]>
git.proxmox.com Git - mirror_edk2.git/blob - StdLib/Include/ctype.h
2 Single-byte character classification, case conversion macros, and
5 The header <ctype.h> declares several functions useful for testing and mapping
6 characters. In all cases, the argument is an int, the value of which shall be
7 representable as an unsigned char or shall equal the value of the macro EOF.
8 If the argument has any other value, the behavior is undefined.
10 The behavior of these functions is affected by the current locale. The
11 default is the "C" locale.
13 The term "printing character" refers to a member of a locale-specific
14 set of characters, each of which occupies at least one printing position on an output
15 device; the term control character refers to a member of a locale-specific
16 set of characters that are not printing characters.
18 Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
19 This program and the accompanying materials are licensed and made available under
20 the terms and conditions of the BSD License that accompanies this distribution.
21 The full text of the license may be found at
22 http://opensource.org/licenses/bsd-license.
24 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
25 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
29 #include <sys/EfiCdefs.h>
30 #include <sys/_ctype.h>
33 // Declarations for the classification Functions
35 /** The isalnum function tests for any character for which isalpha or isdigit
38 @param[in] c The character to be tested.
40 @return Returns nonzero (true) if and only if the value of the parameter c
41 can be classified as specified in the description of the function.
45 /** The isalpha function tests for any character for which isupper or islower
46 is true, or any character that is one of a locale-specific set of
47 alphabetic characters for which none of iscntrl, isdigit, ispunct, or
48 isspace is true. In the "C" locale, isalpha returns true only for the
49 characters for which isupper or islower is true.
51 @param[in] c The character to be tested.
53 @return Returns nonzero (true) if and only if the value of the parameter c
54 can be classified as specified in the description of the function.
58 /** The iscntrl function tests for any control character.
60 @param[in] c The character to be tested.
62 @return Returns nonzero (true) if and only if the value of the parameter c
63 can be classified as specified in the description of the function.
67 /** The isdigit function tests for any decimal-digit character.
69 @param[in] c The character to be tested.
71 @return Returns nonzero (true) if and only if the value of the parameter c
72 can be classified as specified in the description of the function.
76 /** The isgraph function tests for any printing character except space (' ').
78 @param[in] c The character to be tested.
80 @return Returns nonzero (true) if and only if the value of the parameter c
81 can be classified as specified in the description of the function.
85 /** The islower function tests for any character that is a lowercase letter or
86 is one of a locale-specific set of characters for which none of iscntrl,
87 isdigit, ispunct, or isspace is true. In the "C" locale, islower returns
88 true only for the lowercase letters.
90 @param[in] c The character to be tested.
92 @return Returns nonzero (true) if and only if the value of the parameter c
93 can be classified as specified in the description of the function.
97 /** The isprint function tests for any printing character including space (' ').
99 @param[in] c The character to be tested.
101 @return Returns nonzero (true) if and only if the value of the parameter c
102 can be classified as specified in the description of the function.
106 /** The ispunct function tests for any printing character that is one of a
107 locale-specific set of punctuation characters for which neither isspace nor
108 isalnum is true. In the "C" locale, ispunct returns true for every printing
109 character for which neither isspace nor isalnum is true.
111 @param[in] c The character to be tested.
113 @return Returns nonzero (true) if and only if the value of the parameter c
114 can be classified as specified in the description of the function.
118 /** The isspace function tests for any character that is a standard white-space
119 character or is one of a locale-specific set of characters for which
120 isalnum is false. The standard white-space characters are the following:
121 space (' '), form feed ('\f'), new-line ('\n'), carriage return ('\r'),
122 horizontal tab ('\t'), and vertical tab ('\v'). In the "C" locale, isspace
123 returns true only for the standard white-space characters.
125 @param[in] c The character to be tested.
127 @return Returns nonzero (true) if and only if the value of the parameter c
128 can be classified as specified in the description of the function.
132 /** The isupper function tests for any character that is an uppercase letter or
133 is one of a locale-specific set of characters for which none of iscntrl,
134 isdigit, ispunct, or isspace is true. In the "C" locale, isupper returns
135 true only for the uppercase letters.
137 @param[in] c The character to be tested.
139 @return Returns nonzero (true) if and only if the value of the parameter c
140 can be classified as specified in the description of the function.
144 /** The isxdigit function tests for any hexadecimal-digit character.
146 @param[in] c The character to be tested.
148 @return Returns nonzero (true) if and only if the value of the parameter c
149 can be classified as specified in the description of the function.
153 /** The isblank function tests that a character is a white-space character that results
154 in a number of space (' ') characters being sent to the output device. In the C locale
155 this is either ' ' or '\t'.
157 @param[in] c The character to be tested.
159 @return Returns nonzero (true) if and only if the value of the parameter c
160 can be classified as specified in the description of the function.
164 /** The isascii function tests that a character is one of the 128 7-bit ASCII characters.
166 @param[in] c The character to be tested.
168 @return Returns nonzero (true) if and only if the value of the parameter c
169 can be classified as specified in the description of the function.
173 /** The tolower function converts an uppercase letter to a corresponding
176 @param[in] c The character to be converted.
178 @return If the argument is a character for which isupper is true and
179 there are one or more corresponding characters, as specified by
180 the current locale, for which islower is true, the tolower
181 function returns one of the corresponding characters (always the
182 same one for any given locale); otherwise, the argument is
187 /** The toupper function converts a lowercase letter to a corresponding
190 @param[in] c The character to be converted.
192 @return If the argument is a character for which islower is true and
193 there are one or more corresponding characters, as specified by
194 the current locale, for which isupper is true, the toupper
195 function returns one of the corresponding characters (always the
196 same one for any given locale); otherwise, the argument is
203 /** Character Classification Macros.
204 Undefine individually or define NO_CTYPE_MACROS, before including <ctype.h>,
205 in order to use the Function version of the character classification macros.
208 #ifndef NO_CTYPE_MACROS
209 #define isalnum(c) (__isCClass( (int)c, (_CD | _CU | _CL | _XA)))
210 #define isalpha(c) (__isCClass( (int)c, (_CU | _CL | _XA)))
211 #define iscntrl(c) (__isCClass( (int)c, (_CC)))
212 #define isdigit(c) (__isCClass( (int)c, (_CD)))
213 #define isgraph(c) (__isCClass( (int)c, (_CG)))
214 #define islower(c) (__isCClass( (int)c, (_CL)))
215 #define isprint(c) (__isCClass( (int)c, (_CS | _CG)))
216 #define ispunct(c) (__isCClass( (int)c, (_CP)))
217 #define isspace(c) (__isCClass( (int)c, (_CW)))
218 #define isupper(c) (__isCClass( (int)c, (_CU)))
219 #define isxdigit(c) (__isCClass( (int)c, (_CD | _CX)))
220 #define tolower(c) (__toLower((int)c))
221 #define toupper(c) (__toUpper((int)c))
222 #endif /* NO_CTYPE_MACROS */
225 #endif /* _CTYPE_H */