aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/crunch.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/crunch.c b/src/crunch.c
index 37aa5fd..ae8c153 100644
--- a/src/crunch.c
+++ b/src/crunch.c
@@ -108,8 +108,8 @@ void dump_tokens(void) {
}
}
- printf("maxkidcount %d, maxlevel = %d, totalkidcount = %d\n", maxkidcount, maxlevel, totalkidcount);
- printf("avgkidcount: %.2f\n", ((float)totalkidcount) / (float)(nodeswithkids));
+ printf("\nmaxkidcount %d, maxlevel = %d, totalkidcount = %d\n", maxkidcount, maxlevel, totalkidcount);
+ printf("avgkidcount: %.2f\n\n--\n", ((float)totalkidcount) / (float)(nodeswithkids));
}
/*********************************************************************/
@@ -143,7 +143,14 @@ void store_token(int tok) {
int mask;
if(opt_verbose > 1) {
- printf("<%d >%d:%d #%d\n", in_pos, output_len, out_bitpos, tok);
+ printf("<%d >%d:%d #%d", in_pos, output_len, out_bitpos, tok);
+ if(tok == TOK_RESET)
+ fputs(" RESET", stdout);
+ else if(tok == TOK_END)
+ fputs(" END", stdout);
+ else if(tok < 256)
+ printf(" %s", fmt_chr(tok));
+ putchar('\n');
}
for(mask = 1 << (token_bits - 1); mask; mask >>= 1) {
@@ -249,11 +256,6 @@ the new token's index at tokens['a']['b'].
You can think of tokens[] as 256 trees, each of which has 256 branches,
which can be 0 (no node here) or the base of another 256-branch tree.
-For "abc" as the first 3 bytes of the input file, we get:
-
-tokens['a']['b'] = 258 (aka INIT_TOKEN)
-tokens['b']['c'] = 259
-
Using a static array wastes memory, but not much by modern standards,
and it avoids a time-consuming linear search of each level of the
tree to see if the current character matches an existing token. Array