OSDN Git Service

A number of updates from Manuel Novoa III. Things look good...
[uclinux-h8/uClibc.git] / libc / misc / ctype / ctype.c
1 /* ctype.c      
2  * Character classification and conversion
3  * Copyright (C) 2000 Lineo, Inc.
4  * Written by Erik Andersen
5  * This file is part of the uClibc C library and is distributed
6  * under the GNU Library General Public License.
7  */
8
9 #define USE_CTYPE_C_FUNCTIONS
10 #include <ctype.h>
11
12 #ifdef L_isalnum
13 int
14 isalnum( int c )
15 {
16     return (isalpha(c) || isdigit(c));
17 }
18 #endif
19
20 #ifdef L_isalpha
21 int
22 isalpha( int c )
23 {
24     return (isupper(c) || islower(c));
25 }
26 #endif
27
28 #ifdef L_isascii
29 int
30 isascii( int c )
31 {
32     return (c > 0 && c <= 0x7f);
33 }
34 #endif
35
36 #ifdef L_iscntrl
37 int
38 iscntrl( int c )
39 {
40     return ((c > 0) && ((c <= 0x1f) || (c == 0x7f)));
41 }
42 #endif
43
44 #ifdef L_isdigit
45 int
46 isdigit( int c )
47 {
48     return (c >= '0' && c <= '9');
49 }
50 #endif
51
52 #ifdef L_isgraph
53 int
54 isgraph( int c )
55 {
56     return (c != ' ' && isprint(c));
57 }
58 #endif
59
60 #ifdef L_islower
61 int
62 islower( int c )
63 {
64     return (c >=  'a' && c <= 'z');
65 }
66 #endif
67
68 #ifdef L_isprint
69 int
70 isprint( int c )
71 {
72     return (c >= ' ' && c <= '~');
73 }
74 #endif
75
76 #ifdef L_ispunct
77 int
78 ispunct( int c )
79 {
80     return ((c > ' ' && c <= '~') && !isalnum(c));
81 }
82 #endif
83
84 #ifdef L_isspace
85 int
86 isspace( int c )
87 {
88     return (c == ' ' || c == '\f' || c == '\n' || c == '\r' ||
89             c == '\t' || c == '\v');
90 }
91 #endif
92
93 #ifdef L_isupper
94 int
95 isupper( int c )
96 {
97     return (c >=  'A' && c <= 'Z');
98 }
99 #endif
100
101 #ifdef L_isxdigit
102 int
103 isxdigit( int c )
104 {
105     return (isxupper(c) || isxlower(c));
106 }
107 #endif
108
109 #ifdef L_isxlower
110 int
111 isxlower( int c )
112 {
113     return (isdigit(c) || (c >= 'a' && c <= 'f'));
114 }
115 #endif
116
117 #ifdef L_isxupper
118 int
119 isxupper( int c )
120 {
121     return (isdigit(c) || (c >= 'A' && c <= 'F'));
122 }
123 #endif
124
125 #ifdef L_toascii
126 int
127 toascii( int c )
128 {
129     return (c & 0x7f);
130 }
131 #endif
132
133 #ifdef L_tolower
134 int
135 tolower( int c )
136 {
137     return (isupper(c) ? ( c - 'A' + 'a') : (c));
138 }
139 #endif
140
141 #ifdef L_toupper
142 int
143 toupper( int c )
144 {
145     return (islower(c) ? (c - 'a' + 'A') : (c));
146 }
147 #endif