From 39a5ef697479b56db0ac69ef00e0735e51f6150a Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Mon, 27 Jul 2020 15:55:46 +0200 Subject: added command clear --- docs/clear.txt | 9 +++++++++ docs/pre.txt | 18 ------------------ nissy | Bin 171912 -> 521128 bytes src/main.c | 12 +++++++++++- 4 files changed, 20 insertions(+), 19 deletions(-) create mode 100644 docs/clear.txt delete mode 100644 docs/pre.txt diff --git a/docs/clear.txt b/docs/clear.txt new file mode 100644 index 0000000..8ba961a --- /dev/null +++ b/docs/clear.txt @@ -0,0 +1,9 @@ + +HELP PAGE FOR COMMAND clear + +SYNTAX +clear + +DESCRIPTION +Resets all saved scrambles and output sequences. + diff --git a/docs/pre.txt b/docs/pre.txt deleted file mode 100644 index c2cfd96..0000000 --- a/docs/pre.txt +++ /dev/null @@ -1,18 +0,0 @@ - -HELP PAGE FOR COMMAND pre - -SYNTAX -pre [MOVES|$ID1|@ID1] $ID2 - -DESCRIPTION -Prepends either MOVES, the scramble memorized under $ID1 or the output sequence -memorized under @ID1 at the beginning of the scramble memorized under $ID2. If -none of MOVES, $ID1 or @ID1 is specified, the user will be asked to type the -moves. -Menmonic: "pre(pend) x to y" or just "pre(pend) to y". - -EXAMPLES -add $1 - The user is required to type the moves that will be prepended to $1. -add F R B $1 - Prepends the moves F R B to scramble $1. Now scramble $1 begins with F R B. diff --git a/nissy b/nissy index d471eb7..d0ed5f5 100755 Binary files a/nissy and b/nissy differ diff --git a/src/main.c b/src/main.c index d68f4af..9758a2f 100644 --- a/src/main.c +++ b/src/main.c @@ -32,6 +32,8 @@ char *commands[][10] = { "Solves a scramble."}, {"replace", "[MOVES|$ID|@ID]", "Find non-optimal subsequences."}, + {"clear", "", + "Delete saved scrambles and output sequences."}, {"eo", "[MOVES|$ID|@ID]", "Solves EO."}, {"dr", "[MOVES|$ID|@ID]", @@ -459,6 +461,14 @@ void replace_cmd(int n, char cmdtok[][100]) { } } +void clear_cmd(int n, char cmdtok[][100]) { + if (n > 1 || cmdtok[0][0] != 'c') { /* Avoid unused variable warning */ + printf("clear: syntax error.\n"); + return; + } + scr_count = tmp_count = 1; +} + void eo_cmd(int n, char cmdtok[][100]) { /* Default values */ @@ -818,7 +828,7 @@ void exit_quit_cmd(int n, char cmdtok[][100]) { void (*cmd_list[])(int n, char cmdtok[][100]) = { help_cmd, scramble_cmd, save_cmd, change_cmd, print_cmd, add_cmd, invert_cmd, unniss_cmd, pic_cmd, - solve_cmd, replace_cmd, + solve_cmd, replace_cmd, clear_cmd, eo_cmd, dr_cmd, htr_cmd, drfinish_cmd, htrfinish_cmd, drcorners_cmd, exit_quit_cmd, exit_quit_cmd, NULL -- cgit v1.3