]> git.saurik.com Git - wxWidgets.git/blame - src/zlib/maketree.c
Use the size value passed to the ctor to set the window's minimum size.
[wxWidgets.git] / src / zlib / maketree.c
CommitLineData
c801d85f 1/* maketree.c -- make inffixed.h table for decoding fixed codes
a4019ec2 2 * Copyright (C) 1995-2002 Mark Adler
c801d85f
KB
3 * For conditions of distribution and use, see copyright notice in zlib.h
4 */
5
6/* WARNING: this file should *not* be used by applications. It is
7 part of the implementation of the compression library and is
8 subject to change. Applications should only use zlib.h.
9 */
10
11/* This program is included in the distribution for completeness.
12 You do not need to compile or run this program since inffixed.h
13 is already included in the distribution. To use this program
14 you need to compile zlib with BUILDFIXED defined and then compile
15 and link this program with the zlib library. Then the output of
16 this program can be piped to inffixed.h. */
17
18#include <stdio.h>
19#include <stdlib.h>
20#include "zutil.h"
21#include "inftrees.h"
22
23/* simplify the use of the inflate_huft type with some defines */
24#define exop word.what.Exop
25#define bits word.what.Bits
26
c801d85f
KB
27/* generate initialization table for an inflate_huft structure array */
28void maketree(uInt b, inflate_huft *t)
29{
30 int i, e;
31
32 i = 0;
33 while (1)
34 {
35 e = t[i].exop;
36 if (e && (e & (16+64)) == 0) /* table pointer */
37 {
38 fprintf(stderr, "maketree: cannot initialize sub-tables!\n");
39 exit(1);
40 }
a4019ec2 41 if (i % 4 == 0)
c801d85f 42 printf("\n ");
a4019ec2 43 printf(" {{{%u,%u}},%u}", t[i].exop, t[i].bits, t[i].base);
c801d85f
KB
44 if (++i == (1<<b))
45 break;
46 putchar(',');
47 }
48 puts("");
49}
50
51/* create the fixed tables in C initialization syntax */
52void main(void)
53{
54 int r;
55 uInt bl, bd;
56 inflate_huft *tl, *td;
57 z_stream z;
58
59 z.zalloc = zcalloc;
60 z.opaque = (voidpf)0;
61 z.zfree = zcfree;
62 r = inflate_trees_fixed(&bl, &bd, &tl, &td, &z);
63 if (r)
64 {
65 fprintf(stderr, "inflate_trees_fixed error %d\n", r);
66 return;
67 }
c801d85f
KB
68 puts("/* inffixed.h -- table for decoding fixed codes");
69 puts(" * Generated automatically by the maketree.c program");
70 puts(" */");
71 puts("");
72 puts("/* WARNING: this file should *not* be used by applications. It is");
73 puts(" part of the implementation of the compression library and is");
74 puts(" subject to change. Applications should only use zlib.h.");
75 puts(" */");
76 puts("");
77 printf("local uInt fixed_bl = %d;\n", bl);
78 printf("local uInt fixed_bd = %d;\n", bd);
79 printf("local inflate_huft fixed_tl[] = {");
80 maketree(bl, tl);
81 puts(" };");
82 printf("local inflate_huft fixed_td[] = {");
83 maketree(bd, td);
84 puts(" };");
85}