]> git.proxmox.com Git - mirror_edk2.git/blame - StdLib/Include/wctype.h
Fix GCC build errors.
[mirror_edk2.git] / StdLib / Include / wctype.h
CommitLineData
53e1e5c6 1/** @file\r
61403bd7 2 Wide character classification and mapping utilities.\r
3\r
4 The following macros are defined in this file:<BR>\r
5@verbatim\r
6 WEOF Wide char version of end-of-file.\r
7@endverbatim\r
8\r
9 The following types are defined in this file:<BR>\r
10@verbatim\r
11 wint_t Type capable of holding all wchar_t values and WEOF.\r
12 wctrans_t A type for holding locale-specific character mappings.\r
13 wctype_t Type for holding locale-specific character classifications.\r
14@endverbatim\r
15\r
16 The following functions are declared in this file:<BR>\r
17@verbatim\r
18 ############### Wide Character Classification Functions\r
19 int iswalnum (wint_t);\r
20 int iswalpha (wint_t);\r
21 int iswcntrl (wint_t);\r
22 int iswdigit (wint_t);\r
23 int iswgraph (wint_t);\r
24 int iswlower (wint_t);\r
25 int iswprint (wint_t);\r
26 int iswpunct (wint_t);\r
27 int iswblank (wint_t);\r
28 int iswspace (wint_t);\r
29 int iswupper (wint_t);\r
30 int iswxdigit (wint_t);\r
31\r
32 ############### Extensible Wide Character Classification Functions\r
33 wctype_t wctype (const char *);\r
34 int iswctype (wint_t, wctype_t);\r
35\r
36 ############### Wide Character Case Mapping Utilities\r
37 wint_t towlower (wint_t);\r
38 wint_t towupper (wint_t);\r
39\r
40 ############### Extensible Wide Character Case Mapping Utilities\r
41 wctrans_t wctrans (const char *);\r
42 wint_t towctrans (wint_t, wctrans_t);\r
43@endverbatim\r
53e1e5c6 44\r
45 Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r
46 This program and the accompanying materials are licensed and made available under\r
47 the terms and conditions of the BSD License that accompanies this distribution.\r
48 The full text of the license may be found at\r
49 http://opensource.org/licenses/bsd-license.\r
50\r
51 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
52 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
2aa62f2b 53\r
2aa62f2b 54 * Copyright (c)1999 Citrus Project,\r
55 * All rights reserved.\r
56 *\r
57 * Redistribution and use in source and binary forms, with or without\r
58 * modification, are permitted provided that the following conditions\r
59 * are met:\r
60 * 1. Redistributions of source code must retain the above copyright\r
61 * notice, this list of conditions and the following disclaimer.\r
62 * 2. Redistributions in binary form must reproduce the above copyright\r
63 * notice, this list of conditions and the following disclaimer in the\r
64 * documentation and/or other materials provided with the distribution.\r
65 *\r
66 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\r
67 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
68 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
69 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r
70 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
71 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
72 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
73 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
74 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
75 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
76 * SUCH DAMAGE.\r
77 *\r
78 * citrus Id: wctype.h,v 1.4 2000/12/21 01:50:21 itojun Exp\r
2aa62f2b 79\r
53e1e5c6 80 NetBSD: wctype.h,v 1.6 2005/02/03 04:39:32 perry Exp\r
81**/\r
2aa62f2b 82#ifndef _WCTYPE_H_\r
83#define _WCTYPE_H_\r
84\r
85#include <sys/EfiCdefs.h>\r
86#include <machine/ansi.h>\r
87\r
53e1e5c6 88#ifdef _EFI_WINT_T\r
61403bd7 89 /** wint_t is an integer type unchanged by default argument promotions that can\r
90 hold any value corresponding to members of the extended character set, as\r
91 well as at least one value that does not correspond to any member of the\r
92 extended character set: WEOF.\r
93 */\r
53e1e5c6 94 typedef _EFI_WINT_T wint_t;\r
95 #undef _BSD_WINT_T_\r
96 #undef _EFI_WINT_T\r
2aa62f2b 97#endif\r
98\r
99#ifdef _BSD_WCTRANS_T_\r
61403bd7 100 /** A scalar type for holding locale-specific character mappings. */\r
101 typedef wint_t (*wctrans_t)(wint_t);\r
102 #undef _BSD_WCTRANS_T_\r
2aa62f2b 103#endif\r
104\r
105#ifdef _BSD_WCTYPE_T_\r
61403bd7 106 /** A scalar type capable of holding values representing locale-specific\r
107 character classifications. */\r
108 typedef _BSD_WCTYPE_T_ wctype_t;\r
109 #undef _BSD_WCTYPE_T_\r
2aa62f2b 110#endif\r
111\r
112#ifndef WEOF\r
61403bd7 113 /** WEOF expands to a constant expression of type wint_t whose value does not\r
114 correspond to any member of the extended character set. It is accepted\r
115 (and returned) by several functions, declared in this file, to indicate\r
116 end-of-file, that is, no more input from a stream. It is also used as a\r
117 wide character value that does not correspond to any member of the\r
118 extended character set.\r
119 */\r
120 #define WEOF ((wint_t)-1)\r
2aa62f2b 121#endif\r
122\r
123__BEGIN_DECLS\r
61403bd7 124 /** Test for any wide character for which iswalpha or iswdigit is TRUE.\r
125\r
126 @param[in] WC The wide character to be classified.\r
127\r
128 @return Returns non-zero (TRUE) if and only if the value of WC conforms\r
129 to the classification described for this function.\r
130 */\r
131 int iswalnum (wint_t WC);\r
132\r
133 /** Test for any wide character for which iswupper or iswlower is TRUE,\r
134 OR, a locale-specific character where none of iswcntrl, iswdigit,\r
135 iswpunct, or iswspace is TRUE.\r
136\r
137 @param[in] WC The wide character to be classified.\r
138\r
139 @return Returns non-zero (TRUE) if and only if the value of WC conforms\r
140 to the classification described for this function.\r
141 */\r
142 int iswalpha (wint_t WC);\r
143\r
144 /** Test for any wide control character.\r
145\r
146 @param[in] WC The wide character to be classified.\r
147\r
148 @return Returns non-zero (TRUE) if and only if the value of WC conforms\r
149 to the classification described for this function.\r
150 */\r
151 int iswcntrl (wint_t WC);\r
152\r
153 /** Test if the value of WC is a wide character that corresponds to a decimal digit.\r
154\r
155 @param[in] WC The wide character to be classified.\r
156\r
157 @return Returns non-zero (TRUE) if and only if the value of WC conforms\r
158 to the classification described for this function.\r
159 */\r
160 int iswdigit (wint_t WC);\r
161\r
162 /** Test for wide characters for which iswprint is TRUE and iswspace is FALSE.\r
163\r
164 @param[in] WC The wide character to be classified.\r
165\r
166 @return Returns non-zero (TRUE) if and only if the value of WC conforms\r
167 to the classification described for this function.\r
168 */\r
169 int iswgraph (wint_t WC);\r
170\r
171 /** The iswlower function tests for any wide character that corresponds to a\r
172 lowercase letter or is one of a locale-specific set of wide characters\r
173 for which none of iswcntrl, iswdigit, iswpunct, or iswspace is TRUE.\r
174\r
175 @param[in] WC The wide character to be classified.\r
176\r
177 @return Returns non-zero (TRUE) if and only if the value of WC conforms\r
178 to the classification described for this function.\r
179 */\r
180 int iswlower (wint_t WC);\r
181\r
182 /** Test for any printing wide character.\r
183\r
184 @param[in] WC The wide character to be classified.\r
185\r
186 @return Returns non-zero (TRUE) if and only if the value of WC conforms\r
187 to the classification described for this function.\r
188 */\r
189 int iswprint (wint_t WC);\r
190\r
191 /** The iswpunct function tests for any printing wide character that is one\r
192 of a locale-specific set of punctuation wide characters for which\r
193 neither iswspace nor iswalnum is TRUE.\r
194\r
195 @param[in] WC The wide character to be classified.\r
196\r
197 @return Returns non-zero (TRUE) if and only if the value of WC conforms\r
198 to the classification described for this function.\r
199 */\r
200 int iswpunct (wint_t WC);\r
201\r
202 /** Test for standard blank characters or locale-specific characters\r
203 for which iswspace is TRUE and are used to separate words within a line\r
204 of text. In the "C" locale, iswblank only returns TRUE for the standard\r
205 blank characters space (L' ') and horizontal tab (L'\t').\r
206\r
207 @param[in] WC The wide character to be classified.\r
208\r
209 @return Returns non-zero (TRUE) if and only if the value of WC conforms\r
210 to the classification described for this function.\r
211 */\r
212 int iswblank (wint_t WC);\r
213\r
214 /** The iswspace function tests for any wide character that corresponds to a\r
215 locale-specific set of white-space wide characters for which none of\r
216 iswalnum, iswgraph, or iswpunct is TRUE.\r
217\r
218 @param[in] WC The wide character to be classified.\r
219\r
220 @return Returns non-zero (TRUE) if and only if the value of WC conforms\r
221 to the classification described for this function.\r
222 */\r
223 int iswspace (wint_t WC);\r
224\r
225 /** Tests for any wide character that corresponds to an uppercase letter or\r
226 is one of a locale-specific set of wide characters for which none of\r
227 iswcntrl, iswdigit, iswpunct, or iswspace is TRUE.\r
228\r
229 @param[in] WC The wide character to be classified.\r
230\r
231 @return Returns non-zero (TRUE) if and only if the value of WC conforms\r
232 to the classification described for this function.\r
233 */\r
234 int iswupper (wint_t WC);\r
235\r
236 /** The iswxdigit function tests for any wide character that corresponds to a\r
237 hexadecimal-digit character.\r
238\r
239 @param[in] WC The wide character to be classified.\r
240\r
241 @return Returns non-zero (TRUE) if and only if the value of WC conforms\r
242 to the classification described for this function.\r
243 */\r
244 int iswxdigit (wint_t WC);\r
245\r
246 /** Construct a value that describes a class of wide characters, identified\r
247 by the string pointed to by Desc. The constructed value is suitable for\r
248 use as the second argument to the iswctype function.\r
249\r
250 The following strings name classes of wide characters that the iswctype\r
251 function is able to test against. These strings are valid in all locales\r
252 as Desc arguments to wctype().\r
253 - "alnum"\r
254 - "alpha"\r
255 - "blank"\r
256 - "cntrl"\r
257 - "digit"\r
258 - "graph"\r
259 - "lower"\r
260 - "print"\r
261 - "punct"\r
262 - "space"\r
263 - "upper"\r
264 - "xdigit\r
265\r
266 @param[in] Desc A pointer to a multibyte character string naming a\r
267 class of wide characters.\r
268\r
269 @return If Desc identifies a valid class of wide characters in the\r
270 current locale, the wctype function returns a nonzero value that\r
271 is valid as the second argument to the iswctype function;\r
272 otherwise, it returns zero.\r
273 */\r
274 wctype_t wctype (const char *Desc);\r
275\r
276 /** Determine whether the wide character WC has the property described by Wct.\r
277\r
278 @param[in] WC The wide character to be classified.\r
279 @param[in] Wct A value describing a class of wide characters.\r
280\r
281 @return The iswctype function returns nonzero (TRUE) if and only if the\r
282 value of the wide character WC has the property described by Wct.\r
283 */\r
284 int iswctype (wint_t WC, wctype_t Wct);\r
285\r
286 /** Convert an uppercase letter to a corresponding lowercase letter.\r
287\r
288 @param[in] WC The wide character to be converted.\r
289\r
290 @return If the argument is a wide character for which iswupper is TRUE\r
291 and there are one or more corresponding wide characters, as\r
292 specified by the current locale, for which iswlower is TRUE, the\r
293 towlower function returns one of the corresponding wide\r
294 characters (always the same one for any given locale); otherwise,\r
295 the argument is returned unchanged.\r
296 */\r
297 wint_t towlower (wint_t WC);\r
298\r
299 /** Convert a lowercase letter to a corresponding uppercase letter.\r
300\r
301 @param[in] WC The wide character to be converted.\r
302\r
303 @return If the argument is a wide character for which iswlower is TRUE\r
304 and there are one or more corresponding wide characters, as\r
305 specified by the current locale, for which iswupper is TRUE, the\r
306 towupper function returns one of the corresponding wide\r
307 characters (always the same one for any given locale); otherwise,\r
308 the argument is returned unchanged.\r
309 */\r
310 wint_t towupper (wint_t WC);\r
311\r
312 /** Construct a value that describes a mapping between wide characters\r
313 identified by the string argument, S.\r
314\r
315 The strings listed below are valid in all locales as the S argument to\r
316 the wctrans function.\r
317 - "tolower"\r
318 - "toupper"\r
319\r
320 @param[in] S A pointer to a multibyte character string naming a\r
321 mapping between wide characters.\r
322\r
323 @return If S identifies a valid mapping of wide characters in the current\r
324 locale, the wctrans function returns a nonzero value that is\r
325 valid as the second argument to the towctrans function;\r
326 otherwise, it returns zero.\r
327 */\r
328 wctrans_t wctrans (const char *S);\r
329\r
330 /** Map the wide character WC using the mapping described by WTr. The current\r
331 locale will be the same as during the call to wctrans that returned\r
332 the value WTr.\r
333\r
334 @param[in] WC The wide character to be converted.\r
335 @param[in] WTr A value describing a mapping of wide characters in the\r
336 current locale.\r
337\r
338 @return Returns the mapped value of WC using the mapping selected by WTr.\r
339 */\r
340 wint_t towctrans (wint_t WC, wctrans_t WTr);\r
2aa62f2b 341__END_DECLS\r
342\r
343#endif /* _WCTYPE_H_ */\r