wchar.h 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888
  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. /* XXX We have to clean this up at some point. Since tm is in the std
  115. namespace but wcsftime is in __c99 the type wouldn't be found
  116. without inserting it in the global namespace. */
  117. __USING_NAMESPACE_STD(tm)
  118. __END_NAMESPACE_STD
  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. /* Append no more than N wide-characters of SRC onto DEST. */
  131. extern wchar_t *wcsncat (wchar_t *__restrict __dest,
  132. __const wchar_t *__restrict __src, size_t __n)
  133. __THROW;
  134. /* Compare S1 and S2. */
  135. extern int wcscmp (__const wchar_t *__s1, __const wchar_t *__s2)
  136. __THROW __attribute_pure__;
  137. /* Compare N wide-characters of S1 and S2. */
  138. extern int wcsncmp (__const wchar_t *__s1, __const wchar_t *__s2, size_t __n)
  139. __THROW __attribute_pure__;
  140. __END_NAMESPACE_C99
  141. #ifdef __USE_GNU
  142. /* Compare S1 and S2, ignoring case. */
  143. extern int wcscasecmp (__const wchar_t *__s1, __const wchar_t *__s2) __THROW;
  144. /* Compare no more than N chars of S1 and S2, ignoring case. */
  145. extern int wcsncasecmp (__const wchar_t *__s1, __const wchar_t *__s2,
  146. size_t __n) __THROW;
  147. #ifdef __UCLIBC_HAS_XLOCALE__
  148. /* Similar to the two functions above but take the information from
  149. the provided locale and not the global locale. */
  150. # include <xlocale.h>
  151. extern int wcscasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2,
  152. __locale_t __loc) __THROW;
  153. extern int __wcscasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2,
  154. __locale_t __loc) __THROW;
  155. extern int wcsncasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2,
  156. size_t __n, __locale_t __loc) __THROW;
  157. extern int __wcsncasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2,
  158. size_t __n, __locale_t __loc) __THROW;
  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. /* Transform S2 into array pointed to by S1 such that if wcscmp is
  166. applied to two transformed strings the result is the as applying
  167. `wcscoll' to the original strings. */
  168. extern size_t wcsxfrm (wchar_t *__restrict __s1,
  169. __const wchar_t *__restrict __s2, size_t __n) __THROW;
  170. __END_NAMESPACE_C99
  171. #ifdef __USE_GNU
  172. #ifdef __UCLIBC_HAS_XLOCALE__
  173. /* Similar to the two functions above but take the information from
  174. the provided locale and not the global locale. */
  175. /* Compare S1 and S2, both interpreted as appropriate to the
  176. LC_COLLATE category of the given locale. */
  177. extern int wcscoll_l (__const wchar_t *__s1, __const wchar_t *__s2,
  178. __locale_t __loc) __THROW;
  179. extern int __wcscoll_l (__const wchar_t *__s1, __const wchar_t *__s2,
  180. __locale_t __loc) __THROW;
  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. extern size_t __wcsxfrm_l (wchar_t *__s1, __const wchar_t *__s2,
  187. size_t __n, __locale_t __loc) __THROW;
  188. #endif /* __UCLIBC_HAS_XLOCALE__ */
  189. /* Duplicate S, returning an identical malloc'd string. */
  190. extern wchar_t *wcsdup (__const wchar_t *__s) __THROW __attribute_malloc__;
  191. #endif
  192. __BEGIN_NAMESPACE_C99
  193. /* Find the first occurrence of WC in WCS. */
  194. extern wchar_t *wcschr (__const wchar_t *__wcs, wchar_t __wc)
  195. __THROW __attribute_pure__;
  196. /* Find the last occurrence of WC in WCS. */
  197. extern wchar_t *wcsrchr (__const wchar_t *__wcs, wchar_t __wc)
  198. __THROW __attribute_pure__;
  199. __END_NAMESPACE_C99
  200. #ifdef __USE_GNU
  201. /* This function is similar to `wcschr'. But it returns a pointer to
  202. the closing NUL wide character in case C is not found in S. */
  203. extern wchar_t *wcschrnul (__const wchar_t *__s, wchar_t __wc)
  204. __THROW __attribute_pure__;
  205. #endif
  206. __BEGIN_NAMESPACE_C99
  207. /* Return the length of the initial segmet of WCS which
  208. consists entirely of wide characters not in REJECT. */
  209. extern size_t wcscspn (__const wchar_t *__wcs, __const wchar_t *__reject)
  210. __THROW __attribute_pure__;
  211. /* Return the length of the initial segmet of WCS which
  212. consists entirely of wide characters in ACCEPT. */
  213. extern size_t wcsspn (__const wchar_t *__wcs, __const wchar_t *__accept)
  214. __THROW __attribute_pure__;
  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. /* Find the first occurrence of NEEDLE in HAYSTACK. */
  219. extern wchar_t *wcsstr (__const wchar_t *__haystack, __const wchar_t *__needle)
  220. __THROW __attribute_pure__;
  221. /* Divide WCS into tokens separated by characters in DELIM. */
  222. extern wchar_t *wcstok (wchar_t *__restrict __s,
  223. __const wchar_t *__restrict __delim,
  224. wchar_t **__restrict __ptr) __THROW;
  225. /* Return the number of wide characters in S. */
  226. extern size_t wcslen (__const wchar_t *__s) __THROW __attribute_pure__;
  227. __END_NAMESPACE_C99
  228. #ifdef __USE_XOPEN
  229. /* Another name for `wcsstr' from XPG4. */
  230. extern wchar_t *wcswcs (__const wchar_t *__haystack, __const wchar_t *__needle)
  231. __THROW __attribute_pure__;
  232. #endif
  233. #ifdef __USE_GNU
  234. /* Return the number of wide characters in S, but at most MAXLEN. */
  235. extern size_t wcsnlen (__const wchar_t *__s, size_t __maxlen)
  236. __THROW __attribute_pure__;
  237. #endif
  238. __BEGIN_NAMESPACE_C99
  239. /* Search N wide characters of S for C. */
  240. extern wchar_t *wmemchr (__const wchar_t *__s, wchar_t __c, size_t __n)
  241. __THROW __attribute_pure__;
  242. /* Compare N wide characters of S1 and S2. */
  243. extern int wmemcmp (__const wchar_t *__restrict __s1,
  244. __const wchar_t *__restrict __s2, size_t __n)
  245. __THROW __attribute_pure__;
  246. /* Copy N wide characters of SRC to DEST. */
  247. extern wchar_t *wmemcpy (wchar_t *__restrict __s1,
  248. __const wchar_t *__restrict __s2, size_t __n) __THROW;
  249. /* Copy N wide characters of SRC to DEST, guaranteeing
  250. correct behavior for overlapping strings. */
  251. extern wchar_t *wmemmove (wchar_t *__s1, __const wchar_t *__s2, size_t __n)
  252. __THROW;
  253. /* Set N wide characters of S to C. */
  254. extern wchar_t *wmemset (wchar_t *__s, wchar_t __c, size_t __n) __THROW;
  255. __END_NAMESPACE_C99
  256. #ifdef __USE_GNU
  257. /* Copy N wide characters of SRC to DEST and return pointer to following
  258. wide character. */
  259. extern wchar_t *wmempcpy (wchar_t *__restrict __s1,
  260. __const wchar_t *__restrict __s2, size_t __n)
  261. __THROW;
  262. #endif
  263. __BEGIN_NAMESPACE_C99
  264. /* Determine whether C constitutes a valid (one-byte) multibyte
  265. character. */
  266. extern wint_t btowc (int __c) __THROW;
  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. /* Write wide character representation of multibyte character pointed
  274. to by S to PWC. */
  275. extern size_t mbrtowc (wchar_t *__restrict __pwc,
  276. __const char *__restrict __s, size_t __n,
  277. mbstate_t *__p) __THROW;
  278. /* Write multibyte representation of wide character WC to S. */
  279. extern size_t wcrtomb (char *__restrict __s, wchar_t __wc,
  280. mbstate_t *__restrict __ps) __THROW;
  281. /* Return number of bytes in multibyte character pointed to by S. */
  282. extern size_t __mbrlen (__const char *__restrict __s, size_t __n,
  283. mbstate_t *__restrict __ps) __THROW;
  284. extern size_t mbrlen (__const char *__restrict __s, size_t __n,
  285. mbstate_t *__restrict __ps) __THROW;
  286. __END_NAMESPACE_C99
  287. #ifdef __USE_EXTERN_INLINES
  288. /* Define inline function as optimization. */
  289. extern __inline size_t mbrlen (__const char *__restrict __s, size_t __n,
  290. mbstate_t *__restrict __ps) __THROW
  291. { return (__ps != NULL
  292. ? mbrtowc (NULL, __s, __n, __ps) : __mbrlen (__s, __n, NULL)); }
  293. #endif
  294. __BEGIN_NAMESPACE_C99
  295. /* Write wide character representation of multibyte character string
  296. SRC to DST. */
  297. extern size_t mbsrtowcs (wchar_t *__restrict __dst,
  298. __const char **__restrict __src, size_t __len,
  299. mbstate_t *__restrict __ps) __THROW;
  300. /* Write multibyte character representation of wide character string
  301. SRC to DST. */
  302. extern size_t wcsrtombs (char *__restrict __dst,
  303. __const wchar_t **__restrict __src, size_t __len,
  304. mbstate_t *__restrict __ps) __THROW;
  305. __END_NAMESPACE_C99
  306. #ifdef __USE_GNU
  307. /* Write wide character representation of at most NMC bytes of the
  308. multibyte character string SRC to DST. */
  309. extern size_t mbsnrtowcs (wchar_t *__restrict __dst,
  310. __const char **__restrict __src, size_t __nmc,
  311. size_t __len, mbstate_t *__restrict __ps) __THROW;
  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. #endif /* use GNU */
  319. /* The following functions are extensions found in X/Open CAE. */
  320. #ifdef __USE_XOPEN
  321. /* Determine number of column positions required for C. */
  322. extern int wcwidth (wchar_t __c) __THROW;
  323. /* Determine number of column positions required for first N wide
  324. characters (or fewer if S ends before this) in S. */
  325. extern int wcswidth (__const wchar_t *__s, size_t __n) __THROW;
  326. #endif /* Use X/Open. */
  327. __BEGIN_NAMESPACE_C99
  328. #ifdef __UCLIBC_HAS_FLOATS__
  329. /* Convert initial portion of the wide string NPTR to `double'
  330. representation. */
  331. extern double wcstod (__const wchar_t *__restrict __nptr,
  332. wchar_t **__restrict __endptr) __THROW;
  333. #ifdef __USE_ISOC99
  334. /* Likewise for `float' and `long double' sizes of floating-point numbers. */
  335. extern float wcstof (__const wchar_t *__restrict __nptr,
  336. wchar_t **__restrict __endptr) __THROW;
  337. extern long double wcstold (__const wchar_t *__restrict __nptr,
  338. wchar_t **__restrict __endptr) __THROW;
  339. #endif /* C99 */
  340. #endif /* __UCLIBC_HAS_FLOATS__ */
  341. /* Convert initial portion of wide string NPTR to `long int'
  342. representation. */
  343. extern long int wcstol (__const wchar_t *__restrict __nptr,
  344. wchar_t **__restrict __endptr, int __base) __THROW;
  345. /* Convert initial portion of wide string NPTR to `unsigned long int'
  346. representation. */
  347. extern unsigned long int wcstoul (__const wchar_t *__restrict __nptr,
  348. wchar_t **__restrict __endptr, int __base)
  349. __THROW;
  350. #if defined __USE_ISOC99 || (defined __GNUC__ && defined __USE_GNU)
  351. /* Convert initial portion of wide string NPTR to `long int'
  352. representation. */
  353. __extension__
  354. extern long long int wcstoll (__const wchar_t *__restrict __nptr,
  355. wchar_t **__restrict __endptr, int __base)
  356. __THROW;
  357. /* Convert initial portion of wide string NPTR to `unsigned long long int'
  358. representation. */
  359. __extension__
  360. extern unsigned long long int wcstoull (__const wchar_t *__restrict __nptr,
  361. wchar_t **__restrict __endptr,
  362. int __base) __THROW;
  363. #endif /* ISO C99 or GCC and GNU. */
  364. __END_NAMESPACE_C99
  365. #if defined __GNUC__ && defined __USE_GNU
  366. /* Convert initial portion of wide string NPTR to `long int'
  367. representation. */
  368. __extension__
  369. extern long long int wcstoq (__const wchar_t *__restrict __nptr,
  370. wchar_t **__restrict __endptr, int __base)
  371. __THROW;
  372. /* Convert initial portion of wide string NPTR to `unsigned long long int'
  373. representation. */
  374. __extension__
  375. extern unsigned long long int wcstouq (__const wchar_t *__restrict __nptr,
  376. wchar_t **__restrict __endptr,
  377. int __base) __THROW;
  378. #endif /* GCC and use GNU. */
  379. #ifdef __USE_GNU
  380. #ifdef __UCLIBC_HAS_XLOCALE__
  381. /* The concept of one static locale per category is not very well
  382. thought out. Many applications will need to process its data using
  383. information from several different locales. Another application is
  384. the implementation of the internationalization handling in the
  385. upcoming ISO C++ standard library. To support this another set of
  386. the functions using locale data exist which have an additional
  387. argument.
  388. Attention: all these functions are *not* standardized in any form.
  389. This is a proof-of-concept implementation. */
  390. /* Structure for reentrant locale using functions. This is an
  391. (almost) opaque type for the user level programs. */
  392. # include <xlocale.h>
  393. /* Special versions of the functions above which take the locale to
  394. use as an additional parameter. */
  395. extern long int wcstol_l (__const wchar_t *__restrict __nptr,
  396. wchar_t **__restrict __endptr, int __base,
  397. __locale_t __loc) __THROW;
  398. extern long int __wcstol_l (__const wchar_t *__restrict __nptr,
  399. wchar_t **__restrict __endptr, int __base,
  400. __locale_t __loc) __THROW;
  401. extern unsigned long int wcstoul_l (__const wchar_t *__restrict __nptr,
  402. wchar_t **__restrict __endptr,
  403. int __base, __locale_t __loc) __THROW;
  404. extern unsigned long int __wcstoul_l (__const wchar_t *__restrict __nptr,
  405. wchar_t **__restrict __endptr,
  406. int __base, __locale_t __loc) __THROW;
  407. __extension__
  408. extern long long int wcstoll_l (__const wchar_t *__restrict __nptr,
  409. wchar_t **__restrict __endptr,
  410. int __base, __locale_t __loc) __THROW;
  411. __extension__
  412. extern long long int __wcstoll_l (__const wchar_t *__restrict __nptr,
  413. wchar_t **__restrict __endptr,
  414. int __base, __locale_t __loc) __THROW;
  415. __extension__
  416. extern unsigned long long int wcstoull_l (__const wchar_t *__restrict __nptr,
  417. wchar_t **__restrict __endptr,
  418. int __base, __locale_t __loc)
  419. __THROW;
  420. __extension__
  421. extern unsigned long long int __wcstoull_l (__const wchar_t *__restrict __nptr,
  422. wchar_t **__restrict __endptr,
  423. int __base, __locale_t __loc)
  424. __THROW;
  425. #ifdef __UCLIBC_HAS_FLOATS__
  426. extern double wcstod_l (__const wchar_t *__restrict __nptr,
  427. wchar_t **__restrict __endptr, __locale_t __loc)
  428. __THROW;
  429. extern double __wcstod_l (__const wchar_t *__restrict __nptr,
  430. wchar_t **__restrict __endptr, __locale_t __loc)
  431. __THROW;
  432. extern float wcstof_l (__const wchar_t *__restrict __nptr,
  433. wchar_t **__restrict __endptr, __locale_t __loc)
  434. __THROW;
  435. extern float __wcstof_l (__const wchar_t *__restrict __nptr,
  436. wchar_t **__restrict __endptr, __locale_t __loc)
  437. __THROW;
  438. extern long double wcstold_l (__const wchar_t *__restrict __nptr,
  439. wchar_t **__restrict __endptr,
  440. __locale_t __loc) __THROW;
  441. extern long double __wcstold_l (__const wchar_t *__restrict __nptr,
  442. wchar_t **__restrict __endptr,
  443. __locale_t __loc) __THROW;
  444. #endif /* __UCLIBC_HAS_FLOATS__ */
  445. #endif /* __UCLIBC_HAS_XLOCALE__ */
  446. #endif /* GNU */
  447. #if 0
  448. #ifdef __UCLIBC_HAS_FLOATS__
  449. /* The internal entry points for `wcstoX' take an extra flag argument
  450. saying whether or not to parse locale-dependent number grouping. */
  451. extern double __wcstod_internal (__const wchar_t *__restrict __nptr,
  452. wchar_t **__restrict __endptr, int __group)
  453. __THROW;
  454. extern float __wcstof_internal (__const wchar_t *__restrict __nptr,
  455. wchar_t **__restrict __endptr, int __group)
  456. __THROW;
  457. extern long double __wcstold_internal (__const wchar_t *__restrict __nptr,
  458. wchar_t **__restrict __endptr,
  459. int __group) __THROW;
  460. #endif /* __UCLIBC_HAS_FLOATS__ */
  461. #ifndef __wcstol_internal_defined
  462. extern long int __wcstol_internal (__const wchar_t *__restrict __nptr,
  463. wchar_t **__restrict __endptr,
  464. int __base, int __group) __THROW;
  465. # define __wcstol_internal_defined 1
  466. #endif
  467. #ifndef __wcstoul_internal_defined
  468. extern unsigned long int __wcstoul_internal (__const wchar_t *__restrict __npt,
  469. wchar_t **__restrict __endptr,
  470. int __base, int __group) __THROW;
  471. # define __wcstoul_internal_defined 1
  472. #endif
  473. #ifndef __wcstoll_internal_defined
  474. __extension__
  475. extern long long int __wcstoll_internal (__const wchar_t *__restrict __nptr,
  476. wchar_t **__restrict __endptr,
  477. int __base, int __group) __THROW;
  478. # define __wcstoll_internal_defined 1
  479. #endif
  480. #ifndef __wcstoull_internal_defined
  481. __extension__
  482. extern unsigned long long int __wcstoull_internal (__const wchar_t *
  483. __restrict __nptr,
  484. wchar_t **
  485. __restrict __endptr,
  486. int __base,
  487. int __group) __THROW;
  488. # define __wcstoull_internal_defined 1
  489. #endif
  490. #if defined __OPTIMIZE__ && __GNUC__ >= 2
  491. /* Define inline functions which call the internal entry points. */
  492. /* __BEGIN_NAMESPACE_C99 */
  493. /* extern __inline double wcstod (__const wchar_t *__restrict __nptr, */
  494. /* wchar_t **__restrict __endptr) __THROW */
  495. /* { return __wcstod_internal (__nptr, __endptr, 0); } */
  496. /* extern __inline long int wcstol (__const wchar_t *__restrict __nptr, */
  497. /* wchar_t **__restrict __endptr, */
  498. /* int __base) __THROW */
  499. /* { return __wcstol_internal (__nptr, __endptr, __base, 0); } */
  500. /* extern __inline unsigned long int wcstoul (__const wchar_t *__restrict __nptr, */
  501. /* wchar_t **__restrict __endptr, */
  502. /* int __base) __THROW */
  503. /* { return __wcstoul_internal (__nptr, __endptr, __base, 0); } */
  504. /* __END_NAMESPACE_C99 */
  505. # ifdef __USE_GNU
  506. /* extern __inline float wcstof (__const wchar_t *__restrict __nptr, */
  507. /* wchar_t **__restrict __endptr) __THROW */
  508. /* { return __wcstof_internal (__nptr, __endptr, 0); } */
  509. /* extern __inline long double wcstold (__const wchar_t *__restrict __nptr, */
  510. /* wchar_t **__restrict __endptr) __THROW */
  511. /* { return __wcstold_internal (__nptr, __endptr, 0); } */
  512. /* __extension__ */
  513. /* extern __inline long long int wcstoq (__const wchar_t *__restrict __nptr, */
  514. /* wchar_t **__restrict __endptr, */
  515. /* int __base) __THROW */
  516. /* { return __wcstoll_internal (__nptr, __endptr, __base, 0); } */
  517. /* __extension__ */
  518. /* extern __inline unsigned long long int wcstouq (__const wchar_t * */
  519. /* __restrict __nptr, */
  520. /* wchar_t **__restrict __endptr, */
  521. /* int __base) __THROW */
  522. /* { return __wcstoull_internal (__nptr, __endptr, __base, 0); } */
  523. # endif /* Use GNU. */
  524. #endif /* Optimizing GCC >=2. */
  525. #endif /* 0 */
  526. #ifdef __USE_GNU
  527. /* Copy SRC to DEST, returning the address of the terminating L'\0' in
  528. DEST. */
  529. extern wchar_t *wcpcpy (wchar_t *__dest, __const wchar_t *__src) __THROW;
  530. /* Copy no more than N characters of SRC to DEST, returning the address of
  531. the last character written into DEST. */
  532. extern wchar_t *wcpncpy (wchar_t *__dest, __const wchar_t *__src, size_t __n)
  533. __THROW;
  534. #endif /* use GNU */
  535. /* Wide character I/O functions. */
  536. #if defined __USE_ISOC99 || defined __USE_UNIX98
  537. __BEGIN_NAMESPACE_C99
  538. /* Select orientation for stream. */
  539. extern int fwide (__FILE *__fp, int __mode) __THROW;
  540. /* Write formatted output to STREAM.
  541. This function is a possible cancellation point and therefore not
  542. marked with __THROW. */
  543. extern int fwprintf (__FILE *__restrict __stream,
  544. __const wchar_t *__restrict __format, ...)
  545. /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */;
  546. /* Write formatted output to stdout.
  547. This function is a possible cancellation point and therefore not
  548. marked with __THROW. */
  549. extern int wprintf (__const wchar_t *__restrict __format, ...)
  550. /* __attribute__ ((__format__ (__wprintf__, 1, 2))) */;
  551. /* Write formatted output of at most N characters to S. */
  552. extern int swprintf (wchar_t *__restrict __s, size_t __n,
  553. __const wchar_t *__restrict __format, ...)
  554. __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
  555. /* Write formatted output to S from argument list ARG.
  556. This function is a possible cancellation point and therefore not
  557. marked with __THROW. */
  558. extern int vfwprintf (__FILE *__restrict __s,
  559. __const wchar_t *__restrict __format,
  560. __gnuc_va_list __arg)
  561. /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */;
  562. /* Write formatted output to stdout from argument list ARG.
  563. This function is a possible cancellation point and therefore not
  564. marked with __THROW. */
  565. extern int vwprintf (__const wchar_t *__restrict __format,
  566. __gnuc_va_list __arg)
  567. /* __attribute__ ((__format__ (__wprintf__, 1, 0))) */;
  568. /* Write formatted output of at most N character to S from argument
  569. list ARG. */
  570. extern int vswprintf (wchar_t *__restrict __s, size_t __n,
  571. __const wchar_t *__restrict __format,
  572. __gnuc_va_list __arg)
  573. __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
  574. /* Read formatted input from STREAM.
  575. This function is a possible cancellation point and therefore not
  576. marked with __THROW. */
  577. extern int fwscanf (__FILE *__restrict __stream,
  578. __const wchar_t *__restrict __format, ...)
  579. /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
  580. /* Read formatted input from stdin.
  581. This function is a possible cancellation point and therefore not
  582. marked with __THROW. */
  583. extern int wscanf (__const wchar_t *__restrict __format, ...)
  584. /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
  585. /* Read formatted input from S. */
  586. extern int swscanf (__const wchar_t *__restrict __s,
  587. __const wchar_t *__restrict __format, ...)
  588. __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
  589. __END_NAMESPACE_C99
  590. #endif /* Use ISO C99 and Unix98. */
  591. #ifdef __USE_ISOC99
  592. __BEGIN_NAMESPACE_C99
  593. /* Read formatted input from S into argument list ARG.
  594. This function is a possible cancellation point and therefore not
  595. marked with __THROW. */
  596. extern int vfwscanf (__FILE *__restrict __s,
  597. __const wchar_t *__restrict __format,
  598. __gnuc_va_list __arg)
  599. /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
  600. /* Read formatted input from stdin into argument list ARG.
  601. This function is a possible cancellation point and therefore not
  602. marked with __THROW. */
  603. extern int vwscanf (__const wchar_t *__restrict __format,
  604. __gnuc_va_list __arg)
  605. /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
  606. /* Read formatted input from S into argument list ARG. */
  607. extern int vswscanf (__const wchar_t *__restrict __s,
  608. __const wchar_t *__restrict __format,
  609. __gnuc_va_list __arg)
  610. __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
  611. __END_NAMESPACE_C99
  612. #endif /* Use ISO C99. */
  613. __BEGIN_NAMESPACE_C99
  614. /* Read a character from STREAM.
  615. These functions are possible cancellation points and therefore not
  616. marked with __THROW. */
  617. extern wint_t fgetwc (__FILE *__stream);
  618. extern wint_t getwc (__FILE *__stream);
  619. /* Read a character from stdin.
  620. This function is a possible cancellation point and therefore not
  621. marked with __THROW. */
  622. extern wint_t getwchar (void);
  623. /* Write a character to STREAM.
  624. These functions are possible cancellation points and therefore not
  625. marked with __THROW. */
  626. extern wint_t fputwc (wchar_t __wc, __FILE *__stream);
  627. extern wint_t putwc (wchar_t __wc, __FILE *__stream);
  628. /* Write a character to stdout.
  629. This function is a possible cancellation points and therefore not
  630. marked with __THROW. */
  631. extern wint_t putwchar (wchar_t __wc);
  632. /* Get a newline-terminated wide character string of finite length
  633. from STREAM.
  634. This function is a possible cancellation points and therefore not
  635. marked with __THROW. */
  636. extern wchar_t *fgetws (wchar_t *__restrict __ws, int __n,
  637. __FILE *__restrict __stream);
  638. /* Write a string to STREAM.
  639. This function is a possible cancellation points and therefore not
  640. marked with __THROW. */
  641. extern int fputws (__const wchar_t *__restrict __ws,
  642. __FILE *__restrict __stream);
  643. /* Push a character back onto the input buffer of STREAM.
  644. This function is a possible cancellation points and therefore not
  645. marked with __THROW. */
  646. extern wint_t ungetwc (wint_t __wc, __FILE *__stream);
  647. __END_NAMESPACE_C99
  648. #ifdef __USE_GNU
  649. /* These are defined to be equivalent to the `char' functions defined
  650. in POSIX.1:1996.
  651. These functions are not part of POSIX and therefore no official
  652. cancellation point. But due to similarity with an POSIX interface
  653. or due to the implementation they are cancellation points and
  654. therefore not marked with __THROW. */
  655. extern wint_t getwc_unlocked (__FILE *__stream);
  656. extern wint_t getwchar_unlocked (void);
  657. /* This is the wide character version of a GNU extension.
  658. This function is not part of POSIX and therefore no official
  659. cancellation point. But due to similarity with an POSIX interface
  660. or due to the implementation it is a cancellation point and
  661. therefore not marked with __THROW. */
  662. extern wint_t fgetwc_unlocked (__FILE *__stream);
  663. /* Faster version when locking is not necessary.
  664. This function is not part of POSIX and therefore no official
  665. cancellation point. But due to similarity with an POSIX interface
  666. or due to the implementation it is a cancellation point and
  667. therefore not marked with __THROW. */
  668. extern wint_t fputwc_unlocked (wchar_t __wc, __FILE *__stream);
  669. /* These are defined to be equivalent to the `char' functions defined
  670. in POSIX.1:1996.
  671. These functions are not part of POSIX and therefore no official
  672. cancellation point. But due to similarity with an POSIX interface
  673. or due to the implementation they are cancellation points and
  674. therefore not marked with __THROW. */
  675. extern wint_t putwc_unlocked (wchar_t __wc, __FILE *__stream);
  676. extern wint_t putwchar_unlocked (wchar_t __wc);
  677. /* This function does the same as `fgetws' but does not lock the stream.
  678. This function is not part of POSIX and therefore no official
  679. cancellation point. But due to similarity with an POSIX interface
  680. or due to the implementation it is a cancellation point and
  681. therefore not marked with __THROW. */
  682. extern wchar_t *fgetws_unlocked (wchar_t *__restrict __ws, int __n,
  683. __FILE *__restrict __stream);
  684. /* This function does the same as `fputws' but does not lock the stream.
  685. This function is not part of POSIX and therefore no official
  686. cancellation point. But due to similarity with an POSIX interface
  687. or due to the implementation it is a cancellation point and
  688. therefore not marked with __THROW. */
  689. extern int fputws_unlocked (__const wchar_t *__restrict __ws,
  690. __FILE *__restrict __stream);
  691. #endif
  692. #if 0
  693. __BEGIN_NAMESPACE_C99
  694. /* Format TP into S according to FORMAT.
  695. Write no more than MAXSIZE wide characters and return the number
  696. of wide characters written, or 0 if it would exceed MAXSIZE. */
  697. extern size_t wcsftime (wchar_t *__restrict __s, size_t __maxsize,
  698. __const wchar_t *__restrict __format,
  699. __const struct tm *__restrict __tp) __THROW;
  700. __END_NAMESPACE_C99
  701. # ifdef __USE_GNU
  702. #ifdef __UCLIBC_HAS_XLOCALE__
  703. # include <xlocale.h>
  704. /* Similar to `wcsftime' but takes the information from
  705. the provided locale and not the global locale. */
  706. extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize,
  707. __const wchar_t *__restrict __format,
  708. __const struct tm *__restrict __tp,
  709. __locale_t __loc) __THROW;
  710. extern size_t __wcsftime_l (wchar_t *__restrict __s, size_t __maxsize,
  711. __const wchar_t *__restrict __format,
  712. __const struct tm *__restrict __tp,
  713. __locale_t __loc) __THROW;
  714. #endif /* __UCLIBC_HAS_XLOCALE__ */
  715. # endif
  716. #endif /* 0 */
  717. /* The X/Open standard demands that most of the functions defined in
  718. the <wctype.h> header must also appear here. This is probably
  719. because some X/Open members wrote their implementation before the
  720. ISO C standard was published and introduced the better solution.
  721. We have to provide these definitions for compliance reasons but we
  722. do this nonsense only if really necessary. */
  723. #if defined __USE_UNIX98 && !defined __USE_GNU
  724. # define __need_iswxxx
  725. # include <wctype.h>
  726. #endif
  727. __END_DECLS
  728. #endif /* _WCHAR_H defined */
  729. #endif /* wchar.h */