Are there any pitfalls when using FPP to manipulate non-Fortran text files?
We have some text data files. We want to build multiple versions of the data files from one master copy, using FPP and #ifdef #else #endif. I've tried this and it does work. But I am aware that FPP was not designed to do this, but only to preprocess Fortran code. I am worried that there could be pitfalls: certain text sequences that will cause behaviour that I don't want.
The text files are code-like: they contain lines like these below. They do not contain lines starting with the hash character #. The lines could be any length (I worry that there could be a maximum length.)
We are running FPP like this: fpp /P /undef /DPREPROCVAR=1 inputfile.txt outputfile.txt
Are there any pitfalls with this approach or things I should be aware of?
Thanks in advance
I hate contradicting Steve, so I'm not *exactly* doing that ... however, if it's working for you, then please continue to use it.
it is true that fpp tries to ever-so-briefly parse the syntax, but it is not a complete compiler.
What you will need to worry about, however, is the line length. Fpp will try to re-format lines wider than 132 characters.
Thanks Lorri. In my experience you cannot go wrong following Steve's advice, so I have already switched over to using M4 as suggested by mecej4! I used a GNU Windows build rather than cygwin.
It did seem to be working fine with FPP but we feel more confident using M4. We have no long lines at the moment but it could happen in future