1 /* Copyright (C) 1995-2002, 2003 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>
31 #ifndef __UCLIBC_HAS_WCHAR__
32 #error Attempted to include wchar.h when uClibc built without wide char support.
36 /* Get FILE definition. */
37 # define __need___FILE
42 /* Get va_list definition. */
43 # define __need___va_list
46 /* Get size_t, wchar_t, wint_t and NULL from <stddef.h>. */
47 # define __need_size_t
48 # define __need_wchar_t
54 #include <bits/wchar.h>
56 /* We try to get wint_t from <stddef.h>, but not all GCC versions define it
57 there. So define it ourselves if it remains undefined. */
59 /* Integral type unchanged by default argument promotions that can
60 hold any value corresponding to members of the extended character
61 set, as well as at least one value that does not correspond to any
62 member of the extended character set. */
64 typedef unsigned int wint_t;
66 /* Work around problems with the <stddef.h> file which doesn't put
67 wint_t in the std namespace. */
68 # if defined __cplusplus && defined _GLIBCPP_USE_NAMESPACES \
69 && defined __WINT_TYPE__
71 typedef __WINT_TYPE__ wint_t;
77 #ifndef __mbstate_t_defined
78 # define __mbstate_t_defined 1
79 /* Conversion state information. */
94 } __value; /* Value so far. */
98 #undef __need_mbstate_t
101 /* The rest of the file is only used if used if __need_mbstate_t is not
105 __BEGIN_NAMESPACE_C99
107 typedef __mbstate_t mbstate_t;
110 __USING_NAMESPACE_C99(mbstate_t)
114 /* These constants might also be defined in <inttypes.h>. */
115 # define WCHAR_MIN __WCHAR_MIN
116 # define WCHAR_MAX __WCHAR_MAX
120 # define WEOF (0xffffffffu)
123 /* For XPG4 compliance we have to define the stuff from <wctype.h> here
125 #if defined __USE_XOPEN && !defined __USE_UNIX98
132 __BEGIN_NAMESPACE_STD
133 /* This incomplete type is defined in <time.h> but needed here because
136 /* XXX We have to clean this up at some point. Since tm is in the std
137 namespace but wcsftime is in __c99 the type wouldn't be found
138 without inserting it in the global namespace. */
139 __USING_NAMESPACE_STD(tm)
143 __BEGIN_NAMESPACE_C99
144 /* Copy SRC to DEST. */
145 extern wchar_t *wcscpy (wchar_t *__restrict __dest,
146 __const wchar_t *__restrict __src) __THROW;
147 /* Copy no more than N wide-characters of SRC to DEST. */
148 extern wchar_t *wcsncpy (wchar_t *__restrict __dest,
149 __const wchar_t *__restrict __src, size_t __n)
152 /* Append SRC onto DEST. */
153 extern wchar_t *wcscat (wchar_t *__restrict __dest,
154 __const wchar_t *__restrict __src) __THROW;
155 /* Append no more than N wide-characters of SRC onto DEST. */
156 extern wchar_t *wcsncat (wchar_t *__restrict __dest,
157 __const wchar_t *__restrict __src, size_t __n)
160 /* Compare S1 and S2. */
161 extern int wcscmp (__const wchar_t *__s1, __const wchar_t *__s2)
162 __THROW __attribute_pure__;
163 /* Compare N wide-characters of S1 and S2. */
164 extern int wcsncmp (__const wchar_t *__s1, __const wchar_t *__s2, size_t __n)
165 __THROW __attribute_pure__;
169 /* Compare S1 and S2, ignoring case. */
170 extern int wcscasecmp (__const wchar_t *__s1, __const wchar_t *__s2) __THROW;
172 /* Compare no more than N chars of S1 and S2, ignoring case. */
173 extern int wcsncasecmp (__const wchar_t *__s1, __const wchar_t *__s2,
176 #ifdef __UCLIBC_HAS_XLOCALE__
177 /* Similar to the two functions above but take the information from
178 the provided locale and not the global locale. */
179 # include <xlocale.h>
181 extern int wcscasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2,
182 __locale_t __loc) __THROW;
183 extern int __wcscasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2,
184 __locale_t __loc) __THROW;
186 extern int wcsncasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2,
187 size_t __n, __locale_t __loc) __THROW;
188 extern int __wcsncasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2,
189 size_t __n, __locale_t __loc) __THROW;
190 #endif /* __UCLIBC_HAS_XLOCALE__ */
193 __BEGIN_NAMESPACE_C99
194 /* Compare S1 and S2, both interpreted as appropriate to the
195 LC_COLLATE category of the current locale. */
196 extern int wcscoll (__const wchar_t *__s1, __const wchar_t *__s2) __THROW;
197 /* Transform S2 into array pointed to by S1 such that if wcscmp is
198 applied to two transformed strings the result is the as applying
199 `wcscoll' to the original strings. */
200 extern size_t wcsxfrm (wchar_t *__restrict __s1,
201 __const wchar_t *__restrict __s2, size_t __n) __THROW;
205 #ifdef __UCLIBC_HAS_XLOCALE__
206 /* Similar to the two functions above but take the information from
207 the provided locale and not the global locale. */
209 /* Compare S1 and S2, both interpreted as appropriate to the
210 LC_COLLATE category of the given locale. */
211 extern int wcscoll_l (__const wchar_t *__s1, __const wchar_t *__s2,
212 __locale_t __loc) __THROW;
213 extern int __wcscoll_l (__const wchar_t *__s1, __const wchar_t *__s2,
214 __locale_t __loc) __THROW;
216 /* Transform S2 into array pointed to by S1 such that if wcscmp is
217 applied to two transformed strings the result is the as applying
218 `wcscoll' to the original strings. */
219 extern size_t wcsxfrm_l (wchar_t *__s1, __const wchar_t *__s2,
220 size_t __n, __locale_t __loc) __THROW;
221 extern size_t __wcsxfrm_l (wchar_t *__s1, __const wchar_t *__s2,
222 size_t __n, __locale_t __loc) __THROW;
224 #endif /* __UCLIBC_HAS_XLOCALE__ */
226 /* Duplicate S, returning an identical malloc'd string. */
227 extern wchar_t *wcsdup (__const wchar_t *__s) __THROW __attribute_malloc__;
230 __BEGIN_NAMESPACE_C99
231 /* Find the first occurrence of WC in WCS. */
232 extern wchar_t *wcschr (__const wchar_t *__wcs, wchar_t __wc)
233 __THROW __attribute_pure__;
234 /* Find the last occurrence of WC in WCS. */
235 extern wchar_t *wcsrchr (__const wchar_t *__wcs, wchar_t __wc)
236 __THROW __attribute_pure__;
240 /* This function is similar to `wcschr'. But it returns a pointer to
241 the closing NUL wide character in case C is not found in S. */
242 extern wchar_t *wcschrnul (__const wchar_t *__s, wchar_t __wc)
243 __THROW __attribute_pure__;
246 __BEGIN_NAMESPACE_C99
247 /* Return the length of the initial segmet of WCS which
248 consists entirely of wide characters not in REJECT. */
249 extern size_t wcscspn (__const wchar_t *__wcs, __const wchar_t *__reject)
250 __THROW __attribute_pure__;
251 /* Return the length of the initial segmet of WCS which
252 consists entirely of wide characters in ACCEPT. */
253 extern size_t wcsspn (__const wchar_t *__wcs, __const wchar_t *__accept)
254 __THROW __attribute_pure__;
255 /* Find the first occurrence in WCS of any character in ACCEPT. */
256 extern wchar_t *wcspbrk (__const wchar_t *__wcs, __const wchar_t *__accept)
257 __THROW __attribute_pure__;
258 /* Find the first occurrence of NEEDLE in HAYSTACK. */
259 extern wchar_t *wcsstr (__const wchar_t *__haystack, __const wchar_t *__needle)
260 __THROW __attribute_pure__;
262 /* Divide WCS into tokens separated by characters in DELIM. */
263 extern wchar_t *wcstok (wchar_t *__restrict __s,
264 __const wchar_t *__restrict __delim,
265 wchar_t **__restrict __ptr) __THROW;
267 /* Return the number of wide characters in S. */
268 extern size_t wcslen (__const wchar_t *__s) __THROW __attribute_pure__;
272 /* Another name for `wcsstr' from XPG4. */
273 extern wchar_t *wcswcs (__const wchar_t *__haystack, __const wchar_t *__needle)
274 __THROW __attribute_pure__;
278 /* Return the number of wide characters in S, but at most MAXLEN. */
279 extern size_t wcsnlen (__const wchar_t *__s, size_t __maxlen)
280 __THROW __attribute_pure__;
284 __BEGIN_NAMESPACE_C99
285 /* Search N wide characters of S for C. */
286 extern wchar_t *wmemchr (__const wchar_t *__s, wchar_t __c, size_t __n)
287 __THROW __attribute_pure__;
289 /* Compare N wide characters of S1 and S2. */
290 extern int wmemcmp (__const wchar_t *__restrict __s1,
291 __const wchar_t *__restrict __s2, size_t __n)
292 __THROW __attribute_pure__;
294 /* Copy N wide characters of SRC to DEST. */
295 extern wchar_t *wmemcpy (wchar_t *__restrict __s1,
296 __const wchar_t *__restrict __s2, size_t __n) __THROW;
298 /* Copy N wide characters of SRC to DEST, guaranteeing
299 correct behavior for overlapping strings. */
300 extern wchar_t *wmemmove (wchar_t *__s1, __const wchar_t *__s2, size_t __n)
303 /* Set N wide characters of S to C. */
304 extern wchar_t *wmemset (wchar_t *__s, wchar_t __c, size_t __n) __THROW;
308 /* Copy N wide characters of SRC to DEST and return pointer to following
310 extern wchar_t *wmempcpy (wchar_t *__restrict __s1,
311 __const wchar_t *__restrict __s2, size_t __n)
316 __BEGIN_NAMESPACE_C99
317 /* Determine whether C constitutes a valid (one-byte) multibyte
319 extern wint_t btowc (int __c) __THROW;
321 /* Determine whether C corresponds to a member of the extended
322 character set whose multibyte representation is a single byte. */
323 extern int wctob (wint_t __c) __THROW;
325 /* Determine whether PS points to an object representing the initial
327 extern int mbsinit (__const mbstate_t *__ps) __THROW __attribute_pure__;
329 /* Write wide character representation of multibyte character pointed
331 extern size_t mbrtowc (wchar_t *__restrict __pwc,
332 __const char *__restrict __s, size_t __n,
333 mbstate_t *__p) __THROW;
335 /* Write multibyte representation of wide character WC to S. */
336 extern size_t wcrtomb (char *__restrict __s, wchar_t __wc,
337 mbstate_t *__restrict __ps) __THROW;
339 /* Return number of bytes in multibyte character pointed to by S. */
340 extern size_t __mbrlen (__const char *__restrict __s, size_t __n,
341 mbstate_t *__restrict __ps) __THROW;
342 extern size_t mbrlen (__const char *__restrict __s, size_t __n,
343 mbstate_t *__restrict __ps) __THROW;
345 /* Write wide character representation of multibyte character string
347 extern size_t mbsrtowcs (wchar_t *__restrict __dst,
348 __const char **__restrict __src, size_t __len,
349 mbstate_t *__restrict __ps) __THROW;
351 /* Write multibyte character representation of wide character string
353 extern size_t wcsrtombs (char *__restrict __dst,
354 __const wchar_t **__restrict __src, size_t __len,
355 mbstate_t *__restrict __ps) __THROW;
360 /* Write wide character representation of at most NMC bytes of the
361 multibyte character string SRC to DST. */
362 extern size_t mbsnrtowcs (wchar_t *__restrict __dst,
363 __const char **__restrict __src, size_t __nmc,
364 size_t __len, mbstate_t *__restrict __ps) __THROW;
366 /* Write multibyte character representation of at most NWC characters
367 from the wide character string SRC to DST. */
368 extern size_t wcsnrtombs (char *__restrict __dst,
369 __const wchar_t **__restrict __src,
370 size_t __nwc, size_t __len,
371 mbstate_t *__restrict __ps) __THROW;
375 /* The following functions are extensions found in X/Open CAE. */
377 /* Determine number of column positions required for C. */
378 extern int wcwidth (wchar_t __c) __THROW;
380 /* Determine number of column positions required for first N wide
381 characters (or fewer if S ends before this) in S. */
382 extern int wcswidth (__const wchar_t *__s, size_t __n) __THROW;
383 #endif /* Use X/Open. */
386 __BEGIN_NAMESPACE_C99
387 #ifdef __UCLIBC_HAS_FLOATS__
388 /* Convert initial portion of the wide string NPTR to `double'
390 extern double wcstod (__const wchar_t *__restrict __nptr,
391 wchar_t **__restrict __endptr) __THROW;
394 /* Likewise for `float' and `long double' sizes of floating-point numbers. */
395 extern float wcstof (__const wchar_t *__restrict __nptr,
396 wchar_t **__restrict __endptr) __THROW;
397 extern long double wcstold (__const wchar_t *__restrict __nptr,
398 wchar_t **__restrict __endptr) __THROW;
400 #endif /* __UCLIBC_HAS_FLOATS__ */
403 /* Convert initial portion of wide string NPTR to `long int'
405 extern long int wcstol (__const wchar_t *__restrict __nptr,
406 wchar_t **__restrict __endptr, int __base) __THROW;
408 /* Convert initial portion of wide string NPTR to `unsigned long int'
410 extern unsigned long int wcstoul (__const wchar_t *__restrict __nptr,
411 wchar_t **__restrict __endptr, int __base)
414 #if defined __USE_ISOC99 || (defined __GNUC__ && defined __USE_GNU)
415 /* Convert initial portion of wide string NPTR to `long int'
418 extern long long int wcstoll (__const wchar_t *__restrict __nptr,
419 wchar_t **__restrict __endptr, int __base)
422 /* Convert initial portion of wide string NPTR to `unsigned long long int'
425 extern unsigned long long int wcstoull (__const wchar_t *__restrict __nptr,
426 wchar_t **__restrict __endptr,
428 #endif /* ISO C99 or GCC and GNU. */
431 #if defined __GNUC__ && defined __USE_GNU
432 /* Convert initial portion of wide string NPTR to `long int'
435 extern long long int wcstoq (__const wchar_t *__restrict __nptr,
436 wchar_t **__restrict __endptr, int __base)
439 /* Convert initial portion of wide string NPTR to `unsigned long long int'
442 extern unsigned long long int wcstouq (__const wchar_t *__restrict __nptr,
443 wchar_t **__restrict __endptr,
445 #endif /* GCC and use GNU. */
448 #ifdef __UCLIBC_HAS_XLOCALE__
449 /* The concept of one static locale per category is not very well
450 thought out. Many applications will need to process its data using
451 information from several different locales. Another application is
452 the implementation of the internationalization handling in the
453 upcoming ISO C++ standard library. To support this another set of
454 the functions using locale data exist which have an additional
457 Attention: all these functions are *not* standardized in any form.
458 This is a proof-of-concept implementation. */
460 /* Structure for reentrant locale using functions. This is an
461 (almost) opaque type for the user level programs. */
462 # include <xlocale.h>
464 /* Special versions of the functions above which take the locale to
465 use as an additional parameter. */
466 extern long int wcstol_l (__const wchar_t *__restrict __nptr,
467 wchar_t **__restrict __endptr, int __base,
468 __locale_t __loc) __THROW;
469 extern long int __wcstol_l (__const wchar_t *__restrict __nptr,
470 wchar_t **__restrict __endptr, int __base,
471 __locale_t __loc) __THROW;
473 extern unsigned long int wcstoul_l (__const wchar_t *__restrict __nptr,
474 wchar_t **__restrict __endptr,
475 int __base, __locale_t __loc) __THROW;
476 extern unsigned long int __wcstoul_l (__const wchar_t *__restrict __nptr,
477 wchar_t **__restrict __endptr,
478 int __base, __locale_t __loc) __THROW;
481 extern long long int wcstoll_l (__const wchar_t *__restrict __nptr,
482 wchar_t **__restrict __endptr,
483 int __base, __locale_t __loc) __THROW;
485 extern long long int __wcstoll_l (__const wchar_t *__restrict __nptr,
486 wchar_t **__restrict __endptr,
487 int __base, __locale_t __loc) __THROW;
490 extern unsigned long long int wcstoull_l (__const wchar_t *__restrict __nptr,
491 wchar_t **__restrict __endptr,
492 int __base, __locale_t __loc)
495 extern unsigned long long int __wcstoull_l (__const wchar_t *__restrict __nptr,
496 wchar_t **__restrict __endptr,
497 int __base, __locale_t __loc)
500 #ifdef __UCLIBC_HAS_FLOATS__
501 extern double wcstod_l (__const wchar_t *__restrict __nptr,
502 wchar_t **__restrict __endptr, __locale_t __loc)
504 extern double __wcstod_l (__const wchar_t *__restrict __nptr,
505 wchar_t **__restrict __endptr, __locale_t __loc)
508 extern float wcstof_l (__const wchar_t *__restrict __nptr,
509 wchar_t **__restrict __endptr, __locale_t __loc)
511 extern float __wcstof_l (__const wchar_t *__restrict __nptr,
512 wchar_t **__restrict __endptr, __locale_t __loc)
515 extern long double wcstold_l (__const wchar_t *__restrict __nptr,
516 wchar_t **__restrict __endptr,
517 __locale_t __loc) __THROW;
518 extern long double __wcstold_l (__const wchar_t *__restrict __nptr,
519 wchar_t **__restrict __endptr,
520 __locale_t __loc) __THROW;
521 #endif /* __UCLIBC_HAS_FLOATS__ */
522 #endif /* __UCLIBC_HAS_XLOCALE__ */
527 /* Copy SRC to DEST, returning the address of the terminating L'\0' in
529 extern wchar_t *wcpcpy (wchar_t *__dest, __const wchar_t *__src) __THROW;
531 /* Copy no more than N characters of SRC to DEST, returning the address of
532 the last character written into DEST. */
533 extern wchar_t *wcpncpy (wchar_t *__dest, __const wchar_t *__src, size_t __n)
538 /* Wide character I/O functions. */
539 #if defined __USE_ISOC99 || defined __USE_UNIX98
540 __BEGIN_NAMESPACE_C99
542 /* Select orientation for stream. */
543 extern int fwide (__FILE *__fp, int __mode) __THROW;
546 /* Write formatted output to STREAM.
548 This function is a possible cancellation point and therefore not
549 marked with __THROW. */
550 extern int fwprintf (__FILE *__restrict __stream,
551 __const wchar_t *__restrict __format, ...)
552 /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */;
553 /* Write formatted output to stdout.
555 This function is a possible cancellation point and therefore not
556 marked with __THROW. */
557 extern int wprintf (__const wchar_t *__restrict __format, ...)
558 /* __attribute__ ((__format__ (__wprintf__, 1, 2))) */;
559 /* Write formatted output of at most N characters to S. */
560 extern int swprintf (wchar_t *__restrict __s, size_t __n,
561 __const wchar_t *__restrict __format, ...)
562 __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
564 /* Write formatted output to S from argument list ARG.
566 This function is a possible cancellation point and therefore not
567 marked with __THROW. */
568 extern int vfwprintf (__FILE *__restrict __s,
569 __const wchar_t *__restrict __format,
570 __gnuc_va_list __arg)
571 /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */;
572 /* Write formatted output to stdout from argument list ARG.
574 This function is a possible cancellation point and therefore not
575 marked with __THROW. */
576 extern int vwprintf (__const wchar_t *__restrict __format,
577 __gnuc_va_list __arg)
578 /* __attribute__ ((__format__ (__wprintf__, 1, 0))) */;
579 /* Write formatted output of at most N character to S from argument
581 extern int vswprintf (wchar_t *__restrict __s, size_t __n,
582 __const wchar_t *__restrict __format,
583 __gnuc_va_list __arg)
584 __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
587 /* Read formatted input from STREAM.
589 This function is a possible cancellation point and therefore not
590 marked with __THROW. */
591 extern int fwscanf (__FILE *__restrict __stream,
592 __const wchar_t *__restrict __format, ...)
593 /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
594 /* Read formatted input from stdin.
596 This function is a possible cancellation point and therefore not
597 marked with __THROW. */
598 extern int wscanf (__const wchar_t *__restrict __format, ...)
599 /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
600 /* Read formatted input from S. */
601 extern int swscanf (__const wchar_t *__restrict __s,
602 __const wchar_t *__restrict __format, ...)
603 __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
606 #endif /* Use ISO C99 and Unix98. */
609 __BEGIN_NAMESPACE_C99
611 /* Read formatted input from S into argument list ARG.
613 This function is a possible cancellation point and therefore not
614 marked with __THROW. */
615 extern int vfwscanf (__FILE *__restrict __s,
616 __const wchar_t *__restrict __format,
617 __gnuc_va_list __arg)
618 /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
619 /* Read formatted input from stdin into argument list ARG.
621 This function is a possible cancellation point and therefore not
622 marked with __THROW. */
623 extern int vwscanf (__const wchar_t *__restrict __format,
624 __gnuc_va_list __arg)
625 /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
626 /* Read formatted input from S into argument list ARG. */
627 extern int vswscanf (__const wchar_t *__restrict __s,
628 __const wchar_t *__restrict __format,
629 __gnuc_va_list __arg)
630 __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
633 #endif /* Use ISO C99. */
636 __BEGIN_NAMESPACE_C99
637 /* Read a character from STREAM.
639 These functions are possible cancellation points and therefore not
640 marked with __THROW. */
641 extern wint_t fgetwc (__FILE *__stream);
642 extern wint_t getwc (__FILE *__stream);
644 /* Read a character from stdin.
646 This function is a possible cancellation point and therefore not
647 marked with __THROW. */
648 extern wint_t getwchar (void);
651 /* Write a character to STREAM.
653 These functions are possible cancellation points and therefore not
654 marked with __THROW. */
655 extern wint_t fputwc (wchar_t __wc, __FILE *__stream);
656 extern wint_t putwc (wchar_t __wc, __FILE *__stream);
658 /* Write a character to stdout.
660 This function is a possible cancellation points and therefore not
661 marked with __THROW. */
662 extern wint_t putwchar (wchar_t __wc);
665 /* Get a newline-terminated wide character string of finite length
668 This function is a possible cancellation points and therefore not
669 marked with __THROW. */
670 extern wchar_t *fgetws (wchar_t *__restrict __ws, int __n,
671 __FILE *__restrict __stream);
673 /* Write a string to STREAM.
675 This function is a possible cancellation points and therefore not
676 marked with __THROW. */
677 extern int fputws (__const wchar_t *__restrict __ws,
678 __FILE *__restrict __stream);
681 /* Push a character back onto the input buffer of STREAM.
683 This function is a possible cancellation points and therefore not
684 marked with __THROW. */
685 extern wint_t ungetwc (wint_t __wc, __FILE *__stream);
690 /* These are defined to be equivalent to the `char' functions defined
693 These functions are not part of POSIX and therefore no official
694 cancellation point. But due to similarity with an POSIX interface
695 or due to the implementation they are cancellation points and
696 therefore not marked with __THROW. */
697 extern wint_t getwc_unlocked (__FILE *__stream);
698 extern wint_t getwchar_unlocked (void);
700 /* This is the wide character version of a GNU extension.
702 This function is not part of POSIX and therefore no official
703 cancellation point. But due to similarity with an POSIX interface
704 or due to the implementation it is a cancellation point and
705 therefore not marked with __THROW. */
706 extern wint_t fgetwc_unlocked (__FILE *__stream);
708 /* Faster version when locking is not necessary.
710 This function is not part of POSIX and therefore no official
711 cancellation point. But due to similarity with an POSIX interface
712 or due to the implementation it is a cancellation point and
713 therefore not marked with __THROW. */
714 extern wint_t fputwc_unlocked (wchar_t __wc, __FILE *__stream);
716 /* These are defined to be equivalent to the `char' functions defined
719 These functions are not part of POSIX and therefore no official
720 cancellation point. But due to similarity with an POSIX interface
721 or due to the implementation they are cancellation points and
722 therefore not marked with __THROW. */
723 extern wint_t putwc_unlocked (wchar_t __wc, __FILE *__stream);
724 extern wint_t putwchar_unlocked (wchar_t __wc);
727 /* This function does the same as `fgetws' but does not lock the stream.
729 This function is not part of POSIX and therefore no official
730 cancellation point. But due to similarity with an POSIX interface
731 or due to the implementation it is a cancellation point and
732 therefore not marked with __THROW. */
733 extern wchar_t *fgetws_unlocked (wchar_t *__restrict __ws, int __n,
734 __FILE *__restrict __stream);
736 /* This function does the same as `fputws' but does not lock the stream.
738 This function is not part of POSIX and therefore no official
739 cancellation point. But due to similarity with an POSIX interface
740 or due to the implementation it is a cancellation point and
741 therefore not marked with __THROW. */
742 extern int fputws_unlocked (__const wchar_t *__restrict __ws,
743 __FILE *__restrict __stream);
747 __BEGIN_NAMESPACE_C99
748 /* Format TP into S according to FORMAT.
749 Write no more than MAXSIZE wide characters and return the number
750 of wide characters written, or 0 if it would exceed MAXSIZE. */
751 extern size_t wcsftime (wchar_t *__restrict __s, size_t __maxsize,
752 __const wchar_t *__restrict __format,
753 __const struct tm *__restrict __tp) __THROW;
757 #ifdef __UCLIBC_HAS_XLOCALE__
758 # include <xlocale.h>
760 /* Similar to `wcsftime' but takes the information from
761 the provided locale and not the global locale. */
762 extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize,
763 __const wchar_t *__restrict __format,
764 __const struct tm *__restrict __tp,
765 __locale_t __loc) __THROW;
766 extern size_t __wcsftime_l (wchar_t *__restrict __s, size_t __maxsize,
767 __const wchar_t *__restrict __format,
768 __const struct tm *__restrict __tp,
769 __locale_t __loc) __THROW;
770 #endif /* __UCLIBC_HAS_XLOCALE__ */
773 /* The X/Open standard demands that most of the functions defined in
774 the <wctype.h> header must also appear here. This is probably
775 because some X/Open members wrote their implementation before the
776 ISO C standard was published and introduced the better solution.
777 We have to provide these definitions for compliance reasons but we
778 do this nonsense only if really necessary. */
779 #if defined __USE_UNIX98 && !defined __USE_GNU
780 # define __need_iswxxx
786 #endif /* _WCHAR_H defined */