m4-patches
[Top][All Lists]
Advanced

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

Re: argv_ref patch 21: push builtin tokens through $@ and m4wrap


From: Eric Blake
Subject: Re: argv_ref patch 21: push builtin tokens through $@ and m4wrap
Date: Tue, 15 Apr 2008 21:30:35 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Eric Blake <ebb9 <at> byu.net> writes:

> 
> One nice bit about this patch is we now match Solaris m4 behavior on this
> (admittedly contrived) testcase:
> m4wrap(`define(foo,')m4wrap(defn(`divnum'))m4wrap(`)foo
> ')
> => 0
> 

Just to set the record straight, I did more testing of how other 
implementations behave with builtin tokens given to m4wrap.  The above quote is 
wrong, since neither Solaris nor BSD handle it the way patched GNU M4 does.  
But I was able to find at least one case where the other two implementations 
would support a builtin token in the argument to m4wrap:

BSD$ m4
m4wrap(`define(foo,')m4wrap(defn(`divnum'))m4wrap(`)-foo-
')dnl
m4: unexpected end of input, unclosed parenthesis:
   stdin at line 3
BSD$ m4
m4wrap(`define(foo,'defn(`divnum')`)-foo-
')dnl
-0-
BSD$

Solaris$ /usr/xpg4/bin/m4
m4wrap(`define(foo,')m4wrap(defn(`divnum'))m4wrap(`)-foo-
')dnl
--
Solaris$ /usr/xpg4/bin/m4
m4wrap(`define(foo,'defn(`divnum')`)-foo-
')dnl
--
Solaris$ /usr/xpg4/bin/m4
define(q,``$@'')m4wrap(`define'(q(foo,defn(`divnum')))`-foo-
')dnl
-0-
Solaris$

So this statement that I added to the GNU M4 manual is particularly 
true: "However, for portability, it is better to defer the evaluation of `defn' 
along with the rest of the wrapped text".

-- 
Eric Blake






reply via email to

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