diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/include/emscripten.h | 8 | ||||
-rw-r--r-- | src/library.js | 5 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/include/emscripten.h b/src/include/emscripten.h index 1974fc71..958bef98 100644 --- a/src/include/emscripten.h +++ b/src/include/emscripten.h @@ -9,6 +9,10 @@ // ES_SIZEOF // +// NOTE: As of now, ES_SIZEOF is not needed when using QUANTUM_SIZE +// of 4. We will use the same offsets as C/C++ does in that case. +// ES_SIZEOF is useful if QUANTUM_SIZE is 1. +// // A 'safe' sizeof operator. Sadly llvm-gcc calculates sizeof's // and stores them hardcoded as raw values, unlike say offsets // within a structure which it nicely details using getelementptr. @@ -40,3 +44,7 @@ #define ES_SIZEOF(T) sizeof(T) #endif +// Interface to the underlying JS engine. This function will +// eval() the given script. +extern void emscripten_run_script(const char *script); + diff --git a/src/library.js b/src/library.js index cc8fe45f..f79de6c8 100644 --- a/src/library.js +++ b/src/library.js @@ -1147,6 +1147,11 @@ var Library = { opendir: function(pname) { return 0; + }, + + // ** emscripten.h ** + _Z21emscripten_run_scriptPKc: function(ptr) { + eval(Pointer_stringify(ptr)); } }; |