From 0dea33846d610ebc8120e1843fb150170f75316c Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Sun, 1 Mar 2026 13:06:57 +1100 Subject: [PATCH] xo-reader2 stack: + #q token + QuoteSsm [WIP - not functional] --- src/interpreter2/VirtualSchematikaMachine.cpp | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/interpreter2/VirtualSchematikaMachine.cpp b/src/interpreter2/VirtualSchematikaMachine.cpp index dc600768..bc3cc913 100644 --- a/src/interpreter2/VirtualSchematikaMachine.cpp +++ b/src/interpreter2/VirtualSchematikaMachine.cpp @@ -27,6 +27,7 @@ #include #include #include +#include // for getcwd() namespace xo { using xo::print::APrintable; @@ -862,6 +863,8 @@ namespace xo { } } + // ----- primitive: report_memory_use() ----- + obj xfer_report_memory_use(obj rcx) { @@ -883,6 +886,22 @@ namespace xo { static DPrimitive_gco_0 s_report_memory_use_pm("_report_memory_use", &xfer_report_memory_use); + // ----- primitive: cwd() ----- + + obj + xfer_cwd(obj rcx) + { + char buf[PATH_MAX]; + ::getcwd(buf, sizeof(buf)); + + return obj(DString::from_cstr(rcx.allocator(), buf)); + } + + static DPrimitive_gco_0 s_cwd_pm("_cwd", + &xfer_cwd); + + // ----- install primitives ----- + void VirtualSchematikaMachine::install_core_primitives() { @@ -896,6 +915,17 @@ namespace xo { Reflect::require(), obj(&s_report_memory_use_pm)); } + + { + const DUniqueString * name + = reader_.intern_string("cwd"); + + global_env_->_upsert_value + (mm_.to_op(), + name, + Reflect::require(), + obj(&s_cwd_pm)); + } } } /*namespace scm*/