blob: 12ddd4f49a632cc7a5b7bace935258a522be9615 [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
8#define __NEED_FILE
9#define __NEED_va_list
10#define __NEED_size_t
11#define __NEED_wchar_t
12#define __NEED_wint_t
Rich Felkerc247ebd2011-02-14 19:33:11 -050013
Rich Felkere0614f72012-03-01 23:24:45 -050014#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
15 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
16#define __NEED_locale_t
17#endif
18
Rich Felkerc247ebd2011-02-14 19:33:11 -050019#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
Rich Felker0b44a032011-02-12 00:22:29 -050020#define __NEED_wctype_t
Rich Felkerc247ebd2011-02-14 19:33:11 -050021#endif
Rich Felker0b44a032011-02-12 00:22:29 -050022
23#include <bits/alltypes.h>
24
Rich Felker224c7a32011-09-19 17:39:51 -040025#include <bits/wchar.h>
26
Rich Felker0b44a032011-02-12 00:22:29 -050027#undef NULL
Rich Felkerc247ebd2011-02-14 19:33:11 -050028#ifdef __cplusplus
29#define NULL 0
30#else
Rich Felker0b44a032011-02-12 00:22:29 -050031#define NULL ((void*)0)
Rich Felkerc247ebd2011-02-14 19:33:11 -050032#endif
Rich Felker0b44a032011-02-12 00:22:29 -050033
Rich Felker0b44a032011-02-12 00:22:29 -050034#undef WEOF
35#define WEOF (-1)
36
Rich Felker0b44a032011-02-12 00:22:29 -050037typedef struct
38{
39 unsigned __opaque1, __opaque2;
40} mbstate_t;
41
42wchar_t *wcscpy (wchar_t *, const wchar_t *);
43wchar_t *wcsncpy (wchar_t *, const wchar_t *, size_t);
44
45wchar_t *wcscat (wchar_t *, const wchar_t *);
46wchar_t *wcsncat (wchar_t *, const wchar_t *, size_t);
47
48int wcscmp (const wchar_t *, const wchar_t *);
49int wcsncmp (const wchar_t *, const wchar_t *, size_t);
50
Rich Felker1c1aa322011-03-29 18:30:27 -040051int wcscoll(const wchar_t *, const wchar_t *);
Rich Felker0b44a032011-02-12 00:22:29 -050052size_t wcsxfrm (wchar_t *, const wchar_t *, size_t n);
53
54wchar_t *wcschr (const wchar_t *, wchar_t);
55wchar_t *wcsrchr (const wchar_t *, wchar_t);
56
57size_t wcscspn (const wchar_t *, const wchar_t *);
58size_t wcsspn (const wchar_t *, const wchar_t *);
59wchar_t *wcspbrk (const wchar_t *, const wchar_t *);
60
61wchar_t *wcstok (wchar_t *, const wchar_t *, wchar_t **);
62
63size_t wcslen (const wchar_t *);
64
65wchar_t *wcsstr (const wchar_t *, const wchar_t *);
66wchar_t *wcswcs (const wchar_t *, const wchar_t *);
67
68wchar_t *wmemchr (const wchar_t *, wchar_t, size_t);
69int wmemcmp (const wchar_t *, const wchar_t *, size_t);
70wchar_t *wmemcpy (wchar_t *, const wchar_t *, size_t);
71wchar_t *wmemmove (wchar_t *, const wchar_t *, size_t);
72wchar_t *wmemset (wchar_t *, wchar_t, size_t);
73
74wint_t btowc (int);
75int wctob (wint_t);
76
77int mbsinit (const mbstate_t *);
78size_t mbrtowc (wchar_t *, const char *, size_t, mbstate_t *);
79size_t wcrtomb (char *, wchar_t, mbstate_t *);
80
81size_t mbrlen (const char *, size_t, mbstate_t *);
82
83size_t mbsrtowcs (wchar_t *, const char **, size_t, mbstate_t *);
84size_t wcsrtombs (char *, const wchar_t **, size_t, mbstate_t *);
85
Rich Felker0b44a032011-02-12 00:22:29 -050086float wcstof (const wchar_t *, wchar_t **);
87double wcstod (const wchar_t *, wchar_t **);
88long double wcstold (const wchar_t *, wchar_t **);
89
90long wcstol (const wchar_t *, wchar_t **, int);
91unsigned long wcstoul (const wchar_t *, wchar_t **, int);
92
93long long wcstoll (const wchar_t *, wchar_t **, int);
94unsigned long long wcstoull (const wchar_t *, wchar_t **, int);
95
96
97
98int fwide (FILE *, int);
99
100
101int wprintf (const wchar_t *, ...);
102int fwprintf (FILE *, const wchar_t *, ...);
Rich Felkere18b5632011-03-18 09:19:09 -0400103int swprintf (wchar_t *, size_t, const wchar_t *, ...);
Rich Felker0b44a032011-02-12 00:22:29 -0500104
105int vwprintf (const wchar_t *, va_list);
106int vfwprintf (FILE *, const wchar_t *, va_list);
Rich Felkere18b5632011-03-18 09:19:09 -0400107int vswprintf (wchar_t *, size_t, const wchar_t *, va_list);
Rich Felker0b44a032011-02-12 00:22:29 -0500108
109int wscanf (const wchar_t *, ...);
110int fwscanf (FILE *, const wchar_t *, ...);
111int swscanf (const wchar_t *, const wchar_t *, ...);
112
113int vwscanf (const wchar_t *, va_list);
114int vfwscanf (FILE *, const wchar_t *, va_list);
115int vswscanf (const wchar_t *, const wchar_t *, va_list);
116
117wint_t fgetwc (FILE *);
118wint_t getwc (FILE *);
119wint_t getwchar (void);
120
121wint_t fputwc (wchar_t, FILE *);
122wint_t putwc (wchar_t, FILE *);
123wint_t putwchar (wchar_t);
124
125wchar_t *fgetws (wchar_t *, int, FILE *);
126int fputws (const wchar_t *, FILE *);
127
128wint_t ungetwc (wint_t, FILE *);
129
130struct tm;
131size_t wcsftime (wchar_t *, size_t, const wchar_t *, const struct tm *);
132
133#undef iswdigit
134
Rich Felkerc74d3062011-05-30 13:32:40 -0400135#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
136 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
Rich Felker1461e022011-09-03 19:49:46 -0400137FILE *open_wmemstream(wchar_t **, size_t *);
Rich Felkerc74d3062011-05-30 13:32:40 -0400138size_t mbsnrtowcs(wchar_t *, const char **, size_t, size_t, mbstate_t *);
139size_t wcsnrtombs(char *, const wchar_t **, size_t, size_t, mbstate_t *);
Rich Felkere0614f72012-03-01 23:24:45 -0500140wchar_t *wcsdup(const wchar_t *);
141size_t wcsnlen (const wchar_t *, size_t);
142wchar_t *wcpcpy (wchar_t *, const wchar_t *);
143wchar_t *wcpncpy (wchar_t *, const wchar_t *, size_t);
144int wcscasecmp(const wchar_t *, const wchar_t *);
145int wcscasecmp_l(const wchar_t *, const wchar_t *, locale_t);
146int wcsncasecmp(const wchar_t *, const wchar_t *, size_t);
147int wcsncasecmp_l(const wchar_t *, const wchar_t *, size_t, locale_t);
148int wcscoll_l(const wchar_t *, const wchar_t *, locale_t);
149size_t wcsxfrm_l(wchar_t *, const wchar_t *, size_t n, locale_t);
Rich Felkerc74d3062011-05-30 13:32:40 -0400150#endif
151
Rich Felkerc247ebd2011-02-14 19:33:11 -0500152#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
153int wcwidth (wchar_t);
154int wcswidth (const wchar_t *, size_t);
Rich Felker0b44a032011-02-12 00:22:29 -0500155int iswalnum(wint_t);
156int iswalpha(wint_t);
157int iswblank(wint_t);
158int iswcntrl(wint_t);
159int iswdigit(wint_t);
160int iswgraph(wint_t);
161int iswlower(wint_t);
162int iswprint(wint_t);
163int iswpunct(wint_t);
164int iswspace(wint_t);
165int iswupper(wint_t);
166int iswxdigit(wint_t);
167int iswctype(wint_t, wctype_t);
168wint_t towlower(wint_t);
169wint_t towupper(wint_t);
170wctype_t wctype(const char *);
Rich Felkerc247ebd2011-02-14 19:33:11 -0500171#undef iswdigit
Rich Felker0b44a032011-02-12 00:22:29 -0500172#define iswdigit(a) ((unsigned)(a)-'0' < 10)
Rich Felkerc247ebd2011-02-14 19:33:11 -0500173#endif
Rich Felker0b44a032011-02-12 00:22:29 -0500174
175#ifdef __cplusplus
176}
177#endif
178
179#endif