]>
git.proxmox.com Git - mirror_edk2.git/blob - StdLib/Include/ctype.h
2 Single-byte character classification and 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 one printing position on a display
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, 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.php.
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.
30 #include <sys/EfiCdefs.h>
31 #include <sys/_ctype.h>
34 // Declarations for the classification Functions
36 /** The isalnum function tests for any character for which isalpha or isdigit
39 @return Returns nonzero (true) if and only if the value of the argument c
40 conforms to that in the description of the function.
44 /** The isalpha function tests for any character for which isupper or islower
45 is true, or any character that is one of a locale-specific set of
46 alphabetic characters for which none of iscntrl, isdigit, ispunct, or
47 isspace is true. In the "C" locale, isalpha returns true only for the
48 characters for which isupper or islower is true.
50 @return Returns nonzero (true) if and only if the value of the argument c
51 conforms to that in the description of the function.
55 /** The iscntrl function tests for any control character.
57 @return Returns nonzero (true) if and only if the value of the argument c
58 conforms to that in the description of the function.
62 /** The isdigit function tests for any decimal-digit character.
64 @return Returns nonzero (true) if and only if the value of the argument c
65 conforms to that in the description of the function.
69 /** The isgraph function tests for any printing character except space (' ').
71 @return Returns nonzero (true) if and only if the value of the argument c
72 conforms to that in the description of the function.
76 /** The islower function tests for any character that is a lowercase letter or
77 is one of a locale-specific set of characters for which none of iscntrl,
78 isdigit, ispunct, or isspace is true. In the "C" locale, islower returns
79 true only for the lowercase letters.
81 @return Returns nonzero (true) if and only if the value of the argument c
82 conforms to that in the description of the function.
86 /** The isprint function tests for any printing character including space (' ').
88 @return Returns nonzero (true) if and only if the value of the argument c
89 conforms to that in the description of the function.
93 /** The ispunct function tests for any printing character that is one of a
94 locale-specific set of punctuation characters for which neither isspace nor
95 isalnum is true. In the "C" locale, ispunct returns true for every printing
96 character for which neither isspace nor isalnum is true.
98 @return Returns nonzero (true) if and only if the value of the argument c
99 conforms to that in the description of the function.
103 /** The isspace function tests for any character that is a standard white-space
104 character or is one of a locale-specific set of characters for which
105 isalnum is false. The standard white-space characters are the following:
106 space (' '), form feed ('\f'), new-line ('\n'), carriage return ('\r'),
107 horizontal tab ('\t'), and vertical tab ('\v'). In the "C" locale, isspace
108 returns true only for the standard white-space characters.
110 @return Returns nonzero (true) if and only if the value of the argument c
111 conforms to that in the description of the function.
115 /** The isupper function tests for any character that is an uppercase letter or
116 is one of a locale-specific set of characters for which none of iscntrl,
117 isdigit, ispunct, or isspace is true. In the "C" locale, isupper returns
118 true only for the uppercase letters.
120 @return Returns nonzero (true) if and only if the value of the argument c
121 conforms to that in the description of the function.
125 /** The isxdigit function tests for any hexadecimal-digit character.
127 @return Returns nonzero (true) if and only if the value of the argument c
128 conforms to that in the description of the function.
132 /** The isascii function tests that a character is one of the 128 ASCII characters.
134 @param[in] c The character to test.
135 @return Returns nonzero (true) if c is a valid ASCII character. Otherwize,
136 zero (false) is returned.
140 /** The tolower function converts an uppercase letter to a corresponding
143 @return If the argument is a character for which isupper is true and
144 there are one or more corresponding characters, as specified by
145 the current locale, for which islower is true, the tolower
146 function returns one of the corresponding characters (always the
147 same one for any given locale); otherwise, the argument is
152 /** The toupper function converts a lowercase letter to a corresponding
155 @return If the argument is a character for which islower is true and
156 there are one or more corresponding characters, as specified by
157 the current locale, for which isupper is true, the toupper
158 function returns one of the corresponding characters (always the
159 same one for any given locale); otherwise, the argument is
168 // Character Classification Macros
169 // Undefine individually or define NO_CTYPE_MACROS, before including <ctype.h>,
170 // in order to use the Function version of the character classification macros.
171 #ifndef NO_CTYPE_MACROS
172 #define isalnum(c) (__isCClass( (int)c, (_CD | _CU | _CL | _XA)))
173 #define isalpha(c) (__isCClass( (int)c, (_CU | _CL | _XA)))
174 #define iscntrl(c) (__isCClass( (int)c, (_CC)))
175 #define isdigit(c) (__isCClass( (int)c, (_CD)))
176 #define isgraph(c) (__isCClass( (int)c, (_CG)))
177 #define islower(c) (__isCClass( (int)c, (_CL)))
178 #define isprint(c) (__isCClass( (int)c, (_CS | _CG)))
179 #define ispunct(c) (__isCClass( (int)c, (_CP)))
180 #define isspace(c) (__isCClass( (int)c, (_CW)))
181 #define isupper(c) (__isCClass( (int)c, (_CU)))
182 #define isxdigit(c) (__isCClass( (int)c, (_CD | _CX)))
183 #define tolower(c) (__toLower((int)c))
184 #define toupper(c) (__toUpper((int)c))
185 #endif /* NO_CTYPE_MACROS */
187 #endif /* _CTYPE_H */