blob: a28992574ab4d0d340f94a7e7201249e57be9a79 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
#include "../tool.h"
char *solver;
static void
run(void) {
int64_t size;
char filename[1024], dataid[NISSY_SIZE_DATAID];
unsigned char *buf;
size = generatetable(solver, &buf, dataid);
switch (size) {
case -1:
return;
case -2:
goto gendata_run_finish;
default:
if (nissy_checkdata(solver, size, buf) == NISSY_OK) {
printf("\n");
printf("Generated %" PRId64 " bytes.\n", size);
sprintf(filename, "tables/%s", dataid);
writetable(buf, size, filename);
} else {
printf("Error: table for %s generated incorrectly!\n",
solver);
}
break;
}
gendata_run_finish:
free(buf);
}
int main(int argc, char **argv) {
if (argc < 2) {
printf("Error: not enough arguments. "
"A solver must be given.\n");
return 1;
}
solver = argv[1];
nissy_setlogger(log_stderr, NULL);
timerun(run);
return 0;
}
|