Print this page
2964 need POSIX 2008 locale object support
Reviewed by: Robert Mustacchi <rm@joyent.com>
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/head/wchar.h
+++ new/usr/src/head/wchar.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 (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
↓ open down ↓ |
12 lines elided |
↑ open up ↑ |
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 + * Copyright 2014 Garrett D'Amore <garrett@damore.org>
23 24 * Copyright (c) 1993, 2010, Oracle and/or its affiliates. All rights reserved.
24 25 */
25 26
26 27 #ifndef _WCHAR_H
27 28 #define _WCHAR_H
28 29
29 30 #include <sys/feature_tests.h>
30 31 #include <iso/wchar_iso.h>
31 32 #include <iso/wchar_c99.h>
32 33
33 34 /*
34 35 * Allow global visibility for symbols defined in
35 36 * C++ "std" namespace in <iso/wchar_iso.h>.
36 37 */
37 38 #if __cplusplus >= 199711L
38 39 using std::FILE;
39 40 using std::wint_t;
40 41 using std::clock_t;
41 42 using std::size_t;
42 43 using std::time_t;
43 44 using std::tm;
44 45 using std::mbstate_t;
45 46 using std::fgetwc;
46 47 using std::fgetws;
47 48 using std::fputwc;
48 49 using std::fputws;
49 50 using std::ungetwc;
50 51 using std::getwc;
51 52 using std::getwchar;
52 53 using std::putwc;
53 54 using std::putwchar;
54 55 using std::wcstod;
55 56 using std::wcstol;
56 57 using std::wcstoul;
57 58 using std::wcscat;
58 59 using std::wcschr;
59 60 using std::wcscmp;
60 61 using std::wcscoll;
61 62 using std::wcscpy;
62 63 using std::wcscspn;
63 64 using std::wcslen;
64 65 using std::wcsncat;
65 66 using std::wcsncmp;
66 67 using std::wcsncpy;
67 68 using std::wcspbrk;
68 69 using std::wcsrchr;
69 70 using std::wcsspn;
70 71 using std::wcsxfrm;
71 72 using std::wcstok;
72 73 using std::wcsftime;
73 74 /* not XPG4 and not XPG4v2 */
74 75 #if (!defined(_XPG4) && !defined(_XPG4_2) || defined(_XPG5))
75 76 using std::btowc;
76 77 using std::fwprintf;
77 78 using std::fwscanf;
78 79 using std::fwide;
79 80 using std::mbsinit;
80 81 using std::mbrlen;
81 82 using std::mbrtowc;
82 83 using std::mbsrtowcs;
83 84 using std::swprintf;
84 85 using std::swscanf;
85 86 using std::vfwprintf;
86 87 using std::vwprintf;
87 88 using std::vswprintf;
88 89 using std::wcrtomb;
89 90 using std::wcsrtombs;
90 91 using std::wcsstr;
91 92 using std::wctob;
92 93 using std::wmemchr;
93 94 using std::wmemcmp;
94 95 using std::wmemcpy;
95 96 using std::wmemmove;
96 97 using std::wmemset;
97 98 using std::wprintf;
98 99 using std::wscanf;
99 100 #endif /* not XPG4 and not XPG4v2 */
100 101 #endif /* __cplusplus >= 199711L */
101 102
102 103 #ifdef __cplusplus
103 104 extern "C" {
104 105 #endif
105 106
106 107 #if !defined(_STRICT_STDC) || defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__)
107 108 #if !defined(_WCTYPE_T) || __cplusplus >= 199711L
108 109 #define _WCTYPE_T
109 110 typedef int wctype_t;
110 111 #endif
111 112 #endif /* !defined(_STRICT_STDC) || defined(_XOPEN_SOURCE)... */
112 113
113 114 /*
114 115 * XPG6 requires that va_list be defined as defined in <stdarg.h>,
115 116 * however, inclusion of <stdarg.h> breaks Standard C namespace.
116 117 */
117 118 #if defined(_XPG6) && !defined(_VA_LIST)
118 119 #define _VA_LIST
119 120 typedef __va_list va_list;
120 121 #endif /* defined(_XPG6) && !defined(_VA_LIST) */
121 122
122 123 #ifdef __STDC__
123 124
124 125 #if !defined(_STRICT_STDC) || defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__)
125 126 #if __cplusplus >= 199711L
126 127 namespace std {
127 128 #endif
128 129 extern int iswalpha(wint_t);
129 130 extern int iswupper(wint_t);
130 131 extern int iswlower(wint_t);
131 132 extern int iswdigit(wint_t);
132 133 extern int iswxdigit(wint_t);
133 134 extern int iswalnum(wint_t);
134 135 extern int iswspace(wint_t);
135 136 extern int iswpunct(wint_t);
136 137 extern int iswprint(wint_t);
137 138 extern int iswgraph(wint_t);
138 139 extern int iswcntrl(wint_t);
139 140 extern int iswctype(wint_t, wctype_t);
140 141 extern wint_t towlower(wint_t);
141 142 extern wint_t towupper(wint_t);
142 143 extern wchar_t *wcswcs(const wchar_t *, const wchar_t *);
143 144 extern int wcswidth(const wchar_t *, size_t);
144 145 extern int wcwidth(wchar_t);
145 146 extern wctype_t wctype(const char *);
146 147 #if __cplusplus >= 199711L
147 148 } /* namespace std */
148 149
149 150 using std::iswalpha;
150 151 using std::iswupper;
151 152 using std::iswlower;
152 153 using std::iswdigit;
153 154 using std::iswxdigit;
154 155 using std::iswalnum;
155 156 using std::iswspace;
156 157 using std::iswpunct;
157 158 using std::iswprint;
158 159 using std::iswgraph;
159 160 using std::iswcntrl;
↓ open down ↓ |
127 lines elided |
↑ open up ↑ |
160 161 using std::iswctype;
161 162 using std::towlower;
162 163 using std::towupper;
163 164 using std::wcswcs;
164 165 using std::wcswidth;
165 166 using std::wcwidth;
166 167 using std::wctype;
167 168 #endif
168 169 #endif /* !defined(_STRICT_STDC) || defined(_XOPEN_SOURCE)... */
169 170
170 -#if defined(__EXTENSIONS__) || \
171 - (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))
172 - /* || defined(_XPG7) */
173 -extern wchar_t *wcsdup(const wchar_t *);
171 +#if defined(_XPG7) || !defined(_STRICT_SYMBOLS)
172 +
173 +#ifndef _LOCALE_T
174 +#define _LOCALE_T
175 +typedef struct locale *locale_t;
176 +#endif
177 +
174 178 extern size_t wcsnlen(const wchar_t *, size_t);
175 179 extern wchar_t *wcpcpy(wchar_t *_RESTRICT_KYWD, const wchar_t *_RESTRICT_KYWD);
176 180 extern wchar_t *wcpncpy(wchar_t *_RESTRICT_KYWD, const wchar_t *_RESTRICT_KYWD,
177 181 size_t);
182 +extern size_t wcsxfrm_l(wchar_t *_RESTRICT_KYWD, const wchar_t *_RESTRICT_KYWD,
183 + size_t, locale_t);
184 +extern int wcscoll_l(const wchar_t *, const wchar_t *, locale_t);
185 +extern wchar_t *wcsdup(const wchar_t *);
178 186 extern int wcscasecmp(const wchar_t *, const wchar_t *);
187 +extern int wcscasecmp_l(const wchar_t *, const wchar_t *, locale_t);
179 188 extern int wcsncasecmp(const wchar_t *, const wchar_t *, size_t);
180 -#endif
189 +extern int wcsncasecmp_l(const wchar_t *, const wchar_t *, size_t, locale_t);
190 +extern size_t mbsnrtowcs(wchar_t *_RESTRICT_KYWD, const char **_RESTRICT_KYWD,
191 + size_t, size_t, mbstate_t *_RESTRICT_KYWD);
181 192
193 +#endif /* defined(_XPG7) || !defined(_STRICT_SYMBOLS) */
194 +
182 195 #else /* __STDC__ */
183 196
184 197 #if !defined(_STRICT_STDC) || defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__)
185 198 extern int iswalpha();
186 199 extern int iswupper();
187 200 extern int iswlower();
188 201 extern int iswdigit();
189 202 extern int iswxdigit();
190 203 extern int iswalnum();
191 204 extern int iswspace();
192 205 extern int iswpunct();
193 206 extern int iswprint();
194 207 extern int iswgraph();
↓ open down ↓ |
3 lines elided |
↑ open up ↑ |
195 208 extern int iswcntrl();
196 209 extern int iswctype();
197 210 extern wint_t towlower();
198 211 extern wint_t towupper();
199 212 extern wchar_t *wcswcs();
200 213 extern int wcswidth();
201 214 extern int wcwidth();
202 215 extern wctype_t wctype();
203 216 #endif /* !defined(_STRICT_STDC) || defined(_XOPEN_SOURCE)... */
204 217
205 -#if defined(__EXTENSIONS__) || \
206 - (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))
207 - /* || defined(_XPG7) */
208 -extern wchar_t *wcsdup();
218 +#if defined(_XGP7) || !defined(_STRICT_SYMBOLS)
209 219 extern size_t wcsnlen();
210 220 extern wchar_t *wcpcpy();
211 221 extern wchar_t *wcpncpy();
222 +extern size_t wcsxfrm_l();
223 +extern int wcscoll_l();
224 +extern wchar_t *wcsdup();
212 225 extern int wcscasecmp();
226 +extern int wcscasecmp_l();
213 227 extern int wcsncasecmp();
228 +extern int wcsncasecmp_l();
229 +extern size_t mbsnrtowcs();
214 230 #endif
215 231
216 232 #endif /* __STDC__ */
217 233
218 234 #ifdef __cplusplus
219 235 }
220 236 #endif
221 237
222 238 #endif /* _WCHAR_H */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX