[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
/floppy/ac-patches/95-fyi-m4-re-escape.patch
From: |
Akim Demaille |
Subject: |
/floppy/ac-patches/95-fyi-m4-re-escape.patch |
Date: |
Thu, 13 Sep 2001 08:56:11 +0200 |
Index: ChangeLog
from Akim Demaille <address@hidden>
* lib/m4sugar/m4sugar.m4 (_AS_QUOTE_IFELSE, _AS_BOX_INDIR): Use
m4_match.
(m4_re_escape): New.
* lib/autoconf/status.m4 (AC_CONFIG_IF_MEMBER): Use it.
* lib/autoconf/general.m4 (AC_CACHE_SAVE): Use m4_match.
* lib/autoconf/status.m4 (AC_CONFIG_IF_MEMBER, AC_CONFIG_LINKS):
Likewise.
* lib/autoconf/types.m4 (_AC_CHECK_TYPE_REPLACEMENT_TYPE_P)
(_AC_CHECK_TYPE_MAYBE_TYPE_P, AC_CHECK_MEMBER): Likewise.
* lib/autotest/general.m4 (AT_INIT): Rename AT_TESTS_ALL as
AT_tests_all for consistency.
Set at_victims.
(AT_VICTIMS): Similar to AT_KEYWORDS.
(_AT_CLEANUP_FILE_IF): Use m4_match and m4_re_escape.
Index: lib/autoconf/general.m4
--- lib/autoconf/general.m4 Wed, 12 Sep 2001 17:50:53 +0200 akim
+++ lib/autoconf/general.m4 Wed, 12 Sep 2001 23:13:29 +0200 akim
@@ -1793,8 +1793,8 @@ m4_define([AC_CACHE_SAVE],
# The name of shell var CACHE-ID must contain `_cv_' in order to get saved.
# Should be dnl'ed. Try to catch common mistakes.
m4_define([AC_CACHE_VAL],
-[m4_if(m4_regexp([$2], [AC_DEFINE]), [-1], [],
- [AC_DIAGNOSE(syntax,
+[m4_match([$2], [AC_DEFINE],
+ [AC_DIAGNOSE(syntax,
[$0($1, ...): suspicious presence of an AC_DEFINE in the second argument, ]dnl
[where no actions should be taken])])dnl
AS_VAR_SET_IF([$1],
Index: lib/autoconf/status.m4
--- lib/autoconf/status.m4 Fri, 31 Aug 2001 15:06:56 +0200 akim
+++ lib/autoconf/status.m4 Wed, 12 Sep 2001 23:12:46 +0200 akim
@@ -175,9 +175,8 @@ m4_define([_AC_SRCPATHS],
# matching. The big problem is then that the active characters should
# be quoted. Currently `+*.' are quoted.
m4_define([AC_CONFIG_IF_MEMBER],
-[m4_if(m4_regexp($2, [\(^\| \)]m4_patsubst([$1],
- [\([+*.]\)], [\\\1])[\(:\| \|$\)]),
- -1, [$4], [$3])])
+[m4_match($2, [\(^\| \)]m4_re_escape([$1])[\(:\| \|$\)]),
+ [$3], [$4])])
# AC_FILE_DEPENDENCY_TRACE(DEST, SOURCE1, [SOURCE2...])
@@ -661,8 +660,7 @@ AC_DEFUN([AC_CONFIG_LINKS],
[m4_divert_push([KILL])
_AC_CONFIG_UNIQUE([$1])
_AC_CONFIG_DEPENDENCIES([$1])
-m4_if(m4_regexp([$1], [^\.:\| \.:]), -1,,
- [AC_FATAL([$0: invalid destination: `.'])])
+m4_match([$1], [^\.:\| \.:], [m4_fatal([$0: invalid destination: `.'])])
m4_append([AC_LIST_LINKS], [ $1])
dnl Register the commands
m4_ifval([$2], [AC_FOREACH([AC_File], [$1],
Index: lib/autoconf/types.m4
--- lib/autoconf/types.m4 Fri, 27 Jul 2001 20:21:13 +0200 akim
+++ lib/autoconf/types.m4 Wed, 12 Sep 2001 23:15:17 +0200 akim
@@ -193,9 +193,9 @@ m4_define([_AC_CHECK_TYPE_OLD],
# Because many people have used `off_t' and `size_t' too, they are added
# for better common-useward backward compatibility.
m4_define([_AC_CHECK_TYPE_REPLACEMENT_TYPE_P],
-[m4_if(m4_regexp([$1],
-
[^\(_Bool\|bool\|char\|double\|float\|int\|long\|short\|\(un\)?signed\|[_a-zA-Z][_a-zA-Z0-9]*_t\)[][_a-zA-Z0-9()
*]*$]),
- 0, 1, 0)dnl
+[m4_match([$1],
+
[^\(_Bool\|bool\|char\|double\|float\|int\|long\|short\|\(un\)?signed\|[_a-zA-Z][_a-zA-Z0-9]*_t\)[][_a-zA-Z0-9()
*]*$],
+ 1, 0)dnl
])# _AC_CHECK_TYPE_REPLACEMENT_TYPE_P
@@ -203,8 +203,8 @@ m4_define([_AC_CHECK_TYPE_REPLACEMENT_TY
# -----------------------------------
# Return `1' if STRING looks like a C/C++ type.
m4_define([_AC_CHECK_TYPE_MAYBE_TYPE_P],
-[m4_if(m4_regexp([$1], [^[_a-zA-Z0-9 ]+\([_a-zA-Z0-9() *]\|\[\|\]\)*$]),
- 0, 1, 0)dnl
+[m4_match([$1], [^[_a-zA-Z0-9 ]+\([_a-zA-Z0-9() *]\|\[\|\]\)*$],
+ 1, 0)dnl
])# _AC_CHECK_TYPE_MAYBE_TYPE_P
@@ -417,8 +417,8 @@ AC_DEFUN([AC_CHECK_SIZEOF],
AC_DEFUN([AC_CHECK_MEMBER],
[AS_LITERAL_IF([$1], [],
[AC_FATAL([$0: requires literal arguments])])dnl
-m4_if(m4_regexp([$1], [\.]), -1,
- [AC_FATAL([$0: Did not see any dot in `$1'])])dnl
+m4_match([$1], [\.], ,
+ [m4_fatal([$0: Did not see any dot in `$1'])])dnl
AS_VAR_PUSHDEF([ac_Member], [ac_cv_member_$1])dnl
dnl Extract the aggregate name, and the member name
AC_CACHE_CHECK([for $1], ac_Member,
Index: lib/autotest/general.m4
--- lib/autotest/general.m4 Wed, 12 Sep 2001 20:19:26 +0200 akim
+++ lib/autotest/general.m4 Wed, 12 Sep 2001 23:09:55 +0200 akim
@@ -594,8 +594,10 @@ m4_define([AS_MESSAGE_LOG_FD], [6])
exit 0
m4_divert_pop([TAIL])dnl
m4_wrap([m4_divert_text([DEFAULT],
- [# List of the tests.
-at_tests_all="AT_TESTS_ALL "
+ [# List of the tested programs.
+at_victims="AT_victims"
+# List of the tests.
+at_tests_all="AT_tests_all "
# Number of the last test.
at_last_test=AT_ordinal
# Description of all the tests.
@@ -612,11 +614,7 @@ m4_define([AS_MESSAGE_LOG_FD], [6])
# must correspond to the version of the package.. The PATH should be
# already preset so the proper executable will be selected.
m4_define([AT_VICTIMS],
-[m4_divert_text([DEFAULT],
-[# List of the tested programs.
-at_victims="$1"
-])
-])# AT_VICTIMS
+[m4_append([AT_victims], [$1], [ ])])
# AT_SETUP(DESCRIPTION)
@@ -628,7 +626,7 @@ m4_define([AT_SETUP],
m4_define([AT_line], AT_LINE)
m4_define([AT_description], [$1])
m4_define([AT_ordinal], m4_incr(AT_ordinal))
-m4_append([AT_TESTS_ALL], [ ]m4_defn([AT_ordinal]))
+m4_append([AT_tests_all], [ ]m4_defn([AT_ordinal]))
m4_divert_push([TESTS])dnl
AT_ordinal ) @%:@ AT_ordinal. m4_defn([AT_line]): $1
at_setup_line='m4_defn([AT_line])'
@@ -653,9 +651,8 @@ m4_define([AT_KEYWORDS],
# We try to build a regular expression matching `[', `]', `*', and
# `.', i.e., the regexp active characters.
m4_define([_AT_CLEANUP_FILE_IF],
-[m4_if(m4_regexp(AT_data_files, m4_patsubst([ $1 ], [[][*.]], [\\\&])),
- -1,
- [$3], [$2])])
+[m4_match(AT_data_files, m4_re_escape([ $1 ]),
+ [$2], [$3])])
# _AT_CLEANUP_FILE(FILE)
@@ -698,7 +695,7 @@ m4_define([AT_CLEANUP],
# Output TEXT without any shell expansion.
m4_define([AT_BANNER],
[m4_define([AT_banner_ordinal], m4_incr(AT_banner_ordinal))
-m4_append([AT_TESTS_ALL], [ banner-]m4_defn([AT_banner_ordinal]))
+m4_append([AT_tests_all], [ banner-]m4_defn([AT_banner_ordinal]))
m4_divert_text([TESTS],
[
banner-AT_banner_ordinal ) @%:@ Banner AT_banner_ordinal. AT_LINE
Index: lib/m4sugar/m4sh.m4
--- lib/m4sugar/m4sh.m4 Wed, 12 Sep 2001 19:54:03 +0200 akim
+++ lib/m4sugar/m4sh.m4 Wed, 12 Sep 2001 23:43:42 +0200 akim
@@ -237,11 +237,10 @@ m4_define([AS_ESCAPE],
# Otherwise it's modern.
# We use two quotes in the pattern to keep highlighting tools at peace.
m4_define([_AS_QUOTE_IFELSE],
-[m4_if(m4_regexp([$1], [\\[\\$]]),
- [-1], [m4_if(m4_regexp([$1], [\\[`""]]),
- [-1], [$2],
- [$3])],
- [$2])])
+[m4_match([$1],
+ [\\[\\$]], [$2],
+ [\\[`""]], [$3],
+ [$2])])
# _AS_ECHO_UNQUOTED(STRING, [FD = AS_MESSAGE_FD])
@@ -581,9 +580,8 @@ m4_define([_AS_BOX_INDIR],
# This is an *approximation*: for instance EXPRESSION = `\$' is
# definitely a literal, but will not be recognized as such.
m4_define([AS_LITERAL_IF],
-[m4_if(m4_regexp([$1], [[`$]]),
- -1, [$2],
- [$3])])
+[m4_match([$1], [[`$]],
+ [$3], [$2])])
# AS_TMPDIR(PREFIX)
@@ -760,7 +758,7 @@ m4_define([AS_VAR_SET],
# else into the appropriate `eval' sequence.
m4_define([AS_VAR_GET],
[AS_LITERAL_IF([$1],
- [$[]$1],
+ [$$1],
[`eval echo '${'m4_patsubst($1, [[\\`]], [\\\&])'}'`])])
Index: lib/m4sugar/m4sugar.m4
--- lib/m4sugar/m4sugar.m4 Mon, 10 Sep 2001 08:25:22 +0200 akim
+++ lib/m4sugar/m4sugar.m4 Wed, 12 Sep 2001 23:10:32 +0200 akim
@@ -1308,6 +1308,7 @@ m4_define([m4_provide_ifelse],
## 9. Text processing. ##
## -------------------- ##
+
# m4_cr_letters
# m4_cr_LETTERS
# m4_cr_Letters
@@ -1319,6 +1320,7 @@ m4_define([m4_cr_Letters],
m4_defn([m4_cr_LETTERS])dnl
)
+
# m4_cr_digits
# ------------
m4_define([m4_cr_digits], [0123456789])
@@ -1336,6 +1338,14 @@ m4_define([m4_cr_symbols2],
)
+# m4_re_escape(STRING)
+# --------------------
+# Escape BRE active characters in STRING.
+m4_define([m4_re_escape],
+[m4_patsubst([$1],
+ [[][+*.]], [\\\&])])
+
+
# m4_re_string
# ------------
# Regexp for `[a-zA-Z_0-9]*'
@@ -1353,19 +1363,15 @@ m4_define([m4_re_word],
m4_defn([m4_re_string])dnl
)
+
# m4_tolower(STRING)
# m4_toupper(STRING)
# ------------------
# These macros lowercase and uppercase strings.
m4_define([m4_tolower],
-[m4_translit([$1],
- [ABCDEFGHIJKLMNOPQRSTUVWXYZ],
- [abcdefghijklmnopqrstuvwxyz])])
-
+[m4_translit([$1], m4_defn([m4_cr_LETTERS]), m4_defn([m4_cr_letters]))])
m4_define([m4_toupper],
-[m4_translit([$1],
- [abcdefghijklmnopqrstuvwxyz],
- [ABCDEFGHIJKLMNOPQRSTUVWXYZ])])
+[m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
# m4_split(STRING, [REGEXP])
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- /floppy/ac-patches/95-fyi-m4-re-escape.patch,
Akim Demaille <=