Commit | Line | Data |
---|---|---|
f5bcab4b WJ |
1 | /* ctype.h */ |
2 | ||
3 | /* This file contains macros definitions and extern declarations for a | |
4 | * version of <ctype.h> which is aware of the o_flipcase letters used in | |
5 | * elvis. | |
6 | * | |
7 | * This file uses the "uchar" data type and "UCHAR" conversion macro which | |
8 | * are defined in "config.h". Consequently, any file that includes this | |
9 | * header must include config.h first. | |
10 | */ | |
11 | ||
12 | #ifndef _CT_UPPER | |
13 | ||
14 | #define _CT_UPPER 0x01 | |
15 | #define _CT_LOWER 0x02 | |
16 | #define _CT_SPACE 0x04 | |
17 | #define _CT_DIGIT 0x08 | |
18 | #define _CT_ALNUM 0x10 | |
19 | #define _CT_CNTRL 0x20 | |
20 | ||
21 | #define isalnum(c) (_ct_ctypes[UCHAR(c)] & _CT_ALNUM) | |
22 | #define isalpha(c) (_ct_ctypes[UCHAR(c)] & (_CT_LOWER|_CT_UPPER)) | |
23 | #define isdigit(c) (_ct_ctypes[UCHAR(c)] & _CT_DIGIT) | |
24 | #define islower(c) (_ct_ctypes[UCHAR(c)] & _CT_LOWER) | |
25 | #define isspace(c) (_ct_ctypes[UCHAR(c)] & _CT_SPACE) | |
26 | #define isupper(c) (_ct_ctypes[UCHAR(c)] & _CT_UPPER) | |
27 | #define iscntrl(c) (_ct_ctypes[UCHAR(c)] & _CT_CNTRL) | |
28 | #define ispunct(c) (!_ct_ctypes[UCHAR(c)]) /* punct = "none of the above" */ | |
29 | ||
30 | #define isascii(c) (!((c) & 0x80)) | |
31 | ||
32 | #define toupper(c) _ct_toupper[UCHAR(c)] | |
33 | #define tolower(c) _ct_tolower[UCHAR(c)] | |
34 | ||
35 | extern uchar _ct_toupper[]; | |
36 | extern uchar _ct_tolower[]; | |
37 | extern uchar _ct_ctypes[]; | |
38 | extern void _ct_init(/* char *flipcase */); | |
39 | ||
40 | #endif /* ndef _CT_UPPER */ |