conformtest: Correct signal.h expectations for XPG4 / XPG42.
[glibc.git] / wctype / wctype.h
blob73165bbda2b639415ac88be033016cae9ca69bde
1 /* Copyright (C) 1996-2017 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 /* Scalar type that can hold values which represent locale-specific
50 character classifications. */
51 typedef unsigned long int wctype_t;
53 # ifndef _ISwbit
54 /* The characteristics are stored always in network byte order (big
55 endian). We define the bit value interpretations here dependent on the
56 machine's byte order. */
58 # include <endian.h>
59 # if __BYTE_ORDER == __BIG_ENDIAN
60 # define _ISwbit(bit) (1 << (bit))
61 # else /* __BYTE_ORDER == __LITTLE_ENDIAN */
62 # define _ISwbit(bit) \
63 ((bit) < 8 ? (int) ((1UL << (bit)) << 24) \
64 : ((bit) < 16 ? (int) ((1UL << (bit)) << 8) \
65 : ((bit) < 24 ? (int) ((1UL << (bit)) >> 8) \
66 : (int) ((1UL << (bit)) >> 24))))
67 # endif
69 enum
71 __ISwupper = 0, /* UPPERCASE. */
72 __ISwlower = 1, /* lowercase. */
73 __ISwalpha = 2, /* Alphabetic. */
74 __ISwdigit = 3, /* Numeric. */
75 __ISwxdigit = 4, /* Hexadecimal numeric. */
76 __ISwspace = 5, /* Whitespace. */
77 __ISwprint = 6, /* Printing. */
78 __ISwgraph = 7, /* Graphical. */
79 __ISwblank = 8, /* Blank (usually SPC and TAB). */
80 __ISwcntrl = 9, /* Control character. */
81 __ISwpunct = 10, /* Punctuation. */
82 __ISwalnum = 11, /* Alphanumeric. */
84 _ISwupper = _ISwbit (__ISwupper), /* UPPERCASE. */
85 _ISwlower = _ISwbit (__ISwlower), /* lowercase. */
86 _ISwalpha = _ISwbit (__ISwalpha), /* Alphabetic. */
87 _ISwdigit = _ISwbit (__ISwdigit), /* Numeric. */
88 _ISwxdigit = _ISwbit (__ISwxdigit), /* Hexadecimal numeric. */
89 _ISwspace = _ISwbit (__ISwspace), /* Whitespace. */
90 _ISwprint = _ISwbit (__ISwprint), /* Printing. */
91 _ISwgraph = _ISwbit (__ISwgraph), /* Graphical. */
92 _ISwblank = _ISwbit (__ISwblank), /* Blank (usually SPC and TAB). */
93 _ISwcntrl = _ISwbit (__ISwcntrl), /* Control character. */
94 _ISwpunct = _ISwbit (__ISwpunct), /* Punctuation. */
95 _ISwalnum = _ISwbit (__ISwalnum) /* Alphanumeric. */
97 # endif /* Not _ISwbit */
100 __BEGIN_DECLS
103 * Wide-character classification functions: 7.15.2.1.
106 /* Test for any wide character for which `iswalpha' or `iswdigit' is
107 true. */
108 extern int iswalnum (wint_t __wc) __THROW;
110 /* Test for any wide character for which `iswupper' or 'iswlower' is
111 true, or any wide character that is one of a locale-specific set of
112 wide-characters for which none of `iswcntrl', `iswdigit',
113 `iswpunct', or `iswspace' is true. */
114 extern int iswalpha (wint_t __wc) __THROW;
116 /* Test for any control wide character. */
117 extern int iswcntrl (wint_t __wc) __THROW;
119 /* Test for any wide character that corresponds to a decimal-digit
120 character. */
121 extern int iswdigit (wint_t __wc) __THROW;
123 /* Test for any wide character for which `iswprint' is true and
124 `iswspace' is false. */
125 extern int iswgraph (wint_t __wc) __THROW;
127 /* Test for any wide character that corresponds to a lowercase letter
128 or is one of a locale-specific set of wide characters for which
129 none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */
130 extern int iswlower (wint_t __wc) __THROW;
132 /* Test for any printing wide character. */
133 extern int iswprint (wint_t __wc) __THROW;
135 /* Test for any printing wide character that is one of a
136 locale-specific et of wide characters for which neither `iswspace'
137 nor `iswalnum' is true. */
138 extern int iswpunct (wint_t __wc) __THROW;
140 /* Test for any wide character that corresponds to a locale-specific
141 set of wide characters for which none of `iswalnum', `iswgraph', or
142 `iswpunct' is true. */
143 extern int iswspace (wint_t __wc) __THROW;
145 /* Test for any wide character that corresponds to an uppercase letter
146 or is one of a locale-specific set of wide character for which none
147 of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */
148 extern int iswupper (wint_t __wc) __THROW;
150 /* Test for any wide character that corresponds to a hexadecimal-digit
151 character equivalent to that performed be the functions described
152 in the previous subclause. */
153 extern int iswxdigit (wint_t __wc) __THROW;
155 /* Test for any wide character that corresponds to a standard blank
156 wide character or a locale-specific set of wide characters for
157 which `iswalnum' is false. */
158 # ifdef __USE_ISOC99
159 extern int iswblank (wint_t __wc) __THROW;
160 # endif
163 * Extensible wide-character classification functions: 7.15.2.2.
166 /* Construct value that describes a class of wide characters identified
167 by the string argument PROPERTY. */
168 extern wctype_t wctype (const char *__property) __THROW;
170 /* Determine whether the wide-character WC has the property described by
171 DESC. */
172 extern int iswctype (wint_t __wc, wctype_t __desc) __THROW;
176 * Wide-character case-mapping functions: 7.15.3.1.
179 /* Scalar type that can hold values which represent locale-specific
180 character mappings. */
181 typedef const __int32_t *wctrans_t;
183 /* Converts an uppercase letter to the corresponding lowercase letter. */
184 extern wint_t towlower (wint_t __wc) __THROW;
186 /* Converts an lowercase letter to the corresponding uppercase letter. */
187 extern wint_t towupper (wint_t __wc) __THROW;
189 __END_DECLS
191 #endif /* need iswxxx. */
194 /* The remaining definitions and declarations must not appear in the
195 <wchar.h> header. */
196 #ifdef _WCTYPE_H
199 * Extensible wide-character mapping functions: 7.15.3.2.
202 __BEGIN_DECLS
204 /* Construct value that describes a mapping between wide characters
205 identified by the string argument PROPERTY. */
206 extern wctrans_t wctrans (const char *__property) __THROW;
208 /* Map the wide character WC using the mapping described by DESC. */
209 extern wint_t towctrans (wint_t __wc, wctrans_t __desc) __THROW;
211 # ifdef __USE_XOPEN2K8
212 /* Declare the interface to extended locale model. */
213 # include <xlocale.h>
215 /* Test for any wide character for which `iswalpha' or `iswdigit' is
216 true. */
217 extern int iswalnum_l (wint_t __wc, __locale_t __locale) __THROW;
219 /* Test for any wide character for which `iswupper' or 'iswlower' is
220 true, or any wide character that is one of a locale-specific set of
221 wide-characters for which none of `iswcntrl', `iswdigit',
222 `iswpunct', or `iswspace' is true. */
223 extern int iswalpha_l (wint_t __wc, __locale_t __locale) __THROW;
225 /* Test for any control wide character. */
226 extern int iswcntrl_l (wint_t __wc, __locale_t __locale) __THROW;
228 /* Test for any wide character that corresponds to a decimal-digit
229 character. */
230 extern int iswdigit_l (wint_t __wc, __locale_t __locale) __THROW;
232 /* Test for any wide character for which `iswprint' is true and
233 `iswspace' is false. */
234 extern int iswgraph_l (wint_t __wc, __locale_t __locale) __THROW;
236 /* Test for any wide character that corresponds to a lowercase letter
237 or is one of a locale-specific set of wide characters for which
238 none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */
239 extern int iswlower_l (wint_t __wc, __locale_t __locale) __THROW;
241 /* Test for any printing wide character. */
242 extern int iswprint_l (wint_t __wc, __locale_t __locale) __THROW;
244 /* Test for any printing wide character that is one of a
245 locale-specific et of wide characters for which neither `iswspace'
246 nor `iswalnum' is true. */
247 extern int iswpunct_l (wint_t __wc, __locale_t __locale) __THROW;
249 /* Test for any wide character that corresponds to a locale-specific
250 set of wide characters for which none of `iswalnum', `iswgraph', or
251 `iswpunct' is true. */
252 extern int iswspace_l (wint_t __wc, __locale_t __locale) __THROW;
254 /* Test for any wide character that corresponds to an uppercase letter
255 or is one of a locale-specific set of wide character for which none
256 of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */
257 extern int iswupper_l (wint_t __wc, __locale_t __locale) __THROW;
259 /* Test for any wide character that corresponds to a hexadecimal-digit
260 character equivalent to that performed be the functions described
261 in the previous subclause. */
262 extern int iswxdigit_l (wint_t __wc, __locale_t __locale) __THROW;
264 /* Test for any wide character that corresponds to a standard blank
265 wide character or a locale-specific set of wide characters for
266 which `iswalnum' is false. */
267 extern int iswblank_l (wint_t __wc, __locale_t __locale) __THROW;
269 /* Construct value that describes a class of wide characters identified
270 by the string argument PROPERTY. */
271 extern wctype_t wctype_l (const char *__property, __locale_t __locale)
272 __THROW;
274 /* Determine whether the wide-character WC has the property described by
275 DESC. */
276 extern int iswctype_l (wint_t __wc, wctype_t __desc, __locale_t __locale)
277 __THROW;
281 * Wide-character case-mapping functions.
284 /* Converts an uppercase letter to the corresponding lowercase letter. */
285 extern wint_t towlower_l (wint_t __wc, __locale_t __locale) __THROW;
287 /* Converts an lowercase letter to the corresponding uppercase letter. */
288 extern wint_t towupper_l (wint_t __wc, __locale_t __locale) __THROW;
290 /* Construct value that describes a mapping between wide characters
291 identified by the string argument PROPERTY. */
292 extern wctrans_t wctrans_l (const char *__property, __locale_t __locale)
293 __THROW;
295 /* Map the wide character WC using the mapping described by DESC. */
296 extern wint_t towctrans_l (wint_t __wc, wctrans_t __desc,
297 __locale_t __locale) __THROW;
299 # endif /* Use POSIX 2008. */
301 __END_DECLS
303 #endif /* __WCTYPE_H defined. */
305 #endif /* wctype.h */