1 /* Copyright (C) 1995-2002, 2003, 2004 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
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.
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.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, write to the Free
16 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20 * ISO C99 Standard: 7.24
21 * Extended multibyte and wide character utilities <wchar.h>
26 #ifndef __need_mbstate_t
28 # include <features.h>
32 /* Get FILE definition. */
33 # define __need___FILE
38 /* Get va_list definition. */
39 # define __need___va_list
42 /* Get size_t, wchar_t, wint_t and NULL from <stddef.h>. */
43 # define __need_size_t
44 # define __need_wchar_t
50 #include <bits/wchar.h>
52 /* We try to get wint_t from <stddef.h>, but not all GCC versions define it
53 there. So define it ourselves if it remains undefined. */
55 /* Integral type unchanged by default argument promotions that can
56 hold any value corresponding to members of the extended character
57 set, as well as at least one value that does not correspond to any
58 member of the extended character set. */
60 typedef unsigned int wint_t;
62 /* Work around problems with the <stddef.h> file which doesn't put
63 wint_t in the std namespace. */
64 # if defined __cplusplus && defined _GLIBCPP_USE_NAMESPACES \
65 && defined __WINT_TYPE__
67 typedef __WINT_TYPE__
wint_t;
73 #ifndef __mbstate_t_defined
74 # define __mbstate_t_defined 1
75 /* Conversion state information. */
83 } __value
; /* Value so far. */
86 #undef __need_mbstate_t
89 /* The rest of the file is only used if used if __need_mbstate_t is not
95 typedef __mbstate_t
mbstate_t;
98 __USING_NAMESPACE_C99(mbstate_t)
102 /* These constants might also be defined in <inttypes.h>. */
103 # define WCHAR_MIN __WCHAR_MIN
104 # define WCHAR_MAX __WCHAR_MAX
108 # define WEOF (0xffffffffu)
111 /* For XPG4 compliance we have to define the stuff from <wctype.h> here
113 #if defined __USE_XOPEN && !defined __USE_UNIX98
120 __BEGIN_NAMESPACE_STD
121 /* This incomplete type is defined in <time.h> but needed here because
124 /* XXX We have to clean this up at some point. Since tm is in the std
125 namespace but wcsftime is in __c99 the type wouldn't be found
126 without inserting it in the global namespace. */
127 __USING_NAMESPACE_STD(tm
)
131 __BEGIN_NAMESPACE_C99
132 /* Copy SRC to DEST. */
133 extern wchar_t *wcscpy (wchar_t *__restrict __dest
,
134 __const
wchar_t *__restrict __src
) __THROW
;
135 /* Copy no more than N wide-characters of SRC to DEST. */
136 extern wchar_t *wcsncpy (wchar_t *__restrict __dest
,
137 __const
wchar_t *__restrict __src
, size_t __n
)
140 /* Append SRC onto DEST. */
141 extern wchar_t *wcscat (wchar_t *__restrict __dest
,
142 __const
wchar_t *__restrict __src
) __THROW
;
143 /* Append no more than N wide-characters of SRC onto DEST. */
144 extern wchar_t *wcsncat (wchar_t *__restrict __dest
,
145 __const
wchar_t *__restrict __src
, size_t __n
)
148 /* Compare S1 and S2. */
149 extern int wcscmp (__const
wchar_t *__s1
, __const
wchar_t *__s2
)
150 __THROW __attribute_pure__
;
151 /* Compare N wide-characters of S1 and S2. */
152 extern int wcsncmp (__const
wchar_t *__s1
, __const
wchar_t *__s2
, size_t __n
)
153 __THROW __attribute_pure__
;
157 /* Compare S1 and S2, ignoring case. */
158 extern int wcscasecmp (__const
wchar_t *__s1
, __const
wchar_t *__s2
) __THROW
;
160 /* Compare no more than N chars of S1 and S2, ignoring case. */
161 extern int wcsncasecmp (__const
wchar_t *__s1
, __const
wchar_t *__s2
,
164 /* Similar to the two functions above but take the information from
165 the provided locale and not the global locale. */
166 # include <xlocale.h>
168 extern int wcscasecmp_l (__const
wchar_t *__s1
, __const
wchar_t *__s2
,
169 __locale_t __loc
) __THROW
;
171 extern int wcsncasecmp_l (__const
wchar_t *__s1
, __const
wchar_t *__s2
,
172 size_t __n
, __locale_t __loc
) __THROW
;
175 __BEGIN_NAMESPACE_C99
176 /* Compare S1 and S2, both interpreted as appropriate to the
177 LC_COLLATE category of the current locale. */
178 extern int wcscoll (__const
wchar_t *__s1
, __const
wchar_t *__s2
) __THROW
;
179 /* Transform S2 into array pointed to by S1 such that if wcscmp is
180 applied to two transformed strings the result is the as applying
181 `wcscoll' to the original strings. */
182 extern size_t wcsxfrm (wchar_t *__restrict __s1
,
183 __const
wchar_t *__restrict __s2
, size_t __n
) __THROW
;
187 /* Similar to the two functions above but take the information from
188 the provided locale and not the global locale. */
190 /* Compare S1 and S2, both interpreted as appropriate to the
191 LC_COLLATE category of the given locale. */
192 extern int wcscoll_l (__const
wchar_t *__s1
, __const
wchar_t *__s2
,
193 __locale_t __loc
) __THROW
;
195 /* Transform S2 into array pointed to by S1 such that if wcscmp is
196 applied to two transformed strings the result is the as applying
197 `wcscoll' to the original strings. */
198 extern size_t wcsxfrm_l (wchar_t *__s1
, __const
wchar_t *__s2
,
199 size_t __n
, __locale_t __loc
) __THROW
;
201 /* Duplicate S, returning an identical malloc'd string. */
202 extern wchar_t *wcsdup (__const
wchar_t *__s
) __THROW __attribute_malloc__
;
205 __BEGIN_NAMESPACE_C99
206 /* Find the first occurrence of WC in WCS. */
207 extern wchar_t *wcschr (__const
wchar_t *__wcs
, wchar_t __wc
)
208 __THROW __attribute_pure__
;
209 /* Find the last occurrence of WC in WCS. */
210 extern wchar_t *wcsrchr (__const
wchar_t *__wcs
, wchar_t __wc
)
211 __THROW __attribute_pure__
;
215 /* This function is similar to `wcschr'. But it returns a pointer to
216 the closing NUL wide character in case C is not found in S. */
217 extern wchar_t *wcschrnul (__const
wchar_t *__s
, wchar_t __wc
)
218 __THROW __attribute_pure__
;
221 __BEGIN_NAMESPACE_C99
222 /* Return the length of the initial segmet of WCS which
223 consists entirely of wide characters not in REJECT. */
224 extern size_t wcscspn (__const
wchar_t *__wcs
, __const
wchar_t *__reject
)
225 __THROW __attribute_pure__
;
226 /* Return the length of the initial segmet of WCS which
227 consists entirely of wide characters in ACCEPT. */
228 extern size_t wcsspn (__const
wchar_t *__wcs
, __const
wchar_t *__accept
)
229 __THROW __attribute_pure__
;
230 /* Find the first occurrence in WCS of any character in ACCEPT. */
231 extern wchar_t *wcspbrk (__const
wchar_t *__wcs
, __const
wchar_t *__accept
)
232 __THROW __attribute_pure__
;
233 /* Find the first occurrence of NEEDLE in HAYSTACK. */
234 extern wchar_t *wcsstr (__const
wchar_t *__haystack
, __const
wchar_t *__needle
)
235 __THROW __attribute_pure__
;
237 /* Divide WCS into tokens separated by characters in DELIM. */
238 extern wchar_t *wcstok (wchar_t *__restrict __s
,
239 __const
wchar_t *__restrict __delim
,
240 wchar_t **__restrict __ptr
) __THROW
;
242 /* Return the number of wide characters in S. */
243 extern size_t wcslen (__const
wchar_t *__s
) __THROW __attribute_pure__
;
247 /* Another name for `wcsstr' from XPG4. */
248 extern wchar_t *wcswcs (__const
wchar_t *__haystack
, __const
wchar_t *__needle
)
249 __THROW __attribute_pure__
;
253 /* Return the number of wide characters in S, but at most MAXLEN. */
254 extern size_t wcsnlen (__const
wchar_t *__s
, size_t __maxlen
)
255 __THROW __attribute_pure__
;
259 __BEGIN_NAMESPACE_C99
260 /* Search N wide characters of S for C. */
261 extern wchar_t *wmemchr (__const
wchar_t *__s
, wchar_t __c
, size_t __n
)
262 __THROW __attribute_pure__
;
264 /* Compare N wide characters of S1 and S2. */
265 extern int wmemcmp (__const
wchar_t *__restrict __s1
,
266 __const
wchar_t *__restrict __s2
, size_t __n
)
267 __THROW __attribute_pure__
;
269 /* Copy N wide characters of SRC to DEST. */
270 extern wchar_t *wmemcpy (wchar_t *__restrict __s1
,
271 __const
wchar_t *__restrict __s2
, size_t __n
) __THROW
;
273 /* Copy N wide characters of SRC to DEST, guaranteeing
274 correct behavior for overlapping strings. */
275 extern wchar_t *wmemmove (wchar_t *__s1
, __const
wchar_t *__s2
, size_t __n
)
278 /* Set N wide characters of S to C. */
279 extern wchar_t *wmemset (wchar_t *__s
, wchar_t __c
, size_t __n
) __THROW
;
283 /* Copy N wide characters of SRC to DEST and return pointer to following
285 extern wchar_t *wmempcpy (wchar_t *__restrict __s1
,
286 __const
wchar_t *__restrict __s2
, size_t __n
)
291 __BEGIN_NAMESPACE_C99
292 /* Determine whether C constitutes a valid (one-byte) multibyte
294 extern wint_t btowc (int __c
) __THROW
;
296 /* Determine whether C corresponds to a member of the extended
297 character set whose multibyte representation is a single byte. */
298 extern int wctob (wint_t __c
) __THROW
;
300 /* Determine whether PS points to an object representing the initial
302 extern int mbsinit (__const
mbstate_t *__ps
) __THROW __attribute_pure__
;
304 /* Write wide character representation of multibyte character pointed
306 extern size_t mbrtowc (wchar_t *__restrict __pwc
,
307 __const
char *__restrict __s
, size_t __n
,
308 mbstate_t *__p
) __THROW
;
310 /* Write multibyte representation of wide character WC to S. */
311 extern size_t wcrtomb (char *__restrict __s
, wchar_t __wc
,
312 mbstate_t *__restrict __ps
) __THROW
;
314 /* Return number of bytes in multibyte character pointed to by S. */
315 extern size_t __mbrlen (__const
char *__restrict __s
, size_t __n
,
316 mbstate_t *__restrict __ps
) __THROW
;
317 extern size_t mbrlen (__const
char *__restrict __s
, size_t __n
,
318 mbstate_t *__restrict __ps
) __THROW
;
321 #ifdef __USE_EXTERN_INLINES
322 /* Define inline function as optimization. */
323 extern __inline
size_t
324 __NTH (mbrlen (__const
char *__restrict __s
, size_t __n
,
325 mbstate_t *__restrict __ps
))
326 { return (__ps
!= NULL
327 ? mbrtowc (NULL
, __s
, __n
, __ps
) : __mbrlen (__s
, __n
, NULL
)); }
330 __BEGIN_NAMESPACE_C99
331 /* Write wide character representation of multibyte character string
333 extern size_t mbsrtowcs (wchar_t *__restrict __dst
,
334 __const
char **__restrict __src
, size_t __len
,
335 mbstate_t *__restrict __ps
) __THROW
;
337 /* Write multibyte character representation of wide character string
339 extern size_t wcsrtombs (char *__restrict __dst
,
340 __const
wchar_t **__restrict __src
, size_t __len
,
341 mbstate_t *__restrict __ps
) __THROW
;
346 /* Write wide character representation of at most NMC bytes of the
347 multibyte character string SRC to DST. */
348 extern size_t mbsnrtowcs (wchar_t *__restrict __dst
,
349 __const
char **__restrict __src
, size_t __nmc
,
350 size_t __len
, mbstate_t *__restrict __ps
) __THROW
;
352 /* Write multibyte character representation of at most NWC characters
353 from the wide character string SRC to DST. */
354 extern size_t wcsnrtombs (char *__restrict __dst
,
355 __const
wchar_t **__restrict __src
,
356 size_t __nwc
, size_t __len
,
357 mbstate_t *__restrict __ps
) __THROW
;
361 /* The following functions are extensions found in X/Open CAE. */
363 /* Determine number of column positions required for C. */
364 extern int wcwidth (wchar_t __c
) __THROW
;
366 /* Determine number of column positions required for first N wide
367 characters (or fewer if S ends before this) in S. */
368 extern int wcswidth (__const
wchar_t *__s
, size_t __n
) __THROW
;
369 #endif /* Use X/Open. */
372 __BEGIN_NAMESPACE_C99
373 /* Convert initial portion of the wide string NPTR to `double'
375 extern double wcstod (__const
wchar_t *__restrict __nptr
,
376 wchar_t **__restrict __endptr
) __THROW
;
379 /* Likewise for `float' and `long double' sizes of floating-point numbers. */
380 extern float wcstof (__const
wchar_t *__restrict __nptr
,
381 wchar_t **__restrict __endptr
) __THROW
;
382 extern long double wcstold (__const
wchar_t *__restrict __nptr
,
383 wchar_t **__restrict __endptr
) __THROW
;
387 /* Convert initial portion of wide string NPTR to `long int'
389 extern long int wcstol (__const
wchar_t *__restrict __nptr
,
390 wchar_t **__restrict __endptr
, int __base
) __THROW
;
392 /* Convert initial portion of wide string NPTR to `unsigned long int'
394 extern unsigned long int wcstoul (__const
wchar_t *__restrict __nptr
,
395 wchar_t **__restrict __endptr
, int __base
)
398 #if defined __USE_ISOC99 || (defined __GNUC__ && defined __USE_GNU)
399 /* Convert initial portion of wide string NPTR to `long int'
402 extern long long int wcstoll (__const
wchar_t *__restrict __nptr
,
403 wchar_t **__restrict __endptr
, int __base
)
406 /* Convert initial portion of wide string NPTR to `unsigned long long int'
409 extern unsigned long long int wcstoull (__const
wchar_t *__restrict __nptr
,
410 wchar_t **__restrict __endptr
,
412 #endif /* ISO C99 or GCC and GNU. */
415 #if defined __GNUC__ && defined __USE_GNU
416 /* Convert initial portion of wide string NPTR to `long int'
419 extern long long int wcstoq (__const
wchar_t *__restrict __nptr
,
420 wchar_t **__restrict __endptr
, int __base
)
423 /* Convert initial portion of wide string NPTR to `unsigned long long int'
426 extern unsigned long long int wcstouq (__const
wchar_t *__restrict __nptr
,
427 wchar_t **__restrict __endptr
,
429 #endif /* GCC and 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
440 Attention: all these functions are *not* standardized in any form.
441 This is a proof-of-concept implementation. */
443 /* Structure for reentrant locale using functions. This is an
444 (almost) opaque type for the user level programs. */
445 # include <xlocale.h>
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
,
450 wchar_t **__restrict __endptr
, int __base
,
451 __locale_t __loc
) __THROW
;
453 extern unsigned long int wcstoul_l (__const
wchar_t *__restrict __nptr
,
454 wchar_t **__restrict __endptr
,
455 int __base
, __locale_t __loc
) __THROW
;
458 extern long long int wcstoll_l (__const
wchar_t *__restrict __nptr
,
459 wchar_t **__restrict __endptr
,
460 int __base
, __locale_t __loc
) __THROW
;
463 extern unsigned long long int wcstoull_l (__const
wchar_t *__restrict __nptr
,
464 wchar_t **__restrict __endptr
,
465 int __base
, __locale_t __loc
)
468 extern double wcstod_l (__const
wchar_t *__restrict __nptr
,
469 wchar_t **__restrict __endptr
, __locale_t __loc
)
472 extern float wcstof_l (__const
wchar_t *__restrict __nptr
,
473 wchar_t **__restrict __endptr
, __locale_t __loc
)
476 extern long double wcstold_l (__const
wchar_t *__restrict __nptr
,
477 wchar_t **__restrict __endptr
,
478 __locale_t __loc
) __THROW
;
482 /* The internal entry points for `wcstoX' take an extra flag argument
483 saying whether or not to parse locale-dependent number grouping. */
484 extern double __wcstod_internal (__const
wchar_t *__restrict __nptr
,
485 wchar_t **__restrict __endptr
, int __group
)
487 extern float __wcstof_internal (__const
wchar_t *__restrict __nptr
,
488 wchar_t **__restrict __endptr
, int __group
)
490 extern long double __wcstold_internal (__const
wchar_t *__restrict __nptr
,
491 wchar_t **__restrict __endptr
,
492 int __group
) __THROW
;
494 #ifndef __wcstol_internal_defined
495 extern long int __wcstol_internal (__const
wchar_t *__restrict __nptr
,
496 wchar_t **__restrict __endptr
,
497 int __base
, int __group
) __THROW
;
498 # define __wcstol_internal_defined 1
500 #ifndef __wcstoul_internal_defined
501 extern unsigned long int __wcstoul_internal (__const
wchar_t *__restrict __npt
,
502 wchar_t **__restrict __endptr
,
503 int __base
, int __group
) __THROW
;
504 # define __wcstoul_internal_defined 1
506 #ifndef __wcstoll_internal_defined
508 extern long long int __wcstoll_internal (__const
wchar_t *__restrict __nptr
,
509 wchar_t **__restrict __endptr
,
510 int __base
, int __group
) __THROW
;
511 # define __wcstoll_internal_defined 1
513 #ifndef __wcstoull_internal_defined
515 extern unsigned long long int __wcstoull_internal (__const
wchar_t *
520 int __group
) __THROW
;
521 # define __wcstoull_internal_defined 1
525 #if defined __OPTIMIZE__ && __GNUC__ >= 2
526 /* Define inline functions which call the internal entry points. */
527 __BEGIN_NAMESPACE_C99
529 extern __inline
double
530 __NTH (wcstod (__const
wchar_t *__restrict __nptr
,
531 wchar_t **__restrict __endptr
))
532 { return __wcstod_internal (__nptr
, __endptr
, 0); }
533 extern __inline
long int
534 __NTH (wcstol (__const
wchar_t *__restrict __nptr
,
535 wchar_t **__restrict __endptr
, int __base
))
536 { return __wcstol_internal (__nptr
, __endptr
, __base
, 0); }
537 extern __inline
unsigned long int
538 __NTH (wcstoul (__const
wchar_t *__restrict __nptr
,
539 wchar_t **__restrict __endptr
, int __base
))
540 { return __wcstoul_internal (__nptr
, __endptr
, __base
, 0); }
544 extern __inline
float
545 __NTH (wcstof (__const
wchar_t *__restrict __nptr
,
546 wchar_t **__restrict __endptr
))
547 { return __wcstof_internal (__nptr
, __endptr
, 0); }
548 extern __inline
long double
549 __NTH (wcstold (__const
wchar_t *__restrict __nptr
,
550 wchar_t **__restrict __endptr
))
551 { return __wcstold_internal (__nptr
, __endptr
, 0); }
555 extern __inline
long long int
556 __NTH (wcstoq (__const
wchar_t *__restrict __nptr
,
557 wchar_t **__restrict __endptr
, int __base
))
558 { return __wcstoll_internal (__nptr
, __endptr
, __base
, 0); }
560 extern __inline
unsigned long long int
561 __NTH (wcstouq (__const
wchar_t *__restrict __nptr
,
562 wchar_t **__restrict __endptr
, int __base
))
563 { return __wcstoull_internal (__nptr
, __endptr
, __base
, 0); }
564 # endif /* Use GNU. */
565 #endif /* Optimizing GCC >=2. */
569 /* Copy SRC to DEST, returning the address of the terminating L'\0' in
571 extern wchar_t *wcpcpy (wchar_t *__dest
, __const
wchar_t *__src
) __THROW
;
573 /* Copy no more than N characters of SRC to DEST, returning the address of
574 the last character written into DEST. */
575 extern wchar_t *wcpncpy (wchar_t *__dest
, __const
wchar_t *__src
, size_t __n
)
580 /* Wide character I/O functions. */
581 #if defined __USE_ISOC99 || defined __USE_UNIX98
582 __BEGIN_NAMESPACE_C99
584 /* Select orientation for stream. */
585 extern int fwide (__FILE
*__fp
, int __mode
) __THROW
;
588 /* Write formatted output to STREAM.
590 This function is a possible cancellation point and therefore not
591 marked with __THROW. */
592 extern int fwprintf (__FILE
*__restrict __stream
,
593 __const
wchar_t *__restrict __format
, ...)
594 /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */;
595 /* Write formatted output to stdout.
597 This function is a possible cancellation point and therefore not
598 marked with __THROW. */
599 extern int wprintf (__const
wchar_t *__restrict __format
, ...)
600 /* __attribute__ ((__format__ (__wprintf__, 1, 2))) */;
601 /* Write formatted output of at most N characters to S. */
602 extern int swprintf (wchar_t *__restrict __s
, size_t __n
,
603 __const
wchar_t *__restrict __format
, ...)
604 __THROW
/* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
606 /* Write formatted output to S from argument list ARG.
608 This function is a possible cancellation point and therefore not
609 marked with __THROW. */
610 extern int vfwprintf (__FILE
*__restrict __s
,
611 __const
wchar_t *__restrict __format
,
612 __gnuc_va_list __arg
)
613 /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */;
614 /* Write formatted output to stdout from argument list ARG.
616 This function is a possible cancellation point and therefore not
617 marked with __THROW. */
618 extern int vwprintf (__const
wchar_t *__restrict __format
,
619 __gnuc_va_list __arg
)
620 /* __attribute__ ((__format__ (__wprintf__, 1, 0))) */;
621 /* Write formatted output of at most N character to S from argument
623 extern int vswprintf (wchar_t *__restrict __s
, size_t __n
,
624 __const
wchar_t *__restrict __format
,
625 __gnuc_va_list __arg
)
626 __THROW
/* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
629 /* Read formatted input from STREAM.
631 This function is a possible cancellation point and therefore not
632 marked with __THROW. */
633 extern int fwscanf (__FILE
*__restrict __stream
,
634 __const
wchar_t *__restrict __format
, ...)
635 /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
636 /* Read formatted input from stdin.
638 This function is a possible cancellation point and therefore not
639 marked with __THROW. */
640 extern int wscanf (__const
wchar_t *__restrict __format
, ...)
641 /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
642 /* Read formatted input from S. */
643 extern int swscanf (__const
wchar_t *__restrict __s
,
644 __const
wchar_t *__restrict __format
, ...)
645 __THROW
/* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
648 #endif /* Use ISO C99 and Unix98. */
651 __BEGIN_NAMESPACE_C99
653 /* Read formatted input from S into argument list ARG.
655 This function is a possible cancellation point and therefore not
656 marked with __THROW. */
657 extern int vfwscanf (__FILE
*__restrict __s
,
658 __const
wchar_t *__restrict __format
,
659 __gnuc_va_list __arg
)
660 /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
661 /* Read formatted input from stdin into argument list ARG.
663 This function is a possible cancellation point and therefore not
664 marked with __THROW. */
665 extern int vwscanf (__const
wchar_t *__restrict __format
,
666 __gnuc_va_list __arg
)
667 /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
668 /* Read formatted input from S into argument list ARG. */
669 extern int vswscanf (__const
wchar_t *__restrict __s
,
670 __const
wchar_t *__restrict __format
,
671 __gnuc_va_list __arg
)
672 __THROW
/* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
675 #endif /* Use ISO C99. */
678 __BEGIN_NAMESPACE_C99
679 /* Read a character from STREAM.
681 These functions are possible cancellation points and therefore not
682 marked with __THROW. */
683 extern wint_t fgetwc (__FILE
*__stream
);
684 extern wint_t getwc (__FILE
*__stream
);
686 /* Read a character from stdin.
688 This function is a possible cancellation point and therefore not
689 marked with __THROW. */
690 extern wint_t getwchar (void);
693 /* Write a character to STREAM.
695 These functions are possible cancellation points and therefore not
696 marked with __THROW. */
697 extern wint_t fputwc (wchar_t __wc
, __FILE
*__stream
);
698 extern wint_t putwc (wchar_t __wc
, __FILE
*__stream
);
700 /* Write a character to stdout.
702 This function is a possible cancellation points and therefore not
703 marked with __THROW. */
704 extern wint_t putwchar (wchar_t __wc
);
707 /* Get a newline-terminated wide character string of finite length
710 This function is a possible cancellation points and therefore not
711 marked with __THROW. */
712 extern wchar_t *fgetws (wchar_t *__restrict __ws
, int __n
,
713 __FILE
*__restrict __stream
);
715 /* Write a string to STREAM.
717 This function is a possible cancellation points and therefore not
718 marked with __THROW. */
719 extern int fputws (__const
wchar_t *__restrict __ws
,
720 __FILE
*__restrict __stream
);
723 /* Push a character back onto the input buffer of STREAM.
725 This function is a possible cancellation points and therefore not
726 marked with __THROW. */
727 extern wint_t ungetwc (wint_t __wc
, __FILE
*__stream
);
732 /* These are defined to be equivalent to the `char' functions defined
735 These functions are not part of POSIX and therefore no official
736 cancellation point. But due to similarity with an POSIX interface
737 or due to the implementation they are cancellation points and
738 therefore not marked with __THROW. */
739 extern wint_t getwc_unlocked (__FILE
*__stream
);
740 extern wint_t getwchar_unlocked (void);
742 /* This is the wide character version of a GNU extension.
744 This function is not part of POSIX and therefore no official
745 cancellation point. But due to similarity with an POSIX interface
746 or due to the implementation it is a cancellation point and
747 therefore not marked with __THROW. */
748 extern wint_t fgetwc_unlocked (__FILE
*__stream
);
750 /* Faster version when locking is not necessary.
752 This function is not part of POSIX and therefore no official
753 cancellation point. But due to similarity with an POSIX interface
754 or due to the implementation it is a cancellation point and
755 therefore not marked with __THROW. */
756 extern wint_t fputwc_unlocked (wchar_t __wc
, __FILE
*__stream
);
758 /* These are defined to be equivalent to the `char' functions defined
761 These functions are not part of POSIX and therefore no official
762 cancellation point. But due to similarity with an POSIX interface
763 or due to the implementation they are cancellation points and
764 therefore not marked with __THROW. */
765 extern wint_t putwc_unlocked (wchar_t __wc
, __FILE
*__stream
);
766 extern wint_t putwchar_unlocked (wchar_t __wc
);
769 /* This function does the same as `fgetws' but does not lock the stream.
771 This function is not part of POSIX and therefore no official
772 cancellation point. But due to similarity with an POSIX interface
773 or due to the implementation it is a cancellation point and
774 therefore not marked with __THROW. */
775 extern wchar_t *fgetws_unlocked (wchar_t *__restrict __ws
, int __n
,
776 __FILE
*__restrict __stream
);
778 /* This function does the same as `fputws' but does not lock the stream.
780 This function is not part of POSIX and therefore no official
781 cancellation point. But due to similarity with an POSIX interface
782 or due to the implementation it is a cancellation point and
783 therefore not marked with __THROW. */
784 extern int fputws_unlocked (__const
wchar_t *__restrict __ws
,
785 __FILE
*__restrict __stream
);
789 __BEGIN_NAMESPACE_C99
790 /* Format TP into S according to FORMAT.
791 Write no more than MAXSIZE wide characters and return the number
792 of wide characters written, or 0 if it would exceed MAXSIZE. */
793 extern size_t wcsftime (wchar_t *__restrict __s
, size_t __maxsize
,
794 __const
wchar_t *__restrict __format
,
795 __const
struct tm
*__restrict __tp
) __THROW
;
799 # include <xlocale.h>
801 /* Similar to `wcsftime' but takes the information from
802 the provided locale and not the global locale. */
803 extern size_t wcsftime_l (wchar_t *__restrict __s
, size_t __maxsize
,
804 __const
wchar_t *__restrict __format
,
805 __const
struct tm
*__restrict __tp
,
806 __locale_t __loc
) __THROW
;
809 /* The X/Open standard demands that most of the functions defined in
810 the <wctype.h> header must also appear here. This is probably
811 because some X/Open members wrote their implementation before the
812 ISO C standard was published and introduced the better solution.
813 We have to provide these definitions for compliance reasons but we
814 do this nonsense only if really necessary. */
815 #if defined __USE_UNIX98 && !defined __USE_GNU
816 # define __need_iswxxx
822 #endif /* _WCHAR_H defined */