diff options
| -rw-r--r-- | tools/300_solve_small/solve_small.c | 8 | ||||
| -rw-r--r-- | tools/301_solve_file/solve_file.c | 8 | ||||
| -rw-r--r-- | tools/302_solve_multisol/solve_multisol.c | 8 | ||||
| -rw-r--r-- | tools/500_pause_resume_stop/pause_resume_stop.c | 7 | ||||
| -rw-r--r-- | tools/solvetest.h | 7 | ||||
| -rw-r--r-- | tools/tool.h | 2 |
6 files changed, 17 insertions, 23 deletions
diff --git a/tools/300_solve_small/solve_small.c b/tools/300_solve_small/solve_small.c index 83a712a..af82b80 100644 --- a/tools/300_solve_small/solve_small.c +++ b/tools/300_solve_small/solve_small.c | |||
| @@ -47,7 +47,7 @@ void run(void) { | |||
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | int main(int argc, char **argv) { | 49 | int main(int argc, char **argv) { |
| 50 | char filename[255], dataid[NISSY_SIZE_DATAID]; | 50 | char filename[7+NISSY_SIZE_DATAID], dataid[NISSY_SIZE_DATAID]; |
| 51 | 51 | ||
| 52 | if (argc < 2) { | 52 | if (argc < 2) { |
| 53 | printf("Error: not enough arguments. " | 53 | printf("Error: not enough arguments. " |
| @@ -59,13 +59,11 @@ int main(int argc, char **argv) { | |||
| 59 | srand(time(NULL)); | 59 | srand(time(NULL)); |
| 60 | nissy_setlogger(log_stderr, NULL); | 60 | nissy_setlogger(log_stderr, NULL); |
| 61 | 61 | ||
| 62 | 62 | size = nissy_solverinfo(solver, dataid); | |
| 63 | sprintf(filename, "tables/%s", solver); | 63 | sprintf(filename, "tables/%s", dataid); |
| 64 | if (getdata(solver, &buf, filename) != 0) | 64 | if (getdata(solver, &buf, filename) != 0) |
| 65 | return 1; | 65 | return 1; |
| 66 | 66 | ||
| 67 | size = nissy_solverinfo(solver, dataid); | ||
| 68 | |||
| 69 | timerun(run); | 67 | timerun(run); |
| 70 | 68 | ||
| 71 | free(buf); | 69 | free(buf); |
diff --git a/tools/301_solve_file/solve_file.c b/tools/301_solve_file/solve_file.c index a1277e3..a8f0925 100644 --- a/tools/301_solve_file/solve_file.c +++ b/tools/301_solve_file/solve_file.c | |||
| @@ -38,7 +38,8 @@ void run(void) { | |||
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | int main(int argc, char **argv) { | 40 | int main(int argc, char **argv) { |
| 41 | char filename[255], dataid[NISSY_SIZE_DATAID], *scrfilename; | 41 | char filename[7+NISSY_SIZE_DATAID], dataid[NISSY_SIZE_DATAID]; |
| 42 | char *scrfilename; | ||
| 42 | FILE *scrfile; | 43 | FILE *scrfile; |
| 43 | 44 | ||
| 44 | if (argc < 3) { | 45 | if (argc < 3) { |
| @@ -60,12 +61,11 @@ int main(int argc, char **argv) { | |||
| 60 | srand(time(NULL)); | 61 | srand(time(NULL)); |
| 61 | nissy_setlogger(log_stderr, NULL); | 62 | nissy_setlogger(log_stderr, NULL); |
| 62 | 63 | ||
| 63 | sprintf(filename, "tables/%s", solver); | 64 | size = nissy_solverinfo(solver, dataid); |
| 65 | sprintf(filename, "tables/%s", dataid); | ||
| 64 | if (getdata(solver, &buf, filename) != 0) | 66 | if (getdata(solver, &buf, filename) != 0) |
| 65 | return 1; | 67 | return 1; |
| 66 | 68 | ||
| 67 | size = nissy_solverinfo(solver, dataid); | ||
| 68 | |||
| 69 | if ((scrfile = fopen(scrfilename, "r")) == NULL) { | 69 | if ((scrfile = fopen(scrfilename, "r")) == NULL) { |
| 70 | printf("Error: could not read given file '%s'.\n", | 70 | printf("Error: could not read given file '%s'.\n", |
| 71 | scrfilename); | 71 | scrfilename); |
diff --git a/tools/302_solve_multisol/solve_multisol.c b/tools/302_solve_multisol/solve_multisol.c index a3dfd1f..2275671 100644 --- a/tools/302_solve_multisol/solve_multisol.c +++ b/tools/302_solve_multisol/solve_multisol.c | |||
| @@ -40,7 +40,7 @@ void run(void) { | |||
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | int main(int argc, char **argv) { | 42 | int main(int argc, char **argv) { |
| 43 | char filename[255], dataid[NISSY_SIZE_DATAID]; | 43 | char filename[7+NISSY_SIZE_DATAID], dataid[NISSY_SIZE_DATAID]; |
| 44 | 44 | ||
| 45 | if (argc < 3) { | 45 | if (argc < 3) { |
| 46 | printf("Error: not enough arguments. " | 46 | printf("Error: not enough arguments. " |
| @@ -53,13 +53,11 @@ int main(int argc, char **argv) { | |||
| 53 | srand(time(NULL)); | 53 | srand(time(NULL)); |
| 54 | nissy_setlogger(log_stderr, NULL); | 54 | nissy_setlogger(log_stderr, NULL); |
| 55 | 55 | ||
| 56 | 56 | size = nissy_solverinfo(solver, dataid); | |
| 57 | sprintf(filename, "tables/%s", solver); | 57 | sprintf(filename, "tables/%s", dataid); |
| 58 | if (getdata(solver, &buf, filename) != 0) | 58 | if (getdata(solver, &buf, filename) != 0) |
| 59 | return 1; | 59 | return 1; |
| 60 | 60 | ||
| 61 | size = nissy_solverinfo(solver, dataid); | ||
| 62 | |||
| 63 | timerun(run); | 61 | timerun(run); |
| 64 | 62 | ||
| 65 | free(buf); | 63 | free(buf); |
diff --git a/tools/500_pause_resume_stop/pause_resume_stop.c b/tools/500_pause_resume_stop/pause_resume_stop.c index ae3b67f..8beee5c 100644 --- a/tools/500_pause_resume_stop/pause_resume_stop.c +++ b/tools/500_pause_resume_stop/pause_resume_stop.c | |||
| @@ -65,7 +65,7 @@ void run(void) { | |||
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | int main(int argc, char **argv) { | 67 | int main(int argc, char **argv) { |
| 68 | char filename[255], dataid[NISSY_SIZE_DATAID]; | 68 | char filename[7+NISSY_SIZE_DATAID], dataid[NISSY_SIZE_DATAID]; |
| 69 | 69 | ||
| 70 | if (argc < 2) { | 70 | if (argc < 2) { |
| 71 | printf("Error: not enough arguments. " | 71 | printf("Error: not enough arguments. " |
| @@ -76,12 +76,11 @@ int main(int argc, char **argv) { | |||
| 76 | srand(time(NULL)); | 76 | srand(time(NULL)); |
| 77 | nissy_setlogger(log_stderr, NULL); | 77 | nissy_setlogger(log_stderr, NULL); |
| 78 | 78 | ||
| 79 | sprintf(filename, "tables/%s", solver); | 79 | size = nissy_solverinfo(solver, dataid); |
| 80 | sprintf(filename, "tables/%s", dataid); | ||
| 80 | if (getdata(solver, &buf, filename) != 0) | 81 | if (getdata(solver, &buf, filename) != 0) |
| 81 | return 1; | 82 | return 1; |
| 82 | 83 | ||
| 83 | size = nissy_solverinfo(solver, dataid); | ||
| 84 | |||
| 85 | timerun(run); | 84 | timerun(run); |
| 86 | 85 | ||
| 87 | free(buf); | 86 | free(buf); |
diff --git a/tools/solvetest.h b/tools/solvetest.h index 5939d5d..f9087b7 100644 --- a/tools/solvetest.h +++ b/tools/solvetest.h | |||
| @@ -119,7 +119,7 @@ void run(void) { | |||
| 119 | } | 119 | } |
| 120 | 120 | ||
| 121 | int main(int argc, char **argv) { | 121 | int main(int argc, char **argv) { |
| 122 | char filename[255], dataid[NISSY_SIZE_DATAID]; | 122 | char filename[7+NISSY_SIZE_DATAID], dataid[NISSY_SIZE_DATAID]; |
| 123 | 123 | ||
| 124 | if (argc < 2) { | 124 | if (argc < 2) { |
| 125 | printf("Error: not enough arguments. " | 125 | printf("Error: not enough arguments. " |
| @@ -131,12 +131,11 @@ int main(int argc, char **argv) { | |||
| 131 | srand(time(NULL)); | 131 | srand(time(NULL)); |
| 132 | nissy_setlogger(log_stderr, NULL); | 132 | nissy_setlogger(log_stderr, NULL); |
| 133 | 133 | ||
| 134 | sprintf(filename, "tables/%s", solver); | 134 | size = nissy_solverinfo(solver, dataid); |
| 135 | sprintf(filename, "tables/%s", dataid); | ||
| 135 | if (getdata(solver, &buf, filename) != 0) | 136 | if (getdata(solver, &buf, filename) != 0) |
| 136 | return 1; | 137 | return 1; |
| 137 | 138 | ||
| 138 | size = nissy_solverinfo(solver, dataid); | ||
| 139 | |||
| 140 | timerun(run); | 139 | timerun(run); |
| 141 | 140 | ||
| 142 | free(buf); | 141 | free(buf); |
diff --git a/tools/tool.h b/tools/tool.h index 9c55d2b..8c04eb0 100644 --- a/tools/tool.h +++ b/tools/tool.h | |||
| @@ -80,6 +80,7 @@ generatetable( | |||
| 80 | printf("Error getting table size.\n"); | 80 | printf("Error getting table size.\n"); |
| 81 | return -1; | 81 | return -1; |
| 82 | } | 82 | } |
| 83 | printf("In generatetable %s\n", dataid); | ||
| 83 | 84 | ||
| 84 | *buf = malloc(size); | 85 | *buf = malloc(size); |
| 85 | gensize = nissy_gendata(solver, size, *buf); | 86 | gensize = nissy_gendata(solver, size, *buf); |
| @@ -157,7 +158,6 @@ gendata_run( | |||
| 157 | printf("Succesfully generated %lld bytes. " | 158 | printf("Succesfully generated %lld bytes. " |
| 158 | "See above for details on the tables.\n", size); | 159 | "See above for details on the tables.\n", size); |
| 159 | 160 | ||
| 160 | /* TODO: check that the table is correct */ | ||
| 161 | writetable(buf, size, filename); | 161 | writetable(buf, size, filename); |
| 162 | break; | 162 | break; |
| 163 | } | 163 | } |
