From f6df8471931faeac7be76b8cdedc6daa48ab961d Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Mon, 7 Mar 2022 10:12:05 +0100 Subject: Set up for adding freemem command --- TODO.md | 5 +++-- src/commands.c | 22 ++++++++++++++++++++++ src/shell.c | 2 ++ 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/TODO.md b/TODO.md index 553207f..a18c068 100644 --- a/TODO.md +++ b/TODO.md @@ -5,8 +5,7 @@ It's more of a personal reminder than anything else. ## For version 2.1 ### Memory management -* Free large tables from memory before exit (this is not strictly necessary, - but can help with WSL bugs) +* freemem command: implement the 5 functions, execute at the end of shell.c ### Installation * Is it possible to make table generation at least 3x faster? ### Documentation @@ -40,6 +39,8 @@ including e.g. solutions that were not shown because -c) * transform alg, rufify etc... * command notation to list available moves * make multi-step solve much more general and create command +* input directly cube status instead of moves + (graphical: maybe there is a cubing.js function; command line: ???) ## Distribution 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); static void scramble_exec(CommandArgs *args); static void steps_exec(CommandArgs *args); static void commands_exec(CommandArgs *args); +static void freemem_exec(CommandArgs *args); static void print_exec(CommandArgs *args); static void twophase_exec(CommandArgs *args); static void help_exec(CommandArgs *args); @@ -87,6 +88,15 @@ commands_cmd = { .exec = commands_exec }; +Command +freemem_cmd = { + .name = "freemem", + .usage = "freemem", + .description = "free large tables from RAM", + .parse_args = parse_no_arg, + .exec = freemem_exec, +}; + Command print_cmd = { .name = "print", @@ -534,6 +544,18 @@ commands_exec(CommandArgs *args) } +static void +freemem_exec(CommandArgs *args) +{ +/* TODO: implement these functions + free_allpd(); + free_allsd(); + free_invtables(); + free_ttables(); + free_mtables(); +*/ +} + static void print_exec(CommandArgs *args) { 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[]) launch(false); } + /* TODO: exec freemem */ + return 0; } -- cgit v1.3