Fix libcxx locale (now use emscripten mask table )

This commit is contained in:
julien.hamaide 2012-02-07 13:22:39 +01:00
Родитель b782221bf8
Коммит 29fbebcc21
2 изменённых файлов: 34 добавлений и 1 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -3743,6 +3743,28 @@ def process(filename):
'''
self.do_run(src, "some string constant")
def test_istream(self):
if self.emcc_args is None: return self.skip('requires libcxx')
src = '''
#include <string>
#include <sstream>
#include <iostream>
int main()
{
std::string mystring("1 2 3");
std::istringstream is(mystring);
int one, two, three;
is >> one >> two >> three;
printf( "%i %i %i", one, two, three );
}
'''
self.do_run(src, "1 2 3")
def test_fs_base(self):
Settings.INCLUDE_FULL_LIBRARY = 1
try: