diff options
Diffstat (limited to '')
| -rwxr-xr-x | utils/genmovecode.sh | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/utils/genmovecode.sh b/utils/genmovecode.sh new file mode 100755 index 0000000..c389ea8 --- /dev/null +++ b/utils/genmovecode.sh | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | type="${1:-src}" | ||
| 4 | |||
| 5 | gcc -DDEBUG h48_to_"$type".c ../src/cube.c -o h48_to_"$type" | ||
| 6 | |||
| 7 | genfuncs() { | ||
| 8 | for f in move_??_*.txt; do | ||
| 9 | move="$(echo $f | sed 's/.*_// ; s/\.txt//')" | ||
| 10 | printf 'static inline cube_t\ninline_move_%s' "$move" | ||
| 11 | printf '(cube_t c)\n{\n' | ||
| 12 | printf '\tcube_t m = ' | ||
| 13 | ./h48_to_"$type" <"$f" | sed '2,4s/^/\t/' | ||
| 14 | printf ';\n\n\treturn compose(c, m);\n}\n\n' | ||
| 15 | done | ||
| 16 | } | ||
| 17 | |||
| 18 | genfuncs | ||
| 19 | rm -f h48_to_"$type" invert | ||
