wchar.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. #ifndef _WCHAR_H_
  2. #define _WCHAR_H_
  3. #include <_ansi.h>
  4. #include <sys/reent.h>
  5. #define __need_size_t
  6. #define __need_wchar_t
  7. #define __need_wint_t
  8. #define __need_NULL
  9. #include <stddef.h>
  10. #define __need___va_list
  11. #include <stdarg.h>
  12. /* For _mbstate_t definition. */
  13. #include <sys/_types.h>
  14. #include <sys/cdefs.h>
  15. /* For __STDC_ISO_10646__ */
  16. #include <sys/features.h>
  17. #ifndef WEOF
  18. # define WEOF ((wint_t)-1)
  19. #endif
  20. /* This must match definition in <stdint.h> */
  21. #ifndef WCHAR_MIN
  22. #ifdef __WCHAR_MIN__
  23. #define WCHAR_MIN __WCHAR_MIN__
  24. #elif defined(__WCHAR_UNSIGNED__) || (L'\0' - 1 > 0)
  25. #define WCHAR_MIN (0 + L'\0')
  26. #else
  27. #define WCHAR_MIN (-0x7fffffff - 1 + L'\0')
  28. #endif
  29. #endif
  30. /* This must match definition in <stdint.h> */
  31. #ifndef WCHAR_MAX
  32. #ifdef __WCHAR_MAX__
  33. #define WCHAR_MAX __WCHAR_MAX__
  34. #elif defined(__WCHAR_UNSIGNED__) || (L'\0' - 1 > 0)
  35. #define WCHAR_MAX (0xffffffffu + L'\0')
  36. #else
  37. #define WCHAR_MAX (0x7fffffff + L'\0')
  38. #endif
  39. #endif
  40. _BEGIN_STD_C
  41. /* As in stdio.h, <sys/reent.h> defines __FILE. */
  42. typedef __FILE FILE;
  43. /* As required by POSIX.1-2008, declare tm as incomplete type.
  44. The actual definition is in time.h. */
  45. struct tm;
  46. #ifndef _MBSTATE_T
  47. #define _MBSTATE_T
  48. typedef _mbstate_t mbstate_t;
  49. #endif /* _MBSTATE_T */
  50. wint_t _EXFUN(btowc, (int));
  51. int _EXFUN(wctob, (wint_t));
  52. size_t _EXFUN(mbrlen, (const char *__restrict, size_t, mbstate_t *__restrict));
  53. size_t _EXFUN(mbrtowc, (wchar_t *__restrict, const char *__restrict, size_t,
  54. mbstate_t *__restrict));
  55. size_t _EXFUN(_mbrtowc_r, (struct _reent *, wchar_t * , const char * ,
  56. size_t, mbstate_t *));
  57. int _EXFUN(mbsinit, (const mbstate_t *));
  58. size_t _EXFUN(mbsnrtowcs, (wchar_t *__restrict, const char **__restrict,
  59. size_t, size_t, mbstate_t *__restrict));
  60. size_t _EXFUN(_mbsnrtowcs_r, (struct _reent *, wchar_t * , const char ** ,
  61. size_t, size_t, mbstate_t *));
  62. size_t _EXFUN(mbsrtowcs, (wchar_t *__restrict, const char **__restrict, size_t,
  63. mbstate_t *__restrict));
  64. size_t _EXFUN(_mbsrtowcs_r, (struct _reent *, wchar_t * , const char ** , size_t, mbstate_t *));
  65. size_t _EXFUN(wcrtomb, (char *__restrict, wchar_t, mbstate_t *__restrict));
  66. size_t _EXFUN(_wcrtomb_r, (struct _reent *, char * , wchar_t, mbstate_t *));
  67. size_t _EXFUN(wcsnrtombs, (char *__restrict, const wchar_t **__restrict,
  68. size_t, size_t, mbstate_t *__restrict));
  69. size_t _EXFUN(_wcsnrtombs_r, (struct _reent *, char * , const wchar_t ** ,
  70. size_t, size_t, mbstate_t *));
  71. size_t _EXFUN(wcsrtombs, (char *__restrict, const wchar_t **__restrict,
  72. size_t, mbstate_t *__restrict));
  73. size_t _EXFUN(_wcsrtombs_r, (struct _reent *, char * , const wchar_t ** ,
  74. size_t, mbstate_t *));
  75. int _EXFUN(wcscasecmp, (const wchar_t *, const wchar_t *));
  76. wchar_t *_EXFUN(wcscat, (wchar_t *__restrict, const wchar_t *__restrict));
  77. wchar_t *_EXFUN(wcschr, (const wchar_t *, wchar_t));
  78. int _EXFUN(wcscmp, (const wchar_t *, const wchar_t *));
  79. int _EXFUN(wcscoll, (const wchar_t *, const wchar_t *));
  80. wchar_t *_EXFUN(wcscpy, (wchar_t *__restrict, const wchar_t *__restrict));
  81. wchar_t *_EXFUN(wcpcpy, (wchar_t *__restrict,
  82. const wchar_t *__restrict));
  83. wchar_t *_EXFUN(wcsdup, (const wchar_t *));
  84. wchar_t *_EXFUN(_wcsdup_r, (struct _reent *, const wchar_t * ));
  85. size_t _EXFUN(wcscspn, (const wchar_t *, const wchar_t *));
  86. size_t _EXFUN(wcsftime, (wchar_t *__restrict, size_t,
  87. const wchar_t *__restrict, const struct tm *__restrict));
  88. size_t _EXFUN(wcslcat, (wchar_t *, const wchar_t *, size_t));
  89. size_t _EXFUN(wcslcpy, (wchar_t *, const wchar_t *, size_t));
  90. size_t _EXFUN(wcslen, (const wchar_t *));
  91. int _EXFUN(wcsncasecmp, (const wchar_t *, const wchar_t *, size_t));
  92. wchar_t *_EXFUN(wcsncat, (wchar_t *__restrict,
  93. const wchar_t *__restrict, size_t));
  94. int _EXFUN(wcsncmp, (const wchar_t *, const wchar_t *, size_t));
  95. wchar_t *_EXFUN(wcsncpy, (wchar_t *__restrict,
  96. const wchar_t *__restrict, size_t));
  97. wchar_t *_EXFUN(wcpncpy, (wchar_t *__restrict,
  98. const wchar_t *__restrict, size_t));
  99. size_t _EXFUN(wcsnlen, (const wchar_t *, size_t));
  100. wchar_t *_EXFUN(wcspbrk, (const wchar_t *, const wchar_t *));
  101. wchar_t *_EXFUN(wcsrchr, (const wchar_t *, wchar_t));
  102. size_t _EXFUN(wcsspn, (const wchar_t *, const wchar_t *));
  103. wchar_t *_EXFUN(wcsstr, (const wchar_t *__restrict,
  104. const wchar_t *__restrict));
  105. wchar_t *_EXFUN(wcstok, (wchar_t *__restrict, const wchar_t *__restrict,
  106. wchar_t **__restrict));
  107. double _EXFUN(wcstod, (const wchar_t *__restrict, wchar_t **__restrict));
  108. double _EXFUN(_wcstod_r, (struct _reent *, const wchar_t *, wchar_t **));
  109. float _EXFUN(wcstof, (const wchar_t *__restrict, wchar_t **__restrict));
  110. float _EXFUN(_wcstof_r, (struct _reent *, const wchar_t *, wchar_t **));
  111. #ifdef _LDBL_EQ_DBL
  112. long double _EXFUN(wcstold, (const wchar_t *, wchar_t **));
  113. #endif /* _LDBL_EQ_DBL */
  114. int _EXFUN(wcswidth, (const wchar_t *, size_t));
  115. size_t _EXFUN(wcsxfrm, (wchar_t *__restrict, const wchar_t *__restrict,
  116. size_t));
  117. int _EXFUN(wcwidth, (const wchar_t));
  118. wchar_t *_EXFUN(wmemchr, (const wchar_t *, wchar_t, size_t));
  119. int _EXFUN(wmemcmp, (const wchar_t *, const wchar_t *, size_t));
  120. wchar_t *_EXFUN(wmemcpy, (wchar_t *__restrict, const wchar_t *__restrict,
  121. size_t));
  122. wchar_t *_EXFUN(wmemmove, (wchar_t *, const wchar_t *, size_t));
  123. wchar_t *_EXFUN(wmemset, (wchar_t *, wchar_t, size_t));
  124. long _EXFUN(wcstol, (const wchar_t *__restrict, wchar_t **__restrict, int));
  125. long long _EXFUN(wcstoll, (const wchar_t *__restrict, wchar_t **__restrict,
  126. int));
  127. unsigned long _EXFUN(wcstoul, (const wchar_t *__restrict, wchar_t **__restrict,
  128. int));
  129. unsigned long long _EXFUN(wcstoull, (const wchar_t *__restrict,
  130. wchar_t **__restrict, int));
  131. long _EXFUN(_wcstol_r, (struct _reent *, const wchar_t *, wchar_t **, int));
  132. long long _EXFUN(_wcstoll_r, (struct _reent *, const wchar_t *, wchar_t **, int));
  133. unsigned long _EXFUN(_wcstoul_r, (struct _reent *, const wchar_t *, wchar_t **, int));
  134. unsigned long long _EXFUN(_wcstoull_r, (struct _reent *, const wchar_t *, wchar_t **, int));
  135. /* On platforms where long double equals double. */
  136. #ifdef _LDBL_EQ_DBL
  137. long double _EXFUN(wcstold, (const wchar_t *, wchar_t **));
  138. #endif /* _LDBL_EQ_DBL */
  139. wint_t _EXFUN(fgetwc, (__FILE *));
  140. wchar_t *_EXFUN(fgetws, (wchar_t *__restrict, int, __FILE *__restrict));
  141. wint_t _EXFUN(fputwc, (wchar_t, __FILE *));
  142. int _EXFUN(fputws, (const wchar_t *__restrict, __FILE *__restrict));
  143. int _EXFUN (fwide, (__FILE *, int));
  144. wint_t _EXFUN (getwc, (__FILE *));
  145. wint_t _EXFUN (getwchar, (void));
  146. wint_t _EXFUN(putwc, (wchar_t, __FILE *));
  147. wint_t _EXFUN(putwchar, (wchar_t));
  148. wint_t _EXFUN (ungetwc, (wint_t wc, __FILE *));
  149. wint_t _EXFUN(_fgetwc_r, (struct _reent *, __FILE *));
  150. wint_t _EXFUN(_fgetwc_unlocked_r, (struct _reent *, __FILE *));
  151. wchar_t *_EXFUN(_fgetws_r, (struct _reent *, wchar_t *, int, __FILE *));
  152. wchar_t *_EXFUN(_fgetws_unlocked_r, (struct _reent *, wchar_t *, int, __FILE *));
  153. wint_t _EXFUN(_fputwc_r, (struct _reent *, wchar_t, __FILE *));
  154. wint_t _EXFUN(_fputwc_unlocked_r, (struct _reent *, wchar_t, __FILE *));
  155. int _EXFUN(_fputws_r, (struct _reent *, const wchar_t *, __FILE *));
  156. int _EXFUN(_fputws_unlocked_r, (struct _reent *, const wchar_t *, __FILE *));
  157. int _EXFUN (_fwide_r, (struct _reent *, __FILE *, int));
  158. wint_t _EXFUN (_getwc_r, (struct _reent *, __FILE *));
  159. wint_t _EXFUN (_getwc_unlocked_r, (struct _reent *, __FILE *));
  160. wint_t _EXFUN (_getwchar_r, (struct _reent *ptr));
  161. wint_t _EXFUN (_getwchar_unlocked_r, (struct _reent *ptr));
  162. wint_t _EXFUN(_putwc_r, (struct _reent *, wchar_t, __FILE *));
  163. wint_t _EXFUN(_putwc_unlocked_r, (struct _reent *, wchar_t, __FILE *));
  164. wint_t _EXFUN(_putwchar_r, (struct _reent *, wchar_t));
  165. wint_t _EXFUN(_putwchar_unlocked_r, (struct _reent *, wchar_t));
  166. wint_t _EXFUN (_ungetwc_r, (struct _reent *, wint_t wc, __FILE *));
  167. #if __GNU_VISIBLE
  168. wint_t _EXFUN(fgetwc_unlocked, (__FILE *));
  169. wchar_t *_EXFUN(fgetws_unlocked, (wchar_t *__restrict, int, __FILE *__restrict));
  170. wint_t _EXFUN(fputwc_unlocked, (wchar_t, __FILE *));
  171. int _EXFUN(fputws_unlocked, (const wchar_t *__restrict, __FILE *__restrict));
  172. wint_t _EXFUN(getwc_unlocked, (__FILE *));
  173. wint_t _EXFUN(getwchar_unlocked, (void));
  174. wint_t _EXFUN(putwc_unlocked, (wchar_t, __FILE *));
  175. wint_t _EXFUN(putwchar_unlocked, (wchar_t));
  176. #endif
  177. __FILE *_EXFUN (open_wmemstream, (wchar_t **, size_t *));
  178. __FILE *_EXFUN (_open_wmemstream_r, (struct _reent *, wchar_t **, size_t *));
  179. #ifndef __VALIST
  180. #ifdef __GNUC__
  181. #define __VALIST __gnuc_va_list
  182. #else
  183. #define __VALIST char*
  184. #endif
  185. #endif
  186. int _EXFUN(fwprintf, (__FILE *__restrict, const wchar_t *__restrict, ...));
  187. int _EXFUN(swprintf, (wchar_t *__restrict, size_t,
  188. const wchar_t *__restrict, ...));
  189. int _EXFUN(vfwprintf, (__FILE *__restrict, const wchar_t *__restrict,
  190. __VALIST));
  191. int _EXFUN(vswprintf, (wchar_t *__restrict, size_t,
  192. const wchar_t *__restrict, __VALIST));
  193. int _EXFUN(vwprintf, (const wchar_t *__restrict, __VALIST));
  194. int _EXFUN(wprintf, (const wchar_t *__restrict, ...));
  195. int _EXFUN(_fwprintf_r, (struct _reent *, __FILE *, const wchar_t *, ...));
  196. int _EXFUN(_swprintf_r, (struct _reent *, wchar_t *, size_t, const wchar_t *, ...));
  197. int _EXFUN(_vfwprintf_r, (struct _reent *, __FILE *, const wchar_t *, __VALIST));
  198. int _EXFUN(_vswprintf_r, (struct _reent *, wchar_t *, size_t, const wchar_t *, __VALIST));
  199. int _EXFUN(_vwprintf_r, (struct _reent *, const wchar_t *, __VALIST));
  200. int _EXFUN(_wprintf_r, (struct _reent *, const wchar_t *, ...));
  201. int _EXFUN(fwscanf, (__FILE *__restrict, const wchar_t *__restrict, ...));
  202. int _EXFUN(swscanf, (const wchar_t *__restrict,
  203. const wchar_t *__restrict, ...));
  204. int _EXFUN(vfwscanf, (__FILE *__restrict, const wchar_t *__restrict,
  205. __VALIST));
  206. int _EXFUN(vswscanf, (const wchar_t *__restrict, const wchar_t *__restrict,
  207. __VALIST));
  208. int _EXFUN(vwscanf, (const wchar_t *__restrict, __VALIST));
  209. int _EXFUN(wscanf, (const wchar_t *__restrict, ...));
  210. int _EXFUN(_fwscanf_r, (struct _reent *, __FILE *, const wchar_t *, ...));
  211. int _EXFUN(_swscanf_r, (struct _reent *, const wchar_t *, const wchar_t *, ...));
  212. int _EXFUN(_vfwscanf_r, (struct _reent *, __FILE *, const wchar_t *, __VALIST));
  213. int _EXFUN(_vswscanf_r, (struct _reent *, const wchar_t *, const wchar_t *, __VALIST));
  214. int _EXFUN(_vwscanf_r, (struct _reent *, const wchar_t *, __VALIST));
  215. int _EXFUN(_wscanf_r, (struct _reent *, const wchar_t *, ...));
  216. #define getwc(fp) fgetwc(fp)
  217. #define putwc(wc,fp) fputwc((wc), (fp))
  218. #define getwchar() fgetwc(_REENT->_stdin)
  219. #define putwchar(wc) fputwc((wc), _REENT->_stdout)
  220. #if __GNU_VISIBLE
  221. #define getwc_unlocked(fp) fgetwc_unlocked(fp)
  222. #define putwc_unlocked(wc,fp) fputwc_unlocked((wc), (fp))
  223. #define getwchar_unlocked() fgetwc_unlocked(_REENT->_stdin)
  224. #define putwchar_unlocked(wc) fputwc_unlocked((wc), _REENT->_stdout)
  225. #endif
  226. _END_STD_C
  227. #endif /* _WCHAR_H_ */