Board index » off-topic » has CW automatic reformat of source or somwhat like 'indent', but better ?

has CW automatic reformat of source or somwhat like 'indent', but better ?


2005-08-28 11:53:13 PM
off-topic15
When inheriting alien source codes, I bring it often into an optical
form, that I personally feel more readable (to me). While doing this,
I also try to undersand the source - so it could not be the worst idea
;-).
But sometimes the packet is too complex - so I would let the machine
do the cosmetic work. I tried out "indent" but it is not comfortable
to me, because it must be done for every file in a complex sub dir
hierarchy (see other reasons below). MAKE + indent is also no
solution, because I know no way to let make do it for *.h files :-(
So, what I could imagine ist on every load of every source file to
invoke some CW internal macro which does the pretty writing of the
source. I did some similiar on API_macro_handler to strip trailling
white spaces, so I am familiar with "how to invoke".
Q: Is there any internal pretty printer / indent-tool ?
Other reasons, why I do not found my lovely indent tool? See this
code:
typedef struct
{
int a; /* this is the first member */
int b; /* the second meber needs */
/* a little bit more explanation */
const char* ptr; /* while tis is only an exaple */
/* to demonstrate that humans */
/* often use more columns style*/
} TS_myStruct, *PTS_myStruct;
const long Konstante = 123L;
short sh = 0;
unsigned long int ulX = 1L;
indent would make something like;
typedef struct
{
int a;
/* this is the first member */
int b;
/* the second meber needs */
/* a little bit more explanation */
const char* ptr;
/* while tis is only an exaple */
/* to demonstrate that humans */
/* often use more columns style*/
} TS_myStruct, *PTS_myStruct;
const long Konstante = 123L;
short sh = 0;
unsigned long int ulX = 1L;
In my eyes, this is bullshit. I would fall in the trap and read:
/* this is the first member */
int b;
while 'b' is the second member. And in MY eyes it is ugly. Of course,
some of you would never do the plenking her:
const long Konstante = 123L;
short sh = 0;
unsigned long int ulX = 1L;
but, hey, it's me, and the life is to short to learn foreing style
=:-)
Mai Kee
--
Hamster beisst sich durch ...
 
 

Re:has CW automatic reformat of source or somwhat like 'indent', but better ?

Quote
Q: Is there any internal pretty printer/indent-tool?
The Zeus for Windows programmer's editor:
www.zeusedit.com
runs the "Artistic Style" tool via a macro script to perform
it's code pretty feature and it seems to do a nice good job
of re-indenting source code.
You can get the "Artistic Style" utility from this web page:
astyle.sourceforge.net
Jussi Jumppanen
Author: Zeus for Windows
Note: Zeus is shareware (45 day trial).