blob: 35706c7ff7abaf796d047ae13a315a5165105a1e [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
11#define __NEED_va_list
12#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
19#endif
20
Rich Felkerc247ebd2011-02-14 19:33:11 -050021#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
Rich Felker0b44a032011-02-12 00:22:29 -050022#define __NEED_wctype_t
Rich Felkerc247ebd2011-02-14 19:33:11 -050023#endif
Rich Felker0b44a032011-02-12 00:22:29 -050024
25#include <bits/alltypes.h>
26
Rich Felker224c7a32011-09-19 17:39:51 -040027#include <bits/wchar.h>
28
Rich Felker0b44a032011-02-12 00:22:29 -050029#undef NULL
Rich Felkerc247ebd2011-02-14 19:33:11 -050030#ifdef __cplusplus
31#define NULL 0
32#else
Rich Felker0b44a032011-02-12 00:22:29 -050033#define NULL ((void*)0)
Rich Felkerc247ebd2011-02-14 19:33:11 -050034#endif
Rich Felker0b44a032011-02-12 00:22:29 -050035
Rich Felker0b44a032011-02-12 00:22:29 -050036#undef WEOF
37#define WEOF (-1)
38
Rich Felker0b44a032011-02-12 00:22:29 -050039typedef struct
40{
41 unsigned __opaque1, __opaque2;
42} mbstate_t;
43
Rich Felker400c5e52012-09-06 22:44:55 -040044wchar_t *wcscpy (wchar_t *__restrict, const wchar_t *__restrict);
45wchar_t *wcsncpy (wchar_t *__restrict, const wchar_t *__restrict, size_t);
Rich Felker0b44a032011-02-12 00:22:29 -050046
Rich Felker400c5e52012-09-06 22:44:55 -040047wchar_t *wcscat (wchar_t *__restrict, const wchar_t *__restrict);
48wchar_t *wcsncat (wchar_t *__restrict, const wchar_t *__restrict, size_t);
Rich Felker0b44a032011-02-12 00:22:29 -050049
50int wcscmp (const wchar_t *, const wchar_t *);
51int wcsncmp (const wchar_t *, const wchar_t *, size_t);
52
Rich Felker1c1aa322011-03-29 18:30:27 -040053int wcscoll(const wchar_t *, const wchar_t *);
Rich Felker400c5e52012-09-06 22:44:55 -040054size_t wcsxfrm (wchar_t *__restrict, const wchar_t *__restrict, size_t n);
Rich Felker0b44a032011-02-12 00:22:29 -050055
56wchar_t *wcschr (const wchar_t *, wchar_t);
57wchar_t *wcsrchr (const wchar_t *, wchar_t);
58
59size_t wcscspn (const wchar_t *, const wchar_t *);
60size_t wcsspn (const wchar_t *, const wchar_t *);
61wchar_t *wcspbrk (const wchar_t *, const wchar_t *);
62
Rich Felker400c5e52012-09-06 22:44:55 -040063wchar_t *wcstok (wchar_t *__restrict, const wchar_t *__restrict, wchar_t **__restrict);
Rich Felker0b44a032011-02-12 00:22:29 -050064
65size_t wcslen (const wchar_t *);
66
Rich Felker400c5e52012-09-06 22:44:55 -040067wchar_t *wcsstr (const wchar_t *__restrict, const wchar_t *__restrict);
Rich Felker0b44a032011-02-12 00:22:29 -050068wchar_t *wcswcs (const wchar_t *, const wchar_t *);
69
70wchar_t *wmemchr (const wchar_t *, wchar_t, size_t);
71int wmemcmp (const wchar_t *, const wchar_t *, size_t);
Rich Felker400c5e52012-09-06 22:44:55 -040072wchar_t *wmemcpy (wchar_t *__restrict, const wchar_t *__restrict, size_t);
Rich Felker0b44a032011-02-12 00:22:29 -050073wchar_t *wmemmove (wchar_t *, const wchar_t *, size_t);
74wchar_t *wmemset (wchar_t *, wchar_t, size_t);
75
76wint_t btowc (int);
77int wctob (wint_t);
78
79int mbsinit (const mbstate_t *);
Rich Felker400c5e52012-09-06 22:44:55 -040080size_t mbrtowc (wchar_t *__restrict, const char *__restrict, size_t, mbstate_t *__restrict);
81size_t wcrtomb (char *__restrict, wchar_t, mbstate_t *__restrict);
Rich Felker0b44a032011-02-12 00:22:29 -050082
Rich Felker400c5e52012-09-06 22:44:55 -040083size_t mbrlen (const char *__restrict, size_t, mbstate_t *__restrict);
Rich Felker0b44a032011-02-12 00:22:29 -050084
Rich Felker400c5e52012-09-06 22:44:55 -040085size_t mbsrtowcs (wchar_t *__restrict, const char **__restrict, size_t, mbstate_t *__restrict);
86size_t wcsrtombs (char *__restrict, const wchar_t **__restrict, size_t, mbstate_t *__restrict);
Rich Felker0b44a032011-02-12 00:22:29 -050087
Rich Felker400c5e52012-09-06 22:44:55 -040088float wcstof (const wchar_t *__restrict, wchar_t **__restrict);
89double wcstod (const wchar_t *__restrict, wchar_t **__restrict);
90long double wcstold (const wchar_t *__restrict, wchar_t **__restrict);
Rich Felker0b44a032011-02-12 00:22:29 -050091
Rich Felker400c5e52012-09-06 22:44:55 -040092long wcstol (const wchar_t *__restrict, wchar_t **__restrict, int);
93unsigned long wcstoul (const wchar_t *__restrict, wchar_t **__restrict, int);
Rich Felker0b44a032011-02-12 00:22:29 -050094
Rich Felker400c5e52012-09-06 22:44:55 -040095long long wcstoll (const wchar_t *__restrict, wchar_t **__restrict, int);
96unsigned long long wcstoull (const wchar_t *__restrict, wchar_t **__restrict, int);
Rich Felker0b44a032011-02-12 00:22:29 -050097
98
99
100int fwide (FILE *, int);
101
102
Rich Felker400c5e52012-09-06 22:44:55 -0400103int wprintf (const wchar_t *__restrict, ...);
104int fwprintf (FILE *__restrict, const wchar_t *__restrict, ...);
105int swprintf (wchar_t *__restrict, size_t, const wchar_t *__restrict, ...);
Rich Felker0b44a032011-02-12 00:22:29 -0500106
Rich Felker400c5e52012-09-06 22:44:55 -0400107int vwprintf (const wchar_t *__restrict, va_list);
108int vfwprintf (FILE *__restrict, const wchar_t *__restrict, va_list);
109int vswprintf (wchar_t *__restrict, size_t, const wchar_t *__restrict, va_list);
Rich Felker0b44a032011-02-12 00:22:29 -0500110
Rich Felker400c5e52012-09-06 22:44:55 -0400111int wscanf (const wchar_t *__restrict, ...);
112int fwscanf (FILE *__restrict, const wchar_t *__restrict, ...);
113int swscanf (const wchar_t *__restrict, const wchar_t *__restrict, ...);
Rich Felker0b44a032011-02-12 00:22:29 -0500114
Rich Felker400c5e52012-09-06 22:44:55 -0400115int vwscanf (const wchar_t *__restrict, va_list);
116int vfwscanf (FILE *__restrict, const wchar_t *__restrict, va_list);
117int vswscanf (const wchar_t *__restrict, const wchar_t *__restrict, va_list);
Rich Felker0b44a032011-02-12 00:22:29 -0500118
119wint_t fgetwc (FILE *);
120wint_t getwc (FILE *);
121wint_t getwchar (void);
122
123wint_t fputwc (wchar_t, FILE *);
124wint_t putwc (wchar_t, FILE *);
125wint_t putwchar (wchar_t);
126
Rich Felker400c5e52012-09-06 22:44:55 -0400127wchar_t *fgetws (wchar_t *__restrict, int, FILE *__restrict);
128int fputws (const wchar_t *__restrict, FILE *__restrict);
Rich Felker0b44a032011-02-12 00:22:29 -0500129
130wint_t ungetwc (wint_t, FILE *);
131
132struct tm;
Rich Felker400c5e52012-09-06 22:44:55 -0400133size_t wcsftime (wchar_t *__restrict, size_t, const wchar_t *__restrict, const struct tm *__restrict);
Rich Felker0b44a032011-02-12 00:22:29 -0500134
135#undef iswdigit
136
Rich Felkerc74d3062011-05-30 13:32:40 -0400137#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
138 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
Rich Felker1461e022011-09-03 19:49:46 -0400139FILE *open_wmemstream(wchar_t **, size_t *);
Rich Felker400c5e52012-09-06 22:44:55 -0400140size_t mbsnrtowcs(wchar_t *__restrict, const char **__restrict, size_t, size_t, mbstate_t *__restrict);
141size_t wcsnrtombs(char *__restrict, const wchar_t **__restrict, size_t, size_t, mbstate_t *__restrict);
Rich Felkere0614f72012-03-01 23:24:45 -0500142wchar_t *wcsdup(const wchar_t *);
143size_t wcsnlen (const wchar_t *, size_t);
Rich Felker400c5e52012-09-06 22:44:55 -0400144wchar_t *wcpcpy (wchar_t *__restrict, const wchar_t *__restrict);
145wchar_t *wcpncpy (wchar_t *__restrict, const wchar_t *__restrict, size_t);
Rich Felkere0614f72012-03-01 23:24:45 -0500146int wcscasecmp(const wchar_t *, const wchar_t *);
147int wcscasecmp_l(const wchar_t *, const wchar_t *, locale_t);
148int wcsncasecmp(const wchar_t *, const wchar_t *, size_t);
149int wcsncasecmp_l(const wchar_t *, const wchar_t *, size_t, locale_t);
150int wcscoll_l(const wchar_t *, const wchar_t *, locale_t);
Rich Felker400c5e52012-09-06 22:44:55 -0400151size_t wcsxfrm_l(wchar_t *__restrict, const wchar_t *__restrict, size_t n, locale_t);
Rich Felkerc74d3062011-05-30 13:32:40 -0400152#endif
153
Rich Felkerc247ebd2011-02-14 19:33:11 -0500154#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
155int wcwidth (wchar_t);
156int wcswidth (const wchar_t *, size_t);
Rich Felker0b44a032011-02-12 00:22:29 -0500157int iswalnum(wint_t);
158int iswalpha(wint_t);
159int iswblank(wint_t);
160int iswcntrl(wint_t);
161int iswdigit(wint_t);
162int iswgraph(wint_t);
163int iswlower(wint_t);
164int iswprint(wint_t);
165int iswpunct(wint_t);
166int iswspace(wint_t);
167int iswupper(wint_t);
168int iswxdigit(wint_t);
169int iswctype(wint_t, wctype_t);
170wint_t towlower(wint_t);
171wint_t towupper(wint_t);
172wctype_t wctype(const char *);
Rich Felkerc247ebd2011-02-14 19:33:11 -0500173#undef iswdigit
Rich Felker0b44a032011-02-12 00:22:29 -0500174#define iswdigit(a) ((unsigned)(a)-'0' < 10)
Rich Felkerc247ebd2011-02-14 19:33:11 -0500175#endif
Rich Felker0b44a032011-02-12 00:22:29 -0500176
177#ifdef __cplusplus
178}
179#endif
180
181#endif