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 libc_hidden_proto(wcscat
)
156 /* Append no more than N wide-characters of SRC onto DEST. */
157 extern wchar_t *wcsncat (wchar_t *__restrict __dest
,
158 __const
wchar_t *__restrict __src
, size_t __n
)
161 /* Compare S1 and S2. */
162 extern int wcscmp (__const
wchar_t *__s1
, __const
wchar_t *__s2
)
163 __THROW __attribute_pure__
;
164 libc_hidden_proto(wcscmp
)
165 /* Compare N wide-characters of S1 and S2. */
166 extern int wcsncmp (__const
wchar_t *__s1
, __const
wchar_t *__s2
, size_t __n
)
167 __THROW __attribute_pure__
;
171 /* Compare S1 and S2, ignoring case. */
172 extern int wcscasecmp (__const
wchar_t *__s1
, __const
wchar_t *__s2
) __THROW
;
173 libc_hidden_proto(wcscasecmp
)
175 /* Compare no more than N chars of S1 and S2, ignoring case. */
176 extern int wcsncasecmp (__const
wchar_t *__s1
, __const
wchar_t *__s2
,
178 libc_hidden_proto(wcsncasecmp
)
180 #ifdef __UCLIBC_HAS_XLOCALE__
181 /* Similar to the two functions above but take the information from
182 the provided locale and not the global locale. */
183 # include <xlocale.h>
185 extern int wcscasecmp_l (__const
wchar_t *__s1
, __const
wchar_t *__s2
,
186 __locale_t __loc
) __THROW
;
187 libc_hidden_proto(wcscasecmp_l
)
189 extern int wcsncasecmp_l (__const
wchar_t *__s1
, __const
wchar_t *__s2
,
190 size_t __n
, __locale_t __loc
) __THROW
;
191 libc_hidden_proto(wcsncasecmp_l
)
192 #endif /* __UCLIBC_HAS_XLOCALE__ */
195 __BEGIN_NAMESPACE_C99
196 /* Compare S1 and S2, both interpreted as appropriate to the
197 LC_COLLATE category of the current locale. */
198 extern int wcscoll (__const
wchar_t *__s1
, __const
wchar_t *__s2
) __THROW
;
199 libc_hidden_proto(wcscoll
)
200 /* Transform S2 into array pointed to by S1 such that if wcscmp is
201 applied to two transformed strings the result is the as applying
202 `wcscoll' to the original strings. */
203 extern size_t wcsxfrm (wchar_t *__restrict __s1
,
204 __const
wchar_t *__restrict __s2
, size_t __n
) __THROW
;
205 libc_hidden_proto(wcsxfrm
)
209 #ifdef __UCLIBC_HAS_XLOCALE__
210 /* Similar to the two functions above but take the information from
211 the provided locale and not the global locale. */
213 /* Compare S1 and S2, both interpreted as appropriate to the
214 LC_COLLATE category of the given locale. */
215 extern int wcscoll_l (__const
wchar_t *__s1
, __const
wchar_t *__s2
,
216 __locale_t __loc
) __THROW
;
217 libc_hidden_proto(wcscoll_l
)
219 /* Transform S2 into array pointed to by S1 such that if wcscmp is
220 applied to two transformed strings the result is the as applying
221 `wcscoll' to the original strings. */
222 extern size_t wcsxfrm_l (wchar_t *__s1
, __const
wchar_t *__s2
,
223 size_t __n
, __locale_t __loc
) __THROW
;
224 libc_hidden_proto(wcsxfrm_l
)
226 #endif /* __UCLIBC_HAS_XLOCALE__ */
228 /* Duplicate S, returning an identical malloc'd string. */
229 extern wchar_t *wcsdup (__const
wchar_t *__s
) __THROW __attribute_malloc__
;
232 __BEGIN_NAMESPACE_C99
233 /* Find the first occurrence of WC in WCS. */
234 extern wchar_t *wcschr (__const
wchar_t *__wcs
, wchar_t __wc
)
235 __THROW __attribute_pure__
;
236 libc_hidden_proto(wcschr
)
237 /* Find the last occurrence of WC in WCS. */
238 extern wchar_t *wcsrchr (__const
wchar_t *__wcs
, wchar_t __wc
)
239 __THROW __attribute_pure__
;
243 /* This function is similar to `wcschr'. But it returns a pointer to
244 the closing NUL wide character in case C is not found in S. */
245 extern wchar_t *wcschrnul (__const
wchar_t *__s
, wchar_t __wc
)
246 __THROW __attribute_pure__
;
247 libc_hidden_proto(wcschrnul
)
250 __BEGIN_NAMESPACE_C99
251 /* Return the length of the initial segmet of WCS which
252 consists entirely of wide characters not in REJECT. */
253 extern size_t wcscspn (__const
wchar_t *__wcs
, __const
wchar_t *__reject
)
254 __THROW __attribute_pure__
;
255 /* Return the length of the initial segmet of WCS which
256 consists entirely of wide characters in ACCEPT. */
257 extern size_t wcsspn (__const
wchar_t *__wcs
, __const
wchar_t *__accept
)
258 __THROW __attribute_pure__
;
259 libc_hidden_proto(wcsspn
)
260 /* Find the first occurrence in WCS of any character in ACCEPT. */
261 extern wchar_t *wcspbrk (__const
wchar_t *__wcs
, __const
wchar_t *__accept
)
262 __THROW __attribute_pure__
;
263 libc_hidden_proto(wcspbrk
)
264 /* Find the first occurrence of NEEDLE in HAYSTACK. */
265 extern wchar_t *wcsstr (__const
wchar_t *__haystack
, __const
wchar_t *__needle
)
266 __THROW __attribute_pure__
;
268 /* Divide WCS into tokens separated by characters in DELIM. */
269 extern wchar_t *wcstok (wchar_t *__restrict __s
,
270 __const
wchar_t *__restrict __delim
,
271 wchar_t **__restrict __ptr
) __THROW
;
273 /* Return the number of wide characters in S. */
274 extern size_t wcslen (__const
wchar_t *__s
) __THROW __attribute_pure__
;
275 libc_hidden_proto(wcslen
)
278 #if defined __USE_XOPEN && defined __UCLIBC_SUSV3_LEGACY__
279 /* Another name for `wcsstr' from XPG4. */
280 extern wchar_t *wcswcs (__const
wchar_t *__haystack
, __const
wchar_t *__needle
)
281 __THROW __attribute_pure__
;
285 /* Return the number of wide characters in S, but at most MAXLEN. */
286 extern size_t wcsnlen (__const
wchar_t *__s
, size_t __maxlen
)
287 __THROW __attribute_pure__
;
288 libc_hidden_proto(wcsnlen
)
292 __BEGIN_NAMESPACE_C99
293 /* Search N wide characters of S for C. */
294 extern wchar_t *wmemchr (__const
wchar_t *__s
, wchar_t __c
, size_t __n
)
295 __THROW __attribute_pure__
;
296 libc_hidden_proto(wmemchr
)
298 /* Compare N wide characters of S1 and S2. */
299 extern int wmemcmp (__const
wchar_t *__restrict __s1
,
300 __const
wchar_t *__restrict __s2
, size_t __n
)
301 __THROW __attribute_pure__
;
303 /* Copy N wide characters of SRC to DEST. */
304 extern wchar_t *wmemcpy (wchar_t *__restrict __s1
,
305 __const
wchar_t *__restrict __s2
, size_t __n
) __THROW
;
306 libc_hidden_proto(wmemcpy
)
308 /* Copy N wide characters of SRC to DEST, guaranteeing
309 correct behavior for overlapping strings. */
310 extern wchar_t *wmemmove (wchar_t *__s1
, __const
wchar_t *__s2
, size_t __n
)
313 /* Set N wide characters of S to C. */
314 extern wchar_t *wmemset (wchar_t *__s
, wchar_t __c
, size_t __n
) __THROW
;
318 /* Copy N wide characters of SRC to DEST and return pointer to following
320 extern wchar_t *wmempcpy (wchar_t *__restrict __s1
,
321 __const
wchar_t *__restrict __s2
, size_t __n
)
323 libc_hidden_proto(wmempcpy
)
327 __BEGIN_NAMESPACE_C99
328 /* Determine whether C constitutes a valid (one-byte) multibyte
330 extern wint_t btowc (int __c
) __THROW
;
331 libc_hidden_proto(btowc
)
333 /* Determine whether C corresponds to a member of the extended
334 character set whose multibyte representation is a single byte. */
335 extern int wctob (wint_t __c
) __THROW
;
337 /* Determine whether PS points to an object representing the initial
339 extern int mbsinit (__const
mbstate_t *__ps
) __THROW __attribute_pure__
;
340 libc_hidden_proto(mbsinit
)
342 /* Write wide character representation of multibyte character pointed
344 extern size_t mbrtowc (wchar_t *__restrict __pwc
,
345 __const
char *__restrict __s
, size_t __n
,
346 mbstate_t *__p
) __THROW
;
347 libc_hidden_proto(mbrtowc
)
349 /* Write multibyte representation of wide character WC to S. */
350 extern size_t wcrtomb (char *__restrict __s
, wchar_t __wc
,
351 mbstate_t *__restrict __ps
) __THROW
;
352 libc_hidden_proto(wcrtomb
)
354 /* Return number of bytes in multibyte character pointed to by S. */
355 #if 0 /* uClibc: disabled */
356 extern size_t __mbrlen (__const
char *__restrict __s
, size_t __n
,
357 mbstate_t *__restrict __ps
) __THROW
;
359 extern size_t mbrlen (__const
char *__restrict __s
, size_t __n
,
360 mbstate_t *__restrict __ps
) __THROW
;
361 libc_hidden_proto(mbrlen
)
363 /* Write wide character representation of multibyte character string
365 extern size_t mbsrtowcs (wchar_t *__restrict __dst
,
366 __const
char **__restrict __src
, size_t __len
,
367 mbstate_t *__restrict __ps
) __THROW
;
368 libc_hidden_proto(mbsrtowcs
)
370 /* Write multibyte character representation of wide character string
372 extern size_t wcsrtombs (char *__restrict __dst
,
373 __const
wchar_t **__restrict __src
, size_t __len
,
374 mbstate_t *__restrict __ps
) __THROW
;
375 libc_hidden_proto(wcsrtombs
)
380 /* Write wide character representation of at most NMC bytes of the
381 multibyte character string SRC to DST. */
382 extern size_t mbsnrtowcs (wchar_t *__restrict __dst
,
383 __const
char **__restrict __src
, size_t __nmc
,
384 size_t __len
, mbstate_t *__restrict __ps
) __THROW
;
385 libc_hidden_proto(mbsnrtowcs
)
387 /* Write multibyte character representation of at most NWC characters
388 from the wide character string SRC to DST. */
389 extern size_t wcsnrtombs (char *__restrict __dst
,
390 __const
wchar_t **__restrict __src
,
391 size_t __nwc
, size_t __len
,
392 mbstate_t *__restrict __ps
) __THROW
;
393 libc_hidden_proto(wcsnrtombs
)
397 /* The following functions are extensions found in X/Open CAE. */
399 /* Determine number of column positions required for C. */
400 extern int wcwidth (wchar_t __c
) __THROW
;
402 /* Determine number of column positions required for first N wide
403 characters (or fewer if S ends before this) in S. */
404 extern int wcswidth (__const
wchar_t *__s
, size_t __n
) __THROW
;
405 libc_hidden_proto(wcswidth
)
406 #endif /* Use X/Open. */
409 __BEGIN_NAMESPACE_C99
410 #ifdef __UCLIBC_HAS_FLOATS__
411 /* Convert initial portion of the wide string NPTR to `double'
413 extern double wcstod (__const
wchar_t *__restrict __nptr
,
414 wchar_t **__restrict __endptr
) __THROW
;
417 /* Likewise for `float' and `long double' sizes of floating-point numbers. */
418 extern float wcstof (__const
wchar_t *__restrict __nptr
,
419 wchar_t **__restrict __endptr
) __THROW
;
420 extern long double wcstold (__const
wchar_t *__restrict __nptr
,
421 wchar_t **__restrict __endptr
) __THROW
;
423 #endif /* __UCLIBC_HAS_FLOATS__ */
426 /* Convert initial portion of wide string NPTR to `long int'
428 extern long int wcstol (__const
wchar_t *__restrict __nptr
,
429 wchar_t **__restrict __endptr
, int __base
) __THROW
;
431 /* Convert initial portion of wide string NPTR to `unsigned long int'
433 extern unsigned long int wcstoul (__const
wchar_t *__restrict __nptr
,
434 wchar_t **__restrict __endptr
, int __base
)
437 #if defined __USE_ISOC99 || (defined __GNUC__ && defined __USE_GNU)
438 /* Convert initial portion of wide string NPTR to `long int'
441 extern long long int wcstoll (__const
wchar_t *__restrict __nptr
,
442 wchar_t **__restrict __endptr
, int __base
)
445 /* Convert initial portion of wide string NPTR to `unsigned long long int'
448 extern unsigned long long int wcstoull (__const
wchar_t *__restrict __nptr
,
449 wchar_t **__restrict __endptr
,
451 #endif /* ISO C99 or GCC and GNU. */
454 #if defined __GNUC__ && defined __USE_GNU
455 /* Convert initial portion of wide string NPTR to `long int'
458 extern long long int wcstoq (__const
wchar_t *__restrict __nptr
,
459 wchar_t **__restrict __endptr
, int __base
)
462 /* Convert initial portion of wide string NPTR to `unsigned long long int'
465 extern unsigned long long int wcstouq (__const
wchar_t *__restrict __nptr
,
466 wchar_t **__restrict __endptr
,
468 #endif /* GCC and use GNU. */
471 #ifdef __UCLIBC_HAS_XLOCALE__
472 /* The concept of one static locale per category is not very well
473 thought out. Many applications will need to process its data using
474 information from several different locales. Another application is
475 the implementation of the internationalization handling in the
476 upcoming ISO C++ standard library. To support this another set of
477 the functions using locale data exist which have an additional
480 Attention: all these functions are *not* standardized in any form.
481 This is a proof-of-concept implementation. */
483 /* Structure for reentrant locale using functions. This is an
484 (almost) opaque type for the user level programs. */
485 # include <xlocale.h>
487 /* Special versions of the functions above which take the locale to
488 use as an additional parameter. */
489 extern long int wcstol_l (__const
wchar_t *__restrict __nptr
,
490 wchar_t **__restrict __endptr
, int __base
,
491 __locale_t __loc
) __THROW
;
493 extern unsigned long int wcstoul_l (__const
wchar_t *__restrict __nptr
,
494 wchar_t **__restrict __endptr
,
495 int __base
, __locale_t __loc
) __THROW
;
498 extern long long int wcstoll_l (__const
wchar_t *__restrict __nptr
,
499 wchar_t **__restrict __endptr
,
500 int __base
, __locale_t __loc
) __THROW
;
503 extern unsigned long long int wcstoull_l (__const
wchar_t *__restrict __nptr
,
504 wchar_t **__restrict __endptr
,
505 int __base
, __locale_t __loc
)
508 #ifdef __UCLIBC_HAS_FLOATS__
509 extern double wcstod_l (__const
wchar_t *__restrict __nptr
,
510 wchar_t **__restrict __endptr
, __locale_t __loc
)
513 extern float wcstof_l (__const
wchar_t *__restrict __nptr
,
514 wchar_t **__restrict __endptr
, __locale_t __loc
)
517 extern long double wcstold_l (__const
wchar_t *__restrict __nptr
,
518 wchar_t **__restrict __endptr
,
519 __locale_t __loc
) __THROW
;
520 #endif /* __UCLIBC_HAS_FLOATS__ */
521 #endif /* __UCLIBC_HAS_XLOCALE__ */
526 /* Copy SRC to DEST, returning the address of the terminating L'\0' in
528 extern wchar_t *wcpcpy (wchar_t *__dest
, __const
wchar_t *__src
) __THROW
;
530 /* Copy no more than N characters of SRC to DEST, returning the address of
531 the last character written into DEST. */
532 extern wchar_t *wcpncpy (wchar_t *__dest
, __const
wchar_t *__src
, size_t __n
)
537 /* Wide character I/O functions. */
538 #if defined __USE_ISOC99 || defined __USE_UNIX98
539 __BEGIN_NAMESPACE_C99
541 /* Select orientation for stream. */
542 extern int fwide (__FILE
*__fp
, int __mode
) __THROW
;
545 /* Write formatted output to STREAM.
547 This function is a possible cancellation point and therefore not
548 marked with __THROW. */
549 extern int fwprintf (__FILE
*__restrict __stream
,
550 __const
wchar_t *__restrict __format
, ...)
551 /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */;
552 libc_hidden_proto(fwprintf
)
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 libc_hidden_proto(vfwprintf
)
573 /* Write formatted output to stdout from argument list ARG.
575 This function is a possible cancellation point and therefore not
576 marked with __THROW. */
577 extern int vwprintf (__const
wchar_t *__restrict __format
,
578 __gnuc_va_list __arg
)
579 /* __attribute__ ((__format__ (__wprintf__, 1, 0))) */;
580 /* Write formatted output of at most N character to S from argument
582 extern int vswprintf (wchar_t *__restrict __s
, size_t __n
,
583 __const
wchar_t *__restrict __format
,
584 __gnuc_va_list __arg
)
585 __THROW
/* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
586 libc_hidden_proto(vswprintf
)
589 /* Read formatted input from STREAM.
591 This function is a possible cancellation point and therefore not
592 marked with __THROW. */
593 extern int fwscanf (__FILE
*__restrict __stream
,
594 __const
wchar_t *__restrict __format
, ...)
595 /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
596 /* Read formatted input from stdin.
598 This function is a possible cancellation point and therefore not
599 marked with __THROW. */
600 extern int wscanf (__const
wchar_t *__restrict __format
, ...)
601 /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
602 /* Read formatted input from S. */
603 extern int swscanf (__const
wchar_t *__restrict __s
,
604 __const
wchar_t *__restrict __format
, ...)
605 __THROW
/* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
608 #endif /* Use ISO C99 and Unix98. */
611 __BEGIN_NAMESPACE_C99
613 /* Read formatted input from S into argument list ARG.
615 This function is a possible cancellation point and therefore not
616 marked with __THROW. */
617 extern int vfwscanf (__FILE
*__restrict __s
,
618 __const
wchar_t *__restrict __format
,
619 __gnuc_va_list __arg
)
620 /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
621 libc_hidden_proto(vfwscanf
)
622 /* Read formatted input from stdin into argument list ARG.
624 This function is a possible cancellation point and therefore not
625 marked with __THROW. */
626 extern int vwscanf (__const
wchar_t *__restrict __format
,
627 __gnuc_va_list __arg
)
628 /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
629 /* Read formatted input from S into argument list ARG. */
630 extern int vswscanf (__const
wchar_t *__restrict __s
,
631 __const
wchar_t *__restrict __format
,
632 __gnuc_va_list __arg
)
633 __THROW
/* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
634 libc_hidden_proto(vswscanf
)
637 #endif /* Use ISO C99. */
640 __BEGIN_NAMESPACE_C99
641 /* Read a character from STREAM.
643 These functions are possible cancellation points and therefore not
644 marked with __THROW. */
645 extern wint_t fgetwc (__FILE
*__stream
);
646 libc_hidden_proto(fgetwc
)
647 extern wint_t getwc (__FILE
*__stream
);
649 /* Read a character from stdin.
651 This function is a possible cancellation point and therefore not
652 marked with __THROW. */
653 extern wint_t getwchar (void);
656 /* Write a character to STREAM.
658 These functions are possible cancellation points and therefore not
659 marked with __THROW. */
660 extern wint_t fputwc (wchar_t __wc
, __FILE
*__stream
);
661 extern wint_t putwc (wchar_t __wc
, __FILE
*__stream
);
663 /* Write a character to stdout.
665 This function is a possible cancellation points and therefore not
666 marked with __THROW. */
667 extern wint_t putwchar (wchar_t __wc
);
670 /* Get a newline-terminated wide character string of finite length
673 This function is a possible cancellation points and therefore not
674 marked with __THROW. */
675 extern wchar_t *fgetws (wchar_t *__restrict __ws
, int __n
,
676 __FILE
*__restrict __stream
);
678 /* Write a string to STREAM.
680 This function is a possible cancellation points and therefore not
681 marked with __THROW. */
682 extern int fputws (__const
wchar_t *__restrict __ws
,
683 __FILE
*__restrict __stream
);
684 libc_hidden_proto(fputws
)
687 /* Push a character back onto the input buffer of STREAM.
689 This function is a possible cancellation points and therefore not
690 marked with __THROW. */
691 extern wint_t ungetwc (wint_t __wc
, __FILE
*__stream
);
692 libc_hidden_proto(ungetwc
)
697 /* These are defined to be equivalent to the `char' functions defined
700 These functions are not part of POSIX and therefore no official
701 cancellation point. But due to similarity with an POSIX interface
702 or due to the implementation they are cancellation points and
703 therefore not marked with __THROW. */
704 extern wint_t getwc_unlocked (__FILE
*__stream
);
705 extern wint_t getwchar_unlocked (void);
707 /* This is the wide character version of a GNU extension.
709 This function is not part of POSIX and therefore no official
710 cancellation point. But due to similarity with an POSIX interface
711 or due to the implementation it is a cancellation point and
712 therefore not marked with __THROW. */
713 extern wint_t fgetwc_unlocked (__FILE
*__stream
);
714 libc_hidden_proto(fgetwc_unlocked
)
716 /* Faster version when locking is not necessary.
718 This function is not part of POSIX and therefore no official
719 cancellation point. But due to similarity with an POSIX interface
720 or due to the implementation it is a cancellation point and
721 therefore not marked with __THROW. */
722 extern wint_t fputwc_unlocked (wchar_t __wc
, __FILE
*__stream
);
723 libc_hidden_proto(fputwc_unlocked
)
725 /* These are defined to be equivalent to the `char' functions defined
728 These functions are not part of POSIX and therefore no official
729 cancellation point. But due to similarity with an POSIX interface
730 or due to the implementation they are cancellation points and
731 therefore not marked with __THROW. */
732 extern wint_t putwc_unlocked (wchar_t __wc
, __FILE
*__stream
);
733 extern wint_t putwchar_unlocked (wchar_t __wc
);
736 /* This function does the same as `fgetws' 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 wchar_t *fgetws_unlocked (wchar_t *__restrict __ws
, int __n
,
743 __FILE
*__restrict __stream
);
744 libc_hidden_proto(fgetws_unlocked
)
746 /* This function does the same as `fputws' but does not lock the stream.
748 This function is not part of POSIX and therefore no official
749 cancellation point. But due to similarity with an POSIX interface
750 or due to the implementation it is a cancellation point and
751 therefore not marked with __THROW. */
752 extern int fputws_unlocked (__const
wchar_t *__restrict __ws
,
753 __FILE
*__restrict __stream
);
754 libc_hidden_proto(fputws_unlocked
)
758 __BEGIN_NAMESPACE_C99
759 /* Format TP into S according to FORMAT.
760 Write no more than MAXSIZE wide characters and return the number
761 of wide characters written, or 0 if it would exceed MAXSIZE. */
762 extern size_t wcsftime (wchar_t *__restrict __s
, size_t __maxsize
,
763 __const
wchar_t *__restrict __format
,
764 __const
struct tm
*__restrict __tp
) __THROW
;
765 libc_hidden_proto(wcsftime
)
768 # if defined __USE_GNU && defined __UCLIBC_HAS_XLOCALE__
769 # include <xlocale.h>
771 /* Similar to `wcsftime' but takes the information from
772 the provided locale and not the global locale. */
773 extern size_t wcsftime_l (wchar_t *__restrict __s
, size_t __maxsize
,
774 __const
wchar_t *__restrict __format
,
775 __const
struct tm
*__restrict __tp
,
776 __locale_t __loc
) __THROW
;
777 libc_hidden_proto(wcsftime_l
)
780 /* The X/Open standard demands that most of the functions defined in
781 the <wctype.h> header must also appear here. This is probably
782 because some X/Open members wrote their implementation before the
783 ISO C standard was published and introduced the better solution.
784 We have to provide these definitions for compliance reasons but we
785 do this nonsense only if really necessary. */
786 #if defined __USE_UNIX98 && !defined __USE_GNU
787 # define __need_iswxxx
793 #endif /* _WCHAR_H defined */