Back to index

glibc  2.9
wchar.h
Go to the documentation of this file.
00001 /* Copyright (C) 1995-2004,2005,2006,2007 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003 
00004    The GNU C Library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Lesser General Public
00006    License as published by the Free Software Foundation; either
00007    version 2.1 of the License, or (at your option) any later version.
00008 
00009    The GNU C Library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Lesser General Public License for more details.
00013 
00014    You should have received a copy of the GNU Lesser General Public
00015    License along with the GNU C Library; if not, write to the Free
00016    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00017    02111-1307 USA.  */
00018 
00019 /*
00020  *      ISO C99 Standard: 7.24
00021  *     Extended multibyte and wide character utilities  <wchar.h>
00022  */
00023 
00024 #ifndef _WCHAR_H
00025 
00026 #if !defined __need_mbstate_t && !defined __need_wint_t
00027 # define _WCHAR_H 1
00028 # include <features.h>
00029 #endif
00030 
00031 #ifdef _WCHAR_H
00032 /* Get FILE definition.  */
00033 # define __need___FILE
00034 # if defined __USE_UNIX98 || defined __USE_XOPEN2K
00035 #  define __need_FILE
00036 # endif
00037 # include <stdio.h>
00038 /* Get va_list definition.  */
00039 # define __need___va_list
00040 # include <stdarg.h>
00041 
00042 # include <bits/wchar.h>
00043 
00044 /* Get size_t, wchar_t, wint_t and NULL from <stddef.h>.  */
00045 # define __need_size_t
00046 # define __need_wchar_t
00047 # define __need_NULL
00048 #endif
00049 #if defined _WCHAR_H || defined __need_wint_t || !defined __WINT_TYPE__
00050 # undef __need_wint_t
00051 # define __need_wint_t
00052 # include <stddef.h>
00053 
00054 /* We try to get wint_t from <stddef.h>, but not all GCC versions define it
00055    there.  So define it ourselves if it remains undefined.  */
00056 # ifndef _WINT_T
00057 /* Integral type unchanged by default argument promotions that can
00058    hold any value corresponding to members of the extended character
00059    set, as well as at least one value that does not correspond to any
00060    member of the extended character set.  */
00061 #  define _WINT_T
00062 typedef unsigned int wint_t;
00063 # else
00064 /* Work around problems with the <stddef.h> file which doesn't put
00065    wint_t in the std namespace.  */
00066 #  if defined __cplusplus && defined _GLIBCPP_USE_NAMESPACES \
00067       && defined __WINT_TYPE__
00068 __BEGIN_NAMESPACE_STD
00069 typedef __WINT_TYPE__ wint_t;
00070 __END_NAMESPACE_STD
00071 #  endif
00072 # endif
00073 #endif
00074 
00075 #if (defined _WCHAR_H || defined __need_mbstate_t) && !defined __mbstate_t_defined
00076 # define __mbstate_t_defined       1
00077 /* Conversion state information.  */
00078 typedef struct
00079 {
00080   int __count;
00081   union
00082   {
00083 # ifdef __WINT_TYPE__
00084     __WINT_TYPE__ __wch;
00085 # else
00086     wint_t __wch;
00087 # endif
00088     char __wchb[4];
00089   } __value;         /* Value so far.  */
00090 } __mbstate_t;
00091 #endif
00092 #undef __need_mbstate_t
00093 
00094 
00095 /* The rest of the file is only used if used if __need_mbstate_t is not
00096    defined.  */
00097 #ifdef _WCHAR_H
00098 
00099 __BEGIN_NAMESPACE_C99
00100 /* Public type.  */
00101 typedef __mbstate_t mbstate_t;
00102 __END_NAMESPACE_C99
00103 #ifdef __USE_GNU
00104 __USING_NAMESPACE_C99(mbstate_t)
00105 #endif
00106 
00107 #ifndef WCHAR_MIN
00108 /* These constants might also be defined in <inttypes.h>.  */
00109 # define WCHAR_MIN __WCHAR_MIN
00110 # define WCHAR_MAX __WCHAR_MAX
00111 #endif
00112 
00113 #ifndef WEOF
00114 # define WEOF (0xffffffffu)
00115 #endif
00116 
00117 /* For XPG4 compliance we have to define the stuff from <wctype.h> here
00118    as well.  */
00119 #if defined __USE_XOPEN && !defined __USE_UNIX98
00120 # include <wctype.h>
00121 #endif
00122 
00123 
00124 __BEGIN_DECLS
00125 
00126 __BEGIN_NAMESPACE_STD
00127 /* This incomplete type is defined in <time.h> but needed here because
00128    of `wcsftime'.  */
00129 struct tm;
00130 __END_NAMESPACE_STD
00131 /* XXX We have to clean this up at some point.  Since tm is in the std
00132    namespace but wcsftime is in __c99 the type wouldn't be found
00133    without inserting it in the global namespace.  */
00134 __USING_NAMESPACE_STD(tm)
00135 
00136 
00137 __BEGIN_NAMESPACE_STD
00138 /* Copy SRC to DEST.  */
00139 extern wchar_t *wcscpy (wchar_t *__restrict __dest,
00140                      __const wchar_t *__restrict __src) __THROW;
00141 /* Copy no more than N wide-characters of SRC to DEST.  */
00142 extern wchar_t *wcsncpy (wchar_t *__restrict __dest,
00143                       __const wchar_t *__restrict __src, size_t __n)
00144      __THROW;
00145 
00146 /* Append SRC onto DEST.  */
00147 extern wchar_t *wcscat (wchar_t *__restrict __dest,
00148                      __const wchar_t *__restrict __src) __THROW;
00149 /* Append no more than N wide-characters of SRC onto DEST.  */
00150 extern wchar_t *wcsncat (wchar_t *__restrict __dest,
00151                       __const wchar_t *__restrict __src, size_t __n)
00152      __THROW;
00153 
00154 /* Compare S1 and S2.  */
00155 extern int wcscmp (__const wchar_t *__s1, __const wchar_t *__s2)
00156      __THROW __attribute_pure__;
00157 /* Compare N wide-characters of S1 and S2.  */
00158 extern int wcsncmp (__const wchar_t *__s1, __const wchar_t *__s2, size_t __n)
00159      __THROW __attribute_pure__;
00160 __END_NAMESPACE_STD
00161 
00162 #ifdef __USE_GNU
00163 /* Compare S1 and S2, ignoring case.  */
00164 extern int wcscasecmp (__const wchar_t *__s1, __const wchar_t *__s2) __THROW;
00165 
00166 /* Compare no more than N chars of S1 and S2, ignoring case.  */
00167 extern int wcsncasecmp (__const wchar_t *__s1, __const wchar_t *__s2,
00168                      size_t __n) __THROW;
00169 
00170 /* Similar to the two functions above but take the information from
00171    the provided locale and not the global locale.  */
00172 # include <xlocale.h>
00173 
00174 extern int wcscasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2,
00175                       __locale_t __loc) __THROW;
00176 
00177 extern int wcsncasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2,
00178                        size_t __n, __locale_t __loc) __THROW;
00179 #endif
00180 
00181 __BEGIN_NAMESPACE_STD
00182 /* Compare S1 and S2, both interpreted as appropriate to the
00183    LC_COLLATE category of the current locale.  */
00184 extern int wcscoll (__const wchar_t *__s1, __const wchar_t *__s2) __THROW;
00185 /* Transform S2 into array pointed to by S1 such that if wcscmp is
00186    applied to two transformed strings the result is the as applying
00187    `wcscoll' to the original strings.  */
00188 extern size_t wcsxfrm (wchar_t *__restrict __s1,
00189                      __const wchar_t *__restrict __s2, size_t __n) __THROW;
00190 __END_NAMESPACE_STD
00191 
00192 #ifdef __USE_GNU
00193 /* Similar to the two functions above but take the information from
00194    the provided locale and not the global locale.  */
00195 
00196 /* Compare S1 and S2, both interpreted as appropriate to the
00197    LC_COLLATE category of the given locale.  */
00198 extern int wcscoll_l (__const wchar_t *__s1, __const wchar_t *__s2,
00199                     __locale_t __loc) __THROW;
00200 
00201 /* Transform S2 into array pointed to by S1 such that if wcscmp is
00202    applied to two transformed strings the result is the as applying
00203    `wcscoll' to the original strings.  */
00204 extern size_t wcsxfrm_l (wchar_t *__s1, __const wchar_t *__s2,
00205                       size_t __n, __locale_t __loc) __THROW;
00206 
00207 /* Duplicate S, returning an identical malloc'd string.  */
00208 extern wchar_t *wcsdup (__const wchar_t *__s) __THROW __attribute_malloc__;
00209 #endif
00210 
00211 __BEGIN_NAMESPACE_STD
00212 /* Find the first occurrence of WC in WCS.  */
00213 extern wchar_t *wcschr (__const wchar_t *__wcs, wchar_t __wc)
00214      __THROW __attribute_pure__;
00215 /* Find the last occurrence of WC in WCS.  */
00216 extern wchar_t *wcsrchr (__const wchar_t *__wcs, wchar_t __wc)
00217      __THROW __attribute_pure__;
00218 __END_NAMESPACE_STD
00219 
00220 #ifdef __USE_GNU
00221 /* This function is similar to `wcschr'.  But it returns a pointer to
00222    the closing NUL wide character in case C is not found in S.  */
00223 extern wchar_t *wcschrnul (__const wchar_t *__s, wchar_t __wc)
00224      __THROW __attribute_pure__;
00225 #endif
00226 
00227 __BEGIN_NAMESPACE_STD
00228 /* Return the length of the initial segmet of WCS which
00229    consists entirely of wide characters not in REJECT.  */
00230 extern size_t wcscspn (__const wchar_t *__wcs, __const wchar_t *__reject)
00231      __THROW __attribute_pure__;
00232 /* Return the length of the initial segmet of WCS which
00233    consists entirely of wide characters in  ACCEPT.  */
00234 extern size_t wcsspn (__const wchar_t *__wcs, __const wchar_t *__accept)
00235      __THROW __attribute_pure__;
00236 /* Find the first occurrence in WCS of any character in ACCEPT.  */
00237 extern wchar_t *wcspbrk (__const wchar_t *__wcs, __const wchar_t *__accept)
00238      __THROW __attribute_pure__;
00239 /* Find the first occurrence of NEEDLE in HAYSTACK.  */
00240 extern wchar_t *wcsstr (__const wchar_t *__haystack, __const wchar_t *__needle)
00241      __THROW __attribute_pure__;
00242 
00243 /* Divide WCS into tokens separated by characters in DELIM.  */
00244 extern wchar_t *wcstok (wchar_t *__restrict __s,
00245                      __const wchar_t *__restrict __delim,
00246                      wchar_t **__restrict __ptr) __THROW;
00247 
00248 /* Return the number of wide characters in S.  */
00249 extern size_t wcslen (__const wchar_t *__s) __THROW __attribute_pure__;
00250 __END_NAMESPACE_STD
00251 
00252 #ifdef __USE_XOPEN
00253 /* Another name for `wcsstr' from XPG4.  */
00254 extern wchar_t *wcswcs (__const wchar_t *__haystack, __const wchar_t *__needle)
00255      __THROW __attribute_pure__;
00256 #endif
00257 
00258 #ifdef __USE_GNU
00259 /* Return the number of wide characters in S, but at most MAXLEN.  */
00260 extern size_t wcsnlen (__const wchar_t *__s, size_t __maxlen)
00261      __THROW __attribute_pure__;
00262 #endif
00263 
00264 
00265 __BEGIN_NAMESPACE_STD
00266 /* Search N wide characters of S for C.  */
00267 extern wchar_t *wmemchr (__const wchar_t *__s, wchar_t __c, size_t __n)
00268      __THROW __attribute_pure__;
00269 
00270 /* Compare N wide characters of S1 and S2.  */
00271 extern int wmemcmp (__const wchar_t *__restrict __s1,
00272                   __const wchar_t *__restrict __s2, size_t __n)
00273      __THROW __attribute_pure__;
00274 
00275 /* Copy N wide characters of SRC to DEST.  */
00276 extern wchar_t *wmemcpy (wchar_t *__restrict __s1,
00277                       __const wchar_t *__restrict __s2, size_t __n) __THROW;
00278 
00279 /* Copy N wide characters of SRC to DEST, guaranteeing
00280    correct behavior for overlapping strings.  */
00281 extern wchar_t *wmemmove (wchar_t *__s1, __const wchar_t *__s2, size_t __n)
00282      __THROW;
00283 
00284 /* Set N wide characters of S to C.  */
00285 extern wchar_t *wmemset (wchar_t *__s, wchar_t __c, size_t __n) __THROW;
00286 __END_NAMESPACE_STD
00287 
00288 #ifdef __USE_GNU
00289 /* Copy N wide characters of SRC to DEST and return pointer to following
00290    wide character.  */
00291 extern wchar_t *wmempcpy (wchar_t *__restrict __s1,
00292                        __const wchar_t *__restrict __s2, size_t __n)
00293      __THROW;
00294 #endif
00295 
00296 
00297 __BEGIN_NAMESPACE_STD
00298 /* Determine whether C constitutes a valid (one-byte) multibyte
00299    character.  */
00300 extern wint_t btowc (int __c) __THROW;
00301 
00302 /* Determine whether C corresponds to a member of the extended
00303    character set whose multibyte representation is a single byte.  */
00304 extern int wctob (wint_t __c) __THROW;
00305 
00306 /* Determine whether PS points to an object representing the initial
00307    state.  */
00308 extern int mbsinit (__const mbstate_t *__ps) __THROW __attribute_pure__;
00309 
00310 /* Write wide character representation of multibyte character pointed
00311    to by S to PWC.  */
00312 extern size_t mbrtowc (wchar_t *__restrict __pwc,
00313                      __const char *__restrict __s, size_t __n,
00314                      mbstate_t *__p) __THROW;
00315 
00316 /* Write multibyte representation of wide character WC to S.  */
00317 extern size_t wcrtomb (char *__restrict __s, wchar_t __wc,
00318                      mbstate_t *__restrict __ps) __THROW;
00319 
00320 /* Return number of bytes in multibyte character pointed to by S.  */
00321 extern size_t __mbrlen (__const char *__restrict __s, size_t __n,
00322                      mbstate_t *__restrict __ps) __THROW;
00323 extern size_t mbrlen (__const char *__restrict __s, size_t __n,
00324                     mbstate_t *__restrict __ps) __THROW;
00325 __END_NAMESPACE_STD
00326 
00327 #ifdef __USE_EXTERN_INLINES
00328 /* Define inline function as optimization.  */
00329 
00330 /* We can use the BTOWC and WCTOB optimizations since we know that all
00331    locales must use ASCII encoding for the values in the ASCII range
00332    and because the wchar_t encoding is always ISO 10646.  */
00333 extern wint_t __btowc_alias (int __c) __asm ("btowc");
00334 __extern_inline wint_t
00335 __NTH (btowc (int __c))
00336 { return (__builtin_constant_p (__c) && __c >= '\0' && __c <= '\x7f'
00337          ? (wint_t) __c : __btowc_alias (__c)); }
00338 
00339 extern int __wctob_alias (wint_t __c) __asm ("wctob");
00340 __extern_inline int
00341 __NTH (wctob (wint_t __wc))
00342 { return (__builtin_constant_p (__wc) && __wc >= L'\0' && __wc <= L'\x7f'
00343          ? (int) __wc : __wctob_alias (__wc)); }
00344 
00345 __extern_inline size_t
00346 __NTH (mbrlen (__const char *__restrict __s, size_t __n,
00347               mbstate_t *__restrict __ps))
00348 { return (__ps != NULL
00349          ? mbrtowc (NULL, __s, __n, __ps) : __mbrlen (__s, __n, NULL)); }
00350 #endif
00351 
00352 __BEGIN_NAMESPACE_STD
00353 /* Write wide character representation of multibyte character string
00354    SRC to DST.  */
00355 extern size_t mbsrtowcs (wchar_t *__restrict __dst,
00356                       __const char **__restrict __src, size_t __len,
00357                       mbstate_t *__restrict __ps) __THROW;
00358 
00359 /* Write multibyte character representation of wide character string
00360    SRC to DST.  */
00361 extern size_t wcsrtombs (char *__restrict __dst,
00362                       __const wchar_t **__restrict __src, size_t __len,
00363                       mbstate_t *__restrict __ps) __THROW;
00364 __END_NAMESPACE_STD
00365 
00366 
00367 #ifdef __USE_GNU
00368 /* Write wide character representation of at most NMC bytes of the
00369    multibyte character string SRC to DST.  */
00370 extern size_t mbsnrtowcs (wchar_t *__restrict __dst,
00371                        __const char **__restrict __src, size_t __nmc,
00372                        size_t __len, mbstate_t *__restrict __ps) __THROW;
00373 
00374 /* Write multibyte character representation of at most NWC characters
00375    from the wide character string SRC to DST.  */
00376 extern size_t wcsnrtombs (char *__restrict __dst,
00377                        __const wchar_t **__restrict __src,
00378                        size_t __nwc, size_t __len,
00379                        mbstate_t *__restrict __ps) __THROW;
00380 #endif /* use GNU */
00381 
00382 
00383 /* The following functions are extensions found in X/Open CAE.  */
00384 #ifdef __USE_XOPEN
00385 /* Determine number of column positions required for C.  */
00386 extern int wcwidth (wchar_t __c) __THROW;
00387 
00388 /* Determine number of column positions required for first N wide
00389    characters (or fewer if S ends before this) in S.  */
00390 extern int wcswidth (__const wchar_t *__s, size_t __n) __THROW;
00391 #endif /* Use X/Open.  */
00392 
00393 
00394 __BEGIN_NAMESPACE_STD
00395 /* Convert initial portion of the wide string NPTR to `double'
00396    representation.  */
00397 extern double wcstod (__const wchar_t *__restrict __nptr,
00398                     wchar_t **__restrict __endptr) __THROW;
00399 __END_NAMESPACE_STD
00400 
00401 #ifdef __USE_ISOC99
00402 __BEGIN_NAMESPACE_C99
00403 /* Likewise for `float' and `long double' sizes of floating-point numbers.  */
00404 extern float wcstof (__const wchar_t *__restrict __nptr,
00405                    wchar_t **__restrict __endptr) __THROW;
00406 extern long double wcstold (__const wchar_t *__restrict __nptr,
00407                          wchar_t **__restrict __endptr) __THROW;
00408 __END_NAMESPACE_C99
00409 #endif /* C99 */
00410 
00411 
00412 __BEGIN_NAMESPACE_STD
00413 /* Convert initial portion of wide string NPTR to `long int'
00414    representation.  */
00415 extern long int wcstol (__const wchar_t *__restrict __nptr,
00416                      wchar_t **__restrict __endptr, int __base) __THROW;
00417 
00418 /* Convert initial portion of wide string NPTR to `unsigned long int'
00419    representation.  */
00420 extern unsigned long int wcstoul (__const wchar_t *__restrict __nptr,
00421                               wchar_t **__restrict __endptr, int __base)
00422      __THROW;
00423 __END_NAMESPACE_STD
00424 
00425 #if defined __USE_ISOC99 || (defined __GNUC__ && defined __USE_GNU)
00426 __BEGIN_NAMESPACE_C99
00427 /* Convert initial portion of wide string NPTR to `long long int'
00428    representation.  */
00429 __extension__
00430 extern long long int wcstoll (__const wchar_t *__restrict __nptr,
00431                            wchar_t **__restrict __endptr, int __base)
00432      __THROW;
00433 
00434 /* Convert initial portion of wide string NPTR to `unsigned long long int'
00435    representation.  */
00436 __extension__
00437 extern unsigned long long int wcstoull (__const wchar_t *__restrict __nptr,
00438                                    wchar_t **__restrict __endptr,
00439                                    int __base) __THROW;
00440 __END_NAMESPACE_C99
00441 #endif /* ISO C99 or GCC and GNU.  */
00442 
00443 #if defined __GNUC__ && defined __USE_GNU
00444 /* Convert initial portion of wide string NPTR to `long long int'
00445    representation.  */
00446 __extension__
00447 extern long long int wcstoq (__const wchar_t *__restrict __nptr,
00448                           wchar_t **__restrict __endptr, int __base)
00449      __THROW;
00450 
00451 /* Convert initial portion of wide string NPTR to `unsigned long long int'
00452    representation.  */
00453 __extension__
00454 extern unsigned long long int wcstouq (__const wchar_t *__restrict __nptr,
00455                                    wchar_t **__restrict __endptr,
00456                                    int __base) __THROW;
00457 #endif /* GCC and use GNU.  */
00458 
00459 #ifdef __USE_GNU
00460 /* The concept of one static locale per category is not very well
00461    thought out.  Many applications will need to process its data using
00462    information from several different locales.  Another application is
00463    the implementation of the internationalization handling in the
00464    upcoming ISO C++ standard library.  To support this another set of
00465    the functions using locale data exist which have an additional
00466    argument.
00467 
00468    Attention: all these functions are *not* standardized in any form.
00469    This is a proof-of-concept implementation.  */
00470 
00471 /* Structure for reentrant locale using functions.  This is an
00472    (almost) opaque type for the user level programs.  */
00473 # include <xlocale.h>
00474 
00475 /* Special versions of the functions above which take the locale to
00476    use as an additional parameter.  */
00477 extern long int wcstol_l (__const wchar_t *__restrict __nptr,
00478                        wchar_t **__restrict __endptr, int __base,
00479                        __locale_t __loc) __THROW;
00480 
00481 extern unsigned long int wcstoul_l (__const wchar_t *__restrict __nptr,
00482                                 wchar_t **__restrict __endptr,
00483                                 int __base, __locale_t __loc) __THROW;
00484 
00485 __extension__
00486 extern long long int wcstoll_l (__const wchar_t *__restrict __nptr,
00487                             wchar_t **__restrict __endptr,
00488                             int __base, __locale_t __loc) __THROW;
00489 
00490 __extension__
00491 extern unsigned long long int wcstoull_l (__const wchar_t *__restrict __nptr,
00492                                      wchar_t **__restrict __endptr,
00493                                      int __base, __locale_t __loc)
00494      __THROW;
00495 
00496 extern double wcstod_l (__const wchar_t *__restrict __nptr,
00497                      wchar_t **__restrict __endptr, __locale_t __loc)
00498      __THROW;
00499 
00500 extern float wcstof_l (__const wchar_t *__restrict __nptr,
00501                      wchar_t **__restrict __endptr, __locale_t __loc)
00502      __THROW;
00503 
00504 extern long double wcstold_l (__const wchar_t *__restrict __nptr,
00505                            wchar_t **__restrict __endptr,
00506                            __locale_t __loc) __THROW;
00507 #endif /* GNU */
00508 
00509 
00510 #ifdef __USE_GNU
00511 /* Copy SRC to DEST, returning the address of the terminating L'\0' in
00512    DEST.  */
00513 extern wchar_t *wcpcpy (wchar_t *__dest, __const wchar_t *__src) __THROW;
00514 
00515 /* Copy no more than N characters of SRC to DEST, returning the address of
00516    the last character written into DEST.  */
00517 extern wchar_t *wcpncpy (wchar_t *__dest, __const wchar_t *__src, size_t __n)
00518      __THROW;
00519 #endif /* use GNU */
00520 
00521 
00522 /* Wide character I/O functions.  */
00523 
00524 #ifdef __USE_GNU
00525 /* Like OPEN_MEMSTREAM, but the stream is wide oriented and produces
00526    a wide character string.  */
00527 extern __FILE *open_wmemstream (wchar_t **__bufloc, size_t *__sizeloc) __THROW;
00528 #endif
00529 
00530 #if defined __USE_ISOC95 || defined __USE_UNIX98
00531 __BEGIN_NAMESPACE_STD
00532 
00533 /* Select orientation for stream.  */
00534 extern int fwide (__FILE *__fp, int __mode) __THROW;
00535 
00536 
00537 /* Write formatted output to STREAM.
00538 
00539    This function is a possible cancellation point and therefore not
00540    marked with __THROW.  */
00541 extern int fwprintf (__FILE *__restrict __stream,
00542                    __const wchar_t *__restrict __format, ...)
00543      /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */;
00544 /* Write formatted output to stdout.
00545 
00546    This function is a possible cancellation point and therefore not
00547    marked with __THROW.  */
00548 extern int wprintf (__const wchar_t *__restrict __format, ...)
00549      /* __attribute__ ((__format__ (__wprintf__, 1, 2))) */;
00550 /* Write formatted output of at most N characters to S.  */
00551 extern int swprintf (wchar_t *__restrict __s, size_t __n,
00552                    __const wchar_t *__restrict __format, ...)
00553      __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
00554 
00555 /* Write formatted output to S from argument list ARG.
00556 
00557    This function is a possible cancellation point and therefore not
00558    marked with __THROW.  */
00559 extern int vfwprintf (__FILE *__restrict __s,
00560                     __const wchar_t *__restrict __format,
00561                     __gnuc_va_list __arg)
00562      /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */;
00563 /* Write formatted output to stdout from argument list ARG.
00564 
00565    This function is a possible cancellation point and therefore not
00566    marked with __THROW.  */
00567 extern int vwprintf (__const wchar_t *__restrict __format,
00568                    __gnuc_va_list __arg)
00569      /* __attribute__ ((__format__ (__wprintf__, 1, 0))) */;
00570 /* Write formatted output of at most N character to S from argument
00571    list ARG.  */
00572 extern int vswprintf (wchar_t *__restrict __s, size_t __n,
00573                     __const wchar_t *__restrict __format,
00574                     __gnuc_va_list __arg)
00575      __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
00576 
00577 
00578 /* Read formatted input from STREAM.
00579 
00580    This function is a possible cancellation point and therefore not
00581    marked with __THROW.  */
00582 extern int fwscanf (__FILE *__restrict __stream,
00583                   __const wchar_t *__restrict __format, ...)
00584      /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
00585 /* Read formatted input from stdin.
00586 
00587    This function is a possible cancellation point and therefore not
00588    marked with __THROW.  */
00589 extern int wscanf (__const wchar_t *__restrict __format, ...)
00590      /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
00591 /* Read formatted input from S.  */
00592 extern int swscanf (__const wchar_t *__restrict __s,
00593                   __const wchar_t *__restrict __format, ...)
00594      __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
00595 
00596 # if defined __USE_ISOC99 && !defined __USE_GNU \
00597      && (!defined __LDBL_COMPAT || !defined __REDIRECT) \
00598      && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K)
00599 #  ifdef __REDIRECT
00600 /* For strict ISO C99 or POSIX compliance disallow %as, %aS and %a[
00601    GNU extension which conflicts with valid %a followed by letter
00602    s, S or [.  */
00603 extern int __REDIRECT (fwscanf, (__FILE *__restrict __stream,
00604                              __const wchar_t *__restrict __format, ...),
00605                      __isoc99_fwscanf)
00606      /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
00607 extern int __REDIRECT (wscanf, (__const wchar_t *__restrict __format, ...),
00608                      __isoc99_wscanf)
00609      /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
00610 extern int __REDIRECT (swscanf, (__const wchar_t *__restrict __s,
00611                              __const wchar_t *__restrict __format, ...),
00612                      __isoc99_swscanf)
00613      __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
00614 #  else
00615 extern int __isoc99_fwscanf (__FILE *__restrict __stream,
00616                           __const wchar_t *__restrict __format, ...);
00617 extern int __isoc99_wscanf (__const wchar_t *__restrict __format, ...);
00618 extern int __isoc99_swscanf (__const wchar_t *__restrict __s,
00619                           __const wchar_t *__restrict __format, ...)
00620      __THROW;
00621 #   define fwscanf __isoc99_fwscanf
00622 #   define wscanf __isoc99_wscanf
00623 #   define swscanf __isoc99_swscanf
00624 #  endif
00625 # endif
00626 
00627 __END_NAMESPACE_STD
00628 #endif /* Use ISO C95, C99 and Unix98. */
00629 
00630 #ifdef __USE_ISOC99
00631 __BEGIN_NAMESPACE_C99
00632 /* Read formatted input from S into argument list ARG.
00633 
00634    This function is a possible cancellation point and therefore not
00635    marked with __THROW.  */
00636 extern int vfwscanf (__FILE *__restrict __s,
00637                    __const wchar_t *__restrict __format,
00638                    __gnuc_va_list __arg)
00639      /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
00640 /* Read formatted input from stdin into argument list ARG.
00641 
00642    This function is a possible cancellation point and therefore not
00643    marked with __THROW.  */
00644 extern int vwscanf (__const wchar_t *__restrict __format,
00645                   __gnuc_va_list __arg)
00646      /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
00647 /* Read formatted input from S into argument list ARG.  */
00648 extern int vswscanf (__const wchar_t *__restrict __s,
00649                    __const wchar_t *__restrict __format,
00650                    __gnuc_va_list __arg)
00651      __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
00652 
00653 # if !defined __USE_GNU \
00654      && (!defined __LDBL_COMPAT || !defined __REDIRECT) \
00655      && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K)
00656 #  ifdef __REDIRECT
00657 extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s,
00658                               __const wchar_t *__restrict __format,
00659                               __gnuc_va_list __arg), __isoc99_vfwscanf)
00660      /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
00661 extern int __REDIRECT (vwscanf, (__const wchar_t *__restrict __format,
00662                              __gnuc_va_list __arg), __isoc99_vwscanf)
00663      /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
00664 extern int __REDIRECT (vswscanf, (__const wchar_t *__restrict __s,
00665                               __const wchar_t *__restrict __format,
00666                               __gnuc_va_list __arg), __isoc99_vswscanf)
00667      __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
00668 #  else
00669 extern int __isoc99_vfwscanf (__FILE *__restrict __s,
00670                            __const wchar_t *__restrict __format,
00671                            __gnuc_va_list __arg);
00672 extern int __isoc99_vwscanf (__const wchar_t *__restrict __format,
00673                           __gnuc_va_list __arg);
00674 extern int __isoc99_vswscanf (__const wchar_t *__restrict __s,
00675                            __const wchar_t *__restrict __format,
00676                            __gnuc_va_list __arg) __THROW;
00677 #   define vfwscanf __isoc99_vfwscanf
00678 #   define vwscanf __isoc99_vwscanf
00679 #   define vswscanf __isoc99_vswscanf
00680 #  endif
00681 # endif
00682 
00683 __END_NAMESPACE_C99
00684 #endif /* Use ISO C99. */
00685 
00686 
00687 __BEGIN_NAMESPACE_STD
00688 /* Read a character from STREAM.
00689 
00690    These functions are possible cancellation points and therefore not
00691    marked with __THROW.  */
00692 extern wint_t fgetwc (__FILE *__stream);
00693 extern wint_t getwc (__FILE *__stream);
00694 
00695 /* Read a character from stdin.
00696 
00697    This function is a possible cancellation point and therefore not
00698    marked with __THROW.  */
00699 extern wint_t getwchar (void);
00700 
00701 
00702 /* Write a character to STREAM.
00703 
00704    These functions are possible cancellation points and therefore not
00705    marked with __THROW.  */
00706 extern wint_t fputwc (wchar_t __wc, __FILE *__stream);
00707 extern wint_t putwc (wchar_t __wc, __FILE *__stream);
00708 
00709 /* Write a character to stdout.
00710 
00711    This function is a possible cancellation points and therefore not
00712    marked with __THROW.  */
00713 extern wint_t putwchar (wchar_t __wc);
00714 
00715 
00716 /* Get a newline-terminated wide character string of finite length
00717    from STREAM.
00718 
00719    This function is a possible cancellation points and therefore not
00720    marked with __THROW.  */
00721 extern wchar_t *fgetws (wchar_t *__restrict __ws, int __n,
00722                      __FILE *__restrict __stream);
00723 
00724 /* Write a string to STREAM.
00725 
00726    This function is a possible cancellation points and therefore not
00727    marked with __THROW.  */
00728 extern int fputws (__const wchar_t *__restrict __ws,
00729                  __FILE *__restrict __stream);
00730 
00731 
00732 /* Push a character back onto the input buffer of STREAM.
00733 
00734    This function is a possible cancellation points and therefore not
00735    marked with __THROW.  */
00736 extern wint_t ungetwc (wint_t __wc, __FILE *__stream);
00737 __END_NAMESPACE_STD
00738 
00739 
00740 #ifdef __USE_GNU
00741 /* These are defined to be equivalent to the `char' functions defined
00742    in POSIX.1:1996.
00743 
00744    These functions are not part of POSIX and therefore no official
00745    cancellation point.  But due to similarity with an POSIX interface
00746    or due to the implementation they are cancellation points and
00747    therefore not marked with __THROW.  */
00748 extern wint_t getwc_unlocked (__FILE *__stream);
00749 extern wint_t getwchar_unlocked (void);
00750 
00751 /* This is the wide character version of a GNU extension.
00752 
00753    This function is not part of POSIX and therefore no official
00754    cancellation point.  But due to similarity with an POSIX interface
00755    or due to the implementation it is a cancellation point and
00756    therefore not marked with __THROW.  */
00757 extern wint_t fgetwc_unlocked (__FILE *__stream);
00758 
00759 /* Faster version when locking is not necessary.
00760 
00761    This function is not part of POSIX and therefore no official
00762    cancellation point.  But due to similarity with an POSIX interface
00763    or due to the implementation it is a cancellation point and
00764    therefore not marked with __THROW.  */
00765 extern wint_t fputwc_unlocked (wchar_t __wc, __FILE *__stream);
00766 
00767 /* These are defined to be equivalent to the `char' functions defined
00768    in POSIX.1:1996.
00769 
00770    These functions are not part of POSIX and therefore no official
00771    cancellation point.  But due to similarity with an POSIX interface
00772    or due to the implementation they are cancellation points and
00773    therefore not marked with __THROW.  */
00774 extern wint_t putwc_unlocked (wchar_t __wc, __FILE *__stream);
00775 extern wint_t putwchar_unlocked (wchar_t __wc);
00776 
00777 
00778 /* This function does the same as `fgetws' but does not lock the stream.
00779 
00780    This function is not part of POSIX and therefore no official
00781    cancellation point.  But due to similarity with an POSIX interface
00782    or due to the implementation it is a cancellation point and
00783    therefore not marked with __THROW.  */
00784 extern wchar_t *fgetws_unlocked (wchar_t *__restrict __ws, int __n,
00785                              __FILE *__restrict __stream);
00786 
00787 /* This function does the same as `fputws' but does not lock the stream.
00788 
00789    This function is not part of POSIX and therefore no official
00790    cancellation point.  But due to similarity with an POSIX interface
00791    or due to the implementation it is a cancellation point and
00792    therefore not marked with __THROW.  */
00793 extern int fputws_unlocked (__const wchar_t *__restrict __ws,
00794                          __FILE *__restrict __stream);
00795 #endif
00796 
00797 
00798 __BEGIN_NAMESPACE_C99
00799 /* Format TP into S according to FORMAT.
00800    Write no more than MAXSIZE wide characters and return the number
00801    of wide characters written, or 0 if it would exceed MAXSIZE.  */
00802 extern size_t wcsftime (wchar_t *__restrict __s, size_t __maxsize,
00803                      __const wchar_t *__restrict __format,
00804                      __const struct tm *__restrict __tp) __THROW;
00805 __END_NAMESPACE_C99
00806 
00807 # ifdef __USE_GNU
00808 # include <xlocale.h>
00809 
00810 /* Similar to `wcsftime' but takes the information from
00811    the provided locale and not the global locale.  */
00812 extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize,
00813                        __const wchar_t *__restrict __format,
00814                        __const struct tm *__restrict __tp,
00815                        __locale_t __loc) __THROW;
00816 # endif
00817 
00818 /* The X/Open standard demands that most of the functions defined in
00819    the <wctype.h> header must also appear here.  This is probably
00820    because some X/Open members wrote their implementation before the
00821    ISO C standard was published and introduced the better solution.
00822    We have to provide these definitions for compliance reasons but we
00823    do this nonsense only if really necessary.  */
00824 #if defined __USE_UNIX98 && !defined __USE_GNU
00825 # define __need_iswxxx
00826 # include <wctype.h>
00827 #endif
00828 
00829 /* Define some macros helping to catch buffer overflows.  */
00830 #if __USE_FORTIFY_LEVEL > 0 && defined __extern_always_inline
00831 # include <bits/wchar2.h>
00832 #endif
00833 
00834 #ifdef __LDBL_COMPAT
00835 # include <bits/wchar-ldbl.h>
00836 #endif
00837 
00838 __END_DECLS
00839 
00840 #endif /* _WCHAR_H defined */
00841 
00842 /* Undefined all __need_* constants in case we are included to get those
00843    constants but the whole file was already read.  */
00844 #undef __need_mbstate_t
00845 #undef __need_wint_t
00846 
00847 #endif /* wchar.h  */