From 9ce09207e08ff8638241bece31c1814c4e1ce554 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Mon, 7 Aug 2023 15:28:52 -0700 Subject: [PATCH] change split-insns.sh to split out both whole insn and pseudocode into separate mdwn files --- split-insns.sh | 96 ++++++++++++++++++++++++++------------------------ 1 file changed, 50 insertions(+), 46 deletions(-) diff --git a/split-insns.sh b/split-insns.sh index 1ef222ae..4feb4034 100755 --- a/split-insns.sh +++ b/split-insns.sh @@ -1,17 +1,19 @@ #!/bin/bash -cd "$(dirname "$0")" +cd "$(dirname "$0")" || exit set -C +: "${DEBUGGING:=0}" + function note() { - echo "$fname:$((lidx + 1)): note: $@" + echo "$fname:$((lidx + 1)): note: $*" } function warn() { - echo "$fname:$((lidx + 1)): warning: $@" >&2 + echo "$fname:$((lidx + 1)): warning: $*" >&2 } function fatal() { - echo "$fname:$((lidx + 1)): fatal: $@" >&2 + echo "$fname:$((lidx + 1)): fatal: $*" >&2 exit 1 } @@ -19,6 +21,10 @@ function next_line() { line="${lines[++lidx]}" } +function prev_line() { + line="${lines[--lidx]}" +} + function skip_comments() { while [[ "$line" =~ ^"