From aa0108c75e4177b6db0705ce42998e92c6ac734f Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Fri, 29 Mar 2013 16:19:55 +0700 Subject: Update to r178253 from March 29, 2013. --- system/lib/libcxx/locale.cpp | 54 +++++++++++++------------------------------- 1 file changed, 16 insertions(+), 38 deletions(-) (limited to 'system/lib/libcxx/locale.cpp') diff --git a/system/lib/libcxx/locale.cpp b/system/lib/libcxx/locale.cpp index 35a65086..b7a47843 100644 --- a/system/lib/libcxx/locale.cpp +++ b/system/lib/libcxx/locale.cpp @@ -25,7 +25,7 @@ #include "cstring" #include "cwctype" #include "__sso_allocator" -#if _WIN32 +#ifdef _WIN32 #include #else // _WIN32 #include @@ -786,7 +786,7 @@ ctype::do_toupper(char_type c) const { #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE return isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c; -#elif defined(__GLIBC__) || defined(EMSCRIPTEN) +#elif defined(__GLIBC__) return isascii(c) ? ctype::__classic_upper_table()[c] : c; #else return (isascii(c) && iswlower_l(c, __cloc())) ? c-L'a'+L'A' : c; @@ -799,7 +799,7 @@ ctype::do_toupper(char_type* low, const char_type* high) const for (; low != high; ++low) #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE *low = isascii(*low) ? _DefaultRuneLocale.__mapupper[*low] : *low; -#elif defined(__GLIBC__) || defined(EMSCRIPTEN) +#elif defined(__GLIBC__) *low = isascii(*low) ? ctype::__classic_upper_table()[*low] : *low; #else @@ -813,7 +813,7 @@ ctype::do_tolower(char_type c) const { #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE return isascii(c) ? _DefaultRuneLocale.__maplower[c] : c; -#elif defined(__GLIBC__) || defined(EMSCRIPTEN) +#elif defined(__GLIBC__) return isascii(c) ? ctype::__classic_lower_table()[c] : c; #else return (isascii(c) && isupper_l(c, __cloc())) ? c-L'A'+'a' : c; @@ -826,7 +826,7 @@ ctype::do_tolower(char_type* low, const char_type* high) const for (; low != high; ++low) #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE *low = isascii(*low) ? _DefaultRuneLocale.__maplower[*low] : *low; -#elif defined(__GLIBC__) || defined(EMSCRIPTEN) +#elif defined(__GLIBC__) *low = isascii(*low) ? ctype::__classic_lower_table()[*low] : *low; #else @@ -893,7 +893,7 @@ ctype::do_toupper(char_type c) const #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE return isascii(c) ? static_cast(_DefaultRuneLocale.__mapupper[static_cast(c)]) : c; -#elif defined(__GLIBC__) || defined(EMSCRIPTEN) +#elif defined(__GLIBC__) return isascii(c) ? static_cast(__classic_upper_table()[static_cast(c)]) : c; #else @@ -908,7 +908,7 @@ ctype::do_toupper(char_type* low, const char_type* high) const #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE *low = isascii(*low) ? static_cast(_DefaultRuneLocale.__mapupper[static_cast(*low)]) : *low; -#elif defined(__GLIBC__) || defined(EMSCRIPTEN) +#elif defined(__GLIBC__) *low = isascii(*low) ? static_cast(__classic_upper_table()[static_cast(*low)]) : *low; #else @@ -923,7 +923,7 @@ ctype::do_tolower(char_type c) const #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE return isascii(c) ? static_cast(_DefaultRuneLocale.__maplower[static_cast(c)]) : c; -#elif defined(__GLIBC__) || defined(EMSCRIPTEN) +#elif defined(__GLIBC__) return isascii(c) ? static_cast(__classic_lower_table()[static_cast(c)]) : c; #else @@ -937,7 +937,7 @@ ctype::do_tolower(char_type* low, const char_type* high) const for (; low != high; ++low) #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE *low = isascii(*low) ? static_cast(_DefaultRuneLocale.__maplower[static_cast(*low)]) : *low; -#elif defined(__GLIBC__) || defined(EMSCRIPTEN) +#elif defined(__GLIBC__) *low = isascii(*low) ? static_cast(__classic_lower_table()[static_cast(*low)]) : *low; #else *low = (isascii(*low) && isupper_l(*low, __cloc())) ? *low-'A'+'a' : *low; @@ -978,12 +978,6 @@ ctype::do_narrow(const char_type* low, const char_type* high, char dfault, return low; } -#ifdef EMSCRIPTEN -extern "C" const unsigned short ** __ctype_b_loc(); -extern "C" const int ** __ctype_tolower_loc(); -extern "C" const int ** __ctype_toupper_loc(); -#endif - const ctype::mask* ctype::classic_table() _NOEXCEPT { @@ -993,12 +987,10 @@ ctype::classic_table() _NOEXCEPT return __cloc()->__ctype_b; #elif __sun__ return __ctype_mask; -#elif _WIN32 +#elif defined(_WIN32) return _ctype+1; // internal ctype mask table defined in msvcrt.dll // This is assumed to be safe, which is a nonsense assumption because we're // going to end up dereferencing it later... -#elif EMSCRIPTEN - return *__ctype_b_loc(); #else // Platform not supported: abort so the person doing the port knows what to // fix @@ -1022,20 +1014,6 @@ ctype::__classic_upper_table() _NOEXCEPT } #endif // __GLIBC__ -#if defined(EMSCRIPTEN) -const int* -ctype::__classic_lower_table() _NOEXCEPT -{ - return *__ctype_tolower_loc(); -} - -const int* -ctype::__classic_upper_table() _NOEXCEPT -{ - return *__ctype_toupper_loc(); -} -#endif // EMSCRIPTEN - // template <> class ctype_byname ctype_byname::ctype_byname(const char* name, size_t refs) @@ -5801,7 +5779,7 @@ moneypunct_byname::init(const char* nm) __frac_digits_ = lc->int_frac_digits; else __frac_digits_ = base::do_frac_digits(); -#if _WIN32 +#ifdef _WIN32 if (lc->p_sign_posn == 0) #else // _WIN32 if (lc->int_p_sign_posn == 0) @@ -5809,7 +5787,7 @@ moneypunct_byname::init(const char* nm) __positive_sign_ = "()"; else __positive_sign_ = lc->positive_sign; -#if _WIN32 +#ifdef _WIN32 if(lc->n_sign_posn == 0) #else // _WIN32 if (lc->int_n_sign_posn == 0) @@ -5821,7 +5799,7 @@ moneypunct_byname::init(const char* nm) // the same places in curr_symbol since there's no way to // represent anything else. string_type __dummy_curr_symbol = __curr_symbol_; -#if _WIN32 +#ifdef _WIN32 __init_pat(__pos_format_, __dummy_curr_symbol, true, lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn, ' '); __init_pat(__neg_format_, __curr_symbol_, true, @@ -5960,7 +5938,7 @@ moneypunct_byname::init(const char* nm) __frac_digits_ = lc->int_frac_digits; else __frac_digits_ = base::do_frac_digits(); -#if _WIN32 +#ifdef _WIN32 if (lc->p_sign_posn == 0) #else // _WIN32 if (lc->int_p_sign_posn == 0) @@ -5980,7 +5958,7 @@ moneypunct_byname::init(const char* nm) wbe = wbuf + j; __positive_sign_.assign(wbuf, wbe); } -#if _WIN32 +#ifdef _WIN32 if (lc->n_sign_posn == 0) #else // _WIN32 if (lc->int_n_sign_posn == 0) @@ -6004,7 +5982,7 @@ moneypunct_byname::init(const char* nm) // the same places in curr_symbol since there's no way to // represent anything else. string_type __dummy_curr_symbol = __curr_symbol_; -#if _WIN32 +#ifdef _WIN32 __init_pat(__pos_format_, __dummy_curr_symbol, true, lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn, L' '); __init_pat(__neg_format_, __curr_symbol_, true, -- cgit v1.2.3-18-g5258