Re: a simple formatter

From: Amos Jeffries <squid3@dont-contact.us>
Date: Thu, 7 Feb 2008 12:35:18 +1300 (NZDT)

>> Hi all,
>>
>> I wrote a small perl script which fixes (some of) the astyle problems.
>>
>> Before use it, you must adjust the $ASTYLE_BIN variable at the beggining
>> of the formatter.pl file.
>>
>> I am running it using the following command:
>> # find . -name "*.cc" -exec formater.pl \{\} \;
>> but it can take multiple files as arguments.
>>
>> I used it with astyle versions 1.18 and 1.21. I did not do extensive
>> tests, so I am sure it contains bugs :-). Please use it with caution.
>>
>> I tried to implement Alex suggestions. For the problem discussion look
>> at the thread:
>> http://www.squid-cache.org/mail-archive/squid-dev/200801/0019.html
>>
>> This script starts the astyle and attach one filter in its input and one
>> in its output, using pipes.
>>
>> The input filter search for "unsigned int XXXXX:1;" cases and convert
>> them to "unsigned int XXXXX__FORASTYLE__1;".
>>
>> The output filter search for "unsigned int XXXXX__FORASTYLE__1;"
>> patterns and convert them back to the original text.
>> Also it search for the cases "#preprocessor directive {" or "{
>> #preprocessor_directive" and fix them.
>>
>>
>> Do we need something like that? Any comments/suggestions? Any testers?
>>
>> Regards,
>> Christos
>>
>
> Tested.
>

Also, I noticed that the formatter will accept _anything_ given to it as a
filename and create the files. Thats rather nasty when non-valid filename
sequences are entered. ie "--help"

Amos
Received on Wed Feb 06 2008 - 16:35:20 MST

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