]> git.proxmox.com Git - mirror_edk2.git/blame - StdLib/Include/ctype.h
Fix the bug that WinNtBlockIo fails to properly allocate a buffer.
[mirror_edk2.git] / StdLib / Include / ctype.h
CommitLineData
2aa62f2b 1/** @file\r
2 Single-byte character classification and case conversion macros and\r
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
14 set of characters, each of which occupies one printing position on a display\r
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
18 Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>\r
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
22 http://opensource.org/licenses/bsd-license.php.\r
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
26\r
27**/\r
28#ifndef _CTYPE_H\r
29#define _CTYPE_H\r
30#include <sys/EfiCdefs.h>\r
31#include <sys/_ctype.h>\r
32\r
33__BEGIN_DECLS\r
34// Declarations for the classification Functions\r
35\r
36/** The isalnum function tests for any character for which isalpha or isdigit\r
37 is true.\r
38\r
39 @return Returns nonzero (true) if and only if the value of the argument c\r
40 conforms to that in the description of the function.\r
41**/\r
42int isalnum(int c);\r
43\r
44/** The isalpha function tests for any character for which isupper or islower\r
45 is true, or any character that is one of a locale-specific set of\r
46 alphabetic characters for which none of iscntrl, isdigit, ispunct, or\r
47 isspace is true. In the "C" locale, isalpha returns true only for the\r
48 characters for which isupper or islower is true.\r
49\r
50 @return Returns nonzero (true) if and only if the value of the argument c\r
51 conforms to that in the description of the function.\r
52**/\r
53int isalpha(int c);\r
54\r
55/** The iscntrl function tests for any control character.\r
56\r
57 @return Returns nonzero (true) if and only if the value of the argument c\r
58 conforms to that in the description of the function.\r
59**/\r
60int iscntrl(int c);\r
61\r
62/** The isdigit function tests for any decimal-digit character.\r
63\r
64 @return Returns nonzero (true) if and only if the value of the argument c\r
65 conforms to that in the description of the function.\r
66**/\r
67int isdigit(int c);\r
68\r
69/** The isgraph function tests for any printing character except space (' ').\r
70\r
71 @return Returns nonzero (true) if and only if the value of the argument c\r
72 conforms to that in the description of the function.\r
73**/\r
74int isgraph(int c);\r
75\r
76/** The islower function tests for any character that is a lowercase letter or\r
77 is one of a locale-specific set of characters for which none of iscntrl,\r
78 isdigit, ispunct, or isspace is true. In the "C" locale, islower returns\r
79 true only for the lowercase letters.\r
80\r
81 @return Returns nonzero (true) if and only if the value of the argument c\r
82 conforms to that in the description of the function.\r
83**/\r
84int islower(int c);\r
85\r
86/** The isprint function tests for any printing character including space (' ').\r
87\r
88 @return Returns nonzero (true) if and only if the value of the argument c\r
89 conforms to that in the description of the function.\r
90**/\r
91int isprint(int c);\r
92\r
93/** The ispunct function tests for any printing character that is one of a\r
94 locale-specific set of punctuation characters for which neither isspace nor\r
95 isalnum is true. In the "C" locale, ispunct returns true for every printing\r
96 character for which neither isspace nor isalnum is true.\r
97\r
98 @return Returns nonzero (true) if and only if the value of the argument c\r
99 conforms to that in the description of the function.\r
100**/\r
101int ispunct(int c);\r
102\r
103/** The isspace function tests for any character that is a standard white-space\r
104 character or is one of a locale-specific set of characters for which\r
105 isalnum is false. The standard white-space characters are the following:\r
106 space (' '), form feed ('\f'), new-line ('\n'), carriage return ('\r'),\r
107 horizontal tab ('\t'), and vertical tab ('\v'). In the "C" locale, isspace\r
108 returns true only for the standard white-space characters.\r
109\r
110 @return Returns nonzero (true) if and only if the value of the argument c\r
111 conforms to that in the description of the function.\r
112**/\r
113int isspace(int c);\r
114\r
115/** The isupper function tests for any character that is an uppercase letter or\r
116 is one of a locale-specific set of characters for which none of iscntrl,\r
117 isdigit, ispunct, or isspace is true. In the "C" locale, isupper returns\r
118 true only for the uppercase letters.\r
119\r
120 @return Returns nonzero (true) if and only if the value of the argument c\r
121 conforms to that in the description of the function.\r
122**/\r
123int isupper(int c);\r
124\r
125/** The isxdigit function tests for any hexadecimal-digit character.\r
126\r
127 @return Returns nonzero (true) if and only if the value of the argument c\r
128 conforms to that in the description of the function.\r
129**/\r
130int isxdigit(int c);\r
131\r
132/** The isascii function tests that a character is one of the 128 ASCII characters.\r
133\r
134 @param[in] c The character to test.\r
135 @return Returns nonzero (true) if c is a valid ASCII character. Otherwize,\r
136 zero (false) is returned.\r
137**/\r
138int isascii(int c);\r
139\r
140/** The tolower function converts an uppercase letter to a corresponding\r
141 lowercase letter.\r
142\r
143 @return If the argument is a character for which isupper is true and\r
144 there are one or more corresponding characters, as specified by\r
145 the current locale, for which islower is true, the tolower\r
146 function returns one of the corresponding characters (always the\r
147 same one for any given locale); otherwise, the argument is\r
148 returned unchanged.\r
149**/\r
150int tolower(int c);\r
151\r
152/** The toupper function converts a lowercase letter to a corresponding\r
153 uppercase letter.\r
154\r
155 @return If the argument is a character for which islower is true and\r
156 there are one or more corresponding characters, as specified by\r
157 the current locale, for which isupper is true, the toupper\r
158 function returns one of the corresponding characters (always the\r
159 same one for any given locale); otherwise, the argument is\r
160 returned unchanged.\r
161**/\r
162int toupper(int c);\r
163\r
164int isblank(int);\r
165\r
166__END_DECLS\r
167\r
168// Character Classification Macros\r
169// Undefine individually or define NO_CTYPE_MACROS, before including <ctype.h>,\r
170// in order to use the Function version of the character classification macros.\r
171#ifndef NO_CTYPE_MACROS\r
172 #define isalnum(c) (__isCClass( (int)c, (_CD | _CU | _CL | _XA)))\r
173 #define isalpha(c) (__isCClass( (int)c, (_CU | _CL | _XA)))\r
174 #define iscntrl(c) (__isCClass( (int)c, (_CC)))\r
175 #define isdigit(c) (__isCClass( (int)c, (_CD)))\r
176 #define isgraph(c) (__isCClass( (int)c, (_CG)))\r
177 #define islower(c) (__isCClass( (int)c, (_CL)))\r
178 #define isprint(c) (__isCClass( (int)c, (_CS | _CG)))\r
179 #define ispunct(c) (__isCClass( (int)c, (_CP)))\r
180 #define isspace(c) (__isCClass( (int)c, (_CW)))\r
181 #define isupper(c) (__isCClass( (int)c, (_CU)))\r
182 #define isxdigit(c) (__isCClass( (int)c, (_CD | _CX)))\r
183 #define tolower(c) (__toLower((int)c))\r
184 #define toupper(c) (__toUpper((int)c))\r
185#endif /* NO_CTYPE_MACROS */\r
186\r
187#endif /* _CTYPE_H */\r