Recreate log2file.fth (used as well as log2file.fb in tests) and declare it

as test dependency.
This commit is contained in:
Philip Zembrod 2024-12-24 14:42:42 +01:00
parent c1421d44f4
commit 5fbdc1afb2
2 changed files with 115 additions and 1 deletions

View File

@ -86,7 +86,7 @@ logappendtest.log: v4thfile.com tests/logapp.fth
prepsrcs = asm.fb extend.fb multi.vid dos.fb include.fb
prepfths = asm.fb extend.fb multi.vid dos.fb include.fb 86asm.fth \
t86asm.fth extend2.fth multivid.fth dos2.fth dos3.fth
t86asm.fth extend2.fth multivid.fth dos2.fth dos3.fth log2file.fth
incltest.log: \
$(patsubst %, dosfiles/%, v4thblk.com $(prepsrcs) log2file.fb \

View File

@ -0,0 +1,114 @@
\ *** Block No. 0, Hexblock 0
\ logging to a text file phz 03jan22
\ *** Block No. 1, Hexblock 1
\ load screen phz 25feb22
Code m+! ( 16b addr -- )
D W mov W inc W inc A pop A W ) add
CS ?[ W dec W dec W ) inc ]?
D pop Next end-code
: (blk blk @ 0= IF ascii ) parse 2drop THEN ;
(blk 1 2 +thru ( )
\ *** Block No. 2, Hexblock 2
\ log-type log-emit log-cr phz 25feb22
context @ dos also context !
\ vocabulary log dos also log definitions
file logfile
variable logfcb
variable logpos 0 ,
: log-type ( addr count -- ) dup logpos m+!
2dup (type ds@ -rot logfcb @ lfputs ;
: log-emit ( char -- ) 1 logpos m+!
dup (emit logfcb @ fputc ;
: log-cr ( -- ) 2 logpos m+!
(cr #cr logfcb @ fputc #lf logfcb @ fputc ;
\ *** Block No. 3, Hexblock 3
\ alsologtofile logopen logclose logreopen phz 25feb22
Output: alsologtofile
log-emit log-cr log-type (del (page (at (at? ;
: logopen ( -- )
isfile push logpos dup 2+ off off
logfile make isfile@ dup freset logfcb !
alsologtofile ;
: logclose ( -- ) display logfcb @ fclose ;
: logreopen ( -- )
logfcb @ freset logpos 2@ logfcb @ fseek
alsologtofile ;
\ *** Block No. 4, Hexblock 4
\ phz 25feb22
\ *** Block No. 5, Hexblock 5