aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/pruning.c13
-rw-r--r--src/shell.c34
-rw-r--r--src/shell.h1
-rw-r--r--src/symcoord.c4
4 files changed, 50 insertions, 2 deletions
diff --git a/src/pruning.c b/src/pruning.c
index d484a12..869110f 100644
--- a/src/pruning.c
+++ b/src/pruning.c
@@ -135,6 +135,18 @@ genptable(PruneData *pd, int nthreads)
135 return; 135 return;
136 } 136 }
137 137
138 if (nthreads < 4) {
139 fprintf(stderr,
140 "--- Warning ---\n"
141 "You are using only %d threads to generate the pruning"
142 "tables. This can take a while."
143 "Unless you did this intentionally, you should re-run"
144 "this command with `-t 4' or more.\n"
145 "---------------\n\n", nthreads
146 );
147 }
148
149
138 /* For the first steps we proceed the same way for compact and not */ 150 /* For the first steps we proceed the same way for compact and not */
139 compact = pd->compact; 151 compact = pd->compact;
140 pd->compact = false; 152 pd->compact = false;
@@ -144,6 +156,7 @@ genptable(PruneData *pd, int nthreads)
144 fprintf(stderr, "Cannot load %s, generating it with %d threads\n", 156 fprintf(stderr, "Cannot load %s, generating it with %d threads\n",
145 pd->filename, nthreads); 157 pd->filename, nthreads);
146 158
159
147 memset(pd->ptable, ~(uint8_t)0, ptablesize(pd)*sizeof(entry_group_t)); 160 memset(pd->ptable, ~(uint8_t)0, ptablesize(pd)*sizeof(entry_group_t));
148 161
149 ptable_update(pd, (Cube){0}, 0); 162 ptable_update(pd, (Cube){0}, 0);
diff --git a/src/shell.c b/src/shell.c
index 6e67e0a..31dde0e 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -3,6 +3,27 @@
3static void cleanwhitespaces(char *line); 3static void cleanwhitespaces(char *line);
4static int parseline(char *line, char **v); 4static int parseline(char *line, char **v);
5 5
6bool
7checkfiles()
8{
9 /* TODO: add more checks (other files, use checksum...) */
10 FILE *f;
11 char fname[strlen(tabledir)+100];
12 int i;
13
14 for (i = 0; allpd[i] != NULL; i++) {
15 strcpy(fname, tabledir);
16 strcpy(fname, "/");
17 strcpy(fname, allpd[i]->filename);
18 if ((f = fopen(fname, "rb")) == NULL)
19 return false;
20 else
21 fclose(f);
22 }
23
24 return true;
25}
26
6static void 27static void
7cleanwhitespaces(char *line) 28cleanwhitespaces(char *line)
8{ 29{
@@ -119,6 +140,19 @@ launch(bool batchmode)
119int 140int
120main(int argc, char *argv[]) 141main(int argc, char *argv[])
121{ 142{
143 init_env();
144
145 if (!checkfiles()) {
146 fprintf(stderr,
147 "--- Warning ---\n"
148 "Some pruning tables are missing or unreadable."
149 "You can generate them with `nissy gen -t 4'\n"
150 "Here `4' is the number of threads. Use more if your"
151 "CPU has them, or expect it to take a while.\n"
152 "---------------\n\n"
153 );
154 }
155
122 if (argc > 1) { 156 if (argc > 1) {
123 if (!strcmp(argv[1], "-b")) { 157 if (!strcmp(argv[1], "-b")) {
124 launch(true); 158 launch(true);
diff --git a/src/shell.h b/src/shell.h
index 80f86ba..7e4f785 100644
--- a/src/shell.h
+++ b/src/shell.h
@@ -7,6 +7,7 @@
7#define MAXTOKENLEN 255 7#define MAXTOKENLEN 255
8#define MAXNTOKENS 255 8#define MAXNTOKENS 255
9 9
10bool checkfiles();
10void exec_args(int c, char **v); 11void exec_args(int c, char **v);
11void launch(bool batchmode); 12void launch(bool batchmode);
12 13
diff --git a/src/symcoord.c b/src/symcoord.c
index b2099a7..4a737af 100644
--- a/src/symcoord.c
+++ b/src/symcoord.c
@@ -53,10 +53,10 @@ sd_eofbepos_16 = {
53 .trans = trans_group_udfix 53 .trans = trans_group_udfix
54}; 54};
55 55
56static int nsymdata = 2;
57static SymData * all_sd[] = { 56static SymData * all_sd[] = {
58 &sd_cp_16, 57 &sd_cp_16,
59 &sd_eofbepos_16, 58 &sd_eofbepos_16,
59 NULL
60}; 60};
61 61
62 62
@@ -403,7 +403,7 @@ init_symcoord()
403 403
404 init_coord(); 404 init_coord();
405 405
406 for (i = 0; i < nsymdata; i++) 406 for (i = 0; all_sd[i] != NULL; i++)
407 gensym(all_sd[i]); 407 gensym(all_sd[i]);
408} 408}
409 409

Generated with cgit - Back to sebastiano.tronto.net