OSDN Git Service

The obligatory forgotten files...
[uclinux-h8/uClibc.git] / include / wctype.h
1 /* Copyright (C) 1996,1997,1998,1999,2000,2001 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 wchar.h when uClibc built without wide char support.
31 #endif
32
33 #ifndef __need_iswxxx
34 # define _WCTYPE_H      1
35
36 #include <bits/uClibc_ctype.h>
37
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
41 # include <stddef.h>
42 # ifndef _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.  */
47 #  define _WINT_T
48 typedef unsigned int wint_t;
49 # endif
50
51 /* Constant expression of type `wint_t' whose value does not correspond
52    to any member of the extended character set.  */
53 # ifndef WEOF
54 #  define WEOF (0xffffffffu)
55 # endif
56 #endif
57 #undef __need_iswxxx
58
59
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
64
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;
69
70
71 __BEGIN_DECLS
72
73 /*
74  * Wide-character classification functions: 7.15.2.1.
75  */
76
77 /* Test for any wide character for which `iswalpha' or `iswdigit' is
78    true.  */
79 extern int iswalnum (wint_t __wc) __THROW;
80
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;
86
87 /* Test for any control wide character.  */
88 extern int iswcntrl (wint_t __wc) __THROW;
89
90 /* Test for any wide character that corresponds to a decimal-digit
91    character.  */
92 extern int iswdigit (wint_t __wc) __THROW;
93
94 /* Test for any wide character for which `iswprint' is true and
95    `iswspace' is false.  */
96 extern int iswgraph (wint_t __wc) __THROW;
97
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;
102
103 /* Test for any printing wide character.  */
104 extern int iswprint (wint_t __wc) __THROW;
105
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;
110
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;
115
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;
120
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;
125
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.  */
129 # ifdef __USE_ISOC99
130 extern int iswblank (wint_t __wc) __THROW;
131 # endif
132
133 /*
134  * Extensible wide-character classification functions: 7.15.2.2.
135  */
136
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;
140
141 /* Determine whether the wide-character WC has the property described by
142    DESC.  */
143 extern int iswctype (wint_t __wc, wctype_t __desc) __THROW;
144
145 /*
146  * Wide-character case-mapping functions: 7.15.3.1.
147  */
148
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 */
153
154 /* Converts an uppercase letter to the corresponding lowercase letter.  */
155 extern wint_t towlower (wint_t __wc) __THROW;
156
157 /* Converts an lowercase letter to the corresponding uppercase letter.  */
158 extern wint_t towupper (wint_t __wc) __THROW;
159
160 __END_DECLS
161
162 #endif  /* need iswxxx.  */
163
164
165 /* The remaining definitions and declarations must not appear in the
166    <wcsmbs.h> header.  */
167 #ifdef _WCTYPE_H
168
169 /*
170  * Extensible wide-character mapping functions: 7.15.3.2.
171  */
172
173 __BEGIN_DECLS
174
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;
178
179 /* Map the wide character WC using the mapping described by DESC.  */
180 extern wint_t towctrans (wint_t __wc, wctrans_t __desc) __THROW;
181
182 #if 0
183 /*  # ifdef __USE_GNU */
184 /* Declare the interface to extended locale model.  */
185 #  include <xlocale.h>
186
187 /* Test for any wide character for which `iswalpha' or `iswdigit' is
188    true.  */
189 extern int __iswalnum_l (wint_t __wc, __locale_t __locale) __THROW;
190
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;
196
197 /* Test for any control wide character.  */
198 extern int __iswcntrl_l (wint_t __wc, __locale_t __locale) __THROW;
199
200 /* Test for any wide character that corresponds to a decimal-digit
201    character.  */
202 extern int __iswdigit_l (wint_t __wc, __locale_t __locale) __THROW;
203
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;
207
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;
212
213 /* Test for any printing wide character.  */
214 extern int __iswprint_l (wint_t __wc, __locale_t __locale) __THROW;
215
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;
220
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;
225
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;
230
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;
235
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;
240
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)
244      __THROW;
245
246 /* Determine whether the wide-character WC has the property described by
247    DESC.  */
248 extern int __iswctype_l (wint_t __wc, wctype_t __desc, __locale_t __locale)
249      __THROW;
250
251
252 /*
253  * Wide-character case-mapping functions.
254  */
255
256 /* Converts an uppercase letter to the corresponding lowercase letter.  */
257 extern wint_t __towlower_l (wint_t __wc, __locale_t __locale) __THROW;
258
259 /* Converts an lowercase letter to the corresponding uppercase letter.  */
260 extern wint_t __towupper_l (wint_t __wc, __locale_t __locale) __THROW;
261
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)
265      __THROW;
266
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;
270
271 # endif /* Use GNU.  */
272
273 __END_DECLS
274
275 #endif  /* __WCTYPE_H defined.  */
276
277 #endif /* wctype.h  */