3 ** Donated to the public domain.
11 #define LJ_CHAR_CNTRL 0x01
12 #define LJ_CHAR_SPACE 0x02
13 #define LJ_CHAR_PUNCT 0x04
14 #define LJ_CHAR_DIGIT 0x08
15 #define LJ_CHAR_XDIGIT 0x10
16 #define LJ_CHAR_UPPER 0x20
17 #define LJ_CHAR_LOWER 0x40
18 #define LJ_CHAR_IDENT 0x80
19 #define LJ_CHAR_ALPHA (LJ_CHAR_LOWER|LJ_CHAR_UPPER)
20 #define LJ_CHAR_ALNUM (LJ_CHAR_ALPHA|LJ_CHAR_DIGIT)
21 #define LJ_CHAR_GRAPH (LJ_CHAR_ALNUM|LJ_CHAR_PUNCT)
23 /* Only pass -1 or 0..255 to these macros. Never pass a signed char! */
24 #define lj_char_isa(c, t) (lj_char_bits[(c)+1] & t)
25 #define lj_char_iscntrl(c) lj_char_isa((c), LJ_CHAR_CNTRL)
26 #define lj_char_isspace(c) lj_char_isa((c), LJ_CHAR_SPACE)
27 #define lj_char_ispunct(c) lj_char_isa((c), LJ_CHAR_PUNCT)
28 #define lj_char_isdigit(c) lj_char_isa((c), LJ_CHAR_DIGIT)
29 #define lj_char_isxdigit(c) lj_char_isa((c), LJ_CHAR_XDIGIT)
30 #define lj_char_isupper(c) lj_char_isa((c), LJ_CHAR_UPPER)
31 #define lj_char_islower(c) lj_char_isa((c), LJ_CHAR_LOWER)
32 #define lj_char_isident(c) lj_char_isa((c), LJ_CHAR_IDENT)
33 #define lj_char_isalpha(c) lj_char_isa((c), LJ_CHAR_ALPHA)
34 #define lj_char_isalnum(c) lj_char_isa((c), LJ_CHAR_ALNUM)
35 #define lj_char_isgraph(c) lj_char_isa((c), LJ_CHAR_GRAPH)
37 #define lj_char_toupper(c) ((c) - (lj_char_islower(c) >> 1))
38 #define lj_char_tolower(c) ((c) + lj_char_isupper(c))
40 LJ_DATA
const uint8_t lj_char_bits
[257];