Samsung Internal API reference  2.0
ctype.h
Go to the documentation of this file.
1 
10 /*-
11  * Copyright (c) 1982, 1988, 1991, 1993
12  * The Regents of the University of California. All rights reserved.
13  * (c) UNIX System Laboratories, Inc.
14  * All or some portions of this file are derived from material licensed
15  * to the University of California by American Telephone and Telegraph
16  * Co. or Unix System Laboratories, Inc. and are reproduced herein with
17  * the permission of UNIX System Laboratories, Inc.
18  *
19  * Redistribution and use in source and binary forms, with or without
20  * modification, are permitted provided that the following conditions
21  * are met:
22  * 1. Redistributions of source code must retain the above copyright
23  * notice, this list of conditions and the following disclaimer.
24  * 2. Redistributions in binary form must reproduce the above copyright
25  * notice, this list of conditions and the following disclaimer in the
26  * documentation and/or other materials provided with the distribution.
27  * 4. Neither the name of the University nor the names of its contributors
28  * may be used to endorse or promote products derived from this software
29  * without specific prior written permission.
30  *
31  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
32  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
33  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
34  * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
35  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
39  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
40  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
41  * SUCH DAMAGE.
42  *
43  * $FreeBSD$
44  */
45 
46 /*
47  * Portions copyright (c) 2009-2014, ARM Limited and Contributors.
48  * All rights reserved.
49  */
50 
51 #ifndef __CTYPE_H__
52 #define __CTYPE_H__
53 
54 #ifdef __cplusplus
55 extern "C" {
56 #endif
57 
67 static inline int isspace(int c)
68 {
69  return c == ' ' || (c >= '\t' && c <= '\r');
70 }
71 
81 static inline int isascii(int c)
82 {
83  return !(c & ~0x7f);
84 }
85 
93 static inline int isupper(int c)
94 {
95  return c >= 'A' && c <= 'Z';
96 }
97 
105 static inline int islower(int c)
106 {
107  return c >= 'a' && c <= 'z';
108 }
109 
118 static inline int isalpha(int c)
119 {
120  return isupper(c) || islower(c);
121 }
122 
130 static inline int isdigit(int c)
131 {
132  return c >= '0' && c <= '9';
133 }
134 
143 static inline int isalnum(int c)
144 {
145  return isdigit(c) || isalpha(c);
146 }
147 
155 static inline int isblank(int c)
156 {
157  return c == ' ' || c == '\t';
158 }
159 
168 static inline int isxdigit(int c)
169 {
170  return isdigit(c) || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f');
171 }
172 
180 static inline int isprint(int c)
181 {
182  return c >= ' ' && c <= '~';
183 }
184 
192 static inline int isgraph(int c)
193 {
194  return c != ' ' && isprint(c);
195 }
196 
205 static inline int ispunct(int c)
206 {
207  return isgraph(c) && !isalnum(c);
208 }
209 
217 static inline int iscntrl(int c)
218 {
219  return !isprint(c);
220 }
221 
229 static inline int toupper(int c)
230 {
231  return c - 0x20 * (c >= 'a' && c <= 'z');
232 }
233 
241 static inline int tolower(int c)
242 {
243  return c + 0x20 * (c >= 'A' && c <= 'Z');
244 }
245 
246 #ifdef __cplusplus
247 }
248 #endif
249 
250 #endif /* !__CTYPE_H__ */
static int isgraph(int c)
Check for any printable character except space.
Definition: ctype.h:192
static int ispunct(int c)
Check for any printable character which is not a space or an alphanumeric character.
Definition: ctype.h:205
static int tolower(int c)
Convert uppercase letter to lowercase.
Definition: ctype.h:241
static int isspace(int c)
Check for white-space characters. These are: space, form-feed (&#39;\f&#39;), newline (&#39;\n&#39;), carriage return (&#39;\r&#39;), horizontal tab (&#39;\t&#39;), and vertical tab (&#39;\v&#39;).
Definition: ctype.h:67
static int isxdigit(int c)
Check for hexadecimal digits, that is, one of 0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F...
Definition: ctype.h:168
static int isprint(int c)
Check for any printable character including space.
Definition: ctype.h:180
static int toupper(int c)
Convert lowercase letter to uppercase.
Definition: ctype.h:229
static int iscntrl(int c)
Check for a control character.
Definition: ctype.h:217
static int isalnum(int c)
Check for an alphanumeric character; it is equivalent to (isalpha(c) || isdigit(c)).
Definition: ctype.h:143
static int isalpha(int c)
Check for an alphabetic character; it is equivalent to (isupper(c) || islower(c)) ...
Definition: ctype.h:118
static int isupper(int c)
Check for an uppercase letter.
Definition: ctype.h:93
static int isblank(int c)
Check for a blank character; that is, a space or a tab.
Definition: ctype.h:155
static int isascii(int c)
Check whether c is a 7-bit unsigned char value that fits into the ASCII character set...
Definition: ctype.h:81
static int islower(int c)
Check for an lowercase letter.
Definition: ctype.h:105
static int isdigit(int c)
Check for a digit (0 through 9)
Definition: ctype.h:130