]> git.saurik.com Git - bison.git/commitdiff
* data/m4sugar/m4sugar.m4 (_m4_map): New macro.
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 5 Oct 2005 21:28:07 +0000 (21:28 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 5 Oct 2005 21:28:07 +0000 (21:28 +0000)
(m4_map, m4_map_sep): Use it.  Handle the empty list correctly.

ChangeLog
data/m4sugar/m4sugar.m4

index 859fead35320f5c88606a6dd619f4a2a175964e2..e7dd36687fc22bc69417f7a47c53515e2552e304 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-10-05  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * data/m4sugar/m4sugar.m4 (_m4_map): New macro.
+       (m4_map, m4_map_sep): Use it.  Handle the empty list correctly.
+
 2005-10-04  Paul Eggert  <eggert@cs.ucla.edu>
 
        Undo the parts of the unlocked-I/O change that substituted
index bd6c8d68c10bb1a9f20a07bb21647dce21fd568f..3e2f1769008f126f351229f18d1a2a9479cb7565 100644 (file)
@@ -398,8 +398,11 @@ m4_define([m4_cdr],
 # of LIST (which can be lists themselves, for multiple arguments MACROs).
 m4_define([m4_fst], [$1])
 m4_define([m4_map],
+[m4_if([$2], [[]], [],
+       [_m4_map([$1], [$2])])])
+m4_define([_m4_map],
 [m4_ifval([$2],
-         [$1(m4_fst($2))[]m4_map([$1], m4_cdr($2))])])
+         [$1(m4_fst($2))[]_m4_map([$1], m4_cdr($2))])])
 
 
 # m4_map_sep(MACRO, SEPARATOR, LIST)
@@ -408,8 +411,8 @@ m4_define([m4_map],
 # are the elements of LIST (which can be lists themselves, for multiple
 # arguments MACROs).
 m4_define([m4_map_sep],
-[m4_ifval([$3],
-         [$1(m4_fst($3))[]m4_map([$2[]$1], m4_cdr($3))])])
+[m4_if([$3], [[]], [],
+       [$1(m4_fst($3))[]_m4_map([$2[]$1], m4_cdr($3))])])
 
 
 ## ---------------------------------------- ##