mirror of
https://github.com/forth-ev/VolksForth.git
synced 2025-01-09 13:32:05 +00:00
Add Makefile rules to convert uppercase XYZ.FB block files
into lowercase xyz.fth stream files, and convert files in src/ and tests/
This commit is contained in:
parent
83173f691f
commit
e089121f22
@ -1,12 +1,12 @@
|
||||
|
||||
|
||||
test: logtest.result
|
||||
|
||||
clean:
|
||||
rm -f *.log *.LOG *.result *.golden
|
||||
|
||||
|
||||
logtest.log: volks4th.com tests/LOG2FILE.FB tests/LOGTEST.FB emulator/run-in-dosbox.sh
|
||||
logtest.log: volks4th.com tests/LOG2FILE.FB tests/LOGTEST.FB \
|
||||
emulator/run-in-dosbox.sh
|
||||
./emulator/run-in-dosbox.sh volks4th.com logtest
|
||||
|
||||
logtest.golden: tests/golden/logtest.golden
|
||||
@ -16,3 +16,18 @@ logtest.golden: tests/golden/logtest.golden
|
||||
rm -f $@
|
||||
tests/evaluate-test.sh $(basename $@)
|
||||
|
||||
fbfiles = $(wildcard src/*.FB tests/*.FB)
|
||||
fthfiles = $(patsubst %.fb, %.fth, \
|
||||
$(shell ../../tools/echo-tolower.py $(fbfiles)))
|
||||
|
||||
fth: $(fthfiles)
|
||||
|
||||
.ONESHELL:
|
||||
$(fthfiles): $(fbfiles)
|
||||
set -x
|
||||
for fb in $^
|
||||
do
|
||||
echo fb: $$fb
|
||||
fth=$$(../../tools/echo-tolower.py $$fb | sed -e 's/fb$$/fth/')
|
||||
../../tools/fb2fth.py $$fb $$fth
|
||||
done
|
||||
|
95
8086/msdos/src/include.fth
Normal file
95
8086/msdos/src/include.fth
Normal file
@ -0,0 +1,95 @@
|
||||
|
||||
\ *** Block No. 0, Hexblock 0
|
||||
|
||||
\ include for stream sources phz 06jan22
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
\ *** Block No. 1, Hexblock 1
|
||||
|
||||
\ load screen phz 06jan22
|
||||
|
||||
1 3 +thru
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
\ *** Block No. 2, Hexblock 2
|
||||
|
||||
\ 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 ;
|
||||
|
||||
|
||||
|
||||
|
||||
\ *** Block No. 3, Hexblock 3
|
||||
|
||||
\ 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 ;
|
||||
|
||||
|
||||
\ *** Block No. 4, Hexblock 4
|
||||
|
||||
\ 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 ;
|
||||
|
||||
|
||||
|
||||
|
76
8086/msdos/tests/log2file.fth
Normal file
76
8086/msdos/tests/log2file.fth
Normal file
@ -0,0 +1,76 @@
|
||||
|
||||
\ *** Block No. 0, Hexblock 0
|
||||
|
||||
\ logging to a text file phz 03jan22
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
\ *** Block No. 1, Hexblock 1
|
||||
|
||||
\ load screen phz 04jan22
|
||||
|
||||
1 2 +thru
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
\ *** Block No. 2, Hexblock 2
|
||||
|
||||
\ log-type log-emit log-cr alsologtofile phz 04jan22
|
||||
context @ dos also context !
|
||||
\ vocabulary log dos also log definitions
|
||||
file logfile
|
||||
variable logfcb
|
||||
|
||||
: log-type 2dup (type ds@ -rot logfcb @ lfputs ;
|
||||
|
||||
: log-emit dup (emit logfcb @ fputc ;
|
||||
|
||||
: log-cr (cr #cr logfcb @ fputc #lf logfcb @ fputc ;
|
||||
|
||||
Output: alsologtofile
|
||||
log-emit log-cr log-type (del (page (at (at? ;
|
||||
|
||||
|
||||
|
||||
\ *** Block No. 3, Hexblock 3
|
||||
|
||||
\ logopen logclose phz 04jan22
|
||||
|
||||
: logopen ( -- )
|
||||
logfile make isfile@ dup freset logfcb !
|
||||
alsologtofile ;
|
||||
|
||||
: logclose ( -- ) display logfcb @ fclose ;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
38
8086/msdos/tests/logtest.fth
Normal file
38
8086/msdos/tests/logtest.fth
Normal file
@ -0,0 +1,38 @@
|
||||
|
||||
\ *** Block No. 0, Hexblock 0
|
||||
|
||||
\ logtest.fb phz 04jan22
|
||||
|
||||
basic tests for log2file.fb
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
\ *** Block No. 1, Hexblock 1
|
||||
|
||||
\ loadscreen phz 04jan22
|
||||
|
||||
include log2file.fb
|
||||
|
||||
logopen logtest.log
|
||||
.( logtest done) cr
|
||||
logclose
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user