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