I have a large number of c++ source files that I'd like to transform by expanding a single function macro that I specify and leave all other preprocessing directives untouched. The arguments to the macro will, in general involve parens and braces and paren protected commas, so it does not seem straight forward to do this with sed and kin.
Update: Our code has made heavy use of macros to generate boiler plate (eg helper code for swig). As we have better figured out how to do certain things, various of the macros no longer do anything terribly interesting (eg just declare some functions), and many people complain that they make the code harder to read. I'd like to expand the less interesting macros that expand to simple C++ code.
I did this sort of things by using regular expressions in python. You can write a fairly short script to process a large number of files and run a few regular expressions on each of them. Regular expressions would probably be the most time consuming part.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With