Commit graph

63 commits

Author SHA1 Message Date
Keith Kanios
a5fc6467ab Fix 32-bit types in preproc.c and eval.c
Fix 32-bit types in preproc.c and eval.c that should have been 64-bit
types.  This allows %assign to work correctly with 64-bit integers.
2007-10-13 07:09:22 -07:00
H. Peter Anvin
4db5a16128 preproc.c: move smacro define/undef to separate functions
Instead of tons of replicated code, move smacro define/undef into
separate static functions.
2007-10-11 13:42:09 -07:00
H. Peter Anvin
95e7f957f2 preproc.c: PP_DEFINE and PP_XDEFINE are case-sensitive
The statement for case-sensitivity had PP_DEFINE and PP_IXDEFINE,
rather than PP_XDEFINE.
2007-10-11 13:38:38 -07:00
H. Peter Anvin
4bc9f1de73 preproc.c: normalize the handling of case sensitivity
Fix a bug relating to case sensitivity, and make remaining code more
similar.
2007-10-11 12:52:03 -07:00
H. Peter Anvin
f8ba53eb2a preproc.c: allow 64-bit repeat counts
Allow the count of %rep to exceed 2^31.
2007-10-11 10:11:57 -07:00
H. Peter Anvin
16ed438e71 preproc.c: For an SMacro, in_progress really is a boolean (no %rep) 2007-10-11 10:06:19 -07:00
H. Peter Anvin
70055964fc Additional uses of bool and enum
Proper use of bool and enum makes code easier to debug.  Do more of
it.  In particular, we really should stomp out any residual uses of
magic constants that aren't enums or, in some cases, even #defines.
2007-10-11 00:05:57 -07:00
H. Peter Anvin
54901e1785 preproc.c: MMacro.in_progress is not a boolean
Per the comment:

 * In a MMacro describing a `%rep' block, the `in_progress' field
 * isn't merely boolean, but gives the number of repeats left to
 * run.

This fixes the "global" directive not getting recognized, since it
repeats over all its arguments.
2007-10-11 00:05:57 -07:00
H. Peter Anvin
6867acc18e Use the compiler-provided booleans if available, otherwise emulate
Both C and C++ have "bool", "true" and "false" in lower case; C
requires <stdbool.h> for this, in C++ it is an inherent type built
into the compiler.  Use those instead of the old macros; emulate with
a simple typedef enum if unavailable.
2007-10-10 14:58:45 -07:00
H. Peter Anvin
476d2864b0 preproc.c: constipation
Add "const" in suitable places
2007-10-02 22:04:15 -07:00
H. Peter Anvin
fe501957c0 Portability fixes
Concentrate compiler dependencies to compiler.h; make sure compiler.h
is included first in every .c file (since some prototypes may depend
on the presence of feature request macros.)

Actually use the conditional inclusion of various functions (totally
broken in previous releases.)
2007-10-02 21:53:51 -07:00
H. Peter Anvin
e373efdab5 preproc.c: fix the loop in %undef
The parent-pointer-based freeing loop in %undef should not advance the
parent pointer when a node is freed, since that will result accessing
freed memory.
2007-09-24 21:33:17 -07:00
H. Peter Anvin
37a321fbbe Implement the -MG option (SF RFE 1564264)
Implement the -MG option, to generate dependencies in the presence of
generated files.  In the end, we probably need to support the full
gamut of GCC-like dependency-generation options.
2007-09-24 13:41:58 -07:00
H. Peter Anvin
25a993488c BR 1783117: Document that %+ needs a space after it, and fix crash
Document that %+ needs a space after it due to collision with %+1
syntax for multiline macro arguments; make it issue an error message
rather than crashing.
2007-09-22 17:45:45 -07:00
H. Peter Anvin
97a234782d Switch the preprocessor over to using the hash table library
Switch the preprocessor over to using the hash table library.  On my
system, this improves the runtime of the output of test/pref/macro.pl
from over 600 seconds to 7 seconds.

