src/utilfuns/zlib/maketree.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include "zutil.h"
#include "inftrees.h"
Include dependency graph for maketree.c:

Go to the source code of this file.

Defines

#define bits   word.what.Bits
#define exop   word.what.Exop

Functions

void main (void)
void maketree (uInt b, inflate_huft *t)

Define Documentation

#define bits   word.what.Bits

Definition at line 25 of file maketree.c.

#define exop   word.what.Exop

Definition at line 24 of file maketree.c.


Function Documentation

void main ( void   ) 

Definition at line 52 of file maketree.c.

00053 {
00054   int r;
00055   uInt bl, bd;
00056   inflate_huft *tl, *td;
00057   z_stream z;
00058 
00059   z.zalloc = zcalloc;
00060   z.opaque = (voidpf)0;
00061   z.zfree = zcfree;
00062   r = inflate_trees_fixed(&bl, &bd, &tl, &td, &z);
00063   if (r)
00064   {
00065     fprintf(stderr, "inflate_trees_fixed error %d\n", r);
00066     return;
00067   }
00068   puts("/* inffixed.h -- table for decoding fixed codes");
00069   puts(" * Generated automatically by the maketree.c program");
00070   puts(" */");
00071   puts("");
00072   puts("/* WARNING: this file should *not* be used by applications. It is");
00073   puts("   part of the implementation of the compression library and is");
00074   puts("   subject to change. Applications should only use zlib.h.");
00075   puts(" */");
00076   puts("");
00077   printf("local uInt fixed_bl = %d;\n", bl);
00078   printf("local uInt fixed_bd = %d;\n", bd);
00079   printf("local inflate_huft fixed_tl[] = {");
00080   maketree(bl, tl);
00081   puts("  };");
00082   printf("local inflate_huft fixed_td[] = {");
00083   maketree(bd, td);
00084   puts("  };");
00085 }

void maketree ( uInt  b,
inflate_huft t 
)

Definition at line 28 of file maketree.c.

00029 {
00030   int i, e;
00031 
00032   i = 0;
00033   while (1)
00034   {
00035     e = t[i].exop;
00036     if (e && (e & (16+64)) == 0)        /* table pointer */
00037     {
00038       fprintf(stderr, "maketree: cannot initialize sub-tables!\n");
00039       exit(1);
00040     }
00041     if (i % 4 == 0)
00042       printf("\n   ");
00043     printf(" {{{%u,%u}},%u}", t[i].exop, t[i].bits, t[i].base);
00044     if (++i == (1<<b))
00045       break;
00046     putchar(',');
00047   }
00048   puts("");
00049 }


Generated on 18 Mar 2013 for The SWORD Project by  doxygen 1.6.1