ia64/xen-unstable

annotate 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
rev   line source
kaf24@6714 1 #ifndef _CTYPE_H
kaf24@6714 2 #define _CTYPE_H
kaf24@6714 3
keir@17972 4 #ifdef HAVE_LIBC
keir@17972 5 #include_next <ctype.h>
keir@17972 6 #else
kaf24@6714 7 /*
kaf24@6714 8 * NOTE! This ctype does not handle EOF like the standard C
kaf24@6714 9 * library is required to.
kaf24@6714 10 */
kaf24@6714 11
kaf24@6714 12 #define _U 0x01 /* upper */
kaf24@6714 13 #define _L 0x02 /* lower */
kaf24@6714 14 #define _D 0x04 /* digit */
kaf24@6714 15 #define _C 0x08 /* cntrl */
kaf24@6714 16 #define _P 0x10 /* punct */
kaf24@6714 17 #define _S 0x20 /* white space (space/lf/tab) */
kaf24@6714 18 #define _X 0x40 /* hex digit */
kaf24@6714 19 #define _SP 0x80 /* hard space (0x20) */
kaf24@6714 20
kaf24@6714 21
keir@16437 22 extern unsigned char _ctype[];
kaf24@6714 23
kaf24@6714 24 #define __ismask(x) (_ctype[(int)(unsigned char)(x)])
kaf24@6714 25
kaf24@6714 26 #define isalnum(c) ((__ismask(c)&(_U|_L|_D)) != 0)
kaf24@6714 27 #define isalpha(c) ((__ismask(c)&(_U|_L)) != 0)
kaf24@6714 28 #define iscntrl(c) ((__ismask(c)&(_C)) != 0)
kaf24@6714 29 #define isdigit(c) ((__ismask(c)&(_D)) != 0)
kaf24@6714 30 #define isgraph(c) ((__ismask(c)&(_P|_U|_L|_D)) != 0)
kaf24@6714 31 #define islower(c) ((__ismask(c)&(_L)) != 0)
kaf24@6714 32 #define isprint(c) ((__ismask(c)&(_P|_U|_L|_D|_SP)) != 0)
kaf24@6714 33 #define ispunct(c) ((__ismask(c)&(_P)) != 0)
kaf24@6714 34 #define isspace(c) ((__ismask(c)&(_S)) != 0)
kaf24@6714 35 #define isupper(c) ((__ismask(c)&(_U)) != 0)
kaf24@6714 36 #define isxdigit(c) ((__ismask(c)&(_D|_X)) != 0)
kaf24@6714 37
kaf24@6714 38 #define isascii(c) (((unsigned char)(c))<=0x7f)
kaf24@6714 39 #define toascii(c) (((unsigned char)(c))&0x7f)
kaf24@6714 40
kaf24@6714 41 static inline unsigned char __tolower(unsigned char c)
kaf24@6714 42 {
kaf24@6714 43 if (isupper(c))
kaf24@6714 44 c -= 'A'-'a';
kaf24@6714 45 return c;
kaf24@6714 46 }
kaf24@6714 47
kaf24@6714 48 static inline unsigned char __toupper(unsigned char c)
kaf24@6714 49 {
kaf24@6714 50 if (islower(c))
kaf24@6714 51 c -= 'a'-'A';
kaf24@6714 52 return c;
kaf24@6714 53 }
kaf24@6714 54
kaf24@6714 55 #define tolower(c) __tolower(c)
kaf24@6714 56 #define toupper(c) __toupper(c)
kaf24@6714 57
kaf24@6714 58 #endif
keir@17972 59
keir@17972 60 #endif