wchar.h 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704
  1. /* Copyright (C) 1995-1999, 2000, 2001 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. #endif
  55. #ifndef __mbstate_t_defined
  56. # define __mbstate_t_defined 1
  57. /* Conversion state information. */
  58. #if 1
  59. typedef struct
  60. {
  61. wchar_t mask;
  62. wchar_t wc;
  63. } __mbstate_t;
  64. #else
  65. typedef struct
  66. {
  67. int __count;
  68. union
  69. {
  70. wint_t __wch;
  71. char __wchb[4];
  72. } __value; /* Value so far. */
  73. } __mbstate_t;
  74. #endif
  75. #endif
  76. #undef __need_mbstate_t
  77. /* The rest of the file is only used if used if __need_mbstate_t is not
  78. defined. */
  79. #ifdef _WCHAR_H
  80. /* Public type. */
  81. typedef __mbstate_t mbstate_t;
  82. #ifndef WCHAR_MIN
  83. /* These constants might also be defined in <inttypes.h>. */
  84. # define WCHAR_MIN __WCHAR_MIN
  85. # define WCHAR_MAX __WCHAR_MAX
  86. #endif
  87. #ifndef WEOF
  88. # define WEOF (0xffffffffu)
  89. #endif
  90. /* For XPG4 compliance we have to define the stuff from <wctype.h> here
  91. as well. */
  92. #if defined __USE_XOPEN && !defined __USE_UNIX98
  93. # include <wctype.h>
  94. #endif
  95. /* This incomplete type is defined in <time.h> but needed here because
  96. of `wcsftime'. */
  97. struct tm;
  98. __BEGIN_DECLS
  99. /* Copy SRC to DEST. */
  100. extern wchar_t *wcscpy (wchar_t *__restrict __dest,
  101. __const wchar_t *__restrict __src) __THROW;
  102. /* Copy no more than N wide-characters of SRC to DEST. */
  103. extern wchar_t *wcsncpy (wchar_t *__restrict __dest,
  104. __const wchar_t *__restrict __src, size_t __n)
  105. __THROW;
  106. /* Append SRC onto DEST. */
  107. extern wchar_t *wcscat (wchar_t *__restrict __dest,
  108. __const wchar_t *__restrict __src) __THROW;
  109. /* Append no more than N wide-characters of SRC onto DEST. */
  110. extern wchar_t *wcsncat (wchar_t *__restrict __dest,
  111. __const wchar_t *__restrict __src, size_t __n)
  112. __THROW;
  113. /* Compare S1 and S2. */
  114. extern int wcscmp (__const wchar_t *__s1, __const wchar_t *__s2)
  115. __THROW __attribute_pure__;
  116. /* Compare N wide-characters of S1 and S2. */
  117. extern int wcsncmp (__const wchar_t *__s1, __const wchar_t *__s2, size_t __n)
  118. __THROW __attribute_pure__;
  119. #ifdef __USE_GNU
  120. /* Compare S1 and S2, ignoring case. */
  121. extern int wcscasecmp (__const wchar_t *__s1, __const wchar_t *__s2) __THROW;
  122. /* Compare no more than N chars of S1 and S2, ignoring case. */
  123. extern int wcsncasecmp (__const wchar_t *__s1, __const wchar_t *__s2,
  124. size_t __n) __THROW;
  125. /* Similar to the two functions above but take the information from
  126. the provided locale and not the global locale. */
  127. #if 0
  128. # include <xlocale.h>
  129. extern int __wcscasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2,
  130. __locale_t __loc) __THROW;
  131. extern int __wcsncasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2,
  132. size_t __n, __locale_t __loc) __THROW;
  133. #endif
  134. #endif
  135. /* Compare S1 and S2, both interpreted as appropriate to the
  136. LC_COLLATE category of the current locale. */
  137. extern int wcscoll (__const wchar_t *__s1, __const wchar_t *__s2) __THROW;
  138. /* Transform S2 into array pointed to by S1 such that if wcscmp is
  139. applied to two transformed strings the result is the as applying
  140. `wcscoll' to the original strings. */
  141. extern size_t wcsxfrm (wchar_t *__restrict __s1,
  142. __const wchar_t *__restrict __s2, size_t __n) __THROW;
  143. #ifdef __USE_GNU
  144. #if 0
  145. /* Similar to the two functions above but take the information from
  146. the provided locale and not the global locale. */
  147. /* Compare S1 and S2, both interpreted as appropriate to the
  148. LC_COLLATE category of the given locale. */
  149. extern int __wcscoll_l (__const wchar_t *__s1, __const wchar_t *__s2,
  150. __locale_t __loc) __THROW;
  151. /* Transform S2 into array pointed to by S1 such that if wcscmp is
  152. applied to two transformed strings the result is the as applying
  153. `wcscoll' to the original strings. */
  154. extern size_t __wcsxfrm_l (wchar_t *__s1, __const wchar_t *__s2,
  155. size_t __n, __locale_t __loc) __THROW;
  156. #endif
  157. /* Duplicate S, returning an identical malloc'd string. */
  158. extern wchar_t *wcsdup (__const wchar_t *__s) __THROW __attribute_malloc__;
  159. #endif
  160. /* Find the first occurrence of WC in WCS. */
  161. extern wchar_t *wcschr (__const wchar_t *__wcs, wchar_t __wc)
  162. __THROW __attribute_pure__;
  163. /* Find the last occurrence of WC in WCS. */
  164. extern wchar_t *wcsrchr (__const wchar_t *__wcs, wchar_t __wc)
  165. __THROW __attribute_pure__;
  166. #ifdef __USE_GNU
  167. /* This function is similar to `wcschr'. But it returns a pointer to
  168. the closing NUL wide character in case C is not found in S. */
  169. extern wchar_t *wcschrnul (__const wchar_t *__s, wchar_t __wc)
  170. __THROW __attribute_pure__;
  171. #endif
  172. /* Return the length of the initial segmet of WCS which
  173. consists entirely of wide characters not in REJECT. */
  174. extern size_t wcscspn (__const wchar_t *__wcs, __const wchar_t *__reject)
  175. __THROW __attribute_pure__;
  176. /* Return the length of the initial segmet of WCS which
  177. consists entirely of wide characters in ACCEPT. */
  178. extern size_t wcsspn (__const wchar_t *__wcs, __const wchar_t *__accept)
  179. __THROW __attribute_pure__;
  180. /* Find the first occurrence in WCS of any character in ACCEPT. */
  181. extern wchar_t *wcspbrk (__const wchar_t *__wcs, __const wchar_t *__accept)
  182. __THROW __attribute_pure__;
  183. /* Find the first occurrence of NEEDLE in HAYSTACK. */
  184. extern wchar_t *wcsstr (__const wchar_t *__haystack, __const wchar_t *__needle)
  185. __THROW __attribute_pure__;
  186. #ifdef __USE_XOPEN
  187. /* Another name for `wcsstr' from XPG4. */
  188. extern wchar_t *wcswcs (__const wchar_t *__haystack, __const wchar_t *__needle)
  189. __THROW __attribute_pure__;
  190. #endif
  191. /* Divide WCS into tokens separated by characters in DELIM. */
  192. extern wchar_t *wcstok (wchar_t *__restrict __s,
  193. __const wchar_t *__restrict __delim,
  194. wchar_t **__restrict __ptr) __THROW;
  195. /* Return the number of wide characters in S. */
  196. extern size_t wcslen (__const wchar_t *__s) __THROW __attribute_pure__;
  197. #ifdef __USE_GNU
  198. /* Return the number of wide characters in S, but at most MAXLEN. */
  199. extern size_t wcsnlen (__const wchar_t *__s, size_t __maxlen)
  200. __THROW __attribute_pure__;
  201. #endif
  202. /* Search N wide characters of S for C. */
  203. extern wchar_t *wmemchr (__const wchar_t *__s, wchar_t __c, size_t __n)
  204. __THROW __attribute_pure__;
  205. /* Compare N wide characters of S1 and S2. */
  206. extern int wmemcmp (__const wchar_t *__restrict __s1,
  207. __const wchar_t *__restrict __s2, size_t __n)
  208. __THROW __attribute_pure__;
  209. /* Copy N wide characters of SRC to DEST. */
  210. extern wchar_t *wmemcpy (wchar_t *__restrict __s1,
  211. __const wchar_t *__restrict __s2, size_t __n) __THROW;
  212. /* Copy N wide characters of SRC to DEST, guaranteeing
  213. correct behavior for overlapping strings. */
  214. extern wchar_t *wmemmove (wchar_t *__s1, __const wchar_t *__s2, size_t __n)
  215. __THROW;
  216. /* Set N wide characters of S to C. */
  217. extern wchar_t *wmemset (wchar_t *__s, wchar_t __c, size_t __n) __THROW;
  218. #ifdef __USE_GNU
  219. /* Copy N wide characters of SRC to DEST and return pointer to following
  220. wide character. */
  221. extern wchar_t *wmempcpy (wchar_t *__restrict __s1,
  222. __const wchar_t *__restrict __s2, size_t __n)
  223. __THROW;
  224. #endif
  225. /* Determine whether C constitutes a valid (one-byte) multibyte
  226. character. */
  227. extern wint_t btowc (int __c) __THROW;
  228. /* Determine whether C corresponds to a member of the extended
  229. character set whose multibyte representation is a single byte. */
  230. extern int wctob (wint_t __c) __THROW;
  231. /* Determine whether PS points to an object representing the initial
  232. state. */
  233. extern int mbsinit (__const mbstate_t *__ps) __THROW __attribute_pure__;
  234. /* Write wide character representation of multibyte character pointed
  235. to by S to PWC. */
  236. extern size_t mbrtowc (wchar_t *__restrict __pwc,
  237. __const char *__restrict __s, size_t __n,
  238. mbstate_t *__p) __THROW;
  239. /* Write multibyte representation of wide character WC to S. */
  240. extern size_t wcrtomb (char *__restrict __s, wchar_t __wc,
  241. mbstate_t *__restrict __ps) __THROW;
  242. /* Return number of bytes in multibyte character pointed to by S. */
  243. extern size_t __mbrlen (__const char *__restrict __s, size_t __n,
  244. mbstate_t *__restrict __ps) __THROW;
  245. extern size_t mbrlen (__const char *__restrict __s, size_t __n,
  246. mbstate_t *__restrict __ps) __THROW;
  247. #if 0
  248. /* #ifdef __USE_EXTERN_INLINES */
  249. /* Define inline function as optimization. */
  250. extern __inline size_t mbrlen (__const char *__restrict __s, size_t __n,
  251. mbstate_t *__restrict __ps) __THROW
  252. { return (__ps != NULL
  253. ? mbrtowc (NULL, __s, __n, __ps) : __mbrlen (__s, __n, NULL)); }
  254. #endif
  255. /* Write wide character representation of multibyte character string
  256. SRC to DST. */
  257. extern size_t mbsrtowcs (wchar_t *__restrict __dst,
  258. __const char **__restrict __src, size_t __len,
  259. mbstate_t *__restrict __ps) __THROW;
  260. /* Write multibyte character representation of wide character string
  261. SRC to DST. */
  262. extern size_t wcsrtombs (char *__restrict __dst,
  263. __const wchar_t **__restrict __src, size_t __len,
  264. mbstate_t *__restrict __ps) __THROW;
  265. #ifdef __USE_GNU
  266. /* Write wide character representation of at most NMC bytes of the
  267. multibyte character string SRC to DST. */
  268. extern size_t mbsnrtowcs (wchar_t *__restrict __dst,
  269. __const char **__restrict __src, size_t __nmc,
  270. size_t __len, mbstate_t *__restrict __ps) __THROW;
  271. /* Write multibyte character representation of at most NWC characters
  272. from the wide character string SRC to DST. */
  273. extern size_t wcsnrtombs (char *__restrict __dst,
  274. __const wchar_t **__restrict __src,
  275. size_t __nwc, size_t __len,
  276. mbstate_t *__restrict __ps) __THROW;
  277. #endif /* use GNU */
  278. /* The following functions are extensions found in X/Open CAE. */
  279. #ifdef __USE_XOPEN
  280. /* Determine number of column positions required for C. */
  281. extern int wcwidth (wchar_t __c) __THROW;
  282. /* Determine number of column positions required for first N wide
  283. characters (or fewer if S ends before this) in S. */
  284. extern int wcswidth (__const wchar_t *__s, size_t __n) __THROW;
  285. #endif /* Use X/Open. */
  286. /* Convert initial portion of the wide string NPTR to `double'
  287. representation. */
  288. extern double wcstod (__const wchar_t *__restrict __nptr,
  289. wchar_t **__restrict __endptr) __THROW;
  290. #ifdef __USE_ISOC99
  291. /* Likewise for `float' and `long double' sizes of floating-point numbers. */
  292. extern float wcstof (__const wchar_t *__restrict __nptr,
  293. wchar_t **__restrict __endptr) __THROW;
  294. extern long double wcstold (__const wchar_t *__restrict __nptr,
  295. wchar_t **__restrict __endptr) __THROW;
  296. #endif /* C99 */
  297. /* Convert initial portion of wide string NPTR to `long int'
  298. representation. */
  299. extern long int wcstol (__const wchar_t *__restrict __nptr,
  300. wchar_t **__restrict __endptr, int __base) __THROW;
  301. /* Convert initial portion of wide string NPTR to `unsigned long int'
  302. representation. */
  303. extern unsigned long int wcstoul (__const wchar_t *__restrict __nptr,
  304. wchar_t **__restrict __endptr, int __base)
  305. __THROW;
  306. #if defined __GNUC__ && defined __USE_GNU
  307. /* Convert initial portion of wide string NPTR to `long int'
  308. representation. */
  309. __extension__
  310. extern long long int wcstoq (__const wchar_t *__restrict __nptr,
  311. wchar_t **__restrict __endptr, int __base)
  312. __THROW;
  313. /* Convert initial portion of wide string NPTR to `unsigned long long int'
  314. representation. */
  315. __extension__
  316. extern unsigned long long int wcstouq (__const wchar_t *__restrict __nptr,
  317. wchar_t **__restrict __endptr,
  318. int __base) __THROW;
  319. #endif /* GCC and use GNU. */
  320. #if defined __USE_ISOC99 || (defined __GNUC__ && defined __USE_GNU)
  321. /* Convert initial portion of wide string NPTR to `long int'
  322. representation. */
  323. __extension__
  324. extern long long int wcstoll (__const wchar_t *__restrict __nptr,
  325. wchar_t **__restrict __endptr, int __base)
  326. __THROW;
  327. /* Convert initial portion of wide string NPTR to `unsigned long long int'
  328. representation. */
  329. __extension__
  330. extern unsigned long long int wcstoull (__const wchar_t *__restrict __nptr,
  331. wchar_t **__restrict __endptr,
  332. int __base) __THROW;
  333. #endif /* ISO C99 or GCC and GNU. */
  334. #if 0
  335. /* #ifdef __USE_GNU */
  336. /* The concept of one static locale per category is not very well
  337. thought out. Many applications will need to process its data using
  338. information from several different locales. Another application is
  339. the implementation of the internationalization handling in the
  340. upcoming ISO C++ standard library. To support this another set of
  341. the functions using locale data exist which have an additional
  342. argument.
  343. Attention: all these functions are *not* standardized in any form.
  344. This is a proof-of-concept implementation. */
  345. /* Structure for reentrant locale using functions. This is an
  346. (almost) opaque type for the user level programs. */
  347. # include <xlocale.h>
  348. /* Special versions of the functions above which take the locale to
  349. use as an additional parameter. */
  350. extern long int __wcstol_l (__const wchar_t *__restrict __nptr,
  351. wchar_t **__restrict __endptr, int __base,
  352. __locale_t __loc) __THROW;
  353. extern unsigned long int __wcstoul_l (__const wchar_t *__restrict __nptr,
  354. wchar_t **__restrict __endptr,
  355. int __base, __locale_t __loc) __THROW;
  356. __extension__
  357. extern long long int __wcstoll_l (__const wchar_t *__restrict __nptr,
  358. wchar_t **__restrict __endptr,
  359. int __base, __locale_t __loc) __THROW;
  360. __extension__
  361. extern unsigned long long int __wcstoull_l (__const wchar_t *__restrict __nptr,
  362. wchar_t **__restrict __endptr,
  363. int __base, __locale_t __loc)
  364. __THROW;
  365. extern double __wcstod_l (__const wchar_t *__restrict __nptr,
  366. wchar_t **__restrict __endptr, __locale_t __loc)
  367. __THROW;
  368. extern float __wcstof_l (__const wchar_t *__restrict __nptr,
  369. wchar_t **__restrict __endptr, __locale_t __loc)
  370. __THROW;
  371. extern long double __wcstold_l (__const wchar_t *__restrict __nptr,
  372. wchar_t **__restrict __endptr,
  373. __locale_t __loc) __THROW;
  374. #endif /* GNU */
  375. #if 0
  376. /* The internal entry points for `wcstoX' take an extra flag argument
  377. saying whether or not to parse locale-dependent number grouping. */
  378. extern double __wcstod_internal (__const wchar_t *__restrict __nptr,
  379. wchar_t **__restrict __endptr, int __group)
  380. __THROW;
  381. extern float __wcstof_internal (__const wchar_t *__restrict __nptr,
  382. wchar_t **__restrict __endptr, int __group)
  383. __THROW;
  384. extern long double __wcstold_internal (__const wchar_t *__restrict __nptr,
  385. wchar_t **__restrict __endptr,
  386. int __group) __THROW;
  387. #ifndef __wcstol_internal_defined
  388. extern long int __wcstol_internal (__const wchar_t *__restrict __nptr,
  389. wchar_t **__restrict __endptr,
  390. int __base, int __group) __THROW;
  391. # define __wcstol_internal_defined 1
  392. #endif
  393. #ifndef __wcstoul_internal_defined
  394. extern unsigned long int __wcstoul_internal (__const wchar_t *__restrict __npt,
  395. wchar_t **__restrict __endptr,
  396. int __base, int __group) __THROW;
  397. # define __wcstoul_internal_defined 1
  398. #endif
  399. #ifndef __wcstoll_internal_defined
  400. __extension__
  401. extern long long int __wcstoll_internal (__const wchar_t *__restrict __nptr,
  402. wchar_t **__restrict __endptr,
  403. int __base, int __group) __THROW;
  404. # define __wcstoll_internal_defined 1
  405. #endif
  406. #ifndef __wcstoull_internal_defined
  407. __extension__
  408. extern unsigned long long int __wcstoull_internal (__const wchar_t *
  409. __restrict __nptr,
  410. wchar_t **
  411. __restrict __endptr,
  412. int __base,
  413. int __group) __THROW;
  414. # define __wcstoull_internal_defined 1
  415. #endif
  416. #if defined __OPTIMIZE__ && __GNUC__ >= 2
  417. /* Define inline functions which call the internal entry points. */
  418. extern __inline double wcstod (__const wchar_t *__restrict __nptr,
  419. wchar_t **__restrict __endptr) __THROW
  420. { return __wcstod_internal (__nptr, __endptr, 0); }
  421. extern __inline long int wcstol (__const wchar_t *__restrict __nptr,
  422. wchar_t **__restrict __endptr,
  423. int __base) __THROW
  424. { return __wcstol_internal (__nptr, __endptr, __base, 0); }
  425. extern __inline unsigned long int wcstoul (__const wchar_t *__restrict __nptr,
  426. wchar_t **__restrict __endptr,
  427. int __base) __THROW
  428. { return __wcstoul_internal (__nptr, __endptr, __base, 0); }
  429. # ifdef __USE_GNU
  430. extern __inline float wcstof (__const wchar_t *__restrict __nptr,
  431. wchar_t **__restrict __endptr) __THROW
  432. { return __wcstof_internal (__nptr, __endptr, 0); }
  433. extern __inline long double wcstold (__const wchar_t *__restrict __nptr,
  434. wchar_t **__restrict __endptr) __THROW
  435. { return __wcstold_internal (__nptr, __endptr, 0); }
  436. __extension__
  437. extern __inline long long int wcstoq (__const wchar_t *__restrict __nptr,
  438. wchar_t **__restrict __endptr,
  439. int __base) __THROW
  440. { return __wcstoll_internal (__nptr, __endptr, __base, 0); }
  441. __extension__
  442. extern __inline unsigned long long int wcstouq (__const wchar_t *
  443. __restrict __nptr,
  444. wchar_t **__restrict __endptr,
  445. int __base) __THROW
  446. { return __wcstoull_internal (__nptr, __endptr, __base, 0); }
  447. # endif /* Use GNU. */
  448. #endif /* Optimizing GCC >=2. */
  449. #endif
  450. #ifdef __USE_GNU
  451. /* Copy SRC to DEST, returning the address of the terminating L'\0' in
  452. DEST. */
  453. extern wchar_t *wcpcpy (wchar_t *__dest, __const wchar_t *__src) __THROW;
  454. /* Copy no more than N characters of SRC to DEST, returning the address of
  455. the last character written into DEST. */
  456. extern wchar_t *wcpncpy (wchar_t *__dest, __const wchar_t *__src, size_t __n)
  457. __THROW;
  458. #endif /* use GNU */
  459. /* Wide character I/O functions. */
  460. #if defined __USE_ISOC99 || defined __USE_UNIX98
  461. /* Select orientation for stream. */
  462. extern int fwide (__FILE *__fp, int __mode) __THROW;
  463. /* Write formatted output to STREAM. */
  464. extern int fwprintf (__FILE *__restrict __stream,
  465. __const wchar_t *__restrict __format, ...)
  466. __THROW /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */;
  467. /* Write formatted output to stdout. */
  468. extern int wprintf (__const wchar_t *__restrict __format, ...)
  469. __THROW /* __attribute__ ((__format__ (__wprintf__, 1, 2))) */;
  470. /* Write formatted output of at most N characters to S. */
  471. extern int swprintf (wchar_t *__restrict __s, size_t __n,
  472. __const wchar_t *__restrict __format, ...)
  473. __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
  474. /* Write formatted output to S from argument list ARG. */
  475. extern int vfwprintf (__FILE *__restrict __s,
  476. __const wchar_t *__restrict __format,
  477. __gnuc_va_list __arg)
  478. __THROW /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */;
  479. /* Write formatted output to stdout from argument list ARG. */
  480. extern int vwprintf (__const wchar_t *__restrict __format,
  481. __gnuc_va_list __arg)
  482. __THROW /* __attribute__ ((__format__ (__wprintf__, 1, 0))) */;
  483. /* Write formatted output of at most N character to S from argument
  484. list ARG. */
  485. extern int vswprintf (wchar_t *__restrict __s, size_t __n,
  486. __const wchar_t *__restrict __format,
  487. __gnuc_va_list __arg)
  488. __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
  489. /* Read formatted input from STREAM. */
  490. extern int fwscanf (__FILE *__restrict __stream,
  491. __const wchar_t *__restrict __format, ...)
  492. __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
  493. /* Read formatted input from stdin. */
  494. extern int wscanf (__const wchar_t *__restrict __format, ...)
  495. __THROW /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
  496. /* Read formatted input from S. */
  497. extern int swscanf (__const wchar_t *__restrict __s,
  498. __const wchar_t *__restrict __format, ...)
  499. __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
  500. #endif /* Use ISO C99 and Unix98. */
  501. #ifdef __USE_ISOC99
  502. /* Read formatted input from S into argument list ARG. */
  503. extern int vfwscanf (__FILE *__restrict __s,
  504. __const wchar_t *__restrict __format,
  505. __gnuc_va_list __arg)
  506. __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
  507. /* Read formatted input from stdin into argument list ARG. */
  508. extern int vwscanf (__const wchar_t *__restrict __format,
  509. __gnuc_va_list __arg)
  510. __THROW /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
  511. /* Read formatted input from S into argument list ARG. */
  512. extern int vswscanf (__const wchar_t *__restrict __s,
  513. __const wchar_t *__restrict __format,
  514. __gnuc_va_list __arg)
  515. __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
  516. #endif /* Use ISO C99. */
  517. /* Read a character from STREAM. */
  518. extern wint_t fgetwc (__FILE *__stream) __THROW;
  519. extern wint_t getwc (__FILE *__stream) __THROW;
  520. /* Read a character from stdin. */
  521. extern wint_t getwchar (void) __THROW;
  522. /* Write a character to STREAM. */
  523. extern wint_t fputwc (wchar_t __wc, __FILE *__stream) __THROW;
  524. extern wint_t putwc (wchar_t __wc, __FILE *__stream) __THROW;
  525. /* Write a character to stdout. */
  526. extern wint_t putwchar (wchar_t __wc) __THROW;
  527. /* Get a newline-terminated wide character string of finite length
  528. from STREAM. */
  529. extern wchar_t *fgetws (wchar_t *__restrict __ws, int __n,
  530. __FILE *__restrict __stream) __THROW;
  531. /* Write a string to STREAM. */
  532. extern int fputws (__const wchar_t *__restrict __ws,
  533. __FILE *__restrict __stream) __THROW;
  534. /* Push a character back onto the input buffer of STREAM. */
  535. extern wint_t ungetwc (wint_t __wc, __FILE *__stream) __THROW;
  536. #ifdef __USE_GNU
  537. /* These are defined to be equivalent to the `char' functions defined
  538. in POSIX.1:1996. */
  539. extern wint_t getwc_unlocked (__FILE *__stream) __THROW;
  540. extern wint_t getwchar_unlocked (void) __THROW;
  541. /* This is the wide character version of a GNU extension. */
  542. extern wint_t fgetwc_unlocked (__FILE *__stream) __THROW;
  543. /* Faster version when locking is not necessary. */
  544. extern wint_t fputwc_unlocked (wchar_t __wc, __FILE *__stream) __THROW;
  545. /* These are defined to be equivalent to the `char' functions defined
  546. in POSIX.1:1996. */
  547. extern wint_t putwc_unlocked (wchar_t __wc, __FILE *__stream) __THROW;
  548. extern wint_t putwchar_unlocked (wchar_t __wc) __THROW;
  549. /* This function does the same as `fgetws' but does not lock the stream. */
  550. extern wchar_t *fgetws_unlocked (wchar_t *__restrict __ws, int __n,
  551. __FILE *__restrict __stream) __THROW;
  552. /* This function does the same as `fputws' but does not lock the stream. */
  553. extern int fputws_unlocked (__const wchar_t *__restrict __ws,
  554. __FILE *__restrict __stream) __THROW;
  555. #endif
  556. /* Format TP into S according to FORMAT.
  557. Write no more than MAXSIZE wide characters and return the number
  558. of wide characters written, or 0 if it would exceed MAXSIZE. */
  559. extern size_t wcsftime (wchar_t *__restrict __s, size_t __maxsize,
  560. __const wchar_t *__restrict __format,
  561. __const struct tm *__restrict __tp) __THROW;
  562. /* The X/Open standard demands that most of the functions defined in
  563. the <wctype.h> header must also appear here. This is probably
  564. because some X/Open members wrote their implementation before the
  565. ISO C standard was published and introduced the better solution.
  566. We have to provide these definitions for compliance reasons but we
  567. do this nonsense only if really necessary. */
  568. #if defined __USE_UNIX98 && !defined __USE_GNU
  569. # define __need_iswxxx
  570. # include <wctype.h>
  571. #endif
  572. __END_DECLS
  573. #endif /* _WCHAR_H defined */
  574. #endif /* wchar.h */