arc: add acq/rel variants for atomic cmpxchg/xchg
[uclibc-ng.git] / include / wctype.h
blob3842ccf4e815c492a74e128c8f204975ee56b139
1 /* Copyright (C) 1996,97,98,99,2000,01,02 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 __UCLIBC_HAS_WCHAR__
29 #error Attempted to include wctype.h when uClibc built without wide char support.
30 #endif
32 #ifndef __need_iswxxx
33 # define _WCTYPE_H 1
35 /* We try to get wint_t from <stddef.h>, but not all GCC versions define it
36 there. So define it ourselves if it remains undefined. */
37 # define __need_wint_t
38 # include <stddef.h>
39 # ifndef _WINT_T
40 /* Integral type unchanged by default argument promotions that can
41 hold any value corresponding to members of the extended character
42 set, as well as at least one value that does not correspond to any
43 member of the extended character set. */
44 # define _WINT_T
45 typedef unsigned int wint_t;
46 # else
47 # ifdef __USE_ISOC99
48 __USING_NAMESPACE_C99(wint_t)
49 # endif
50 # endif
52 /* Constant expression of type `wint_t' whose value does not correspond
53 to any member of the extended character set. */
54 # ifndef WEOF
55 # define WEOF (0xffffffffu)
56 # endif
57 #endif
58 #undef __need_iswxxx
61 /* The following part is also used in the <wcsmbs.h> header when compiled
62 in the Unix98 compatibility mode. */
63 #ifndef __iswxxx_defined
64 # define __iswxxx_defined 1
66 __BEGIN_NAMESPACE_C99
67 /* Scalar type that can hold values which represent locale-specific
68 character classifications. */
69 /* uClibc note: glibc uses - typedef unsigned long int wctype_t; */
70 typedef unsigned int wctype_t;
71 __END_NAMESPACE_C99
73 # ifndef _ISwbit
74 # define _ISwbit(bit) (1 << (bit))
76 enum
78 __ISwupper = 0, /* UPPERCASE. */
79 __ISwlower = 1, /* lowercase. */
80 __ISwalpha = 2, /* Alphabetic. */
81 __ISwdigit = 3, /* Numeric. */
82 __ISwxdigit = 4, /* Hexadecimal numeric. */
83 __ISwspace = 5, /* Whitespace. */
84 __ISwprint = 6, /* Printing. */
85 __ISwgraph = 7, /* Graphical. */
86 __ISwblank = 8, /* Blank (usually SPC and TAB). */
87 __ISwcntrl = 9, /* Control character. */
88 __ISwpunct = 10, /* Punctuation. */
89 __ISwalnum = 11, /* Alphanumeric. */
91 _ISwupper = _ISwbit (__ISwupper), /* UPPERCASE. */
92 _ISwlower = _ISwbit (__ISwlower), /* lowercase. */
93 _ISwalpha = _ISwbit (__ISwalpha), /* Alphabetic. */
94 _ISwdigit = _ISwbit (__ISwdigit), /* Numeric. */
95 _ISwxdigit = _ISwbit (__ISwxdigit), /* Hexadecimal numeric. */
96 _ISwspace = _ISwbit (__ISwspace), /* Whitespace. */
97 _ISwprint = _ISwbit (__ISwprint), /* Printing. */
98 _ISwgraph = _ISwbit (__ISwgraph), /* Graphical. */
99 _ISwblank = _ISwbit (__ISwblank), /* Blank (usually SPC and TAB). */
100 _ISwcntrl = _ISwbit (__ISwcntrl), /* Control character. */
101 _ISwpunct = _ISwbit (__ISwpunct), /* Punctuation. */
102 _ISwalnum = _ISwbit (__ISwalnum) /* Alphanumeric. */
104 # endif /* Not _ISwbit */
107 __BEGIN_DECLS
109 __BEGIN_NAMESPACE_C99
111 * Wide-character classification functions: 7.15.2.1.
114 /* Test for any wide character for which `iswalpha' or `iswdigit' is
115 true. */
116 extern int iswalnum (wint_t __wc) __THROW;
117 libc_hidden_proto(iswalnum)
119 /* Test for any wide character for which `iswupper' or 'iswlower' is
120 true, or any wide character that is one of a locale-specific set of
121 wide-characters for which none of `iswcntrl', `iswdigit',
122 `iswpunct', or `iswspace' is true. */
123 extern int iswalpha (wint_t __wc) __THROW;
125 /* Test for any control wide character. */
126 extern int iswcntrl (wint_t __wc) __THROW;
128 /* Test for any wide character that corresponds to a decimal-digit
129 character. */
130 extern int iswdigit (wint_t __wc) __THROW;
132 /* Test for any wide character for which `iswprint' is true and
133 `iswspace' is false. */
134 extern int iswgraph (wint_t __wc) __THROW;
136 /* Test for any wide character that corresponds to a lowercase letter
137 or is one of a locale-specific set of wide characters for which
138 none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */
139 extern int iswlower (wint_t __wc) __THROW;
140 libc_hidden_proto(iswlower)
142 /* Test for any printing wide character. */
143 extern int iswprint (wint_t __wc) __THROW;
145 /* Test for any printing wide character that is one of a
146 locale-specific et of wide characters for which neither `iswspace'
147 nor `iswalnum' is true. */
148 extern int iswpunct (wint_t __wc) __THROW;
150 /* Test for any wide character that corresponds to a locale-specific
151 set of wide characters for which none of `iswalnum', `iswgraph', or
152 `iswpunct' is true. */
153 extern int iswspace (wint_t __wc) __THROW;
154 libc_hidden_proto(iswspace)
156 /* Test for any wide character that corresponds to an uppercase letter
157 or is one of a locale-specific set of wide character for which none
158 of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */
159 extern int iswupper (wint_t __wc) __THROW;
160 libc_hidden_proto(iswupper)
162 /* Test for any wide character that corresponds to a hexadecimal-digit
163 character equivalent to that performed be the functions described
164 in the previous subclause. */
165 extern int iswxdigit (wint_t __wc) __THROW;
167 /* Test for any wide character that corresponds to a standard blank
168 wide character or a locale-specific set of wide characters for
169 which `iswalnum' is false. */
170 # ifdef __USE_ISOC99
171 extern int iswblank (wint_t __wc) __THROW;
172 # endif
175 * Extensible wide-character classification functions: 7.15.2.2.
178 /* Construct value that describes a class of wide characters identified
179 by the string argument PROPERTY. */
180 extern wctype_t wctype (const char *__property) __THROW;
181 libc_hidden_proto(wctype)
183 /* Determine whether the wide-character WC has the property described by
184 DESC. */
185 extern int iswctype (wint_t __wc, wctype_t __desc) __THROW;
186 libc_hidden_proto(iswctype)
187 __END_NAMESPACE_C99
191 * Wide-character case-mapping functions: 7.15.3.1.
194 __BEGIN_NAMESPACE_C99
195 /* Scalar type that can hold values which represent locale-specific
196 character mappings. */
197 /* uClibc note: glibc uses - typedef const __int32_t *wctrans_t; */
198 typedef unsigned int wctrans_t;
199 __END_NAMESPACE_C99
200 #ifdef __USE_GNU
201 __USING_NAMESPACE_C99(wctrans_t)
202 #endif
204 __BEGIN_NAMESPACE_C99
205 /* Converts an uppercase letter to the corresponding lowercase letter. */
206 extern wint_t towlower (wint_t __wc) __THROW;
207 libc_hidden_proto(towlower)
209 /* Converts an lowercase letter to the corresponding uppercase letter. */
210 extern wint_t towupper (wint_t __wc) __THROW;
211 libc_hidden_proto(towupper)
212 __END_NAMESPACE_C99
214 __END_DECLS
216 #endif /* need iswxxx. */
219 /* The remaining definitions and declarations must not appear in the
220 <wcsmbs.h> header. */
221 #ifdef _WCTYPE_H
224 * Extensible wide-character mapping functions: 7.15.3.2.
227 __BEGIN_DECLS
229 __BEGIN_NAMESPACE_C99
230 /* Construct value that describes a mapping between wide characters
231 identified by the string argument PROPERTY. */
232 extern wctrans_t wctrans (const char *__property) __THROW;
233 libc_hidden_proto(wctrans)
235 /* Map the wide character WC using the mapping described by DESC. */
236 extern wint_t towctrans (wint_t __wc, wctrans_t __desc) __THROW;
237 libc_hidden_proto(towctrans)
238 __END_NAMESPACE_C99
240 #if defined(__USE_GNU) && defined(__UCLIBC_HAS_XLOCALE__)
241 /* Declare the interface to extended locale model. */
242 # include <xlocale.h>
244 /* Test for any wide character for which `iswalpha' or `iswdigit' is
245 true. */
246 extern int iswalnum_l (wint_t __wc, __locale_t __locale) __THROW;
248 /* Test for any wide character for which `iswupper' or 'iswlower' is
249 true, or any wide character that is one of a locale-specific set of
250 wide-characters for which none of `iswcntrl', `iswdigit',
251 `iswpunct', or `iswspace' is true. */
252 extern int iswalpha_l (wint_t __wc, __locale_t __locale) __THROW;
254 /* Test for any control wide character. */
255 extern int iswcntrl_l (wint_t __wc, __locale_t __locale) __THROW;
257 /* Test for any wide character that corresponds to a decimal-digit
258 character. */
259 extern int iswdigit_l (wint_t __wc, __locale_t __locale) __THROW;
261 /* Test for any wide character for which `iswprint' is true and
262 `iswspace' is false. */
263 extern int iswgraph_l (wint_t __wc, __locale_t __locale) __THROW;
265 /* Test for any wide character that corresponds to a lowercase letter
266 or is one of a locale-specific set of wide characters for which
267 none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */
268 extern int iswlower_l (wint_t __wc, __locale_t __locale) __THROW;
270 /* Test for any printing wide character. */
271 extern int iswprint_l (wint_t __wc, __locale_t __locale) __THROW;
273 /* Test for any printing wide character that is one of a
274 locale-specific et of wide characters for which neither `iswspace'
275 nor `iswalnum' is true. */
276 extern int iswpunct_l (wint_t __wc, __locale_t __locale) __THROW;
278 /* Test for any wide character that corresponds to a locale-specific
279 set of wide characters for which none of `iswalnum', `iswgraph', or
280 `iswpunct' is true. */
281 extern int iswspace_l (wint_t __wc, __locale_t __locale) __THROW;
282 libc_hidden_proto(iswspace_l)
284 /* Test for any wide character that corresponds to an uppercase letter
285 or is one of a locale-specific set of wide character for which none
286 of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */
287 extern int iswupper_l (wint_t __wc, __locale_t __locale) __THROW;
289 /* Test for any wide character that corresponds to a hexadecimal-digit
290 character equivalent to that performed be the functions described
291 in the previous subclause. */
292 extern int iswxdigit_l (wint_t __wc, __locale_t __locale) __THROW;
294 /* Test for any wide character that corresponds to a standard blank
295 wide character or a locale-specific set of wide characters for
296 which `iswalnum' is false. */
297 extern int iswblank_l (wint_t __wc, __locale_t __locale) __THROW;
299 /* Construct value that describes a class of wide characters identified
300 by the string argument PROPERTY. */
301 extern wctype_t wctype_l (const char *__property, __locale_t __locale)
302 __THROW;
304 /* Determine whether the wide-character WC has the property described by
305 DESC. */
306 extern int iswctype_l (wint_t __wc, wctype_t __desc, __locale_t __locale)
307 __THROW;
308 libc_hidden_proto(iswctype_l)
312 * Wide-character case-mapping functions.
315 /* Converts an uppercase letter to the corresponding lowercase letter. */
316 extern wint_t towlower_l (wint_t __wc, __locale_t __locale) __THROW;
317 libc_hidden_proto(towlower_l)
319 /* Converts an lowercase letter to the corresponding uppercase letter. */
320 extern wint_t towupper_l (wint_t __wc, __locale_t __locale) __THROW;
321 libc_hidden_proto(towupper_l)
323 /* Construct value that describes a mapping between wide characters
324 identified by the string argument PROPERTY. */
325 extern wctrans_t wctrans_l (const char *__property, __locale_t __locale)
326 __THROW;
328 /* Map the wide character WC using the mapping described by DESC. */
329 extern wint_t towctrans_l (wint_t __wc, wctrans_t __desc,
330 __locale_t __locale) __THROW;
331 libc_hidden_proto(towctrans_l)
333 # endif /* Use GNU. */
335 __END_DECLS
337 #endif /* __WCTYPE_H defined. */
339 #endif /* wctype.h */