diff options
Diffstat (limited to 'maketree.c')
-rw-r--r-- | maketree.c | 38 |
1 files changed, 2 insertions, 36 deletions
@@ -24,36 +24,6 @@ | |||
24 | #define exop word.what.Exop | 24 | #define exop word.what.Exop |
25 | #define bits word.what.Bits | 25 | #define bits word.what.Bits |
26 | 26 | ||
27 | /* showtree is only used for debugging purposes */ | ||
28 | void showtree(uInt b, inflate_huft *t, int d) | ||
29 | { | ||
30 | int i, e; | ||
31 | char p[2*d+1]; | ||
32 | |||
33 | for (i = 0; i < 2*d; i++) | ||
34 | p[i] = ' '; | ||
35 | p[i] = 0; | ||
36 | printf("%s[%d]\n", p, 1<<b); | ||
37 | for (i = 0; i < (1<<b); i++) | ||
38 | { | ||
39 | e = t[i].exop; | ||
40 | if (e == 0) /* simple code */ | ||
41 | printf("%s%d(%d): literal=%d\n", p, i, t[i].bits, t[i].base); | ||
42 | else if (e & 16) /* length */ | ||
43 | printf("%s%d(%d): length/distance=%d+(%d)\n", | ||
44 | p, i, t[i].bits, t[i].base, e & 15); | ||
45 | else if ((e & 64) == 0) /* next table */ | ||
46 | { | ||
47 | printf("%s%d(%d): *sub table*\n", p, i, t[i].bits); | ||
48 | showtree(e, t + t[i].base, d + 1); | ||
49 | } | ||
50 | else if (e & 32) /* end of block */ | ||
51 | printf("%s%d(%d): end of block\n", p, i, t[i].bits); | ||
52 | else /* bad code */ | ||
53 | printf("%s%d: bad code\n", p, i); | ||
54 | } | ||
55 | } | ||
56 | |||
57 | /* generate initialization table for an inflate_huft structure array */ | 27 | /* generate initialization table for an inflate_huft structure array */ |
58 | void maketree(uInt b, inflate_huft *t) | 28 | void maketree(uInt b, inflate_huft *t) |
59 | { | 29 | { |
@@ -68,9 +38,9 @@ void maketree(uInt b, inflate_huft *t) | |||
68 | fprintf(stderr, "maketree: cannot initialize sub-tables!\n"); | 38 | fprintf(stderr, "maketree: cannot initialize sub-tables!\n"); |
69 | exit(1); | 39 | exit(1); |
70 | } | 40 | } |
71 | if (i % 5 == 0) | 41 | if (i % 4 == 0) |
72 | printf("\n "); | 42 | printf("\n "); |
73 | printf(" {{%u,%u},%u}", t[i].exop, t[i].bits, t[i].base); | 43 | printf(" {{{%u,%u}},%u}", t[i].exop, t[i].bits, t[i].base); |
74 | if (++i == (1<<b)) | 44 | if (++i == (1<<b)) |
75 | break; | 45 | break; |
76 | putchar(','); | 46 | putchar(','); |
@@ -95,10 +65,6 @@ void main(void) | |||
95 | fprintf(stderr, "inflate_trees_fixed error %d\n", r); | 65 | fprintf(stderr, "inflate_trees_fixed error %d\n", r); |
96 | return; | 66 | return; |
97 | } | 67 | } |
98 | /* puts("Literal/Length Tree:"); | ||
99 | showtree(bl, tl, 1); | ||
100 | puts("Distance Tree:"); | ||
101 | showtree(bd, td, 1); */ | ||
102 | puts("/* inffixed.h -- table for decoding fixed codes"); | 68 | puts("/* inffixed.h -- table for decoding fixed codes"); |
103 | puts(" * Generated automatically by the maketree.c program"); | 69 | puts(" * Generated automatically by the maketree.c program"); |
104 | puts(" */"); | 70 | puts(" */"); |