Re: indentation of c code

2008-08-21 Thread daniel g. siegel
indent was not enough for me, i found some corner cases where it just
did not work. but i found a great alternative: uncrustify [1]

it really works great and i can recommend it to anyone as it has also
some aligning features.

i created a config file for cheese, which uses some quite gnome standard
whatever ;) you can find that config here [2]

daniel

[1]: http://uncrustify.sourceforge.net/
[2]: http://home.cs.tum.edu/~siegel/files/cheese-indent.cfg

On Mo, 2008-08-18 at 08:52 +0200, BJörn Lindqvist wrote:
> 2008/8/17 daniel g. siegel <[EMAIL PROTECTED]>:
> > hi all!
> >
> > i just wanted to know if someone out there has already an option file or
> > a small script for gnu indent to indent c code to the "gnome standard"?
> 
> There is no GNOME standard for indenting C code -- every project use
> their own indentation style (unfortunately). But to reformat a file to
> an indentation style many projects use, you can just run "indent"
> without any arguments.
> 
> 
-- 
this mail was sent using 100% recycled electrons

daniel g. siegel <[EMAIL PROTECTED]>
http://home.cs.tum.edu/~siegel
gnupg key id: 0x6EEC9E62
fingerprint: DE5B 1F64 9034 1FB6 E120 DE10 268D AFD5 6EEC 9E62
encrypted email preferred


signature.asc
Description: This is a digitally signed message part
___
desktop-devel-list mailing list
desktop-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/desktop-devel-list

Re: indentation of c code

2008-08-19 Thread Alan Cox
> http://developer.gnome.org/doc/guides/programming-guidelines/code-style.html
> 
> So, basically GNOME was supports to be using the linux kernel coding
> style to begin with, but that has probably been watered out by now.

For the kernel coding style its

indent -npro -kr -i8 -ts8 -sob -l80 -ss -ncs -cp1 -il0

(which is why its a script scripts/Lindent in the kernel distribution)

Alan
___
desktop-devel-list mailing list
desktop-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/desktop-devel-list


Re: indentation of c code

2008-08-19 Thread Kjartan Maraas
ma., 18.08.2008 kl. 08.52 +0200, skrev BJörn Lindqvist:
> 2008/8/17 daniel g. siegel <[EMAIL PROTECTED]>:
> > hi all!
> >
> > i just wanted to know if someone out there has already an option file or
> > a small script for gnu indent to indent c code to the "gnome standard"?
> 
> There is no GNOME standard for indenting C code -- every project use
> their own indentation style (unfortunately). But to reformat a file to
> an indentation style many projects use, you can just run "indent"
> without any arguments.
> 
Once upon a time there was this:

http://developer.gnome.org/doc/guides/programming-guidelines/code-style.html

So, basically GNOME was supports to be using the linux kernel coding
style to begin with, but that has probably been watered out by now.

Cheers
Kjartan


___
desktop-devel-list mailing list
desktop-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/desktop-devel-list

Re: indentation of c code

2008-08-18 Thread daniel g. siegel
i tried to play with gnu indent but i dont like some specific parts,
e.g.

some_function_with_a_very_long_name (GtkWidget *widget, GdkEvent event,
 gpointer data)
-> either i would put every argument on its line or all of those on just
   1 line..

primary =
g_strdup_printf (_
 ("some long text %s"),
 list_length);

-> sorry, but no sane programmer would do stuff like that...

