diff --git a/8086/msdos/Makefile b/8086/msdos/Makefile index 0a385a5..8fbfd2c 100644 --- a/8086/msdos/Makefile +++ b/8086/msdos/Makefile @@ -7,12 +7,19 @@ clean: v4thfile.com: volks4th.com src/V4THFILE.FB \ emulator/run-in-dosbox.sh rm -f V4THFILE.COM v4thfile.com - ./emulator/run-in-dosbox.sh volks4th.com v4thfile + ./emulator/run-in-dosbox.sh volks4th.com v4thfile.fb mv V4THFILE.COM v4thfile.com +incltest.log: v4thfile.com tests/LOG2FILE.FB tests/incltest.fth \ + emulator/run-in-dosbox.sh + ./emulator/run-in-dosbox.sh v4thfile.com incltest.fth + +incltest.golden: tests/golden/incltest.golden + cp -p $< $@ + logtest.log: volks4th.com tests/LOG2FILE.FB tests/LOGTEST.FB \ emulator/run-in-dosbox.sh - ./emulator/run-in-dosbox.sh volks4th.com logtest + ./emulator/run-in-dosbox.sh volks4th.com logtest.fb logtest.golden: tests/golden/logtest.golden cp -p $< $@ @@ -21,6 +28,12 @@ logtest.golden: tests/golden/logtest.golden rm -f $@ tests/evaluate-test.sh $(basename $@) +src/%.fth: src/%.fb ../../tools/fb2fth.py + ../../tools/fb2fth.py $< $@ + +tests/%.fth: tests/%.fb ../../tools/fb2fth.py + ../../tools/fb2fth.py $< $@ + fbfiles = $(wildcard src/*.FB tests/*.FB) fthfiles = $(patsubst %.fb, %.fth, \ $(shell ../../tools/echo-tolower.py $(fbfiles))) diff --git a/8086/msdos/emulator/run-in-dosbox.sh b/8086/msdos/emulator/run-in-dosbox.sh index 6675b89..6b7d176 100755 --- a/8086/msdos/emulator/run-in-dosbox.sh +++ b/8086/msdos/emulator/run-in-dosbox.sh @@ -1,17 +1,19 @@ #!/bin/bash set -e +set -x emulatordir="$(realpath --relative-to="$PWD" "$(dirname "${BASH_SOURCE[0]}")")" basedir="$(realpath --relative-to="$PWD" "${emulatordir}/..")" forth="$1" -include_basename="$2" +include_filename="$2" +include_basename="${include_filename%.*}" forthcmd="" exit="" bye="" if [ -n "${include_basename}" ]; then - forthcmd="include ${include_basename}.fb" + forthcmd="include ${include_filename}" logname="${include_basename}.log" doslogname="$(echo ${logname}|tr '[:lower:]' '[:upper:]')" rm -f "${logname}" "${doslogname}" diff --git a/8086/msdos/tests/golden/incltest.golden b/8086/msdos/tests/golden/incltest.golden new file mode 100644 index 0000000..eb978d3 --- /dev/null +++ b/8086/msdos/tests/golden/incltest.golden @@ -0,0 +1,2 @@ +hello, world +hello, world, from test-hello diff --git a/8086/msdos/tests/incltest.fth b/8086/msdos/tests/incltest.fth new file mode 100644 index 0000000..27cfcfd --- /dev/null +++ b/8086/msdos/tests/incltest.fth @@ -0,0 +1,9 @@ + +include log2file.fb +logopen incltest.log + +.( hello, world) cr +: test-hello ." hello, world, from test-hello" cr ; +test-hello + +logclose diff --git a/8086/msdos/v4thfile.com b/8086/msdos/v4thfile.com index 28b7ff6..3f2412e 100644 Binary files a/8086/msdos/v4thfile.com and b/8086/msdos/v4thfile.com differ diff --git a/tools/echo-tolower.py b/tools/echo-tolower.py new file mode 100755 index 0000000..a46699f --- /dev/null +++ b/tools/echo-tolower.py @@ -0,0 +1,5 @@ +#!/usr/bin/python3 + +import sys + +print(' '.join(a.lower() for a in sys.argv[1:])) diff --git a/tools/echo-toupper.py b/tools/echo-toupper.py new file mode 100755 index 0000000..655fa3e --- /dev/null +++ b/tools/echo-toupper.py @@ -0,0 +1,5 @@ +#!/usr/bin/python3 + +import sys + +print(' '.join(a.upper() for a in sys.argv[1:]))