diff options
Diffstat (limited to 'src/lib/lua/lctype.h')
-rw-r--r-- | src/lib/lua/lctype.h | 53 |
1 files changed, 26 insertions, 27 deletions
diff --git a/src/lib/lua/lctype.h b/src/lib/lua/lctype.h index 99c7d122376..da45b2f9a01 100644 --- a/src/lib/lua/lctype.h +++ b/src/lib/lua/lctype.h @@ -20,58 +20,58 @@ #if 'A' == 65 && '0' == 48 /* ASCII case: can use its own tables; faster and fixed */ -#define LUA_USE_CTYPE 0 +#define LUA_USE_CTYPE 0 #else /* must use standard C ctype */ -#define LUA_USE_CTYPE 1 +#define LUA_USE_CTYPE 1 #endif #endif -#if !LUA_USE_CTYPE /* { */ +#if !LUA_USE_CTYPE /* { */ #include <limits.h> #include "llimits.h" -#define ALPHABIT 0 -#define DIGITBIT 1 -#define PRINTBIT 2 -#define SPACEBIT 3 -#define XDIGITBIT 4 +#define ALPHABIT 0 +#define DIGITBIT 1 +#define PRINTBIT 2 +#define SPACEBIT 3 +#define XDIGITBIT 4 -#define MASK(B) (1 << (B)) +#define MASK(B) (1 << (B)) /* ** add 1 to char to allow index -1 (EOZ) */ -#define testprop(c,p) (luai_ctype_[(c)+1] & (p)) +#define testprop(c,p) (luai_ctype_[(c)+1] & (p)) /* ** 'lalpha' (Lua alphabetic) and 'lalnum' (Lua alphanumeric) both include '_' */ -#define lislalpha(c) testprop(c, MASK(ALPHABIT)) -#define lislalnum(c) testprop(c, (MASK(ALPHABIT) | MASK(DIGITBIT))) -#define lisdigit(c) testprop(c, MASK(DIGITBIT)) -#define lisspace(c) testprop(c, MASK(SPACEBIT)) -#define lisprint(c) testprop(c, MASK(PRINTBIT)) -#define lisxdigit(c) testprop(c, MASK(XDIGITBIT)) +#define lislalpha(c) testprop(c, MASK(ALPHABIT)) +#define lislalnum(c) testprop(c, (MASK(ALPHABIT) | MASK(DIGITBIT))) +#define lisdigit(c) testprop(c, MASK(DIGITBIT)) +#define lisspace(c) testprop(c, MASK(SPACEBIT)) +#define lisprint(c) testprop(c, MASK(PRINTBIT)) +#define lisxdigit(c) testprop(c, MASK(XDIGITBIT)) /* ** this 'ltolower' only works for alphabetic characters */ -#define ltolower(c) ((c) | ('A' ^ 'a')) +#define ltolower(c) ((c) | ('A' ^ 'a')) /* two more entries for 0 and -1 (EOZ) */ LUAI_DDEC const lu_byte luai_ctype_[UCHAR_MAX + 2]; -#else /* }{ */ +#else /* }{ */ /* ** use standard C ctypes @@ -80,16 +80,15 @@ LUAI_DDEC const lu_byte luai_ctype_[UCHAR_MAX + 2]; #include <ctype.h> -#define lislalpha(c) (isalpha(c) || (c) == '_') -#define lislalnum(c) (isalnum(c) || (c) == '_') -#define lisdigit(c) (isdigit(c)) -#define lisspace(c) (isspace(c)) -#define lisprint(c) (isprint(c)) -#define lisxdigit(c) (isxdigit(c)) +#define lislalpha(c) (isalpha(c) || (c) == '_') +#define lislalnum(c) (isalnum(c) || (c) == '_') +#define lisdigit(c) (isdigit(c)) +#define lisspace(c) (isspace(c)) +#define lisprint(c) (isprint(c)) +#define lisxdigit(c) (isxdigit(c)) -#define ltolower(c) (tolower(c)) +#define ltolower(c) (tolower(c)) -#endif /* } */ +#endif /* } */ #endif - |