From 533e73c29dfc9dcea448442fd08c6abd8bf64f7c Mon Sep 17 00:00:00 2001 From: Philip Zembrod Date: Tue, 11 Jan 2022 23:40:24 +0100 Subject: [PATCH] - enable run-in-dosbox.sh to include either .fb or .fth files - add first test for including an .fth file - add generic rules to convert lowercase .fb files to .fth files - check in the tools/echo-toupper/tolower.py files that I left out earlier --- 8086/msdos/Makefile | 17 +++++++++++++++-- 8086/msdos/emulator/run-in-dosbox.sh | 6 ++++-- 8086/msdos/tests/golden/incltest.golden | 2 ++ 8086/msdos/tests/incltest.fth | 9 +++++++++ 8086/msdos/v4thfile.com | Bin 32228 -> 32228 bytes tools/echo-tolower.py | 5 +++++ tools/echo-toupper.py | 5 +++++ 7 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 8086/msdos/tests/golden/incltest.golden create mode 100644 8086/msdos/tests/incltest.fth create mode 100755 tools/echo-tolower.py create mode 100755 tools/echo-toupper.py 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 28b7ff64d25737c7030dcdeaa39084e4627f861c..3f2412ec39aa57535fb4a55f59973520cdedb812 100644 GIT binary patch delta 23 fcmaFzoAJqS#tof(jJlJ%_^c;7DsO(l_a_ekhGz<- delta 28 kcmaFzoAJqS#tof(jE0lD_^eqJk}6XtI?8W;!S^Q*0JYQ%2mk;8 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:]))