m4-discuss
[Top][All Lists]
Advanced

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

Re: Macro + diversion issue


From: Eric Blake
Subject: Re: Macro + diversion issue
Date: Mon, 21 May 2007 21:45:43 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.10) Gecko/20070221 Thunderbird/1.5.0.10 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Daniel Richard G. on 5/21/2007 1:43 AM:
> In fact, it's a fairly simple patch. See attached for my stab at it. (Also, 
> there's a more straightforward test input file.) I did the two-arg 
> divert(), since that seems more natural than coming up with a new/separate 
> builtin for this.
> 
> I think this fills a hole in the core m4 feature set---right now, as I 
> understand it, the only way to send text to a diversion is at the point 
> when the text is actually being written out. With this, you can send text 
> to a diversion in the same way that errprint() sends text to stderr: 
> immediately upon evaluation of the builtin. Without regard to the invoking 
> context.

I'm debating if some other solution might also be helpful, such as a
builtin that adds an extra set of quotes only if it is called while
currently parsing the arguments to a macro.  And it is also worth
considering the proposal for a qindir() builtin in the TODO file.

But so far, it still seems like your solution of expanding the divert
builtin to take a second argument of text that will be output to the
specified diversion seems pretty slick.  I'm not so sure about reverting
back to the current diversion, mainly because it seems weird for
divert(1,) to behave differently than divert(1), particularly in light of
POSIX rules that extra arguments should be ignored.  So if no one else
comments in a couple of days, I will probably commit a variant of your
patch to HEAD only which allows an optional second argument to divert that
will be output immediately to the new diversion, but where the divert
macro always changes the current diversion, as it has always done.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGUmdn84KuGfSFAYARAq1xAJ4s0uq1qZvRZ71OVJzerHR0iGd4nwCgzWd8
BmrKJnCCKSIzJL6tsRuVw+o=
=NeJU
-----END PGP SIGNATURE-----




reply via email to

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