commit 474039de7af2cee7fa309e06a5c4e75b81f220ad
parent bf3497420c9a12397dc13a34faf3ce3e456f3aa7
Author: Sebastiano Tronto <sebastiano@tronto.net>
Date: Thu, 31 Jul 2025 13:41:29 +0200
Fixed table name in tools
Diffstat:
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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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;
}