GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / toolchains / hndtools-arm-linux-2.6.36-uclibc-4.5.3 / arm-brcm-linux-uclibcgnueabi / sysroot / usr / include / bits / uClibc_ctype.h
blobc583fc39b4c0633f32b6ecc44c582d659b61cde0
1 /* Copyright (C) 2002 Manuel Novoa III
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2.1 of the License, or (at your option) any later version.
8 * The GNU C Library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with the GNU C Library; if not, write to the Free
15 * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
16 * 02111-1307 USA.
19 /* ATTENTION! ATTENTION! ATTENTION! ATTENTION! ATTENTION!
21 * Besides uClibc, I'm using this code in my libc for elks, which is
22 * a 16-bit environment with a fairly limited compiler. It would make
23 * things much easier for me if this file isn't modified unnecessarily.
24 * In particular, please put any new or replacement functions somewhere
25 * else, and modify the makefile to use your version instead.
26 * Thanks. Manuel
28 * ATTENTION! ATTENTION! ATTENTION! ATTENTION! ATTENTION! */
30 #if !defined(_CTYPE_H) && !defined(_WCTYPE_H)
31 #error Always include <{w}ctype.h> rather than <bits/uClibc_ctype.h>
32 #endif
34 #ifndef _BITS_UCLIBC_CTYPE_H
35 #define _BITS_UCLIBC_CTYPE_H
38 /* Define some ctype macros valid for the C/POSIX locale. */
40 /* ASCII ords of \t, \f, \n, \r, and \v are 9, 12, 10, 13, 11 respectively. */
41 #define __C_isspace(c) \
42 ((sizeof(c) == sizeof(char)) \
43 ? ((((c) == ' ') || (((unsigned char)((c) - 9)) <= (13 - 9)))) \
44 : ((((c) == ' ') || (((unsigned int)((c) - 9)) <= (13 - 9)))))
45 #define __C_isblank(c) (((c) == ' ') || ((c) == '\t'))
46 #define __C_isdigit(c) \
47 ((sizeof(c) == sizeof(char)) \
48 ? (((unsigned char)((c) - '0')) < 10) \
49 : (((unsigned int)((c) - '0')) < 10))
50 #define __C_isxdigit(c) \
51 (__C_isdigit(c) \
52 || ((sizeof(c) == sizeof(char)) \
53 ? (((unsigned char)((((c)) | 0x20) - 'a')) < 6) \
54 : (((unsigned int)((((c)) | 0x20) - 'a')) < 6)))
55 #define __C_iscntrl(c) \
56 ((sizeof(c) == sizeof(char)) \
57 ? ((((unsigned char)(c)) < 0x20) || ((c) == 0x7f)) \
58 : ((((unsigned int)(c)) < 0x20) || ((c) == 0x7f)))
59 #define __C_isalpha(c) \
60 ((sizeof(c) == sizeof(char)) \
61 ? (((unsigned char)(((c) | 0x20) - 'a')) < 26) \
62 : (((unsigned int)(((c) | 0x20) - 'a')) < 26))
63 #define __C_isalnum(c) (__C_isalpha(c) || __C_isdigit(c))
64 #define __C_isprint(c) \
65 ((sizeof(c) == sizeof(char)) \
66 ? (((unsigned char)((c) - 0x20)) <= (0x7e - 0x20)) \
67 : (((unsigned int)((c) - 0x20)) <= (0x7e - 0x20)))
68 #define __C_islower(c) \
69 ((sizeof(c) == sizeof(char)) \
70 ? (((unsigned char)((c) - 'a')) < 26) \
71 : (((unsigned int)((c) - 'a')) < 26))
72 #define __C_isupper(c) \
73 ((sizeof(c) == sizeof(char)) \
74 ? (((unsigned char)((c) - 'A')) < 26) \
75 : (((unsigned int)((c) - 'A')) < 26))
76 #define __C_ispunct(c) \
77 ((!__C_isalnum(c)) \
78 && ((sizeof(c) == sizeof(char)) \
79 ? (((unsigned char)((c) - 0x21)) <= (0x7e - 0x21)) \
80 : (((unsigned int)((c) - 0x21)) <= (0x7e - 0x21))))
81 #define __C_isgraph(c) \
82 ((sizeof(c) == sizeof(char)) \
83 ? (((unsigned char)((c) - 0x21)) <= (0x7e - 0x21)) \
84 : (((unsigned int)((c) - 0x21)) <= (0x7e - 0x21)))
86 #define __C_tolower(c) (__C_isupper(c) ? ((c) | 0x20) : (c))
87 #define __C_toupper(c) (__C_islower(c) ? ((c) ^ 0x20) : (c))
89 /**********************************************************************/
90 __BEGIN_DECLS
93 /* Now some non-ansi/iso c99 macros. */
95 #ifdef __UCLIBC_SUSV4_LEGACY__
96 #define __isascii(c) (((c) & ~0x7f) == 0)
97 #define __toascii(c) ((c) & 0x7f)
98 /* Works correctly *only* on lowercase letters! */
99 #define _toupper(c) ((c) ^ 0x20)
100 /* Works correctly *only* on letters (of any case) and numbers */
101 #define _tolower(c) ((c) | 0x20)
102 #endif
104 __END_DECLS
106 /**********************************************************************/
107 #ifdef __GNUC__
109 # define __body_C_macro(f,args) __C_ ## f args
111 # define __body(f,c) \
112 (__extension__ ({ \
113 int __res; \
114 if (sizeof(c) > sizeof(char)) { \
115 int __c = (c); \
116 __res = __body_C_macro(f,(__c)); \
117 } else { \
118 unsigned char __c = (c); \
119 __res = __body_C_macro(f,(__c)); \
121 __res; \
124 # define __isspace(c) __body(isspace,c)
125 # define __isblank(c) __body(isblank,c)
126 # define __isdigit(c) __body(isdigit,c)
127 # define __isxdigit(c) __body(isxdigit,c)
128 # define __iscntrl(c) __body(iscntrl,c)
129 # define __isalpha(c) __body(isalpha,c)
130 # define __isalnum(c) __body(isalnum,c)
131 # define __isprint(c) __body(isprint,c)
132 # define __islower(c) __body(islower,c)
133 # define __isupper(c) __body(isupper,c)
134 # define __ispunct(c) __body(ispunct,c)
135 # define __isgraph(c) __body(isgraph,c)
137 /*locale-aware ctype.h has no __tolower, why stub locale
138 *tries to have it? remove after 0.9.31
139 *# define __tolower(c) __body(tolower,c)
140 *# define __toupper(c) __body(toupper,c)
143 /* Do not combine in one #if - unifdef tool is not that clever */
144 # ifndef __cplusplus
146 # define isspace(c) __isspace(c)
147 # define isblank(c) __isblank(c)
148 # define isdigit(c) __isdigit(c)
149 # define isxdigit(c) __isxdigit(c)
150 # define iscntrl(c) __iscntrl(c)
151 # define isalpha(c) __isalpha(c)
152 # define isalnum(c) __isalnum(c)
153 # define isprint(c) __isprint(c)
154 # define islower(c) __islower(c)
155 # define isupper(c) __isupper(c)
156 # define ispunct(c) __ispunct(c)
157 # define isgraph(c) __isgraph(c)
159 # define tolower(c) __body(tolower,c)
160 # define toupper(c) __body(toupper,c)
162 # endif
164 #else /* !_GNUC__ */
166 # ifndef __cplusplus
168 /* These macros should be safe from side effects!
169 * (not all __C_xxx macros are) */
170 # define isdigit(c) __C_isdigit(c)
171 # define isalpha(c) __C_isalpha(c)
172 # define isprint(c) __C_isprint(c)
173 # define islower(c) __C_islower(c)
174 # define isupper(c) __C_isupper(c)
175 # define isgraph(c) __C_isgraph(c)
177 # endif
179 #endif /* __GNUC__ */
180 /**********************************************************************/
183 #endif /* _BITS_UCLIBC_CTYPE_H */