diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2024-09-11 17:01:49 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2024-09-11 17:01:49 +0200 |
| commit | e6ff0ce6926fa921a13055c9c35d8e60b691e776 (patch) | |
| tree | 4af98713a2b43cbd229ca081d2dac877c8c36880 /src/nissy.c | |
| parent | dd6078288b5d7af4a4c0cdd1377a2976af569c9a (diff) | |
| download | nissy-core-e6ff0ce6926fa921a13055c9c35d8e60b691e776.tar.gz nissy-core-e6ff0ce6926fa921a13055c9c35d8e60b691e776.zip | |
Finished table refactor
Diffstat (limited to 'src/nissy.c')
| -rw-r--r-- | src/nissy.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/nissy.c b/src/nissy.c index de95e94..2d6af4b 100644 --- a/src/nissy.c +++ b/src/nissy.c | |||
| @@ -196,6 +196,53 @@ nissy_datasize( | |||
| 196 | } | 196 | } |
| 197 | 197 | ||
| 198 | int64_t | 198 | int64_t |
| 199 | nissy_datainfo( | ||
| 200 | const void *table, | ||
| 201 | void (*write)(const char *, ...) | ||
| 202 | ) | ||
| 203 | { | ||
| 204 | uint8_t i; | ||
| 205 | tableinfo_t info; | ||
| 206 | |||
| 207 | readtableinfo(table, &info); | ||
| 208 | |||
| 209 | write("\n---------\n\n"); | ||
| 210 | write("Table information for '%s'\n", info.solver); | ||
| 211 | write("\n"); | ||
| 212 | write("Size: %" PRIu64 " bytes\n", info.fullsize); | ||
| 213 | write("Entries: %" PRIu64 " (%" PRIu8 " bits per entry)", | ||
| 214 | info.entries, info.bits); | ||
| 215 | write("\n"); | ||
| 216 | |||
| 217 | switch (info.type) { | ||
| 218 | case TABLETYPE_PRUNING: | ||
| 219 | write("\n"); | ||
| 220 | if (info.base != 0) | ||
| 221 | write(" (base value = %" PRIu8 ")", info.base); | ||
| 222 | write(":\nValue\tPositions\n"); | ||
| 223 | for (i = 0; i <= info.maxvalue; i++) { | ||
| 224 | write("%" PRIu8 "\t%" PRIu64 "\n", | ||
| 225 | i, info.distribution[i]); | ||
| 226 | } | ||
| 227 | break; | ||
| 228 | case TABLETYPE_SPECIAL: | ||
| 229 | write("This is an ad-hoc table\n"); | ||
| 230 | break; | ||
| 231 | default: | ||
| 232 | LOG("datainfo: unknown table type\n"); | ||
| 233 | return 1; | ||
| 234 | } | ||
| 235 | |||
| 236 | if (info.next != 0) { | ||
| 237 | return nissy_datainfo((char *)table + info.next, write); | ||
| 238 | } | ||
| 239 | |||
| 240 | write("\n---------\n"); | ||
| 241 | |||
| 242 | return 0; | ||
| 243 | } | ||
| 244 | |||
| 245 | int64_t | ||
| 199 | nissy_gendata( | 246 | nissy_gendata( |
| 200 | const char *solver, | 247 | const char *solver, |
| 201 | const char *options, | 248 | const char *options, |
