wchar.h 27 KB

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