Hi all,
I believe, I solved (most of?) the problems in astyle.
I am attaching the new version of the formatter.pl
I test it only using the astyle version 1.21.
This version does simpler hooks than the previous versions.
The input filter:
1) Converts patterns
unsigned int aparam:1;
to
unsigned int aparam__FORASTYLE__1;
2) Scans for #endif/#else/#if patterns and adds at input the line:
"//__ASTYLECOMMENT__\n"
The comment is important, just a simple newline will not work.
Example 1:
#endif /*A comment*/
{
f++;
converted to:
#endif /*A comment*/
//__ASTYLECOMMENT__
{
f++;
Example 2:
/* #endif A comment*/
{
f++;
converted to:
/* #endif A comment*/
//__ASTYLECOMMENT__
{
f++;
The output filter just replaces the __FORASTYLE__ with a " : " and
removes the line "//__ASTYLECOMMENT__"
Although I looked carefully without finding any bad formated code maybe
there are still exists problems.
Also I am attaching a simple script I used to check the formated code.
This scripts removes any space, tabs and newlines from the original file
and the formated file, and compare their md5 signatures.This script
requires the tr and md5sum utilities. I test it only on a linux system.
This script can not detect bad formated code but maybe can detect bad
modifications (eg source code blocks removal) on source code.
Running this script I found 5 files with different md5 signatures but
all of these files had formating modifications similar to the following:
From
if (i<t) /*A comment*/
{
...
}
To
if (i<t) { /*A comment*/
...
}
Regards,
Christos
This archive was generated by hypermail pre-2.1.9 : Sat Mar 01 2008 - 12:00:09 MST