Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1 | // -*- C++ -*- |
| 2 | //===--------------------------- cwchar -----------------------------------===// |
| 3 | // |
Howard Hinnant | f5256e1 | 2010-05-11 21:36:01 +0000 | [diff] [blame] | 4 | // The LLVM Compiler Infrastructure |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 5 | // |
Howard Hinnant | b64f8b0 | 2010-11-16 22:09:02 +0000 | [diff] [blame] | 6 | // This file is dual licensed under the MIT and the University of Illinois Open |
| 7 | // Source Licenses. See LICENSE.TXT for details. |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 8 | // |
| 9 | //===----------------------------------------------------------------------===// |
| 10 | |
| 11 | #ifndef _LIBCPP_CWCHAR |
| 12 | #define _LIBCPP_CWCHAR |
| 13 | |
| 14 | /* |
| 15 | cwchar synopsis |
| 16 | |
| 17 | Macros: |
| 18 | |
| 19 | NULL |
| 20 | WCHAR_MAX |
| 21 | WCHAR_MIN |
| 22 | WEOF |
Howard Hinnant | 324bb03 | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 23 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 24 | namespace std |
| 25 | { |
| 26 | |
| 27 | Types: |
| 28 | |
| 29 | mbstate_t |
| 30 | size_t |
| 31 | tm |
| 32 | wint_t |
| 33 | |
| 34 | int fwprintf(FILE* restrict stream, const wchar_t* restrict format, ...); |
| 35 | int fwscanf(FILE* restrict stream, const wchar_t* restrict format, ...); |
| 36 | int swprintf(wchar_t* restrict s, size_t n, const wchar_t* restrict format, ...); |
| 37 | int swscanf(const wchar_t* restrict s, const wchar_t* restrict format, ...); |
| 38 | int vfwprintf(FILE* restrict stream, const wchar_t* restrict format, va_list arg); |
| 39 | int vfwscanf(FILE* restrict stream, const wchar_t* restrict format, va_list arg); // C99 |
| 40 | int vswprintf(wchar_t* restrict s, size_t n, const wchar_t* restrict format, va_list arg); |
| 41 | int vswscanf(const wchar_t* restrict s, const wchar_t* restrict format, va_list arg); // C99 |
| 42 | int vwprintf(const wchar_t* restrict format, va_list arg); |
| 43 | int vwscanf(const wchar_t* restrict format, va_list arg); // C99 |
| 44 | int wprintf(const wchar_t* restrict format, ...); |
| 45 | int wscanf(const wchar_t* restrict format, ...); |
| 46 | wint_t fgetwc(FILE* stream); |
| 47 | wchar_t* fgetws(wchar_t* restrict s, int n, FILE* restrict stream); |
| 48 | wint_t fputwc(wchar_t c, FILE* stream); |
| 49 | int fputws(const wchar_t* restrict s, FILE* restrict stream); |
| 50 | int fwide(FILE* stream, int mode); |
| 51 | wint_t getwc(FILE* stream); |
Howard Hinnant | 324bb03 | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 52 | wint_t getwchar(); |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 53 | wint_t putwc(wchar_t c, FILE* stream); |
| 54 | wint_t putwchar(wchar_t c); |
| 55 | wint_t ungetwc(wint_t c, FILE* stream); |
| 56 | double wcstod(const wchar_t* restrict nptr, wchar_t** restrict endptr); |
| 57 | float wcstof(const wchar_t* restrict nptr, wchar_t** restrict endptr); // C99 |
| 58 | long double wcstold(const wchar_t* restrict nptr, wchar_t** restrict endptr); // C99 |
| 59 | long wcstol(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base); |
| 60 | long long wcstoll(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base); // C99 |
| 61 | unsigned long wcstoul(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base); |
| 62 | unsigned long long wcstoull(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base); // C99 |
| 63 | wchar_t* wcscpy(wchar_t* restrict s1, const wchar_t* restrict s2); |
| 64 | wchar_t* wcsncpy(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n); |
| 65 | wchar_t* wcscat(wchar_t* restrict s1, const wchar_t* restrict s2); |
| 66 | wchar_t* wcsncat(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n); |
| 67 | int wcscmp(const wchar_t* s1, const wchar_t* s2); |
| 68 | int wcscoll(const wchar_t* s1, const wchar_t* s2); |
| 69 | int wcsncmp(const wchar_t* s1, const wchar_t* s2, size_t n); |
| 70 | size_t wcsxfrm(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n); |
| 71 | const wchar_t* wcschr(const wchar_t* s, wchar_t c); |
| 72 | wchar_t* wcschr( wchar_t* s, wchar_t c); |
| 73 | size_t wcscspn(const wchar_t* s1, const wchar_t* s2); |
| 74 | size_t wcslen(const wchar_t* s); |
| 75 | const wchar_t* wcspbrk(const wchar_t* s1, const wchar_t* s2); |
| 76 | wchar_t* wcspbrk( wchar_t* s1, const wchar_t* s2); |
| 77 | const wchar_t* wcsrchr(const wchar_t* s, wchar_t c); |
| 78 | wchar_t* wcsrchr( wchar_t* s, wchar_t c); |
| 79 | size_t wcsspn(const wchar_t* s1, const wchar_t* s2); |
| 80 | const wchar_t* wcsstr(const wchar_t* s1, const wchar_t* s2); |
| 81 | wchar_t* wcsstr( wchar_t* s1, const wchar_t* s2); |
| 82 | wchar_t* wcstok(wchar_t* restrict s1, const wchar_t* restrict s2, wchar_t** restrict ptr); |
| 83 | const 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); |
| 85 | int wmemcmp(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n); |
| 86 | wchar_t* wmemcpy(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n); |
| 87 | wchar_t* wmemmove(wchar_t* s1, const wchar_t* s2, size_t n); |
| 88 | wchar_t* wmemset(wchar_t* s, wchar_t c, size_t n); |
| 89 | size_t wcsftime(wchar_t* restrict s, size_t maxsize, const wchar_t* restrict format, |
| 90 | const tm* restrict timeptr); |
| 91 | wint_t btowc(int c); |
| 92 | int wctob(wint_t c); |
| 93 | int mbsinit(const mbstate_t* ps); |
| 94 | size_t mbrlen(const char* restrict s, size_t n, mbstate_t* restrict ps); |
Howard Hinnant | 324bb03 | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 95 | size_t mbrtowc(wchar_t* restrict pwc, const char* restrict s, size_t n, mbstate_t* restrict ps); |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 96 | size_t wcrtomb(char* restrict s, wchar_t wc, mbstate_t* restrict ps); |
| 97 | size_t mbsrtowcs(wchar_t* restrict dst, const char** restrict src, size_t len, |
Howard Hinnant | 324bb03 | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 98 | mbstate_t* restrict ps); |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 99 | size_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 Hinnant | efbe406 | 2011-09-28 21:39:20 +0000 | [diff] [blame] | 109 | #if _WIN32 |
| 110 | #include <support/win32/support.h> // pull in *swprintf defines |
| 111 | #endif // _WIN32 |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 112 | |
Howard Hinnant | 08e1747 | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 113 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 114 | #pragma GCC system_header |
Howard Hinnant | 08e1747 | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 115 | #endif |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 116 | |
| 117 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 118 | |
| 119 | using ::mbstate_t; |
| 120 | using ::size_t; |
| 121 | using ::tm; |
| 122 | using ::wint_t; |
| 123 | using ::FILE; |
| 124 | using ::fwprintf; |
| 125 | using ::fwscanf; |
| 126 | using ::swprintf; |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 127 | using ::vfwprintf; |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 128 | using ::vswprintf; |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 129 | using ::vwprintf; |
Howard Hinnant | 78b6828 | 2011-10-22 20:59:45 +0000 | [diff] [blame^] | 130 | #ifndef _MSC_VER |
| 131 | using ::swscanf; |
| 132 | using ::vfwscanf; |
| 133 | using ::vswscanf; |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 134 | using ::vwscanf; |
Howard Hinnant | 78b6828 | 2011-10-22 20:59:45 +0000 | [diff] [blame^] | 135 | #endif // _MSC_VER |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 136 | using ::wprintf; |
| 137 | using ::wscanf; |
| 138 | using ::fgetwc; |
| 139 | using ::fgetws; |
| 140 | using ::fputwc; |
| 141 | using ::fputws; |
| 142 | using ::fwide; |
| 143 | using ::getwc; |
| 144 | using ::getwchar; |
| 145 | using ::putwc; |
| 146 | using ::putwchar; |
| 147 | using ::ungetwc; |
| 148 | using ::wcstod; |
Howard Hinnant | 78b6828 | 2011-10-22 20:59:45 +0000 | [diff] [blame^] | 149 | #ifndef _MSC_VER |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 150 | using ::wcstof; |
| 151 | using ::wcstold; |
Howard Hinnant | 78b6828 | 2011-10-22 20:59:45 +0000 | [diff] [blame^] | 152 | #endif // _MSC_VER |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 153 | using ::wcstol; |
| 154 | using ::wcstoll; |
| 155 | using ::wcstoul; |
| 156 | using ::wcstoull; |
| 157 | using ::wcscpy; |
| 158 | using ::wcsncpy; |
| 159 | using ::wcscat; |
| 160 | using ::wcsncat; |
| 161 | using ::wcscmp; |
| 162 | using ::wcscoll; |
| 163 | using ::wcsncmp; |
| 164 | using ::wcsxfrm; |
| 165 | |
| 166 | inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcschr(const wchar_t* __s, wchar_t __c) {return ::wcschr(__s, __c);} |
| 167 | inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcschr( wchar_t* __s, wchar_t __c) {return ::wcschr(__s, __c);} |
| 168 | |
| 169 | using ::wcscspn; |
| 170 | using ::wcslen; |
| 171 | |
| 172 | inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcspbrk(const wchar_t* __s1, const wchar_t* __s2) {return ::wcspbrk(__s1, __s2);} |
| 173 | inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcspbrk( wchar_t* __s1, const wchar_t* __s2) {return ::wcspbrk(__s1, __s2);} |
| 174 | |
| 175 | inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcsrchr(const wchar_t* __s, wchar_t __c) {return ::wcsrchr(__s, __c);} |
| 176 | inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcsrchr( wchar_t* __s, wchar_t __c) {return ::wcsrchr(__s, __c);} |
| 177 | |
| 178 | using ::wcsspn; |
| 179 | |
| 180 | inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcsstr(const wchar_t* __s1, const wchar_t* __s2) {return ::wcsstr(__s1, __s2);} |
| 181 | inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcsstr( wchar_t* __s1, const wchar_t* __s2) {return ::wcsstr(__s1, __s2);} |
| 182 | |
| 183 | using ::wcstok; |
| 184 | |
| 185 | inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {return ::wmemchr(__s, __c, __n);} |
| 186 | inline _LIBCPP_INLINE_VISIBILITY wchar_t* wmemchr( wchar_t* __s, wchar_t __c, size_t __n) {return ::wmemchr(__s, __c, __n);} |
| 187 | |
| 188 | using ::wmemcmp; |
| 189 | using ::wmemcpy; |
| 190 | using ::wmemmove; |
| 191 | using ::wmemset; |
| 192 | using ::wcsftime; |
| 193 | using ::btowc; |
| 194 | using ::wctob; |
| 195 | using ::mbsinit; |
| 196 | using ::mbrlen; |
| 197 | using ::mbrtowc; |
| 198 | using ::wcrtomb; |
| 199 | using ::mbsrtowcs; |
| 200 | using ::wcsrtombs; |
| 201 | |
| 202 | _LIBCPP_END_NAMESPACE_STD |
| 203 | |
| 204 | #endif // _LIBCPP_CWCHAR |