Simplify the code generators by merging the two hash constant arrays
into one. The hash is effectively the same, although the order of the
constants differ (possibly in a way which makes the indexing easier.)
The main difference is the amount of code is necessary to generate
each of the output C files.
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
The name UNUSED is too generic and may conflict with future
macro definitions. This is machine-generated code anyway, so
rename UNUSED to UNUSED_HASH_ENTRY.
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Enough users expect the namespace starting with underscore to be safe
for symbols. Change our private namespace from __foo__ to
__?foo?__. Use %defalias to provide backwards compatiblity (by using
%defalias instead of %define, we handle the case properly where the
user changes the value.)
Add a preprocessor directive:
%aliases off
... to disable all smacro aliases and thereby making the namespace
clean.
Finally, fix infinite recursion when seeing %? or %?? due to
paste_tokens(). If we don't paste anything, the expansion is done.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Since we use 127 not 0 for end of line in stdmac packages now, we
can't simply use the __USE_*__ macro as a string to test for a %use
package. Keep an internal array of state instead.
Fix the stripping of comments from lines in macro files.
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Handle up to 160 directives for stdmac compression. This is done by
allowing the directive numbers to wrap around (128-255, 0-31), using
127 for end of line, and forcing any whitespace character to be space.
Make macros.c a bit more legible by using #defines for the byte codes;
strictly for the benefit of the human reader.
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Clean up some perl warnings, some of which were legitimate (apparently
undef doesn't actually take a list of arguments, a common enough
mistake that it is mentioned in the man page!, and a list of variables
after "my" can be cantankerous), and some of which were nuisance but
were easy enough to clean up.
Maybe this can resolve the problems with very old version of Perl?
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
The 2-operand form was inherently unsafe. Use the 3-operand form
instead, which guarantees that arbitrary filenames are supported.
This also means we can remove a few instances of sysopen() which was
used for exactly this reason, however, at least in theory sysopen()
isn't portable.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
The ordering of the macro sets ended up changing due to the recent
file reorganization. Instead of forcing the order again, handle
multiple macro sets (rather than just two) in a coherent manner.
macros/macros.pl could use a cleanup of duplicated code, however.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Make the source code easier to understand and keep track of by
organizing it into subdirectories depending on the function.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>