diff --git a/flake.nix b/flake.nix index e36c155..9902215 100644 --- a/flake.nix +++ b/flake.nix @@ -45,6 +45,7 @@ clang-tools # clangd gdb gdbgui + rust-analyzer ]; }; }; diff --git a/runtime/.envrc b/runtime/.envrc deleted file mode 100644 index 3550a30..0000000 --- a/runtime/.envrc +++ /dev/null @@ -1 +0,0 @@ -use flake diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 17399c3..412631f 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -1,7 +1,14 @@ use std::{io::{stdout, Write}}; -const scm_tc3_cons: u64 = 0; -const scm_tc2_int: u64 = 2; +const scm_tc2_int : u64 = 2; +const scm_tc3_cons : u64 = 0; +const scm_tc7_weak_set : u64 = 0x55; +const scm_tc7_symbol : u64 = 0x05; +const scm_tc7_string : u64 = 0x15; + +const scm_false : SCM = scm_pack (0b00100); +const scm_true : SCM = scm_pack (0b01100); +const scm_eol : SCM = scm_pack (0b10100); type scm_bits = u64; @@ -12,7 +19,7 @@ struct SCM { n : scm_bits } -fn scm_pack (bits : scm_bits) -> SCM { +const fn scm_pack (bits : scm_bits) -> SCM { SCM {n: bits} } @@ -88,9 +95,9 @@ pub extern "C" fn scm_write (x: SCM) -> SCM { } #[unsafe(no_mangle)] -pub extern "C" fn scm_from_utf8_string (s: scm_bits, len: scm_bits) -> scm_bits { +pub extern "C" fn scm_from_utf8 (s: &str) -> SCM { println! ("scm_from_utf8_string"); - return 0; + return scm_pack (0); } pub fn add (left: u64, right: u64) -> u64 { diff --git a/runtime/src/weak-set.rs b/runtime/src/weak-set.rs new file mode 100644 index 0000000..551e803 --- /dev/null +++ b/runtime/src/weak-set.rs @@ -0,0 +1,2 @@ +use std::collections; +