From 474039de7af2cee7fa309e06a5c4e75b81f220ad Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Thu, 31 Jul 2025 13:41:29 +0200 Subject: Fixed table name in tools --- tools/300_solve_small/solve_small.c | 8 +++----- tools/301_solve_file/solve_file.c | 8 ++++---- tools/302_solve_multisol/solve_multisol.c | 8 +++----- tools/500_pause_resume_stop/pause_resume_stop.c | 7 +++---- tools/solvetest.h | 7 +++---- 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) { } int main(int argc, char **argv) { - char filename[255], dataid[NISSY_SIZE_DATAID]; + char filename[7+NISSY_SIZE_DATAID], dataid[NISSY_SIZE_DATAID]; if (argc < 2) { printf("Error: not enough arguments. " @@ -59,13 +59,11 @@ int main(int argc, char **argv) { srand(time(NULL)); nissy_setlogger(log_stderr, NULL); - - sprintf(filename, "tables/%s", solver); + size = nissy_solverinfo(solver, dataid); + sprintf(filename, "tables/%s", dataid); if (getdata(solver, &buf, filename) != 0) return 1; - size = nissy_solverinfo(solver, dataid); - timerun(run); 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) { } int main(int argc, char **argv) { - char filename[255], dataid[NISSY_SIZE_DATAID], *scrfilename; + char filename[7+NISSY_SIZE_DATAID], dataid[NISSY_SIZE_DATAID]; + char *scrfilename; FILE *scrfile; if (argc < 3) { @@ -60,12 +61,11 @@ int main(int argc, char **argv) { srand(time(NULL)); nissy_setlogger(log_stderr, NULL); - sprintf(filename, "tables/%s", solver); + size = nissy_solverinfo(solver, dataid); + sprintf(filename, "tables/%s", dataid); if (getdata(solver, &buf, filename) != 0) return 1; - size = nissy_solverinfo(solver, dataid); - if ((scrfile = fopen(scrfilename, "r")) == NULL) { printf("Error: could not read given file '%s'.\n", 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) { } int main(int argc, char **argv) { - char filename[255], dataid[NISSY_SIZE_DATAID]; + char filename[7+NISSY_SIZE_DATAID], dataid[NISSY_SIZE_DATAID]; if (argc < 3) { printf("Error: not enough arguments. " @@ -53,13 +53,11 @@ int main(int argc, char **argv) { srand(time(NULL)); nissy_setlogger(log_stderr, NULL); - - sprintf(filename, "tables/%s", solver); + size = nissy_solverinfo(solver, dataid); + sprintf(filename, "tables/%s", dataid); if (getdata(solver, &buf, filename) != 0) return 1; - size = nissy_solverinfo(solver, dataid); - timerun(run); 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) { } int main(int argc, char **argv) { - char filename[255], dataid[NISSY_SIZE_DATAID]; + char filename[7+NISSY_SIZE_DATAID], dataid[NISSY_SIZE_DATAID]; if (argc < 2) { printf("Error: not enough arguments. " @@ -76,12 +76,11 @@ int main(int argc, char **argv) { srand(time(NULL)); nissy_setlogger(log_stderr, NULL); - sprintf(filename, "tables/%s", solver); + size = nissy_solverinfo(solver, dataid); + sprintf(filename, "tables/%s", dataid); if (getdata(solver, &buf, filename) != 0) return 1; - size = nissy_solverinfo(solver, dataid); - timerun(run); 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) { } int main(int argc, char **argv) { - char filename[255], dataid[NISSY_SIZE_DATAID]; + char filename[7+NISSY_SIZE_DATAID], dataid[NISSY_SIZE_DATAID]; if (argc < 2) { printf("Error: not enough arguments. " @@ -131,12 +131,11 @@ int main(int argc, char **argv) { srand(time(NULL)); nissy_setlogger(log_stderr, NULL); - sprintf(filename, "tables/%s", solver); + size = nissy_solverinfo(solver, dataid); + sprintf(filename, "tables/%s", dataid); if (getdata(solver, &buf, filename) != 0) return 1; - size = nissy_solverinfo(solver, dataid); - timerun(run); 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( printf("Error getting table size.\n"); return -1; } +printf("In generatetable %s\n", dataid); *buf = malloc(size); gensize = nissy_gendata(solver, size, *buf); @@ -157,7 +158,6 @@ gendata_run( printf("Succesfully generated %lld bytes. " "See above for details on the tables.\n", size); - /* TODO: check that the table is correct */ writetable(buf, size, filename); break; } -- cgit v1.3