* data/m4sugar/m4sugar.m4: Update from CVS Autoconf.

This commit is contained in:
Akim Demaille
2002-05-03 08:26:55 +00:00
parent 77f6f42074
commit 1f41899519
2 changed files with 23 additions and 5 deletions

View File

@@ -422,8 +422,8 @@ m4_define([m4_bmatch],
[m4_if([$#], 0, [],
[$#], 1, [],
[$#], 2, [$2],
m4_bregexp([$1], [$2]), -1, [$0([$1], m4_shiftn(3, $@))],
[$3])])
[m4_if(m4_bregexp([$1], [$2]), -1, [$0([$1], m4_shiftn(3, $@))],
[$3])])])
# m4_map(MACRO, LIST)
@@ -437,6 +437,20 @@ m4_define([m4_map],
m4_map([$1], m4_cdr($2))])])
# m4_map_sep(MACRO, SEPARATOR, LIST)
# ----------------------------------
# Invoke MACRO($1), SEPARATOR, MACRO($2), ..., MACRO($N) where $1, $2... $N
# are the elements of LIST (which can be lists themselves, for multiple
# arguments MACROs).
m4_define([m4_map_sep],
[m4_if([$3], [[]], [],
[$1(m4_fst($3))[]dnl
m4_if(m4_cdr($3),
[[]], [],
[$2])[]dnl
m4_map_sep([$1], [$2], m4_cdr($3))])])
## ---------------------------------------- ##
## 6. Enhanced version of some primitives. ##
## ---------------------------------------- ##
@@ -469,7 +483,7 @@ m4_define([m4_bpatsubsts],
# ------------------
# This macro invokes all its arguments (in sequence, of course). It is
# useful for making your macros more structured and readable by dropping
# unecessary dnl's and have the macros indented properly.
# unnecessary dnl's and have the macros indented properly.
m4_define([m4_do],
[m4_if($#, 0, [],
$#, 1, [$1],
@@ -615,7 +629,7 @@ m4_if($1, [$2], [],
# Implementing `foreach' loops in m4 is much more tricky than it may
# seem. Actually, the example of a `foreach' loop in the m4
# documentation is wrong: it does not quote the arguments properly,
# which leads to undesired expansions.
# which leads to undesirable expansions.
#
# The example in the documentation is:
#
@@ -1484,7 +1498,7 @@ m4_define([m4_flatten],
# of brackets around $1 (don't forget that the result must be quoted
# too, hence one more quoting than applications).
#
# Then notice the 2 last pattens: they are in charge of removing the
# Then notice the 2 last patterns: they are in charge of removing the
# leading/trailing spaces. Why not just `[^ ]'? Because they are
# applied to doubly quoted strings, i.e. more or less [[STRING]]. So
# if there is a leading space in STRING, then it is the *third*