Eric Blake
0fe33c9c7d
Stage 21b: $@ concatenates builtins, m4wrap takes builtins.
...
* m4/m4module.h (m4_push_builtin): Add parameter.
(m4_builtin_print, m4_push_wrapup_init, m4_push_wrapup_finish)
(m4_arg_print, m4_symbol_value_print): Rename and reduce scope...
* m4/m4private.h (m4__builtin_print, m4__push_wrapup_init)
(m4__push_wrapup_finish, m4__arg_print, m4__symbol_value_print):
...to these, in some cases adding a parameter.
(m4__append_builtin): New prototype.
* m4/builtin.c (m4_builtin_print): Alter signature to print
builtin to a growing symbol chain.
* m4/symtab.c (m4__symbol_value_print): Alter signature.
(m4_symbol_print, dump_symbol_CB): Adjust callers.
* m4/input.c (builtin_peek, builtin_read, builtin_unget)
(builtin_print, builtin_funcs): Delete, handled via composite
blocks now.
(struct m4_input_block): Delete u.builtin member.
(init_builtin_token): Only use composite block.
(m4__append_builtin): New function.
(m4_push_builtin, m4__push_wrapup_init): Alter signature.
(m4__push_symbol): Allow builtin tokens.
(m4__push_wrapup_finish): Rename.
(composite_print, m4_print_token): Adjust callers.
* m4/macro.c (m4_wrap_args, collect_arguments): Allow builtin
tokens.
(m4__arg_print): Alter signature.
(trace_prepre, trace_pre, m4_arg_text, m4_arg_equal): Adjust
callers.
* modules/m4.c (m4wrap): Allow builtin tokens.
(defn, errprint): Adjust callers.
* modules/gnu.c (builtin): Likewise.
* doc/m4.texinfo (M4wrap): New test.
(Debuglen): Adjust expected output.
Signed-off-by: Eric Blake <ebb9@byu.net>
2008-04-14 21:09:14 -06:00
Eric Blake
03c4e545af
Improve OS/2 detection.
...
* modules/gnu.c (m4_macro_table): Ensure all possible identifiers
are defined, not just the first. The testsuite ensures that
exactly one gets defined.
* m4/system_.h [__EMX__]: OS/2 is not Unix-compatible, no matter
what other pre-defined macros it has.
* THANKS: Update.
Reported by Elbert Pol.
Signed-off-by: Eric Blake <ebb9@byu.net>
2008-04-14 17:14:33 -06:00
Eric Blake
0b8410450c
Overhaul inter-version releases to work with git.
...
* configure.ac (version): New variable, which has nicer version
contents when using git 1.5.5+, hardcoded to 1.9a otherwise.
(TIMESTAMP): Delete, since CVS id expansion died with transition
to git.
(AM_INIT_AUTOMAKE): Use version to decide gnu vs. gnits.
* build-aux/mkstamp: Delete, no longer used.
* Makefile.am (CONFIG_STATUS_DEPENDENCIES): Kill, to speed up
rebuilds when timestamps don't matter.
(MKSTAMP): Delete, no longer used.
(EXTRA_DIST): No longer worry about mkstamp.
(.version): New rule and distributed file.
(doc/m4.1, tests/package.m4): Depend on .version, not
configure.ac, for timestamp.
* ltdl/m4/gnulib-cache.m4: Import git-version-gen module.
* modules/gnu.c (__m4_version__): TIMESTAMP no longer exists.
* src/main.c (main): Likewise.
Signed-off-by: Eric Blake <ebb9@byu.net>
2008-04-08 12:12:53 -06:00
Eric Blake
a2df6b461c
Stage 19c: allow builtin tokens in more macros.
...
* m4/m4module.h (m4_symbol_value_lookup, m4_builtin_print): New
prototypes.
* m4/m4private.h (enum m4__symbol_chain_type): Add
M4__CHAIN_FUNC.
(struct m4__symbol_chain): Add builtin member.
* m4/utility.c (m4_symbol_value_lookup): New method.
* m4/builtin.c (m4_builtin_print): New function.
* m4/symtab.c (m4_symbol_value_print): Use it.
* m4/input.c (builtin_print): Likewise.
(m4__push_symbol): Allow pushing builtin tokens.
(composite_peek, composite_read, composite_unget, composite_clean)
(composite_print): Handle builtin tokens.
(init_builtin_token): Allow builtin tokens from composite input.
(m4__next_token): Flatten builtins inside comment or string.
* m4/macro.c (expand_argument): Strengthen assertion.
(collect_arguments, m4_arg_equal, m4_arg_print, m4_push_args):
Handle builtin tokens.
(arg_symbol): Add parameter, and allow NULL level.
(m4_arg_symbol, m4__push_arg_quote): Adjust callers.
(m4_arg_text): Ensure all builtins have been flattened.
* modules/m4.c (defn, dumpdef, popdef, traceoff, traceon)
(undefine, m4_dump_symbols): Warn on invalid macro names.
(ifdef, ifelse, shift): Handle builtin tokens.
* modules/gnu.c (m4symbols): Likewise.
* doc/m4.texinfo (Defn, Ifdef, Ifelse): Document and test the new
behavior.
(Debuglen): Likewise, and remove xfail.
* NEWS: Mention the change.
Signed-off-by: Eric Blake <ebb9@byu.net>
2008-03-13 21:09:33 -06:00
Eric Blake
2f49d755e5
Stage 19b: invert sense of bit for handling builtin tokens.
...
* m4/m4module.h (M4BUILTIN_ENTRY): New convenience macro.
(M4_BUILTIN_GROKS_MACRO): Rename...
(M4_BUILTIN_FLATTEN_ARGS): ...and invert sense.
(m4_symbol_value_groks_macro, m4_symbol_groks_macro): Likewise...
(m4_symbol_value_flatten_args, m4_symbol_flatten_args): ...to
this.
* m4/m4private.h (VALUE_MACRO_ARGS_BIT)
(m4_symbol_value_groks_macro): Likewise...
(VALUE_FLATTEN_ARGS_BIT, m4_symbol_value_flatten_args): ...to
this.
* m4/symtab.c (m4_symbol_value_groks_macro): Likewise...
(m4_symbol_value_flatten_args): ...to this.
* m4/macro.c (collect_arguments): Accomodate changed sense.
* m4/module.c (m4__module_open): Require arguments if flattening
is requested.
* m4/input.c (m4_push_string_finish): For now, flatten all
builtins pushed as back-references.
* modules/gnu.c (m4_builtin_table, builtin): Adjust all clients.
* modules/import.c (m4_builtin_table): Likewise.
* modules/load.c (m4_builtin_table): Likewise.
* modules/modtest.c (m4_builtin_table): Likewise.
* modules/mpeval.c (m4_builtin_table): Likewise.
* modules/perl.c (m4_builtin_table): Likewise.
* modules/shadow.c (m4_builtin_table): Likewise.
* modules/stdlib.c (m4_builtin_table): Likewise.
* modules/time.c (m4_builtin_table): Likewise.
* modules/m4.c (m4_builtin_table): Likewise.
(mkstemp): Undo #undef hack from 2006-10-23, now that macro names
are stringized without preprocessor expansion.
* doc/m4.texinfo (Defn): Update comments to match reality.
(Debuglen): Update test now that user macros pass builtin tokens.
Signed-off-by: Eric Blake <ebb9@byu.net>
2008-03-13 21:09:32 -06:00
Eric Blake
951a9ef5bb
Consistently cast malloc results, for C++ compilation.
...
* m4/builtin.c (m4_builtin_find_by_name): Add cast.
* m4/hash.c (m4_hash_new, m4_get_hash_iterator_next, node_new)
(m4_hash_resize, maybe_grow): Likewise.
* m4/m4.c (m4_create): Likewise.
* m4/macro.c (expand_macro): Likewise.
* m4/output.c (m4_tmpname): Likewise.
* m4/path.c (search_path_add): Likewise.
* m4/symtab.c (m4_symtab_create, m4_symbol_value_create)
(symtab_fetch): Likewise.
* m4/syntax.c (m4_syntax_create): Likewise.
* modules/gnu.c (regexp_compile): Likewise.
* src/main.c (main): Likewise.
* src/freeze.c (reload_frozen_state): Likewise.
Signed-off-by: Eric Blake <ebb9@byu.net>
2008-03-13 12:06:23 -06:00
Eric Blake
2e81b08037
Avoid some magic numbers.
...
* m4/m4private.h (CHAR_EOF, CHAR_BUILTIN, CHAR_QUOTE, CHAR_ARGV)
(CHAR_RETRY): Define in terms of UCHAR_MAX.
* m4/syntax.c (m4_syntax_create, set_syntax_set)
(reset_syntax_set, check_is_single_quotes)
(check_is_single_comments, check_is_macro_escaped)
(m4_set_quotes, m4_set_comment): Likewise.
* modules/gnu.c (regexp_compile): Likewise.
* modules/m4.c (translit): Likewise.
* src/freeze.c (produce_syntax_dump): Likewise.
Reported by Ralf Wildenhues.
Signed-off-by: Eric Blake <ebb9@byu.net>
2008-02-18 06:24:08 -07:00
Eric Blake
7f0b47b96e
* modules/gnu.c (regexp_compile): Use a fastmap for regex speed.
...
Signed-off-by: Eric Blake <ebb9@byu.net>
2008-02-15 16:46:50 -07:00
Eric Blake
4af40c4d6f
Allow builtin text macros to specify number of arguments.
...
* m4/m4module.h (struct m4_macro): Add argument limits to builtin
text macros.
* m4/module.c (install_macro_table): Allow text macros to warn on
extra arguments.
* modules/gnu.c (m4_macro_table): Update all clients.
* modules/load.c (m4_macro_table): Likewise.
* modules/mpeval.c (m4_macro_table): Likewise.
* modules/perl.c (m4_macro_table): Likewise.
* modules/shadow.c (m4_macro_table): Likewise.
* modules/traditional.c (m4_macro_table): Likewise.
* modules/modtest.c (m4_macro_table): Likewise. Also add text
macros, for testing this.
* doc/m4.texinfo (Standard Modules): Update text, and enhance
test.
* tests/modules.at (modules: text): New test.
Signed-off-by: Eric Blake <ebb9@byu.net>
2008-02-11 13:33:08 -07:00
Eric Blake
9123df1a73
Consistently use size_t for number of arguments.
...
* m4/m4module.h (m4_builtin_func): Alter prototype.
(struct m4_builtin): Adjust type of min_args, max_args.
(M4BUILTIN, M4BUILTIN_HANDLER): Adjust all builtins.
(m4_bad_argc, m4_dump_args, m4_macro_call, m4_arg_argc)
(m4_arg_symbol, m4_is_arg_text, m4_is_arg_func, m4_arg_text)
(m4_arg_equal, m4_arg_empty, m4_arg_len, m4_arg_func)
(m4_arg_print, m4_push_arg): Adjust all clients.
* m4/m4private.h (struct m4__symbol_chain, m4_symbol_value)
(m4_macro_args): Adjust type of various fields.
(m4__push_arg_quote): Adjust all clients.
* m4/input.c (m4_pop_wrapup): Likewise.
* m4/macro.c (m4_macro_call, trace_pre, make_argv_ref)
(arg_symbol, m4_arg_symbol, m4_is_arg_text, m4_is_arg_func)
(m4_arg_text, m4_arg_equal, m4_arg_empty, m4_arg_len)
(m4_arg_func, m4_arg_print, m4_make_argv_ref, m4_push_arg)
(m4__push_arg_quote, m4_push_args, m4_arg_argc): Likewise.
* m4/utility.c (m4_bad_argc, m4_dump_args): Likewise.
* modules/evalparse.c (m4_evaluate): Likewise.
* modules/gnu.c (changesyntax): Likewise.
* modules/m4.c (m4_dump_symbols, undefine, popdef, ifelse, defn)
(undivert, traceon, traceoff): Likewise.
* modules/m4.h (m4_dump_symbols_func): Likewise.
* modules/perl.c (perleval): Likewise.
Signed-off-by: Eric Blake <ebb9@byu.net>
2008-02-02 14:55:08 -07:00
Eric Blake
88382ff9ef
Stage 12c: add macro for m4_arg_len.
...
* m4/m4module.h (M4ARGLEN): New macro.
* m4/macro.c (process_macro): Adjust all callers.
* m4/utility.c (m4_dump_args): Likewise.
* modules/m4.c (divert, maketemp, mkstemp, m4wrap, len, index)
(substr): Likewise.
* modules/gnu.c (builtin, indir, mkdtemp, patsubst, regexp)
(renamesyms): Likewise.
* modules/stdlib.c (setenv): Likewise.
Signed-off-by: Eric Blake <ebb9@byu.net>
2008-01-26 00:08:48 -07:00
Eric Blake
e38bf1ca50
Stage 9: share rather than copy single-arg refs.
...
* ltdl/m4/gnulib-cache.m4: Import memmem and quote modules.
* m4/m4module.h (m4_arg_scratch): New prototype.
* m4/m4private.h (m4__push_symbol): Add parameter.
(m4_arg_scratch): Add fast accessor.
(struct m4): Add expansion_level member, taken...
* m4/macro.c (expansion_level): ...from here. Adjust all users.
(expand_argument): Minor cleanup.
(expand_macro): Track scratch space per macro call.
(m4_arg_scratch): New function.
(m4_make_argv_ref): Call new function.
(m4_push_arg): Push reference to $0.
(m4_push_args): Rework separator usage, since separators will
usually be inlined.
(process_macro): Allow embedded NUL.
* m4/input.c (INPUT_INLINE_THRESHOLD): New define.
(m4__push_symbol): Add parameter. Inline short strings, and save
references through rescanning.
* m4/symtab.c (m4_set_symbol_value_text): Weaken assertion.
* modules/m4.c (errprint, index): Handle NUL transparently.
(dumpdef, translit): Use scratch space, rather than expansion
stack.
* modules/gnu.c (renamesyms, m4symbols): Likewise.
* tests/others.at (nul character): New test.
(iso8859): Quote absolute file name, remove XFAIL.
* tests/iso8859.m4: Avoid raw NUL in output.
* tests/null.m4: New file.
* tests/null.out: Likewise.
* tests/null.err: Likewise.
* Makefile.am (OTHER_FILES): Distribute new files.
* .gitattributes: Treat new files as text.
Signed-off-by: Eric Blake <ebb9@byu.net>
2007-12-20 14:46:08 -07:00
Eric Blake
fa34c3f776
Stage 8: extend life of references into argv.
...
* m4/system_.h (obstack_regrow): Delete.
* m4/m4private.h (struct m4_symbol_chain): Add level field.
(m4__push_symbol): Adjust prototype.
(m4__adjust_refcount): New prototype.
(DEBUG_MACRO) [DEBUG]: New debug control.
(struct m4__macro_arg_stacks): New structure.
(struct m4): Add arg_stacks, stacks_count fields.
* m4/m4module.h (m4_make_argv_ref): Add parameter.
* m4/macro.c (argc_stack, argv_stack): Delete, replaced by
context->arg_stacks.
(m4_macro_expand_input) [DEBUG_MACRO]: Add debug hooks,
conditional on M4_DEBUG_MACRO envvar.
(collect_arguments): Adjust signature.
(expand_macro): Rework obstack handling.
(m4__adjust_refcount, arg_mark): New functions.
(m4_make_argv_ref): Populate new field.
(m4_push_arg, m4_push_args): Track inuse.
(process_macro): One less cast.
* m4/m4.c (m4_delete): Clean up arg_stacks.
* m4/input.c (make_text_link): Use new field.
(m4__push_symbol, file_clean): Update signature.
(composite_read): Bump refcount when done with reference.
(composite_clean): New function.
(pop_input): Adjust caller.
* m4/debug.c (m4_debug_message): Make assertion match comment.
* modules/gnu.c (builtin, indir): Adjust callers.
* tests/builtins.at (ifelse): New test.
(exp): Move and rename...
* tests/others.at (countdown): ...to this.
* doc/m4.texinfo (Improved foreach): Fix tracing usage in
example.
Signed-off-by: Eric Blake <ebb9@byu.net>
2007-12-17 21:59:56 -07:00
Eric Blake
a9d31f373b
Stage 6: convert builtins to push arg at a time.
...
* m4/m4module.h (m4_shipout_text): Rename...
(m4_divert_text): ...to this, to avoid confusion with m4_shipout_*
that does not worry about sync lines.
(m4_shipout_string_trunc): New prototype.
* m4/output.c (m4_shipout_text): Rename...
(m4_divert_text): ...to this.
(m4_shipout_string): Move guts...
(m4_shipout_string_trunc): ...to this new function.
* m4/macro.c (m4_push_arg, m4_push_args): New functions.
(expand_token, process_macro): Update callers.
* m4/input.c (string_print): Likewise.
* modules/m4.c (ifdef, ifelse, shift, substr, translit, divert):
Likewise.
* modules/gnu.c (patsubst): Likewise.
(debuglen): Use SIZE_MAX for unlimited debug length.
* src/main.c (main): Likewise.
* m4/m4.c (m4_create): Default max_debug_length to SIZE_MAX, not
zero.
Signed-off-by: Eric Blake <ebb9@byu.net>
2007-12-08 21:05:11 -07:00
Eric Blake
6128996ce3
Stage 4: route indir, builtin through ref; make argv opaque.
...
* m4/system_.h (obstack_regrow): Fix precedence.
* m4/m4module.h (m4_arg_equal, m4_arg_empty, m4_make_argv_ref):
New prototypes.
(struct m4_macro_args): Move...
* m4/m4private.h (struct m4_macro_args): ...here, making it opaque
to modules. Add has_ref member.
(bool_bitfield): New helper typedef.
(struct m4_symbol_chain): Add flatten and len members.
* m4/macro.c (empty_symbol): New placeholder, for optimizing
comparison with empty string.
(m4_macro_expand_input): Initialize it.
(collect_arguments): Alter signature, and populate new fields.
(trace_pre, trace_post): Remove redundant parameter.
(expand_macro): Alter handling of obstacks.
(m4_arg_symbol): Account for wrapped argv.
(m4_arg_equal, m4_arg_empty, m4_make_argv_ref): New methods.
(m4_arg_text, m4_arg_len, m4_arg_func): Use new methods.
* modules/m4.c (ifelse, syscmd): Likewise.
* modules/evalparse.c (m4_evaluate): Likewise.
(undefine, popdef, m4_dump_symbols): Optimize.
* modules/gnu.c (builtin, indir, esyscmd, debugfile): Use new
methods.
(changesyntax, regexp): Optimize.
* m4/output.c (diversion_storage): Use typedef.
Signed-off-by: Eric Blake <ebb9@byu.net>
2007-11-29 22:01:26 -07:00
Eric Blake
17a806c257
Stage 3b: cache length, rather than computing it, in modules.
...
* m4/hash.c (m4_hash_remove): Avoid double free on remove
failure.
* m4/output.c (m4_shipout_string): Change semantics of len param.
(m4_shipout_int): Use cached length.
* m4/input.c (m4_push_string_finish): Likewise.
* modules/m4.h (m4_make_temp_func): Add parameter.
* m4/macro.c (expand_token, m4_arg_len): Use cached length.
(collect_arguments, expand_macro): Alter signature.
(trace_format): Don't use out-of-scope buffer.
(process_macro): All callers changed.
* m4/utility.c (m4_dump_args): Likewise.
* m4/symtab.c (m4_symbol_value_print): Likewise.
* modules/gnu.c (__file__, __program__, builtin, indir)
(m4symbols, mkdtemp, regexp_compile, regexp_substitute,
renamesyms, patsubst, regexp, regexp_compile): Likewise.
* modules/load.c (m4modules): Likewise.
* modules/m4.c (defn, m4wrap, maketemp, m4_make_temp)
(numb_obstack, ifdef, ifelse, divert, len, substr): Likewise.
* modules/perl.c (perleval): Likewise.
* modules/stdlib.c (getcwd, getenv, getlogin, getpwnam, getpwuid)
(hostname, uname, setenv): Likewise.
* modules/mpeval.c (numb_obstack): Likewise.
* src/freeze.c (dump_symbol_CB): Likewise.
* doc/m4.texinfo (Renamesyms, Dumpdef, Changesyntax): Adjust test.
* tests/builtins.at (mkstemp): Likewise.
* tests/others.at (iso8859): XFAIL this test, now that
length-based handling allows NUL through part but not all of M4.
Signed-off-by: Eric Blake <ebb9@byu.net>
2007-11-29 06:55:21 -07:00
Eric Blake
8e1fad3c14
Stage 3a: cache length, rather than computing it, in libm4.
...
* m4/m4module.h (struct m4_macro_args): Cache length.
(m4_get_symbol_len, m4_get_symbol_value_len): New accessors.
(m4_set_symbol_value_text): Change signature.
* m4/m4private.h (struct m4_symbol_value): Store string length.
(m4_get_symbol_value_text, m4_get_symbol_value_placeholder)
(m4_set_symbol_value_placeholder): Update accordingly.
(m4_set_symbol_value_text): Change signature.
(m4_get_symbol_value_len): New accessor.
* m4/input.c (struct m4_input_block, string_peek, string_read)
(string_unget, string_print, m4_push_string_finish)
(m4_push_wrapup): Track length of string input.
(m4__next_token): Adjust all users of symbol text to track length,
too.
* m4/macro.c (expand_argument, collect_arguments): Likewise.
* m4/module.c (install_macro_table): Likewise.
* modules/gnu.c (builtin, indir): Likewise.
* modules/m4.c (define, pushdef): Likewise.
* src/main.c (main): Likewise.
* src/freeze.c (reload_frozen_state): Likewise.
* m4/symtab.c (m4_symbol_value_copy): Likewise.
(m4_get_symbol_value_len): New function.
(m4_get_symbol_value_text, m4_get_symbol_value_placeholder)
(m4_set_symbol_value_text, m4_set_symbol_value_placeholder):
Adjust implementation.
Signed-off-by: Eric Blake <ebb9@byu.net>
2007-11-28 22:07:29 -07:00
Eric Blake
5d2ce0f461
Stage 2: use accessors, not direct reference, into argv.
...
* m4/m4private.h (m4_arg_argc): New fast accessor.
* m4/m4module.h (m4_arg_argc, m4_arg_symbol, m4_is_arg_text)
(m4_is_arg_func, m4_arg_text, m4_arg_len, m4_arg_func): New
prototypes.
(m4_builtin_func, M4BUILTIN, M4BUILTIN_HANDLER, m4_dump_args)
(m4_macro_call): Make argc unsigned.
(M4ARG): Use new accessors.
* modules/m4.c (define, pushdef): Likewise.
(undefine, popdef, ifelse, m4_dump_symbols, defn, undivert)
(traceon, traceoff): Make argc unsigned.
* modules/m4.h (m4_dump_symbols_func): Likewise.
* modules/evalparse.c (m4_evaluate): Likewise.
* modules/gnu.c (builtin, indir): Use new accessors.
(changesyntax): Make argc unsigned.
* modules/perl.c (perleval): Likewise.
* m4/utility.c (m4_dump_args): Use new accessors.
* m4/macro.c (trace_pre): Likewise.
(m4_arg_symbol, m4_arg_argc, m4_is_arg_text, m4_is_arg_func)
(m4_arg_text, m4_arg_len, m4_arg_func): New functions.
(expand_macro, trace_pre, trace_post, m4_macro_call): Update argc
usage.
Signed-off-by: Eric Blake <ebb9@byu.net>
2007-11-27 19:10:43 -07:00
Eric Blake
14b2ffbb82
Stage 1: convert m4_symbol_value** into new object.
...
* ltdl/m4/gnulib-cache.m4: Import flexmember module.
* m4/m4module.h (m4_macro_args): New type, will be opaque to
modules later.
(m4_builtin_func, M4BUILTIN, M4BUILTIN_HANDLER, m4_dump_args)
(m4_macro_call): Alter signature to use m4_macro_args object.
(M4ARG): Redefine to access new struct.
* m4/m4private.h (M4_SYMBOL_COMP): New enumerator.
(struct m4_symbol_chain): New type.
(struct m4_symbol_value): Add chain alternative.
* m4/macro.c (collect_arguments): Build new struct.
(expand_macro, m4_macro_call, process_macro, trace_pre)
(trace_post): Adjust implementation to use it.
* m4/utility.c (m4_dump_args): Likewise.
* modules/gnu.c (builtin, indir): Likewise.
* modules/format.c (format): Likewise.
* modules/m4.h (m4_dump_symbols_func): Likewise.
* modules/m4.c (m4_dump_symbols, define, pushdef, defn, ifelse)
(shift, include, errprint, m4wrap): Likewise.
* modules/evalparse.c (m4_evaluate): Likewise.
Signed-off-by: Eric Blake <ebb9@byu.net>
2007-11-24 16:23:47 -07:00
Eric Blake
32ab6f9f81
Pass only macro name to utility functions.
...
* m4/m4module.h (m4_bad_argc, m4_numeric_arg): Adjust signature.
* m4/utility.c (m4_bad_argc, m4_numeric_arg): Adjust
implementation.
* m4/macro.c (m4_macro_call): Adjust callers.
* modules/gnu.c (builtin, debuglen): Likewise.
* modules/m4.c (ifelse, incr, decr, divert, undivert, m4exit)
(substr): Likewise.
* modules/evalparse.c (m4_evaluate): Likewise.
* modules/stdlib.c (setenv, getpwuid, srand): Likewise.
* modules/time.c (ctime, gmtime, localtime, mktime, strftime):
Likewise.
Signed-off-by: Eric Blake <ebb9@byu.net>
2007-11-24 07:04:18 -07:00
Eric Blake
b6c03a0e43
Add macro name to debugfile messages.
...
* m4/m4module.h (m4_debug_set_output): Add parameter.
* m4/debug.c (m4_debug_set_output, set_debug_file): Pass macro
name through.
* modules/gnu.c (debugfile): Adjust caller.
* modules/m4.c (m4exit): Likewise.
* src/main.c (main): Likewise.
Signed-off-by: Eric Blake <ebb9@byu.net>
2007-11-23 16:14:17 -07:00
Eric Blake
f6e28cf9c7
Factor out handling of macro name in error messages.
...
* m4/m4module.h (m4_error, m4_error_at_line, m4_warn)
(m4_warn_at_line): Add new parameter.
* m4/utility.c (m4_verror_at_line): New helper method.
(m4_error, m4_error_at_line, m4_warn, m4_warn_at_line): Add new
parameter.
(m4_bad_argc, m4_numeric_arg, m4_parse_truth_arg): All callers
changed.
* m4/debug.c: Likewise.
* m4/input.c: Likewise.
* m4/macro.c: Likewise.
* m4/module.c: Likewise.
* m4/output.c: Likewise.
* m4/path.c: Likewise.
* modules/evalparse.c: Likewise.
* modules/format.c: Likewise.
* modules/gnu.c: Likewise.
* modules/load.c: Likewise.
* modules/m4.c: Likewise.
* modules/mpeval.c: Likewise.
* src/freeze.c: Likewise.
* src/main.c: Likewise.
Signed-off-by: Eric Blake <ebb9@byu.net>
2007-11-23 15:18:40 -07:00
Eric Blake
394083c7c6
Fix regexp regression of 2007-09-29.
...
* modules/gnu.c (substitute): Allow NULL buf when no
subexpressions were present.
(regexp): Handle \ escapes even with empty regex.
* doc/m4.texinfo (Regexp, Patsubst): Catch this bug.
Signed-off-by: Eric Blake <ebb9@byu.net>
2007-10-09 13:55:37 -06:00
Eric Blake
2243fca7d2
Cache regex compilation for another autoconf speedup.
...
* modules/gnu.c (gnu_buf): Replace...
(REGEX_CACHE_SIZE, regex_cache): ...with new declarations.
(m4_pattern_buffer): Add fields.
(m4_regexp_compile): Rename...
(regexp_compile): ...to this, and drop no_sub parameter.
Implement caching.
(M4FINISH_HANDLER): Clean up entire cache.
(m4_regexp_search): Rename...
(regex_search): ...to this, adjust to new struct contents, and add
no_sub parameter.
(m4_regexp_substitute): Rename...
(regexp_substitute): ...to this.
(substitute, patsubst, regexp, renamesyms): Adjust callers.
Signed-off-by: Eric Blake <ebb9@byu.net>
2007-10-09 12:16:29 -06:00
Eric Blake
7dab2c5188
Optimize for Autoconf usage pattern.
...
* modules/gnu.c (regexp, patsubst): Handle empty regex faster.
Signed-off-by: Eric Blake <ebb9@byu.net>
2007-10-06 07:08:54 -06:00
Eric Blake
5ced71a68d
Normalize all GPL license notices.
...
* m4/COPYING.LIB: Delete - libm4 is not distributed under LGPLv2
at this time.
* Makefile.am: Update license wording.
* bootstrap: Likewise.
* commit: Likewise.
* configure.ac: Likewise.
* ltdl/config/mailnotify: Likewise.
* ltdl/config/mkstamp: Likewise.
* ltdl/m4/debug.m4: Likewise.
* ltdl/m4/gmp.m4: Likewise.
* ltdl/m4/m4-error.m4: Likewise.
* ltdl/m4/m4-getopt.m4: Likewise.
* ltdl/m4/m4-gettext.m4: Likewise.
* ltdl/m4/m4-obstack.m4: Likewise.
* ltdl/m4/m4-regex.m4: Likewise.
* ltdl/m4/stackovf.m4: Likewise.
* m4/builtin.c: Likewise.
* m4/debug.c: Likewise.
* m4/hash.c: Likewise.
* m4/hash.h: Likewise.
* m4/input.c: Likewise.
* m4/m4.c: Likewise.
* m4/m4module.h: Likewise.
* m4/m4private.h: Likewise.
* m4/macro.c: Likewise.
* m4/module.c: Likewise.
* m4/output.c: Likewise.
* m4/path.c: Likewise.
* m4/resyntax.c: Likewise.
* m4/symtab.c: Likewise.
* m4/syntax.c: Likewise.
* m4/system_.h: Likewise.
* m4/utility.c: Likewise.
* modules/evalp
2007-10-06 07:08:43 -06:00
Eric Blake
4755abc0ee
Upgrade to GPLv3, and document 1.4.10.
...
* bootstrap: Adjust to GPLv3.
(func_update): Port from branch.
* ltdl/m4/gnulib-cache.m4: Augment with 'gnulib-tool
--local-dir=local --import gpl-3.0'.
* doc/m4.texinfo (History): Mention 1.4.11.
(Copying This Package): New appendix.
* NEWS: Document 1.4.10.
* local/doc/gpl-3.0.texi.diff: New file.
* Makefile.am: Update license.
(doc_m4_TEXINFOS, EXTRA_DIST): Distribute additions.
* commit: Update license.
* configure.ac: Likewise.
* ltdl/config/mailnotify: Likewise.
* ltdl/config/mkstamp: Likewise.
* ltdl/m4/debug.m4: Likewise.
* ltdl/m4/gmp.m4: Likewise.
* ltdl/m4/m4-error.m4: Likewise.
* ltdl/m4/m4-getopt.m4: Likewise.
* ltdl/m4/m4-gettext.m4: Likewise.
* ltdl/m4/m4-obstack.m4: Likewise.
* ltdl/m4/m4-regex.m4: Likewise.
* ltdl/m4/stackovf.m4: Likewise.
* m4/builtin.c: Likewise.
* m4/debug.c: Likewise.
* m4/hash.c: Likewise.
* m4/hash.h: Likewise.
* m4/input.c: Likewise.
* m4/m4.c: Likewise.
* m4/m4module.h: Likewise.
* m4/m4private.
2007-10-06 07:08:39 -06:00
Eric Blake
e12ff51c9c
Port format improvements from branch.
...
* doc/m4.texinfo (History): Mention upcoming 1.4.10 release.
(Format): Enhance section.
* modules/format.c (format): Accept %'hhd, and issue warnings on
unrecognized specifiers.
* modules/gnu.c (builtin_format): Adjust how format is called.
2007-10-06 07:08:35 -06:00
Gary V. Vaughan
1722215a83
M4 was designed to have a small number of header files defining
...
the interfaces to several source files each. Keeping this in
mind allows us to tidy things up considerably. Having done this,
it becomes clear that some of the installed headers reference
other headers which are not installed (but that's another patch):
* m4/m4private.h (stdio--.h, stdlib--.h, unistd--.h): Moved from
here...
* m4/system_.h (gnu/stdio--.h, gnu/stdlib--.h, gnu/unistd--.h):
...to here, so client modules can benefit too.
(assert.h, errno.h, limits.h, sys/stat.h): Include one here at the
lowest level to save doing it multiple times elsewhere.
* m4/debug.c (stdio.h): Removed. The portable <gnu/stdio--.h>
is already included via m4private.h.
* modules/time.c (stdio.h): Ditto.
* modules/gnu.c (stdlib.h): Ditto resp <gnu/stdlib--.h>.
* modules/stdlib.c (stdlib.h, unistd.h): Ditto resp <gnu/stdlib--.h>
and <gnu/unistd--.h>,
* m4/m4private.h (m4module.h): Use angle brackets for an installed
file.
* m4/hash.h (system.h): Ditto.
* modules/gnu.c (progname.h): Removed.
* src/freeze.c (m4/system.h, m4private.h): Already included vi m4.h.
* m4/m4private.h (assert.h, errno.h): Already included via
m4/m4module.h.
* m4/input.c (ctype.h): Ditto.
* m4/module.c (ltdl.h): Ditto.
* m4/output.c (errno.h, limits.h, stdio.h, sys/types.h, sys/stat.h)
(unistd.h): Ditto.
* m4/path.c (config.h, stdlib.h): Ditto.
* m4/utility.c (config.h): Ditto.
* modules/evalparse.c (assert.h, ctype.h): Ditto.
* modules/gnu.c (assert.h, ctype.h, errno.h): Ditto.
* modules/import.c (assert.h): Ditto.
* modules/m4.c (assert.h, errno.h): Ditto.
* modules/modtest.c (assert.h): Ditto.
* modules/stdlib.c (sys/types.h): DittAo.
* src/m4.h (ctype.h, errno.h, string.h, sys/types.h, ltdl.h):
Ditto.
* src/stackovf.c (assert.h): Ditto.
* modules/gnu.c (m4/m4module.h, m4private.h): Build using the faster
private interfaces when NDEBUG is defined.
* modules/import.c (m4/m4module.h, m4private.h): Ditto.
* modules/load.c (m4/m4module.h, m4private.h): Ditto.
* modules/m4.c (m4/m4module.h, m4private.h): Ditto.
* modules/modtest.c (m4/m4module.h, m4private.h): Ditto.
* modules/mpeval.c (m4/m4module.h, m4private.h): Ditto.
* modules/perl.c (m4/m4module.h, m4private.h): Ditto.
* modules/shadow.c (m4/m4module.h, m4private.h): Ditto.
* modules/time.c (m4/m4module.h, m4private.h): Ditto.
* modules/traditional.c (m4/m4module.h, m4private.h): Ditto.
* src/m4.h (locale.h): Moved from here...
* src/main.h: ...to here.
(m4private.h): Already included via m4.h.
* src/stackovf.c (m4private.h): Ditto.
2007-10-06 07:08:19 -06:00
Eric Blake
9bdb9e7403
* tests/builtins.at (__m4_version__): New test.
...
* modules/traditional.c (m4_macro_table): Provide windows and os2
macros, as appropriate. Add __traditional__ macro.
* modules/mpeval.c (m4_macro_table): Name the macro __mpeval__,
not __gmp__, to match module name.
* modules/load.c (m4_macro_table): Name the macro __load__, not
__modules__, to match module name.
* doc/m4.texinfo (History, Shell commands, Platform macros): Merge
from the branch.
(Standard Modules): Improve wording.
(Incompatibilities): Move platform macros into their own node.
(Load, Unload): Use actual examples.
* NEWS: Document this change.
* THANKS: Update.
2007-10-06 07:07:55 -06:00
Eric Blake
bee5be2a29
* m4/m4module.h (m4_set_syntax): Change signature.
...
* modules/gnu.c (m4_resyntax_encode_safe): Reduce error to
warning.
(changesyntax): Likewise, and update caller.
* m4/m4private.h (m4_syntax_table): Add orig member.
* m4/syntax.c (m4_set_quotes, m4_set_comment): Merge from branch.
Don't set is_single_quotes and is_single_comments when the begin
character is shadowed by another syntax type.
(m4_syntax_create): Populate default syntax table.
(add_syntax_attribute): Don't lose quote assignment.
(remove_syntax_attribute): Only allow removing rquote or ecomm.
(add_syntax_set, subtract_syntax_set, set_syntax_set)
(reset_syntax_set): New helper routines.
(m4_set_syntax): Alter semantics - NUL key reverts entire syntax
to default, and empty chars reverts that key to default.
(check_is_single_quotes, check_is_single_comments): New helper
routines.
* modules/m4.c (changecom): Merge from branch.
* m4/input.c (m4__next_token): Rearrange token recognition order
to macro, quote, comment,
2007-10-06 07:07:45 -06:00
Eric Blake
36b52dd4b1
* modules/m4.h (m4_sysval_flush_func): Adjust prototype.
...
* modules/m4.c (m4_sysval_flush): Add parameter, so that m4exit
can track write errors without all other callers warning multiple
times.
(sysval_flush_helper): New function.
(dumpdef, syscmd, errprint, m4exit): Adjust callers.
* modules/gnu.c (esyscmd): Likewise.
* tests/others.at (stdout closed, stdout full): Error message
update.
2007-10-06 07:07:43 -06:00
Eric Blake
5e96b6de8f
Add several new command line options.
...
* src/main.c (usage): Update.
(OPTSTRING, long_options): Add --pushdef, --popdef, --gnu,
--traceon, --traceoff, --syncoutput, --warnings, --unload-module.
Make --regexp-syntax argument optional.
(main): Support new options. Fix regression in interactive
behavior from Nov 8.
* m4/m4private.h (M4_OPT_SYNCOUTPUT_BIT): Rename from
M4_OPT_SYNC_OUTPUT_BIT.
* m4/m4module.h (m4_context_opt_bit_table): Rename sync_output to
syncoutput, to match option.
(m4_parse_truth_arg): New prototype.
* m4/utility.c (m4_parse_truth_arg): Implement it.
* m4/output.c (m4_shipout_text): Adjust sync_output caller.
* modules/gnu.c (syncoutput): Adjust sync_output caller, and use
m4_parse_truth_arg.
* doc/m4.texinfo (Operation modes, Dynamic loading features)
(Preprocessor features, Limits control, Debugging options)
(Command line files): Update documentation.
* tests/builtins.at (mkstemp): Simplify.
* tests/macros.at (Command line pushdef): New test.
(Command lin
2007-10-06 07:07:33 -06:00
Eric Blake
e8a13d29c5
One step closer to allowing C++ compilation - don't blindly
...
convert between char* and unsigned char*.
* m4/m4module.h (m4_set_syntax): Change signature.
* m4/m4private.h (m4_string): Use signed char.
(m4_get_syntax_lquote, m4_get_syntax_rquote, m4_get_syntax_bcomm)
(m4_get_syntax_ecomm): No longer a need to cast.
* m4/syntax.c (m4_set_syntax, m4_syntax_create, m4_set_quotes):
Reflect this change.
* m4/macro.c (expand_argument): Simplify.
(expand_token): Use proper type.
* src/freeze.c (reload_frozen_state): Likewise.
* m4/input.c (MATCH, match_input): Likewise.
* modules/m4.c (translit): Likewise.
* modules/gnu.c (substitute): Simplify.
2007-10-06 07:07:32 -06:00
Eric Blake
36a89bf3c9
* m4/macro.c (expand_argument): Fix missing initialization.
...
* m4/m4private.h (struct m4_symbol_value): Store entire
m4_builtin, not just the func.
(m4_get_symbol_value_func): Update.
(m4_get_symbol_value_builtin, m4_set_symbol_value_builtin): New
fast accessors.
* m4/m4module.h (m4_get_symbol_value_builtin)
(m4_get_symbol_builtin): New prototypes.
(m4_set_symbol_value_func): Delete, replace with...
(m4_set_symbol_value_builtin): New function.
(m4_builtin_find_by_name): Change signature.
* m4/symtab.c (m4_symbol_value_print): Simplify.
(m4_get_symbol_value_func): Update.
(m4_get_symbol_value_builtin): New function.
(m4_set_symbol_value_func): Delete, replace with...
(m4_set_symbol_value_builtin): New function.
(dump_symbol_CB) [DEBUG_SYM]: Simplify.
* m4/builtin.c (m4_builtin_find_by_name): Change signature.
* m4/input.c (struct m4_input_block): Remove unused trace member.
(m4_push_builtin, builtin_print, init_builtin_token): Update
callers.
* m4/module.c (install_builtin_tab
2007-10-06 07:07:20 -06:00
Eric Blake
935b9801aa
* modules/m4.c (m4_make_temp): Change signature.
...
(maketemp, mkstemp): Update callers.
* modules/m4.h (m4_make_temp_func): New export.
* modules/gnu.c (mkdtemp): New macro.
* doc/m4.texinfo (Operation modes): Document interaction with
--safer.
(Mkdtemp): New node.
* tests/builtins.at (mkdtemp): New test.
(mkstemp): Check for umask effect.
* NEWS: Document new builtin.
2007-10-06 07:07:10 -06:00
Eric Blake
ae3382c886
* configure.ac (AC_CONFIG_HEADERS): Name the template config.hin,
...
not config-h.in.
* modules/gnu.c (builtin, indir): Transparently handle builtin
tokens from defn.
* doc/m4.texinfo (Indir, Builtin): Remerge from branch.
* m4/input.c (m4_pop_wrapup): Display debug message when switching
to wrapped text.
(m4_input_init): No need to use empty file any more.
(file_print): Display correct file name.
* m4/utility.c (m4_error, m4_warn): Ensure we don't try to
dereference a NULL file name.
* m4/m4module.h (m4_pop_wrapup): New parameter.
(m4_symbol_value_groks_macro, m4_symbol_groks_macro): New
prototypes.
* m4/m4private.h (m4_symbol_value_groks_macro): Faster version.
* m4/symtab.c (m4_symbol_value_groks_macro): New method.
* src/main.c (main): Adjust caller.
* tests/options.at (--debugmode): Test more output from -dV.
2007-10-06 06:59:17 -06:00
Eric Blake
23b5e7571c
* modules/gnu.c (gnu_buf): Rename from buf to silence -Wshadow.
2007-10-06 06:59:12 -06:00
Eric Blake
310ea9dc1f
* m4/utility.c (m4_numeric_arg): Merge from branch.
...
* modules/gnu.c (debuglen): New builtin.
* src/main.c (usage, ARGLENGTH_OPTION, long_options, main):
Rename --arglength to --debuglen.
* tests/options.at (--arglength): Rename to --debuglen.
(deprecated options): Augment test.
* doc/m4.texinfo (Invoking m4): Document the name change.
(Debugmode): Rename from Debug Levels.
(Debugfile): Rename from Debug Output.
(Debuglen): New node.
* NEWS: Document these changes.
2007-10-06 06:59:09 -06:00
Eric Blake
cb0876cdf6
Avoid all global variables in modules, so that --disable-static
...
can work on cygwin.
* examples/incl.m4: New file, from branch.
* Makefile.am (dist_pkgdata_DATA): Distribute it.
* doc/m4.texinfo (Location): Merge this section from branch.
(Include): Update the test.
* tests/generate.awk (new_test): Allow for VPATH build
pre-processing of expected __program__ output.
* m4/m4module.h (m4_current_diversion, m4_output_current_line):
Avoid global variables.
(m4_context_field_table): Add current_diversion, output_line.
(m4_output_init, m4_make_diversion): Add parameter.
(m4_get_program_name, m4_set_program_name): New accessors.
* m4/m4private.h (m4_get_current_diversion),
(m4_set_current_diversion, m4_get_output_line)
(m4_set_output_line): New accessors.
* m4/utility.c (m4_get_program_name, m4_set_program_name): New
methods.
* modules/m4.c (divnum, divert): Adjust callers.
* modules/gnu.c (__program__): Likewise.
* m4/output.c (m4_output_init, m4_make_diversion)
(m4_freeze_diversio
2007-10-06 06:59:05 -06:00
Eric Blake
71fcb4614d
Partially plug memory leak when unloading gnu module.
...
* tests/modules.at (unload gnu module): New test.
* modules/gnu.c (gnu_LTX_m4_finish_module): New function.
(m4_regexp_compile): Move static storage to module visibility.
* tests/options.at (--debug): Adjust to new output.
2007-10-06 06:59:04 -06:00
Eric Blake
00d057565b
Even when not the first option, --help can't have side effects.
...
* tests/options.at (--debugfile): Detect bugs in this area.
* tests/testsuite.at (AT_CHECK_M4): Avoid a process when ignoring
stderr.
* src/main.c (main): Fix it by deferring debugfile change. Also,
defer closing streams until after module tracing is done.
* modules/gnu.c (debugfile): Make message consistent with command
line.
* doc/m4.texinfo (Invoking m4): Touch up the documentation.
* NEWS: Document this fix.
2007-10-06 06:59:03 -06:00
Eric Blake
6ec3170c49
* modules/m4.c (m4_dump_symbols, errprint, m4wrap)
...
(m4_expand_ranges): Ensure we aren't picking up partial object on
obstack.
* modules/stdlib.c (setenv): Allow extra arguments.
* modules/time.c (ctime): Avoid side effect in call to
obstack_grow.
* modules/gnu.c (m4_regexp_substitute): Likewise.
(renamesyms): Avoid extra obstack_init.
* src/freeze.c (reload_frozen_state): Remove debug comment.
(produce_frozen_state): Simplify fprintf to puts where possible.
* modules/modtest.c (modtest_init, modtest_finish): Likewise.
* modules/import.c (import, symbol_fail, modules_fail): Likewise.
* m4/macro.c (trace_flush): Likewise.
* m4/debug.c (m4_debug_message_prefix): Likewise.
* m4/path.c (include_dump): Likewise.
* m4/module.c (module_remove): Likewise.
(install_builtin_table): Simplify malloc and string
concatenation.
2007-10-06 06:58:58 -06:00
Eric Blake
92a30082b1
* configure.ac (AC_CONFIG_HEADERS): Place <config.h> with other
...
gnulib headers.
* Makefile.am (AUTOMAKE_OPTIONS): Add nostdinc, to reduce length
of lines during make.
(AM_CPPFLAGS): Remove unneeded include path.
(src_m4_CPPFLAGS): Remove redundant include path.
* m4/system_.h Make preprocessor indentation consistent.
(M4_DIRSEP_CHAR, M4_PATHSEP_CHAR, M4_GNUC_FORMAT): Remove unused
macros.
(UNIX, W32_NATIVE, OS2): Update platform recognition macros from
branch.
(M4_GNUC_PRINTF, M4_GNUC_SCANF, M4_GNUC_NORETURN)
(M4_GNUC_CONST, M4_GNUC_UNUSED): Mangle names properly for header.
(bool, true, false): Don't undefine here; stdbool takes care of
that.
* src/m4.h (includes): Assume config.h, and several standard
headers.
(__CYGWIN__, WIN32): Don't define here; let system.h do it.
* m4/m4private.h: Assume config.h.
* m4/output.c: Likewise.
* m4/path.c: Likewise.
* m4/resyntax.c: Likewise.
* m4/utility.c: Likewise.
* modules/gnu.c: Likewise.
* modules/import.c: Likewise.
* modules/load
2007-10-06 06:58:56 -06:00
Eric Blake
585036394c
* modules/load.c (modules): Rename to...
...
(m4modules): ...this, since it is an English word with 0
arguments.
* modules/gnu.c (symbols, m4symbols): Likewise.
* doc/m4.texinfo (Listing Modules): Rename to...
(M4modules): ...this.
(Symbols): Rename to...
(M4symbols): ...this.
(Load, Foreach, Trace, Answers): Update to new spellings.
* NEWS: Document this.
2007-10-06 06:58:50 -06:00
Eric Blake
055a40f1a5
Add --safer option, per debian bug 5898.
...
* src/main.c (usage): Document new option.
(SAFER_OPTION): New enumerator.
(main): Set the option bit.
* m4/m4module.h (m4_context_opt_bit_table): Declare new bit
accessors.
* m4/m4private.h (M4_OPT_SAFER_BIT): New macro.
(m4_get_safer_opt): New accessor.
* modules/gnu.c (esyscmd, debugfile): Disable when --safer.
* modules/m4.c (syscmd, maketemp): Likewise.
* doc/m4.texinfo (Invoking m4, Debug Output, Syscmd, Esyscmd)
(Sysval, Maketemp): Add tests of this.
* tests/options.at (--safer): Likewise.
2007-10-06 06:58:46 -06:00
Eric Blake
b0c19f2819
* m4/macro.c (expansion_level, macro_call_id): Change to size_t.
...
All users updated.
(expand_token): Avoid assertion just added to docs.
(expand_macro): Track pending expansions, for when a symbol's
definition changes during argument collection.
(m4_macro_call, process_macro): Operate on symbol value, not
symbol, since symbol may have changed during argument collection.
* m4/m4private.h (m4_symbol_value): Add pending_expansions member.
(VALUE_PENDING, SYMBOL_PENDING, VALUE_DELETED_BIT): New defines.
(m4_get_symbol_value): Add fast macro version.
* m4/m4module.h (M4_BUILTIN_FLAGS_MASK): New enumerator.
(m4_macro_call): Adjust prototype.
* m4/module.c (install_builtin_table): Check that flags are valid
when creating builtin.
* m4/symtab.c (m4__symtab_remove_module_references): Use
m4_symbol_value_delete, rather than inlining it.
(m4_symbol_value_copy): Copy placeholder text.
(symbol_popval): Use m4_symbol_value_delete.
(m4_symbol_value_delete): Implementation was missing when N
2007-10-06 06:58:28 -06:00
Eric Blake
311fdd9550
* m4/utility.c (m4_warn): Factor "Warning" out of messages into
...
here.
(m4_bad_argc, m4_numeric_arg): Update all callers.
* m4/macro.c (m4_macro_call): Likewise.
* doc/m4.texinfo (Defn, Pushdef): Fix typos in last commit.
(Indir, Builtin, Ifdef): More doc merges.
(Loops): Mention that documenting foreach would be nice.
(Macro Arguments, Defn, Builtin, Ifdef, Ifelse, Changesyntax)
(Include, Eval, Location, M4exit): s/input.m4/stdin/.
* modules/gnu.c (indir, builtin): Warn, not error, on undefined.
(substitute, syncoutput): Update all m4_warn callers.
* modules/m4.c (undefine, popdef, m4_dump_symbols, defn)
(traceon, traceoff): Make warning message consistent.
(define, pushdef): Update all m4_warn callers.
* tests/generate.awk: Choose file name so that documentation can
show command-line behavior.
* tests/builtins.at (define): Update to new wording.
* tests/macros.at (pushdef/popdef): Likewise.
* tests/freeze.at (loading format 1): Likewise.
* tests/modules.at (AT_CHECK_M4_MODT
2007-10-06 06:53:35 -06:00
Eric Blake
4c4b73d2d9
* m4/utility.c (m4_bad_argc): Move assertion out of hot path...
...
* m4/module.c (install_builtin_table): ...to here, and add
assertion that blind macros require arguments.
* m4/m4module.h (struct m4_builtin): Document restrictions that
must be met during module loading.
* modules/gnu.c (changeresyntax, changesyntax): These are blind,
so require an argument to avoid triggering assertion.
(debugfile): Tweak error message.
2007-10-06 06:53:29 -06:00
Eric Blake
832c5ebd68
* m4/m4module.h (M4_BUILTIN_GROKS_MACRO, M4_BUILTIN_BLIND)
...
(M4_BUILTIN_SIDE_EFFECT): New enumerators.
(struct m4_builtin): New member flags replaces groks_macro_args,
blind_if_no_args. min_args and max_args are now 0-based.
Rearrange members to reduce size on platforms where function
pointers are 64 bits but regular pointers are 32.
(m4_bad_argc): Add argument.
* m4/m4private.h (VALUE_SIDE_EFFECT_ARGS_BIT): New define.
* m4/utility.c (m4_bad_argc): Simplify calculation, and take side
effect into account.
* m4/module.c (install_builtin_table): Adjust all users affected
by this API change.
* m4/macro.c (m4_macro_call): Likewise.
* src/freeze.c (reload_frozen_state): Likewise.
* modules/m4.c (builtin_functions, ifelse, syscmd): Likewise.
* modules/gnu.c (builtin_functions, builtin, esyscmd): Likewise.
* modules/import.c (builtin_functions): Likewise.
* modules/load.c (builtin_functions): Likewise.
* modules/modtest.c (builtin_functions): Likewise.
* modules/mpeval.c (builtin_f
2007-10-06 06:53:26 -06:00