]>
Commit | Line | Data |
---|---|---|
51631861 A |
1 | /* |
2 | * Copyright (c) 2003 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
6 | * This file contains Original Code and/or Modifications of Original Code | |
7 | * as defined in and that are subject to the Apple Public Source License | |
8 | * Version 2.0 (the 'License'). You may not use this file except in | |
9 | * compliance with the License. Please obtain a copy of the License at | |
10 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
11 | * file. | |
12 | * | |
13 | * The Original Code and all software distributed under the License are | |
14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
18 | * Please see the License for the specific language governing rights and | |
19 | * limitations under the License. | |
20 | * | |
21 | * @APPLE_LICENSE_HEADER_END@ | |
22 | */ | |
9385eb3d A |
23 | /*- |
24 | * Copyright (c)1999 Citrus Project, | |
25 | * All rights reserved. | |
26 | * | |
27 | * Redistribution and use in source and binary forms, with or without | |
28 | * modification, are permitted provided that the following conditions | |
29 | * are met: | |
30 | * 1. Redistributions of source code must retain the above copyright | |
31 | * notice, this list of conditions and the following disclaimer. | |
32 | * 2. Redistributions in binary form must reproduce the above copyright | |
33 | * notice, this list of conditions and the following disclaimer in the | |
34 | * documentation and/or other materials provided with the distribution. | |
35 | * | |
36 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
37 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
39 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
40 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
41 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
42 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
43 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
44 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
45 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
46 | * SUCH DAMAGE. | |
47 | * | |
48 | * citrus Id: wctype.h,v 1.4 2000/12/21 01:50:21 itojun Exp | |
49 | * $NetBSD: wctype.h,v 1.3 2000/12/22 14:16:16 itojun Exp $ | |
50 | * $FreeBSD: /repoman/r/ncvs/src/include/wctype.h,v 1.10 2002/08/21 16:19:55 mike Exp $ | |
51 | */ | |
52 | ||
53 | #ifndef _WCTYPE_H_ | |
54 | #define _WCTYPE_H_ | |
55 | ||
56 | #include <sys/cdefs.h> | |
57 | #include <sys/types.h> | |
58 | ||
59 | #include <ctype.h> | |
60 | ||
61 | #ifndef _BSD_CT_RUNE_T_DEFINED_ | |
62 | #define _BSD_CT_RUNE_T_DEFINED_ | |
63 | typedef _BSD_CT_RUNE_T_ ct_rune_t; | |
64 | #endif | |
65 | ||
66 | #ifndef _BSD_RUNE_T_DEFINED_ | |
67 | #define _BSD_RUNE_T_DEFINED_ | |
68 | typedef _BSD_RUNE_T_ rune_t; | |
69 | #endif | |
70 | ||
71 | #ifndef __cplusplus | |
72 | #ifndef _BSD_WCHAR_T_DEFINED_ | |
73 | #define _BSD_WCHAR_T_DEFINED_ | |
74 | #ifdef __WCHAR_TYPE__ | |
75 | typedef __WCHAR_TYPE__ wchar_t; | |
76 | #else /* ! __WCHAR_TYPE__ */ | |
77 | typedef _BSD_WCHAR_T_ wchar_t; | |
78 | #endif /* __WCHAR_TYPE__ */ | |
79 | #endif /* _BSD_WCHAR_T_DEFINED_ */ | |
80 | #endif /* __cplusplus */ | |
81 | ||
82 | #ifndef _BSD_WINT_T_DEFINED_ | |
83 | #define _BSD_WINT_T_DEFINED_ | |
84 | typedef _BSD_WINT_T_ wint_t; | |
85 | #endif | |
86 | ||
87 | #ifndef _WCTRANS_T | |
88 | typedef int wctrans_t; | |
89 | #define _WCTRANS_T | |
90 | #endif | |
91 | ||
92 | #ifndef _WCTYPE_T | |
93 | typedef unsigned long wctype_t; | |
94 | #define _WCTYPE_T | |
95 | #endif | |
96 | ||
97 | #ifndef WEOF | |
98 | #define WEOF ((wint_t)-1) | |
99 | #endif | |
100 | ||
101 | __BEGIN_DECLS | |
102 | int iswalnum(wint_t); | |
103 | int iswalpha(wint_t); | |
104 | int iswblank(wint_t); | |
105 | int iswcntrl(wint_t); | |
106 | int iswctype(wint_t, wctype_t); | |
107 | int iswdigit(wint_t); | |
108 | int iswgraph(wint_t); | |
109 | int iswlower(wint_t); | |
110 | int iswprint(wint_t); | |
111 | int iswpunct(wint_t); | |
112 | int iswspace(wint_t); | |
113 | int iswupper(wint_t); | |
114 | int iswxdigit(wint_t); | |
115 | wint_t towctrans(wint_t, wctrans_t); | |
116 | wint_t towlower(wint_t); | |
117 | wint_t towupper(wint_t); | |
118 | wctrans_t | |
119 | wctrans(const char *); | |
120 | wctype_t | |
121 | wctype(const char *); | |
122 | ||
123 | #if !defined(_ANSI_SOURCE) | |
124 | wint_t iswascii(wint_t); | |
125 | wint_t iswhexnumber(wint_t); | |
126 | wint_t iswideogram(wint_t); | |
127 | wint_t iswnumber(wint_t); | |
128 | wint_t iswphonogram(wint_t); | |
129 | wint_t iswrune(wint_t); | |
130 | wint_t iswspecial(wint_t); | |
131 | #endif | |
132 | __END_DECLS | |
133 | ||
134 | #define iswalnum(wc) __istype((wc), _CTYPE_A|_CTYPE_D) | |
135 | #define iswalpha(wc) __istype((wc), _CTYPE_A) | |
136 | #define iswblank(wc) __istype((wc), _CTYPE_B) | |
137 | #define iswcntrl(wc) __istype((wc), _CTYPE_C) | |
138 | #define iswctype(wc, charclass) __istype((wc), (charclass)) | |
139 | #define iswdigit(wc) __istype((wc), _CTYPE_D) | |
140 | #define iswgraph(wc) __istype((wc), _CTYPE_G) | |
141 | #define iswlower(wc) __istype((wc), _CTYPE_L) | |
142 | #define iswprint(wc) __istype((wc), _CTYPE_R) | |
143 | #define iswpunct(wc) __istype((wc), _CTYPE_P) | |
144 | #define iswspace(wc) __istype((wc), _CTYPE_S) | |
145 | #define iswupper(wc) __istype((wc), _CTYPE_U) | |
146 | #define iswxdigit(wc) __istype((wc), _CTYPE_X) | |
147 | #define towlower(wc) __tolower(wc) | |
148 | #define towupper(wc) __toupper(wc) | |
149 | ||
150 | #if !defined(_ANSI_SOURCE) | |
151 | #define iswascii(wc) (((wc) & ~0x7F) == 0) | |
152 | #define iswhexnumber(wc) __istype((wc), _CTYPE_X) | |
153 | #define iswideogram(wc) __istype((wc), _CTYPE_I) | |
154 | #define iswnumber(wc) __istype((wc), _CTYPE_D) | |
155 | #define iswphonogram(wc) __istype((wc), _CTYPE_Q) | |
156 | #define iswrune(wc) __istype((wc), 0xFFFFFF00L) | |
157 | #define iswspecial(wc) __istype((wc), _CTYPE_T) | |
158 | #endif | |
159 | ||
160 | #endif /* _WCTYPE_H_ */ |