14684ddb6SLionel Sambuc// -*- C++ -*- 24684ddb6SLionel Sambuc//===--------------------------- cwchar -----------------------------------===// 34684ddb6SLionel Sambuc// 44684ddb6SLionel Sambuc// The LLVM Compiler Infrastructure 54684ddb6SLionel Sambuc// 64684ddb6SLionel Sambuc// This file is dual licensed under the MIT and the University of Illinois Open 74684ddb6SLionel Sambuc// Source Licenses. See LICENSE.TXT for details. 84684ddb6SLionel Sambuc// 94684ddb6SLionel Sambuc//===----------------------------------------------------------------------===// 104684ddb6SLionel Sambuc 114684ddb6SLionel Sambuc#ifndef _LIBCPP_CWCHAR 124684ddb6SLionel Sambuc#define _LIBCPP_CWCHAR 134684ddb6SLionel Sambuc 144684ddb6SLionel Sambuc/* 154684ddb6SLionel Sambuc cwchar synopsis 164684ddb6SLionel Sambuc 174684ddb6SLionel SambucMacros: 184684ddb6SLionel Sambuc 194684ddb6SLionel Sambuc NULL 204684ddb6SLionel Sambuc WCHAR_MAX 214684ddb6SLionel Sambuc WCHAR_MIN 224684ddb6SLionel Sambuc WEOF 234684ddb6SLionel Sambuc 244684ddb6SLionel Sambucnamespace std 254684ddb6SLionel Sambuc{ 264684ddb6SLionel Sambuc 274684ddb6SLionel SambucTypes: 284684ddb6SLionel Sambuc 294684ddb6SLionel Sambuc mbstate_t 304684ddb6SLionel Sambuc size_t 314684ddb6SLionel Sambuc tm 324684ddb6SLionel Sambuc wint_t 334684ddb6SLionel Sambuc 344684ddb6SLionel Sambucint fwprintf(FILE* restrict stream, const wchar_t* restrict format, ...); 354684ddb6SLionel Sambucint fwscanf(FILE* restrict stream, const wchar_t* restrict format, ...); 364684ddb6SLionel Sambucint swprintf(wchar_t* restrict s, size_t n, const wchar_t* restrict format, ...); 374684ddb6SLionel Sambucint swscanf(const wchar_t* restrict s, const wchar_t* restrict format, ...); 384684ddb6SLionel Sambucint vfwprintf(FILE* restrict stream, const wchar_t* restrict format, va_list arg); 394684ddb6SLionel Sambucint vfwscanf(FILE* restrict stream, const wchar_t* restrict format, va_list arg); // C99 404684ddb6SLionel Sambucint vswprintf(wchar_t* restrict s, size_t n, const wchar_t* restrict format, va_list arg); 414684ddb6SLionel Sambucint vswscanf(const wchar_t* restrict s, const wchar_t* restrict format, va_list arg); // C99 424684ddb6SLionel Sambucint vwprintf(const wchar_t* restrict format, va_list arg); 434684ddb6SLionel Sambucint vwscanf(const wchar_t* restrict format, va_list arg); // C99 444684ddb6SLionel Sambucint wprintf(const wchar_t* restrict format, ...); 454684ddb6SLionel Sambucint wscanf(const wchar_t* restrict format, ...); 464684ddb6SLionel Sambucwint_t fgetwc(FILE* stream); 474684ddb6SLionel Sambucwchar_t* fgetws(wchar_t* restrict s, int n, FILE* restrict stream); 484684ddb6SLionel Sambucwint_t fputwc(wchar_t c, FILE* stream); 494684ddb6SLionel Sambucint fputws(const wchar_t* restrict s, FILE* restrict stream); 504684ddb6SLionel Sambucint fwide(FILE* stream, int mode); 514684ddb6SLionel Sambucwint_t getwc(FILE* stream); 524684ddb6SLionel Sambucwint_t getwchar(); 534684ddb6SLionel Sambucwint_t putwc(wchar_t c, FILE* stream); 544684ddb6SLionel Sambucwint_t putwchar(wchar_t c); 554684ddb6SLionel Sambucwint_t ungetwc(wint_t c, FILE* stream); 564684ddb6SLionel Sambucdouble wcstod(const wchar_t* restrict nptr, wchar_t** restrict endptr); 574684ddb6SLionel Sambucfloat wcstof(const wchar_t* restrict nptr, wchar_t** restrict endptr); // C99 584684ddb6SLionel Sambuclong double wcstold(const wchar_t* restrict nptr, wchar_t** restrict endptr); // C99 594684ddb6SLionel Sambuclong wcstol(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base); 604684ddb6SLionel Sambuclong long wcstoll(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base); // C99 614684ddb6SLionel Sambucunsigned long wcstoul(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base); 624684ddb6SLionel Sambucunsigned long long wcstoull(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base); // C99 634684ddb6SLionel Sambucwchar_t* wcscpy(wchar_t* restrict s1, const wchar_t* restrict s2); 644684ddb6SLionel Sambucwchar_t* wcsncpy(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n); 654684ddb6SLionel Sambucwchar_t* wcscat(wchar_t* restrict s1, const wchar_t* restrict s2); 664684ddb6SLionel Sambucwchar_t* wcsncat(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n); 674684ddb6SLionel Sambucint wcscmp(const wchar_t* s1, const wchar_t* s2); 684684ddb6SLionel Sambucint wcscoll(const wchar_t* s1, const wchar_t* s2); 694684ddb6SLionel Sambucint wcsncmp(const wchar_t* s1, const wchar_t* s2, size_t n); 704684ddb6SLionel Sambucsize_t wcsxfrm(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n); 714684ddb6SLionel Sambucconst wchar_t* wcschr(const wchar_t* s, wchar_t c); 724684ddb6SLionel Sambuc wchar_t* wcschr( wchar_t* s, wchar_t c); 734684ddb6SLionel Sambucsize_t wcscspn(const wchar_t* s1, const wchar_t* s2); 744684ddb6SLionel Sambucsize_t wcslen(const wchar_t* s); 754684ddb6SLionel Sambucconst wchar_t* wcspbrk(const wchar_t* s1, const wchar_t* s2); 764684ddb6SLionel Sambuc wchar_t* wcspbrk( wchar_t* s1, const wchar_t* s2); 774684ddb6SLionel Sambucconst wchar_t* wcsrchr(const wchar_t* s, wchar_t c); 784684ddb6SLionel Sambuc wchar_t* wcsrchr( wchar_t* s, wchar_t c); 794684ddb6SLionel Sambucsize_t wcsspn(const wchar_t* s1, const wchar_t* s2); 804684ddb6SLionel Sambucconst wchar_t* wcsstr(const wchar_t* s1, const wchar_t* s2); 814684ddb6SLionel Sambuc wchar_t* wcsstr( wchar_t* s1, const wchar_t* s2); 824684ddb6SLionel Sambucwchar_t* wcstok(wchar_t* restrict s1, const wchar_t* restrict s2, wchar_t** restrict ptr); 834684ddb6SLionel Sambucconst wchar_t* wmemchr(const wchar_t* s, wchar_t c, size_t n); 844684ddb6SLionel Sambuc wchar_t* wmemchr( wchar_t* s, wchar_t c, size_t n); 854684ddb6SLionel Sambucint wmemcmp(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n); 864684ddb6SLionel Sambucwchar_t* wmemcpy(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n); 874684ddb6SLionel Sambucwchar_t* wmemmove(wchar_t* s1, const wchar_t* s2, size_t n); 884684ddb6SLionel Sambucwchar_t* wmemset(wchar_t* s, wchar_t c, size_t n); 894684ddb6SLionel Sambucsize_t wcsftime(wchar_t* restrict s, size_t maxsize, const wchar_t* restrict format, 904684ddb6SLionel Sambuc const tm* restrict timeptr); 914684ddb6SLionel Sambucwint_t btowc(int c); 924684ddb6SLionel Sambucint wctob(wint_t c); 934684ddb6SLionel Sambucint mbsinit(const mbstate_t* ps); 944684ddb6SLionel Sambucsize_t mbrlen(const char* restrict s, size_t n, mbstate_t* restrict ps); 954684ddb6SLionel Sambucsize_t mbrtowc(wchar_t* restrict pwc, const char* restrict s, size_t n, mbstate_t* restrict ps); 964684ddb6SLionel Sambucsize_t wcrtomb(char* restrict s, wchar_t wc, mbstate_t* restrict ps); 974684ddb6SLionel Sambucsize_t mbsrtowcs(wchar_t* restrict dst, const char** restrict src, size_t len, 984684ddb6SLionel Sambuc mbstate_t* restrict ps); 994684ddb6SLionel Sambucsize_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len, 1004684ddb6SLionel Sambuc mbstate_t* restrict ps); 1014684ddb6SLionel Sambuc 1024684ddb6SLionel Sambuc} // std 1034684ddb6SLionel Sambuc 1044684ddb6SLionel Sambuc*/ 1054684ddb6SLionel Sambuc 1064684ddb6SLionel Sambuc#include <__config> 1074684ddb6SLionel Sambuc#include <cwctype> 1084684ddb6SLionel Sambuc#include <wchar.h> 1094684ddb6SLionel Sambuc#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__) 1104684ddb6SLionel Sambuc#include <support/win32/support.h> // pull in *swprintf defines 1114684ddb6SLionel Sambuc#endif // _LIBCPP_MSVCRT 1124684ddb6SLionel Sambuc 1134684ddb6SLionel Sambuc#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 1144684ddb6SLionel Sambuc#pragma GCC system_header 1154684ddb6SLionel Sambuc#endif 1164684ddb6SLionel Sambuc 1174684ddb6SLionel Sambuc_LIBCPP_BEGIN_NAMESPACE_STD 1184684ddb6SLionel Sambuc 1194684ddb6SLionel Sambucusing ::mbstate_t; 1204684ddb6SLionel Sambucusing ::size_t; 1214684ddb6SLionel Sambucusing ::tm; 1224684ddb6SLionel Sambucusing ::wint_t; 1234684ddb6SLionel Sambucusing ::FILE; 1244684ddb6SLionel Sambucusing ::fwprintf; 1254684ddb6SLionel Sambucusing ::fwscanf; 1264684ddb6SLionel Sambucusing ::swprintf; 1274684ddb6SLionel Sambucusing ::vfwprintf; 1284684ddb6SLionel Sambucusing ::vswprintf; 1294684ddb6SLionel Sambuc#ifndef _LIBCPP_MSVCRT 1304684ddb6SLionel Sambucusing ::swscanf; 1314684ddb6SLionel Sambucusing ::vfwscanf; 1324684ddb6SLionel Sambucusing ::vswscanf; 1334684ddb6SLionel Sambuc#endif // _LIBCPP_MSVCRT 1344684ddb6SLionel Sambucusing ::fgetwc; 1354684ddb6SLionel Sambucusing ::fgetws; 1364684ddb6SLionel Sambucusing ::fputwc; 1374684ddb6SLionel Sambucusing ::fputws; 1384684ddb6SLionel Sambucusing ::fwide; 1394684ddb6SLionel Sambucusing ::getwc; 1404684ddb6SLionel Sambucusing ::putwc; 1414684ddb6SLionel Sambucusing ::ungetwc; 1424684ddb6SLionel Sambucusing ::wcstod; 1434684ddb6SLionel Sambuc#ifndef _LIBCPP_MSVCRT 1444684ddb6SLionel Sambucusing ::wcstof; 1454684ddb6SLionel Sambucusing ::wcstold; 1464684ddb6SLionel Sambuc#endif // _LIBCPP_MSVCRT 1474684ddb6SLionel Sambucusing ::wcstol; 1484684ddb6SLionel Sambuc#ifndef _LIBCPP_HAS_NO_LONG_LONG 1494684ddb6SLionel Sambucusing ::wcstoll; 1504684ddb6SLionel Sambuc#endif // _LIBCPP_HAS_NO_LONG_LONG 1514684ddb6SLionel Sambucusing ::wcstoul; 1524684ddb6SLionel Sambuc#ifndef _LIBCPP_HAS_NO_LONG_LONG 1534684ddb6SLionel Sambucusing ::wcstoull; 1544684ddb6SLionel Sambuc#endif // _LIBCPP_HAS_NO_LONG_LONG 1554684ddb6SLionel Sambucusing ::wcscpy; 1564684ddb6SLionel Sambucusing ::wcsncpy; 1574684ddb6SLionel Sambucusing ::wcscat; 1584684ddb6SLionel Sambucusing ::wcsncat; 1594684ddb6SLionel Sambucusing ::wcscmp; 1604684ddb6SLionel Sambucusing ::wcscoll; 1614684ddb6SLionel Sambucusing ::wcsncmp; 1624684ddb6SLionel Sambucusing ::wcsxfrm; 1634684ddb6SLionel Sambuc 1644684ddb6SLionel Sambuc#if defined(_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_) 1654684ddb6SLionel Sambuc 1664684ddb6SLionel Sambucusing ::wcschr; 1674684ddb6SLionel Sambucusing ::wcspbrk; 1684684ddb6SLionel Sambucusing ::wcsrchr; 1694684ddb6SLionel Sambucusing ::wcsstr; 1704684ddb6SLionel Sambucusing ::wmemchr; 1714684ddb6SLionel Sambuc 1724684ddb6SLionel Sambuc#else 1734684ddb6SLionel Sambuc 1744684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcschr(const wchar_t* __s, wchar_t __c) {return ::wcschr(__s, __c);} 1754684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY wchar_t* wcschr( wchar_t* __s, wchar_t __c) {return ::wcschr(__s, __c);} 1764684ddb6SLionel Sambuc 1774684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcspbrk(const wchar_t* __s1, const wchar_t* __s2) {return ::wcspbrk(__s1, __s2);} 1784684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY wchar_t* wcspbrk( wchar_t* __s1, const wchar_t* __s2) {return ::wcspbrk(__s1, __s2);} 1794684ddb6SLionel Sambuc 1804684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcsrchr(const wchar_t* __s, wchar_t __c) {return ::wcsrchr(__s, __c);} 1814684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY wchar_t* wcsrchr( wchar_t* __s, wchar_t __c) {return ::wcsrchr(__s, __c);} 1824684ddb6SLionel Sambuc 1834684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcsstr(const wchar_t* __s1, const wchar_t* __s2) {return ::wcsstr(__s1, __s2);} 1844684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY wchar_t* wcsstr( wchar_t* __s1, const wchar_t* __s2) {return ::wcsstr(__s1, __s2);} 1854684ddb6SLionel Sambuc 1864684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY const wchar_t* wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {return ::wmemchr(__s, __c, __n);} 1874684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY wchar_t* wmemchr( wchar_t* __s, wchar_t __c, size_t __n) {return ::wmemchr(__s, __c, __n);} 1884684ddb6SLionel Sambuc 1894684ddb6SLionel Sambuc#endif 1904684ddb6SLionel Sambuc 1914684ddb6SLionel Sambucusing ::wcscspn; 1924684ddb6SLionel Sambucusing ::wcslen; 1934684ddb6SLionel Sambucusing ::wcsspn; 1944684ddb6SLionel Sambucusing ::wcstok; 1954684ddb6SLionel Sambucusing ::wmemcmp; 1964684ddb6SLionel Sambucusing ::wmemcpy; 1974684ddb6SLionel Sambucusing ::wmemmove; 1984684ddb6SLionel Sambucusing ::wmemset; 1994684ddb6SLionel Sambucusing ::wcsftime; 2004684ddb6SLionel Sambucusing ::btowc; 2014684ddb6SLionel Sambucusing ::wctob; 2024684ddb6SLionel Sambucusing ::mbsinit; 2034684ddb6SLionel Sambucusing ::mbrlen; 2044684ddb6SLionel Sambucusing ::mbrtowc; 2054684ddb6SLionel Sambucusing ::wcrtomb; 2064684ddb6SLionel Sambucusing ::mbsrtowcs; 2074684ddb6SLionel Sambucusing ::wcsrtombs; 2084684ddb6SLionel Sambuc 209*0a6a1f1dSLionel Sambuc#ifndef _LIBCPP_HAS_NO_STDIN 210*0a6a1f1dSLionel Sambucusing ::getwchar; 211*0a6a1f1dSLionel Sambuc#ifndef _LIBCPP_MSVCRT 212*0a6a1f1dSLionel Sambucusing ::vwscanf; 213*0a6a1f1dSLionel Sambuc#endif // _LIBCPP_MSVCRT 214*0a6a1f1dSLionel Sambucusing ::wscanf; 215*0a6a1f1dSLionel Sambuc#endif 216*0a6a1f1dSLionel Sambuc 217*0a6a1f1dSLionel Sambuc#ifndef _LIBCPP_HAS_NO_STDOUT 218*0a6a1f1dSLionel Sambucusing ::putwchar; 219*0a6a1f1dSLionel Sambucusing ::vwprintf; 220*0a6a1f1dSLionel Sambucusing ::wprintf; 221*0a6a1f1dSLionel Sambuc#endif 222*0a6a1f1dSLionel Sambuc 2234684ddb6SLionel Sambuc_LIBCPP_END_NAMESPACE_STD 2244684ddb6SLionel Sambuc 2254684ddb6SLionel Sambuc#endif // _LIBCPP_CWCHAR 226