autoconf-patches
[Top][All Lists]
Advanced

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

FYI: 01-m4sugar-formatting.patch


From: Akim Demaille
Subject: FYI: 01-m4sugar-formatting.patch
Date: 27 Oct 2000 09:38:50 +0200
User-agent: Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.1 (Channel Islands)

Index: ChangeLog
from  Akim Demaille  <address@hidden>
        * m4sugar.m4: Formatting changes.
        
        
Index: m4sugar.m4
--- m4sugar.m4 Thu, 26 Oct 2000 21:03:04 +0200 akim (ace/b/42_m4sugar.m4 1.1 
644)
+++ m4sugar.m4 Thu, 26 Oct 2000 21:13:43 +0200 akim (ace/b/42_m4sugar.m4 1.1 
644)
@@ -62,9 +62,9 @@
 m4exit(2)])
 
 
-## --------------------------------- ##
-## Defining macros and name spaces.  ##
-## --------------------------------- ##
+## --------------------------------------------- ##
+## 1. Move some builtins to a safer name space.  ##
+## --------------------------------------------- ##
 
 # m4_rename(SRC, DST)
 # -------------------
@@ -81,9 +81,9 @@ define([m4_rename],
 m4_rename([symbols], [m4_symbols])
 
 
-## --------------------------------------------- ##
-## Move some m4 builtins to a safer name space.  ##
-## --------------------------------------------- ##
+## ------------------- ##
+## 2. Error messages.  ##
+## ------------------- ##
 
 
 # m4_location
@@ -129,6 +129,11 @@ define([m4_assert],
         [])])
 
 
+## ------------------- ##
+## 3. File inclusion.  ##
+## ------------------- ##
+
+
 # We also want to neutralize include (and sinclude for symmetry),
 # but we want to extend them slightly: warn when a file is included
 # several times.  This is in general a dangerous operation because
@@ -170,9 +175,10 @@ define([m4_sinclude],
 undefine([sinclude])
 
 
-## --------------------------------------- ##
-## Some additional m4 structural control.  ##
-## --------------------------------------- ##
+
+## ------------------------------------ ##
+## 4. Additional branching constructs.  ##
+## ------------------------------------ ##
 
 # Both `ifval' and `ifset' tests against the empty string.  The
 # difference is that `ifset' is specialized on macros.
@@ -222,25 +228,6 @@ define([ifndef],
 [ifdef([$1], [$3], [$2])])
 
 
-# m4_default(EXP1, EXP2)
-# ----------------------
-# Returns EXP1 if non empty, otherwise EXP2.
-define([m4_default], [ifval([$1], [$1], [$2])])
-
-
-# m4_shiftn(N, ...)
-# -----------------
-# Returns ... shifted N times.  Useful for recursive "varargs" constructs.
-define([m4_shiftn],
-[m4_assert(($1 >= 0) && ($# > $1))dnl
-_m4_shiftn($@)])
-
-define([_m4_shiftn],
-[ifelse([$1], 0,
-        [m4_shift($@)],
-        [_m4_shiftn(m4_eval([$1]-1), m4_shift(m4_shift($@)))])])
-
-
 # m4_case(SWITCH, VAL1, IF-VAL1, VAL2, IF-VAL2, ..., DEFAULT)
 # -----------------------------------------------------------
 # m4 equivalent of
@@ -290,6 +277,11 @@ define([m4_match],
         [$3])])
 
 
+
+## ---------------------------------------- ##
+## 5. Enhanced version of some primitives.  ##
+## ---------------------------------------- ##
+
 # m4_do(STRING, ...)
 # ------------------
 # This macro invokes all its arguments (in sequence, of course).  It is
@@ -301,6 +293,27 @@ define([m4_do],
           [$1[]m4_do(m4_shift($@))])])
 
 
+# m4_default(EXP1, EXP2)
+# ----------------------
+# Returns EXP1 if non empty, otherwise EXP2.
+define([m4_default], [ifval([$1], [$1], [$2])])
+
+
+# m4_shiftn(N, ...)
+# -----------------
+# Returns ... shifted N times.  Useful for recursive "varargs" constructs.
+define([m4_shiftn],
+[m4_assert(($1 >= 0) && ($# > $1))dnl
+_m4_shiftn($@)])
+
+define([_m4_shiftn],
+[ifelse([$1], 0,
+        [m4_shift($@)],
+        [_m4_shiftn(m4_eval([$1]-1), m4_shift(m4_shift($@)))])])
+
+
+
+
 # _m4_dumpdefs_up(NAME)
 # ---------------------
 define([_m4_dumpdefs_up],
@@ -329,9 +342,30 @@ define([m4_dumpdefs],
 _m4_dumpdefs_down([$1])])
 
 
-## --------------------- ##
-## Implementing m4 loops ##
-## --------------------- ##
+# m4_quote(STRING)
+# ----------------
+# Return STRING quoted.
+#
+# It is important to realize the difference between `m4_quote(exp)' and
+# `[exp]': in the first case you obtain the quoted *result* of the
+# expansion of EXP, while in the latter you just obtain the string
+# `exp'.
+define([m4_quote], [[$*]])
+
+
+# m4_noquote(STRING)
+# ------------------
+# Return the result of ignoring all quotes in STRING and invoking the
+# macros it contains.  Amongst other things useful for enabling macro
+# invocations inside strings with [] blocks (for instance regexps and
+# help-strings).
+define([m4_noquote],
+[changequote(-=<{,}>=-)$1-=<{}>=-changequote([,])])
+
+
+## -------------------------- ##
+## 6. Implementing m4 loops.  ##
+## -------------------------- ##
 
 
 # m4_for(VARIABLE, FIRST, LAST, [STEP = +/-1], EXPRESSION)
@@ -464,9 +498,9 @@ define([_m4_foreach],
 
 
 
-## ------------------------ ##
-## More diversion support.  ##
-## ------------------------ ##
+## --------------------------- ##
+## 7. More diversion support.  ##
+## --------------------------- ##
 
 
 # _m4_divert(DIBERSION-NAME or NUMBER)
@@ -510,9 +544,9 @@ define([m4_divert],
 ])
 
 
-## ----------------- ##
-## Text processing.  ##
-## ----------------- ##
+## -------------------- ##
+## 8. Text processing.  ##
+## -------------------- ##
 
 # m4_tolower(STRING)
 # m4_toupper(STRING)
@@ -529,27 +563,6 @@ define([m4_toupper],
           [ABCDEFGHIJKLMNOPQRSTUVWXYZ])])
 
 
