aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2025-12-10 04:36:20 -0500
committerB. Watson <urchlay@slackware.uk>2025-12-10 04:36:20 -0500
commit9dacd9e8484e1f31828b597deaa6ac0b9836c652 (patch)
treef0dce899306c8ca08c479115644abd8cb443b570
parent70461919cbecff93f203f0d6fd710b184707741c (diff)
downloadalftools-9dacd9e8484e1f31828b597deaa6ac0b9836c652.tar.gz
alf: restore -vv for real.
-rw-r--r--src/crunch.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/crunch.c b/src/crunch.c
index 655e441..37aa5fd 100644
--- a/src/crunch.c
+++ b/src/crunch.c
@@ -77,7 +77,12 @@ void dump_kids(short tok, int level) {
}
}
- if(!kidcount) {
+ if(kidcount) {
+ indent(level - 1);
+ printf("#%d has %d kids\n", tok, kidcount);
+ nodeswithkids++;
+ if(kidcount > maxkidcount) maxkidcount = kidcount;
+ } else {
indent(level);
fputs("(no kids)\n", stdout);
}
@@ -85,13 +90,22 @@ void dump_kids(short tok, int level) {
/* -vv */
void dump_tokens(void) {
- int i;
+ int i, j, prune;
maxkidcount = maxlevel = totalkidcount = nodeswithkids = 0;
for(i = 0; i < 256; i++) {
- print_tok(i, i);
- dump_kids(i, 0);
+ prune = 1;
+ for(j = 0; j < 256; j++) {
+ if(tokens[i][j]) {
+ prune = 0;
+ break;
+ }
+ }
+ if(!prune) {
+ print_tok(i, i);
+ dump_kids(i, 1);
+ }
}
printf("maxkidcount %d, maxlevel = %d, totalkidcount = %d\n", maxkidcount, maxlevel, totalkidcount);
@@ -185,6 +199,8 @@ void make_token(short tok, u8 chr) {
void crunch(void) {
short tok;
+ if(opt_verbose > 1) putchar('\n');
+
init_table();
out_bitpos = 0;
in_pos = 0;