modernc.org/cc@v1.0.1/v2/headers/linux_arm/usr/include/wchar.h (about) 1 /* Copyright (C) 1995-2016 Free Software Foundation, Inc. 2 This file is part of the GNU C Library. 3 4 The GNU C Library is free software; you can redistribute it and/or 5 modify it under the terms of the GNU Lesser General Public 6 License as published by the Free Software Foundation; either 7 version 2.1 of the License, or (at your option) any later version. 8 9 The GNU C Library is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 Lesser General Public License for more details. 13 14 You should have received a copy of the GNU Lesser General Public 15 License along with the GNU C Library; if not, see 16 <http://www.gnu.org/licenses/>. */ 17 18 /* 19 * ISO C99 Standard: 7.24 20 * Extended multibyte and wide character utilities <wchar.h> 21 */ 22 23 #ifndef _WCHAR_H 24 25 #if !defined __need_mbstate_t && !defined __need_wint_t 26 #define _WCHAR_H 1 27 #include <features.h> 28 #endif 29 30 #ifdef _WCHAR_H 31 /* Get FILE definition. */ 32 #define __need___FILE 33 #if defined __USE_UNIX98 || defined __USE_XOPEN2K 34 #define __need_FILE 35 #endif 36 #include <stdio.h> 37 /* Get va_list definition. */ 38 #define __need___va_list 39 #include <stdarg.h> 40 41 #include <bits/wchar.h> 42 43 /* Get size_t, wchar_t, wint_t and NULL from <stddef.h>. */ 44 #define __need_size_t 45 #define __need_wchar_t 46 #define __need_NULL 47 #endif 48 #if defined _WCHAR_H || defined __need_wint_t || !defined __WINT_TYPE__ 49 #undef __need_wint_t 50 #define __need_wint_t 51 #include <stddef.h> 52 53 /* We try to get wint_t from <stddef.h>, but not all GCC versions define it 54 there. So define it ourselves if it remains undefined. */ 55 #ifndef _WINT_T 56 /* Integral type unchanged by default argument promotions that can 57 hold any value corresponding to members of the extended character 58 set, as well as at least one value that does not correspond to any 59 member of the extended character set. */ 60 #define _WINT_T 61 typedef unsigned int wint_t; 62 #else 63 /* Work around problems with the <stddef.h> file which doesn't put 64 wint_t in the std namespace. */ 65 #if defined __cplusplus && defined _GLIBCPP_USE_NAMESPACES \ 66 && defined __WINT_TYPE__ 67 __BEGIN_NAMESPACE_STD typedef __WINT_TYPE__ wint_t; 68 __END_NAMESPACE_STD 69 #endif 70 #endif 71 /* Tell the caller that we provide correct C++ prototypes. */ 72 #if defined __cplusplus && __GNUC_PREREQ (4, 4) 73 #define __CORRECT_ISO_CPP_WCHAR_H_PROTO 74 #endif 75 #endif 76 #if (defined _WCHAR_H || defined __need_mbstate_t) && !defined ____mbstate_t_defined 77 #define ____mbstate_t_defined 1 78 /* Conversion state information. */ 79 typedef struct { 80 int __count; 81 union { 82 #ifdef __WINT_TYPE__ 83 __WINT_TYPE__ __wch; 84 #else 85 wint_t __wch; 86 #endif 87 char __wchb[4]; 88 } __value; /* Value so far. */ 89 } __mbstate_t; 90 #endif 91 #undef __need_mbstate_t 92 93 /* The rest of the file is only used if used if __need_mbstate_t is not 94 defined. */ 95 #ifdef _WCHAR_H 96 97 #ifndef __mbstate_t_defined 98 __BEGIN_NAMESPACE_C99 99 /* Public type. */ 100 typedef __mbstate_t mbstate_t; 101 __END_NAMESPACE_C99 102 #define __mbstate_t_defined 1 103 #endif 104 #ifdef __USE_GNU 105 __USING_NAMESPACE_C99(mbstate_t) 106 #endif 107 #ifndef WCHAR_MIN 108 /* These constants might also be defined in <inttypes.h>. */ 109 #define WCHAR_MIN __WCHAR_MIN 110 #define WCHAR_MAX __WCHAR_MAX 111 #endif 112 #ifndef WEOF 113 #define WEOF (0xffffffffu) 114 #endif 115 /* For XPG4 compliance we have to define the stuff from <wctype.h> here 116 as well. */ 117 #if defined __USE_XOPEN && !defined __USE_UNIX98 118 #include <wctype.h> 119 #endif 120 __BEGIN_DECLS __BEGIN_NAMESPACE_STD 121 /* This incomplete type is defined in <time.h> but needed here because 122 of `wcsftime'. */ 123 struct tm; 124 __END_NAMESPACE_STD 125 /* XXX We have to clean this up at some point. Since tm is in the std 126 namespace but wcsftime is in __c99 the type wouldn't be found 127 without inserting it in the global namespace. */ 128 __USING_NAMESPACE_STD(tm) 129 130 __BEGIN_NAMESPACE_STD 131 /* Copy SRC to DEST. */ 132 extern wchar_t *wcscpy(wchar_t * __restrict __dest, const wchar_t * __restrict __src) 133 __THROW __nonnull((1, 2)); 134 135 /* Copy no more than N wide-characters of SRC to DEST. */ 136 extern wchar_t *wcsncpy(wchar_t * __restrict __dest, const wchar_t * __restrict __src, size_t __n) 137 __THROW __nonnull((1, 2)); 138 139 /* Append SRC onto DEST. */ 140 extern wchar_t *wcscat(wchar_t * __restrict __dest, const wchar_t * __restrict __src) 141 __THROW __nonnull((1, 2)); 142 /* Append no more than N wide-characters of SRC onto DEST. */ 143 extern wchar_t *wcsncat(wchar_t * __restrict __dest, const wchar_t * __restrict __src, size_t __n) 144 __THROW __nonnull((1, 2)); 145 146 /* Compare S1 and S2. */ 147 extern int wcscmp(const wchar_t * __s1, const wchar_t * __s2) 148 __THROW __attribute_pure__ __nonnull((1, 2)); 149 /* Compare N wide-characters of S1 and S2. */ 150 extern int wcsncmp(const wchar_t * __s1, const wchar_t * __s2, size_t __n) 151 __THROW __attribute_pure__ __nonnull((1, 2)); 152 __END_NAMESPACE_STD 153 #ifdef __USE_XOPEN2K8 154 /* Compare S1 and S2, ignoring case. */ 155 extern int wcscasecmp(const wchar_t * __s1, const wchar_t * __s2) __THROW; 156 157 /* Compare no more than N chars of S1 and S2, ignoring case. */ 158 extern int wcsncasecmp(const wchar_t * __s1, const wchar_t * __s2, size_t __n) __THROW; 159 160 /* Similar to the two functions above but take the information from 161 the provided locale and not the global locale. */ 162 #include <xlocale.h> 163 164 extern int wcscasecmp_l(const wchar_t * __s1, const wchar_t * __s2, __locale_t __loc) __THROW; 165 166 extern int wcsncasecmp_l(const wchar_t * __s1, const wchar_t * __s2, size_t __n, __locale_t __loc) __THROW; 167 #endif 168 169 __BEGIN_NAMESPACE_STD 170 /* Compare S1 and S2, both interpreted as appropriate to the 171 LC_COLLATE category of the current locale. */ 172 extern int wcscoll(const wchar_t * __s1, const wchar_t * __s2) __THROW; 173 /* Transform S2 into array pointed to by S1 such that if wcscmp is 174 applied to two transformed strings the result is the as applying 175 `wcscoll' to the original strings. */ 176 extern size_t wcsxfrm(wchar_t * __restrict __s1, const wchar_t * __restrict __s2, size_t __n) __THROW; 177 __END_NAMESPACE_STD 178 #ifdef __USE_XOPEN2K8 179 /* Similar to the two functions above but take the information from 180 the provided locale and not the global locale. */ 181 /* Compare S1 and S2, both interpreted as appropriate to the 182 LC_COLLATE category of the given locale. */ 183 extern int wcscoll_l(const wchar_t * __s1, const wchar_t * __s2, __locale_t __loc) __THROW; 184 185 /* Transform S2 into array pointed to by S1 such that if wcscmp is 186 applied to two transformed strings the result is the as applying 187 `wcscoll' to the original strings. */ 188 extern size_t wcsxfrm_l(wchar_t * __s1, const wchar_t * __s2, size_t __n, __locale_t __loc) __THROW; 189 190 /* Duplicate S, returning an identical malloc'd string. */ 191 extern wchar_t *wcsdup(const wchar_t * __s) 192 __THROW __attribute_malloc__; 193 #endif 194 195 __BEGIN_NAMESPACE_STD 196 /* Find the first occurrence of WC in WCS. */ 197 #ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO 198 extern "C++" wchar_t * wcschr(wchar_t * __wcs, wchar_t __wc) 199 __THROW __asm("wcschr") __attribute_pure__; 200 extern "C++" const wchar_t *wcschr(const wchar_t * __wcs, wchar_t __wc) 201 __THROW __asm("wcschr") __attribute_pure__; 202 #else 203 extern wchar_t *wcschr(const wchar_t * __wcs, wchar_t __wc) 204 __THROW __attribute_pure__; 205 #endif 206 /* Find the last occurrence of WC in WCS. */ 207 #ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO 208 extern "C++" wchar_t * wcsrchr(wchar_t * __wcs, wchar_t __wc) 209 __THROW __asm("wcsrchr") __attribute_pure__; 210 extern "C++" const wchar_t *wcsrchr(const wchar_t * __wcs, wchar_t __wc) 211 __THROW __asm("wcsrchr") __attribute_pure__; 212 #else 213 extern wchar_t *wcsrchr(const wchar_t * __wcs, wchar_t __wc) 214 __THROW __attribute_pure__; 215 #endif 216 __END_NAMESPACE_STD 217 #ifdef __USE_GNU 218 /* This function is similar to `wcschr'. But it returns a pointer to 219 the closing NUL wide character in case C is not found in S. */ 220 extern wchar_t *wcschrnul(const wchar_t * __s, wchar_t __wc) 221 __THROW __attribute_pure__; 222 #endif 223 224 __BEGIN_NAMESPACE_STD 225 /* Return the length of the initial segmet of WCS which 226 consists entirely of wide characters not in REJECT. */ 227 extern size_t wcscspn(const wchar_t * __wcs, const wchar_t * __reject) 228 __THROW __attribute_pure__; 229 /* Return the length of the initial segmet of WCS which 230 consists entirely of wide characters in ACCEPT. */ 231 extern size_t wcsspn(const wchar_t * __wcs, const wchar_t * __accept) 232 __THROW __attribute_pure__; 233 /* Find the first occurrence in WCS of any character in ACCEPT. */ 234 #ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO 235 extern "C++" wchar_t * wcspbrk(wchar_t * __wcs, const wchar_t * __accept) 236 __THROW __asm("wcspbrk") __attribute_pure__; 237 extern "C++" const wchar_t *wcspbrk(const wchar_t * __wcs, const wchar_t * __accept) 238 __THROW __asm("wcspbrk") __attribute_pure__; 239 #else 240 extern wchar_t *wcspbrk(const wchar_t * __wcs, const wchar_t * __accept) 241 __THROW __attribute_pure__; 242 #endif 243 /* Find the first occurrence of NEEDLE in HAYSTACK. */ 244 #ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO 245 extern "C++" wchar_t * wcsstr(wchar_t * __haystack, const wchar_t * __needle) 246 __THROW __asm("wcsstr") __attribute_pure__; 247 extern "C++" const wchar_t *wcsstr(const wchar_t * __haystack, const wchar_t * __needle) 248 __THROW __asm("wcsstr") __attribute_pure__; 249 #else 250 extern wchar_t *wcsstr(const wchar_t * __haystack, const wchar_t * __needle) 251 __THROW __attribute_pure__; 252 #endif 253 254 /* Divide WCS into tokens separated by characters in DELIM. */ 255 extern wchar_t *wcstok(wchar_t * __restrict __s, const wchar_t * __restrict __delim, wchar_t ** __restrict __ptr) __THROW; 256 257 /* Return the number of wide characters in S. */ 258 extern size_t wcslen(const wchar_t * __s) 259 __THROW __attribute_pure__; 260 __END_NAMESPACE_STD 261 #ifdef __USE_XOPEN 262 /* Another name for `wcsstr' from XPG4. */ 263 #ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO 264 extern "C++" wchar_t * wcswcs(wchar_t * __haystack, const wchar_t * __needle) 265 __THROW __asm("wcswcs") __attribute_pure__; 266 extern "C++" const wchar_t *wcswcs(const wchar_t * __haystack, const wchar_t * __needle) 267 __THROW __asm("wcswcs") __attribute_pure__; 268 #else 269 extern wchar_t *wcswcs(const wchar_t * __haystack, const wchar_t * __needle) 270 __THROW __attribute_pure__; 271 #endif 272 #endif 273 274 #ifdef __USE_XOPEN2K8 275 /* Return the number of wide characters in S, but at most MAXLEN. */ 276 extern size_t wcsnlen(const wchar_t * __s, size_t __maxlen) 277 __THROW __attribute_pure__; 278 #endif 279 280 __BEGIN_NAMESPACE_STD 281 /* Search N wide characters of S for C. */ 282 #ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO 283 extern "C++" wchar_t * wmemchr(wchar_t * __s, wchar_t __c, size_t __n) 284 __THROW __asm("wmemchr") __attribute_pure__; 285 extern "C++" const wchar_t *wmemchr(const wchar_t * __s, wchar_t __c, size_t __n) 286 __THROW __asm("wmemchr") __attribute_pure__; 287 #else 288 extern wchar_t *wmemchr(const wchar_t * __s, wchar_t __c, size_t __n) 289 __THROW __attribute_pure__; 290 #endif 291 292 /* Compare N wide characters of S1 and S2. */ 293 extern int wmemcmp(const wchar_t * __s1, const wchar_t * __s2, size_t __n) 294 __THROW __attribute_pure__; 295 296 /* Copy N wide characters of SRC to DEST. */ 297 extern wchar_t *wmemcpy(wchar_t * __restrict __s1, const wchar_t * __restrict __s2, size_t __n) __THROW; 298 299 /* Copy N wide characters of SRC to DEST, guaranteeing 300 correct behavior for overlapping strings. */ 301 extern wchar_t *wmemmove(wchar_t * __s1, const wchar_t * __s2, size_t __n) __THROW; 302 303 /* Set N wide characters of S to C. */ 304 extern wchar_t *wmemset(wchar_t * __s, wchar_t __c, size_t __n) __THROW; 305 __END_NAMESPACE_STD 306 #ifdef __USE_GNU 307 /* Copy N wide characters of SRC to DEST and return pointer to following 308 wide character. */ 309 extern wchar_t *wmempcpy(wchar_t * __restrict __s1, const wchar_t * __restrict __s2, size_t __n) __THROW; 310 #endif 311 312 __BEGIN_NAMESPACE_STD 313 /* Determine whether C constitutes a valid (one-byte) multibyte 314 character. */ 315 extern wint_t btowc(int __c) __THROW; 316 317 /* Determine whether C corresponds to a member of the extended 318 character set whose multibyte representation is a single byte. */ 319 extern int wctob(wint_t __c) __THROW; 320 321 /* Determine whether PS points to an object representing the initial 322 state. */ 323 extern int mbsinit(const mbstate_t * __ps) 324 __THROW __attribute_pure__; 325 326 /* Write wide character representation of multibyte character pointed 327 to by S to PWC. */ 328 extern size_t mbrtowc(wchar_t * __restrict __pwc, const char *__restrict __s, size_t __n, mbstate_t * __restrict __p) __THROW; 329 330 /* Write multibyte representation of wide character WC to S. */ 331 extern size_t wcrtomb(char *__restrict __s, wchar_t __wc, mbstate_t * __restrict __ps) __THROW; 332 333 /* Return number of bytes in multibyte character pointed to by S. */ 334 extern size_t __mbrlen(const char *__restrict __s, size_t __n, mbstate_t * __restrict __ps) __THROW; 335 extern size_t mbrlen(const char *__restrict __s, size_t __n, mbstate_t * __restrict __ps) __THROW; 336 __END_NAMESPACE_STD 337 #ifdef __USE_EXTERN_INLINES 338 /* Define inline function as optimization. */ 339 /* We can use the BTOWC and WCTOB optimizations since we know that all 340 locales must use ASCII encoding for the values in the ASCII range 341 and because the wchar_t encoding is always ISO 10646. */ 342 extern wint_t __btowc_alias(int __c) __asm("btowc"); 343 __extern_inline wint_t __NTH(btowc(int __c)) 344 { 345 return (__builtin_constant_p(__c) && __c >= '\0' && __c <= '\x7f' ? (wint_t) __c : __btowc_alias(__c)); 346 } 347 348 extern int __wctob_alias(wint_t __c) __asm("wctob"); 349 __extern_inline int __NTH(wctob(wint_t __wc)) 350 { 351 return (__builtin_constant_p(__wc) && __wc >= L'\0' && __wc <= L'\x7f' ? (int)__wc : __wctob_alias(__wc)); 352 } 353 354 __extern_inline size_t __NTH(mbrlen(const char *__restrict __s, size_t __n, mbstate_t * __restrict __ps)) 355 { 356 return (__ps != NULL ? mbrtowc(NULL, __s, __n, __ps) : __mbrlen(__s, __n, NULL)); 357 } 358 #endif 359 360 __BEGIN_NAMESPACE_STD 361 /* Write wide character representation of multibyte character string 362 SRC to DST. */ 363 extern size_t mbsrtowcs(wchar_t * __restrict __dst, const char **__restrict __src, size_t __len, mbstate_t * __restrict __ps) __THROW; 364 365 /* Write multibyte character representation of wide character string 366 SRC to DST. */ 367 extern size_t wcsrtombs(char *__restrict __dst, const wchar_t ** __restrict __src, size_t __len, mbstate_t * __restrict __ps) __THROW; 368 __END_NAMESPACE_STD 369 #ifdef __USE_XOPEN2K8 370 /* Write wide character representation of at most NMC bytes of the 371 multibyte character string SRC to DST. */ 372 extern size_t mbsnrtowcs(wchar_t * __restrict __dst, const char **__restrict __src, size_t __nmc, size_t __len, mbstate_t * __restrict __ps) __THROW; 373 374 /* Write multibyte character representation of at most NWC characters 375 from the wide character string SRC to DST. */ 376 extern size_t wcsnrtombs(char *__restrict __dst, const wchar_t ** __restrict __src, size_t __nwc, size_t __len, mbstate_t * __restrict __ps) __THROW; 377 #endif /* use POSIX 2008 */ 378 379 /* The following functions are extensions found in X/Open CAE. */ 380 #ifdef __USE_XOPEN 381 /* Determine number of column positions required for C. */ 382 extern int wcwidth(wchar_t __c) __THROW; 383 384 /* Determine number of column positions required for first N wide 385 characters (or fewer if S ends before this) in S. */ 386 extern int wcswidth(const wchar_t * __s, size_t __n) __THROW; 387 #endif /* Use X/Open. */ 388 389 __BEGIN_NAMESPACE_STD 390 /* Convert initial portion of the wide string NPTR to `double' 391 representation. */ 392 extern double wcstod(const wchar_t * __restrict __nptr, wchar_t ** __restrict __endptr) __THROW; 393 __END_NAMESPACE_STD 394 #ifdef __USE_ISOC99 395 __BEGIN_NAMESPACE_C99 396 /* Likewise for `float' and `long double' sizes of floating-point numbers. */ 397 extern float wcstof(const wchar_t * __restrict __nptr, wchar_t ** __restrict __endptr) __THROW; 398 extern long double wcstold(const wchar_t * __restrict __nptr, wchar_t ** __restrict __endptr) __THROW; 399 __END_NAMESPACE_C99 400 #endif /* C99 */ 401 __BEGIN_NAMESPACE_STD 402 /* Convert initial portion of wide string NPTR to `long int' 403 representation. */ 404 extern long int wcstol(const wchar_t * __restrict __nptr, wchar_t ** __restrict __endptr, int __base) __THROW; 405 406 /* Convert initial portion of wide string NPTR to `unsigned long int' 407 representation. */ 408 extern unsigned long int wcstoul(const wchar_t * __restrict __nptr, wchar_t ** __restrict __endptr, int __base) __THROW; 409 __END_NAMESPACE_STD 410 #ifdef __USE_ISOC99 411 __BEGIN_NAMESPACE_C99 412 /* Convert initial portion of wide string NPTR to `long long int' 413 representation. */ 414 __extension__ extern long long int wcstoll(const wchar_t * __restrict __nptr, wchar_t ** __restrict __endptr, int __base) __THROW; 415 416 /* Convert initial portion of wide string NPTR to `unsigned long long int' 417 representation. */ 418 __extension__ extern unsigned long long int wcstoull(const wchar_t * __restrict __nptr, wchar_t ** __restrict __endptr, int __base) __THROW; 419 __END_NAMESPACE_C99 420 #endif /* ISO C99. */ 421 #ifdef __USE_GNU 422 /* Convert initial portion of wide string NPTR to `long long int' 423 representation. */ 424 __extension__ extern long long int wcstoq(const wchar_t * __restrict __nptr, wchar_t ** __restrict __endptr, int __base) __THROW; 425 426 /* Convert initial portion of wide string NPTR to `unsigned long long int' 427 representation. */ 428 __extension__ extern unsigned long long int wcstouq(const wchar_t * __restrict __nptr, wchar_t ** __restrict __endptr, int __base) __THROW; 429 #endif /* Use GNU. */ 430 431 #ifdef __USE_GNU 432 /* The concept of one static locale per category is not very well 433 thought out. Many applications will need to process its data using 434 information from several different locales. Another application is 435 the implementation of the internationalization handling in the 436 upcoming ISO C++ standard library. To support this another set of 437 the functions using locale data exist which have an additional 438 argument. 439 440 Attention: all these functions are *not* standardized in any form. 441 This is a proof-of-concept implementation. */ 442 443 /* Structure for reentrant locale using functions. This is an 444 (almost) opaque type for the user level programs. */ 445 #include <xlocale.h> 446 447 /* Special versions of the functions above which take the locale to 448 use as an additional parameter. */ 449 extern long int wcstol_l(const wchar_t * __restrict __nptr, wchar_t ** __restrict __endptr, int __base, __locale_t __loc) __THROW; 450 451 extern unsigned long int wcstoul_l(const wchar_t * __restrict __nptr, wchar_t ** __restrict __endptr, int __base, __locale_t __loc) __THROW; 452 453 __extension__ extern long long int wcstoll_l(const wchar_t * __restrict __nptr, wchar_t ** __restrict __endptr, int __base, __locale_t __loc) __THROW; 454 455 __extension__ extern unsigned long long int wcstoull_l(const wchar_t * __restrict __nptr, wchar_t ** __restrict __endptr, int __base, __locale_t __loc) __THROW; 456 457 extern double wcstod_l(const wchar_t * __restrict __nptr, wchar_t ** __restrict __endptr, __locale_t __loc) __THROW; 458 459 extern float wcstof_l(const wchar_t * __restrict __nptr, wchar_t ** __restrict __endptr, __locale_t __loc) __THROW; 460 461 extern long double wcstold_l(const wchar_t * __restrict __nptr, wchar_t ** __restrict __endptr, __locale_t __loc) __THROW; 462 #endif /* use GNU */ 463 464 #ifdef __USE_XOPEN2K8 465 /* Copy SRC to DEST, returning the address of the terminating L'\0' in 466 DEST. */ 467 extern wchar_t *wcpcpy(wchar_t * __restrict __dest, const wchar_t * __restrict __src) __THROW; 468 469 /* Copy no more than N characters of SRC to DEST, returning the address of 470 the last character written into DEST. */ 471 extern wchar_t *wcpncpy(wchar_t * __restrict __dest, const wchar_t * __restrict __src, size_t __n) __THROW; 472 473 /* Wide character I/O functions. */ 474 475 /* Like OPEN_MEMSTREAM, but the stream is wide oriented and produces 476 a wide character string. */ 477 extern __FILE *open_wmemstream(wchar_t ** __bufloc, size_t * __sizeloc) __THROW; 478 #endif 479 480 #if defined __USE_ISOC95 || defined __USE_UNIX98 481 __BEGIN_NAMESPACE_STD 482 /* Select orientation for stream. */ 483 extern int fwide(__FILE * __fp, int __mode) __THROW; 484 485 /* Write formatted output to STREAM. 486 487 This function is a possible cancellation point and therefore not 488 marked with __THROW. */ 489 extern int fwprintf(__FILE * __restrict __stream, const wchar_t * __restrict __format, ...) 490 /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */ ; 491 /* Write formatted output to stdout. 492 493 This function is a possible cancellation point and therefore not 494 marked with __THROW. */ 495 extern int wprintf(const wchar_t * __restrict __format, ...) 496 /* __attribute__ ((__format__ (__wprintf__, 1, 2))) */ ; 497 /* Write formatted output of at most N characters to S. */ 498 extern int swprintf(wchar_t * __restrict __s, size_t __n, const wchar_t * __restrict __format, ...) __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */ ; 499 500 /* Write formatted output to S from argument list ARG. 501 502 This function is a possible cancellation point and therefore not 503 marked with __THROW. */ 504 extern int vfwprintf(__FILE * __restrict __s, const wchar_t * __restrict __format, __gnuc_va_list __arg) 505 /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */ ; 506 /* Write formatted output to stdout from argument list ARG. 507 508 This function is a possible cancellation point and therefore not 509 marked with __THROW. */ 510 extern int vwprintf(const wchar_t * __restrict __format, __gnuc_va_list __arg) 511 /* __attribute__ ((__format__ (__wprintf__, 1, 0))) */ ; 512 /* Write formatted output of at most N character to S from argument 513 list ARG. */ 514 extern int vswprintf(wchar_t * __restrict __s, size_t __n, const wchar_t * __restrict __format, __gnuc_va_list __arg) __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */ ; 515 516 /* Read formatted input from STREAM. 517 518 This function is a possible cancellation point and therefore not 519 marked with __THROW. */ 520 extern int fwscanf(__FILE * __restrict __stream, const wchar_t * __restrict __format, ...) 521 /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */ ; 522 /* Read formatted input from stdin. 523 524 This function is a possible cancellation point and therefore not 525 marked with __THROW. */ 526 extern int wscanf(const wchar_t * __restrict __format, ...) 527 /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */ ; 528 /* Read formatted input from S. */ 529 extern int swscanf(const wchar_t * __restrict __s, const wchar_t * __restrict __format, ...) __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */ ; 530 531 #if defined __USE_ISOC99 && !defined __USE_GNU \ 532 && (!defined __LDBL_COMPAT || !defined __REDIRECT) \ 533 && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) 534 #ifdef __REDIRECT 535 /* For strict ISO C99 or POSIX compliance disallow %as, %aS and %a[ 536 GNU extension which conflicts with valid %a followed by letter 537 s, S or [. */ 538 extern int __REDIRECT(fwscanf, (__FILE * __restrict __stream, const wchar_t * __restrict __format, ...), __isoc99_fwscanf) 539 /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */ ; 540 extern int __REDIRECT(wscanf, (const wchar_t * __restrict __format, ...), __isoc99_wscanf) 541 /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */ ; 542 extern int __REDIRECT_NTH(swscanf, (const wchar_t * __restrict __s, const wchar_t * __restrict __format, ...), __isoc99_swscanf) 543 /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */ ; 544 #else 545 extern int __isoc99_fwscanf(__FILE * __restrict __stream, const wchar_t * __restrict __format, ...); 546 extern int __isoc99_wscanf(const wchar_t * __restrict __format, ...); 547 extern int __isoc99_swscanf(const wchar_t * __restrict __s, const wchar_t * __restrict __format, ...) __THROW; 548 #define fwscanf __isoc99_fwscanf 549 #define wscanf __isoc99_wscanf 550 #define swscanf __isoc99_swscanf 551 #endif 552 #endif 553 554 __END_NAMESPACE_STD 555 #endif /* Use ISO C95, C99 and Unix98. */ 556 #ifdef __USE_ISOC99 557 __BEGIN_NAMESPACE_C99 558 /* Read formatted input from S into argument list ARG. 559 560 This function is a possible cancellation point and therefore not 561 marked with __THROW. */ 562 extern int vfwscanf(__FILE * __restrict __s, const wchar_t * __restrict __format, __gnuc_va_list __arg) 563 /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */ ; 564 /* Read formatted input from stdin into argument list ARG. 565 566 This function is a possible cancellation point and therefore not 567 marked with __THROW. */ 568 extern int vwscanf(const wchar_t * __restrict __format, __gnuc_va_list __arg) 569 /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */ ; 570 /* Read formatted input from S into argument list ARG. */ 571 extern int vswscanf(const wchar_t * __restrict __s, const wchar_t * __restrict __format, __gnuc_va_list __arg) __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */ ; 572 573 #if !defined __USE_GNU \ 574 && (!defined __LDBL_COMPAT || !defined __REDIRECT) \ 575 && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) 576 #ifdef __REDIRECT 577 extern int __REDIRECT(vfwscanf, (__FILE * __restrict __s, const wchar_t * __restrict __format, __gnuc_va_list __arg), __isoc99_vfwscanf) 578 /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */ ; 579 extern int __REDIRECT(vwscanf, (const wchar_t * __restrict __format, __gnuc_va_list __arg), __isoc99_vwscanf) 580 /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */ ; 581 extern int __REDIRECT_NTH(vswscanf, (const wchar_t * __restrict __s, const wchar_t * __restrict __format, __gnuc_va_list __arg), __isoc99_vswscanf) 582 /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */ ; 583 #else 584 extern int __isoc99_vfwscanf(__FILE * __restrict __s, const wchar_t * __restrict __format, __gnuc_va_list __arg); 585 extern int __isoc99_vwscanf(const wchar_t * __restrict __format, __gnuc_va_list __arg); 586 extern int __isoc99_vswscanf(const wchar_t * __restrict __s, const wchar_t * __restrict __format, __gnuc_va_list __arg) __THROW; 587 #define vfwscanf __isoc99_vfwscanf 588 #define vwscanf __isoc99_vwscanf 589 #define vswscanf __isoc99_vswscanf 590 #endif 591 #endif 592 593 __END_NAMESPACE_C99 594 #endif /* Use ISO C99. */ 595 __BEGIN_NAMESPACE_STD 596 /* Read a character from STREAM. 597 598 These functions are possible cancellation points and therefore not 599 marked with __THROW. */ 600 extern wint_t fgetwc(__FILE * __stream); 601 extern wint_t getwc(__FILE * __stream); 602 603 /* Read a character from stdin. 604 605 This function is a possible cancellation point and therefore not 606 marked with __THROW. */ 607 extern wint_t getwchar(void); 608 609 /* Write a character to STREAM. 610 611 These functions are possible cancellation points and therefore not 612 marked with __THROW. */ 613 extern wint_t fputwc(wchar_t __wc, __FILE * __stream); 614 extern wint_t putwc(wchar_t __wc, __FILE * __stream); 615 616 /* Write a character to stdout. 617 618 This function is a possible cancellation point and therefore not 619 marked with __THROW. */ 620 extern wint_t putwchar(wchar_t __wc); 621 622 /* Get a newline-terminated wide character string of finite length 623 from STREAM. 624 625 This function is a possible cancellation point and therefore not 626 marked with __THROW. */ 627 extern wchar_t *fgetws(wchar_t * __restrict __ws, int __n, __FILE * __restrict __stream); 628 629 /* Write a string to STREAM. 630 631 This function is a possible cancellation point and therefore not 632 marked with __THROW. */ 633 extern int fputws(const wchar_t * __restrict __ws, __FILE * __restrict __stream); 634 635 /* Push a character back onto the input buffer of STREAM. 636 637 This function is a possible cancellation point and therefore not 638 marked with __THROW. */ 639 extern wint_t ungetwc(wint_t __wc, __FILE * __stream); 640 __END_NAMESPACE_STD 641 #ifdef __USE_GNU 642 /* These are defined to be equivalent to the `char' functions defined 643 in POSIX.1:1996. 644 645 These functions are not part of POSIX and therefore no official 646 cancellation point. But due to similarity with an POSIX interface 647 or due to the implementation they are cancellation points and 648 therefore not marked with __THROW. */ 649 extern wint_t getwc_unlocked(__FILE * __stream); 650 extern wint_t getwchar_unlocked(void); 651 652 /* This is the wide character version of a GNU extension. 653 654 This function is not part of POSIX and therefore no official 655 cancellation point. But due to similarity with an POSIX interface 656 or due to the implementation it is a cancellation point and 657 therefore not marked with __THROW. */ 658 extern wint_t fgetwc_unlocked(__FILE * __stream); 659 660 /* Faster version when locking is not necessary. 661 662 This function is not part of POSIX and therefore no official 663 cancellation point. But due to similarity with an POSIX interface 664 or due to the implementation it is a cancellation point and 665 therefore not marked with __THROW. */ 666 extern wint_t fputwc_unlocked(wchar_t __wc, __FILE * __stream); 667 668 /* These are defined to be equivalent to the `char' functions defined 669 in POSIX.1:1996. 670 671 These functions are not part of POSIX and therefore no official 672 cancellation point. But due to similarity with an POSIX interface 673 or due to the implementation they are cancellation points and 674 therefore not marked with __THROW. */ 675 extern wint_t putwc_unlocked(wchar_t __wc, __FILE * __stream); 676 extern wint_t putwchar_unlocked(wchar_t __wc); 677 678 /* This function does the same as `fgetws' but does not lock the stream. 679 680 This function is not part of POSIX and therefore no official 681 cancellation point. But due to similarity with an POSIX interface 682 or due to the implementation it is a cancellation point and 683 therefore not marked with __THROW. */ 684 extern wchar_t *fgetws_unlocked(wchar_t * __restrict __ws, int __n, __FILE * __restrict __stream); 685 686 /* This function does the same as `fputws' but does not lock the stream. 687 688 This function is not part of POSIX and therefore no official 689 cancellation point. But due to similarity with an POSIX interface 690 or due to the implementation it is a cancellation point and 691 therefore not marked with __THROW. */ 692 extern int fputws_unlocked(const wchar_t * __restrict __ws, __FILE * __restrict __stream); 693 #endif 694 695 __BEGIN_NAMESPACE_C99 696 /* Format TP into S according to FORMAT. 697 Write no more than MAXSIZE wide characters and return the number 698 of wide characters written, or 0 if it would exceed MAXSIZE. */ 699 extern size_t wcsftime(wchar_t * __restrict __s, size_t __maxsize, const wchar_t * __restrict __format, const struct tm *__restrict __tp) __THROW; 700 __END_NAMESPACE_C99 701 #ifdef __USE_GNU 702 #include <xlocale.h> 703 /* Similar to `wcsftime' but takes the information from 704 the provided locale and not the global locale. */ 705 extern size_t wcsftime_l(wchar_t * __restrict __s, size_t __maxsize, const wchar_t * __restrict __format, const struct tm *__restrict __tp, __locale_t __loc) __THROW; 706 #endif 707 708 /* The X/Open standard demands that most of the functions defined in 709 the <wctype.h> header must also appear here. This is probably 710 because some X/Open members wrote their implementation before the 711 ISO C standard was published and introduced the better solution. 712 We have to provide these definitions for compliance reasons but we 713 do this nonsense only if really necessary. */ 714 #if defined __USE_UNIX98 && !defined __USE_GNU 715 #define __need_iswxxx 716 #include <wctype.h> 717 #endif 718 719 /* Define some macros helping to catch buffer overflows. */ 720 #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function 721 #include <bits/wchar2.h> 722 #endif 723 724 #ifdef __LDBL_COMPAT 725 #include <bits/wchar-ldbl.h> 726 #endif 727 728 __END_DECLS 729 #endif /* _WCHAR_H defined */ 730 #endif /* wchar.h */ 731 /* Undefine all __need_* constants in case we are included to get those 732 constants but the whole file was already read. */ 733 #undef __need_mbstate_t 734 #undef __need_wint_t