1227825Stheraven// -*- C++ -*-
2227825Stheraven//===--------------------------- cwchar -----------------------------------===//
3227825Stheraven//
4227825Stheraven//                     The LLVM Compiler Infrastructure
5227825Stheraven//
6227825Stheraven// This file is dual licensed under the MIT and the University of Illinois Open
7227825Stheraven// Source Licenses. See LICENSE.TXT for details.
8227825Stheraven//
9227825Stheraven//===----------------------------------------------------------------------===//
10227825Stheraven
11227825Stheraven#ifndef _LIBCPP_CWCHAR
12227825Stheraven#define _LIBCPP_CWCHAR
13227825Stheraven
14227825Stheraven/*
15227825Stheraven    cwchar synopsis
16227825Stheraven
17227825StheravenMacros:
18227825Stheraven
19227825Stheraven    NULL
20227825Stheraven    WCHAR_MAX
21227825Stheraven    WCHAR_MIN
22227825Stheraven    WEOF
23227825Stheraven
24227825Stheravennamespace std
25227825Stheraven{
26227825Stheraven
27227825StheravenTypes:
28227825Stheraven
29227825Stheraven    mbstate_t
30227825Stheraven    size_t
31227825Stheraven    tm
32227825Stheraven    wint_t
33227825Stheraven
34227825Stheravenint fwprintf(FILE* restrict stream, const wchar_t* restrict format, ...);
35227825Stheravenint fwscanf(FILE* restrict stream, const wchar_t* restrict format, ...);
36227825Stheravenint swprintf(wchar_t* restrict s, size_t n, const wchar_t* restrict format, ...);
37227825Stheravenint swscanf(const wchar_t* restrict s, const wchar_t* restrict format, ...);
38227825Stheravenint vfwprintf(FILE* restrict stream, const wchar_t* restrict format, va_list arg);
39227825Stheravenint vfwscanf(FILE* restrict stream, const wchar_t* restrict format, va_list arg);  // C99
40227825Stheravenint vswprintf(wchar_t* restrict s, size_t n, const wchar_t* restrict format, va_list arg);
41227825Stheravenint vswscanf(const wchar_t* restrict s, const wchar_t* restrict format, va_list arg);  // C99
42227825Stheravenint vwprintf(const wchar_t* restrict format, va_list arg);
43227825Stheravenint vwscanf(const wchar_t* restrict format, va_list arg);  // C99
44227825Stheravenint wprintf(const wchar_t* restrict format, ...);
45227825Stheravenint wscanf(const wchar_t* restrict format, ...);
46227825Stheravenwint_t fgetwc(FILE* stream);
47227825Stheravenwchar_t* fgetws(wchar_t* restrict s, int n, FILE* restrict stream);
48227825Stheravenwint_t fputwc(wchar_t c, FILE* stream);
49227825Stheravenint fputws(const wchar_t* restrict s, FILE* restrict stream);
50227825Stheravenint fwide(FILE* stream, int mode);
51227825Stheravenwint_t getwc(FILE* stream);
52227825Stheravenwint_t getwchar();
53227825Stheravenwint_t putwc(wchar_t c, FILE* stream);
54227825Stheravenwint_t putwchar(wchar_t c);
55227825Stheravenwint_t ungetwc(wint_t c, FILE* stream);
56227825Stheravendouble wcstod(const wchar_t* restrict nptr, wchar_t** restrict endptr);
57227825Stheravenfloat wcstof(const wchar_t* restrict nptr, wchar_t** restrict endptr);         // C99
58227825Stheravenlong double wcstold(const wchar_t* restrict nptr, wchar_t** restrict endptr);  // C99
59227825Stheravenlong wcstol(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
60227825Stheravenlong long wcstoll(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);  // C99
61227825Stheravenunsigned long wcstoul(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
62227825Stheravenunsigned long long wcstoull(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);  // C99
63227825Stheravenwchar_t* wcscpy(wchar_t* restrict s1, const wchar_t* restrict s2);
64227825Stheravenwchar_t* wcsncpy(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
65227825Stheravenwchar_t* wcscat(wchar_t* restrict s1, const wchar_t* restrict s2);
66227825Stheravenwchar_t* wcsncat(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
67227825Stheravenint wcscmp(const wchar_t* s1, const wchar_t* s2);
68227825Stheravenint wcscoll(const wchar_t* s1, const wchar_t* s2);
69227825Stheravenint wcsncmp(const wchar_t* s1, const wchar_t* s2, size_t n);
70227825Stheravensize_t wcsxfrm(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
71227825Stheravenconst wchar_t* wcschr(const wchar_t* s, wchar_t c);
72227825Stheraven      wchar_t* wcschr(      wchar_t* s, wchar_t c);
73227825Stheravensize_t wcscspn(const wchar_t* s1, const wchar_t* s2);
74227825Stheravensize_t wcslen(const wchar_t* s);
75227825Stheravenconst wchar_t* wcspbrk(const wchar_t* s1, const wchar_t* s2);
76227825Stheraven      wchar_t* wcspbrk(      wchar_t* s1, const wchar_t* s2);
77227825Stheravenconst wchar_t* wcsrchr(const wchar_t* s, wchar_t c);
78227825Stheraven      wchar_t* wcsrchr(      wchar_t* s, wchar_t c);
79227825Stheravensize_t wcsspn(const wchar_t* s1, const wchar_t* s2);
80227825Stheravenconst wchar_t* wcsstr(const wchar_t* s1, const wchar_t* s2);
81227825Stheraven      wchar_t* wcsstr(      wchar_t* s1, const wchar_t* s2);
82227825Stheravenwchar_t* wcstok(wchar_t* restrict s1, const wchar_t* restrict s2, wchar_t** restrict ptr);
83227825Stheravenconst wchar_t* wmemchr(const wchar_t* s, wchar_t c, size_t n);
84227825Stheraven      wchar_t* wmemchr(      wchar_t* s, wchar_t c, size_t n);
85227825Stheravenint wmemcmp(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
86227825Stheravenwchar_t* wmemcpy(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
87227825Stheravenwchar_t* wmemmove(wchar_t* s1, const wchar_t* s2, size_t n);
88227825Stheravenwchar_t* wmemset(wchar_t* s, wchar_t c, size_t n);
89227825Stheravensize_t wcsftime(wchar_t* restrict s, size_t maxsize, const wchar_t* restrict format,
90227825Stheraven                const tm* restrict timeptr);
91227825Stheravenwint_t btowc(int c);
92227825Stheravenint wctob(wint_t c);
93227825Stheravenint mbsinit(const mbstate_t* ps);
94227825Stheravensize_t mbrlen(const char* restrict s, size_t n, mbstate_t* restrict ps);
95227825Stheravensize_t mbrtowc(wchar_t* restrict pwc, const char* restrict s, size_t n, mbstate_t* restrict ps);
96227825Stheravensize_t wcrtomb(char* restrict s, wchar_t wc, mbstate_t* restrict ps);
97227825Stheravensize_t mbsrtowcs(wchar_t* restrict dst, const char** restrict src, size_t len,
98227825Stheraven                 mbstate_t* restrict ps);
99227825Stheravensize_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
100227825Stheraven                 mbstate_t* restrict ps);
101227825Stheraven
102227825Stheraven}  // std
103227825Stheraven
104227825Stheraven*/
105227825Stheraven
106227825Stheraven#include <__config>
107227825Stheraven#include <cwctype>
108227825Stheraven#include <wchar.h>
109227825Stheraven
110227825Stheraven#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
111227825Stheraven#pragma GCC system_header
112227825Stheraven#endif
113227825Stheraven
114227825Stheraven_LIBCPP_BEGIN_NAMESPACE_STD
115227825Stheraven
116227825Stheravenusing ::mbstate_t;
117227825Stheravenusing ::size_t;
118227825Stheravenusing ::tm;
119227825Stheravenusing ::wint_t;
120227825Stheravenusing ::FILE;
121227825Stheravenusing ::fwprintf;
122227825Stheravenusing ::fwscanf;
123227825Stheravenusing ::swprintf;
124227825Stheravenusing ::vfwprintf;
125227825Stheravenusing ::vswprintf;
126261272Sdim#ifndef _LIBCPP_MSVCRT
127227825Stheravenusing ::swscanf;
128227825Stheravenusing ::vfwscanf;
129227825Stheravenusing ::vswscanf;
130261272Sdim#endif // _LIBCPP_MSVCRT
131227825Stheravenusing ::fgetwc;
132227825Stheravenusing ::fgetws;
133227825Stheravenusing ::fputwc;
134227825Stheravenusing ::fputws;
135227825Stheravenusing ::fwide;
136227825Stheravenusing ::getwc;
137227825Stheravenusing ::putwc;
138227825Stheravenusing ::ungetwc;
139227825Stheravenusing ::wcstod;
140261272Sdim#ifndef _LIBCPP_MSVCRT
141227825Stheravenusing ::wcstof;
142227825Stheravenusing ::wcstold;
143261272Sdim#endif // _LIBCPP_MSVCRT
144227825Stheravenusing ::wcstol;
145243671Stheraven#ifndef _LIBCPP_HAS_NO_LONG_LONG
146227825Stheravenusing ::wcstoll;
147243671Stheraven#endif // _LIBCPP_HAS_NO_LONG_LONG
148227825Stheravenusing ::wcstoul;
149243671Stheraven#ifndef _LIBCPP_HAS_NO_LONG_LONG
150227825Stheravenusing ::wcstoull;
151243671Stheraven#endif // _LIBCPP_HAS_NO_LONG_LONG
152227825Stheravenusing ::wcscpy;
153227825Stheravenusing ::wcsncpy;
154227825Stheravenusing ::wcscat;
155227825Stheravenusing ::wcsncat;
156227825Stheravenusing ::wcscmp;
157227825Stheravenusing ::wcscoll;
158227825Stheravenusing ::wcsncmp;
159227825Stheravenusing ::wcsxfrm;
160227825Stheraven
161300770Sdim#ifdef _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS
162249989Sdimusing ::wcschr;
163249989Sdimusing ::wcspbrk;
164249989Sdimusing ::wcsrchr;
165249989Sdimusing ::wcsstr;
166249989Sdimusing ::wmemchr;
167249989Sdim#else
168227825Stheraveninline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcschr(const wchar_t* __s, wchar_t __c) {return ::wcschr(__s, __c);}
169227825Stheraveninline _LIBCPP_INLINE_VISIBILITY       wchar_t* wcschr(      wchar_t* __s, wchar_t __c) {return ::wcschr(__s, __c);}
170227825Stheraven
171227825Stheraveninline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcspbrk(const wchar_t* __s1, const wchar_t* __s2) {return ::wcspbrk(__s1, __s2);}
172227825Stheraveninline _LIBCPP_INLINE_VISIBILITY       wchar_t* wcspbrk(      wchar_t* __s1, const wchar_t* __s2) {return ::wcspbrk(__s1, __s2);}
173227825Stheraven
174227825Stheraveninline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcsrchr(const wchar_t* __s, wchar_t __c) {return ::wcsrchr(__s, __c);}
175227825Stheraveninline _LIBCPP_INLINE_VISIBILITY       wchar_t* wcsrchr(      wchar_t* __s, wchar_t __c) {return ::wcsrchr(__s, __c);}
176227825Stheraven
177227825Stheraveninline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcsstr(const wchar_t* __s1, const wchar_t* __s2) {return ::wcsstr(__s1, __s2);}
178227825Stheraveninline _LIBCPP_INLINE_VISIBILITY       wchar_t* wcsstr(      wchar_t* __s1, const wchar_t* __s2) {return ::wcsstr(__s1, __s2);}
179227825Stheraven
180227825Stheraveninline _LIBCPP_INLINE_VISIBILITY const wchar_t* wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {return ::wmemchr(__s, __c, __n);}
181227825Stheraveninline _LIBCPP_INLINE_VISIBILITY       wchar_t* wmemchr(      wchar_t* __s, wchar_t __c, size_t __n) {return ::wmemchr(__s, __c, __n);}
182249989Sdim#endif
183249989Sdim
184249989Sdimusing ::wcscspn;
185249989Sdimusing ::wcslen;
186249989Sdimusing ::wcsspn;
187249989Sdimusing ::wcstok;
188227825Stheravenusing ::wmemcmp;
189227825Stheravenusing ::wmemcpy;
190227825Stheravenusing ::wmemmove;
191227825Stheravenusing ::wmemset;
192227825Stheravenusing ::wcsftime;
193227825Stheravenusing ::btowc;
194227825Stheravenusing ::wctob;
195227825Stheravenusing ::mbsinit;
196227825Stheravenusing ::mbrlen;
197227825Stheravenusing ::mbrtowc;
198227825Stheravenusing ::wcrtomb;
199227825Stheravenusing ::mbsrtowcs;
200227825Stheravenusing ::wcsrtombs;
201227825Stheraven
202288943Sdim#ifndef _LIBCPP_HAS_NO_STDIN
203288943Sdimusing ::getwchar;
204288943Sdim#ifndef _LIBCPP_MSVCRT
205288943Sdimusing ::vwscanf;
206288943Sdim#endif // _LIBCPP_MSVCRT
207288943Sdimusing ::wscanf;
208288943Sdim#endif
209288943Sdim
210288943Sdim#ifndef _LIBCPP_HAS_NO_STDOUT
211288943Sdimusing ::putwchar;
212288943Sdimusing ::vwprintf;
213288943Sdimusing ::wprintf;
214288943Sdim#endif
215288943Sdim
216227825Stheraven_LIBCPP_END_NAMESPACE_STD
217227825Stheraven
218227825Stheraven#endif  // _LIBCPP_CWCHAR
219