mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 19:40:18 +00:00
...
...
This commit is contained in:
parent
a97149778a
commit
4e74d66768
@ -14,3 +14,11 @@ You need to use the C++ `new` operator to create a `VM` instance.
|
||||
```cpp
|
||||
VM* vm = new VM();
|
||||
```
|
||||
|
||||
The constructor can take 2 extra parameters.
|
||||
|
||||
#### `VM(bool use_stdio=true, bool enable_os=true)`
|
||||
|
||||
+ `use_stdio`, if `true`, the `print()` function outputs string to `stdout`. Error messages will be send to `stderr`; If `false`, they will be sent to an internal buffer. In the latter case, you need to read them via `read_output` manually.
|
||||
+ `enable_os`, whether to enable OS-related features or not. This setting controls the availability of some priviledged modules such os `io` and `os` as well as builtin function `open`.
|
||||
|
||||
|
@ -14,7 +14,7 @@ links:
|
||||
link: ""
|
||||
- text: "Live Demo"
|
||||
icon: play
|
||||
link: "./static/web/index.html"
|
||||
link: "https://pocketpy.dev/static/web/"
|
||||
target: blank
|
||||
- text: "Github"
|
||||
icon: mark-github
|
||||
|
@ -113,7 +113,7 @@ var Module = {
|
||||
term.write(text + "\r\n");
|
||||
},
|
||||
'onRuntimeInitialized': function(text) {
|
||||
var vm = Module.ccall('pkpy_new_vm', 'number', [], []);
|
||||
var vm = Module.ccall('pkpy_new_vm', 'number', ['boolean', 'boolean'], [true, true]);
|
||||
repl = Module.ccall('pkpy_new_repl', 'number', ['number'], [vm]);
|
||||
term.write(need_more_lines ? "... " : ">>> ");
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user