Skip to content

Commit

Permalink
Add script to compare order of oplist and interp.c op order
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
samcv committed Jun 10, 2018
1 parent eed6fbb commit 48827f3
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions 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

0 comments on commit 48827f3

Please sign in to comment.