mirror of
git://git.sv.gnu.org/autoconf
synced 2024-12-03 02:00:36 +08:00
Instead of having stacking `shift's evaluated at the end, let
`foreach' loops immediately evaluate them. * lib/m4sugar/m4sugar.m4 (m4_quote, m4_dquote): Use $@ rather than $*. This is the n-th time I change my mind, but hopefully this is the last... (m4_lquote): New. (m4_text_wrap): Use m4_foreach, which is finally correct _and_ efficient. (m4_foreach_quoted, m4_car_quoted, _m4_foreach_quoted): Remove, as it was only a hack for m4_text_wrap. (m4_car2): Remove, replaced by... (m4_cdr): New. (_m4_foreach): Adjust. * lib/autoconf/general.m4 (_AC_INIT_PREPARE): Adjust, and use m4_bpatsubst for clarification.
This commit is contained in:
parent
223a67a67a
commit
e1189f6dbc
19
ChangeLog
19
ChangeLog
@ -1,3 +1,22 @@
|
||||
2002-03-04 Akim Demaille <akim@epita.fr>
|
||||
|
||||
Instead of having stacking `shift's evaluated at the end, let
|
||||
`foreach' loops immediately evaluate them.
|
||||
|
||||
* lib/m4sugar/m4sugar.m4 (m4_quote, m4_dquote): Use $@ rather than
|
||||
$*. This is the n-th time I change my mind, but hopefully this is
|
||||
the last...
|
||||
(m4_lquote): New.
|
||||
(m4_text_wrap): Use m4_foreach, which is finally correct _and_
|
||||
efficient.
|
||||
(m4_foreach_quoted, m4_car_quoted, _m4_foreach_quoted): Remove, as
|
||||
it was only a hack for m4_text_wrap.
|
||||
(m4_car2): Remove, replaced by...
|
||||
(m4_cdr): New.
|
||||
(_m4_foreach): Adjust.
|
||||
* lib/autoconf/general.m4 (_AC_INIT_PREPARE): Adjust, and use
|
||||
m4_bpatsubst for clarification.
|
||||
|
||||
2002-03-04 Akim Demaille <akim@epita.fr>
|
||||
|
||||
* doc/autoconf.texi (Changequote is Evil): New.
|
||||
|
@ -1164,10 +1164,10 @@ trap 'exit_status=$?
|
||||
echo
|
||||
AS_BOX([Cache variables.])
|
||||
echo
|
||||
m4_bpatsubst(m4_bpatsubst(m4_dquote(m4_defn([_AC_CACHE_DUMP])),
|
||||
[^ *\(#.*\)?
|
||||
]),
|
||||
['], ['"'"'])
|
||||
m4_bpatsubsts(m4_defn([_AC_CACHE_DUMP]),
|
||||
[^ *\(#.*\)?
|
||||
], [],
|
||||
['], ['"'"'])
|
||||
echo
|
||||
if test -s confdefs.h; then
|
||||
AS_BOX([confdefs.h.])
|
||||
|
@ -521,16 +521,18 @@ m4_define([m4_popdef],
|
||||
m4_builtin([popdef], $@)])
|
||||
|
||||
|
||||
# m4_quote(STRING)
|
||||
# ----------------
|
||||
# Return STRING quoted.
|
||||
# m4_quote(ARGS)
|
||||
# --------------
|
||||
# Return ARGS quoted. Note that a list of quoted arguments is returned,
|
||||
# not a quoted list.
|
||||
#
|
||||
# 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'.
|
||||
m4_define([m4_quote], [[$*]])
|
||||
m4_define([m4_dquote], [[[$*]]])
|
||||
m4_define([m4_quote], [[$*]])
|
||||
m4_define([m4_lquote], [$@])
|
||||
m4_define([m4_dquote], [[$@]])
|
||||
|
||||
|
||||
# m4_noquote(STRING)
|
||||
@ -696,11 +698,11 @@ m4_define([m4_foreach],
|
||||
|
||||
# Low level macros used to define m4_foreach.
|
||||
m4_define([m4_car], [[$1]])
|
||||
m4_define([m4_car2], [[$@]])
|
||||
m4_define([m4_cdr], [m4_dquote(m4_shift($@))])
|
||||
m4_define([_m4_foreach],
|
||||
[m4_if(m4_quote($2), [], [],
|
||||
[m4_if([$2], [[]], [],
|
||||
[m4_define([$1], [m4_car($2)])$3[]_m4_foreach([$1],
|
||||
m4_car2(m4_shift($2)),
|
||||
m4_cdr($2),
|
||||
[$3])])])
|
||||
|
||||
|
||||
@ -1375,7 +1377,7 @@ m4_define([m4_re_escape],
|
||||
# ------------
|
||||
# Regexp for `[a-zA-Z_0-9]*'
|
||||
m4_define([m4_re_string],
|
||||
m4_dquote(m4_defn([m4_cr_symbols2]))dnl
|
||||
m4_quote(m4_defn([m4_cr_symbols2]))dnl
|
||||
[*]dnl
|
||||
)
|
||||
|
||||
@ -1384,7 +1386,7 @@ m4_dquote(m4_defn([m4_cr_symbols2]))dnl
|
||||
# ----------
|
||||
# Regexp for `[a-zA-Z_][a-zA-Z_0-9]*'
|
||||
m4_define([m4_re_word],
|
||||
m4_dquote(m4_defn([m4_cr_symbols1]))dnl
|
||||
m4_quote(m4_defn([m4_cr_symbols1]))dnl
|
||||
m4_defn([m4_re_string])dnl
|
||||
)
|
||||
|
||||
@ -1554,22 +1556,6 @@ m4_define([m4_append_uniq],
|
||||
[m4_append($@)])])
|
||||
|
||||
|
||||
# m4_foreach_quoted(VARIABLE, LIST, EXPRESSION)
|
||||
# ---------------------------------------------
|
||||
# FIXME: This macro should not exists. Currently it's used only in
|
||||
# m4_wrap, which needs to be rewritten. But it's godam hard.
|
||||
m4_define([m4_foreach_quoted],
|
||||
[m4_pushdef([$1], [])_m4_foreach_quoted($@)m4_popdef([$1])])
|
||||
|
||||
# Low level macros used to define m4_foreach.
|
||||
m4_define([m4_car_quoted], [[$1]])
|
||||
m4_define([_m4_foreach_quoted],
|
||||
[m4_if($2, [()], ,
|
||||
[m4_define([$1], [m4_car_quoted$2])$3[]_m4_foreach_quoted([$1],
|
||||
[(m4_shift$2)],
|
||||
[$3])])])
|
||||
|
||||
|
||||
# m4_text_wrap(STRING, [PREFIX], [FIRST-PREFIX], [WIDTH])
|
||||
# -------------------------------------------------------
|
||||
# Expands into STRING wrapped to hold in WIDTH columns (default = 79).
|
||||
@ -1617,16 +1603,16 @@ m4_Prefix1[]dnl
|
||||
m4_if(m4_eval(m4_Cursor > m4_len(m4_Prefix)),
|
||||
1, [m4_define([m4_Cursor], m4_len(m4_Prefix))
|
||||
m4_Prefix])[]dnl
|
||||
m4_foreach_quoted([m4_Word], (m4_split(m4_normalize([$1]))),
|
||||
[m4_define([m4_Cursor], m4_eval(m4_Cursor + m4_len(m4_Word) + 1))dnl
|
||||
m4_foreach([m4_Word], m4_quote(m4_split(m4_normalize([$1]))),
|
||||
[m4_define([m4_Cursor], m4_eval(m4_Cursor + m4_len(m4_defn([m4_Word])) + 1))dnl
|
||||
dnl New line if too long, else insert a space unless it is the first
|
||||
dnl of the words.
|
||||
m4_if(m4_eval(m4_Cursor > m4_Width),
|
||||
1, [m4_define([m4_Cursor],
|
||||
m4_eval(m4_len(m4_Prefix) + m4_len(m4_Word) + 1))]
|
||||
m4_eval(m4_len(m4_Prefix) + m4_len(m4_defn([m4_Word])) + 1))]
|
||||
m4_Prefix,
|
||||
[m4_Separator])[]dnl
|
||||
m4_Word[]dnl
|
||||
m4_defn([m4_Word])[]dnl
|
||||
m4_define([m4_Separator], [ ])])dnl
|
||||
m4_popdef([m4_Separator])dnl
|
||||
m4_popdef([m4_Cursor])dnl
|
||||
|
Loading…
Reference in New Issue
Block a user