blueloveTH 2 年 前
コミット
4e74d66768
3 ファイル変更11 行追加3 行削除
  1. 9 1
      docs/quick-start/overview.md
  2. 1 1
      docs/retype.yml
  3. 1 1
      web/index.js

+ 9 - 1
docs/quick-start/overview.md

@@ -13,4 +13,12 @@ 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`.
+

+ 1 - 1
docs/retype.yml

@@ -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

+ 1 - 1
web/index.js

@@ -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 ? "... " : ">>> ");
     },