autoconf-patches
[Top][All Lists]
Advanced

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

Re: Fix m4_join


From: Eric Blake
Subject: Re: Fix m4_join
Date: Sun, 14 Oct 2007 21:48:11 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070728 Thunderbird/2.0.0.6 Mnenhy/0.7.5.666

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

According to Ralf Wildenhues on 10/14/2007 10:07 AM:
> Thanks for your work on this.  I had some year-old notes on m4_join that
> I'll try to dig out, but for now I only have this question for your
> implementation: is it possible to pass a comma as either argument
> (separator, entries) to the current version of m4_join?  Is it possible
> to pass a macro that is defined to expand to comma?  This doesn't seem
> to work right:
>   m4_define([x],[,])
>   m4_define([y],[,])
>   m4_join([x],[y],[z])

Both before and after my patch, m4_join was purely text-based - it did no
macro expansion on either the separator or the entries, and produced a
quoted string (well, a series of concatenated quoted strings) as its
single result.  Below, I'm showing the results prior to the rescan that
removes one more level of quoting (and since everything is quoted, there
are no macros to expand on the rescan).

m4_define([x],[,])
m4_define([y],[,])
m4_join([x],[y],[z])
=> [y][xz]
m4_join([,],[y],[z])
=> [y][,z]

However, you could always do something like the following to get the
separators but not the entries expanded:

m4_join([x],[[y]],[[z]])
=> [[y]][x[z]]
m4_unquote(m4_join([x],[[y]],[[z]]))
=> [y],[z]

Or vice-versa, to keep the separator but expand the entries:

m4_join([[x]],[y],[z])
=> [y][[x]z]
m4_unquote(m4_join([[x]],[y],[z])
=> ,[x]z

What did you have in mind?  Perhaps I can come up with the best m4sugar
idiom for what you want to accomplish.  For example, m4_map_sep currently
expands its separator (although I haven't documented that one yet).

- --
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

iD8DBQFHEuL784KuGfSFAYARAj+4AKC8dtSWaqUHlwGb02FTcTf3xDcdzwCgsey3
HuseG+fwoYFAgSoEUOwGfZQ=
=Qbfr
-----END PGP SIGNATURE-----




reply via email to

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