aboutsummaryrefslogtreecommitdiff
path: root/tools/tool.h
diff options
context:
space:
mode:
Diffstat (limited to 'tools/tool.h')
-rw-r--r--tools/tool.h20
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
10static void log_stderr(const char *, ...); 11static void log_stderr(const char *, ...);
11static void log_stdout(const char *, ...); 12static void log_stdout(const char *, ...);
12static double timerun(void (*)(void), const char *); 13static double timerun(void (*)(void), const char *);
14static void getfilename(const char *, const char *, char *);
13static void writetable(const char *, int64_t, const char *); 15static void writetable(const char *, int64_t, const char *);
14static int64_t generatetable(const char *, const char *, char **); 16static int64_t generatetable(const char *, const char *, char **);
15static int getdata(const char *, const char *, char **, const char *); 17static int getdata(const char *, const char *, char **, const char *);
16static void gendata_run(const char *, const char *, const char *, uint64_t[static 21]); 18static void gendata_run(const char *, const char *, uint64_t *);
17 19
18static void 20static void
19log_stderr(const char *str, ...) 21log_stderr(const char *str, ...)
@@ -70,6 +72,17 @@ timerun(void (*run)(void), const char *name)
70} 72}
71 73
72static void 74static void
75getfilename(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
85static void
73writetable(const char *buf, int64_t size, const char *filename) 86writetable(const char *buf, int64_t size, const char *filename)
74{ 87{
75 FILE *f; 88 FILE *f;
@@ -155,13 +168,12 @@ static void
155gendata_run( 168gendata_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:

Generated with cgit - Back to sebastiano.tronto.net