source: svn/newcon3bcm2_21bu/dst/dlib/src/ZLIB/maketree.c @ 69

Last change on this file since 69 was 69, checked in by phkim, 10 years ago

1.phkim

  1. 광주방송
  2. 변경내용
    • VBI 캡션 disabled
  • Property svn:executable set to *
File size: 2.7 KB
Line 
1/*
2 * $Id: //suprahd/releases/suprahd_163/suprahd_ztvapp640_163/drivers/graphics/ZLIB/maketree.c#1 $
3 * $Revision: #1 $
4 * $DateTime: 2006/02/24 17:51:46 $
5 * $Change: 42566 $
6 * $Author: pryush.sharma $
7 */
8
9/* maketree.c -- make inffixed.h table for decoding fixed codes
10 * Copyright (C) 1998 Mark Adler
11 * For conditions of distribution and use, see copyright notice in zlib.h
12 */
13
14/* WARNING: this file should *not* be used by applications. It is
15   part of the implementation of the compression library and is
16   subject to change. Applications should only use zlib.h.
17 */
18
19/* This program is included in the distribution for completeness.
20   You do not need to compile or run this program since inffixed.h
21   is already included in the distribution.  To use this program
22   you need to compile zlib with BUILDFIXED defined and then compile
23   and link this program with the zlib library.  Then the output of
24   this program can be piped to inffixed.h. */
25
26#include <stdio.h>
27//#include <string.h>
28#include "zutil.h"
29#include "inftrees.h"
30
31/* simplify the use of the inflate_huft type with some defines */
32#define exop word.what.Exop
33#define bits word.what.Bits
34
35/* generate initialization table for an inflate_huft structure array */
36void maketree(uInt b, inflate_huft *t)
37{
38  int i, e;
39
40  i = 0;
41  while (1)
42  {
43    e = t[i].exop;
44    if (e && (e & (16+64)) == 0)        /* table pointer */
45    {
46      fprintf(stderr, "maketree: cannot initialize sub-tables!\n");
47      exit(1);
48    }
49    if (i % 4 == 0)
50      printf("\n   ");
51    printf(" {{{%u,%u}},%u}", t[i].exop, t[i].bits, t[i].base);
52    if (++i == (1<<b))
53      break;
54    putchar(',');
55  }
56  puts("");
57}
58
59/* create the fixed tables in C initialization syntax */
60int main(void)
61{
62  int r;
63  uInt bl, bd;
64  inflate_huft *tl, *td;
65  z_stream z;
66
67  z.zalloc = zcalloc;
68  z.opaque = (voidpf)0;
69  z.zfree = zcfree;
70  r = inflate_trees_fixed(&bl, &bd, &tl, &td, &z);
71  if (r)
72  {
73    fprintf(stderr, "inflate_trees_fixed error %d\n", r);
74    return(0);
75  }
76  puts("/* inffixed.h -- table for decoding fixed codes");
77  puts(" * Generated automatically by the maketree.c program");
78  puts(" */");
79  puts("");
80  puts("/* WARNING: this file should *not* be used by applications. It is");
81  puts("   part of the implementation of the compression library and is");
82  puts("   subject to change. Applications should only use zlib.h.");
83  puts(" */");
84  puts("");
85  printf("local uInt fixed_bl = %d;\n", bl);
86  printf("local uInt fixed_bd = %d;\n", bd);
87  printf("local inflate_huft fixed_tl[] = {");
88  maketree(bl, tl);
89  puts("  };");
90  printf("local inflate_huft fixed_td[] = {");
91  maketree(bd, td);
92  puts("  };");
93  return(0);
94}
Note: See TracBrowser for help on using the repository browser.