Re: a simple formatter

From: Tsantilas Christos <chtsanti@dont-contact.us>
Date: Tue, 12 Feb 2008 21:20:14 +0200

Some comments about astyle and bcpp formatters. Also I am attaching a
new script which solves the problems mentioned by Amos.

Astyle:
  Looks that it is difficult to fix all problems of astyle.....
Looks that the "#ifdef...#else ..." confuses the astyle. For example is
not possible for me to format well the src/tools.cc and src/stat.cc files.
However with formater.pl script looks that the formated source code is
correct (but in some cases not well formated).

The bcpp in the other hand looks that it does not breaks the code and
has more predictable behaviour. But still is not excellent.....

It changes the current indentation format of squid3 as follows:

1) The class definitions have the following format:

class aclass
{
    public:
       void a func()
 .....
};

2) The if else formated as:

  if(...) {
  }
  else {
  }

3) When there are comments with code in aline the bcpp will try to ident
the comments. For example
  i++; /*a comment*/

 converted to:
  i++; /*a comment*/

There is a command line parameter the -cc which defines in which column
the comments will be placed. You can not tell to bcpp to not format the
comments.

4) The function calls which placed in more than one line formated as:

   afuctioncall(arg1,arg2,.....
       argn..................);

5) Does not indent the multiline preprocessor macros:
#define GENGRAPH(X,Y,Z) \
GRAPH_TITLE(Y,Z) \
GRAPH_PER_MIN(X) \
GRAPH_PER_HOUR(X) \
GRAPH_END

6) When a function/method definitions takes more than one lines does not
formated well:

void aclass::afunction (int a, int b
int c,ind);

7) For the constructors it uses the following format (does not indent
data members) :

aconstructor::aconstructor(....):
data1(...),
data2(...),
data3(...),
{
}

Received on Tue Feb 12 2008 - 12:46:59 MST

This archive was generated by hypermail pre-2.1.9 : Sat Mar 01 2008 - 12:00:09 MST