wchar.h 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787
  1. /* Copyright (C) 1995-2002, 2003 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Lesser General Public
  5. License as published by the Free Software Foundation; either
  6. version 2.1 of the License, or (at your option) any later version.
  7. The GNU C Library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public
  12. License along with the GNU C Library; if not, see
  13. <http://www.gnu.org/licenses/>. */
  14. /*
  15. * ISO C99 Standard: 7.24
  16. * Extended multibyte and wide character utilities <wchar.h>
  17. */
  18. #ifndef _WCHAR_H
  19. #ifndef __need_mbstate_t
  20. # define _WCHAR_H 1
  21. # include <features.h>
  22. #endif
  23. #ifndef __UCLIBC_HAS_WCHAR__
  24. #error Attempted to include wchar.h when uClibc built without wide char support.
  25. #endif
  26. #ifdef _WCHAR_H
  27. /* Get FILE definition. */
  28. # define __need___FILE
  29. # ifdef __USE_UNIX98
  30. # define __need_FILE
  31. # endif
  32. # include <stdio.h>
  33. /* Get va_list definition. */
  34. # define __need___va_list
  35. # include <stdarg.h>
  36. /* Get size_t, wchar_t, wint_t and NULL from <stddef.h>. */
  37. # define __need_size_t
  38. # define __need_wchar_t
  39. # define __need_NULL
  40. #endif
  41. #define __need_wint_t
  42. #include <stddef.h>
  43. #include <bits/wchar.h>
  44. /* We try to get wint_t from <stddef.h>, but not all GCC versions define it
  45. there. So define it ourselves if it remains undefined. */
  46. #ifndef _WINT_T
  47. /* Integral type unchanged by default argument promotions that can
  48. hold any value corresponding to members of the extended character
  49. set, as well as at least one value that does not correspond to any
  50. member of the extended character set. */
  51. # define _WINT_T
  52. typedef unsigned int wint_t;
  53. #else
  54. /* Work around problems with the <stddef.h> file which doesn't put
  55. wint_t in the std namespace. */
  56. # if defined __cplusplus && defined _GLIBCPP_USE_NAMESPACES \
  57. && defined __WINT_TYPE__
  58. __BEGIN_NAMESPACE_STD
  59. typedef __WINT_TYPE__ wint_t;
  60. __END_NAMESPACE_STD
  61. # endif
  62. #endif
  63. #ifndef __mbstate_t_defined
  64. # define __mbstate_t_defined 1
  65. /* Conversion state information. */
  66. #define __need_wchar_t
  67. #include <stddef.h>
  68. typedef struct
  69. {
  70. wchar_t __mask;
  71. wchar_t __wc;
  72. } __mbstate_t;
  73. #endif
  74. #undef __need_mbstate_t
  75. /* The rest of the file is only used if used if __need_mbstate_t is not
  76. defined. */
  77. #ifdef _WCHAR_H
  78. __BEGIN_NAMESPACE_C99
  79. /* Public type. */
  80. typedef __mbstate_t mbstate_t;
  81. __END_NAMESPACE_C99
  82. #ifdef __USE_GNU
  83. __USING_NAMESPACE_C99(mbstate_t)
  84. #endif
  85. #ifndef WCHAR_MIN
  86. /* These constants might also be defined in <inttypes.h>. */
  87. # define WCHAR_MIN __WCHAR_MIN
  88. # define WCHAR_MAX __WCHAR_MAX
  89. #endif
  90. #ifndef WEOF
  91. # define WEOF (0xffffffffu)
  92. #endif
  93. /* For XPG4 compliance we have to define the stuff from <wctype.h> here
  94. as well. */
  95. #if defined __USE_XOPEN && !defined __USE_UNIX98
  96. # include <wctype.h>
  97. #endif
  98. __BEGIN_DECLS
  99. __BEGIN_NAMESPACE_STD
  100. /* This incomplete type is defined in <time.h> but needed here because
  101. of `wcsftime'. */
  102. struct tm;
  103. __END_NAMESPACE_STD
  104. /* XXX We have to clean this up at some point. Since tm is in the std
  105. namespace but wcsftime is in __c99 the type wouldn't be found
  106. without inserting it in the global namespace. */
  107. __USING_NAMESPACE_STD(tm)
  108. __BEGIN_NAMESPACE_C99
  109. /* Copy SRC to DEST. */
  110. extern wchar_t *wcscpy (wchar_t *__restrict __dest,
  111. const wchar_t *__restrict __src) __THROW;
  112. /* Copy no more than N wide-characters of SRC to DEST. */
  113. extern wchar_t *wcsncpy (wchar_t *__restrict __dest,
  114. const wchar_t *__restrict __src, size_t __n)
  115. __THROW;
  116. /* Append SRC onto DEST. */
  117. extern wchar_t *wcscat (wchar_t *__restrict __dest,
  118. const wchar_t *__restrict __src) __THROW;
  119. libc_hidden_proto(wcscat)
  120. /* Append no more than N wide-characters of SRC onto DEST. */
  121. extern wchar_t *wcsncat (wchar_t *__restrict __dest,
  122. const wchar_t *__restrict __src, size_t __n)
  123. __THROW;
  124. /* Compare S1 and S2. */
  125. extern int wcscmp (const wchar_t *__s1, const wchar_t *__s2)
  126. __THROW __attribute_pure__;
  127. libc_hidden_proto(wcscmp)
  128. /* Compare N wide-characters of S1 and S2. */
  129. extern int wcsncmp (const wchar_t *__s1, const wchar_t *__s2, size_t __n)
  130. __THROW __attribute_pure__;
  131. __END_NAMESPACE_C99
  132. #ifdef __USE_GNU
  133. /* Compare S1 and S2, ignoring case. */
  134. extern int wcscasecmp (const wchar_t *__s1, const wchar_t *__s2) __THROW;
  135. /* Compare no more than N chars of S1 and S2, ignoring case. */
  136. extern int wcsncasecmp (const wchar_t *__s1, const wchar_t *__s2,
  137. size_t __n) __THROW;
  138. #ifdef __UCLIBC_HAS_XLOCALE__
  139. /* Similar to the two functions above but take the information from
  140. the provided locale and not the global locale. */
  141. # include <xlocale.h>
  142. extern int wcscasecmp_l (const wchar_t *__s1, const wchar_t *__s2,
  143. __locale_t __loc) __THROW;
  144. libc_hidden_proto(wcscasecmp_l)
  145. extern int wcsncasecmp_l (const wchar_t *__s1, const wchar_t *__s2,
  146. size_t __n, __locale_t __loc) __THROW;
  147. libc_hidden_proto(wcsncasecmp_l)
  148. #endif /* __UCLIBC_HAS_XLOCALE__ */
  149. #endif
  150. __BEGIN_NAMESPACE_C99
  151. /* Compare S1 and S2, both interpreted as appropriate to the
  152. LC_COLLATE category of the current locale. */
  153. extern int wcscoll (const wchar_t *__s1, const wchar_t *__s2) __THROW;
  154. libc_hidden_proto(wcscoll)
  155. /* Transform S2 into array pointed to by S1 such that if wcscmp is
  156. applied to two transformed strings the result is the as applying
  157. `wcscoll' to the original strings. */
  158. extern size_t wcsxfrm (wchar_t *__restrict __s1,
  159. const wchar_t *__restrict __s2, size_t __n) __THROW;
  160. __END_NAMESPACE_C99
  161. #ifdef __USE_GNU
  162. #ifdef __UCLIBC_HAS_XLOCALE__
  163. /* Similar to the two functions above but take the information from
  164. the provided locale and not the global locale. */
  165. /* Compare S1 and S2, both interpreted as appropriate to the
  166. LC_COLLATE category of the given locale. */
  167. extern int wcscoll_l (const wchar_t *__s1, const wchar_t *__s2,
  168. __locale_t __loc) __THROW;
  169. libc_hidden_proto(wcscoll_l)
  170. /* Transform S2 into array pointed to by S1 such that if wcscmp is
  171. applied to two transformed strings the result is the as applying
  172. `wcscoll' to the original strings. */
  173. extern size_t wcsxfrm_l (wchar_t *__s1, const wchar_t *__s2,
  174. size_t __n, __locale_t __loc) __THROW;
  175. libc_hidden_proto(wcsxfrm_l)
  176. #endif /* __UCLIBC_HAS_XLOCALE__ */
  177. /* Duplicate S, returning an identical malloc'd string. */
  178. extern wchar_t *wcsdup (const wchar_t *__s) __THROW __attribute_malloc__;
  179. #endif
  180. __BEGIN_NAMESPACE_C99
  181. /* Find the first occurrence of WC in WCS. */
  182. extern wchar_t *wcschr (const wchar_t *__wcs, wchar_t __wc)
  183. __THROW __attribute_pure__;
  184. /* Find the last occurrence of WC in WCS. */
  185. extern wchar_t *wcsrchr (const wchar_t *__wcs, wchar_t __wc)
  186. __THROW __attribute_pure__;
  187. __END_NAMESPACE_C99
  188. #ifdef __USE_GNU
  189. /* This function is similar to `wcschr'. But it returns a pointer to
  190. the closing NUL wide character in case C is not found in S. */
  191. extern wchar_t *wcschrnul (const wchar_t *__s, wchar_t __wc)
  192. __THROW __attribute_pure__;
  193. #endif
  194. __BEGIN_NAMESPACE_C99
  195. /* Return the length of the initial segmet of WCS which
  196. consists entirely of wide characters not in REJECT. */
  197. extern size_t wcscspn (const wchar_t *__wcs, const wchar_t *__reject)
  198. __THROW __attribute_pure__;
  199. /* Return the length of the initial segmet of WCS which
  200. consists entirely of wide characters in ACCEPT. */
  201. extern size_t wcsspn (const wchar_t *__wcs, const wchar_t *__accept)
  202. __THROW __attribute_pure__;
  203. libc_hidden_proto(wcsspn)
  204. /* Find the first occurrence in WCS of any character in ACCEPT. */
  205. extern wchar_t *wcspbrk (const wchar_t *__wcs, const wchar_t *__accept)
  206. __THROW __attribute_pure__;
  207. libc_hidden_proto(wcspbrk)
  208. /* Find the first occurrence of NEEDLE in HAYSTACK. */
  209. /* SuSv uses restrict keyword, glibc does not */
  210. extern wchar_t *wcsstr (const wchar_t *__restrict __haystack, const wchar_t *__restrict __needle)
  211. __THROW __attribute_pure__;
  212. /* Divide WCS into tokens separated by characters in DELIM. */
  213. extern wchar_t *wcstok (wchar_t *__restrict __s,
  214. const wchar_t *__restrict __delim,
  215. wchar_t **__restrict __ptr) __THROW;
  216. /* Return the number of wide characters in S. */
  217. extern size_t wcslen (const wchar_t *__s) __THROW __attribute_pure__;
  218. libc_hidden_proto(wcslen)
  219. __END_NAMESPACE_C99
  220. #if defined __USE_XOPEN && defined __UCLIBC_SUSV3_LEGACY__
  221. /* Another name for `wcsstr' from XPG4. */
  222. /* SuSv3 did not use restrict keyword, probably because it was marked LEGACY
  223. we do to be in sync with wcsstr */
  224. extern wchar_t *wcswcs (const wchar_t *__restrict __haystack, const wchar_t *__restrict __needle)
  225. __THROW __attribute_pure__;
  226. #endif
  227. #ifdef __USE_GNU
  228. /* Return the number of wide characters in S, but at most MAXLEN. */
  229. extern size_t wcsnlen (const wchar_t *__s, size_t __maxlen)
  230. __THROW __attribute_pure__;
  231. libc_hidden_proto(wcsnlen)
  232. #endif
  233. __BEGIN_NAMESPACE_C99
  234. /* Search N wide characters of S for C. */
  235. extern wchar_t *wmemchr (const wchar_t *__s, wchar_t __c, size_t __n)
  236. __THROW __attribute_pure__;
  237. libc_hidden_proto(wmemchr)
  238. /* Compare N wide characters of S1 and S2. */
  239. /* SuSv4 does not use restrict keyword for S1 and S2, glibc does */
  240. extern int wmemcmp (const wchar_t *__s1,
  241. const wchar_t *__s2, size_t __n)
  242. __THROW __attribute_pure__;
  243. /* Copy N wide characters of SRC to DEST. */
  244. extern wchar_t *wmemcpy (wchar_t *__restrict __s1,
  245. const wchar_t *__restrict __s2, size_t __n) __THROW;
  246. libc_hidden_proto(wmemcpy)
  247. /* Copy N wide characters of SRC to DEST, guaranteeing
  248. correct behavior for overlapping strings. */
  249. extern wchar_t *wmemmove (wchar_t *__s1, const wchar_t *__s2, size_t __n)
  250. __THROW;
  251. /* Set N wide characters of S to C. */
  252. extern wchar_t *wmemset (wchar_t *__s, wchar_t __c, size_t __n) __THROW;
  253. __END_NAMESPACE_C99
  254. #ifdef __USE_GNU
  255. /* Copy N wide characters of SRC to DEST and return pointer to following
  256. wide character. */
  257. extern wchar_t *wmempcpy (wchar_t *__restrict __s1,
  258. const wchar_t *__restrict __s2, size_t __n)
  259. __THROW;
  260. libc_hidden_proto(wmempcpy)
  261. #endif
  262. __BEGIN_NAMESPACE_C99
  263. /* Determine whether C constitutes a valid (one-byte) multibyte
  264. character. */
  265. extern wint_t btowc (int __c) __THROW;
  266. libc_hidden_proto(btowc)
  267. /* Determine whether C corresponds to a member of the extended
  268. character set whose multibyte representation is a single byte. */
  269. extern int wctob (wint_t __c) __THROW;
  270. /* Determine whether PS points to an object representing the initial
  271. state. */
  272. extern int mbsinit (const mbstate_t *__ps) __THROW __attribute_pure__;
  273. libc_hidden_proto(mbsinit)
  274. /* Write wide character representation of multibyte character pointed
  275. to by S to PWC. */
  276. extern size_t mbrtowc (wchar_t *__restrict __pwc,
  277. const char *__restrict __s, size_t __n,
  278. mbstate_t *__p) __THROW;
  279. libc_hidden_proto(mbrtowc)
  280. /* Write multibyte representation of wide character WC to S. */
  281. extern size_t wcrtomb (char *__restrict __s, wchar_t __wc,
  282. mbstate_t *__restrict __ps) __THROW;
  283. libc_hidden_proto(wcrtomb)
  284. /* Return number of bytes in multibyte character pointed to by S. */
  285. #if 0 /* uClibc: disabled */
  286. extern size_t __mbrlen (const char *__restrict __s, size_t __n,
  287. mbstate_t *__restrict __ps) __THROW;
  288. #endif
  289. extern size_t mbrlen (const char *__restrict __s, size_t __n,
  290. mbstate_t *__restrict __ps) __THROW;
  291. libc_hidden_proto(mbrlen)
  292. /* Write wide character representation of multibyte character string
  293. SRC to DST. */
  294. extern size_t mbsrtowcs (wchar_t *__restrict __dst,
  295. const char **__restrict __src, size_t __len,
  296. mbstate_t *__restrict __ps) __THROW;
  297. libc_hidden_proto(mbsrtowcs)
  298. /* Write multibyte character representation of wide character string
  299. SRC to DST. */
  300. extern size_t wcsrtombs (char *__restrict __dst,
  301. const wchar_t **__restrict __src, size_t __len,
  302. mbstate_t *__restrict __ps) __THROW;
  303. libc_hidden_proto(wcsrtombs)
  304. __END_NAMESPACE_C99
  305. #ifdef __USE_GNU
  306. /* Write wide character representation of at most NMC bytes of the
  307. multibyte character string SRC to DST. */
  308. extern size_t mbsnrtowcs (wchar_t *__restrict __dst,
  309. const char **__restrict __src, size_t __nmc,
  310. size_t __len, mbstate_t *__restrict __ps) __THROW;
  311. libc_hidden_proto(mbsnrtowcs)
  312. /* Write multibyte character representation of at most NWC characters
  313. from the wide character string SRC to DST. */
  314. extern size_t wcsnrtombs (char *__restrict __dst,
  315. const wchar_t **__restrict __src,
  316. size_t __nwc, size_t __len,
  317. mbstate_t *__restrict __ps) __THROW;
  318. libc_hidden_proto(wcsnrtombs)
  319. #endif /* use GNU */
  320. /* The following functions are extensions found in X/Open CAE. */
  321. #ifdef __USE_XOPEN
  322. /* Determine number of column positions required for C. */
  323. extern int wcwidth (wchar_t __c) __THROW;
  324. /* Determine number of column positions required for first N wide
  325. characters (or fewer if S ends before this) in S. */
  326. extern int wcswidth (const wchar_t *__s, size_t __n) __THROW;
  327. libc_hidden_proto(wcswidth)
  328. #endif /* Use X/Open. */
  329. __BEGIN_NAMESPACE_C99
  330. #ifdef __UCLIBC_HAS_FLOATS__
  331. /* Convert initial portion of the wide string NPTR to `double'
  332. representation. */
  333. extern double wcstod (const wchar_t *__restrict __nptr,
  334. wchar_t **__restrict __endptr) __THROW;
  335. #ifdef __USE_ISOC99
  336. /* Likewise for `float' and `long double' sizes of floating-point numbers. */
  337. extern float wcstof (const wchar_t *__restrict __nptr,
  338. wchar_t **__restrict __endptr) __THROW;
  339. extern long double wcstold (const wchar_t *__restrict __nptr,
  340. wchar_t **__restrict __endptr) __THROW;
  341. #endif /* C99 */
  342. #endif /* __UCLIBC_HAS_FLOATS__ */
  343. /* Convert initial portion of wide string NPTR to `long int'
  344. representation. */
  345. extern long int wcstol (const wchar_t *__restrict __nptr,
  346. wchar_t **__restrict __endptr, int __base) __THROW;
  347. /* Convert initial portion of wide string NPTR to `unsigned long int'
  348. representation. */
  349. extern unsigned long int wcstoul (const wchar_t *__restrict __nptr,
  350. wchar_t **__restrict __endptr, int __base)
  351. __THROW;
  352. #if defined __USE_ISOC99 || (defined __GNUC__ && defined __USE_GNU)
  353. /* Convert initial portion of wide string NPTR to `long long int'
  354. representation. */
  355. __extension__
  356. extern long long int wcstoll (const wchar_t *__restrict __nptr,
  357. wchar_t **__restrict __endptr, int __base)
  358. __THROW;
  359. /* Convert initial portion of wide string NPTR to `unsigned long long int'
  360. representation. */
  361. __extension__
  362. extern unsigned long long int wcstoull (const wchar_t *__restrict __nptr,
  363. wchar_t **__restrict __endptr,
  364. int __base) __THROW;
  365. #endif /* ISO C99 or GCC and GNU. */
  366. __END_NAMESPACE_C99
  367. #if defined __GNUC__ && defined __USE_GNU
  368. /* Convert initial portion of wide string NPTR to `long long int'
  369. representation. */
  370. __extension__
  371. extern long long int wcstoq (const wchar_t *__restrict __nptr,
  372. wchar_t **__restrict __endptr, int __base)
  373. __THROW;
  374. /* Convert initial portion of wide string NPTR to `unsigned long long int'
  375. representation. */
  376. __extension__
  377. extern unsigned long long int wcstouq (const wchar_t *__restrict __nptr,
  378. wchar_t **__restrict __endptr,
  379. int __base) __THROW;
  380. #endif /* GCC and use GNU. */
  381. #ifdef __USE_GNU
  382. #ifdef __UCLIBC_HAS_XLOCALE__
  383. /* The concept of one static locale per category is not very well
  384. thought out. Many applications will need to process its data using
  385. information from several different locales. Another application is
  386. the implementation of the internationalization handling in the
  387. upcoming ISO C++ standard library. To support this another set of
  388. the functions using locale data exist which have an additional
  389. argument.
  390. Attention: all these functions are *not* standardized in any form.
  391. This is a proof-of-concept implementation. */
  392. /* Structure for reentrant locale using functions. This is an
  393. (almost) opaque type for the user level programs. */
  394. # include <xlocale.h>
  395. /* Special versions of the functions above which take the locale to
  396. use as an additional parameter. */
  397. extern long int wcstol_l (const wchar_t *__restrict __nptr,
  398. wchar_t **__restrict __endptr, int __base,
  399. __locale_t __loc) __THROW;
  400. extern unsigned long int wcstoul_l (const wchar_t *__restrict __nptr,
  401. wchar_t **__restrict __endptr,
  402. int __base, __locale_t __loc) __THROW;
  403. __extension__
  404. extern long long int wcstoll_l (const wchar_t *__restrict __nptr,
  405. wchar_t **__restrict __endptr,
  406. int __base, __locale_t __loc) __THROW;
  407. __extension__
  408. extern unsigned long long int wcstoull_l (const wchar_t *__restrict __nptr,
  409. wchar_t **__restrict __endptr,
  410. int __base, __locale_t __loc)
  411. __THROW;
  412. #ifdef __UCLIBC_HAS_FLOATS__
  413. extern double wcstod_l (const wchar_t *__restrict __nptr,
  414. wchar_t **__restrict __endptr, __locale_t __loc)
  415. __THROW;
  416. extern float wcstof_l (const wchar_t *__restrict __nptr,
  417. wchar_t **__restrict __endptr, __locale_t __loc)
  418. __THROW;
  419. extern long double wcstold_l (const wchar_t *__restrict __nptr,
  420. wchar_t **__restrict __endptr,
  421. __locale_t __loc) __THROW;
  422. #endif /* __UCLIBC_HAS_FLOATS__ */
  423. #endif /* __UCLIBC_HAS_XLOCALE__ */
  424. #endif /* GNU */
  425. #ifdef __USE_GNU
  426. /* Copy SRC to DEST, returning the address of the terminating L'\0' in
  427. DEST. */
  428. extern wchar_t *wcpcpy (wchar_t *__dest, const wchar_t *__src) __THROW;
  429. /* Copy no more than N characters of SRC to DEST, returning the address of
  430. the last character written into DEST. */
  431. extern wchar_t *wcpncpy (wchar_t *__dest, const wchar_t *__src, size_t __n)
  432. __THROW;
  433. #endif /* use GNU */
  434. /* Wide character I/O functions. */
  435. #if defined __USE_ISOC99 || defined __USE_UNIX98
  436. __BEGIN_NAMESPACE_C99
  437. /* Select orientation for stream. */
  438. extern int fwide (__FILE *__fp, int __mode) __THROW;
  439. /* Write formatted output to STREAM.
  440. This function is a possible cancellation point and therefore not
  441. marked with __THROW. */
  442. extern int fwprintf (__FILE *__restrict __stream,
  443. const wchar_t *__restrict __format, ...)
  444. /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */;
  445. /* Write formatted output to stdout.
  446. This function is a possible cancellation point and therefore not
  447. marked with __THROW. */
  448. extern int wprintf (const wchar_t *__restrict __format, ...)
  449. /* __attribute__ ((__format__ (__wprintf__, 1, 2))) */;
  450. /* Write formatted output of at most N characters to S. */
  451. extern int swprintf (wchar_t *__restrict __s, size_t __n,
  452. const wchar_t *__restrict __format, ...)
  453. __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
  454. /* Write formatted output to S from argument list ARG.
  455. This function is a possible cancellation point and therefore not
  456. marked with __THROW. */
  457. extern int vfwprintf (__FILE *__restrict __s,
  458. const wchar_t *__restrict __format,
  459. __gnuc_va_list __arg)
  460. /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */;
  461. libc_hidden_proto(vfwprintf)
  462. /* Write formatted output to stdout from argument list ARG.
  463. This function is a possible cancellation point and therefore not
  464. marked with __THROW. */
  465. extern int vwprintf (const wchar_t *__restrict __format,
  466. __gnuc_va_list __arg)
  467. /* __attribute__ ((__format__ (__wprintf__, 1, 0))) */;
  468. /* Write formatted output of at most N character to S from argument
  469. list ARG. */
  470. extern int vswprintf (wchar_t *__restrict __s, size_t __n,
  471. const wchar_t *__restrict __format,
  472. __gnuc_va_list __arg)
  473. __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
  474. libc_hidden_proto(vswprintf)
  475. /* Read formatted input from STREAM.
  476. This function is a possible cancellation point and therefore not
  477. marked with __THROW. */
  478. extern int fwscanf (__FILE *__restrict __stream,
  479. const wchar_t *__restrict __format, ...)
  480. /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
  481. /* Read formatted input from stdin.
  482. This function is a possible cancellation point and therefore not
  483. marked with __THROW. */
  484. extern int wscanf (const wchar_t *__restrict __format, ...)
  485. /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
  486. /* Read formatted input from S. */
  487. extern int swscanf (const wchar_t *__restrict __s,
  488. const wchar_t *__restrict __format, ...)
  489. __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
  490. __END_NAMESPACE_C99
  491. #endif /* Use ISO C99 and Unix98. */
  492. #ifdef __USE_ISOC99
  493. __BEGIN_NAMESPACE_C99
  494. /* Read formatted input from S into argument list ARG.
  495. This function is a possible cancellation point and therefore not
  496. marked with __THROW. */
  497. extern int vfwscanf (__FILE *__restrict __s,
  498. const wchar_t *__restrict __format,
  499. __gnuc_va_list __arg)
  500. /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
  501. libc_hidden_proto(vfwscanf)
  502. /* Read formatted input from stdin into argument list ARG.
  503. This function is a possible cancellation point and therefore not
  504. marked with __THROW. */
  505. extern int vwscanf (const wchar_t *__restrict __format,
  506. __gnuc_va_list __arg)
  507. /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
  508. /* Read formatted input from S into argument list ARG. */
  509. extern int vswscanf (const wchar_t *__restrict __s,
  510. const wchar_t *__restrict __format,
  511. __gnuc_va_list __arg)
  512. __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
  513. libc_hidden_proto(vswscanf)
  514. __END_NAMESPACE_C99
  515. #endif /* Use ISO C99. */
  516. __BEGIN_NAMESPACE_C99
  517. /* Read a character from STREAM.
  518. These functions are possible cancellation points and therefore not
  519. marked with __THROW. */
  520. extern wint_t fgetwc (__FILE *__stream);
  521. libc_hidden_proto(fgetwc)
  522. extern wint_t getwc (__FILE *__stream);
  523. /* Read a character from stdin.
  524. This function is a possible cancellation point and therefore not
  525. marked with __THROW. */
  526. extern wint_t getwchar (void);
  527. /* Write a character to STREAM.
  528. These functions are possible cancellation points and therefore not
  529. marked with __THROW. */
  530. extern wint_t fputwc (wchar_t __wc, __FILE *__stream);
  531. libc_hidden_proto(fputwc)
  532. extern wint_t putwc (wchar_t __wc, __FILE *__stream);
  533. /* Write a character to stdout.
  534. This function is a possible cancellation point and therefore not
  535. marked with __THROW. */
  536. extern wint_t putwchar (wchar_t __wc);
  537. /* Get a newline-terminated wide character string of finite length
  538. from STREAM.
  539. This function is a possible cancellation point and therefore not
  540. marked with __THROW. */
  541. extern wchar_t *fgetws (wchar_t *__restrict __ws, int __n,
  542. __FILE *__restrict __stream);
  543. /* Write a string to STREAM.
  544. This function is a possible cancellation point and therefore not
  545. marked with __THROW. */
  546. extern int fputws (const wchar_t *__restrict __ws,
  547. __FILE *__restrict __stream);
  548. libc_hidden_proto(fputws)
  549. /* Push a character back onto the input buffer of STREAM.
  550. This function is a possible cancellation point and therefore not
  551. marked with __THROW. */
  552. extern wint_t ungetwc (wint_t __wc, __FILE *__stream);
  553. libc_hidden_proto(ungetwc)
  554. __END_NAMESPACE_C99
  555. #ifdef __USE_GNU
  556. /* These are defined to be equivalent to the `char' functions defined
  557. in POSIX.1:1996.
  558. These functions are not part of POSIX and therefore no official
  559. cancellation point. But due to similarity with an POSIX interface
  560. or due to the implementation they are cancellation points and
  561. therefore not marked with __THROW. */
  562. extern wint_t getwc_unlocked (__FILE *__stream);
  563. extern wint_t getwchar_unlocked (void);
  564. /* This is the wide character version of a GNU extension.
  565. This function is not part of POSIX and therefore no official
  566. cancellation point. But due to similarity with an POSIX interface
  567. or due to the implementation it is a cancellation point and
  568. therefore not marked with __THROW. */
  569. extern wint_t fgetwc_unlocked (__FILE *__stream);
  570. libc_hidden_proto(fgetwc_unlocked)
  571. /* Faster version when locking is not necessary.
  572. This function is not part of POSIX and therefore no official
  573. cancellation point. But due to similarity with an POSIX interface
  574. or due to the implementation it is a cancellation point and
  575. therefore not marked with __THROW. */
  576. extern wint_t fputwc_unlocked (wchar_t __wc, __FILE *__stream);
  577. libc_hidden_proto(fputwc_unlocked)
  578. /* These are defined to be equivalent to the `char' functions defined
  579. in POSIX.1:1996.
  580. These functions are not part of POSIX and therefore no official
  581. cancellation point. But due to similarity with an POSIX interface
  582. or due to the implementation they are cancellation points and
  583. therefore not marked with __THROW. */
  584. extern wint_t putwc_unlocked (wchar_t __wc, __FILE *__stream);
  585. extern wint_t putwchar_unlocked (wchar_t __wc);
  586. /* This function does the same as `fgetws' but does not lock the stream.
  587. This function is not part of POSIX and therefore no official
  588. cancellation point. But due to similarity with an POSIX interface
  589. or due to the implementation it is a cancellation point and
  590. therefore not marked with __THROW. */
  591. extern wchar_t *fgetws_unlocked (wchar_t *__restrict __ws, int __n,
  592. __FILE *__restrict __stream);
  593. libc_hidden_proto(fgetws_unlocked)
  594. /* This function does the same as `fputws' but does not lock the stream.
  595. This function is not part of POSIX and therefore no official
  596. cancellation point. But due to similarity with an POSIX interface
  597. or due to the implementation it is a cancellation point and
  598. therefore not marked with __THROW. */
  599. extern int fputws_unlocked (const wchar_t *__restrict __ws,
  600. __FILE *__restrict __stream);
  601. libc_hidden_proto(fputws_unlocked)
  602. #endif
  603. __BEGIN_NAMESPACE_C99
  604. /* Format TP into S according to FORMAT.
  605. Write no more than MAXSIZE wide characters and return the number
  606. of wide characters written, or 0 if it would exceed MAXSIZE. */
  607. extern size_t wcsftime (wchar_t *__restrict __s, size_t __maxsize,
  608. const wchar_t *__restrict __format,
  609. const struct tm *__restrict __tp) __THROW;
  610. __END_NAMESPACE_C99
  611. # if defined __USE_GNU && defined __UCLIBC_HAS_XLOCALE__
  612. # include <xlocale.h>
  613. /* Similar to `wcsftime' but takes the information from
  614. the provided locale and not the global locale. */
  615. extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize,
  616. const wchar_t *__restrict __format,
  617. const struct tm *__restrict __tp,
  618. __locale_t __loc) __THROW;
  619. libc_hidden_proto(wcsftime_l)
  620. # endif
  621. /* The X/Open standard demands that most of the functions defined in
  622. the <wctype.h> header must also appear here. This is probably
  623. because some X/Open members wrote their implementation before the
  624. ISO C standard was published and introduced the better solution.
  625. We have to provide these definitions for compliance reasons but we
  626. do this nonsense only if really necessary. */
  627. #if defined __USE_UNIX98 && !defined __USE_GNU
  628. # define __need_iswxxx
  629. # include <wctype.h>
  630. #endif
  631. #ifdef _LIBC
  632. extern size_t __wcslcpy(wchar_t *__restrict dst,
  633. const wchar_t *__restrict src, size_t n) attribute_hidden;
  634. #endif
  635. __END_DECLS
  636. #endif /* _WCHAR_H defined */
  637. #endif /* wchar.h */