aboutsummaryrefslogtreecommitdiff
path: root/crates/sloth_vm/src/sloth_std/mod.rs
diff options
context:
space:
mode:
authorCody <cody@codyq.dev>2023-04-27 18:42:28 -0500
committerGitHub <noreply@github.com>2023-04-27 18:42:28 -0500
commit86eab2dc7dc2f88e0f56d09ae3b5f36cf8d9706e (patch)
treed312fd5c0981df90aef29a4131703ae89f328268 /crates/sloth_vm/src/sloth_std/mod.rs
parent448babe8090c2bcf177c23efd2257a926a1d07f7 (diff)
parentd6b12291db70ea19d37d84226161f964400ae0b2 (diff)
downloadsloth-86eab2dc7dc2f88e0f56d09ae3b5f36cf8d9706e.tar.gz
Merge pull request #5 from slothlang/standard-library
Standard Library
Diffstat (limited to 'crates/sloth_vm/src/sloth_std/mod.rs')
-rw-r--r--crates/sloth_vm/src/sloth_std/mod.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/crates/sloth_vm/src/sloth_std/mod.rs b/crates/sloth_vm/src/sloth_std/mod.rs
index 86611d7..ff761a6 100644
--- a/crates/sloth_vm/src/sloth_std/mod.rs
+++ b/crates/sloth_vm/src/sloth_std/mod.rs
@@ -4,8 +4,12 @@ use once_cell::sync::Lazy;
use crate::native::NativeFunction;
+pub mod file;
+pub mod misc;
pub mod rand;
pub mod stdio;
+pub mod term;
+pub mod time;
pub static NATIVE_LIBRARY: Lazy<HashMap<&'static str, NativeFunction>> = Lazy::new(|| {
let mut map = HashMap::new();
@@ -16,9 +20,24 @@ pub static NATIVE_LIBRARY: Lazy<HashMap<&'static str, NativeFunction>> = Lazy::n
// stdio
map.insert("write", stdio::WRITE_FUNCTION);
+ map.insert("writeln", stdio::WRITELN_FUNCTION);
map.insert("read", stdio::READ_FUNCTION);
+ // term
+ map.insert("term$clear", term::TERM_CLEAR);
+ map.insert("term$setpos", term::TERM_SETPOS);
+
// filesystem
+ // TODO: Make the files commands work by making a global file variable with
+ // certain permissions created by 'file.open' instead of just reading the file.
+ map.insert("file$read", file::FILE_READ);
+ map.insert("file$write", file::FILE_WRITE);
+
+ // time
+ map.insert("wait", time::WAIT);
+
+ // doc
+ map.insert("docs", misc::DOCS);
map
});