diff options
-rw-r--r-- | AUTHORS | 1 | ||||
-rw-r--r-- | cmake/Platform/Emscripten.cmake | 10 | ||||
-rw-r--r-- | src/library.js | 14 | ||||
-rw-r--r-- | system/lib/gl.c | 4 | ||||
-rw-r--r-- | tests/test_core.py | 4 | ||||
-rw-r--r-- | tests/test_locale.c | 24 | ||||
-rw-r--r-- | tests/test_locale.out | 12 |
7 files changed, 62 insertions, 7 deletions
@@ -125,3 +125,4 @@ a license to everyone to use it as detailed in LICENSE.) * Sami Vaarala <sami.vaarala@iki.fi> * Jack A. Arrington <jack@epicpineapple.com> * Richard Janicek <r@janicek.co> +* Joel Croteau <jcroteau@gmail.com> diff --git a/cmake/Platform/Emscripten.cmake b/cmake/Platform/Emscripten.cmake index 4f434d14..7d86c467 100644 --- a/cmake/Platform/Emscripten.cmake +++ b/cmake/Platform/Emscripten.cmake @@ -125,20 +125,20 @@ set(CMAKE_C_SIZEOF_DATA_PTR 4) set(CMAKE_CXX_SIZEOF_DATA_PTR 4) set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG -O2" CACHE STRING "Emscripten-overridden CMAKE_C_FLAGS_RELEASE") -set(CMAKE_C_FLAGS_MINSIZEREL "-DNDEBUG -O2" CACHE STRING "Emscripten-overridden CMAKE_C_FLAGS_MINSIZEREL") +set(CMAKE_C_FLAGS_MINSIZEREL "-DNDEBUG -Os" CACHE STRING "Emscripten-overridden CMAKE_C_FLAGS_MINSIZEREL") set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2" CACHE STRING "Emscripten-overridden CMAKE_C_FLAGS_RELWITHDEBINFO") set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -O2" CACHE STRING "Emscripten-overridden CMAKE_CXX_FLAGS_RELEASE") -set(CMAKE_CXX_FLAGS_MINSIZEREL "-DNDEBUG -O2" CACHE STRING "Emscripten-overridden CMAKE_CXX_FLAGS_MINSIZEREL") +set(CMAKE_CXX_FLAGS_MINSIZEREL "-DNDEBUG -Os" CACHE STRING "Emscripten-overridden CMAKE_CXX_FLAGS_MINSIZEREL") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2" CACHE STRING "Emscripten-overridden CMAKE_CXX_FLAGS_RELWITHDEBINFO") set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-O2" CACHE STRING "Emscripten-overridden CMAKE_EXE_LINKER_FLAGS_RELEASE") -set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "-O2" CACHE STRING "Emscripten-overridden CMAKE_EXE_LINKER_FLAGS_MINSIZEREL") +set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "-Os" CACHE STRING "Emscripten-overridden CMAKE_EXE_LINKER_FLAGS_MINSIZEREL") set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "-O2 -g" CACHE STRING "Emscripten-overridden CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO") set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "-O2" CACHE STRING "Emscripten-overridden CMAKE_SHARED_LINKER_FLAGS_RELEASE") -set(CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "-O2" CACHE STRING "Emscripten-overridden CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL") +set(CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "-Os" CACHE STRING "Emscripten-overridden CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL") set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "-O2 -g" CACHE STRING "Emscripten-overridden CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO") set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "-O2" CACHE STRING "Emscripten-overridden CMAKE_MODULE_LINKER_FLAGS_RELEASE") -set(CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL "-O2" CACHE STRING "Emscripten-overridden CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL") +set(CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL "-Os" CACHE STRING "Emscripten-overridden CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL") set(CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO "-O2 -g" CACHE STRING "Emscripten-overridden CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO") function(em_validate_asmjs_after_build target) diff --git a/src/library.js b/src/library.js index 326e24f0..91d5f925 100644 --- a/src/library.js +++ b/src/library.js @@ -6445,7 +6445,19 @@ LibraryManager.library = { // var indexes = Runtime.calculateStructAlignment({ fields: ['i32', 'i32'] }); var me = _localeconv; if (!me.ret) { - me.ret = allocate([allocate(intArrayFromString('.'), 'i8', ALLOC_NORMAL)], 'i8*', ALLOC_NORMAL); // just decimal point, for now + // These are defaults from the "C" locale + me.ret = allocate([ + allocate(intArrayFromString('.'), 'i8', ALLOC_NORMAL),0,0,0, // decimal_point + allocate(intArrayFromString(''), 'i8', ALLOC_NORMAL),0,0,0, // thousands_sep + allocate(intArrayFromString(''), 'i8', ALLOC_NORMAL),0,0,0, // grouping + allocate(intArrayFromString(''), 'i8', ALLOC_NORMAL),0,0,0, // int_curr_symbol + allocate(intArrayFromString(''), 'i8', ALLOC_NORMAL),0,0,0, // currency_symbol + allocate(intArrayFromString(''), 'i8', ALLOC_NORMAL),0,0,0, // mon_decimal_point + allocate(intArrayFromString(''), 'i8', ALLOC_NORMAL),0,0,0, // mon_thousands_sep + allocate(intArrayFromString(''), 'i8', ALLOC_NORMAL),0,0,0, // mon_grouping + allocate(intArrayFromString(''), 'i8', ALLOC_NORMAL),0,0,0, // positive_sign + allocate(intArrayFromString(''), 'i8', ALLOC_NORMAL),0,0,0 // negative_sign + ], 'i8*', ALLOC_NORMAL); // Allocate strings in lconv, still don't allocate chars } return me.ret; }, diff --git a/system/lib/gl.c b/system/lib/gl.c index e6c60956..bbc77437 100644 --- a/system/lib/gl.c +++ b/system/lib/gl.c @@ -1543,11 +1543,13 @@ GLAPI void APIENTRY emscripten_glVertexAttribDivisor (GLuint index, GLuint divis void* emscripten_GetProcAddress(const char *name_) { char *name = malloc(strlen(name_)+1); strcpy(name, name_); - // remove EXT|ARB suffixes + // remove EXT|ARB|OES suffixes char *end = strstr(name, "EXT"); if (end) *end = 0; end = strstr(name, "ARB"); if (end) *end = 0; + end = strstr(name, "OES"); + if (end) *end = 0; // misc renamings if (!strcmp(name, "glCreateProgramObject")) name = "glCreateProgram"; else if (!strcmp(name, "glUseProgramObject")) name = "glUseProgram"; diff --git a/tests/test_core.py b/tests/test_core.py index 733407ff..b96cbc36 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -6400,6 +6400,10 @@ def process(filename): if os.environ.get('EMCC_FAST_COMPILER') != '1': return self.skip('this test will not pass in the old compiler') self.do_run(open(path_from_root('tests', 'test_minmax.c')).read(), 'NAN != NAN\nSuccess!') + def test_locale(self): + if self.emcc_args is None: return self.skip('needs emcc') + self.do_run_from_file(path_from_root('tests', 'test_locale.c'), path_from_root('tests', 'test_locale.out')) + # Generate tests for everything def make_run(fullname, name=-1, compiler=-1, embetter=0, quantum_size=0, typed_arrays=0, emcc_args=None, env=None): diff --git a/tests/test_locale.c b/tests/test_locale.c new file mode 100644 index 00000000..4aba30db --- /dev/null +++ b/tests/test_locale.c @@ -0,0 +1,24 @@ +#include <locale.h> +#include <stdio.h> + +int main() +{ + // Test basic functions from classic locale. + struct lconv* locale = localeconv(); + + printf("Testing locale information.\n"); + printf("Decimal point: %s\n", locale->decimal_point); + printf("Thousands separator: %s\n", locale->thousands_sep); + printf("Grouping: %s\n", locale->grouping); + printf("International currency symbol: %s\n", locale->int_curr_symbol); + printf("Currency symbol: %s\n", locale->currency_symbol); + printf("Money decimal point: %s\n", locale->mon_decimal_point); + printf("Money thousands separator: %s\n", locale->mon_thousands_sep); + printf("Money Grouping: %s\n", locale->mon_grouping); + printf("Positive sign: %s\n", locale->positive_sign); + printf("Negative sign: %s\n", locale->negative_sign); + + // If no runtime errors, assume the test passed. + printf("Locale tests passed.\n"); + return 0; +} diff --git a/tests/test_locale.out b/tests/test_locale.out new file mode 100644 index 00000000..7e8740fb --- /dev/null +++ b/tests/test_locale.out @@ -0,0 +1,12 @@ +Testing locale information. +Decimal point: . +Thousands separator: +Grouping: +International currency symbol: +Currency symbol: +Money decimal point: +Money thousands separator: +Money Grouping: +Positive sign: +Negative sign: +Locale tests passed. |