Is it feasible to do this in TextPad using some combination of regular expression search-and-replace and a macro? Has anybody done it?
I was thinking of writing a WSH script for use as a TextPad tool that could do this, but it would nice if there was alternative out there.
The formatting I want to pretty standard:
- blocks start and end on separate lines from statements
- successive indentation based on block nesting level
- space around most operators
..etc
Formatting C and similar block-structured source code
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
-
Ed
Re: Formatting C and similar block-structured source code
Somewhere in this forum someone (probably Andreas!) pointed us to a freeware tool gc from http://perso.club-internet.fr/cbeaudet/
I found this was excellent apart from screwing up the format of comments. Most of the formatting can be changed to suit by means of a set-up file. For instance mine tells it to leave the comments alone! I can supply the set-up I use if it's of any interest.
I found this was excellent apart from screwing up the format of comments. Most of the formatting can be changed to suit by means of a set-up file. For instance mine tells it to leave the comments alone! I can supply the set-up I use if it's of any interest.
-
Leah O'Connor
Re: Formatting C and similar block-structured source code
I would be interested in seeing the setup file you mention, so I can clean up
some C files that were messed up by using editors with different tab settings. I just started using TextPad 4.5.0 and I thought my older version allowed me to change indentation style from
if( something){
doThis();
}
to
if( something)
{
doThis();
}
But I cannot seem to find anything to allow me to do this. Is it possible that my old version of TextPad was using a tool for this? I still have the older veriosn of TextPad on my computer at home, but my work hard drive was reformatted before the new version of TextPad was installed. How do I tell what is an add on tool and what is part of TextPad? If I have tools on my computer at home, can I move them to my computer at work?
some C files that were messed up by using editors with different tab settings. I just started using TextPad 4.5.0 and I thought my older version allowed me to change indentation style from
if( something){
doThis();
}
to
if( something)
{
doThis();
}
But I cannot seem to find anything to allow me to do this. Is it possible that my old version of TextPad was using a tool for this? I still have the older veriosn of TextPad on my computer at home, but my work hard drive was reformatted before the new version of TextPad was installed. How do I tell what is an add on tool and what is part of TextPad? If I have tools on my computer at home, can I move them to my computer at work?