aboutsummaryrefslogtreecommitdiff
path: root/shell/shell.c
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2025-04-22 14:47:25 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2025-04-22 14:47:25 +0200
commit93522effba2f200257141189de5925a23fca93b8 (patch)
tree96d94b56017f1448832b5dc9e24bfcb31183f13c /shell/shell.c
parent1fb55fe25b3dd5ef61dbc38290fbba2e233dc6b6 (diff)
downloadnissy-core-93522effba2f200257141189de5925a23fca93b8.tar.gz
nissy-core-93522effba2f200257141189de5925a23fca93b8.zip
Remove compose from the public API
Diffstat (limited to '')
-rw-r--r--shell/shell.c34
1 files changed, 0 insertions, 34 deletions
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 @@
15#define MAX_PATH_LENGTH UINT64_C(10000) 15#define MAX_PATH_LENGTH UINT64_C(10000)
16 16
17#define FLAG_CUBE "-cube" 17#define FLAG_CUBE "-cube"
18#define FLAG_PERM "-perm"
19#define FLAG_COMMAND "-command" 18#define FLAG_COMMAND "-command"
20#define FLAG_STR_CUBE "-cubestr" 19#define FLAG_STR_CUBE "-cubestr"
21#define FLAG_MOVES "-moves" 20#define FLAG_MOVES "-moves"
@@ -37,7 +36,6 @@
37typedef struct { 36typedef struct {
38 int command_index; 37 int command_index;
39 char cube[NISSY_SIZE_CUBE]; 38 char cube[NISSY_SIZE_CUBE];
40 char cube_perm[NISSY_SIZE_CUBE];
41 char *str_command; 39 char *str_command;
42 char *str_cube; 40 char *str_cube;
43 char *str_moves; 41 char *str_moves;
@@ -51,7 +49,6 @@ typedef struct {
51 unsigned threads; 49 unsigned threads;
52} args_t; 50} args_t;
53 51
54static int64_t compose_exec(args_t *);
55static int64_t inverse_exec(args_t *); 52static int64_t inverse_exec(args_t *);
56static int64_t applymoves_exec(args_t *); 53static int64_t applymoves_exec(args_t *);
57static int64_t applytrans_exec(args_t *); 54static int64_t applytrans_exec(args_t *);
@@ -69,7 +66,6 @@ static bool parse_uint(const char *, unsigned *);
69static uint8_t parse_nisstype(const char *); 66static uint8_t parse_nisstype(const char *);
70 67
71static bool set_cube(int, char **, args_t *); 68static bool set_cube(int, char **, args_t *);
72static bool set_cube_perm(int, char **, args_t *);
73static bool set_str_command(int, char **, args_t *); 69static bool set_str_command(int, char **, args_t *);
74static bool set_str_cube(int, char **, args_t *); 70static bool set_str_cube(int, char **, args_t *);
75static bool set_str_moves(int, char **, args_t *); 71static bool set_str_moves(int, char **, args_t *);
@@ -92,7 +88,6 @@ struct {
92 bool (*set)(int, char **, args_t *); 88 bool (*set)(int, char **, args_t *);
93} options[] = { 89} options[] = {
94 OPTION(FLAG_CUBE, 1, set_cube), 90 OPTION(FLAG_CUBE, 1, set_cube),
95 OPTION(FLAG_PERM, 1, set_cube_perm),
96 OPTION(FLAG_COMMAND, 1, set_str_command), 91 OPTION(FLAG_COMMAND, 1, set_str_command),
97 OPTION(FLAG_STR_CUBE, 1, set_str_cube), 92 OPTION(FLAG_STR_CUBE, 1, set_str_cube),
98 OPTION(FLAG_MOVES, 1, set_str_moves), 93 OPTION(FLAG_MOVES, 1, set_str_moves),
@@ -116,12 +111,6 @@ struct {
116} commands[] = { 111} commands[] = {
117/* TODO: add synopsis and description here */ 112/* TODO: add synopsis and description here */
118 COMMAND( 113 COMMAND(
119 "compose",
120 "compose " FLAG_CUBE " CUBE " FLAG_PERM " PERM",
121 "Apply on CUBE the permutation defined by PERM.",
122 compose_exec
123 ),
124 COMMAND(
125 "inverse", 114 "inverse",
126 "inverse " FLAG_CUBE " CUBE ", 115 "inverse " FLAG_CUBE " CUBE ",
127 "Compute the inverse of the given CUBE.", 116 "Compute the inverse of the given CUBE.",
@@ -224,19 +213,6 @@ rand64(void)
224} 213}
225 214
226static int64_t 215static int64_t
227compose_exec(args_t *args)
228{
229 char result[NISSY_SIZE_CUBE];
230 int64_t ret;
231
232 ret = nissy_compose(args->cube, args->cube_perm, result);
233 if (ret == NISSY_OK || ret == NISSY_WARNING_UNSOLVABLE)
234 printf("%s\n", result);
235
236 return ret;
237}
238
239static int64_t
240inverse_exec(args_t *args) 216inverse_exec(args_t *args)
241{ 217{
242 char result[NISSY_SIZE_CUBE]; 218 char result[NISSY_SIZE_CUBE];
@@ -531,7 +507,6 @@ parse_args(int argc, char **argv, args_t *args)
531 *args = (args_t) { 507 *args = (args_t) {
532 .command_index = -1, 508 .command_index = -1,
533 .cube = "", 509 .cube = "",
534 .cube_perm = "",
535 .str_cube = "", 510 .str_cube = "",
536 .str_moves = "", 511 .str_moves = "",
537 .str_trans = "", 512 .str_trans = "",
@@ -630,15 +605,6 @@ set_cube(int argc, char **argv, args_t *args)
630} 605}
631 606
632static bool 607static bool
633set_cube_perm(int argc, char **argv, args_t *args)
634{
635 memcpy(args->cube_perm, argv[0], NISSY_SIZE_CUBE);
636 args->cube_perm[21] = 0;
637
638 return true;
639}
640
641static bool
642set_str_command(int argc, char **argv, args_t *args) 608set_str_command(int argc, char **argv, args_t *args)
643{ 609{
644 args->str_command = argv[0]; 610 args->str_command = argv[0];

Generated with cgit - Back to sebastiano.tronto.net