nptl: remove sysdep-cancel ASM macros, convert to C
[uclibc-ng.git] / include / wchar.h
blob2e6ff77c09754f24b03d464d9c9f45d39419c82b
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>
23 #ifndef _WCHAR_H
25 #ifndef __need_mbstate_t
26 # define _WCHAR_H 1
27 # include <features.h>
28 #endif
30 #ifndef __UCLIBC_HAS_WCHAR__
31 #error Attempted to include wchar.h when uClibc built without wide char support.
32 #endif
34 #ifdef _WCHAR_H
35 /* Get FILE definition. */
36 # define __need___FILE
37 # ifdef __USE_UNIX98
38 # define __need_FILE
39 # endif
40 # include <stdio.h>
41 /* Get va_list definition. */
42 # define __need___va_list
43 # include <stdarg.h>
45 /* Get size_t, wchar_t, wint_t and NULL from <stddef.h>. */
46 # define __need_size_t
47 # define __need_wchar_t
48 # define __need_NULL
49 #endif
50 #define __need_wint_t
51 #include <stddef.h>
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. */
57 #ifndef _WINT_T
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. */
62 # define _WINT_T
63 typedef unsigned int wint_t;
64 #else
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__
69 __BEGIN_NAMESPACE_STD
70 typedef __WINT_TYPE__ wint_t;
71 __END_NAMESPACE_STD
72 # endif
73 #endif
76 #ifndef __mbstate_t_defined
77 # define __mbstate_t_defined 1
78 /* Conversion state information. */
79 #define __need_wchar_t
80 #include <stddef.h>
81 typedef struct
83 wchar_t __mask;
84 wchar_t __wc;
85 } __mbstate_t;
86 #endif
87 #undef __need_mbstate_t
90 /* The rest of the file is only used if used if __need_mbstate_t is not
91 defined. */
92 #ifdef _WCHAR_H
94 __BEGIN_NAMESPACE_C99
95 /* Public type. */
96 typedef __mbstate_t mbstate_t;
97 __END_NAMESPACE_C99
98 #ifdef __USE_GNU
99 __USING_NAMESPACE_C99(mbstate_t)
100 #endif
102 #ifndef WCHAR_MIN
103 /* These constants might also be defined in <inttypes.h>. */
104 # define WCHAR_MIN __WCHAR_MIN
105 # define WCHAR_MAX __WCHAR_MAX
106 #endif
108 #ifndef WEOF
109 # define WEOF (0xffffffffu)
110 #endif
112 /* For XPG4 compliance we have to define the stuff from <wctype.h> here
113 as well. */
114 #if defined __USE_XOPEN && !defined __USE_UNIX98
115 # include <wctype.h>
116 #endif
119 __BEGIN_DECLS
121 __BEGIN_NAMESPACE_STD
122 /* This incomplete type is defined in <time.h> but needed here because
123 of `wcsftime'. */
124 struct tm;
125 __END_NAMESPACE_STD
126 /* XXX We have to clean this up at some point. Since tm is in the std
127 namespace but wcsftime is in __c99 the type wouldn't be found
128 without inserting it in the global namespace. */
129 __USING_NAMESPACE_STD(tm)
132 __BEGIN_NAMESPACE_C99
133 /* Copy SRC to DEST. */
134 extern wchar_t *wcscpy (wchar_t *__restrict __dest,
135 const wchar_t *__restrict __src) __THROW;
136 /* Copy no more than N wide-characters of SRC to DEST. */
137 extern wchar_t *wcsncpy (wchar_t *__restrict __dest,
138 const wchar_t *__restrict __src, size_t __n)
139 __THROW;
141 /* Append SRC onto DEST. */
142 extern wchar_t *wcscat (wchar_t *__restrict __dest,
143 const wchar_t *__restrict __src) __THROW;
144 libc_hidden_proto(wcscat)
145 /* Append no more than N wide-characters of SRC onto DEST. */
146 extern wchar_t *wcsncat (wchar_t *__restrict __dest,
147 const wchar_t *__restrict __src, size_t __n)
148 __THROW;
150 /* Compare S1 and S2. */
151 extern int wcscmp (const wchar_t *__s1, const wchar_t *__s2)
152 __THROW __attribute_pure__;
153 libc_hidden_proto(wcscmp)
154 /* Compare N wide-characters of S1 and S2. */
155 extern int wcsncmp (const wchar_t *__s1, const wchar_t *__s2, size_t __n)
156 __THROW __attribute_pure__;
157 __END_NAMESPACE_C99
159 #ifdef __USE_GNU
160 /* Compare S1 and S2, ignoring case. */
161 extern int wcscasecmp (const wchar_t *__s1, const wchar_t *__s2) __THROW;
163 /* Compare no more than N chars of S1 and S2, ignoring case. */
164 extern int wcsncasecmp (const wchar_t *__s1, const wchar_t *__s2,
165 size_t __n) __THROW;
167 #ifdef __UCLIBC_HAS_XLOCALE__
168 /* Similar to the two functions above but take the information from
169 the provided locale and not the global locale. */
170 # include <xlocale.h>
172 extern int wcscasecmp_l (const wchar_t *__s1, const wchar_t *__s2,
173 __locale_t __loc) __THROW;
174 libc_hidden_proto(wcscasecmp_l)
176 extern int wcsncasecmp_l (const wchar_t *__s1, const wchar_t *__s2,
177 size_t __n, __locale_t __loc) __THROW;
178 libc_hidden_proto(wcsncasecmp_l)
179 #endif /* __UCLIBC_HAS_XLOCALE__ */
180 #endif
182 __BEGIN_NAMESPACE_C99
183 /* Compare S1 and S2, both interpreted as appropriate to the
184 LC_COLLATE category of the current locale. */
185 extern int wcscoll (const wchar_t *__s1, const wchar_t *__s2) __THROW;
186 libc_hidden_proto(wcscoll)
187 /* Transform S2 into array pointed to by S1 such that if wcscmp is
188 applied to two transformed strings the result is the as applying
189 `wcscoll' to the original strings. */
190 extern size_t wcsxfrm (wchar_t *__restrict __s1,
191 const wchar_t *__restrict __s2, size_t __n) __THROW;
192 __END_NAMESPACE_C99
194 #ifdef __USE_GNU
195 #ifdef __UCLIBC_HAS_XLOCALE__
196 /* Similar to the two functions above but take the information from
197 the provided locale and not the global locale. */
199 /* Compare S1 and S2, both interpreted as appropriate to the
200 LC_COLLATE category of the given locale. */
201 extern int wcscoll_l (const wchar_t *__s1, const wchar_t *__s2,
202 __locale_t __loc) __THROW;
203 libc_hidden_proto(wcscoll_l)
205 /* Transform S2 into array pointed to by S1 such that if wcscmp is
206 applied to two transformed strings the result is the as applying
207 `wcscoll' to the original strings. */
208 extern size_t wcsxfrm_l (wchar_t *__s1, const wchar_t *__s2,
209 size_t __n, __locale_t __loc) __THROW;
210 libc_hidden_proto(wcsxfrm_l)
212 #endif /* __UCLIBC_HAS_XLOCALE__ */
214 /* Duplicate S, returning an identical malloc'd string. */
215 extern wchar_t *wcsdup (const wchar_t *__s) __THROW __attribute_malloc__;
216 #endif
218 __BEGIN_NAMESPACE_C99
219 /* Find the first occurrence of WC in WCS. */
220 extern wchar_t *wcschr (const wchar_t *__wcs, wchar_t __wc)
221 __THROW __attribute_pure__;
222 /* Find the last occurrence of WC in WCS. */
223 extern wchar_t *wcsrchr (const wchar_t *__wcs, wchar_t __wc)
224 __THROW __attribute_pure__;
225 __END_NAMESPACE_C99
227 #ifdef __USE_GNU
228 /* This function is similar to `wcschr'. But it returns a pointer to
229 the closing NUL wide character in case C is not found in S. */
230 extern wchar_t *wcschrnul (const wchar_t *__s, wchar_t __wc)
231 __THROW __attribute_pure__;
232 #endif
234 __BEGIN_NAMESPACE_C99
235 /* Return the length of the initial segmet of WCS which
236 consists entirely of wide characters not in REJECT. */
237 extern size_t wcscspn (const wchar_t *__wcs, const wchar_t *__reject)
238 __THROW __attribute_pure__;
239 /* Return the length of the initial segmet of WCS which
240 consists entirely of wide characters in ACCEPT. */
241 extern size_t wcsspn (const wchar_t *__wcs, const wchar_t *__accept)
242 __THROW __attribute_pure__;
243 libc_hidden_proto(wcsspn)
244 /* Find the first occurrence in WCS of any character in ACCEPT. */
245 extern wchar_t *wcspbrk (const wchar_t *__wcs, const wchar_t *__accept)
246 __THROW __attribute_pure__;
247 libc_hidden_proto(wcspbrk)
248 /* Find the first occurrence of NEEDLE in HAYSTACK. */
249 /* SuSv uses restrict keyword, glibc does not */
250 extern wchar_t *wcsstr (const wchar_t *__restrict __haystack, const wchar_t *__restrict __needle)
251 __THROW __attribute_pure__;
253 /* Divide WCS into tokens separated by characters in DELIM. */
254 extern wchar_t *wcstok (wchar_t *__restrict __s,
255 const wchar_t *__restrict __delim,
256 wchar_t **__restrict __ptr) __THROW;
258 /* Return the number of wide characters in S. */
259 extern size_t wcslen (const wchar_t *__s) __THROW __attribute_pure__;
260 libc_hidden_proto(wcslen)
261 __END_NAMESPACE_C99
263 #if defined __USE_XOPEN && defined __UCLIBC_SUSV3_LEGACY__
264 /* Another name for `wcsstr' from XPG4. */
265 /* SuSv3 did not use restrict keyword, probably because it was marked LEGACY
266 we do to be in sync with wcsstr */
267 extern wchar_t *wcswcs (const wchar_t *__restrict __haystack, const wchar_t *__restrict __needle)
268 __THROW __attribute_pure__;
269 #endif
271 #ifdef __USE_GNU
272 /* Return the number of wide characters in S, but at most MAXLEN. */
273 extern size_t wcsnlen (const wchar_t *__s, size_t __maxlen)
274 __THROW __attribute_pure__;
275 libc_hidden_proto(wcsnlen)
276 #endif
279 __BEGIN_NAMESPACE_C99
280 /* Search N wide characters of S for C. */
281 extern wchar_t *wmemchr (const wchar_t *__s, wchar_t __c, size_t __n)
282 __THROW __attribute_pure__;
283 libc_hidden_proto(wmemchr)
285 /* Compare N wide characters of S1 and S2. */
286 /* SuSv4 does not use restrict keyword for S1 and S2, glibc does */
287 extern int wmemcmp (const wchar_t *__s1,
288 const wchar_t *__s2, size_t __n)
289 __THROW __attribute_pure__;
291 /* Copy N wide characters of SRC to DEST. */
292 extern wchar_t *wmemcpy (wchar_t *__restrict __s1,
293 const wchar_t *__restrict __s2, size_t __n) __THROW;
294 libc_hidden_proto(wmemcpy)
296 /* Copy N wide characters of SRC to DEST, guaranteeing
297 correct behavior for overlapping strings. */
298 extern wchar_t *wmemmove (wchar_t *__s1, const wchar_t *__s2, size_t __n)
299 __THROW;
301 /* Set N wide characters of S to C. */
302 extern wchar_t *wmemset (wchar_t *__s, wchar_t __c, size_t __n) __THROW;
303 __END_NAMESPACE_C99
305 #ifdef __USE_GNU
306 /* Copy N wide characters of SRC to DEST and return pointer to following
307 wide character. */
308 extern wchar_t *wmempcpy (wchar_t *__restrict __s1,
309 const wchar_t *__restrict __s2, size_t __n)
310 __THROW;
311 libc_hidden_proto(wmempcpy)
312 #endif
315 __BEGIN_NAMESPACE_C99
316 /* Determine whether C constitutes a valid (one-byte) multibyte
317 character. */
318 extern wint_t btowc (int __c) __THROW;
319 libc_hidden_proto(btowc)
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
326 state. */
327 extern int mbsinit (const mbstate_t *__ps) __THROW __attribute_pure__;
328 libc_hidden_proto(mbsinit)
330 /* Write wide character representation of multibyte character pointed
331 to by S to PWC. */
332 extern size_t mbrtowc (wchar_t *__restrict __pwc,
333 const char *__restrict __s, size_t __n,
334 mbstate_t *__p) __THROW;
335 libc_hidden_proto(mbrtowc)
337 /* Write multibyte representation of wide character WC to S. */
338 extern size_t wcrtomb (char *__restrict __s, wchar_t __wc,
339 mbstate_t *__restrict __ps) __THROW;
340 libc_hidden_proto(wcrtomb)
342 /* Return number of bytes in multibyte character pointed to by S. */
343 #if 0 /* uClibc: disabled */
344 extern size_t __mbrlen (const char *__restrict __s, size_t __n,
345 mbstate_t *__restrict __ps) __THROW;
346 #endif
347 extern size_t mbrlen (const char *__restrict __s, size_t __n,
348 mbstate_t *__restrict __ps) __THROW;
349 libc_hidden_proto(mbrlen)
351 /* Write wide character representation of multibyte character string
352 SRC to DST. */
353 extern size_t mbsrtowcs (wchar_t *__restrict __dst,
354 const char **__restrict __src, size_t __len,
355 mbstate_t *__restrict __ps) __THROW;
356 libc_hidden_proto(mbsrtowcs)
358 /* Write multibyte character representation of wide character string
359 SRC to DST. */
360 extern size_t wcsrtombs (char *__restrict __dst,
361 const wchar_t **__restrict __src, size_t __len,
362 mbstate_t *__restrict __ps) __THROW;
363 libc_hidden_proto(wcsrtombs)
364 __END_NAMESPACE_C99
367 #ifdef __USE_GNU
368 /* Write wide character representation of at most NMC bytes of the
369 multibyte character string SRC to DST. */
370 extern size_t mbsnrtowcs (wchar_t *__restrict __dst,
371 const char **__restrict __src, size_t __nmc,
372 size_t __len, mbstate_t *__restrict __ps) __THROW;
373 libc_hidden_proto(mbsnrtowcs)
375 /* Write multibyte character representation of at most NWC characters
376 from the wide character string SRC to DST. */
377 extern size_t wcsnrtombs (char *__restrict __dst,
378 const wchar_t **__restrict __src,
379 size_t __nwc, size_t __len,
380 mbstate_t *__restrict __ps) __THROW;
381 libc_hidden_proto(wcsnrtombs)
382 #endif /* use GNU */
385 /* The following functions are extensions found in X/Open CAE. */
386 #ifdef __USE_XOPEN
387 /* Determine number of column positions required for C. */
388 extern int wcwidth (wchar_t __c) __THROW;
390 /* Determine number of column positions required for first N wide
391 characters (or fewer if S ends before this) in S. */
392 extern int wcswidth (const wchar_t *__s, size_t __n) __THROW;
393 libc_hidden_proto(wcswidth)
394 #endif /* Use X/Open. */
397 __BEGIN_NAMESPACE_C99
398 #ifdef __UCLIBC_HAS_FLOATS__
399 /* Convert initial portion of the wide string NPTR to `double'
400 representation. */
401 extern double wcstod (const wchar_t *__restrict __nptr,
402 wchar_t **__restrict __endptr) __THROW;
404 #ifdef __USE_ISOC99
405 /* Likewise for `float' and `long double' sizes of floating-point numbers. */
406 extern float wcstof (const wchar_t *__restrict __nptr,
407 wchar_t **__restrict __endptr) __THROW;
408 extern long double wcstold (const wchar_t *__restrict __nptr,
409 wchar_t **__restrict __endptr) __THROW;
410 #endif /* C99 */
411 #endif /* __UCLIBC_HAS_FLOATS__ */
414 /* Convert initial portion of wide string NPTR to `long int'
415 representation. */
416 extern long int wcstol (const wchar_t *__restrict __nptr,
417 wchar_t **__restrict __endptr, int __base) __THROW;
419 /* Convert initial portion of wide string NPTR to `unsigned long int'
420 representation. */
421 extern unsigned long int wcstoul (const wchar_t *__restrict __nptr,
422 wchar_t **__restrict __endptr, int __base)
423 __THROW;
425 #if defined __USE_ISOC99 || (defined __GNUC__ && defined __USE_GNU)
426 /* Convert initial portion of wide string NPTR to `long long int'
427 representation. */
428 __extension__
429 extern long long int wcstoll (const wchar_t *__restrict __nptr,
430 wchar_t **__restrict __endptr, int __base)
431 __THROW;
433 /* Convert initial portion of wide string NPTR to `unsigned long long int'
434 representation. */
435 __extension__
436 extern unsigned long long int wcstoull (const wchar_t *__restrict __nptr,
437 wchar_t **__restrict __endptr,
438 int __base) __THROW;
439 #endif /* ISO C99 or GCC and GNU. */
440 __END_NAMESPACE_C99
442 #if defined __GNUC__ && defined __USE_GNU
443 /* Convert initial portion of wide string NPTR to `long long int'
444 representation. */
445 __extension__
446 extern long long int wcstoq (const wchar_t *__restrict __nptr,
447 wchar_t **__restrict __endptr, int __base)
448 __THROW;
450 /* Convert initial portion of wide string NPTR to `unsigned long long int'
451 representation. */
452 __extension__
453 extern unsigned long long int wcstouq (const wchar_t *__restrict __nptr,
454 wchar_t **__restrict __endptr,
455 int __base) __THROW;
456 #endif /* GCC and use GNU. */
458 #ifdef __USE_GNU
459 #ifdef __UCLIBC_HAS_XLOCALE__
460 /* The concept of one static locale per category is not very well
461 thought out. Many applications will need to process its data using
462 information from several different locales. Another application is
463 the implementation of the internationalization handling in the
464 upcoming ISO C++ standard library. To support this another set of
465 the functions using locale data exist which have an additional
466 argument.
468 Attention: all these functions are *not* standardized in any form.
469 This is a proof-of-concept implementation. */
471 /* Structure for reentrant locale using functions. This is an
472 (almost) opaque type for the user level programs. */
473 # include <xlocale.h>
475 /* Special versions of the functions above which take the locale to
476 use as an additional parameter. */
477 extern long int wcstol_l (const wchar_t *__restrict __nptr,
478 wchar_t **__restrict __endptr, int __base,
479 __locale_t __loc) __THROW;
481 extern unsigned long int wcstoul_l (const wchar_t *__restrict __nptr,
482 wchar_t **__restrict __endptr,
483 int __base, __locale_t __loc) __THROW;
485 __extension__
486 extern long long int wcstoll_l (const wchar_t *__restrict __nptr,
487 wchar_t **__restrict __endptr,
488 int __base, __locale_t __loc) __THROW;
490 __extension__
491 extern unsigned long long int wcstoull_l (const wchar_t *__restrict __nptr,
492 wchar_t **__restrict __endptr,
493 int __base, __locale_t __loc)
494 __THROW;
496 #ifdef __UCLIBC_HAS_FLOATS__
497 extern double wcstod_l (const wchar_t *__restrict __nptr,
498 wchar_t **__restrict __endptr, __locale_t __loc)
499 __THROW;
501 extern float wcstof_l (const wchar_t *__restrict __nptr,
502 wchar_t **__restrict __endptr, __locale_t __loc)
503 __THROW;
505 extern long double wcstold_l (const wchar_t *__restrict __nptr,
506 wchar_t **__restrict __endptr,
507 __locale_t __loc) __THROW;
508 #endif /* __UCLIBC_HAS_FLOATS__ */
509 #endif /* __UCLIBC_HAS_XLOCALE__ */
510 #endif /* GNU */
513 #ifdef __USE_GNU
514 /* Copy SRC to DEST, returning the address of the terminating L'\0' in
515 DEST. */
516 extern wchar_t *wcpcpy (wchar_t *__dest, const wchar_t *__src) __THROW;
518 /* Copy no more than N characters of SRC to DEST, returning the address of
519 the last character written into DEST. */
520 extern wchar_t *wcpncpy (wchar_t *__dest, const wchar_t *__src, size_t __n)
521 __THROW;
522 #endif /* use GNU */
525 /* Wide character I/O functions. */
526 #if defined __USE_ISOC99 || defined __USE_UNIX98
527 __BEGIN_NAMESPACE_C99
529 /* Select orientation for stream. */
530 extern int fwide (__FILE *__fp, int __mode) __THROW;
533 /* Write formatted output to STREAM.
535 This function is a possible cancellation point and therefore not
536 marked with __THROW. */
537 extern int fwprintf (__FILE *__restrict __stream,
538 const wchar_t *__restrict __format, ...)
539 /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */;
540 /* Write formatted output to stdout.
542 This function is a possible cancellation point and therefore not
543 marked with __THROW. */
544 extern int wprintf (const wchar_t *__restrict __format, ...)
545 /* __attribute__ ((__format__ (__wprintf__, 1, 2))) */;
546 /* Write formatted output of at most N characters to S. */
547 extern int swprintf (wchar_t *__restrict __s, size_t __n,
548 const wchar_t *__restrict __format, ...)
549 __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
551 /* Write formatted output to S from argument list ARG.
553 This function is a possible cancellation point and therefore not
554 marked with __THROW. */
555 extern int vfwprintf (__FILE *__restrict __s,
556 const wchar_t *__restrict __format,
557 __gnuc_va_list __arg)
558 /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */;
559 libc_hidden_proto(vfwprintf)
560 /* Write formatted output to stdout from argument list ARG.
562 This function is a possible cancellation point and therefore not
563 marked with __THROW. */
564 extern int vwprintf (const wchar_t *__restrict __format,
565 __gnuc_va_list __arg)
566 /* __attribute__ ((__format__ (__wprintf__, 1, 0))) */;
567 /* Write formatted output of at most N character to S from argument
568 list ARG. */
569 extern int vswprintf (wchar_t *__restrict __s, size_t __n,
570 const wchar_t *__restrict __format,
571 __gnuc_va_list __arg)
572 __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
573 libc_hidden_proto(vswprintf)
576 /* Read formatted input from STREAM.
578 This function is a possible cancellation point and therefore not
579 marked with __THROW. */
580 extern int fwscanf (__FILE *__restrict __stream,
581 const wchar_t *__restrict __format, ...)
582 /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
583 /* Read formatted input from stdin.
585 This function is a possible cancellation point and therefore not
586 marked with __THROW. */
587 extern int wscanf (const wchar_t *__restrict __format, ...)
588 /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
589 /* Read formatted input from S. */
590 extern int swscanf (const wchar_t *__restrict __s,
591 const wchar_t *__restrict __format, ...)
592 __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
594 __END_NAMESPACE_C99
595 #endif /* Use ISO C99 and Unix98. */
597 #ifdef __USE_ISOC99
598 __BEGIN_NAMESPACE_C99
600 /* Read formatted input from S into argument list ARG.
602 This function is a possible cancellation point and therefore not
603 marked with __THROW. */
604 extern int vfwscanf (__FILE *__restrict __s,
605 const wchar_t *__restrict __format,
606 __gnuc_va_list __arg)
607 /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
608 libc_hidden_proto(vfwscanf)
609 /* Read formatted input from stdin into argument list ARG.
611 This function is a possible cancellation point and therefore not
612 marked with __THROW. */
613 extern int vwscanf (const wchar_t *__restrict __format,
614 __gnuc_va_list __arg)
615 /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
616 /* Read formatted input from S into argument list ARG. */
617 extern int vswscanf (const wchar_t *__restrict __s,
618 const wchar_t *__restrict __format,
619 __gnuc_va_list __arg)
620 __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
621 libc_hidden_proto(vswscanf)
623 __END_NAMESPACE_C99
624 #endif /* Use ISO C99. */
627 __BEGIN_NAMESPACE_C99
628 /* Read a character from STREAM.
630 These functions are possible cancellation points and therefore not
631 marked with __THROW. */
632 extern wint_t fgetwc (__FILE *__stream);
633 libc_hidden_proto(fgetwc)
634 extern wint_t getwc (__FILE *__stream);
636 /* Read a character from stdin.
638 This function is a possible cancellation point and therefore not
639 marked with __THROW. */
640 extern wint_t getwchar (void);
643 /* Write a character to STREAM.
645 These functions are possible cancellation points and therefore not
646 marked with __THROW. */
647 extern wint_t fputwc (wchar_t __wc, __FILE *__stream);
648 libc_hidden_proto(fputwc)
649 extern wint_t putwc (wchar_t __wc, __FILE *__stream);
651 /* Write a character to stdout.
653 This function is a possible cancellation point and therefore not
654 marked with __THROW. */
655 extern wint_t putwchar (wchar_t __wc);
658 /* Get a newline-terminated wide character string of finite length
659 from STREAM.
661 This function is a possible cancellation point and therefore not
662 marked with __THROW. */
663 extern wchar_t *fgetws (wchar_t *__restrict __ws, int __n,
664 __FILE *__restrict __stream);
666 /* Write a string to STREAM.
668 This function is a possible cancellation point and therefore not
669 marked with __THROW. */
670 extern int fputws (const wchar_t *__restrict __ws,
671 __FILE *__restrict __stream);
672 libc_hidden_proto(fputws)
675 /* Push a character back onto the input buffer of STREAM.
677 This function is a possible cancellation point and therefore not
678 marked with __THROW. */
679 extern wint_t ungetwc (wint_t __wc, __FILE *__stream);
680 libc_hidden_proto(ungetwc)
681 __END_NAMESPACE_C99
684 #ifdef __USE_GNU
685 /* These are defined to be equivalent to the `char' functions defined
686 in POSIX.1:1996.
688 These functions are not part of POSIX and therefore no official
689 cancellation point. But due to similarity with an POSIX interface
690 or due to the implementation they are cancellation points and
691 therefore not marked with __THROW. */
692 extern wint_t getwc_unlocked (__FILE *__stream);
693 extern wint_t getwchar_unlocked (void);
695 /* This is the wide character version of a GNU extension.
697 This function is not part of POSIX and therefore no official
698 cancellation point. But due to similarity with an POSIX interface
699 or due to the implementation it is a cancellation point and
700 therefore not marked with __THROW. */
701 extern wint_t fgetwc_unlocked (__FILE *__stream);
702 libc_hidden_proto(fgetwc_unlocked)
704 /* Faster version when locking is not necessary.
706 This function is not part of POSIX and therefore no official
707 cancellation point. But due to similarity with an POSIX interface
708 or due to the implementation it is a cancellation point and
709 therefore not marked with __THROW. */
710 extern wint_t fputwc_unlocked (wchar_t __wc, __FILE *__stream);
711 libc_hidden_proto(fputwc_unlocked)
713 /* These are defined to be equivalent to the `char' functions defined
714 in POSIX.1:1996.
716 These functions are 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 they are cancellation points and
719 therefore not marked with __THROW. */
720 extern wint_t putwc_unlocked (wchar_t __wc, __FILE *__stream);
721 extern wint_t putwchar_unlocked (wchar_t __wc);
724 /* This function does the same as `fgetws' but does not lock the stream.
726 This function is 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 it is a cancellation point and
729 therefore not marked with __THROW. */
730 extern wchar_t *fgetws_unlocked (wchar_t *__restrict __ws, int __n,
731 __FILE *__restrict __stream);
732 libc_hidden_proto(fgetws_unlocked)
734 /* This function does the same as `fputws' 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 int fputws_unlocked (const wchar_t *__restrict __ws,
741 __FILE *__restrict __stream);
742 libc_hidden_proto(fputws_unlocked)
743 #endif
746 __BEGIN_NAMESPACE_C99
747 /* Format TP into S according to FORMAT.
748 Write no more than MAXSIZE wide characters and return the number
749 of wide characters written, or 0 if it would exceed MAXSIZE. */
750 extern size_t wcsftime (wchar_t *__restrict __s, size_t __maxsize,
751 const wchar_t *__restrict __format,
752 const struct tm *__restrict __tp) __THROW;
753 __END_NAMESPACE_C99
755 # if defined __USE_GNU && defined __UCLIBC_HAS_XLOCALE__
756 # include <xlocale.h>
758 /* Similar to `wcsftime' but takes the information from
759 the provided locale and not the global locale. */
760 extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize,
761 const wchar_t *__restrict __format,
762 const struct tm *__restrict __tp,
763 __locale_t __loc) __THROW;
764 libc_hidden_proto(wcsftime_l)
765 # endif
767 /* The X/Open standard demands that most of the functions defined in
768 the <wctype.h> header must also appear here. This is probably
769 because some X/Open members wrote their implementation before the
770 ISO C standard was published and introduced the better solution.
771 We have to provide these definitions for compliance reasons but we
772 do this nonsense only if really necessary. */
773 #if defined __USE_UNIX98 && !defined __USE_GNU
774 # define __need_iswxxx
775 # include <wctype.h>
776 #endif
778 #ifdef _LIBC
779 extern size_t __wcslcpy(wchar_t *__restrict dst,
780 const wchar_t *__restrict src, size_t n) attribute_hidden;
781 #endif
783 __END_DECLS
785 #endif /* _WCHAR_H defined */
787 #endif /* wchar.h */