OSDN Git Service

The 'Somebody Else's Problem Field' was just activated
[uclinux-h8/uclibc-ng.git] / include / wctype.h
1 /* Copyright (C) 1996,97,98,99,2000,01,02 Free Software Foundation, Inc.
2    This file is part of the GNU C Library.
3
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.
8
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.
13
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
17    02111-1307 USA.  */
18
19 /*
20  *      ISO C99 Standard: 7.25
21  *      Wide character classification and mapping utilities  <wctype.h>
22  */
23
24 #ifndef _WCTYPE_H
25
26 #include <features.h>
27 #include <bits/types.h>
28
29 #ifndef __UCLIBC_HAS_WCHAR__
30 #error Attempted to include wctype.h when uClibc built without wide char support.
31 #endif
32
33 #ifndef __need_iswxxx
34 # define _WCTYPE_H      1
35
36 /* We try to get wint_t from <stddef.h>, but not all GCC versions define it
37    there.  So define it ourselves if it remains undefined.  */
38 # define __need_wint_t
39 # include <stddef.h>
40 # ifndef _WINT_T
41 /* Integral type unchanged by default argument promotions that can
42    hold any value corresponding to members of the extended character
43    set, as well as at least one value that does not correspond to any
44    member of the extended character set.  */
45 #  define _WINT_T
46 typedef unsigned int wint_t;
47 # else
48 #  ifdef __USE_ISOC99
49 __USING_NAMESPACE_C99(wint_t)
50 #  endif
51 __END_NAMESPACE_C99
52 # endif
53
54 /* Constant expression of type `wint_t' whose value does not correspond
55    to any member of the extended character set.  */
56 # ifndef WEOF
57 #  define WEOF (0xffffffffu)
58 # endif
59 #endif
60 #undef __need_iswxxx
61
62
63 /* The following part is also used in the <wcsmbs.h> header when compiled
64    in the Unix98 compatibility mode.  */
65 #ifndef __iswxxx_defined
66 # define __iswxxx_defined       1
67
68 __BEGIN_NAMESPACE_C99
69 /* Scalar type that can hold values which represent locale-specific
70    character classifications.  */
71 /* uClibc note: glibc uses - typedef unsigned long int wctype_t; */
72 typedef unsigned int wctype_t;
73 __END_NAMESPACE_C99
74
75 # ifndef _ISwbit
76 #  define _ISwbit(bit)  (1 << (bit))
77
78 enum
79 {
80   __ISwupper = 0,                       /* UPPERCASE.  */
81   __ISwlower = 1,                       /* lowercase.  */
82   __ISwalpha = 2,                       /* Alphabetic.  */
83   __ISwdigit = 3,                       /* Numeric.  */
84   __ISwxdigit = 4,                      /* Hexadecimal numeric.  */
85   __ISwspace = 5,                       /* Whitespace.  */
86   __ISwprint = 6,                       /* Printing.  */
87   __ISwgraph = 7,                       /* Graphical.  */
88   __ISwblank = 8,                       /* Blank (usually SPC and TAB).  */
89   __ISwcntrl = 9,                       /* Control character.  */
90   __ISwpunct = 10,                      /* Punctuation.  */
91   __ISwalnum = 11,                      /* Alphanumeric.  */
92
93   _ISwupper = _ISwbit (__ISwupper),     /* UPPERCASE.  */
94   _ISwlower = _ISwbit (__ISwlower),     /* lowercase.  */
95   _ISwalpha = _ISwbit (__ISwalpha),     /* Alphabetic.  */
96   _ISwdigit = _ISwbit (__ISwdigit),     /* Numeric.  */
97   _ISwxdigit = _ISwbit (__ISwxdigit),   /* Hexadecimal numeric.  */
98   _ISwspace = _ISwbit (__ISwspace),     /* Whitespace.  */
99   _ISwprint = _ISwbit (__ISwprint),     /* Printing.  */
100   _ISwgraph = _ISwbit (__ISwgraph),     /* Graphical.  */
101   _ISwblank = _ISwbit (__ISwblank),     /* Blank (usually SPC and TAB).  */
102   _ISwcntrl = _ISwbit (__ISwcntrl),     /* Control character.  */
103   _ISwpunct = _ISwbit (__ISwpunct),     /* Punctuation.  */
104   _ISwalnum = _ISwbit (__ISwalnum)      /* Alphanumeric.  */
105 };
106 # else
107 #  if defined(__UCLIBC_MJN3_ONLY__) && defined(L_iswctype)
108 #warning remove _ISwbit already defined check?
109 #error _ISwbit already defined!
110 #  endif
111 # endif /* Not _ISwbit  */
112
113
114 __BEGIN_DECLS
115
116 __BEGIN_NAMESPACE_C99
117 /*
118  * Wide-character classification functions: 7.15.2.1.
119  */
120
121 /* Test for any wide character for which `iswalpha' or `iswdigit' is
122    true.  */
123 extern int iswalnum (wint_t __wc) __THROW;
124
125 /* Test for any wide character for which `iswupper' or 'iswlower' is
126    true, or any wide character that is one of a locale-specific set of
127    wide-characters for which none of `iswcntrl', `iswdigit',
128    `iswpunct', or `iswspace' is true.  */
129 extern int iswalpha (wint_t __wc) __THROW;
130
131 /* Test for any control wide character.  */
132 extern int iswcntrl (wint_t __wc) __THROW;
133
134 /* Test for any wide character that corresponds to a decimal-digit
135    character.  */
136 extern int iswdigit (wint_t __wc) __THROW;
137
138 /* Test for any wide character for which `iswprint' is true and
139    `iswspace' is false.  */
140 extern int iswgraph (wint_t __wc) __THROW;
141
142 /* Test for any wide character that corresponds to a lowercase letter
143    or is one of a locale-specific set of wide characters for which
144    none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true.  */
145 extern int iswlower (wint_t __wc) __THROW;
146
147 /* Test for any printing wide character.  */
148 extern int iswprint (wint_t __wc) __THROW;
149
150 /* Test for any printing wide character that is one of a
151    locale-specific et of wide characters for which neither `iswspace'
152    nor `iswalnum' is true.  */
153 extern int iswpunct (wint_t __wc) __THROW;
154
155 /* Test for any wide character that corresponds to a locale-specific
156    set of wide characters for which none of `iswalnum', `iswgraph', or
157    `iswpunct' is true.  */
158 extern int iswspace (wint_t __wc) __THROW;
159
160 /* Test for any wide character that corresponds to an uppercase letter
161    or is one of a locale-specific set of wide character for which none
162    of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true.  */
163 extern int iswupper (wint_t __wc) __THROW;
164
165 /* Test for any wide character that corresponds to a hexadecimal-digit
166    character equivalent to that performed be the functions described
167    in the previous subclause.  */
168 extern int iswxdigit (wint_t __wc) __THROW;
169
170 /* Test for any wide character that corresponds to a standard blank
171    wide character or a locale-specific set of wide characters for
172    which `iswalnum' is false.  */
173 # ifdef __USE_ISOC99
174 extern int iswblank (wint_t __wc) __THROW;
175 # endif
176
177 /*
178  * Extensible wide-character classification functions: 7.15.2.2.
179  */
180
181 /* Construct value that describes a class of wide characters identified
182    by the string argument PROPERTY.  */
183 extern wctype_t wctype (__const char *__property) __THROW;
184
185 /* Determine whether the wide-character WC has the property described by
186    DESC.  */
187 extern int iswctype (wint_t __wc, wctype_t __desc) __THROW;
188 __END_NAMESPACE_C99
189
190
191 /*
192  * Wide-character case-mapping functions: 7.15.3.1.
193  */
194
195 __BEGIN_NAMESPACE_C99
196 /* Scalar type that can hold values which represent locale-specific
197    character mappings.  */
198 /* uClibc note: glibc uses - typedef __const __int32_t *wctrans_t; */
199 typedef unsigned int wctrans_t;
200 __END_NAMESPACE_C99
201 #ifdef __USE_GNU
202 __USING_NAMESPACE_C99(wctrans_t)
203 #endif
204
205 __BEGIN_NAMESPACE_C99
206 /* Converts an uppercase letter to the corresponding lowercase letter.  */
207 extern wint_t towlower (wint_t __wc) __THROW;
208
209 /* Converts an lowercase letter to the corresponding uppercase letter.  */
210 extern wint_t towupper (wint_t __wc) __THROW;
211 __END_NAMESPACE_C99
212
213 __END_DECLS
214
215 #endif  /* need iswxxx.  */
216
217
218 /* The remaining definitions and declarations must not appear in the
219    <wcsmbs.h> header.  */
220 #ifdef _WCTYPE_H
221
222 /*
223  * Extensible wide-character mapping functions: 7.15.3.2.
224  */
225
226 __BEGIN_DECLS
227
228 __BEGIN_NAMESPACE_C99
229 /* Construct value that describes a mapping between wide characters
230    identified by the string argument PROPERTY.  */
231 extern wctrans_t wctrans (__const char *__property) __THROW;
232
233 /* Map the wide character WC using the mapping described by DESC.  */
234 extern wint_t towctrans (wint_t __wc, wctrans_t __desc) __THROW;
235 __END_NAMESPACE_C99
236
237 #if defined(__USE_GNU) && defined(__UCLIBC_HAS_XLOCALE__)
238 /* Declare the interface to extended locale model.  */
239 #  include <xlocale.h>
240
241 /* Test for any wide character for which `iswalpha' or `iswdigit' is
242    true.  */
243 extern int iswalnum_l (wint_t __wc, __locale_t __locale) __THROW;
244
245 /* Test for any wide character for which `iswupper' or 'iswlower' is
246    true, or any wide character that is one of a locale-specific set of
247    wide-characters for which none of `iswcntrl', `iswdigit',
248    `iswpunct', or `iswspace' is true.  */
249 extern int iswalpha_l (wint_t __wc, __locale_t __locale) __THROW;
250
251 /* Test for any control wide character.  */
252 extern int iswcntrl_l (wint_t __wc, __locale_t __locale) __THROW;
253
254 /* Test for any wide character that corresponds to a decimal-digit
255    character.  */
256 extern int iswdigit_l (wint_t __wc, __locale_t __locale) __THROW;
257
258 /* Test for any wide character for which `iswprint' is true and
259    `iswspace' is false.  */
260 extern int iswgraph_l (wint_t __wc, __locale_t __locale) __THROW;
261
262 /* Test for any wide character that corresponds to a lowercase letter
263    or is one of a locale-specific set of wide characters for which
264    none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true.  */
265 extern int iswlower_l (wint_t __wc, __locale_t __locale) __THROW;
266
267 /* Test for any printing wide character.  */
268 extern int iswprint_l (wint_t __wc, __locale_t __locale) __THROW;
269
270 /* Test for any printing wide character that is one of a
271    locale-specific et of wide characters for which neither `iswspace'
272    nor `iswalnum' is true.  */
273 extern int iswpunct_l (wint_t __wc, __locale_t __locale) __THROW;
274
275 /* Test for any wide character that corresponds to a locale-specific
276    set of wide characters for which none of `iswalnum', `iswgraph', or
277    `iswpunct' is true.  */
278 extern int iswspace_l (wint_t __wc, __locale_t __locale) __THROW;
279
280 /* Test for any wide character that corresponds to an uppercase letter
281    or is one of a locale-specific set of wide character for which none
282    of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true.  */
283 extern int iswupper_l (wint_t __wc, __locale_t __locale) __THROW;
284
285 /* Test for any wide character that corresponds to a hexadecimal-digit
286    character equivalent to that performed be the functions described
287    in the previous subclause.  */
288 extern int iswxdigit_l (wint_t __wc, __locale_t __locale) __THROW;
289
290 /* Test for any wide character that corresponds to a standard blank
291    wide character or a locale-specific set of wide characters for
292    which `iswalnum' is false.  */
293 extern int iswblank_l (wint_t __wc, __locale_t __locale) __THROW;
294
295 /* Construct value that describes a class of wide characters identified
296    by the string argument PROPERTY.  */
297 extern wctype_t wctype_l (__const char *__property, __locale_t __locale)
298      __THROW;
299
300 /* Determine whether the wide-character WC has the property described by
301    DESC.  */
302 extern int iswctype_l (wint_t __wc, wctype_t __desc, __locale_t __locale)
303      __THROW;
304
305
306 /*
307  * Wide-character case-mapping functions.
308  */
309
310 /* Converts an uppercase letter to the corresponding lowercase letter.  */
311 extern wint_t towlower_l (wint_t __wc, __locale_t __locale) __THROW;
312
313 /* Converts an lowercase letter to the corresponding uppercase letter.  */
314 extern wint_t towupper_l (wint_t __wc, __locale_t __locale) __THROW;
315
316 /* Construct value that describes a mapping between wide characters
317    identified by the string argument PROPERTY.  */
318 extern wctrans_t wctrans_l (__const char *__property, __locale_t __locale)
319      __THROW;
320
321 /* Map the wide character WC using the mapping described by DESC.  */
322 extern wint_t towctrans_l (wint_t __wc, wctrans_t __desc,
323                            __locale_t __locale) __THROW;
324
325 extern int __iswalnum_l(wint_t __wc, __locale_t __locale) __THROW;
326 extern int __iswalpha_l(wint_t __wc, __locale_t __locale) __THROW;
327 extern int __iswblank_l(wint_t __wc, __locale_t __locale) __THROW;
328 extern int __iswcntrl_l(wint_t __wc, __locale_t __locale) __THROW;
329 extern int __iswdigit_l(wint_t __wc, __locale_t __locale) __THROW;
330 extern int __iswgraph_l(wint_t __wc, __locale_t __locale) __THROW;
331 extern int __iswlower_l(wint_t __wc, __locale_t __locale) __THROW;
332 extern int __iswprint_l(wint_t __wc, __locale_t __locale) __THROW;
333 extern int __iswpunct_l(wint_t __wc, __locale_t __locale) __THROW;
334 extern int __iswspace_l(wint_t __wc, __locale_t __locale) __THROW;
335 extern int __iswupper_l(wint_t __wc, __locale_t __locale) __THROW;
336 extern int __iswxdigit_l(wint_t __wc, __locale_t __locale) __THROW;
337 extern wint_t __towlower_l(wint_t __wc, __locale_t __locale) __THROW;
338 extern wint_t __towupper_l(wint_t __wc, __locale_t __locale) __THROW;
339 extern int __iswctype_l(wint_t __wc, wctype_t __desc, __locale_t __locale) __THROW;
340 extern wctrans_t __wctrans_l(const char *__property, __locale_t __locale) __THROW;
341 extern wint_t __towctrans_l(wint_t __wc, wctrans_t __desc, __locale_t __locale) __THROW;
342 # endif /* Use GNU.  */
343
344 __END_DECLS
345
346 #endif  /* __WCTYPE_H defined.  */
347
348 #endif /* wctype.h  */