diff options
| author | B. Watson <urchlay@slackware.uk> | 2025-12-11 03:14:45 -0500 |
|---|---|---|
| committer | B. Watson <urchlay@slackware.uk> | 2025-12-11 03:16:31 -0500 |
| commit | ae8053232281a67ed2c7d1677c3d30b937e61d15 (patch) | |
| tree | 94210db1adb01ce0c11437318241397f3c4bc1b0 | |
| parent | c1411df1e118a5f66145a709c78d4751ee6bb346 (diff) | |
| download | alftools-ae8053232281a67ed2c7d1677c3d30b937e61d15.tar.gz | |
alf: Clean up and expand -vv output.
| -rw-r--r-- | src/crunch.c | 18 |
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 |
