diff options
author | julien.hamaide <julien.hamaide@fishingcactus.com> | 2012-02-07 13:22:39 +0100 |
---|---|---|
committer | julien.hamaide <julien.hamaide@fishingcactus.com> | 2012-02-07 13:22:39 +0100 |
commit | 29fbebcc21df391a8f244d39634812a4fe6d2e5e (patch) | |
tree | 02d18667909e78b68e580a6e4565eeb37122943f /system/lib/libcxx | |
parent | b782221bf8a5d1271c3277e27360adc1d5e7bb75 (diff) |
Fix libcxx locale (now use emscripten mask table )
Diffstat (limited to 'system/lib/libcxx')
-rw-r--r-- | system/lib/libcxx/locale.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/system/lib/libcxx/locale.cpp b/system/lib/libcxx/locale.cpp index 388660d2..0530b7af 100644 --- a/system/lib/libcxx/locale.cpp +++ b/system/lib/libcxx/locale.cpp @@ -909,6 +909,11 @@ ctype<char>::do_narrow(const char_type* low, const char_type* high, char dfault, return low; } +// XXX Emscripten define local table +extern "C" const unsigned int ** __ctype_b_loc(); +extern "C" const int ** __ctype_tolower_loc(); +extern "C" const int ** __ctype_toupper_loc(); + const ctype<char>::mask* ctype<char>::classic_table() _NOEXCEPT { @@ -918,6 +923,8 @@ ctype<char>::classic_table() _NOEXCEPT return __cloc()->__ctype_b; // This is assumed to be safe, which is a nonsense assumption because we're // going to end up dereferencing it later... +#elif defined(EMSCRIPTEN) + return *__ctype_b_loc(); #else return NULL; #endif @@ -931,6 +938,8 @@ ctype<char>::__classic_lower_table() _NOEXCEPT return _DefaultRuneLocale.__maplower; #elif defined(__GLIBC__) return __cloc()->__ctype_tolower; +#elif defined(EMSCRIPTEN) + return *__ctype_tolower_loc(); #else return NULL; #endif @@ -943,6 +952,8 @@ ctype<char>::__classic_upper_table() _NOEXCEPT return _DefaultRuneLocale.__mapupper; #elif defined(__GLIBC__) return __cloc()->__ctype_toupper; +#elif defined(EMSCRIPTEN) + return *__ctype_toupper_loc(); #else return NULL; #endif @@ -1041,7 +1052,7 @@ ctype_byname<wchar_t>::do_is(mask m, char_type c) const #ifdef _LIBCPP_WCTYPE_IS_MASK return static_cast<bool>(iswctype_l(c, m, __l)); #else - // FIXME: This is broken for things that test more than one flag. + // FIXME: This is broken for things that test more than one flag. if (m & space && !iswspace_l(c, __l)) return false; if (m & print && !iswprint_l(c, __l)) return false; if (m & cntrl && !iswcntrl_l(c, __l)) return false; |