On 8/24/06, Kyrre Nygård <[EMAIL PROTECTED]> wrote:


Perhaps you could share with us whatever scripts you've written?

Thanks!


Well, my scripts aren't magic. They are pretty simple. Here's few (not
scripts, these are valid Vim regexps):

:%s/).*\n.*{/) {/g

:%s/) *{/) {/g

:%s/\t/    /g

:%s/^ *$//g

:%s/ *$//g

1) Move curly brackets from the next line to the end of an expression.
2) Clean up some crazy bracket placements.
3) Remove tab characters and replace them with 4 spaces. This may mess
some multiline comments.
4) Clean all lines, which contain only spaces.
5) Almost same as above. Cleans up spaces at the end of the line.

If you run those one after another, the C source file should be much
nicer to read and manipulate. The idea should be quite clear and the
same regexp rules should be possible to be applied to other
regexp-savvy programs/interpreters, so it should be no problem to
create a set of scripts, which use those rules to modify a set of
files at one run. Some of those regexps are applicable (with minor
modifications) to other target languages also.



       -Matti
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to