Print this page
2964 need POSIX 2008 locale object support
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
Approved by: TBD
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/head/iso/ctype_iso.h
+++ new/usr/src/head/iso/ctype_iso.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License, Version 1.0 only
6 6 * (the "License"). You may not use this file except in compliance
7 7 * with the License.
8 8 *
9 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 * or http://www.opensolaris.org/os/licensing.
11 11 * See the License for the specific language governing permissions
12 12 * and limitations under the License.
13 13 *
14 14 * When distributing Covered Code, include this CDDL HEADER in each
15 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 16 * If applicable, add the following below this CDDL HEADER, with the
17 17 * fields enclosed by brackets "[]" replaced with your own identifying
18 18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 19 *
↓ open down ↓ |
19 lines elided |
↑ open up ↑ |
20 20 * CDDL HEADER END
21 21 */
22 22 /* Copyright (c) 1988 AT&T */
23 23 /* All Rights Reserved */
24 24
25 25
26 26 /*
27 27 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
28 28 * Use is subject to license terms.
29 29 */
30 +/*
31 + * Copyright 2013 Garrett D'Amore <garrett@damore.org>
32 + */
30 33
31 34 /*
32 35 * An application should not include this header directly. Instead it
33 36 * should be included only through the inclusion of other Sun headers.
34 37 *
35 38 * The contents of this header is limited to identifiers specified in the
36 39 * C Standard. Any new identifiers specified in future amendments to the
37 40 * C Standard must be placed in this header. If these new identifiers
38 41 * are required to also be in the C++ Standard "std" namespace, then for
39 42 * anything other than macro definitions, corresponding "using" directives
40 43 * must also be added to <ctype.h>.
41 44 */
42 45
43 46 #ifndef _ISO_CTYPE_ISO_H
44 47 #define _ISO_CTYPE_ISO_H
45 48
46 -#pragma ident "%Z%%M% %I% %E% SMI"
47 -
48 49 #include <sys/feature_tests.h>
49 50
50 51 #ifdef __cplusplus
51 52 extern "C" {
52 53 #endif
53 54
54 55 #define _U 0x00000001 /* Upper case */
55 56 #define _L 0x00000002 /* Lower case */
56 57 #define _N 0x00000004 /* Numeral (digit) */
57 58 #define _S 0x00000008 /* Spacing character */
58 59 #define _P 0x00000010 /* Punctuation */
59 60 #define _C 0x00000020 /* Control character */
60 61 #define _B 0x00000040 /* Blank */
61 62 #define _X 0x00000080 /* heXadecimal digit */
62 63
63 64 #define _ISUPPER _U
64 65 #define _ISLOWER _L
65 66 #define _ISDIGIT _N
↓ open down ↓ |
8 lines elided |
↑ open up ↑ |
66 67 #define _ISSPACE _S
67 68 #define _ISPUNCT _P
68 69 #define _ISCNTRL _C
69 70 #define _ISBLANK _B
70 71 #define _ISXDIGIT _X
71 72 #define _ISGRAPH 0x00002000
72 73 #define _ISALPHA 0x00004000
73 74 #define _ISPRINT 0x00008000
74 75 #define _ISALNUM (_ISALPHA | _ISDIGIT)
75 76
77 +extern unsigned char __ctype[];
78 +extern unsigned int *__ctype_mask;
79 +extern int *__trans_upper;
80 +extern int *__trans_lower;
76 81
77 82 #if defined(__STDC__)
78 83
79 -#if __cplusplus < 199711L /* Use inline functions instead for ANSI C++ */
84 +#if __cplusplus >= 199711L
85 +namespace std {
86 +#endif
80 87
88 +/*
89 + * These used to be macros, which while more efficient, precludes operation
90 + * with thread specific locales. The old macros will still work, but new
91 + * code compiles to use functions. This is specifically permitted by the
92 + * various standards. Only _tolower and _toupper were required to be
93 + * delivered in macro form.
94 + */
81 95 extern int isalnum(int);
82 96 extern int isalpha(int);
83 97 extern int iscntrl(int);
84 98 extern int isdigit(int);
85 99 extern int isgraph(int);
86 100 extern int islower(int);
87 101 extern int isprint(int);
88 102 extern int ispunct(int);
89 103 extern int isspace(int);
90 104 extern int isupper(int);
91 105 extern int isxdigit(int);
92 -
93 -#endif /* __cplusplus < 199711L */
94 -
95 -#if __cplusplus >= 199711L
96 -namespace std {
106 +#if defined(_XPG6) || defined(_STDC_C99) || !defined(_STRICT_SYMBOLS)
107 +extern int isblank(int);
97 108 #endif
98 109
99 110 extern int tolower(int);
100 111 extern int toupper(int);
101 112
102 113 #if __cplusplus >= 199711L
103 114 } /* end of namespace std */
104 115 #endif
105 116
106 -extern unsigned char __ctype[];
107 -extern unsigned int *__ctype_mask;
108 -extern int *__trans_upper;
109 -extern int *__trans_lower;
110 -
111 -#if !defined(__lint)
112 -
113 -#if __cplusplus >= 199711L
114 -namespace std {
115 -
116 -#if defined(__XPG4_CHAR_CLASS__) || defined(_XPG4)
117 -
118 -inline int isalpha(int c) { return (__ctype_mask[c] & _ISALPHA); }
119 -inline int isupper(int c) { return (__ctype_mask[c] & _ISUPPER); }
120 -inline int islower(int c) { return (__ctype_mask[c] & _ISLOWER); }
121 -inline int isdigit(int c) { return (__ctype_mask[c] & _ISDIGIT); }
122 -inline int isxdigit(int c) { return (__ctype_mask[c] & _ISXDIGIT); }
123 -inline int isalnum(int c) { return (__ctype_mask[c] & _ISALNUM); }
124 -inline int isspace(int c) { return (__ctype_mask[c] & _ISSPACE); }
125 -inline int ispunct(int c) { return (__ctype_mask[c] & _ISPUNCT); }
126 -inline int isprint(int c) { return (__ctype_mask[c] & _ISPRINT); }
127 -inline int isgraph(int c) { return (__ctype_mask[c] & _ISGRAPH); }
128 -inline int iscntrl(int c) { return (__ctype_mask[c] & _ISCNTRL); }
129 -#else
130 -inline int isalpha(int c) { return ((__ctype + 1)[c] & (_U | _L)); }
131 -inline int isupper(int c) { return ((__ctype + 1)[c] & _U); }
132 -inline int islower(int c) { return ((__ctype + 1)[c] & _L); }
133 -inline int isdigit(int c) { return ((__ctype + 1)[c] & _N); }
134 -inline int isxdigit(int c) { return ((__ctype + 1)[c] & _X); }
135 -inline int isalnum(int c) { return ((__ctype + 1)[c] & (_U | _L | _N)); }
136 -inline int isspace(int c) { return ((__ctype + 1)[c] & _S); }
137 -inline int ispunct(int c) { return ((__ctype + 1)[c] & _P); }
138 -inline int isprint(int c) {
139 - return ((__ctype + 1)[c] & (_P | _U | _L | _N | _B)); }
140 -inline int isgraph(int c) { return ((__ctype + 1)[c] & (_P | _U | _L | _N)); }
141 -inline int iscntrl(int c) { return ((__ctype + 1)[c] & _C); }
142 -#endif /* defined(__XPG4_CHAR_CLASS__) || defined(_XPG4) */
143 -
144 -} /* end of namespace std */
145 -
146 -#else /* __cplusplus >= 199711L */
147 -
148 -#if defined(__XPG4_CHAR_CLASS__) || defined(_XPG4)
149 -#define isalpha(c) (__ctype_mask[(int)(c)] & _ISALPHA)
150 -#define isupper(c) (__ctype_mask[(int)(c)] & _ISUPPER)
151 -#define islower(c) (__ctype_mask[(int)(c)] & _ISLOWER)
152 -#define isdigit(c) (__ctype_mask[(int)(c)] & _ISDIGIT)
153 -#define isxdigit(c) (__ctype_mask[(int)(c)] & _ISXDIGIT)
154 -#define isalnum(c) (__ctype_mask[(int)(c)] & _ISALNUM)
155 -#define isspace(c) (__ctype_mask[(int)(c)] & _ISSPACE)
156 -#define ispunct(c) (__ctype_mask[(int)(c)] & _ISPUNCT)
157 -#define isprint(c) (__ctype_mask[(int)(c)] & _ISPRINT)
158 -#define isgraph(c) (__ctype_mask[(int)(c)] & _ISGRAPH)
159 -#define iscntrl(c) (__ctype_mask[(int)(c)] & _ISCNTRL)
160 -#else
161 -#define isalpha(c) ((__ctype + 1)[(int)(c)] & (_U | _L))
162 -#define isupper(c) ((__ctype + 1)[(int)(c)] & _U)
163 -#define islower(c) ((__ctype + 1)[(int)(c)] & _L)
164 -#define isdigit(c) ((__ctype + 1)[(int)(c)] & _N)
165 -#define isxdigit(c) ((__ctype + 1)[(int)(c)] & _X)
166 -#define isalnum(c) ((__ctype + 1)[(int)(c)] & (_U | _L | _N))
167 -#define isspace(c) ((__ctype + 1)[(int)(c)] & _S)
168 -#define ispunct(c) ((__ctype + 1)[(int)(c)] & _P)
169 -#define isprint(c) ((__ctype + 1)[(int)(c)] & (_P | _U | _L | _N | _B))
170 -#define isgraph(c) ((__ctype + 1)[(int)(c)] & (_P | _U | _L | _N))
171 -#define iscntrl(c) ((__ctype + 1)[(int)(c)] & _C)
172 -
173 -#endif /* defined(__XPG4_CHAR_CLASS__) || defined(_XPG4) */
174 -
175 -#endif /* __cplusplus >= 199711L */
176 -
177 -#endif /* !defined(__lint) */
178 -
179 117 #else /* defined(__STDC__) */
180 118
181 -extern unsigned char _ctype[];
182 -
183 119 #if !defined(__lint)
184 120
185 -#define isalpha(c) ((_ctype + 1)[(int)(c)] & (_U | _L))
186 -#define isupper(c) ((_ctype + 1)[(int)(c)] & _U)
187 -#define islower(c) ((_ctype + 1)[(int)(c)] & _L)
188 -#define isdigit(c) ((_ctype + 1)[(int)(c)] & _N)
189 -#define isxdigit(c) ((_ctype + 1)[(int)(c)] & _X)
190 -#define isalnum(c) ((_ctype + 1)[(int)(c)] & (_U | _L | _N))
191 -#define isspace(c) ((_ctype + 1)[(int)(c)] & _S)
192 -#define ispunct(c) ((_ctype + 1)[(int)(c)] & _P)
193 -#define isprint(c) ((_ctype + 1)[(int)(c)] & (_P | _U | _L | _N | _B))
194 -#define isgraph(c) ((_ctype + 1)[(int)(c)] & (_P | _U | _L | _N))
195 -#define iscntrl(c) ((_ctype + 1)[(int)(c)] & _C)
121 +extern int isalpha();
122 +extern int isupper();
123 +extern int islower();
124 +extern int isdigit();
125 +extern int isxdigit();
126 +extern int isalnum();
127 +extern int isspace();
128 +extern int ispunct();
129 +extern int isprint();
130 +extern int isgraph();
131 +extern int iscntrl();
132 +extern int isblank();
196 133
197 134 #endif /* !defined(__lint) */
198 135
199 136 #endif /* defined(__STDC__) */
200 137
201 138 #ifdef __cplusplus
202 139 }
203 140 #endif
204 141
205 142 #endif /* _ISO_CTYPE_ISO_H */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX