Re: Process only sections of a file? (newbie)
Gary <[email protected]>
| Newsgroups | gmane.comp.gnu.m4.general |
|---|---|
| Message-ID | <[email protected]> |
Gary wrote: > Eric Blake wrote: >> what you CAN do is redefine m4 builtins to have a different name, so >> that they no longer clash with the rest of your text. The manual >> gives several examples of this, but a short summary would be: >> >> define(`m4include', defn(`include'))undefine(`include') > > Ah, okay. Thanks. When I read that section of the manual I didn't twig > that you could also redefine the built in macros. I guess I can't redefine brackets, can I :)) What I am basically trying to do is replace gpp - http://en.nothingisreal.com/wiki/GPP (which works fine, btw, but seems to lack any kind of support or ongoing development) - with m4, for the purpose of building php scripts from smaller, self-contained, "chunks". To make sure I don't include the same code twice, each chunk's file uses a typical C/C++ -like guard: ,---- | #ifndef FOO | #define FOO | /* | php code | */ | #endif `---- That's pretty easy syntax to read, for anyone who has ever used C. But the equivalent m4 would be something like: ,---- | ifdef(`FOO', `', | define(`FOO') | /* | php code | */ | ) `---- (I think! although actually it doesn't seem to work if the define line is included, so presumably I am going something wrong there) and I'm worried that the end of the ifndef at the end of the file will just get "lost" because it is very similar to php syntax and so far away from the start of the macro.