On Sun, Jul 12, 2009 at 01:21:55PM -0700, Alan Irwin wrote: > On 2009-07-12 10:19-0700 Alan W. Irwin wrote: > > > 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. > > Well, we still need that style-conscious volunteer, but to get the ball > rolling I just committed uncrustify.cfg in the top-level source tree which I > think already does a pretty good job of enforcing the consensus style > we have been discussing. > > uncrustify-0.53 has a number of example style files including the default > style, defaults.cfg (which defines some 350 options). One of those style > files is ben2.cfg which is the favorite style of the author of uncrustify. > It only mentions ~60 options so I assume those are the most > important options, and the code uses defaults.cfg for the rest. I > edited ben2.cfg to create uncrustify.cfg. > > You can run it like this: > > ~software/uncrustify/install/bin/uncrustify -c uncrustify.cfg -f \ > drivers/qt.cpp |less > > where the application pathname must point to the (latest) 0.53 version of > uncrustify. I adjusted uncrustify.cfg following the documentation in > defaults.cfg until the results looked consistent with what was mentioned on > list. In addition to using less to view stdout, I have also used the > programme to create a local "styled" form of qt.cpp which builds without > issues. > > However, when looking at the "styled" source code I noticed that line > breaking on one ugly long line starting with > > static DrvOpt qt_options > > gives an even uglier (but still correct) result. I presume it is the > combination of alignment options (which I didn't change from Ben's version) > which need tweaking here. Anyhow, uncrustify.cfg needs some more work > following the documentation in defaults.cfg (from uncrustify-0.53), and > patches or commits to that effect would be most welcome.
Alan, This looks like a power full tool that should do what we want. Things I noticed from a quick check of the output. 1) It's very free with spaces at the moment, for example aligning the = sign where you have a series of variable assignments. (Not necessarily a criticism, but a comment and a potential change of style.) 2) It adds spaces in between function names and brackets, e.g. sin ( x ) not sin(x). I don't particularly like a space before the ( since I think it can make it less clear that sin is a function rather than a variable at a quick glance. I don't mind the spaces inside. Particularly with lots of arguments I think this is a good idea. 3) It doesn't at the moment fix up C comments with * to our "style", or at least consistently. I suspect that line breaks will always be to some degree a subjective problem depending on the precise code and so any automated system might not do exactly what you would have done. All these can, I'm sure, be fixed. I've only tried on C / C++ code. Andrew ------------------------------------------------------------------------------ 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