IF / ELSE / ENDIF macros for M4
"Mr. Clif" <[email protected]> Wed, 7 Apr 2021 09:58:08 -0700
| Newsgroups | gmane.comp.gnu.m4.general |
|---|---|
| Message-ID | <[email protected]> |
Greetings, I heard a long time ago that CPP was derived from M4, and read that a few folks including myself have looked for IF / ENDIF type macros to use on other projects. CPP is not ideal in that it wants to take extra steps like tokenizing the source. Here is a post from someone else looking: https://stackoverflow.com/questions/50549946/conditional-compilation-interpretation-using-m4/66978338#66978338 So not finding anything like this, I wrote some that seem to work pretty well. Here they are: http://www.eugeneweb.com/wiki/Sites/M4Macros I defined the names without the #'s eg. IF, ELSE, ENDIF, etc... Also M4 requires parentheses to hold the arguments where CPP does not (at least for most of these). I also added a selective invoke, to protect macros with side effects from invocation in an unselected block. I was wondering if they pass muster, if the devs might consider including them or something similar in M4's list of examples. <https://stackoverflow.com/posts/66978338/timeline> Best, Clif