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