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>
109262801Sdim#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
110227825Stheraven#include <support/win32/support.h> // pull in *swprintf defines
111262801Sdim#endif // _LIBCPP_MSVCRT
112227825Stheraven
113227825Stheraven#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
114227825Stheraven#pragma GCC system_header
115227825Stheraven#endif
116227825Stheraven
117227825Stheraven_LIBCPP_BEGIN_NAMESPACE_STD
118227825Stheraven
119227825Stheravenusing ::mbstate_t;
120227825Stheravenusing ::size_t;
121227825Stheravenusing ::tm;
122227825Stheravenusing ::wint_t;
123227825Stheravenusing ::FILE;
124227825Stheravenusing ::fwprintf;
125227825Stheravenusing ::fwscanf;
126227825Stheravenusing ::swprintf;
127227825Stheravenusing ::vfwprintf;
128227825Stheravenusing ::vswprintf;
129227825Stheravenusing ::vwprintf;
130262801Sdim#ifndef _LIBCPP_MSVCRT
131227825Stheravenusing ::swscanf;
132227825Stheravenusing ::vfwscanf;
133227825Stheravenusing ::vswscanf;
134227825Stheravenusing ::vwscanf;
135262801Sdim#endif // _LIBCPP_MSVCRT
136227825Stheravenusing ::wprintf;
137227825Stheravenusing ::wscanf;
138227825Stheravenusing ::fgetwc;
139227825Stheravenusing ::fgetws;
140227825Stheravenusing ::fputwc;
141227825Stheravenusing ::fputws;
142227825Stheravenusing ::fwide;
143227825Stheravenusing ::getwc;
144227825Stheravenusing ::getwchar;
145227825Stheravenusing ::putwc;
146227825Stheravenusing ::putwchar;
147227825Stheravenusing ::ungetwc;
148227825Stheravenusing ::wcstod;
149262801Sdim#ifndef _LIBCPP_MSVCRT
150227825Stheravenusing ::wcstof;
151227825Stheravenusing ::wcstold;
152262801Sdim#endif // _LIBCPP_MSVCRT
153227825Stheravenusing ::wcstol;
154243572Sdim#ifndef _LIBCPP_HAS_NO_LONG_LONG
155227825Stheravenusing ::wcstoll;
156243572Sdim#endif // _LIBCPP_HAS_NO_LONG_LONG
157227825Stheravenusing ::wcstoul;
158243572Sdim#ifndef _LIBCPP_HAS_NO_LONG_LONG
159227825Stheravenusing ::wcstoull;
160243572Sdim#endif // _LIBCPP_HAS_NO_LONG_LONG
161227825Stheravenusing ::wcscpy;
162227825Stheravenusing ::wcsncpy;
163227825Stheravenusing ::wcscat;
164227825Stheravenusing ::wcsncat;
165227825Stheravenusing ::wcscmp;
166227825Stheravenusing ::wcscoll;
167227825Stheravenusing ::wcsncmp;
168227825Stheravenusing ::wcsxfrm;
169227825Stheraven
170249998Sdim#if defined(_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_)
171249998Sdim
172249998Sdimusing ::wcschr;
173249998Sdimusing ::wcspbrk;
174249998Sdimusing ::wcsrchr;
175249998Sdimusing ::wcsstr;
176249998Sdimusing ::wmemchr;
177249998Sdim
178249998Sdim#else
179249998Sdim
180227825Stheraveninline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcschr(const wchar_t* __s, wchar_t __c) {return ::wcschr(__s, __c);}
181227825Stheraveninline _LIBCPP_INLINE_VISIBILITY       wchar_t* wcschr(      wchar_t* __s, wchar_t __c) {return ::wcschr(__s, __c);}
182227825Stheraven
183227825Stheraveninline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcspbrk(const wchar_t* __s1, const wchar_t* __s2) {return ::wcspbrk(__s1, __s2);}
184227825Stheraveninline _LIBCPP_INLINE_VISIBILITY       wchar_t* wcspbrk(      wchar_t* __s1, const wchar_t* __s2) {return ::wcspbrk(__s1, __s2);}
185227825Stheraven
186227825Stheraveninline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcsrchr(const wchar_t* __s, wchar_t __c) {return ::wcsrchr(__s, __c);}
187227825Stheraveninline _LIBCPP_INLINE_VISIBILITY       wchar_t* wcsrchr(      wchar_t* __s, wchar_t __c) {return ::wcsrchr(__s, __c);}
188227825Stheraven
189227825Stheraveninline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcsstr(const wchar_t* __s1, const wchar_t* __s2) {return ::wcsstr(__s1, __s2);}
190227825Stheraveninline _LIBCPP_INLINE_VISIBILITY       wchar_t* wcsstr(      wchar_t* __s1, const wchar_t* __s2) {return ::wcsstr(__s1, __s2);}
191227825Stheraven
192227825Stheraveninline _LIBCPP_INLINE_VISIBILITY const wchar_t* wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {return ::wmemchr(__s, __c, __n);}
193227825Stheraveninline _LIBCPP_INLINE_VISIBILITY       wchar_t* wmemchr(      wchar_t* __s, wchar_t __c, size_t __n) {return ::wmemchr(__s, __c, __n);}
194227825Stheraven
195249998Sdim#endif
196249998Sdim
197249998Sdimusing ::wcscspn;
198249998Sdimusing ::wcslen;
199249998Sdimusing ::wcsspn;
200249998Sdimusing ::wcstok;
201227825Stheravenusing ::wmemcmp;
202227825Stheravenusing ::wmemcpy;
203227825Stheravenusing ::wmemmove;
204227825Stheravenusing ::wmemset;
205227825Stheravenusing ::wcsftime;
206227825Stheravenusing ::btowc;
207227825Stheravenusing ::wctob;
208227825Stheravenusing ::mbsinit;
209227825Stheravenusing ::mbrlen;
210227825Stheravenusing ::mbrtowc;
211227825Stheravenusing ::wcrtomb;
212227825Stheravenusing ::mbsrtowcs;
213227825Stheravenusing ::wcsrtombs;
214227825Stheraven
215227825Stheraven_LIBCPP_END_NAMESPACE_STD
216227825Stheraven
217227825Stheraven#endif  // _LIBCPP_CWCHAR
218