blob: 0f1f6d264e997f12ff87566aa76e390a42659f4c [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 Felkerc247ebd2011-02-14 19:33:11 -050015
Rich Felkere0614f72012-03-01 23:24:45 -050016#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
17 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
18#define __NEED_locale_t
Rich Felkera3e2f3c2013-06-25 22:26:20 -040019#define __NEED_va_list
Rich Felkere0614f72012-03-01 23:24:45 -050020#endif
21
Rich Felkerc247ebd2011-02-14 19:33:11 -050022#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
Rich Felker0b44a032011-02-12 00:22:29 -050023#define __NEED_wctype_t
Rich Felkerc247ebd2011-02-14 19:33:11 -050024#endif
Rich Felker0b44a032011-02-12 00:22:29 -050025
26#include <bits/alltypes.h>
27
Rich Felkerc7af2712013-04-04 19:57:23 -040028#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 Felker224c7a32011-09-19 17:39:51 -040035
Rich Felker41d7c772013-01-18 20:35:26 -050036#define NULL 0L
Rich Felker0b44a032011-02-12 00:22:29 -050037
Rich Felker0b44a032011-02-12 00:22:29 -050038#undef WEOF
39#define WEOF (-1)
40
Rich Felker0b44a032011-02-12 00:22:29 -050041typedef struct
42{
43 unsigned __opaque1, __opaque2;
44} mbstate_t;
45
Rich Felker400c5e52012-09-06 22:44:55 -040046wchar_t *wcscpy (wchar_t *__restrict, const wchar_t *__restrict);
47wchar_t *wcsncpy (wchar_t *__restrict, const wchar_t *__restrict, size_t);
Rich Felker0b44a032011-02-12 00:22:29 -050048
Rich Felker400c5e52012-09-06 22:44:55 -040049wchar_t *wcscat (wchar_t *__restrict, const wchar_t *__restrict);
50wchar_t *wcsncat (wchar_t *__restrict, const wchar_t *__restrict, size_t);
Rich Felker0b44a032011-02-12 00:22:29 -050051
52int wcscmp (const wchar_t *, const wchar_t *);
53int wcsncmp (const wchar_t *, const wchar_t *, size_t);
54
Rich Felker1c1aa322011-03-29 18:30:27 -040055int wcscoll(const wchar_t *, const wchar_t *);
Rich Felker400c5e52012-09-06 22:44:55 -040056size_t wcsxfrm (wchar_t *__restrict, const wchar_t *__restrict, size_t n);
Rich Felker0b44a032011-02-12 00:22:29 -050057
58wchar_t *wcschr (const wchar_t *, wchar_t);
59wchar_t *wcsrchr (const wchar_t *, wchar_t);
60
61size_t wcscspn (const wchar_t *, const wchar_t *);
62size_t wcsspn (const wchar_t *, const wchar_t *);
63wchar_t *wcspbrk (const wchar_t *, const wchar_t *);
64
Rich Felker400c5e52012-09-06 22:44:55 -040065wchar_t *wcstok (wchar_t *__restrict, const wchar_t *__restrict, wchar_t **__restrict);
Rich Felker0b44a032011-02-12 00:22:29 -050066
67size_t wcslen (const wchar_t *);
68
Rich Felker400c5e52012-09-06 22:44:55 -040069wchar_t *wcsstr (const wchar_t *__restrict, const wchar_t *__restrict);
Rich Felker0b44a032011-02-12 00:22:29 -050070wchar_t *wcswcs (const wchar_t *, const wchar_t *);
71
72wchar_t *wmemchr (const wchar_t *, wchar_t, size_t);
73int wmemcmp (const wchar_t *, const wchar_t *, size_t);
Rich Felker400c5e52012-09-06 22:44:55 -040074wchar_t *wmemcpy (wchar_t *__restrict, const wchar_t *__restrict, size_t);
Rich Felker0b44a032011-02-12 00:22:29 -050075wchar_t *wmemmove (wchar_t *, const wchar_t *, size_t);
76wchar_t *wmemset (wchar_t *, wchar_t, size_t);
77
78wint_t btowc (int);
79int wctob (wint_t);
80
81int mbsinit (const mbstate_t *);
Rich Felker400c5e52012-09-06 22:44:55 -040082size_t mbrtowc (wchar_t *__restrict, const char *__restrict, size_t, mbstate_t *__restrict);
83size_t wcrtomb (char *__restrict, wchar_t, mbstate_t *__restrict);
Rich Felker0b44a032011-02-12 00:22:29 -050084
Rich Felker400c5e52012-09-06 22:44:55 -040085size_t mbrlen (const char *__restrict, size_t, mbstate_t *__restrict);
Rich Felker0b44a032011-02-12 00:22:29 -050086
Rich Felker400c5e52012-09-06 22:44:55 -040087size_t mbsrtowcs (wchar_t *__restrict, const char **__restrict, size_t, mbstate_t *__restrict);
88size_t wcsrtombs (char *__restrict, const wchar_t **__restrict, size_t, mbstate_t *__restrict);
Rich Felker0b44a032011-02-12 00:22:29 -050089
Rich Felker400c5e52012-09-06 22:44:55 -040090float wcstof (const wchar_t *__restrict, wchar_t **__restrict);
91double wcstod (const wchar_t *__restrict, wchar_t **__restrict);
92long double wcstold (const wchar_t *__restrict, wchar_t **__restrict);
Rich Felker0b44a032011-02-12 00:22:29 -050093
Rich Felker400c5e52012-09-06 22:44:55 -040094long wcstol (const wchar_t *__restrict, wchar_t **__restrict, int);
95unsigned long wcstoul (const wchar_t *__restrict, wchar_t **__restrict, int);
Rich Felker0b44a032011-02-12 00:22:29 -050096
Rich Felker400c5e52012-09-06 22:44:55 -040097long long wcstoll (const wchar_t *__restrict, wchar_t **__restrict, int);
98unsigned long long wcstoull (const wchar_t *__restrict, wchar_t **__restrict, int);
Rich Felker0b44a032011-02-12 00:22:29 -050099
100
101
102int fwide (FILE *, int);
103
104
Rich Felker400c5e52012-09-06 22:44:55 -0400105int wprintf (const wchar_t *__restrict, ...);
106int fwprintf (FILE *__restrict, const wchar_t *__restrict, ...);
107int swprintf (wchar_t *__restrict, size_t, const wchar_t *__restrict, ...);
Rich Felker0b44a032011-02-12 00:22:29 -0500108
Rich Felkera3e2f3c2013-06-25 22:26:20 -0400109int vwprintf (const wchar_t *__restrict, __isoc_va_list);
110int vfwprintf (FILE *__restrict, const wchar_t *__restrict, __isoc_va_list);
111int vswprintf (wchar_t *__restrict, size_t, const wchar_t *__restrict, __isoc_va_list);
Rich Felker0b44a032011-02-12 00:22:29 -0500112
Rich Felker400c5e52012-09-06 22:44:55 -0400113int wscanf (const wchar_t *__restrict, ...);
114int fwscanf (FILE *__restrict, const wchar_t *__restrict, ...);
115int swscanf (const wchar_t *__restrict, const wchar_t *__restrict, ...);
Rich Felker0b44a032011-02-12 00:22:29 -0500116
Rich Felkera3e2f3c2013-06-25 22:26:20 -0400117int vwscanf (const wchar_t *__restrict, __isoc_va_list);
118int vfwscanf (FILE *__restrict, const wchar_t *__restrict, __isoc_va_list);
119int vswscanf (const wchar_t *__restrict, const wchar_t *__restrict, __isoc_va_list);
Rich Felker0b44a032011-02-12 00:22:29 -0500120
121wint_t fgetwc (FILE *);
122wint_t getwc (FILE *);
123wint_t getwchar (void);
124
125wint_t fputwc (wchar_t, FILE *);
126wint_t putwc (wchar_t, FILE *);
127wint_t putwchar (wchar_t);
128
Rich Felker400c5e52012-09-06 22:44:55 -0400129wchar_t *fgetws (wchar_t *__restrict, int, FILE *__restrict);
130int fputws (const wchar_t *__restrict, FILE *__restrict);
Rich Felker0b44a032011-02-12 00:22:29 -0500131
132wint_t ungetwc (wint_t, FILE *);
133
134struct tm;
Rich Felker400c5e52012-09-06 22:44:55 -0400135size_t wcsftime (wchar_t *__restrict, size_t, const wchar_t *__restrict, const struct tm *__restrict);
Rich Felker0b44a032011-02-12 00:22:29 -0500136
137#undef iswdigit
138
Rich Felkerc74d3062011-05-30 13:32:40 -0400139#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
140 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
Rich Felker1461e022011-09-03 19:49:46 -0400141FILE *open_wmemstream(wchar_t **, size_t *);
Rich Felker400c5e52012-09-06 22:44:55 -0400142size_t mbsnrtowcs(wchar_t *__restrict, const char **__restrict, size_t, size_t, mbstate_t *__restrict);
143size_t wcsnrtombs(char *__restrict, const wchar_t **__restrict, size_t, size_t, mbstate_t *__restrict);
Rich Felkere0614f72012-03-01 23:24:45 -0500144wchar_t *wcsdup(const wchar_t *);
145size_t wcsnlen (const wchar_t *, size_t);
Rich Felker400c5e52012-09-06 22:44:55 -0400146wchar_t *wcpcpy (wchar_t *__restrict, const wchar_t *__restrict);
147wchar_t *wcpncpy (wchar_t *__restrict, const wchar_t *__restrict, size_t);
Rich Felkere0614f72012-03-01 23:24:45 -0500148int wcscasecmp(const wchar_t *, const wchar_t *);
149int wcscasecmp_l(const wchar_t *, const wchar_t *, locale_t);
150int wcsncasecmp(const wchar_t *, const wchar_t *, size_t);
151int wcsncasecmp_l(const wchar_t *, const wchar_t *, size_t, locale_t);
152int wcscoll_l(const wchar_t *, const wchar_t *, locale_t);
Rich Felker400c5e52012-09-06 22:44:55 -0400153size_t wcsxfrm_l(wchar_t *__restrict, const wchar_t *__restrict, size_t n, locale_t);
Rich Felkerc74d3062011-05-30 13:32:40 -0400154#endif
155
Rich Felkerc247ebd2011-02-14 19:33:11 -0500156#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
157int wcwidth (wchar_t);
158int wcswidth (const wchar_t *, size_t);
Rich Felker0b44a032011-02-12 00:22:29 -0500159int iswalnum(wint_t);
160int iswalpha(wint_t);
161int iswblank(wint_t);
162int iswcntrl(wint_t);
163int iswdigit(wint_t);
164int iswgraph(wint_t);
165int iswlower(wint_t);
166int iswprint(wint_t);
167int iswpunct(wint_t);
168int iswspace(wint_t);
169int iswupper(wint_t);
170int iswxdigit(wint_t);
171int iswctype(wint_t, wctype_t);
172wint_t towlower(wint_t);
173wint_t towupper(wint_t);
174wctype_t wctype(const char *);
Rich Felkerc247ebd2011-02-14 19:33:11 -0500175#undef iswdigit
Rich Felker0b44a032011-02-12 00:22:29 -0500176#define iswdigit(a) ((unsigned)(a)-'0' < 10)
Rich Felkerc247ebd2011-02-14 19:33:11 -0500177#endif
Rich Felker0b44a032011-02-12 00:22:29 -0500178
179#ifdef __cplusplus
180}
181#endif
182
183#endif