blob: c0c6ef754fbebe3cd29a3ba21d3d4920628f39d6 [file] [log] [blame]
Richard Smithde66c512015-10-10 01:39:51 +00001// -*- C++ -*-
2//===--------------------------- wchar.h ----------------------------------===//
3//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
8//
9//===----------------------------------------------------------------------===//
10
11#if defined(__need_wint_t) || defined(__need_mbstate_t)
12
13#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
14#pragma GCC system_header
15#endif
16
17#include_next <wchar.h>
18
19#elif !defined(_LIBCPP_WCHAR_H)
20#define _LIBCPP_WCHAR_H
21
22/*
23 wchar.h synopsis
24
25Macros:
26
27 NULL
28 WCHAR_MAX
29 WCHAR_MIN
30 WEOF
31
32Types:
33
34 mbstate_t
35 size_t
36 tm
37 wint_t
38
39int fwprintf(FILE* restrict stream, const wchar_t* restrict format, ...);
40int fwscanf(FILE* restrict stream, const wchar_t* restrict format, ...);
41int swprintf(wchar_t* restrict s, size_t n, const wchar_t* restrict format, ...);
42int swscanf(const wchar_t* restrict s, const wchar_t* restrict format, ...);
43int vfwprintf(FILE* restrict stream, const wchar_t* restrict format, va_list arg);
44int vfwscanf(FILE* restrict stream, const wchar_t* restrict format, va_list arg); // C99
45int vswprintf(wchar_t* restrict s, size_t n, const wchar_t* restrict format, va_list arg);
46int vswscanf(const wchar_t* restrict s, const wchar_t* restrict format, va_list arg); // C99
47int vwprintf(const wchar_t* restrict format, va_list arg);
48int vwscanf(const wchar_t* restrict format, va_list arg); // C99
49int wprintf(const wchar_t* restrict format, ...);
50int wscanf(const wchar_t* restrict format, ...);
51wint_t fgetwc(FILE* stream);
52wchar_t* fgetws(wchar_t* restrict s, int n, FILE* restrict stream);
53wint_t fputwc(wchar_t c, FILE* stream);
54int fputws(const wchar_t* restrict s, FILE* restrict stream);
55int fwide(FILE* stream, int mode);
56wint_t getwc(FILE* stream);
57wint_t getwchar();
58wint_t putwc(wchar_t c, FILE* stream);
59wint_t putwchar(wchar_t c);
60wint_t ungetwc(wint_t c, FILE* stream);
61double wcstod(const wchar_t* restrict nptr, wchar_t** restrict endptr);
62float wcstof(const wchar_t* restrict nptr, wchar_t** restrict endptr); // C99
63long double wcstold(const wchar_t* restrict nptr, wchar_t** restrict endptr); // C99
64long wcstol(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
65long long wcstoll(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base); // C99
66unsigned long wcstoul(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
67unsigned long long wcstoull(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base); // C99
68wchar_t* wcscpy(wchar_t* restrict s1, const wchar_t* restrict s2);
69wchar_t* wcsncpy(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
70wchar_t* wcscat(wchar_t* restrict s1, const wchar_t* restrict s2);
71wchar_t* wcsncat(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
72int wcscmp(const wchar_t* s1, const wchar_t* s2);
73int wcscoll(const wchar_t* s1, const wchar_t* s2);
74int wcsncmp(const wchar_t* s1, const wchar_t* s2, size_t n);
75size_t wcsxfrm(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
76const wchar_t* wcschr(const wchar_t* s, wchar_t c);
77 wchar_t* wcschr( wchar_t* s, wchar_t c);
78size_t wcscspn(const wchar_t* s1, const wchar_t* s2);
79size_t wcslen(const wchar_t* s);
80const wchar_t* wcspbrk(const wchar_t* s1, const wchar_t* s2);
81 wchar_t* wcspbrk( wchar_t* s1, const wchar_t* s2);
82const wchar_t* wcsrchr(const wchar_t* s, wchar_t c);
83 wchar_t* wcsrchr( wchar_t* s, wchar_t c);
84size_t wcsspn(const wchar_t* s1, const wchar_t* s2);
85const wchar_t* wcsstr(const wchar_t* s1, const wchar_t* s2);
86 wchar_t* wcsstr( wchar_t* s1, const wchar_t* s2);
87wchar_t* wcstok(wchar_t* restrict s1, const wchar_t* restrict s2, wchar_t** restrict ptr);
88const wchar_t* wmemchr(const wchar_t* s, wchar_t c, size_t n);
89 wchar_t* wmemchr( wchar_t* s, wchar_t c, size_t n);
90int wmemcmp(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
91wchar_t* wmemcpy(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
92wchar_t* wmemmove(wchar_t* s1, const wchar_t* s2, size_t n);
93wchar_t* wmemset(wchar_t* s, wchar_t c, size_t n);
94size_t wcsftime(wchar_t* restrict s, size_t maxsize, const wchar_t* restrict format,
95 const tm* restrict timeptr);
96wint_t btowc(int c);
97int wctob(wint_t c);
98int mbsinit(const mbstate_t* ps);
99size_t mbrlen(const char* restrict s, size_t n, mbstate_t* restrict ps);
100size_t mbrtowc(wchar_t* restrict pwc, const char* restrict s, size_t n, mbstate_t* restrict ps);
101size_t wcrtomb(char* restrict s, wchar_t wc, mbstate_t* restrict ps);
102size_t mbsrtowcs(wchar_t* restrict dst, const char** restrict src, size_t len,
103 mbstate_t* restrict ps);
104size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
105 mbstate_t* restrict ps);
106
107*/
108
109#include <__config>
110
111#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
112#pragma GCC system_header
113#endif
114
115#ifdef __cplusplus
116#define __CORRECT_ISO_CPP_WCHAR_H_PROTO
117#endif
118
119#include_next <wchar.h>
120
Richard Smithb4aa9712016-02-10 00:59:02 +0000121// Determine whether we have const-correct overloads for wcschr and friends.
Richard Smithde66c512015-10-10 01:39:51 +0000122#if defined(_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_)
123# define _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS 1
124#elif defined(__GLIBC_PREREQ)
125# if __GLIBC_PREREQ(2, 10)
126# define _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS 1
127# endif
128#endif
129
Richard Smithb4aa9712016-02-10 00:59:02 +0000130#if defined(__cplusplus) && !defined(_LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS) && defined(_LIBCPP_PREFERRED_OVERLOAD)
131extern "C++" {
132inline _LIBCPP_INLINE_VISIBILITY
133wchar_t* __libcpp_wcschr(const wchar_t* __s, wchar_t __c) {return (wchar_t*)wcschr(__s, __c);}
134inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
135const wchar_t* wcschr(const wchar_t* __s, wchar_t __c) {return __libcpp_wcschr(__s, __c);}
136inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
137 wchar_t* wcschr( wchar_t* __s, wchar_t __c) {return __libcpp_wcschr(__s, __c);}
138
139inline _LIBCPP_INLINE_VISIBILITY
140wchar_t* __libcpp_wcspbrk(const wchar_t* __s1, const wchar_t* __s2) {return (wchar_t*)wcspbrk(__s1, __s2);}
141inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
142const wchar_t* wcspbrk(const wchar_t* __s1, const wchar_t* __s2) {return __libcpp_wcspbrk(__s1, __s2);}
143inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
144 wchar_t* wcspbrk( wchar_t* __s1, const wchar_t* __s2) {return __libcpp_wcspbrk(__s1, __s2);}
145
146inline _LIBCPP_INLINE_VISIBILITY
147wchar_t* __libcpp_wcsrchr(const wchar_t* __s, wchar_t __c) {return (wchar_t*)wcsrchr(__s, __c);}
148inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
149const wchar_t* wcsrchr(const wchar_t* __s, wchar_t __c) {return __libcpp_wcsrchr(__s, __c);}
150inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
151 wchar_t* wcsrchr( wchar_t* __s, wchar_t __c) {return __libcpp_wcsrchr(__s, __c);}
152
153inline _LIBCPP_INLINE_VISIBILITY
154wchar_t* __libcpp_wcsstr(const wchar_t* __s1, const wchar_t* __s2) {return (wchar_t*)wcsstr(__s1, __s2);}
155inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
156const wchar_t* wcsstr(const wchar_t* __s1, const wchar_t* __s2) {return __libcpp_wcsstr(__s1, __s2);}
157inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
158 wchar_t* wcsstr( wchar_t* __s1, const wchar_t* __s2) {return __libcpp_wcsstr(__s1, __s2);}
159
160inline _LIBCPP_INLINE_VISIBILITY
161wchar_t* __libcpp_wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {return (wchar_t*)wmemchr(__s, __c, __n);}
162inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
163const wchar_t* wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {return __libcpp_wmemchr(__s, __c, __n);}
164inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
165 wchar_t* wmemchr( wchar_t* __s, wchar_t __c, size_t __n) {return __libcpp_wmemchr(__s, __c, __n);}
166}
167#endif
168
Richard Smithde66c512015-10-10 01:39:51 +0000169#if defined(__cplusplus) && (defined(_LIBCPP_MSVCRT) || defined(__MINGW32__))
170extern "C++" {
171#include <support/win32/support.h> // pull in *swprintf defines
172} // extern "C++"
173#endif // __cplusplus && _LIBCPP_MSVCRT
174
175#endif // _LIBCPP_WCHAR_H