-# m4_quote(STRING)
-# ----------------
-# Return STRING quoted.
-#
-# It is important to realize the difference between `m4_quote(exp)' and
-# `[exp]': in the first case you obtain the quoted *result* of the
-# expansion of EXP, while in the latter you just obtain the string
-# `exp'.
-define([m4_quote], [[$*]])
-
-
-# m4_noquote(STRING)
-# ------------------
-# Return the result of ignoring all quotes in STRING and invoking the
-# macros it contains.  Amongst other things useful for enabling macro
-# invocations inside strings with [] blocks (for instance regexps and
-# help-strings).
-define([m4_noquote],
-[changequote(-=<{,}>=-)$1-=<{}>=-changequote([,])])
-
-
 # m4_split(STRING, [REGEXP])
 # --------------------------
 #
@@ -675,50 +688,6 @@ define([m4_list_append],
 ifdef([$1], [defn([$1]), ])[$2])])
 
 
-
-
-## -------------------- ##
-## Version processing.  ##
-## -------------------- ##
-
-
-# m4_version_unletter(VERSION)
-# ----------------------------
-# Normalize beta version numbers with letters to numbers only for comparison.
-#
-#   Nl -> (N+1).-1.(l#)
-#
-#i.e., 2.14a -> 2.15.-1.1, 2.14b -> 2.15.-1.2, etc.
-# This macro is absolutely not robust to active macro, it expects
-# reasonable version numbers and is valid up to `z', no double letters.
-define([m4_version_unletter],
-[translit(patsubst(patsubst(patsubst([$1],
-                                     [\([0-9]+\)\([abcdefghi]\)],
-                                     [m4_eval(\1 + 1).-1.\2]),
-                            [\([0-9]+\)\([jklmnopqrs]\)],
-                            [m4_eval(\1 + 1).-1.1\2]),
-          [\([0-9]+\)\([tuvwxyz]\)],
-          [m4_eval(\1 + 1).-1.2\2]),
-          abcdefghijklmnopqrstuvwxyz,
-          12345678901234567890123456)])
-
-
-# m4_version_compare(VERSION-1, VERSION-2)
-# ----------------------------------------
-# Compare the two version numbers and expand into
-#  -1 if VERSION-1 < VERSION-2
-#   0 if           =
-#   1 if           >
-define([m4_version_compare],
-[m4_list_cmp((m4_split(m4_version_unletter([$1]), [\.])),
-             (m4_split(m4_version_unletter([$2]), [\.])))])
-
-
-
-## ----------------------------------- ##
-## Helping macros to display strings.  ##
-## ----------------------------------- ##
-
 # m4_foreach_quoted(VARIABLE, LIST, EXPRESSION)
 # ---------------------------------------------
 # FIXME: This macro should not exists.  Currently it's used only in
@@ -801,9 +770,9 @@ define([m4_Separator], [ ])])dnl
 
 
 
-## ------------------- ##
-## Number processing.  ##
-## ------------------- ##
+## ---------------------- ##
+## 9. Number processing.  ##
+## ---------------------- ##
 
 # m4_sign(A)
 # ----------
@@ -845,3 +814,41 @@ define([m4_list_cmp],
                  -1, -1,
                   1, 1,
                   0, [m4_list_cmp((m4_shift$1), (m4_shift$2))])])])
+
+
+
+## ------------------------ ##
+## 10. Version processing.  ##
+## ------------------------ ##
+
+
+# m4_version_unletter(VERSION)
+# ----------------------------
+# Normalize beta version numbers with letters to numbers only for comparison.
+#
+#   Nl -> (N+1).-1.(l#)
+#
+#i.e., 2.14a -> 2.15.-1.1, 2.14b -> 2.15.-1.2, etc.
+# This macro is absolutely not robust to active macro, it expects
+# reasonable version numbers and is valid up to `z', no double letters.
+define([m4_version_unletter],
+[translit(patsubst(patsubst(patsubst([$1],
+                                     [\([0-9]+\)\([abcdefghi]\)],
+                                     [m4_eval(\1 + 1).-1.\2]),
+                            [\([0-9]+\)\([jklmnopqrs]\)],
+                            [m4_eval(\1 + 1).-1.1\2]),
+          [\([0-9]+\)\([tuvwxyz]\)],
+          [m4_eval(\1 + 1).-1.2\2]),
+          abcdefghijklmnopqrstuvwxyz,
+          12345678901234567890123456)])
+
+
+# m4_version_compare(VERSION-1, VERSION-2)
+# ----------------------------------------
+# Compare the two version numbers and expand into
+#  -1 if VERSION-1 < VERSION-2
+#   0 if           =
+#   1 if           >
+define([m4_version_compare],
+[m4_list_cmp((m4_split(m4_version_unletter([$1]), [\.])),
+             (m4_split(m4_version_unletter([$2]), [\.])))])



reply via email to

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