blob: 0a67fe8bba9dd82af949fbf29ca8ab6efa077162 [file] [log] [blame]
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001// -*- C++ -*-
2//===--------------------------- cwchar -----------------------------------===//
3//
Howard Hinnantf5256e12010-05-11 21:36:01 +00004// The LLVM Compiler Infrastructure
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00005//
Howard Hinnantb64f8b02010-11-16 22:09:02 +00006// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00008//
9//===----------------------------------------------------------------------===//
10
11#ifndef _LIBCPP_CWCHAR
12#define _LIBCPP_CWCHAR
13
14/*
15 cwchar synopsis
16
17Macros:
18
19 NULL
20 WCHAR_MAX
21 WCHAR_MIN
22 WEOF
Howard Hinnant324bb032010-08-22 00:02:43 +000023
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000024namespace std
25{
26
27Types:
28
29 mbstate_t
30 size_t
31 tm
32 wint_t
33
34int fwprintf(FILE* restrict stream, const wchar_t* restrict format, ...);
35int fwscanf(FILE* restrict stream, const wchar_t* restrict format, ...);
36int swprintf(wchar_t* restrict s, size_t n, const wchar_t* restrict format, ...);
37int swscanf(const wchar_t* restrict s, const wchar_t* restrict format, ...);
38int vfwprintf(FILE* restrict stream, const wchar_t* restrict format, va_list arg);
39int vfwscanf(FILE* restrict stream, const wchar_t* restrict format, va_list arg); // C99
40int vswprintf(wchar_t* restrict s, size_t n, const wchar_t* restrict format, va_list arg);
41int vswscanf(const wchar_t* restrict s, const wchar_t* restrict format, va_list arg); // C99
42int vwprintf(const wchar_t* restrict format, va_list arg);
43int vwscanf(const wchar_t* restrict format, va_list arg); // C99
44int wprintf(const wchar_t* restrict format, ...);
45int wscanf(const wchar_t* restrict format, ...);
46wint_t fgetwc(FILE* stream);
47wchar_t* fgetws(wchar_t* restrict s, int n, FILE* restrict stream);
48wint_t fputwc(wchar_t c, FILE* stream);
49int fputws(const wchar_t* restrict s, FILE* restrict stream);
50int fwide(FILE* stream, int mode);
51wint_t getwc(FILE* stream);
Howard Hinnant324bb032010-08-22 00:02:43 +000052wint_t getwchar();
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000053wint_t putwc(wchar_t c, FILE* stream);
54wint_t putwchar(wchar_t c);
55wint_t ungetwc(wint_t c, FILE* stream);
56double wcstod(const wchar_t* restrict nptr, wchar_t** restrict endptr);
57float wcstof(const wchar_t* restrict nptr, wchar_t** restrict endptr); // C99
58long double wcstold(const wchar_t* restrict nptr, wchar_t** restrict endptr); // C99
59long wcstol(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
60long long wcstoll(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base); // C99
61unsigned long wcstoul(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
62unsigned long long wcstoull(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base); // C99
63wchar_t* wcscpy(wchar_t* restrict s1, const wchar_t* restrict s2);
64wchar_t* wcsncpy(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
65wchar_t* wcscat(wchar_t* restrict s1, const wchar_t* restrict s2);
66wchar_t* wcsncat(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
67int wcscmp(const wchar_t* s1, const wchar_t* s2);
68int wcscoll(const wchar_t* s1, const wchar_t* s2);
69int wcsncmp(const wchar_t* s1, const wchar_t* s2, size_t n);
70size_t wcsxfrm(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
71const wchar_t* wcschr(const wchar_t* s, wchar_t c);
72 wchar_t* wcschr( wchar_t* s, wchar_t c);
73size_t wcscspn(const wchar_t* s1, const wchar_t* s2);
74size_t wcslen(const wchar_t* s);
75const wchar_t* wcspbrk(const wchar_t* s1, const wchar_t* s2);
76 wchar_t* wcspbrk( wchar_t* s1, const wchar_t* s2);
77const wchar_t* wcsrchr(const wchar_t* s, wchar_t c);
78 wchar_t* wcsrchr( wchar_t* s, wchar_t c);
79size_t wcsspn(const wchar_t* s1, const wchar_t* s2);
80const wchar_t* wcsstr(const wchar_t* s1, const wchar_t* s2);
81 wchar_t* wcsstr( wchar_t* s1, const wchar_t* s2);
82wchar_t* wcstok(wchar_t* restrict s1, const wchar_t* restrict s2, wchar_t** restrict ptr);
83const wchar_t* wmemchr(const wchar_t* s, wchar_t c, size_t n);
84 wchar_t* wmemchr( wchar_t* s, wchar_t c, size_t n);
85int wmemcmp(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
86wchar_t* wmemcpy(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
87wchar_t* wmemmove(wchar_t* s1, const wchar_t* s2, size_t n);
88wchar_t* wmemset(wchar_t* s, wchar_t c, size_t n);
89size_t wcsftime(wchar_t* restrict s, size_t maxsize, const wchar_t* restrict format,
90 const tm* restrict timeptr);
91wint_t btowc(int c);
92int wctob(wint_t c);
93int mbsinit(const mbstate_t* ps);
94size_t mbrlen(const char* restrict s, size_t n, mbstate_t* restrict ps);
Howard Hinnant324bb032010-08-22 00:02:43 +000095size_t mbrtowc(wchar_t* restrict pwc, const char* restrict s, size_t n, mbstate_t* restrict ps);
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000096size_t wcrtomb(char* restrict s, wchar_t wc, mbstate_t* restrict ps);
97size_t mbsrtowcs(wchar_t* restrict dst, const char** restrict src, size_t len,
Howard Hinnant324bb032010-08-22 00:02:43 +000098 mbstate_t* restrict ps);
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000099size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
100 mbstate_t* restrict ps);
101
102} // std
103
104*/
105
106#include <__config>
107#include <cwctype>
108#include <wchar.h>
Howard Hinnantefbe4062011-09-28 21:39:20 +0000109#if _WIN32
110#include <support/win32/support.h> // pull in *swprintf defines
111#endif // _WIN32
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000112
113#pragma GCC system_header
114
115_LIBCPP_BEGIN_NAMESPACE_STD
116
117using ::mbstate_t;
118using ::size_t;
119using ::tm;
120using ::wint_t;
121using ::FILE;
122using ::fwprintf;
123using ::fwscanf;
124using ::swprintf;
125using ::swscanf;
126using ::vfwprintf;
127using ::vfwscanf;
128using ::vswprintf;
129using ::vswscanf;
130using ::vwprintf;
131using ::vwscanf;
132using ::wprintf;
133using ::wscanf;
134using ::fgetwc;
135using ::fgetws;
136using ::fputwc;
137using ::fputws;
138using ::fwide;
139using ::getwc;
140using ::getwchar;
141using ::putwc;
142using ::putwchar;
143using ::ungetwc;
144using ::wcstod;
145using ::wcstof;
146using ::wcstold;
147using ::wcstol;
148using ::wcstoll;
149using ::wcstoul;
150using ::wcstoull;
151using ::wcscpy;
152using ::wcsncpy;
153using ::wcscat;
154using ::wcsncat;
155using ::wcscmp;
156using ::wcscoll;
157using ::wcsncmp;
158using ::wcsxfrm;
159
160inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcschr(const wchar_t* __s, wchar_t __c) {return ::wcschr(__s, __c);}
161inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcschr( wchar_t* __s, wchar_t __c) {return ::wcschr(__s, __c);}
162
163using ::wcscspn;
164using ::wcslen;
165
166inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcspbrk(const wchar_t* __s1, const wchar_t* __s2) {return ::wcspbrk(__s1, __s2);}
167inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcspbrk( wchar_t* __s1, const wchar_t* __s2) {return ::wcspbrk(__s1, __s2);}
168
169inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcsrchr(const wchar_t* __s, wchar_t __c) {return ::wcsrchr(__s, __c);}
170inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcsrchr( wchar_t* __s, wchar_t __c) {return ::wcsrchr(__s, __c);}
171
172using ::wcsspn;
173
174inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcsstr(const wchar_t* __s1, const wchar_t* __s2) {return ::wcsstr(__s1, __s2);}
175inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcsstr( wchar_t* __s1, const wchar_t* __s2) {return ::wcsstr(__s1, __s2);}
176
177using ::wcstok;
178
179inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {return ::wmemchr(__s, __c, __n);}
180inline _LIBCPP_INLINE_VISIBILITY wchar_t* wmemchr( wchar_t* __s, wchar_t __c, size_t __n) {return ::wmemchr(__s, __c, __n);}
181
182using ::wmemcmp;
183using ::wmemcpy;
184using ::wmemmove;
185using ::wmemset;
186using ::wcsftime;
187using ::btowc;
188using ::wctob;
189using ::mbsinit;
190using ::mbrlen;
191using ::mbrtowc;
192using ::wcrtomb;
193using ::mbsrtowcs;
194using ::wcsrtombs;
195
196_LIBCPP_END_NAMESPACE_STD
197
198#endif // _LIBCPP_CWCHAR