diff options
| author | Irene Knapp <ireneista@irenes.space> | 2026-08-28 22:21:52 -0700 |
|---|---|---|
| committer | Irene Knapp <ireneista@irenes.space> | 2026-08-28 22:21:52 -0700 |
| commit | a41c6444d30f9ad561d95a1776f796581338df16 (patch) | |
| tree | ec8b878efec4f37d330aff1098d46e20960b7f01 /transform.e | |
| parent | 6e0227328154e18810d8dfa4489bf84c9c15cbf7 (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 'transform.e')
| -rw-r--r-- | transform.e | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/transform.e b/transform.e index 313882d..ff37ea6 100644 --- a/transform.e +++ b/transform.e @@ -203,7 +203,7 @@ ~ implementations of both transforms. ~ TODO all this buffer stuff should be in its own file -~ (buffer size -- buffer address) +~ (delimiter pointer, buffer size -- buffer address) : read-to-buffer dup allocate dup dup ~ (buffer size, buffer address, word start, output point) @@ -212,7 +212,7 @@ dup not { ~ Make sure to pack the zero to serve as a null terminator. pack8 - drop drop swap drop exit } if + drop drop swap drop swap drop exit } if dup is-space { ~ (buffer size, buffer address, word start, output point, key) ~ Tuck the key out of the way until we've done some stuff. @@ -224,12 +224,12 @@ ~ Add a null terminator so we can use stringcmp dup 0 swap ! ~ Check for the magic word - over s" pyrzqxgl" stringcmp 0 = + over 6 pick stringcmp 0 = } if { ~ It's magic, so exit. ~ Make sure to pack a zero to serve as a null terminator. 0 pack8 - drop drop drop swap drop exit } + drop drop drop swap drop swap drop exit } { ~ It's not magic, so reset the word start. Of course whitespace is ~ not a word but this will help us keep track of things. 3roll pack8 |