diff options
| author | kitty <nepeta@canaglie.net> | 2026-03-10 02:46:57 +1100 |
|---|---|---|
| committer | kitty <nepeta@canaglie.net> | 2026-03-10 02:46:57 +1100 |
| commit | 89a89b9892804084146903c5eb8cc01d32542bba (patch) | |
| tree | 4579fb0e30ef29c5fb1f07fef189544828e1091c | |
| parent | ea0c00411656872dcce0cf7bf124457dd0e45720 (diff) | |
EXIT (finally)
it's immediate unlike in ANS forth, because it literally just puts a C3
into the current definition.
| -rw-r--r-- | jefs.fs | 8 | ||||
| -rw-r--r-- | readme.md | 1 |
2 files changed, 6 insertions, 3 deletions
@@ -148,6 +148,8 @@ decimal rex.w r14, r14 8 d) lea, r11 call, ] ; +: exit ret, ; immediate + : ?comp state @ 0<> if 3 error ! handler execute then ; : ?intr state @ if 4 error ! handler execute then ; @@ -315,7 +317,7 @@ stdin buffers-fd ! : buffer-refill ( u|0 ) cbuffer /buffer cbuffer-fd @ read-file 0<> if 0 then 0 cbuffer->in ! dup cbuffer-used ! ; \ returns zero on error or nothing read. : buffer-empty? cbuffer->in @ cbuffer-used @ >= ; -: buffer-key ( key|-1 ) buffer-empty? if buffer-refill 0= if -1 [ ret, ] then then +: buffer-key ( key|-1 ) buffer-empty? if buffer-refill 0= if -1 exit then then cbuffer cbuffer->in @ + c@ cbuffer->in @ 1+ cbuffer->in ! ; \ this is profoundly horrible and ugly @@ -335,9 +337,9 @@ hide truncate-(accept-n) 2048 constant line-buffer-length make line-buffer line-buffer-length allot -: refill ( -- ? ) source-id 0< if false [ ret, ] then +: refill ( -- ? ) source-id 0< if false exit then 0 >in ! line-buffer tib ! line-buffer line-buffer-length accept - 0= if dup 0= if #tib ! false [ ret, ] then then #tib ! true ; + 0= if dup 0= if #tib ! false exit then then #tib ! true ; \ todo?: reset retstack : quit 0 to source-id [compile] [ begin refill while interpret ." ok" cr repeat ; @@ -25,6 +25,7 @@ this does not follow any standards. here are some things to keep in mind - `create` can't be used for arrays and stuff. use `make` instead - `:noname` is called `:>` (based on duskos). it also just creates a word called `_` and pushes its xt to the stack - an `include` discards the rest of the input line +- `exit` is immediate (it compiles a `ret` into the definition) ## the one reserved register |
