Cleanup feenableexcept to use the same logic as the ARM version. No functional changes.
[glibc.git] / wctype / wctype.h
bloba307f05721bcaa6f23d873c477290443c7896a78
1 /* Copyright (C) 1996-2014 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
19 * ISO C99 Standard: 7.25
20 * Wide character classification and mapping utilities <wctype.h>
23 #ifndef _WCTYPE_H
25 #include <features.h>
26 #include <bits/types.h>
28 #ifndef __need_iswxxx
29 # define _WCTYPE_H 1
31 /* Get wint_t from <wchar.h>. */
32 # define __need_wint_t
33 # include <wchar.h>
35 /* Constant expression of type `wint_t' whose value does not correspond
36 to any member of the extended character set. */
37 # ifndef WEOF
38 # define WEOF (0xffffffffu)
39 # endif
40 #endif
41 #undef __need_iswxxx
44 /* The following part is also used in the <wcsmbs.h> header when compiled
45 in the Unix98 compatibility mode. */
46 #ifndef __iswxxx_defined
47 # define __iswxxx_defined 1
49 __BEGIN_NAMESPACE_C99
50 /* Scalar type that can hold values which represent locale-specific
51 character classifications. */
52 typedef unsigned long int wctype_t;
53 __END_NAMESPACE_C99
55 # ifndef _ISwbit
56 /* The characteristics are stored always in network byte order (big
57 endian). We define the bit value interpretations here dependent on the
58 machine's byte order. */
60 # include <endian.h>
61 # if __BYTE_ORDER == __BIG_ENDIAN
62 # define _ISwbit(bit) (1 << (bit))
63 # else /* __BYTE_ORDER == __LITTLE_ENDIAN */
64 # define _ISwbit(bit) \
65 ((bit) < 8 ? (int) ((1UL << (bit)) << 24) \
66 : ((bit) < 16 ? (int) ((1UL << (bit)) << 8) \
67 : ((bit) < 24 ? (int) ((1UL << (bit)) >> 8) \
68 : (int) ((1UL << (bit)) >> 24))))
69 # endif
71 enum
73 __ISwupper = 0, /* UPPERCASE. */
74 __ISwlower = 1, /* lowercase. */
75 __ISwalpha = 2, /* Alphabetic. */
76 __ISwdigit = 3, /* Numeric. */
77 __ISwxdigit = 4, /* Hexadecimal numeric. */
78 __ISwspace = 5, /* Whitespace. */
79 __ISwprint = 6, /* Printing. */
80 __ISwgraph = 7, /* Graphical. */
81 __ISwblank = 8, /* Blank (usually SPC and TAB). */
82 __ISwcntrl = 9, /* Control character. */
83 __ISwpunct = 10, /* Punctuation. */
84 __ISwalnum = 11, /* Alphanumeric. */
86 _ISwupper = _ISwbit (__ISwupper), /* UPPERCASE. */
87 _ISwlower = _ISwbit (__ISwlower), /* lowercase. */
88 _ISwalpha = _ISwbit (__ISwalpha), /* Alphabetic. */
89 _ISwdigit = _ISwbit (__ISwdigit), /* Numeric. */
90 _ISwxdigit = _ISwbit (__ISwxdigit), /* Hexadecimal numeric. */
91 _ISwspace = _ISwbit (__ISwspace), /* Whitespace. */
92 _ISwprint = _ISwbit (__ISwprint), /* Printing. */
93 _ISwgraph = _ISwbit (__ISwgraph), /* Graphical. */
94 _ISwblank = _ISwbit (__ISwblank), /* Blank (usually SPC and TAB). */
95 _ISwcntrl = _ISwbit (__ISwcntrl), /* Control character. */
96 _ISwpunct = _ISwbit (__ISwpunct), /* Punctuation. */
97 _ISwalnum = _ISwbit (__ISwalnum) /* Alphanumeric. */
99 # endif /* Not _ISwbit */
102 __BEGIN_DECLS
104 __BEGIN_NAMESPACE_C99
106 * Wide-character classification functions: 7.15.2.1.
109 /* Test for any wide character for which `iswalpha' or `iswdigit' is
110 true. */
111 extern int iswalnum (wint_t __wc) __THROW;
113 /* Test for any wide character for which `iswupper' or 'iswlower' is
114 true, or any wide character that is one of a locale-specific set of
115 wide-characters for which none of `iswcntrl', `iswdigit',
116 `iswpunct', or `iswspace' is true. */
117 extern int iswalpha (wint_t __wc) __THROW;
119 /* Test for any control wide character. */
120 extern int iswcntrl (wint_t __wc) __THROW;
122 /* Test for any wide character that corresponds to a decimal-digit
123 character. */
124 extern int iswdigit (wint_t __wc) __THROW;
126 /* Test for any wide character for which `iswprint' is true and
127 `iswspace' is false. */
128 extern int iswgraph (wint_t __wc) __THROW;
130 /* Test for any wide character that corresponds to a lowercase letter
131 or is one of a locale-specific set of wide characters for which
132 none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */
133 extern int iswlower (wint_t __wc) __THROW;
135 /* Test for any printing wide character. */
136 extern int iswprint (wint_t __wc) __THROW;
138 /* Test for any printing wide character that is one of a
139 locale-specific et of wide characters for which neither `iswspace'
140 nor `iswalnum' is true. */
141 extern int iswpunct (wint_t __wc) __THROW;
143 /* Test for any wide character that corresponds to a locale-specific
144 set of wide characters for which none of `iswalnum', `iswgraph', or
145 `iswpunct' is true. */
146 extern int iswspace (wint_t __wc) __THROW;
148 /* Test for any wide character that corresponds to an uppercase letter
149 or is one of a locale-specific set of wide character for which none
150 of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */
151 extern int iswupper (wint_t __wc) __THROW;
153 /* Test for any wide character that corresponds to a hexadecimal-digit
154 character equivalent to that performed be the functions described
155 in the previous subclause. */
156 extern int iswxdigit (wint_t __wc) __THROW;
158 /* Test for any wide character that corresponds to a standard blank
159 wide character or a locale-specific set of wide characters for
160 which `iswalnum' is false. */
161 # ifdef __USE_ISOC99
162 extern int iswblank (wint_t __wc) __THROW;
163 # endif
166 * Extensible wide-character classification functions: 7.15.2.2.
169 /* Construct value that describes a class of wide characters identified
170 by the string argument PROPERTY. */
171 extern wctype_t wctype (const char *__property) __THROW;
173 /* Determine whether the wide-character WC has the property described by
174 DESC. */
175 extern int iswctype (wint_t __wc, wctype_t __desc) __THROW;
176 __END_NAMESPACE_C99
180 * Wide-character case-mapping functions: 7.15.3.1.
183 __BEGIN_NAMESPACE_C99
184 /* Scalar type that can hold values which represent locale-specific
185 character mappings. */
186 typedef const __int32_t *wctrans_t;
187 __END_NAMESPACE_C99
188 #ifdef __USE_GNU
189 __USING_NAMESPACE_C99(wctrans_t)
190 #endif
192 __BEGIN_NAMESPACE_C99
193 /* Converts an uppercase letter to the corresponding lowercase letter. */
194 extern wint_t towlower (wint_t __wc) __THROW;
196 /* Converts an lowercase letter to the corresponding uppercase letter. */
197 extern wint_t towupper (wint_t __wc) __THROW;
198 __END_NAMESPACE_C99
200 __END_DECLS
202 #endif /* need iswxxx. */
205 /* The remaining definitions and declarations must not appear in the
206 <wchar.h> header. */
207 #ifdef _WCTYPE_H
210 * Extensible wide-character mapping functions: 7.15.3.2.
213 __BEGIN_DECLS
215 __BEGIN_NAMESPACE_C99
216 /* Construct value that describes a mapping between wide characters
217 identified by the string argument PROPERTY. */
218 extern wctrans_t wctrans (const char *__property) __THROW;
220 /* Map the wide character WC using the mapping described by DESC. */
221 extern wint_t towctrans (wint_t __wc, wctrans_t __desc) __THROW;
222 __END_NAMESPACE_C99
224 # ifdef __USE_XOPEN2K8
225 /* Declare the interface to extended locale model. */
226 # include <xlocale.h>
228 /* Test for any wide character for which `iswalpha' or `iswdigit' is
229 true. */
230 extern int iswalnum_l (wint_t __wc, __locale_t __locale) __THROW;
232 /* Test for any wide character for which `iswupper' or 'iswlower' is
233 true, or any wide character that is one of a locale-specific set of
234 wide-characters for which none of `iswcntrl', `iswdigit',
235 `iswpunct', or `iswspace' is true. */
236 extern int iswalpha_l (wint_t __wc, __locale_t __locale) __THROW;
238 /* Test for any control wide character. */
239 extern int iswcntrl_l (wint_t __wc, __locale_t __locale) __THROW;
241 /* Test for any wide character that corresponds to a decimal-digit
242 character. */
243 extern int iswdigit_l (wint_t __wc, __locale_t __locale) __THROW;
245 /* Test for any wide character for which `iswprint' is true and
246 `iswspace' is false. */
247 extern int iswgraph_l (wint_t __wc, __locale_t __locale) __THROW;
249 /* Test for any wide character that corresponds to a lowercase letter
250 or is one of a locale-specific set of wide characters for which
251 none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */
252 extern int iswlower_l (wint_t __wc, __locale_t __locale) __THROW;
254 /* Test for any printing wide character. */
255 extern int iswprint_l (wint_t __wc, __locale_t __locale) __THROW;
257 /* Test for any printing wide character that is one of a
258 locale-specific et of wide characters for which neither `iswspace'
259 nor `iswalnum' is true. */
260 extern int iswpunct_l (wint_t __wc, __locale_t __locale) __THROW;
262 /* Test for any wide character that corresponds to a locale-specific
263 set of wide characters for which none of `iswalnum', `iswgraph', or
264 `iswpunct' is true. */
265 extern int iswspace_l (wint_t __wc, __locale_t __locale) __THROW;
267 /* Test for any wide character that corresponds to an uppercase letter
268 or is one of a locale-specific set of wide character for which none
269 of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */
270 extern int iswupper_l (wint_t __wc, __locale_t __locale) __THROW;
272 /* Test for any wide character that corresponds to a hexadecimal-digit
273 character equivalent to that performed be the functions described
274 in the previous subclause. */
275 extern int iswxdigit_l (wint_t __wc, __locale_t __locale) __THROW;
277 /* Test for any wide character that corresponds to a standard blank
278 wide character or a locale-specific set of wide characters for
279 which `iswalnum' is false. */
280 extern int iswblank_l (wint_t __wc, __locale_t __locale) __THROW;
282 /* Construct value that describes a class of wide characters identified
283 by the string argument PROPERTY. */
284 extern wctype_t wctype_l (const char *__property, __locale_t __locale)
285 __THROW;
287 /* Determine whether the wide-character WC has the property described by
288 DESC. */
289 extern int iswctype_l (wint_t __wc, wctype_t __desc, __locale_t __locale)
290 __THROW;
294 * Wide-character case-mapping functions.
297 /* Converts an uppercase letter to the corresponding lowercase letter. */
298 extern wint_t towlower_l (wint_t __wc, __locale_t __locale) __THROW;
300 /* Converts an lowercase letter to the corresponding uppercase letter. */
301 extern wint_t towupper_l (wint_t __wc, __locale_t __locale) __THROW;
303 /* Construct value that describes a mapping between wide characters
304 identified by the string argument PROPERTY. */
305 extern wctrans_t wctrans_l (const char *__property, __locale_t __locale)
306 __THROW;
308 /* Map the wide character WC using the mapping described by DESC. */
309 extern wint_t towctrans_l (wint_t __wc, wctrans_t __desc,
310 __locale_t __locale) __THROW;
312 # endif /* Use POSIX 2008. */
314 __END_DECLS
316 #endif /* __WCTYPE_H defined. */
318 #endif /* wctype.h */