mirror of
https://github.com/forth-ev/VolksForth.git
synced 2025-02-16 21:30:59 +00:00
Add ctrl-z detection to eolf? and inc-getc
This commit is contained in:
parent
7810835c7d
commit
5e6c400124
File diff suppressed because one or more lines are too long
@ -39,11 +39,12 @@
|
||||
|
||||
\ *** Block No. 2, Hexblock 2
|
||||
|
||||
\ fib /fib #fib eolf? phz 06okt22
|
||||
\ fib /fib #fib eolf? phz 07mai23
|
||||
|
||||
context @ dos also context !
|
||||
$50 constant /tib
|
||||
variable tibeof tibeof off
|
||||
$1a constant ctrl-z
|
||||
|
||||
: eolf? ( c -- f )
|
||||
\ f=-1: not yet eol; store c and continue
|
||||
@ -51,8 +52,7 @@
|
||||
\ f=1: eof: return line and flag eof
|
||||
tibeof off
|
||||
dup #lf = IF drop 0 exit THEN
|
||||
-1 = IF tibeof on 1 ELSE -1 THEN ;
|
||||
|
||||
ctrl-z = IF tibeof on 1 ELSE -1 THEN ;
|
||||
|
||||
|
||||
|
||||
@ -66,7 +66,7 @@
|
||||
|
||||
: inc-fgetc ( -- c )
|
||||
rec-offset c@ b/rec u< 0= IF dmabuf dma!
|
||||
incfile @ drive iread-seq IF ." eof" -1 exit THEN
|
||||
incfile @ drive iread-seq IF ctrl-z exit THEN
|
||||
0 rec-offset c! THEN
|
||||
rec-offset c@ dup 1+ rec-offset c! dmabuf + c@
|
||||
; \\
|
||||
|
@ -2,3 +2,4 @@
|
||||
@123456789ABCDEF0123456789abcdef0123456789abcdef0123456789abcde
|
||||
A123456789abcdef0123456789abcdef0123456789abcdef0123456789abcde
|
||||
B123456789ABCDEF0123456789abcdef0123456789abcdef0123456789abcde
|
||||
abc
|
||||
|
Loading…
x
Reference in New Issue
Block a user