[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: the C coding style in lua sources
- From: malkia <malkia@...>
- Date: Wed, 26 Jan 2011 15:25:55 -0800
Hi Francois,
I guess you can use "astyle" lua source code, and recompile it.
http://astyle.sourceforge.net/
And if astyle does not work, there are probably other formatting tools.
Thanks,
Dimiter "malkia" Stanev.
On Wed, Jan 26, 2011 at 6:57 AM, François Perrad
<francois.perrad@gadz.org> wrote:
> This is not about aesthetics.
> The sources use a consistent coding style and it is a right thing.
>
> But this style is not friendly with some tools like debugger or code
> coverage analysor.
> For example (from luaB_select):
> if (i < 0) i = n + i;
> else if (i > n) i = n;
> could be rewritten :
> if (i < 0)
> i = n + i;
> else if (i > n)
> i = n;
> This allows to set breakpoint on condition and on instruction,
> and the code coverage analysis doesn't mix condition & instruction.
>
> The attached script lgrep allows to find all occurences
> $ lgrep "if %b()%s+%l" *.c *.h
>
> Now, a personal preference, please remove also the trailing spaces
> $ lgrep "%s$" *.c *.h
>
> François
>
> Note: You could find a full example of code coverage here
> http://fperrad.github.com/lua-TestMore/cover_lua520/src/index.html
>
>
--
Dimiter "malkia" Stanev,
ICQ: 21875894
malkia@mac.com
malkia@gmail.com