diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-03-15 14:34:13 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-03-15 14:34:13 -0700 |
commit | 27d1a249622d33ab8aff2814d13569507336873b (patch) | |
tree | c568136b2cf95d897d128b362720602a3b401244 /src/preamble.js | |
parent | fefd5caa31c4d701df7bf5c1bc48028e212f4694 (diff) |
add option to disable utf support, and test that in asm2g
Diffstat (limited to 'src/preamble.js')
-rw-r--r-- | src/preamble.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/preamble.js b/src/preamble.js index 6c0b0e93..6f3a969c 100644 --- a/src/preamble.js +++ b/src/preamble.js @@ -503,6 +503,7 @@ function allocate(slab, types, allocator, ptr) { Module['allocate'] = allocate; function Pointer_stringify(ptr, /* optional */ length) { +#if UTF_STRING_SUPPORT var utf8 = new Runtime.UTF8Processor(); var nullTerminated = typeof(length) == "undefined"; var ret = ""; @@ -519,6 +520,13 @@ function Pointer_stringify(ptr, /* optional */ length) { if (!nullTerminated && i == length) break; } return ret; +#else +#if USE_TYPED_ARRAYS == 2 + return String.fromCharCode.apply(String, HEAPU8.subarray(ptr, ptr + (length || _strlen(ptr)))); +#else + throw 'unsupported combination'; +#endif +#endif } Module['Pointer_stringify'] = Pointer_stringify; |