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