The CppMunge.py tool

You will find a script written in Python called CppMunge.py (it needs v2.3 or later of Python installed). While use of it is optional, it does make your life a good deal easier and TnFOX itself uses it. It provides the following features: CppMunge was designed to modify in-place C++ source without making its changes too noticeable. A previous solution generated a separate output file which had the problem of debugging referring to the wrong source file plus I myself kept altering the munged copy to fix bugs rather than its original. This new solution is much more convenient.

However it can slow things down a bit as the translation & error codes file needs to be loaded, decoded, modified and written out for each and every source file compiled. To avoid this I wrote another python script called UpdateMunged.py which simply scans the source directory and if any munged files are newer than a time stamp file, it calls CppMunge.py on them as a child process. To permit UpdateMunged to distinguish between mungeable files and normal ones, munged files use a .cxx extension rather than .cpp. Further optimisations include CppMunge not writing out anything unless it has changed.

You can disable features in either utility via commmand line options - try running CppMunge.py with -help to see what options it supports.

Note:
The C++ parser used by CppMunge is extremely simple and likely to get confused by anything complicated so do not modify the lines it changes AT ALL. You might also want to keep method definitions well spaced and on separate lines like I naturally tend to write my C++!

(C) 2002-2009 Niall Douglas. Some parts (C) to assorted authors.
Generated on Fri Nov 20 18:31:36 2009 for TnFOX by doxygen v1.4.7