11 #ifndef TOR_COMPAT_CTYPE_H
12 #define TOR_COMPAT_CTYPE_H
19 #define DECLARE_CTYPE_FN(name) \
20 static int TOR_##name(char c); \
21 extern const uint32_t TOR_##name##_TABLE[]; \
22 static inline int TOR_##name(char c) { \
24 return !!(TOR_##name##_TABLE[(u >> 5) & 7] & (1u << (u & 31))); \
26 DECLARE_CTYPE_FN(ISALPHA)
27 DECLARE_CTYPE_FN(ISALNUM)
28 DECLARE_CTYPE_FN(ISSPACE)
29 DECLARE_CTYPE_FN(ISDIGIT)
30 DECLARE_CTYPE_FN(ISXDIGIT)
31 DECLARE_CTYPE_FN(ISPRINT)
32 DECLARE_CTYPE_FN(ISLOWER)
33 DECLARE_CTYPE_FN(ISUPPER)
35 extern const uint8_t TOR_TOLOWER_TABLE[];
36 #define TOR_TOLOWER(c) (TOR_TOLOWER_TABLE[(uint8_t)c])
37 #define TOR_TOUPPER(c) (TOR_TOUPPER_TABLE[(uint8_t)c])
56 case 'A':
case 'a':
return 10;
57 case 'B':
case 'b':
return 11;
58 case 'C':
case 'c':
return 12;
59 case 'D':
case 'd':
return 13;
60 case 'E':
case 'e':
return 14;
61 case 'F':
case 'f':
return 15;
static int hex_decode_digit(char c)
const uint8_t TOR_TOUPPER_TABLE[]
Integer definitions used throughout Tor.