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 | c247ebd | 2011-02-14 19:33:11 -0500 | [diff] [blame] | 15 | |
Rich Felker | e0614f7 | 2012-03-01 23:24:45 -0500 | [diff] [blame] | 16 | #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ |
| 17 | || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) |
| 18 | #define __NEED_locale_t |
Rich Felker | a3e2f3c | 2013-06-25 22:26:20 -0400 | [diff] [blame^] | 19 | #define __NEED_va_list |
Rich Felker | e0614f7 | 2012-03-01 23:24:45 -0500 | [diff] [blame] | 20 | #endif |
| 21 | |
Rich Felker | c247ebd | 2011-02-14 19:33:11 -0500 | [diff] [blame] | 22 | #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 23 | #define __NEED_wctype_t |
Rich Felker | c247ebd | 2011-02-14 19:33:11 -0500 | [diff] [blame] | 24 | #endif |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 25 | |
| 26 | #include <bits/alltypes.h> |
| 27 | |
Rich Felker | c7af271 | 2013-04-04 19:57:23 -0400 | [diff] [blame] | 28 | #if L'\0'-1 > 0 |
| 29 | #define WCHAR_MAX (0xffffffffu+L'\0') |
| 30 | #define WCHAR_MIN (0+L'\0') |
| 31 | #else |
| 32 | #define WCHAR_MAX (0x7fffffff+L'\0') |
| 33 | #define WCHAR_MIN (-1-0x7fffffff+L'\0') |
| 34 | #endif |
Rich Felker | 224c7a3 | 2011-09-19 17:39:51 -0400 | [diff] [blame] | 35 | |
Rich Felker | 41d7c77 | 2013-01-18 20:35:26 -0500 | [diff] [blame] | 36 | #define NULL 0L |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 37 | |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 38 | #undef WEOF |
| 39 | #define WEOF (-1) |
| 40 | |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 41 | typedef struct |
| 42 | { |
| 43 | unsigned __opaque1, __opaque2; |
| 44 | } mbstate_t; |
| 45 | |
Rich Felker | 400c5e5 | 2012-09-06 22:44:55 -0400 | [diff] [blame] | 46 | wchar_t *wcscpy (wchar_t *__restrict, const wchar_t *__restrict); |
| 47 | wchar_t *wcsncpy (wchar_t *__restrict, const wchar_t *__restrict, size_t); |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 48 | |
Rich Felker | 400c5e5 | 2012-09-06 22:44:55 -0400 | [diff] [blame] | 49 | wchar_t *wcscat (wchar_t *__restrict, const wchar_t *__restrict); |
| 50 | wchar_t *wcsncat (wchar_t *__restrict, const wchar_t *__restrict, size_t); |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 51 | |
| 52 | int wcscmp (const wchar_t *, const wchar_t *); |
| 53 | int wcsncmp (const wchar_t *, const wchar_t *, size_t); |
| 54 | |
Rich Felker | 1c1aa32 | 2011-03-29 18:30:27 -0400 | [diff] [blame] | 55 | int wcscoll(const wchar_t *, const wchar_t *); |
Rich Felker | 400c5e5 | 2012-09-06 22:44:55 -0400 | [diff] [blame] | 56 | size_t wcsxfrm (wchar_t *__restrict, const wchar_t *__restrict, size_t n); |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 57 | |
| 58 | wchar_t *wcschr (const wchar_t *, wchar_t); |
| 59 | wchar_t *wcsrchr (const wchar_t *, wchar_t); |
| 60 | |
| 61 | size_t wcscspn (const wchar_t *, const wchar_t *); |
| 62 | size_t wcsspn (const wchar_t *, const wchar_t *); |
| 63 | wchar_t *wcspbrk (const wchar_t *, const wchar_t *); |
| 64 | |
Rich Felker | 400c5e5 | 2012-09-06 22:44:55 -0400 | [diff] [blame] | 65 | 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] | 66 | |
| 67 | size_t wcslen (const wchar_t *); |
| 68 | |
Rich Felker | 400c5e5 | 2012-09-06 22:44:55 -0400 | [diff] [blame] | 69 | wchar_t *wcsstr (const wchar_t *__restrict, const wchar_t *__restrict); |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 70 | wchar_t *wcswcs (const wchar_t *, const wchar_t *); |
| 71 | |
| 72 | wchar_t *wmemchr (const wchar_t *, wchar_t, size_t); |
| 73 | int wmemcmp (const wchar_t *, const wchar_t *, size_t); |
Rich Felker | 400c5e5 | 2012-09-06 22:44:55 -0400 | [diff] [blame] | 74 | wchar_t *wmemcpy (wchar_t *__restrict, const wchar_t *__restrict, size_t); |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 75 | wchar_t *wmemmove (wchar_t *, const wchar_t *, size_t); |
| 76 | wchar_t *wmemset (wchar_t *, wchar_t, size_t); |
| 77 | |
| 78 | wint_t btowc (int); |
| 79 | int wctob (wint_t); |
| 80 | |
| 81 | int mbsinit (const mbstate_t *); |
Rich Felker | 400c5e5 | 2012-09-06 22:44:55 -0400 | [diff] [blame] | 82 | size_t mbrtowc (wchar_t *__restrict, const char *__restrict, size_t, mbstate_t *__restrict); |
| 83 | size_t wcrtomb (char *__restrict, wchar_t, mbstate_t *__restrict); |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 84 | |
Rich Felker | 400c5e5 | 2012-09-06 22:44:55 -0400 | [diff] [blame] | 85 | size_t mbrlen (const char *__restrict, size_t, mbstate_t *__restrict); |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 86 | |
Rich Felker | 400c5e5 | 2012-09-06 22:44:55 -0400 | [diff] [blame] | 87 | size_t mbsrtowcs (wchar_t *__restrict, const char **__restrict, size_t, mbstate_t *__restrict); |
| 88 | 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] | 89 | |
Rich Felker | 400c5e5 | 2012-09-06 22:44:55 -0400 | [diff] [blame] | 90 | float wcstof (const wchar_t *__restrict, wchar_t **__restrict); |
| 91 | double wcstod (const wchar_t *__restrict, wchar_t **__restrict); |
| 92 | long double wcstold (const wchar_t *__restrict, wchar_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 | long wcstol (const wchar_t *__restrict, wchar_t **__restrict, int); |
| 95 | unsigned long wcstoul (const wchar_t *__restrict, wchar_t **__restrict, int); |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 96 | |
Rich Felker | 400c5e5 | 2012-09-06 22:44:55 -0400 | [diff] [blame] | 97 | long long wcstoll (const wchar_t *__restrict, wchar_t **__restrict, int); |
| 98 | unsigned long long wcstoull (const wchar_t *__restrict, wchar_t **__restrict, int); |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 99 | |
| 100 | |
| 101 | |
| 102 | int fwide (FILE *, int); |
| 103 | |
| 104 | |
Rich Felker | 400c5e5 | 2012-09-06 22:44:55 -0400 | [diff] [blame] | 105 | int wprintf (const wchar_t *__restrict, ...); |
| 106 | int fwprintf (FILE *__restrict, const wchar_t *__restrict, ...); |
| 107 | int swprintf (wchar_t *__restrict, size_t, const wchar_t *__restrict, ...); |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 108 | |
Rich Felker | a3e2f3c | 2013-06-25 22:26:20 -0400 | [diff] [blame^] | 109 | int vwprintf (const wchar_t *__restrict, __isoc_va_list); |
| 110 | int vfwprintf (FILE *__restrict, const wchar_t *__restrict, __isoc_va_list); |
| 111 | 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] | 112 | |
Rich Felker | 400c5e5 | 2012-09-06 22:44:55 -0400 | [diff] [blame] | 113 | int wscanf (const wchar_t *__restrict, ...); |
| 114 | int fwscanf (FILE *__restrict, const wchar_t *__restrict, ...); |
| 115 | int swscanf (const wchar_t *__restrict, const wchar_t *__restrict, ...); |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 116 | |
Rich Felker | a3e2f3c | 2013-06-25 22:26:20 -0400 | [diff] [blame^] | 117 | int vwscanf (const wchar_t *__restrict, __isoc_va_list); |
| 118 | int vfwscanf (FILE *__restrict, const wchar_t *__restrict, __isoc_va_list); |
| 119 | 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] | 120 | |
| 121 | wint_t fgetwc (FILE *); |
| 122 | wint_t getwc (FILE *); |
| 123 | wint_t getwchar (void); |
| 124 | |
| 125 | wint_t fputwc (wchar_t, FILE *); |
| 126 | wint_t putwc (wchar_t, FILE *); |
| 127 | wint_t putwchar (wchar_t); |
| 128 | |
Rich Felker | 400c5e5 | 2012-09-06 22:44:55 -0400 | [diff] [blame] | 129 | wchar_t *fgetws (wchar_t *__restrict, int, FILE *__restrict); |
| 130 | int fputws (const wchar_t *__restrict, FILE *__restrict); |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 131 | |
| 132 | wint_t ungetwc (wint_t, FILE *); |
| 133 | |
| 134 | struct tm; |
Rich Felker | 400c5e5 | 2012-09-06 22:44:55 -0400 | [diff] [blame] | 135 | 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] | 136 | |
| 137 | #undef iswdigit |
| 138 | |
Rich Felker | c74d306 | 2011-05-30 13:32:40 -0400 | [diff] [blame] | 139 | #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ |
| 140 | || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) |
Rich Felker | 1461e02 | 2011-09-03 19:49:46 -0400 | [diff] [blame] | 141 | FILE *open_wmemstream(wchar_t **, size_t *); |
Rich Felker | 400c5e5 | 2012-09-06 22:44:55 -0400 | [diff] [blame] | 142 | size_t mbsnrtowcs(wchar_t *__restrict, const char **__restrict, size_t, size_t, mbstate_t *__restrict); |
| 143 | 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] | 144 | wchar_t *wcsdup(const wchar_t *); |
| 145 | size_t wcsnlen (const wchar_t *, size_t); |
Rich Felker | 400c5e5 | 2012-09-06 22:44:55 -0400 | [diff] [blame] | 146 | wchar_t *wcpcpy (wchar_t *__restrict, const wchar_t *__restrict); |
| 147 | wchar_t *wcpncpy (wchar_t *__restrict, const wchar_t *__restrict, size_t); |
Rich Felker | e0614f7 | 2012-03-01 23:24:45 -0500 | [diff] [blame] | 148 | int wcscasecmp(const wchar_t *, const wchar_t *); |
| 149 | int wcscasecmp_l(const wchar_t *, const wchar_t *, locale_t); |
| 150 | int wcsncasecmp(const wchar_t *, const wchar_t *, size_t); |
| 151 | int wcsncasecmp_l(const wchar_t *, const wchar_t *, size_t, locale_t); |
| 152 | int wcscoll_l(const wchar_t *, const wchar_t *, locale_t); |
Rich Felker | 400c5e5 | 2012-09-06 22:44:55 -0400 | [diff] [blame] | 153 | size_t wcsxfrm_l(wchar_t *__restrict, const wchar_t *__restrict, size_t n, locale_t); |
Rich Felker | c74d306 | 2011-05-30 13:32:40 -0400 | [diff] [blame] | 154 | #endif |
| 155 | |
Rich Felker | c247ebd | 2011-02-14 19:33:11 -0500 | [diff] [blame] | 156 | #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) |
| 157 | int wcwidth (wchar_t); |
| 158 | int wcswidth (const wchar_t *, size_t); |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 159 | int iswalnum(wint_t); |
| 160 | int iswalpha(wint_t); |
| 161 | int iswblank(wint_t); |
| 162 | int iswcntrl(wint_t); |
| 163 | int iswdigit(wint_t); |
| 164 | int iswgraph(wint_t); |
| 165 | int iswlower(wint_t); |
| 166 | int iswprint(wint_t); |
| 167 | int iswpunct(wint_t); |
| 168 | int iswspace(wint_t); |
| 169 | int iswupper(wint_t); |
| 170 | int iswxdigit(wint_t); |
| 171 | int iswctype(wint_t, wctype_t); |
| 172 | wint_t towlower(wint_t); |
| 173 | wint_t towupper(wint_t); |
| 174 | wctype_t wctype(const char *); |
Rich Felker | c247ebd | 2011-02-14 19:33:11 -0500 | [diff] [blame] | 175 | #undef iswdigit |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 176 | #define iswdigit(a) ((unsigned)(a)-'0' < 10) |
Rich Felker | c247ebd | 2011-02-14 19:33:11 -0500 | [diff] [blame] | 177 | #endif |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 178 | |
| 179 | #ifdef __cplusplus |
| 180 | } |
| 181 | #endif |
| 182 | |
| 183 | #endif |