Skip to content

Commit

Permalink
Merge pull request sl-sh-dev#169 from sl-sh-dev/io-builtins
Browse files Browse the repository at this point in the history
Io builtins
  • Loading branch information
sstanfield authored May 10, 2024
2 parents 3563510 + 8969b11 commit 08fef8e
Show file tree
Hide file tree
Showing 23 changed files with 1,773 additions and 84 deletions.
11 changes: 9 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ compile_state = { path = "compile_state" }
sl-compiler = { path = "compiler" }
compiler_test_utils = { path = "compiler/test_utils" }
slvm = { path = "vm" }
shell = { path = "shell" }
regex = "1"
lazy_static = "1"
mdbook = "0.4.37"
Expand Down
6 changes: 0 additions & 6 deletions bridge_adapters/src/lisp_adapters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,3 @@ impl SlFrom<Value> for Value {
Ok(value)
}
}

impl<'a> SlFromRef<'a, Value> for Value {
fn sl_from_ref(value: Value, _vm: &'a SloshVm) -> VMResult<Self> {
Ok(value)
}
}
5 changes: 5 additions & 0 deletions bridge_adapters/src/lisp_adapters/numbers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ impl SlFrom<u32> for Value {
}
}

impl SlFrom<i64> for Value {
fn sl_from(value: i64, _vm: &mut SloshVm) -> VMResult<Self> {
Ok(to_i56(value))
}
}
impl<'a> SlFromRef<'a, Value> for i32 {
fn sl_from_ref(value: Value, vm: &'a SloshVm) -> VMResult<i32> {
match value {
Expand Down
6 changes: 6 additions & 0 deletions bridge_adapters/src/lisp_adapters/primitives.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ use crate::lisp_adapters::{SlFrom, SlFromRef};
use compile_state::state::SloshVm;
use slvm::{VMResult, Value};

impl<'a> SlFromRef<'a, Value> for Value {
fn sl_from_ref(value: Value, _vm: &SloshVm) -> VMResult<Self> {
Ok(value)
}
}

impl<'a> SlFromRef<'a, Value> for bool {
fn sl_from_ref(value: Value, _vm: &SloshVm) -> VMResult<Self> {
match value {
Expand Down
1 change: 1 addition & 0 deletions bridge_adapters/src/lisp_adapters/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ impl<'a> SlFromRef<'a, Value> for String {
fn sl_from_ref(value: Value, vm: &'a SloshVm) -> VMResult<Self> {
match value {
Value::String(h) => Ok(vm.get_string(h).to_string()),
Value::StringConst(i) => Ok(vm.get_interned(i).to_string()),
_ => Err(VMError::new_conversion(
ErrorStrings::fix_me_mismatched_type(
<&'static str>::from(ValueType::String),
Expand Down
6 changes: 6 additions & 0 deletions builtins/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,18 @@ edition = "2021"
[dependencies]
slvm = { workspace = true }
compile_state = { workspace = true }
shell = { workspace = true }
sl-compiler = { workspace = true }
bridge_adapters = { path = "../bridge_adapters" }
unicode-segmentation = "1.10.1"
unicode_reader = "1"
bridge_types = { workspace = true }
bridge_macros = { path = "../bridge_macros" }
static_assertions = "1.1.0"
rand = "0.8.5"
walkdir = "2.5.0"
same-file = "1.0.6"
glob = "0.3"

[dev-dependencies]
trybuild = "1.0"
Loading

0 comments on commit 08fef8e

Please sign in to comment.