diff options
Diffstat (limited to 'tools/tool.h')
| -rw-r--r-- | tools/tool.h | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/tools/tool.h b/tools/tool.h index 757657b..1540f22 100644 --- a/tools/tool.h +++ b/tools/tool.h | |||
| @@ -6,14 +6,16 @@ | |||
| 6 | #include <stdlib.h> | 6 | #include <stdlib.h> |
| 7 | 7 | ||
| 8 | #include "../src/nissy.h" | 8 | #include "../src/nissy.h" |
| 9 | #include "nissy_extra.h" | ||
| 9 | 10 | ||
| 10 | static void log_stderr(const char *, ...); | 11 | static void log_stderr(const char *, ...); |
| 11 | static void log_stdout(const char *, ...); | 12 | static void log_stdout(const char *, ...); |
| 12 | static double timerun(void (*)(void), const char *); | 13 | static double timerun(void (*)(void), const char *); |
| 14 | static void getfilename(const char *, const char *, char *); | ||
| 13 | static void writetable(const char *, int64_t, const char *); | 15 | static void writetable(const char *, int64_t, const char *); |
| 14 | static int64_t generatetable(const char *, const char *, char **); | 16 | static int64_t generatetable(const char *, const char *, char **); |
| 15 | static int getdata(const char *, const char *, char **, const char *); | 17 | static int getdata(const char *, const char *, char **, const char *); |
| 16 | static void gendata_run(const char *, const char *, const char *, uint64_t[static 21]); | 18 | static void gendata_run(const char *, const char *, uint64_t *); |
| 17 | 19 | ||
| 18 | static void | 20 | static void |
| 19 | log_stderr(const char *str, ...) | 21 | log_stderr(const char *str, ...) |
| @@ -70,6 +72,17 @@ timerun(void (*run)(void), const char *name) | |||
| 70 | } | 72 | } |
| 71 | 73 | ||
| 72 | static void | 74 | static void |
| 75 | getfilename(const char *solver, const char *options, char *filename) | ||
| 76 | { | ||
| 77 | uint8_t h, k; | ||
| 78 | |||
| 79 | /* Only h48 supported for now */ | ||
| 80 | parse_h48_options(options, &h, &k, NULL); | ||
| 81 | |||
| 82 | sprintf(filename, "tables/%sh%dk%d", solver, h, k); | ||
| 83 | } | ||
| 84 | |||
| 85 | static void | ||
| 73 | writetable(const char *buf, int64_t size, const char *filename) | 86 | writetable(const char *buf, int64_t size, const char *filename) |
| 74 | { | 87 | { |
| 75 | FILE *f; | 88 | FILE *f; |
| @@ -155,13 +168,12 @@ static void | |||
| 155 | gendata_run( | 168 | gendata_run( |
| 156 | const char *solver, | 169 | const char *solver, |
| 157 | const char *options, | 170 | const char *options, |
| 158 | const char *filename, /* TODO: remove filename, use solver name */ | ||
| 159 | uint64_t expected[static 21] | 171 | uint64_t expected[static 21] |
| 160 | ) { | 172 | ) { |
| 161 | int64_t size; | 173 | int64_t size; |
| 162 | char *buf; | 174 | char *buf, filename[1024]; |
| 163 | 175 | ||
| 164 | 176 | getfilename(solver, options, filename); | |
| 165 | size = generatetable(solver, options, &buf); | 177 | size = generatetable(solver, options, &buf); |
| 166 | switch (size) { | 178 | switch (size) { |
| 167 | case -1: | 179 | case -1: |
