2009-08-24 Eric Blake Pick up gnulib fixes for sub-process execution. * gnulib: Update. * tests/others.at (stdin and stdout closed): New test, to avoid regression introduced on 1.4 branch on 2008-07-17. * NEWS: Document the change. A status of 127 does not always imply esyscmd failure. * modules/gnu.c (esyscmd): Silence gnulib message; regression introduced 2009-03-13. * doc/m4.texinfo (Sysval): Test this. * NEWS: Document the change. 2009-06-26 Eric Blake Use bitrotate for hashing. * gnulib: Update to latest. * ltdl/m4/gnulib-cache.m4: Import bitrotate module. * m4/hash.c (m4_hash_string_hash): Use it. Fix description of limits on diversions. * doc/m4.texinfo (Diversions): Fix grammar. Be less pessimistic about limitations. * THANKS: Update. Reported by Elias Benali. 2009-06-17 Eric Blake Stress test for hash resizing. * tests/builtins.at (define): Enhance test. 2009-06-15 Eric Blake Document why bootstrap might touch state of tree. * bootstrap: Fix typos. Add comment. * HACKING: Add notes about this scenario. * gnulib: Update to latest version. * .gitignore: Track gnulib changes. Drop .cvsignore and redundant .gitignore files. * .cvsignore: Delete. We are moving further away from CVS. * build-aux/.cvsignore: Likewise. * doc/.cvsignore: Likewise. * examples/.cvsignore: Likewise. * ltdl/.cvsignore: Likewise. * m4/.cvsignore: Likewise. * modules/.cvsignore: Likewise. * po/.cvsignore: Likewise. * src/.cvsignore: Likewise. * tests/.cvsignore: Likewise. * .gitignore: Consolidate from other files. * build-aux/.gitignore: Delete, now that it is consolidated. * doc/.gitignore: Likewise. * examples/.gitignore: Likewise. * ltdl/.gitignore: Likewise. * m4/.gitignore: Likewise. * modules/.gitignore: Likewise. * po/.gitignore: Likewise. * src/.gitignore: Likewise. * tests/.gitignore: Likewise. * bootstrap: Simplify accordingly. Sync gnulib tree prior to libtoolize, to avoid libtool overwriting config.guess. Avoid compiler warning. * m4/macro.c (process_macro): Use correct type for isdigit. 2009-06-13 Eric Blake Avoid snprintf link failures. * ltdl/m4/gnulib-cache.m4: Import snprintf-posix module. Reported by Ralf Wildenhues. 2009-06-12 Ralf Wildenhues Avoid pointer arithmetic on `void *'. * modules/m4.c (dump_symbol_CB): Cast obstack_base return value to `char *' before using it. 2009-05-04 Eric Blake Silence verbose testsuite runs. * tests/testsuite.at (m4_version_prereq): Bump to recent autoconf.git version where stdout-nolog was added. * tests/builtins.at (esyscmd, syscmd): Use new stdout-nolog. * tests/freeze.at (AT_TEST_FREEZE): Likewise. * tests/others.at (stderr closed): Likewise. * HACKING: Mention new requirement. * bootstrap: Likewise. Reported by Ralf Wildenhues. 2009-04-21 Eric Blake Be more explicit about default quoting characters. * doc/m4.texinfo (Quoted strings): Call out characters by name. * THANKS: Update. Suggested by Mehul Sanghvi. 2009-04-16 Eric Blake Use gnulib rename module. * ltdl/m4/gnulib-cache.m4: Import rename module. At the moment, we don't tickle either of the platform bugs that it fixes, but it is better to be safe than sorry. Require newer automake features. * configure.ac (AM_INIT_AUTOMAKE): Add dist-xz, color-tests, parallel-tests, and silent-rules. Drop dist-lzma. * HACKING: Update minimum requirements. * gnulib: Update to latest version. Mention release of 1.4.13. * NEWS: Update to match release on branch-1.4. * doc/m4.texinfo (History): Update release history. (copying): Finish conversion to GFDL 1.3, started 2008-11-04. 2009-03-23 Eric Blake Exploit git submodule by adding appropriate symlinks. * bootstrap: No longer copy files from gnulib. * COPYING: Change to symlink pointing into gnulib. * INSTALL: Likewise. * build-aux/compile: Likewise. * build-aux/config.guess: Likewise. * build-aux/config.sub: Likewise. * build-aux/depcomp: Likewise. * build-aux/install-sh: Likewise. * build-aux/mdate-sh: Likewise. * build-aux/missing: Likewise. * build-aux/texinfo.tex: Likewise. * .cvsignore: Reflect these changes. * .gitignore: Likewise. * build-aux/.cvsignore: New file. * build-aux/.gitignore: Likewise. Make gnulib a git submodule. * .gitmodules: New file. * gnulib: Record which version of gnulib has been tested. * bootstrap: Aid in submodule usage. * cfg.mk (gnulib_dir): Alter default location of gnulib. * HACKING: Mention how to use submodule. 2009-03-21 Eric Blake Use memcmp2 to simplify lexicographic comparisons. * ltdl/m4/gnulib-cache.m4: Import memcmp2. * modules/m4.c (dumpdef_cmp_CB): Use it. 2009-03-19 Ralf Wildenhues Fix m4.1 build race, exposed by parallelism through GNUmakefile. * Makefile.am (SUBDIRS): Add doc. (Documentation rules): Move ... * doc/Makefile.am: ... to this new file. * configure.ac (AC_CONFIG_FILES): Generate doc/Makefile. 2009-03-13 Eric Blake Try to tolerate spaces in directory names in testsuite. * tests/null.m4: Provide shell quoting, in case __program__ contains spaces. Fix awk script portability. * checks/get-them: In gsub, properly escape {. Reported by Gary V. Vaughan. Make bootstrap easier on Solaris. * bootstrap: Add GNULIB_SRCDIR. Useful when a wrapper script gnulib-tool exists earlier on the path to work around /bin/sh failure in parsing $GNULIB_SRCDIR/gnulib-tool. 2009-03-13 Eric Blake Allow configuration choice in syscmd shell. * ltdl/m4/m4-syscmd.m4: New file. * configure.ac (M4_SYSCMD): Use it to provide --with-syscmd-shell. (AC_CHECK_HEADERS_ONCE): No longer need to worry about . * modules/m4.c (syscmd): Use it to avoid hard-coding the shell location. * modules/gnu.c (esyscmd): Likewise. * doc/m4.texinfo (Syscmd, Esyscmd): Document this. * README: Document new configure option. * NEWS: Likewise. Use gnulib pipe module instead of popen(3). * ltdl/m4/gnulib-cache.m4: Import pipe and wait-process modules. * modules/gnu.c (M4_SYSVAL_EXITBITS, M4_SYSVAL_TERMSIGBITS): Delete. (esyscmd): Rewrite with pipe module. Resolves a failure on AIX, reported by Gary V. Vaughan. Use gnulib execute module instead of system(3). * ltdl/m4/gnulib-cache.m4: Import execute module. * m4/utility.c (m4_info_name): New function. * m4/m4module.h (m4_info_name): New prototype. * modules/m4.c (syscmd): Rewrite with execute module. (M4_SYSVAL_EXITBITS, M4_SYSVAL_TERMSIGBITS, m4_sysval): Move computation... * modules/gnu.c (M4_SYSVAL_EXITBITS, M4_SYSVAL_TERMSIGBITS) (esyscmd): ...here. Resolves a failure on AIX, reported by Gary V. Vaughan. 2009-03-05 Eric Blake Improve web-manual maintainer rule. * maint.mk (web-manual): Factor package-specific detail... * cfg.mk (manual_title): ...to new variable. 2009-02-23 Eric Blake Speed up translit when from argument is short. * modules/m4.c (translit): Use memchr2 when possible. * tests/builtins.at (translit): Add tests. * NEWS: Document this. 2009-02-18 Eric Blake Prefer buffer over byte operations. * modules/format.c (format): Use memchr for speed. * modules/gnu.c (substitute): Likewise. * m4/macro.c (locate_dollar): Inline into only caller... (process_macro): ...and rearrange for readability. * m4/input.c (consume_buffer): Allow C++ compilation. * doc/m4.texinfo (Changesyntax): Enhance test. Speed up esyscmd with buffer reads. * modules/gnu.c (esyscmd): Read blocks directly into obstack, rather than repeatedly reading bytes. Detect read errors. Avoid risk of stack overflow. * m4/output.c (insert_file): Avoid stack allocation of large buffer. Synchronize THANKS with branch. * THANKS: Import more names. Improve handling of $ in syntax table. * m4/m4module.h (m4_is_syntax_single_dollar): New function. (M4_SYNTAX_DOLLAR, M4_SYNTAX_LBRACE, M4_SYNTAX_RBRACE): Change to be context rather than basic syntax categories. (M4_SYNTAX_MASKS): Adjust macro. * m4/m4private.h (struct m4_syntax_table): Add dollar and is_single_dollar members. (m4_is_syntax_single_dollar): Add fast alternative. * m4/syntax.c (m4_syntax_create, reset_syntax_set): Adjust to account for change to context categories. (m4_set_syntax): Manage is_single_dollar. (m4_is_syntax_single_dollar): New function. * m4/macro.c (locate_dollar): New helper function. (process_macro): Use it to speed up macro expansion. * m4/input.c (m4__next_token): Adjust client. * doc/m4.texinfo (Changesyntax): Document this. 2009-02-17 Eric Blake Sync changecom documentation with branch. * doc/m4.texinfo (Changecom): Tweak wording. * NEWS: Import changes from the branch. Stage 29b: Process quotes and comments by buffer, not bytes. Search for quote and comment delimiters by buffer when possible. Memory impact: none. Speed impact: noticeable improvement, from fewer function calls. * ltdl/m4/gnulib-cache.m4: Import memchr2 module. * m4/input.c (m4__next_token): Add buffer reads to quote and comment parsing. * NEWS: Document this. 2009-02-16 Eric Blake Stage 29a: Process dnl and macro names by buffer, not bytes. Enhance input engine to provide lookahead buffer, rather than forcing clients to call next_char for every byte. Utilize this for the simplest clients. Memory impact: none. Speed impact: noticeable improvement, from fewer function calls. * ltdl/m4/gnulib-cache.m4: Import freadptr and freadseek modules. * m4/input.c (struct input_funcs): Add virtual functions buffer_func and consume_func. (file_buffer, file_consume, string_buffer, string_consume) (composite_buffer, composite_consume, eof_buffer): Implement them. (file_funcs, string_funcs, composite_funcs, eof_funcs): Update vtables accordingly. (buffer_retry): New sentinel. (next_buffer, consume_buffer): New functions. (m4_skip_line, match_input, consume_syntax): Use them for faster parsing. Suggested by Bruno Haible. Unify single and multi-character delimiter handling. * m4/input.c (MATCH): Add a parameter. (m4__next_token): Simplify logic and reduce redundancy. (m4__next_token_is_open): Adjust caller. * m4/syntax.c (m4_set_comment, m4_set_quotes): Handle delimiters of differing lengths. (m4_set_syntax): Recognize restoration of single delimiters. Revamp changesyntax vs. changequote interactions. * m4/m4module.h (M4_SYNTAX_VALUE): Delete unused macro. (M4_SYNTAX_SUSPECT): New macro. * m4/m4private.h (struct m4_syntax_table): Add suspect field. * m4/syntax.c (check_is_single_quotes, check_is_single_comments) (check_is_macro_escaped): Delete, by inlining body... (m4_set_syntax): ...into here. Improves handling between changesyntax and changequote/changecom. (add_syntax_set, subtract_syntax_set, set_syntax_set): Simplify, and let suspect field track needed cleanup. (m4_set_quotes, m4_set_comment): Adjust meaning of is_single_quotes and is_single_comment flags to always be true if only one delimiter exists, regardless of its length. Ensure that the syntax categories M4_SYNTAX_LQUOTE and M4_SYNTAX_BCOMM are only used on 1-byte delimiters. (add_syntax_attribute, remove_syntax_attribute): Change signature to allow the use of fewer casts. Adjust the suspect field when necessary. (m4_reset_syntax, set_quote_age): Adjust callers. * m4/input.c (m4__next_token, m4__next_token_is_open): Simplify callers. * doc/m4.texinfo (Changesyntax): Update documentation and tests. Improve changesyntax documentation. * doc/m4.texinfo (Changesyntax): Merge two tables into one multitable. Fix regression in multicharacter quotes, from 2008-01-26. * m4/input.c (m4__next_token): Fix typo. * tests/builtins.at (changequote): Enhance test. 2009-02-13 Eric Blake Speed up parsing when detecting input file change. * m4/input.c (next_char): Clear input_change flag. Bug introduced 2006-10-25. 2009-02-12 Eric Blake Avoid quadratic code when walking definition stack. * examples/stack_sep.m4: Use linear, not quadratic implementation. * doc/m4.texinfo (Improved copy): Fix documentation, based on recent autoconf bug fix. * tests/others.at (recursion): Enhance test. 2009-02-11 Eric Blake Stage 28c: Warn on embedded NUL in remaining cases. Ensure all remaining warnings can handle embedded NUL. Memory impact: none. Speed impact: none noticed. * m4/m4module.h (m4_debug_decode, m4_parse_truth_arg): Add parameter. * m4/macro.c (m4_macro_call): Improve diagnostic. * modules/m4.c (defn): Likewise. * m4/debug.c (m4_debug_decode): Handle embedded NUL. * m4/utility.c (m4_parse_truth_arg): Likewise. * modules/format.c (arg_int, arg_long, arg_double): Likewise. (arg_string): New function. (ARG_INT, ARG_LONG, ARG_STR, ARG_DOUBLE): Update callers. * src/main.c (main): Likewise. * src/freeze.c (reload_frozen_state): Likewise. * modules/gnu.c (debugmode, syncoutput): Likewise. * tests/options.at (--regexp-syntax): Adjust test. * tests/freeze.at (reloading nul): Likewise. * tests/null.m4: Likewise. * tests/null.out: Likewise. * tests/null.err: Likewise. Stage 28b: Warn on embedded NUL in file arguments. Quote warning messages related to file and other NUL-terminated system commands. Memory impact: none. Speed impact: none noticed. * m4/path.c (m4_path_search): Quote file names in message. * modules/m4.c (syscmd, include, m4_make_temp): Handle embedded NUL. * modules/gnu.c (debugfile, esyscmd): Likewise. * tests/others.at (nul character): Adjust test. * tests/builtins.at (mkdtemp, mkstemp): Likewise. * tests/null.m4: Likewise. * tests/null.out: Likewise. * tests/null.err: Likewise. Stage 28a: Warn on embedded NUL in numeric arguments. Quote warning messages related to numeric parsing in order to handle embedded NUL. Memory impact: none. Speed impact: none noticed. * m4/m4module.h (m4_numeric_arg): Adjust prototype. * m4/utility.c (m4_numeric_arg): Add parameter. * modules/gnu.c (debuglen): Adjust callers. * modules/m4.c (incr, decr, divert, undivert, m4exit, substr) (index): Likewise. * modules/evalparse.c (m4_evaluate): Likewise. * modules/stdlib.c (setenv, getpwuid, srand): Likewise. * modules/time.c (ctime, gmtime, localtime, mktime, strftime): Likewise. * doc/m4.texinfo (Changesyntax): Fix typo. * tests/others.at (nul character): Adjust test. * tests/null.m4: Likewise. * tests/null.out: Likewise. * tests/null.err: Likewise. 2009-02-11 Eric Blake Avoid regression in popdef(undef). * doc/m4.texinfo (Trace): Enhance test, to cover regression recently fixed on the branch. 2009-02-09 Eric Blake Enhance index to support starting offset. * modules/m4.c (index): Add optional third argument. * NEWS: Document this. * doc/m4.texinfo (Index macro): Likewise. (Macro Arguments): Adjust tests. 2009-01-24 Eric Blake Add URLs to --help output. * src/main.c (usage): Use enhanced version-etc features. 2009-01-07 Eric Blake Enhance substr to support replacement text. * doc/m4.texinfo (Substr): Document new semantics. * modules/m4.c (substr): Support optional fourth argument. * NEWS: Document this. Enhance substr to support negative values. * doc/m4.texinfo (Substr): Document new semantics, and how to simulate old. * modules/m4.c (substr): Support negative values. * NEWS: Document this. 2009-01-05 Eric Blake Maintainer cleanups. * HACKING: Remove mention of xdelta. * Makefile.am (EXTRA_DIST, MAINTAINERCLEANFILES): Let gnulib take care of distributing gendocs.sh. * maint.mk (web-manual): Use new feature of gendocs. * ltdl/m4/gnulib-cache.m4: Regenerate. 2008-12-24 Eric Blake Relax eval as allowed by POSIX 2008. * modules/evalparse.c (m4_evaluate): Warn, not error, on invalid operator. Quote expression in warning. * modules/mpeval.c (includes): Add quotearg.h. * doc/m4.texinfo (Eval, Improved forloop): Update tests. * NEWS: Update to reflect 1.6 support for `?:'. 2008-12-23 Eric Blake Add debugmode(o) to control dumpdef output location. * m4/m4module.h (M4_DEBUG_TRACE_OUTPUT_DUMPDEF): New enumerator. (M4_DEBUG_TRACE_VERBOSE): Update. * m4/debug.c (m4_debug_decode): Support new debug option. * src/freeze.c (produce_debugmode_state): Likewise. * modules/m4.c (dumpdef): When set, force dumpdef to stderr rather than the debug file. * src/main.c (usage): Document it. * doc/m4.texinfo (Debugmode, Dumpdef, Debugging options) (Debugfile): Likewise. * NEWS: Likewise. Based on an autoconf bug report by Paolo Bonzini. Make --debugfile argument optional. * src/main.c (long_options): Make the argument optional, to allow setting debug file back to stderr. (main): Make --debugfile order-dependent. (usage): Document this. * doc/m4.texinfo (Debugging options): Likewise. * NEWS: Likewise. * tests/options.at (--debugfile): Enhance test. (--safer): Adjust to new semantics. 2008-12-22 Eric Blake Use @var correctly. * doc/m4.texinfo (Operation modes, Preprocessor features) (Limits control, Frozen state, Debugging options) (Dynamic loading features): Use lower case names in @var. (Improved copy): Use @code, not @var, as appropriate. 2008-12-18 Eric Blake Deal with M4 1.4.x limitation on builtin tokens. * doc/m4.texinfo (Composition): Mention limitation on curry. (Improved copy): New node. (Stacks): Fix typo. * examples/stack.m4: Likewise. * examples/stack_sep.m4: New file. * Makefile.am (dist_pkgdata_DATA): Distribute it. 2008-12-15 Eric Blake Double size of temp file cache. * m4/output.c (tmp_file, tmp_file_owner): Split... (tmp_file1, tmp_file2, tmp_file1_owner, tmp_file2_owner): ...into two variables. (tmp_file2_recent): New variable. (m4_tmpopen, m4_tmpclose, m4_tmpremove, m4_tmprename) (m4_output_exit): Adjust callers. Use fewer seeks on cached files. * m4/output.c (m4_tmpfile): Use write, not append mode. (m4_tmpopen): Add parameter to decide when to skip seeks. (m4_tmprename, m4_make_diversion, insert_diversion_helper) (m4_freeze_diversions): Adjust callers. Cache most recently spilled diversion. * m4/output.c (tmp_file, tmp_file_owner): New variables, for 1-deep cache of spilled diversions. (m4_tmpfile): Open in append mode, since we might revisit diversion without closing it now. (m4_tmpopen): Check cache first. (m4_tmpclose): Update cache, rather than closing. Add parameter. (m4_tmpremove): Close cache before removing. (m4_tmprename): Deal with open files when renaming. (m4_output_exit): Close cache before exiting. (make_room_for, m4_make_diversion, insert_diversion_helper): Adjust callers. * ltdl/m4/m4-rename.m4 (M4_RENAME): New file. * configure.ac (M4_RENAME): Invoke it. Correctly track size of in-memory diversions. * m4/output.c (insert_diversion_helper): Correctly track total in-memory diversion size after undivert. Avoid quadratic behavior for some cases of divert/undivert. * m4/output.c (struct m4_diversion): Improve comments. (m4_tmpname, m4_make_diversion): Strengthen preconditions. (m4_tmprename): New function. (m4_output_init, m4_output_exit): Move after internal functions. (make_room_for): Don't bother copying uninitialized bytes. (insert_diversion_helper): Transfer metadata, rather than copying contents, when undiverting into a previously unused diversion. * tests/builtins.at (divert): Add a check to the test. * doc/m4.texinfo (Undivert): Enhance test. * NEWS: Document the speedup. 2008-12-02 Eric Blake Stage 27: Allow embedded NUL in text processing macros. Pass NUL through regular expressions, format, and translit, and diagnose it in eval and changeresyntax. Improve warning capabilities of format. Memory impact: none. Speed impact: none noticed. * modules/m4.c (m4_expand_ranges): Don't append extra bytes. (translit): Manage NUL bytes. * modules/format.c (format): Likewise. * modules/gnu.c (substitute, regexp_substitute): Likewise. (m4_resyntax_encode_safe): Add parameter. (regexp, patsubst, renamesyms): Update callers. (regexp_compile): Adjust error message. * modules/evalparse.c (m4_evaluate): Use consistent message. (end_text): New variable. (eval_init_lex): Add parameter. (eval_lex): Detect embedded NUL. * src/freeze.c (reload_frozen_state): Likewise. * doc/m4.texinfo (Format): Update to cover new behavior. (Eval): Mention that result is unquoted. * tests/freeze.at (reloading nul): Enhance test. * tests/null.m4: Likewise. * tests/null.err: Update expected output. * tests/null.out: Likewise. * tests/options.at (--regexp-syntax): Likewise. 2008-11-28 Eric Blake Resync NEWS with branches. * NEWS: Mention 1.4.12, update state of 1.6. 2008-11-26 Eric Blake Keep COPYING in repository. * Makefile.am (MAINTAINERCLEANFILES): Don't remove COPYING. * .cvsignore: Don't ignore it. * .gitignore: Likewise. * COPYING: Store in repository, per automake 1.10.2 recommendation. 2008-11-26 Eric Blake Document optimized forloop. * doc/m4.texinfo (Improved forloop): Mention alternate style that avoids define overhead. * examples/forloop3.m4: New file. * Makefile.am (dist_pkgdata_DATA): Distribute it. Document copy composite using stack_foreach and curry. * doc/m4.texinfo (Stacks): New node, to document pushdef stack manipulation. (Ifelse): Move define_blind... (Composition): ...to this new node. Document currying, then use it to implement copy and rename. * examples/curry.m4: New file. * examples/stack.m4: Likewise. * Makefile.am (dist_pkgdata_DATA): Distribute them. 2008-11-04 Eric Blake Upgrade to FDL 1.3. * ltdl/m4/gnulib-cache.m4: Replace fdl module with fdl-1.3. * Makefile.am (doc_m4_TEXINFOS, MAINTAINERCLEANFILES): Reflect file change. * doc/m4.texinfo (GNU Free Documentation License): Likewise. 2008-10-22 Eric Blake Give nicer error if user modifies testsuite but lacks autoconf. * Makefile.am (AUTOM4TE): Use missing in the definition. 2008-10-09 Eric Blake Allow user to choose which sed to use in testsuite. * tests/atlocal.in (SED): Inherit from configure results. * tests/builtins.at (__m4_@&t@version__, divert, esyscmd) (mkstemp, syscmd): Use $SED. * tests/generate.awk (new_test): Likewise. * tests/options.at (deprecated options, unknown option) (--debugmode, --help and --version): Likewise. * tests/testsuite.at (AT_CHECK_M4): Likewise. * tests/others.at (directory, stderr closed, stdin seekable) (stdout closed): Likewise. (nul character): Likewise. Also, skip test if sed can't handle NUL bytes. Clean up testsuite invocation. * tests/atlocal.in: Fix copyright notice. * Makefile.am (TESTS_ENVIRONMENT): Delete; it wasn't being used. (check-local, installcheck-local): Adjust clients. Add missing dependency. 2008-09-25 Eric Blake Tweak error message on command line failure. * m4/m4private.h (includes): Use "quotearg.h". * src/main.c (process_file, main): Use nicer quotes for file name in error messages. * m4/input.c (file_clean, m4_push_file): Likewise. * m4/module.c (m4__module_open): Likewise. * src/freeze.c (produce_frozen_state, reload_frozen_state): Likewise. * modules/gnu.c (debugfile): Likewise. * modules/m4.c (undivert, include): Likewise. * tests/others.at (directory, stdin closed): Update tests. * tests/options.at (file names, --debugmode): Likewise. * doc/m4.texinfo (Debugmode): Likewise. Unify error handling for reading directories. * m4/path.c (m4_path_search): Factor open attempts... (m4_fopen): ...into new function, to reject directories. * tests/others.at (directory): Enhance test. * doc/m4.texinfo (Include): Document that directories cannot be input files. Avoid bugs on platforms that mishandle trailing /. * ltdl/m4/gnulib-cache.m4: Import fopen module. * tests/others.at (directory): New test. 2008-09-16 Eric Blake Fix bootstrap for Solaris /bin/sh. * bootstrap: Avoid shell quoting pitfall. 2008-09-01 Ralf Wildenhues Typos in source code comments. * modules/m4.c: Fix typos in comments. * m4/input.c: Likewise. * src/main.c: Likewise. 2008-08-29 Eric Blake Fix manual date information. * doc/m4.texinfo: UPDATED refers to the day the manual was built, not the release date of M4. Based on a bison patch by Akim Demaille. 2008-08-27 Eric Blake Tweak -d examples. * doc/m4.texinfo (Invoking m4): Fix example, since order of -d matters. (Dumpdef): Fix typo. 2008-08-23 Eric Blake Allow debugmode control over whether defn(undef) warns. * ltdl/m4/gnulib-cache.m4: Import verify module. * m4/m4module.h (M4_DEBUG_TRACE_DEREF, M4_DEBUG_TRACE_INITIAL): New values. (M4_DEBUG_TRACE_VERBOSE, M4_DEBUG_TRACE_DEFAULT): Adjust. * m4/m4.c (m4_create): Start with debugmode = d. * src/main.c (usage): Mention this. (main): Let -E impact debug mode. * m4/utility.c (m4_symbol_value_lookup): Squelch undefined warning if flag is clear. * modules/gnu.c (builtin, inder): Likewise. * m4/debug.c (m4_debug_decode): Parse new mode. * src/freeze.c (produce_debugmode_state): Accomodate new mode. * doc/m4.texinfo (Debugging options): Mention change in the default behavior. (Debugmode): Mention new flag d. (Operation modes): Mention interaction with -E. (Undefine, Defn, Pushdef, Indir, Builtin, Dumpdef): Document and test its effect. * tests/options.at (--debugmode): Update tests. * tests/freeze.at (reloading debugmode): Likewise. * NEWS: Document this. Reported by Ralf Wildenhues; without this patch, M4 1.6+ would be incompatible with Autoconf 2.62. 2008-08-22 Eric Blake Improve --debugmode behavior. * m4/m4module.h (m4_debug_decode): Simplify interface. * m4/debug.c (m4_debug_decode): Remove parameter, and handle setting the new value. * modules/gnu.c (debugmode): Adjust caller. * src/freeze.c (reload_frozen_state): Likewise. * src/main.c (main): Likewise. (usage): Fix default for --debug. * doc/m4.texinfo (Debugging options): Add an example. 2008-08-21 Eric Blake Avoid regression in defn(undef). * doc/m4.texinfo (Trace): Enhance test, to cover regression recently fixed on the branch. 2008-08-18 Eric Blake Remove deprecated -N option; fixes a regression from 2006-09-14. * src/main.c (DIVERSIONS_OPTION): Delete. (long_options, OPTSTRING, main): Remove -N/--diversions option. * doc/m4.texinfo (Limits control): Remove it from the manual. * NEWS: Mention that it is gone. * tests/options.at (deprecated options): Update test. Improve 'git diff' of manual source. * .gitattributes (*.texi*): Add diff attribute. * bootstrap: Tell git how to use it. Inspired by Jim Meyering's similar patch for coreutils. 2008-08-07 Bruno Haible (tiny change) Run m4 tests prior to gnulib unit tests. * Makefile.am (SUBDIRS): Swap order of directories. 2008-08-03 Eric Blake Stage 26: Allow embedded NUL in macro definitions. Clean up final few locations that did not track macro definitions by length, to allow embedded NUL. Make m4_arg_len callers aware of issue of flattening builtins when determining length. Memory impact: none. Speed impact: none noticed. * m4/m4module.h (m4_arg_len): Add parameter. (M4ARGLEN): Provide default for the parameter. * m4/m4private.h (includes): Share xmemdup0.h among all libm4 files. * m4/macro.c (m4_arg_len): Fail if builtins are not flattened. * m4/syntax.c (includes): Rely on m4private.h for xmemdup0. * m4/symtab.c (includes): Likewise. (m4_symbol_value_copy): Use xmemdup0. * m4/module.c (install_macro_table): Likewise. * src/freeze.c (reload_frozen_state): Likewise. * tests/freeze.at (reloading nul): Enhance test. * tests/null.m4: Likewise. * tests/null.err: Update expected output. * tests/null.out: Likewise. Fix regression in commenting unbalanced quotes, from 2008-02-16. * m4/m4private.h (m4__token_type): Add M4_TOKEN_COMMENT. * m4/input.c (m4__next_token, m4_print_token): Supply new token type for comments. * m4/macro.c (expand_token): Penalize comments, as they can contain unbalanced quotes; latent bug since 2007-12-07, exposed by passing $@ references built from comments. (expand_argument): Adjust caller. * tests/others.at (Comments): Enhance test to catch it. * NEWS: Mention the fix. 2008-07-30 Eric Blake Fix regression in trace output, introduced 2008-05-08. * m4/input.c (m4__push_symbol): When cloning chains, break pointer back to original chain; latent bug from 2008-02-02 that did not cause misbehavior until trace output read unfinished chain. * tests/builtins.at (debug): Add test for this. 2008-07-28 Eric Blake Optimize iteration examples. * examples/forloop2.m4: Avoid excess indir, by passing current counter value as parameter. * examples/foreachq3.m4: Avoid unneeded ifelse, by injecting an ignored argument. * doc/m4.texinfo (Improved forloop, Improved foreach): Update the documentation to match. 2008-07-26 Eric Blake Give example for O(n) foreach on m4 1.4.x. * examples/foreachq4.m4: New file. * Makefile.am (dist_pkgdata_DATA): Distribute it. * tests/others.at (recursion): Test it. * doc/m4.texinfo (Improved foreach): Document linear foreach with m4 1.4.5 and greater. 2008-07-19 Eric Blake Resynchronize docs from branch. * doc/m4.texinfo (Undefine, Pushdef): Mention warning on undefined name, particularly since the old documentation didn't match code. (Standard Modules): Add caveat about using __m4_version__. 2008-07-11 Eric Blake Bump required automake to 1.10a; regression introduced 2008-01-22. * configure.ac (AM_INIT_AUTOMAKE): Undo requirement downgrade to 1.10.1, since we also rely on pkglibexecdir. * HACKING: Fix minimum requirement. * bootstrap: Likewise. * THANKS: Update. Reported by Joel E. Denny. Avoid bogus whitespace in @ovar, @dvar. * doc/m4.texinfo (ovar, dvar): Add @c. Based on patch by Ralf Wildenhues to Autoconf manual. 2008-06-23 Eric Blake Adjust to new gnulib-tool layout. * ltdl/m4/gnulib-cache.m4: Reformat. Fix bootstrap comment. * bootstrap: DOWNLOAD_PO was previously removed. 2008-06-19 Eric Blake Revert speed regression from 2008-06-16. * m4/output.c (m4_shipout_int): Avoid obstack_printf in hot path. * modules/m4.c (numb_obstack): Likewise. * m4/input.c (MATCH): Use fewer conditionals, and factor adjustment of S... (match_input): ...here for smaller code size. * m4/syntax.c (m4_reset_syntax, m4_set_quotes, m4_set_comment): Supply trailing NUL to delimiters, to meet contract of faster MATCH. 2008-06-18 Eric Blake Whitespace cleanup. * m4/m4module.h: Use consistent spacing for pointer parameters. * m4/m4private.h: Likewise. Stage 25b: Handle embedded NUL in changesyntax and friends. Track quote and comment delimiters by length, to allow embedded NUL. Improve changesyntax to support assigning syntax to NUL. Memory impact: none. Speed impact: none noticed. * m4/m4module.h (m4_set_quotes, m4_set_comment, m4_set_syntax): Add parameter. (m4_reset_syntax): New prototype. * m4/syntax.c (add_syntax_set, subtract_syntax_set) (set_syntax_set, m4_set_quotes, m4_set_comment): Add parameter, to handle embedded NUL. (m4_set_syntax): Likewise. Also, split code to reset the table... (m4_reset_syntax): ...into a new function. (m4_syntax_create): Adjust callers. * m4/input.c (match_input, MATCH): Add parameter. (m4__next_token, m4__next_token_is_open): Adjust callers. * modules/m4.h (m4_expand_ranges_func): Add parameter. * modules/m4.c (dumpdef): Handle NUL in dumped quotes. (changequote, changecom, translit, m4_expand_ranges): Track delimiter length. * modules/gnu.c (changesyntax): Handle embedded NUL. * src/freeze.c (reload_frozen_state): Adjust callers. * tests/freeze.at (reloading nul): Enhance test. * tests/null.m4: Likewise. * tests/null.out: Update expected output. * tests/null.err: Likewise. 2008-06-16 Eric Blake Stage 25a: Use obstack_printf for easier output. Convert macro tracing and other locations to use obstack_printf rather than hand-rolled equivalents. Ensure that embedded NUL in trace output does not truncate the trace string. Memory impact: none. Speed impact: noticeable penalty, from obstack_printf overhead. * ltdl/m4/gnulib-cache.m4: Import obstack-printf-posix module. * m4/macro.c (trace_format): Delete; use obstack_printf instead. (trace_header, trace_pre, trace_post): All callers updated. * m4/output.c (m4_shipout_int, m4_tmpname): Use obstack_printf. (m4_divert_text): Speed up syncline output. * modules/m4.c (dumpdef): Handle embedded NUL. (numb_obstack): Speed up eval output. (maketemp): Use obstack_printf. * modules/format.c (format): Likewise. Add missing const qualifications. * m4/resyntax.c (m4_resyntax_map): Declare array elements as const. * modules/gnu.c (m4_builtin_table, m4_macro_table): Likewise. * modules/import.c (m4_builtin_table): Likewise. * modules/load.c (m4_builtin_table, m4_macro_table): Likewise. * modules/m4.c (m4_builtin_table): Likewise. * modules/modtest.c (m4_builtin_table, m4_macro_table): Likewise. * modules/mpeval.c (m4_builtin_table, m4_macro_table): Likewise. * modules/perl.c (m4_builtin_table, m4_macro_table): Likewise. * modules/shadow.c (m4_builtin_table, m4_macro_table): Likewise. * modules/stdlib.c (m4_builtin_table): Likewise. * modules/time.c (m4_builtin_table): Likewise. * modules/traditional.c (m4_macro_table): Likewise. 2008-06-10 Eric Blake Avoid corrupted frozen file if NUL appears on block boundary. * m4/output.c (insert_file): Separate consecutive quotearg blocks with \, in case last byte of first block was NUL. 2008-06-03 Eric Blake Fix printf type mismatches. * m4/m4module.h (m4_bad_argc): Alter parameter type. * m4/m4private.h (struct m4_call_info): Alter call_id type. * m4/macro.c (expand_macro, m4__adjust_refcount): Use correct specifiers. * m4/utility.c (m4_bad_argc): Likewise. Borrow bootstrap ideas from gnulib. * bootstrap (options, DOWNLOAD_PO): Remove --download-po; the advertized subset of languages didn't work. Use --skip-po instead, for consistency with gnulib bootstrap. (func_get_translations): Use rsync, not wget. (func_update_po): Use a reference directory, to avoid changing timestamps on unchanged .po files. * TODO: Update accordingly. Fix fallout from previous patch. * doc/m4.texinfo (Builtin): Adjust expected output. 2008-06-02 Eric Blake Stage 24c: Improve display of macro names with embedded NUL. Quote instances of problematic characters in macro names when presented to user. Track location via call_info rather than munging context for every expansion. Memory impact: none. Speed impact: slight penalty, due to more bookkeeping. * m4/m4module.h (m4_push_string_init): Add parameters. * m4/m4private.h (struct m4_macro_args): Remove argv0 and argv0_len, now redundant with info. (m4__push_wrapup_init): Add parameter. * m4/input.c (m4_push_string_init, m4__push_wrapup_init): Track location from caller, rather than context. (composite_peek, composite_read, match_input): Adjust callers. * m4/utility.c (m4_symbol_value_lookup): Quote macro name. (m4_verror_at_line): Allow NUL in macro name. * m4/macro.c (trace_flush, m4_trace_prepare, trace_pre): Allow NUL in trace. (expand_macro): No longer munge context location. (collect_arguments, m4_arg_text, m4_arg_empty, m4_arg_len) (m4_make_argv_ref, m4_push_arg, m4_wrap_args): Adjust callers. * modules/gnu.c (builtin, indir): Likewise. * tests/null.m4: Enhance test. * tests/null.err: Adjust expected output. * tests/null.out: Likewise. Stage 24b: Allow embedded NUL in macro names. Use length rather than NUL-termination when tracking macro names. All APIs dealing with symbol table changed. Memory impact: none. Speed impact: slight penalty, due to more bookkeeping. * m4/m4module.h (m4_symtab_apply_func, m4_symbol_lookup) (m4_symbol_pushdef, m4_symbol_define, m4_symbol_popdef) (m4_symbol_rename, m4_symbol_delete): Add length parameter. (m4_string): New type. * ltdl/m4/gnulib-cache.m4: Import xmemdup0 module. * m4/hash.c (m4_hash_string_hash, m4_hash_string_cmp): Account for length. * m4/symtab.c (m4_symtab_delete, m4_symtab_apply, symtab_fetch) (m4__symtab_remove_module_references, symbol_destroy_CB) (m4_symbol_lookup, m4_symbol_pushdef, m4_symbol_define) (m4_symbol_popdef, m4_symbol_rename, m4_set_symbol_name_traced) (m4_symbol_delete): Likewise. * modules/m4.h (struct m4_dump_symbol_data): Adjust type to allow passing length. * m4/macro.c (expand_token): Adjust all callers. * m4/module.c (install_builtin_table, install_macro_table): Likewise. * m4/utility.c (m4_symbol_value_lookup): Likewise. * modules/gnu.c (indir, renamesyms, m4symbols): Likewise. * modules/m4.c (define, undefine, pushdef, popdef) (dumpdef_cmp_CB, dump_symbol_CB, m4_dump_symbols, dumpdef) (traceon, traceoff): Likewise. * src/main.c (main): Likewise. * src/freeze.c (dump_symbol_CB, reload_frozen_state): Likewise. * tests/freeze.at (reloading nul): Augment test. * tests/null.out: Adjust expected output. Stage 24a: Use full call context in error reporting. Replace const char *macro_name with const m4_call_info *call, so that the next patch can pass the length of macro_name with embedded NUL. Simplifies handling of global state. Memory impact: none. Speed impact: none noticed. * m4/m4module.h (m4_error, m4_warn): Change parameter type. (m4_error_at_line, m4_warn_at_line): Delete. (m4_debug_set_output, m4_skip_line, m4_bad_argc, m4_numeric_arg) (m4_parse_truth_arg, m4_symbol_value_lookup): Adjust all clients. * m4/m4private.h (m4__next_token): Likewise. * m4/utility.c (m4_verror_at_line): Alter parameter, and use caller's location if caller is provided. (m4_error, m4_warn): Change parameter type. (m4_error_at_line, m4_warn_at_line): Delete. (m4_bad_argc, m4_numeric_arg, m4_parse_truth_arg) (m4_symbol_value_lookup): Adjust all callers. * m4/debug.c (set_debug_file, m4_debug_set_output): Likewise. * m4/input.c (m4_skip_line, m4__next_token): Likewise. * m4/macro.c (expand_argument, collect_arguments, m4_macro_call) (process_macro): Likewise. * modules/m4.h (m4_make_temp_func): Likewise. * modules/evalparse.c (m4_evaluate): Likewise. * modules/format.c (arg_int, arg_long, arg_double, format): Likewise. * modules/gnu.c (builtin, changeresyntax, changesyntax, debugfile) (debuglen, debugmode, esyscmd, indir, mkdtemp, patsubst, regexp) (renamesyms, syncoutput, regexp_compile, substitute) (regexp_substitute, m4_resyntax_encode_safe): Likewise. * modules/m4.c (define, undefine, pushdef, popdef, ifdef, ifelse) (m4_dump_symbols, defn, syscmd, incr, decr, divert, undivert, dnl) (include, maketemp, mkstemp, m4exit, traceon, traceoff, substr): Likewise. * modules/stdlib.c (setenv, getpwuid, srand): Likewise. * modules/time.c (ctime, gmtime, localtime, mktime, strftime): Likewise. * tests/options.at (--syncoutput): Add test for invalid command-line argument. Split xfailed portion... (--syncoutput and diversions): ...into new test. (unknown option): New test. * tests/freeze.at (reloading unknown builtin): Update expected output. Adjust to recent gnulib change. * configure.ac (AB_INIT): Delete, now that gnulib does this. 2008-05-28 Eric Blake Improve frozen debugmode behavior. * m4/debug.c (m4_debug_decode): Make empty debugmode additive. * src/main.c (main): Interleave -d with files. * tests/options.at (--debugmode): Update test. * tests/freeze.at (reloading debugmode): New test. * doc/m4.texinfo (Debugging options, Debugmode): Document the change. * NEWS: Likewise. 2008-05-27 Eric Blake Fix some testsuite failures on Solaris 8. * tests/builtins.at (esyscmd, syscmd): Skip tests if system(2) is broken. * tests/others.at (stderr closed): Likewise. Also support Solaris wording for EBADF. (stdin closed): Skip test if closed stdin gets reopened. (stdout closed): Support Solaris wording for EBADF. * tests/testsuite.at (AT_CHECK_M4): Likewise. Fix configure message nesting, broken since 2001-09-20. * ltdl/m4/gmp.m4 (M4_LIB_GMP): Don't cache result; the test is not expensive, and AC_MSG_WARN doesn't work in AC_CACHE_CHECK. Support 'make dist' with BSD make. * Makefile.am (TESTSUITE_AT, MAINTAINERCLEANFILES): Qualify uses of the generated file tests/generated.at. (EXTRA_DIST, $(TESTSUITE)): Likewise for tests/package.m4. * tests/others.at (stdout closed): Accomodate OpenBSD /bin/sh. 2008-05-24 Eric Blake Test NUL in frozen files. * tests/testsuite.at (AT_CHECK_M4): Add parameter. * tests/freeze.at (reloading nul): New test. (AT_TEST_FREEZE): Inhibit -d when reloading frozen file. (reloading unknown builtin): Likewise. 2008-05-23 Eric Blake Improve handling of frozen file errors. * src/freeze.c (produce_frozen_state): Detect write failures. (reload_frozen_state): Use close_stream. * tests/freeze.at (freezing failure): New test. * THANKS: Update. Reported by Jean-Charles Longuet. 2008-05-19 Eric Blake In frozen file, split consecutive strings with newline. * src/freeze.c (dump_symbol_CB): Add newline to 'T', 'F'. (produce_frozen_state): Likewise for 'Q', 'C'. (reload_frozen_state): Parse the new layout. [GET_DIRECTIVE]: Fix format 1 regression from 2008-05-13. * tests/freeze.at (loading format 2): Rewrite to new format. (reloading unknown builtin): Likewise. (loading format 1): Make sure backslash-newline is not interpreted. * doc/m4.texinfo (Frozen file format 2): Document the format. * NEWS: Document this change. Fix xgettext options. * po/Makevars (XGETTEXT_OPTIONS): The " must be passed to xgettext. Fix spelling of René Seindal's name in --version output. * ltdl/m4/gnulib-cache.m4: Import propername module. * src/main.c (AUTHORS): Rewrite in terms of proper_name. * po/Makevars (XGETTEXT_OPTIONS): Detect new functions. * HACKING: Mention new prerequisite of gperf. 2008-05-18 Eric Blake Allow freezing the trace status of macros. * src/freeze.c (produce_symbol_dump): Let undefined traced macros through. (dump_symbol_CB): Also freeze trace state. * tests/freeze.at (reloading traced macros): New test. * doc/m4.texinfo (Using frozen files): Update documentation to mention new state. (Frozen file format 1): Improve synchronization with branch. (Frozen file format 2): Reorder directives, and add `d', `t'. * NEWS: Document this change. 2008-05-15 Eric Blake Fix frozen file regression in pushdef stacks from 2001-09-01. * src/freeze.c (dump_symbol_CB): Push all values on the stack, not just the current definition. (reverse_symbol_value_stack): New helper method. * tests/freeze.at (AT_TEST_FREEZE): New helper macro. (reloading pushdef stack): New test. (reloading unknown builtin): Enhance test. 2008-05-13 Eric Blake Fix frozen file regression in diversions from 2007-01-21. * m4/output.c (insert_diversion_helper): Add parameter. (m4_insert_file): Move contents... (insert_file): ...to this new helper, with added parameter. (m4_insert_diversion, m4_undivert_all, m4_freeze_diversions): Update callers. * src/freeze.c (produce_mem_dump): Simplify. * tests/freeze.at (large diversion): Test for this. Improve error message when frozen file is invalid. * src/freeze.c (decode_char): Add parameter. Allow \ line continuations. (reload_frozen_state): Track current line. * tests/freeze.at (loading format 1, loading format 2): Update to test this. 2008-05-10 Eric Blake Detect integer overflow when loading frozen file. * src/freeze.c (reload_frozen_state) [GET_NUMBER]: Rewrite to fail immediately on overflow. * tests/freeze.at (loading format 2): Test this. Reported by Jim Meyering. 2008-05-08 Eric Blake Stage 23: allow tracing of indirect macro calls. Track all trace information as part of the argv struct, rather than temporarily resetting global state. Teach indir to trace macros that it invokes. Memory impact: slight penalty, due to larger argv struct. Speed impact: none noticed. * m4/m4module.h (m4_input_block): Remove. (m4_call_info): New opaque type. (m4_trace_prepare, m4_arg_info): New prototypes. (m4_macro_call, m4_push_string_finish, m4_input_print): Change prototypes. * m4/m4private.h (struct m4_macro_args): Add info field. (struct m4_call_info): New structure. (m4_arg_info): New accessor. * m4/input.c (m4_input_block): Make typedef local. (m4_push_string_init): Initialize length. (m4_push_string_finish, m4_input_print): Change signature, so that printing can be done before finalization. (struct input_funcs): Add parameter to print_func. (file_print, string_print, composite_print): Adjust accordingly. * m4/macro.c (trace_header, trace_flush, trace_pre, trace_post): Change signatures for stacked trace messages, and for using call context. (trace_prepre): Export and rename... (m4_trace_prepare): ...to this, for use by indir. Alter signature to use call context. (collect_arguments): Alter signature, to manage new field. (expand_macro): Change call context management. Move tracing... (m4_macro_call): ...here. Remove redundant parameter. (m4_arg_argc): New function. (m4_make_argv_ref): Replace unused skip parameter with new trace parameter; manage new field. * modules/gnu.c (builtin, indir): Adjust callers. * src/main.c (usage): Update debugmode flag summary. * tests/null.m4: Enhance test. * tests/null.err: Update expected output. * tests/macros.at (Tracing Hanoi Towers): Likewise. * doc/m4.texinfo (Trace): Mention more about trace formatting. (Debugmode): Enhance description of 'c' and 'x'. Enhance test to cover line numbering details in traces. (Debuglen): Enhance test to cover indir tracing. * NEWS: Mention these changes. Reported by Akim Demaille in the autoconf TODO file in 2000. 2008-05-07 Eric Blake Test for traceon regression just fixed in branch-1.6. * doc/m4.texinfo (Trace): Enhance test. * NEWS: Port news item from branch. 2008-05-05 Eric Blake Stage 22: allow builtin token concatenation outside $@. Adjust the input and argument parsing engines to append builtins alongside text. Make define warn when builtins must be flattened. Memory impact: slight penalty, with fewer builtins flattened. Speed impact: slight penalty, from more bookkeeping. * m4/m4module.h (m4_is_arg_composite): New prototype. (m4_symbol_value_copy): Change return type. (m4_arg_text): Add parameter. (M4ARG): Adjust callers. * m4/m4private.h: Adjust comments. * m4/symtab.c (m4_symbol_value_copy): Detect when builtins are flattened. * m4/input.c (init_builtin_token): Add parameter, and allow concatenating builtins. (m4__next_token): Adjust caller. * m4/macro.c (m4_is_arg_composite): New function. (expand_argument): Allow builtin concatenation. (m4_arg_text): Add parameter. (m4__arg_adjust_refcount, m4__arg_print): Adjust callers. (m4_arg_equal): Fix comparison of builtin tokens. * modules/m4.c (define, pushdef): Warn when flattening builtins. * doc/m4.texinfo (Define): Remove dead comment. (Defn): Update to reflect code changes. * tests/builtins.at (defn): Remove xfail. * NEWS: Document this change. 2008-05-03 Eric Blake Document define_blind. * doc/m4.texinfo (Ifelse): Add a new composite macro. * THANKS: Update. Suggested by Mike R. 2008-05-01 Eric Blake Avoid -Wshadow compiler warnings. * m4/output.c (threshold_diversion_CB): s/div/diversion/. * m4/macro.c (make_argv_ref, arg_symbol, m4_arg_symbol) (m4_is_arg_text, m4_is_arg_func, m4_arg_text, m4_arg_empty) (m4_arg_len, m4_arg_func, m4__arg_print, m4_make_argv_ref) (m4_push_arg, m4__push_arg_quote): s/index/arg/. * modules/format.c (format): Likewise. * modules/m4.c (ifelse): Likewise. Improve debugmode testing, based on recent branch-1.6 regressions. * doc/m4.texinfo (Debugmode): Enhance tests. * tests/generate.awk: Run tests from stdin, not input.m4. Support stderr munging when using -I examples. Fix regression in define from 2008-02-22. * m4/m4module.h (m4_symbol_value_copy): Add parameter. * m4/symtab.c (m4_symbol_value_copy): Support copying $@ back-references. * m4/macro.c (expand_argument): Update callers. * modules/m4.c (define, pushdef): Likewise. * tests/builtins.at (define): Enhance test to catch this. 2008-04-21 Eric Blake Simplify previous patch. * tests/m4.in: Compress assignment. Suggested by Gary V. Vaughan. Fix --disable-shared testsuite regression from previous patch. * tests/m4.in: Export M4MODPATH, so that recursive m4 invocations will also work. Fix spelling of attribution to Christopher Strachey. * doc/m4.texinfo (History, Inhibiting Invocation): Fix typo. * THANKS: Update. Reported by Fernando Carrijo. 2008-04-17 Eric Blake Fix testsuite bug when SIGPIPE is ignored. * tests/builtins.at (divert): Consume all of m4's output, to avoid spurious write failure. * src/main.c (main): In batch mode, restore default handling of SIGPIPE. * doc/m4.texinfo (Operation modes): Document SIGPIPE behavior. * THANKS: Update. Reported by Bob Proulx, via his autobuilder. 2008-04-15 Eric Blake Fix 'make installcheck' after './configure --prefix-progname'. * tests/testsuite.at (AT_CHECK_M4): Allow overriding the m4 program name. (HELP_OTHER, PREPARE_TESTS): Document and use $M4. * tests/builtins.at (patsubst): Avoid space-tab. (divert, mkdtemp, mkstemp): Adjust tests to use $M4. * tests/options.at (--debugfile): Likewise. * tests/others.at (stdin seekable): Likewise. (fstab): Avoid space-tab. * Makefile.am (installcheck-local): Accomodate transformed name. (DISTCHECK_CONFIGURE_FLAGS): Ensure no regressions, by using gm4 during 'make distcheck'. * cfg.mk: New file, borrowed from branch. Update prerequisite tools to match recent releases. * configure.ac (AC_PREREQ): Rely on released autoconf. (LT_PREREQ): Rely on released libtool. * tests/testsuite.at (m4_version_prereq): Update dependence. * bootstrap: Mention prerequisites. Work around OS/2 limitation of printf(1). * tests/null.m4: Use m4, not printf, to generate NUL byte. * tests/null.out: Check for esyscmd failure. Reported by Elbert Pol. 2008-04-14 Eric Blake Stage 21b: $@ concatenates builtins, m4wrap takes builtins. Improve arg_print to handle builtin tokens when printing to a known chain, rather than always flattening builtins. This allows m4wrap and $@ back-references to handle embedded builtin tokens. Memory impact: none. Speed impact: slight penalty, from more bookkeeping. * 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. Stage 21a: Optimize checks for end of input. Create a new polymorphic input block type, which always fails with CHAR_EOF, so that remaining input routines no longer have to check for NULL input block. Memory impact: none. Speed impact: noticeable improvement, from fewer conditionals. * m4/input.c (eof_funcs, input_eof): New objects. (eof_peek, eof_read, eof_unget): New functions. (file_clean, m4_push_string_init, pop_input, m4_push_wrapup_init) (m4_pop_wrapup, next_char, peek_char, unget_input, m4_input_init) (m4_input_exit): Use placeholder to guarantee non-NULL isp and wsp. (next_char): Rename retry to allow_unget, and change sense for easier manipulation. All callers changed. 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. Ensure __m4_version__ is unquoted. * tests/builtins.at (__m4_@&t@version__): Augment test. Avoid GNU make failure on tarball. * Makefile.am (EXTRA_DIST): Distribute cfg.mk and maint.mk. 2008-04-10 Eric Blake Allow back-referenced macro names; fixes 2008-03-13 regression. * m4/m4module.h (m4_symbol_value_lookup): Change prototype. * m4/utility.c (m4_symbol_value_lookup): Change signature. * modules/m4.c (undefine, popdef, ifdef, m4_dump_symbols, defn): Adjust all callers. * tests/others.at (ifndef): New test. Be namespace clean for M4 version; fixes 2008-04-08 regression. * configure.ac (version): Rename... (M4_VERSION): ...to this, since using 'version' broke po.m4. 2008-04-09 Eric Blake Mention 1.4.11 release. * doc/m4.texinfo (History, Defn, Ifdef, Ifelse, M4wrap) (Extensions, Improved foreach): Distinguish 1.4.11 and 1.6. (Format): Add test of C99 hex-float parsing. * NEWS: Mention 1.4.11 release. * tests/builtins.at (divert): Add additional test. 2008-04-08 Eric Blake 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. 2008-03-28 Eric Blake Use GNUmakefile module. * ltdl/m4/gnulib-cache.m4: Import gnumakefile module. * Makefile.am: Split off maintainer rules... * maint.mk: ...into this new file. 2008-03-18 Eric Blake Stage 20b: make m4wrap obey POSIX fifo ordering. Improve input engine to support location changes within symbol chains, then convert m4wrap to always build symbol chain. Memory impact: none. Speed impact: slight penalty, from more m4wrap bookkeeping. * m4/m4module.h (m4_wrap_args): Add prototype. * m4/m4private.h (enum m4__symbol_chain_type): Add M4__CHAIN_LOC. (struct m4__symbol_chain): Add struct u_l. * m4/input.c (m4_push_wrapup_init, m4_push_wrapup_finish): Use new link type. (composite_peek, composite_read, composite_clean): Handle location link. * m4/macro.c (m4_wrap_args): New function. * modules/m4.c (m4wrap): Use it. * doc/m4.texinfo (M4wrap): Sync with branch and POSIX. (Extensions): Document extension of multiple arguments. (Location, Improved m4wrap): Adjust example to match FIFO order. * tests/builtins.at (wrap): Likewise. * NEWS: Document this change. 2008-03-17 Eric Blake Stage 20a: reduce unget's in input engine. Now that out-of-range input placeholders like CHAR_BUILTIN are consumed outside of next_char, next_token should always consume rather than peek at the first character. Fewer peeks results in less ungetc overhead. Memory impact: none. Speed impact: noticeable improvement, from fewer function calls. * m4/input.c (struct input_funcs): Alter read_func prototype. (next_char, file_read, buildin_read, string_read, composite_read): Add allow_argv parameter. (init_builtin_token, init_argv_symbol): Require all prior input to be consumed. (m4_skip_line, match_input, consume_syntax): Adjust callers. (m4__next_token): Consume first byte without peek. Update for fresh bootstrap. * ltdl/m4/gnulib-cache.m4: Updated copyright from upstream. 2008-03-15 Eric Blake Document join, in order to fix bug in m4wrap example. * examples/join.m4: New file. * examples/wraplifo2.m4: Likewise. * Makefile.am (EXTRA_DIST): Add new files. * doc/m4.texinfo (Improved m4wrap): New node. (Defn, Location): Enhance tests. (Shift): Document the composite macro join. (Incompatibilities): Move documentation of LIFO vs. FIFO... (M4wrap): ...here, to match improved example. 2008-03-13 Eric Blake Stage 19c: allow builtin tokens in more macros. Allow builtin tokens inside symbol chains, although for now, they are not allowed inside comments or quotes. Enable builtin token handling in more macros, if only to consistently diagnose invalid macro names. Memory impact: none. Speed impact: slight impact, due to more bookkeeping. * 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. Stage 19b: invert sense of bit for handling builtin tokens. Pass builtin tokens by default, rather than as the exception, so that the logic can consistently refer to flattening arguments. Memory impact: none. Speed impact: none. * 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. Stage 19a: sort and cache builtins loaded by a module. Rather than repeatedly using dlsym to browse the builtin table, copy off the table at module load time. Then, the input engine merely refers to the copy instead of duplicating information. Memory impact: slight penalty, due to more memory per module, but offset by less memory in input engine. Speed impact: slight improvement, due to faster builtin lookups. * m4/m4module.h (m4_set_symbol_value_builtin): Delete. Use m4_builtin_find_by_* instead. (m4_builtin_find_by_func): Change return type. * m4/m4private.h (m4__builtin): New struct. (m4_module): Add sorted list of loaded builtins. (struct m4_symbol_value): Change type of builtin value. (m4__set_symbol_value_builtin): New prototype and fast accessor. (m4_get_symbol_value_func, m4_get_symbol_value_builtin): Adjust to new field type. * m4/symtab.c (m4_set_symbol_value_builtin): Rename... (m4__set_symbol_value_builtin): ...and populate additional fields, based on new type. (m4_get_symbol_value_func, m4_get_symbol_value_builtin): Adjust to new field type. * m4/module.c (install_builtin_table): Use cached table. (compare_builtin_CB): New helper function. (m4__module_open): Populate table. (module_remove): Free table. * m4/builtin.c (compare_builtin_name_CB): New helper function. (m4_builtin_find_by_name): Rewrite to use sorted table. (m4_builtin_find_by_func): Change return type. * m4/input.c (struct m4_input_block): Simplify u_b, since most fields can be determined from builtin. (builtin_peek, builtin_read, builtin_unget, init_builtin_token) (m4__next_token): Alter parsing so that only init_builtin_token consumes a builtin. (builtin_print, m4_push_builtin): Adjust all users. * tests/macros.at (Arity, defn, and freeze): Fix typo. 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. 2008-03-06 Eric Blake Fix nested builtin(`shift',$@) regression from 2008-02-23. * m4/macro.c (make_argv_ref): Don't output expansion text when making wrapper for builtin or indir. * tests/builtins.at (builtin): New test. * NEWS: Document the fix. Reported by Andreas Schwab. 2008-03-04 Eric Blake The gnulib module free was deprecated. * ltdl/m4/gnulib-cache.m4: Remove free module. 2008-02-29 Eric Blake Import news from 1.4.10b. * NEWS: Update from branch. 2008-02-23 Eric Blake Stage 18: try harder to reuse argv in recursion. When pushing arguments that contain an existing $@ ref, reuse the ref rather than creating another layer of wrappers. Memory impact: noticeable improvement, due to better $@ reuse. Speed impact: noticeable improvement, due to O(n^2) to O(n) reduction in unboxed recursion. * m4/macro.c (make_argv_ref): Avoid wrapping $@ when possible. (m4_push_args): Let make_argv_ref take care of pending data. * doc/m4.texinfo (Improved foreach): Tweak wording to match new performance capability. * tests/others.at (recursion): Add tests to avoid performance regression. 2008-02-22 Eric Blake Update NEWS. * NEWS: Document change to __gnu__ on 2008-02-11. Stage 17: pass argv through quoted strings. Allow the concatenation of $@ references with other text input inside quoted contexts, which requires distinguishing between a wrapper around many arguments vs. a reference serving as part of a single argument. Also optimize based on whether argv contains builtin tokens that might need flattening to the empty string. Memory impact: noticeable improvement, due to O(n^2) to O(n) reduction from total reuse of $@ references. Speed impact: noticeable improvement, due to O(n^2) to O(n) reduction in boxed recursion. * m4/m4module.h (m4_arg_equal, m4_arg_len): Add parameter. (M4ARGLEN): Adjust definition. * m4/m4private.h (struct m4__symbol_chain): Add has_func member. (struct m4_symbol_value): Add wrapper and has_func members. (struct m4_macro_args): Add flatten and has_func members. * m4/input.c (append_quote_token): Return argv refs inside quoted strings. (init_argv_symbol): Populate new fields. * m4/macro.c (expand_argument, collect_arguments, make_argv_ref) (m4_make_argv_ref): Likewise. (arg_symbol, arg_mark, m4_is_arg_text, m4_is_arg_func): Use new fields. (m4_arg_equal, m4_arg_len): Handle quoted argv references, and add new parameter. * modules/m4.c (ifelse): Adjust caller. 2008-02-22 Gary V. Vaughan Fix regression in argument collection, from 2008-01-21. * m4/input.c (m4__next_token): When DEBUG_INPUT is defined, undo argument collection optimisation for strings, so that m4_print_token doesn't abort when it otherwise receives an unprintable M4_SYMBOL_VOID type token. 2008-02-20 Eric Blake Stage 16: cache quotes and improve m4_arg_print. Cache rather than always copying quotes when pushing $@ refs; in particular, reconstruct single-byte quotes on the fly. Allow NUL through m4wrap. Improve sharing of code that prints arguments. Memory impact: slight improvement, due to cached quotes. Speed impact: slight improvement, due to less copying. * m4/m4module.h (m4_symbol_value_print, m4_symbol_print) (m4_arg_print): Adjust prototypes. (m4_dump_args): Delete. (m4_push_wrapup): Split... (m4_push_wrapup_init, m4_push_wrapup_finish): ...into these prototypes. * m4/m4private.h (struct m4_syntax_table): Add cached_quote member. (m4__quote_cache, m4__quote_uncache): New prototypes. * m4/syntax.c (m4_syntax_create): Initialize the cache. (m4__quote_cache): New function. (m4_set_syntax): Update caller. * m4/symtab.c (m4_symbol_value_print): Add parameter. (m4_symbol_print, dump_symbol_CB): Adjust all callers. * m4/utility.c (m4_dump_args): Delete; callers should use m4_arg_print instead. * m4/input.c (m4_push_wrapup_init, m4_push_wrapup_finish): Split implementation, and allow embedded NUL. (m4_print_token, pop_input, composite_print, composite_peek): (composite_read, append_quote_token): Adjust all callers. * m4/macro.c (trace_prepre, m4_arg_text, make_argv_ref): Likewise. (m4_arg_print): Add parameters. (trace_pre): Rewrite in terms of m4_arg_print. * modules/m4.c (errprint): Likewise. (m4wrap): Rewrite to allow embedded NUL. (dumpdef): Adjust caller. * doc/m4.texinfo (Debuglen): Enhance debuglen test. * tests/null.m4: Test for NUL in m4wrap. * tests/null.out: Update expected output. Fix out-of-bounds read for sanitized macro names, from 2008-02-06. * m4/utility.c (m4_verror_at_line): Properly terminate the string. Reported by Ralf Wildenhues. * doc/m4.texinfo (Debuglen, Changesyntax): Fix typos. 2008-02-19 Eric Blake Clean up example on filtering defined symbols. * doc/m4.texinfo (Foreach, Improved foreach): Document another shortcoming in foreach.m4, and improve filter example by using foreach2.m4. * src/main.c (usage): Fix typo. 2008-02-18 Eric Blake 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. 2008-02-16 Eric Blake Add regression test for multi-character quote recursion. * examples/foreach2.m4: Use $0 rather than spelling out name. * examples/foreachq2.m4: Likewise. * examples/forloop2.m4: Likewise. * examples/hanoi.m4: Likewise. * examples/trace.m4: Likewise. * doc/m4.texinfo (Improved forloop): Document advantage of $0. (Improved foreach): Adjust dump from file. Stage 15: return argv refs back to collect_arguments. Collect an entire $@ reference at once rather than one argument at a time, outside of quotes (but inside quotes, $@ is still flattened for now). The skip_last field allows concatenation of $@ with other text when collecting arguments. Memory impact: noticeable improvement, due to better reuse of $@. Speed impact: noticeable improvement, due to less parsing. * m4/m4private.h (CHAR_ARGV): New input engine sentinel. (enum m4__token_type): Add M4_TOKEN_ARGV. (struct m4__symbol_chain): Add skip_last member to argv link. (m4__next_token): Add parameter. * m4/input.c (peek_char, file_peek, builtin_peek, string_peek) (composite_peek, m4__next_token): Add new parameter. (composite_read, append_quote_token): Support argv in quotes. (init_argv_symbol): New function. (m4__push_symbol, match_input, consume_syntax) (m4__next_token_is_open, m4_print_token): Adjust callers. * m4/macro.c (m4_macro_expand_input, m4__arg_adjust_refcount) (arg_mark, m4_arg_text, make_argv_ref): Likewise. (expand_argument, collect_arguments): Handle new token. (arg_symbol): Drill through $@ reference. * m4/syntax.c (set_quote_age): Detect disabled comments. * m4/symtab.c (dump_symbol_CB) [DEBUG_SYM]: Fix debug code. 2008-02-15 Eric Blake * modules/gnu.c (regexp_compile): Use a fastmap for regex speed. 2008-02-13 Eric Blake Fix texinfo grammar. * doc/m4.texinfo (Eval, Incompatibilities): Use @. after capital. (History): Use @: after abbreviations. (M4exit): Use correct Latin abbreviation. (Dumpdef, Debugmode, Frozen file format 2): Use correct spacing between sentences. 2008-02-11 Eric Blake 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. Fix regression in command line -D option, from 2006-08-25. * m4/m4private.h (m4_symbol_value_create): Delete fast accessor. * m4/m4module.h: Fix typo. * m4/symtab.c (m4_symbol_value_create): Prime the maximum number of arguments. * tests/macros.at (Command line define): Enhance test. * tests/others.at (nul character): Enhance test. * tests/null.m4: Likewise. * tests/null.out: Likewise. Use gnulib's git-merge-changelog driver when available. * .gitattributes: Add merge attributes for ChangeLog. * bootstrap: Install driver, if not already present. 2008-02-06 Eric Blake Fix security hole introduced 2007-11-23. * m4/utility.c (m4_verror_at_line): Properly escape macro names. * src/main.c (main): Manage quoteargs defaults. * doc/m4.texinfo (Indir): Document and test this. Using raw strtod is not portable. * ltdl/m4/gnulib-cache.m4: Import the strtod module. 2008-02-02 Eric Blake 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. Stage 14b: allow pushing argv references. Push a $@ reference to the input engine in one go, rather than pushing each element. For now, argument collection still gets one argument of a $@ at a time; but the penalties of this patch make it easier to manage $@ efficiently in future patches. Memory impact: noticeable penalty, due to larger struct and O(n) to O(n^2) on unboxed recursion. Speed impact: noticeable penalty, due to more bookkeeping. * m4/m4private.h (struct m4__symbol_chain): Add comma and quotes fields. (struct m4_macro_args): Add level field. (m4__arg_adjust_refcount, m4__push_arg_quote): New prototypes. * m4/input.c (m4__push_symbol, composite_peek, composite_read) (composite_unget, composite_clean, composite_print): Support $@ refs. * m4/macro.c (collect_arguments): Populate new field. (expand_macro): Move argv cleanup... (m4__arg_adjust_refcount): ...to this new function. (m4_arg_symbol, m4_make_argv_ref, m4_push_arg): Factor... (arg_symbol, make_argv_ref, m4__push_arg_quote): ...to these new helper functions, to add parameters. (m4_push_args): Adjust caller. * m4/symtab.c (m4_symbol_value_print): Likewise. Stage 14a: allow printing argv references. Refactor symbol-value printing code for better sharing, and to allow printing a contiguous text representation of a $@ ref. Memory impact: none. Speed impact: none. * m4/m4module.h (m4_arg_print): New prototype. (m4_symbol_value_print): Alter prototype. * m4/input.c (struct input_funcs): Add parameter to peek_func. (file_peek, builtin_peek, string_peek): Ignore new parameter. (composite_peek): Ignore new parameter, for now. (composite_clean, pop_input): Rework to minimize indirection, and to avoid infinite recursion in next patch. * m4/macro.c (trace_prepre, trace_pre): Adjust callers. (m4_arg_print): New function. * m4/symtab.c (m4_symbol_value_print): Update signature. (m4_symbol_print): Update caller. * m4/output.c (m4_shipout_string_trunc): Update comments. * m4/syntax.c (set_quote_age): Require comma as argument separator when dealing with $@ as a unit. * tests/builtins.at (ifelse): Augment test. * doc/m4.texinfo (Changesyntax): Document changesyntax deficiency. 2008-01-31 Eric Blake Kill hack for M4 1.4.4. * configure.ac (AM_GNU_GETTEXT_INTL_SUBDIR): Delete, now that we require new enough autoconf which in turn requires M4 1.4.5. 2008-01-31 Gary V. Vaughan and Eric Blake Depend on new libtool to use non-recursive build. * configure.ac (LT_PREREQ): Bump to alpha release version. (LTDL_INIT): Choose nonrecursive mode. Perform sanity check that installed libtool has correct symbols. * Makefile.am (SUBDIRS): Drop ltdl, now that it is built from the top level. (AM_CPPFLAGS): Drop directories covered by libtool. (AM_LDFLAGS): Drop -no-undefined, covered by libtool. (include_HEADERS, noinst_LTLIBRARIES, EXTRA_LTLIBRARIES): New macros, used by libtool. (lib_LTLIBRARIES): Also used by libtool. (ltdl/libltdlc.la): Delete, now that libtool does this. * bootstrap: Mention new requirements. (LIBTOOLIZE): Provide default program, and run libtoolize prior to autoreconf. (autoreconf): Also neutralize libtoolize, since it is run early. * HACKING: Mention updated prerequisites. 2008-01-28 Ralf Wildenhues Fix build failure if installed libltdl is used. * Makefile.am (m4_libm4_la_DEPENDENCIES): Use $(LTDLDEPS). 2008-01-28 Eric Blake Depend on newer autoconf, for testsuite -C dir. * Makefile.am (CD_TESTDIR): Delete, no longer required. (check-local, installcheck-local, clean-local-tests): Use new -C option from autotest. * configure.ac (AC_PREREQ): Bump to 2.61a.347. * bootstrap: Mention new dependency. * HACKING: Likewise. 2008-01-27 Eric Blake Stage 13: push composite text tokens. Support pushing composite tokens, allowing back-references to be reused through multiple macro expansions. Add hueristic that avoids creating new reference when pushing existing references. Memory impact: noticeable improvement due to better reference reuse, except for O(n) to O(n^2) copying in boxed recursion. Speed impact: slight penalty, due to more bookkeeping. * m4/m4private.h (m4__push_symbol): Adjust prototype. * m4/input.c (m4__push_symbol): Add parameter, and support composite tokens. (append_quote_token): Add parameter, and support inlining of short text. (m4__next_token): Adjust caller. * m4/macro.c (m4_push_arg, m4_push_args): Likewise. 2008-01-26 Eric Blake Stage 12c: add macro for m4_arg_len. Make a common action easier to type. Memory impact: none. Speed impact: none. * 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. Stage 12b: add m4_string_pair. Make passing quote delimiters around more efficient. Memory impact: none. Speed impact: slight penalty, due to more bookkeeping. * m4/m4module.h (m4_string_pair): New type. (m4_get_syntax_quotes, m4_get_syntax_comments): New prototypes. (m4_symbol_value_print, m4_symbol_print, m4_shipout_string_trunc): Alter signature. * m4/m4private.h (struct m4_string): Delete. (struct m4_syntax_table): Combine quote and comment members. (m4_get_syntax_lquote, m4_get_syntax_rquote, m4_get_syntax_bcomm) (m4_get_syntax_ecomm): Adjust accessors. (m4_get_syntax_quotes, m4_get_syntax_comments): New fast accessors. * m4/symtab.c (m4_symbol_value_print, m4_symbol_print): Alter signatures. * m4/input.c (string_print, composite_print, m4_input_print): All callers updated. * m4/syntax.c (m4_syntax_delete, m4_set_syntax) (check_is_single_quotes, m4_set_quotes, set_quote_age) (m4_get_syntax_lquote, m4_get_syntax_rquote) (m4_get_syntax_quotes, check_is_single_comments, m4_set_comment) (m4_get_syntax_bcomm, m4_get_syntax_ecomm) (m4_get_syntax_comments): Likewise. * m4/macro.c (trace_prepre, trace_pre, m4_push_args): Likewise. * m4/output.c (m4_shipout_string, m4_shipout_string_trunc): Likewise. * modules/m4.c (dumpdef, m4_make_temp): Likewise. * src/freeze.c (produce_frozen_state): Likewise. * tests/freeze.at (reloading unknown builtin): Update test. Stage 12a: make m4_symbol_chain a union. Shrink size of symbol chains by using a union. Memory impact: slight improvement, due to smaller struct. Speed impact: slight improvement, due to less bookkeeping. * m4/m4private.h (enum m4__symbol_chain_type): New enum. (struct m4_symbol_chain): Rename... (struct m4__symbol_chain): ...to this, since it is internal. * m4/symtab.c (m4_symbol_value_copy, m4_symbol_value_print): All callers updated. * m4/input.c (struct m4_input_block, m4__push_symbol) (composite_peek, composite_read, composite_unget) (composite_clean, composite_print, m4__make_text_link) (append_quote_token): Likewise. * m4/macro.c (expand_macro, arg_mark, m4_arg_symbol, m4_arg_text) (m4_arg_equal, m4_arg_len, m4_make_argv_ref, m4_push_arg) (m4_push_args): Likewise. 2008-01-23 Eric Blake Adjust to recent libtool interface change. * configure.ac (LT_PREREQ): Require bleeding-edge libtool. (LT_WITH_LTDL): Delete, now that it is obsolete. (LTDL_INIT): Use new libtool macro. 2008-01-22 Ralf Wildenhues and Eric Blake Rely on newer automake. * configure.ac (AM_INIT_AUTOMAKE): Require 1.10.1, and add lzma distribution. * bootstrap: Update automake requirement. (func_version): Fix --version output, broken since 2007-08-06. * HACKING: Likewise. Add lzma requirement. * Makefile.am (clean-local-src): Not needed any more with newest Automake. (clean-local): Adjust. * TODO: Remove completed item. 2008-01-22 Eric Blake Doc tweak. * doc/m4.texinfo (Renamesyms): Avoid underfull hbox, and improve example. 2008-01-21 Eric Blake Stage 11: full circle for single argument references. Pass quoted strings through to argument collection in a single action, so that an argument can be reused throughout macro recursion if it remains unchanged. Memory impact: noticeable improvement, due to more reuse in argument collection stacks; O(n^2) to O(n) on boxed recursion. Speed impact: noticeable improvement, due to less copying. * m4/m4module.h (m4_arg_text): Add parameter. (M4ARG): Adjust. * m4/m4private.h (CHAR_QUOTE): New input engine sentinel. (m4__make_text_link): New prototype. (struct m4_symbol_chain): Add quote_age member. (struct m4_symbol_value): Add end member to chained symbol. (struct m4_macro_args): Add wrapper member. * m4/symtab.c (m4_symbol_value_print): Print composite tokens. (m4_symbol_value_copy, m4_symbol_value_delete): Recognize composite tokens. * m4/input.c (make_text_link): Rename... (m4__make_text_link): ...to this, and export. (m4_push_string_finish): Adjust caller. (make_text_link, m4__push_symbol): Update new field. (file_read, builtin_read, string_read, composite_read, next_char): Add parameter. (m4_skip_line, match_input, consume_syntax): Adjust callers. (append_quote_token): New function. (m4__next_token): Pass quoted strings onto argument collection. (m4_print_token) [DEBUG_INPUT]: Update. * m4/macro.c (expand_argument): Collect composite arguments. (collect_arguments): Update new field. (expand_macro): Reduce ref-count of back-references after use. (arg_mark, m4_arg_symbol, m4_make_argv_ref): Adjust to new member names. (m4_is_arg_text): Also recognize composite symbols as text. (m4_arg_text, m4_arg_len): Merge composite symbols as needed. (m4_arg_equal): Compare composite symbols. (m4_push_arg, m4_push_args): Handle composite symbols. (m4_arg_symbol): Relax assertion. (process_macro): Use single-argument references. * m4/output.c (m4_shipout_string_trunc): Update comment. * tests/macros.at (Rescanning macros): Augment test. 2008-01-16 Eric Blake Stage 10: avoid extra copying of strings and comments. When collecting tokens that are immune to further expansion, avoid copying data from one obstack to another by outputting it into the destination obstack to begin with. Also reduce copying done in format builtin. Memory impact: slight improvement, due to better obstack usage. Speed impact: noticeable improvement, due less data copying. * ltdl/m4/gnulib-cache.m4: Import intprops and vasnprintf-posix modules. * m4/m4private.h (m4__token_type): Adjust prototype. * m4/input.c (m4__next_token): Support new parameter. * m4/macro.c (m4_macro_expand_input, expand_token) (expand_argument, collect_arguments): Adjust callers. * modules/m4.c (ntoa): Tighten buffer size. * m4/output.c (m4_tmpname): Guarantee no buffer overflow. * modules/format.c (arg_int, arg_long, arg_double): New helper functions, to detect overflow or unparsed characters. (ARG_INT, ARG_LONG, ARG_STR, ARG_DOUBLE): Adjust to check for missing or excess arguments. (format): Likewise, and also output directly into obstack if there is room. * doc/m4.texinfo (History): Update for new year. (Format): Test for new warnings. 2008-01-15 Eric Blake * TODO: Update with some newer URLs. Verify linear `index'. * tests/builtins.at (index): New test. (translit): Make test take longer, to make quadratic algorithms more apparent. 2007-12-20 Eric Blake Stage 9: share rather than copy single-arg refs. Use hooks of previous patch to create back-references to arguments in the input engine, and inline short text rather than always creating a FIFO link. Also start testing embedded NUL behavior. Until the argument collection engine also shares references, the memory usage increases. Memory impact: noticeable penalty, due to longer life of argv changing O(n) to O(n^2) on boxed recursion. Speed impact: slight improvement, due less data copying. * 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. 2007-12-17 Eric Blake Stage 8: extend life of references into argv. Add hooks to lengthen the lifetime of arguments reused in a macro expansion, rather than always discarding arguments at the end of expand_macro. Rework the expand_macro obstacks to handle longer lifetimes. For now, the hooks remain unused. Memory impact: slight penalty, due to larger structs. Speed impact: slight penalty, due to more bookkeeping. * 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. 2007-12-13 Eric Blake Yet more rewording. * doc/m4.texinfo (Inhibiting Invocation): Missed one instance in the previous patch. * THANKS: Update. 2007-12-13 Paolo Bonzini (tiny change) * doc/m4.texinfo (Inhibiting Invocation): Fix quoting of a quoting example. Reported by Giovanni Toffetti. 2007-12-11 Eric Blake Stage 7: use chained input support in input parser. Allow the LIFO input engine to rescan a macro expansion composed of smaller chunks of FIFO data, rather than the old approach of a monolithic string. For now, all chunks are still copied. Memory impact: slight penalty, due to FIFO chain overhead. Speed impact: slight penalty, due to extra bookkeeping. * m4/m4private.h (m4__push_symbol): New prototype. (struct m4_symbol_chain): Add const-safety. * m4/symtab.c (m4_symbol_value_print): Simplify. (dump_symbol_CB): Update caller. * m4/input.c (struct m4_input_block): Alter u_c member, first introduced 2006-10-25, but unused until now. (composite_peek, composite_read, composite_unget) (composite_print, init_builtin_token): Rewrite accordingly. (m4_push_wrapup): No longer need trailing NUL. (m4__push_symbol, make_text_link): New functions. (m4_push_string_finish): Use them. * m4/macro.c (m4_push_arg, m4_push_args): Likewise. (expand_macro): Simplify logic of nesting_limit. * src/main.c (main): Likewise. * doc/m4.texinfo (Dumpdef): Augment test. 2007-12-08 Eric Blake Stage 6: convert builtins to push arg at a time. Add new methods to factor all builtins whose expansion includes an argument, making back-reference creation easier in future patches. Factor out length-limited printing to obstacks, and use -1 rather than 0 for unlimited length. Memory impact: none. Speed impact: slight improvement, due to better code sharing. * 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. 2007-12-07 Eric Blake Minor security fix: Quote output of mkstemp. * modules/m4.c (m4_make_temp): Produce quoted output. * doc/m4.texinfo (Mkstemp, Mkdtemp): Update the documentation and tests. Stage 5: add notion of quote age. Cache the quoting rules that were in effect when a string was parsed, to avoid reparsing that string if no changequote or other quote age change took place in the meantime. A quote_age of 0 is always safe, but does not benefit from caching. Memory impact: slight improvement, due to smaller struct in input engine. Speed impact: slight penalty, due to more bookkeeping. * m4/m4module.h (m4_get_symbol_value_quote_age): New prototype. (m4_set_symbol_value_text): Adjust prototype. (m4_has_syntax): Factor out the unsigned char cast. * m4/m4private.h (struct m4_syntax_table): Add syntax_age and quote_age members. (m4__quote_age, m4__safe_quotes): New accessor macros, no need for functions at this point. (struct m4_symbol_value, struct m4_macro_args): Add quote_age member. (m4_set_symbol_value_text): Adjust fast accessor. (m4_get_symbol_value_quote_age): New fast accessor. * m4/symtab.c (m4_set_symbol_value_text): Add parameter. (m4_get_symbol_value_quote_age): New function. (m4_symbol_value_copy): Adjust callers. * m4/macro.c (expand_token): Add parameter, and track quote age. (expand_argument, collect_arguments): Track quote age. (m4_macro_expand_input, process_macro, m4_make_argv_ref) (m4_macro_expand_input): Update callers. (m4_arg_text, m4_arg_len, m4_arg_func): Abort on type mismatch. * m4/input.c: Comment cleanups. (struct m4_input_block): Reduce size. (m4__next_token): Report quote age. (m4_push_builtin, init_builtin_token): Update callers. * m4/utility.c (skip_space): Adjust callers. * m4/module.c (install_macro_table): Likewise. * m4/syntax.c (m4_set_syntax): Initialize and update quote age. (m4_set_quotes, m4_set_comment): Detect no-op changes, and update quote age. (set_quote_age): New helper function. (check_is_single_quotes, check_is_single_comments): Adjust callers. * src/freeze.c (reload_frozen_state): Likewise. * src/main.c (main): Likewise. * modules/m4.c (define, pushdef): No need to set macro text. * tests/builtins.at (changequote, defn): New tests. * examples/wrapfifo.m4: New file. * examples/wraplifo.m4: New file. * Makefile.am (dist_pkgdata_DATA): Distribute new examples. 2007-12-04 Eric Blake Fix builds with OpenBSD make. * Makefile.am (HELP2MAN): New macro. (dist_man_MANS, doc/m4.1): Fix rules for building m4.1 into srcdir. * README: Update copyright. * HACKING: Mention help2man and makeinfo dependencies. 2007-11-29 Eric Blake Stage 4: route indir, builtin through ref; make argv opaque. Finish making struct opaque to all but the input engine, by reworking obstack usage in expand_macro to better support creation of a $@ reference. Canonicalize the empty argument, to allow pointer comparison optimizations. Memory impact: slight penalty, due to larger struct. Speed impact: slight improvement, due to fewer function calls. * 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. Stage 3b: cache length, rather than computing it, in modules. Use cached token length in builtins and output engine. Memory impact: none. Speed impact: noticeable improvement, due to fewer function calls. * 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. 2007-11-28 Eric Blake Stage 3a: cache length, rather than computing it, in libm4. Cache the length of a token in the input engine and symbol table, to avoid repeating lots of strlen calls. Additionally, by using obstack length rather than strlen, the input engine can now support embedded NUL. Memory impact: slight penalty, due to larger struct. Speed impact: slight improvement, due to fewer function calls. * 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. 2007-11-27 Eric Blake Stage 2: use accessors, not direct reference, into argv. Outside of macro.c, use accessor methods rather than direct access into the argv struct. Memory impact: none. Speed impact: slight penalty, due to increased function calls. * 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. 2007-11-24 Eric Blake Stage 1: convert m4_symbol_value** into new object. Pass a variable-size wrapper structure instead of an array to builtins, so that subsequent optimizations in the structure need not impact every builtin client. Memory impact: slight penalty, since struct is larger than array. Speed impact: slight penalty, due to increased bookkeeping. * 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. 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. 2007-11-23 Eric Blake 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. 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. 2007-11-14 Eric Blake Handle some defn corner cases differently. * doc/m4.texinfo (Defn): Update documentation; although this still doesn't match the branch, since it may be changed before 2.0. * m4/macro.c (expand_argument): Consistently ignore builtins in concatenation contexts. * m4/m4private.h (m4__symbol_type): Fix C89 compliance bug. 2007-11-13 Eric Blake Note: Patches titled Stage 0 through N form a series of patches which decreases the algorithmic complexity of tail recursion in macro expansions from O(n^2) to O(n) in both time and memory, then performs cleanups, such as handling of embedded NUL, made easier by the code refactoring. Stage 0: Fix memory leak in tail recursion. Free expansion text in the input engine as soon as it is parsed, rather than when the recursive expansion completes. Memory impact: noticeable improvement, due to reduction from O(n^2) to O(n) on recursion. Speed impact: minor improvement, due to better memory usage. * m4/input.c (pop_input): Add flag parameter and return type. (next_char): Adjust caller. (m4_push_string_init): Let go of memory earlier. 2007-11-07 Eric Blake * tests/macros.at (Rescanning macros): Test more corner cases. 2007-11-06 Eric Blake * build-aux/mkstamp: Rename from ltdl/config/mkstamp. * Makefile.am (tests/package.m4): Work around bash bug. Reported by Ralf Wildenhues. 2007-11-05 Eric Blake For consistency with other GNU projects, use build-aux directory. * configure.ac (AC_CONFIG_AUX_DIR): Change ltdl/config to build-aux. * bootstrap (config_aux_dir): Likewise. * Makefile.am (config_aux_dir): Likewise. * ltdl/m4/gnulib-cache.m4: Use --aux-dir option. 2007-11-02 Eric Blake Update some documentation about version control. * NEWS: M4 is now stored in git. * HACKING: Likewise. * README: Likewise. * bootstrap: Likewise. * commit: Delete, now that CVS commits are no longer necessary. * ltdl/config/mailnotify: No longer necessary; git's patch generation and mail capability is more powerful. Update to recent gnulib changes. * ltdl/m4/gnulib-cache.m4: Replace fprintf-posix, vasprintf-posix, xprintf, and xvasprintf with xprintf-posix and xvasprintf-posix. 2007-11-01 Eric Blake Improve error message when early end of file occurs. * doc/m4.texinfo (Macro Arguments, Changequote, Changecom) (M4wrap): Adjust to new messages. (Improved capitalize): Enhance test. * m4/m4private.h (m4__next_token): Adjust prototype. * m4/input.c (m4__next_token): Add new parameter, and improve error message. * m4/macro.c (m4_macro_expand_input, collect_arguments): Adjust callers. (expand_argument): Likewise, and add parameter. 2007-10-31 Eric Blake Test more corner cases. * tests/macros.at (Rescanning macros): Beef up test. * doc/m4.texinfo (Changecom): Beef up test. (Improved foreach): Document alternate foreachq style. * examples/foreachq3.m4: New file. * examples/loop.m4: New file. * Makefile.am (dist_pkgdata_DATA): Distribute them. 2007-10-28 Eric Blake More test coverage for autoconf usage patterns. * doc/m4.texinfo (Shift): Document cond macro, and add new test. * tests/macros.at (Rescanning macros): New test. * tests/builtins.at (include): Augment test. 2007-10-28 Ralf Wildenhues * Makefile.am: Adjust getopt handling to latest gnulib layout. 2007-10-27 Eric Blake Document one use of changequote(`(',`)'). * doc/m4.texinfo (Changequote): Add new test, based on recent autoconf addition of m4_expand. 2007-10-24 Ralf Wildenhues * Makefile.am (dist_pkgdata_DATA): Add examples/capitalize2.m4. 2007-10-22 Eric Blake Never let printf failures go undetected. * ltdl/m4/gnulib-cache.m4: Augment with 'gnulib-tool --import xprintf'. * m4/system_.h: Include xprintf.h. * m4/debug.c (m4_debug_message_prefix, m4_debug_message): Wrap all use of printf, xprintf. * m4/input.c [DEBUG_INPUT]: Likewise. * m4/module.c [DEBUG_MODULES]: Likewise. * m4/output.c (m4_shipout_text, m4_shipout_int) (m4_freeze_diversions): Likewise. * m4/path.c [DEBUG_INCL]: Likewise. * m4/symtab.c [DEBUG_SYM]: Likewise. * m4/syntax.c [DEBUG_SYNTAX]: Likewise. * modules/modtest.c (export_test): Likewise. * src/freeze.c (produce_resyntax_dump, produce_syntax_dump) (produce_module_dump, dump_symbol_CB, produce_frozen_state): Likewise. * src/main.c (usage): Likewise. * po/POTFILES.in: Adjust to new file. * po/Makevars (XGETTEXT_OPTIONS): Likewise. 2007-10-18 Eric Blake Fix 'm4 -F file -t undefined'. * src/freeze.c (produce_symbol_dump): Skip trace placeholders. * src/freeze.c (dump_symbol_CB): Also skip void symbols. * tests/freeze.at (reloading unknown builtin): Test for this bug. * m4/m4module.h (m4_symtab_apply): Add parameter. * m4/symtab.c (m4_symtab_apply): Ignore trace placeholders when requested. (m4_symtab_delete, symtab_dump): Adjust callers. * modules/m4.c (m4_dump_symbols): Likewise. 2007-10-09 Eric Blake 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. 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. 2007-10-02 Eric Blake Document quoting pitfalls in capitalize. * doc/m4.texinfo (Patsubst): Use the examples directory. Also document shortfall. (Improved capitalize): New node. * examples/capitalize.m4: Update to match manual. * examples/capitalize2.m4: New file. 2007-10-01 Eric Blake Another Autoconf usage pattern optimization. * modules/m4.c (m4_index): Optimize search for one byte. * doc/m4.texinfo (Index macro, Regexp, Patsubst): Test the new code paths. 2007-09-29 Eric Blake Optimize for Autoconf usage pattern. * modules/gnu.c (regexp, patsubst): Handle empty regex faster. * tests/testsuite.at (AT_CHECK_M4): Slight optimization. 2007-09-24 Eric Blake Create .gitignore alongside .cvsignore. * bootstrap (version control): Update to reflect git usage. 2007-09-13 Eric Blake * AUTHORS: Fix typo. 2007-09-12 Gary V. Vaughan Be consistent about using 'module' for m4_module types and 'handle' for lt_dlhandle types: * m4/m4private.h (m4_symbol_value): Rename handle element to method. Changed all references. (VALUE_MODULE, SYMBOL_MODULE): Renamed from VALUE_HANDLE and SYMBOL_HANDLE respectively. Changed all references. * m4/m4module.h (M4INIT_HANDLER, M4FINISH_HANDLER): Ditto. * m4/builtin.c (m4_builtin_find_by_name) (m4_builtin_find_by_func): Use module as the parameter name for pointers of type 'm4_module'. * m4/module.c (module_remove, m4_get_module_name) (install_builtin_table, install_macro_table) (m4_module_make_resident, m4__module_next, m4_module_refcount): Ditto. * src/freeze.c (produce_module_dump): Ditto. * m4/input.c (m4_input_block): Rename handle element to method. Changed all references. * m4/symtab.c (m4__symtab_remove_module_references): Ditto. * modules/load.c: Use module as the variable name for pointers of type 'm4_module'. * modules/m4.c: Ditto. * modules/perl.c: Ditto. * modules/shadow.c: Ditto. 2007-09-07 Eric Blake Add refcount builtin. * modules/load.c (refcount): New builtin. (m4modules): Use correct type. * doc/m4.texinfo (Refcount): New section. * m4/m4private.h (struct m4_module): Add refcount member. (m4_module_refcount) [NDEBUG]: Add faster accessor macro. * m4/module.c (m4_module_load): Add symbols to table on first load by m4, regardless of other libltdl loads of same module. (m4_module_refcount): Use new struct member, rather than relying on libltdl count which might be inflated by unrelated loads. (m4__module_interface): Optimize. (m4__module_next, m4__module_find): Avoid assertions that could trigger with unrelated libltdl loads. (m4__module_open): Track m4 load count. (m4__module_exit): Only unload what m4 loaded. (module_remove): Track m4 unloads. * NEWS: Document new builtin. More conversion to m4_module*. * src/freeze.c (produce_module_dump, dump_symbol_CB) (reload_frozen_state): Use correct type. * m4/input.c (struct m4_input_block): Likewise. * m4/symtab.c (dump_symbol_CB): Likewise. * AUTHORS: Simplify, to match libtool and autoconf layout. * THANKS: Sync with branch. 2007-09-06 Eric Blake Wrap lt_dlhandle in struct m4_module. * m4/m4module.h (includes): No longer require clients to know about lt_dlhandle. (m4_module): New opaque declaration. (m4_export): Delete unused type. (M4INIT_HANDLER, M4FINISH_HANDLER, m4_module_init_func) (m4_module_finish_func, m4_module_load, m4_get_module_name) (m4_builtin_find_by_name, m4_builtin_find_by_func): Use new wrapper. (m4_module_makeresident, m4_module_refcount): New declarations. * m4/m4private.h (includes): Move here. (m4_module): New declaration. Simple for now, but intended for growth. (m4__module_open, m4__module_next, m4__module_find) (m4__symtab_remove_module_references): Use new wrapper. * m4/builtin.c (m4_builtin_find_by_name, m4_builtin_find_by_func): Likewise. * m4/module.c (m4_get_module_name, m4_module_import) (m4_module_load): Likewise. (install_builtin_table, install_macro_table): Likewise. Also, change return type since these always returned NULL and no one used the result. (m4_module_makeresident, m4_module_refcount): New functions. (m4_module_unload, m4__module_next, m4__module_find): Use new wrapper. (m4__module_open): Populate new wrapper, and associate it with the lt_dlhandle. (m4__module_exit): Use new wrapper. (module_remove): Likewise. Reclaim storage on last use. (module_close): Delete, and inline into module_remove. * m4/symtab.c (m4__symtab_remove_module_references): Use new wrapper. * modules/load.c (load_init): Use new API. * modules/m4.c (m4_export_table): Kill unused declaration. (m4_init): Use new API. * modules/shadow.c (shadow_init): Use new API. * src/main.c (main): Adjust callers. * src/freeze.c (reload_frozen_state): Likewise. * tests/modules.at (unload load module): New test. 2007-09-03 Gary V. Vaughan * bootstrap (ltdl/m4/.cvsignore): Add xstrtol module macros. * src/m4/.cvsignore: Add xstrtol module sources. 2007-09-03 Gary V. Vaughan Work around a bug in darwin's awk: * bootstrap (func_get_translations): Use $AWK instead of raw `awk' so that the user can use an alternative implementation if the first awk in PATH doesn't behave as expected. (func_get_translations): The first awk script mangles the last entry passed to it for at least the awk implementation shipped with Darwin 8.10.1. Capture $3 into a variable too to work- around that problem. 2007-08-29 Gary V. Vaughan As gnulib xstrtol is only used by main, and unconditionally pulls in a copy of getopt, undo bootstrap change from 2007-08-11 below, and copy the xstrtol code into src/ so that main() can use it without pushing the extra code into libm4: * bootstrap (src_modules): Add getopt and xstrtol modules. * Makefile.am (src_m4_SOURCES): Add xstrtol sources. * po/POTFILES.in: Move gnu/xstrtol-error.c to src/xstrtol-error.c. 2007-08-11 Eric Blake Another upstream xstrtol change. * po/POTFILES.in: Track changes in files containing messages. * bootstrap (src_modules): getopt is now pulled into libgnu.a, no need to grab it separately. * src/main.c (OPT_STR, LONG_OPT_STR, short_opt_str, OPT_STR_INIT): No longer needed. (size_opt): Adjust to latest xstrtol interface. 2007-08-10 Eric Blake Documentation improvements. * doc/m4.texinfo (Defn): Resync with branch. (Compatibility, Extensions): Sync with branch. 2007-08-07 Eric Blake Adjust to gnulib xstrtol changes. * src/main.c (size_opt): Adjust signature, so that error strings are easier to translate. (OPT_STR, LONG_OPT_STR, short_opt_str, OPT_STR_INIT): New macros for tracking long options. (main): Track which long option was used. * tests/options.at (--debuglen, --nesting-limit): Adjust to change in error message. (deprecated options): Test that --arglength spelling shows up in error message. 2007-08-06 Eric Blake 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/evalparse.c: Likewise. * modules/format.c: Likewise. * modules/gnu.c: Likewise. * modules/import.c: Likewise. * modules/load.c: Likewise. * modules/m4.c: Likewise. * modules/m4.h: Likewise. * modules/modtest.c: Likewise. * modules/mpeval.c: Likewise. * modules/perl.c: Likewise. * modules/shadow.c: Likewise. * modules/stdlib.c: Likewise. * modules/time.c: Likewise. * modules/traditional.c: Likewise. * po/Makevars: Likewise. * src/freeze.c: Likewise. * src/m4.h: Likewise. * src/main.c: Likewise. * src/stackovf.c: Likewise. * tests/builtins.at: Likewise. * tests/freeze.at: Likewise. * tests/generate.awk: Likewise. * tests/m4.in: Likewise. * tests/macros.at: Likewise. * tests/modules.at: Likewise. * tests/options.at: Likewise. * tests/others.at: Likewise. * tests/stackovf.test: Likewise. * tests/testsuite.at: Likewise. 2007-07-22 Eric Blake Fix diversions on NetBSD, when fopen(name,"a+") seeks to end. * m4/output.c (m4_tmpopen): Explicitly seek to beginning. * tests/builtins.at (divert): Enhance test to cover this. * THANKS: Update. Reported by Thomas Klausner. 2007-07-20 Eric Blake Fix 'make distcheck' issues. * bootstrap: Add more files that might be more up-to-date in gnulib. * Makefile.am (EXTRA_DIST): No longer distribute removed diff. * config/m4/gnulib-cache.m4: Update to latest gnulib. 2007-07-16 Eric Blake * po/POTFILES.in: Track recent translation additions from gnulib updates. 2007-07-14 Eric Blake Reflect upstream license .texi changes. * doc/m4.texinfo (Copying): Rename node... (GNU General Public License): ...to this. (GNU Free Documentation License): Adjust node location. * local/doc/gpl-3.0.texi.diff: Remove file. 2007-07-10 Eric Blake 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.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/evalparse.c: Likewise. * modules/format.c: Likewise. * modules/gnu.c: Likewise. * modules/import.c: Likewise. * modules/load.c: Likewise. * modules/m4.c: Likewise. * modules/m4.h: Likewise. * modules/modtest.c: Likewise. * modules/mpeval.c: Likewise. * modules/perl.c: Likewise. * modules/shadow.c: Likewise. * modules/stdlib.c: Likewise. * modules/time.c: Likewise. * modules/traditional.c: Likewise. * po/Makevars: Likewise. * src/freeze.c: Likewise. * src/m4.h: Likewise. * src/main.c: Likewise. * src/stackovf.c: Likewise. * tests/builtins.at: Likewise. * tests/freeze.at: Likewise. * tests/generate.awk: Likewise. * tests/m4.in: Likewise. * tests/macros.at: Likewise. * tests/modules.at: Likewise. * tests/options.at: Likewise. * tests/others.at: Likewise. * tests/stackovf.test: Likewise. * tests/testsuite.at: Likewise. 2007-07-09 Eric Blake * modules/format.c (format): Avoid undefined behavior with %c. 2007-07-01 Gary V. Vaughan The translation project has moved. * bootstrap (func_get_translations): Use the new translation project url. (TP_URL): Removed. 2007-06-26 Karl Berry (tiny change) Match Free Software Directory categories. * doc/m4.texinfo (dircategory): Update. 2007-05-31 Eric Blake Add extension to divert builtin. * modules/m4.c (builtin_divert): Immediately divert second argument. * m4/output.c (m4_output_text): Allow 0 length. Fixes regression from two days ago. (m4_shipout_text): Short-circuit on zero length. * tests/freeze.at (loading format 2): Expand test to catch regression. Also check out-of-range version. * tests/builtins.at (divert): Expand test to check corner cases of extension. * doc/m4.texinfo (Divert): Document the extension. * NEWS: Likewise. Reported by Daniel Richard G. 2007-05-30 Eric Blake 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-05-28 Eric Blake * tests/options.at (--syncoutput): Add xfailed test. Fix sync line interaction with multiline comments. * doc/m4.texinfo (Preprocessor features): Improve documentation. (Syncoutput): Improve testsuite. (Incompatibilities): Add testcase, and document bug. * src/freeze.c (reload_frozen_state): Don't interfere with synclines when reloading state. * m4/input.c (m4__next_token): Report line where multiline tokens start. * m4/m4private.h (m4__token_type): Add parameter. * m4/m4module.h (m4_output_text): Export. (m4_shipout_text): Add parameter. * src/macro.c (m4_macro_expand_input, expand_token) (expand_argument): Adjust callers so that line is passed from input to output. * m4/output.c (output_text): Rename... (m4_output_text): ...to this, and export. (m4_insert_file, insert_diversion_helper): Update callers. (m4_shipout_text): Take new parameter for start line of token. Output at most one syncline per token. Reported by Sergey Poznyakoff. Fix large diversion corner cases. * tests/freeze.at (large diversion): New test. * m4/output.c (m4_tmpfile, m4_tmpopen): Simplify use of errno. (make_room_for): Use NULL, not 0, for pointers. (m4_freeze_diversions): Allow freezing large diversions. (insert_diversion_helper): Avoid using rewind. Also run gnulib unit tests during make check. * ltdl/m4/gnulib-cache.m4: Augment with 'gnulib-tool --tests-base=tests/gnu --with-tests'. * configure.ac (AC_CONFIG_FILES): Build tests/gnu testdir. * Makefile.am (SUBDIRS): Run gnulib tests before ours. 2007-05-25 Eric Blake * m4/system_.h: Include , for intmax_t. * THANKS: Update. Reported by Daniel Richard G. 2007-05-24 Eric Blake Provide consistent shift semantics regardless of hardware. * modules/m4.c (numb_lshift, numb_rshift, numb_urshift): Mask before shifting. (number, unumber): Always use [u]intmax_t. Reported by Gary V. Vaughan. Support POSIX flush semantics on all platforms. * modules/m4.c (m4_sysval_flush): Rely on gnulib. * ltdl/m4/gnulib-cache.m4: Fix typo in previous commit. Work around cygwin and mingw fseeko bugs. * ltdl/m4/gnulib-cache.m4: Augment with 'gnulib-tool --import fseeko'. * modules/m4.c (m4_sysval_flush): Prefer fseeko over fseek. 2007-04-25 Eric Blake Test that regression in 1.4.9's eval doesn't recur. * doc/m4.texinfo (Eval): Check negative division. * THANKS: Update. 2007-04-12 Eric Blake Allow for running test in sticky or setgid directory. * tests/builtins.at (mkdtemp): Adjust test. Don't test for broken sed too soon. * tests/others.at (stdin seekable): Rearrange subtests. Work around 'stdin seekable' shortcoming on glibc. * ltdl/m4/gnulib-cache.m4: Use closein instead of closeout. * tests/others.at (stdin closed): Adjust to new output. * src/main.c (process_file): No need to return anything. (main): Use close_stdin instead of close_stdout. Reported by Ralf Wildenhues. Enable autobuild usage. * ltdl/m4/gnulib-cache.m4: Augment with 'gnulib-tool --import autobuild'. * configure.ac (AB_INIT): Output autobuild information. 2007-04-11 Eric Blake Address testsuite shortcoming in 'stdout full' on glibc. * tests/others.at (stdout full): Adjust expected output when more than 1k text is printed to /dev/full. Reported by Ralf Wildenhues. 2007-04-10 Eric Blake * tests/macros.at (Arity and defn): Fix quoting. 2007-04-09 Eric Blake Address failure of 'seekable stdin' on Mac OS X. * ltdl/m4/gnulib-cache.m4: Augment with 'gnulib-tool --import fflush'. 2007-04-07 Eric Blake Include first in all C files, and not in headers. Fixes regression for --disable-assert builds from 2007-04-02. * src/m4.h (includes): Don't include config.h here. * m4/m4private.h (includes): Likewise. * m4/builtin.c: Include config.h before anything else. * m4/debug.c: Likewise. * m4/hash.c: Likewise. * m4/input.c: Likewise. * m4/m4.c: Likewise. * m4/macro.c: Likewise. * m4/module.c: Likewise. * m4/symtab.c: Likewise. * m4/syntax.c: Likewise. * m4/utility.c: Likewise. * src/freeze.c: Likewise. * src/stackovf.c: Likewise. 2007-04-03 Eric Blake * modules/m4.c (numb_ratio, numb_divide, numb_modulo): Avoid SIGFPE on x86 architectures. Reported by Ralf Wildenhues. 2007-04-02 Eric Blake Fix warnings from last commit. * ltdl/m4/gnulib-cache.m4: Augment with 'gnulib-tool --import fprintf-posix sprintf-posix'. * m4/macro.c (expand_macro, trace_format): Use correct specifier for size_t. (process_macro): Avoid negative array index. * src/freeze.c (produce_resyntax_dump, produce_module_dump) (dump_symbol_CB, produce_frozen_state): Use correct specifier for size_t. 2007-04-02 Gary V. Vaughan Get rid of the last 'differs in signedness' compiler warnings: * m4/macro.c (process_macro): m4_get_symbol_value_text() returns a regular 'char *', so variables to store the return address, and iterate through it should be regular 'char *' too. * m4/input.c (m4_input_block): The start and current members of the string part of this union store regular 'char *' types, so they should be regular 'char *' types too. 2007-04-02 Gary V. Vaughan 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 is already included via m4private.h. * modules/time.c (stdio.h): Ditto. * modules/gnu.c (stdlib.h): Ditto resp . * modules/stdlib.c (stdlib.h, unistd.h): Ditto resp and , * 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-03-28 Gary V. Vaughan * Makefile.am (stamp-vcl): Removed. (CONFIG_STATUS_DEPENDENCIES): Depend directly on ChangeLog. 2007-03-28 Eric Blake * src/main.c (usage): Improve note to TRANSLATORS. * m4/system_.h (EXIT_FAILURE): Reflect gnulib changes. * tests/builtins.at (__m4_version__): Fix bug when TIMESTAMP is empty. 2007-03-24 Eric Blake * m4/output.c (m4_output_init): Update to latest gnulib. * bootstrap (ltdl/m4/.cvsignore): No longer track generated .cvsignore in CVS. * NEWS: Reflect release of 1.4.9. * THANKS: Update. 2007-03-07 Eric Blake * AUTHORS: Update Exercise gnulib's new POSIX *printf modules. * ltdl/m4/gnulib-cache.m4: Augment with 'gnulib-tool --import vasprintf-posix'. * modules/format.c (format): Support %a and %A. * doc/m4.texinfo (Format): Test this addition. * NEWS: Document this addition. 2007-03-03 Eric Blake * m4/input.c (m4__next_token): Fix synclines when in batch mode. * doc/m4.texinfo (M4exit): Synch another section. (Syncoutput): Make similar to other sections. 2007-03-01 Eric Blake * doc/m4.texinfo: Improve the indices. (Concept index): Rearrange to be last. (Sysval): Merge from branch. * doc/m4.texinfo (Syscmd, Esyscmd): Merge more doc sections. 2007-02-28 Eric Blake POSIX XCU ERN 137 was approved. * modules/mpeval.c (numb_extension): Delete. * modules/m4.c (numb_extension): Likewise. * modules/evalparse.c (comma_term, condition_term): Always implement ?: and , operators. * m4/symtab.c: Update comment to match reality. * src/freeze.c (produce_frozen_state, reload_frozen_state): Avoid dereferencing context directly when accessor exists. * src/main.c (usage): Prefer GNU_M4 over EMACS. (struct macro_definition): Rename... (struct deferred): ...to match usage. All uses changed. * doc/m4.texinfo (Eval): Document this change. (Operation modes, Changeresyntax): Fix wording to prefer GNU_M4 over emacs. (Preprocessor features, Changesyntax): Fix inaccuracies. * NEWS: Import branch NEWS items for 1.4.x series. Document change in eval. POSIX XCU ERN 118 was approved. * modules/m4.c (define): Kill posixly_correct distinction in define behavior, since POSIX says GNU behavior complies. * tests/builtins.at (define): Restore original semantics. * doc/m4.texinfo (Pushdef): Document portability issues with define. (Incompatibilities): Clean up wording of what POSIX requires. * NEWS: Document this. 2007-02-26 Eric Blake Re-enable clean bootstrap on cygwin. * Makefile.am (AM_LDFLAGS): For now, export all symbols from modules, since otherwise we run afoul of current libtool limitations on cygwin and mingw. 2007-02-25 M. Levinson (tiny change) * src/freeze.c (reload_frozen_state): Avoid dereferencing freed memory. Fixes regression introduced 2007-01-20. 2007-02-25 Eric Blake * tests/freeze.at (loading format 2): Augment test to catch regression introduced on 2007-01-20. * THANKS: Update. Reported by M. Levinson. * m4/system_.h (includes, EXIT_SUCCESS, EXIT_FAILURE): Adjust to latest gnulib. 2007-02-05 Eric Blake * tests/options.at (--fatal-warnings): New test. * tests/others.at (stdin seekable): Exit on error. * m4/m4private.h (M4_OPT_WARN_EXIT_BIT): New bit. (m4_get_warnings_exit_opt): Access it. * m4/m4module.h (m4_context_opt_bit_table): Access it. * m4/utility.c (m4_error, m4_error_at_line): Only force an exit on -EE. (m4_warn, m4_warn_at_line): Change exit status on -E, and force exit on -EE. * src/m4.c (usage): Document new -E behavior. (main): Make -E an additive option. * doc/m4.texinfo (Operation modes): Document the change. Reported by Ralf Wildenhues. * tests/others.at (stdin seekable): Fix bug in test. * ltdl/m4/gnulib-cache.m4: Gnulib module strstr no longer exists. * m4/input.c (struct m4_input_block): Remove unused field traced. 2007-02-03 Eric Blake and Bruno Haible (tiny change) * doc/m4.texinfo (Input processing, Quoting Arguments): Beef up the examples. Reported by Bruno Haible. 2007-01-31 Eric Blake * m4/resyntax.c (m4_regexp_syntax_encode): Detect allocation failure. 2007-01-26 Eric Blake * m4/symtab.c (includes): Adjust to latest gnulib. * modules/m4.c (includes): Likewise. 2007-01-23 Eric Blake * m4/m4module.h (M4_SYNTAX_ASSIGN): Delete this unused extension to make enough room. (M4_SYNTAX_IGNORE): Change value to zero, since the (commented) code in input.c special cases this category. (M4_SYNTAX_LBRACE, M4_SYNTAX_RBRACE): New values in preparation for define(eleventh,${11}) extension. * m4/syntax.c: Update comments accordingly. (m4_syntax_create, m4_syntax_code): Handle { and }. * m4/input.c (m4__next_token): Likewise. * src/freeze.c (produce_frozen_state): Support new categories. (reload_frozen_state): When loading version 1, disable syntax features not present in 1.4.x. * tests/freeze.at: Sort and rename existing tests. (loading format 1): Ensure we don't break v1 frozen files that used raw ${. (loading format 2, reloading changecom, reloading changesyntax): New tests. * doc/m4.texinfo (Changesyntax, Frozen file format 1): Document the new syntax categories. (Arguments): Update the FIXME comment. (M4wrap): Merge examples from branch, before worrying about fixing m4wrap to obey POSIX. (Using frozen files): Start merging from branch. * NEWS: Update. 2007-01-20 Eric Blake * src/freeze.c (produce_char_dump): Delete. Replace with... (produce_mem_dump): ...this new function, to encode more strings. Also make the coding easier to read and slightly more compact. (produce_syntax_dump): Only dump non-default syntax codes. (produce_module_dump, dump_symbol_CB, produce_frozen_state): Encode non-ASCII characters in user-supplied strings. (GET_STRING): Accept escape sequences in version 2. * NEWS: Document this change. * TODO: Update. 2007-01-16 Eric Blake Port patch from branch for stack overflow detection on BSD/OS. * ltdl/m4/stackovf.m4 (M4_SYS_STACKOVF): Check for stack_t.ss_sp. * src/stackovf.c (setup_stackovf_trap) [HAVE_SIGALTSTACK && ! HAVE_STACK_T_SS_SP]: Use this check. Reported by Chris McGuire. 2007-01-15 Eric Blake * 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-01-13 Eric Blake * doc/m4.texinfo (Mpeval): Add tests. * tests/testsuite.at (AT_CHECK_GMP): New filter, factored from... * tests/builtins.at (gmp): ...here. Rename test to... (mpeval): ...this. * tests/generate.awk (new_test): Filter out mpeval tests when gmp is not available. * m4/m4module.h (m4_get_no_gnu_extensions_opt): Merge no_gnu_extensions with posixly_correct_opt, since they were set in sync. * m4/m4private.h (struct m4): Remove no_gnu_extensions. * src/main.c (main): Update caller. * src/freeze.c (reload_frozen_state): Likewise. * modules/m4.c (m4wrap): Likewise. 2007-01-12 Eric Blake * m4/syntax.c (m4_set_comment): XCU ERN 131 was approved by POSIX, so update the comment. * doc/m4.texinfo (Inhibiting Invocation): XCU ERN 130 was approved by POSIX, so we can always have blind macros, even when POSIXLY_CORRECT. (Ifelse): Mention the term `blind builtin'. 2007-01-08 Ralf Wildenhues * doc/m4.texinfo: Fix a couple of typos. 2007-01-08 Eric Blake * ltdl/m4/gnulib-cache.m4: Update for new year. * ltdl/m4/gmp.m4 (_M4_LIB_GMP): Cover all error cases. Reported by Ralf Wildenhues. 2007-01-06 Eric Blake * m4/m4private.h (to_uchar): Move... * m4/m4module.h: here, so modules can use it. * src/main.c (usage, long_options): Support --posix as a synonym for --traditional. * modules/m4.c (numb_invert): Detect unsupported x**-y. (numb_incr, numb_urshift, numb_extension): New macros. (numb_obstack): Port patch from branch to support radix 1 output. * modules/mpeval.c (numb_obstack): Use \ for ratios. (numb_incr, numb_urshift, numb_extension): New macros. (mpq2mpz): Warn rather than error. * modules/evalparse.c (URSHIFT, NEGATIVE_EXPONENT): New enumerators. (eval_error): Rearrange, so that all ignorable errors are less than SYNTAX_ERROR. (eval_text, last_text): Obey C++ type safety rules. (numb_pow): Change return type. (exp_term): Adjust caller. (m4_evaluate): Fail on bad exponent. (logical_or_term, logical_and_term): Ignore failed ** in short circuit. (eval_lex): Fix typos when detecting <<= and >>=. Use \ instead of : for ratio. Support >>>, ,, and ?:. Port patch from branch to parse radix 1 numbers. (condition_term, comma_term): New parse functions. (shift_term): Support >>>. (m4_evaluate): Port patch from branch to output radix 1 numbers. Warn instead of error for most parse problems. * doc/m4.texinfo (Limits control, Eval): Document these changes. * NEWS: Document new operators and new command line option. 2007-01-04 Eric Blake * configure.ac (AC_SYS_LARGEFILE): Guarantee large file support. 2007-01-03 Eric Blake * doc/m4.texinfo (Format, Incr): More merges. (Eval): Ensure C precedence rules are met. * modules/evalparse.c (BADOP, INVALID_OPERATOR): New enumerators. (not_term, logical_not_term): Delete; these are same precedence as other unary operators. (equality_term): New; these are lower precedence than relational operators. (eval_lex, simple_term, m4_evaluate): Recognize forbidden C operators for better error messages. (logical_or_term, logical_and_term): Short-circuit out the error of division by zero. (unary_term): Allow consecutive unary operators. * modules/m4.c (int2numb, numb2int): Delete; these potentially truncate bits. (numb_not, numb_eor, numb_ior, numb_and): Update callers. * modules/mpeval.c (reduce1, reduce2): Protect macros better. * NEWS: Document this change. 2006-12-27 Eric Blake * doc/m4.texinfo (Substr, Patsubst): Merge more sections from the branch. * modules/m4.c (substr): Merge from branch. 2006-12-26 Eric Blake * doc/m4.texinfo (Changesyntax): Check for regressions with changesyntax(W=...). 2006-12-22 Eric Blake * 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, in order to match traditional implementations. * src/freeze.c (reload_frozen_state): Update caller. * doc/m4.texinfo (Changequote, Changecom): Merge from branch, with modifications. (Changeresyntax): Revise to match style of surrounding sections and add more examples. (Changesyntax): Likewise, and update to new semantics. * NEWS: Document this change. * doc/m4.texinfo (Operation modes): Avoid underfull hbox. (M4wrap, Eval, Errprint): Fix typos. (Divnum): Not necessary to redivert in example. 2006-12-21 Eric Blake * doc/m4.texinfo (Len, Index macro, Regexp): More section merging from branch. 2006-12-19 Eric Blake * 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. 2006-12-16 Eric Blake * src/main.c: Fix missing include. * src/main.c (main): Check for errors when closing stdin. * modules/m4.c (m4exit): Missed part of previous patch: flush stdin before a successful exit. Reported by Ralf Wildenhues. 2006-12-14 Eric Blake * modules/m4.c (m4_sysval_flush): Flush stdin before exiting, as required by POSIX. * tests/others.at (stdin seekable): New test. 2006-12-09 Ralf Wildenhues * doc/m4.texinfo: Fix some typos. 2006-12-04 Eric Blake * doc/m4.texinfo (Undivert, Divnum, Cleardivert): Merge more doc sections. (Modules): Make style consistent. 2006-11-16 Eric Blake * bootstrap: Relax m4 requirement, thanks to... * configure.ac (Gettext support): ...this workaround to the 1.4.4 bug. Undoes restriction added on 2006-11-09. * tests/builtins.at (esyscmd, syscmd): Redo, since spilled diversions are now closed when not active. (divert): Remove check now in the manual. * tests/others.at (stderr closed): Likewise. (stdout closed): Add a check. * doc/m4.texinfo (Include, Search Path, Diversions, Divert): Sync more docs with branch. 2006-11-14 Eric Blake Remerge sparse diversion handling from branch. * ltdl/m4/gnulib-cache.m4: Replace avltree-list with avltree-oset. * m4/output.c (diversion_table): Change type to gl_oset_t. (m4_output_init, m4_output_exit, cleanup_tmpfile, make_room_for) (m4_make_diversion, insert_diversion_helper, m4_insert_diversion) (m4_undivert_all, m4_freeze_diversions): Adjust all callers. (div0, diversion_storage): New variables. (diversions, equal_diversion_CB): Deleted. (threshold_diversion_CB): New callback. (m4_tmpname, m4_tmpopen, m4_tmpclose, m4_tmpremove): New functions. (m4_tmpfile): Move cloexec action here. * m4/resyntax.c (m4_regexp_syntax_encode): Avoid bug with signed char. 2006-11-13 Eric Blake 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 line define): Improve. * tests/options.at (--traceon and --traceoff, --syncoutput): New tests. (POSIXLY_CORRECT): Likewise. (deprecated options): Augment. (--regexp-syntax): Update, now that -r takes optional arg. * NEWS: Reformat. Document new options. 2006-11-11 Eric Blake 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. * m4/macro.c (trace_format): Use canonical type name. * m4/output.c (m4_freeze_diversions): Likewise. * src/freeze.c (produce_module_dump, dump_symbol_CB) (produce_frozen_state): Likewise. * m4/m4private.h (to_uchar): Grab from branch. * m4/input.c (string_peek, string_read): Use it. * m4/utility.c (skip_space): Likewise. * src/main.c (main): Likewise. * doc/m4.texinfo (Translit): Remerge from branch. * tests/builtins.at (translit): Test 8-bit range. * modules/m4.c (m4_expand_ranges): Merge from branch. 2006-11-09 Eric Blake * bootstrap: Validate that installed M4 is powerful enough. Reported by Gary V. Vaughan, analyzed by Stepan Kasal. 2006-11-08 Eric Blake Merge deferred handling of -D option from branch. * doc/m4.texinfo (Debugging options, Preprocessor features) (Dynamic loading features, Operation modes, Invoking m4): Document this change. * src/main.c (OPTSTRING): Specify in-order processing. (process_file): New function. (main): Use it to interleave files and deferred options. * tests/macros.at (Command line define): New test. * tests/generate.awk: Allow '@comment file' as first example within a node. * tests/options.at (option grouping): Update to reflect actual POSIX semantics. (file names): New test. 2006-11-07 Eric Blake * m4/output.c (cleanup_tmpfile, m4_insert_diversion_helper): Check for failure. * tests/builtins.at (m4exit): New test; failed on cygwin before this patch. * m4/output.c (cleanup_tmpfile): Close files before removing directory. (make_room_for, m4_output_exit): Ensure that atexit handler invoked from m4_error sees consistent state. * doc/m4.texinfo (Errprint): Merge another doc node. * tests/builtins.at (dumpdef, errprint): New tests. * modules/m4.c (errprint): Merge from branch: flush before printing to stderr. 2006-11-02 Eric Blake * bootstrap: Update bootstrap requirement wording. Reported by Bruno Haible. 2006-10-31 Eric Blake * ltdl/m4/gnulib-cache.m4: Augment with 'gnulib-tool --import strstr'. * doc/m4.texinfo (Translit): Merge from branch. * modules/m4.c (divert, substr): Ignore excess arguments. (index, translit): Merge from branch. * tests/builtins.at (translit): Add a test. 2006-10-30 Eric Blake * m4/m4private.h (m4_get_symbol_value_module): Delete accidental checkin. * m4/symtab.c (m4_get_symbol_value_module): Likewise. * modules/m4.c (m4_make_temp): Make safe across libtool. * m4/symtab.c (dump_symbol_CB) [DEBUG_SYM]: Avoid warnings. * configure.ac (--with-modules): Accomodate changed module location when doing './configure --enable-debug'. 2006-10-28 Eric Blake * ltdl/m4/gnulib-cache.m4: Augment with 'gnulib-tool --import config-h.' 2006-10-27 Eric Blake * bootstrap (gnulib): No longer a need to patch after gnulib-tool --update. * configure.ac (AM_GNU_GETTEXT_VERSION): Bump requirement to 0.16, since 0.15 is incompatible with our automake requirement. * 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_table): Likewise. * src/freeze.c (reload_frozen_state): Likewise. * modules/gnu.c (builtin): Make it possible to retrieve a builtin token, even after the builtin has been undefined. * doc/m4.texinfo (Builtin): Document new capability. * NEWS: Likewise. * ltdl/m4/gnulib-cache.m4: Augment with 'gnulib-tool --import tempname'. * modules/m4.c (m4_make_temp): Use it. * tests/builtins.at (mkstemp, mkdtemp): Update message wording. 2006-10-27 Ralf Wildenhues * Makefile.am (dist_pkgdata_DATA): Distribute recently-added files. 2006-10-26 Eric Blake Silence -O2 -Wall -Wwrite-strings warnings. * m4/m4private.h (m4_symbol_value): Const-ify text. * m4/m4module.h (m4_get_symbol_value_text) (m4_get_symbol_value_placeholder, m4_set_symbol_value_text) (m4_set_symbol_value_placeholder): Likewise. * m4/macro.c (expand_token, expand_argument, expand_macro): Fix fallout. * m4/symtab.c (m4_symbol_value_delete, m4_symbol_value_copy) (m4_get_symbol_value_text, m4_get_symbol_value_placeholder) (m4_set_symbol_value_text, m4_set_symbol_value_placeholder): Likewise. * modules/format.c (format): Likewise. * src/main.c (main): Likewise. * src/freeze.c (produce_symbol_dump, dump_symbol_CB): Likewise. * modules/shadow.c (shadow, test): Likewise. * m4/output.c (m4_make_diversion): Don't hold on to empty diversions. (m4_output_init, make_room_for, m4_undivert_all): Don't type-pun. (m4_freeze_diversions): Likewise. Don't use uninitialized variable. Convert diversions to list instead of sparse array, part 2. * ltdl/m4/gnulib-cache.m4: Augment with 'gnulib-tool --import avltree-list'. * m4/output.c (m4_diversion): Add next pointer and divnum members. (diversion_table): Convert to a list instead of a sparse array. (free_list): Maintain free list of reclaimed diversions. (equal_diversion_CB, cmp_diversion_CB): New functions. (m4_output_init): Set up list. (m4_output_exit): Tear down list. (make_room_for, m4_undivert_all, m4_freeze_diversions): Change list iteration. (m4_make_diversion): Change creation of new diversions. (m4_insert_diversion_helper): New function, to avoid list searches. * tests/builtins.at (divert): The test now passes. * NEWS: Document this improvement. Convert diversions to list instead of sparse array, part 1. * m4/m4module.h (m4_shipout_text, m4_shipout_string): Use size_t for length. * m4/output.c (diversion, total_buffer_size, output_unused): Track size in size_t. All users changed. (struct diversion): Reduce size now, to compensate for part 2. (m4_make_diversion, make_room_for): Avoid malloc overflow. (m4_output_exit): Fix typo in assert. (m4_output_init, make_room_for, m4_make_diversion) (m4_insert_diversion, m4_freeze_diversions): Adjust users of struct m4_diversion to disambiguate the new union. * tests/builtins.at (divert): Detect this failure. 2006-10-25 Eric Blake * m4/m4module.h (m4_push_builtin): Add parameter. * modules/m4.c (defn): Update caller. * m4/input.c (file_read_init, string_read_init): No longer needed. (input_funcs): Change signature of read_func, all callers updated. (composite_peek, composite_read, composite_unget), (composite_print, composite_funcs): New input type. Not yet fully utilized, but one step closer to fixing defn. (m4_input_block): Make every input block track current file and line. Rename some members. Remove unused out_line. Add support for composite input block. (input_change): New flag. (file_peek, file_read, file_clean, file_unget, file_print): Update callers. (m4_push_file, m4_push_builtin, m4_push_string_init) (m4_push_string_finish, m4_push_wrapup, m4_pop_wrapup) (m4_skip_line, pop_input): Track input block changes. (m4_pop_wrapup): Avoid overflow. (init_builtin_token): Handle composite input. (next_char): Handle input block changes. * doc/m4.texinfo (Location): Remerge from branch. * src/m4.h (includes): Need after all; fixes regression from yesterday. * m4/system_.h (obstack_regrow): New macro. Hopefully glibc will accept it someday. * m4/macro.c (expand_macro): Avoid referencing invalid memory. Handle nesting the argc obstack. (expand_token): Avoid unnecessary malloc. (collect_arguments): Copy name before invalidating it. (argc_stack, argv_stack): New variables. (m4_macro_expand_input): Initialize argc and argv stacks once per file, instead of once per macro. 2006-10-24 Eric Blake * src/m4.h (includes): Add gettext.h, for N_. Assume setlocale. 2006-10-23 Eric Blake * doc/m4.texinfo (Macro Arguments, Incompatibilities): Remerge from branch regarding stripped leading whitespace. * modules/m4.c (includes): Use safe headers even when configured with --enable-assert. (m4_builtin_table, m4_make_temp): Work around fact that mkstemp is #defined as mkstemp_safer. 2006-10-21 Eric Blake * 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. * tests/generate.awk (normalize): Update recognition of trailing spaces in tests. * doc/m4.texinfo: Minor formatting fixes from branch. (Foreach, Improved foreach): Merge from branch. * examples/foreach.m4: Merge from branch. * examples/foreachq.m4: New file from branch. * examples/foreach2.m4: Likewise. * examples/foreachq2.m4: Likewise. * doc/m4.texinfo (titlepage): Add myself as author. * src/main.c (AUTHORS): Likewise. 2006-10-19 Eric Blake * modules/m4.c (m4_make_temp, mkstemp): New functions. (maketemp): Add POSIX behavior and a warning. * tests/others.at (maketemp): Move this test... * tests/builtins.at (mkstemp): ...to here, and beef up. * tests/options.at (--safer): Update to new warning message. * doc/m4.texinfo (Mkstemp): Sync from branch. (Extensions): Update maketemp behavior. * NEWS: Document that maketemp now always warns. * tests/generate.awk: For ease of doc-writing, simplify selection of '-Ipath/to/examples' to '@comment examples'. * examples/forloop.m4: Simplify. * examples/forloop2.m4: New file. * examples/quote.m4: New file. * doc/m4.texinfo (Improved forloop): New node. (Manual): Clarify use of examples directory. (Shift, Forloop): Resync from branch. (Include, Location): Update to new usage of examples directory. * m4/system_.h (includes): Pick up before checking for _POSIX_VERSION. (gettext_noop): Don't define here, let gettext.h do it instead. * po/POTFILES.in: Update entries to reflect gnulib imports. 2006-10-16 Eric Blake * ltdl/m4/gnulib-cache.m4: Augment with 'gnulib-tool --import configmake'. * configure.ac (AM_INIT_AUTOMAKE): Bump requirement to 1.10a, for pkglibexecdir support. * Makefile.am (m4_libm4_la_SOURCES, m4/pathconf.h): No longer worry about pathconf.h, now that gnulib does it for us. (pkgmodincludedir): Simplify. (pkglibexecdir): Delete, now that automake does this. * m4/module.c (m4__module_init): Use PKGLIBEXECDIR. * src/main.c (usage): Likewise. * m4/symtab.c (m4_symbol_value_groks_macro): Fix typo. * doc/m4.texinfo: Port some changes from the branch. (Invoking m4): Promote to a chapter, instead of a section of Preliminaries. (Operation modes, Dynamic loading features, Preprocessor features) (Limits control Frozen state, Debugging options) (Command line files): Subdivide into new sections. (Cleardivert): Rename from cleardiv. 2006-10-14 Eric Blake * tests/others.at (stdin closed): Update to match previous patch. * m4/input.c (file_clean): Don't close stdin twice, POSIX says it is not portable. Reported by Ralf Wildenhues. * modules/m4.c (undivert): Merge from branch. * doc/m4.texinfo (Improved fatal_error): Fix typo. (Improved exch): New node, copied from branch. (Improved cleardivert): Update from branch. * THANKS: Update. 2006-10-13 Eric Blake * 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. 2006-10-12 Eric Blake * m4/input.c (m4_print_token) [DEBUG_INPUT]: Modernize. * m4/m4private.h (m4__next_token_is_open): New prototype. * m4/m4module.h (m4_push_single): Delete; push_string is an adequate interface, and removing support for this simplifies the input engine. (m4_push_wrapup): New parameter. (m4_is_syntax): Delete; m4_has_syntax is sufficient. (M4_SYNTAX_LQUOTE, M4_SYNTAX_BCOMM, M4_SYNTAX_MASKS): Make start-quote and start-comment exclusive from other syntax categories. * m4/syntax.c: Likewise. * m4/input.c (input_funcs): Make polymorphic without requiring clients to know whether they are located at isp. All users changed. (file_names): New variable. (m4_input_init): Initialize it. (m4_push_file): Use it. (m4_input_exit): Free it after use. (m4__next_token): Simplify slightly. (m4__peek_token): Rename and simplify... (m4__next_token_is_open): ... to this. In particular, this allows us to avoid a double ungetc, which POSIX doesn't guarantee. (struct m4_input_block, m4_push_single, single_peek, single_read): Remove support for single characters, as the input engine now guarantees we don't need it. (file_unget, string_unget, m4_input_print, unget_input): Strengthen assertions. (file_init_funcs, file_read_init): New for file reading. (string_init_funcs, string_read_init): New for wrapped text. (m4_push_string_init, m4_push_string_finish, m4_push_wrapup): Support wrapped text with locations. (m4_skip_line): Support dnl across include file boundary. (peek_char): Don't pop input when peeking. (file_peek): Peek can be called at the end of the file. (string_read): Don't read beyond string bounds. * m4/macro.c (expand_token, collect_arguments): Update callers. (expand_macro): Report errors at location of open parenthesis. (expand_token, expand_argument, process_macro): Avoid negative array dereferences with m4_has_syntax. * m4/utility.c (skip_space): Likewise. * modules/m4.c (m4wrap): Update caller. * tests/builtins.at (__file__, __line__, dnl): New tests. * tests/options.at (--debugmode): Normalize the output. * doc/m4.texinfo (Macro Arguments, Dnl, History, Location): Remerge recent changes from branch. (Improved fatal_error): New node from branch. 2006-10-11 Eric Blake * src/main.c (usage, long_options): Add --debugmode as an alias for --debug, to match macro name. * tests/options.at (--debugmode): Rename from --debug, and test for new alias. (--discard-comments): Augment test. * doc/m4.texinfo (Invoking m4, Debugmode): Document this. * NEWS: Likewise. 2006-10-10 Eric Blake Trace improvements: debugmode(c) was always printing the last two lines paired, combine them; and show non-text expansions. * m4/macro.c (trace_prepre): Update to show what the macro will expand to. (trace_pre): No need to special-case on debugmode(c). (trace_post): Likewise. Also, show non-text expansions. (expand_macro): Update caller. Collecting arguments can change debug mode, so cache values beforehand. (trace_format): Remove support for unused %l%S%r, and fix support for %z to match gcc's attribute((printf)). (trace_header): Update caller. * m4/input.c (struct m4_input_block): Rename from input_block. (struct input_funcs): Add print_func member. (file_print, builtin_unget, builtin_print, string_print) (m4_input_print): New functions. (m4_push_string_finish): Change return type. (m4_push_file): Fix missing use of close parameter. * m4/debug.c (m4_debug_decode): Don't clear pending traces. * m4/m4module.h (m4_input_print): New prototype. * tests/builtins.at (debug, esyscmd, multiquotes, syscmd): Update to match behavior change. * tests/options.at (--debug): Likewise. * tests/macros.at (Propagation of traceon) (Propagation of --trace): Likewise. * tests/others.at (stderr closed, stdout closed, stdin closed): Likewise. * doc/m4.texinfo (Forloop): Simplify. (Trace): Update to changed behavior. (Debugmode): Document this change. * src/main.c (usage): Likewise. * NEWS: Likewise. 2006-10-09 Eric Blake * m4/path.c (m4_include_env_init): Don't alter result of getenv. Reported by Ralf Wildenhues. * modules/gnu.c (gnu_buf): Rename from buf to silence -Wshadow. 2006-10-07 Eric Blake * m4/m4module.h (m4_set_exit_failure): New prototype. * m4/utility.c (m4_set_exit_failure): New function. * modules/m4.c (m4exit): Use it to avoid yet another global variable export in libm4. 2006-10-06 Eric Blake * m4/output.c (cleanup_tmpfile): Exit nonzero on failure to clean up. * tests/others.at (stdout closed): Fix final check. Replace uses of tmpfile with clean-temp, since tmpfile is incompatible with closeout. * tests/builtins.at (esyscmd, syscmd): Don't use pipe; it loses exit status of m4. * tests/others.at (stderr closed): Likewise. * tests/testsuite.at (M4_ONE_MEG_DEFN): Actually hit one meg. * ltdl/m4/gnulib-cache.m4: Augment with gnulib-tool --import clean-temp. * m4/output.c [!HAVE_TMPFILE]: Delete dead code. (m4_tmpfile, cleanup_tmpfile): New functions. (make_room_for, m4_insert_diversion): Use clean-temp module. * configure.ac (AC_CHECK_FUNCS_ONCE): No longer check for tmpfile. * doc/m4.texinfo (Diversions): Document new use of $TMPDIR. * 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. * modules/m4.c (m4exit): Fix typo. Ensure desired exit status in case closing a module exits. * modules/m4.c (m4exit): Merge from branch. * m4/m4.c (m4_delete): Avoid assertion triggered by last patch. 2006-10-05 Eric Blake * ltdl/m4/gnulib-cache.m4: Augment with gnulib-tool --import closeout. * Makefile.am (m4_libm4_la_DEPENDENCIES): Add missing dependency. * src/main.c (main): Close stdout on exit. * m4/debug.c (set_debug_file): Check for write failure. * m4/m4.c (m4_delete): Don't mask write failure. * tests/testsuite.at (AT_CHECK_M4): Allow tracing by expanding macros before calling AT_CHECK. (M4_ONE_MEG_DEFN): New helper macro. * tests/others.at (stdout full): New test. (stderr closed, stdin closed, stdout closed): Augment. * tests/builtins.at (syscmd): New test. (esyscmd): Augment. 2006-10-04 Eric Blake * tests/builtins.at: Alphabetize tests. * tests/testsuite.at (AT_CHECK_M4): Allow choosing stdin. * tests/generate.awk (new_test): Fix underquoting. * tests/others.at (maketemp): Rename from misc. (stdin closed, stdout closed, stderr closed): New tests. 2006-10-03 Eric Blake 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_diversions, m4_shipout_text, m4_make_diversion) (m4_insert_diversion): Likewise. * m4/input.c (file_clean, m4_push_file): Likewise. * src/freeze.c (reload_frozen_state): Likewise. * src/main.c (main, usage): Likewise. 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. 2006-09-29 Eric Blake 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. * modules/m4.c (dnl): Include macro name in warning message. * m4/input.c (m4_skip_line): Add parameter. * m4/m4module.h (m4_skip_line): Likewise. * src/main.c (usage): Update wording. * doc/m4.texinfo (Inhibiting Invocation): Add xfailed test until issue of blind macros vs. POSIX is resolved. (Dnl): Merge another node from branch. * ltdl/m4/gnulib-cache.m4: Augment with gnulib-tool --import xstrtol. * m4/system_.h (N_): Define. * src/main.c (main): Validate numeric arguments. (size_opt): New function, idea borrowed from coreutils. * m4/macro.c (expand_macro): -L0 implies no limit. * doc/m4.texinfo (Invoking m4): Document this change. * NEWS: Likewise. * tests/options.at: (--arglength, --nesting-limit) (--regexp-syntax): New tests of argument validation. 2006-09-28 Eric Blake * tests/options.at: Alphabetize the tests. 2006-09-27 Eric Blake * m4/m4module.h (m4_symbol_value_print, m4_symbol_print): Add another parameter to print module info. * m4/macro.c (trace_pre): Adjust caller. * modules/m4.c (M4BUILTIN_HANDLER): Likewise. * doc/m4.texinfo (Dumpdef, Debug Levels): Document this. * NEWS: Document this. * ltdl/m4/gnulib-cache.m4: Augment with gnulib-tool --import strnlen. * m4/symtab.c (symbol_value_print): Rename to... (m4_symbol_value_print): ...this, and... (m4_symbol_print): Update to allow -L length truncation. Now truncation also affects dumpdef output and builtin names. * m4/m4private.h (nesting_limit, max_debug_argument_length): Switch to size_t. * m4/m4module.h (m4_symbol_print): Add parameter. (m4_symbol_value_print): New function. * modules/m4.c (dumpdef): Allow length truncation. * m4/macro.c (trace_pre): Use m4_symbol_print, rather than repeating code. * doc/m4.texinfo (Invoking m4): Document -l better. (Dumpdef, Debug Levels): Document the effect of -l. * NEWS: Document this change. * 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. 2006-09-26 Eric Blake * m4/m4module.h (m4_symbol_print): New prototype. (M4_DEBUG_TRACE_STACK): New enumerator. (m4_is_debug_bit): Allow use without requiring m4private.h. * m4/symtab.c (symbol_value_print, m4_symbol_print): New functions. * modules/m4.c (dump_symbol_CB, m4_dump_symbols): Speed up callback. (dumpdef): Allow printing pushdef'd stacks. * m4/debug.c (m4_debug_decode): Add new 's' debug mode. * src/main.c (usage): Document it. * doc/m4.texinfo (Dumpdef, Debug Levels): Likewise. * NEWS: Likewise. * configure.ac (AC_CONFIG_HEADERS): Place 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.c: Likewise. * modules/m4.c: Likewise. * modules/modtest.c: Likewise. * modules/mpeval.c: Likewise. * modules/perl.c: Likewise. * modules/shadow.c: Likewise. * modules/stdlib.c: Likewise. * modules/time.c: Likewise. * modules/traditional.c: Likewise. 2006-09-21 Eric Blake * doc/m4.texinfo (Invoking m4): Add clarification on option processing behavior. * tests/options.at (option grouping): Test this. * THANKS: Update. Reported by Mikhail Teterin. * bootstrap: Add --force option, based on idea from coreutils. * README: Document that ./bootstrap and autoreconf are for developers, and not lightly done in tarballs. 2006-09-20 Eric Blake * src/main.c (usage, OPTSTRING, main): Rename -e to -i. Make warnings consistent. (long_options, HASHSIZE_OPTION): Warn on -H. * doc/m4.texinfo (Invoking m4): Document this. * tests/options.at (deprecated options): Update. Change the default of interactive sessions to match sh. * src/main.c (usage): Document this. (enum interactive_choice): New enum. (main): Use it to defer decision of interactive until after argument processing. * doc/m4.texinfo (Invoking m4): Document this. * NEWS: Likewise, plus add missing mention of -b. Reported by Stepan Kasal. 2006-09-19 Eric Blake * src/main.c (usage, main, DEBUGFILE_OPTION): Deprecate -o as well as --error-output; the goal is to add -o/--output in some future version with semantics like gcc or autom4te. * doc/m4.texinfo (Invoking m4, Dumpdef, Debug Output, Errprint): (Extensions): Reflect this update. (Renamesyms): Add another test. (Defn): Xfail for now, so that `make check' is happy. * NEWS: Document this change. * tests/generate.awk: Mark dynamic loading tests as such. Allow xfailing tests. * tests/macros.at (Renamesyms collisions): New test, exposing renamesyms' coredump. * tests/options.at (--debugfile, --safer): Update to match change. * m4/debug.c (set_debug_file): Fix regression in -o when stdout and stderr are same file, introduced 2003-07-23. * tests/options.at (--debugfile): New test, to catch the bug. (deprecated options): Test --error-output. * src/main.c (usage, main, long_options, ERROR_OUTPUT_OPTION): Deprecate --error-output, and replace it with --debugfile. * doc/m4.texinfo (Invoking m4, Debug Output, Dumpdef, Errprint): Document this change. * NEWS: Likewise. 2006-09-18 Eric Blake * 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. * modules/m4.c (traceon, traceoff): Change to Solaris semantics, such that without arguments, the global trace flag is changed rather than walking the table of all currently-defined macros. (set_trace_CB): No longer needed. * m4/m4module.h (m4_set_symbol_name_traced): Add a parameter. (m4_set_symbol_traced): Delete. (m4_symtab_create): Nuke the nuke parameter. * m4/m4private.h (m4_get_symbol_value): Delete. * m4/symtab.c (m4_symbol_popdef): No more need for nuke_trace. (m4_set_symbol_name_traced): Free undefined entries that are no longer traced. (symbol_destroy_CB): Update caller. * m4/m4.c (m4_create): Update caller. * src/main.c (main): Likewise. (usage): Fix typo in last commit. * doc/m4.texinfo: Minor cleanups throughout. (Debugging, Dumpdef, Trace, Debug Levels, Debug Output): Merge more nodes from branch. (Trace): Document new semantics, and how to simulate the old. * tests/builtins.at (multiquotes): Adjust to new semantics. * NEWS: Update somewhat. 2006-09-14 Eric Blake 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. 2006-09-13 Eric Blake * tests/modules.at (AT_CHECK_M4_MODTEST): Use AT_CHECK_M4, for stderr filtering. Reported by Ralf Wildenhues. Fix installcheck. * Makefile.am (check_LTLIBRARIES): Build test libraries in the tests directory, so we can be sure an installed build is not picking up uninstalled non-test libraries. (check-local, installcheck-local): Depend on test libraries. * tests/modules.at (AT_CHECK_M4_MODTEST): Don't use options after file name. Fix quoting. Remove skipping the test, now that makefile guarantees test modules will exist. (Freezing modules, modules: shadow, modules: unload) (modules: trace): Always put test modules in module path. (modules: importing): Likewise, and rely on AT_CHECK_M4 for stderr munging. * src/main.c (usage): Document default module search path. (import_environment, frozen_file_to_read, frozen_file_to_write): Move... (main): ...here. * tests/testsuite.at (AT_CHECK_M4): Filter stderr here... * tests/m4.in: ...not here. Reported by Ralf Wildenhues. 2006-09-08 Eric Blake * bootstrap: Kill unrelated copy-n-paste code from argument parsing. Let Makefile generate testsuite. * Makefile.am (EXTRA_DIST): Remove examples/WWW/man/Makefile. 2006-09-07 Eric Blake * m4/m4module.h (m4_peek_input): No longer export. (m4_error_at_line, m4_warn_at_line): New prototypes. (m4_is_symbol_void): New macro. (m4_push_file): Update prototype. * m4/m4private.h (m4__peek_token): New prototype. (M4_TOKEN_OPEN, M4_TOKEN_COMMA, M4_TOKEN_CLOSE): New enumerators. * m4/utility.c (m4_error_at_line, m4_warn_at_line): New functions. * src/main.c (main): Allow reading from stdin twice. * modules/m4.c (include): Adjust to new prototype. * m4/input.c: General comment cleanup. (file_peek, file_read, file_unget, push_file): Set end flag on EOF, so that we don't call getc twice. (push_file, file_clean): Port fix from branch to avoid closing stdin prematurely. (pop_input): Port fix from branch to avoid reading free'd memory when input ends mid-string. (m4_pop_wrapup): Port fix from branch to allow multiple m4wraps. (string_peek, string_read): Always use unsigned char. (m4_skip_line): Warn when dnl cut short by EOF. (peek_input): Rename from m4_peek_input. (match_input): Update signature, to distinguish between `(' token and multi-char quote or comment beginning with `('. (m4_input_exit): Cleanup now done in m4_pop_wrapup. (m4__peek_token): New function, ported from branch. (m4__next_token): Update to new token types. * m4/macro.c (expand_token, expand_argument): Use peek_token. * doc/m4.texinfo (Pseudo Arguments, Defn, Answers): Fix typos. (Invoking m4): Remerge from branch. * Makefile.am ($(TESTSUITE)): Revert patch from 2006-09-05... (check-local): and put dependency here. Reported by Ralf Wildenhues. 2006-09-05 Eric Blake * m4/m4module.h (m4_debug_message): New prototype. (M4_DEBUG_TRACE_MODULE): New debug bit. * m4/m4private.h (M4_DEBUG_MESSAGE, M4_DEBUG_MESSAGE1) (M4_DEBUG_MESSAGE2): Delete these macros. * m4/debug.c (m4_debug_message): New method. (m4_debug_decode): Add module tracing as flag `m'. * m4/input.c (m4_push_file, file_clean): Use new method. * m4/path.c (m4_path_search): Likewise. * po/Makevars (XGETTEXT_OPTIONS): Likewise. * m4/module.c (install_builtin_table, install_macro_table) (m4__module_open, module_close, module_remove): Promote several module debug messages outside of DEBUG_MODULES. (m4__module_init, module_remove) [DEBUG_MODULES]: Don't mix DEBUG_MODULES with normal trace output. * src/main.c (usage): Document new flag. * doc/m4.texinfo (Debug Levels): Likewise. * Makefile.am ($(TESTSUITE)): Add missing dependency. * tests/m4.in: Neutralize platform-dependent module filenames. * tests/options.at (--debug): Update expected output. 2006-09-05 Ralf Wildenhues * doc/m4.texinfo: Fix some typos. * tests/others.at: Likewise. 2006-09-05 Eric Blake * m4/input.c (lex_debug): Remove dead code that broke compilation with --enable-debug. * m4/module.c (install_builtin_table, install_macro_table) (m4__module_init, m4__module_open, module_close) (module_remove): Fix compilation when --enable-debug. * m4/output.c (m4_shipout_text): Likewise. * ltdl/m4/debug.m4 (M4_CHECK_DEBUGGING): Preload all static libraries when --enable-debug. * configure.ac (DYNAMIC_MODULES): New variable, to pass information to testsuite. (modules to preload): Determine modules after we know whether shared libraries are supported. * tests/atlocal.in (DYNAMIC_MODULES): Substitute this into testsuite. * tests/testsuite.at (AT_CHECK_DYNAMIC_MODULE): New macro. * tests/modules.at (Freezing modules, AT_CHECK_M4_MODTEST) (modules: shadow, modules: unload, modules: importing) (modules: trace): Use new macro. * tests/builtins.at (gmp): Likewise. * 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 NDEBUG. Handle pending expansions. * modules/gnu.c (indir): Update to new prototype. * doc/m4.texinfo: Fix menus to be consistent with section names. (Defn): Add test that macro tokens flatten to empty string; triggered an assert before this patch. (Ifelse): Merge another node. (Loops): Split into... (Forloop, Foreach): New nodes; work is still underway on them. (Answers): Add more info on foreach macro; work is still underway. (Indir): Add test that indir collects arguments before looking up macro. * TODO: Update based on this patch. 2006-09-01 Eric Blake * m4/m4.c (m4_create): Fix latent bug since 2003-10-08. * m4/hash.h (m4_free_hash_iterator): New prototype. * m4/hash.c (struct m4_hash) [!NDEBUG]: Add iter member, to ensure we don't do unsafe things while iterating. (HASH_ITER, ITER_CHAIN): New accessor macros. (m4_hash_new, m4_hash_resize, maybe_grow): Fix malloc typing bug. (m4_hash_delete, m4_hash_insert): Unsafe while iterating. (m4_hash_remove) [!NDEBUG]: Enforce safety while iterating. (m4_get_hash_iterator_next) [!NDEBUG]: Track current iterators, to catch unsafe actions. (m4_free_hash_iterator): New function, to avoid memory leaks, and when debugging, to track safe actions. (m4_hash_apply): Avoid memory leak. * m4/symtab.c (m4_symtab_apply): Likewise. * ltdl/m4/gnulib-cache.m4: Remove getopt from here; it is pulled in manually to src/ for now. * tests/builtins.at (gmp): Add keyword module. * tests/modules.at (Freezing modules, modules: shadow) (modules: unload, modules: importing, modules: trace): Likewise. 2006-08-30 Eric Blake * 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_MODTEST): Likewise. * doc/m4.texinfo (Undefine, Defn, Pushdef): More doc merges from the branch. (Defn): Add failing test case for mixing text and builtin. (Renamesyms): Improve wording, and identify core dump that needs fixing. 2006-08-29 Eric Blake * doc/m4.texinfo (Quoting Arguments, Definitions, Define) (Arguments, Pseudo Arguments): More doc merges from the branch. (Macro expansion): Turn example into test. (Pseudo Arguments): Add example of avoiding argument. * modules/m4.c (undefine, popdef): Accept multiple arguments. (define, pushdef): Warn on non-text macro name. (ifelse, m4_dump_symbols, defn, traceon, traceoff): Tweak warning/error messages. (ifdef): Ignore extra arguments. * m4/symtab.c (m4_symbol_value_copy): Avoid memory leak. (m4__symtab_remove_module_references): Check that there is no leak. * tests/macros.at (pushdef/popdef): Update to new message. * tests/builtins.at (define): Likewise. * tests/freeze.at (loading format 1): Likewise. * tests/modules.at (AT_CHECK_M4_MODTEST): Likewise. * m4/m4private.h (m4_get_syntax_lquote, m4_get_syntax_rquote) (m4_get_syntax_bcomm, m4_get_syntax_ecomm) [NDEBUG]: Use same type as accessor function, to avoid compiler warning. * m4/module.c (m4__module_open): Move declaration of variable to avoid compiler warning. * src/main.c (main): Avoid shadowing a global variable. * src/freeze.c (produce_symbol_dump): Avoid unused variable warning when NDEBUG. * tests/options.at (--discard-comments, --import-environment) (--debug, --prepend-include, --help and --version): Rename tests to name option tested. 2006-08-28 Eric Blake * 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. 2006-08-25 Eric Blake * 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_functions): Likewise. * modules/perl.c (builtin_functions): Likewise. * modules/shadow.c (builtin_functions): Likewise. * modules/stdlib.c (builtin_functions): Likewise. * modules/time.c (builtin_functions, mktime_functions) (strftime_functions): Likewise. * doc/m4.texinfo (Loops): Update test now that shift is blind. (Macro Arguments): Fix typo in test. (Patsubst): Fix typo in test. * modules/gnu.c (m4_regexp_substitute): Don't skip empty match at end of string. Fix return value when ignore_duplicates. * tests/builtins.at (patsubst): Fix typo in test. * tests/options.at (debug-flags): Update to reflect new message. (deprecated options, prepend-include, help and version): New tests. * tests/testsuite.at (AT_CHECK_M4): Avoid hanging testsuite if test omits an input file name. * src/main.c (long_options, main): Add -B/--prepend-include. (usage): Document it. (main): `m4 --help --version' now displays help, not version. * ltdl/m4/gnulib-cache.m4: Augment with gnulib-tool --import dirname filenamecat. * m4/m4module.h (m4_add_include_directory): Add parameter. * m4/m4private.h (m4__include_init): New prototype. * m4/m4.c (m4_create): Put `.' on path before options are collected. * m4/path.c (includes): Assume C89. Use gnulib for file name management. (m4__include_init): New function. (search_path_add): Allow prepending. (m4_add_include_directory, search_path_env_init): Adjust callers. (m4_path_search): Relative names now invoke path search, since `.' might not be first. * doc/m4.texinfo (Invoking m4, Search Path): Document new option. 2006-08-25 Bruno Haible (tiny change) and Eric Blake * bootstrap: Run autopoint before gnulib-tool, since autopoint 0.15 installs macros obsoleted by current gnulib. 2006-08-25 Eric Blake * doc/m4.texinfo (Macro Arguments): Another section merged; testsuite failures now exposed. 2006-08-23 Eric Blake * doc/m4.texinfo (Quoted strings, Other tokens, Comments) (Input processing): More doc merges from the branch. (Regular expression syntax): Add introductory text. (Inhibiting Invocation): More doc merges from the branch. (Other tokens): Reorder after comments. * tests/generate.awk: Allow passing options to doc examples. 2006-08-22 Eric Blake * tests/options.at (debug-flags): New test. * m4/m4module.h (M4_DEBUG_TRACE_VERBOSE): Make sure this value is not negative, to distinguish failure in m4_debug_decode. (m4_debug_decode): Add new parameter. * modules/gnu.c (regexp): Slight cleanup. (renamesyms): Ignore excess arguments. (syncoutput): Make case-insensitive, warn on bad argument. (debugmode): Factor -+ handling out to... * m4/debug.c (m4_debug_decode): ...here. (m4_debug_message_prefix): Fix spacing. * src/main.c (main): Let -d option adjust flags. * m4/input.c (file_clean): Avoid printing empty file name. * doc/m4.texinfo (Syncoutput): Document new range of input. (Invoking m4): Document use of multiple -d flags. Start porting various fixes from the branch that use gnulib. * ltdl/m4/gnulib-cache.m4: Augment with gnulib-tool --import binary-io cloexec close-stream fopen-safer getopt gnupload mkstemp regexprops-generic stdlib-safer unlocked-io. * m4/debug.c (m4_debug_set_output): Close debug file on exec. * m4/path.c (m4_path_search): Close input file on exec, reject empty file name, fix parameter naming. * m4/output.c (make_room_for): Close diversion file on exec. (includes): Assume C89 headers. (tmpfile): For now, we don't want tmpfile-safer, because we want clean-temp later. * m4/m4private.h (includes): Use various gnulib headers. * doc/regexprops-generic.texi: Use gnulib's copy. * configure.ac (AM_INIT_AUTOMAKE): Bump automake requirement. * AUTHORS: Add copyright. * ChangeLog: Likewise. * README: Likewise. Require automake 1.9b or later. * HACKING: New file. * README-alpha: Add copyright. * THANKS: Likewise. Update. * doc/STYLE: Add copyright, and tweak for changed directories. * modules/README: Add copyright, and tweak for libtool version. * examples/COPYING: New file. * examples/WWW/COPYING: Likewise. * examples/WWW/m4lib/COPYING: Likewise. * modules/shadow.m4: Add copyright. * modules/perl.m4: Likewise. * modules/modtest.m4: Likewise. * modules/stdlib.m4: Likewise. * modules/time.m4: Likewise. * modules/time2.m4: Likewise. * po/Makevars: Likewise. * tests/iso8859.m4: Likewise. * tests/m4.in: Likewise. * NEWS: Add (C) to copyright. * TODO: Likewise. * m4/system_.h: Likewise. * tests/atlocal.in: Likewise. * tests/builtins.at: Likewise. * tests/freeze.at: Likewise. * tests/generate.awk: Likewise. * tests/macros.at: Likewise. * tests/modules.at: Likewise. * tests/options.at: Likewise. * tests/others.at: Likewise. * tests/testsuite.at: Likewise. * m4/utility.c: Spell out copyright years. * src/main.c: Likewise. * doc/m4.texinfo (Bugs, Manual, Syntax): Sync from branch. 2006-08-21 Eric Blake * configure.ac (AC_CHECK_HEADERS_ONCE): Check for . * modules/gnu.c (esyscmd): Use -1 for failure. Set sysval to 0 when no arguments are given, but without losing warning about 0 arguments. * modules/m4.c (syscmd): Likewise. (includes): Assume C89. (m4_sysval): Make static. (M4_SYSVAL_EXITBITS, M4_SYSVAL_TERMSIGBITS): New macros. (sysval): Port calculation from branch. 2006-08-20 Eric Blake * m4/macro.c (expand_macro): Move argument check... (m4_macro_call): ...to here, so indir will warn. * modules/gnu.c (__program__): New macro, ported from branch. (builtin): Perform argument check. (changesyntax): Avoid out-of-bounds read. * modules/gnu.c (includes): Assume stdlib.h, errno. (m4_regexp_compile): Add no_sub parameter, avoid memory leaks. (substitute): Add caller parameter, avoid out-of-bounds memory references. (m4_regexp_substitute, patsubst, regexp, renamesyms): Adjust callers. 2006-08-16 Eric Blake * po/POTFILES.in: Add more files that contain translatable strings. * po/Makevars (XGETTEXT_OPTIONS): Add options to pass more information to translators. (USE_MSGCTXT): New var for gettext 0.15. * m4/input.c (file_clean, m4_push_file, m4__next_token): Start debug/trace messages in lower case. * m4/macro.c (expand_argument): Likewise. * m4/path.c (m4_path_search): Likewise. * src/main.c (main): Likewise. 2006-08-14 Eric Blake * src/main.c (usage): Document --import-environment. * doc/m4.texinfo (History, Invoking m4): Synchronize from branch. 2006-08-11 Eric Blake * bootstrap (func_get_translations): Only remove files when doing full update. (func_update_po): Avoid CDPATH problems. 2006-08-10 Eric Blake * bootstrap (func_get_translations): New function. (func_update_po): Borrow ideas from tar to correctly pull in translations from newer location. 2006-08-09 Eric Blake * bootstrap: Recent gnulib no longer has jm_* macros to worry about. * ltdl/m4/gnulib-cache.m4: Augment with gnulib-tool --import verror. * m4/m4module.h (M4ERROR, M4WARN): Delete, replaced by... (m4_error, m4_warn): ... these new prototypes. (m4_current_file, m4_current_line): Move into context, rather than leaving as globals. (m4_insert_file, m4_insert_diversion, m4_freeze_diversions) (m4_undivert_all, m4_input_init): Now takes context. * m4/utility.c (m4_error, m4_warn): New functions. * m4/m4private.h: Assume errno exists. (struct m4): Move warning_status to a bit flag, and add exit_status. Adjust accessors accordingly. * src/main.c (print_program_name_CB): No longer needed. (main): Use new m4_get_fatal_warnings_opt. * m4/debug.c: Adjust all callers of M4WARN and M4ERROR, and abort instead of issuing "INTERNAL ERROR". Pass context when needed, and use new accessors. * m4/input.c: Likewise. * m4/macro.c: Likewise. * m4/output.c: Likewise. * m4/utility.c: Likewise. * modules/evalparse.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. * tests/macros.at: Adjust to new message format. * tests/builtins.at: Likewise. * tests/freeze.at: Likewise. * tests/modules.at: Likewise. * doc/m4.texinfo: Likewise. * configure.ac (AM_GNU_GETTEXT, AM_GNU_GETTEXT_VERSION): Require newer gettext 0.15. 2006-08-03 Eric Blake * src/stackovf.c (setup_stackovf_trap): Port patch from branch to gracefully handle ENOSYS. * TODO: Update. * THANKS: Update. 2006-07-28 Eric Blake * src/freeze.c (reload_frozen_state): Copy string when creating placeholder, to avoid memory corruption. * m4/symtab.c (symbol_popval): Avoid memory leak. (m4_symbol_rename): Avoid shadowing rename function. (dump_symbol_CB, symtab_dump) [DEBUG_SYM]: Fix compilation. * tests/freeze.at (reloading unknown builtin): Add test. * tests/generate.awk: Capture m4.texinfo line number in testsuite.log, not just generated.at. Port idea from branch that a frozen file can request an unknown builtin without producing a warning unless the builtin is actually used. * m4/m4private.h (m4__symbol_type): Add M4_SYMBOL_PLACEHOLDER. (m4_is_symbol_value_placeholder, m4_get_symbol_value_placeholder) (m4_set_symbol_value_placeholder): New accessors. * m4/m4module.h (m4_is_symbol_placeholder), (m4_get_symbol_value_placeholder), (m4_set_symbol_value_placeholder), (m4_get_symbol_placeholder): Likewise. * m4/symtab.c (m4_is_symbol_value_placeholder), (m4_get_symbol_value_placeholder), (m4_set_symbol_value_placeholder): Likewise. (dump_symbol_CB): Handle new symbol type. * m4/macro.c (trace_pre): Likewise. (m4_macro_call): Warn when invoking a placeholder. * modules/m4.c (dumpdef): Handle dumping a placeholder. (defn): Warn when referencing a placeholder. * src/freeze.c (dump_symbol_CB): Ignore placeholder when freezing. (reload_frozen_state): When reloading unknown builtin, install a placeholder instead of warning. * tests/freeze.at (loading format 1): Allow warning when popdef'ing undefined function. 2006-07-27 Paul Eggert (tiny change) * m4/hash.c (m4_hash_string_hash): Don't case-fold in the hash function. Shift by 7, not 3, for consistency with gnulib/lib/hash.c. Don't assume hash word is 32 bits. 2006-07-27 Eric Blake * src/main.c (usage): Update to match branch. (main): Update --version info to distinguish between program name `m4' and package name `GNU M4'. (AUTHORS): Translate René Seindal's name. * configure.ac (TIMESTAMP): Remove now-redundant parentheses. * Makefile.am (doc/m4.1): Update to match branch. * m4/m4.c (DEFAULT_NESTING_LIMIT): Raise to 1024, to match branch. * m4/system_.h (EXIT_MISMATCH): Define. * src/main.c (main): Don't clear syntax table for version 1. (usage): Document exit status. * src/freeze.c (reload_frozen_state): Port GET_DIRECTIVE from the branch, and require V directive to appear first in file. Fix broken logic for detecting F and T in version 1 files. 2006-07-22 Eric Blake * src/main.c (stackovf_handler): Document the problems in our overflow handler. * src/stackovf.c: Forward port changes in branch to use POSIX sa_sigaction when available. (process_sigsegv): Avoid buffer overrun when error string is translated, although the fact that we translate in a signal handler is still a bug. * ltdl/m4/stackovf.m4 (M4_SYS_STACKOVF): Forward port changes from branch to modernize checks. * modules/format.c (format): Avoid compiler warning that str may be used uninitialized. * m4/m4private.h (DEBUG_MODULES, DEBUG_STKOVF) [DEBUG]: Fix spelling. (DEBUG_SYNTAX) [DEBUG]: Turn on more debug. (DEBUG_MACRO): Remove unused macro. * src/stackovf.c: Avoid compiler warnings. * m4/input.c: Likewise. * m4/module.c: Likewise. * m4/output.c: Likewise. * m4/path.c: Likewise. * m4/symtab.c: Likewise. * m4/syntax.c: Likewise. 2006-07-20 Eric Blake * ltdl/m4/gnulib-cache.m4: gnulib-tool has changed again. Regenerate to explicitly ask for --assume-autoconf=2.60. 2006-07-19 Eric Blake * po/ChangeLog: Merge into main ChangeLog, then delete file. * THANKS: Update. * doc/m4.texinfo (copying): Relax restriction on front-cover and back-cover texts. 2006-07-17 Eric Blake * configure.ac (AM_GNU_GETTEXT_VERSION): Bump requirement to 0.14.5. * ltdl/m4/gnulib-cache.m4: Augment with `gnulib-tool --import xvasprintf'. * modules/format.c (includes): Use xvasprintf.h. (format): Make static. Avoid buffer overflow, that can lead to arbitrary code execution exploit. Only pass unsigned char to is*(). Support F, g, and G specifiers. * doc/m4.texinfo (Format): Expose buffer overrun bug. Document new specifiers. 2006-07-17 Gary V. Vaughan Ensure M4 compiles correctly with -DDEBUG, and use a single consistent definition of various /DEBUG_[A-Z]+/ symbols: * m4/input.c: Have commented out out DEBUG_INPUT only by default. (m4_print_token): Use m4_get_symbol_value_text and m4_get_symbol_value_func calls instead of obsolescent VALUE_TEXT and VALUE_FUNC respectively. (m4__next_token): Use m4_print_token call instead of obsolescent print_token symbol. * m4/module.c: Have commented out out DEBUG_MODULE only by default. * m4/output.c: Similarly for DEBUG_OUTPUT. * m4/path.c: Similarly for DEBUG_INCL. * m4/symtax.c: Similarly for DEBUG_SYM. * m4/syntax.c: Similarly for DEBUG_SYNTAX. * src/stackovf.c: Similarly for DEBUG_STACKOVF. * m4/m4private.h (DEBUG): Add DEBUG_OUTPUT and DEBUG_STACKOVF to preprocessor macros defined with -DDEBUG compiles. 2006-07-17 Gary V. Vaughan (tiny change) * bootstrap: Correct typo in --download-po argument parsing. 2006-07-15 Eric Blake * ltdl/m4/gnulib-cache.m4: Augment with `gnulib-tool --import gendocs fdl'. * tests/generate.awk (normalize): Recognize @tabchar. * doc/m4.texinfo (Top): Start merging from branch. Remove tabs. Fix menus. Upgrade FDL license from 1.1 to 1.2. Fix overfull hboxes. (Index macro, Shell commands, Incompatiblities): Rename nodes from Index, UNIX commands, Other incompat. (Platform macros, Using frozen files, Frozen file format 1) (Frozen file format 2, Copying This Manual, Indices): New nodes. * Makefile.am (EXTRA_DIST): Distribute gendocs. (MAINTAINERCLEANFILES): Clean up files from gnulib. (doc_m4_TEXINFOS): Depend on fdl.texi. (web-manual): New maintainer target. 2006-07-14 Gary V. Vaughan * doc/m4.texinfo (Modules): RMS asked me for an explanation of the modular architecture of M4. The result is paraphrased here for the benefit of future readers of the manual. 2006-07-14 Gary V. Vaughan (tiny change) * Makefile.am (TESTSUITE_AT): Add missing tests/freeze.at. 2006-07-14 Eric Blake * src/main.c (main): Avoid compiler warning. * modules/gnu.c (renamesyms): Remove unused variable. 2006-07-14 Gary V. Vaughan * m4/m4module.h (m4_regexp_syntax_decode, m4_regexp_syntax_encode) (m4_get_regexp_syntax_opt, m4_set_regexp_syntax_opt): Declare new functions for managing regexp syntax options. * m4/m4private.h (m4): Add regexp_syntax field. * m4/resyntax.c: New file implements the above. * Makefile.am (m4_libm4_la_SOURCES): Add m4/resyntax.c. * modules/gnu.c (RE_SYNTAX_BRE, RE_SYNTAX_ERE, builtin_eregexp) (builtin_epatsubst, builtin_erenamsyms, m4_regexp_do) (m4_patsubst_do, m4_renamesyms_do): Removed. (builtin_changeresyntax): New builtin to change regular expression syntax. (m4_resyntax_encode_safe): Factor out diagnostics code. * src/freeze.c (produce_resyntax_dump): New function to dump default regexp syntax specifier to frozen file. (reload_frozen_state): Updated to action 'R' directive. * src/main.c (usage): Describe new -r option. (long_options, OPTSTRING): Declare it. (main): Encode and store cli regexp syntax option argument. * tests/freeze.at (regexp syntax): New test that regexp syntax survives freezing. * tests/generate.awk (m4_pattern_allow): Updated for renamesyms. * doc/m4.texinfo (Erenamesyms and Renamesyms, Eregexp and Regexp) (Epatsubst and Patsubst): Renamed to... (Renamesyms, Regexp, Patsubst): ...these respectively. Updated documentation and added new examples. (Changeresyntax): New section describing changeresyntax builtin, and regexp syntax names. (Regular expression syntax): New section describing differences between various regular expression syntaxes. (Frozen files): Document 'R' directive. * NEWS: Updated. 2006-07-13 Gary V. Vaughan * bootstrap: Enhanced to work more like our other scripts: Add a copyright statement; support --version and --help; accept a --download-po option with argument as a substitute for DOWNLOAD_PO in the environment. 2006-07-11 Eric Blake * Makefile.am (doc/m4.1): Port patch from branch that avoids intermediate file. * ltdl/m4/gnulib-cache.m4: Regenerate since upstream gnulib-tool changed. 2006-07-10 Gary V. Vaughan (tiny change) * tests/builtin.at (patsubst, regexp): Adjust these tests, now that `\0' is no longer accepted. * src/main.c (usage): Alphabetize options within their sections. * modules/gnu.c (m4_regexp_search, regsub, substitute) (esyscmd): Improve comments. * modules/gnu.c (substitute): Remove old warning for \0. (substitute_warned): No longer required. Removed. * modules/gnu.c: Put macro definitions into alphabetical order. 2006-07-07 Eric Blake * tests/freeze.at (loading format 1): New file, with new test. * tests/testsuite.at: Include it. * tests/macros.at (Arity, defn, and freeze): Add frozen keyword. * tests/modules.at (Freezing modules): Likewise. * configure.ac (AC_PREREQ): Autoconf 2.60 is now out. (AC_CHECK_HEADERS): Assume signal.h. (AC_CHECK_HEADERS_ONCE): Use new feature to shrink configure. (AC_CHECK_FUNCS_ONCE): Likewise. * src/m4.h (includes): Assume signal.h. 2006-07-05 Eric Blake Fix all testsuite failures on cygwin. * doc/m4.texinfo (Syscmd, Esyscmd): Forward-port updates from branch-1_4. Solves testsuite failure when uninstalled m4 is shadowed by redefinition of PATH in libtool wrapper. * Makefile.am (module_ldflags): Don't forget AM_LDFLAGS, which contains the -no-undefined required by cygwin. (TESTS_ENVIRONMENT): Export abs_top_builddir. * tests/others.at (misc): Port to platforms where /etc/passwd does not exist or does not contain user named root. * tests/modules.at (AT_CHECK_M4_MODTEST): Look in correct directory. * tests/builtins.at (define, divert): Avoid overquoting. * tests/generate.awk (new_group): Likewise. 2006-07-05 Gary V. Vaughan The regs_allocated field in a struct re_pattern_buffer refers to the state of a particular re_registers struct when used in successive matches using the same compiled pattern. Avoid a SEGV in `renamesyms' resulting from using a new re_registers with an existing re_pattern_buffer: * modules/gnu.c (m4_pattern_buffer): Wrapper struct for associated pattern buffer and registers. (m4_regexp_search): New function to call re_regexp_search with correctly matched pattern buffer and register instantiations. (m4_regexp_compile): Return an m4_pattern_buffer. Adust all callers. 2006-07-04 Gary V. Vaughan * ltdl/m4/m4-getopt.m4 (M4_GETOPT): Update to take into account changes to gnulib getopt.m4 since last build. * Makefile.am (src_m4_SOURCES): Only compile shipped getopt module if the system getopt fails M4_GETOPT tests. 2006-06-22 Eric Blake * Makefile.am (EXTRA_DIST): Distribute gnulib-cache.m4. Reported by Bruno Haible. 2006-06-22 Ralf Wildenhues * m4/module.c (m4__module_exit): Avoid ltdl memory leak. 2006-06-19 Eric Blake * THANKS: Update. 2006-06-19 Ralf Wildenhues * Makefile.am (src_m4_DEPENDENCIES): Make dependency explicit. (clean-local): Split into and depend upon... (clean-local-tests, clean-local-src): ...these two. The latter removes the libtool object directory below `src', to work around a buglet in Automake, failing to list it. (EXTRA_DIST): Distribute modules/perl.c. 2006-06-19 Eric Blake * Makefile.am ($(srcdir)/doc/m4.1): No need to list $(srcdir) in right side of dependency; VPATH does that. (stamp-vcl): Update to use libtool's algorithm. (EXTRA_DIST): Distribute stamp-vcl. Reported by Ralf Wildenhues. (TESTSUITE): Revert earlier change that used absolute path, as that broke 'make dist' in VPATH. Stick with $(srcdir) instead. (EXTRA_DIST): Revert earlier change of $(TESTSUITE). (TESTS_ENVIRONMENT) [USE_GMP]: Revert earlier addition, since atlocal takes care of it instead. (check-local, installcheck-local, clean-local): Inline absolute path to testsuite here, rather than relative path to testsuite elsewhere. 2006-06-19 Ralf Wildenhues * m4/m4private.h (DELETE): Cast away const here... * src/stackovf.c (stackovf_exit): ...to avoid cast-as-lvalue here. * src/freeze.c (reload_frozen_state): Avoid uninitialized variable warning. 2006-06-19 Eric Blake * Makefile.am (doc/m4.1): Build in $(srcdir), to match where .info pages are built. Reported by Ralf Wildenhues. (EXTRA_DIST): Inline definition of testsuite, so that make dist works again. 2006-06-16 Eric Blake Follow recommendations from autoconf manual for autotest. * Makefile.am (TESTSUITE): Factor the $(srcdir) out of uses, and turn it into an absolute path until autotest provides an option that allows us to avoid changing directories. Properly quote throughout. (TESTS_ENVIRONMENT) [USE_GMP]: Inform testsuite about GMP. (check-recursive): Delete unused target. ($(TESTSUITE)): Atomically update testsuite. (CD_TESTDIR): Simplify. (m4__cd): Delete unused macro. (check-local): Let TESTSUITEFLAGS influence the run. (installcheck-local): Let TESTSUITEFLAGS override AUTOTEST_PATH. Add dependencies. (clean-local): Clean up. (DISTCLEANFILES, MAINTAINERCLEANFILES): Add directory location. * README: Document how to use the testsuite. 2006-06-15 Eric Blake * configure.ac (M4_DEFAULT_PRELOAD): Fix typo in last commit. * ltdl/m4/m4-error.m4 (M4_ERROR): Use M4_ instead of m4_ to avoid clashes with m4sugar. * ltdl/m4/m4-getopt.m4 (M4_GETOPT): Likewise. * ltdl/m4/m4-gettext.m4 (M4_GNU_GETTEXT): Likewise. * ltdl/m4/m4-obstack.m4 (M4_OBSTACK): Likewise. * ltdl/m4/m4-regex.m4 (M4_REGEX): Likewise. * ltdl/m4/gmp.m4 (_M4_LIB_GMP): Likewise. * ltdl/m4/stackovf.m4 (M4_SYS_STACKOVF): Likewise. * ltdl/m4/debug.m4 (M4_CHECK_DEBUGGING): Likewise. * configure.ac: Likewise. (M4_DEFAULT_PRELOAD): Use as a macro, not shell variable. * Makefile.am (src_m4_CPPFLAGS): Use STACKOVF as a makefile conditional. * ltdl/m4/m4-gnulib.m4: Delete, no longer needed. Reduce compiler warnings. Inside GMP, mpq_t is an array type, so const mpq_t is not assignable from plain mpq_t. Avoid type-punning warnings caused trying to mix these types. * modules/mpeval.c (numb_ior, numb_eor, numb_and, numb_lshift), (numb_rshift, numb_divide, numb_modulo): Remove const qualifier. * modules/evalparse.c (or_term, xor_term, and_term, shift_term), (mult_term, exp_term): Remove type-punning casts. (numb_pow): Remove const qualifier. * src/freeze.c (reload_frozen_state): Fix typo in messages. Fix variables that can be used uninitialized, which fixes security hole where malicious frozen file can execute arbitrary code. 2006-06-14 Ralf Wildenhues * Makefile.am (modules_mpeval_la_LIBADD): Readd $(LIBADD_GMP). 2006-06-13 Ralf Wildenhues and Eric Blake Allow `make dist' to work again. * Makefile.am (EXTRA_DIST): doc/helptoman.pl is gone. (MAINTAINERCLEANFILES): Avoid redundant mention of dist_man_MANS. (cvs-dist): Fix typo. * NEWS: Match current version number. 2006-06-13 Ralf Wildenhues * Makefile.am (AM_CPPFLAGS): Add $(LTDLINCL), so the right ltdl.h is used. * bootstrap: Do not run libtoolize manually, this is done correctly by autoreconf. Invoke autoreconf with --no-recursive to avoid unnecessary rerunning of autotools for libltdl. 2006-06-13 Eric Blake * THANKS: Update. 2006-06-12 Eric Blake * m4/output.c [HAVE_MKTEMP]: Gnulib provides mkstemp, so don't bother with mktemp. * src/m4.h: Don't declare mktemp. * m4/input.c (m4__next_token): Avoid bzero. * configure.ac (AC_CHECK_FUNCS): Remove obsolete checks. * Makefile.am (doc/m4.1): Depend on installed help2man, rather than distributing outdated helptoman.pl. * doc/helptoman.pl: Delete. 2006-06-10 Eric Blake * README (Patches): Document the current dependence on CVS builds of autotools. * ltdl/m4/gnulib-cache.m4: Update, and use --macro-prefix=M4. * configure.ac: Use consistent quoting throughout. (AC_PREREQ): Bump to 2.59d. (AC_INIT): Package name begins with uppercase. (AC_ARG_WITH): Use AS_HELP_STRING. (AM_INIT_AUTOMAKE): Enable gnits mode. (AC_ISC_POSIX, AM_PROG_CC_STDC, AC_PROG_INSTALL, AC_PROG_MAKE_SET), (AC_PROG_AWK, AM_C_PROTOTYPES, AC_C_CONST, AC_HEADER_STDC), (AC_CHECK_HEADERS, AC_FUNC_ALLOCA, AC_FUNC_VPRINTF): Remove checks done by gnulib or automake, or which autoconf has declared obsolete. * m4/m4private.h (Includes): Assume C89 or better, and use errno unconditionally. * m4/output.c (Includes): Likewise. * modules/gnu.c (Includes): Likewise. * modules/m4.c (Includes): Likewise. * src/m4.h (Includes): Likewise. * README-alpha: Update web address. * README: Likewise. Change encoding to ASCII. Remove old advice about cygwin. Document bootstrapping dependency. * AUTHORS: Update from branch-1_4. * THANKS: Likewise. Change encoding to UTF-8. * BACKLOG: Delete. This file is too old and unmaintained to be worthwhile. * ChangeLog: Change encoding to UTF-8. Avoid compiler warnings. * m4/macro.c (trace_format): Don't mark this as a printf format, since we don't accept the same set of modifiers as printf. It would be nice if gcc let us specify a custom format archetype. * src/main.c (main): Cast away const. 2006-06-10 Andreas Schwab (tiny change) Eric Blake * modules/time.c (ctime): Pass correctly typed variable to m4_numeric_arg. (gmtime): Likewise. (localtime): Likewise. (strftime): Likewise. * m4/utility.c (m4_numeric_arg): For now, document arbitrary limit inherent in this interface. 2006-05-08 Bruno Haible (tiny change) * modules/m4.c (WEXITSTATUS): Provide fallback definition. (sysval): Use WEXITSTATUS. * modules/gnu.c (esyscmd): Set sysval to 0xffff, to accomodate both big-endian and little-endian wait status definitions. 2006-05-06 Eric Blake * po/Makevars (MSGID_BUGS_ADDRESS): Add. * po/POTFILES.in (src/getopt.c, src/version-etc.c): These files live in src, not gnu. 2006-05-06 Eric Blake * configure.ac (LT_CONFIG_LTDL_DIR): Inform libtool which subdirectory to use. (support for -pipe): Move after LT_INIT, since it relies on libtool internals. 2006-05-05 Eric Blake * Makefile.am (doc/m4.1): Use $@, not $(srcdir)/doc/$@. * THANKS: Update. 2006-05-05 Bruno Haible and Eric Blake * configure.ac (gl_SOURCE_BASE, gl_M4_BASE, gl_MODULES): Move to... * ltdl/m4/gnulib-cache.m4: ...this new file, per new gnulib-tool usage pattern. * bootstrap: Update usage of gnulib-tool. 2006-05-04 Eric Blake * Makefile.am (doc/m4.1): Use EXEEXT on built binary. Cleanup whitespace. 2005-12-05 Gary V. Vaughan * bootstrap (func_update_po): Synch with CVS GNU tar. wget 1.9.x and 1.10.x support --cache=off, so $WGETFLAGS are not necessary. Reported by Eric Blake 2005-12-04 Gary V. Vaughan * bootstrap (func_update_po): Test and set $WGETFLAGS to disable http caching as -C is no longer supported by wget 1.10.x. Reported by Eric Blake 2005-10-20 Gary V. Vaughan * m4/module.c (caller_id): To match libtool-2.0 interface, changed to ... (iface_id): ...an lt_dlinterface_id type. (m4__module_find): New abstraction for lt_dlhandle_fetch. Use throughout, instead of calling obsolete lt_dlhandle_find directly. (m4__module_next): Use multiloader-safe lt_dlhandle_iterate. Use throughout, instead of calling obsolete lt_dlhandle_next. * m4/m4private.h (m4__module_find): Declare it. * m4/builtin.c (m4_builtin_find_by_name, m4_builtin_find_by_func): Use m4__module_next instead of obsolete lt_dlhandle_next. 2005-10-20 Gary V. Vaughan * bootstrap (func_update_po): Update pofiles directly from the translation project. * po/LINGUAS, po/cs.po, po/de.po, po/el.po, po/fr.po, po/it.po, po/ja.po, po/nl.po, po/pl.po, po/ru.po, po/sv.po: No need to store these files under source control anymore. Suggested by Eric Blake 2005-07-07 Paul Eggert * ltdl/m4/m4-gnulib.m4: Update FSF contact address. Somehow this file escaped the address updates on 2005-05-01. 2005-07-07 Gary V. Vaughan * bootstrap: Allow user overriding of gnulib-tool location, and correctly determine module source directories whether gnulib-tool is given as a relative or absolute path, or is found by searching PATH. Reported by Eric Blake 2005-07-07 Ralf Wildenhues * ltdl/m4/debug.m4 (m4_CHECK_DEBUGGING): Make sure that both $rm and $RM are defined for various versions of AC_LIBTOOL_COMPILER_OPTION. * bootstrap (AUTORECONF): New variable to allow user overriding of autoreconf path. 2005-07-07 Gary V. Vaughan * doc/m4.texinfo (History): Add better notes on the ancestory of GNU m4, and other historical interest. 2005-05-08 Gary V. Vaughan * m4/symtab.c (m4_symbol_rename): New function that performs a low level symbol rename. * m4/m4module.h (m4_symbol_rename): Declare it as part of the API. * modules/gnu.c (regsub): Factored out of m4_epatsubst_do... (m4_patsubst_do, m4_renamesyms_do): ...wrappers that use regsub... (erenamesyms, renamesyms): ...builtins that use these to implement macro renaming by regular expression. * doc/m4.texinfo (Erenamesyms and Renamesyms): Document them. * tests/generate.awk: Allow some forbidden `m4_' prefixed symbols to stop the new generated tests from choking. 2005-05-07 Gary V. Vaughan Since most of the build is handled from a single Makefile.am now, we can teach make about the dependencies between the m4 binary and the preopened modules it is built against: * configure.ac (PREOPEN_DEPENDENCIES): Substitute for a list of preopened modules. * Makefile.am (src_m4_DEPENDENCIES): Rebuild the m4 program if any of the preopened modules have changed. 2005-05-07 Gary V. Vaughan * configure.ac (gl_MODULES): Add mkstemp for machines that don't have a native implementation. 2005-05-06 Gary V. Vaughan * src/m4.h (EXIT_SUCCESS, EXIT_FAILURE): Removed. These are handled already by gnu/exit.h. * configure.ac (gl_MODULES): Add assert to support a --disable-assert configure time option for NDEBUG setting. * Makefile.am (src_m4_SOURCES): Add version-etc-fsf.c. * bootstrap (src_modules): Add version-etc-fsf. * src/main.c (version_etc_copyright): Removed. * ltdl/m4/m4-getopt.m4 (m4_GETOPT): Synch with gnulib/getopt.m4. 2005-05-04 Gary V. Vaughan * src/m4.h (__CYGWIN__, WIN32): Canonicalise Windows and Cygwin recognition macros. * src/freeze.c (produce_frozen_state): Use \n line-endings even on Windows, so that the frozen file reader will work. Reported by Josef T. Burger 2005-05-04 Vincent Lonngren Forward port of a patch that allowed m4-1.4.2 to compile on QNX 6.3: * configure.ac (AC_CHECK_HEADERS): Add signal.h, sys/signal.h. * src/m4.h: And include them as appropriate. * src/main.c, src/stackovf.h: Don't include signal.h literally; m4.h will include the correct file. 2005-05-04 Gary V. Vaughan * m4/m4private.h: Make errno visible for the sources patched below. 2005-05-04 Paul Eggert * src/main.c (print_program_name_CB): Preserve errno, since M4ERROR relies on this. * modules/gnu.c (m4_esyscmd): Clear errno before calling popen. * modules/m4.c (m4_maketemp): Clear errno before calling mkstemp. * m4/path.c (m4_path_search): Don't let "free" trash errno when returning NULL. * m4/output.c (m4_insert_file): Don't assume errno has a valid value simply because fread returns zero. This fixes a portability bug reported by Marion Hakanson in . 2005-05-04 Santiago Vila * tests/stackovf.test: Use tempfile if available. 2005-05-04 Robert Bihlmeyer (tiny change) http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=92629 * m4/output.c (m4_insert_file): Do not mix buffered and unbuffered I/O, as this breaks on the Hurd. 2005-05-04 Gary V. Vaughan Gnulib has changed again. Reimport. Adjust. Rinse. Repeat. Automake and Libtool now agree on subdir-objects and LTLIBOBJS, and libtoolize does a better job of ltdl importing now too, so take advantage of that while updating the tree: * acm4, config: Moved from here... * ltdl/m4, ltdl/config: ...to here. * doc/Makefile.am, m4/Makefile.am, modules/Makefile.am, src/Makefile.am, tests/Makefile.am: Removed... * Makefile.am: ...and migrated to here, with adjustments to compensate for relative path differences. * commit: Adjust relative paths. * configure.ac: Adjust relative paths. (AC_PREREQ): 2.59 isn't strictly new enough, we also need a patch. (LT_PREREQ): 2.0 isn't released yet, but will work when it is! In the meanwhile, CVS HEAD libtool is needed. (AM_INIT_AUTOMAKE): Added subdir-objects declaration. 1.9.5 isn't stricly new enough, we also need a patch. (AM_PROG_CC_C_O): Required for subdir-objects in Automake. (AC_WITH_LTDL): Replaced with LT_WITH_LTDL. (gl_MODULES): Don't list getopt and version-etc, as they don't belong in libm4. * bootstrap: After running gnulib-tool to import the listed modules, fetch getopt and version-etc into src manually. (ltdldir): Change to ltdl. * src/main.c: Adjust for changes in version-etc API. * ltdl/m4/m4-getopt.m4: New macro to mirror gnulib's getopt.m4, but works when the getopt module isn't to be included in the lib. * README: Add note about patching autoconf and automake to bootstrap CVS m4. 2005-05-02 Matt Kraai (tiny change) http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=84416 * doc/m4.texinfo (Maketemp): Change maketemp to refer to a new, empty file rather than to a nonexistent file. This closes a common security hole. * modules/m4.c (m4_maketemp): Implement the above, by using mkstemp rather than mktemp. 2005-05-01 Gary V. Vaughan The FSF are moving offices today. Changed their contact address in all files from `59 Temple Place, Suite 330, MA 02111-1307' to `51 Franklin Street, Fifth Floor, MA 02110-1301'. 2005-03-11 Ralf Wildenhues (tiny change) * tests/Makefile (clean-local): Ignore testsuite cleanup failures. 2005-03-11 Per Bothner (tiny change) * tests/Makefile (clean-local): Only run the testsuite cleanup if the testsuite has been generated. 2005-02-11 Stepan Kasal * TODO: slight clarification of the example of qindir usage. 2005-02-08 Gary V. Vaughan * TODO: Add qindir requirement, and defn bug. From Stepan Kasal 2005-02-08 Stepan Kasal * TODO: Add ``execution stack'', fix a typo. * doc/m4.texinfo: Typos. 2004-12-24 Eric Blake * configure.ac (INCLUDE_STDBOOL_H): Account for gnulib's move to the gnu subdirectory. * acm4/m4-error.m4 (INCLUDE_ERROR_H): Likewise. * acm4/m4-obstack.m4 (INCLUDE_OBSTACK_H): Likewise. * acm4/m4-regex.m4 (INCLUDE_REGEX_H): Likewise. * m4/system_.h: Likewise, in non-configured includes. 2004-10-14 Noah Misch , Gary V. Vaughan * m4/m4.c (m4_context_field_table, m4_context_opt_bit_table): Protect definitions from macro expansion under -DNDEBUG by parenthesising the expanded function names. * m4/syntax.c (m4_get_syntax_lquote, m4_get_syntax_rquote) (m4_get_syntax_bcomm, m4_get_syntax_ecomm) (m4_is_syntax_single_quotes, m4_is_syntax_single_comments) (m4_is_syntax_macro_escaped): Similarly protect function definitions from macro expansion under -DNDEBUG by #undefing the matching macro names before each definition. Also, move all the function definitions to the end of the file so that any invocations in the rest of the file pick up the fast macro versions. * m4/m4private.h (m4_set_symbol_table, m4_set_syntax_table) (m4_set_debug_file, m4_set_trace_messages) (m4_set_warning_status_opt, m4_set_no_gnu_extensions_opt) (m4_set_nesting_limit_opt, m4_set_debug_level_opt) (m4_set_max_debug_arg_length_opt): New fast macro versions of the option setter functions. 2004-09-23 Gary V. Vaughan * po/POTFILES.in: Reflect move of gnulib files from gnulib/m4 to gnu. 2004-09-23 Gary V. Vaughan * src/main.c: Include gnulib files from the correct directory. * gnulib/*: Don't store any of the gnulib files in arch, as they generate spurious changes. * Makefile.am (ACLOCAL_AMFLAGS): Remove gnulib/acm4 since the gnulib macros now share our macro directory. (SUBDIRS): Descend into `gnu' rather than `gnulib'. * bootstrap: Call gnulib-tool to import from the gnulib tree. (gl_AC_HEADER_INT_TYPES_H, gl_AC_HEADER_STDINT_H, gl_AC_TYPE_UINTMAX_T): Patch gnulib.m4 to define these in terms of the gettext macros from autopoint that overwrite the gnulib-tool imported versions. Import sources and Makefile.am into the `gnu' directory. Changed all callers. * configure.ac (gl_EARLY, gl_SOURCE_BASE, gl_M4_BASE, gl_MODULES, gl_INIT): Call these gnulib-tool macros instead of the hardcoded for imported modules. * acm4/m4-error.m4, acm4/m4-gettext.m4, acm4/m4-obstack.m4, acm4/m4-regex.m4: Use AC_BEFORE to enforce ordering rather than hardcoding the gnulib macros they wrap. 2004-07-15 Gary V. Vaughan Latest CVS libtool can preload modules in libraries, including its own module loaders! Tweak m4 so that it doesn't try to treat libltdl's module loaders as m4 modules when freezing and on exit: * gnulib/acm4/*.m4: Don't store these files in arch since they generate spurious changes. * bootstrap: Simplify initial libtoolize call, since CVS libtoolize is smarter these days. * doc/Makefile.am (%.1): Make the helptoman call work with a VPATH build. * m4/module.h (m4__module_exit): Missing declaration. * m4/m4private.h (m4__module_next): New function declaration. * m4/module.c (m4__module_next): lt_dlhandle_{firs,nex}t encapsulation. Changed all callers. (m4__module_interface): New function to verify m4 loadable module interfaces. (m4__module_init): Register the interface validator. (m4__module_exit): Only close my own modules. * modules/m4.c (unistd.h): Provide missing declaration. (m4_set_sysval, m4_sysval_flush, m4_dump_symbols) (m4_expand_ranges): More missing declarations. * modules/modtest.c (export_test): Ditto. * src/Makefile.am (AM_CPPFLAGS): Add libltdl directory. * src/main.c (main): Bump copyright year. * tests/modules.at: Fix sed syntax error. 2004-06-17 Gary V. Vaughan Tweaking to enable compilation with latest CVS libtool and libltdl. We can't just dump the library files directly into the m4 directory anymore now that libltdl is built from pieces itself: * bootstrap: Rewritten to use latest libtoolize sanely, and to set up libltdl subdirectory. * configure.ac (AC_CONFIG_AUX_DIR): Point to our own, not the gnulib subdirectory's config. (TIMESTAMP): Use $ac_aux_dir for VPATH builds. (m4_pattern_forbid): Remove the cruft to deal with renamed jm_ macros from gnulib. (AC_LIB_LTDL): Latest libltdl is a sub-project with its own configure.ac, so use AC_WITH_LTDL instead. * Makefile.am (SUBDIRS): Add libltdl. * acm4/m4-regex.m4 (jm_INCLUDED_REGEX): Updated. gnulib now uses gl_INCLUDED_REGEX. * m4/Makefile.am (AM_CPPFLAGS): Add INCLTDL. (libm4_la_SOURCES): Remove ltdl.c and ltdl.h. (libm4_la_LIBADD): Add LIBLTDL. * m4/ltdl.c, m4/ltdl.h: Removed. * m4/m4module.h: Include canonical ltdl.h. * po/*.po: Updated. 2004-06-14 Gary V. Vaughan * gnulib/import: Now updates makefile fragments, and configure.ac. * gnulib/m4/gnulib.am: New file. Generated makefile fragments. * gnulib/m4/Makefile.am: include it. * gnulib/acm4/intmax.m4, gnulib/acm4/longdouble.m4, gnulib/acm4/longlong.m4, gnulib/acm4/printf-posix.m4, gnulib/acm4/signed.m4, gnulib/acm4/size_max.m4, gnulib/acm4/wchar_t.m4, gnulib/acm4/wint_t.m4, gnulib/acm4/xsize.m4: New macro files from latest gnulib import. * gnulib/acm4/alloca.m4, gnulib/acm4/inttypes_h.m4, gnulib/acm4/lib-ld.m4, gnulib/acm4/lib-prefix.m4, gnulib/acm4/error.m4, gnulib/acm4/po.m4, gnulib/acm4/regex.m4, gnulib/acm4/stdbool.m4, gnulib/acm4/stdint_h.m4, gnulib/acm4/uintmax_t.m4, gnulib/acm4/ulonglong.m4, gnulib/acm4/unlocked-io.m4, gnulib/acm4/xalloc.m4, gnulib/acm4/free.m4, gnulib/acm4/gettext.m4, gnulib/acm4/glibc21.m4: Updated macro files from latest gnulib import. * gnulib/m4/getopt_int.h: New source file from latest gnulib import. * gnulib/m4/alloca.c, gnulib/m4/alloca_.h, gnulib/m4/getopt1.c, gnulib/m4/obstack.c, gnulib/m4/obstack.h, gnulib/m4/regex.c, gnulib/m4/unlocked-io.h, gnulib/m4/version-etc.c, gnulib/m4/xmalloc.c, gnulib/m4/getopt.c, gnulib/m4/getopt.h: Updated source files from latest gnulib. 2004-02-29 Gary V. Vaughan * config/mailnotify: New file for mailing commit notifications, imported from cvs-utils. * commit: Updated from cvs-utils and tweaked for m4. 2003-12-01 Gary V. Vaughan * config/mkstamp: Updated from CVS libtool. * configure.ac: Generate a gnu coding standards compliant version number, and use it for the banner. * Makefile.am (stamp-vcl): New rules to force m4 to be regenerated mhen the TIMESTAMP changes in ChangeLog, but the file modification time doesn't (e.g. in cvs commit). Otherwise dist tarballs will contain the previous version number. * src/main.c: Make --version output conform to the GNU standard. * configure.ac (AM_INIT_AUTOMAKE): Require 1.7g... * modules/Makefile.am (gnu_la_SOURCES, load_la_SOURCES, m4_la_SOURCES, traditional_la_SOURCES, modtest_la_SOURCES, shadow_la_SOURCES, import_la_SOURCES, stdlib_la_SOURCES, time_la_SOURCES): ...so that these are defaulted correctly, and can be removed from this file. (AM_LDFLAGS): Add -module... (gnu_la_LDFLAGS, load_la_LDFLAGS, m4_la_LDFLAGS, traditional_la_LDFLAGS, modtest_la_LDFLAGS, shadow_la_LDFLAGS, import_la_LDFLAGS, stdlib_la_LDFLAGS, time_la_LDFLAGS): ...so that the individual settings can be removed. * m4/Makefile.am (libm4_la_LIBADD): Add $(LTLIBINTL) here once... * module/Makefile.am (gnu_la_LIBADD, load_la_LIBADD, m4_la_LIBADD, traditional_la_LIBADD, modtest_la_LIBADD, shadow_la_LIBADD, import_la_LIBADD, stdlib_la_LIBADD, time_la_LIBADD): ...so that these are picked up as a deplib of libm4 and don't need to be set explicitly. 2003-11-18 Gary V. Vaughan * modules/Makefile.am (pkglibexec_LTLIBRARIES): Remove perl.la from the standard build. It is too fragile. * gnulib/acm4/libtool.m4, m4/ltdl.c, m4/ltdl.h: Reimported from CVS libtool after merging m4 changes across to libtool. * m4/symtab.c (m4_symtab_create): Fix a careless use of sizeof. * m4/path.c (search_path_add): Ditto. 2003-11-13 Gary V. Vaughan * configure.ac (AC_LIBTOOL_TAGS): Don't include shell code for libtool tags we don't use in configure. This reduces the size of the script from over 1Mb to under 700Kb. 2003-11-13 Gary V. Vaughan The import script was not written properly, and the last gnulib import was incomplete. Fixed that problem, and reimport our gnulib dependencies, which picks up the address calculation overflow checks described by Paul below. Also tweak the clients of the gnulib xalloc module not to use deprecated macros: * gnulib/import: Recurse through module dependencies rather than naively descending only one level. * configure.ac: Add calls to gnulib's strnlen and extension module macros. * gnulib/m4/Makefile.am: Add snippets from gnulib's strnlen and extension modules. * gnulib/acm4/extensions.m4, gnulib/acm4/xalloc.m4, gnulib/m4/alloca.c, gnulib/m4/obstack.c, gnulib/m4/obstack.h, gnulib/m4/stdbool_.h, gnulib/m4/unlocked-io.h, gnulib/m4/xalloc.h, gnulib/m4/xmalloc.c, gnulib/m4/xstrdup.c: Updated from CVS gnulib. * gnulib/acm4/libtool.m4: Updated from CVS libtool. * m4/hash.c (m4_get_hash_iterator_next): Use `xzalloc (S)' in place of `xcalloc (1, S)'. * m4/m4.c (m4_create): Likewise. * m4/m4private.h (m4_symbol_value_create): Likewise. * m4/symtab.c (symtab_fetch): Likewise. * m4/syntax.c (m4_syntax_create): Likewise. * src/freeze.c (reload_frozen_state): Likewise. * m4/path.c (search_path_add): Eliminate use of deprecated NEW macro. * m4/symtab.c (m4_symtab_create): Likewise. 2003-11-13 Gary V. Vaughan * tests/module.at: Comment typo. 2003-10-10 Gary V. Vaughan * tests/modules.at (modules: importing): Apply some lateral thinking, and use AT_CHECK to compare the output of a sed pass over stderr against the canonical strerror string. * tests/modules.at (modules: importing): Edit the generated stderr output to canonicalize strerror output, before a comparison. 2003-10-10 Gary V. Vaughan Tru64UNIX perl is sloppy with namespace pollution. This patch is careful not to trip over the mess: * modules/perl.c: Some builds of perl install headers that contain `#define try __builtin_try'. Be sure to undefine that macro before `m4/hash.h' gets included, which uses the `try' symbol. * m4/system_.h: Similarly for `bool'. Undefine `bool', `true' and `false' before including `stdbool.h'. (DELETE): This symbol is not in m4's namespace, and is in any case only used internally... * m4/m4private.h (DELETE): ...so move it to here. Reported by Martin MOKREJS 2003-10-08 Paul Eggert Don't use XMALLOC and XCALLOC. Once we install the corresponding patch into gnulib, this will fix some address-calculation overflow bugs on hosts where calloc (A, B) returns garbage when A*B overflows. * m4/hash.c (m4_hash_new, node_new, m4_hash_resize, maybe_grow, m4_get_hash_iterator_next): Replace XMALLOC with xmalloc, XCALLOC with xcalloc. * m4/m4.c (m4_create): Likewise. * m4/m4private.h (m4_symbol_value_create): Likewise. * m4/output.c (m4_output_init): Likewise. * m4/symtab.c (symtab_fetch, m4_set_symbol_traced): Likewise. * m4/syntax.c (remove_syntax_attribute): Likewise. * src/freeze.c (reload_frozen_state): Likewise. * src/main.c (main): Likewise. 2003-10-07 Gary V. Vaughan * Makefile.am (ACLOCAL_AMFLAGS): Search in the new acm4 and gnulib/acm4 directories for aclocal m4 macros. * gnulib/Makefile.am (EXTRA_DIST): Removed. (MAINTAINERCLEANFILES): Add Makefile.in. * configure.ac (m4_GNULIB_MODULES): Use it to declare which gnulib modules we use. * acm4/m4-gnulib.m4 (m4_GNULIB_MODULES): New macro. * gnulib/import: New file. Temporary script for updating gnulib imported files, until gnulib-tool is working. * gnulib/config/codeset.m4, gnulib/config/error.m4, gnulib/config/exitfail.m4, gnulib/config/extensions.m4, gnulib/config/getopt.m4, gnulib/config/gettext.m4, gnulib/config/glibc21.m4, gnulib/config/iconv.m4, gnulib/config/intdiv0.m4, gnulib/config/inttypes-pri.m4, gnulib/config/inttypes.m4, gnulib/config/inttypes_h.m4, gnulib/config/isc-posix.m4, gnulib/config/lcmessage.m4, gnulib/config/lib-ld.m4, gnulib/config/lib-link.m4, gnulib/config/lib-prefix.m4, gnulib/config/malloc.m4, gnulib/config/nls.m4, gnulib/config/obstack.m4, gnulib/config/onceonly_2_57.m4, gnulib/config/po.m4, gnulib/config/progtest.m4, gnulib/config/realloc.m4, gnulib/config/regex.m4, gnulib/config/restrict.m4. gnulib/config/stdbool.m4, gnulib/config/stdint_h.m4, gnulib/config/strerror_r.m4, gnulib/config/strndup.m4, gnulib/config/strnlen.m4, gnulib/config/strtol.m4, gnulib/config/uintmax_t.m4, gnulib/config/ulonglong.m4, gnulib/config/unlocked-io.m4, gnulib/config/xalloc.m4, gnulib/config/xstrndup.m4: Removed. * gnulib/acm4/alloca.m4, gnulib/acm4/codeset.m4, gnulib/acm4/error.m4, gnulib/acm4/exitfail.m4, gnulib/acm4/extensions.m4, gnulib/acm4/free.m4, gnulib/acm4/getopt.m4, gnulib/acm4/gettext.m4, gnulib/acm4/glibc21.m4, gnulib/acm4/iconv.m4, gnulib/acm4/intdiv0.m4, gnulib/acm4/inttypes-pri.m4, gnulib/acm4/inttypes.m4, gnulib/acm4/inttypes_h.m4, gnulib/acm4/isc-posix.m4, gnulib/acm4/lcmessage.m4, gnulib/acm4/lib-ld.m4, gnulib/acm4/lib-link.m4, gnulib/acm4/lib-prefix.m4, gnulib/acm4/malloc.m4, gnulib/acm4/nls.m4, gnulib/acm4/obstack.m4, gnulib/acm4/onceonly_2_57.m4, gnulib/acm4/po.m4, gnulib/acm4/progtest.m4, gnulib/acm4/realloc.m4, gnulib/acm4/regex.m4, gnulib/acm4/restrict.m4. gnulib/acm4/stdbool.m4, gnulib/acm4/stdint_h.m4, gnulib/acm4/strerror_r.m4, gnulib/acm4/strndup.m4, gnulib/acm4/strnlen.m4, gnulib/acm4/strtol.m4, gnulib/acm4/uintmax_t.m4, gnulib/acm4/ulonglong.m4, gnulib/acm4/unlocked-io.m4, gnulib/acm4/xalloc.m4, gnulib/acm4/xstrndup.m4: Reimported from CVS gnulib with gnulib/import script. * gnulib/m4/alloca.c, gnulib/m4/alloca_.h, gnulib/m4/error.c, gnulib/m4/error.h, gnulib/m4/exitfail.c, gnulib/m4/free.c, gnulib/m4/malloc.c, gnulib/m4/obstack.c, gnulib/m4/obstack.h, gnulib/m4/realloc.c, gnulib/m4/regex.c, gnulib/m4/strtol.c, gnulib/m4/version-etc.c, gnulib/m4/version-etc.h, gnulib/m4/xalloc.h, gnulib/m4/xmalloc.c: Updated from CVS gnulib with gnulib/import script. * configure.ac, gnulib/m4/Makefile.am: Manually insert anticipated guards ready for gnulib-tool to autoupdate on import. * config/debug.m4, config/gmp.m4, config/m4-error.m4, config/m4-gettext.m4, config/m4-obstack.m4, config/m4-regex.m4, config/stackovf.m4: Moved from here... * acm4/debug.m4, acm4/gmp.m4, acm4/m4-error.m4, acm4/m4-gettext.m4, acm4/m4-obstack.m4, acm4/m4-regex.m4, acm4/stackovf.m4: ...to here, to separate aclocal macros from configure time helper scripts. * config/error.m4: Removed; superceded by gnulib/acm4/error.m4. * m4/hash.c, m4/m4.c, m4/macro.c, m4/module.c, m4/output.c, m4/path.c, m4/symtab.c, m4/syntax, m4/system_.h, modules/m4.c, src/main.c, src/stackovf.c: s/xfree/free/g to comply with new gnulib xalloc.h. * src/main.c (version_etc_copyright): Only output the current year. (version_etc): Call with new variadic API. 2003-09-16 Gary V. Vaughan * gnulib/m4/version-etc.c, gnulib/m4/version-etc.h: Import version-etc module from CVS gnulib. * po/POTFILES.in: Add gnulib/m4/version-etc.c. * src/Makefile.am: Build it. * src/main.c: Use it. * gnulib/m4/exit.h: Import exit module from CVS gnulib. * gnulib/m4/Makefile.am (pkginclude_HEADERS): Add exit.h. * m4/system_.h: Don't define EXIT_SUCCESS and FAILURE, include exit.h instead. 2003-09-15 Charles Wilson , Gary V. Vaughan * bootstrap: Separate options. * configure.ac (AM_GNU_GETTEXT_VERSION): Bump to 0.12.1. * gnulib/m4/Makefile.am (stdbool.h): Use srcdir, gnulib_srcdir is not set. * modules/Makefile.am (gnu_la_LIBADD, load_la_LIBADD) (m4_la_LIBADD, mpeval_la_LIBADD, traditianal_la_LIBADD) (modtest_la_LIBADD, import_la_LIBADD, perl_la_LIBADD) (shadow_la_LIBADD, stdlib_la_LIBADD, time_la_LIBADD): Add $(LTLIBINTL) for gettext support on cygwin. * src/Makefile.am (m4_LDADD): Remove $(INTLLIBS), since we now have $(LTLIBINTL) from the preloaded module la files. * README: Remove the warning about using --disable-nls on Windows machines. 2003-09-15 Gary V. Vaughan * gnulib/m4/regex.c: s//"regex.h"/ or else the compiler picks up the system regex.h if gl_REGEX decides gnulib/m4/regex.c is required. 2003-09-12 Gary V. Vaughan * doc/STYLE: Document the gnulib header naming conventions, and #include policy. * gnulib/m4/error_.h, gnulib/m4/gettext_.h, gnulib/m4/obstack_.h, gnulib/m4/regex_.h: Renamed to gnulib/m4/error.h, gnulib/m4/gettext.h, gnulib/m4/obstack.h, gnulib/m4/regex.h respectively. * gnulib/m4/Makefile.am: Remove the rules to build these headers. * gnulib/m4/strtol.c, gnulib/config/strtol.m4: Import strtol module from CVS gnulib. * configure.ac (AC_REPLACE_FUNCS): Remove strtol. (gl_FUNC_STRTOL): In favour of the module macro. 2003-09-12 Gary V. Vaughan Replace the getopt code with CVS gnulib getopt. The source files detect whether they are in a glibc environment and preprocess away all of the code if there is a system getopt, so we can compile them into the m4 executable unconditionally: * gnulib/m4/getopt.c, gnulib/m4/getopt1.c, gnulib/m4/getopt.h, gnulib/config/getopt.m4: Import getopt module from CVS gnulib. * configure.ac (gl_GETOPT): Use this instead of homebrew inline macros. * src/getopt.c, src/getopt1.c, src/gnu-getopt.h: Removed old version. * src/Makefile.am: Adjust. * src/main.c: Always include our shipped getopt.h. * po/POTFILES.in: Use new location of getopt.c. 2003-09-12 Gary V. Vaughan * configure.ac (AC_CONFIG_FILES): Remove config/Makefile. * config/Makefile.am: Removed. Automake 1.8 distributes the files in this directory automatically. * Makefile.am (EXTRA_DIST): Except config/mkstamp. * configure.ac (pkglibexecdir): Don't try and set it here, PACKAGE isn't set yet. * m4/Makefile.am (MODULE_PATH): Removed. Calculate pkglibexecdir inline. * modules/Makefile.am (pkglibexecdir): Set it here. (pkgmodincdir): Renamed to pkgmodincludedir). Changed all clients. * gnulib/m4/regex.c, gnulib/m4/regex_.h, gnulib/config/regex.m4: Import regex module from CVS gnulib. * gnulib/config/restrict.m4: Ditto for dependee module restrict. * config/m4-regex.m4 (m4_REGEX): Wrap gnulib/config/regex.m4, but do extra substitutions for Makefile. * configure.ac: Use it. * gnulib/m4/Makefile.am: Maybe install regex.h after linking it from regex_.h if necessary. * m4/system_.h: Include the correct version of regex.h. * m4/regex.c, m4/regex.h, config/regex.m4: Removed legacy version. * po/POTFILES.in: Use new location of regex.c. * gnulib/m4/Makefile.am (EXTRA_DIST): Removed malloc.c and realloc.c: automake distributes these files already. 2003-09-12 Gary V. Vaughan Replace the xstrzdup code by importing the xstrndup module from CVS gnulib, along with its dependencies: strndup and strnlen: * gnulib/m4/xstrndup.c, gnulib/m4/xstrndup.h, gnulib/config/xstrndup.m4: Import xstrndup module from CVS gnulib. * gnulib/m4/strndup.c, gnulib/m4/strndup.h, gnulib/config/strndup.m4: Ditto wrt strndup. * gnulib/m4/strnlen.c, gnulib/config/strnlen.m4: Ditto wrt strnlen. * gnulib/m4/Makefile.am: Add rules from newly imported modules. However, contrary to gnulib, we install xstrndup.h. * configure.ac (AC_REPLACE_FUNCS): Remove xstrzdup. * gnulib/lib/xstrzdup.c: Delete. This was never a gnulib file, it is an artifact of the old m4 portability layer. * configure.ac (gl_XSTRNDUP): This is the gnulib equivalent. * m4/system_.h: Include xstrndup.h. * m4/macro.c (process_macro): Call xstrndup, not xstrzdup. 2003-09-11 Gary V. Vaughan Reimport the latest xalloc module from CVS gnulib, and adjust the m4 sources to take advantage of xalloc xfree. Also create a new macro DELETE with the same semantics as the old m4 XFREE macro, and carefully tweak callers: * gnulib/config/xalloc.m4, gnulib/m4/xalloc.h: Updated from CVS gnulib. * m4/utility.c (xfree): Removed. This function is now supplied by gnulib xalloc. * m4/m4private.h (WITH_DMALLOC): Removed XFREE redefine. * m4/path.c (search_path_add): Use NEW macro from xalloc.h. * m4/symtab.c (m4_symtab_create): Ditto. * m4/system_.h: Removed XFREE redefine. (DELETE): New macro with same functionality as the original m4 XFREE macro, but based on xalloc.h now. Changed all callers. * src/main.c (main): Use XMALLOC macro. * m4/hash.c, m4/macro.c, m4/symtab.c, m4/syntax.c: Use xfree instead of XFREE. * m4/output.c (m4_output_exit): Use DELETE instead of XFREE. 2003-09-10 Gary V. Vaughan Import the xalloc module from CVS gnulib, along with its dependencies: exitfail, malloc and realloc. We had different semantics for our XFREE and a function xfree() not supplied by gnulib, so also a bit of work to keep everything running smoothly: * configure.ac (AC_REPLACE_FUNCS): Removed xmalloc and xstrdup. (gl_XALLOC): Use gnulib equivalents. * gnulib/config/exitfail.m4, gnulib/m4/exitfail.h, gnulib/m4/exitfail.c: Import exitfail module from CVS gnulib. * gnulib/config/malloc.m4, gnulib/m4/malloc.c: Ditto wrt malloc. * gnulib/config/realloc.m4, gnulib/m4/realloc.c: Ditto wrt realloc. * gnulib/config/xalloc.m4, gnulib/m4/xalloc.h, gnulib/m4/xmalloc.c, gnulib/m4/xstrdup.c: Ditto wrt xalloc. * gnulib/m4/Makefile.am: Add fragment from gnulib for newly imported modules. (pkgincdir): Removed. Use pkgincludedir instead. * m4/m4private.h (XFREE): xfree already checks for NULL. * m4/system_.h: Use xalloc module, and remove macros already supplied by xalloc.h. * m4/utility.c (xfree): xalloc does not yet implement xfree, so moved the old definition from m4/xmalloc.c to here for now. 2003-09-09 Gary V. Vaughan Import the error and progname modules from CVS gnulib. Our old error.c subsumed the functionality of both, so a little adjustment was required to accomodate the split in sources. Also added more wrapper macros to choose between a system installed error.h or our shipped gnulib error module: * m4/error.c, m4/error.h: Removed. * m4/Makefile.am: Adjust. (pkgincdir): Removed. Use pkgincludedir instead. * m4/module.h, src/main.c: Don't include `m4/error.h'. * m4/system_.h (INCLUDE_ERROR_H): Add a substitution for suitable error.h. * gnulib/m4/progname.c: Imported from CVS gnulib. * gnulib/m4/progname.h: Ditto. * src/main.c: Adjust to use progname module. * gnulib/m4/error.c: Imported from CVS gnulib. * gnulib/m4/error_.h: Ditto. * gnulib/m4/Makefile.am: Build the error module into our libgnu.la if appropriate, and link a local error.h if the system version is missing. (libgnu_la_SOURCES) Add progname module sources. * gnulib/config/error.m4: Imported from CVS gnulib. * gnulib/config/strerror_r.m4: Ditto. * config/m4-error.c: New file. Wrap gnulib error.m4 but arrange to have ERROR_H for Makefile substitutions and tell system.h whether the system error.h should be used, or a locally installed version. * configure.ac (jm_PREREQ_ERROR): Replaced by a call to m4_ERROR. 2003-09-09 Gary V. Vaughan * gnulib/m4/Makefile.am (MOSTLYCLEANFILES): Typo s/gettext_.h/gettext.h/. * bootstrap: Revert 2003-09-04 patch now that CVS autoconf and automake have been fixed. * config/m4-obstack.m4 (m4_FUNC_OBSTACK): D'oh! Now that we wrap gl_OBSTACK, which in turn calls AC_FUNC_OBSTACK, don't rerun bits of code originally snarfed from AC_FUNC_OBSTACK!!! While I'm here rename to m4_OBSTACK in light of wrapping gl_OBSTACK. 2003-09-09 Gary V. Vaughan The gnulib obstack module requires the gnulib gettext module for systems that do not have GNU gettext installed. Because we use -Ignulib/m4 in our Makefiles it is not safe to drop gettext.h in that directory incase it clashes with the system gettext.h. This delta uses gettext_.h and extra rules in the Makefile to make a link to gettext.h when needed: * Makefile.am (auxdir): Removed. No longer used. * configure.ac (ac_aux_dir): Removed AC_SUBST. No longer used. (TIMESTAMP): List path to `mkstamp' literally, as ac_aux_dir has moved. (AC_CONFIG_LIBOBJ_DIR): Declare this for possible future single Makefile based build. (AC_CONFIG_AUX_DIR): Now we use gnulib/config where the majority of the macros are kept. * Makefile.am (ACLOCAL_MFLAGS): Search gnulib/config first. * configure.ac (AM_INIT_AUTOMAKE): Require 1.7a. * config/Makefile (ACLOCAL_MACROS): Removed. Automake 1.7a distributes these automatically. * config/regex.m4 (jm_WITH_REGEX): Fixed underquoting to prevent warning from automake-1.7a. * config/debug.m4 (M4_AC_CHECK_DEBUGGING): Renamed to m4_CHECK_DEBUGGING for consistency with gnulib prefixes. Changed all callers. * config/m4-obstack.m4 (M4_AC_FUNC_OBSTACK): Ditto wrt. m4_FUNC_OBSTACK. * config/stackovf.m4 (M4_AC_SYS_STACKOVF): Ditto wrt. m4_sys_STACKOVF. * config/gmp.m4 (_M4_AC_LIB_GMP, M4_AC_LIB_GMP): Ditto wrt. _m4_LIB_GMP, m4_LIB_GMP. (ac_gmp_save_LIBS, ac_cv_using_lib_gmp): Don't use autoconf's namespace. Renamed to m4_gmp_save_LIBS and m4_cv_using_lib_gmp respectively. * config/m4-gettext.m4: New file to set GETTEXT_H appropriately. * gnulib/m4/Makefile.am: Added a new block to make an appropriate gettext.h link on deficient systems. (pkginc_HEADERS): Mention $(GETTEXT_H). (EXTRA_HEADERS): Mention gettext.h. * gnulib/config/gettext_.h: New file from gnulib's gettext.h. * gnulib/config/codeset.m4, gnulib/config/gettext.m4, gnulib/config/glibc21.m4, gnulib/config/iconv.m4, gnulib/config/intdiv.m4, gnulib/config/inttypes-pri.m4, gnulib/config/inttypes.m4, gnulib/config/inttypes_h.m4, gnulib/config/isc-posix.m4, gnulib/config/lcmessage.m4, gnulib/config/lib-ld.m4, gnulib/config/lib-link.m4, gnulib/config/lib-prefix.m4, gnulib/config/nls.m4, gnulib/config/po.m4, gnulib/config/progtest.m4, gnulib/config/stdint_h.m4, gnulib/config/uintmax_t.m4, gnulib/config/ulonglong.m4: Imported from CVS gnulib. 2003-09-05 Gary V. Vaughan We can't mirror the gnulib directory structure here, since we need to be able to eg. `#include ' from our source files, which is much easier if the local obstack.h is created in a directory named m4. Rather than trying to symlink everything into the m4 directory, now we build a libtool convenience library from the sources we get from gnulib and link that with libm4.la: * gnulib/config/extensions.m4: Imported from CVS gnulib. * gnulib/config/unlocked-io.m4: Ditto. * gnulib/m4/unlocked-io.h: Ditto. * gnulib/m4/obstack.m4, gnulib/m4/onceonly_2_57.m4, gnulib/m4/stdbool.m4: All moved to gnulib/config directory. * gnulib/lib/obstack.c, gnulib/lib/obstack_.h, gnulib/lib/stdbool_.h: All moved to gnulib/m4 directory. * m4/strtol.c, m4/xmalloc.c, m4/xstrdup.c, m4/xstrzdup.c: Ditto. * m4/Makefile.am: Adjust. * gnulib/Makefile.am (EXTRA_DIST): Name just the additional gnulib macros we redistribute. * gnulib/m4/Makefile.am: New file. Build libgnu.la convenience library among others. (GNULIB_SRCS, GNULIB_MACROS): Removed. * Makefile.am (ACLOCAL_AMFLAGS): Adjust. * config/m4-obstack.m4: Adjust. * po/POTFILES.in: Adjust. * configure.ac: Reformatting. Call newly imported gnulib macros. * m4/builtin.c, m4/macro.c, m4/module.c, m4/utility.c: Removed bogus calls of `#include "m4.h"'. * Makefile.am: INCLUDES has been deprecated in favour of AM_CPPFLAGS. * m4/Makefile.am: Ditto. * modules/Makefile.am: Ditto. * src/Makefile.am: Ditto. 2003-09-05 Gary V. Vaughan * config/Makefile.am: Reverting yesterdays patch for VPATH builds. 2003-09-04 Gary V. Vaughan Migrate the obstack support into the gnulib directories for easy synchronisation with upstream files in gnulib: * config/gnu-obstack.m4: Moved from here... * config/m4-obstack.m4: ...to here. * config/Makefile.am (SPECIFIC_MACROS): Adjust. * m4/obstack.c, m4/obstack_.h: Moved from here... * gnulib/obstack.c, gnulib/obstack.h: ...to here. * po/POTFILES.in: Adjust. * gnulib/Makefile.am (GNULIB_SRCS, GNULIB_MACROS): Adjust. * m4/Makefile.am: Add a whole new section to link the obstack sources from the gnulib tree if necessary. * gnulib/m4/onceonly_2_57.m4, gnulib/m4/obstack.m4: New macros from gnulib. * config/m4-obstack.m4: Rewrite as a wrapper for gnulib/m4/obstack.m4. 2003-09-04 Gary V. Vaughan GNU M4 currently builds with a number of files adapted from upstream sources. Recently the gnulib project on savannah.gnu.org has pulled together a great many of these externally maintained files. This delta is the beginnings of isolating those files maintained in gnulib to make it easy to synchronise M4 with the upstream files prior to releases. * Makefile.am (ACLOCAL_AMFLAGS): Mention gnulib/m4 macro directory. (SUBDIRS): Added new gnulib subdirectory. * configure.ac (AC_CONFIG_FILES): Add new gnulib tree Makefiles. * config/stdbool.m4: Moved from here... * gnulib/m4/stdbool.m4: ...to here. * m4/stdbool_.h: Moved from here... * gnulib/lib/stdbool_.h: ...to here. * gnulib/Makefile.am: New file. Make sure the gnulib tree is distributed. * m4/Makefile.am: Adjust gnulib/modules/stdbool:Makefile.am based code to work with new stdbool_.h location. (gnulib_srcdir): New. 2003-09-04 Gary V. Vaughan * config/Makefile.am (MAINTAINERCLEANFILES, ACLOCAL_MACROS) (STANDARD_TOOLS, SPECIFIC_MACROS): Needed `$(srcdir)/' for VPATH builds to work. (SPECIFIC_TOOLS): New variable. Moved mkstamp to here. (EXTRA_DIST): Use it. * bootstrap: CVS autoreconf leaves file droppings. Remove aclocal.m4t incase autoreconf doesn't. 2003-08-29 Gary V. Vaughan * m4/gnu-obstack.h: Updated from CVS gnulib. For consistency with the other gnulib imports, renamed to m4/obstack_.h. * m4/obstack.c: Updated from CVS gnulib. * m4/Makefile.am (EXTRA_HEADERS): Adjust. * config/gnu-obstack.m4 (M4_AC_FUNC_OBSTACK): Merge in additional header tests from gnulib obstack module. AC_CONFIG_LINKS knows about vpath already, and $top_srcdir upsets CVS Automake, so the $top_srcdir reference was removed. * m4/system-h.in: For consistency with the gnulib imports, renamed to m4/system_.h. * m4/Makefile (EXTRA_HEADERS): Adjust. * configure.ac (AC_CONFIG_FILES): Adjust. * m4/stdbool_.h: New file from gnulib for systems without their own. * m4/Makefile.am: Add snippets from gnulib for C99 bool support. * config/stdbool.m4: New file. Macros from gnulib for same. * configure.ac: Use it. 2003-08-27 Gary V. Vaughan * config/debug.m4: `perl -pi.bak -e 's/(Copyright) (\d)/$1 (C) $2/g'` * config/gmp.m4: Ditto. * config/gnu-obstack.m4: Ditto. * config/stackovf.m4: Ditto. * m4/builtin.c: Ditto. * m4/debug.c: Ditto. * m4/error.c: Ditto. * m4/error.h: Ditto. * m4/gnu-obstack.h: Ditto. * m4/hash.c: Ditto. * m4/hash.h: Ditto. * m4/input.c: Ditto. * m4/m4.c: Ditto. * m4/m4module.h: Ditto. * m4/m4private.h: Ditto. * m4/macro.c: Ditto. * m4/module.c: Ditto. * m4/obstack.c: Ditto. * m4/output.c: Ditto. * m4/path.c: Ditto. * m4/regex.c: Ditto. * m4/regex.h: Ditto. * m4/strtol.c: Ditto. * m4/symtab.c: Ditto. * m4/syntax.c: Ditto. * m4/utility.c: Ditto. * m4/xmalloc.c: Ditto. * m4/xstrdup.c: Ditto. * m4/xstrzdup.c: Ditto. * modules/evalparse.c: Ditto. * modules/format.c: Ditto. * modules/gnu.c: Ditto. * modules/import.c: Ditto. * modules/load.c: Ditto. * modules/m4.c: Ditto. * modules/m4.h: Ditto. * modules/modtest.c: Ditto. * modules/mpeval.c: Ditto. * modules/perl.c: Ditto. * modules/shadow.c: Ditto. * modules/stdlib.c: Ditto. * modules/time.c: Ditto. * modules/traditional.c: Ditto. * src/freeze.c: Ditto. * src/getopt.c: Ditto. * src/getopt1.c: Ditto. * src/m4.h: Ditto. * src/main.c: Ditto. * src/stackovf.c: Ditto. * config/gmp.m4 (M4_AC_LIB_GMP): Use AC_INCLUDES_DEFAULT: ac_default_headers is an autoconf internal variable. * config/gnu-obstack.m4 (M4_AC_FUNC_OBSTACK): Ditto. * config/stackovf.m4 (M4_AC_SYS_STACKOVF): Ditto. * configure.ac (AC_CONFIG_FILES): Add tests/atlocal. * tests/Makefile.am (TESTS_ENVIRONMENT): Revert the 2003-08-14 delta. 2003-08-15 Gary V. Vaughan * configure.ac (AC_HEADER_STDBOOL, INCLUDE_STDBOOL_H): Check for C99 bool. * system-h.in (m4_boolean): Removed in favour of using C99 bool if possible or faking one with a typedef. Changed all callers. 2003-08-15 Gary V. Vaughan Still cleaning up the users' module API, by taking out the stuff that isn't used by any existing modules, and moving specialised functions out of libm4 and into the module they are used by. * m4/m4module.h (m4_skip_space): No need to export this. Moved... * m4/utility.c (m4_skip_space): ...to here the home of its only use, made static and renamed to `skip_space'. Changed all callers. * m4/m4module.h (m4_expand_ranges): Removed prototype. * m4/utility.c (m4_expand_ranges): Moved definition from here... * modules/m4.c (m4_expand_ranges): ...to here, and exported using ltdl. * modules/m4.h (m4_expand_ranges_func): For lt_dlsym import casting . * modules/gnu.c (builtin_syntax): Import and use in this builtin implementation. * m4/m4module.h (M4_DEBUG_PRINT1, M4_DEBUG_PRINT2, M4_DEBUG_PRINT3): Not used. Deleted. * m4/macro.c (trace_flush): Except here where the macro is now manually inlined. * m4/m4module.h (M4_DEBUG_MESSAGE, M4_DEBUG_MESSAGE1) (M4_DEBUG_MESSAGE2, M4_DEBUG_MESSAGE3): Only used internally, so moved... * m4/m4private.h (M4_DEBUG_MESSAGE, M4_DEBUG_MESSAGE1) (M4_DEBUG_MESSAGE2, M4_DEBUG_MESSAGE3): ...to here. 2003-08-14 Gary V. Vaughan * config/gnu-obstack.m4 (M4_AC_FUNC_OBSTACK): Use the interrim new compiler based AC_CHECK_HEADER that was introduced in autoconf-2.56. * config/stackovf.m4 (M4_AC_SYS_STACKOVF): Ditto. * config/gmp.m4 (AC_LIB_GMP): Ditto. And renamed to M4_AC_LIB_GMP. * configure.ac: Use renamed M4_AC_LIB_GMP. * config/debug.m4 (M4_AC_CHECK_DEBUGGING): Don't AC_REQUIRE a macro that requires arguments! This stops the shell's bad substitution error at configure time. * tests/Makefile.am (TESTS_ENVIRONMENT): Now we can pass make variables to the testsuite shell. Set the value of USE_GMP so that the gmp test will run! (check-local, clean-local): Use the TESTS_ENVIRONMENT variable. 2003-08-11 Gary V. Vaughan Libltdl already has an excellent mechanism for accessing C symbols in modules. Lets use that! Remove all the exporting cruft and just use lt_dlsym in conjunction with a few conventions to simplify module writers' jobs. Also removed the table address caching code and otherwise simplified the module loader quite a bit. To access exported symbols in other modules, first the exporting module must name the symbols _LTX_, and the importing module must define a function type called _func. The importer then adds M4_MODULE_IMPORT(, ) at the top of any function that wishes to call out to the exported functions. Care must be taken that is non-NULL in the importing module incase M4_MODULE_IMPORT fails, but otherwise it can be called as if the definition was in the importers source. Study `modules/{gnu.c,m4.{c,h}' for a model example. At the moment, m4_module_import will attempt to automatically load a module required for symbol access if it is not loaded already. * TODO: Removed the items fixed in this delta. * m4/ltdl.c (lt_dlhandle_find): New function to find a handle by module name. * m4/ltdl.h (lt_dlhandle_find): Declare it. * m4/module.c (m4_module_unload): Use it. * src/freeze.c (reload_frozen_state): Ditto. * m4/m4module.h (m4_export): Deleted. Removed all references. (M4_MODULE_IMPORT): New user convenience macro for importing arbitrary symbols from other modules. * m4/module.c (m4_module_import): New function to service M4_MODULE_IMPORT macro. (module_data): Removed. Looking up the tables on demand with lt_dlsym, rather than caching their addresses here simplifies the code substantially. (m4_get_module_builtin_table, m4_get_module_macro_table): Removed. Changed all callers. (set_module_macro_table, set_module_builtin_table): Renamed to install_macro_table and install_builtin_table respectively, and simplified now that the cache is no more. * modules/gnu.c (builtin_symbols): Use this new mechanism to import m4_dump_symbols from the m4 module. (builtin_esyscmd): Likewise for m4_set_sysval and m4_sysval_flush. * modules/m4.c (m4_export_table): Removed. Functions are addressed with the new mechanism which doesn't need this. (m4_set_sysval): New exported accessor function to prevent problems with variable access on inferior architectures. * modules/m4.h (m4_sysval_flush_func, m4_set_sysval_func) (m4_dump_symbols_func): Typedefs required by M4_MODULE_IMPORT so that we can have some type safety. * modules/modtest.c (export_test): C level exported function for testing the new import mechanism. * modules/import.c: New file for the import end of the test. * modules/Makefile.am (pkglibexec_LTLIBRARIES): Added import.la. * tests/modules.at: New test cases for intermodule symbol importing. 2003-08-07 Gary V. Vaughan * m4/m4module.c (m4_string): Moved from here... * m4/m4private.c (m4_string): ...to here. * m4/utility.c (dumpdef_cmp): Removed stale declaration. 2003-07-29 Gary V. Vaughan * m4/m4module.h (M4_DEFAULT_NESTING_LIMIT): This value is already available to module writers through m4_{get,set}_nesting_limit_opt(), so moved from here... * m4/m4.c (DEFAULT_NESTING_LIMIT): ...to here and renamed. (m4_create): Use it. 2003-07-28 Gary V. Vaughan Aside from auditing path.c for m4module.h api obfuscation, this delta introduces the concept of private struct members in opaque data types to GNU m4: See the STYLE file for details. * TODO: Remind ourselves that a rewrite of path.c is needed. * m4/m4module.h (m4_search_path, struct m4_search_path_info): Moved from here... * m4/m4private.h (m4__search_path, m4__search_path_info): ...to here and renamed. These type definitions are for internal api use only. Changed all callers. * m4/m4module.h (m4_search_path_env_init, m4_search_path_add): Moved from here... * m4/path.c (search_path_env_init, search_path_add): ...to here and renamed. These calls were never used outside this file. Changed all callers. (dirpath): Moved functionality of this static declaration... * m4/m4private.h (struct m4): ...to this new internal only search_path field. Changed all callers. (m4__get_search_path): Added new internal api accessor. * m4/path.c (m4_search_path_info_new): Removed. Not used. (m4_include_init): Removed... * m4/m4.c (m4_create): ...because the new m4 field is now initialised here. (m4_delete): Recycle search_path memory. * src/main.c (main): Don't call m4_include_init now that it's gone! * doc/STYLE: Document convention for private fields in opaque ADTs. 2003-07-24 Gary V. Vaughan Sometimes exporting the address of a symbol from a module isn't enough for other modules to call that symbol correctly. If custom data types are used for function parameters, they need to be known to the caller. This change introduces the concept of $(prefix)/include/modules/$(modulename).h to declare those structures. Also we move m4_dump_symbols from libm4 to the m4 module to show this concept in action. * m4/m4module.h (m4_dump_symbol_data): Moved from here... * modules/m4.h (m4_dump_symbol_data): ...to this new file for exporting data structures from modules/m4.c. * modules/m4.c, modules/gnu.c: Include it. * modules/Makefile.am (pkgmodinc_HEADERS): Install it. * m4/m4module.h (m4_dump_symbol_CB, m4_dump_symbols): Removed prototypes. * m4/utility.c (dumpdef_cmp, m4_dump_symbol_CB, m4_dump_symbols): Moved from here... * modules/m4.c (dumpdef_cmp_CB, dump_symbol_CB, m4_dump_symbols): ...to here, with slight renaming. (m4_export_table): Prototype and add m4_dump_symbols. * m4/symtab.c (m4_is_symbol_value_void): Needed for an external definition of m4_dump_symbols. * m4/m4module.h (m4_is_symbol_value_void): Prototype it. * m4/m4private.h (m4_is_symbol_value_void): Fast macro version. 2003-07-24 Gary V. Vaughan Create an export table in modules/m4.c in readiness for beefing up the module loader to track module exports and imports. * m4/m4module.h (m4_debug_flush_files): Removed prototype. * m4/debug.c (m4_debug_flush_files): Moved... * modules/m4.c (m4_sysval_flush): ...to here and renamed. * modules/gnu.c (builtin_esysval): Use it. * m4/m4module.h (m4_export): New type for declaring module symbols for export. * modules/m4.c (m4_export_table): List symbols exported from this module for use by other modules. 2003-07-24 Gary V. Vaughan An experiment: There is loads of code in libm4 which should be in the m4 module, but is also used by another module. Just because some linkers won't cope with calls across dynamic runtime loaded objects I initially left the code in libm4. It will tidy the module api immensely if this code moves to the right place, I just need to remember to invent a suitable calling mechanism at some point. For now, only modules that are statically linked and preloaded will get this treatment, so the only platforms that will break are those that require all symbols to be resolved at link time. * TODO: Reminder that what I am doing could reduce portability unless I do something more robust later. * m4/m4module.h (m4_sysval): No longer exported from libm4. * m4/utility.c (m4_sysval): No longer declared in libm4. * modules/Makefile.am: Reformatting. * modules/m4.c (m4_sysval): Declare it at place of use. * modules/gnu.c (m4_sysval): Import it for use in esyscmd. 2003-07-23 Gary V. Vaughan * m4/m4module.h: Reformatting and rearranging lines a bit. (m4_obstack): Save typing by typedefing `struct obstack'. Changed all users. (m4_call_macro, m4_expand_input): Renamed... (m4_macro_call, m4_macro_expand_input): ...to these. Changed all callers. (m4_expansion_level, m4_process_macro): Moved... * m4/macro.c (expansion_level, process_macro): ...to here, and made static. * m4/m4module.h (program_name): Not used by modules at all, so moved... * src/main.c (program_name): ...to here. (print_program_name): Renamed... (print_program_name_CB): ...to conform to the STYLE guide. 2003-07-23 Gary V. Vaughan More refactoring of the m4module.h API. Replace #defines with an enum, and move non-public functions out of the public API. * m4/debug.c (stdarg.h, varargs.h): Remove variadic header inclusion. * m4/macro.c (stdarg.h): Add ANSI C variadic header. * m4/debug.c (m4_debug, trace): Moved... * m4/m4private.h (struct m4): ...to fields of this struct. (m4_get_debug_file, m4_get_trace_messages): New fast access macros for the new fields. * m4/debug.c (m4_debug_init, m4_debug_exit): Removed functions... * src/main.c (m4_debug_init, m4_debug_exit): ...invocations... * m4/m4.c (m4_create, m4_delete): ...and handled here instead. * m4/m4module.h (m4_context_field_table): Add entries for new debug_file and trace_messages fields. (M4_DEBUG_TRACE_ARGS, M4_DEBUG_TRACE_EXPANSION) (M4_DEBUG_TRACE_QUOTE, M4_DEBUG_TRACE_ALL, M4_DEBUG_TRACE_LINE) (M4_DEBUG_TRACE_FILE, M4_DEBUG_TRACE_PATH, M4_DEBUG_TRACE_CALL) (M4_DEBUG_TRACE_INPUT, M4_DEBUG_TRACE_CALLID) (M4_DEBUG_TRACE_VERBOSE): Replaced #defines with an enum. (m4_is_debug_bit): New macro to simplfy checks against the debug bits above. (m4_trace_format, m4_trace_header, m4_trace_flush) (m4_trace_prepre, m4_trace_pre, m4_trace_post): Removed prototypes. * m4/debug.c (m4_trace_format, m4_trace_header, m4_trace_flush) (m4_trace_prepre, m4_trace_pre, m4_trace_post): Moved... * m4/macro.c (trace_format, trace_header, trace_flush) (trace_prepre, trace_pre, trace_post): ...to these newly static functions, since they are only ever used from this file. Changed all callers. 2003-07-17 Gary V. Vaughan Change the macros for checking syntax so that matching against multiple possible syntax classes can be done with a single comparison some of the time. The various classes are now bits of an int that can be checked with bitwise logic operators. * m4/m4module.h (M4_SYNTAX_IGNORE, M4_SYNTAX_OTHER) (M4_SYNTAX_SPACE, M4_SYNTAX_OPEN, M4_SYNTAX_CLOSE, M4_SYNTAX_COMMA) (M4_SYNTAX_DOLLAR, M4_SYNTAX_ACTIVE, M4_SYNTAX_ESCAPE) (M4_SYNTAX_ASSIGN, M4_SYNTAX_ALPHA, M4_SYNTAX_NUM) (M4_SYNTAX_LQUOTE, M4_SYNTAX_RQUOTE, M4_SYNTAX_BCOMM) (M4_SYNTAX_ECOMM): Replaced #defines with an enum. (M4_SYNTAX_ALNUM): Removed. Changed all callers. (M4_IS_IGNORE, M4_IS_OTHER, M4_IS_SPACE, M4_IS_OPEN, M4_IS_CLOSE) (M4_IS_COMMA, M4_IS_DOLLAR, M4_IS_ACTIVE, M4_IS_ESCAPE) (M4_IS_ASSIGN, M4_IS_ALPHA, M4_IS_NUM, M4_IS_LQUOTE, M4_IS_RQUOTE) (M4_IS_BCOMM, M4_IS_ECOMM, M4__IS_STRING, M4_IS_IDENT): Removed. Replace all calls with invocations of these... (m4_is_syntax, m4_has_syntax): ...New macros. * src/freeze.c (produce_syntax_dump): Remove mask argument, which is no longer required with new macros. Changed all callers. 2003-07-15 Gary V. Vaughan * m4/input.c (CHAR_EOF, CHAR_BUILTIN, CHAR_RETRY): These token values are returned as part of the internal interface, so they need to be moved... * m4/private.h: ...to here. * m4/macro.c (expand_token): Check for out of range m4_peek_input() results before looking up in the syntax table. (collect_arguments): Ditto. * NEWS: Note `$' syntax class. 2003-07-08 Paul Eggert and Gary V. Vaughan Conform to POSIX if the POSIXLY_CORRECT environment is set. --traditional `define' now smashes all the definitions. * NEWS: Explain this. * doc/m4.texinfo (Defn): `defn' takes any number of arguments. (Extensions): Explain that extensions that are incompatible with POSIX are disabled if POSIXLY_CORRECT is set. (Incompatibilities): Remove. (Define, Other Incompat): Explain difference between GNU and POSIX behavior of define, pushdef, popdef. * m4/m4.c (m4_get_posixly_correct_opt): New undef. * m4/m4module.h (m4_context_opt_bit_table): Add POSIXLY_CORRECT entry. * m4/m4private.h (M4_OPT_POSIXLY_CORRECT_BIT): New macro. (m4_get_posixly_correct_opt): New macro. * m4/m4macro.c (m4_process_macro): Disable $10, $abc etc. if POSIXLY_CORRECT. * modules/m4.c (builtin_functions): defn now takes any number of args. (builtin_define): Smash all the definitions if POSIXLY_CORRECT. (builtin_defn)): Allow any number of arguments. (builtin_undivert): Do not allow nonnumeric arguments if POSIXLY_CORRECT. * src/main.c (main): Set posixly-correct behavior if either POSIXLY_CORRECT is set, or if -G is given. * tests/builtins.at: New test for smashed definitions. 2003-06-27 Gary V. Vaughan * doc/m4.texinfo (Changesyntax): Document Dollar syntax class. * m4/m4module.h (M4__SYNTAX_STRING): New syntax class. Be careful not to slow the parser down. (M4__IS_STRING): New macro to test string syntax class membership. * m4/syntax.c: Adjust docucomment. (m4_syntax_create): Add a default M4_SYNTAX_DOLLAR element. (m4_syntax_code): Translate `$' -> M4_SYNTAX_DOLLAR. * m4/input.c (init_builtin_token): Comment typo. (m4__next_token): Comment typo. Accept M4_SYNTAX_DOLLAR items into M4_TOKEN_STRING type tokens by using the new M4__IS_STRING macro. * m4/macro.c (m4_process_macro): Use M4_IS_DOLLAR to test for variable references in macro expansions. * doc/m4.texinfo (Eregexp and Regexp): Typo. (Epatsubst and Patsubst): Typo. (Eval): Typo. 2003-06-26 Gary V. Vaughan Move the global variables that pertain to syntax to a new `struct m4_syntax_table', and then add one of these to `struct m4'. The ripple effect through the code to both change formerly global references, and make sure a suitable context is available in lexical scope is disproportionately large compared to the size of the change proper. This change is a large part of decoupling syntax.c from the rest of the code that uses it. * m4/m4private.h (struct m4): Add a syntax field. * m4/m4.c (m4_create): Initialise it, (m4_delete): Recycle it. (m4_get_symtab): Remove hand coded version... (m4_get_symbol_table): ...and generate this with cpp. Changed all callers. * m4/m4module.h (m4_context_field_table): Add an extra field so we can generate m4_get_symbol_table. Add a new row for m4_get_syntax_table. (M4SYNTAX): Syntactic sugar for module writers. (m4_symtab): Renamed to m4_symbol_table. Changed all callers. (m4_syntax_table): New home for syntax related formerly global variables. * m4/m4private.h (struct m4_syntax_table): Define it. * m4/input.c (m4_input_init): Initialisation of these formerly global variables moved... * m4/syntax.c (m4_syntax_create): ...to here. * m4/input.c (m4_input_exit): And similarly, recycling of the memory used by those values moved... * m4/syntax.c (m4_syntax_delete): ...to here. * m4/m4module.h (DEF_LQUOTE, DEF_RQUOTE, DEF_BCOMM, DEF_ECOMM): Moved to m4/m4private.h. * m4/syntax.c (m4_get_syntax_lquote, m4_get_syntax_rquote) (m4_get_syntax_bcomm, m4_get_syntax_ecomm) (m4_is_syntax_single_quotes, m4_is_syntax_single_comments) (m4_is_syntax_macro_escaped): New accessors for m4_syntax_table objects. Changed all callers that used to directly access the global equivalents. (m4__single_quotes, m4__single_comments, m4__use_macro_escape): Removed and incorporated into m4_syntax_table structure. * m4/utility.c (lquote, rquote, bcomm, ecomm): Ditto. * m4/syntax.c (m4_set_syntax): Now returns an error status, instead of requiring a `struct m4' to generate its own errors. Changed all callers. * src/main.c (main): Now that the syntax table is initialised as part of m4_create, we have to manually wipe the syntax entries if we are about to read a frozen file. 2003-06-26 Gary V. Vaughan * doc/STYLE: Added notes on callback naming schemes. * m4/module.c (m4_set_module_macro_table) (m4_set_module_builtin_table): Declarations weren't changed when definitions were renamed on 2003-06-19. * m4/hash.c (m4_hash_resize): ifdefed out. This function is neither used nor particularly appropriate since it exposes the internal workings of the hash module. I haven't yet decided whether to remove it entirely. 2003-06-20 Gary V. Vaughan Two related changes, and a huge knockon effect throughout the source: Moved the option variables out of global space and into `struct m4'; made `m4_symtab' a real datatype, so that its api is not marred passing `struct m4' around just so it can decide whether to keep traced symbol names or not. Added setters and getters for the formerly global option variables, and obviously changed a vast number of functions to take a `struct m4' and use the getter funcs to find option values. * m4/utility.c (interactive, sync_output, debug_level) (no_gnu_extensions, prefix_all_builtins, suppress_warnings) (max_debug_argument_length, warning_status, nesting_limit) (discard_comments): Removed. * m4/m4module (warning_status, no_gnu_extensions, nesting_limit) (debug_level, max_debug_argument_length, prefix_all_builtins) (suppress_warnings, discard_comments, interactive, sync_output): Removed from here... * m4/m4private.h (struct m4): ...and equivalent fields added to this structure. (m4_get_warning_status_opt, m4_get_no_gnu_extensions_opt) (m4_get_nesting_limit_opt, m4_get_debug_level_opt) (m4_get_max_debug_arg_length_opt, m4_get_prefix_builtins_opt) (m4_get_suppress_warnings_opt, m4_get_discard_comments_opt) (m4_get_interactive_opt, m4_get_sync_output_opt): Fast access macros for the new fields. * m4/m4module.h (m4_context_field_table) (m4_context_opt_bit_table): Helper macros used to generate prototypes, setters and getters for new option fields consistently. * m4/m4.c (m4_get_warning_status_opt, m4_get_no_gnu_extensions_opt) (m4_get_nesting_limit_opt, m4_get_debug_level_opt) (m4_get_max_debug_arg_length_opt, m4_get_prefix_builtins_opt) (m4_get_suppress_warnings_opt, m4_get_discard_comments_opt) (m4_get_interactive_opt, m4_get_sync_output_opt) (m4_set_warning_status_opt, m4_set_no_gnu_extensions_opt) (m4_set_nesting_limit_opt, m4_set_debug_level_opt) (m4_set_max_debug_arg_length_opt, m4_set_prefix_builtins_opt) (m4_set_suppress_warnings_opt, m4_set_discard_comments_opt) (m4_set_interactive_opt, m4_set_sync_output_opt): Addressable setter and getter functions generated by cpp from m4_context_field_table and m4_context_opt_bit_table, exported as part of the module api. Changed all callers. * m4/symtab (struct m4_symtab): Used as the concrete type for m4_symtab now. (m4_symtab_create): Allocate and initialise a new struct. (m4_symtab_apply): New function that works like m4_hash_apply, but with different callbacks specific to symbol tables. Changed all callers. (symbol_destroy, arg_destroy, arg_copy): Renamed symbol_destroy_CB, arg_destroy_CB, arg_copy_CB to remind me that they have unused parameters for a reason! (dump_symbol_CB): New callback to dump the contents of a single symbol. (symtob_dump): Rewritten in terms of dump_symbol_CB. * m4/utility.c (m4_dump_symbol): Renamed to m4_dump_symbol_CB. Changed all callers. * m4/m4.c (m4_create): By default point the `nuke_trace_bit' field of the contained `m4_symtab' at the `no_gnu_extensions' field. Although I'm not convinced these semantics are correct, they are at least consistent with how things were before this delta. Also set the default nesting limit to M4_DEFAULT_NESTING_LIMIT. 2003-06-19 Gary V. Vaughan Tie down the interface to libm4 some more. Make more structures opaque to modules by moving them to m4private.h, and writing setters and getters. To win back the speed penalty for doing this also wrote macroized versions that do know about structure layout in m4private.h and #include that file into modules when NDEBUG is defined at compile time. There are still some accessor macros in m4private.h that need to go, but that is not necessary to clean the module api up. * m4/m4module.h (m4_symbol_type): Moved... * m4/m4private.h (m4__symbol_type): ...to here. * m4/symtab.c (m4_get_symbol_value, m4_get_symbol_traced) (m4_set_symbol_traced, m4_set_symbol_name_traced) (m4_is_symbol_text, m4_is_symbol_func, m4_get_symbol_text) (m4_get_symbol_func, m4_symbol_value_create) (m4_symbol_value_delete, m4_set_symbol_value_text) (m4_set_symbol_value_func): New exported api to symbols. (m4_get_symbol_value_type): Replaced by m4_is_symbol_value_text and m4_is_symbol_value_func. * m4/m4module.h: Prototype these guys. * m4/module.c (m4_set_module_macro_table) (m4_set_module_builtin_table): Make these static, there is no reason to pollute the api with them. * m4/m4private.h: Reformatting. (m4_get_symtab): Only define when NDEBUG is defined. (m4_get_symbol_value, m4_get_symbol_traced) (m4_set_symbol_traced, m4_set_symbol_name_traced) (m4_is_symbol_text, m4_is_symbol_func, m4_get_symbol_text) (m4_get_symbol_func, m4_symbol_value_create) (m4_symbol_value_delete, m4_set_symbol_value_text) (m4_set_symbol_value_func): Macro implementations of the new functions when NDEBUG is defined. (SYMBOL_TRACED, SYMBOL_VALUE, SYMBOL_TYPE, SYMBOL_TEXT) (SYMBOL_FUNC, VALUE_TYPE, VALUE_TEXT, VALUE_FUNC): Removed. Superceded by the above. All callers changed. (M4ARG): Removed. This is no longer different to the m4/m4module.h definition. * modules/gnu.c, modules/m4.c: Only include m4private.h when NDEBUG is defined. That way we exercise the same (albeit slower) api that external modules must use. 2003-06-18 Gary V. Vaughan Renamed some of the types and their accessors to make more sense. Now we have a SYMTAB in which we store SYMBOLs, and each SYMBOL has a stack of SYMBOL_VALUEs. * m4/m4module.h (m4_token, m4_get_token_type, m4_get_token_text) (m4_get_token_func, m4_token_copy): Renamed to m4_symbol_value, m4_get_symbol_value_type, m4_get_symbol_value_text, m4_get_symbol_value_func and m4_symbol_value_copy respectively. Changed all callers. (m4_symbol_type): s/M4_TOKEN_/M4_SYMBOL_/ (m4_get_token_type): Renamed * m4/input.c (m4_next_token): Renamed to m4__next_token, and moved to the internal api. * m4/m4private.h: s/TOKEN_ARG_/SYMBOL_ARG_/ s/TOKEN_/VALUE_/ (m4__symtab_init, m4__symtab_exit): Removed prototypes. (m4_token_arg): Renamed to m4_symbol_arg. Changed all callers. (m4__token_type): Moved here from m4module.h. (m4__next_token): Renamed from m4_next_token. * m4/symtab.c: Removed some of the parameterised macro support functions for modularisation later. (m4_token_copy): Renamed to m4_symbol_value_copy, and use new m4_hash_dup to perform a true deep copy of the SRC. (arg_copy): Callback for m4_symbol_value_copy. * utility.c (m4_token_get_type, m4_token_text, m4_token_func): Renamed to m4_get_symbol_value_type, m4_get_symbol_value_text and m4_get_symbol_value_func. Changed all callers. 2003-06-18 Gary V. Vaughan Tidy up style of hash.[ch] in accordance with doc/STYLE. * m4/hash.c: Internal symbol renaming and formatting. (m4_hash_dup): New function to facilitate deep copies of hash tables. (m4_hash_apply_func): Returns a void* now, which is a richer type for returning exceptions (NULL means keep going). (m4_hash_apply): Ditto. * m4/hash.h: Declare exported symbols with an explicit extern. Reformated. 2003-06-17 Gary V. Vaughan Still refactoring furiously. This delta represents a change in semantics to symtab.c. Instead of building temporary m4_tokens in the caller, and copying fields in the methods, we now create the actual m4_token for hashing in the caller so the methods just slot them in directly. Also, this means that we don't lookup a symbol and get back an allocated but VOID token to copy fields into, we create the token we want to push and pass that to m4_symbol_define or m4_symbol_pushdef. And that's it. There are a few other small changes to stop knowledge of the implementation of symtab.c leaking out into other files. * m4/macro.c (expand_argument): Comment typo corrected. * m4/symtab.c (symtab_fetch): New function to fetch the address of an interned symbol. (m4_symbol_pushdef): Take an extra value parameter and use this directly as the new top of the value stack. All callers changed to build a token and pass responsibility for memory in, rather than copying as we used to. (m4_symbol_define): Also use the new value parameter directly as a replacement for the top of the value stack. All callers changed to build a token as above. (m4_set_symbol_traced): New function to set the traced bit on the named symbol, creating it if necessary. (symbol_popval): The guts of the old m4_symbol_popdef. (m4_symbol_popdef): Use it. * m4/builtin.c (m4_symbol_set_token): Removed, (m4__symbol_set_builtin, m4__symbol_set_macro): Removed and replaced... * m4/module.c (m4_set_module_builtin_table) (m4_set_module_macro_table): ...with these more orthogonal functions. * m4/m4module.h (m4_macro_pushdef, m4_macro_define) (m4_builtin_pushdef, m4_builtin_define): Removed. No longer required. * m4/builtin.c (M4_ARG_SIGNATURE_DEFAULT_SIZE) (m4_arg_signature_parse): Moved... * m4/symtab.c: ...to here. * m4/input.c (m4_token_copy): Arghh... I'm amazed this didn't screw something up. Moved... * m4/symtab.c (m4_token_copy): ...to here, and fixed so that it actually does a proper deep copy of source to dest. 2003-06-16 Gary V. Vaughan Further refactoring to stabilise the module API. Renaming some functions for orthogonality, and judicious definition migration to move things out of the set of exported symbols. * doc/STYLE: New file. Notes on coding style. * m4/m4module.c: Updated bitrotted docucomment at the top of the file. (m4_module_name, m4_module_builtins, m4_module_macros): Renamed to m4_get_module_name, m4_get_module_builtin_table, m4_get_module_macro_table which are verb phrases. Changed all callers. * m4/builtin.c (m4_builtin_table_install, m4_macro_table_install): Moved to... * m4/module.c (m4_set_module_builtin_table) (m4_set_module_macro_table): ...here, and renamed. Changed all callers. * m4/m4module.c (m4_module_data): This... * m4/m4private.c (struct m4_module_data): ...and this... * m4/module.c (module_data) ...consolidated here and no longer exported. Changed all callers. 2003-06-16 Gary V. Vaughan Begin work on lifting the curse of the global variables. To start with create a `struct m4' context container, and replace `m4__symtab' with `context->symtab' throughout. This means initialising a context container in main, and adjusting many functions between main and the module entry points so that the container gets passed through. It would have been nice to defer this until after 1.5, but it has a major effect on the user's module writing ABI, so it needs to be addressed now - at least in the areas that impact the ABI. An interrelated change in the symtab API removes the dependency on a global symbol table, and instead focuses on a passed table (from the context container). * TODO: Reminders for finishing context functionality. * m4/Makefile.am (libm4_la_SOURCES): Add m4.c. * m4/m4.c: New file. Manage new struct m4 objects to eliminate global variables and eventually allow m4 to be reentrant. * m4/m4private.h (m4): Define the new structure here... (M4_SYMTAB, m4_get_symtab): ...so we can have fast accessors that don't carry the overhead of a function call. * m4/m4module.h: Prototype extern functions from m4/m4.c. (m4): Declare type for new struct m4 objects. (M4SYMTAB): User macro to ease finding the symbol table for the current context for module developers. (m4_symbol_token): Renamed to m4_symbol_set_token which contains a verb. (M4_BUILTIN, m4_builtin_func, M4_BUILTIN_HANDLER) (m4_builtin_define, m4_builtin_pushdef, m4_builtin_table_install) (m4_call_macro, m4_dump_symbols, m4_expand_input) (M4_FINISH_HANDLER, M4_INIT_HANDLE, m4_macro_define) (m4_macro_pushdef, m4_macro_table_install, m4_module_load) (m4_module_unload, m4_process_macro, m4_symbol_set_token): Add an m4* context parameter. Changed definitions and all callers. (m4_symtab): Alias for m4_hash to decouple the m4_symtab api from m4_hash. (m4_symtab_apply, m4_symtab_apply_func): Use m4_symtab instead of m4_hash. (m4_symtab_create): New function to return an initialised m4_symtab. (m4_symtab_delete): New function to delete an m4_symtab's memory. (m4_symbol_define, m4_symbol_delete, m4_symbol_lookup) (m4_symbol_popdef, m4_symbol_pushdef): Add an m4_symtab parameter instead of simply using the global m4__symtab. Changed definitions and all callers. * m4/m4private.h (m4__symtab_remove_module_references): Ditto. * m4/symtab.c (m4__symtab_init, m4__symtab_exit): Removed. * src/main.c (main): Create a context and use that instead of the former global m4__symtab. 2003-06-13 Gary V. Vaughan * m4/hash.c (m4_hash_apply): Pass an initial hash table parameter to the callback. Callbacks should not need to hardcode the hashtable they are working from, nor should we have to waste the userdata parameter to pass the table in. * m4/hash.h (m4_hash_apply_func): Require the initial table parameter. * m4/symtab.c (symtab_destroy): Use the passed table instead of hardcoding m4__symtab. (m4_symbol_popdef): Don't use the userdata parameter to pass the table to arg_destroy. (arg_destroy): Use the hash parameter, ignore userdata. * modules/m4.c (set_trace): Make it fit the m4_hash_apply_func prototype. (traceon, traceoff): Call set_trace with the extra initial parameter. 2003-06-13 Gary V. Vaughan More refactoring to stabilise the module api, this time for symtab.c. Additionally, start to pay attention to function names that don't contain a verb like they should. * m4/m4module.h (m4_symtab_apply): Reintroduced this function as a wrapper for m4_hash_apply to decouple the symtab module from the hash module. (m4_symbol_builtin, m4_symbol_macro): Renamed to m4__symbol_set_builtin and m4__symbol_set_macro. Changed all callers. (m4_symbol_delete): Create a macro version to save a function call. (m4_token_t, m4_data_t): These violate the POSIX reserved namespace. Renamed to m4_token_type and m4_symbol_type. Changed all callers. (m4_token_type): Renamed to m4_token_get_type. (m4_symtab, m4_symtab_init, m4_symtab_remove_module_references) (m4_symtab_exit): Removed from the exported module api... * m4/m4private.h (m4__symtab, m4__symtab_init) (m4__symtab_remove_module_references, m4__symtab_exit): ...and renamed and added to the internal api. Changed all callers. (m4_symtab_apply): A faster macro version of the function for users of the internal api. * m4/symtab.c (m4_symbol_destroy, m4_arg_destroy): Renamed to symbol_destroy and arg_destroy. (symtab_debug): Added a prototype. (m4_symtab_apply, m4_symbol_delete): Moved to the end of the file so that callers in this file get the faster macro versions from m4/m4private.h. 2003-06-12 Gary V. Vaughan Refactoring modules to rationalise the API into an external documented (eventually!) API for use by modules in the `m4_' namespace declared in m4/m4module.h, an internal API between the source files we ship (including our shipped modules) in the `m4__' namespace declared in m4/m4private.h and making the rest as cohesive as possible with liberal use of the `static' keyword. This change represents an audit to m4/module.c along these guidelines. * m4/m4module.h (m4_module_close_all, m4_module_find_by_builtin): Removed. No longer used. (m4_module_close): Removed prototypes. (m4_module_init, m4_module_open, m4_module_unload_all): Removed from the exported module api... * m4/m4private.h (m4__module_init, m4__module_open) (m4__module_exit): ...and renamed and added to the internal api. Changed all callers. (BUILTIN_SYMBOL, MACRO_SYMBOL, INIT_SYMBOL, FINISH_SYMBOL): Centralised definitions after renaming... * m4/module.c (M4_BUILTIN_SYMBOL, M4_MACRO_SYMBOL, M4_INIT_SYMBOL) (M4_FINISH_SYMBOL): ...and removing from here. (m4_module_dlerror, m4_module_remove, m4_module_close) (m4_caller_id): Not exported at all, so renamed to module_dlerror, module_remove, module_close and caller_id. (MODULE_SELF_NAME): New macro to make reporting self errors easier. (m4_module_load, module_close, module_remove): Use it. * m4/m4private.h (USER_MODULE_PATH_ENV): Macro to hold "M4MODPATH" name. * src/main.c (main): Use it. 2003-06-12 Gary V. Vaughan * README: Remove references to --enable-changeword, which has been removed from the code. 2003-06-11 Gary V. Vaughan Getting rid of the annoying bug with configure --enable-debug, which spewed -e: command not found errors. This was an interaction between libtool-1.5's LT_AC_COMPILER_OPTION, and config/debug.m4. You'll need to re-bootstrap the m4 tree with cvs libtool (HEAD or branch-1-5) to get the full fix. * config/debug.m4 (M4_AC_CHECK_DEBUGGING): Require libtools version of AC_LIBTOOL_COMPILER_OPTION (which now requires LT_AC_PROG_SED), and then use the probed value of $SED. (AC_LIBTOOL_COMPILER_OPTION): Removed. Don't conditionally define this, it messes up the AC_REQUIRE stack. 2003-06-10 Gary V. Vaughan * m4/symtab.c (m4_symbol_popdef): Need to pass the hash address to the destroy callback. (m4_arg_destroy): Use the hash address to free the hash node key field. 2003-06-06 Gary V. Vaughan First cut at formal parameters in macros. * configure.ac (AC_REPLACE_FUNCS): Add xstrzdup. * m4/xstrzdup.c: New file. * m4/builtin.c (M4_ARG_SIGNATURE_DEFAULT_SIZE): Start size for associative array of parameter names to details. (m4_symbol_token): Capture macro names with parameter lists. (m4_arg_signature_parse): And build an associative array to hang from the symbol structure to map names to details. * m4/hash.c (m4_hash_new): Break the m4_hash_new followed by m4_hash_resize idiom. Now that we potentially add a little hash table to many of the entries in the symbol table, added an extra arg to set the initial size. Changed all callers. (m4_hash_apply): New function that is basically a generalised version of... * m4/symtab.c (m4_symbol_apply): ...this. Now deleted. Adjusted all callers to call m4_hash_apply instead. (m4_arg_destroy): Recycle memory used by an m4_token_arg. (m4_symbol_popdef): Use m4_arg_destroy to help recycle the m4_arg_signature association that might be attached to the symbol, * m4/hash.h (m4_hash_apply_func): Replacement type for... * m4/m4module.h (m4_symtab_apply_func): ...this. Now deleted. (M4_SYNTAX_ASSIGN): Placeholder for assigning default values in parameter lists. (M4_IS_ASSIGN): Detect characters with M4_SYNTAX_ASSIGN syntax. (M4_IS_IDENT): Detect characters that can be safely used in parameter names. * m4/syntax.c (m4_syntax_init): Add an M4_SYNTAX_ASSIGN character. * m4/macro.c: Corrected grammar in some comments. Use `token' rather than `td' for m4_token variables. (m4_process_macro): If we find a dollar followed by some M4_IS_IDENT characters, replace that with the contents of the argv entry with offset stored in the m4_token_arg associated with the collected identifier. 2003-06-05 Gary V. Vaughan Begin preparations for supporting formal parameters in m4 macros. * m4/m4private.h (struct m4_token_arg): Placeholder for holding the details of a formal parameter. (m4_token): Add an arg_signature member to hold a hash table for looking up formal parameters. * m4/input.c: Update more bitrotted comments. (m4_push_builtin): Initialise arg_signature member. (init_builtin_token): Copy arg_signature member. * m4/m4module.h (m4_builtin_pushdef, m4_builtin_define) (m4_macro_pushdef, m4_macro_define): Rewritten as macros to replace... * m4/builtin.c (m4_builtin_pushdef, m4_builtin_define) (m4_macro_pushdef, m4_macro_define): ...these, And... (m4_symbol_token): ...wrapped around this new function, which vastly simplifies the arguments required by the functions it replaces. Changed all callers. 2003-06-05 Gary V. Vaughan * m4/macro.c: Format changes. 2003-06-04 Gary V. Vaughan * m4/input.c: Updated various bitrotted comments. (m4_push_builtin): Just pass the whole m4_token, rather than extracting all the fields in the caller. This also allows us to check the token type for consistency. (macro_funcs, macro_peek, macro_read, m4_push_macro, CHAR_MACRO): Renamed to builtin_funcs, builtin_peek, builtin_read, m4_push_builtin and CHAR_BUILTIN for consistency with the rest of the code. Changed all callers. (struct input_block): Similarly renamed u_m member to u_b, and changed all callers. (m4_next_token): Use bzero to initialise the data fields. * m4/m4module (m4_push_macro): Renamed to m4_push_builtin. 2003-05-29 Gary V. Vaughan These changes were necessary to get m4 to build on my iBook running "powerpc-apple-darwin6.6" using Apples build of gcc "gcc (GCC) 3.1 20020420 (prerelease)": * src/main.c: Don't include dlfcn.h, ltdl.h handles correct inclusion of module loader headers. * modules/Makefile.am: Use AM_LDFLAGS, not LDFLAGS. * m4/Makefile.am: Ditto. (libm4_la_LIBADD): Added $(LTLIBINTL). * m4/utility.c (program_name): Removed declaration in favour of the one already in error.c! * m4/m4module.h (program_name): Define to program_invocation_name when using GNU C library. Use an explicit extern declaration. (interactive, sync_output, debug_level, hash_table_size) (no_gnu_extensions, prefix_all_builtins, max_debug_argument_length) (suppress_warnings, warning_status, nesting_limit, discard_comments) (lquote, rquote, bcomm, ecomm, m4_bad_argc, m4_skip_space) (m4_numeric_arg, m4_shipout_int, m4_shipout_string, m4_dump_args) (m4_debug, m4_debug_init, m4_debug_exit, m4_debug_decode) (m4_debug_flush_files, m4_debug_set_output, m4_debug_message_prefix) (m4_trace_prepre, m4_trace_pre, m4_trace_post, m4_sysval) (m4_expansion_level, m4_expand_ranges, m4_expand_input) (m4_call_macro, m4_process_macro, m4_syntax_table, m4_current_file) (m4_current_line, m4_current_diversion, m4_output_current_line): Don't rely on default, use an explicit extern. * m4/error.h (error, error_at_line, error_print_progname) (error_message_count, error_one_per_line): Ditto. * m4/ltdl.c: Update from CVS libtool. * m4/ltdl.h: Ditto. * commit: Update from CVS cvs-utils. 2002-11-04 gettextize * po/Makefile.in.in: Upgrade to gettext-0.11.5. * po/boldquot.sed: New file, from gettext-0.11.5. * po/en@boldquot.header: New file, from gettext-0.11.5. * po/en@quot.header: New file, from gettext-0.11.5. * po/insert-header.sin: New file, from gettext-0.11.5. * po/quot.sed: New file, from gettext-0.11.5. * po/remove-potcdate.sin: New file, from gettext-0.11.5. * po/Rules-quot: New file, from gettext-0.11.5. 2002-11-04 Akim Demaille * doc/m4.texinfo (Esyscmd): Don't grep, use something easier: running m4 itself. * tests/others.at (iso8859): Use abs_srcdir, not srcdir. 2002-11-04 Akim Demaille * config/Makefile.am (ACLOCAL_MACROS): Ship the Gettext macros. 2002-11-04 Akim Demaille * configure.ac: Automake 1.7.1, Autoconf 2.54, Gettext 0.11.5, used as `external', and Libtool 1.4.3. (LINGUAS): Remove. (LTLIBOBJS): Don't play with it. * intl/: Remove. * Makefile.am (SUBDIRS): Remove intl. (ACLOCAL_AMFLAGS): Add -I config. (EXTRA_DIST): Add config/config.rpath. * po/LINGUAS: New. * po/Makevars: New. * modules/perl.c (M4INIT_HANDLER): Don't prototype xs_init. 2002-05-29 Gary V. Vaughan Preparations for refactoring syntax tables to allow reverse lookups [fetch me a M4_SYNTAX_OPEN], without compromising the speed of normal lookups in an array of unsigned short. * m4/input.c (single_quotes, single_comments, use_macro_escape): Moved from here... * m4/m4private.h (m4__single_quotes, m4__single_comments, m4__use_macro_escape): ...to here, and renamed. The `m4__' prefix is for internal symbols which unavoidably pollute the global namespace, but are not published APIs. Adjusted all callers. * m4/input.c (m4_syntax_init, m4_syntax_code, m4_set_quotes, m4_set_comment, m4_set_syntax, set_syntax_internal, unset_syntax_attribute): Moved from this file... * m4/syntax.c: New. ...to this file. Also added an m4_syntax_exit stub for orthogonality. * src/main.c (main): Use it. * m4/Makefile.am (libm4_la_SOURCES): Add syntax.c. * m4/m4module.h: Reformatting. New prototypes. 2002-05-29 Gary V. Vaughan * bootstrap (aclocal_apiversion): The aclocal apiversion is distinct from the automake release number (in that the apiversion apparently has no micro-version-component). (aclocal_apilibdir): Use it. 2002-05-28 Gary V. Vaughan * m4/hash.c (m4_hash_resize): New function. * m4/hash.h: Add prototype. * m4/symtab.c (m4_symtab_init): Use it. This could do with some benchmarking to find a good value for, say, autoconf. This is already a little quicker than before for me. * m4/symtab.c (m4_symtab_hash, m4_symtab_cmp): Moved from here... * m4/hash.c (m4_hash_string_hash, m4_hash_string_cmp): .. to here, and reenamed. * m4/hash.h: Adjust prototypes. 2002-01-22 Akim Demaille * bootstrap (aclocal_apilibdir): New, to cope with Automake's new APIVERSION scheme. * tests/Makefile.am (package.m4): New. * tests/atlocal.in: Adjust to CVS Autotest. * config/gnu-obstack.m4 (M4_AC_FUNC_OBSTACK): Use AC_LIBOBJ. * configure.ac: LIBOBJ is a forbidden string. Simplify AM_INIT_AUTOMAKE invocation. * config/Makefile.am (ACLOCAL_MACROS): Add amversion.m4 and options.m4. 2002-01-21 gettextize * po/Makefile.in.in: Upgrade to gettext-0.10.40. 2001-10-19 Akim Demaille * m4/module.c, m4/output.c, src/main.c: Normalize error messages. 2001-10-19 Akim Demaille * m4/input.c (m4_next_token): Display where was opened what is not closed. 2001-10-19 Akim Demaille * m4/macro.c (expand_argument): Display where was opened what is not closed. 2001-10-18 Akim Demaille * m4/input.c, modules/m4.c: Formatting changes. 2001-10-17 Gary V. Vaughan * bootstrap: s/configure.in/configure.ac/ 2001-10-16 Gary V. Vaughan * m4/symtab.c (m4_symbol_destroy): This function calls m4_symbol_popdef, which recycles a symbols memory when the last definition is popped. Since we were passing the address of the symbol name found in the symbol table, and it was being removed partway through m4_symbol_destroy() we were referencing freed memory for the balance of the function. Now we take a copy of the symbol name tring and use that as a key into the symbol table... that way if the original symbol name is freed, the copy is still valid. 2001-10-13 Akim Demaille * m4/ltdl.c: Update. 2001-10-13 Akim Demaille * src/main.c, src/freeze.c, m4/debug.c, m4/input.c, m4/macro.c: Don't gettextize internal error messages. 2001-10-13 Akim Demaille * tests/macros.at (Arity and defn): New failing test. (Arity, defn, and freeze): New. Fix `Arity and defn'. * m4/input.c (m4_push_macro): Don't forget the arity. * modules/m4.c (defn): Likewise. 2001-10-13 Akim Demaille * tests/builtins.at (pushdef/popdef, trace, trace2, trace3): Move to... * tests/macros.at (pushdef/popdef, Tracing Hanoi Towers) (Propagation of traceon, Propagation of --trace): this new file. 2001-10-13 Akim Demaille * m4/utility.c (m4_numeric_arg): Use the usual (argc, argv, ...) interface instead of (name, argc...). Upon failure, specify which argument was guilty. Adjust callers. 2001-10-13 Akim Demaille * modules/evalparse.c: Save translators' time: don't translate internal error messages. (m4_evaluate): Simplify/normalize error messages. * doc/m4.texinfo (Eval): Adjust. 2001-10-13 Akim Demaille * m4/macro.c (expand_macro): Let m4_bad_argc handle the cases where no checking is needed. * m4/utility.c (m4_bad_argc): Use the usual (argc, argv, ...) interface instead of (name, argc...). Adjust callers. * modules/gnu.c (m4_patsubst_do): Don't check argc, done elsewhere. 2001-10-13 Akim Demaille * m4/utility.c (m4_bad_argc): Display user argument counts, i.e., exclude the builtin name from the count. * modules/m4.c (ifelse): Do not use the regular argc mechanism, as calling ifelse with a single argument is valid. * doc/m4.texinfo (Ifelse): Add an example where ifelse is invoked with 1 and 2 args, mostly to strengthen the test suite. 2001-10-13 Akim Demaille * m4/output.c (m4_make_diversion, m4_insert_file) (m4_insert_diversion, +m4_freeze_diversions): Ansify. 2001-10-12 Gary V. Vaughan * m4/input.c (init_builtin_token): Renamed from init_macro_token, since we call these things builtins in the rest of the code! * modules/gnu.c (m4_regexp_compile): s/%0/%s/ 2001-10-12 Gary V. Vaughan Rather than forcing each builtin definition to manage its own argument range checking, tabulate the maxima and minima for all builtins in each module. This forces us to consider what the valid ranges for each builtin should be, and moves the checking code out of each builtin implementation and into the builtin caller infrastructure. * m4/m4module.h (struct m4_builtin): Add argument minima and maxima. * m4/m4private.h (struct m4_token): Reflect them here too. * m4/input.c (struct input_block): ...and here. (m4_token_copy): New function for token copying. (init_macro_token): Copy them from a token to the input stack. (m4_next_token): Don't forget to initialise them for text macros. * m4/macro.c (expand_argument): Use m4_token_copy, and also check argument counts before calling the builtin handler. * m4/symtab.c (m4_symbol_builtin): Take minima and maxima params. (m4_symbol_macro): Likewise. * m4/builtin.c (m4_builtin_pushdef): Add min_args and max_args parameters. Updated all callers. (m4_builtin_define): Ditto. (m4_macro_pushdef, m4_macro_define): Ditto. * m4/symtab.c (m4_symbol_builtin, m4_symbol_define): Ditto. * modules/evalparse.c: Declare argument counts for defined builtins and remove explicit calls to m4_bad_argc(). * modules/gnu.c: Ditto. * modules/load.c: Ditto. * modules/m4.c: Ditto. * modules/modtest.c: Ditto. * modules/mpeval.c: Ditto. * modules/perl.c: Ditto. * modules/shadow.c: Ditto. * modules/stdlib.c: Ditto. * modules/time.c: Ditto. * TODO: Updated. 2001-10-10 Gary V. Vaughan The trace semantics now attach the trace bit to a symbol name. For as long as a traceon(`foo') is active, calls to foo will be traced regardless of intervening undefines or module unloads. Fixed the flag propogation issues differently to the fixes reverted with the last attempt at nailing down trace: * m4/m4private.h: This file is not visible outside of the m4 source tree, so I removed all the `M4_' and `m4_' prefixes to save on typing. Updated all clients. (m4_token): New typedef contains the fields that need to be passed around with the low level tokeniser. (m4_token_data): Removed. (m4_symbol): Now contains the traced flag again. * m4/symtab.c: Rewritten again. Now we don't remove symbols with the trace bit set. This change is contained entirely within this module and doesn't leak out into the callers. Updated all clients. (m4_symbol_builtin, m4_symbol_macro): Adjusted to make use of the new fields in m4_token. Updated all clients. * m4/builtin.c (m4_builtin_pushdef): Needs a flags argument so that `groks_macro_args' and `blind_if_no_args' flags are retained when defn() results are passed around in m4 code. Updated all callers. (m4_builtin_define): Ditto. (m4_macro_pushdef, m4_macro_define): Ditto. * m4/input.c (struct input_block): Add a flags field to facilitate the above. (m4_push_macro): ...use it. (init_macro_token): Retrieve it. (m4_next_token): Initialise it. * m4/macro.c (expand_argument): Copy it. * m4/m4module.h: Adjust. * tests/builtins.at: Adjust the expected output of the trace tests to reflect the change in semantics. * tests/modules.at (modules: trace): Check that unloading a module which supplies a traced symbol definition doesn't lose te trace bit. 2001-10-07 Gary V. Vaughan * modules/gnu.c (m4_macro_table): Display the timetamp when expanding __m4_version__. * configure.ac (--with-modules): Forgot a comma in the AC_HELP_STRING parameter list. 2001-10-05 Gary V. Vaughan * bootstrap: Remove aclocal.m4t when it is no longer required. 2001-10-05 Akim Demaille * tests/Makefile.am: Adjust for gnuprog2. * tests/m4.in: There can be a leading path. * tests/modules.at (AT_CHECK_M4_MODTEST): No need for $4 and $5. * tests/testsuite.at: Adjust to the most recent Autotest. (AT_CHECK_M4_FILTER): Fix and rename as... (AT_TEST_M4): this. * tests/others.at: Use it. * config/gmp.m4 (_AC_LIB_GMP): In order to read the content of a variable in shell scripts, one uses `$'... 2001-10-04 Gary V. Vaughan * configure.ac: `rm -f $m4_getopt_h' was lost. 2001-10-04 Gary V. Vaughan * configure.ac (TIMESTAMP): Display with AS_BOX at configure time. Define it for config.h in order to... * src/main.c (main): ...display the timestamp for --version. 2001-10-04 Akim Demaille * modules/gnu.c (m4_regexp_do, m4_patsubst_do): Extracted from previous builtins `regexp' and `patsubst'. (regexp, patsubst): Use them. (eregexp, epatsubst): New builtins. * doc/m4.texinfo (Patsubst, Regexp): Rename and complete as... (Epatsubst and Patsubst, Eregexp and Regexp): these. (Extensions): More info on REs. 2001-10-04 Akim Demaille * modules/modtest.c (init_handler): Consistently output to stderr. (finish_handler): New. (test): The `if' is an `assert'. * tests/modules.at: Adjust. 2001-10-04 Akim Demaille * m4/utility.c (m4_bad_argc): Detail the mismatches. 2001-10-01 Akim Demaille * tests/generate.awk: Tag the tests with `documentation'. * tests/modules.at (AT_CHECK_M4_MODTEST): New. Use the make the existing modtest tests more uniform, and complete the set of possibilities. 2001-10-01 Akim Demaille * config/gmp.m4: Consult the user before using GMP: use --without-gmp. * configure.ac: Adjust. * modules/gmp.c: No protection needed as the module is not built if GMP is not used. 2001-10-01 Akim Demaille * tests/generate.awk: Remove debugging code. (fatal): Specify the current location. * m4/debug.c, m4/macro.c, m4/utility.c, modules/format.c, * modules/gnu.c, modules/m4.c: Use M4ARG. 2001-10-01 Akim Demaille * modules/gnu.c (RE_SYNTAX_BRE, RE_SYNTAX_ERE): New. (m4_regexp_compile): New. (regexp, patsubst): Use it. 2001-09-30 Gary V. Vaughan Reinstate the memory handling improvements from the patch I just reverted. Relevant ChangeLog entries repeated here: * m4/module.c (m4_module_remove): New function that holds the core of the old m4_module_unload. (m4_module_unload): Use it. (m4_module_unload_all): When we know the modules will never be used again (i.e. on exit), free up as much module memory as possible. There are still some artifacts from resident modules living inside ltdl.c, but everything else is freed. * m4/debug.c (m4_debug_exit): Free memory allocated in m4_debug_init(). * m4/input.c (m4_input_exit): Ditto wrt m4_input_init(). * m4/output.c (m4_output_exit): Ditto wrt m4_output_init (). * src/stackovf.c (stackovf_exit): Ditto wrt setup_stackovf_trap (). * m4/m4module.h: Updated prototypes. * m4/hash.c (m4_hash_exit): Free the nodes on the free list. * m4/hash.h: Updated prototypes. * src/main.c (main): Use all these new functions to clean up as much memory as possible before exit. 2001-09-30 Gary V. Vaughan Reverted my large patch for removing the old m4_symbol structure on 2001-09-20. We are still not happy about the way trace works in conjunction with defn and undefine, and leaving the reverted patch active prevents us from moving the traced bit from the definition back to the symbol. 2001-09-30 Gary V. Vaughan * configure.in: Moved to... * configure.ac: ...here. Added a libtool like timestamped banner, and tidied up the libltdl cruft. * config/mkstamp: Script to extract a timestamp from ChangeLog. * modules/Makefile.am (INCLTDL): Removed. This is required only when libltdl is configured in a subdirectory. * src/Makefile.am: Ditto. (LIBADD_DL): No need to add this again, libtool already knows that libm4.la depends on it. * m4/Makefile.am: Automake sets variables from AC_SUBST. Use them. * TODO: stackovf.c is basically broken. Reported by Marc Espie 2001-09-28 Akim Demaille * tests/Makefile.am (EXTRA_DIST): `m4' is not to be shipped. 2001-09-27 Akim Demaille * tests/m4.in: Don't use short options. Simplify the stderr signature normalization. 2001-09-27 Akim Demaille tests/m4 shall be position independent. * tests/m4.in: New. * tests/m4: Remove. * tests/testsuite.at: No args to AT_INIT. * configure.in, tests/Makefile.am: Adjust. 2001-09-22 Akim Demaille Autotest has changed again. * tests/Makefile.am (DISTCLEANFILES): Add package.m4. (package.m4): Remove. * configure.in: Adjust to LIBADD_GMP. 2001-09-21 Gary V. Vaughan * config/gmp.m4 (AC_ARG_WITH): Removed. (GMP_LIB): Renamed to LIBADD_GMP for consistency. (AC_LIB_GMP): When performing a test compile against libgmp, include the header gmp.h if possible, and link against -lgmp. If they both work define USE_GMP. * modules/Makefile.am (mpeval_la_LIBADD): Add LIBADD_GMP. (mpeval_LTX_init_func): Complain on load that there was no libgmp at compile time. 2001-09-20 Gary V. Vaughan * m4/evalparse.c: Moved to... * modules/evalparse.c: ...here. This code is shared between modules/mpeval.c and modules/m4.c, so there is no need to pollute the libm4 API with its details. Moderately rewritten to interface into its clients more simply. * m4/eval.c: Deleted. Migrated functionality to... * modules/m4.c: ...here. (builtin_eval): Implemented in terms of the new interface style. * modules/mpeval.c (builtin_mpeval): Ditto. * m4/m4module.h: Removed references to the former m4/eval.c. * m4/Makefile.am (libm4_la_SOURCES): Removed eval.c. (EXTRA_libm4_la_SOURCES): Deleted. * modules/Makefile.am (EXTRA_m4_la_SOURCES): Reference evalparse.c. (EXTRA_mpeval_la_SOURCES): Reference evalparse.c. 2001-09-20 Akim Demaille * config/gmp.m4 (AM_WITH_GMP): Rename as... (AC_LIB_GMP): this. By default, use gmp. Massive revamping. * configure.in: Adjust. Use Automake conditionals for USE_GMP. Always compute sizeof (long long int). This was a bug BTW, as `eval' (not `mpeval') depends on it: before, it was used _only_ if mpeval was not activated. * modules/Makefile.am (pkglibexec2dir, +pkglibexec2_LTLIBRARIES) (mpeval_la_LIBADD): New macros. * modules/mpeval.c: No longer be conditioned by WITH_GMP. Indent. * tests/Makefile.am ($(srcdir)/$(TESTSUITE)): Create package.m4. * tests/atlocal.in, tests/builtins.at: Depend upon USE_GMP, not WITH_GMP. 2001-09-20 Akim Demaille * tests/Makefile.am (package.m4): New. * tests/testsuite.at: Adjust AT_INIT and AT_VICTIMS. 2001-09-20 Gary V. Vaughan More cleanup. After the last patch, m4_symbol holds nothing but the head of a chain of m4_token_data. So I have removed the old m4_symbol, so that m4_token_data chains are stored directly in the value cell of a hash table node. But there's more... m4_symbol was a more natural name for the symbol value cell, and now that it is gone I have renamed the former m4_token_data structure to m4_symbol. This change turned out to be a pig to get right, since the original code didn't need to modify the value cell itself, since changing the chain happened inside the m4_symbol that used to be returned -- I had to pass the address of the value cell across various function calls, incase the head value changed. I also tightened up the memory management to help me find a nasty memory corruption bug that took me all night to track down... * m4/m4private.h (struct m4_symbol): Removed. (struct m4_token_data): Renamed to `struct m4_symbol'. Updated all references. * m4/hash.c (m4_hash_iterator_value): Return the address of the value cell. Updated all callers. * m4/symtab.c: Took advantage of the simplification in the data structures to rewrite a lot of this file more simply. There is still some room for optimisation here, but we should tackle that systematically closer to the release. * m4/ltdl.c: Added dmalloc support, and fixed some memory leaks it revealed. This version is ahead of CVS libtool until I get chance to flush my changes. * m4/module.c (m4_module_remove): New function that holds the core of the old m4_module_unload. (m4_module_unload): Use it. (m4_module_unload_all): When we know the modules will never be used again (i.e. on exit), free up as much module memory as possible. There are still some artifacts from resident modules living inside ltdl.c, but everything else is freed. * m4/debug.c (m4_debug_exit): Free memory allocated in m4_debug_init(). * m4/input.c (m4_input_exit): Ditto wrt m4_input_init(). * m4/output.c (m4_output_exit): Ditto wrt m4_output_init (). * src/stackovf.c (stackovf_exit): Ditto wrt setup_stackovf_trap (). * m4/m4module.h: Updated prototypes. * m4/hash.c (m4_hash_exit): Free the nodes on the free list. * m4/hash.h: Updated prototypes. * src/main.c (main): Use all these new functions to clean up as much memory as possible before exit. 2001-09-18 Gary V. Vaughan The `traced' flag needs to be attached to the definition of a symbol rather than the current symbol containing the definition. Implementing this showed up some long standing post 1.4 bugs in flag propogation which I also fixed. * m4/m4private.h (struct m4_symbol): Remove the traced flag. (struct m4_token_data): And add it back in here. * m4/input.c (init_macro_token): Propogate the traced flag correctly. * m4/macro.c (expand_argument): Ditto. * tests/builtins.at (trace2, trace3): New tests based on Akim's sadistic email ;-) 2001-09-08 Gary V. Vaughan * m4/m4private.h (struct m4_token_data): Simplified by removing the redundant `traced' flag, and one level of structure nesting. (M4_TOKEN_DATA_FUNC_TRACED): Removed. * m4/input.c (init_macro_token): No need to initialise removed `traced' field. * m4/macro.c (expand_argument): No need to copy it either. * m4/utility.c (m4_token_data_func_traced): Or provide an access function. * m4/hash.c (m4_hash_bucket_insert): Symbol shadowing is no longer dependant on multiple symbols with the same key, so preserving relative symbol order in each bucket during resizing is no longer required. The resize function is considerably faster as a result. * m4/m4module.h, m4/builtin.c, m4/symtab.c: s/m4_symbol_insert/m4_symbol_define/g; s/m4_builtin_insert/m4_builtin_define/g; s/m4_macro_insert/m4_macro_define/g. Updated all callers. 2001-09-08 Gary V. Vaughan Get rid of m4_symbol_lookup_t entirely. With Akim's earlier commits, the m4_lookup_symbol dispatch function is split into specialised functions that must be called directly. * m4/m4module.h (m4_symbol_lookup_t): Removed. * m4/symtab.c (m4_lookup_symbol): Removed. (m4_symbol_builtin, m4_symbol_macro): New functions. * m4/builtin.c (m4_builtin_define): Split into... (m4_builtin_pushdef, m4_builtin_insert): ...these. (m4_macro_define): Split into... (m4_macro_pushdef, m4_macro_insert): ...these. * src/main.c (main): Set command line macros from `-D' parameters using `m4_macro_define'. 2001-09-08 Gary V. Vaughan * m4/symtab.c (m4_symtab_remove_module_references): Renamed as this from m4_remove_table_reference_symbols(). * m4/m4module.h, m4/module.c: Updated all references. 2001-09-07 Akim Demaille * modules/stdlib.c, modules/times.c: Misc cleanups. 2001-09-07 Akim Demaille * configure.in: We now need Autoconf 2.52e. * m4/m4module.h (m4_symbol_lookup_t): Remove `M4_SYMBOL_POPDEF' and `M4_SYMBOL_DELETE'. * m4/symtab.c (m4_lookup_symbol, symtab_debug): Adjust. * src/main.c (main): Adjust. 2001-09-06 Gary V. Vaughan Fix the obstack.h problem once and for all! At configure time we can test for a system supplied obstack.h: depending on the result, we now generate system.h with an #include of the correct header. As a bonus, I've also added a --with-included-obstack, incase the user doesn't like the system obstack for some reason... and also we can test the shipped obstack on a system that has oe of its own. We also now need to be careful to add build directories to the include search path, since the generated system.h will be in the build tree. * configure.in (AC_CONFIG_FILES): Generate system.h from system-h.in. * config/gnu-obstack.m4 (M4_AC_FUNC_OBSTACK): Determine whether to include the system obstack header or the copy shipped with M4. Allow the user to override configure and force the build to use the shipped version. * m4/system-h.in: New file, template for... * m4/system.h: ...this. Now deleted. * m4/m4module.h: Include system.h before everything else. * src/freeze.c: Ditto. * m4/Makefile.am (dist-hook): Remove generated system.h. (INCLUDES): Check builddir for generated headers before checking srcdir. * modules/Makefile.am (INCLUDES): Ditto. * src/Makefile.am (INCLUDES): Ditto. 2001-09-05 Gary V. Vaughan * TODO: Remove the items that have been addressed already. 2001-09-05 Akim Demaille * src/main.c (main): Standardize --version. 2001-09-05 Akim Demaille * modules/format.c (format): Have a bigger `str'. 2001-09-05 Akim Demaille Rationalize warnings, reporting the macro name as if it were a program name, and assertions. * m4/m4module.h (m4_lookup_symbol): Prototype, it is still used. (M4WARN): New. * m4/symtab.c (m4_lookup_symbol, m4_symbol_popdef) (m4_symbol_delete): Use assert for internal errors. * m4/utility.c (m4_bad_argc, m4_numeric_arg, m4_dump_symbols): Use M4WARN. * modules/m4.c (undefine, defn, traceon, traceoff, dumpdef): use M4WARN and assert. * tests/builtins.at (pushpop): Adjust. 2001-09-05 Akim Demaille * m4/symtab.c (m4_symbol_insert): Don't use `foo () || bar ()' with pointers. 2001-09-05 Akim Demaille * m4/m4module.h (m4_symbol_lookup): Remove M4_SYMBOL_LOOKUP. * m4/macro.c, m4/symtab.c: Adjust. 2001-09-05 Akim Demaille * m4/symtab.c (m4_symbol_popdef, m4_symbol_delete): Rename as... (m4_symbol_pop, m4_symbol_del): this. (m4_symbol_lookup, m4_symbol_pushdef, m4_symbol_insert) (m4_symbol_popdef, m4_symbol_delete): New. (m4_lookup_symbol): Adjust. * m4/m4module.h, src/main.c, modules/gnu.c, modules/m4.c: Adjust. 2001-09-05 Akim Demaille * m4/m4module.h (m4_symbol_lookup): Rename as... (m4_symbol_lookup_t): this. 2001-09-05 Akim Demaille * m4/m4module.h (m4_symbol_lookup): Remove M4_SYMBOL_IGNORE, unused. * m4/symtab.c (m4_lookup_symbol): Adjust. 2001-09-03 Gary V. Vaughan Bootstrap will now work with Libtool 1.4.1 or higher: * bootstrap: Remove stale autom4te.cache files when rebootstrapping. * config/Makefile.am (ACLOCAL_MACROS): Add ltdl.m4 and libtool.m4. * bootstrap: Ignore acinclude.m4 now the we include ltdl.m4 and libtool.m4 directly. Run libtoolize to refresh ltmain.sh. * config/ltmain.sh: Deleted. * acinclude.m4: Deleted. * m4/ltdl.c, m4/ltdl.h: Updated from libtool-1.4.1. * config/debug.m4 (AC_LIBTOOL_COMPILER_OPTION): Provide a fallback implementation for the cvs impaired libtool user. 2001-09-03 Akim Demaille * m4/symtab.c (m4_lookup_symbol): Give more details when reporting internal errors. Avoid using `default' in switch, as it hides useful compiler warnings when a case is forgotten. 2001-09-03 Akim Demaille * src/main.c (MODULE_SHORTOPT, MODULEPATH_SHORTOPT): Remove, there is no such thing as `WITH_MODULES'. 2001-09-03 Akim Demaille Improve the test suite's selfcontainedness. * doc/m4.texinfo: Let `input.m4' be the input file, not `in'. (Include, Undivert): Tag the other input files. * tests/generate.awk: Catch `@comment file:'. `-I $src' is no longer needed. `next' is really like `return': the rest is skipped. Adjust to `input.m4'. (fatal): New function. * tests/foo, tests/incl.m4: Remove. 2001-09-01 Gary V. Vaughan The shadowing mechanism and, infact, the whole symbol table implementation was creaking under the weight of the features piled on top of it. We now have a separate hash table module which will dynamically resize to keep symbol density withing good performace limits, and a new symtab module layered above it. Symbol lookups are now marginally more efficient (since the shadowed flag is no longer required) and symbol removal, such as on module unload, is considerably faster due to a reorganisation of the data structures used in symtab.c. * src/main.c (main): Don't mention `-H'. * doc/m4.texinfo (Invoking m4): Document that -H no longer has any effect. * NEWS: Updated. * m4/hash.c: New generalised dynamic hash table data structure management module. * m4/hash.h: Public interface. * m4/Makefile.am (pkginc_HEADERS): Add hash.h. (libm4_la_SOURCES): Add hash.c. * m4/symtab.c: More or less rewritten from scratch, within the bounds of the previous API. (m4_symtab_apply): A cleaner version of the old hack_all_symbols call. Updated all callers. * m4/m4module.c: #include , and changed all affected declarations to reflect API changes. (M4INIT): Generate a declaration too, to avoid the warning with --enable-debug builds. (M4FINISH): Ditto. (HASHMAX): Removed. * m4/utility.c (hash_table_size): Removed. (m4_dump_symbols): Rewritten to build and qsort an array of symbol names, which are then looked up by builtin_dumpdef() as necessary. This implies a small speedup in builtin_symbols(), which discarded all of the symbol info under the old call. * m4/m4private.h (m4_symbol): Removed shadowed flag -- symbol shadowing is implicit in respect to the new data structures. symbol names are no longer duplicated here, they are stored in the key field of the hash table. Moved macro_args and blind_no_args... (m4_token_data): ...to here. m4/macro.c (expand_macro): Added a name argument since the symbol name is no longer copied into each struct m4_symbol. Modified all callers. (collect_arguments): Ditto. * modules/m4.c (set_trace): Ditto. * modules/gnu.c (builtin_symbols): Updated. * src/freeze.c (produce_symbol_dump): Much improved in light of the improved symbol table layout. 2001-09-01 Gary V. Vaughan * m4/m4private.h (SYMBOL_NEXT): Move into m4's name space; renamed to M4_SYMBOL_NEXT. (SYMBOL_TRACED): Similarly renamed by prefixing with `M4_'. (SYMBOL_SHADOWED, SYMBOL_MACRO_ARGS, SYMBOL_BLIND_NO_ARGS, SYMBOL_NAME, SYMBOL_TYPE, SYMBOL_TEXT, SYMBOL_FUNC, SYMBOL_HANDLE): Ditto. * m4/builtin.c, m4/macro.c, m4/symtab.c, m4/utility.c, modules/gnu.c, modules/m4.c, src/freeze.c, src/main.c: Updated all references. * src/Makefile.am (m4_SOURCES): Don't list $(M4OBJS) here, since Automake 1.5 chokes on dynamic source file lists, Besides, it is already listed in m4_LDADD... how did that ever used to work? * configure.in (getopt.h): Use AC_CONFIG_LINKS instead of a manual link. * config/gnu-obstack.m4 (M4_AC_FUNC_OBSTACK): Ditto. Suggested by Tim Van Holder * tests/m4: Don't call the m4 wrapper script with libtool, it works fine all by itself. 2001-08-30 Gary V. Vaughan The experimental `changeword' feature never took off, and has no obvious advantages over `changesyntax' to compensate the enormous speed penalty it carries: * configure.in (ENABLE_CHANGEWORD): Removed. * m4/m4module.h (m4_set_word_regexp): Removed. * m4/m4private.h (m4_token_data): Removed original_text field. * m4/utility.c (m4_token_data_orig_text): Removed. * m4/input,c: Removed all conditional ENABLE_CHANGEWORD code. * m4/macro.c: Ditto. * src/main.c: Ditto. * modules/Makefile.am (changeword.la): Removed. * modules/changeword.c: File removed. * doc/m4.texinfo: References to changeword and --word-regexp removed. * po/POTFILES.in: modules/changeword.c removed. * tests/atlocal.in (ENABLE_CHANGEWORD): Removed. * tests/builtins.at (changeword): Test removed. 2001-08-30 Akim Demaille * bootstrap.sh: Create aclocal.m4 instead of modifying it. This also help having a single list of m4 files: in config/Makefile.am. * config/Makefile.am (STANDARD_MACROS): Rename as... (ACLOCAL_MACROS): this. (list-standard-macros): Remove. (spy): New. 2001-08-29 Gary V. Vaughan In an attempt to moderate my egomania... * tests/modules.at: Remove attributions. * tests/generate.awk: When making substitutions to "@&t@", either "&" or "\&" in the substitution string argument to gsub refer back to the matched text. "@\\&t@" seems to work though, Tests 43 and 67 now pass for me. 2001-08-29 Akim Demaille * tests/others.at (changeword, ddivert, debug, esyscmd, exp, gmp) (include, indir, multiquotes, patsubst, pushdef/popdef, regexp) (sync-lines, trace, translit, undivert, wrap): Move to... * tests/builtins.at: this new file. * tests/others.at (Discard comments, import-environment): Move to... * tests/options.at: this new file. 2001-08-29 Akim Demaille * tests/others.at (Freezing modules) (--module-directory: absolute path, modpath2, modpath3) (M4MODPATH: absolute path, modtest, shadow, unload): Move to... * tests/modules.at: here, new file. * tests/others.at, tests/generate.awk: Add a banner. * tests/testsuite.at: Adjust. (AT_CHECK_M4_FILTER): New, but unused. 2001-08-29 Akim Demaille * tests/testsuite.at (AT_CHECK_M4): Don't pass -I, let the tests handle that. * tests/others.at (wrap): Inline wrap.m4. (shadow): Inline shadow.m4. (iso8859): Don't specify the path from top_srcdir, but from srcdir. * tests/m4: Simplify. 2001-08-29 Akim Demaille * tests/Makefile.am ($(srcdir)/$(TESTSUITE)): Use autom4te's --language. 2001-08-29 Akim Demaille * tests/generate.awk (normalize): s/@__@/@&t@/. 2001-08-28 Akim Demaille * examples/indir.m4, tests/others.at (indir): s/nonsens/nonsense/. 2001-08-28 Gary V. Vaughan * bootstrap (generate.awk): Generate test cases with new script. 2001-08-27 Akim Demaille * tests/Makefile.am (installcheck-local): Don't use `dc_install_base' which is not visible here, but `exec_prefix' which is clearly the RT anyway. * tests/testsuite.at (AT_CHECK_M4): Don't pass -M here since it is related to testing a now installed m4. * tests/m4: Do it here. 2001-08-27 Akim Demaille * tests/others.at (indir): Formatting change. 2001-08-27 Akim Demaille * tests/Makefile.am (installcheck-local): New. * tests/testsuite.at (AT_CHECK_M4): Pass `-b' so that C-c works on the test suite. Prefer options over envvars. * src/main.c (main): First bug caught by the test suite (yeah!): --batch lacked a `break' which resulted in an accidental invocation of --discard-comments. 2001-08-27 Akim Demaille * tests/others.at (capitalize, changeword, comments, ddivert) (debug, esyscmd, exp, foreach, forloop, fstab, hanoi, include) (misc, multiquotes, patsubst, pushdef/popdef, regexp, reverse) (sysv-args, trace, translit, undivert): Don't rely on files in examples/: AT_DATA them. 2001-08-27 Akim Demaille Let the test suite use a wrapper around the not installed m4 to pretend it is (installed). * bootstrap (aclocal.m4): Output AC_SUBST's and AM_CONDITIONAL's in such a way that m4 does not process them. * configure.in: The package name seems to be `m4', not `M4'. * tests/m4: New. * tests/atlocal.in (at_package, M4): Remove. * tests/testsuite.at, tests/others.at: Use m4, not $M4. 2001-08-27 Akim Demaille * tests/Makefile.am (CLEANFILES): Remove. (DISTCLEANFILES, clean-local): New. * examples/mktests.sh: Remove. 2001-08-27 Akim Demaille * Makefile.am (AUTOMAKE_OPTIONS): 1.5. Don't use aclocal: it's written by hand. * aclocal.m4: m4_include all the files instead of being built by aclocal. * bootstrap: Help automake find the AC_SUBSTs and AM_CONDITIONALs until it reads the traces by itself. * configure.in: Require Autoconf 2.42c as we are now using AC_CONFIG_TESTDIR instead of AT_CONFIG. Catch unexpanded `jm_' macros. * config/atconfig.m4: Remove. * config/error.m4: new. * config/Makefile.am: Ship the files included by aclocal.m4. * tests/Makefile.am (TESTSUITE_SOURCES): Rename as... (TESTSUITE_AT): this, to please Automake. (TESTSUITE): This target uses autotest/autotest.m4, not autotest/general.m4. * tests/testsuite.at: Prereq Autotest 2.52c. * examples/Makefile.am (pkgdata_DATA): Rename as... (dist_pkgdata_DATA): this. * doc/Makefile.am (man_MANS): Rename as... (dist_man_mans): this. 2001-08-20 Gary V. Vaughan * m4/system.h [cygwin*]: Thanks to Paul Sokolovsky and Robert Collins, building on Cygwin no longer requires Windows import and export symbol decorations. * m4/m4module.h (M4_SCOPE) [cygwin*]: Deleted all occurences. * m4/error.h (M4_SCOPE) [cygwin*]: Ditto. * m4/debug.c (M4_GLOBAL_DATA) [cygwin*]: Ditto. * m4/error.c (M4_GLOBAL_DATA) [cygwin*]: Ditto. * m4/input.c (M4_GLOBAL_DATA) [cygwin*]: Ditto. * m4/macro.c (M4_GLOBAL_DATA) [cygwin*]: Ditto. * m4/output.c (M4_GLOBAL_DATA) [cygwin*]: Ditto. * m4/utilty.c (M4_GLOBAL_DATA) [cygwin*]: Ditto. * m4/xmalloc.c (M4_GLOBAL_DATA) [cygwin*]: Ditto. * configure.in (LIBM4_DLL_IMPORT) [cygwin*]: Don't set this anymore. * src/Makefile.am (AM_CPPFLAGS) [cygwin*]: Don't use it either! * modules/Makefile.am (AM_CPPFLAGS) [cygwin*]: Ditto. 2001-08-20 Gary V. Vaughan Ansify the source. Previously we had a mix, where my code was in a K&R compatible style, and the preexisting code was in ANSI style. Nothing is lost wrt release 1.4 by reverting to ANSI, and now the code base is much cleaner. * m4/system.h: Remove M4_PARAMS macro and all users. Remove VOID macro and all users. * m4/m4module.h: Ansify function prototypes and headers. * m4/builtin.c: Ditto. * m4/evalparse.c: Ditto. * m4/input.c: Ditto. * m4/macro.c: Ditto. * m4/module.c: Ditto. * m4/output.c: Ditto. * m4/path.c: Ditto. * m4/symtab.c: Ditto. * m4/utility.c: Ditto. * modules/format.c: Ditto. * modules/gnu.c: Ditto. * modules/m4.c: Ditto. * modules/mpeval.c: Ditto. * src/freeze.c: Ditto. * src/m4.h: Ditto. * src/main.c: Ditto. 2001-08-20 Akim Demaille * config/atconfig.m4: s/EOF/ATEOF/, so that configure can be generated with stock 2.52. 2001-08-20 Akim Demaille * config/atconfig.m4: New, until part of Autoconf per se. * configure.in (AT_CONFIG): Use it. Adjust. * tests/mkconfig.sh, tests/atconfig.in, tests/defs: Remove. * tests/atlocal.in: New. * tests/generate.awk: For the time being, the empty quadrigraph is `@__@'. * tests/others.at (changeword, gmp): Check the configuration variable against `yes'. * tests/testsuite.at (dnl): Allow it, as it's used all over the place. 2001-08-20 Akim Demaille * m4/utility.c (m4_numeric_arg): Spell out the culprit. * modules/m4.c (undivert): Disable the possibility of undiverting several files at once: it is not documented, it is inconsistent with the other macros, it can be straightforwardly mocked by several invocations, and most importantly, it prevents the possibility of other kinds of extension. Use `m4_numeric_arg'. 2001-08-20 Akim Demaille * examples/include.m4: Typo. * tests/generate.awk: Really add it. * tests/Makefile.am: Adjust. * tests/others.at (Discard comments): It sure fails without `-c'. (include, undivert): Add -I examples/. 2001-08-20 Akim Demaille Use sprintf, not ecft and friends since it is standard, portable, simplifies the code, and since the latter is even deprecated according to the GNU libc documentation. * modules/format.c: Drop evct support. 2001-08-19 Gary V. Vaughan * config/debug.m4 (M4_AC_CHECK_DEBUGGING): Cleaned up. Don't test for `-pipe' here... * configure.in: ...do it here instead. * c-boxes.el: Deleted. * m4/builtin.c: Reformat box comments to be closer to GNU standards. * m4/debug.c: Ditto. * m4/eval.c: Ditto. * m4/evalparse.c: Ditto. * m4/input.c: Ditto. * m4/m4module.h: Ditto. * m4/macro.c: Ditto. * m4/output.c: Ditto. * m4/symtab.c: Ditto. * m4/utility.c: Ditto. * modules/changeword.c: Ditto. * modules/format.c: Ditto. * modules/gnu.c: Ditto. * modules/load.c: Ditto. * modules/m4.c: Ditto. * modules/modtest.c: Ditto. * modules/mpeval.c: Ditto. * modules/perl.c: Ditto. * modules/shadow.c: Ditto. * modules/stdlib.c: Ditto. * modules/time.c: Ditto. * src/freeze.c: Ditto. * src/main.c: Ditto. 2001-08-17 Gary V. Vaughan * m4/module.c: Fixup some errors in the description comment. 2001-08-17 Akim Demaille * tests/others.at (iso8859): Specify the path to the M4 test file. * tests/testsuite.at (AT_CHECK_M4): Normalize the path of input files in error messages. 2001-08-17 Akim Demaille * tests/testsuite.at (AT_CHECK_M4): Anchor M4PATH in $top_srcdir. * tests/others.at: Adjust input files paths. * tests/atconfig.in: Set top_builddir. * tests/Makefile.am: Adjust. `testsuite' is in src, not build. 2001-08-17 Akim Demaille * tests/Makefile.am (EXTRA_DIST): Ship generate.awk. (generate.at): Install a temporary hack until the actual generate.awk is added to the repository. * tests/atconfig.in: New. 2001-08-17 Akim Demaille Really apply the patch ``Drop Autoconf 2.13 compatibility.'' 2001-08-17 Akim Demaille * doc/m4.texinfo: Promote proper quotation. 2001-08-17 Akim Demaille Remove the non Autotest tests. * tests/other-tests/capitalize.test, * tests/other-tests/changeword.test, * tests/other-tests/comments.test, tests/other-tests/ddivert.test, * tests/other-tests/debug.test, * tests/other-tests/discard-comments.m4, * tests/other-tests/discard-comments.test, * tests/other-tests/esyscmd.test, tests/other-tests/exp.test, * tests/other-tests/foreach.test, tests/other-tests/forloop.test, * tests/other-tests/frozen.m4, tests/other-tests/fstab.test, * tests/other-tests/gmp.m4, tests/other-tests/gmp.test, * tests/other-tests/hanoi.test, * tests/other-tests/import-environment.m4, * tests/other-tests/import-environment.test, * tests/other-tests/include.test, tests/other-tests/indir.test, * tests/other-tests/iso8859.m4, tests/other-tests/iso8859.test, * tests/other-tests/misc.test, tests/other-tests/modfreeze.test, * tests/other-tests/modpath1.test, tests/other-tests/modpath2.test, * tests/other-tests/modpath3.test, tests/other-tests/modpath4.test, * tests/other-tests/modtest.test, * tests/other-tests/multiquotes.test, * tests/other-tests/patsubst.test, tests/other-tests/pushpop.test, * tests/other-tests/regexp.test, tests/other-tests/reverse.test, * tests/other-tests/shadow.test, tests/other-tests/stackovf.test, * tests/other-tests/sync-lines.m4, * tests/other-tests/sync-lines.test, * tests/other-tests/sysv-args.test, tests/other-tests/trace.test, * tests/other-tests/translit.test, tests/other-tests/undivert.test, * tests/other-tests/unfrozen.m4, tests/other-tests/unload.test, * tests/other-tests/wrap.test: Remove. * tests/run-test, tests/get-them: Remove. * tests/Makefile.am: Adjust. 2001-08-17 Akim Demaille others.at no longer depends on other-tests/. * tests/others.at (stackovf): You're actually... (sync-lines): this. (modfreeze, modpath1, modpath2, modpath3, modpath4, modtest, shadow) (unload.test): Keep their authorship. (discard-comments, gmp, import-environment, modfreeze) (sync-lines): Embed the input files. * tests/stackovf.test: Copy from other-tests/stackovf.test. * tests/iso8850.m4: Copy from other-tests/iso8859.m4. 2001-08-17 Akim Demaille * doc/m4.texinfo (Esyscmd): Fix the paths in the Vice example. (M4exit): Tag the exit status of the example. * tests/get-them: Adjust. * tests/generate.awk: New, based on get-them. * tests/Makefile.am: Adjust to generate `generated.at'. * tests/testsuite.at: Adjust. (AT_CHECK_M4): Don't overquote. Blush... 2001-08-17 Akim Demaille Start using Autotest. atconfig creation is still lacking. * examples/patsubst.m4, modules/modtest.m4, modules/shadow.m4, * examples/reverse.m4, tests/other-tests/import-environment.m4, * tests/other-tests/iso8859.m4: Don't produce trailing blanks. * tests/other-tests/import-environment.test: Don't check LANGUAGE as it might be `unset', or set to `C'. * tests/other-tests/iso8859.test, tests/other-tests/modpath1.test, * tests/other-tests/modpath2.test, tests/other-tests/modpath3.test, * tests/other-tests/modpath4.test, tests/other-tests/modtest.test, * tests/other-tests/patsubst.test, tests/other-tests/reverse.test, * tests/other-tests/shadow.test: Adjust. * tests/testsuite.at, tests/others.at: New. * tests/Makefile.am: Adjust. 2001-08-17 Akim Demaille Drop Autoconf 2.13 compatibility. * configure.in (changeword): No need to undefine it, as anyway if it's defined, M4sugar moved it as m4_changeword. And anyway, proper quotation is enough. (m4_pattern_allow): As it exists in 2.50, just use it. (AC_OUTPUT): Split in AC_CONFIG_FILES and AC_CONFIG_COMMANDS. Don't handle Gettext's duties, let it handle them. * config/gnu-obstack.m4: Use m4_pattern_allow directly. 2001-08-17 Akim Demaille * modules/m4.c (m4_dumpdef): Output to stderr, not m4_debug. (m4_errprint): Use fputs. * doc/m4.texinfo (Invoking m4) <--error-output>: errprint and dumpdef are not concerned. (Dumpdef, Errprint): Emphasize their insensitivity to --error-output. * doc/Makefile.am: Add `TAGS' support. (MAINTAINERCLEANFILES): Remove texinfo.tex and mdate-sh which are in `config/' now. * config/Makefile.am (MAINTAINERCLEANFILES): New. 2001-08-17 Akim Demaille * modules/Makefile.am (ETAGS_ARGS): New. 2001-08-17 Akim Demaille * m4/symtab.c (m4_hack_all_symbols, m4_lookup_symbol): Formatting changes. 2001-08-17 Akim Demaille * m4/builtin.c (m4_macro_define): Do not reset SYMBOL_TRACED. 2001-08-17 Akim Demaille * m4/m4module.h (m4/list.h): Don't include it. 2001-08-16 Gary V. Vaughan m4_modules are no more, we use lt_dlhandles directly and let latest libltdl features manage the list of loaded modules. * acinclude.m4: Regenerated. * m4/ltdl.c: Updated from master copy. * m4/module.c: Reimplemented to take advantage of advances in libltdl. * m4/builtin.c (m4_builtin_find_by_name): Traverse loaded module list with lt_dlhandle_next. (m4_builtin_find_by_func): Ditto. (m4_builtin_table_install): Use lt_dlhandle. (m4_macro_define): Ditto. (m4_macro_table_install): Ditto. m4/module.h: Prototype new module management API. (m4_modules): No longer required. (m4_module_init_t, m4_module_finish_t): POSIX namespace violations, renamed to... (m4_module_init_func, m4_module_finish_func): ...these, respectively. (M4INIT_HANDLER): Clean way to declare init functions in modules. (M4FINISH_HANDLER): And similarly for finish functions. * m4/system.h (_CONC): Used by M4INIT_HANDLER and M4FINISH_HANDLER -- Add indirection to the CONC macro so that arguments are correctly expanded. * modules/modtest.c (m4_init_module): Replaced with M4INIT_HANDLER. * modules/shadow.c (m4_init_module): Ditto. Due to new init function semantics, be careful to perform the initialisation only on first load. * modules/perl.c (m4_init_module): Ditto. And Ditto. (m4_finish_module): Replaced with M4FINISH_HANDLER. Due to new finish function semantics, be careful to perform the finalisation only on first load. * m4/m4private.h (m4_module): Removed in favour of... (m4_module_data): ...structure without all the wrapper fields. Instances of this new structure are stored associated lt_dlhandles with lt_dlcaller_data_set(). * m4/builtin.c (m4_builtin_define): Takes a handle argument instead of the old module argument. (m4_builtin_table_install): Ditto. * modules/load.c (m4_resident_module): Removed. This is no longer implemented as a magic symbol... * modules/m4.c (m4_resident_module): Ditto. * modules/load.c (M4INIT_HANDLER): ...the module init function now uses the ltdl api to make the module resident. * modules/m4.c (M4INIT_HANDLER): Ditto. * modules/load.c (builtin_modules): Traverse the loaded module list with lt_dlhandle_next. (builtin_load): Much simplified in light of the reimplemented module loader. * src/freeze.c (produce_module_dump): Cleaned up and optimised in light of the m4/module.c rewrite. (produce_symbol_dump): Ditto. (reload_frozen_state): Ditto. * m4/list.c, m4/list.h: Files deleted. No longer required. * m4/Makefile.am (pkginc_HEADERS): Delete list.h reference. (libm4_la_SOURCES): Delete list.c reference. * m4/m4private.h (m4_token_data): Add a handle field. This eliminates many of the searches to find the handle associated with various tokens that are passed between functions. (struct m4_symbol): Removed the module field. The module association does not belong with the symbol... * m4/input.c (struct m4_builtin): ...it belongs with the builtin that the module implementation code is from. Added a handle field. (m4_push_macro): Add a `handle' argument. Changed all callers. (init_macro_token): Set the `handle' field for the m4_token_data. * m4/macro.c (expand_argument): Copy the new handle field during reassignment. * modules/m4.c (macro_install): Use the new handle field to optimise the search for the correct builtin structure, and pass the handle details to m4_builtin_define. 2001-08-15 Akim Demaille * config/gnu-obstack.m4 (M4_AC_FUNC_OBSTACK): Be sure `m4/' exists when creating `m4/obstack.h'. * tests/Makefile.am (TESTS_ENVIRONMENT): Pass top_srcdir and top_builddir. * tests/defs: Make them absolute. (CDPATH) Neutralize. * tests/gethem: Use them. 2001-08-14 Gary V. Vaughan * config/ltmain.sh: Doh! Import again for a quoting fix that prevented any regression test from passing. * m4/m4module.h (obstack.h): Choose between installed version and shipped version based on configure tests. * src/freeze.c (obstack.h): Ditto. * acconfig.h: Removed. No longer required. * bootstrap: Rewritten to play nicely with Autoconf 2.5x. * configure.in (MY_NAME, MY_VERSION): Define these once, and feed them to AC_INIT and AM_INIT_AUTOMAKE. * Makefile.am (AUTOMAKE_OPTIONS): Remove `gnits' which would disallow MY_NAME and MY_VERSION arguments to AM_INIT_AUTOMAKE. * config/gnu-obstack.m4 (M4_AC_FUNC_OBSTACK): Don't choke on shell variable m4_cv_func_obstack_h. * tests/defs (M4): Be more careful about relative path to libtool script and m4 binary by using $srcdir. * src/main.c (main): Use lt_dlinsertsearchdir to prepend -M optargs to the existing libltdl search path. * acinclude.m4: Regenerate from latest libtool,m4 and ltdl.m4. * m4/ltdl.c: Updated. * m4/ltdl.h: Ditto. * config/ltmain.sh: Ditto. 2001-08-11 Gary V. Vaughan * src/main.c (main): Add `-b' (for `batch') mode switch to force interactive mode off. 2001-08-10 Akim Demaille * configure.in: Require Autoconf 2.52. (AC_ARG_PROGRAM): Remove, handled by Automake. (m4_getopt): Rename as... (m4_getopt_h): this. Allow the tokens `m4_cv_*', `m4_top_srcdir', and `m4_getopt_h'. Undefine `changeword' only if defined. * config/gnu-obstack.m4: Require Autoconf 2.52. (M4_AC_FUNC_OBSTACK): Rename `m4_obstack' and `m4_obstack_h'. Allow this token. 2001-08-09 Yuji Minejima * doc/m4.texinfo: Fix some typos, and apply some small clarifications. 2001-08-09 Andreas Schwab * src/main.c (main): Fix improper uses of error (missing format string). 2001-08-07 Akim Demaille Improve `make distcheck'. * configure.in: Be sure to be able to run `mkconfig.sh' when src != build. * Makefile.am (dist-hook): Remove, as it is no longer needed. * doc/m4.texinfo (Include): Add missing blank. * m4/Makefile.am (EXTRA_DIST): Distribute gnu-obstack.h and obstack.c. 2001-08-07 Akim Demaille * m4/evalparse.c: A better introductory comment. * m4/m4module.h (M4_DEBUG_PRINT2): s/M4_debug/m4_debug/. * m4/macro.c: Adjust old comments. * modules/README: Typo. 2001-08-07 Akim Demaille * config/gnu-obstack.m4: New. 2001-08-07 Akim Demaille * config/Makefile.am, config/stackovf.m4: New. * configure.in, Makefile.am: Adjust. 2001-08-05 gettextize * po/Makefile.in.in: Upgrade to gettext-0.10.39. * po/cat-id-tbl.c: Remove file. * po/stamp-cat-id: Remove file. 2001-04-08 Roderick Koehle * modules/format.c (format): Formatting for %f was not interpreting the position of the decimal point correctly for whole numbers. 2000-12-01 Gary V. Vaughan * TODO: Removed m4exit bug. * modules/load.c (m4_resident_module): Make this module resident. * module/m4.c (m4_resident_module): Ditto. * m4/modules.c (m4_module_load): Use new ltdl resident modules feature to mark modules as resident if they export `m4_resident_module' as TRUE. (m4_module_unload): Do not remove resident modules, and take care with symbol insertion and deletion with resident modules. * m4/ltdl.c, m4/ltdl.h: Update to latest unreleased versions to use resident modules feature. 2000-11-30 Gary V. Vaughan * TODO: Updated. Removed some cruft that has since been fixed or implemented. Added some more entries. * NEWS: Updated. * README: Updated. * modules/README: Updated. * doc/m4.texinfo: Updated. * modules/gnu.c (builtin_functions): Make indir orthogonal to builtin, in that each is recognised as a macro only with parameters (builtin_indir): Passing 0 arguments is now an error, as with builtin. * src/main.c (usage): Added missing description of `-c' option. 2000-11-29 Gary V. Vaughan Consolidate the myriad of dispersed test scripts into the tests subdirectory. I think I now have all the file where I want them, so there shouldn't be anymore upheaval =)O| Honest! * tests/Makefile.am: Updated to run the new tests added below. * tests/other-tests/capitalize.test, tests/other-tests/comments.test, tests/other-tests/ddivert.test, tests/other-tests/debug.test, tests/other-tests/esyscmd.test, tests/other-tests/exp.test, tests/other-tests/foreach.test, tests/other-tests/forloop.test, tests/other-tests/frozen.m4, tests/other-tests/fstab.test, tests/other-tests/hanoi.test, tests/other-tests/include.test, tests/other-tests/indir.test, tests/other-tests/misc.test, tests/other-tests/modfreeze.test, tests/other-tests/modpath1.test, tests/other-tests/modpath2.test, tests/other-tests/modpath3.test, tests/other-tests/modpath4.test, tests/other-tests/modtest.test, tests/other-tests/multiquotes.test, tests/other-tests/patsubst.test, tests/other-tests/pushpop.test, tests/other-tests/regexp.test, tests/other-tests/reverse.test, tests/other-tests/shadow.test, tests/other-tests/sysv-args.test, tests/other-tests/trace.test, tests/other-tests/translit.test, tests/other-tests/undivert.test, tests/other-tests/unfrozen.m4, tests/other-tests/unload.test, tests/other-tests/wrap.test: New tests based on the contents of the tests removed below. * examples/Makefile.am, modules/Makefile.am: Updated to reflect removed tests. * examples/defs,modules/defs: Removed. * examples/capitalize.test, examples/comments.test, examples/ddivert.test, examples/debug.test, examples/esyscmd.test, examples/exp.test, examples/foreach.test, examples/forloop.test, examples/fstab.test, examples/hanoi.test, examples/include.test, examples/indir.test, examples/misc.test, examples/multiquotes.test, examples/patsubst.test, examples/pushpop.test, examples/regexp.test, examples/reverse.test, examples/sysv-args.test, examples/trace.test, examples/translit.test, examples/undivert.test, examples/wrap.test, modules/frozen.m4, modules/modfreeze.test, modules/modpath1.test, modules/modpath2.test, modules/modpath3.test, modules/modpath4.test, modules/modtest.test, modules/shadow.test, modules/unfrozen.m4, modules/unload.test: Removed. Move the implementation of GMP support for the mpeval() builtin into a loadable module that depends on libgmp. mpeval() and eval() share a common parser, now in m4/evalparser.c; the code in m4/numb.c and m4/numb.h is now physically split between m4/eval.c (the eval() backend) and modules/mpeval.c (the mpeval() backend), rather than being differentiated by cpp macros and multiple inclusion. The mpeval module is always built but will generate an diagnostic if it is used from an installation that didn't link in the gmp library. * modules/Makefile.am: build and install the new mpeval module. * modules/mpeval.c: Now contains the former parts of m4/numb.c and m4/numb.h that are required for gmp support in mpeval(). * m4/Makefile.am (libm4_la_SOURCES): Removed evalmp.c. * m4/evalmp.c: Removed. * m4/m4module.h: Removed conditional prototype for m4_mp_evaluate(). * m4/eval.c: Rewritten. Contains the former parts of m4/numb.c and m4/numb.h that do not rely on gmp. * m4/evalparse.c: New file, contains the shared parts of the eval() and evalmp() parser implementations, and is no longer unencumbered by cpp magic to uncover the right parts. * m4/numb.h: Removed. It's former contents are split between m4/eval.c and modules/mpeval.c. * m4/numb.c: ditto. * tests/other-tests/changeword.test: New test. Rudimentary testing of changeword builtin runs only if --wnable-changeword was used at configure time. * tests/mkconfig.sh: Solaris sed (at least) does not parse nested alternation correctly. Split into two expressions to compensate. * m4/input.c (m4_input_init): Use m4_ prefix on m4_set_word_regexp. * modules/Makefile.am: Build changeword module. * modules/changeword.c (m4_macro_table): Define __m4_changeword__ only when --enable-changeword was passed to configure. (builtin_changeword): If --enable-changeword was not used, then report that changeword() builtin has no support in m4 binary. 2000-11-28 Gary V. Vaughan * src/main.c (main): Fixed a particularly nasty bug is user_search_path setting -- the -M flag processing must be extremely careful with search path ordering, or else the default installed module directory (possibly containing modules from a previous release) is placed earlier in the search path than any -M arguments (which are relied upon to load uninstalled modules with most of the tests in the regresion suite). * modules/load.c (builtin_load): Nasty hack to prevent adding symbols to symtab again if a module is loaded more than once. * modules/m4.c (builtin_ifelse): removed unused variable argv0. * m4/symtab.c (m4_remove_table_reference_symbols): Fixed a possible NULL pointer dereference. * m4/module.c (m4_module_find_by_modname): Renamed from m4_module_modname_find. Fixed all references. (m4_module_find_by_builtin): New function. * modules/modfreeze.test: load the `load' module with each invocation. * src/freeze.c (produce_frozen_state): Simplified in light of module field in m4_symbol. Allow a third argument for text macros to name the originating module. (reload_frozen_state): ditto. * m4/m4module.h: Fixup prototypes. * m4/builtin.h (m4_builtin_define): Add a module argument so that symbols can be registered against the defining module. (m4_macro_define): ditto. * m4/m4private.h (m4_symbol): Make the module field const to save on casting in the rest of the code. (SYMBOL_MODULE): New macro. * m4/symtab.c (m4_remove_table_reference_symbols): Fixed stupid symbol reference maintenance bugs when removing a symbol from the symtab. * src/stackovf.c (setup_stackovf_trap): Fixed some memory leaks. 2000-11-27 Gary V. Vaughan * configure.in (m4_cv_func_obstack): A better check for whether libc has an obstack implementation. * m4/Makefile.am (EXTRA_libm4_la_SOURCES): add gnu-obstack.h. * configure.in (--with-modules): Changed semantics. This option is now used to list modules to be preopened. * src/m4.h: #include "ltdl.h" unconditionally. * src/main.c: Removed all dependencies on WITH_MODULES. * src/freeze.c: ditto. * modules/Makefile.am: ditto. * m4/m4.c (builtin_m4exit): ditto. * modules/modpath1.test: ditto. * modules/modpath2.test: ditto. * modules/modpath3.test: ditto. * modules/modpath4.test: ditto. * modules/modtest.test: ditto. * modules/shadow.test: ditto. * modules/unload.test: ditto. * m4/Makefile.am (libm4_la_SOURCES): Removed obstack.c, since it comes up on demand in LTLIBOBJS now. * configure.in (getopt_long): Creating and relying on a link for getopt.h on hosts with no getopt_long() of thier own works correctly now. This is necessary so that callers of getopt_long() can simply `#include ': the naive way of doing this would end up using our own getopt.h and the installed getopt_long(), which is asking for trouble! (obstack_init): A similar argument applies to obstack.h and obstack_init(). * m4/ltdl.c: Upgraded to latest bleeding edge version again. On Solaris-2.5 (at least) the native dlopen implementation gets confused about m4.o when looking for module "m4". This version always looks for .la an .$lib_ext suffixed names first to work around the problem. Sigh. * po/POTFILES.in: Take account of these file movements. * src/Makefile.am (m4_SOURCES): removed eval.c. (EXTRA_m4_SOURCES): removed numb.c and numb.h. * m4/Makefile.am (libm4_la_SOURCES): added eval.c. (EXTRA_libm4_la_SOURCES): added numb.c and numb.h. * modules/m4.c (builtin_eval): Use m4_evaluate(). * m4/eval.c: Moved here from src/eval.c to facilitate implementation of eval() builtin as part of the `m4' loadable module. (m4_evaluate): renamed from evaluate for namespace cleanliness. * m4/numb.c: Moved here from src/numb.c, since it is #included into eval.c at compile time. * m4/m4module.h (m4_evaluate): Added prototype. * src/m4.h (evaluate): Removed prototype. 2000-11-25 Gary V. Vaughan * modules/perl.c (builtin_perleval): Use PL_na for compatibility with perl-5.6. * src/main.c (main): It is now safe to ``m4_module_install("m4")'', without tripping over the m4 binary itself! * m4/ltdl.h, m4/ltdl.c: Upgraded to latest bleeding edge versions having fixed the insidious module search order bug. * m4/Makefile.am (libm4_la_LIBADD): New magic -- we are supposed to be using @LIBADD_DL@; @DLLDFLAGS@ is dead. * configure.in: Figure out whether to use the installed getopt.h or the supplied one. * src/Makefile.am: ditto. * po/POTFILES.in: List files in their new positions. * config/ltmain.sh: This needs to be checked in to match the libtool macros copied to acinclude.m4 (until a released libtool copes with m4's needs). * bootstrap: Run gettextize. 2000-11-24 Gary V. Vaughan * AUTHORS: Added my details. * TODO: updated. * NEWS: updated. * bootstrap: temporary update until released libtool catches up. * All files: Use new GNU GPL copyright blurb with current contact address. * configure.in (LTLIBOBJS): Use canonical code for calculation of this variable. * config: renamed acm4 directory to config to be more like other autoconfiscated packages. * configure.in (M4_AC_CHECK_DEBUGGING): Use it. * config/debug.m4: New file implementing configure macros to add suitable debug flags to the compiler invocation. * modules/load.c: New file implementing the ``load'' and ``unload'' builtins. * tests/get-them: Set the module search directory to the modules build directory in generated tests. * modules/shadow.test: ditto. * modules/modtest.test: ditto. * modules/modpath1.test: ditto. * modules/modpath2.test: ditto. * modules/modpath3.test: ditto. * modules/modpath4.test: ditto. * modules/modtest.test: ditto. * modules/modfreeze.test: ditto. * modules/unload.test: ditto. * modules/changeword.c: New file implementing the ``changeword'' builtin as a loadable module. * modules/mpeval.c: New file implementing the ``mpeval'' builtin as a loadable module. * src/main.c (main): Load the gnu module if m4 was started normally -- i.e. without the -G option. * modules/gnu.c: New file implementing a new loadable module wuth definitions for all the gnu extension builtins. * modules/format.c: Moved here from src/format.c. Now included directly by gnu.c. * src/main.c (main): Load the traditional module if m4 was started in `no_gnu_extensions' mode. * modules/traditional.c: New file implementing the ``unix'' macro, required when m4 is executed in traditional mode, as a loadable module. * src/main.c: Renamed from m4.c to avoid confusion with modules/m4.c. (main): Always load the m4 module. * modules/m4.c: New file implementing a new loadable module with definitions for all m4 builtins that are not gnu extensions. * m4/Makefile.am: Adjusted to take new files below into account. * m4/m4module.h: Prototypes for exported functions and types moved to this directory from the src directory. * m4/m4private.h: Moved here from src/m4private.h to facilitate the migration of all builtin implementations to loadable modules. * m4/macro.c: Moved this file here from the src directory, renaming all exported symbols to use the prefix ``m4_''. * m4/builtin.c: ditto. * m4/module.c: ditto. * m4/symtab.c: ditto. * m4/debug.c: ditto. * m4/input.c: ditto. * m4/output.c: ditto. * m4/path.c: ditto. * m4/ltdl.h, m4/ltdl.c: ditto. * m4/utility.c: Odd functions moved here from files in the src directory to facilitate builtin migration. 2000-08-12 Gary V. Vaughan * src/builtin.c (dump_symbols): Use "Undefined name `%s'" for error message, to make translators' jobs a little easier. (builtin_builtin): ditto. (builtin_traceon): ditto. (builtin_traceoff): ditto. Reported by Akim Demaille * m4/Makefile.am (pkgincdir): Deleted. Use automake's built in pkgincludedir instead. * m4/m4module.h (rquote): Renamed with a prefix of `m4_' since it is exported globally. Fixed all references. (lquote): ditto. (bcomm): ditto. (ecomm): ditto. (DEF_RQUOTE): Renamed with a prefix of `M4_' since it is exported globally. Fixed all references. (DEF_LQUOTE): ditto. (DEF_BCOMM): ditto. (DEF_ECOMM): ditto. 2000-07-28 Gary V. Vaughan * NEWS: updated. * TODO: updated. * configure.in (AC_CHECK_FUNCS): added bzero and calloc. (AC_OUTPUT): touch stamp-h.in, not stamp-h. * doc/m4.texinfo: Fixed to work with --html option of makeinfo. Removed `Prev', `Next' and `Up' fields of all @nodes now that makeinfo calculates them for us, and to make any future reorganisation easier. (Frozen files): Document format version 2. `V' now takes argument `2'. `F' can take a single argument if symbol and builtin names are the same, or 3 arguments if the builtin is from a module. New `S' specification for saving syntax table contents. New `M' specification for saving loaded module names. * src/freeze.c: Implement them. * src/input.c (syntax_code): For interpreting frozen syntax state. * examples/Makefile.am: Add the contents of the WWW directory to the distribution. * examples/WWW/Makefile: ditto, (%.htm): Compares file contents (not just sizes) to determine whether a change has occured. * examples/WWW/_header.htm: Bumped version number. * examples/WWW: Regenerated content. * m4/Makefile.am (AUTOMAKE_OPTIONS): Support for non-ANSI compilers comes much easier without ansi2knr. * src/Makefile.am (AUTOMAKE_OPTIONS): ditto. * m4/list.c: New generic list container type. * m4/list.h: Interface to new container type. * m4/Makefile.am (pkginc_HEADERS): Install list.h. (libm4_la_SOURCES): compile and link list.c. * src/builtin.c (builtin_tables): Use list container. * src/module.c (symtab): ditto. * src/symtab.c (symtab): ditto. * m4/system.h: New file for common preprocessor definitions. * m4/Makefile.am (pkginc_HEADERS): install system.h. * m4/error.c: Use system.h in place of inline preprocessor. * m4/error.h: ditto. * m4/module.c: ditto. * m4/module.h: ditto. * m4/xmalloc.c: ditto. * m4/error.h (error_one_per_line): Make M4_GLOBAL_DATA for WIN32 compatibility. * m4/xmalloc.c (xmalloc_exit_failure): ditto. * m4module.h (syntax_table): Renamed with a prefix of `m4_' since it is exported globally. Fixed all references. (builtin): ditto. (module_init_t): ditto. (module_finish_t): ditto. (token_data): ditto. (SYNTAX_OTHER): Renamed with a prefix of `M4_' since it is exported globally. Fixed all references. (SYNTAX_IGNORE): ditto. (SYNTAX_SPACE): ditto. (SYNTAX_OPEN): ditto. (SYNTAX_CLOSE): ditto. (SYNTAX_COMMA): ditto. (SYNTAX_DOLLAR): ditto. (SYNTAX_ACTIVE): ditto. (SYNTAX_ESCAPE): ditto. (SYNTAX_ALPHA): ditto. (SYNTAX_NUM): ditto. (SYNTAX_ALNUM): ditto. (SYNTAX_LQUOTE): ditto. (SYNTAX_RQUOTE): ditto. (SYNTAX_BCOMM): ditto. (SYNTAX_ECOMM): ditto. (SYNTAX_VALUE): ditto. (SYNTAX_MASKS): ditto. (IS_OTHER): ditto. (IS_IGNORE): ditto. (IS_SPACE): ditto. (IS_OPEN): ditto. (IS_CLOSE): ditto. (IS_COMMA): ditto. (IS_DOLLAR): ditto. (IS_ACTIVE): ditto. (IS_ESCAPE): ditto. (IS_ALPHA): ditto. (IS_NUM): ditto. (IS_ALNUM): ditto. (IS_LQUOTE): ditto. (IS_RQUOTE): ditto. (IS_BCOMM): ditto. (IS_ECOMM): ditto. (TOKEN_EOF): ditto. (TOKEN_NONE): ditto. (TOKEN_STRING): ditto. (TOKEN_SPACE): ditto. (TOKEN_WORD): ditto. (TOKEN_SIMPLE): ditto. (TOKEN_MACDEF): ditto. * m4/m4module.h (voidstar): Removed in favour of `VOID' for consistency. Fixed all references. (STRING): Renamed to `m4_string' for consistency, and because if is exported globally. Fixed all references. (token_type): Renamed to `m4_token_t' for the same reasons. (token_data_type): Renamed to `m4_token_data_t' for the same reasons. * m4/m4module.h (XCALLOC): Wrapper macro which handles type sizes. (XMALLOC): ditto. (XREALLOC): ditto. (XFREE): Wrapper macro which avoids freeing NULL pointers. * m4/m4module.h (m4_macro): New type for module defined user macros. * modules/modtest.c (m4_macro_table): Define module user macros. * modules/shadow.c (m4_macro_table): ditto. * m4/m4module.h (M4BUILTIN_HANDLER): For defining handlers declared with M4BUILTIN. * m4/xmalloc.c: Use memset if bzero is not available when emulating calloc with malloc. (xcalloc): Fallback to malloc/bzero if calloc is not available. (xfree): Added for consistency. Will not try to free NULL pointers. * src/m4.c (xfree): Deleted in favour of the above. * m4/xmalloc.c (WITH_DMALLOC): preprocess away the entire file if linking with libdmalloc. * m4/xstrdup.c (WITH_DMALLOC): ditto. * modules/frozen.m4: New test case. * modules/unfrozen.m4: ditto. * modules/modfreeze.test: New test. * modules/unload.test: ditto. * modules/Makefile.am (EXTRA_DIST): Distribute them. (TESTS): Use them. * modules/modpath1.test: Don't try this test if module support is not compiled in. * modules/modpath2.test: ditto. * modules/modpath3.test: ditto. * modules/modpath4.test: ditto. * modules/modtest.test: ditto. * modules/shadow.test: ditto. * modules/perl.c: New module. * modules/perl.m4: Example of using it. * modules/Makefile.am (perl_la_SOURCES): Build new perl module. * src/m4.c (main): Assume interactive mode if STDIN is connected to a tty. Changed startup sequence slightly so that syntax is not initialised from here when loading a frozen file. * src/builtin.c: Much improved macro definition style. * src/m4private.h: Internal structures for m4_builtin and m4_macro instances. These are not exposed to module writers. * src/module.c (module_modname_find): Find a module structure from the its name. (make_macro_table): Build an internal macro table from a external definition. (make_builtin_table): Build an internal builtin table from an external definition. * src/module.c (module_unload): Be extremely careful to remove builtins and macros that match the module being unloaded -- no longer assume that the top element can be removed incase another odule defines an identical name. * src/symtab.c (remove_table_reference_symbols): remove all symbol table entries which refer to a given builtin table. * src/builtin.c (remove_tables): Use it! 2000-07-13 Thomas Tanner * Makefile.am (SUBDIRS): we need modules/ for "make dist" * acm4/modules.m4: deleted * bootstrap: don't libtoolize libltdl! * configure.in: AC_SUBST INCLTDL and LIBLTDL, -with-modules flag: if set, enable WITH_MODULES and add modules to DLPREOPEN * examples/misc.test: redirect standard output * lib/Makefile.am: don't use DLLDFLAGS * lib/m4module.c: include necessary headers to silence GCC -Wall * lib/m4regex.c: fixes to silence GCC -Wall * modules/Makefile.am: don't use DLLDFLAGS, add INCLTDL to INCLUDES, build modules conditionally * modules/shadow.c: define symbol aliases before using them * modules/test.c: define symbol aliases before using them * po/de.po: update translation * src/Makefile.am: delete pathconf.h, set MODULE_PATH to pkglibexecdir, don't use DLLDFLAGS, add INCLTDL to INCLUDES and LIBLTDL to LIBS. * src/m4.c: initialize libltdl's preloaded symbols via LTDL_SET_PRELOADED_SYMBOLS * src/module.c: libltdl's memory management must be initialized before calling lt_dlinit!, fix warnings 2000-01-18 Gary V. Vaughan * README: Caveat about nls not supported by dll architecture on Windows. * TODO (MODULE SPECIFIC ISSUES): more ideas for the future. * tests/Makefile.am (stamp-TESTS): now works with VPATH. * src/Makefile.am (m4_LDADD): use $(builddir) for VPATH. * modules/Makefile.am (LIBS): ditto. (INCLUDES): search $(top_srcdir) (for eg. ) and then $(top_srcdir)/m4 (for only ). * modules/shadow.test: fixed for VPATH. * modules/modtest.test: ditto. * modules/modpath4.test: ditto. * modules/modpath3.test: ditto. * modules/modpath2.test: ditto. * modules/modpath1.test: ditto. * modules/time.test: Removed due to timezone dependence, * modules/Makefile.am (TESTS): Removed time.test. * configure.in: Use $3 of AC_DEFINE so that we can,,, * acconfig.h: Remove everything except the gettext parameters. * acm4/gmp.m4: Add a serial number, and take advantage of $3 of AC_DEFINE. * acm4/ltdl.m4: Updated to latest from libtool cvs. * acm4/modules.m4: Remove code which duplicates ltdl.m4 and increment serial number. * Makefile.am (SUBDIRS): Moved @MODULES_DIR@ to compile before src dir and immediately after libm4 is built for confidence that it doesn't rely on the src directory. (SUBDIRS): Moved doc dir to the end since helptoman.pl and makeinfo stop the build on cygwin (because they don't work). * src/m4.h: use GNU standard #if HAVE_CONFIG_H ideom. * m4/m4private.h: ...is not a public header, so moved to src. Add `#include ', `#define _COMPILING_M4' and `#include "m4.h". * m4/Makefile.am (noinst_HEADERS): remove m4private.h. * src/Makefile.am (noinst_HEADERS): add m4private.h. * src/builtin.c: `#include "m4private.h"' now takes care of the above. Duplicates removed. * src/debug.c: ditto. * src/eval.c: ditto. * src/evalmp.c: ditto. * src/format.c: ditto. * src/freeze.c: ditto. * src/input.c: ditto. * src/m4.c: ditto. * src/macro.c: ditto. * src/module.c: ditto. * src/numb.h: ditto. * src/output.c: ditto. * src/path.c: ditto. * stackovf.c: ditto. * symtab.c: ditto. * po/POTFILES.in: compensate for renaming of lib/*. * m4/Makefile.am (CLEANFILES): @EXEEXT@ left libtool wrapper behind. (INCLUDES): Look first in $(top_srcdir) (for eg. ), and then in $(top_srcdir)/lib (for eg. "m4private.h"). * src/Makefile.am (m4_LDADD): replace libi/libm4.la with m4/libm4.la. * m4/m4error.h: Renamed error.h, for installation to $prefix/include/m4.. * m4/m4obstack.h: Renamed obstack.h, for same reason. * m4/m4regex.h: Renamed regex.h, for same reason. * m4/m4error.c: Renamed error.c, and use #include "error.h". * m4/m4obstack.c: Renamed obstack.c, and fix #includes. * m4/m4regex.c: Renamed regex.c, and fix #includes. * lib: moved to m4 to easily support header installation to $prefix/include/m4. * Makefile.am (SUBDIRS): renamed lib dir to m4. * configure.in (AC_OUTPUT): reference m4/Makefile.in. * acm4/regex.m4: Point to m4/regex.c. * examples/foreach.m4: Sanitise quoting. * examples/foreach.test: New torture test. From Akim Demaille 2000-01-17 Gary V. Vaughan * src/ltdl.c: Use access() to abort doomed module load attempts if module file does not exist. * src/Makefile.am (m4_SOURCES, EXTRA_SOURCES): getopt.o and getopt1.o will already be used if appropriate, so I moved getopt.c and getopt1.c from m4_SOURCES to EXTRA_SOURCES. * modules/modpath1.test: Use correct filename in header line. * modules/modpath2.test: ditto. * modules/modpath3.test: ditto. * modules/modpath4.test: ditto. Without these changes lt_dlopen("test") attempts to LoadLibrary("/bin/test") on Windows, which although harmless generates a spurious error message which spoils most of the tests: * modules/Makefile.am (EXTRA_DIST): s/test.m4 /modtest.m4 / (TESTS): s/test.test /modtest.test / (pkglibexec_LTLIBRARIES): s/test.la /modtest.la / (test_la_SOURCES, test_la_LDFLAGS): renamed to use modtest. * modules/modpath1.test: s/test.m4 /modtest.m4 / * modules/modpath2.test: ditto. * modules/modpath4.test: ditto. * modules/modpath3.test: s/-m test /-m modtest / * modules/shadow.m4: use {un,}loadmodule(`modtest'). 2000-01-16 Gary V. Vaughan * src/ltdl.c (find_file): Updated to new version with fixed memory allocation bug in `next'. * src/ltdl.h: updated to match. * modules/Makefile.am: Cleaned up and reordered. 2000-01-16 René Seindal * modules/Makefile.am (TESTS): New tests for the module system. * modules/*.test: New files. * src/m4.c (main): Added call to module_init(). Treats -M and -m as the arguments -D -U and -t, ie deferred. * src/m4.h: Added declaration of module_init(). * src/module.c (module_init): No longer static * modules/Makefile.am ({test,shadow,time,stdlib}_la_LDFLAGS): Added to shut up automake about non standard libtool library names. * src/module.c: Disabled DEBUG by default. * modules/README: Changed example from unload.m4 to shadow.m4 * modules/shadow.m4: Renamed from unload.m4 * modules/Makefile.am (EXTRA_DIST): Removed unload.m4. * src/m4.c (main): Functionality for -m and -M were reversed. Fixed. 2000-01-12 Gary V. Vaughan * doc/help2man.pl: updated to version 1.020. * lib/COPYING.LIB: updated to version 2.1. * lib/m4module.h: restructure the M4_SCOPE code to work when creating a dll which links with libm4.la and both DLL_EXPORT (for the new dll) and LIBM4_DLL_IMPORT (for m4module.h) are both defined. 2000-01-11 Gary V. Vaughan Merged the following changes from my tree: 1999-06-15 Gary V. Vaughan * configure.in (AC_LIBTOOL_WIN32_DLL): Declare that m4 has been ported to compile shared libs. * configure.in (LIBM4_DLL_IMPORT): Discover whether we need to use `__declspec(dllimport)' when linking libm4.la on win32. * src/Makefile.am (m4_LDFLAGS): Use dllimport if necessary. * configure.in (M4OBJS): Discover whether we need the shipped implementation of getopt_long. * src/Makefile.am (m4_LDADD): Link the getopt objects into the main binary here, as opposed to the module library in lib/libm4.la. 1999-06-14 Gary V. Vaughan * modules/README: Updated to describe the improved libltdl based module scheme. * README (cygwin): Added some compilation notes for building m4 correctly under cygwin. * TODO: Cleaned out the entries for the module system since they are now implemented. * *.[ch]: __P is in the compiler's reserved namespace, so replaced all instances of __P with M4_PARAMS. * lib/getdate.h: removed unreferenced file. * lib/m4private.h: New file to define the private interface to the token_data struct, which must be shared between m4module.c, and builtin.c but not exported to modules built from the installed m4module.h since it's size changes depending on compile time options. * src/m4.h: Lots of stuff moved to lib/m4module.h. * lib/m4module.h: New file to define the interface available when compiling m4 modules. * lib/m4module.c: Moved parts of builtin.c, and m4.c which are necessary for module compilation into this new file. * lib/Makefile.am (include_HEADERS): install headers (renamed to avoid nameclash with other system headers) necessary for compiling modules. (libm4_la_SOURCES): always include error.c, obstack.c and regex.c so that modules can include the (renamed) installed headers and be guaranteed a matching implementation. * lib/m4error.h: renamed from error.h. * lib/m4obstack.h: renamed from obstack.h. * lib/m4regex.h: renamed from regex.h. * configure.in (AC_REPLACE_FUNCS): Don't look for a system implementation, simply include the shipped version unconditionally, otherwise it is hard for a module to know whether the m4obstack.h header it is using matches the implementation it ends up linking against. (jm_WITH_REGEX): Include regex into libm4 unconditionally for the same reason. 1999-05-18 Gary V. Vaughan * examples/misc.test: Don't run this test on machines which don't have a root user in /etc/passwd (e.g. cygwin). * tests/get-them (/^@example$/): Error messages might have a ``.exe'' suffix to the program name, or else use the libtool ``.libs/lt-m4'' binary, or generally have an unexpected path. All of these cases are now catered for when comparing error messages in generated tests. * tests/other-tests/*.test: ditto. * examples/*.test: ditto. * tests/defs (M4): use libtool execute mode. * examples/defs (M4): ditto. * tests/get-them (END): explicitly close any open file. (printthem): In a regular expression, '{' is the start of a repeat count! Use `[{]' for a literal open brace. (/^@node /): Don't use substr on a string shorter than the trim length. 1999-05-17 Gary V. Vaughan * configure.in (LTLIBOBJS): calculated from LIBOBJS, and substituted. (AC_LIBTOOL_DLOPEN): declare that this package will use dlopen. 2000-01-10 Andreas Schwab * tests/other-tests/gmp.test: Find config.sh in build directory. * configure.in: Find tests/mkconfig.sh in $srcdir. * configure.in: Define HAVE_SIGINFO_T if siginfo_t is defined in (for SUS2 compliant systems). * src/stackovf.c: Check for HAVE_SIGINFO_T in addition to HAVE_SIGINFO_H. 2000-01-10 René Seindal * Prerelease 1.4o. * TODO, NEWS: Cleaned up and updated. * src/m4.c (main): New variable exit_status for exit status in case of unreadable files. Now m4 will exit with EXIT_FAILURE if a file cannot be read instead of EXIT_SUCCESS. * src/builtin.c (m4_indir): Changed error message to help translators (from Akim Demaille ). * lib/obstack.[hc], getopt*.[ch]: Updated to newest version from Cygnus. * lib/error.[hc], lib/regex.[hc], lib/strtol.c: Updated to version from glic 2.1.2. * src/input.c (match_input): Reordering of code, to avoid multiple calls to push_string_init() from obstack_grow(), which can happen with some compilers (found and fixed by James Bonfield ). * src/stackovf.c: Added prototypes for ultrix. (setup_stackovf_trap): Added __P to cast. (Both reported by John David Anglin ) 2000-01-09 René Seindal * doc/m4.texinfo (Changequote): Added comment about changing quotes when the old quote is a part of the new. * src/builtin.c (expand_ranges): Added break after trailing dash. This caused misbehavious on some systems (found and fixed by Akim Demaille ). * AUTHORS: Thomas Tanner included * acconfig.h: Added entry for ss_sp (see below). * configure.in (use_stackovf): Added check for stack_t with member ss_base instead of ss_sp (BSDI notably). (Reported by Paul Eggert ). * doc/m4.texinfo (Frozen files): Added a simpler example for generating frozen files from several input files. 1999-11-14 Paul Eggert * po/POTFILES.in: Add lib/getopt.c, lib/obstack.c, lib/regex.c, lib/xmalloc.c. 1999-11-10 René Seindal * Makefile.am (ACLOCAL_AMFLAGS): Passes -I acm4 to aclocal. * src/module.c: reindented. (module_load): return if this is a repeated load of same module. (module_init): slight change of logic to avoid repeated initialisation debug messages. * Makefile.am (DIST_SUBDIRS): Added to ensure modules/ is included in the distribution. * modules/Makefile.am (test_la_LDFLAGS): set to -module to silence automake warnings about missing lib prefix. (time_la_LDFLAGS): ditto (stdlib_la_LDFLAGS): ditto 1999-11-10 Paul Eggert * src/m4.h: Include error.h, since our macros use error. * src/m4.c: Don't need to include error.h. 1999-11-09 Paul Eggert * src/m4.h (voidstar): Define to void * if __STDC__ is defined and zero, as Solaris 7 cc does. (bcopy): Remove macro; no longer needed with new obstack.h. * src/output.c (freeze_diversions): Don't assume that a diversion size can fit in `int'. Check for diversion file size too large to be printed with `unsigned long'. * src/Makefile.am (CFLAGS): Omit -Wall. * src/stackovf.c (setup_stackovf_trap): Remove cast to unsigned. * src/debug.c (trace_format): Use ANSI C if (defined __STDC__ && __STDC__) || defined PROTOTYPES. * src/freeze.c (produce_frozen_state): Don't assume string lengths fit in int. 1999-10-13 René Seindal * po/cs.po: Czech translation added. * po/sv.po: Updated Swedish translation. * po/ru.po: Updated Russian translation. * po/pl.po: Updated Polish translation. * po/el.po: Greek translation added. 1999-10-13 René Seindal * configure.in (ALL_LINGUAS): Added Greek translation (el). (ALL_LINGUAS): Added Czech translation (cs). 1999-03-30 Gary V. Vaughan * src/builtin.c: moved module loading functions into... * src/module.c: entirely new implementation using libltdl. * po/POTFILES.in: added src/module.c. * modules/Makefile.am (LTLIBRARIES): Removed lib prefix as these are modules, not linktime libraries. (LDFLAGS): added -no-undefined -module and -avoid-version flags. * modules/stdlib.c (m4_macro_table): use _LTX collision avoidance on exported symbols. * modules/test.c (m4_macro_table, m4_init_module, m4_finish_module): ditto. * modules/time.c (m4_macro_table): ditto. * modules/time2.m4: new file which requires command line loading of modules. * src/m4.c (--load-module): dynamically load named runtime module into running executable before reading the source. (--module-directory): prepend a directory to the module search path. (module_init()): Do this the first time we load a module instead; if the module subsystem is broken normal m4 scripts can still run. * src/m4.h (install_builtin_table): is now exported. 1999-03-26 Gary V. Vaughan * src/module.c: removed. No longer required. * po/POTFILES.in: removed src/module.c. * Makefile.am (MAINTAINERCLEANFILES): Remove all the files that the bootstrap script can recreate. * acm4/Makefile.am (MAINTAINERCLEANFILES): ditto. * doc/Makefile.am (MAINTAINERCLEANFILES): ditto. * examples/Makefile.am (MAINTAINERCLEANFILES): ditto. * lib/Makefile.am (MAINTAINERCLEANFILES): ditto. (AUTOMAKE_OPTIONS): reduced strictness to allow COPYING.LIB. * modules/Makefile.am (MAINTAINERCLEANFILES): ditto. * src/Makefile.am (MAINTAINERCLEANFILES): ditto. * tests/Makefile.am (MAINTAINERCLEANFILES): ditto. * acinclude.m4: removed. `aclocal -I acm4' handles this much better. * acm4/Makefile.am (ACINCLUDE_M4): ditto. * acm4/gettext.m4: removed. It causes a multiple definition vs. the installed gettext.m4 file when running aclocal. 1999-03-25 Gary V. Vaughan * configure.in (AM_INIT_AUTOMAKE): bumped version number to distinguish this from the last prerelease. (AC_LIBLTDL_CONVENIENCE): build libltdl as a convenience library in its own subdirectory. * modules/Makefile.am (*_SOURCES): renamed to use libtool's "no lib prefix on a module" feature. (LDFLAGS): Added `-module -avoid-version' flags to build versionless module libraries. * src/builtin.c (m4_load_module): use libltdl. (module_unload_all): use libltdl. * src/m4.c (module_init): initialise module loading on demand for better diagnostics, and so that m4 will still work even if the module code is broken. * src/m4.h (module_init): removed. No longer relevant. * modules/stdlib.c (m4_macro_table): use stdlib_LTX_ prefix on exported symbols for compatibility with dlpreopening. * modules/test.c (m4_macro_table, m4_init_module, m4_finish_module): ditto. * modules/time.c (m4_macro_table): ditto. * bootstrap: New file. Runs all the autoutils in the right order after a fresh checkout, or a make maintainer-clean. 1999-02-18 Akim Demaille * src/builtin.c (dump_symbols): New function, factoring common content of m4_dumpdef and m4_symbols. (m4_dumpdef): Use it. (m4_symbols): New function, implementing `symbols'. Use it. * doc/m4.texinfo: Fixed missing commas after @xref, so that the file compile with modern makeinfo. (Symbols): New node, documenting symbols. (direntry): Modernize. 1998-12-11 René Seindal * src/builtin.c (predefined_tab): New predefined macros __m4_changeword__, __m4_gmp__ and __m4_modules__ for testing for configure time options. 1998-12-01 Andreas Schwab * src/module.c (module_try_load): Don't try to be clever and overwrite argument string. Instead allocate all constructed strings locally, since they can have arbitrary lengths. Make arguments pointers to const. (module_search): Simplify due to above change. 1998-11-29 René Seindal * Prerelease 1.4n. * tests/Makefile.am (OTHER_TESTS, OTHER_FILES): New tests. * tests/other-tests/import-environment.{m4,test}: New test. * tests/other-tests/discard-comments.{m4,test}: New test. * doc/m4.texinfo (Invoking m4): Updated for --discard-comments. * src/m4.c (main): New option -c --discard-comments. New global variable discard_comments. * src/m4.h (token_type): New TOKEN_NONE for tokens to be discarded, ie never returned from next_token(). Added declaration of discard_comments. * src/input.c (next_token): Now loops until token type is not TOKEN_NONE. Comments are now given this type when comments should be discarded. * doc/m4.texinfo (Invoking m4): Updated for --import-environment and mpeval. 1998-11-28 René Seindal * src/m4.c (main): New option --import-environment (no single letter option). * When configured with --with-gmp both the normal (fast) eval() and the gmp aware mpeval() are defined. To restore previous bahaviour use "define(`eval', defn(`mpeval'))". * tests/other-tests/gmp.m4: Changed to use mpeval(). * src/evalmp.c: New file for compiling eval.c as gmp aware. Just defines USE_GMP if WITH_GMP is defined and includes eval.c. * src/eval.c: Now includes "numb.c" directly. Everything in this file must by static, except evaluate(), which is changed to mp_evaluate() if USE_GMP in force. * src/numb.c: Changed to be included by eval.c instead of being compiled separately. Everything is declared static. * src/numb.h: Removed declarations of functions, as numb.c is now included by eval.c. * src/builtin.c: Declaration of m4_mpeval() added. Inserted `mpeval' in builtin table. (do_eval): New function with common code for m4_eval and m4_mpeval. (m4_mpeval): New function for gmp version of eval. * src/m4.h: Declaration of mp_evaluate(). * src/Makefile.am (m4_SOUCES): Includes mpeval.c. (EXTRA_m4_SOURCES): Now has numb.c and numb.h * src/m4.c (main): m4 --version also shows which options were used for compilation, such as: "GNU m4 1.4n (options: modules gmp)" 1998-11-27 René Seindal * Error messages now always print program name before input file name as specified by GNU coding standards. Reported by Akim Demaille . * doc/m4.texinfo (Include): Change due to changed error message format. (Eval): Do. * tests/get-them: Minor change to sed script due to changed error message format. * src/m4.c (print_program_name): New func used to print program name, input file and line number in error (). Used as an error_print_progname handler. (reference_error): Removed. (main): Assigns error_print_progname. * src/m4.h (M4ERROR): Removed reference_error (). 1998-11-25 René Seindal * Updated to libtool 1.2b. * src/builtin.c (install_builtin_table): Added braces to avoid warning of ambiguous 'else'. * src/module.c: Inserted search path code from path.c modified to use new interface. (module_init): Configured default path used only if M4MODPATH is not set. (module_try_load): Now reads libMODULE.la as generated by libtool for actual module name. (module_load): Gives better error messages on failure. * src/m4.h: Added declarations of structures and functions for generic search path handling. * src/path.c: Removed all module specific code and introduced new functions of more generic search path handling. 1998-11-24 René Seindal * configure.in: Defines INTLINCL to -I$(top_srcdir)/intl if using included gettext, as might not be found otherwise. Reported by Andrew Bettison . 1998-11-22 René Seindal * src/output.c (insert_diversion): Fixed bug that might cause m4 to read from standard output! Triggered by input 'divert(1)undivert(0)'. Test for divnum>0 changed to divnum>=0, so now 'undivert(0)' does nothing. 1998-11-18 René Seindal * Prerelease 1.4m. * src/input.c (set_word_regexp): Fixed a bug, where word_regexp could be changed when compiling a illegal regexp, causing later use of the regexp to dump core. * src/module.c (module_load): Changed error message to conform to standards. * src/m4.c (usage): Added message about reporting bugs. * doc/m4.texinfo (Changeword): Corrected a wrong example. (Changeword): Added note about the type of regexps used. * ltconfig, ltmain.sh: New files from Libtool 1.2. * configure.in: Added calls to AM_ENABLE_SHARED, AM_DISABLE_STATIC and AM_PROG_LIBTOOL. * acm4/modules.m4 (AM_WITH_MODULES): Redone completely to work with libtool. * modules/Makefile.am: Changed completely to compile modules using libtool. The modules are compiled as shared libraries, and are renamed when installed. * src/m4.h, src/module.c, acm4/modules.m4, acconfig.h: Renamed USE_SHL_LOAD to HAVE_SHL_LOAD * src/builtin.c (shipout_string): Now tests for a NULL string. * src/module.c: New level of indirection around non-portable functions to load shared objects. Intended to encapsulate the non portable parts better and to reduce the number of #ifdefs in the code. * Makefile.am (DIST_SUBDIRS): Instead of EXTRA_DIST for added directory modules/ to the distribution. 1998-11-15 René Seindal * Prerelease 1.4l. * modules/stdlib.c: New module `stdlib' defining some standard functions: getcwd, getlogin, getpid, getppid, getuid, getpwnam, getpwuid, hostname, rand, srand, getenv, setenv, unsetenv, uname. * src/builtin.c (shipout_string): New convenience function for builtins and modules. * src/module.c (module_load): Tentative support for shl_load/shl_findsym, but I cannot test it. Copied from MetaHTML. * Makefile.am (SUBDIRS): Directory modules added if configured. * modules/Makefile.am: Now correctly compiles and installs modules in pkglibexecdir. * src/m4.h: WITH_MODULES defined iff HAVE_DLOPEN or USE_SHL_LOAD. These two are now initialised by autoconf macros. * src/path.c (module_env_init): MODULE_PATH is always on the search path. * src/Makefile.am: Now generated pathconf.h which defined the default MODULE_PATH. * configure.in (pkglibexecdir): Added defintion of pkglibexecdir, where modules are installed. * acm4/modules.m4: Enhanced with code from MetaHTML, contributed by Brian J. Fox . This change allow modules to build and install automatically, and it is prepared for other interfacec than dlopen(). * src/builtin.c (predefined_tab): Added __m4_version__ for the current version of GNU m4. It is a GNU extension. 1998-11-14 René Seindal * tests/Makefile.am (GENERATED_TESTS): Added new generated-tests/changesy.8.test * doc/m4.texinfo (Changesyntax): Documentation for escape syntax class. * src/macro.c (expand_token): Check for escaped macro call before symbol table lookup. * src/builtin.c (m4_changesyntax): Added `@' flag to define escape characters * src/input.c: New static variable use_macro_escape, which is TRUE iff some character has code SYNTAX_ESCAPE (input_init): Added initialisation of use_macro_escape. (check_use_macro_escape): New function to synchronise use_macro_escape with the syntax table. (set_quotes): Added call to check_use_macro_escape() (set_comment): Do. (set_syntax): Do. (next_token): Added new case for IS_ESCAPE. * src/m4.h (SYNTAX_ESCAPE): Defined as simple syntax category. 1998-10-13 René Seindal * Prerelease 1.4k. * tests/Makefile.am (GENERATED_TESTS): Renamed gentest to generated-tests. * tests/Makefile.am (OTHER_TESTS, OTHER_FILES): Added manually maintained tests in tests/other-tests. These currently tests for 8-bit transparency, multiple precision arithmetic and sync-line output. Test for stackoverflow detection does not work. * examples/Makefile.am (TESTS): Added tests for all example files. * examples/mktests.sh: New file. Help program for creating test files. * tests/mkconfig.sh: New file to generate tests/config.m4 and tests/config.sh. This is for tests of configure selectable features. Picks up all set WITH_ and ENABLE_ veriables from config.h * src/path.c (path_search): Added argument 'char **expanded_name' to return the expanded name. * src/m4.h: Added 2nd argument to declaration of path_search(). * src/m4.c (main): Added 2nd argument to path_search(). * src/freeze.c (reload_frozen_state): Do. * src/builtin.c (m4_undivert): Do. (include): Do. 1998-10-11 René Seindal * acm4/Makefile.am (ACINCLUDES_M4): Added gmp.m4 and modules.m4 * acm4/modules.m4: New file. Defines AM_WITH_MODULES. * acm4/gmp.m4: New file. Defines AM_WITH_GMP. * configure.in: Introduced AM_WITH_MODULES and AM_WITH_GMP. * AUTHORS, ChangeLog: Changed all dates to ISO 8601. * intl/: Updated to GNU gettext 0.10.35. * doc/m4.texinfo (Format): Documented that format is blind. * src/builtin.c (builtin_tab): Builtin format marked as blind. 1998-10-07 René Seindal * Prerelease 1.4j. * tests/Makefile.am (GENERATED_TESTS): Changed .m4 extension to .test, as the files are no longer just m4 input. * tests/get-them (FILE): Changed .m4 extension to .test. * src/m4.h (token_type): New token type TOKEN_SPACE introduced. Otherwise quoted strings with leading whitespace first in a macro argument would be eliminated. * src/macro.c (expand_token): Handles new token type TOKEN_SPACE. (expand_argument): Do. * src/input.c (next_token): SPACE and NUM/OTHER characters are only grouped together iff both quote and comment strings are single character. Otherwise they might include a comment/quote leader. (next_token): Returns new token type TOKEN_SPACE. * src/builtin.c (push_builtin_table): New function to push a builtin_table on the stack without installing its contents. (find_builtin_by_name): Added call to push_builtin_table() if reading frozen files. Otherwise the builtins named in the frozen files could not be found. (install_builtin_table): Changed to use push_builtin_table() 1998-10-04 René Seindal * po/pl.po: Polish translation added. * po/POTFILES.in: src/module.c added. 1998-10-04 René Seindal * Prerelease 1.4i. * configure.in (ALL_LINGUAS): Added Polish pl.po 1998-10-03 René Seindal * Many files: Incorporated changes to implement dynamic modules. Detailed comments in src/modules.c and modules/README * src/module.c: New file, implements the OS dependant parts of dynamic module loading. * src/Makefile.am (m4_SOURCES): Added module.c * src/builtin.h: New file, declares some functions from builtin.c that are of use for other modules (shipout_int, numeric_arg, skip_space, bad_argc), and the macros ARG() and DECLARE(). * src/builtin.c (install_builtin_table): New function. Each module brings in a builtin_table, which is pushed on a stack. (struct builtin_table): New struct for list of builtin_tables. (m4_loadmodule): New function to implement builtin "loadmodule". (shipout_int): No longer static, to be used by modules. (numeric_arg): do. (skip_space): do. (bad_argc): do. (builtin_init): changed to call install_builtin_table() (find_builtin_by_name): Now searches all builtin_tables (find_builtin_by_addr): do. * src/path.c: Reorganised to allow for two search paths, one for include files and one for modules. * src/m4.h: Added declarations for new functions in module.c and in path.c. * src/m4.c (main): Added call to module_init(). * modules: New directory with a few demo modules. * Makefile.am (EXTRA_DIST): Added modules/* since modules/ is not in SUBDIRS. * configure.in: Added modules/Makefile to AC_OUTPUT. * configure.in: Added code to implement --with-modules. Tests for and -ldl. * acconfig.h: Added WITH_MODULES 1998-10-02 René Seindal * examples/Makefile.am (pkgdata_DATA): Removed special target for check and variables TESTS. These tests are now run from the tests/ directory. * tests/Makefile.am (OTHER_TESTS): Added tests from the example/ directory. The files stay there but the tests are run from the tests/ directory. * tests/Makefile.am (EXTRA_DIST): Added run-test. * tests/run-test: New file. Run a test manually * tests/Makefile.am, tests/get_them: Moved automatically generated tests (from the manual) to sub directory tests/gentest/. The tests/ directory had gotten a bit messy. 1998-09-06 Erick Branderhorst * examples/{comments,ddivert,debug,iso8859,reverse,sysv-args,\ wrap}.test: Added a few testcases. 1998-08-21 Erick Branderhorst * Prerelease 1.4h. * lib/Makefile.am (noinst_HEADERS): regex.h added * configure.in (jm_WITH_REGEX, jm_PREREQ_ERROR): acm4/{error,regex}.m4 (from fileutils-3.16u.tar.gz). * acm4/Makefile.am: created providing rules to create $(top_srcdir)/acinclude.m4 to be used by aclocal. * tests/defs (LANGUAGE, LC_ALL, LANG): force them to be `C'. Reported by Ulrich Drepper. * Makefile.am (SUBDIRS): Removed checks directory * configure.in (AC_OUTPUT): Removed checks/Makefile * doc/m4.texinfo (Patsubst,example): @comment added to preserve the space when m4.texinfo is edited and whitespace.el is active. (Defn,example): idem. 1998-08-20 Erick Branderhorst * doc/m4.texinfo (Esyscmd): grep ../Makefile instead of ../COPYING. ../Makefile is a file which is certainly present when test is executed in testSubDir. One can't be sure that the COPYING file is in .. or ../.. in all situations, the ../Makefile is always there. * doc/m4.texinfo (Include): adjusted expected test output according to new tests, i.e. the input will always come from the file `in' created by the test. * tests/Makefile.am: Added three lines at the top to get esyscmd.1.test working. * tests/get-them: modified to generate clearer tests who will need less maintenance when new test examples are created in `doc/m4.texinfo'. All tests are small (nearly stand-alone, they need the generic file `defs') shell scripts creating `in', `ok', `out' and when apropriate `okerr' and `err' in the directory `testSubDir' when executed. The compare of `ok' and `out' (and of `okerr' and `err') will be the exit status of the test. `out' must match `ok' (and `okerr' must match `err') for the test to be succesful. * tests/[a-b]\{1,8\}.[0-9]+.test: This namespace is reserved for the tests generated by tests/get-them getting it input normally from doc/m4.texinfo. The namespace tests/[a-b]+[0-9]+.test (no `.' (dot) before the numeric part) is reserved for all other (hand written) tests. The `+' means one or more times. 1998-08-12 Erick Branderhorst * doc/Makefile.am (EXTRA_DIST): helptoman.pl and $(MANS) to supported short man page to refer to info documentation * helptoman.pl: added * configure.in: AC_PATH_PROG(PERL,perl) * Makefile.am (SUBDIRS): doc after src * libitized with libit 0.5 from ftp://ftp.iro.umontreal.ca/pub/contrib/pinard/maintenance/libit. * configure.in (AC_REPLACE_FUNCS): added xmalloc xstrdup * lib/Makefile.am (libm4_a_SOURCES): removed automakely supported replacement functions, (libm4_a_LIBADD): @LIBOBJS@ * configure.in (AM_WITH_REGEX), acconfig.h (WITH_REGEX): added lib/rx.{c,h}: added * configure.in (AC_CHECK_FUNC): getopt_long * src/m4.c (usage): Report bugs to m4-bugs@gnu.org. * TODO: added entry about dependencies 1998-08-10 René Seindal * Prerelease 1.4f * doc/m4.texinfo (Changesyntax): Added documentation for the macro "changesyntax". * src/builtin.c (m4_changesyntax): Added builtin macro "changesyntax" to modify the syntax table. * src/input.c, src/m4.h, src/macro.c: Implemented an input syntax table. All categories are assigned a syntax code and tokens are read according to this table. 1998-08-09 René Seindal * src/numb.{c,h}: New files, implements multiple precision eval using GNU gmp. Originally submitted by John Gerard Makecki (johnm@vlibs.com), later modified. Tested with GNU gmp 2.0.2. * doc/m4.texinfo (Eval): Added documentation for multiple precision arithmetic library support. * src/m4.{c,h}, src/eval.c, src/builtin.c, configure.in: Changes to accommodate multiple precision eval. 1998-08-07 René Seindal * src/input.c (MATCH, match_input), src/m4.h: changed definition of comment and quote strings to `unsigned int' to allow eight bit chars (reported by andrewb@zip.com.au (Andrew Bettison)). * src/builtin.c, doc/m4.texinfo: Builtin `syncoutput' added by patch from Mike Howard 1998-08-06 René Seindal * gettext.m4: corrected AM_WITH_NLS to handle use of installed -lintl. 1998-08-03 René Seindal * Prerelease 1.4e * src/m4.h: Added ifdef ENABLE_NLS around include of and _ macro. M4 now builds with --disable-nls. * src/m4.c (main): reintroduced textdomain(PACKAGE) to get gettext to look for right message catalogs. Call indef'ed by ENABLE_NLS. * configure.in (ALL_LINGUAS): Added complete list of translations: de fr it ja nl ru sv. 1998-05-23 Erick Branderhorst * po/nl.po: Dutch translation by Erick Branderhorst. * po/fr.po: French translation by Erick Branderhorst, based on the translations by François Pinard in fr.msg and m4.cod. 1998-05-22 Erick Branderhorst * Prerelease 1.4d. * src/m4.c: #include not . * src/Makefile.am: CFLAGS = -Wall @CFLAGS@. * checks/Makefile.am: explicit list tests in CHECKS. * configure.in, {,src,doc,lib,examples,checks}/Makefile.am, src/{ansi2knr.{1,c}} doc/{m4.texinfo,mdate-sh}, missing, mkinstalldirs, install-sh: Added automake (1.3) support. * lib/{alloca.c,error.{c,h},get{date.h,opt.{c,h},opt1.c}, obstack.{c,h},regex.{c,h},strtol.c,xmalloc.c,xstrdup.c}: Used libitize (0.4) to update. * configure.in, ABOUT-NLS, intl/*, po/*: Added gettextize (0.10.25) support. Removed LOCALE, fr.msg, m4.cod and adjusted README accordingly. * src/stackovf.c: #ifdef USE_STACKOVF ... #endif to (de-)activate stack overflow functionality. 1994-12-03 François Pinard * Prerelease 1.4.1. * Makefile.in (realclean-local): Delete stamp-h.in. * configure.in, {,src,lib}/Makefile.in, src/m4.h, src/m4.c: Localize, adapting from how it is done in sharutils. * fr.tt: New file, for French. * configure.in, {,*/}Makefile.in, acconfig.h, src/m4.c, src/freeze.c: Rename PRODUCT to PACKAGE. 1994-11-26 François Pinard * configure.in: Check for and . * src/m4.h, src/builtin.c, src/debug.c, src/eval.c, src/macro.c, src/stackovf.c: Rename _ to __P. * src/m4.h: Declare _ as a macro returning its argument, or else, include and declare _ as gettext. * src/m4.c: Possibly include and call setlocale. * src/m4.c, src/builtin.c, src/debug.c, src/eval.c, src/freeze.c, src/input.c, src/macro.c, src/output.c, src/path.c, src/stackovf.c, src/symtab.c: Use _ macro over all localizable strings. 1994-11-07 François Pinard * doc/Makefile.in (stamp-vti): Use new -r option to date. * configure.in: Put --with-gmp in place, in prevision for John Gerard's work. * acconfig.h: Document WITH_GMP. 1994-11-05 François Pinard * Release 1.4. * doc/Makefile.in (realclean): Also remove stamp-vti. Reported by Eric Backus. 1994-11-02 François Pinard * src/freeze.c (produce_frozen_state): If the frozen file cannot be opened, return immediately after producing the error message. Reported by Andreas Schwab. * configure.in: Check for const only after having found possible ANSIfying compiler flags, this is of no use to check it before. Reported by Alexander Lehmann. 1994-11-01 François Pinard * src/macro.c (collect_arguments): Cast obstack arguments to (voidstar), so avoiding compiler warnings. Reported by Joseph E. Sacco. * src/freeze.c (produce_frozen_state): Cast printed lengths to (int) so they correspond to %d format items. Reported by Joseph E. Sacco. * src/m4.c (main): Cast the argument to xfree to (voidstar). * src/symtab.c (free_symbol): Idem. Reported by Karl Vogel. 1994-10-31 François Pinard * Makefile.in (DISTFILES): Distribute BACKLOG. * configure.in: Define PRODUCT and VERSION. * acconfig.h: Document PRODUCT and VERSION. * src/m4.c, src/freeze.c: Use PRODUCT and VERSION instead of the constant string m4 and variable or parameter named version. 1994-10-30 François Pinard * src/m4.h, src/debug.c: Replace all #ifdef __STDC__ by #if __STDC__. Alliant FX/2800 Concentrix 2.2 (i860-BSD4.3) compiler defines __STDC__ to 0, for indicating it is *not* ANSI! Reported by Kaveh R. Ghazi. * configure.in: Added obsolescent tests for AIX and Minix. * doc/Makefile.in (mostlyclean): Remove texclean in dependencies, which texclean does not exist anymore. Reported by Eric Backus, Jim Meyering, John David Anglin and Joseph E. Sacco. 1994-10-29 François Pinard * aclocal.m4 (fp_C_PROTOTYPES): Force -D_HPUX_SOURCE with -Aa. Reported by John David Anglin. * src/ansi2knr.c: New version, sent by Peter Deutsch. * aclocal.m4 (fp_C_PROTOTYPES): Substitute empty or ansi2knr for ANSI2KNR, depending on the fact the compiler is ANSI or not. * src/Makefile.in: Use -Ovarargs=convert on ansi2knr calls. Remove the sed filter after ansi2knr for debug.c. Use $O instead of $U, put underline in extensions rather than in basenames. Use implicit rules, now that regularity makes this possible. Have $(OBJECTS) depend on $(ANSI2KNR), so to trigger compilation of ansi2knr whenever it is needed. * configure.in: Adjusted for correct STACKOVF substitution. * src/debug.c (trace_format): When not __STDC__, use (...) as a parameter list, so ansi2knr will convert it to (va_alist) va_dcl. Reported by David MacKenzie. * Makefile.in: Remove binprefix. Use transform_name instead. Reported by David MacKenzie. * doc/Makefile.in: Create version.texi, use it, clean it. Reported by Jim Meyering. 1994-10-28 François Pinard * Makefile.in (all, install, uninstall): Depend on Makefile. * Makefile.in: For actions invoking $(MAKE) from within compound sh statements, exit non-zero if the sub-make fails. Otherwise, the top-level make may exit successfully when it should fail. Reported by Jim Kingdon. * {,/*}Makefile.in: Use && after all cd, in case they fail. * {,*/}Makefile.in: Declare PRODUCT and VERSION macros. (dist): Use PRODUCT and VERSION instead of tricks on .fname. * configure.in: Substitute PRODUCT and VERSION. * {,*/}Makefile.in (dist): Always try a hard link before a copy. 1994-10-27 François Pinard * Makefile.in (mostlyclean-local): Do not remove *~. * */Makefile.in (mostlyclean): Idem. Reported by Robert E. Brown and Richard Stallman. 1994-10-09 François Pinard * src/m4.h: Get rid of CONFIG_BROKETS. 1994-10-02 François Pinard * configure.in: Use AC_ARG_PROGRAM. * aclocal.m4 (fp_C_PROTOTYPES): Substitute @kr@ by kr or empty. Reported by David MacKenzie. 1994-10-01 François Pinard * configure.in: Do not add -O to CFLAGS for GNU C, now that configure does it automatically. Reported by Jim Meyering. 1994-09-23 François Pinard * src/stackovf.c: Declare the handler_t typedef earlier in the code, use it for stackovf_handler. (setup_stackovf_trap): Use RETSIGTYPE instead of void while casting sigsegv_handler. Reported by Robert Bernstein. * src/m4.c (main): Initialize program_name to argv[0] without basename'ing it. Reported by Karl Berry. 1994-09-18 François Pinard * src/Makefile.in (TAGS): Include a ../lib/TAGS reference. Reported by Karl Berry. 1994-09-14 François Pinard * lib/Makefile.in (mostlyclean): Added. (TAGS): Make in $(srcdir). * configure.in: Use `choke me' in test, like everywhere! * {doc,examples,lib,src}/Makefile.in (check): Deleted, as unreacheable and useless. * doc/Makefile.in (texclean): Deleted, merged in mostlyclean. * lib/Makefile.in (DISTFILES): Distribute TAGS. (distclean): Do not remove TAGS. (realclean): Remove it. * Makefile.in: Make TAGS in lib also, not just in src. Reported by Karl Berry. * Makefile.in (distclean, realclean): Instead of recursively calling $(MAKE) for the -local part, allow parallel execution of -recursive and -local, only delay the removal of config.status, which is repeated in both goals. 1994-09-13 François Pinard * Release 1.3. * Makefile.in: Group all *clean-recursive goals in one, using sed to remove `-recursive' while calling make recursively. Also, use a subshell for each recursive $(MAKE). Reported by Jim Meyering. * src/m4.h (memcpy): Define with bcopy for BSD systems. Reported by Kaveh R. Ghazi. * src/Makefile.in (ansi2knr): Use $(LIBS) while linking, for SunOS 4.1.3 requires -ldl to link even ansik2nr, and we need a way to specify it. * configure.in: Use date instead of touch for stamp-h. * Makefile.in (stamp-h.in): Idem. * Makefile.in (distclean, realclean): Force serial execution of both goals, in case parallel makes are being used. Reported by Jim Meyering. * src/Makefile.in (DISTFILES): Distribute TAGS. (distclean): Do not remove TAGS. (realclean): Remove it. Reported by Karl Berry. 1994-09-10 François Pinard * configure.in: Use fp_ to match aclocal.m4. Revert _OS_ macros to old names, for following Autoconf. 1994-09-08 François Pinard * Makefile.in (MDEFINES): Remove INSTALL substitutions, for ./install.sh will not be correctly referred to in sub-Makefiles. Reported by John David Anglin. * doc/Makefile.in (texclean): Remove *.cps and *.fns too. Reported by Eric Backus. * Makefile.in, checks/Makefile.in, doc/Makefile.in, examples/Makefile.in, lib/Makefile.in, src/Makefile.in: Limit config.status into remaking this directory's Makefile only. * Makefile.in (stamp-h): Do not check nor touch stamp-h. * configure.in (AC_OUTPUT): Touch stamp-h if CONFIG_HEADERS. Reported by Jim Meyering. 1994-09-06 François Pinard * configure.in: Correct stack overflow detection logic, taking care of systems having only incomplete implementations (like for Pyramid 9820 OSx 5.0d). Reported by Kaveh R. Ghazi. * src/Makefile.in (TAGS): Remote -t from etags call. 1994-09-02 François Pinard * lib/Makefile.in (install): Depend on all. 1994-08-31 François Pinard * examples/Makefile.in (mostlyclean): Do not depend on texclean. Reported by Jim Meyering and John David Anglin. * Makefile.in (distclean-local): Delete config.log. Reported by Jim Meyering. Solidify frozen files with respect to -P: * src/m4.c: Have -P set prefix_all_buitins variable instead of calling a function by that name. Declare the variable. * src/m4.h: Adjust declaration for prefix_all_buitins. * src/builtin.c (builtin_init): Merge in functionality from previous prefix_all_buitins function, while making entries in the symbol table, but not modifying the builtin description itself. * src/freeze.c (reload_frozen_state): Add a useless `break;', because *many* compilers do not accept an empty `default:'. Reported by Akiko Matsushita, Eric Backus, John David Anglin, Joseph E. Sacco, Kaveh R. Ghazi, Tom McConnell and Ulrich Drepper. * configure.in: Use AC_TYPE_SIGNAL. * src/stackovf.c (setup_stackovf_trap): Use RETSIGTYPE. Reported by Robert Bernstein. * checks/Makefile.in (check): Modify PATH so check-them will find m4 in the src directory. * Makefile.in (check): Don't. Reported by Akiko Matsushita and Jim Meyering. * src/output.c (make_room_for, output_character_helper): New functions, for implementing a global MAXIMUM_TOTAL_SIZE instead of a per buffer MAXIMUM_BUFFER_SIZE. * src/output.c (output_text): New function, for optimizing the output of strings of characters. Use it. 1994-08-30 François Pinard * doc, src: New directories reorganizing the distribution. * doc/Makefile.in, src/Makefile.in, examples/Makefile.in: New files. * Makefile.in: Adjusted. * configure.in: Configure new Makefiles. * m4.h: Declare STRING typedef. Use it for comment and quote strings, adjusting all references. (This is the rudiments of a beginning for the eventual withdrawal of NUL terminated strings.) * output.c (shipout_text): Accept a length parameter, and use it. All callers adjusted. 1994-08-29 François Pinard * m4.h: Include if it exists. * stackovf.c: Don't. Clean up for current_diversion variable: * output.c: Move current_diversion from builtin.c. * m4.h: Declare current_diversion so builtin.c can access it. * output.c (output_init, make_diversion): Initialize or update current_diversion. * builtin.c (builtin_init, m4_divert): Leave current_diversion alone. Remove limit on number of diversions: * output.c: Replace ndiversion by diversions, declare it. (output_init): Allocate only diversion 0. (make_diversion): Allocate new diversions as needed. * m4.h, m4.c: Remove NDIVERSIONS and ndiversion related stuff. * m4.c: Still accept -N, but do nothing with it. Reported by David MacKenzie. Freeze diversions: * output.c (freeze_diversions): New function. * m4.h: Declare freeze_diversions. * freeze.c: Document frozen file format, revise it, call freeze_diversions to add diversions to frozen format, and code to reload them properly. * m4.c: Do not undivert automatically at end when status being frozen. Do not call builtin_init when reloading frozen state. Speed up diversion processing: * output.c: Add INITIAL_BUFFER_SIZE, MAXIMUM_BUFFER_SIZE, COPY_BUFFER_SIZE, in-memory diversion buffers, struct diversion structure and variables, cached variables out of output_diversion, reallocate_diversion_for and OUTPUT_CHARACTER. (shipout_text, make_diversion, insert_diversion): Adapted to new structures. (insert_file): Use better buffering. Reported by David MacKenzie. 1994-08-28 François Pinard * Makefile.in, lib/Makefile.in, checks/Makefile.in: Arrange so dist works from another build directory. 1994-08-27 François Pinard * symtab.c (hack_all_symbols): Use hash_table_size instead of constant HASHMAX, for -H option to work better. * builtin.c (DECLARE): Simplify by using _ (). * freeze.c: New file. * Makefile.in: Compile it, distribute it. * m4.c: Recognize, document and process --freeze-state (-F) and --reload-state (-R) options. Pass a true flag to builtin_init only if no reloading some state. * builtin.c (define_builtin): Remove static specifier. (find_builtin_by_name): Remove static specifier. (builtin_init): Accept and obey a flag argument. * m4.h: Add declarations for freeze.c, changes for builtin.c. 1994-08-24 François Pinard * builtin.c (dumpdef_cmp): Rewrite so the cast protect the const specifier. * configure.in: Implement --with-dmalloc. * acconfig.h: Document WITH_DMALLOC. * m4.h: Add code for when WITH_DMALLOC. 1994-08-15 François Pinard * m4.c (long_options): Use "error-output", the dash was missing. Reported by Akiko Matsushita. 1994-08-12 François Pinard * m4.h: Include . * builtin.c, debug.c, m4.c, output.c, stackovf.c: Don't. * m4.h: Declare len_lquote and len_rquote as size_t, not int. int. * input.c: Declare len_lquote, len_rquote, len_bcomm and len_ecomm as size_t, not int. * builtin.c (dump_args): Declare len as size_t, not int. * debug.c: Prototype the forward declaration of debug_set_file. * builtin.c (m4_undivert): Replace div by file, for avoiding the shadowing of this variable. * output.c (insert_diversion): Idem. * input.c: Delete def_rquote, def_lquote, def_bcomm and def_ecomm. (input_init): Duplicate default quote and comment strings. (set_quotes): Free previous quote strings in all cases. Duplicate even default quote strings. (set_comment): Free previous comment strings in all cases. Duplicate even default comment strings. * configure.in: Updated for Autoconf 2.0. * Makefile.in (distclean-local): Also delete config.cache. * m4.c (usage): Reorganize the --help output by topic. Include a description for debugging flags. 1994-07-29 François Pinard * configure.in: If sigaction is available and SA_ONSTACK defined, use sigaction. Otherwise, if sigvec is available and SV_ONSTACK defined, use sigvec. Else don't compile stackovf.c. * stackovf.c (setup_stackovf_trap): Idem. Reported by Jim Avera, Karl Berry, Kaveh R. Ghazi, Matthias Rabe and Simon Leinen. 1994-07-21 François Pinard * m4.c (usage): Replace printf par fputs. 1994-07-18 François Pinard * Release 1.2 1994-07-17 François Pinard * configure.in: Check for sigaction and sigvec. Add a new delayed check for RLIMIT_STACK, combine in the checking for getrlimit. All those things are not universally available. * stackovf.c: Split setting up the trap handler and catching signals, for better taking care of various configure outcomes. * examples/stackovf.sh: Correct a typo. Reported by Eric Backus, Jim Avera and Jim Meyering. 1994-07-16 François Pinard * ansi2knr.c: New version sent by its author, Peter Deutsch. 1994-07-15 François Pinard * Makefile.in: Modify so parallel make will not try making lib/libm4.a twice simultaneously. Reported by Jim Meyering. 1994-07-14 François Pinard * stackovf.c (setup_stackovf_trap): Replace "Don't" by "Do not" in error message, for when no code possibility exists. Even if this line is completely #ifdef'ed out, it brings a syntax error. Reported by Andreas Schwab, Jim Meyering and Joseph E. Sacco. * Makefile.in (install): Have install depend on all too, for lib to be remade as needed. * examples/stackovf.sh: Try ksh, bsh and bash for shells providing ulimit, instead of using only ksh. Reported by Jim Avera and Joseph E. Sacco. 1994-07-12 François Pinard * Makefile.in (check): Have it depend on all instead of m4. In this way, a change in lib will be detected and processed. * builtin.c (numeric_arg): Use strtol and verify the conversion, instead of using sscanf which stops as soon as there is a non-digit in the input. Previously, incr(1xyzzy), eval(1,2xyzzy) and divert(1xyzzy) were all accepted without any warning or error messages. * m4.h: Declare strtol as long if not including stdlib.h. * configure.in: Check for limits.h, and replace strtol if missing. * lib/Makefile.in: Substitute LIBOBJS. Distribute strtol.c. * lib/strtol.c: New file, from elsewhere. Reported by Andreas Schwab. 1994-07-07 François Pinard * macro.c (expand_macro): Cast value to (boolean) prior to assigning it to traced. Reported by Tom McConnell. * Makefile.in (m4): Always make all in lib first. Reported by Jim Meyering. 1994-07-06 Jim Avera * stackovf.c: Isolated OS-dependent sections; Improved portability, adding support for SunOS/BSD (sigvec, sigstack, and 4-parameter signal handlers), and a default error message if the fault address is not available (when neither siginfo.h nor BSD sigcontext are supported). * configure.in: Changes for stackovf.h: Check for sigcontext, sigaction, sigstack, and define rlim_t as int if necessary. * acconfig.h: Added HAVE_SIGCONTEXT and rlim_t. * examples/stackovf.sh: Run m4 -L99999999 to allow stack overflow. * ansi2knr.c: Fix for func-ptr args; convert "..." to varargs syntax. 1994-07-05 François Pinard * configure.in: Use AC_SET_MAKE. * Makefile.in: Use @SET_MAKE@. Reported by Jim Meyering. * checks/check-them: Do not trap on SIGQUIT or SIGALRM. Reported by Ian Taylor. 1994-07-02 François Pinard * configure.in: Remove dependency of USE_STACKOVF on STDC_HEADERS, because siginfo.h is unrelated to standard headers, and siginfo.h is already checked for. Reported by Joseph E. Sacco. * acconfig.h, aclocal.m4, m4.h: Replace HAVE_PROTOTYPES by PROTOTYPES. * aclocal.m4, configure.in: Replace AC_HAVE_PROTOTYPES by AC_PROTOTYPES. 1994-06-29 François Pinard * builtin.c (substitute): Use \& to represent this part of the string which was matched by the whole regexp, instead of representing the whole string. Any usage of \0 issues a warning and acts like \&, it will disappear in some subsequent release. 1994-06-27 François Pinard * m4.c: Complete prototype for forwarded declaration of usage. * input.c (init_macro_token): Correct own reference in error message. Previous name get_macro_func was referred to instead. (next_char): Correct own reference in error message. Previous name advance_input was referred to instead. * m4.h: Declare eval_t and unsigned_eval_t typedefs to 32 bits. * eval.c (logical_or_term, logical_and_term, or_term, xor_term, and_term, not_term, logical_not_term, cmp_term, shift_term, add_term, mult_term, exp_term, unary_term, simple_term): Add prototype to forwarded declarations. Declare parameter v1 as eval_t * instead of int *. Same for local variable v2 in dyadic functions. Same for result in exp_term. * builtin.c (m4_eval): Declare value as eval_t instead of int. (ntoa): Declare value as eval_t instead of int. Declare uvalue as unsigned_eval_t instead of unsigned int. Change casts accordingly. (shipout_int): Cast first argument of ntoa to eval_t. Reported by Thorsten Ohl. * macro.c: Complete the prototypes of forwarded expand_macro and expand_token. Reported by Thorsten Ohl. * m4.h: Define voidstar as void * or char * depending on __STDC__. The Ultrix 3.1 compiler cannot do much with void pointers. * builtin.c (dumpdef_cmp): Replace void * by voidstar. * m4.c (xfree): Replace void * by voidstar. Reported by Tom McConnell. * ansi2knr.1: New, from elsewhere. * Makefile.in (DISTFILES): Distribute ansi2knr.1 * Makefile.in (stamp-h.in): Avoid running ./config.status if stamp-h does not exist yet. This avoids running it a second time just after the initial ./configure. Reported by David MacKenzie and Tom McConnell. * m4.h: Replace the enum debug_info declaration with a series of #define's. The Ultrix 3.1 compiler would otherwise need casting (int) to most references, when used in expressions. Reported by Tom McConnell. 1994-06-25 François Pinard * aclocal.m4: Replace FP_PROTOTYPES by AC_HAVE_PROTOTYPES, following an idea from Brook G. Milligan. AC_HAVE_PROTOTYPES calls the compiler. Previously, FP_PROTOTYPES was only calling the preprocessor; by not being subject to CFLAGS, this was discouraging those flags asking for ANSI compilation. * acconfig.h: Document HAVE_PROTOTYPES. * configure.in: Use AC_HAVE_PROTOTYPES instead of FP_PROTOTYPES. * m4.h: Define _() according to HAVE_PROTOTYPES, not __STDC__. Reported by Eric Backus. * configure.in: Substitute CFLAGS and LDFLAGS, taking their value from the environment. Default CFLAGS to -g if not set. * Makefile.in: Have CFLAGS and LDFLAGS substituted from configure. * lib/Makefile.in: Have CFLAGS substituted from configure. Reported by Eric Backus and Tom McConnell. * configure.in: m4_undefine changeword before using AC_ENABLE. * m4.h: Declare prototypes for error (for ANSI compilers only), prefix_all_builtins and reference_error. Reported by Tom McConnell. * input.c (set_word_regexp): Do not try to initialize the array test from a string, this does not work with non-ANSI compilers. Reported by Eric Backus. * Makefile.in (dist): Clean examples/ before saving it. (distclean-local): Also remove stamp-h. Reported by Eric Backus. * Makefile.in (_stackovf.c): Goal for compiling stacokovf.c with non ANSI compilers. Reported by Tom McConnell. * checks/Makefile.in (clean): Depends on mostlyclean. (mostlyclean): New goal. 1994-06-24 François Pinard * Makefile.in (DISTFILES): Distribute install.sh. * install.sh: New file, copied from elsewhere. Reported by Assar Westerlund and Kaveh R. Ghazi. 1994-06-23 François Pinard * configure.in: Define ENABLE_CHANGEWORD if --enable-changeword. * acconfig.h: Explain ENABLE_CHANGEWORD. [These modifs all depend upon ENABLE_CHANGEWORD and are adapted from code provided by Pete Chown] * m4.h: Add original_text field to u_t variant of union u. Declare TOKEN_DATA_FUNC macro. * builtin.c: Declare changeword. (m4_changeword): New function. * input.c: Include "regex.h", define variables with word regexps. (input_init): Initialize the word regexp. (set_word_regexp): New. (next_token): Declare local variables, use the previous code if default_word_regexp is true. Else, match using a new code. Save the original text. * macro.c (expand_token): Ship out original text if not a macro name. Reported by Krste Asanovic and Pete Chown. [These modifs all depend upon ENABLE_CHANGEWORD] * m4.h: Declare external user_word_regexp. * m4.c: Declare user_word_regexp, and initialize it from --word-regexp or -W, or NULL if not specified. * input.c: Use user_word_regexp if specified, instead of DEFAULT_WORD_REGEXP. * Makefile.in (m4): Revert Jan 3 1994 change. I'm unable to agree with it. * Makefile.in, lib/Makefile.in: Limit suffixes to .c and .o. * checks/Makefile.in: Empty the suffix list. Reported by Geoff Russell, Joel Sherrill and Roland McGrath. * m4.c: Declare nesting_limit and initialize it to 250. Implement -LNUMBER or --nesting-limit=NUMBER to change its value. * m4.h: Declare nesting_limit as external. * macro.c (expand_macro): Stop execution whenever nesting limit is exceeded. Reported by Bengt Mertensson. * eval.c (evaluate): Diagnose excess characters in eval input. Things like `eval(08)' used to return 0 with no diagnostic. * m4.h: Capitalize first letter of all macro arguments in definitions. * m4.c: Declare warning_status, initialize it to 0. Add new option -E, or --fatal-warnings, which sets warning_status to EXIT_FAILURE instead. * m4.h: Declare external warning_status. Define EXIT_SUCCESS and EXIT_FAILURE if not otherwise done by header files. * m4.c: Delete declarations for EXIT_SUCCESS and EXIT_FAILURE. * m4.c, input.c, output.c, symtab.c, builtin.c, macro.c, debug.c, eval.c: Replace 0 by warning_status and 1 by EXIT_FAILURE in first argument of all M4ERROR calls. Reported by Noah Friedman. * examples/incl-test.m4: Renamed from incl_test.m4. * examples/include.m4: Include incl-test.m4 instead of incl_test.m4. * examples/multiquotes.m4: Renamed from multi-quotes.m. 1994-06-22 François Pinard * configure.in: Avoid USE_STACKOVF if not found. Note that Jim developped stackovf.c on a 486 running SVR4.0 (ESIX), and also tested it on a Sun Sparc workstation running SunOS 4.x. * format.c (format): When not HAVE_EFGCVT, m4 was failing the 49.format check, abusing a `union values' argument with sprintf without selecting the proper field. Now, save the formatting type first, delaying the fetch of the corresponding argument. Reported by Joseph E. Sacco and Tom Quinn. * format.c (format): Remove const from char *fmt declaration when not HAVE_EFGCVT, because a NUL may be forced into it. * m4.h: Declare atof() when not STDC_HEADERS. Reported by Joseph E. Sacco. * Regenerate configure using Autoconf 1.11, this corrects a problem about an incorrect cpp seting on NeXT 3.1. Reported by Alexander Lehmann. 1994-06-05 François Pinard * m4.h (_): Change argument from `x' to `Args'. 1994-04-22 François Pinard * m4.h: Rename Args() to _(). * m4.h: Remove extern specifier from all function declarations. 1994-04-22 Jim Avera * stackovf.c: New file implementing stack-overflow detection. * configure.in: Check for getrlimit, sigaction. If all of standard headers, getrlimit and sigaction, define USE_STACKOVF and substitute ${U}stackovf.o for STACKOVF. * acconfig.h: Declare USE_STACKOVF. * Makefile.in: Distribute stackovf.c, link with $(STACKOVF). * m4.h: Declare setup_stackovf_trap(). * m4.c: Call setup_stackovf_trap(). * tests/stackovf_test.sh: New file. 1994-04-13 François Pinard * checks/Makefile.in: Rename .all-stamp to stamp-checks. * Makefile.in (Makefile, etc.): Adapt for Autoconf 1.8. 1994-01-30 François Pinard * m4.h: Remove definition of volatile, not used anymore. Reported by Jim Meyering and Joseph E. Sacco. * m4.h: Consistently use `do { ... } while (0)' in macros, instead of `if ... else /* nothing */' for if macros. Reported by Jim Meyering. * builtin.c (m4_regexp): Reorganize the code for avoiding a warning from gcc about `repl' possibly used before defined. Reported by Jim Meyering. * m4.h: Avoid a pre-ANSI together with . Reported by Jim Meyering. 1994-01-25 François Pinard * m4.h: Move the conditional definition of volatile after the inclusion of system files, because they may define it first. 1994-01-04 François Pinard * checks/Makefile.in (CHECKS): Add a useless `*' before `[', to get around a problem with Alpha make seeing a syntax error, there. Reported by Vern Paxson. 1994-01-03 François Pinard * Makefile.in: Do not define LDFLAGS, use CFLAGS on link calls. Reported by Richard Stallman. 1993-12-25 François Pinard * configure.in: Correct test for strerror, AC_FUNC_CHECK was used instead of AC_HAVE_FUNCS. Reported by Noah Friedman. 1993-12-01 François Pinard * m4.c: Initialize show_help and show_version to zero. * m4.c: Ensure EXIT_SUCCESS and EXIT_FAILURE are defined. Use them in exit() and usage() calls. 1993-11-27 François Pinard * m4.h: Delete extern sys_nerr, sys_errlist declarations, and syserr() macro. Delete errref, add reference_error and M4ERROR. * m4.c: Replace errref, which was returning an input reference string, with reference_error, which prints it on standard error. * builtin.c, output.c: Use errno as second parameter to error, instead of using syserr() with %s. * *.c: Use M4ERROR instead of error: no more errref() with %s. Doing so, the program name appears after the input reference instead of before, which eases M-x next-error processing. 1993-11-24 François Pinard * checks/get-them: Escape braces with backslashes in patterns, because HPUX-9.01 awk needs this. Reported by Jim Meyering. 1993-11-22 François Pinard * builtin.c: Declare "FILE *popen ();". * m4.h: Remove MESSAGE{,1,2}, WARNING1, FATAL{,1}, INTERNAL_ERROR macros, replace error_message_prefix() declaration by errref()'s. Declare xrealloc, for use in errref(). * m4.c: Delete error_message_prefix() function, add errref(). * *.c: Use error() systematically in place of all error macros, now that error() flushes stdout first. Make needed adjustments. * m4.h: Remove const in sys_errlist[] declaration, it creates conflicts on SGI and Alpha. Reported by Kaveh R. Ghazi. 1993-11-20 François Pinard * m4.c: Include instead of "getopt.h". * configure.in: Output to config.h. Use HAVE_FUNCS preferably. * acconfig.h: New, for documenting HAVE_EFGCVT. * Makefile.in: Distribute acconfig.h, .stamp-h.in and config.h.in, use them wherever appropriate. Also use -I. for compilations. * lib/Makefile.in: Use -I.. for compilations. * *.c: Include or "config.h". * m4.h: Test for HAVE_MEMORY_H instead of NEED_MEMORY_H. * configure.in: Use AC_HAVE_HEADERS(memory.h), delete AC_MEMORY_H. 1993-11-17 François Pinard * builtin.c (m4_eval): Cast strlen to (int) before comparing. * input.c (input_init): Initialize quote and comment strings explicitely instead of calling set_quotes and set_comment: by doing so, we ensure we do not free uninitialized variables. * checks/check-them: Reverse arguments to both diff, so the expected is on the left and the obtained on the right. * m4.h: Add MESSAGE{,1,2}, WARNING1, FATAL{,1} and INTERNAL_ERROR macros. Delete declarations for m4error, warning, fatal and internal_error, add declaration for error_message_prefix. * m4.c: Delete m4error, warning, fatal and internal_error routines, add error_message_prefix routine. * *.c: Replace m4error routine calls with MESSAGE* macro calls, warning with WARNING*, fatal with FATAL* and internal_error with INTERNAL_ERROR*. * Makefile.in (_m4.c): Do not adjust ansi2knr output for va_alist, this is not needed anymore. * m4.h: Declare extern FILE *debug. Add DEBUG_PRINT{1,3} and DEBUG_MESSAGE{,1,2} macros. Delete declarations for debug_print and debug_message, add declaration for debug_message_prefix. * debug.c: Remove static specifier for FILE *debug declaration. Delete debug_print and debug_message routines, add debug_message_prefix routine. * builtin.c, debug.c: Replace debug_print routine calls with DEBUG_PRINT* macro calls. * input.c, path.c: Replace debug_message routine calls with DEBUG_MESSAGE* macro calls. * m4.h: Remove inclusion of . * debug.c: Include or . (trace_format): Use stdarg instead of varargs if __STDC__. * configure.in: Remove checks for vfprintf and _doprnt. These implementations use varargs tricks which are not portable enough. * lib/vfprintf.c: Deleted. * lib/_doprnt.c: Deleted. * lib/Makefile.in: Adjusted accordingly. Remove LIBOBJS. Reported by Joel Sherrill. * path.c (add_include_directory): Use xstrdup. * builtin.c (find_builtin_by_name): Declare static. * *.[ch]: Add const to a few "char *" declarations. * configure.in: Remove commented tests for fileno() and fstat(). * debug.c: Remove comments about HAVE_FILENO and HAVE_FSTAT. * debug.c (debug_flush_files): New. * m4.h: Declares it. * builtin.c (m4_syscmd, m4_esyscmd): Use it. Reported by Nicolas Pioch. 1993-11-12 François Pinard * Makefile.in (m4.dvi): Use m4.texinfo instead of m4.texi. Reported by Joel Sherrill. * builtin.c (prefix_all_builtins): Instead of the table size, use the null entry at end for stopping the loop. It was overwritten. Reported by Andreas Schwab and Jim Meyering. * builtin.c (prefix_all_builtins): Cast xmalloc to (char *). Reported by Kaveh R. Ghazi. * macro.c (call_macro): Add * in (*SYMBOL_FUNC (sym)) (...). Reported by Karl Vogel. 1993-11-09 François Pinard * m4.h: Do not define volatile if already defined. Reported by René Seindal. * lib/Makefile.in: Add a forgotten ALLOCA=@ALLOCA@. Grrr! Reported by Bernhard Daeubler, Eric Backus, Hal Peterson, Hoang Uong, Ian Taylor, Kaveh R. Ghazi, Tom McConnell and Walter Wong. 1993-11-08 François Pinard * m4.h: Define strchr and strrchr in terms of index and rindex, instead of the other way around. * builtin.c, m4.c, path.c: Use strchr instead of index. * input.c (next_char): Remove a "break;" after a "return ...;". Reported by Tom McConnell. 1993-11-08 François Pinard * Release 1.1 * configure.in: Do not copy check files in the build hierarchy. * checks/check-them: Identify the m4 version being checked. For finding m4, look in $PATH instead of in the parent directory. * Makefile.in (check): Prepend `pwd` to $PATH before checking. * checks/Makefile.in (.all-stamp): Always create check files in the source hierarchy, not anymore in the build hierarchy. (check): cd to the source hierarchy before performing checks. Do not copy nor clean COPYING anymore, take it from `..'. Reported by Tom McConnell. * Makefile.in (Makefile): Use $(SHELL). (config.status): Use $(SHELL). Use "config.status --recheck" instead of "configure --no-create", which is obsolete. Reported by Tom McConnell. 1993-11-05 François Pinard * m4.c (usage): Use "%s" instead of "m4" in format string. Reported by Jim Meyering. * Makefile.in: Distribute mkinstalldirs. Reported by Pierre Gaumond. Reported by Jim Meyering. Reported by Tom McConnell. Reported by Andreas Gustafsson. * checks/check-them: Renamed from checks/check_them. * checks/get-them: Renamed from checks/get_them. * checks/.all-stamp: Renamed from checks/.all_stamp. * checks/Makefile.in: Changed accordingly. Reported by Jim Meyering. 1993-11-04 François Pinard * lib/Makefile.in (dist): Correct permissions on files. * output.c: Declare tmpfile, some systems don't. 1993-11-03 François Pinard * checks/Makefile.in (dist): Correct permissions on files. * Makefile.in (dist): Ensure recursive linking for subdirectory `examples', also set read/write permissions on all its files. * mkinstalldirs: New, from elsewhere. * Makefile.in: Use it. * debug.c: Synchronize debug messages and regular output when the debug file and stdout are redirected to the same file. * configure.in: Add (commented) checks for fileno and fstat. Reported by Jim Avera. * builtin.c (m4_ifelse): Diagnose excess arguments if 5, 8, 11, etc., arguments, then ignore the superfluous one. m4 used to diagnose missing arguments and return the empty string. Reported by Nick S. Kanakakorn. 1993-11-02 François Pinard * m4.c (main): At end of all input, ensure all undiverted text goes to the main output stream. Reported by Andreas Gustafsson. * m4.c (main): exit (0), instead of return 0. * m4.c: Implement -P and --prefix-builtins. * builtin.c: Delete const specifier on builtin_tab. (prefix_all_builtins): New. Reported by Noah Friedman. Reported by Scott Bartram. * c-boxes.el: New, from elsewhere. * Makefile.in: Distribute it. * m4.h: Do not define bcopy if defines it. Reported by Stephen Perkins. * builtin.c (define_macro): Allow a missing second argument, in which case it is implied empty. Affects define and pushdef. Reported by Eric Allman. 1993-11-01 François Pinard * m4.h: Add blind_if_no_args in struct builtin, blind_no_args in struct symbol adn SYMBOL_BLIND_NO_ARGS macro. * builtin.c: Initialize all the blindness fields in builtin_tab. (define_builtin): Copy the blindness of a builtin into its symbol. * macro.c (expand_token): Avoid processing a blind builtin if the next character is not an opening parenthesis. Reported by David MacKenzie. Reported by Noah Friedman. * configure.in: Ensure an exit status of 0 on completion. Reported by Vivek P. Singhal. * eval.c (eval_lex): Admit both lower and upper case letters for bases greater than 10. Only lower case letters were accepted. * eval.c (eval_lex): Recognize 0bDIGITS and 0rRADIX:DIGITS syntax. Reported by Krste Asanovic. * eval.c: Rename NOT to LNOT. Add XOR, NOT, LSHIFT and RSHIFT. * eval.c (logical_not_term): New name for not_term. * eval.c (xor_term): New, between or_term and and_term. * eval.c (not_term): New, between and_term and logical_not_term. * eval.c (shift_term): New, between cmp_term and add_term. Reported by Krste Asanovic: ~, ^, <<, >>. Reported by Ben A. Mesander: ** vs ^. * m4.c: Delete xmalloc.c, xrealloc.c, xstrdup.c. * m4.h: Delete xrealloc.c. * lib/xmalloc.c: New, from elsewhere. * lib/xstrdup.c: New, from elsewhere. * lib/Makefile.in: Distribute and compile them. * m4.c: Change progname to program_name. * builtin.c, eval.c, m4.c, m4.h: Rename error to m4error. * lib/error.c: New, from elsewhere. * lib/Makefile.in: Distribute and compile error.c. * configure.in: Check AC_VPRINTF and for strerror. * m4.c: Delete cmd_error. Use error instead. * m4.c: Change label capitalisation to "ERROR", "Warning", etc. * m4.h: Delete #define const, let Autoconf takes care of this. * m4.c: Remove all code conditionalized by IMPLEMENT_M4OPTS. Merge parse_args into main. Declare argv to be `char *const *', then remove superfluous casts. * m4.c: Rename --no-gnu-extensions to --traditional. Reported by Ben A. Mesander. * m4.c (usage): Add a status parameter. Supply one in various calls. Add --help processing. Remove -V for --version. * lib/Makefile.in: Put $(CFLAGS) last in .c.o rule. * lib/Makefile.in: Have an AR=ar declaration. Reported by Eric Backus. Reported by Bjorn R. Bjornsson. Reported by Tom Tromey. Reported by Kristine Lund. Reported by Marion Hakanson. 1993-10-30 François Pinard * Makefile.in (m4.info): Use -I$(srcdir) on $(MAKEINFO). Reported by Noah Friedman. 1993-10-25 François Pinard * Makefile.in: Remove MDEFINES and cleanup. 1993-06-09 François Pinard * Makefile.in (dist): Replace "echo `pwd`" by a mere "pwd". Create a gzip file. 1993-02-06 François Pinard * Makefile.in, lib/Makefile.in, check/Makefile.in: In dist goals, ensure 777 mode for directories, so older tar's will restore file modes properly. 1993-01-17 François Pinard * Makefile.in, lib/Makefile.in: Put $(CFLAGS) after $(CPPFLAGS), so the installer can override automatically configured choices. Reported by Karl Berry. 1993-01-15 François Pinard * lib/vfprintf.c: Stolen from Oleo distribution and adapted. The previous version was not working properly on m68k-hp-bsd4.3. Reported by Roland McGrath. * lib/_doprnt.c: Stolen from Oleo distribution. * configure.in: Check for _doprnt.c if vfprintf.c selected. * lib/Makefile.in: Distribute _doprnt.c. Do not distribute regex.[ch].old anymore. 1993-01-01 François Pinard * Makefile.in, lib/Makefile.in: Reinstate $(CPPFLAGS), use it. Richard wants it there. 1992-12-27 François Pinard * Makefile.in: Add DEFS to MDEFINES. * lib/Makefile.in (.c.o): Remove $(CPPFLAGS). (libm4.a): Remove the library before creating it. (distclean): Remove tags and TAGS too. 1992-12-23 François Pinard * Makefile.in (dvi, m4.dvi): New goals. * builtin.c, eval.c, format.c, input.c, m4.[ch], m4.texinfo, macro.c, output.c, path.c, symtab.c: Change Copyright from 1989-1992 to the explicit enumeration 1989, 1990, 1991, 1992. * examples/divert.m4: Deleted, this bug has been corrected. * Makefile.in (texclean, mostlyclean): New goals. * Makefile.in (clean): Remove clutter from ansi2knr. Reported by Pierre Gaumond. 1992-12-20 François Pinard * Makefile.in: Remove $(CPPFLAGS) from the .c.o rule. The user might well use CFLAGS is s/he needs it. * Makefile.in: Allow installation of info files from a separate build directory. Reported by Jason Merrill. Reported by David MacKenzie. Reported by Skip Montanaro. Reported by Erez Zadok. Reported by Assar Westerlund. 1992-12-19 François Pinard * Release 1.0.3 This is still a beta release for the future GNU m4 version 1.1. * lib/alloca.c: New, from elsewhere. * lib/Makefile.in: Distribute it. Define and use $(ALLOCA). * m4.h: Do not define index/rindex if already defined. If FALSE/TRUE are already defined, do not redefine them, but merely define boolean typedef to int. * Makefile.in: Use $(DEFS) while compiling ansi2knr. * ansi2knr.c: Rewrite #ifdef HAVE_STRING_H || STDC_HEADERS, because some C compilers do not like connectives with #ifdef. * m4.h: Define `volatile' only if __GNUC__, instead of once for __GNUC__ and once for __STDC__. * lib/regex.h: Leave const alone, AC_CONST will take care of it. * checks/Makefile.in: Use .all_stamp instead of $(CHECKS) for Makefile dependencies. Without it, make keeps destroying and remaking $(CHECKS) in a loop (why?). Distribute .all_stamp. * m4.h, m4.c, builtin.c, output.c: Change all divertion/DIVERTION to diversion/DIVERSION, this was a spelling error. * m4.c: Declare version[], remove #include "version.h". * version.h: Deleted. * Makefile.in: Remove references to version.h. * output.c (shipout_text): Centralize all `#line NUM ["FILE"]' production, by using a simpler and more robust algorithm. This solves the problem of synclines sometimes written in the middle of an output line. Delete sync_line() and output_lines variable. * m4.h: Remove sync_line prototype and output_lines declaration. * input.c (next_char), output.c (shipout_text): Remove references to output_lines. * input.c (push_file, pop_file): Merely put the value -1 in output_current_line instead of calling sync_line, for delaying a single `#line NUM FILE' before next output line. Do not test for sync_output, because this is unnecessary clutter. * output.c (make_divertion, insert_divertion): Idem. * input.c: Rename must_advance_line to start_of_input_line, for consistency. * debug.c (trace_header): Select a new debug line format, which better complies with GNU standards for formatting error messages. With option `-dfl', M-x next-error might be used on the output. * m4.c (vmesg): Adjust format of error output to GNU standards. * m4.texinfo: Adjust examples for `make check' to work. * m4.h, builtin.c, debug.c, input.c, macro.c, path.c: Use upper case for enum debug_info constants, which were all lower case. * builtin.c (m4_regexp, m4_patsubst): Use re_search instead of re_search_2. * lib/regex.[ch]: Use new version from textutils 1.3.6, with some collected patches. I tried a few times using newer regex.[ch], it mysteriously stopped aborting with this one. Insecure feeling... * lib/Makefile.in: Distribute regex.[ch].old, just in case! 1992-12-18 François Pinard * m4.c: Change `--no-warnings' to `--silent'. Reported by David MacKenzie. * m4.c: Put all M4OPTS code upon IMPLEMENT_M4OPTS control, and leave it off for now. See comment in m4.c for justification. Reported by David MacKenzie. * configure.in: Replace AC_USG by AC_HAVE_HEADERS(string.h). * m4.h, ansi2knr.c, lib/regex.h: Replace USG by HAVE_STRING_H. * Makefile.in: Add a new `info' goal. Use macro MAKEINFO. * Makefile.in: Ensure recursive cleaning is done before local cleaning for all clean goals. * builtin.c (ntoa): Ensure the value is always interpreted as a signed quantity, whatever the radix is. 1992-11-18 Jim Meyering * builtin.c, format.c, input.c: Split long lines. * m4.c: Use typedef macro_definition instead of struct macro_definition. * symtab.c: Use typedef symbol instead of struct symbol. 1992-11-17 François Pinard * *.[ch]: Remove all trailing whitespace, in code and comments. * configure.in: Find some awk. * Makefile.in: Add $(AWK) to MDEFINES. * checks/Makefile.in: Transmit $(AWK) to get_them. * checks/get_them: Use $AWK instead of gawk. Add a close in the awk script when switching files, because without this, mawk runs out of file descriptors. 1992-11-16 François Pinard * Makefile.in (realclean): Delete m4.info*. Reported by Jim Meyering. * Makefile.in: Adjust and link with checks/Makefile. * checks/Makefile.in: New. * configure.in: Output checks/Makefile. * checks/get_them: Have the dnl header of each test more recognizable by next-error, also use a better message. 1992-11-16 Jim Meyering * m4.h [__GNUC__]: Use __volatile__ instead of `volatile.' And use that only if __GNUC__ since we're using it's GCC-specific semantics that tell the compiler the associated function doesn't return. * builtin.c (substitute): Don't use character as an array index. (dumpdef_cmp): Make formal arguments `const void *' to avoid warnings with gcc -W -Wall on systems with qsort prototype. (m4_errprint): Cast obstack_finish to `char *' to avoid warnings from gcc -W -Wall. * eval.c (most functions): Add parentheses to assignments used as truth values go avoid warnings from gcc -Wall. * input.c, m4.c, output.c, path.c, symtab.c: Declare static any functions that don't need external scope. * builtin.c, debug.c, format.c, m4.c, m4.h, macro.c, symtab.c (many functions and arrays): Declare `const'. 1992-11-15 François Pinard * *.[ch]: Rename nil to NULL, using the declaration from , removing the declaration from m4.h. Also rename false to FALSE and true to TRUE. * lib/Makefile.in (Makefile): New goal. * Makefile.in, lib/Makefile.in: Add a .c.o rule, so CFLAGS is not so heavily loaded. It gets more easily overridable, calling make. Reported by Jim Meyering. * Makefile.in (dist): Get .fname from the current directory name, instead of from version.h. I need updating many files manually, when the version changes, version.h is just one of them. 1992-11-14 François Pinard * m4.h: Remove the tag `boolean' on the enum introducing typedef `boolean'. This tag conflicts with on SVR4. Reported by Tom McConnell. 1992-11-13 François Pinard * m4.texinfo: Correct the examples for 33.divert, 38.divnum, 39.cleardiv, which were describing missing or spurious newlines. Modify examples 52.eval, 53.esyscmd and 54.sysval so the results do not depend on machine word size, `/bin/false' implementation, or `wc' output format. `make check' is more dependable, now. * checks/check_them: Summarize the failed tests by listing their name, at end. If none, issue `All checks successful'. Output `Checking' instead of `Input file:'. * checks/get_them, checks/check_them: Reindented. * Makefile.in (dist): chmod a+r before making the tar file. 1992-11-12 François Pinard * builtin.c (m4_dnl): Diagnose any parameter to `dnl'. * input.c (next_token): Reinitialize token_buttom just after using it as a watermark with obstack_free. Or else, a future token, big enough for triggering reallocation of the obstack chunk, could void the initialized value of token_buttom, later causing panic in obstack_free. Rename token_buttom to token_bottom everywhere. * m4.h: Before declaring errno, first include and ensure that it does not define errno. Reported by Richard Stallman. 1992-11-11 François Pinard * builtin.c: Define and use DECLARE macro for builtins. * builtin.c (m4_ifelse): Avoid any diagnostic when exactly one argument, this is a common idiom for introducing long comments. * builtin.c (m4_ifelse): If 3n + 2 arguments, diagnose missing arguments. The last argument was silently ignored. * m4.c (cmd_error): Add a missing semicolon before va_end(). 1992-11-10 François Pinard * Makefile.in: Now handle protoized sources. Define and use U. Compile and use ansi2knr with old compilers. Update DISTFILES. Add `aclocal.m4' to `configure' dependencies. * ansi2knr.c: New, from Ghostscript distribution. * configure.in: Define U through FP_PROTOTYPES for old compilers. Add AC_ISC_POSIX, AC_CONST, AC_SIZE_T. * aclocal.m4: New, provide FP_PROTOTYPES. * m4.h: Conditionnaly protoized through Args, save for varags. * builtin.c: Protoized. Then: Include if size_t is not defined, before "regex.h". (m4_ifelse): Fetch built-in name properly for diagnostic. (m4_dumpdef): Remove wrong (char *) cast calling dump_symbol. (m4_regexp): Add const to `msg' declaration. (m4_patsubst): Add const to `msg' declaration. * debug.c: Protoized, save for varargs. * eval.c: Protoized. * format.c: Protoized. * input.c: Protoized. * m4.c: Protoized, save for varargs. Then: (xfree): Accept void * instead of char *. (xmalloc): Return void * instead of char *. (xrealloc): Accept and return void * instead of char *. * macro.c: Protoized. * output.c: Protoized. * path.c: Protoized. Then cast some (char *) over xmalloc's. * symtab.c: Protoized. 1992-11-06 François Pinard * m4.texinfo: Remove directory from diagnostics in 30.include, 51.eval, 56.errprint and 57.m4exit tests. * m4.h: Remove declarations for int or void system functions, they cause more conflicting trouble than they make good. * configure.in: Avoid configuration header file. Add some tests. * m4.h: Remove #include "config.h". * Makefile.in, lib/Makefile.in: Implement Autoconf interface. Then, rewritten for better compliance with GNU standards. 1992-11-05 François Pinard * format.c (format): Avoid syntax error if not HAVE_EFGCVT, because of a misplaced #endif. * Many *.[hc] files: Correct intra-line spacing here and there, according to GNU indent 1.6 advice. * configure.in: New, using Autoconf 1.2. * m4.h: Reverse NO_MEMORY_H to NEED_MEMORY_H. * Delete old configure.in, configure, etc/configure.in, etc/configure, lib/configure.in, lib/configure and config/*. Reported by Jason Merrill. * symtab.c (hash): Change (char) NULL to '\0'. Reported by Jason Merrill. * Delete .vers, etc/newdist.sh, etc/newvers.sh and etc/nextvers.sh. Release numbers will be edited `by hand'. * version.h: De-automatize, force value in. * m4.c: Changes in order to use a newer getopt.h. Reported by David MacKenzie. * checks/: New name for examples/. * checks/get_them: New location for etc/get_examples. * checks/check_them: New location for etc/check_examples. * Makefile.in, checks/get_them, checks/check_them: Adjust. * lib/vfprintf.c: New location for etc/vfprintf.c. * Delete empty etc/. * examples/: New name for test/. 1992-03-10 François Pinard * Makefile.in (check): Add m4 as dependency. * m4.c: Accept --no-warnings instead of --no_warnings, and --no-gnu-extensions instead of --no_gnu_extensions. Make the usage message more informative. Reported by David MacKenzie. 1992-03-09 François Pinard * etc/check_examples: New name for check_examples.sh. * etc/get_examples: New name for get_examples.sh. * Makefile.in, etc/Makefile.in: Use new names. * Makefile.in: Transmit $(CC) while making in lib. * Many *.[hc] files: GNU indent'ed, with further fine tuning of code disposition by hand. 1992-03-08 François Pinard * m4.h: Delete definitions for abort() and exit(). Reported by Richard Stallman. * config/hmake-unicos, config/s-unicos.h: New files. Reported by Hal Peterson. * eval.c (exp_term): Have N^0 return 1. Reported by Michael Fetterman. * eval.c, input.c, m4.h: Remove last comma in enums. Reported by Mike Lijewski. * Transfer of maintenance duties from René to François. 1991-10-24 René Seindal * Release 1.0. Many thanks to those, who provided me with bug reports and feedback. * Uses GNU configure, taken from the gdb distribution. * Uses GNU getopt(), with long option names. * The -Q/+quiet option is added, which suppresses warnings about missing or superflous arguments to built-in macros. * Added default options via the M4OPTS environment variable. * The built-in format can now be configured to use sprintf as the formatting engine, for systems without [efg]cvt(3). * GNU library code is moved to the ./lib subdirectory; other utility files are now in ./etc. * Several minor bugs have been fixed. 1991-07-26 René Seindal * Fixed various bugs. Release 0.99, manual 0.09. Many thanks to François Pinard and Roland H. Pesch for providing me with reports. * The builtins incr and decr are now implemented without use of eval. * The builtin indir is added, to allow for indirect macro calls (allows use of "illegal" macro names). * The debugging and tracing facilities has been enhanced considerably. See the manual for details. * The -tMACRO option is added, marks MACRO for tracing as soon as it is defined. * Builtins are traced after renaming iff they were before. * Named files can now be undiverted. * The -Nnum option can be used to increase the number of divertions available. * Calling changecom without arguments now disables all comment handling. * The function m4_patsubst() is now consistently declared static. * A bug in dnl is fixed. * A bug in the multi-character quoting code is fixed. * Several typos in the manual has been corrected. More probably persist. * The m4.info file is now installed along with the program. 1990-11-15 René Seindal * Updated and enhanced version. Release 0.75, manual 0.07. * Implemented search path for include files (-I option and M4PATH envronment variable). * Implemented builtin "format" for printf-like formatting. * Implemented builtin "regexp" for searching for regular expressions. * Implemented builtin "patsubst" for substitution with regular expressions. * Implemented builtin "esyscmd", which expands to a shell commands output. * Implemented "__file__" and "__line__" for use in error messages. * Implemented character ranges in "translit". * Implemented control over debugging output. * Implemented multi-character quotes. * Implemented multi-character comment delimiters. * Changed predefined macro "gnu" to "__gnu__". * Changed predefined macro "unix" to "__unix__", when the -G option is not used. With -G, "unix" is still defined. * Changed "shift", "$@" and "$*" to not insert spaces afters commas. * Added program name to error messages. * Fixed two missing null bytes bugs. 1990-01-22 René Seindal * Initial beta release. Release 0.50, manual 0.05. ----- Local Variables: coding: utf-8 End: Copyright (C) 1990, 1991, 1992, 1993, 1994, 2000, 2001, 2003, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted provided the copyright notice and this notice are preserved.