aboutsummaryrefslogtreecommitdiffstats
path: root/doc/api-documentation/html/infutil_8h-source.html
blob: c654bf55101d4ece3ef588ba8e24dac001856c16 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>infutil.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.2.15 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; </center>
<hr><h1>infutil.h</h1><div class="fragment"><pre>00001 <font class="comment">/* infutil.h -- types and macros common to blocks and codes</font>
00002 <font class="comment"> * Copyright (C) 1995-1998 Mark Adler</font>
00003 <font class="comment"> * For conditions of distribution and use, see copyright notice in zlib.h </font>
00004 <font class="comment"> */</font>
00005 
00006 <font class="comment">/* WARNING: this file should *not* be used by applications. It is</font>
00007 <font class="comment">   part of the implementation of the compression library and is</font>
00008 <font class="comment">   subject to change. Applications should only use zlib.h.</font>
00009 <font class="comment"> */</font>
00010 
00011 <font class="preprocessor">#ifndef _INFUTIL_H</font>
00012 <font class="preprocessor"></font><font class="preprocessor">#define _INFUTIL_H</font>
00013 <font class="preprocessor"></font>
00014 <font class="keyword">typedef</font> <font class="keyword">enum</font> {
00015       TYPE,     <font class="comment">/* get type bits (3, including end bit) */</font>
00016       LENS,     <font class="comment">/* get lengths for stored */</font>
00017       STORED,   <font class="comment">/* processing stored block */</font>
00018       TABLE,    <font class="comment">/* get table lengths */</font>
00019       BTREE,    <font class="comment">/* get bit lengths tree for a dynamic block */</font>
00020       DTREE,    <font class="comment">/* get length, distance trees for a dynamic block */</font>
00021       CODES,    <font class="comment">/* processing fixed or dynamic block */</font>
00022       DRY,      <font class="comment">/* output remaining window bytes */</font>
00023       DONE,     <font class="comment">/* finished last block, done */</font>
00024       BAD}      <font class="comment">/* got a data error--stuck here */</font>
00025 inflate_block_mode;
00026 
00027 <font class="comment">/* inflate blocks semi-private state */</font>
00028 <font class="keyword">struct </font>inflate_blocks_state {
00029 
00030   <font class="comment">/* mode */</font>
00031   inflate_block_mode  mode;     <font class="comment">/* current inflate_block mode */</font>
00032 
00033   <font class="comment">/* mode dependent information */</font>
00034   <font class="keyword">union </font>{
00035     uInt left;          <font class="comment">/* if STORED, bytes left to copy */</font>
00036     <font class="keyword">struct </font>{
00037       uInt table;               <font class="comment">/* table lengths (14 bits) */</font>
00038       uInt index;               <font class="comment">/* index into blens (or border) */</font>
00039       uIntf *blens;             <font class="comment">/* bit lengths of codes */</font>
00040       uInt bb;                  <font class="comment">/* bit length tree depth */</font>
00041       inflate_huft *tb;         <font class="comment">/* bit length decoding tree */</font>
00042     } trees;            <font class="comment">/* if DTREE, decoding info for trees */</font>
00043     <font class="keyword">struct </font>{
00044       inflate_codes_statef 
00045          *codes;
00046     } decode;           <font class="comment">/* if CODES, current state */</font>
00047   } sub;                <font class="comment">/* submode */</font>
00048   uInt last;            <font class="comment">/* true if this block is the last block */</font>
00049 
00050   <font class="comment">/* mode independent information */</font>
00051   uInt bitk;            <font class="comment">/* bits in bit buffer */</font>
00052   uLong bitb;           <font class="comment">/* bit buffer */</font>
00053   inflate_huft *hufts;  <font class="comment">/* single malloc for tree space */</font>
00054   Bytef *window;        <font class="comment">/* sliding window */</font>
00055   Bytef *end;           <font class="comment">/* one byte after sliding window */</font>
00056   Bytef *read;          <font class="comment">/* window read pointer */</font>
00057   Bytef *write;         <font class="comment">/* window write pointer */</font>
00058   check_func checkfn;   <font class="comment">/* check function */</font>
00059   uLong check;          <font class="comment">/* check on output */</font>
00060 
00061 };
00062 
00063 
00064 <font class="comment">/* defines for inflate input/output */</font>
00065 <font class="comment">/*   update pointers and return */</font>
00066 <font class="preprocessor">#define UPDBITS {s-&gt;bitb=b;s-&gt;bitk=k;}</font>
00067 <font class="preprocessor"></font><font class="preprocessor">#define UPDIN {z-&gt;avail_in=n;z-&gt;total_in+=p-z-&gt;next_in;z-&gt;next_in=p;}</font>
00068 <font class="preprocessor"></font><font class="preprocessor">#define UPDOUT {s-&gt;write=q;}</font>
00069 <font class="preprocessor"></font><font class="preprocessor">#define UPDATE {UPDBITS UPDIN UPDOUT}</font>
00070 <font class="preprocessor"></font><font class="preprocessor">#define LEAVE {UPDATE return inflate_flush(s,z,r);}</font>
00071 <font class="preprocessor"></font><font class="comment">/*   get bytes and bits */</font>
00072 <font class="preprocessor">#define LOADIN {p=z-&gt;next_in;n=z-&gt;avail_in;b=s-&gt;bitb;k=s-&gt;bitk;}</font>
00073 <font class="preprocessor"></font><font class="preprocessor">#define NEEDBYTE {if(n)r=Z_OK;else LEAVE}</font>
00074 <font class="preprocessor"></font><font class="preprocessor">#define NEXTBYTE (n--,*p++)</font>
00075 <font class="preprocessor"></font><font class="preprocessor">#define NEEDBITS(j) {while(k&lt;(j)){NEEDBYTE;b|=((uLong)NEXTBYTE)&lt;&lt;k;k+=8;}}</font>
00076 <font class="preprocessor"></font><font class="preprocessor">#define DUMPBITS(j) {b&gt;&gt;=(j);k-=(j);}</font>
00077 <font class="preprocessor"></font><font class="comment">/*   output bytes */</font>
00078 <font class="preprocessor">#define WAVAIL (uInt)(q&lt;s-&gt;read?s-&gt;read-q-1:s-&gt;end-q)</font>
00079 <font class="preprocessor"></font><font class="preprocessor">#define LOADOUT {q=s-&gt;write;m=(uInt)WAVAIL;}</font>
00080 <font class="preprocessor"></font><font class="preprocessor">#define WRAP {if(q==s-&gt;end&amp;&amp;s-&gt;read!=s-&gt;window){q=s-&gt;window;m=(uInt)WAVAIL;}}</font>
00081 <font class="preprocessor"></font><font class="preprocessor">#define FLUSH {UPDOUT r=inflate_flush(s,z,r); LOADOUT}</font>
00082 <font class="preprocessor"></font><font class="preprocessor">#define NEEDOUT {if(m==0){WRAP if(m==0){FLUSH WRAP if(m==0) LEAVE}}r=Z_OK;}</font>
00083 <font class="preprocessor"></font><font class="preprocessor">#define OUTBYTE(a) {*q++=(Byte)(a);m--;}</font>
00084 <font class="preprocessor"></font><font class="comment">/*   load local pointers */</font>
00085 <font class="preprocessor">#define LOAD {LOADIN LOADOUT}</font>
00086 <font class="preprocessor"></font>
00087 <font class="comment">/* masks for lower bits (size given to avoid silly warnings with Visual C++) */</font>
00088 <font class="keyword">extern</font> uInt inflate_mask[17];
00089 
00090 <font class="comment">/* copy as much as possible from the sliding window to the output area */</font>
00091 <font class="keyword">extern</font> <font class="keywordtype">int</font> inflate_flush OF((
00092     inflate_blocks_statef *,
00093     z_streamp ,
00094     <font class="keywordtype">int</font>));
00095 
00096 <font class="keyword">struct </font>internal_state      {<font class="keywordtype">int</font> dummy;}; <font class="comment">/* for buggy compilers */</font>
00097 
00098 <font class="preprocessor">#endif</font>
</pre></div><hr><address align="right"><small>Generated on Thu Jun 20 22:12:59 2002 for The Sword Project by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 
width=110 height=53></a>1.2.15 </small></address>
</body>
</html>