diff options
Diffstat (limited to 'tools/tool.h')
| -rw-r--r-- | tools/tool.h | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/tools/tool.h b/tools/tool.h index 59407b6..5eec318 100644 --- a/tools/tool.h +++ b/tools/tool.h | |||
| @@ -11,11 +11,12 @@ | |||
| 11 | static void log_stderr(const char *, ...); | 11 | static void log_stderr(const char *, ...); |
| 12 | static void log_stdout(const char *, ...); | 12 | static void log_stdout(const char *, ...); |
| 13 | static double timerun(void (*)(void), const char *); | 13 | static double timerun(void (*)(void), const char *); |
| 14 | static void getfilename(const char *, const char *, char *); | ||
| 14 | static void writetable(const char *, int64_t, const char *); | 15 | static void writetable(const char *, int64_t, const char *); |
| 15 | static int64_t generatetable(const char *, const char *, char **); | 16 | static int64_t generatetable(const char *, const char *, char **); |
| 16 | static int64_t derivetable(uint8_t, char **); | 17 | static int64_t derivetable(uint8_t, char **); |
| 17 | static int getdata(const char *, const char *, char **, const char *); | 18 | static int getdata(const char *, const char *, char **, const char *); |
| 18 | static void gendata_run(const char *, const char *, const char *, uint64_t[static 21]); | 19 | static void gendata_run(const char *, const char *, uint64_t[static 21]); |
| 19 | static void derivedata_run(uint8_t, const char *, uint64_t[static 21]); | 20 | static void derivedata_run(uint8_t, const char *, uint64_t[static 21]); |
| 20 | 21 | ||
| 21 | static void | 22 | static void |
| @@ -73,6 +74,17 @@ timerun(void (*run)(void), const char *name) | |||
| 73 | } | 74 | } |
| 74 | 75 | ||
| 75 | static void | 76 | static void |
| 77 | getfilename(const char *solver, const char *options, char *filename) | ||
| 78 | { | ||
| 79 | uint8_t h, k; | ||
| 80 | |||
| 81 | /* Only h48 supported for now */ | ||
| 82 | parse_h48_options(options, &h, &k, NULL); | ||
| 83 | |||
| 84 | sprintf(filename, "tables/%sh%dk%d", solver, h, k); | ||
| 85 | } | ||
| 86 | |||
| 87 | static void | ||
| 76 | writetable(const char *buf, int64_t size, const char *filename) | 88 | writetable(const char *buf, int64_t size, const char *filename) |
| 77 | { | 89 | { |
| 78 | FILE *f; | 90 | FILE *f; |
| @@ -193,13 +205,12 @@ static void | |||
| 193 | gendata_run( | 205 | gendata_run( |
| 194 | const char *solver, | 206 | const char *solver, |
| 195 | const char *options, | 207 | const char *options, |
| 196 | const char *filename, /* TODO: remove filename, use solver name */ | ||
| 197 | uint64_t expected[static 21] | 208 | uint64_t expected[static 21] |
| 198 | ) { | 209 | ) { |
| 199 | int64_t size; | 210 | int64_t size; |
| 200 | char *buf; | 211 | char *buf, filename[1024]; |
| 201 | 212 | ||
| 202 | 213 | getfilename(solver, options, filename); | |
| 203 | size = generatetable(solver, options, &buf); | 214 | size = generatetable(solver, options, &buf); |
| 204 | switch (size) { | 215 | switch (size) { |
| 205 | case -1: | 216 | case -1: |
