diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2024-10-10 14:30:39 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2024-10-10 14:30:39 +0200 |
| commit | f8d247c53c3c3bd94fed645b5b47a9096cadc123 (patch) | |
| tree | 7a62cc7322ea8175a7df9b655d4a9d5e026a004a /tools/000_gendata | |
| parent | 2e93de4ad102973961cb24d5b91f0c299763299f (diff) | |
| download | nissy-core-f8d247c53c3c3bd94fed645b5b47a9096cadc123.tar.gz nissy-core-f8d247c53c3c3bd94fed645b5b47a9096cadc123.zip | |
Removed "options" from solver selection
Now the solver name fully determines the solver (and options)
to be used. For example, now one must specify "h48h0k4" as the
name of the solver.
This PR also fixes a couple of things in tools.
Diffstat (limited to 'tools/000_gendata')
| -rw-r--r-- | tools/000_gendata/gendata.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/tools/000_gendata/gendata.c b/tools/000_gendata/gendata.c index 2798862..eec9f76 100644 --- a/tools/000_gendata/gendata.c +++ b/tools/000_gendata/gendata.c | |||
| @@ -1,16 +1,16 @@ | |||
| 1 | #include "../tool.h" | 1 | #include "../tool.h" |
| 2 | #include "../expected_distributions.h" | 2 | #include "../expected_distributions.h" |
| 3 | 3 | ||
| 4 | char *solver, *options; | 4 | char *solver; |
| 5 | uint64_t *expected; | 5 | uint64_t *expected; |
| 6 | 6 | ||
| 7 | static void | 7 | static void |
| 8 | run(void) { | 8 | run(void) { |
| 9 | int64_t size; | 9 | int64_t size; |
| 10 | bool consistent, expected; | ||
| 10 | char *buf, filename[1024]; | 11 | char *buf, filename[1024]; |
| 11 | 12 | ||
| 12 | getfilename(solver, options, filename); | 13 | size = generatetable(solver, &buf); |
| 13 | size = generatetable(solver, options, &buf); | ||
| 14 | switch (size) { | 14 | switch (size) { |
| 15 | case -1: | 15 | case -1: |
| 16 | return; | 16 | return; |
| @@ -18,11 +18,19 @@ run(void) { | |||
| 18 | goto gendata_run_finish; | 18 | goto gendata_run_finish; |
| 19 | default: | 19 | default: |
| 20 | nissy_datainfo(buf, write_stdout); | 20 | nissy_datainfo(buf, write_stdout); |
| 21 | if (check_distribution(solver, buf)) { | 21 | consistent = nissy_checkdata(solver, buf) == 0; |
| 22 | expected = check_distribution(solver, buf); | ||
| 23 | if (consistent && expected) { | ||
| 22 | printf("\n"); | 24 | printf("\n"); |
| 23 | printf("Generated %" PRId64 " bytes.\n", size); | 25 | printf("Generated %" PRId64 " bytes.\n", size); |
| 26 | sprintf(filename, "tables/%s", solver); | ||
| 24 | writetable(buf, size, filename); | 27 | writetable(buf, size, filename); |
| 25 | } | 28 | } |
| 29 | if (!consistent) | ||
| 30 | printf("Error: table is not consistent with info" | ||
| 31 | " (nissy_checkdata() failed)\n"); | ||
| 32 | if (!expected) | ||
| 33 | printf("Error: distribution is not as expected\n"); | ||
| 26 | break; | 34 | break; |
| 27 | } | 35 | } |
| 28 | 36 | ||
| @@ -33,15 +41,14 @@ gendata_run_finish: | |||
| 33 | int main(int argc, char **argv) { | 41 | int main(int argc, char **argv) { |
| 34 | uint8_t h, k; | 42 | uint8_t h, k; |
| 35 | 43 | ||
| 36 | if (argc < 3) { | 44 | if (argc < 2) { |
| 37 | fprintf(stderr, "Error: not enough arguments. " | 45 | fprintf(stderr, "Error: not enough arguments. " |
| 38 | "A solver and its options must be given.\n"); | 46 | "A solver must be given.\n"); |
| 39 | return 1; | 47 | return 1; |
| 40 | } | 48 | } |
| 41 | 49 | ||
| 42 | solver = argv[1]; | 50 | solver = argv[1]; |
| 43 | options = argv[2]; | 51 | parse_h48_solver(solver, &h, &k); |
| 44 | parse_h48_options(options, &h, &k, NULL); | ||
| 45 | expected = expected_h48[h][k]; | 52 | expected = expected_h48[h][k]; |
| 46 | 53 | ||
| 47 | nissy_setlogger(log_stderr); | 54 | nissy_setlogger(log_stderr); |