Macros have an odd mix of case-sensitive and case-insensitive
behaviour, plus there are matching parameters for arguments, etc.  As
a result, we use case-insensitive hash tables and use a linked list to
store all the possible isomorphs.
2007-09-16 18:04:57 -07:00
H. Peter Anvin
8cfdb9d185 preproc.c: remove unnecessary int64_t
We hardly need to support more than 2^31 arguments to a macro.
2007-09-14 18:36:01 -07:00
H. Peter Anvin
95e28828ab preproc.c: adjust whitespace
Be consistent about whitespace.
2007-09-12 04:20:08 +00:00
H. Peter Anvin
da10e7b85e More automation in the preprocessor conditionals handling
Further automate the production of preprocessor conditionals.  Now the
code automatically folds if/elif and the negatives.
2007-09-12 04:18:37 +00:00
H. Peter Anvin
9bf0aa7c52 Generate automatically correct tests for %if and %elif
Automatically generate macros to test for %if and %elif variants, which
are guaranteed to be correct across future changes.
2007-09-12 02:12:07 +00:00
H. Peter Anvin
4169a47bd9 Use a perfect hash to look up preprocessor directives
Use a perfect hash to look up preprocessor directives, and generate
the preprocessor directive list automatically.
2007-09-12 01:29:43 +00:00
H. Peter Anvin
ce9be34d3d Add RCXZ as a known preprocessor condition 2007-09-12 00:22:29 +00:00
Chuck Crayne
60ae75d3ab Add %IFN and %ELIFN as per RFE #786286 2007-05-02 01:59:16 +00:00
Keith Kanios
93f2e9a5a1 c99 printf/fprintf compliance. 2007-04-14 00:10:59 +00:00
Keith Kanios
a6dfa78b78 Fixed distinction between char and int8_t data types. 2007-04-13 16:47:53 +00:00
Keith Kanios
b7a89544d0 General push for x86-64 support, dubbed 0.99.00. 2007-04-12 02:40:54 +00:00
H. Peter Anvin
e2c80181b6 Apply Nindent to all .c and .h files 2005-01-15 22:15:51 +00:00
Ed Beroset
3ef4e4da04 changed last sprintf to more secure snprintf to prevent vulnerability to buffer
overflow exploits.
2004-12-15 18:30:54 +00:00
Ed Beroset
19f927ac64 cleaned up most but not all sprintf() and vsprintf() calls to avoid
vulnerability to buffer overflow exploits.
2004-12-15 17:07:03 +00:00
Ed Beroset
ec2e10cfea replaced vsprintf() with vsnprintf() to avoid buffer overflow exploit 2004-12-15 16:45:46 +00:00
Nickolay Yurchenko
f7956c4072 For compatibility with older code removed feature:
* Unterminated string auto termination.
2003-09-26 19:03:40 +00:00
Nickolay Yurchenko
f3b3ce27bd * Unterminated string auto termination.
* %(el)if(n)idn insensitivity to string quotes difference (#809300).
2003-09-21 20:38:43 +00:00
Nickolay Yurchenko
9aea715998 * Fix for %rep with no arguments (#560568)
* Fix concatenation of preprocessor function call  (#794686)
2003-09-07 22:46:26 +00:00
Frank Kotler
d0ed6fd30d Alexei's patch to allow "-I" paths to be searched for "incbin"ed files 2003-08-27 11:33:56 +00:00
Frank Kotler
7fd4f00930 Remove "backslash()" 2003-08-06 07:10:16 +00:00
Frank Kotler
d352302111 apply dborca's patch - make the "-U" switch work - finally! 2003-06-14 12:12:26 +00:00
H. Peter Anvin
bfebdb0a07 "const"-ipation fixes from Trevor Woerner 2002-09-12 02:23:54 +00:00
Ed Beroset
3ab3f41305 fixed multiple %ROTATE bugs (numbers 560567 and 560930) and changed
return value of do_directive from meaningless numbers to #defined values.
2002-06-11 03:31:49 +00:00
H. Peter Anvin
7cf897e7ae Correctly recognize $$ as TOKEN_BASE 2002-05-30 21:30:33 +00:00
H. Peter Anvin
0c60815d91 Undo broken %elif change, and put in a big comment explaining why the
existing code is correct.
2002-05-22 22:59:40 +00:00
Ed Beroset
168c9c0c43 Fixed bug 556600 in which an unterminated macro error never included a file
name or line number.
2002-05-17 03:10:13 +00:00
H. Peter Anvin
0a7a3b459c Change "const static" -> "static const" to keep gcc happy 2002-05-14 23:54:46 +00:00
H. Peter Anvin
310b3e165f Code cleanup fixes from Ed Beroset 2002-05-14 22:38:55 +00:00
H. Peter Anvin
99941bf067 Change __error (reserved namespace) to _error (normal namespace) 2002-05-14 17:44:03 +00:00
H. Peter Anvin
77ba0c6f98 Fix from Ed Beroset for unterminated %macro directive -> coredump 2002-05-14 03:18:53 +00:00
H. Peter Anvin
6574726f21 Add %ifmacro and friends, and fix two minor bugs:
a) The argument to %elif* is handled different than the one to %if*
b) Incorrect error messages for the %ifdef variants
2002-05-07 00:10:05 +00:00
H. Peter Anvin
9a633fa3b9 NASM 0.98.25alt 2002-04-30 21:08:11 +00:00
H. Peter Anvin
9f39464e5b NASM 0.98.25 2002-04-30 21:07:51 +00:00
H. Peter Anvin
dce1e2f795 NASM 0.98.23 2002-04-30 21:06:37 +00:00
H. Peter Anvin
9eb185bfdb NASM 0.98.15 2002-04-30 21:02:47 +00:00
H. Peter Anvin
ce61607e11 NASM 0.98.14 2002-04-30 21:02:23 +00:00