X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/040984073a54b4c603172be3c3f44b908ea5deb9..a005a9c4dc5588fc017a1cb1d19c1560e0e68943:/data/m4sugar/m4sugar.m4?ds=sidebyside diff --git a/data/m4sugar/m4sugar.m4 b/data/m4sugar/m4sugar.m4 index bd6c8d68..f3a09019 100644 --- a/data/m4sugar/m4sugar.m4 +++ b/data/m4sugar/m4sugar.m4 @@ -6,10 +6,10 @@ divert(-1)# -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software # Foundation, Inc. # -# This program is free software; you can redistribute it and/or modify +# This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,10 +17,8 @@ divert(-1)# -*- Autoconf -*- # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -# 02110-1301, USA. -# +# along with this program. If not, see . + # As a special exception, the Free Software Foundation gives unlimited # permission to copy, distribute and modify the configure scripts that # are the output of Autoconf. You need not follow the terms of the GNU @@ -398,8 +396,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 +409,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))])]) ## ---------------------------------------- ## @@ -1512,6 +1513,12 @@ m4_define([m4_append], [m4_define([$1], m4_ifdef([$1], [m4_defn([$1])$3])[$2])]) +# m4_prepend(MACRO-NAME, STRING, [SEPARATOR]) +# ------------------------------------------- +# Same, but prepend. +m4_define([m4_prepend], +[m4_define([$1], + [$2]m4_ifdef([$1], [$3[]m4_defn([$1])]))]) # m4_append_uniq(MACRO-NAME, STRING, [SEPARATOR]) # -----------------------------------------------