Subversion Repositories Kolibri OS

Rev

Rev 4874 | Rev 6099 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

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