1 /* Copyright (C) 1996,1997,1998,1999,2000,2001 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, write to the Free
16 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20 * ISO C99 Standard: 7.25
21 * Wide character classification and mapping utilities <wctype.h>
27 #include <bits/types.h>
29 #ifndef __UCLIBC_HAS_WCHAR__
30 #error Attempted to include wchar.h when uClibc built without wide char support.
36 #include <bits/uClibc_ctype.h>
38 /* We try to get wint_t from <stddef.h>, but not all GCC versions define it
39 there. So define it ourselves if it remains undefined. */
40 # define __need_wint_t
43 /* Integral type unchanged by default argument promotions that can
44 hold any value corresponding to members of the extended character
45 set, as well as at least one value that does not correspond to any
46 member of the extended character set. */
48 typedef unsigned int wint_t;
51 /* Constant expression of type `wint_t' whose value does not correspond
52 to any member of the extended character set. */
54 # define WEOF (0xffffffffu)
60 /* The following part is also used in the <wcsmbs.h> header when compiled
61 in the Unix98 compatibility mode. */
62 #ifndef __iswxxx_defined
63 # define __iswxxx_defined 1
65 /* Scalar type that can hold values which represent locale-specific
66 character classifications. */
67 /* uClibc note: glibc uses an unsigned long int. */
68 typedef unsigned int wctype_t;
74 * Wide-character classification functions: 7.15.2.1.
77 /* Test for any wide character for which `iswalpha' or `iswdigit' is
79 extern int iswalnum (wint_t __wc) __THROW;
81 /* Test for any wide character for which `iswupper' or 'iswlower' is
82 true, or any wide character that is one of a locale-specific set of
83 wide-characters for which none of `iswcntrl', `iswdigit',
84 `iswpunct', or `iswspace' is true. */
85 extern int iswalpha (wint_t __wc) __THROW;
87 /* Test for any control wide character. */
88 extern int iswcntrl (wint_t __wc) __THROW;
90 /* Test for any wide character that corresponds to a decimal-digit
92 extern int iswdigit (wint_t __wc) __THROW;
94 /* Test for any wide character for which `iswprint' is true and
95 `iswspace' is false. */
96 extern int iswgraph (wint_t __wc) __THROW;
98 /* Test for any wide character that corresponds to a lowercase letter
99 or is one of a locale-specific set of wide characters for which
100 none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */
101 extern int iswlower (wint_t __wc) __THROW;
103 /* Test for any printing wide character. */
104 extern int iswprint (wint_t __wc) __THROW;
106 /* Test for any printing wide character that is one of a
107 locale-specific et of wide characters for which neither `iswspace'
108 nor `iswalnum' is true. */
109 extern int iswpunct (wint_t __wc) __THROW;
111 /* Test for any wide character that corresponds to a locale-specific
112 set of wide characters for which none of `iswalnum', `iswgraph', or
113 `iswpunct' is true. */
114 extern int iswspace (wint_t __wc) __THROW;
116 /* Test for any wide character that corresponds to an uppercase letter
117 or is one of a locale-specific set of wide character for which none
118 of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */
119 extern int iswupper (wint_t __wc) __THROW;
121 /* Test for any wide character that corresponds to a hexadecimal-digit
122 character equivalent to that performed be the functions described
123 in the previous subclause. */
124 extern int iswxdigit (wint_t __wc) __THROW;
126 /* Test for any wide character that corresponds to a standard blank
127 wide character or a locale-specific set of wide characters for
128 which `iswalnum' is false. */
130 extern int iswblank (wint_t __wc) __THROW;
134 * Extensible wide-character classification functions: 7.15.2.2.
137 /* Construct value that describes a class of wide characters identified
138 by the string argument PROPERTY. */
139 extern wctype_t wctype (__const char *__property) __THROW;
141 /* Determine whether the wide-character WC has the property described by
143 extern int iswctype (wint_t __wc, wctype_t __desc) __THROW;
146 * Wide-character case-mapping functions: 7.15.3.1.
149 /* Scalar type that can hold values which represent locale-specific
150 character mappings. */
151 /* typedef __const __int32_t *wctrans_t; */
152 typedef unsigned int wctrans_t; /* TODO: fix this */
154 /* Converts an uppercase letter to the corresponding lowercase letter. */
155 extern wint_t towlower (wint_t __wc) __THROW;
157 /* Converts an lowercase letter to the corresponding uppercase letter. */
158 extern wint_t towupper (wint_t __wc) __THROW;
162 #endif /* need iswxxx. */
165 /* The remaining definitions and declarations must not appear in the
166 <wcsmbs.h> header. */
170 * Extensible wide-character mapping functions: 7.15.3.2.
175 /* Construct value that describes a mapping between wide characters
176 identified by the string argument PROPERTY. */
177 extern wctrans_t wctrans (__const char *__property) __THROW;
179 /* Map the wide character WC using the mapping described by DESC. */
180 extern wint_t towctrans (wint_t __wc, wctrans_t __desc) __THROW;
183 /* # ifdef __USE_GNU */
184 /* Declare the interface to extended locale model. */
185 # include <xlocale.h>
187 /* Test for any wide character for which `iswalpha' or `iswdigit' is
189 extern int __iswalnum_l (wint_t __wc, __locale_t __locale) __THROW;
191 /* Test for any wide character for which `iswupper' or 'iswlower' is
192 true, or any wide character that is one of a locale-specific set of
193 wide-characters for which none of `iswcntrl', `iswdigit',
194 `iswpunct', or `iswspace' is true. */
195 extern int __iswalpha_l (wint_t __wc, __locale_t __locale) __THROW;
197 /* Test for any control wide character. */
198 extern int __iswcntrl_l (wint_t __wc, __locale_t __locale) __THROW;
200 /* Test for any wide character that corresponds to a decimal-digit
202 extern int __iswdigit_l (wint_t __wc, __locale_t __locale) __THROW;
204 /* Test for any wide character for which `iswprint' is true and
205 `iswspace' is false. */
206 extern int __iswgraph_l (wint_t __wc, __locale_t __locale) __THROW;
208 /* Test for any wide character that corresponds to a lowercase letter
209 or is one of a locale-specific set of wide characters for which
210 none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */
211 extern int __iswlower_l (wint_t __wc, __locale_t __locale) __THROW;
213 /* Test for any printing wide character. */
214 extern int __iswprint_l (wint_t __wc, __locale_t __locale) __THROW;
216 /* Test for any printing wide character that is one of a
217 locale-specific et of wide characters for which neither `iswspace'
218 nor `iswalnum' is true. */
219 extern int __iswpunct_l (wint_t __wc, __locale_t __locale) __THROW;
221 /* Test for any wide character that corresponds to a locale-specific
222 set of wide characters for which none of `iswalnum', `iswgraph', or
223 `iswpunct' is true. */
224 extern int __iswspace_l (wint_t __wc, __locale_t __locale) __THROW;
226 /* Test for any wide character that corresponds to an uppercase letter
227 or is one of a locale-specific set of wide character for which none
228 of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */
229 extern int __iswupper_l (wint_t __wc, __locale_t __locale) __THROW;
231 /* Test for any wide character that corresponds to a hexadecimal-digit
232 character equivalent to that performed be the functions described
233 in the previous subclause. */
234 extern int __iswxdigit_l (wint_t __wc, __locale_t __locale) __THROW;
236 /* Test for any wide character that corresponds to a standard blank
237 wide character or a locale-specific set of wide characters for
238 which `iswalnum' is false. */
239 extern int __iswblank_l (wint_t __wc, __locale_t __locale) __THROW;
241 /* Construct value that describes a class of wide characters identified
242 by the string argument PROPERTY. */
243 extern wctype_t __wctype_l (__const char *__property, __locale_t __locale)
246 /* Determine whether the wide-character WC has the property described by
248 extern int __iswctype_l (wint_t __wc, wctype_t __desc, __locale_t __locale)
253 * Wide-character case-mapping functions.
256 /* Converts an uppercase letter to the corresponding lowercase letter. */
257 extern wint_t __towlower_l (wint_t __wc, __locale_t __locale) __THROW;
259 /* Converts an lowercase letter to the corresponding uppercase letter. */
260 extern wint_t __towupper_l (wint_t __wc, __locale_t __locale) __THROW;
262 /* Construct value that describes a mapping between wide characters
263 identified by the string argument PROPERTY. */
264 extern wctrans_t __wctrans_l (__const char *__property, __locale_t __locale)
267 /* Map the wide character WC using the mapping described by DESC. */
268 extern wint_t __towctrans_l (wint_t __wc, wctrans_t __desc,
269 __locale_t __locale) __THROW;
271 # endif /* Use GNU. */
275 #endif /* __WCTYPE_H defined. */
277 #endif /* wctype.h */