m4-discuss
[Top][All Lists]
Advanced

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

Macro argument quoting and ifelse condtional


From: Bill McCarty
Subject: Macro argument quoting and ifelse condtional
Date: Sat, 18 Dec 2004 02:17:10 -0800 (PST)

Hi all,

I'm new to m4 and finding an apparently common idiom
confusing. Can someone help me understand it?

Assuming quotes have been replaced by << and >>, a
typical macro definition of the sort that puzzles me
reads as follows:

define(<<_CF_OUTPUT>>, <<dnl
ifelse(_CF_$1, <<_CF_$1>>, <<>>, <<
divert
CF_$1_OUTPUT
divert(-1)
>>)>>)dnl
dnl

I'm particularly puzzled by the distinction between
the first two arguments of ifelse: _CF_$1 and
<<_CF_$1>>. The ifelse seems to cause the macro to
expand to void unless its argument is double-quouted,
like <<<<TEST>>>>. But, in actual use contexts, its
argument seems generally to be single-quoted. So,
genius that I am <g>, I conclude that I'm missing
something. But, I can't see what.

Thanks for any help!





reply via email to

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