]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* libltdl/m4/ltsugar.m4 (lt_join, lt_combine, lt_dict_filter):
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Thu, 10 Nov 2005 18:20:05 +0000 (18:20 +0000)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Thu, 10 Nov 2005 18:20:05 +0000 (18:20 +0000)
Rewrite to eliminate tail recursion; use ..
(lt_unquote): New trivial helper macro.
* libltdl/m4/libtool.m4 (_lt_decl_filter): Document.

ChangeLog
libltdl/m4/libtool.m4
libltdl/m4/ltsugar.m4

index a64af118b8b9484ecc5d581343228ac8cef748be..830f43a353eff2733c6586dfa7b8fb143f393d5a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2005-11-10  Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+       * libltdl/m4/ltsugar.m4 (lt_join, lt_combine, lt_dict_filter):
+       Rewrite to eliminate tail recursion; use ..
+       (lt_unquote): New trivial helper macro.
+       * libltdl/m4/libtool.m4 (_lt_decl_filter): Document.
+
 2005-11-10  Gary V. Vaughan  <gary@gnu.org>
 
        * tests/testsuite.ac (macrodir): Don't set it here...
index b51b6a2c92e74f1c1d2c1cd2faae88aef3a35976..eaff302a806882891a5c3e490f235fd037be5484 100644 (file)
@@ -338,6 +338,10 @@ m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])])
 # ------------------------------------------------
 m4_define([lt_decl_tag_varnames],
 [_lt_decl_filter([tagged?], [yes], $@)])
+
+
+# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..])
+# ---------------------------------------------------------
 m4_define([_lt_decl_filter],
 [m4_case([$#],
   [0], [m4_fatal([$0: too few arguments: $#])],
index b746ffea4108c8112651207d1bd86685843b710b..fc51dc7e89640f16848f34bde1bff16fdf42fd0b 100644 (file)
@@ -23,12 +23,12 @@ m4_define([lt_join],
         [1], [],
         [2], [[$2]],
         [m4_ifval([$2],
-                  [m4_ifval([$3],
-                            [[$2][$1][]$0([$1], m4_shiftn(2, $@))],
-                      [m4_if([$#], [3],
-                             [$2],
-                          [$0([$1], [$2], m4_shiftn(3, $@))])])],
-             [$0([$1], m4_shiftn(2, $@))])])[]dnl
+                  [[$2][]m4_foreach(_lt_Arg, lt_car([m4_shiftn(2, $@)]),
+                          [_$0([$1], _lt_Arg)])],
+                  [$0([$1], m4_shiftn(2, $@))])])[]dnl
+])
+m4_define([_lt_join],
+[m4_ifval([$2],[$1][$2])[]dnl
 ])
 
 
@@ -43,6 +43,7 @@ m4_define([lt_cdr],
 [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
        [$#], 1, [],
        [m4_dquote(m4_shift($@))])])
+m4_define([lt_unquote], $1)
 
 
 # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
@@ -52,14 +53,11 @@ m4_define([lt_cdr],
 # has the form PREFIXmINFIXSUFFIXn.
 m4_define([lt_combine],
 [m4_if([$2], [], [],
-       [lt_join(m4_quote(m4_default([$1], [[, ]])),
-               _$0([$1], lt_car($2)[$3], m4_shiftn(3, $@)),
-               $0([$1], lt_cdr($2), m4_shiftn(2, $@)))])])
-m4_define([_lt_combine],
-[m4_if([$3], [], [],
-       [lt_join(m4_quote(m4_default([$1], [[, ]])),
-               [$2$3],
-               $0([$1], [$2], m4_shiftn(3, $@)))])[]dnl
+  [m4_if([$4], [], [],
+    [lt_join(m4_quote(m4_default([$1], [[, ]])),
+      lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_prefix, [$2],
+                          [m4_foreach(_Lt_suffix, lt_car([m4_shiftn(3, $@)]),
+                              [_Lt_prefix[]$3[]_Lt_suffix ])])))))])])dnl
 ])
 
 
@@ -104,10 +102,10 @@ m4_define([lt_if_dict_fetch],
 
 
 # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
-# ------------------------------------------------------------
+# --------------------------------------------------------------
 m4_define([lt_dict_filter],
 [m4_if([$5], [], [],
   [lt_join(m4_quote(m4_default([$4], [[, ]])),
-          m4_quote(lt_if_dict_fetch([$1], [$5], [$2], [$3], [$5])),
-          m4_quote($0([$1], [$2], [$3], [$4], m4_shiftn(5, $@))))])dnl
+           lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
+                     [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
 ])