From 48827f3e304b2363654f57d581223c708226f205 Mon Sep 17 00:00:00 2001 From: Samantha McVey Date: Sun, 10 Jun 2018 12:29:53 -0700 Subject: [PATCH] Add script to compare order of oplist and interp.c op order This script is fairly simple and shows a diff of the ordering differences between the order of the switch in interp.c and the oplist. --- tools/compare-oplist-interp-order.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 tools/compare-oplist-interp-order.sh diff --git a/tools/compare-oplist-interp-order.sh b/tools/compare-oplist-interp-order.sh new file mode 100755 index 0000000000..2fe3230bdf --- /dev/null +++ b/tools/compare-oplist-interp-order.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env sh +# This tool compares the order of things in oplist-order with interp-order +# Shows diff output in less as `diff oplist-order interp-order` +get_oplist_order () { + grep -vE '(^#)|(^\s*$)' src/core/oplist | sed -E 's/^(\S+)\s*.*/\1/' +} +get_interp_order () { + grep -F 'OP(' src/core/interp.c | grep -v '^#' | sed -E 's/^\s*OP\(([^)]+)\).*/\1/' +} +if [ "$1" == 'get_oplist_order' ]; then + get_oplist_order + exit 0 +fi +get_oplist_order > /tmp/oplist-order.txt +get_interp_order > /tmp/interp-order.txt +diff -aur /tmp/oplist-order.txt /tmp/interp-order.txt | less +rm /tmp/oplist-order.txt +rm /tmp/interp-order.txt