]> git.saurik.com Git - apple/libc.git/blob - locale.subproj/isctype.c
Libc-186.tar.gz
[apple/libc.git] / locale.subproj / isctype.c
1 /*
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22 /*
23 * Copyright (c) 1989, 1993
24 * The Regents of the University of California. All rights reserved.
25 * (c) UNIX System Laboratories, Inc.
26 * All or some portions of this file are derived from material licensed
27 * to the University of California by American Telephone and Telegraph
28 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
29 * the permission of UNIX System Laboratories, Inc.
30 *
31 * This code is derived from software contributed to Berkeley by
32 * Paul Borman at Krystal Technologies.
33 *
34 * Redistribution and use in source and binary forms, with or without
35 * modification, are permitted provided that the following conditions
36 * are met:
37 * 1. Redistributions of source code must retain the above copyright
38 * notice, this list of conditions and the following disclaimer.
39 * 2. Redistributions in binary form must reproduce the above copyright
40 * notice, this list of conditions and the following disclaimer in the
41 * documentation and/or other materials provided with the distribution.
42 * 3. All advertising materials mentioning features or use of this software
43 * must display the following acknowledgement:
44 * This product includes software developed by the University of
45 * California, Berkeley and its contributors.
46 * 4. Neither the name of the University nor the names of its contributors
47 * may be used to endorse or promote products derived from this software
48 * without specific prior written permission.
49 *
50 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
51 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
52 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
53 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
54 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
55 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
56 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
57 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
58 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
59 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
60 * SUCH DAMAGE.
61 */
62
63
64 #define _ANSI_LIBRARY
65 #include <ctype.h>
66
67 #undef isalnum
68 int
69 isalnum(c)
70 int c;
71 {
72 return(__istype((c), (_A|_D)));
73 }
74
75 #undef isalpha
76 int
77 isalpha(c)
78 int c;
79 {
80 return (__istype((c), _A));
81 }
82
83 #undef isascii
84 int
85 isascii(c)
86 int c;
87 {
88 return((c & ~0x7F) == 0);
89 }
90
91 #undef isblank
92 int
93 isblank(c)
94 int c;
95 {
96 return (__istype((c), _B));
97 }
98
99 #undef iscntrl
100 int
101 iscntrl(c)
102 int c;
103 {
104 return (__istype((c), _C));
105 }
106
107 #undef isdigit
108 int
109 isdigit(c)
110 int c;
111 {
112 return (__isctype((c), _D));
113 }
114
115 #undef isgraph
116 int
117 isgraph(c)
118 int c;
119 {
120 return (__istype((c), _G));
121 }
122
123 #undef islower
124 int
125 islower(c)
126 int c;
127 {
128 return (__istype((c), _L));
129 }
130
131 #undef isprint
132 int
133 isprint(c)
134 int c;
135 {
136 return (__istype((c), _R));
137 }
138
139 #undef ispunct
140 int
141 ispunct(c)
142 int c;
143 {
144 return (__istype((c), _P));
145 }
146
147 #undef isspace
148 int
149 isspace(c)
150 int c;
151 {
152 return (__istype((c), _S));
153 }
154
155 #undef isupper
156 int
157 isupper(c)
158 int c;
159 {
160 return (__istype((c), _U));
161 }
162
163 #undef isxdigit
164 int
165 isxdigit(c)
166 int c;
167 {
168 return (__isctype((c), _X));
169 }
170
171 #undef toascii
172 int
173 toascii(c)
174 int c;
175 {
176 return (c & 0177);
177 }
178
179 #undef tolower
180 int
181 tolower(c)
182 int c;
183 {
184 return((c & _CRMASK) ? ___tolower(c) : _CurrentRuneLocale->maplower[c]);
185 }
186
187 #undef toupper
188 int
189 toupper(c)
190 int c;
191 {
192 return((c & _CRMASK) ? ___toupper(c) : _CurrentRuneLocale->mapupper[c]);
193 }