aboutsummaryrefslogtreecommitdiff
path: root/tools/tool.h
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2024-10-14 00:05:43 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2024-10-14 14:45:22 +0200
commit8a91354f7b94c669c77fe628a81f9bfe9f599ef0 (patch)
treeba29a8b0416cb3464b49fd7cfb69e7f407b892c8 /tools/tool.h
parent7dbd34574f629cacf3b89292d2a06ad0ae612f26 (diff)
downloadnissy-core-8a91354f7b94c669c77fe628a81f9bfe9f599ef0.tar.gz
nissy-core-8a91354f7b94c669c77fe628a81f9bfe9f599ef0.zip
Interface changes, progress with python
Diffstat (limited to 'tools/tool.h')
-rw-r--r--tools/tool.h25
1 files changed, 13 insertions, 12 deletions
diff --git a/tools/tool.h b/tools/tool.h
index 2fc0224..8fa726a 100644
--- a/tools/tool.h
+++ b/tools/tool.h
@@ -13,8 +13,9 @@ static void log_stderr(const char *, ...);
13static void log_stdout(const char *, ...); 13static void log_stdout(const char *, ...);
14static double timerun(void (*)(void)); 14static double timerun(void (*)(void));
15static void writetable(const char *, int64_t, const char *); 15static void writetable(const char *, int64_t, const char *);
16static int64_t generatetable(const char *, char **); 16static long long int generatetable(const char *, char **);
17static int64_t derivetable(const char *, const char *, const char *, char **); 17static long long int derivetable(
18 const char *, const char *, const char *, char **);
18static int getdata(const char *, char **, const char *); 19static int getdata(const char *, char **, const char *);
19static void gendata_run(const char *, uint64_t[static 21]); 20static void gendata_run(const char *, uint64_t[static 21]);
20static void derivedata_run( 21static void derivedata_run(
@@ -84,10 +85,10 @@ writetable(const char *buf, int64_t size, const char *filename)
84 } 85 }
85} 86}
86 87
87static int64_t 88static long long int
88generatetable(const char *solver, char **buf) 89generatetable(const char *solver, char **buf)
89{ 90{
90 int64_t size, gensize; 91 long long int size, gensize;
91 92
92 size = nissy_datasize(solver); 93 size = nissy_datasize(solver);
93 if (size == -1) { 94 if (size == -1) {
@@ -101,7 +102,7 @@ generatetable(const char *solver, char **buf)
101 if (gensize != size) { 102 if (gensize != size) {
102 printf("Error generating table"); 103 printf("Error generating table");
103 if (gensize != -1) 104 if (gensize != -1)
104 printf(" (got %" PRId64 " bytes)", gensize); 105 printf(" (got %lld bytes)", gensize);
105 printf("\n"); 106 printf("\n");
106 return -2; 107 return -2;
107 } 108 }
@@ -109,7 +110,7 @@ generatetable(const char *solver, char **buf)
109 return gensize; 110 return gensize;
110} 111}
111 112
112static int64_t 113static long long int
113derivetable( 114derivetable(
114 const char *solver_large, 115 const char *solver_large,
115 const char *solver_small, 116 const char *solver_small,
@@ -118,7 +119,7 @@ derivetable(
118) 119)
119{ 120{
120 uint8_t h, k; 121 uint8_t h, k;
121 int64_t size, gensize; 122 long long int size, gensize;
122 char *fulltable; 123 char *fulltable;
123 124
124 if (getdata(solver_large, &fulltable, filename_large) != 0) { 125 if (getdata(solver_large, &fulltable, filename_large) != 0) {
@@ -161,7 +162,7 @@ getdata(
161 char **buf, 162 char **buf,
162 const char *filename 163 const char *filename
163) { 164) {
164 int64_t size, sizeread; 165 long long int size, sizeread;
165 FILE *f; 166 FILE *f;
166 167
167 if ((f = fopen(filename, "rb")) == NULL) { 168 if ((f = fopen(filename, "rb")) == NULL) {
@@ -201,7 +202,7 @@ gendata_run(
201 const char *solver, 202 const char *solver,
202 uint64_t expected[static 21] 203 uint64_t expected[static 21]
203) { 204) {
204 int64_t size; 205 long long int size;
205 char *buf, filename[1024]; 206 char *buf, filename[1024];
206 207
207 sprintf(filename, "tables/%s", solver); 208 sprintf(filename, "tables/%s", solver);
@@ -214,7 +215,7 @@ gendata_run(
214 default: 215 default:
215 nissy_datainfo(size, buf, write_stdout); 216 nissy_datainfo(size, buf, write_stdout);
216 printf("\n"); 217 printf("\n");
217 printf("Succesfully generated %" PRId64 " bytes. " 218 printf("Succesfully generated %lld bytes. "
218 "See above for details on the tables.\n", size); 219 "See above for details on the tables.\n", size);
219 220
220 /* TODO: check that the table is correct */ 221 /* TODO: check that the table is correct */
@@ -234,7 +235,7 @@ derivedata_run(
234 const char *filename_small 235 const char *filename_small
235) 236)
236{ 237{
237 int64_t size; 238 long long int size;
238 char *buf; 239 char *buf;
239 240
240 buf = NULL; 241 buf = NULL;
@@ -247,7 +248,7 @@ derivedata_run(
247 default: 248 default:
248 nissy_datainfo(size, buf, write_stdout); 249 nissy_datainfo(size, buf, write_stdout);
249 printf("\n"); 250 printf("\n");
250 printf("Succesfully generated %" PRId64 " bytes. " 251 printf("Succesfully generated %lld bytes. "
251 "See above for details on the tables.\n", size); 252 "See above for details on the tables.\n", size);
252 253
253 writetable(buf, size, filename_small); 254 writetable(buf, size, filename_small);

Generated with cgit - Back to sebastiano.tronto.net