diff options
Diffstat (limited to 'src/solvers/solutions.h')
| -rw-r--r-- | src/solvers/solutions.h | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/solvers/solutions.h b/src/solvers/solutions.h index 95c1d1a..c9a1313 100644 --- a/src/solvers/solutions.h +++ b/src/solvers/solutions.h | |||
| @@ -7,7 +7,8 @@ STATIC bool solution_moves_equal( | |||
| 7 | STATIC bool solution_moves_is_duplicate(size_t n, const solution_moves_t[n+1]); | 7 | STATIC bool solution_moves_is_duplicate(size_t n, const solution_moves_t[n+1]); |
| 8 | STATIC bool appendchar(solution_list_t [static 1], char); | 8 | STATIC bool appendchar(solution_list_t [static 1], char); |
| 9 | STATIC int64_t appendsolution(const solution_moves_t [static 1], | 9 | STATIC int64_t appendsolution(const solution_moves_t [static 1], |
| 10 | const solution_settings_t [static 1], solution_list_t [static 1], bool); | 10 | const solution_settings_t [static 1], solution_list_t [static 1], bool, |
| 11 | const char *); | ||
| 11 | STATIC bool solutions_done(const solution_list_t [static 1], | 12 | STATIC bool solutions_done(const solution_list_t [static 1], |
| 12 | const solution_settings_t [static 1], int8_t depth); | 13 | const solution_settings_t [static 1], int8_t depth); |
| 13 | 14 | ||
| @@ -34,7 +35,7 @@ STATIC bool | |||
| 34 | solution_list_init(solution_list_t sols[static 1], size_t n, char buf[n]) | 35 | solution_list_init(solution_list_t sols[static 1], size_t n, char buf[n]) |
| 35 | { | 36 | { |
| 36 | if (n == 0) { | 37 | if (n == 0) { |
| 37 | LOG("Cannot use solution buffer with size 0\n"); | 38 | LOG("Error: cannot use solution buffer with size 0\n"); |
| 38 | return false; | 39 | return false; |
| 39 | } | 40 | } |
| 40 | 41 | ||
| @@ -98,7 +99,8 @@ appendsolution( | |||
| 98 | const solution_moves_t moves[static 1], | 99 | const solution_moves_t moves[static 1], |
| 99 | const solution_settings_t settings[static 1], | 100 | const solution_settings_t settings[static 1], |
| 100 | solution_list_t list[static 1], | 101 | solution_list_t list[static 1], |
| 101 | bool log | 102 | bool log, |
| 103 | const char *solver_name | ||
| 102 | ) | 104 | ) |
| 103 | { | 105 | { |
| 104 | int64_t r, strl; | 106 | int64_t r, strl; |
| @@ -184,8 +186,8 @@ appendsolution( | |||
| 184 | 186 | ||
| 185 | if (log) { | 187 | if (log) { |
| 186 | list->buf[list->used-1] = '\0'; | 188 | list->buf[list->used-1] = '\0'; |
| 187 | LOG("Found solution #%" PRIu64 ": %s\n", | 189 | LOG("[%s solve] Found solution #%" PRIu64 ": %s\n", |
| 188 | list->nsols, last_start); | 190 | solver_name, list->nsols, last_start); |
| 189 | list->buf[list->used-1] = '\n'; | 191 | list->buf[list->used-1] = '\n'; |
| 190 | } | 192 | } |
| 191 | } | 193 | } |
| @@ -194,14 +196,14 @@ appendsolution( | |||
| 194 | return r; | 196 | return r; |
| 195 | 197 | ||
| 196 | appendsolution_error_buffer: | 198 | appendsolution_error_buffer: |
| 197 | LOG("Could not append solution to buffer: size too small\n"); | 199 | LOG("[%s solve] Error: buffer too small\n", solver_name); |
| 198 | list->buf[0] = '\0'; | 200 | list->buf[0] = '\0'; |
| 199 | return NISSY_ERROR_BUFFER_SIZE; | 201 | return NISSY_ERROR_BUFFER_SIZE; |
| 200 | 202 | ||
| 201 | appendsolution_error_solution_length: | 203 | appendsolution_error_solution_length: |
| 202 | LOG("Error: solution is too long (%" PRIu8 ").\n" | 204 | LOG("[%s solve] Error: solution is too long (%" PRIu8 ").\n" |
| 203 | "This is a bug, please report it.\n", | 205 | "This is a bug, please report it.\n", |
| 204 | moves->nmoves + moves->npremoves); | 206 | solver_name, moves->nmoves + moves->npremoves); |
| 205 | list->buf[0] = '\0'; | 207 | list->buf[0] = '\0'; |
| 206 | return NISSY_ERROR_UNKNOWN; | 208 | return NISSY_ERROR_UNKNOWN; |
| 207 | } | 209 | } |
