summary refs log tree commit diff
path: root/dynamic.e
diff options
context:
space:
mode:
authorIrene Knapp <ireneista@irenes.space>2026-08-28 22:21:52 -0700
committerIrene Knapp <ireneista@irenes.space>2026-08-28 22:21:52 -0700
commita41c6444d30f9ad561d95a1776f796581338df16 (patch)
treeec8b878efec4f37d330aff1098d46e20960b7f01 /dynamic.e
parent6e0227328154e18810d8dfa4489bf84c9c15cbf7 (diff)
make read-to-buffer take its delimiter as a parameter
since the recommended invocation to build Evocation (hehe) does the heavy lifting in interpreted mode, this required a new helper, allocate-string, which takes a string in the scratch space and properly allocates it so it won't be overwritten by future allocations

Force-Push: yes
Change-Id: Ia73612a65fd7c11af5fe110c573c23c16b777112
Diffstat (limited to 'dynamic.e')
-rw-r--r--dynamic.e9
1 files changed, 9 insertions, 0 deletions
diff --git a/dynamic.e b/dynamic.e
index a02eec0..af5d9b2 100644
--- a/dynamic.e
+++ b/dynamic.e
@@ -348,6 +348,15 @@
   3roll + 8 packalign here ! ;
 
 
+~   Takes a string pointer which must be equal to the current value of "here",
+~ indicating it is in the temporary allocation space, and allocates it
+~ permanently by advancing "here" to the next aligned address after it.
+~
+~ (string pointer -- string pointer)
+: allocate-string
+  dup dup stringlen 1+ + 8 packalign here ! ;
+
+
 ~   Allocate space by incrementing "here", and output a word entry header in
 ~ it. Also add it to the "latest" linked list. Use zero as the flag values;
 ~ accept a string pointer on the stack and use its contents as the name.