Modularise 2006/birken/try.sh

This commit is contained in:
Cody Boone Ferguson committed 2024-02-13 03:18:43 -08:00
1 parent d688a1b2c7
commit ad12345e08
1 file changed
+19 -60
+19 -60
View File
@@ -15,67 +15,26 @@ make CC="$CC" all >/dev/null || exit 1
# clear screen after compilation so that only the entry is shown # clear screen after compilation so that only the entry is shown
clear clear
read -r -n 1 -p "Press any key to run: ./birken < adder.tofu: " birken()
echo 1>&2 {
./birken < adder.tofu 2>/dev/null if [[ "$#" -ne 1 ]]; then
echo 1>&2 echo "$0: birken() requires exactly 1 arg, got: $#" 1>&2
return
fi
read -r -n 1 -p "Press any key to run: ./birken < buffer.tofu: " if [[ ! -f "$1" || ! -r "$1" ]]; then
echo 1>&2 echo "$0: $1 not a regular readable file" 1>&2
./birken < buffer.tofu 2>/dev/null return
echo 1>&2 fi
read -r -n 1 -p "Press any key to run: ./birken < computer.tofu (space = next page, q = quit): " read -r -n 1 -p "Press any key to run: ./birken < $1 (space = next page, q = quit): "
echo 1>&2 echo 1>&2
./birken < computer.tofu 2>/dev/null | less -rEXFK ./birken < "$1" 2>/dev/null | less -rEXFK
echo 1>&2 }
read -r -n 1 -p "Press any key to run: ./birken < counter.tofu: " for f in adder.tofu buffer.tofu computer.tofu counter.tofu divider.tofu lfsr.tofu \
echo 1>&2 memory.tofu multiplier.tofu multiplier2.tofu oneline.tofu shift.tofu zuse.tofu \
./birken < counter.tofu 2>/dev/null zuse2.tofu; do
echo 1>&2
read -r -n 1 -p "Press any key to run: ./birken < divider.tofu: " birken "$f"
echo 1>&2 done
./birken < divider.tofu 2>/dev/null
echo 1>&2
read -r -n 1 -p "Press any key to run: ./birken < lfsr.tofu: "
echo 1>&2
./birken < lfsr.tofu 2>/dev/null
echo 1>&2
read -r -n 1 -p "Press any key to run: ./birken < memory.tofu: "
echo 1>&2
./birken < memory.tofu 2>/dev/null
echo 1>&2
read -r -n 1 -p "Press any key to run: ./birken < multiplier.tofu: "
echo 1>&2
./birken < multiplier.tofu 2>/dev/null
echo 1>&2
read -r -n 1 -p "Press any key to run: ./birken < multiplier2.tofu: "
echo 1>&2
./birken < multiplier2.tofu 2>/dev/null
echo 1>&2
read -r -n 1 -p "Press any key to run: ./birken < oneline.tofu: "
echo 1>&2
./birken < oneline.tofu 2>/dev/null
echo 1>&2
read -r -n 1 -p "Press any key to run: ./birken < shift.tofu: "
echo 1>&2
./birken < shift.tofu 2>/dev/null
echo 1>&2
read -r -n 1 -p "Press any key to run: ./birken < zuse.tofu: "
echo 1>&2
./birken < zuse.tofu 2>/dev/null
echo 1>&2
read -r -n 1 -p "Press any key to run: ./birken < zuse2.tofu: "
echo 1>&2
./birken < zuse2.tofu 2>/dev/null
echo 1>&2