autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01-more-m4sugar.patch


From: Akim Demaille
Subject: 01-more-m4sugar.patch
Date: Tue, 19 Mar 2002 08:49:15 +0100

Index: ChangeLog
from  Akim Demaille  <address@hidden>
        
        * lib/m4sugar/m4sugar.m4 (m4_define_default, m4_fst, m4_map): New.
        
Index: lib/m4sugar/m4sugar.m4
--- lib/m4sugar/m4sugar.m4 Sun, 03 Mar 2002 09:58:13 +0100 akim
+++ lib/m4sugar/m4sugar.m4 Sat, 16 Mar 2002 11:11:56 +0100 akim
@@ -2,7 +2,7 @@
 # This file is part of Autoconf.
 # Base M4 layer.
 # Requires GNU M4.
-# Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
 #
 # 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
@@ -426,6 +426,16 @@ m4_define([m4_bmatch],
        [$3])])
 
 
+# m4_map(MACRO, LIST)
+# -------------------
+# Invoke MACRO($1), MACRO($2) etc. where $1, $2... are the elements
+# of LIST (which can be lists themselves, for multiple arguments MACROs).
+m4_define([m4_fst], [$1])
+m4_define([m4_map],
+[m4_if([$2], [[]], [],
+       [$1(m4_fst($2))[]dnl
+m4_map([$1], m4_cdr($2))])])
+
 
 ## ---------------------------------------- ##
 ## 6. Enhanced version of some primitives.  ##
@@ -466,6 +476,13 @@ m4_define([m4_do],
        [$1[]m4_do(m4_shift($@))])])
 
 
+# m4_define_default(MACRO, VALUE)
+# -------------------------------
+# If MACRO is undefined, set it to VALUE.
+m4_define([m4_define_default],
+[m4_ifndef([$1], [m4_define($@)])])
+
+
 # m4_default(EXP1, EXP2)
 # ----------------------
 # Returns EXP1 if non empty, otherwise EXP2.
@@ -531,6 +548,7 @@ m4_define([m4_popdef],
 # `exp'.
 m4_define([m4_quote],  [[$*]])
 m4_define([m4_dquote],  address@hidden)
+
 
 # m4_noquote(STRING)
 # ------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]