fix potential integer overflows in memory allocation (mostly for pedagogical
purposes, these are unlikely to overflow in practice)
move the rest of lst.lib stuff into its own directory.
- 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@
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@
- 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@
- 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.
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@
Inline some macros/functions for speed.
So, this achieves the goal of one single lookup for macro/trace status,
which does speed up m4 in partial tracing situations somewhat.
This does also speed up m4 in large pushdef situations, since it no longer
has to lookup large chains of macros.
okay millert@
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@.
speeds up recent autoconf somewhat, since it traces a large set
of individual macro.
(more rework of m4 internal interfaces to unify lookup tables in order)
okay fries@
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@
Fix strspace automatic extension.
The assumption that simply updating the current pointer works is false,
there are cases where previous entries on the stack would absorp vast
amounts of string space, and overload the non-updated entries.
To fix it, we use a shadow copy of the stack, which only records which
entries are pointers within strspace, so that a resize can adjust all
those pointers at once.
Reviewed by millert@
functionality.
* regular expressions,
* line-number reporting
* `meta'-macros, builtin and indir.
Reviewed by pjanzen@, tested by fries@ and a few others.
Namely, it doesn't help to try and expand include if it's not followed
by parenthesis and a filename.
This should make applications like sendmail m4 scripts more sturdy for
unquoted machine names that happen to collide with built-ins.
The only drawback is that our m4 may now do intelligent things with scripts
that don't work on other systems.
- 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...
With 2^32 possible hash values, this means that collisions no longer
incur supplementary string compares, which was most of the reason for
STREQ in the first place...
Add missing prototypes,
Make local functions static,
Sort extern.h by file,
Constify all char * that can be,
Copy temp file name so that eval does not modify its arguments.
Let indx match netbsd flavor, to simplify diffs.
Show how many quotes were not closed.
Increase stack slightly, now that we're no longer bound by argspace.
A bit wasteful, but not too intrusive.
Also remove pushback buffer limitations, as this would be mostly useless
otherwise.
Incidentally, pushback buffer overflow detection in pbstr was wrong.