[Top][All Lists]

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

passing a parenthesis character

From: Denis Valois
Subject: passing a parenthesis character
Date: Thu, 8 Mar 2018 22:29:58 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

Hello m4 wizards,

My problem is passing a single parenthesis as a macro argument.  I do not understand m4 behavior; this tells me that I miss some fundamentals.

example 1:  notice the litteral `('
    index(`abcdef', `(')
this works perfectly with the expected results -1.

example 2: use of a macro
    define(`c', `(')
    index(`abcdef', c)
Here we have "ERROR: end of file in argument list".  This is because the macro c is expanded before index so the parenthesis are unbalanced.

Other approaches such as
    builtin(`index', `abcdef', `c')
are either expanding to a wrong result or generate a run-time error.  I simply do not see how to pass a macro defined with a parenthesis as argument.

Thanks in advance for help.
Denis Valois/
PGP KeyID 0xB5418E1A

reply via email to

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