command_line =
  g_strdup_printf ("gnome-open mailto:?subject='%s'", _("Media
files"));
-> same as above

gtk_action_group_set_sensitive (cheese_window->actions_flickr,
TRUE);
gtk_action_group_set_sensitive (cheese_window->actions_fspot,
TRUE);
gtk_action_group_set_sensitive
(cheese_window->actions_account_photo,
TRUE);

-> why should the last TRUE be on a separate line if those above arent?

and so on.. mostly the problems are with long lines, where the logic is
more important than a strict rule, which says you dont have to go above
a certain limit (as the -l parameter does)

my settings to get the above were:

indent file.c -i2 -psl -di0 -bl -bli0 -nce -d0 -cli0 -pcs -nfc1 -nut -lp
-hnl -nbbo --ignore-newlines -T GtkWidget -T GtkWindow -T
CheeseWindow 

would be great if someone could help me with this!

daniel



On Mo, 2008-08-18 at 08:52 +0200, BJörn Lindqvist wrote:
> 2008/8/17 daniel g. siegel <[EMAIL PROTECTED]>:
> > hi all!
> >
> > i just wanted to know if someone out there has already an option file or
> > a small script for gnu indent to indent c code to the "gnome standard"?
> 
> There is no GNOME standard for indenting C code -- every project use
> their own indentation style (unfortunately). But to reformat a file to
> an indentation style many projects use, you can just run "indent"
> without any arguments.
> 
> 
-- 
this mail was sent using 100% recycled electrons

daniel g. siegel <[EMAIL PROTECTED]>
http://home.cs.tum.edu/~siegel
gnupg key id: 0x6EEC9E62
fingerprint: DE5B 1F64 9034 1FB6 E120 DE10 268D AFD5 6EEC 9E62
encrypted email preferred


signature.asc
Description: This is a digitally signed message part
___
desktop-devel-list mailing list
desktop-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/desktop-devel-list

Re: indentation of c code

2008-08-18 Thread Sandy Armstrong

Jason D. Clinton wrote:
On Mon, Aug 18, 2008 at 7:22 AM, Dodji Seketeli <[EMAIL PROTECTED] 
> wrote:


BJörn Lindqvist a écrit :

[...]


There is no GNOME standard for indenting C code -- every
project use
their own indentation style (unfortunately). But to reformat a
file to
an indentation style many projects use, you can just run "indent"
without any arguments.


I am sorry, but I think there is a GNOME standard for indenting C
code.
It's at
http://developer.gnome.org/doc/guides/programming-guidelines/book1.html,
  chapter

http://developer.gnome.org/doc/guides/programming-guidelines/code-style.html.

If GNOME C projects use their own indentation style, I think it's
just because only a few people have read that documentation or
because GNOME as a project does not enforce it that much.

GTK+ uses the GNU indentation style that is documented at
http://www.gnu.org/prep/standards/standards.html.


I would love to clean up indentation in my module but I fear that it 
creates useless svn blame output henceforth.


svn blame has an option to ignore whitespace, fyi.

Sandy
___
desktop-devel-list mailing list
desktop-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/desktop-devel-list

Re: indentation of c code

2008-08-18 Thread Jason D. Clinton
On Mon, Aug 18, 2008 at 7:22 AM, Dodji Seketeli <[EMAIL PROTECTED]> wrote:

> BJörn Lindqvist a écrit :
>
> [...]
>
>  There is no GNOME standard for indenting C code -- every project use
>> their own indentation style (unfortunately). But to reformat a file to
>> an indentation style many projects use, you can just run "indent"
>> without any arguments.
>>
>
> I am sorry, but I think there is a GNOME standard for indenting C code.
> It's at
> http://developer.gnome.org/doc/guides/programming-guidelines/book1.html,
> chapter
> http://developer.gnome.org/doc/guides/programming-guidelines/code-style.html
> .
>
> If GNOME C projects use their own indentation style, I think it's just
> because only a few people have read that documentation or because GNOME as a
> project does not enforce it that much.
>
> GTK+ uses the GNU indentation style that is documented at
> http://www.gnu.org/prep/standards/standards.html.
>

I would love to clean up indentation in my module but I fear that it creates
useless svn blame output henceforth.
___
desktop-devel-list mailing list
desktop-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/desktop-devel-list

Re: indentation of c code

2008-08-18 Thread Havoc Pennington
Hi,

On Mon, Aug 18, 2008 at 8:43 AM, Thomas Thurman <[EMAIL PROTECTED]> wrote:
> If you're using an 8-char indent with GNU style, does that mean you go
>
>  if (something)
>  <--eight-->{
>  <--eight--><--eight-->printf("I like cheese\n");
>

Yes, it would do that I think. Eight chars with GNU braces is kind of
twisted, nobody does that; either the wide spacing or the braces on
separate lines serve a similar function, doing both is kind of
overkill. (And 2-char spacing with linux-kernel-style braces is very
cramped, nobody does that either, at least not many)

Havoc
___
desktop-devel-list mailing list
desktop-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/desktop-devel-list


Re: indentation of c code

2008-08-18 Thread Thomas Thurman
Ysgrifennodd Dodji Seketeli:
> http://developer.gnome.org/doc/guides/programming-guidelines/code-style.html.

Does anyone have a good idea about modelines at the tops of files?  That 
page ought really to cover them, but it doesn't mention them.  We have a 
bug open about it () 
in Metacity.

If you're using an 8-char indent with GNU style, does that mean you go

 if (something)
 <--eight-->{
 <--eight--><--eight-->printf("I like cheese\n");

or is the indent four in that case?

I actually prefer an 8-character indent, but Metacity uses two 
throughout, and it's a bit late to change.  I wish source control worked 
on the basis of tokens rather than lines, as though we were still on 
punched cards, so it wouldn't matter if you reformatted a block.

Thomas

-- 
Thomas Thurman, tthurman at gnome, http://blogs.gnome.org/tthurman
Shell Room
___
desktop-devel-list mailing list
desktop-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/desktop-devel-list


Re: indentation of c code

2008-08-18 Thread Dodji Seketeli

BJörn Lindqvist a écrit :

[...]


There is no GNOME standard for indenting C code -- every project use
their own indentation style (unfortunately). But to reformat a file to
an indentation style many projects use, you can just run "indent"
without any arguments.


I am sorry, but I think there is a GNOME standard for indenting C code.
It's at 
http://developer.gnome.org/doc/guides/programming-guidelines/book1.html, 
   chapter 
http://developer.gnome.org/doc/guides/programming-guidelines/code-style.html.


If GNOME C projects use their own indentation style, I think it's just 
because only a few people have read that documentation or because GNOME 
as a project does not enforce it that much.


GTK+ uses the GNU indentation style that is documented at 
http://www.gnu.org/prep/standards/standards.html.


Best wishes,

Dodji.
___
desktop-devel-list mailing list
desktop-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/desktop-devel-list


Re: indentation of c code

2008-08-17 Thread BJörn Lindqvist
2008/8/17 daniel g. siegel <[EMAIL PROTECTED]>:
> hi all!
>
> i just wanted to know if someone out there has already an option file or
> a small script for gnu indent to indent c code to the "gnome standard"?

There is no GNOME standard for indenting C code -- every project use
their own indentation style (unfortunately). But to reformat a file to
an indentation style many projects use, you can just run "indent"
without any arguments.


-- 
mvh Björn
___
desktop-devel-list mailing list
desktop-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/desktop-devel-list