On 2009-07-12 11:30+0200 Werner Smekal wrote:

> Hi Alan,
>
> sorry for kicking in in this discussion late, but you'll find many more 
> programs if you search for
>
> C code beautifier
>
> astyle is quite outdated and there are also some programs out there, which 
> are (more) cross platform. Although this is not a problem a dedicated guy can 
> regularily run the beautifier (with cmake?) on the code using only one OS.

Hi Werner:

Your post inspired me to do some additional searching.

I agree cross-platform is a "would be nice" but not an essential
requirement.  However, I do think the beautifier application should be able
to handle C++ (which eliminates indent since the documentation there
specifically says not for C++).  So I changed the above search to

"C++" code beautifier

and indeed there are lots of hits.  One of those is a HOWTO,
http://www.faqs.org/docs/Linux-HOWTO/C-C++Beautifier-HOWTO.html which
although dated (2003) has some useful ideas (such as diffing the object
files produced) for verifying that code beautification does not screw up the
code.  From the list below it mentions astyle and bcpp.

The Debian "apt-cache search beautifier" command finds bcpp, and uncrustify
from the list below as well as UniversalIndentGUI,
http://universalindent.sourceforge.net/, a GUI frontend for beautifiers.
That GUI supports everything from the list below (and much more if one of
those does not pan out).

>From the combination of my searches and following links here is a list of
possibilities I think would be worth further investigation.

1. uncrustify, http://uncrustify.sourceforge.net/.  Under active
    development. Version 0.53 was released on 2009-05-16.  "highly
    configurable, easily modifiable source code beautifier.  [...] 350
    configurable options...".  Cross Platform. C, C++, C#, ObjectiveC, D,
    Java, Pawn and VALA.

2. astyle, http://astyle.sourceforge.net/.  Under active development.
    Version 1.23 was released on 2009-02-17. "Source code indenter,
    formatter, and beautifier [...]". Cross Platform C, C++, C# and Java.

3. bcpp, http://invisible-island.net/bcpp/. Written in 1995, tweaked by
    somebody else since. Unix only (I think). C, C++.

I have put uncrustify first on the list because from the description it
sounds like the best possibility.  350 options sounds like it should just
about cover every C/C++ code style known to man!  astyle comes next because
it is also actively developed (so it may no longer be as dated as you think)
and does appear to have quite a few configuration options (although not
nearly as many as uncrustify).  Both uncrustify and astyle are
cross-platform.  bcpp came last because I am concerned about how actively it
is being developed. On the other hand, it was mentioned a lot of places so
that is why it remains on the list at all.  It appears only to be available
for Unix.

What is needed now is a volunteer with a keen eye for C/C++ style issues to
evaluate uncrustify-0.53 (and the latest versions of the others on the list
if uncrustify is unsuitable) to find the combination of options which
enforces the consensus on style that we have reached (i.e., the style
details mentioned on list by Geoff which all core developers appeared to be
willing to go along with).  I am tempted to volunteer for this myself
because I think it is really important to come up with a method of
converting PLplot source code to a consistent style after all the effort
that has gone into thinking about the ideal PLplot code style.  However, I
don't have a keen eye for C/C++ style issues since I am not as experienced
in those languages as other PLplot developers.  Thus, if I do this I might
come up with a set of uncrustify options that enforce every style issue that
Geoff brought up but still leave some "obvious" style issue in the result
that will require additional work to fix.  Thus, it would probably be best
if someone else volunteered for this task.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to