From 93522effba2f200257141189de5925a23fca93b8 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Tue, 22 Apr 2025 14:47:25 +0200 Subject: Remove compose from the public API --- shell/shell.c | 34 ---------------------------------- shell/test.sh | 22 ---------------------- shell/testcases/000_frommoves.in | 1 - shell/testcases/000_frommoves.out | 1 - shell/testcases/001_compose.in | 1 - shell/testcases/001_compose.out | 1 - 6 files changed, 60 deletions(-) delete mode 100755 shell/test.sh delete mode 100644 shell/testcases/000_frommoves.in delete mode 100644 shell/testcases/000_frommoves.out delete mode 100644 shell/testcases/001_compose.in delete mode 100644 shell/testcases/001_compose.out (limited to 'shell') diff --git a/shell/shell.c b/shell/shell.c index ecd39f2..40a5748 100644 --- a/shell/shell.c +++ b/shell/shell.c @@ -15,7 +15,6 @@ #define MAX_PATH_LENGTH UINT64_C(10000) #define FLAG_CUBE "-cube" -#define FLAG_PERM "-perm" #define FLAG_COMMAND "-command" #define FLAG_STR_CUBE "-cubestr" #define FLAG_MOVES "-moves" @@ -37,7 +36,6 @@ typedef struct { int command_index; char cube[NISSY_SIZE_CUBE]; - char cube_perm[NISSY_SIZE_CUBE]; char *str_command; char *str_cube; char *str_moves; @@ -51,7 +49,6 @@ typedef struct { unsigned threads; } args_t; -static int64_t compose_exec(args_t *); static int64_t inverse_exec(args_t *); static int64_t applymoves_exec(args_t *); static int64_t applytrans_exec(args_t *); @@ -69,7 +66,6 @@ static bool parse_uint(const char *, unsigned *); static uint8_t parse_nisstype(const char *); static bool set_cube(int, char **, args_t *); -static bool set_cube_perm(int, char **, args_t *); static bool set_str_command(int, char **, args_t *); static bool set_str_cube(int, char **, args_t *); static bool set_str_moves(int, char **, args_t *); @@ -92,7 +88,6 @@ struct { bool (*set)(int, char **, args_t *); } options[] = { OPTION(FLAG_CUBE, 1, set_cube), - OPTION(FLAG_PERM, 1, set_cube_perm), OPTION(FLAG_COMMAND, 1, set_str_command), OPTION(FLAG_STR_CUBE, 1, set_str_cube), OPTION(FLAG_MOVES, 1, set_str_moves), @@ -115,12 +110,6 @@ struct { int64_t (*exec)(args_t *); } commands[] = { /* TODO: add synopsis and description here */ - COMMAND( - "compose", - "compose " FLAG_CUBE " CUBE " FLAG_PERM " PERM", - "Apply on CUBE the permutation defined by PERM.", - compose_exec - ), COMMAND( "inverse", "inverse " FLAG_CUBE " CUBE ", @@ -223,19 +212,6 @@ rand64(void) return ret; } -static int64_t -compose_exec(args_t *args) -{ - char result[NISSY_SIZE_CUBE]; - int64_t ret; - - ret = nissy_compose(args->cube, args->cube_perm, result); - if (ret == NISSY_OK || ret == NISSY_WARNING_UNSOLVABLE) - printf("%s\n", result); - - return ret; -} - static int64_t inverse_exec(args_t *args) { @@ -531,7 +507,6 @@ parse_args(int argc, char **argv, args_t *args) *args = (args_t) { .command_index = -1, .cube = "", - .cube_perm = "", .str_cube = "", .str_moves = "", .str_trans = "", @@ -629,15 +604,6 @@ set_cube(int argc, char **argv, args_t *args) return true; } -static bool -set_cube_perm(int argc, char **argv, args_t *args) -{ - memcpy(args->cube_perm, argv[0], NISSY_SIZE_CUBE); - args->cube_perm[21] = 0; - - return true; -} - static bool set_str_command(int argc, char **argv, args_t *args) { diff --git a/shell/test.sh b/shell/test.sh deleted file mode 100755 index 8bc4589..0000000 --- a/shell/test.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh - -SHELLBIN="./debugrun" -TESTDIR="./shell/testcases" -TESTOUT="shell/lasttest.out" -TESTERR="shell/lasttest.err" - -for cin in "$TESTDIR"/*.in; do - c=$(echo "$cin" | sed 's/\.in//') - cout="$c.out" - printf "%s: " "$c" - (cat "$cin" | xargs "$SHELLBIN") > $TESTOUT 2> $TESTERR - if diff "$cout" "$TESTOUT"; then - printf "OK\n" - else - printf "Test failed! stderr:\n" - cat $TESTERR - exit 1 - fi -done - -echo "All tests passed!" diff --git a/shell/testcases/000_frommoves.in b/shell/testcases/000_frommoves.in deleted file mode 100644 index 2b3c6d1..0000000 --- a/shell/testcases/000_frommoves.in +++ /dev/null @@ -1 +0,0 @@ -frommoves -moves "UFRR" diff --git a/shell/testcases/000_frommoves.out b/shell/testcases/000_frommoves.out deleted file mode 100644 index dfefe81..0000000 --- a/shell/testcases/000_frommoves.out +++ /dev/null @@ -1 +0,0 @@ -DEOISVBH=ZFCYHAGBLTKU diff --git a/shell/testcases/001_compose.in b/shell/testcases/001_compose.in deleted file mode 100644 index fa09a0b..0000000 --- a/shell/testcases/001_compose.in +++ /dev/null @@ -1 +0,0 @@ -compose -cube NEORSQLH=ZFCYUAGLHTKB -perm NEORSQLH=ZFCYUAGLHTKB diff --git a/shell/testcases/001_compose.out b/shell/testcases/001_compose.out deleted file mode 100644 index d36a93c..0000000 --- a/shell/testcases/001_compose.out +++ /dev/null @@ -1 +0,0 @@ -ASTUGFBH=DACXEZGBLIKF -- cgit v1.3