2 //===--------------------------- wchar.h ----------------------------------===//
4 // The LLVM Compiler Infrastructure
6 // This file is dual licensed under the MIT and the University of Illinois Open
7 // Source Licenses. See LICENSE.TXT for details.
9 //===----------------------------------------------------------------------===//
11 #if defined(__need_wint_t) || defined(__need_mbstate_t)
13 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
14 #pragma GCC system_header
17 #include_next <wchar.h>
19 #elif !defined(_LIBCPP_WCHAR_H)
20 #define _LIBCPP_WCHAR_H
39 int fwprintf(FILE* restrict stream, const wchar_t* restrict format, ...);
40 int fwscanf(FILE* restrict stream, const wchar_t* restrict format, ...);
41 int swprintf(wchar_t* restrict s, size_t n, const wchar_t* restrict format, ...);
42 int swscanf(const wchar_t* restrict s, const wchar_t* restrict format, ...);
43 int vfwprintf(FILE* restrict stream, const wchar_t* restrict format, va_list arg);
44 int vfwscanf(FILE* restrict stream, const wchar_t* restrict format, va_list arg); // C99
45 int vswprintf(wchar_t* restrict s, size_t n, const wchar_t* restrict format, va_list arg);
46 int vswscanf(const wchar_t* restrict s, const wchar_t* restrict format, va_list arg); // C99
47 int vwprintf(const wchar_t* restrict format, va_list arg);
48 int vwscanf(const wchar_t* restrict format, va_list arg); // C99
49 int wprintf(const wchar_t* restrict format, ...);
50 int wscanf(const wchar_t* restrict format, ...);
51 wint_t fgetwc(FILE* stream);
52 wchar_t* fgetws(wchar_t* restrict s, int n, FILE* restrict stream);
53 wint_t fputwc(wchar_t c, FILE* stream);
54 int fputws(const wchar_t* restrict s, FILE* restrict stream);
55 int fwide(FILE* stream, int mode);
56 wint_t getwc(FILE* stream);
58 wint_t putwc(wchar_t c, FILE* stream);
59 wint_t putwchar(wchar_t c);
60 wint_t ungetwc(wint_t c, FILE* stream);
61 double wcstod(const wchar_t* restrict nptr, wchar_t** restrict endptr);
62 float wcstof(const wchar_t* restrict nptr, wchar_t** restrict endptr); // C99
63 long double wcstold(const wchar_t* restrict nptr, wchar_t** restrict endptr); // C99
64 long wcstol(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
65 long long wcstoll(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base); // C99
66 unsigned long wcstoul(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
67 unsigned long long wcstoull(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base); // C99
68 wchar_t* wcscpy(wchar_t* restrict s1, const wchar_t* restrict s2);
69 wchar_t* wcsncpy(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
70 wchar_t* wcscat(wchar_t* restrict s1, const wchar_t* restrict s2);
71 wchar_t* wcsncat(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
72 int wcscmp(const wchar_t* s1, const wchar_t* s2);
73 int wcscoll(const wchar_t* s1, const wchar_t* s2);
74 int wcsncmp(const wchar_t* s1, const wchar_t* s2, size_t n);
75 size_t wcsxfrm(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
76 const wchar_t* wcschr(const wchar_t* s, wchar_t c);
77 wchar_t* wcschr( wchar_t* s, wchar_t c);
78 size_t wcscspn(const wchar_t* s1, const wchar_t* s2);
79 size_t wcslen(const wchar_t* s);
80 const wchar_t* wcspbrk(const wchar_t* s1, const wchar_t* s2);
81 wchar_t* wcspbrk( wchar_t* s1, const wchar_t* s2);
82 const wchar_t* wcsrchr(const wchar_t* s, wchar_t c);
83 wchar_t* wcsrchr( wchar_t* s, wchar_t c);
84 size_t wcsspn(const wchar_t* s1, const wchar_t* s2);
85 const wchar_t* wcsstr(const wchar_t* s1, const wchar_t* s2);
86 wchar_t* wcsstr( wchar_t* s1, const wchar_t* s2);
87 wchar_t* wcstok(wchar_t* restrict s1, const wchar_t* restrict s2, wchar_t** restrict ptr);
88 const 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);
90 int wmemcmp(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
91 wchar_t* wmemcpy(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
92 wchar_t* wmemmove(wchar_t* s1, const wchar_t* s2, size_t n);
93 wchar_t* wmemset(wchar_t* s, wchar_t c, size_t n);
94 size_t wcsftime(wchar_t* restrict s, size_t maxsize, const wchar_t* restrict format,
95 const tm* restrict timeptr);
98 int mbsinit(const mbstate_t* ps);
99 size_t mbrlen(const char* restrict s, size_t n, mbstate_t* restrict ps);
100 size_t mbrtowc(wchar_t* restrict pwc, const char* restrict s, size_t n, mbstate_t* restrict ps);
101 size_t wcrtomb(char* restrict s, wchar_t wc, mbstate_t* restrict ps);
102 size_t mbsrtowcs(wchar_t* restrict dst, const char** restrict src, size_t len,
103 mbstate_t* restrict ps);
104 size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
105 mbstate_t* restrict ps);
111 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
112 #pragma GCC system_header
116 #define __CORRECT_ISO_CPP_WCHAR_H_PROTO
119 #include_next <wchar.h>
121 // Let <cwchar> know if we have const-correct overloads for wcschr and friends.
122 #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
130 #if defined(__cplusplus) && (defined(_LIBCPP_MSVCRT) || defined(__MINGW32__))
132 #include <support/win32/support.h> // pull in *swprintf defines
134 #endif // __cplusplus && _LIBCPP_MSVCRT
136 #endif // _LIBCPP_WCHAR_H