Commit 544ed5a6 authored by Michael Droettboom's avatar Michael Droettboom

Don't use cwrap

We only have two entry points, so it's easy to hardcode.
parent 6cbac839
...@@ -25,8 +25,7 @@ LDFLAGS=\ ...@@ -25,8 +25,7 @@ LDFLAGS=\
-s MAIN_MODULE=1 \ -s MAIN_MODULE=1 \
-s EMULATED_FUNCTION_POINTERS=1 \ -s EMULATED_FUNCTION_POINTERS=1 \
-s EMULATE_FUNCTION_POINTER_CASTS=1 \ -s EMULATE_FUNCTION_POINTER_CASTS=1 \
-s EXPORTED_FUNCTIONS='["_main", "_runPython", "__ZNKSt3__220__vector_base_commonILb1EE20__throw_length_errorEv"]' \ -s EXPORTED_FUNCTIONS='["_main", "__ZNKSt3__220__vector_base_commonILb1EE20__throw_length_errorEv"]' \
-s EXTRA_EXPORTED_RUNTIME_METHODS='["ccall", "cwrap"]' \
-s WASM=1 \ -s WASM=1 \
-s SWAPPABLE_ASM_MODULE=1 \ -s SWAPPABLE_ASM_MODULE=1 \
-s USE_FREETYPE=1 \ -s USE_FREETYPE=1 \
......
...@@ -22,13 +22,13 @@ int pyimport(char *name) { ...@@ -22,13 +22,13 @@ int pyimport(char *name) {
} }
EM_JS(int, pyimport_Ready, (), { EM_JS(int, pyimport_Ready, (), {
Module.__pyimport = Module.cwrap('pyimport', 'number', ['string']);
Module.pyimport = function(name) { Module.pyimport = function(name) {
var id = Module.__pyimport(name); var pyname = allocate(intArrayFromString(name), 'i8', ALLOC_NORMAL);
result = Module.hiwire_get_value(id); var idresult = Module._pyimport(pyname);
Module.hiwire_decref(id); jsresult = Module.hiwire_get_value(idresult);
return result; Module.hiwire_decref(idresult);
_free(pyname);
return jsresult;
}; };
return 0; return 0;
......
...@@ -87,15 +87,13 @@ int runPython(char *code) { ...@@ -87,15 +87,13 @@ int runPython(char *code) {
} }
EM_JS(int, runPython_Ready, (), { EM_JS(int, runPython_Ready, (), {
// TODO: Remove uses of cwrap
Module.__runPython = Module.cwrap('runPython', 'number', ['string']);
Module.runPython = function (code) { Module.runPython = function (code) {
var jsid = Module.__runPython(code); var pycode = allocate(intArrayFromString(code), 'i8', ALLOC_NORMAL);
result = Module.hiwire_get_value(jsid); var idresult = Module._runPython(pycode);
Module.hiwire_decref(jsid); jsresult = Module.hiwire_get_value(idresult);
return result; Module.hiwire_decref(idresult);
_free(pycode);
return jsresult;
}; };
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment