bug-m4
[Top][All Lists]
Advanced

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

[sr #105855] Multi-op patsubst() and translit()


From: Eric Blake
Subject: [sr #105855] Multi-op patsubst() and translit()
Date: Fri, 11 May 2007 12:33:06 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3 Mnenhy/0.7.5.666

Follow-up Comment #1, sr #105855 (project m4):

Why can't you write your own recursive macro that does this?  translit should
be easy:

# translit(string, regex1, replace1, regex2, replace2, ...)
changequote([,])
pushdef([translit], [ifelse(eval([$# <= 3]), 1,
  [builtin([translit], $@)],
  [translit(builtin([translit], [$1], [$2], [$3]),
     shift(shift(shift($@))))])])

patsubst is a bit harder, since 2.0 is adding the optional resyntax parameter
(you almost need to reverse the argument order, and specify the resyntax
parameter before the list, since it is difficult in recursive algorithms to
get the last argument on the first iteration of action), but still something
you should be able to write a wrapper for.  I'm not sure I see modifying the
builtin to do this, if we can't prove that there is an efficiency issue that
can't be worked around by merely writing wrappers around the existing
builtins.


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/support/?105855>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

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