autoconf-patches
[Top][All Lists]
Advanced

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

Re: improve AS_ESCAPE


From: Paolo Bonzini
Subject: Re: improve AS_ESCAPE
Date: Tue, 03 Mar 2009 10:21:18 +0100
User-agent: Thunderbird 2.0.0.19 (Macintosh/20081209)

> I currently don't see the need for it.  But you can also just add those
> two lines of example to the @comment if you prefer that to nuking.

I'm thinking of an alternate implementation.  Sorry for coming up late
with this.  What if instead you leave AS_ESCAPE as it was, and instead
add _AS_ESCAPE1/2/3/4 for Autoconf's private usage?  That would be
implemented like this:

m4_define([AS_ESCAPE],
[m4_if([$2], [],
       [m4_if(m4_len([$1], m4_len(m4_translit([[$1]], [$2])),
              [$1], [_AS_ESCAPE($@)])],
       [_AS_ESCAPE4([$1], [`], ['], [""], [$])])

m4_define([_AS_ESCAPE],
[m4_bpatsubst([$1], [[$2]], [\\\&])])

m4_define([_AS_ESCAPE1],
[m4_if(m4_index([$1], $2), -1,
       [$1],
       [_AS_ESCAPE([$1], [$2])])])

m4_define([_AS_ESCAPE2],
[]dnl Use $2$2 for the sake of specifying "" for $3
[m4_if(m4_index(m4_translit([$1], [$3], [$2$2]), $2), -1,
      [$1],
      [_AS_ESCAPE([$1], [$2])])

m4_define([_AS_ESCAPE3],
[]dnl Use one extra $2 for the sake of specifying "" in $3/$4
[m4_if(m4_index(m4_translit([$1], [$3$4], [$2$2$2]), $2), -1,
      [$1],
      [_AS_ESCAPE([$1], [$2])])

m4_define([_AS_ESCAPE4],
[]dnl Use one extra $2 for the sake of specifying "" in $3/$4/$5
[m4_if(m4_index(m4_translit([$1], [$3$4$5], [$2$2$2$2]), $2), -1,
      [$1],
      [_AS_ESCAPE([$1], [$2])])

Paolo




reply via email to

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