m4-discuss
[Top][All Lists]
Advanced

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

Re: IF / ELSE / ENDIF macros for M4


From: Mr. Clif
Subject: Re: IF / ELSE / ENDIF macros for M4
Date: Tue, 11 May 2021 08:36:17 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0

Hello again,

what do you all think about including something like these with the other examples in the upcoming release?

Another person wanting this a while back:
    https://stackoverflow.com/questions/19059432/triple-conditional-check-with-ifdef-in-m4

    Any thoughts? :-)
    Clif

On 4/7/21 9:58 AM, Mr. Clif wrote:
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]