]>
Commit | Line | Data |
---|---|---|
2aa62f2b | 1 | /** @file\r |
681cc25c | 2 | Single-byte character classification, case conversion macros, and\r |
2aa62f2b | 3 | function declarations.\r |
4 | \r | |
5 | The header <ctype.h> declares several functions useful for testing and mapping\r | |
6 | characters. In all cases, the argument is an int, the value of which shall be\r | |
7 | representable as an unsigned char or shall equal the value of the macro EOF.\r | |
8 | If the argument has any other value, the behavior is undefined.\r | |
9 | \r | |
10 | The behavior of these functions is affected by the current locale. The\r | |
11 | default is the "C" locale.\r | |
12 | \r | |
13 | The term "printing character" refers to a member of a locale-specific\r | |
681cc25c | 14 | set of characters, each of which occupies at least one printing position on an output\r |
2aa62f2b | 15 | device; the term control character refers to a member of a locale-specific\r |
16 | set of characters that are not printing characters.\r | |
17 | \r | |
681cc25c | 18 | Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r |
2aa62f2b | 19 | This program and the accompanying materials are licensed and made available under\r |
20 | the terms and conditions of the BSD License that accompanies this distribution.\r | |
21 | The full text of the license may be found at\r | |
681cc25c | 22 | http://opensource.org/licenses/bsd-license.\r |
2aa62f2b | 23 | \r |
24 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
25 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
2aa62f2b | 26 | **/\r |
27 | #ifndef _CTYPE_H\r | |
28 | #define _CTYPE_H\r | |
29 | #include <sys/EfiCdefs.h>\r | |
30 | #include <sys/_ctype.h>\r | |
31 | \r | |
32 | __BEGIN_DECLS\r | |
33 | // Declarations for the classification Functions\r | |
34 | \r | |
35 | /** The isalnum function tests for any character for which isalpha or isdigit\r | |
36 | is true.\r | |
37 | \r | |
681cc25c | 38 | @param[in] c The character to be tested.\r |
39 | \r | |
40 | @return Returns nonzero (true) if and only if the value of the parameter c\r | |
41 | can be classified as specified in the description of the function.\r | |
2aa62f2b | 42 | **/\r |
43 | int isalnum(int c);\r | |
44 | \r | |
45 | /** The isalpha function tests for any character for which isupper or islower\r | |
46 | is true, or any character that is one of a locale-specific set of\r | |
47 | alphabetic characters for which none of iscntrl, isdigit, ispunct, or\r | |
48 | isspace is true. In the "C" locale, isalpha returns true only for the\r | |
49 | characters for which isupper or islower is true.\r | |
50 | \r | |
681cc25c | 51 | @param[in] c The character to be tested.\r |
52 | \r | |
53 | @return Returns nonzero (true) if and only if the value of the parameter c\r | |
54 | can be classified as specified in the description of the function.\r | |
2aa62f2b | 55 | **/\r |
56 | int isalpha(int c);\r | |
57 | \r | |
8379337c | 58 | /** The isblank function tests that a character is a white-space character that results\r |
59 | in a number of space (' ') characters being sent to the output device. In the C locale\r | |
60 | this is either ' ' or '\t'.\r | |
61 | \r | |
62 | @param[in] c The character to be tested.\r | |
63 | \r | |
64 | @return Returns nonzero (true) if and only if the value of the parameter c\r | |
65 | can be classified as specified in the description of the function.\r | |
66 | **/\r | |
67 | int isblank(int);\r | |
68 | \r | |
2aa62f2b | 69 | /** The iscntrl function tests for any control character.\r |
70 | \r | |
681cc25c | 71 | @param[in] c The character to be tested.\r |
72 | \r | |
73 | @return Returns nonzero (true) if and only if the value of the parameter c\r | |
74 | can be classified as specified in the description of the function.\r | |
2aa62f2b | 75 | **/\r |
76 | int iscntrl(int c);\r | |
77 | \r | |
78 | /** The isdigit function tests for any decimal-digit character.\r | |
79 | \r | |
681cc25c | 80 | @param[in] c The character to be tested.\r |
81 | \r | |
82 | @return Returns nonzero (true) if and only if the value of the parameter c\r | |
83 | can be classified as specified in the description of the function.\r | |
2aa62f2b | 84 | **/\r |
85 | int isdigit(int c);\r | |
86 | \r | |
87 | /** The isgraph function tests for any printing character except space (' ').\r | |
88 | \r | |
681cc25c | 89 | @param[in] c The character to be tested.\r |
90 | \r | |
91 | @return Returns nonzero (true) if and only if the value of the parameter c\r | |
92 | can be classified as specified in the description of the function.\r | |
2aa62f2b | 93 | **/\r |
94 | int isgraph(int c);\r | |
95 | \r | |
96 | /** The islower function tests for any character that is a lowercase letter or\r | |
97 | is one of a locale-specific set of characters for which none of iscntrl,\r | |
98 | isdigit, ispunct, or isspace is true. In the "C" locale, islower returns\r | |
99 | true only for the lowercase letters.\r | |
100 | \r | |
681cc25c | 101 | @param[in] c The character to be tested.\r |
102 | \r | |
103 | @return Returns nonzero (true) if and only if the value of the parameter c\r | |
104 | can be classified as specified in the description of the function.\r | |
2aa62f2b | 105 | **/\r |
106 | int islower(int c);\r | |
107 | \r | |
108 | /** The isprint function tests for any printing character including space (' ').\r | |
109 | \r | |
681cc25c | 110 | @param[in] c The character to be tested.\r |
111 | \r | |
112 | @return Returns nonzero (true) if and only if the value of the parameter c\r | |
113 | can be classified as specified in the description of the function.\r | |
2aa62f2b | 114 | **/\r |
115 | int isprint(int c);\r | |
116 | \r | |
117 | /** The ispunct function tests for any printing character that is one of a\r | |
118 | locale-specific set of punctuation characters for which neither isspace nor\r | |
119 | isalnum is true. In the "C" locale, ispunct returns true for every printing\r | |
120 | character for which neither isspace nor isalnum is true.\r | |
121 | \r | |
681cc25c | 122 | @param[in] c The character to be tested.\r |
123 | \r | |
124 | @return Returns nonzero (true) if and only if the value of the parameter c\r | |
125 | can be classified as specified in the description of the function.\r | |
2aa62f2b | 126 | **/\r |
127 | int ispunct(int c);\r | |
128 | \r | |
129 | /** The isspace function tests for any character that is a standard white-space\r | |
130 | character or is one of a locale-specific set of characters for which\r | |
131 | isalnum is false. The standard white-space characters are the following:\r | |
132 | space (' '), form feed ('\f'), new-line ('\n'), carriage return ('\r'),\r | |
133 | horizontal tab ('\t'), and vertical tab ('\v'). In the "C" locale, isspace\r | |
134 | returns true only for the standard white-space characters.\r | |
135 | \r | |
681cc25c | 136 | @param[in] c The character to be tested.\r |
137 | \r | |
138 | @return Returns nonzero (true) if and only if the value of the parameter c\r | |
139 | can be classified as specified in the description of the function.\r | |
2aa62f2b | 140 | **/\r |
141 | int isspace(int c);\r | |
142 | \r | |
143 | /** The isupper function tests for any character that is an uppercase letter or\r | |
144 | is one of a locale-specific set of characters for which none of iscntrl,\r | |
145 | isdigit, ispunct, or isspace is true. In the "C" locale, isupper returns\r | |
146 | true only for the uppercase letters.\r | |
147 | \r | |
681cc25c | 148 | @param[in] c The character to be tested.\r |
149 | \r | |
150 | @return Returns nonzero (true) if and only if the value of the parameter c\r | |
151 | can be classified as specified in the description of the function.\r | |
2aa62f2b | 152 | **/\r |
153 | int isupper(int c);\r | |
154 | \r | |
155 | /** The isxdigit function tests for any hexadecimal-digit character.\r | |
156 | \r | |
681cc25c | 157 | @param[in] c The character to be tested.\r |
158 | \r | |
159 | @return Returns nonzero (true) if and only if the value of the parameter c\r | |
160 | can be classified as specified in the description of the function.\r | |
2aa62f2b | 161 | **/\r |
162 | int isxdigit(int c);\r | |
163 | \r | |
681cc25c | 164 | /** The isascii function tests that a character is one of the 128 7-bit ASCII characters.\r |
8379337c | 165 | This function is not part of the C standard, but is commonly used.\r |
681cc25c | 166 | \r |
167 | @param[in] c The character to be tested.\r | |
168 | \r | |
169 | @return Returns nonzero (true) if and only if the value of the parameter c\r | |
170 | can be classified as specified in the description of the function.\r | |
2aa62f2b | 171 | **/\r |
172 | int isascii(int c);\r | |
173 | \r | |
0c1992fb | 174 | /** Test whether a character is one of the characters used as a separator\r |
175 | between directory elements in a path.\r | |
176 | \r | |
177 | Characters are '/', '\\'\r | |
178 | \r | |
179 | This non-standard function is unique to this implementation.\r | |
180 | \r | |
181 | @param[in] c The character to be tested.\r | |
182 | \r | |
183 | @return Returns nonzero (true) if and only if the value of the parameter c\r | |
184 | can be classified as specified in the description of the function.\r | |
185 | **/\r | |
186 | int isDirSep(int c);\r | |
187 | \r | |
2aa62f2b | 188 | /** The tolower function converts an uppercase letter to a corresponding\r |
189 | lowercase letter.\r | |
190 | \r | |
681cc25c | 191 | @param[in] c The character to be converted.\r |
192 | \r | |
2aa62f2b | 193 | @return If the argument is a character for which isupper is true and\r |
194 | there are one or more corresponding characters, as specified by\r | |
195 | the current locale, for which islower is true, the tolower\r | |
196 | function returns one of the corresponding characters (always the\r | |
197 | same one for any given locale); otherwise, the argument is\r | |
198 | returned unchanged.\r | |
199 | **/\r | |
200 | int tolower(int c);\r | |
201 | \r | |
202 | /** The toupper function converts a lowercase letter to a corresponding\r | |
203 | uppercase letter.\r | |
204 | \r | |
681cc25c | 205 | @param[in] c The character to be converted.\r |
206 | \r | |
2aa62f2b | 207 | @return If the argument is a character for which islower is true and\r |
208 | there are one or more corresponding characters, as specified by\r | |
209 | the current locale, for which isupper is true, the toupper\r | |
210 | function returns one of the corresponding characters (always the\r | |
211 | same one for any given locale); otherwise, the argument is\r | |
212 | returned unchanged.\r | |
213 | **/\r | |
214 | int toupper(int c);\r | |
215 | \r | |
2aa62f2b | 216 | __END_DECLS\r |
217 | \r | |
681cc25c | 218 | /** Character Classification Macros.\r |
219 | Undefine individually or define NO_CTYPE_MACROS, before including <ctype.h>,\r | |
220 | in order to use the Function version of the character classification macros.\r | |
221 | @{\r | |
222 | **/\r | |
2aa62f2b | 223 | #ifndef NO_CTYPE_MACROS\r |
224 | #define isalnum(c) (__isCClass( (int)c, (_CD | _CU | _CL | _XA)))\r | |
225 | #define isalpha(c) (__isCClass( (int)c, (_CU | _CL | _XA)))\r | |
226 | #define iscntrl(c) (__isCClass( (int)c, (_CC)))\r | |
227 | #define isdigit(c) (__isCClass( (int)c, (_CD)))\r | |
228 | #define isgraph(c) (__isCClass( (int)c, (_CG)))\r | |
229 | #define islower(c) (__isCClass( (int)c, (_CL)))\r | |
230 | #define isprint(c) (__isCClass( (int)c, (_CS | _CG)))\r | |
231 | #define ispunct(c) (__isCClass( (int)c, (_CP)))\r | |
232 | #define isspace(c) (__isCClass( (int)c, (_CW)))\r | |
233 | #define isupper(c) (__isCClass( (int)c, (_CU)))\r | |
234 | #define isxdigit(c) (__isCClass( (int)c, (_CD | _CX)))\r | |
0c1992fb | 235 | #define isDirSep(c) (__isCClass( (int)c, (_C0)))\r |
2aa62f2b | 236 | #define tolower(c) (__toLower((int)c))\r |
237 | #define toupper(c) (__toUpper((int)c))\r | |
238 | #endif /* NO_CTYPE_MACROS */\r | |
681cc25c | 239 | ///@}\r |
2aa62f2b | 240 | \r |
241 | #endif /* _CTYPE_H */\r |