Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / openhackware / src / libc / include / ctype.h
1 /*
2  * <ctype.h>
3  *
4  * Open Hack'Ware BIOS POSIX like ctype definitions
5  * 
6  * Copyright (c) 2004-2005 Jocelyn Mayer
7  * 
8  *   This program is free software; you can redistribute it and/or
9  *   modify it under the terms of the GNU General Public License V2
10  *   as published by the Free Software Foundation
11  *
12  *   This program is distributed in the hope that it will be useful,
13  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *   GNU General Public License for more details.
16  *
17  *   You should have received a copy of the GNU General Public License
18  *   along with this program; if not, write to the Free Software
19  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20  */
21
22 #if !defined (__OHW_CTYPE_H__)
23 #define __OHW_CTYPE_H__
24
25 /* Beware that those routines only support ASCII */
26 static inline int islower (int c)
27 {
28     return c >= 'a' && c <= 'z';
29 }
30
31 static inline int isupper (int c)
32 {
33     return c >= 'A' && c <= 'Z';
34 }
35
36 static inline int isalpha (int c)
37 {
38     return islower(c) || isupper(c);
39 }
40
41 static inline int isdigit (int c)
42 {
43     return c >= '0' && c <= '9';
44 }
45
46 static inline int isalnum (int c)
47 {
48     return isalpha(c) || isdigit(c);
49 }
50
51 static inline int isxdigit (int c)
52 {
53     return isdigit(c) || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F');
54 }
55
56 static inline int isspace (int c)
57 {
58     return c == ' ' || c == '\f' || c == '\n' || c == '\r' ||
59         c == '\t' || c == '\v';
60 }
61
62 static inline int isgraph (int c)
63 {
64     return (c >= 0x21 && c <= 0x7E) || (c >= 0xA1 && c <= 0xFF);
65 }
66
67 static inline int isprint (int c)
68 {
69     return isgraph(c) && c != ' ';
70 }
71
72 static inline int ispunct (int c)
73 {
74     return isprint(c) && !isalpha(c) && !isspace(c);
75 }
76
77 static inline int isblank (int c)
78 {
79     return c == ' ' || c == '\t';
80 }
81
82 static inline int iscntrl (int c)
83 {
84     return !isprint(c);
85 }
86
87 static inline int isascii (int c)
88 {
89     return (c & 0x80) == 0;
90 }
91
92 static inline int tolower (int c)
93 {
94     if (isupper(c))
95         c |= 0x20;
96
97     return c;
98 }
99
100 static inline int toupper (int c)
101 {
102     if (islower(c))
103         c &= ~0x20;
104
105     return c;
106 }
107
108 static inline int toascii (int c)
109 {
110     return c & ~0x80;
111 }
112
113 #endif /* !defined (__OHW_CTYPE_H__) */