]> git.proxmox.com Git - mirror_edk2.git/blob - StdLib/Include/ctype.h
Update or add comments to files and functions for use by Doxygen.
[mirror_edk2.git] / StdLib / Include / ctype.h
1 /** @file
2 Single-byte character classification, case conversion macros, and
3 function declarations.
4
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.
9
10 The behavior of these functions is affected by the current locale. The
11 default is the "C" locale.
12
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.
17
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.
23
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.
26 **/
27 #ifndef _CTYPE_H
28 #define _CTYPE_H
29 #include <sys/EfiCdefs.h>
30 #include <sys/_ctype.h>
31
32 __BEGIN_DECLS
33 // Declarations for the classification Functions
34
35 /** The isalnum function tests for any character for which isalpha or isdigit
36 is true.
37
38 @param[in] c The character to be tested.
39
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.
42 **/
43 int isalnum(int c);
44
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.
50
51 @param[in] c The character to be tested.
52
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.
55 **/
56 int isalpha(int c);
57
58 /** The iscntrl function tests for any control character.
59
60 @param[in] c The character to be tested.
61
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.
64 **/
65 int iscntrl(int c);
66
67 /** The isdigit function tests for any decimal-digit character.
68
69 @param[in] c The character to be tested.
70
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.
73 **/
74 int isdigit(int c);
75
76 /** The isgraph function tests for any printing character except space (' ').
77
78 @param[in] c The character to be tested.
79
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.
82 **/
83 int isgraph(int c);
84
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.
89
90 @param[in] c The character to be tested.
91
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.
94 **/
95 int islower(int c);
96
97 /** The isprint function tests for any printing character including space (' ').
98
99 @param[in] c The character to be tested.
100
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.
103 **/
104 int isprint(int c);
105
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.
110
111 @param[in] c The character to be tested.
112
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.
115 **/
116 int ispunct(int c);
117
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.
124
125 @param[in] c The character to be tested.
126
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.
129 **/
130 int isspace(int c);
131
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.
136
137 @param[in] c The character to be tested.
138
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.
141 **/
142 int isupper(int c);
143
144 /** The isxdigit function tests for any hexadecimal-digit character.
145
146 @param[in] c The character to be tested.
147
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.
150 **/
151 int isxdigit(int c);
152
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'.
156
157 @param[in] c The character to be tested.
158
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.
161 **/
162 int isblank(int);
163
164 /** The isascii function tests that a character is one of the 128 7-bit ASCII characters.
165
166 @param[in] c The character to be tested.
167
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.
170 **/
171 int isascii(int c);
172
173 /** The tolower function converts an uppercase letter to a corresponding
174 lowercase letter.
175
176 @param[in] c The character to be converted.
177
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
183 returned unchanged.
184 **/
185 int tolower(int c);
186
187 /** The toupper function converts a lowercase letter to a corresponding
188 uppercase letter.
189
190 @param[in] c The character to be converted.
191
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
197 returned unchanged.
198 **/
199 int toupper(int c);
200
201 __END_DECLS
202
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.
206 @{
207 **/
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 */
223 ///@}
224
225 #endif /* _CTYPE_H */