aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2025-04-22 09:00:15 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2025-04-22 09:00:15 +0200
commit8b72e391c7185e3da0dfbf0ab60068ac37e4d5cc (patch)
treeb79d8154f16a0dadd8d8265d32b8bd95e96263aa /utils
parent510a7471348788fccba6b7c4b9f7b7cc9aee6ba9 (diff)
downloadnissy-core-8b72e391c7185e3da0dfbf0ab60068ac37e4d5cc.tar.gz
nissy-core-8b72e391c7185e3da0dfbf0ab60068ac37e4d5cc.zip
Removed old scripts and updated public API
Diffstat (limited to '')
-rw-r--r--utils/convert.c (renamed from src/core/io_formats.h)6
-rwxr-xr-xutils/genmovecode.sh15
-rwxr-xr-xutils/genmoveswitch.sh8
-rwxr-xr-xutils/gentranscode.sh25
-rwxr-xr-xutils/gentransswitch.sh14
-rwxr-xr-xutils/gentranstests.sh35
-rw-r--r--utils/h48_to_lst.c22
-rw-r--r--utils/invert.c19
-rwxr-xr-xutils/mirror.sh3
9 files changed, 6 insertions, 141 deletions
diff --git a/src/core/io_formats.h b/utils/convert.c
index f5668d4..4f4bb8c 100644
--- a/src/core/io_formats.h
+++ b/utils/convert.c
@@ -1,3 +1,9 @@
1/*
2This file contains code related to cube format conversion that used to
3be in src/core. It is to be adapted into a standalone tool for cube
4format conversion.
5*/
6
1STATIC cube_t readcube(const char *, const char *); 7STATIC cube_t readcube(const char *, const char *);
2STATIC int64_t writecube(const char *, cube_t, size_t n, char [n]); 8STATIC int64_t writecube(const char *, cube_t, size_t n, char [n]);
3STATIC void log_available_formats(void); 9STATIC void log_available_formats(void);
diff --git a/utils/genmovecode.sh b/utils/genmovecode.sh
deleted file mode 100755
index cf13441..0000000
--- a/utils/genmovecode.sh
+++ /dev/null
@@ -1,15 +0,0 @@
1#!/bin/sh
2
3cc -DDEBUG h48_to_lst.c ../src/nissy.c -o h48_to_lst
4
5gen() {
6 for f in cubes/move_??_*.txt; do
7 move="$(echo "$f" | sed 's/.*_// ; s/\.txt//')"
8 printf '#define _move_cube_%s fastcube( \\\n ' "$move"
9 ./h48_to_lst <"$f"
10 printf ')\n'
11 done
12}
13
14gen
15rm -f h48_to_lst invert
diff --git a/utils/genmoveswitch.sh b/utils/genmoveswitch.sh
deleted file mode 100755
index 3b2a74b..0000000
--- a/utils/genmoveswitch.sh
+++ /dev/null
@@ -1,8 +0,0 @@
1#!/bin/sh
2
3printf '\tswitch (m) {\n'
4for f in cubes/move_??_*.txt; do
5 t="$(echo "$f" | sed 's/.*_// ; s/\.txt//')"
6 printf '\tcase %s:\n\t\treturn _move(%s, c);\n' "$t" "$t"
7done
8printf '\t}\n'
diff --git a/utils/gentranscode.sh b/utils/gentranscode.sh
deleted file mode 100755
index 9a1de2c..0000000
--- a/utils/gentranscode.sh
+++ /dev/null
@@ -1,25 +0,0 @@
1#!/bin/sh
2
3cc -DDEBUG h48_to_lst.c ../src/nissy.c -o h48_to_lst
4cc -DDEBUG invert.c ../src/nissy.c -o invert
5
6lineavx() { printf '#define _trans_cube_%s ' "$1"; }
7linesrc() { printf '_static cube_fast_t _trans_cube_%s = ' "$1"; }
8sedavx() { sed '1,2s/$/ \\/ ; 3s/$/)/ ; 3q'; }
9sedsrc() { sed '3s/$/ };/ ; 3q'; }
10
11gen() {
12 for f in cubes/transform_??_???.txt; do
13 trans="$(echo "$f" | sed 's/.*_// ; s/\.txt//')"
14 printf '#define _trans_cube_%s fastcube( \\\n ' "$trans"
15 ./h48_to_lst <"$f"
16 printf ')\n'
17 printf '#define _trans_cube_%s_inverse fastcube( \\\n ' \
18 "$trans"
19 ./invert <"$f" | ./h48_to_lst
20 printf ')\n'
21 done
22}
23
24gen
25rm -f h48_to_lst invert
diff --git a/utils/gentransswitch.sh b/utils/gentransswitch.sh
deleted file mode 100755
index 20e2bfb..0000000
--- a/utils/gentransswitch.sh
+++ /dev/null
@@ -1,14 +0,0 @@
1#!/bin/sh
2
3printf '\tswitch (t) {\n'
4for 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"
13done
14printf '\t}\n'
diff --git a/utils/gentranstests.sh b/utils/gentranstests.sh
deleted file mode 100755
index a257a0a..0000000
--- a/utils/gentranstests.sh
+++ /dev/null
@@ -1,35 +0,0 @@
1#!/bin/sh
2
3outdir="./generated_trans_tests"
4
5mkdir -p "$outdir"
6i=100
7
8while read -r line; do
9 [ -z "$line" ] && continue
10
11 trans_piece="$(echo "$line" | awk '{print $1}' | tr -d 'rm')"
12 move1="$(echo "$line" | awk '{print $2}')"
13 move2="$(echo "$line" | awk '{print $3}')"
14
15 rotation="rotation $trans_piece"
16
17 file1="$(ls cubes | grep "move_.*_${move1}.txt")"
18 file2="$(ls cubes | grep "move_.*_${move2}.txt")"
19 echo "$rotation" >"$outdir/${i}_${trans_piece}r_${move1}.in"
20 cat "cubes/$file1" >>"$outdir/${i}_${trans_piece}r_${move1}.in"
21 cp "cubes/$file2" "$outdir/${i}_${trans_piece}r_${move1}.out"
22
23 i=$((i+1))
24
25 mirrored="mirrored $trans_piece"
26 move2m="$(echo "${move2}" | tr 'LR' 'RL')3"
27
28 file1="$(ls cubes | grep "move_.*_${move1}.txt")"
29 file2="$(ls cubes | grep "move_.*_${move2m}.txt")"
30 echo "$mirrored" >"$outdir/${i}_${trans_piece}m_${move1}.in"
31 cat "cubes/$file1" >>"$outdir/${i}_${trans_piece}m_${move1}.in"
32 cp "cubes/$file2" "$outdir/${i}_${trans_piece}m_${move1}.out"
33
34 i=$((i+1))
35done <transform_moves.txt
diff --git a/utils/h48_to_lst.c b/utils/h48_to_lst.c
deleted file mode 100644
index 03265b7..0000000
--- a/utils/h48_to_lst.c
+++ /dev/null
@@ -1,22 +0,0 @@
1#include <stdio.h>
2#include <inttypes.h>
3#include <stdbool.h>
4
5#include "../src/nissy.h"
6
7#define STRLENMAX 1000
8
9int main(void) {
10 char strin[STRLENMAX], strout[STRLENMAX];
11 int result;
12
13 fgets(strin, STRLENMAX, stdin);
14
15 result = nissy_convertcube("H48", "LST", strin, strout);
16 if (result)
17 fprintf(stderr, "Error converting cube: code %d\n", result);
18
19 fputs(strout, stdout);
20
21 return 0;
22}
diff --git a/utils/invert.c b/utils/invert.c
deleted file mode 100644
index 41580c0..0000000
--- a/utils/invert.c
+++ /dev/null
@@ -1,19 +0,0 @@
1#include <stdio.h>
2#include <inttypes.h>
3#include <stdbool.h>
4
5#include "../src/nissy.h"
6
7#define STRLENMAX 1000
8
9int main(void) {
10 char str[STRLENMAX], cube[22], inv[22];
11
12 fgets(str, STRLENMAX, stdin);
13 nissy_readcube("H48", str, cube);
14 nissy_inverse(cube, inv);
15 nissy_writecube("H48", inv, str);
16 fputs(str, stdout);
17
18 return 0;
19}
diff --git a/utils/mirror.sh b/utils/mirror.sh
deleted file mode 100755
index 41a434f..0000000
--- a/utils/mirror.sh
+++ /dev/null
@@ -1,3 +0,0 @@
1#!/bin/sh
2
3tr 'LR' 'RL'

Generated with cgit - Back to sebastiano.tronto.net