Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1 | // -*- C++ -*- |
| 2 | //===--------------------------- cwchar -----------------------------------===// |
| 3 | // |
Chandler Carruth | d201210 | 2019-01-19 10:56:40 +0000 | [diff] [blame] | 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 5 | // See https://llvm.org/LICENSE.txt for license information. |
| 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #ifndef _LIBCPP_CWCHAR |
| 11 | #define _LIBCPP_CWCHAR |
| 12 | |
| 13 | /* |
| 14 | cwchar synopsis |
| 15 | |
| 16 | Macros: |
| 17 | |
| 18 | NULL |
| 19 | WCHAR_MAX |
| 20 | WCHAR_MIN |
| 21 | WEOF |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 22 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 23 | namespace std |
| 24 | { |
| 25 | |
| 26 | Types: |
| 27 | |
| 28 | mbstate_t |
| 29 | size_t |
| 30 | tm |
| 31 | wint_t |
| 32 | |
| 33 | int fwprintf(FILE* restrict stream, const wchar_t* restrict format, ...); |
| 34 | int fwscanf(FILE* restrict stream, const wchar_t* restrict format, ...); |
| 35 | int swprintf(wchar_t* restrict s, size_t n, const wchar_t* restrict format, ...); |
| 36 | int swscanf(const wchar_t* restrict s, const wchar_t* restrict format, ...); |
| 37 | int vfwprintf(FILE* restrict stream, const wchar_t* restrict format, va_list arg); |
| 38 | int vfwscanf(FILE* restrict stream, const wchar_t* restrict format, va_list arg); // C99 |
| 39 | int vswprintf(wchar_t* restrict s, size_t n, const wchar_t* restrict format, va_list arg); |
| 40 | int vswscanf(const wchar_t* restrict s, const wchar_t* restrict format, va_list arg); // C99 |
| 41 | int vwprintf(const wchar_t* restrict format, va_list arg); |
| 42 | int vwscanf(const wchar_t* restrict format, va_list arg); // C99 |
| 43 | int wprintf(const wchar_t* restrict format, ...); |
| 44 | int wscanf(const wchar_t* restrict format, ...); |
| 45 | wint_t fgetwc(FILE* stream); |
| 46 | wchar_t* fgetws(wchar_t* restrict s, int n, FILE* restrict stream); |
| 47 | wint_t fputwc(wchar_t c, FILE* stream); |
| 48 | int fputws(const wchar_t* restrict s, FILE* restrict stream); |
| 49 | int fwide(FILE* stream, int mode); |
| 50 | wint_t getwc(FILE* stream); |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 51 | wint_t getwchar(); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 52 | wint_t putwc(wchar_t c, FILE* stream); |
| 53 | wint_t putwchar(wchar_t c); |
| 54 | wint_t ungetwc(wint_t c, FILE* stream); |
| 55 | double wcstod(const wchar_t* restrict nptr, wchar_t** restrict endptr); |
| 56 | float wcstof(const wchar_t* restrict nptr, wchar_t** restrict endptr); // C99 |
| 57 | long double wcstold(const wchar_t* restrict nptr, wchar_t** restrict endptr); // C99 |
| 58 | long wcstol(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base); |
| 59 | long long wcstoll(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base); // C99 |
| 60 | unsigned long wcstoul(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base); |
| 61 | unsigned long long wcstoull(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base); // C99 |
| 62 | wchar_t* wcscpy(wchar_t* restrict s1, const wchar_t* restrict s2); |
| 63 | wchar_t* wcsncpy(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n); |
| 64 | wchar_t* wcscat(wchar_t* restrict s1, const wchar_t* restrict s2); |
| 65 | wchar_t* wcsncat(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n); |
| 66 | int wcscmp(const wchar_t* s1, const wchar_t* s2); |
| 67 | int wcscoll(const wchar_t* s1, const wchar_t* s2); |
| 68 | int wcsncmp(const wchar_t* s1, const wchar_t* s2, size_t n); |
| 69 | size_t wcsxfrm(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n); |
| 70 | const wchar_t* wcschr(const wchar_t* s, wchar_t c); |
| 71 | wchar_t* wcschr( wchar_t* s, wchar_t c); |
| 72 | size_t wcscspn(const wchar_t* s1, const wchar_t* s2); |
| 73 | size_t wcslen(const wchar_t* s); |
| 74 | const wchar_t* wcspbrk(const wchar_t* s1, const wchar_t* s2); |
| 75 | wchar_t* wcspbrk( wchar_t* s1, const wchar_t* s2); |
| 76 | const wchar_t* wcsrchr(const wchar_t* s, wchar_t c); |
| 77 | wchar_t* wcsrchr( wchar_t* s, wchar_t c); |
| 78 | size_t wcsspn(const wchar_t* s1, const wchar_t* s2); |
| 79 | const wchar_t* wcsstr(const wchar_t* s1, const wchar_t* s2); |
| 80 | wchar_t* wcsstr( wchar_t* s1, const wchar_t* s2); |
| 81 | wchar_t* wcstok(wchar_t* restrict s1, const wchar_t* restrict s2, wchar_t** restrict ptr); |
| 82 | const wchar_t* wmemchr(const wchar_t* s, wchar_t c, size_t n); |
| 83 | wchar_t* wmemchr( wchar_t* s, wchar_t c, size_t n); |
| 84 | int wmemcmp(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n); |
| 85 | wchar_t* wmemcpy(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n); |
| 86 | wchar_t* wmemmove(wchar_t* s1, const wchar_t* s2, size_t n); |
| 87 | wchar_t* wmemset(wchar_t* s, wchar_t c, size_t n); |
| 88 | size_t wcsftime(wchar_t* restrict s, size_t maxsize, const wchar_t* restrict format, |
| 89 | const tm* restrict timeptr); |
| 90 | wint_t btowc(int c); |
| 91 | int wctob(wint_t c); |
| 92 | int mbsinit(const mbstate_t* ps); |
| 93 | size_t mbrlen(const char* restrict s, size_t n, mbstate_t* restrict ps); |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 94 | size_t mbrtowc(wchar_t* restrict pwc, const char* restrict s, size_t n, mbstate_t* restrict ps); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 95 | size_t wcrtomb(char* restrict s, wchar_t wc, mbstate_t* restrict ps); |
| 96 | size_t mbsrtowcs(wchar_t* restrict dst, const char** restrict src, size_t len, |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 97 | mbstate_t* restrict ps); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 98 | size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len, |
| 99 | mbstate_t* restrict ps); |
| 100 | |
| 101 | } // std |
| 102 | |
| 103 | */ |
| 104 | |
| 105 | #include <__config> |
| 106 | #include <cwctype> |
| 107 | #include <wchar.h> |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 108 | |
Howard Hinnant | aaaa52b | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 109 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 110 | #pragma GCC system_header |
Howard Hinnant | aaaa52b | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 111 | #endif |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 112 | |
| 113 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 114 | |
| 115 | using ::mbstate_t; |
| 116 | using ::size_t; |
| 117 | using ::tm; |
| 118 | using ::wint_t; |
| 119 | using ::FILE; |
| 120 | using ::fwprintf; |
| 121 | using ::fwscanf; |
| 122 | using ::swprintf; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 123 | using ::vfwprintf; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 124 | using ::vswprintf; |
Howard Hinnant | bf07402 | 2011-10-22 20:59:45 +0000 | [diff] [blame] | 125 | using ::swscanf; |
| 126 | using ::vfwscanf; |
| 127 | using ::vswscanf; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 128 | using ::fgetwc; |
| 129 | using ::fgetws; |
| 130 | using ::fputwc; |
| 131 | using ::fputws; |
| 132 | using ::fwide; |
| 133 | using ::getwc; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 134 | using ::putwc; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 135 | using ::ungetwc; |
| 136 | using ::wcstod; |
| 137 | using ::wcstof; |
| 138 | using ::wcstold; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 139 | using ::wcstol; |
Howard Hinnant | 1383035 | 2012-11-26 21:18:17 +0000 | [diff] [blame] | 140 | #ifndef _LIBCPP_HAS_NO_LONG_LONG |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 141 | using ::wcstoll; |
Howard Hinnant | 1383035 | 2012-11-26 21:18:17 +0000 | [diff] [blame] | 142 | #endif // _LIBCPP_HAS_NO_LONG_LONG |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 143 | using ::wcstoul; |
Howard Hinnant | 1383035 | 2012-11-26 21:18:17 +0000 | [diff] [blame] | 144 | #ifndef _LIBCPP_HAS_NO_LONG_LONG |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 145 | using ::wcstoull; |
Howard Hinnant | 1383035 | 2012-11-26 21:18:17 +0000 | [diff] [blame] | 146 | #endif // _LIBCPP_HAS_NO_LONG_LONG |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 147 | using ::wcscpy; |
| 148 | using ::wcsncpy; |
| 149 | using ::wcscat; |
| 150 | using ::wcsncat; |
| 151 | using ::wcscmp; |
| 152 | using ::wcscoll; |
| 153 | using ::wcsncmp; |
| 154 | using ::wcsxfrm; |
Howard Hinnant | ebb9307 | 2013-04-08 18:59:28 +0000 | [diff] [blame] | 155 | using ::wcschr; |
| 156 | using ::wcspbrk; |
| 157 | using ::wcsrchr; |
| 158 | using ::wcsstr; |
| 159 | using ::wmemchr; |
Howard Hinnant | ebb9307 | 2013-04-08 18:59:28 +0000 | [diff] [blame] | 160 | using ::wcscspn; |
| 161 | using ::wcslen; |
| 162 | using ::wcsspn; |
| 163 | using ::wcstok; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 164 | using ::wmemcmp; |
| 165 | using ::wmemcpy; |
| 166 | using ::wmemmove; |
| 167 | using ::wmemset; |
| 168 | using ::wcsftime; |
| 169 | using ::btowc; |
| 170 | using ::wctob; |
| 171 | using ::mbsinit; |
| 172 | using ::mbrlen; |
| 173 | using ::mbrtowc; |
| 174 | using ::wcrtomb; |
| 175 | using ::mbsrtowcs; |
| 176 | using ::wcsrtombs; |
| 177 | |
Ed Schouten | 3a75c0b | 2015-03-26 14:35:46 +0000 | [diff] [blame] | 178 | #ifndef _LIBCPP_HAS_NO_STDIN |
| 179 | using ::getwchar; |
Ed Schouten | 3a75c0b | 2015-03-26 14:35:46 +0000 | [diff] [blame] | 180 | using ::vwscanf; |
Ed Schouten | 3a75c0b | 2015-03-26 14:35:46 +0000 | [diff] [blame] | 181 | using ::wscanf; |
| 182 | #endif |
| 183 | |
| 184 | #ifndef _LIBCPP_HAS_NO_STDOUT |
| 185 | using ::putwchar; |
| 186 | using ::vwprintf; |
| 187 | using ::wprintf; |
| 188 | #endif |
| 189 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 190 | _LIBCPP_END_NAMESPACE_STD |
| 191 | |
| 192 | #endif // _LIBCPP_CWCHAR |