summaryrefslogtreecommitdiff
path: root/stdscan.c
Commit message (Collapse)AuthorAgeFilesLines
* stdscan.c: use TOKEN_EOS and string helpersCyrill Gorcunov2009-10-311-6/+5
| | | | | | Also tab/space cleanup Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* Various tab/space/comment cleanupCyrill Gorcunov2009-10-311-61/+63
| | | | | | No change on binary level Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* stdscan: switch to stdscan_get/set routinesCyrill Gorcunov2009-10-311-1/+11
| | | | | | | | | | Instead of manipulating stdscan buffer pointer directly we switch to a routine interface. This allow us to unify stdscan access: ie caller should "talk" to stdscan via stdscan_get/set routines. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* Add copyright headers to the *.c/*.h files in the main directoryH. Peter Anvin2009-06-281-0/+33
| | | | | | | | | | Add copyright headers to the *.c/*.h files in the main directory. For files where I'm sure enough that we have all the approvals, I have given them the 2-BSD license, the others have been given the "LGPL for now" license header. Most of them can probably be changed after auditing. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* ctype.h: wrapper ctype functions with a cast to (unsigned char)H. Peter Anvin2008-06-211-1/+1
| | | | | | | | | ctype functions take an *int*, which the user is expected to have taken the input character from getc() and friends, or taken a character and cast it to (unsigned char). We don't care about EOF (-1), so use macros that cast to (unsigned char) for us.
* Use an explicit table for tolower() to avoid a function callH. Peter Anvin2008-06-111-1/+1
| | | | | | | | | | On some platforms, tolower() is implemented as a function call, in order to handle locale support. We never change locales, so can the result of tolower() into a table, so we don't have to sit through the function call every time. ~1.3% overall performance improvement on a macro-heavy benchmark under Linux x86-64.
* Make strings a first-class token type; defer evaluationH. Peter Anvin2008-06-091-6/+2
| | | | | | | Make strings a proper, first-class token type, instead of relying on the "TOKEN_NUM with tv_charptr" hack. Only convert a string to a number if requested in an expression context; this also makes it possible to actually issue a warning when it overflows.
* Fix memory management issues with expanded %includeH. Peter Anvin2008-06-041-9/+8
| | | | | | | | Ownership of the filename string was a bit fuzzy, with the result that we were freeing it even though it was retained for use by __FILE__. Clean up a number of other memory management issues with the new quoting code, and change the stdscan implementation to one pass over the string.
* qstring: backquoted strings seem to work now...H. Peter Anvin2008-06-011-12/+17
| | | | Hopefully backquoted strings should work correctly now.
* stdscan.c: clarify commentH. Peter Anvin2008-05-301-1/+1
| | | | There is a reason rn_warn isn't checked in this particular case...
* Support binary and octal floating-pointH. Peter Anvin2007-10-221-1/+1
| | | | | | For consistency, support binary and octal floating-point, and accept a "0d" or "0t" prefix for decimal floating-point. However, we do not accept a binary exponent (p) for a decimal mantissa, or vice versa.
* More consistent handling of radix lettersH. Peter Anvin2007-10-221-7/+8
| | | | | | | | | | Allow any radix letter from the set [bydtoqhx] to be used either "Intel-style" (0...x) or "C-style" (0x...). In Intel style, the leading 0 remains optional as long as the first digit is in the range 0-9. As a consequence, allow the prefix "0h" for hexadecimal floating point.
* Allow $-prefixed hexadecimal FP as an alternative to 0xH. Peter Anvin2007-10-191-1/+1
| | | | | | Since we allow the prefix $ instead of 0x for integer constants, do the same for floating point. No suffix support at this time; we may want to consider if that would be appropriate.
* Formatting: kill off "stealth whitespace"H. Peter Anvin2007-10-191-1/+0
| | | | | "Stealth whitespace" makes it harder to read diffs, and just generally cause unwanted weirdness. Do a source-wide pass to get rid of it.
* Don't confuse suffixed hexadecimal with floating-pointH. Peter Anvin2007-10-191-3/+20
| | | | | | | 1e30 is a floating-point constant, but 1e30h is not. The scanner won't know that until it sees the "h", so make sure we keep enough state to be able to distinguish "1e30" (a possible hex constant) from "1.e30", "1e+30" or "1.0" (unabiguously floating-point.)
* Allow underscores in numbers; better detection of FPH. Peter Anvin2007-10-191-25/+35
| | | | | | | | | - Allow underscores as group separators in numbers, for example: 0x1234_5678 is now a legal number. The underscore is just ignored, it adds no meaning. - Recognize dotless floating-point numbers, such as "1e30". This entails distinguishing hexadecimal numbers in the scanner, since e.g. 0x1e30 is a perfectly legitimate hex constant.
* More "bool" fixesH. Peter Anvin2007-10-111-1/+1
| | | | A few more variables passed as pointers which are now defined as bool *.
* Additional uses of bool and enumH. Peter Anvin2007-10-111-1/+1
| | | | | | 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.
* Use the compiler-provided booleans if available, otherwise emulateH. Peter Anvin2007-10-101-2/+2
| | | | | | | 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.
* Portability fixesH. Peter Anvin2007-10-021-0/+2
| | | | | | | | | 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.)
* Slightly optimize the interface to nasm_token_hash()sse5H. Peter Anvin2007-09-181-5/+1
| | | | | | Instead of returning -1 from nasm_token_hash, set tv->t_type to TOKEN_ID and return TOKEN_ID, since that's what stdscan.c wants to do with it anyway. This allows us to simply tailcall nasm_token_hash().
* Support C99-style hexadecimal floating point.H. Peter Anvin2007-09-181-1/+3
| | | | | | Add support for C99-style hexadecimal floating point. The format is 0x <hexadecimal mantissa> p <binary exponent>. 0x1.0e+1 thus is the same as 2.0.
* Minor cleanup; remove duplication of names.cH. Peter Anvin2007-08-311-3/+3
|
* Finishing touches on perfect hash tokenizer; actually turn the thing onH. Peter Anvin2007-08-301-0/+201
Finish the perfect hash tokenizer, and actually enable it. Move stdscan() et al to a separate file, since it's not needed in any of the clients of nasmlib other than nasm itself. Run make alldeps.