1 #ifndef _WCHAR_H 2 #define _WCHAR_H 3 4 #ifdef __cplusplus 5 extern "C" { 6 #endif 7 8 #include <features.h> 9 10 #define __NEED_FILE 11 #define __NEED___isoc_va_list 12 #define __NEED_size_t 13 #define __NEED_wchar_t 14 #define __NEED_wint_t 15 #define __NEED_mbstate_t 16 #define __NEED_off_t 17 18 #if __STDC_VERSION__ < 201112L 19 #define __NEED_off_t 20 #define __NEED_struct__IO_FILE 21 #endif 22 23 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ 24 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) 25 #define __NEED_locale_t 26 #define __NEED_va_list 27 #endif 28 29 #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) 30 #define __NEED_wctype_t 31 #endif 32 33 #include <bits/alltypes.h> 34 35 #if L'\0'-1 > 0 36 #define WCHAR_MAX (0xffffffffu+L'\0') 37 #define WCHAR_MIN (0+L'\0') 38 #else 39 #define WCHAR_MAX (0x7fffffff+L'\0') 40 #define WCHAR_MIN (-1-0x7fffffff+L'\0') 41 #endif 42 43 #ifdef __cplusplus 44 #define NULL 0L 45 #else 46 #define NULL ((void*)0) 47 #endif 48 49 #undef WEOF 50 #define WEOF 0xffffffffU 51 52 wchar_t *wcscpy (wchar_t *__restrict, const wchar_t *__restrict); 53 wchar_t *wcsncpy (wchar_t *__restrict, const wchar_t *__restrict, size_t); 54 55 wchar_t *wcscat (wchar_t *__restrict, const wchar_t *__restrict); 56 wchar_t *wcsncat (wchar_t *__restrict, const wchar_t *__restrict, size_t); 57 58 int wcscmp (const wchar_t *, const wchar_t *); 59 int wcsncmp (const wchar_t *, const wchar_t *, size_t); 60 61 int wcscoll(const wchar_t *, const wchar_t *); 62 size_t wcsxfrm (wchar_t *__restrict, const wchar_t *__restrict, size_t); 63 64 wchar_t *wcschr (const wchar_t *, wchar_t); 65 wchar_t *wcsrchr (const wchar_t *, wchar_t); 66 67 size_t wcscspn (const wchar_t *, const wchar_t *); 68 size_t wcsspn (const wchar_t *, const wchar_t *); 69 wchar_t *wcspbrk (const wchar_t *, const wchar_t *); 70 71 wchar_t *wcstok (wchar_t *__restrict, const wchar_t *__restrict, wchar_t **__restrict); 72 73 size_t wcslen (const wchar_t *); 74 75 wchar_t *wcsstr (const wchar_t *__restrict, const wchar_t *__restrict); 76 wchar_t *wcswcs (const wchar_t *, const wchar_t *); 77 78 wchar_t *wmemchr (const wchar_t *, wchar_t, size_t); 79 int wmemcmp (const wchar_t *, const wchar_t *, size_t); 80 wchar_t *wmemcpy (wchar_t *__restrict, const wchar_t *__restrict, size_t); 81 wchar_t *wmemmove (wchar_t *, const wchar_t *, size_t); 82 wchar_t *wmemset (wchar_t *, wchar_t, size_t); 83 84 wint_t btowc (int); 85 int wctob (wint_t); 86 87 int mbsinit (const mbstate_t *); 88 size_t mbrtowc (wchar_t *__restrict, const char *__restrict, size_t, mbstate_t *__restrict); 89 size_t wcrtomb (char *__restrict, wchar_t, mbstate_t *__restrict); 90 91 size_t mbrlen (const char *__restrict, size_t, mbstate_t *__restrict); 92 93 size_t mbsrtowcs (wchar_t *__restrict, const char **__restrict, size_t, mbstate_t *__restrict); 94 size_t wcsrtombs (char *__restrict, const wchar_t **__restrict, size_t, mbstate_t *__restrict); 95 96 float wcstof (const wchar_t *__restrict, wchar_t **__restrict); 97 double wcstod (const wchar_t *__restrict, wchar_t **__restrict); 98 long double wcstold (const wchar_t *__restrict, wchar_t **__restrict); 99 100 long wcstol (const wchar_t *__restrict, wchar_t **__restrict, int); 101 unsigned long wcstoul (const wchar_t *__restrict, wchar_t **__restrict, int); 102 103 long long wcstoll (const wchar_t *__restrict, wchar_t **__restrict, int); 104 unsigned long long wcstoull (const wchar_t *__restrict, wchar_t **__restrict, int); 105 106 107 108 int fwide (FILE *, int); 109 110 111 int wprintf (const wchar_t *__restrict, ...); 112 int fwprintf (FILE *__restrict, const wchar_t *__restrict, ...); 113 int swprintf (wchar_t *__restrict, size_t, const wchar_t *__restrict, ...); 114 115 int vwprintf (const wchar_t *__restrict, __isoc_va_list); 116 int vfwprintf (FILE *__restrict, const wchar_t *__restrict, __isoc_va_list); 117 int vswprintf (wchar_t *__restrict, size_t, const wchar_t *__restrict, __isoc_va_list); 118 119 int wscanf (const wchar_t *__restrict, ...); 120 int fwscanf (FILE *__restrict, const wchar_t *__restrict, ...); 121 int swscanf (const wchar_t *__restrict, const wchar_t *__restrict, ...); 122 123 int vwscanf (const wchar_t *__restrict, __isoc_va_list); 124 int vfwscanf (FILE *__restrict, const wchar_t *__restrict, __isoc_va_list); 125 int vswscanf (const wchar_t *__restrict, const wchar_t *__restrict, __isoc_va_list); 126 127 wint_t fgetwc (FILE *); 128 wint_t getwc (FILE *); 129 wint_t getwchar (void); 130 131 wint_t fputwc (wchar_t, FILE *); 132 wint_t putwc (wchar_t, FILE *); 133 wint_t putwchar (wchar_t); 134 135 wchar_t *fgetws (wchar_t *__restrict, int, FILE *__restrict); 136 int fputws (const wchar_t *__restrict, FILE *__restrict); 137 138 wint_t ungetwc (wint_t, FILE *); 139 140 struct tm; 141 size_t wcsftime (wchar_t *__restrict, size_t, const wchar_t *__restrict, const struct tm *__restrict); 142 143 #undef iswdigit 144 145 #if defined(_GNU_SOURCE) 146 wint_t fgetwc_unlocked (FILE *); 147 wint_t getwc_unlocked (FILE *); 148 wint_t getwchar_unlocked (void); 149 wint_t fputwc_unlocked (wchar_t, FILE *); 150 wint_t putwc_unlocked (wchar_t, FILE *); 151 wint_t putwchar_unlocked (wchar_t); 152 wchar_t *fgetws_unlocked (wchar_t *__restrict, int, FILE *__restrict); 153 int fputws_unlocked (const wchar_t *__restrict, FILE *__restrict); 154 #endif 155 156 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) 157 size_t wcsftime_l (wchar_t *__restrict, size_t, const wchar_t *__restrict, const struct tm *__restrict, locale_t); 158 #endif 159 160 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ 161 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) 162 FILE *open_wmemstream(wchar_t **, size_t *); 163 size_t mbsnrtowcs(wchar_t *__restrict, const char **__restrict, size_t, size_t, mbstate_t *__restrict); 164 size_t wcsnrtombs(char *__restrict, const wchar_t **__restrict, size_t, size_t, mbstate_t *__restrict); 165 wchar_t *wcsdup(const wchar_t *); 166 size_t wcsnlen (const wchar_t *, size_t); 167 wchar_t *wcpcpy (wchar_t *__restrict, const wchar_t *__restrict); 168 wchar_t *wcpncpy (wchar_t *__restrict, const wchar_t *__restrict, size_t); 169 int wcscasecmp(const wchar_t *, const wchar_t *); 170 int wcscasecmp_l(const wchar_t *, const wchar_t *, locale_t); 171 int wcsncasecmp(const wchar_t *, const wchar_t *, size_t); 172 int wcsncasecmp_l(const wchar_t *, const wchar_t *, size_t, locale_t); 173 int wcscoll_l(const wchar_t *, const wchar_t *, locale_t); 174 size_t wcsxfrm_l(wchar_t *__restrict, const wchar_t *__restrict, size_t, locale_t); 175 #endif 176 177 #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) 178 int wcwidth (wchar_t); 179 int wcswidth (const wchar_t *, size_t); 180 int iswalnum(wint_t); 181 int iswalpha(wint_t); 182 int iswblank(wint_t); 183 int iswcntrl(wint_t); 184 int iswdigit(wint_t); 185 int iswgraph(wint_t); 186 int iswlower(wint_t); 187 int iswprint(wint_t); 188 int iswpunct(wint_t); 189 int iswspace(wint_t); 190 int iswupper(wint_t); 191 int iswxdigit(wint_t); 192 int iswctype(wint_t, wctype_t); 193 wint_t towlower(wint_t); 194 wint_t towupper(wint_t); 195 wctype_t wctype(const char *); 196 197 #ifndef __cplusplus 198 #undef iswdigit 199 #define iswdigit(a) (0 ? iswdigit(a) : ((unsigned)(a)-'0') < 10) 200 #endif 201 #endif 202 203 #ifdef __cplusplus 204 } 205 #endif 206 207 #endif 208