blob: 8e788fc764e114e43453f71345e3c2cca6c020fb [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
Howard Hinnant08e17472011-10-17 20:05:10 +0000113#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000114#pragma GCC system_header
Howard Hinnant08e17472011-10-17 20:05:10 +0000115#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000116
117_LIBCPP_BEGIN_NAMESPACE_STD
118
119using ::mbstate_t;
120using ::size_t;
121using ::tm;
122using ::wint_t;
123using ::FILE;
124using ::fwprintf;
125using ::fwscanf;
126using ::swprintf;
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000127using ::vfwprintf;
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000128using ::vswprintf;
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000129using ::vwprintf;
Howard Hinnant78b68282011-10-22 20:59:45 +0000130#ifndef _MSC_VER
131using ::swscanf;
132using ::vfwscanf;
133using ::vswscanf;
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000134using ::vwscanf;
Howard Hinnant78b68282011-10-22 20:59:45 +0000135#endif // _MSC_VER
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000136using ::wprintf;
137using ::wscanf;
138using ::fgetwc;
139using ::fgetws;
140using ::fputwc;
141using ::fputws;
142using ::fwide;
143using ::getwc;
144using ::getwchar;
145using ::putwc;
146using ::putwchar;
147using ::ungetwc;
148using ::wcstod;
Howard Hinnant78b68282011-10-22 20:59:45 +0000149#ifndef _MSC_VER
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000150using ::wcstof;
151using ::wcstold;
Howard Hinnant78b68282011-10-22 20:59:45 +0000152#endif // _MSC_VER
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000153using ::wcstol;
154using ::wcstoll;
155using ::wcstoul;
156using ::wcstoull;
157using ::wcscpy;
158using ::wcsncpy;
159using ::wcscat;
160using ::wcsncat;
161using ::wcscmp;
162using ::wcscoll;
163using ::wcsncmp;
164using ::wcsxfrm;
165
166inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcschr(const wchar_t* __s, wchar_t __c) {return ::wcschr(__s, __c);}
167inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcschr( wchar_t* __s, wchar_t __c) {return ::wcschr(__s, __c);}
168
169using ::wcscspn;
170using ::wcslen;
171
172inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcspbrk(const wchar_t* __s1, const wchar_t* __s2) {return ::wcspbrk(__s1, __s2);}
173inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcspbrk( wchar_t* __s1, const wchar_t* __s2) {return ::wcspbrk(__s1, __s2);}
174
175inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcsrchr(const wchar_t* __s, wchar_t __c) {return ::wcsrchr(__s, __c);}
176inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcsrchr( wchar_t* __s, wchar_t __c) {return ::wcsrchr(__s, __c);}
177
178using ::wcsspn;
179
180inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcsstr(const wchar_t* __s1, const wchar_t* __s2) {return ::wcsstr(__s1, __s2);}
181inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcsstr( wchar_t* __s1, const wchar_t* __s2) {return ::wcsstr(__s1, __s2);}
182
183using ::wcstok;
184
185inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {return ::wmemchr(__s, __c, __n);}
186inline _LIBCPP_INLINE_VISIBILITY wchar_t* wmemchr( wchar_t* __s, wchar_t __c, size_t __n) {return ::wmemchr(__s, __c, __n);}
187
188using ::wmemcmp;
189using ::wmemcpy;
190using ::wmemmove;
191using ::wmemset;
192using ::wcsftime;
193using ::btowc;
194using ::wctob;
195using ::mbsinit;
196using ::mbrlen;
197using ::mbrtowc;
198using ::wcrtomb;
199using ::mbsrtowcs;
200using ::wcsrtombs;
201
202_LIBCPP_END_NAMESPACE_STD
203
204#endif // _LIBCPP_CWCHAR