xref: /dragonfly/lib/libc/locale/isctype.c (revision b40e316c)
1 /*
2  * Copyright (c) 1989, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  * (c) UNIX System Laboratories, Inc.
5  * All or some portions of this file are derived from material licensed
6  * to the University of California by American Telephone and Telegraph
7  * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8  * the permission of UNIX System Laboratories, Inc.
9  *
10  * This code is derived from software contributed to Berkeley by
11  * Paul Borman at Krystal Technologies.
12  *
13  * Redistribution and use in source and binary forms, with or without
14  * modification, are permitted provided that the following conditions
15  * are met:
16  * 1. Redistributions of source code must retain the above copyright
17  *    notice, this list of conditions and the following disclaimer.
18  * 2. Redistributions in binary form must reproduce the above copyright
19  *    notice, this list of conditions and the following disclaimer in the
20  *    documentation and/or other materials provided with the distribution.
21  * 3. All advertising materials mentioning features or use of this software
22  *    must display the following acknowledgement:
23  *	This product includes software developed by the University of
24  *	California, Berkeley and its contributors.
25  * 4. Neither the name of the University nor the names of its contributors
26  *    may be used to endorse or promote products derived from this software
27  *    without specific prior written permission.
28  *
29  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
30  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
32  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
33  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
35  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
38  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39  * SUCH DAMAGE.
40  *
41  * $FreeBSD: src/lib/libc/locale/isctype.c,v 1.7 2000/02/08 07:43:24 obrien Exp $
42  * $DragonFly: src/lib/libc/locale/Attic/isctype.c,v 1.2 2003/06/17 04:26:44 dillon Exp $
43  *
44  * @(#)isctype.c	8.3 (Berkeley) 2/24/94
45  */
46 
47 #include <ctype.h>
48 
49 #undef digittoint
50 int
51 digittoint(c)
52 	int c;
53 {
54 	return (__maskrune((c), 0xFF));
55 }
56 
57 #undef isalnum
58 int
59 isalnum(c)
60 	int c;
61 {
62 	return (__istype((c), _CTYPE_A|_CTYPE_D));
63 }
64 
65 #undef isalpha
66 int
67 isalpha(c)
68 	int c;
69 {
70 	return (__istype((c), _CTYPE_A));
71 }
72 
73 #undef isascii
74 int
75 isascii(c)
76 	int c;
77 {
78 	return (((c) & ~0x7F) == 0);
79 }
80 
81 #undef isblank
82 int
83 isblank(c)
84 	int c;
85 {
86 	return (__istype((c), _CTYPE_B));
87 }
88 
89 #undef iscntrl
90 int
91 iscntrl(c)
92 	int c;
93 {
94 	return (__istype((c), _CTYPE_C));
95 }
96 
97 #undef isdigit
98 int
99 isdigit(c)
100 	int c;
101 {
102 	return (__isctype((c), _CTYPE_D));
103 }
104 
105 #undef isgraph
106 int
107 isgraph(c)
108 	int c;
109 {
110 	return (__istype((c), _CTYPE_G));
111 }
112 
113 #undef ishexnumber
114 int
115 ishexnumber(c)
116 	int c;
117 {
118 	return (__istype((c), _CTYPE_X));
119 }
120 
121 #undef isideogram
122 int
123 isideogram(c)
124 	int c;
125 {
126 	return (__istype((c), _CTYPE_I));
127 }
128 
129 #undef islower
130 int
131 islower(c)
132 	int c;
133 {
134 	return (__istype((c), _CTYPE_L));
135 }
136 
137 #undef isnumber
138 int
139 isnumber(c)
140 	int c;
141 {
142 	return (__istype((c), _CTYPE_D));
143 }
144 
145 #undef isphonogram
146 int
147 isphonogram(c)
148 	int c;
149 {
150 	return (__istype((c), _CTYPE_Q));
151 }
152 
153 #undef isprint
154 int
155 isprint(c)
156 	int c;
157 {
158 	return (__istype((c), _CTYPE_R));
159 }
160 
161 #undef ispunct
162 int
163 ispunct(c)
164 	int c;
165 {
166 	return (__istype((c), _CTYPE_P));
167 }
168 
169 #undef isrune
170 int
171 isrune(c)
172 	int c;
173 {
174 	return (__istype((c), 0xFFFFFF00L));
175 }
176 
177 #undef isspace
178 int
179 isspace(c)
180 	int c;
181 {
182 	return (__istype((c), _CTYPE_S));
183 }
184 
185 #undef isspecial
186 int
187 isspecial(c)
188 	int c;
189 {
190 	return (__istype((c), _CTYPE_T));
191 }
192 
193 #undef isupper
194 int
195 isupper(c)
196 	int c;
197 {
198 	return (__istype((c), _CTYPE_U));
199 }
200 
201 #undef isxdigit
202 int
203 isxdigit(c)
204 	int c;
205 {
206 	return (__isctype((c), _CTYPE_X));
207 }
208 
209 #undef toascii
210 int
211 toascii(c)
212 	int c;
213 {
214 	return ((c) & 0x7F);
215 }
216 
217 #undef tolower
218 int
219 tolower(c)
220 	int c;
221 {
222         return (__tolower(c));
223 }
224 
225 #undef toupper
226 int
227 toupper(c)
228 	int c;
229 {
230         return (__toupper(c));
231 }
232 
233