From 122bfde8bbb51f6af007d9bec1c6370dfbd616f0 Mon Sep 17 00:00:00 2001 From: David Given Date: Mon, 18 Jul 2022 00:22:50 +0200 Subject: [PATCH] Remove one more terrible ed script and replace it with a working Lua script. --- mach/proto/fp/FP.script | 40 ------------------------------- mach/proto/fp/build.lua | 7 +++--- mach/proto/fp/massage_s.lua | 47 +++++++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 44 deletions(-) delete mode 100644 mach/proto/fp/FP.script create mode 100644 mach/proto/fp/massage_s.lua diff --git a/mach/proto/fp/FP.script b/mach/proto/fp/FP.script deleted file mode 100644 index a8f12982a..000000000 --- a/mach/proto/fp/FP.script +++ /dev/null @@ -1,40 +0,0 @@ -g/_adf4/s//.adf4/g -g/_adf8/s//.adf8/g -g/_cff4/s//.cff4/g -g/_cff8/s//.cff8/g -g/_cfi/s//.cfi/g -g/_cfu/s//.cfu/g -g/_cif4/s//.cif4/g -g/_cif8/s//.cif8/g -g/_cmf4/s//.cmf4/g -g/_cmf8/s//.cmf8/g -g/_cuf4/s//.cuf4/g -g/_cuf8/s//.cuf8/g -g/_dvf4/s//.dvf4/g -g/_dvf8/s//.dvf8/g -g/_fef4/s//.fef4/g -g/_fef8/s//.fef8/g -g/_fif4/s//.fif4/g -g/_fif8/s//.fif8/g -g/_mlf4/s//.mlf4/g -g/_mlf8/s//.mlf8/g -g/_ngf4/s//.ngf4/g -g/_ngf8/s//.ngf8/g -g/_sbf4/s//.sbf4/g -g/_sbf8/s//.sbf8/g -g/_zrf4/s//.zrf4/g -g/_zrf8/s//.zrf8/g -g/_add_ext/s//.add_ext/g -g/_div_ext/s//.div_ext/g -g/_mul_ext/s//.mul_ext/g -g/_nrm_ext/s//.nrm_ext/g -g/_sft_ext/s//.sft_ext/g -g/_sub_ext/s//.sub_ext/g -g/_zrf_ext/s//.zrf_ext/g -g/_compact/s//.compact/g -g/_extend/s//.extend/g -g/_b64_add/s//.b64_add/g -g/_b64_sft/s//.b64_sft/g -g/_b64_rsft/s//.b64_rsft/g -g/_b64_lsft/s//.b64_lsft/g -1,$p diff --git a/mach/proto/fp/build.lua b/mach/proto/fp/build.lua index db4bd7b59..8ea46b5be 100644 --- a/mach/proto/fp/build.lua +++ b/mach/proto/fp/build.lua @@ -69,17 +69,16 @@ for _, plat in ipairs({"cpm"}) do } } - -- Run FP.script to edit the assembly code. + -- Run massage_s.lua to edit the assembly code. edits[#edits+1] = normalrule { name = "ed_"..plat.."/"..n, ins = { - "./FP.script", - "util/cmisc+ed", + "./massage_s.lua", assembly, }, outleaves = { n..".s" }, commands = { - "%{ins[2]} -s %{ins[3]} <%{ins[1]} >%{outs}" + "$LUA %{ins[1]} <%{ins[2]} >%{outs}" } } end diff --git a/mach/proto/fp/massage_s.lua b/mach/proto/fp/massage_s.lua new file mode 100644 index 000000000..1dd8d19c4 --- /dev/null +++ b/mach/proto/fp/massage_s.lua @@ -0,0 +1,47 @@ +local syms = { + "_adf4", + "_adf8", + "_cff4", + "_cff8", + "_cfi", + "_cfu", + "_cif4", + "_cif8", + "_cmf4", + "_cmf8", + "_cuf4", + "_cuf8", + "_dvf4", + "_dvf8", + "_fef4", + "_fef8", + "_fif4", + "_fif8", + "_mlf4", + "_mlf8", + "_ngf4", + "_ngf8", + "_sbf4", + "_sbf8", + "_zrf4", + "_zrf8", + "_add_ext", + "_div_ext", + "_mul_ext", + "_nrm_ext", + "_sft_ext", + "_sub_ext", + "_zrf_ext", + "_compact", + "_extend", + "_b64_add", + "_b64_sft", + "_b64_rsft", + "_b64_lsft", +} + +local data = io.stdin:read("*a") +for _, s in ipairs(syms) do + data = data:gsub(s, (s:gsub("^_", "."))) +end +io.stdout:write(data)