]> git.proxmox.com Git - mirror_edk2.git/blame - StdLib/Include/ctype.h
Update or add comments to files and functions for use by Doxygen.
[mirror_edk2.git] / StdLib / Include / ctype.h
CommitLineData
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
43int 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
56int isalpha(int c);\r
57\r
58/** The iscntrl function tests for any control character.\r
59\r
681cc25c 60 @param[in] c The character to be tested.\r
61\r
62 @return Returns nonzero (true) if and only if the value of the parameter c\r
63 can be classified as specified in the description of the function.\r
2aa62f2b 64**/\r
65int iscntrl(int c);\r
66\r
67/** The isdigit function tests for any decimal-digit character.\r
68\r
681cc25c 69 @param[in] c The character to be tested.\r
70\r
71 @return Returns nonzero (true) if and only if the value of the parameter c\r
72 can be classified as specified in the description of the function.\r
2aa62f2b 73**/\r
74int isdigit(int c);\r
75\r
76/** The isgraph function tests for any printing character except space (' ').\r
77\r
681cc25c 78 @param[in] c The character to be tested.\r
79\r
80 @return Returns nonzero (true) if and only if the value of the parameter c\r
81 can be classified as specified in the description of the function.\r
2aa62f2b 82**/\r
83int isgraph(int c);\r
84\r
85/** The islower function tests for any character that is a lowercase letter or\r
86 is one of a locale-specific set of characters for which none of iscntrl,\r
87 isdigit, ispunct, or isspace is true. In the "C" locale, islower returns\r
88 true only for the lowercase letters.\r
89\r
681cc25c 90 @param[in] c The character to be tested.\r
91\r
92 @return Returns nonzero (true) if and only if the value of the parameter c\r
93 can be classified as specified in the description of the function.\r
2aa62f2b 94**/\r
95int islower(int c);\r
96\r
97/** The isprint function tests for any printing character including space (' ').\r
98\r
681cc25c 99 @param[in] c The character to be tested.\r
100\r
101 @return Returns nonzero (true) if and only if the value of the parameter c\r
102 can be classified as specified in the description of the function.\r
2aa62f2b 103**/\r
104int isprint(int c);\r
105\r
106/** The ispunct function tests for any printing character that is one of a\r
107 locale-specific set of punctuation characters for which neither isspace nor\r
108 isalnum is true. In the "C" locale, ispunct returns true for every printing\r
109 character for which neither isspace nor isalnum is true.\r
110\r
681cc25c 111 @param[in] c The character to be tested.\r
112\r
113 @return Returns nonzero (true) if and only if the value of the parameter c\r
114 can be classified as specified in the description of the function.\r
2aa62f2b 115**/\r
116int ispunct(int c);\r
117\r
118/** The isspace function tests for any character that is a standard white-space\r
119 character or is one of a locale-specific set of characters for which\r
120 isalnum is false. The standard white-space characters are the following:\r
121 space (' '), form feed ('\f'), new-line ('\n'), carriage return ('\r'),\r
122 horizontal tab ('\t'), and vertical tab ('\v'). In the "C" locale, isspace\r
123 returns true only for the standard white-space characters.\r
124\r
681cc25c 125 @param[in] c The character to be tested.\r
126\r
127 @return Returns nonzero (true) if and only if the value of the parameter c\r
128 can be classified as specified in the description of the function.\r
2aa62f2b 129**/\r
130int isspace(int c);\r
131\r
132/** The isupper function tests for any character that is an uppercase letter or\r
133 is one of a locale-specific set of characters for which none of iscntrl,\r
134 isdigit, ispunct, or isspace is true. In the "C" locale, isupper returns\r
135 true only for the uppercase letters.\r
136\r
681cc25c 137 @param[in] c The character to be tested.\r
138\r
139 @return Returns nonzero (true) if and only if the value of the parameter c\r
140 can be classified as specified in the description of the function.\r
2aa62f2b 141**/\r
142int isupper(int c);\r
143\r
144/** The isxdigit function tests for any hexadecimal-digit character.\r
145\r
681cc25c 146 @param[in] c The character to be tested.\r
147\r
148 @return Returns nonzero (true) if and only if the value of the parameter c\r
149 can be classified as specified in the description of the function.\r
2aa62f2b 150**/\r
151int isxdigit(int c);\r
152\r
681cc25c 153/** The isblank function tests that a character is a white-space character that results\r
154 in a number of space (' ') characters being sent to the output device. In the C locale\r
155 this is either ' ' or '\t'.\r
2aa62f2b 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
161**/\r
162int isblank(int);\r
163\r
164/** The isascii function tests that a character is one of the 128 7-bit ASCII characters.\r
165\r
166 @param[in] c The character to be tested.\r
167\r
168 @return Returns nonzero (true) if and only if the value of the parameter c\r
169 can be classified as specified in the description of the function.\r
2aa62f2b 170**/\r
171int isascii(int c);\r
172\r
173/** The tolower function converts an uppercase letter to a corresponding\r
174 lowercase letter.\r
175\r
681cc25c 176 @param[in] c The character to be converted.\r
177\r
2aa62f2b 178 @return If the argument is a character for which isupper is true and\r
179 there are one or more corresponding characters, as specified by\r
180 the current locale, for which islower is true, the tolower\r
181 function returns one of the corresponding characters (always the\r
182 same one for any given locale); otherwise, the argument is\r
183 returned unchanged.\r
184**/\r
185int tolower(int c);\r
186\r
187/** The toupper function converts a lowercase letter to a corresponding\r
188 uppercase letter.\r
189\r
681cc25c 190 @param[in] c The character to be converted.\r
191\r
2aa62f2b 192 @return If the argument is a character for which islower is true and\r
193 there are one or more corresponding characters, as specified by\r
194 the current locale, for which isupper is true, the toupper\r
195 function returns one of the corresponding characters (always the\r
196 same one for any given locale); otherwise, the argument is\r
197 returned unchanged.\r
198**/\r
199int toupper(int c);\r
200\r
2aa62f2b 201__END_DECLS\r
202\r
681cc25c 203/** Character Classification Macros.\r
204 Undefine individually or define NO_CTYPE_MACROS, before including <ctype.h>,\r
205 in order to use the Function version of the character classification macros.\r
206@{\r
207**/\r
2aa62f2b 208#ifndef NO_CTYPE_MACROS\r
209 #define isalnum(c) (__isCClass( (int)c, (_CD | _CU | _CL | _XA)))\r
210 #define isalpha(c) (__isCClass( (int)c, (_CU | _CL | _XA)))\r
211 #define iscntrl(c) (__isCClass( (int)c, (_CC)))\r
212 #define isdigit(c) (__isCClass( (int)c, (_CD)))\r
213 #define isgraph(c) (__isCClass( (int)c, (_CG)))\r
214 #define islower(c) (__isCClass( (int)c, (_CL)))\r
215 #define isprint(c) (__isCClass( (int)c, (_CS | _CG)))\r
216 #define ispunct(c) (__isCClass( (int)c, (_CP)))\r
217 #define isspace(c) (__isCClass( (int)c, (_CW)))\r
218 #define isupper(c) (__isCClass( (int)c, (_CU)))\r
219 #define isxdigit(c) (__isCClass( (int)c, (_CD | _CX)))\r
220 #define tolower(c) (__toLower((int)c))\r
221 #define toupper(c) (__toUpper((int)c))\r
222#endif /* NO_CTYPE_MACROS */\r
681cc25c 223///@}\r
2aa62f2b 224\r
225#endif /* _CTYPE_H */\r