Stage 19: allow builtin tokens in more macros.
commitd53cf5ec91d8991f633233ed3bd72384b7cbd8b5
authorEric Blake <ebb9@byu.net>
Wed, 21 Nov 2007 17:14:28 +0000 (21 10:14 -0700)
committerEric Blake <ebb9@byu.net>
Fri, 14 Mar 2008 13:03:37 +0000 (14 07:03 -0600)
treedb91f9e264a6c51a838ffb58a15ab3b9facbffb1
parentfb8ad0c1e45abc64d8588dc812023a7ecfd8d269
Stage 19: allow builtin tokens in more macros.

* src/m4.h (enum token_chain_type): Add CHAIN_FUNC.
(struct token_chain): Add func member.
* src/input.c (push_token, pop_input, input_print, peek_input)
(next_char_1, init_macro_token): Handle builtin tokens from
back-references.
(next_token): Flatten builtin tokens inside comments or quotes,
except when a builtin is the only thing inside quotes.
* src/macro.c (expand_argument): Strengthen assertion.
(collect_arguments): Handle builtin tokens.
(expand_macro): Fix harmless typo.
(arg_token): Add parameter.
(arg_type, arg_text, arg_equal, arg_empty, arg_len, arg_func)
(arg_print, push_arg_quote, push_args): Update callers to either
require flattened arguments or to handle builtins.
* src/builtin.c (m4_defn, m4_dumpdef, m4_ifdef, m4_ifelse)
(m4_popdef, m4_shift, m4_traceoff, m4_traceon, m4_undefine):
Handle builtin tokens, either by recognizing invalid macro names
or passing them through transparently.
(define_user_macro): Make all user macros handle builtin token
arguments transparently.
* doc/m4.texinfo (Defn, Ifdef, Ifelse, Debuglen): Document and
test the new behavior.
* NEWS: Document this change.

(cherry picked from commit 434656c96d6486cf959c3050aa85aecb72d948a0)

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
NEWS
doc/m4.texinfo
src/builtin.c
src/input.c
src/m4.h
src/macro.c