ia64/xen-unstable

view extras/mini-os/include/ctype.h @ 17972:433d1b26fd51

stubdom: use host's gcc

This makes stubdom use the host's gcc instead of downloading/compiling
binutils+gcc. That requires a bunch of changes and even uncovered a
few bugs, but saves a lot of time.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Jul 04 17:47:11 2008 +0100 (2008-07-04)
parents c9c476a22036
children
line source
1 #ifndef _CTYPE_H
2 #define _CTYPE_H
4 #ifdef HAVE_LIBC
5 #include_next <ctype.h>
6 #else
7 /*
8 * NOTE! This ctype does not handle EOF like the standard C
9 * library is required to.
10 */
12 #define _U 0x01 /* upper */
13 #define _L 0x02 /* lower */
14 #define _D 0x04 /* digit */
15 #define _C 0x08 /* cntrl */
16 #define _P 0x10 /* punct */
17 #define _S 0x20 /* white space (space/lf/tab) */
18 #define _X 0x40 /* hex digit */
19 #define _SP 0x80 /* hard space (0x20) */
22 extern unsigned char _ctype[];
24 #define __ismask(x) (_ctype[(int)(unsigned char)(x)])
26 #define isalnum(c) ((__ismask(c)&(_U|_L|_D)) != 0)
27 #define isalpha(c) ((__ismask(c)&(_U|_L)) != 0)
28 #define iscntrl(c) ((__ismask(c)&(_C)) != 0)
29 #define isdigit(c) ((__ismask(c)&(_D)) != 0)
30 #define isgraph(c) ((__ismask(c)&(_P|_U|_L|_D)) != 0)
31 #define islower(c) ((__ismask(c)&(_L)) != 0)
32 #define isprint(c) ((__ismask(c)&(_P|_U|_L|_D|_SP)) != 0)
33 #define ispunct(c) ((__ismask(c)&(_P)) != 0)
34 #define isspace(c) ((__ismask(c)&(_S)) != 0)
35 #define isupper(c) ((__ismask(c)&(_U)) != 0)
36 #define isxdigit(c) ((__ismask(c)&(_D|_X)) != 0)
38 #define isascii(c) (((unsigned char)(c))<=0x7f)
39 #define toascii(c) (((unsigned char)(c))&0x7f)
41 static inline unsigned char __tolower(unsigned char c)
42 {
43 if (isupper(c))
44 c -= 'A'-'a';
45 return c;
46 }
48 static inline unsigned char __toupper(unsigned char c)
49 {
50 if (islower(c))
51 c -= 'a'-'A';
52 return c;
53 }
55 #define tolower(c) __tolower(c)
56 #define toupper(c) __toupper(c)
58 #endif
60 #endif