summaryrefslogtreecommitdiff
path: root/nasm.h
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2016-03-03 17:11:28 -0800
committerH. Peter Anvin <hpa@zytor.com>2016-03-03 17:18:38 -0800
commit3a27b17c7fea3845c63864e11008edf8cebd7e17 (patch)
tree4e8ab085247347eddf76fe242b76198d8e6332c1 /nasm.h
parenta9a1b5c318e7bcb7680483c51933c6f3d6c69cd9 (diff)
downloadnasm-ctype.tar.gz
Replace external dependencies on <ctype.h> with an internal tablectype
Don't rely on the platform <ctype.h>; hopefully this can avoid problems. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'nasm.h')
-rw-r--r--nasm.h21
1 files changed, 5 insertions, 16 deletions
diff --git a/nasm.h b/nasm.h
index ff2acfe7..d50e6152 100644
--- a/nasm.h
+++ b/nasm.h
@@ -428,25 +428,14 @@ extern struct preproc_ops preproc_nop;
* decorator. E.g. {rn-sae}, {1to8}, {k1}{z}
*/
-#define isidstart(c) (nasm_isalpha(c) || \
- (c) == '_' || \
- (c) == '.' || \
- (c) == '?' || \
- (c) == '@')
-
-#define isidchar(c) (isidstart(c) || \
- nasm_isdigit(c) || \
- (c) == '$' || \
- (c) == '#' || \
- (c) == '~')
-
-#define isbrcchar(c) (isidchar(c) || \
- (c) == '-')
+#define isidstart(c) ((nasm_ctype_tab[(unsigned char)c] & 0x60) >= 0x60)
+#define isidchar(c) ((nasm_ctype_tab[(unsigned char)c] & 0x60) >= 0x40)
+#define isbrcchar(c) ((nasm_ctype_tab[(unsigned char)c] & 0x60) >= 0x20)
/* Ditto for numeric constants. */
-#define isnumstart(c) (nasm_isdigit(c) || (c) == '$')
-#define isnumchar(c) (nasm_isalnum(c) || (c) == '_')
+#define isnumstart(c) (!!(nasm_ctype_tab[(unsigned char)c] & 0x80))
+#define isnumchar(c) nasm_isalnum(c)
/*
* Data-type flags that get passed to listing-file routines.