ia64/xen-unstable

view extras/mini-os/include/ctype.h @ 10843:4f6d858ea570

[PCI] Per-device permissive flag (replaces global permissive flag).
Signed-off-by: Chris Bookholt <hap10@tycho.ncsc.mil>
author kfraser@localhost.localdomain
date Fri Jul 28 12:56:10 2006 +0100 (2006-07-28)
parents 06d84bf87159
children c9c476a22036
line source
1 #ifndef _CTYPE_H
2 #define _CTYPE_H
4 /*
5 * NOTE! This ctype does not handle EOF like the standard C
6 * library is required to.
7 */
9 #define _U 0x01 /* upper */
10 #define _L 0x02 /* lower */
11 #define _D 0x04 /* digit */
12 #define _C 0x08 /* cntrl */
13 #define _P 0x10 /* punct */
14 #define _S 0x20 /* white space (space/lf/tab) */
15 #define _X 0x40 /* hex digit */
16 #define _SP 0x80 /* hard space (0x20) */
19 unsigned char _ctype[] = {
20 _C,_C,_C,_C,_C,_C,_C,_C, /* 0-7 */
21 _C,_C|_S,_C|_S,_C|_S,_C|_S,_C|_S,_C,_C, /* 8-15 */
22 _C,_C,_C,_C,_C,_C,_C,_C, /* 16-23 */
23 _C,_C,_C,_C,_C,_C,_C,_C, /* 24-31 */
24 _S|_SP,_P,_P,_P,_P,_P,_P,_P, /* 32-39 */
25 _P,_P,_P,_P,_P,_P,_P,_P, /* 40-47 */
26 _D,_D,_D,_D,_D,_D,_D,_D, /* 48-55 */
27 _D,_D,_P,_P,_P,_P,_P,_P, /* 56-63 */
28 _P,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U, /* 64-71 */
29 _U,_U,_U,_U,_U,_U,_U,_U, /* 72-79 */
30 _U,_U,_U,_U,_U,_U,_U,_U, /* 80-87 */
31 _U,_U,_U,_P,_P,_P,_P,_P, /* 88-95 */
32 _P,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L, /* 96-103 */
33 _L,_L,_L,_L,_L,_L,_L,_L, /* 104-111 */
34 _L,_L,_L,_L,_L,_L,_L,_L, /* 112-119 */
35 _L,_L,_L,_P,_P,_P,_P,_C, /* 120-127 */
36 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 128-143 */
37 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 144-159 */
38 _S|_SP,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P, /* 160-175 */
39 _P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P, /* 176-191 */
40 _U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U, /* 192-207 */
41 _U,_U,_U,_U,_U,_U,_U,_P,_U,_U,_U,_U,_U,_U,_U,_L, /* 208-223 */
42 _L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L, /* 224-239 */
43 _L,_L,_L,_L,_L,_L,_L,_P,_L,_L,_L,_L,_L,_L,_L,_L}; /* 240-255 */
45 #define __ismask(x) (_ctype[(int)(unsigned char)(x)])
47 #define isalnum(c) ((__ismask(c)&(_U|_L|_D)) != 0)
48 #define isalpha(c) ((__ismask(c)&(_U|_L)) != 0)
49 #define iscntrl(c) ((__ismask(c)&(_C)) != 0)
50 #define isdigit(c) ((__ismask(c)&(_D)) != 0)
51 #define isgraph(c) ((__ismask(c)&(_P|_U|_L|_D)) != 0)
52 #define islower(c) ((__ismask(c)&(_L)) != 0)
53 #define isprint(c) ((__ismask(c)&(_P|_U|_L|_D|_SP)) != 0)
54 #define ispunct(c) ((__ismask(c)&(_P)) != 0)
55 #define isspace(c) ((__ismask(c)&(_S)) != 0)
56 #define isupper(c) ((__ismask(c)&(_U)) != 0)
57 #define isxdigit(c) ((__ismask(c)&(_D|_X)) != 0)
59 #define isascii(c) (((unsigned char)(c))<=0x7f)
60 #define toascii(c) (((unsigned char)(c))&0x7f)
62 static inline unsigned char __tolower(unsigned char c)
63 {
64 if (isupper(c))
65 c -= 'A'-'a';
66 return c;
67 }
69 static inline unsigned char __toupper(unsigned char c)
70 {
71 if (islower(c))
72 c -= 'a'-'A';
73 return c;
74 }
76 #define tolower(c) __tolower(c)
77 #define toupper(c) __toupper(c)
79 #endif