m4-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

IF / ELSE / ENDIF macros for M4


From: Mr. Clif
Subject: IF / ELSE / ENDIF macros for M4
Date: Wed, 7 Apr 2021 09:58:08 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0

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. 

    Best,
    Clif

reply via email to

[Prev in Thread] Current Thread [Next in Thread]