aboutsummaryrefslogtreecommitdiffstats
path: root/src/wasm_vm.rs
diff options
context:
space:
mode:
authorBrooks J Rady <b.j.rady@gmail.com>2021-01-07 09:39:16 +0000
committerBrooks J Rady <b.j.rady@gmail.com>2021-01-07 09:39:16 +0000
commit01eaedcd3746e9de30fe867340667c65d8eb2733 (patch)
treed4a2ce89265d1a38ac8a4041821058336d43d1a6 /src/wasm_vm.rs
parentMerge branch 'main' into wasm-launchable (diff)
downloadsl0ppij-01eaedcd3746e9de30fe867340667c65d8eb2733.tar.gz
sl0ppij-01eaedcd3746e9de30fe867340667c65d8eb2733.tar.xz
sl0ppij-01eaedcd3746e9de30fe867340667c65d8eb2733.zip
Parse bytes into keys with Termion
Diffstat (limited to 'src/wasm_vm.rs')
-rw-r--r--src/wasm_vm.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/wasm_vm.rs b/src/wasm_vm.rs
index a81c4fba..6d2d4a19 100644
--- a/src/wasm_vm.rs
+++ b/src/wasm_vm.rs
@@ -10,6 +10,7 @@ use wasmer_wasi::WasiEnv;
pub enum PluginInstruction {
Load(Sender<u32>, PathBuf),
Draw(Sender<String>, u32, usize, usize), // String buffer, plugin id, rows, cols
+ Input(u32, Vec<u8>), // plugin id, input bytes
Unload(u32),
Quit,
}
@@ -24,6 +25,7 @@ pub fn mosaic_imports(store: &Store, wasi_env: &WasiEnv) -> ImportObject {
}
}
+// FIXME: Bundle up all of the channels! Pair that with WasiEnv?
fn host_open_file(wasi_env: &WasiEnv) {
Command::new("xdg-open")
.arg(format!(
@@ -46,7 +48,7 @@ pub fn wasi_stdout(wasi_env: &WasiEnv) -> String {
buf
}
-pub fn _wasi_write_string(wasi_env: &WasiEnv, buf: &str) {
+pub fn wasi_write_string(wasi_env: &WasiEnv, buf: &str) {
let mut state = wasi_env.state();
let wasi_file = state.fs.stdin_mut().unwrap().as_mut().unwrap();
writeln!(wasi_file, "{}\r", buf).unwrap();