Print this page
remove support for non-ANSI compilation
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/head/iso/wchar_iso.h
+++ new/usr/src/head/iso/wchar_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 (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>
24 + *
23 25 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
24 26 * Use is subject to license terms.
25 27 */
26 28
27 29 /*
28 - * Copyright 2014 Garrett D'Amore <garrett@damore.org>
29 - */
30 -
31 -/*
32 30 * An application should not include this header directly. Instead it
33 31 * should be included only through the inclusion of other Sun headers.
34 32 *
35 33 * The contents of this header is limited to identifiers specified in the
36 34 * C Standard. Any new identifiers specified in future amendments to the
37 35 * C Standard must be placed in this header. If these new identifiers
38 36 * are required to also be in the C++ Standard "std" namespace, then for
39 37 * anything other than macro definitions, corresponding "using" directives
40 38 * must also be added to <wchar.h>.
41 39 */
42 40
43 41 #ifndef _ISO_WCHAR_ISO_H
44 42 #define _ISO_WCHAR_ISO_H
45 43
46 44 #include <sys/feature_tests.h>
47 45 #include <stdio_tag.h>
48 46 #include <wchar_impl.h>
49 47 #include <iso/time_iso.h>
50 48
51 49 #if (defined(__cplusplus) && (__cplusplus - 0 < 54321L)) || \
52 50 (!defined(__cplusplus) && !defined(_STRICT_STDC)) || \
53 51 defined(__EXTENSIONS__)
54 52 #include <stdio.h>
55 53 #endif /* (defined(__cplusplus) && (__cplusplus - 0 < 54321L)) ... */
56 54
57 55 #if !defined(_STRICT_STDC) || defined(__EXTENSIONS__)
58 56 #include <ctype.h>
59 57 #include <stddef.h>
60 58 #endif /* !defined(_STRICT_STDC) || defined(__EXTENSIONS__) */
61 59
62 60 #include <sys/va_list.h>
63 61
64 62 #ifdef __cplusplus
65 63 extern "C" {
66 64 #endif
67 65
68 66 #if __cplusplus >= 199711L
69 67 namespace std {
70 68 #endif
71 69
72 70 /*
73 71 * wchar_t is a built-in type in standard C++ and as such is not
74 72 * defined here when using standard C++. However, the GNU compiler
75 73 * fixincludes utility nonetheless creates its own version of this
76 74 * header for use by gcc and g++. In that version it adds a redundant
77 75 * guard for __cplusplus. To avoid the creation of a gcc/g++ specific
78 76 * header we need to include the following magic comment:
79 77 *
80 78 * we must use the C++ compiler's type
81 79 *
82 80 * The above comment should not be removed or changed until GNU
83 81 * gcc/fixinc/inclhack.def is updated to bypass this header.
84 82 */
85 83 #if !defined(__cplusplus) || (__cplusplus < 199711L && !defined(__GNUG__))
86 84 #ifndef _WCHAR_T
87 85 #define _WCHAR_T
88 86 #if defined(_LP64)
89 87 typedef int wchar_t;
90 88 #else
91 89 typedef long wchar_t;
92 90 #endif
93 91 #endif /* !_WCHAR_T */
94 92 #endif /* !defined(__cplusplus) ... */
95 93
96 94 #if !defined(_WINT_T) || __cplusplus >= 199711L
97 95 #define _WINT_T
98 96 #if defined(_LP64)
99 97 typedef int wint_t;
100 98 #else
101 99 typedef long wint_t;
102 100 #endif
103 101 #endif /* !defined(_WINT_T) || __cplusplus >= 199711L */
104 102
105 103 #if !defined(_SIZE_T) || __cplusplus >= 199711L
106 104 #define _SIZE_T
107 105 #if defined(_LP64) || defined(_I32LPx)
108 106 typedef unsigned long size_t; /* size of something in bytes */
109 107 #else
110 108 typedef unsigned int size_t; /* (historical version) */
111 109 #endif
112 110 #endif /* !defined(_SIZE_T) || __cplusplus >= 199711L */
113 111
114 112 #ifndef NULL
115 113 #if defined(_LP64)
116 114 #define NULL 0L
117 115 #else
118 116 #define NULL 0
119 117 #endif
120 118 #endif /* !NULL */
121 119
122 120 #ifndef WEOF
123 121 #if __cplusplus >= 199711L
124 122 #define WEOF ((std::wint_t)(-1))
125 123 #else
126 124 #define WEOF ((wint_t)(-1))
127 125 #endif
128 126 #endif /* WEOF */
129 127
130 128 /* not XPG4 and not XPG4v2 */
131 129 #if !defined(_XPG4) || defined(_XPG5)
132 130 #ifndef WCHAR_MAX
133 131 #define WCHAR_MAX 2147483647
134 132 #endif
135 133 #ifndef WCHAR_MIN
136 134 #define WCHAR_MIN (-2147483647-1)
137 135 #endif
138 136 #endif /* not XPG4 and not XPG4v2 */
139 137
140 138 #if !defined(_MBSTATE_T) || __cplusplus >= 199711L
141 139 #define _MBSTATE_T
142 140 typedef __mbstate_t mbstate_t;
143 141 #endif /* _MBSTATE_T */
144 142
145 143 #if defined(_XPG4) && !defined(_FILEDEFED) || __cplusplus >= 199711L
146 144 #define _FILEDEFED
147 145 typedef __FILE FILE;
148 146 #endif
149 147
150 148 #if !defined(_LP64) && !defined(_LONGLONG_TYPE)
151 149
152 150 #ifdef __PRAGMA_REDEFINE_EXTNAME
153 151 #pragma redefine_extname fwprintf _fwprintf_c89
154 152 #pragma redefine_extname swprintf _swprintf_c89
155 153 #pragma redefine_extname vfwprintf _vfwprintf_c89
156 154 #pragma redefine_extname vswprintf _vswprintf_c89
157 155 #pragma redefine_extname vwprintf _vwprintf_c89
158 156 #pragma redefine_extname wprintf _wprintf_c89
159 157 #pragma redefine_extname fwscanf _fwscanf_c89
160 158 #pragma redefine_extname swscanf _swscanf_c89
161 159 #pragma redefine_extname wscanf _wscanf_c89
162 160 #else
163 161 #define fwprintf _fwprintf_c89
164 162 #define swprintf _swprintf_c89
165 163 #define vfwprintf _vfwprintf_c89
166 164 #define vswprintf _vswprintf_c89
167 165 #define vwprintf _vwprintf_c89
168 166 #define wprintf _wprintf_c89
169 167 #define fwscanf _fwscanf_c89
170 168 #define swscanf _swscanf_c89
171 169 #define wscanf _wscanf_c89
172 170 #endif
173 171
174 172 #endif /* !defined(_LP64) && !defined(_LONGLONG_TYPE) */
175 173
176 174 #if (!defined(_MSE_INT_H))
177 175 /* not XPG4 and not XPG4v2 */
178 176 #if !defined(_XPG4) || defined(_XPG5)
179 177 #ifdef __PRAGMA_REDEFINE_EXTNAME
↓ open down ↓ |
138 lines elided |
↑ open up ↑ |
180 178 #pragma redefine_extname fgetwc __fgetwc_xpg5
181 179 #pragma redefine_extname getwc __getwc_xpg5
182 180 #pragma redefine_extname getwchar __getwchar_xpg5
183 181 #pragma redefine_extname fputwc __fputwc_xpg5
184 182 #pragma redefine_extname putwc __putwc_xpg5
185 183 #pragma redefine_extname putwchar __putwchar_xpg5
186 184 #pragma redefine_extname fgetws __fgetws_xpg5
187 185 #pragma redefine_extname fputws __fputws_xpg5
188 186 #pragma redefine_extname ungetwc __ungetwc_xpg5
189 187 #else /* __PRAGMA_REDEFINE_EXTNAME */
190 -#ifdef __STDC__
191 188 extern wint_t __fgetwc_xpg5(__FILE *);
192 189 extern wint_t __getwc_xpg5(__FILE *);
193 190 extern wint_t __getwchar_xpg5(void);
194 191 extern wint_t __fputwc_xpg5(wint_t, __FILE *);
195 192 extern wint_t __putwc_xpg5(wint_t, __FILE *);
196 193 extern wint_t __putwchar_xpg5(wint_t);
197 194 extern wchar_t *__fgetws_xpg5(wchar_t *_RESTRICT_KYWD, int,
198 195 __FILE *_RESTRICT_KYWD);
199 196 extern int __fputws_xpg5(const wchar_t *_RESTRICT_KYWD, __FILE *_RESTRICT_KYWD);
200 197 extern wint_t __ungetwc_xpg5(wint_t, __FILE *);
201 -#else
202 -extern wint_t __fgetwc_xpg5();
203 -extern wint_t __getwc_xpg5();
204 -extern wint_t __getwchar_xpg5();
205 -extern wint_t __fputwc_xpg5();
206 -extern wint_t __putwc_xpg5();
207 -extern wint_t __putwchar_xpg5();
208 -extern wchar_t *__fgetws_xpg5();
209 -extern int __fputws_xpg5();
210 -extern wint_t __ungetwc_xpg5();
211 -#endif /* __STDC__ */
212 198 #define fgetwc __fgetwc_xpg5
213 199 #define getwc __getwc_xpg5
214 200 #define getwchar __getwchar_xpg5
215 201 #define fputwc __fputwc_xpg5
216 202 #define putwc __putwc_xpg5
217 203 #define putwchar __putwchar_xpg5
218 204 #define fgetws __fgetws_xpg5
219 205 #define fputws __fputws_xpg5
220 206 #define ungetwc __ungetwc_xpg5
221 207 #endif /* __PRAGMA_REDEFINE_EXTNAME */
222 208 #endif /* not XPG4 and not XPG4v2 */
223 209 #endif /* defined(_MSE_INT_H) */
224 210
225 -#ifdef __STDC__
226 -
227 211 extern wint_t fgetwc(__FILE *);
228 212 extern wchar_t *fgetws(wchar_t *_RESTRICT_KYWD, int, __FILE *_RESTRICT_KYWD);
229 213 extern wint_t fputwc(wint_t, __FILE *);
230 214 extern int fputws(const wchar_t *_RESTRICT_KYWD, __FILE *_RESTRICT_KYWD);
231 215 extern wint_t ungetwc(wint_t, __FILE *);
232 216 extern wint_t getwc(__FILE *);
233 217 extern wint_t getwchar(void);
234 218 extern wint_t putwc(wint_t, __FILE *);
235 219 extern wint_t putwchar(wint_t);
236 220 extern double wcstod(const wchar_t *_RESTRICT_KYWD, wchar_t **_RESTRICT_KYWD);
237 221 extern long wcstol(const wchar_t *_RESTRICT_KYWD, wchar_t **_RESTRICT_KYWD,
238 222 int);
239 223 extern unsigned long wcstoul(const wchar_t *_RESTRICT_KYWD,
240 224 wchar_t **_RESTRICT_KYWD, int);
241 225 extern wchar_t *wcscat(wchar_t *_RESTRICT_KYWD, const wchar_t *_RESTRICT_KYWD);
242 226 extern int wcscmp(const wchar_t *, const wchar_t *);
243 227 extern int wcscoll(const wchar_t *, const wchar_t *);
244 228 extern wchar_t *wcscpy(wchar_t *_RESTRICT_KYWD, const wchar_t *_RESTRICT_KYWD);
245 229 extern size_t wcscspn(const wchar_t *, const wchar_t *);
246 230 extern size_t wcslen(const wchar_t *);
247 231 extern wchar_t *wcsncat(wchar_t *_RESTRICT_KYWD, const wchar_t *_RESTRICT_KYWD,
248 232 size_t);
249 233 extern int wcsncmp(const wchar_t *, const wchar_t *, size_t);
250 234 extern wchar_t *wcsncpy(wchar_t *_RESTRICT_KYWD, const wchar_t *_RESTRICT_KYWD,
251 235 size_t);
252 236 extern size_t wcsspn(const wchar_t *, const wchar_t *);
253 237 extern size_t wcsxfrm(wchar_t *_RESTRICT_KYWD, const wchar_t *_RESTRICT_KYWD,
254 238 size_t);
255 239 #if __cplusplus >= 199711L
256 240 extern const wchar_t *wcschr(const wchar_t *, wchar_t);
257 241 extern "C++" {
258 242 inline wchar_t *wcschr(wchar_t *__ws, wchar_t __wc) {
259 243 return (wchar_t *)wcschr((const wchar_t *)__ws, __wc);
260 244 }
261 245 }
262 246 extern const wchar_t *wcspbrk(const wchar_t *, const wchar_t *);
263 247 extern "C++" {
264 248 inline wchar_t *wcspbrk(wchar_t *__ws1, const wchar_t *__ws2) {
265 249 return (wchar_t *)wcspbrk((const wchar_t *)__ws1, __ws2);
266 250 }
267 251 }
268 252 extern const wchar_t *wcsrchr(const wchar_t *, wchar_t);
269 253 extern "C++" {
270 254 inline wchar_t *wcsrchr(wchar_t *__ws, wchar_t __wc) {
271 255 return (wchar_t *)wcsrchr((const wchar_t *)__ws, __wc);
272 256 }
273 257 }
274 258 #else /* __cplusplus >= 199711L */
275 259 extern wchar_t *wcschr(const wchar_t *, wchar_t);
276 260 extern wchar_t *wcspbrk(const wchar_t *, const wchar_t *);
277 261 extern wchar_t *wcsrchr(const wchar_t *, wchar_t);
278 262 #endif /* __cplusplus >= 199711L */
279 263
280 264 #if (!defined(_MSE_INT_H))
281 265 #if defined(_XPG4) && !defined(_XPG5) /* XPG4 or XPG4v2 */
282 266 extern wchar_t *wcstok(wchar_t *, const wchar_t *);
283 267 extern size_t wcsftime(wchar_t *, size_t, const char *, const struct tm *);
284 268 #else /* XPG4 or XPG4v2 */
285 269 #ifdef __PRAGMA_REDEFINE_EXTNAME
286 270 #pragma redefine_extname wcstok __wcstok_xpg5
287 271 #pragma redefine_extname wcsftime __wcsftime_xpg5
288 272 extern wchar_t *wcstok(wchar_t *_RESTRICT_KYWD, const wchar_t *_RESTRICT_KYWD,
289 273 wchar_t **_RESTRICT_KYWD);
290 274 extern size_t wcsftime(wchar_t *_RESTRICT_KYWD, size_t,
291 275 const wchar_t *_RESTRICT_KYWD, const struct tm *_RESTRICT_KYWD);
292 276 #else /* __PRAGMA_REDEFINE_EXTNAME */
293 277 extern wchar_t *__wcstok_xpg5(wchar_t *_RESTRICT_KYWD,
294 278 const wchar_t *_RESTRICT_KYWD, wchar_t **_RESTRICT_KYWD);
295 279 extern size_t __wcsftime_xpg5(wchar_t *_RESTRICT_KYWD, size_t,
296 280 const wchar_t *_RESTRICT_KYWD, const struct tm *_RESTRICT_KYWD);
297 281 #define wcstok __wcstok_xpg5
298 282 #define wcsftime __wcsftime_xpg5
299 283 #endif /* __PRAGMA_REDEFINE_EXTNAME */
300 284 #endif /* XPG4 or XPG4v2 */
301 285 #endif /* !defined(_MSE_INT_H) */
302 286
303 287 /* not XPG4 and not XPG4v2 */
304 288 #if !defined(_XPG4) || defined(_XPG5)
305 289 extern wint_t btowc(int);
306 290 extern int fwprintf(__FILE *_RESTRICT_KYWD, const wchar_t *_RESTRICT_KYWD,
307 291 ...);
308 292 extern int fwscanf(__FILE *_RESTRICT_KYWD, const wchar_t *_RESTRICT_KYWD,
309 293 ...);
310 294 extern int fwide(__FILE *, int);
311 295 extern int mbsinit(const mbstate_t *);
312 296 extern size_t mbrlen(const char *_RESTRICT_KYWD, size_t,
313 297 mbstate_t *_RESTRICT_KYWD);
314 298 extern size_t mbrtowc(wchar_t *_RESTRICT_KYWD, const char *_RESTRICT_KYWD,
315 299 size_t, mbstate_t *_RESTRICT_KYWD);
316 300 extern size_t mbsrtowcs(wchar_t *_RESTRICT_KYWD, const char **_RESTRICT_KYWD,
317 301 size_t, mbstate_t *_RESTRICT_KYWD);
318 302 extern int swprintf(wchar_t *_RESTRICT_KYWD, size_t,
319 303 const wchar_t *_RESTRICT_KYWD, ...);
320 304 extern int swscanf(const wchar_t *_RESTRICT_KYWD,
321 305 const wchar_t *_RESTRICT_KYWD, ...);
322 306 extern int vfwprintf(__FILE *_RESTRICT_KYWD, const wchar_t *_RESTRICT_KYWD,
323 307 __va_list);
324 308 extern int vwprintf(const wchar_t *_RESTRICT_KYWD, __va_list);
325 309 extern int vswprintf(wchar_t *_RESTRICT_KYWD, size_t,
326 310 const wchar_t *_RESTRICT_KYWD, __va_list);
327 311 extern size_t wcrtomb(char *_RESTRICT_KYWD, wchar_t,
328 312 mbstate_t *_RESTRICT_KYWD);
329 313 extern size_t wcsrtombs(char *_RESTRICT_KYWD, const wchar_t **_RESTRICT_KYWD,
330 314 size_t, mbstate_t *_RESTRICT_KYWD);
331 315 #if defined(_XPG7) || !defined(_STRICT_SYMBOLS)
332 316 extern size_t wcsnrtombs(char *_RESTRICT_KYWD, const wchar_t **_RESTRICT_KYWD,
333 317 size_t, size_t, mbstate_t *_RESTRICT_KYWD);
334 318 #endif
335 319 extern int wctob(wint_t);
336 320 extern int wmemcmp(const wchar_t *, const wchar_t *, size_t);
337 321 extern wchar_t *wmemcpy(wchar_t *_RESTRICT_KYWD,
338 322 const wchar_t *_RESTRICT_KYWD, size_t);
339 323 extern wchar_t *wmemmove(wchar_t *, const wchar_t *, size_t);
340 324 extern wchar_t *wmemset(wchar_t *, wchar_t, size_t);
341 325 extern int wprintf(const wchar_t *_RESTRICT_KYWD, ...);
342 326 extern int wscanf(const wchar_t *_RESTRICT_KYWD, ...);
343 327 #if __cplusplus >= 199711L
344 328 extern const wchar_t *wcsstr(const wchar_t *, const wchar_t *);
345 329 extern "C++" {
346 330 inline wchar_t *wcsstr(wchar_t *__ws1, const wchar_t *__ws2) {
347 331 return (wchar_t *)wcsstr((const wchar_t *)__ws1, __ws2);
348 332 }
349 333 }
350 334 extern const wchar_t *wmemchr(const wchar_t *, wchar_t, size_t);
351 335 extern "C++" {
352 336 inline wchar_t *wmemchr(wchar_t *__ws, wchar_t __wc, size_t __n) {
↓ open down ↓ |
116 lines elided |
↑ open up ↑ |
353 337 return (wchar_t *)wmemchr((const wchar_t *)__ws, __wc, __n);
354 338 }
355 339 }
356 340 #else /* __cplusplus >= 199711L */
357 341 extern wchar_t *wcsstr(const wchar_t *_RESTRICT_KYWD,
358 342 const wchar_t *_RESTRICT_KYWD);
359 343 extern wchar_t *wmemchr(const wchar_t *, wchar_t, size_t);
360 344 #endif /* __cplusplus >= 199711L */
361 345 #endif /* not XPG4 and not XPG4v2 */
362 346
363 -#else /* __STDC__ */
364 -
365 -extern wint_t fgetwc();
366 -extern wchar_t *fgetws();
367 -extern wint_t fputwc();
368 -extern int fputws();
369 -extern wint_t ungetwc();
370 -extern wint_t getwc();
371 -extern wint_t getwchar();
372 -extern wint_t putwc();
373 -extern wint_t putwchar();
374 -extern wint_t ungetwc();
375 -extern double wcstod();
376 -extern long wcstol();
377 -extern unsigned long wcstoul();
378 -extern wchar_t *wcscat();
379 -extern wchar_t *wcschr();
380 -extern int wcscmp();
381 -extern int wcscoll();
382 -extern wchar_t *wcscpy();
383 -extern size_t wcscspn();
384 -extern size_t wcslen();
385 -extern wchar_t *wcsncat();
386 -extern int wcsncmp();
387 -extern wchar_t *wcsncpy();
388 -extern wchar_t *wcspbrk();
389 -extern wchar_t *wcsrchr();
390 -extern size_t wcsspn();
391 -extern size_t wcsxfrm();
392 -
393 -#if (!defined(_MSE_INT_H))
394 -#if defined(_XPG4) && !defined(_XPG5) /* XPG4 or XPG4v2 */
395 -extern wchar_t *wcstok();
396 -extern size_t wcsftime();
397 -#else /* XPG4 or XPG4v2 */
398 -#ifdef __PRAGMA_REDEFINE_EXTNAME
399 -#pragma redefine_extname wcstok __wcstok_xpg5
400 -#pragma redefine_extname wcsftime __wcsftime_xpg5
401 -extern wchar_t *wcstok();
402 -extern size_t wcsftime();
403 -#else /* __PRAGMA_REDEFINE_EXTNAME */
404 -extern wchar_t *__wcstok_xpg5();
405 -extern size_t __wcsftime_xpg5();
406 -#define wcstok __wcstok_xpg5
407 -#define wcsftime __wcsftime_xpg5
408 -#endif /* __PRAGMA_REDEFINE_EXTNAME */
409 -#endif /* XPG4 or XPG4v2 */
410 -#endif /* defined(_MSE_INT_H) */
411 -
412 -/* not XPG4 and not XPG4v2 */
413 -#if (!defined(_XPG4) && !defined(_XPG4_2) || defined(_XPG5))
414 -extern wint_t btowc();
415 -extern int fwprintf();
416 -extern int fwscanf();
417 -extern int fwide();
418 -extern int mbsinit();
419 -extern size_t mbrlen();
420 -extern size_t mbrtowc();
421 -extern size_t mbsrtowcs();
422 -extern int swprintf();
423 -extern int swscanf();
424 -extern int vfwprintf();
425 -extern int vwprintf();
426 -extern int vswprintf();
427 -extern size_t wcrtomb();
428 -extern size_t wcsrtombs();
429 -#if defined(_XPG7) || !defined(_STRICT_SYMBOLS)
430 -extern size_t wcsnrtombs();
431 -#endif
432 -
433 -extern wchar_t *wcsstr();
434 -extern int wctob();
435 -extern wchar_t *wmemchr();
436 -extern int wmemcmp();
437 -extern wchar_t *wmemcpy();
438 -extern wchar_t *wmemmove();
439 -extern wchar_t *wmemset();
440 -extern int wprintf();
441 -extern int wscanf();
442 -#endif /* not XPG4 and not XPG4v2 */
443 -
444 -#endif /* __STDC__ */
445 -
446 347 #if __cplusplus >= 199711L
447 348 }
448 349 #endif /* end of namespace std */
449 350
450 351 #ifdef __cplusplus
451 352 }
452 353 #endif
453 354
454 355 #endif /* _ISO_WCHAR_ISO_H */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX