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, see
16 <http://www.gnu.org/licenses/>. */
19 * ISO C99 Standard: 7.24
20 * Extended multibyte and wide character utilities <wchar.h>
25 #ifndef __need_mbstate_t
27 # include <features.h>
30 #ifndef __UCLIBC_HAS_WCHAR__
31 #error Attempted to include wchar.h when uClibc built without wide char support.
35 /* Get FILE definition. */
36 # define __need___FILE
41 /* Get va_list definition. */
42 # define __need___va_list
45 /* Get size_t, wchar_t, wint_t and NULL from <stddef.h>. */
46 # define __need_size_t
47 # define __need_wchar_t
53 #include <bits/wchar.h>
55 /* We try to get wint_t from <stddef.h>, but not all GCC versions define it
56 there. So define it ourselves if it remains undefined. */
58 /* Integral type unchanged by default argument promotions that can
59 hold any value corresponding to members of the extended character
60 set, as well as at least one value that does not correspond to any
61 member of the extended character set. */
63 typedef unsigned int wint_t;
65 /* Work around problems with the <stddef.h> file which doesn't put
66 wint_t in the std namespace. */
67 # if defined __cplusplus && defined _GLIBCPP_USE_NAMESPACES \
68 && defined __WINT_TYPE__
70 typedef __WINT_TYPE__
wint_t;
76 #ifndef __mbstate_t_defined
77 # define __mbstate_t_defined 1
78 /* Conversion state information. */
93 } __value
; /* Value so far. */
97 #undef __need_mbstate_t
100 /* The rest of the file is only used if used if __need_mbstate_t is not
104 __BEGIN_NAMESPACE_C99
106 typedef __mbstate_t
mbstate_t;
109 __USING_NAMESPACE_C99(mbstate_t)
113 /* These constants might also be defined in <inttypes.h>. */
114 # define WCHAR_MIN __WCHAR_MIN
115 # define WCHAR_MAX __WCHAR_MAX
119 # define WEOF (0xffffffffu)
122 /* For XPG4 compliance we have to define the stuff from <wctype.h> here
124 #if defined __USE_XOPEN && !defined __USE_UNIX98
131 __BEGIN_NAMESPACE_STD
132 /* 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
)
142 __BEGIN_NAMESPACE_C99
143 /* Copy SRC to DEST. */
144 extern wchar_t *wcscpy (wchar_t *__restrict __dest
,
145 const wchar_t *__restrict __src
) __THROW
;
146 /* Copy no more than N wide-characters of SRC to DEST. */
147 extern wchar_t *wcsncpy (wchar_t *__restrict __dest
,
148 const wchar_t *__restrict __src
, size_t __n
)
151 /* Append SRC onto DEST. */
152 extern wchar_t *wcscat (wchar_t *__restrict __dest
,
153 const wchar_t *__restrict __src
) __THROW
;
154 libc_hidden_proto(wcscat
)
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 libc_hidden_proto(wcscmp
)
164 /* Compare N wide-characters of S1 and S2. */
165 extern int wcsncmp (const wchar_t *__s1
, const wchar_t *__s2
, size_t __n
)
166 __THROW __attribute_pure__
;
170 /* Compare S1 and S2, ignoring case. */
171 extern int wcscasecmp (const wchar_t *__s1
, const wchar_t *__s2
) __THROW
;
173 /* Compare no more than N chars of S1 and S2, ignoring case. */
174 extern int wcsncasecmp (const wchar_t *__s1
, const wchar_t *__s2
,
177 #ifdef __UCLIBC_HAS_XLOCALE__
178 /* Similar to the two functions above but take the information from
179 the provided locale and not the global locale. */
180 # include <xlocale.h>
182 extern int wcscasecmp_l (const wchar_t *__s1
, const wchar_t *__s2
,
183 __locale_t __loc
) __THROW
;
184 libc_hidden_proto(wcscasecmp_l
)
186 extern int wcsncasecmp_l (const wchar_t *__s1
, const wchar_t *__s2
,
187 size_t __n
, __locale_t __loc
) __THROW
;
188 libc_hidden_proto(wcsncasecmp_l
)
189 #endif /* __UCLIBC_HAS_XLOCALE__ */
192 __BEGIN_NAMESPACE_C99
193 /* Compare S1 and S2, both interpreted as appropriate to the
194 LC_COLLATE category of the current locale. */
195 extern int wcscoll (const wchar_t *__s1
, const wchar_t *__s2
) __THROW
;
196 libc_hidden_proto(wcscoll
)
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 libc_hidden_proto(wcscoll_l
)
215 /* Transform S2 into array pointed to by S1 such that if wcscmp is
216 applied to two transformed strings the result is the as applying
217 `wcscoll' to the original strings. */
218 extern size_t wcsxfrm_l (wchar_t *__s1
, const wchar_t *__s2
,
219 size_t __n
, __locale_t __loc
) __THROW
;
220 libc_hidden_proto(wcsxfrm_l
)
222 #endif /* __UCLIBC_HAS_XLOCALE__ */
224 /* Duplicate S, returning an identical malloc'd string. */
225 extern wchar_t *wcsdup (const wchar_t *__s
) __THROW __attribute_malloc__
;
228 __BEGIN_NAMESPACE_C99
229 /* Find the first occurrence of WC in WCS. */
230 extern wchar_t *wcschr (const wchar_t *__wcs
, wchar_t __wc
)
231 __THROW __attribute_pure__
;
232 /* Find the last occurrence of WC in WCS. */
233 extern wchar_t *wcsrchr (const wchar_t *__wcs
, wchar_t __wc
)
234 __THROW __attribute_pure__
;
238 /* This function is similar to `wcschr'. But it returns a pointer to
239 the closing NUL wide character in case C is not found in S. */
240 extern wchar_t *wcschrnul (const wchar_t *__s
, wchar_t __wc
)
241 __THROW __attribute_pure__
;
244 __BEGIN_NAMESPACE_C99
245 /* Return the length of the initial segmet of WCS which
246 consists entirely of wide characters not in REJECT. */
247 extern size_t wcscspn (const wchar_t *__wcs
, const wchar_t *__reject
)
248 __THROW __attribute_pure__
;
249 /* Return the length of the initial segmet of WCS which
250 consists entirely of wide characters in ACCEPT. */
251 extern size_t wcsspn (const wchar_t *__wcs
, const wchar_t *__accept
)
252 __THROW __attribute_pure__
;
253 libc_hidden_proto(wcsspn
)
254 /* Find the first occurrence in WCS of any character in ACCEPT. */
255 extern wchar_t *wcspbrk (const wchar_t *__wcs
, const wchar_t *__accept
)
256 __THROW __attribute_pure__
;
257 libc_hidden_proto(wcspbrk
)
258 /* Find the first occurrence of NEEDLE in HAYSTACK. */
259 /* SuSv uses restrict keyword, glibc does not */
260 extern wchar_t *wcsstr (const wchar_t *__restrict __haystack
, const wchar_t *__restrict __needle
)
261 __THROW __attribute_pure__
;
263 /* Divide WCS into tokens separated by characters in DELIM. */
264 extern wchar_t *wcstok (wchar_t *__restrict __s
,
265 const wchar_t *__restrict __delim
,
266 wchar_t **__restrict __ptr
) __THROW
;
268 /* Return the number of wide characters in S. */
269 extern size_t wcslen (const wchar_t *__s
) __THROW __attribute_pure__
;
270 libc_hidden_proto(wcslen
)
273 #if defined __USE_XOPEN && defined __UCLIBC_SUSV3_LEGACY__
274 /* Another name for `wcsstr' from XPG4. */
275 /* SuSv3 did not use restrict keyword, probably because it was marked LEGACY
276 we do to be in sync with wcsstr */
277 extern wchar_t *wcswcs (const wchar_t *__restrict __haystack
, const wchar_t *__restrict __needle
)
278 __THROW __attribute_pure__
;
282 /* Return the number of wide characters in S, but at most MAXLEN. */
283 extern size_t wcsnlen (const wchar_t *__s
, size_t __maxlen
)
284 __THROW __attribute_pure__
;
285 libc_hidden_proto(wcsnlen
)
289 __BEGIN_NAMESPACE_C99
290 /* Search N wide characters of S for C. */
291 extern wchar_t *wmemchr (const wchar_t *__s
, wchar_t __c
, size_t __n
)
292 __THROW __attribute_pure__
;
293 libc_hidden_proto(wmemchr
)
295 /* Compare N wide characters of S1 and S2. */
296 /* SuSv4 does not use restrict keyword for S1 and S2, glibc does */
297 extern int wmemcmp (const wchar_t *__s1
,
298 const wchar_t *__s2
, size_t __n
)
299 __THROW __attribute_pure__
;
301 /* Copy N wide characters of SRC to DEST. */
302 extern wchar_t *wmemcpy (wchar_t *__restrict __s1
,
303 const wchar_t *__restrict __s2
, size_t __n
) __THROW
;
304 libc_hidden_proto(wmemcpy
)
306 /* Copy N wide characters of SRC to DEST, guaranteeing
307 correct behavior for overlapping strings. */
308 extern wchar_t *wmemmove (wchar_t *__s1
, const wchar_t *__s2
, size_t __n
)
311 /* Set N wide characters of S to C. */
312 extern wchar_t *wmemset (wchar_t *__s
, wchar_t __c
, size_t __n
) __THROW
;
316 /* Copy N wide characters of SRC to DEST and return pointer to following
318 extern wchar_t *wmempcpy (wchar_t *__restrict __s1
,
319 const wchar_t *__restrict __s2
, size_t __n
)
321 libc_hidden_proto(wmempcpy
)
325 __BEGIN_NAMESPACE_C99
326 /* Determine whether C constitutes a valid (one-byte) multibyte
328 extern wint_t btowc (int __c
) __THROW
;
329 libc_hidden_proto(btowc
)
331 /* Determine whether C corresponds to a member of the extended
332 character set whose multibyte representation is a single byte. */
333 extern int wctob (wint_t __c
) __THROW
;
335 /* Determine whether PS points to an object representing the initial
337 extern int mbsinit (const mbstate_t *__ps
) __THROW __attribute_pure__
;
338 libc_hidden_proto(mbsinit
)
340 /* Write wide character representation of multibyte character pointed
342 extern size_t mbrtowc (wchar_t *__restrict __pwc
,
343 const char *__restrict __s
, size_t __n
,
344 mbstate_t *__p
) __THROW
;
345 libc_hidden_proto(mbrtowc
)
347 /* Write multibyte representation of wide character WC to S. */
348 extern size_t wcrtomb (char *__restrict __s
, wchar_t __wc
,
349 mbstate_t *__restrict __ps
) __THROW
;
350 libc_hidden_proto(wcrtomb
)
352 /* Return number of bytes in multibyte character pointed to by S. */
353 #if 0 /* uClibc: disabled */
354 extern size_t __mbrlen (const char *__restrict __s
, size_t __n
,
355 mbstate_t *__restrict __ps
) __THROW
;
357 extern size_t mbrlen (const char *__restrict __s
, size_t __n
,
358 mbstate_t *__restrict __ps
) __THROW
;
359 libc_hidden_proto(mbrlen
)
361 /* Write wide character representation of multibyte character string
363 extern size_t mbsrtowcs (wchar_t *__restrict __dst
,
364 const char **__restrict __src
, size_t __len
,
365 mbstate_t *__restrict __ps
) __THROW
;
366 libc_hidden_proto(mbsrtowcs
)
368 /* Write multibyte character representation of wide character string
370 extern size_t wcsrtombs (char *__restrict __dst
,
371 const wchar_t **__restrict __src
, size_t __len
,
372 mbstate_t *__restrict __ps
) __THROW
;
373 libc_hidden_proto(wcsrtombs
)
378 /* Write wide character representation of at most NMC bytes of the
379 multibyte character string SRC to DST. */
380 extern size_t mbsnrtowcs (wchar_t *__restrict __dst
,
381 const char **__restrict __src
, size_t __nmc
,
382 size_t __len
, mbstate_t *__restrict __ps
) __THROW
;
383 libc_hidden_proto(mbsnrtowcs
)
385 /* Write multibyte character representation of at most NWC characters
386 from the wide character string SRC to DST. */
387 extern size_t wcsnrtombs (char *__restrict __dst
,
388 const wchar_t **__restrict __src
,
389 size_t __nwc
, size_t __len
,
390 mbstate_t *__restrict __ps
) __THROW
;
391 libc_hidden_proto(wcsnrtombs
)
395 /* The following functions are extensions found in X/Open CAE. */
397 /* Determine number of column positions required for C. */
398 extern int wcwidth (wchar_t __c
) __THROW
;
400 /* Determine number of column positions required for first N wide
401 characters (or fewer if S ends before this) in S. */
402 extern int wcswidth (const wchar_t *__s
, size_t __n
) __THROW
;
403 libc_hidden_proto(wcswidth
)
404 #endif /* Use X/Open. */
407 __BEGIN_NAMESPACE_C99
408 #ifdef __UCLIBC_HAS_FLOATS__
409 /* Convert initial portion of the wide string NPTR to `double'
411 extern double wcstod (const wchar_t *__restrict __nptr
,
412 wchar_t **__restrict __endptr
) __THROW
;
415 /* Likewise for `float' and `long double' sizes of floating-point numbers. */
416 extern float wcstof (const wchar_t *__restrict __nptr
,
417 wchar_t **__restrict __endptr
) __THROW
;
418 extern long double wcstold (const wchar_t *__restrict __nptr
,
419 wchar_t **__restrict __endptr
) __THROW
;
421 #endif /* __UCLIBC_HAS_FLOATS__ */
424 /* Convert initial portion of wide string NPTR to `long int'
426 extern long int wcstol (const wchar_t *__restrict __nptr
,
427 wchar_t **__restrict __endptr
, int __base
) __THROW
;
429 /* Convert initial portion of wide string NPTR to `unsigned long int'
431 extern unsigned long int wcstoul (const wchar_t *__restrict __nptr
,
432 wchar_t **__restrict __endptr
, int __base
)
435 #if defined __USE_ISOC99 || (defined __GNUC__ && defined __USE_GNU)
436 /* Convert initial portion of wide string NPTR to `long long int'
439 extern long long int wcstoll (const wchar_t *__restrict __nptr
,
440 wchar_t **__restrict __endptr
, int __base
)
443 /* Convert initial portion of wide string NPTR to `unsigned long long int'
446 extern unsigned long long int wcstoull (const wchar_t *__restrict __nptr
,
447 wchar_t **__restrict __endptr
,
449 #endif /* ISO C99 or GCC and GNU. */
452 #if defined __GNUC__ && defined __USE_GNU
453 /* Convert initial portion of wide string NPTR to `long long int'
456 extern long long int wcstoq (const wchar_t *__restrict __nptr
,
457 wchar_t **__restrict __endptr
, int __base
)
460 /* Convert initial portion of wide string NPTR to `unsigned long long int'
463 extern unsigned long long int wcstouq (const wchar_t *__restrict __nptr
,
464 wchar_t **__restrict __endptr
,
466 #endif /* GCC and use GNU. */
469 #ifdef __UCLIBC_HAS_XLOCALE__
470 /* The concept of one static locale per category is not very well
471 thought out. Many applications will need to process its data using
472 information from several different locales. Another application is
473 the implementation of the internationalization handling in the
474 upcoming ISO C++ standard library. To support this another set of
475 the functions using locale data exist which have an additional
478 Attention: all these functions are *not* standardized in any form.
479 This is a proof-of-concept implementation. */
481 /* Structure for reentrant locale using functions. This is an
482 (almost) opaque type for the user level programs. */
483 # include <xlocale.h>
485 /* Special versions of the functions above which take the locale to
486 use as an additional parameter. */
487 extern long int wcstol_l (const wchar_t *__restrict __nptr
,
488 wchar_t **__restrict __endptr
, int __base
,
489 __locale_t __loc
) __THROW
;
491 extern unsigned long int wcstoul_l (const wchar_t *__restrict __nptr
,
492 wchar_t **__restrict __endptr
,
493 int __base
, __locale_t __loc
) __THROW
;
496 extern long long int wcstoll_l (const wchar_t *__restrict __nptr
,
497 wchar_t **__restrict __endptr
,
498 int __base
, __locale_t __loc
) __THROW
;
501 extern unsigned long long int wcstoull_l (const wchar_t *__restrict __nptr
,
502 wchar_t **__restrict __endptr
,
503 int __base
, __locale_t __loc
)
506 #ifdef __UCLIBC_HAS_FLOATS__
507 extern double wcstod_l (const wchar_t *__restrict __nptr
,
508 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 #endif /* __UCLIBC_HAS_FLOATS__ */
519 #endif /* __UCLIBC_HAS_XLOCALE__ */
524 /* Copy SRC to DEST, returning the address of the terminating L'\0' in
526 extern wchar_t *wcpcpy (wchar_t *__dest
, const wchar_t *__src
) __THROW
;
528 /* Copy no more than N characters of SRC to DEST, returning the address of
529 the last character written into DEST. */
530 extern wchar_t *wcpncpy (wchar_t *__dest
, const wchar_t *__src
, size_t __n
)
535 /* Wide character I/O functions. */
536 #if defined __USE_ISOC99 || defined __USE_UNIX98
537 __BEGIN_NAMESPACE_C99
539 /* Select orientation for stream. */
540 extern int fwide (__FILE
*__fp
, int __mode
) __THROW
;
543 /* Write formatted output to STREAM.
545 This function is a possible cancellation point and therefore not
546 marked with __THROW. */
547 extern int fwprintf (__FILE
*__restrict __stream
,
548 const wchar_t *__restrict __format
, ...)
549 /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */;
550 /* Write formatted output to stdout.
552 This function is a possible cancellation point and therefore not
553 marked with __THROW. */
554 extern int wprintf (const wchar_t *__restrict __format
, ...)
555 /* __attribute__ ((__format__ (__wprintf__, 1, 2))) */;
556 /* Write formatted output of at most N characters to S. */
557 extern int swprintf (wchar_t *__restrict __s
, size_t __n
,
558 const wchar_t *__restrict __format
, ...)
559 __THROW
/* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
561 /* Write formatted output to S from argument list ARG.
563 This function is a possible cancellation point and therefore not
564 marked with __THROW. */
565 extern int vfwprintf (__FILE
*__restrict __s
,
566 const wchar_t *__restrict __format
,
567 __gnuc_va_list __arg
)
568 /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */;
569 libc_hidden_proto(vfwprintf
)
570 /* Write formatted output to stdout from argument list ARG.
572 This function is a possible cancellation point and therefore not
573 marked with __THROW. */
574 extern int vwprintf (const wchar_t *__restrict __format
,
575 __gnuc_va_list __arg
)
576 /* __attribute__ ((__format__ (__wprintf__, 1, 0))) */;
577 /* Write formatted output of at most N character to S from argument
579 extern int vswprintf (wchar_t *__restrict __s
, size_t __n
,
580 const wchar_t *__restrict __format
,
581 __gnuc_va_list __arg
)
582 __THROW
/* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
583 libc_hidden_proto(vswprintf
)
586 /* Read formatted input from STREAM.
588 This function is a possible cancellation point and therefore not
589 marked with __THROW. */
590 extern int fwscanf (__FILE
*__restrict __stream
,
591 const wchar_t *__restrict __format
, ...)
592 /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
593 /* Read formatted input from stdin.
595 This function is a possible cancellation point and therefore not
596 marked with __THROW. */
597 extern int wscanf (const wchar_t *__restrict __format
, ...)
598 /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
599 /* Read formatted input from S. */
600 extern int swscanf (const wchar_t *__restrict __s
,
601 const wchar_t *__restrict __format
, ...)
602 __THROW
/* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
605 #endif /* Use ISO C99 and Unix98. */
608 __BEGIN_NAMESPACE_C99
610 /* Read formatted input from S into argument list ARG.
612 This function is a possible cancellation point and therefore not
613 marked with __THROW. */
614 extern int vfwscanf (__FILE
*__restrict __s
,
615 const wchar_t *__restrict __format
,
616 __gnuc_va_list __arg
)
617 /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
618 libc_hidden_proto(vfwscanf
)
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))) */;
631 libc_hidden_proto(vswscanf
)
634 #endif /* Use ISO C99. */
637 __BEGIN_NAMESPACE_C99
638 /* Read a character from STREAM.
640 These functions are possible cancellation points and therefore not
641 marked with __THROW. */
642 extern wint_t fgetwc (__FILE
*__stream
);
643 libc_hidden_proto(fgetwc
)
644 extern wint_t getwc (__FILE
*__stream
);
646 /* Read a character from stdin.
648 This function is a possible cancellation point and therefore not
649 marked with __THROW. */
650 extern wint_t getwchar (void);
653 /* Write a character to STREAM.
655 These functions are possible cancellation points and therefore not
656 marked with __THROW. */
657 extern wint_t fputwc (wchar_t __wc
, __FILE
*__stream
);
658 libc_hidden_proto(fputwc
)
659 extern wint_t putwc (wchar_t __wc
, __FILE
*__stream
);
661 /* Write a character to stdout.
663 This function is a possible cancellation point and therefore not
664 marked with __THROW. */
665 extern wint_t putwchar (wchar_t __wc
);
668 /* Get a newline-terminated wide character string of finite length
671 This function is a possible cancellation point and therefore not
672 marked with __THROW. */
673 extern wchar_t *fgetws (wchar_t *__restrict __ws
, int __n
,
674 __FILE
*__restrict __stream
);
676 /* Write a string to STREAM.
678 This function is a possible cancellation point and therefore not
679 marked with __THROW. */
680 extern int fputws (const wchar_t *__restrict __ws
,
681 __FILE
*__restrict __stream
);
682 libc_hidden_proto(fputws
)
685 /* Push a character back onto the input buffer of STREAM.
687 This function is a possible cancellation point and therefore not
688 marked with __THROW. */
689 extern wint_t ungetwc (wint_t __wc
, __FILE
*__stream
);
690 libc_hidden_proto(ungetwc
)
695 /* These are defined to be equivalent to the `char' functions defined
698 These functions are not part of POSIX and therefore no official
699 cancellation point. But due to similarity with an POSIX interface
700 or due to the implementation they are cancellation points and
701 therefore not marked with __THROW. */
702 extern wint_t getwc_unlocked (__FILE
*__stream
);
703 extern wint_t getwchar_unlocked (void);
705 /* This is the wide character version of a GNU extension.
707 This function is not part of POSIX and therefore no official
708 cancellation point. But due to similarity with an POSIX interface
709 or due to the implementation it is a cancellation point and
710 therefore not marked with __THROW. */
711 extern wint_t fgetwc_unlocked (__FILE
*__stream
);
712 libc_hidden_proto(fgetwc_unlocked
)
714 /* Faster version when locking is not necessary.
716 This function is not part of POSIX and therefore no official
717 cancellation point. But due to similarity with an POSIX interface
718 or due to the implementation it is a cancellation point and
719 therefore not marked with __THROW. */
720 extern wint_t fputwc_unlocked (wchar_t __wc
, __FILE
*__stream
);
721 libc_hidden_proto(fputwc_unlocked
)
723 /* These are defined to be equivalent to the `char' functions defined
726 These functions are not part of POSIX and therefore no official
727 cancellation point. But due to similarity with an POSIX interface
728 or due to the implementation they are cancellation points and
729 therefore not marked with __THROW. */
730 extern wint_t putwc_unlocked (wchar_t __wc
, __FILE
*__stream
);
731 extern wint_t putwchar_unlocked (wchar_t __wc
);
734 /* This function does the same as `fgetws' but does not lock the stream.
736 This function is not part of POSIX and therefore no official
737 cancellation point. But due to similarity with an POSIX interface
738 or due to the implementation it is a cancellation point and
739 therefore not marked with __THROW. */
740 extern wchar_t *fgetws_unlocked (wchar_t *__restrict __ws
, int __n
,
741 __FILE
*__restrict __stream
);
742 libc_hidden_proto(fgetws_unlocked
)
744 /* This function does the same as `fputws' but does not lock the stream.
746 This function is not part of POSIX and therefore no official
747 cancellation point. But due to similarity with an POSIX interface
748 or due to the implementation it is a cancellation point and
749 therefore not marked with __THROW. */
750 extern int fputws_unlocked (const wchar_t *__restrict __ws
,
751 __FILE
*__restrict __stream
);
752 libc_hidden_proto(fputws_unlocked
)
756 __BEGIN_NAMESPACE_C99
757 /* Format TP into S according to FORMAT.
758 Write no more than MAXSIZE wide characters and return the number
759 of wide characters written, or 0 if it would exceed MAXSIZE. */
760 extern size_t wcsftime (wchar_t *__restrict __s
, size_t __maxsize
,
761 const wchar_t *__restrict __format
,
762 const struct tm
*__restrict __tp
) __THROW
;
765 # if defined __USE_GNU && defined __UCLIBC_HAS_XLOCALE__
766 # include <xlocale.h>
768 /* Similar to `wcsftime' but takes the information from
769 the provided locale and not the global locale. */
770 extern size_t wcsftime_l (wchar_t *__restrict __s
, size_t __maxsize
,
771 const wchar_t *__restrict __format
,
772 const struct tm
*__restrict __tp
,
773 __locale_t __loc
) __THROW
;
774 libc_hidden_proto(wcsftime_l
)
777 /* The X/Open standard demands that most of the functions defined in
778 the <wctype.h> header must also appear here. This is probably
779 because some X/Open members wrote their implementation before the
780 ISO C standard was published and introduced the better solution.
781 We have to provide these definitions for compliance reasons but we
782 do this nonsense only if really necessary. */
783 #if defined __USE_UNIX98 && !defined __USE_GNU
784 # define __need_iswxxx
789 extern size_t __wcslcpy(wchar_t *__restrict dst
,
790 const wchar_t *__restrict src
, size_t n
) attribute_hidden
;
795 #endif /* _WCHAR_H defined */