gentransswitch.sh (334B)
1 #!/bin/sh 2 3 printf '\tswitch (t) {\n' 4 for f in cubes/transform_??_???.txt; do 5 t="$(echo "$f" | sed 's/.*_// ; s/\.txt//')" 6 mirror_or_rotation="$(echo "$t" | grep m)" 7 if [ -z "$mirror_or_rotation" ]; then 8 m="rotation" 9 else 10 m="mirrored" 11 fi 12 printf '\tcase %s:\n\t\treturn _trans_%s(%s, c);\n' "$t" "$m" "$t" 13 done 14 printf '\t}\n'