blob: 88eb55b18cc1ff04819adb40f75fb8c33d860af8 [file] [log] [blame]
Rich Felker0b44a032011-02-12 00:22:29 -05001#ifndef _WCHAR_H
2#define _WCHAR_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
Rich Felkerc1a96582012-09-07 23:13:55 -04008#include <features.h>
Rich Felker400c5e52012-09-06 22:44:55 -04009
Rich Felker0b44a032011-02-12 00:22:29 -050010#define __NEED_FILE
Rich Felkera3e2f3c2013-06-25 22:26:20 -040011#define __NEED___isoc_va_list
Rich Felker0b44a032011-02-12 00:22:29 -050012#define __NEED_size_t
13#define __NEED_wchar_t
14#define __NEED_wint_t
Rich Felkerab9672a2014-10-13 20:59:42 -040015#define __NEED_mbstate_t
Rich Felkerc247ebd2011-02-14 19:33:11 -050016
Rich Felkerf368d9f2019-03-12 15:24:00 -040017#if __STDC_VERSION__ < 201112L
18#define __NEED_struct__IO_FILE
19#endif
20
Rich Felkere0614f72012-03-01 23:24:45 -050021#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
Rich Felker2e5dfa52013-08-02 18:14:44 -040022 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
Rich Felkere0614f72012-03-01 23:24:45 -050023#define __NEED_locale_t
Rich Felkera3e2f3c2013-06-25 22:26:20 -040024#define __NEED_va_list
Rich Felkere0614f72012-03-01 23:24:45 -050025#endif
26
Rich Felker2e5dfa52013-08-02 18:14:44 -040027#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
Rich Felker0b44a032011-02-12 00:22:29 -050028#define __NEED_wctype_t
Rich Felkerc247ebd2011-02-14 19:33:11 -050029#endif
Rich Felker0b44a032011-02-12 00:22:29 -050030
31#include <bits/alltypes.h>
32
Rich Felkerc7af2712013-04-04 19:57:23 -040033#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 Felker224c7a32011-09-19 17:39:51 -040040
Rich Felkerc8a9c222013-11-24 21:42:55 -050041#ifdef __cplusplus
Rich Felker41d7c772013-01-18 20:35:26 -050042#define NULL 0L
Rich Felkerc8a9c222013-11-24 21:42:55 -050043#else
44#define NULL ((void*)0)
45#endif
Rich Felker0b44a032011-02-12 00:22:29 -050046
Rich Felker0b44a032011-02-12 00:22:29 -050047#undef WEOF
Rich Felkerc4dd0c92013-07-22 13:05:41 -040048#define WEOF 0xffffffffU
Rich Felker0b44a032011-02-12 00:22:29 -050049
Rich Felker400c5e52012-09-06 22:44:55 -040050wchar_t *wcscpy (wchar_t *__restrict, const wchar_t *__restrict);
51wchar_t *wcsncpy (wchar_t *__restrict, const wchar_t *__restrict, size_t);
Rich Felker0b44a032011-02-12 00:22:29 -050052
Rich Felker400c5e52012-09-06 22:44:55 -040053wchar_t *wcscat (wchar_t *__restrict, const wchar_t *__restrict);
54wchar_t *wcsncat (wchar_t *__restrict, const wchar_t *__restrict, size_t);
Rich Felker0b44a032011-02-12 00:22:29 -050055
56int wcscmp (const wchar_t *, const wchar_t *);
57int wcsncmp (const wchar_t *, const wchar_t *, size_t);
58
Rich Felker1c1aa322011-03-29 18:30:27 -040059int wcscoll(const wchar_t *, const wchar_t *);
Rich Felker2ed4e9d2016-10-20 17:04:37 -040060size_t wcsxfrm (wchar_t *__restrict, const wchar_t *__restrict, size_t);
Rich Felker0b44a032011-02-12 00:22:29 -050061
62wchar_t *wcschr (const wchar_t *, wchar_t);
63wchar_t *wcsrchr (const wchar_t *, wchar_t);
64
65size_t wcscspn (const wchar_t *, const wchar_t *);
66size_t wcsspn (const wchar_t *, const wchar_t *);
67wchar_t *wcspbrk (const wchar_t *, const wchar_t *);
68
Rich Felker400c5e52012-09-06 22:44:55 -040069wchar_t *wcstok (wchar_t *__restrict, const wchar_t *__restrict, wchar_t **__restrict);
Rich Felker0b44a032011-02-12 00:22:29 -050070
71size_t wcslen (const wchar_t *);
72
Rich Felker400c5e52012-09-06 22:44:55 -040073wchar_t *wcsstr (const wchar_t *__restrict, const wchar_t *__restrict);
Rich Felker0b44a032011-02-12 00:22:29 -050074wchar_t *wcswcs (const wchar_t *, const wchar_t *);
75
76wchar_t *wmemchr (const wchar_t *, wchar_t, size_t);
77int wmemcmp (const wchar_t *, const wchar_t *, size_t);
Rich Felker400c5e52012-09-06 22:44:55 -040078wchar_t *wmemcpy (wchar_t *__restrict, const wchar_t *__restrict, size_t);
Rich Felker0b44a032011-02-12 00:22:29 -050079wchar_t *wmemmove (wchar_t *, const wchar_t *, size_t);
80wchar_t *wmemset (wchar_t *, wchar_t, size_t);
81
82wint_t btowc (int);
83int wctob (wint_t);
84
85int mbsinit (const mbstate_t *);
Rich Felker400c5e52012-09-06 22:44:55 -040086size_t mbrtowc (wchar_t *__restrict, const char *__restrict, size_t, mbstate_t *__restrict);
87size_t wcrtomb (char *__restrict, wchar_t, mbstate_t *__restrict);
Rich Felker0b44a032011-02-12 00:22:29 -050088
Rich Felker400c5e52012-09-06 22:44:55 -040089size_t mbrlen (const char *__restrict, size_t, mbstate_t *__restrict);
Rich Felker0b44a032011-02-12 00:22:29 -050090
Rich Felker400c5e52012-09-06 22:44:55 -040091size_t mbsrtowcs (wchar_t *__restrict, const char **__restrict, size_t, mbstate_t *__restrict);
92size_t wcsrtombs (char *__restrict, const wchar_t **__restrict, size_t, mbstate_t *__restrict);
Rich Felker0b44a032011-02-12 00:22:29 -050093
Rich Felker400c5e52012-09-06 22:44:55 -040094float wcstof (const wchar_t *__restrict, wchar_t **__restrict);
95double wcstod (const wchar_t *__restrict, wchar_t **__restrict);
96long double wcstold (const wchar_t *__restrict, wchar_t **__restrict);
Rich Felker0b44a032011-02-12 00:22:29 -050097
Rich Felker400c5e52012-09-06 22:44:55 -040098long wcstol (const wchar_t *__restrict, wchar_t **__restrict, int);
99unsigned long wcstoul (const wchar_t *__restrict, wchar_t **__restrict, int);
Rich Felker0b44a032011-02-12 00:22:29 -0500100
Rich Felker400c5e52012-09-06 22:44:55 -0400101long long wcstoll (const wchar_t *__restrict, wchar_t **__restrict, int);
102unsigned long long wcstoull (const wchar_t *__restrict, wchar_t **__restrict, int);
Rich Felker0b44a032011-02-12 00:22:29 -0500103
104
105
106int fwide (FILE *, int);
107
108
Rich Felker400c5e52012-09-06 22:44:55 -0400109int wprintf (const wchar_t *__restrict, ...);
110int fwprintf (FILE *__restrict, const wchar_t *__restrict, ...);
111int swprintf (wchar_t *__restrict, size_t, const wchar_t *__restrict, ...);
Rich Felker0b44a032011-02-12 00:22:29 -0500112
Rich Felkera3e2f3c2013-06-25 22:26:20 -0400113int vwprintf (const wchar_t *__restrict, __isoc_va_list);
114int vfwprintf (FILE *__restrict, const wchar_t *__restrict, __isoc_va_list);
115int vswprintf (wchar_t *__restrict, size_t, const wchar_t *__restrict, __isoc_va_list);
Rich Felker0b44a032011-02-12 00:22:29 -0500116
Rich Felker400c5e52012-09-06 22:44:55 -0400117int wscanf (const wchar_t *__restrict, ...);
118int fwscanf (FILE *__restrict, const wchar_t *__restrict, ...);
119int swscanf (const wchar_t *__restrict, const wchar_t *__restrict, ...);
Rich Felker0b44a032011-02-12 00:22:29 -0500120
Rich Felkera3e2f3c2013-06-25 22:26:20 -0400121int vwscanf (const wchar_t *__restrict, __isoc_va_list);
122int vfwscanf (FILE *__restrict, const wchar_t *__restrict, __isoc_va_list);
123int vswscanf (const wchar_t *__restrict, const wchar_t *__restrict, __isoc_va_list);
Rich Felker0b44a032011-02-12 00:22:29 -0500124
125wint_t fgetwc (FILE *);
126wint_t getwc (FILE *);
127wint_t getwchar (void);
128
129wint_t fputwc (wchar_t, FILE *);
130wint_t putwc (wchar_t, FILE *);
131wint_t putwchar (wchar_t);
132
Rich Felker400c5e52012-09-06 22:44:55 -0400133wchar_t *fgetws (wchar_t *__restrict, int, FILE *__restrict);
134int fputws (const wchar_t *__restrict, FILE *__restrict);
Rich Felker0b44a032011-02-12 00:22:29 -0500135
136wint_t ungetwc (wint_t, FILE *);
137
138struct tm;
Rich Felker400c5e52012-09-06 22:44:55 -0400139size_t wcsftime (wchar_t *__restrict, size_t, const wchar_t *__restrict, const struct tm *__restrict);
Rich Felker0b44a032011-02-12 00:22:29 -0500140
141#undef iswdigit
142
Daniel Sabogal5505f6a2016-09-09 21:23:17 -0400143#if defined(_GNU_SOURCE)
144wint_t fgetwc_unlocked (FILE *);
145wint_t getwc_unlocked (FILE *);
146wint_t getwchar_unlocked (void);
147wint_t fputwc_unlocked (wchar_t, FILE *);
148wint_t putwc_unlocked (wchar_t, FILE *);
149wint_t putwchar_unlocked (wchar_t);
150wchar_t *fgetws_unlocked (wchar_t *__restrict, int, FILE *__restrict);
151int fputws_unlocked (const wchar_t *__restrict, FILE *__restrict);
152#endif
153
154#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
155size_t wcsftime_l (wchar_t *__restrict, size_t, const wchar_t *__restrict, const struct tm *__restrict, locale_t);
156#endif
157
Rich Felkerc74d3062011-05-30 13:32:40 -0400158#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
Rich Felker2e5dfa52013-08-02 18:14:44 -0400159 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
Rich Felker1461e022011-09-03 19:49:46 -0400160FILE *open_wmemstream(wchar_t **, size_t *);
Rich Felker400c5e52012-09-06 22:44:55 -0400161size_t mbsnrtowcs(wchar_t *__restrict, const char **__restrict, size_t, size_t, mbstate_t *__restrict);
162size_t wcsnrtombs(char *__restrict, const wchar_t **__restrict, size_t, size_t, mbstate_t *__restrict);
Rich Felkere0614f72012-03-01 23:24:45 -0500163wchar_t *wcsdup(const wchar_t *);
164size_t wcsnlen (const wchar_t *, size_t);
Rich Felker400c5e52012-09-06 22:44:55 -0400165wchar_t *wcpcpy (wchar_t *__restrict, const wchar_t *__restrict);
166wchar_t *wcpncpy (wchar_t *__restrict, const wchar_t *__restrict, size_t);
Rich Felkere0614f72012-03-01 23:24:45 -0500167int wcscasecmp(const wchar_t *, const wchar_t *);
168int wcscasecmp_l(const wchar_t *, const wchar_t *, locale_t);
169int wcsncasecmp(const wchar_t *, const wchar_t *, size_t);
170int wcsncasecmp_l(const wchar_t *, const wchar_t *, size_t, locale_t);
171int wcscoll_l(const wchar_t *, const wchar_t *, locale_t);
Rich Felker2ed4e9d2016-10-20 17:04:37 -0400172size_t wcsxfrm_l(wchar_t *__restrict, const wchar_t *__restrict, size_t, locale_t);
Rich Felkerc74d3062011-05-30 13:32:40 -0400173#endif
174
Rich Felker2e5dfa52013-08-02 18:14:44 -0400175#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
Rich Felkerc247ebd2011-02-14 19:33:11 -0500176int wcwidth (wchar_t);
177int wcswidth (const wchar_t *, size_t);
Rich Felker0b44a032011-02-12 00:22:29 -0500178int iswalnum(wint_t);
179int iswalpha(wint_t);
180int iswblank(wint_t);
181int iswcntrl(wint_t);
182int iswdigit(wint_t);
183int iswgraph(wint_t);
184int iswlower(wint_t);
185int iswprint(wint_t);
186int iswpunct(wint_t);
187int iswspace(wint_t);
188int iswupper(wint_t);
189int iswxdigit(wint_t);
190int iswctype(wint_t, wctype_t);
191wint_t towlower(wint_t);
192wint_t towupper(wint_t);
193wctype_t wctype(const char *);
Rich Felkera60457c2014-10-14 12:30:50 -0400194
195#ifndef __cplusplus
Rich Felkerc247ebd2011-02-14 19:33:11 -0500196#undef iswdigit
Rich Felkerd0040e22015-05-02 21:17:19 -0400197#define iswdigit(a) (0 ? iswdigit(a) : ((unsigned)(a)-'0') < 10)
Rich Felkerc247ebd2011-02-14 19:33:11 -0500198#endif
Rich Felkera60457c2014-10-14 12:30:50 -0400199#endif
Rich Felker0b44a032011-02-12 00:22:29 -0500200
201#ifdef __cplusplus
202}
203#endif
204
205#endif