aboutsummaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
Diffstat (limited to 'system')
-rw-r--r--system/include/libcxx/__locale15
-rw-r--r--system/lib/libcxx/locale.cpp13
-rw-r--r--system/lib/libcxx/symbols1
3 files changed, 26 insertions, 3 deletions
diff --git a/system/include/libcxx/__locale b/system/include/libcxx/__locale
index f63815c3..7b7cfcd7 100644
--- a/system/include/libcxx/__locale
+++ b/system/include/libcxx/__locale
@@ -330,8 +330,21 @@ public:
static const mask punct = _PUNCT;
static const mask xdigit = _HEX;
static const mask blank = _BLANK;
+#elif defined( EMSCRIPTEN )
+ #define _ISbit(bit) ((bit) < 8 ? ((1 << (bit)) << 8) : ((1 << (bit)) >> 8))
+ typedef __uint16_t mask;
+ static const mask upper = _ISbit( 0 );
+ static const mask lower = _ISbit( 1 );
+ static const mask alpha = _ISbit( 2 );
+ static const mask digit = _ISbit( 3 );
+ static const mask xdigit = _ISbit( 4 );
+ static const mask space = _ISbit( 5 );
+ static const mask print = _ISbit( 6 );
+ static const mask blank = _ISbit( 8 );
+ static const mask cntrl = _ISbit( 9 );
+ static const mask punct = _ISbit( 10 );
#else // __GLIBC__ || _WIN32
-#if defined(__APPLE__) || defined(EMSCRIPTEN)
+#if defined(__APPLE__)
typedef __uint32_t mask;
#elif __FreeBSD__
typedef unsigned long mask;
diff --git a/system/lib/libcxx/locale.cpp b/system/lib/libcxx/locale.cpp
index 388660d2..4675fec3 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 short ** __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;
diff --git a/system/lib/libcxx/symbols b/system/lib/libcxx/symbols
index 0cea51cb..23d4a7a4 100644
--- a/system/lib/libcxx/symbols
+++ b/system/lib/libcxx/symbols
@@ -2577,7 +2577,6 @@
T _ZSt17current_exceptionv
T _ZSt17rethrow_exceptionSt13exception_ptr
C _ZSt18make_exception_ptrINSt3__112future_errorEESt13exception_ptrT_
- T _ZSt18uncaught_exceptionv
D _ZSt7nothrow
D _ZTCNSt3__110istrstreamE0_NS_13basic_istreamIcNS_11char_traitsIcEEEE
D _ZTCNSt3__110ostrstreamE0_NS_13basic_ostreamIcNS_11char_traitsIcEEEE