diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2022-03-07 10:12:05 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2022-03-07 10:12:05 +0100 |
| commit | f6df8471931faeac7be76b8cdedc6daa48ab961d (patch) | |
| tree | b0d1f6181ed480975d041630858c96d661b47801 | |
| parent | ecd8bbf2c0b7a4ca20c9cdc5f8f26836d4082c36 (diff) | |
| download | nissy-f6df8471931faeac7be76b8cdedc6daa48ab961d.tar.gz nissy-f6df8471931faeac7be76b8cdedc6daa48ab961d.zip | |
Set up for adding freemem command
| -rw-r--r-- | TODO.md | 5 | ||||
| -rw-r--r-- | src/commands.c | 22 | ||||
| -rw-r--r-- | src/shell.c | 2 |
3 files changed, 27 insertions, 2 deletions
| @@ -5,8 +5,7 @@ It's more of a personal reminder than anything else. | |||
| 5 | 5 | ||
| 6 | ## For version 2.1 | 6 | ## For version 2.1 |
| 7 | ### Memory management | 7 | ### Memory management |
| 8 | * Free large tables from memory before exit (this is not strictly necessary, | 8 | * freemem command: implement the 5 functions, execute at the end of shell.c |
| 9 | but can help with WSL bugs) | ||
| 10 | ### Installation | 9 | ### Installation |
| 11 | * Is it possible to make table generation at least 3x faster? | 10 | * Is it possible to make table generation at least 3x faster? |
| 12 | ### Documentation | 11 | ### Documentation |
| @@ -40,6 +39,8 @@ including e.g. solutions that were not shown because -c) | |||
| 40 | * transform alg, rufify etc... | 39 | * transform alg, rufify etc... |
| 41 | * command notation to list available moves | 40 | * command notation to list available moves |
| 42 | * make multi-step solve much more general and create command | 41 | * make multi-step solve much more general and create command |
| 42 | * input directly cube status instead of moves | ||
| 43 | (graphical: maybe there is a cubing.js function; command line: ???) | ||
| 43 | 44 | ||
| 44 | ## Distribution | 45 | ## Distribution |
| 45 | 46 | ||
diff --git a/src/commands.c b/src/commands.c index 6bfc7b7..1396b69 100644 --- a/src/commands.c +++ b/src/commands.c | |||
| @@ -18,6 +18,7 @@ static void solve_exec(CommandArgs *args); | |||
| 18 | static void scramble_exec(CommandArgs *args); | 18 | static void scramble_exec(CommandArgs *args); |
| 19 | static void steps_exec(CommandArgs *args); | 19 | static void steps_exec(CommandArgs *args); |
| 20 | static void commands_exec(CommandArgs *args); | 20 | static void commands_exec(CommandArgs *args); |
| 21 | static void freemem_exec(CommandArgs *args); | ||
| 21 | static void print_exec(CommandArgs *args); | 22 | static void print_exec(CommandArgs *args); |
| 22 | static void twophase_exec(CommandArgs *args); | 23 | static void twophase_exec(CommandArgs *args); |
| 23 | static void help_exec(CommandArgs *args); | 24 | static void help_exec(CommandArgs *args); |
| @@ -88,6 +89,15 @@ commands_cmd = { | |||
| 88 | }; | 89 | }; |
| 89 | 90 | ||
| 90 | Command | 91 | Command |
| 92 | freemem_cmd = { | ||
| 93 | .name = "freemem", | ||
| 94 | .usage = "freemem", | ||
| 95 | .description = "free large tables from RAM", | ||
| 96 | .parse_args = parse_no_arg, | ||
| 97 | .exec = freemem_exec, | ||
| 98 | }; | ||
| 99 | |||
| 100 | Command | ||
| 91 | print_cmd = { | 101 | print_cmd = { |
| 92 | .name = "print", | 102 | .name = "print", |
| 93 | .usage = "print SCRAMBLE", | 103 | .usage = "print SCRAMBLE", |
| @@ -535,6 +545,18 @@ commands_exec(CommandArgs *args) | |||
| 535 | } | 545 | } |
| 536 | 546 | ||
| 537 | static void | 547 | static void |
| 548 | freemem_exec(CommandArgs *args) | ||
| 549 | { | ||
| 550 | /* TODO: implement these functions | ||
| 551 | free_allpd(); | ||
| 552 | free_allsd(); | ||
| 553 | free_invtables(); | ||
| 554 | free_ttables(); | ||
| 555 | free_mtables(); | ||
| 556 | */ | ||
| 557 | } | ||
| 558 | |||
| 559 | static void | ||
| 538 | print_exec(CommandArgs *args) | 560 | print_exec(CommandArgs *args) |
| 539 | { | 561 | { |
| 540 | init_moves(); | 562 | init_moves(); |
diff --git a/src/shell.c b/src/shell.c index 31dde0e..420dc1c 100644 --- a/src/shell.c +++ b/src/shell.c | |||
| @@ -163,5 +163,7 @@ main(int argc, char *argv[]) | |||
| 163 | launch(false); | 163 | launch(false); |
| 164 | } | 164 | } |
| 165 | 165 | ||
| 166 | /* TODO: exec freemem */ | ||
| 167 | |||
| 166 | return 0; | 168 | return 0; |
| 167 | } | 169 | } |
