]>
git.proxmox.com Git - mirror_edk2.git/blob - StdLib/Include/wctype.h
2 Wide character classification and mapping utilities.
4 The following macros are defined in this file:<BR>
6 WEOF Wide char version of end-of-file.
9 The following types are defined in this file:<BR>
11 wint_t Type capable of holding all wchar_t values and WEOF.
12 wctrans_t A type for holding locale-specific character mappings.
13 wctype_t Type for holding locale-specific character classifications.
16 The following functions are declared in this file:<BR>
18 ############### Wide Character Classification Functions
19 int iswalnum (wint_t);
20 int iswalpha (wint_t);
21 int iswcntrl (wint_t);
22 int iswdigit (wint_t);
23 int iswgraph (wint_t);
24 int iswlower (wint_t);
25 int iswprint (wint_t);
26 int iswpunct (wint_t);
27 int iswblank (wint_t);
28 int iswspace (wint_t);
29 int iswupper (wint_t);
30 int iswxdigit (wint_t);
32 ############### Extensible Wide Character Classification Functions
33 wctype_t wctype (const char *);
34 int iswctype (wint_t, wctype_t);
36 ############### Wide Character Case Mapping Utilities
37 wint_t towlower (wint_t);
38 wint_t towupper (wint_t);
40 ############### Extensible Wide Character Case Mapping Utilities
41 wctrans_t wctrans (const char *);
42 wint_t towctrans (wint_t, wctrans_t);
45 Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
46 This program and the accompanying materials are licensed and made available under
47 the terms and conditions of the BSD License that accompanies this distribution.
48 The full text of the license may be found at
49 http://opensource.org/licenses/bsd-license.
51 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
52 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
54 * Copyright (c)1999 Citrus Project,
55 * All rights reserved.
57 * Redistribution and use in source and binary forms, with or without
58 * modification, are permitted provided that the following conditions
60 * 1. Redistributions of source code must retain the above copyright
61 * notice, this list of conditions and the following disclaimer.
62 * 2. Redistributions in binary form must reproduce the above copyright
63 * notice, this list of conditions and the following disclaimer in the
64 * documentation and/or other materials provided with the distribution.
66 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
67 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
68 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
69 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
70 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
71 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
72 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
73 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
74 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
75 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
78 * citrus Id: wctype.h,v 1.4 2000/12/21 01:50:21 itojun Exp
80 NetBSD: wctype.h,v 1.6 2005/02/03 04:39:32 perry Exp
85 #include <sys/EfiCdefs.h>
86 #include <machine/ansi.h>
89 /** wint_t is an integer type unchanged by default argument promotions that can
90 hold any value corresponding to members of the extended character set, as
91 well as at least one value that does not correspond to any member of the
92 extended character set: WEOF.
94 typedef _EFI_WINT_T
wint_t;
99 #ifdef _BSD_WCTRANS_T_
100 /** A scalar type for holding locale-specific character mappings. */
101 typedef wint_t (*wctrans_t)(wint_t);
102 #undef _BSD_WCTRANS_T_
105 #ifdef _BSD_WCTYPE_T_
106 /** A scalar type capable of holding values representing locale-specific
107 character classifications. */
108 typedef _BSD_WCTYPE_T_
wctype_t;
109 #undef _BSD_WCTYPE_T_
113 /** WEOF expands to a constant expression of type wint_t whose value does not
114 correspond to any member of the extended character set. It is accepted
115 (and returned) by several functions, declared in this file, to indicate
116 end-of-file, that is, no more input from a stream. It is also used as a
117 wide character value that does not correspond to any member of the
118 extended character set.
120 #define WEOF ((wint_t)-1)
124 /** Test for any wide character for which iswalpha or iswdigit is TRUE.
126 @param[in] WC The wide character to be classified.
128 @return Returns non-zero (TRUE) if and only if the value of WC conforms
129 to the classification described for this function.
131 int iswalnum (wint_t WC
);
133 /** Test for any wide character for which iswupper or iswlower is TRUE,
134 OR, a locale-specific character where none of iswcntrl, iswdigit,
135 iswpunct, or iswspace is TRUE.
137 @param[in] WC The wide character to be classified.
139 @return Returns non-zero (TRUE) if and only if the value of WC conforms
140 to the classification described for this function.
142 int iswalpha (wint_t WC
);
144 /** Test for any wide control character.
146 @param[in] WC The wide character to be classified.
148 @return Returns non-zero (TRUE) if and only if the value of WC conforms
149 to the classification described for this function.
151 int iswcntrl (wint_t WC
);
153 /** Test if the value of WC is a wide character that corresponds to a decimal digit.
155 @param[in] WC The wide character to be classified.
157 @return Returns non-zero (TRUE) if and only if the value of WC conforms
158 to the classification described for this function.
160 int iswdigit (wint_t WC
);
162 /** Test for wide characters for which iswprint is TRUE and iswspace is FALSE.
164 @param[in] WC The wide character to be classified.
166 @return Returns non-zero (TRUE) if and only if the value of WC conforms
167 to the classification described for this function.
169 int iswgraph (wint_t WC
);
171 /** The iswlower function tests for any wide character that corresponds to a
172 lowercase letter or is one of a locale-specific set of wide characters
173 for which none of iswcntrl, iswdigit, iswpunct, or iswspace is TRUE.
175 @param[in] WC The wide character to be classified.
177 @return Returns non-zero (TRUE) if and only if the value of WC conforms
178 to the classification described for this function.
180 int iswlower (wint_t WC
);
182 /** Test for any printing wide character.
184 @param[in] WC The wide character to be classified.
186 @return Returns non-zero (TRUE) if and only if the value of WC conforms
187 to the classification described for this function.
189 int iswprint (wint_t WC
);
191 /** The iswpunct function tests for any printing wide character that is one
192 of a locale-specific set of punctuation wide characters for which
193 neither iswspace nor iswalnum is TRUE.
195 @param[in] WC The wide character to be classified.
197 @return Returns non-zero (TRUE) if and only if the value of WC conforms
198 to the classification described for this function.
200 int iswpunct (wint_t WC
);
202 /** Test for standard blank characters or locale-specific characters
203 for which iswspace is TRUE and are used to separate words within a line
204 of text. In the "C" locale, iswblank only returns TRUE for the standard
205 blank characters space (L' ') and horizontal tab (L'\t').
207 @param[in] WC The wide character to be classified.
209 @return Returns non-zero (TRUE) if and only if the value of WC conforms
210 to the classification described for this function.
212 int iswblank (wint_t WC
);
214 /** The iswspace function tests for any wide character that corresponds to a
215 locale-specific set of white-space wide characters for which none of
216 iswalnum, iswgraph, or iswpunct is TRUE.
218 @param[in] WC The wide character to be classified.
220 @return Returns non-zero (TRUE) if and only if the value of WC conforms
221 to the classification described for this function.
223 int iswspace (wint_t WC
);
225 /** Tests for any wide character that corresponds to an uppercase letter or
226 is one of a locale-specific set of wide characters for which none of
227 iswcntrl, iswdigit, iswpunct, or iswspace is TRUE.
229 @param[in] WC The wide character to be classified.
231 @return Returns non-zero (TRUE) if and only if the value of WC conforms
232 to the classification described for this function.
234 int iswupper (wint_t WC
);
236 /** The iswxdigit function tests for any wide character that corresponds to a
237 hexadecimal-digit character.
239 @param[in] WC The wide character to be classified.
241 @return Returns non-zero (TRUE) if and only if the value of WC conforms
242 to the classification described for this function.
244 int iswxdigit (wint_t WC
);
246 /** Construct a value that describes a class of wide characters, identified
247 by the string pointed to by Desc. The constructed value is suitable for
248 use as the second argument to the iswctype function.
250 The following strings name classes of wide characters that the iswctype
251 function is able to test against. These strings are valid in all locales
252 as Desc arguments to wctype().
266 @param[in] Desc A pointer to a multibyte character string naming a
267 class of wide characters.
269 @return If Desc identifies a valid class of wide characters in the
270 current locale, the wctype function returns a nonzero value that
271 is valid as the second argument to the iswctype function;
272 otherwise, it returns zero.
274 wctype_t wctype (const char *Desc
);
276 /** Determine whether the wide character WC has the property described by Wct.
278 @param[in] WC The wide character to be classified.
279 @param[in] Wct A value describing a class of wide characters.
281 @return The iswctype function returns nonzero (TRUE) if and only if the
282 value of the wide character WC has the property described by Wct.
284 int iswctype (wint_t WC
, wctype_t Wct
);
286 /** Convert an uppercase letter to a corresponding lowercase letter.
288 @param[in] WC The wide character to be converted.
290 @return If the argument is a wide character for which iswupper is TRUE
291 and there are one or more corresponding wide characters, as
292 specified by the current locale, for which iswlower is TRUE, the
293 towlower function returns one of the corresponding wide
294 characters (always the same one for any given locale); otherwise,
295 the argument is returned unchanged.
297 wint_t towlower (wint_t WC
);
299 /** Convert a lowercase letter to a corresponding uppercase letter.
301 @param[in] WC The wide character to be converted.
303 @return If the argument is a wide character for which iswlower is TRUE
304 and there are one or more corresponding wide characters, as
305 specified by the current locale, for which iswupper is TRUE, the
306 towupper function returns one of the corresponding wide
307 characters (always the same one for any given locale); otherwise,
308 the argument is returned unchanged.
310 wint_t towupper (wint_t WC
);
312 /** Construct a value that describes a mapping between wide characters
313 identified by the string argument, S.
315 The strings listed below are valid in all locales as the S argument to
316 the wctrans function.
320 @param[in] S A pointer to a multibyte character string naming a
321 mapping between wide characters.
323 @return If S identifies a valid mapping of wide characters in the current
324 locale, the wctrans function returns a nonzero value that is
325 valid as the second argument to the towctrans function;
326 otherwise, it returns zero.
328 wctrans_t wctrans (const char *S
);
330 /** Map the wide character WC using the mapping described by WTr. The current
331 locale will be the same as during the call to wctrans that returned
334 @param[in] WC The wide character to be converted.
335 @param[in] WTr A value describing a mapping of wide characters in the
338 @return Returns the mapped value of WC using the mapping selected by WTr.
340 wint_t towctrans (wint_t WC
, wctrans_t WTr
);
343 #endif /* _WCTYPE_H_ */