This commit is contained in:
blueloveTH 2024-08-12 13:37:09 +08:00
parent e2d4f57859
commit b01234d27e

View File

@ -259,14 +259,15 @@ DEALINGS IN THE SOFTWARE.
var Module = { var Module = {
onRuntimeInitialized: function () { onRuntimeInitialized: function () {
Module.ccall('py_initialize', null, [], []); Module.ccall('py_initialize', null, [], []);
console.log("py_initialize() called");
}, },
print: function (text) { print: function (text) {
console.log(text);
code_output.innerText += text + '\n'; code_output.innerText += text + '\n';
}, },
onabort: function (what) { onabort: function (what) {
code_output.innerText += 'Aborted: ' + what + '\n'; code_output.innerText += 'Aborted: ' + what + '\n';
Module.ccall('py_finalize', null, [], []); Module.ccall('py_finalize', null, [], []);
console.log("py_finalize() called");
} }
}; };
</script> </script>
@ -294,6 +295,7 @@ DEALINGS IN THE SOFTWARE.
'py_exec', 'boolean', ['string', 'string', 'number', 'number'], 'py_exec', 'boolean', ['string', 'string', 'number', 'number'],
[source, 'main.py', 0, 0] [source, 'main.py', 0, 0]
); );
console.log("py_exec() called");
if (!ok) { if (!ok) {
Module.ccall('py_printexc', null, [], []); Module.ccall('py_printexc', null, [], []);
Module.ccall('py_clearexc', null, ['number'], [0]); Module.ccall('py_clearexc', null, ['number'], [0]);