Can someone tell me what is wrong with using the indent program?man indent for detailsSummary The indent program can be used to make code easier to read. It can also convert from one style of writing C to another.
indent understands a substantial amount about the syntax of C, but it also attempts to cope with incomplete and misformed syntax. In version 1.2 and more recent versions, the GNU style of indenting is the default. Regards Leslie Leslie Satenstein Montréal Québec, Canada From: Sébastien Wilmet <swil...@gnome.org> To: desktop-devel-list@gnome.org Sent: Wednesday, November 23, 2016 8:03 AM Subject: Re: Script to format the functions in a C header? On Tue, Nov 22, 2016 at 07:03:02PM +0100, Daiki Ueno wrote: > For what it's worth, I wrote such elisp some time ago: > http://elpa.gnu.org/packages/gnome-c-style.html Cool, added to: https://wiki.gnome.org/Newcomers/Tools-C-language > If anyone is trying to implement the feature somewhere, I would suggest > to provide two separate scripts or commands to do the job: (1) guess the > alignment rule somehow, e.g. from the existing C code, and (2) do the > actual formatting. That would be helpful to avoid unnecessary > formatting changes when creating a patch for existing projects. Why two separate scripts? A single script can have two passes. I think I'll write a new script like I did for lineup-parameters, so that it can be integrated in Vim or Emacs or other text editors (it just reads stdin and write to stdout, or optionally takes file arguments). For the script, the first pass - to determine the columns where to do the alignment - could have two modes: "re-align everything" and "minimal perturbation". For the minimal perturbation, it would look which columns are used the most, and fix the functions that are not aligned to those columns. Also, in the GNOME convention there is something that I don't like and that I would prefer not to do: aligning all the parameter names on the same column (the third column). I prefer aligning the parameter names for each function separately, IMHO it's more readable. Because otherwise, for some functions, there can be a big empty space between parameter types and their names, which doesn't help readability (caused by a long type in another function). -- Sébastien _______________________________________________ desktop-devel-list mailing list desktop-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/desktop-devel-list
_______________________________________________ desktop-devel-list mailing list desktop-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/desktop-devel-list