diff options
Diffstat (limited to 'jefs.fs')
| -rw-r--r-- | jefs.fs | 8 |
1 files changed, 5 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 ; |
