diff --git a/8086/msdos/INCLUDE.FB b/8086/msdos/INCLUDE.FB index 95e23ba..55f70e8 100644 --- a/8086/msdos/INCLUDE.FB +++ b/8086/msdos/INCLUDE.FB @@ -1 +1 @@ -\ include for stream sources phz 06jan22 \ load screen phz 06jan22 1 3 +thru \ fib /fib #fib eolf? phz 06jan22 context @ dos also context ! $50 constant /tib variable tibeof tibeof off : eolf? ( c -- f ) \ f=-1: not yet eol; store c and continue \ f=0: eol but not yet eof; return line and flag continue \ 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 ; \ freadline phz 06jan22 : freadline ( -- eof ) tib /tib bounds DO isfile@ fgetc dup eolf? under 0< IF I c! ELSE drop THEN 0< 0= IF I tib - #tib ! ENDLOOP tibeof @ exit THEN LOOP /tib #tib ! ." warning: line exteeds max " /tib . cr ." extra chars ignored" cr BEGIN isfile@ fgetc eolf? 1+ UNTIL tibeof @ ; \ interpret-via-tib phz 06jan22 : interpret-via-tib BEGIN freadline >r .status >in off interpret r> UNTIL ; : finclude ( -- ) blk @ Abort" no include from blk" pushfile use interpret-via-tib close #tib off >in off ; \ No newline at end of file +\ include for stream sources phz 06jan22 \ load screen phz 06jan22 1 3 +thru \ fib /fib #fib eolf? phz 06jan22 context @ dos also context ! $50 constant /tib variable tibeof tibeof off : eolf? ( c -- f ) \ f=-1: not yet eol; store c and continue \ f=0: eol but not yet eof; return line and flag continue \ 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 ; \ freadline probe-for-fb phz 06jan22 : freadline ( -- eof ) tib /tib bounds DO isfile@ fgetc dup eolf? under 0< IF I c! ELSE drop THEN 0< 0= IF I tib - #tib ! ENDLOOP tibeof @ exit THEN LOOP /tib #tib ! ." warning: line exteeds max " /tib . cr ." extra chars ignored" cr BEGIN isfile@ fgetc eolf? 1+ UNTIL tibeof @ ; : probe-for-fb ( -- flag ) \ probes whether current file looks like a block file /tib 2+ 0 DO isfile@ fgetc #lf = IF ENDLOOP false exit THEN LOOP true ; \ interpret-via-tib include phz 06jan22 : interpret-via-tib BEGIN freadline >r .status >in off interpret r> UNTIL ; : include ( -- ) pushfile use probe-for-fb isfile@ freset IF 1 load close exit THEN blk @ Abort" no include from blk" interpret-via-tib close #tib off >in off ; \ No newline at end of file