mirror of
git://git.sv.gnu.org/autoconf
synced 2025-02-23 14:09:51 +08:00
* libm4.m4 (m4_for): New macro.
This commit is contained in:
parent
9729954f66
commit
0cd449970f
@ -1,3 +1,7 @@
|
||||
2000-02-08 Akim Demaille <akim@epita.fr>
|
||||
|
||||
* libm4.m4 (m4_for): New macro.
|
||||
|
||||
2000-02-07 Akim Demaille <akim@epita.fr>
|
||||
|
||||
Stay in Autoconf's name space.
|
||||
|
17
libm4.m4
17
libm4.m4
@ -233,8 +233,21 @@ define(m4_match,
|
||||
## --------------------- ##
|
||||
|
||||
|
||||
# Implementing loops (`foreach' loops) in m4 is much more tricky than it
|
||||
# may seem. Actually, the example of a `foreach' loop in the m4
|
||||
# m4_for(VARIABLE, FROM, TO, EXPRESSION)
|
||||
# --------------------------------------
|
||||
# Expand EXPRESSION defining VARIABLE to FROM, FROM + 1, ..., TO.
|
||||
# Both limits are included.
|
||||
define([m4_for],
|
||||
[pushdef([$1], [$2])_m4_for([$1], [$2], [$3], [$4])popdef([$1])])
|
||||
|
||||
define([_m4_for],
|
||||
[$4[]ifelse($1, [$3], [],
|
||||
[define([$1], incr($1))_m4_for([$1], [$2], [$3], [$4])])])
|
||||
|
||||
|
||||
|
||||
# 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.
|
||||
#
|
||||
|
Loading…
Reference in New Issue
Block a user