summaryrefslogtreecommitdiff
path: root/usr.bin/m4/eval.c
AgeCommit message (Collapse)Author
2012-04-12new m4 -g stuff:Marc Espie
- expr(`4**3') - include(`hey I am not there') keeps going. work with Baptiste Daroussin, who had the idea but didn't nail all details right. okay otto@, miod@
2011-03-24fix translit() behavior to not be recursive. Fixes autoconf 2.65, matchesMarc Espie
behavior of solaris m4 (e.g., posix). Bug-fix by Nigel Taylor Okay sthen@, todd@. Comment amended per sthen@' suggestion.
2010-09-07Remove stray spaces. No code change.Marco Peereboom
2010-03-25conform to gnum4 AND traditional m4 (solaris) behavior, namely,Marc Espie
translit(`ab',`aa',`cd') -> `cb' (first occurrence matches) okay miod@, sthen@ fixes minor autoconf issues, like HAVE_VOID__ instead of HAVE_VOID_P
2008-08-21in gnu-m4 mode, allow definition of the empty macro (yes, autoconf 2.62Marc Espie
actually uses this, bleh) okay otto@
2008-08-16revert eval.cMarc Espie
2008-08-16argument parsing should only skip spaces outside of parenthesis.Marc Espie
Inside matching parenthesis, keep spaces as is (use chrsave instead of pbstr, since there's no way it can be a further macro expansion). Fixes a long-standing issue with autoconf ( --option -> --option), matches other m4 than gnum4 okay millert@, fries@
2006-03-24oops, noticed by David Hill.Marc Espie
2006-03-23... and remove extra test that is no longer needed.Marc Espie
2006-03-20add limited support for format builtin in gnu-m4 mode, because I'm fedMarc Espie
up of patching it away in various autoconf derivatives. okay miod@
2006-03-20report function m4errx, that shows app-specific data (filename/linenumber)Marc Espie
before the error message. Use it to simplify code. okay miod@
2006-01-20use stdint.h where appropriate. okay millert@Marc Espie
2005-09-06finally make our m4 SusV3-compliant.Marc Espie
- changecom and changequote have a simple definition (that matches gnu-m4, coincidentally, so we no longer need two distinct modes for these) - off-by-one bug in -s, this finally works. - reorder main parser loop, so that we can use alphabetic constructs in quotes/comments. - rename putback to pushback, this matches comments, and makes more sense. - more uniform (and updated) description of changequote/changecom. - new, systematic regression tests of comments/quotes. - framework to test -s: one perl script to reconstitute `full' files with all line numbers, so that we can verify the output without needing a complete match. okay otto@, fries@
2005-08-06zap rcsid. It's not ramdisk, but they still take space.Marc Espie
2005-05-29fix a few minor compatibility issues.Marc Espie
- let eval() handle a base and number of digits, like it's advertized to. - in gnu-mode, undivert can take file names as arguments. - in gnu-mode, map can handle reversed charsets. Suggestions and okay otto@, mostly prompted by looking at the regress tests in newer gnu-m4.
2005-03-02let m4wrap handle multiple wraps, both in normal and gnu-mode.Marc Espie
based on Noah Misch's bug report. okay otto, jmc.
2005-01-31use fflush(stdout) before system() so we won't miss anyRobert Nagy
wanted output; from Andreas Burmester <buster_hh@gmx.net> ok espie@
2005-01-21more portable code, stderr is not necessarily a constant.Marc Espie
2005-01-20remove unused variables, extra declarations.Marc Espie
2003-11-17Modify xalloc so that it also takes err(3)-like arguments.Marc Espie
Write an xrealloc wrapper that works the same way, and use it as well. People who feel like it may want to add more explicit error messages to all the places m4 can fail allocating memory... okay tedu@
2003-06-30Make the trace status of a macro an actual argument that gets pushedMarc Espie
in the frame for the macro expansion. (This will allow one single lookup to grab the macro definition and the trace status) okay millert@
2003-06-30clean up internal lookup interface:Marc Espie
define an interface with explicit define/pushdef/popdef... and use it. That way, most details of the hashtable are no longer visible. okay millert@
2003-06-18- store builtin name as definition for builtin macros.Marc Espie
this removes the need for code->name conversion, in exchange for systematically testing the definition type, since we can no longer rely on the defn being NULL. - commonnalize the builtin-detection code, so that we can use it for pushdef as well with define, so that pushdef handles builtins correctly as well. okay fries@, millert@.
2003-06-03Remove the advertising clause in the UCB license which BerkeleyTodd C. Miller
rescinded 22 July 1999. Proofed by myself and Theo.
2003-04-05say goodbye to strcpy, okay deraadt@Marc Espie
2002-04-28Implement -s.Marc Espie
Triggered by recent FreeBSD changes. - emits #line directives at every file change (like FreeBSD) - maintains a synch_lineno variable to verify when the output gets out of synch with the input, so that it can emit #line to re-synch as well (unlike FreeBSD) To do: either handle \end-of-line, or recognize when a macro expansion is in progress, so that line synch don't perturb cpp on multi-line expansions. With this, we should have a fully POSIX-compliant m4. ok miod@
2002-04-26use ansi function declarations. ok millert@Marc Espie
2002-02-16Part one of userland __P removal. Done with a simple regexp with some minor ↵Todd C. Miller
hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.
2001-12-28Kill yet another hardcoded size. Ok fries@Marc Espie
and flush(stdout) on debugging mode, as a vicious coredump can leave you without info otherwise.
2001-10-10Handle macro expansion even if argc==2, which can happen in indir() calls.Marc Espie
Problem encountered by obecian@.
2001-10-10Fix indentMarc Espie
2001-09-29Synchronize comment with reality.Marc Espie
In gnu-m4 mode, pass the real number of arguments to changequote/changecom, since those distinguish changequote() from changequote.
2001-09-27pass all properties of builtins when defn...Marc Espie
2001-09-27traceon/traceoff built-ins.Marc Espie
2001-09-19inline some very common putback/chrsave. Worth roughly 10%Marc Espie
2001-09-18Tracing facilities. Same style as gnu-m4, because it's mostly used forMarc Espie
autoconf right now.
2001-09-18instrumentation for tracing mode: macro expansionMarc Espie
2001-09-18better gnu m4 emulation for dumpdefMarc Espie
2001-09-18let dumpdef go thru dump_one_def for each def.Marc Espie
2001-09-18let defn(builtin) work enough so thatMarc Espie
define(`newmacro', defn(builtin)) will work, as it should.
2001-09-18One single point for all macros/builtin expansion.Marc Espie
2001-06-13Fix PR 1868. MAXSTR has no place there.Marc Espie
MAXSTR is still a hard limit, but only for token length, where 512 characters seems reasonable. Ok millert@
2000-07-27Handle unlimited diverts for m4 -g.Marc Espie
Problem with autoconf noticed by d@
2000-07-24Implement esyscmdMarc Espie
2000-03-18Last needed m4 changes to bootstrap autoconf without gnu-m4.Marc Espie
2000-03-11Add a few builtins for greater compatibility with gnu-m4, and extendedMarc Espie
functionality. * regular expressions, * line-number reporting * `meta'-macros, builtin and indir. Reviewed by pjanzen@, tested by fries@ and a few others.
2000-01-12Use a proper abstract interface for file accesses, so that we can recordMarc Espie
the file name and line number. This yields more meaningful error messages, and the possibility for yet more.
2000-01-05Close PR-1021. make unix or vms `special' macros that expand toMarc Espie
themselves, with the proper quotes added. Matches gnu-m4, not Solaris nor FreeBSD... better for robustness, as it makes for more transparent expansions.
1999-12-21Recursive definitions are not the real problem.Marc Espie
Trying to expand them is. So flag obvious recursive definitions for later, and give an error only if we expand them. (Some gnu-m4 files, including autoconf, do define some macros with themselves as the replacement text, for use in test-if-set patterns) Since type is no longer MACRTYPE, those macros end up in builtins... but this is not a problem, since expanding them is an error.
1999-11-30Clean up comment/quote recognition a little bit:Marc Espie
- use strlcpy to make clear that the strings are line terminated, - remove the number of magic constants, - use assert() for preconditions, - use puts instead of looping over array of chars...