diff options
Diffstat (limited to 'src/commands.h')
| -rw-r--r-- | src/commands.h | 211 |
1 files changed, 0 insertions, 211 deletions
diff --git a/src/commands.h b/src/commands.h deleted file mode 100644 index 65708e0..0000000 --- a/src/commands.h +++ /dev/null | |||
| @@ -1,211 +0,0 @@ | |||
| 1 | #ifndef COMMANDS_H | ||
| 2 | #define COMMANDS_H | ||
| 3 | |||
| 4 | #include <time.h> | ||
| 5 | |||
| 6 | #include "solve.h" | ||
| 7 | #include "steps.h" | ||
| 8 | #include "solver_step.h" | ||
| 9 | #include "threader_single.h" | ||
| 10 | #include "threader_eager.h" | ||
| 11 | |||
| 12 | void free_args(CommandArgs *args); | ||
| 13 | CommandArgs * new_args(); | ||
| 14 | |||
| 15 | /* Arg parsing functions *****************************************************/ | ||
| 16 | |||
| 17 | CommandArgs * gen_parse_args(int c, char **v); | ||
| 18 | CommandArgs * help_parse_args(int c, char **v); | ||
| 19 | CommandArgs * parse_only_scramble(int c, char **v); | ||
| 20 | CommandArgs * parse_no_arg(int c, char **v); | ||
| 21 | CommandArgs * solve_parse_args(int c, char **v); | ||
| 22 | CommandArgs * scramble_parse_args(int c, char **v); | ||
| 23 | |||
| 24 | /* Exec functions ************************************************************/ | ||
| 25 | |||
| 26 | void gen_exec(CommandArgs *args); | ||
| 27 | void cleanup_exec(CommandArgs *args); | ||
| 28 | void invert_exec(CommandArgs *args); | ||
| 29 | void solve_exec(CommandArgs *args); | ||
| 30 | void scramble_exec(CommandArgs *args); | ||
| 31 | void steps_exec(CommandArgs *args); | ||
| 32 | void commands_exec(CommandArgs *args); | ||
| 33 | void freemem_exec(CommandArgs *args); | ||
| 34 | void print_exec(CommandArgs *args); | ||
| 35 | /*void twophase_exec(CommandArgs *args);*/ | ||
| 36 | void help_exec(CommandArgs *args); | ||
| 37 | void quit_exec(CommandArgs *args); | ||
| 38 | void unniss_exec(CommandArgs *args); | ||
| 39 | void version_exec(CommandArgs *args); | ||
| 40 | |||
| 41 | /* Commands ******************************************************************/ | ||
| 42 | |||
| 43 | #ifndef COMMANDS_C | ||
| 44 | |||
| 45 | extern Command cleanup_cmd; | ||
| 46 | extern Command commands_cmd; | ||
| 47 | extern Command freemem_cmd; | ||
| 48 | extern Command gen_cmd; | ||
| 49 | extern Command help_cmd; | ||
| 50 | extern Command invert_cmd; | ||
| 51 | extern Command print_cmd; | ||
| 52 | extern Command quit_cmd; | ||
| 53 | extern Command scramble_cmd; | ||
| 54 | extern Command solve_cmd; | ||
| 55 | extern Command steps_cmd; | ||
| 56 | extern Command unniss_cmd; | ||
| 57 | extern Command version_cmd; | ||
| 58 | |||
| 59 | extern Command *commands[]; | ||
| 60 | |||
| 61 | #else | ||
| 62 | |||
| 63 | Command | ||
| 64 | solve_cmd = { | ||
| 65 | .name = "solve", | ||
| 66 | .usage = "solve STEP [OPTIONS] SCRAMBLE", | ||
| 67 | .description = "Solve a step; see command steps for a list of steps", | ||
| 68 | .parse_args = solve_parse_args, | ||
| 69 | .exec = solve_exec | ||
| 70 | }; | ||
| 71 | |||
| 72 | Command | ||
| 73 | scramble_cmd = { | ||
| 74 | .name = "scramble", | ||
| 75 | .usage = "scramble [TYPE] [-n N]", | ||
| 76 | .description = "Get a random-position scramble", | ||
| 77 | .parse_args = scramble_parse_args, | ||
| 78 | .exec = scramble_exec, | ||
| 79 | }; | ||
| 80 | |||
| 81 | Command | ||
| 82 | gen_cmd = { | ||
| 83 | .name = "gen", | ||
| 84 | .usage = "gen [-t N]", | ||
| 85 | .description = "Generate all tables [using N threads]", | ||
| 86 | .parse_args = gen_parse_args, | ||
| 87 | .exec = gen_exec | ||
| 88 | }; | ||
| 89 | |||
| 90 | Command | ||
| 91 | invert_cmd = { | ||
| 92 | .name = "invert", | ||
| 93 | .usage = "invert SCRAMBLE]", | ||
| 94 | .description = "Invert a scramble", | ||
| 95 | .parse_args = parse_only_scramble, | ||
| 96 | .exec = invert_exec, | ||
| 97 | }; | ||
| 98 | |||
| 99 | Command | ||
| 100 | steps_cmd = { | ||
| 101 | .name = "steps", | ||
| 102 | .usage = "steps", | ||
| 103 | .description = "List available steps", | ||
| 104 | .parse_args = parse_no_arg, | ||
| 105 | .exec = steps_exec | ||
| 106 | }; | ||
| 107 | |||
| 108 | Command | ||
| 109 | commands_cmd = { | ||
| 110 | .name = "commands", | ||
| 111 | .usage = "commands", | ||
| 112 | .description = "List available commands", | ||
| 113 | .parse_args = parse_no_arg, | ||
| 114 | .exec = commands_exec | ||
| 115 | }; | ||
| 116 | |||
| 117 | Command | ||
| 118 | freemem_cmd = { | ||
| 119 | .name = "freemem", | ||
| 120 | .usage = "freemem", | ||
| 121 | .description = "free large tables from RAM", | ||
| 122 | .parse_args = parse_no_arg, | ||
| 123 | .exec = freemem_exec, | ||
| 124 | }; | ||
| 125 | |||
| 126 | Command | ||
| 127 | print_cmd = { | ||
| 128 | .name = "print", | ||
| 129 | .usage = "print SCRAMBLE", | ||
| 130 | .description = "Print written description of the cube", | ||
| 131 | .parse_args = parse_only_scramble, | ||
| 132 | .exec = print_exec, | ||
| 133 | }; | ||
| 134 | |||
| 135 | Command | ||
| 136 | help_cmd = { | ||
| 137 | .name = "help", | ||
| 138 | .usage = "help [COMMAND]", | ||
| 139 | .description = "Display nissy manual page or help on specific command", | ||
| 140 | .parse_args = help_parse_args, | ||
| 141 | .exec = help_exec, | ||
| 142 | }; | ||
| 143 | |||
| 144 | /* | ||
| 145 | Command | ||
| 146 | twophase_cmd = { | ||
| 147 | .name = "twophase", | ||
| 148 | .usage = "twophase", | ||
| 149 | .description = "Find a solution quickly using a 2-phase method", | ||
| 150 | .parse_args = parse_only_scramble, | ||
| 151 | .exec = twophase_exec, | ||
| 152 | }; | ||
| 153 | */ | ||
| 154 | |||
| 155 | Command | ||
| 156 | quit_cmd = { | ||
| 157 | .name = "quit", | ||
| 158 | .usage = "quit", | ||
| 159 | .description = "Quit nissy", | ||
| 160 | .parse_args = parse_no_arg, | ||
| 161 | .exec = quit_exec, | ||
| 162 | }; | ||
| 163 | |||
| 164 | Command | ||
| 165 | cleanup_cmd = { | ||
| 166 | .name = "cleanup", | ||
| 167 | .usage = "cleanup SCRAMBLE", | ||
| 168 | .description = "Rewrite a scramble using only standard moves (HTM)", | ||
| 169 | .parse_args = parse_only_scramble, | ||
| 170 | .exec = cleanup_exec, | ||
| 171 | }; | ||
| 172 | |||
| 173 | Command | ||
| 174 | unniss_cmd = { | ||
| 175 | .name = "unniss", | ||
| 176 | .usage = "unniss SCRAMBLE", | ||
| 177 | .description = "Rewrite a scramble without NISS", | ||
| 178 | .parse_args = parse_only_scramble, | ||
| 179 | .exec = unniss_exec, | ||
| 180 | }; | ||
| 181 | |||
| 182 | Command | ||
| 183 | version_cmd = { | ||
| 184 | .name = "version", | ||
| 185 | .usage = "version", | ||
| 186 | .description = "print nissy version", | ||
| 187 | .parse_args = parse_no_arg, | ||
| 188 | .exec = version_exec, | ||
| 189 | }; | ||
| 190 | |||
| 191 | Command *commands[] = { | ||
| 192 | &commands_cmd, | ||
| 193 | &freemem_cmd, | ||
| 194 | &gen_cmd, | ||
| 195 | &help_cmd, | ||
| 196 | &invert_cmd, | ||
| 197 | &print_cmd, | ||
| 198 | &quit_cmd, | ||
| 199 | &solve_cmd, | ||
| 200 | &scramble_cmd, | ||
| 201 | &steps_cmd, | ||
| 202 | /* &twophase_cmd,*/ | ||
| 203 | &cleanup_cmd, | ||
| 204 | &unniss_cmd, | ||
| 205 | &version_cmd, | ||
| 206 | NULL | ||
| 207 | }; | ||
| 208 | |||
| 209 | #endif | ||
| 210 | |||
| 211 | #endif | ||
