xref: /minix3/common/dist/zlib/contrib/ada/zlib-thin.ads (revision 44bedb31d842b4b0444105519bcf929a69fe2dc1)
1*44bedb31SLionel Sambuc----------------------------------------------------------------
2*44bedb31SLionel Sambuc--  ZLib for Ada thick binding.                               --
3*44bedb31SLionel Sambuc--                                                            --
4*44bedb31SLionel Sambuc--  Copyright (C) 2002-2003 Dmitriy Anisimkov                 --
5*44bedb31SLionel Sambuc--                                                            --
6*44bedb31SLionel Sambuc--  Open source license information is in the zlib.ads file.  --
7*44bedb31SLionel Sambuc----------------------------------------------------------------
8*44bedb31SLionel Sambuc
9*44bedb31SLionel Sambuc--  Id: zlib-thin.ads,v 1.11 2004/07/23 06:33:11 vagul Exp
10*44bedb31SLionel Sambuc
11*44bedb31SLionel Sambucwith Interfaces.C.Strings;
12*44bedb31SLionel Sambuc
13*44bedb31SLionel Sambucwith System;
14*44bedb31SLionel Sambuc
15*44bedb31SLionel Sambucprivate package ZLib.Thin is
16*44bedb31SLionel Sambuc
17*44bedb31SLionel Sambuc   --  From zconf.h
18*44bedb31SLionel Sambuc
19*44bedb31SLionel Sambuc   MAX_MEM_LEVEL : constant := 9;         --  zconf.h:105
20*44bedb31SLionel Sambuc                                          --  zconf.h:105
21*44bedb31SLionel Sambuc   MAX_WBITS : constant := 15;      --  zconf.h:115
22*44bedb31SLionel Sambuc                                    --  32K LZ77 window
23*44bedb31SLionel Sambuc                                    --  zconf.h:115
24*44bedb31SLionel Sambuc   SEEK_SET : constant := 8#0000#;  --  zconf.h:244
25*44bedb31SLionel Sambuc                                    --  Seek from beginning of file.
26*44bedb31SLionel Sambuc                                    --  zconf.h:244
27*44bedb31SLionel Sambuc   SEEK_CUR : constant := 1;        --  zconf.h:245
28*44bedb31SLionel Sambuc                                    --  Seek from current position.
29*44bedb31SLionel Sambuc                                    --  zconf.h:245
30*44bedb31SLionel Sambuc   SEEK_END : constant := 2;        --  zconf.h:246
31*44bedb31SLionel Sambuc                                    --  Set file pointer to EOF plus "offset"
32*44bedb31SLionel Sambuc                                    --  zconf.h:246
33*44bedb31SLionel Sambuc
34*44bedb31SLionel Sambuc   type Byte is new Interfaces.C.unsigned_char; --  8 bits
35*44bedb31SLionel Sambuc                                                --  zconf.h:214
36*44bedb31SLionel Sambuc   type UInt is new Interfaces.C.unsigned;      --  16 bits or more
37*44bedb31SLionel Sambuc                                                --  zconf.h:216
38*44bedb31SLionel Sambuc   type Int is new Interfaces.C.int;
39*44bedb31SLionel Sambuc
40*44bedb31SLionel Sambuc   type ULong is new Interfaces.C.unsigned_long;     --  32 bits or more
41*44bedb31SLionel Sambuc                                                     --  zconf.h:217
42*44bedb31SLionel Sambuc   subtype Chars_Ptr is Interfaces.C.Strings.chars_ptr;
43*44bedb31SLionel Sambuc
44*44bedb31SLionel Sambuc   type ULong_Access is access ULong;
45*44bedb31SLionel Sambuc   type Int_Access is access Int;
46*44bedb31SLionel Sambuc
47*44bedb31SLionel Sambuc   subtype Voidp is System.Address;            --  zconf.h:232
48*44bedb31SLionel Sambuc
49*44bedb31SLionel Sambuc   subtype Byte_Access is Voidp;
50*44bedb31SLionel Sambuc
51*44bedb31SLionel Sambuc   Nul : constant Voidp := System.Null_Address;
52*44bedb31SLionel Sambuc   --  end from zconf
53*44bedb31SLionel Sambuc
54*44bedb31SLionel Sambuc   Z_NO_FLUSH : constant := 8#0000#;   --  zlib.h:125
55*44bedb31SLionel Sambuc                                       --  zlib.h:125
56*44bedb31SLionel Sambuc   Z_PARTIAL_FLUSH : constant := 1;       --  zlib.h:126
57*44bedb31SLionel Sambuc                                          --  will be removed, use
58*44bedb31SLionel Sambuc                                          --  Z_SYNC_FLUSH instead
59*44bedb31SLionel Sambuc                                          --  zlib.h:126
60*44bedb31SLionel Sambuc   Z_SYNC_FLUSH : constant := 2;       --  zlib.h:127
61*44bedb31SLionel Sambuc                                       --  zlib.h:127
62*44bedb31SLionel Sambuc   Z_FULL_FLUSH : constant := 3;       --  zlib.h:128
63*44bedb31SLionel Sambuc                                       --  zlib.h:128
64*44bedb31SLionel Sambuc   Z_FINISH : constant := 4;        --  zlib.h:129
65*44bedb31SLionel Sambuc                                    --  zlib.h:129
66*44bedb31SLionel Sambuc   Z_OK : constant := 8#0000#;   --  zlib.h:132
67*44bedb31SLionel Sambuc                                 --  zlib.h:132
68*44bedb31SLionel Sambuc   Z_STREAM_END : constant := 1;       --  zlib.h:133
69*44bedb31SLionel Sambuc                                       --  zlib.h:133
70*44bedb31SLionel Sambuc   Z_NEED_DICT : constant := 2;        --  zlib.h:134
71*44bedb31SLionel Sambuc                                       --  zlib.h:134
72*44bedb31SLionel Sambuc   Z_ERRNO : constant := -1;        --  zlib.h:135
73*44bedb31SLionel Sambuc                                    --  zlib.h:135
74*44bedb31SLionel Sambuc   Z_STREAM_ERROR : constant := -2;       --  zlib.h:136
75*44bedb31SLionel Sambuc                                          --  zlib.h:136
76*44bedb31SLionel Sambuc   Z_DATA_ERROR : constant := -3;      --  zlib.h:137
77*44bedb31SLionel Sambuc                                       --  zlib.h:137
78*44bedb31SLionel Sambuc   Z_MEM_ERROR : constant := -4;       --  zlib.h:138
79*44bedb31SLionel Sambuc                                       --  zlib.h:138
80*44bedb31SLionel Sambuc   Z_BUF_ERROR : constant := -5;       --  zlib.h:139
81*44bedb31SLionel Sambuc                                       --  zlib.h:139
82*44bedb31SLionel Sambuc   Z_VERSION_ERROR : constant := -6;      --  zlib.h:140
83*44bedb31SLionel Sambuc                                          --  zlib.h:140
84*44bedb31SLionel Sambuc   Z_NO_COMPRESSION : constant := 8#0000#;   --  zlib.h:145
85*44bedb31SLionel Sambuc                                             --  zlib.h:145
86*44bedb31SLionel Sambuc   Z_BEST_SPEED : constant := 1;       --  zlib.h:146
87*44bedb31SLionel Sambuc                                       --  zlib.h:146
88*44bedb31SLionel Sambuc   Z_BEST_COMPRESSION : constant := 9;       --  zlib.h:147
89*44bedb31SLionel Sambuc                                             --  zlib.h:147
90*44bedb31SLionel Sambuc   Z_DEFAULT_COMPRESSION : constant := -1;      --  zlib.h:148
91*44bedb31SLionel Sambuc                                                --  zlib.h:148
92*44bedb31SLionel Sambuc   Z_FILTERED : constant := 1;      --  zlib.h:151
93*44bedb31SLionel Sambuc                                    --  zlib.h:151
94*44bedb31SLionel Sambuc   Z_HUFFMAN_ONLY : constant := 2;        --  zlib.h:152
95*44bedb31SLionel Sambuc                                          --  zlib.h:152
96*44bedb31SLionel Sambuc   Z_DEFAULT_STRATEGY : constant := 8#0000#; --  zlib.h:153
97*44bedb31SLionel Sambuc                                             --  zlib.h:153
98*44bedb31SLionel Sambuc   Z_BINARY : constant := 8#0000#;  --  zlib.h:156
99*44bedb31SLionel Sambuc                                    --  zlib.h:156
100*44bedb31SLionel Sambuc   Z_ASCII : constant := 1;      --  zlib.h:157
101*44bedb31SLionel Sambuc                                 --  zlib.h:157
102*44bedb31SLionel Sambuc   Z_UNKNOWN : constant := 2;       --  zlib.h:158
103*44bedb31SLionel Sambuc                                    --  zlib.h:158
104*44bedb31SLionel Sambuc   Z_DEFLATED : constant := 8;      --  zlib.h:161
105*44bedb31SLionel Sambuc                                    --  zlib.h:161
106*44bedb31SLionel Sambuc   Z_NULL : constant := 8#0000#; --  zlib.h:164
107*44bedb31SLionel Sambuc                                 --  for initializing zalloc, zfree, opaque
108*44bedb31SLionel Sambuc                                 --  zlib.h:164
109*44bedb31SLionel Sambuc   type gzFile is new Voidp;                  --  zlib.h:646
110*44bedb31SLionel Sambuc
111*44bedb31SLionel Sambuc   type Z_Stream is private;
112*44bedb31SLionel Sambuc
113*44bedb31SLionel Sambuc   type Z_Streamp is access all Z_Stream;     --  zlib.h:89
114*44bedb31SLionel Sambuc
115*44bedb31SLionel Sambuc   type alloc_func is access function
116*44bedb31SLionel Sambuc     (Opaque : Voidp;
117*44bedb31SLionel Sambuc      Items  : UInt;
118*44bedb31SLionel Sambuc      Size   : UInt)
119*44bedb31SLionel Sambuc      return Voidp; --  zlib.h:63
120*44bedb31SLionel Sambuc
121*44bedb31SLionel Sambuc   type free_func is access procedure (opaque : Voidp; address : Voidp);
122*44bedb31SLionel Sambuc
123*44bedb31SLionel Sambuc   function zlibVersion return Chars_Ptr;
124*44bedb31SLionel Sambuc
125*44bedb31SLionel Sambuc   function Deflate (strm : Z_Streamp; flush : Int) return Int;
126*44bedb31SLionel Sambuc
127*44bedb31SLionel Sambuc   function DeflateEnd (strm : Z_Streamp) return Int;
128*44bedb31SLionel Sambuc
129*44bedb31SLionel Sambuc   function Inflate (strm : Z_Streamp; flush : Int) return Int;
130*44bedb31SLionel Sambuc
131*44bedb31SLionel Sambuc   function InflateEnd (strm : Z_Streamp) return Int;
132*44bedb31SLionel Sambuc
133*44bedb31SLionel Sambuc   function deflateSetDictionary
134*44bedb31SLionel Sambuc     (strm       : Z_Streamp;
135*44bedb31SLionel Sambuc      dictionary : Byte_Access;
136*44bedb31SLionel Sambuc      dictLength : UInt)
137*44bedb31SLionel Sambuc      return       Int;
138*44bedb31SLionel Sambuc
139*44bedb31SLionel Sambuc   function deflateCopy (dest : Z_Streamp; source : Z_Streamp) return Int;
140*44bedb31SLionel Sambuc   --  zlib.h:478
141*44bedb31SLionel Sambuc
142*44bedb31SLionel Sambuc   function deflateReset (strm : Z_Streamp) return Int; -- zlib.h:495
143*44bedb31SLionel Sambuc
144*44bedb31SLionel Sambuc   function deflateParams
145*44bedb31SLionel Sambuc     (strm     : Z_Streamp;
146*44bedb31SLionel Sambuc      level    : Int;
147*44bedb31SLionel Sambuc      strategy : Int)
148*44bedb31SLionel Sambuc      return     Int;       -- zlib.h:506
149*44bedb31SLionel Sambuc
150*44bedb31SLionel Sambuc   function inflateSetDictionary
151*44bedb31SLionel Sambuc     (strm       : Z_Streamp;
152*44bedb31SLionel Sambuc      dictionary : Byte_Access;
153*44bedb31SLionel Sambuc      dictLength : UInt)
154*44bedb31SLionel Sambuc      return       Int; --  zlib.h:548
155*44bedb31SLionel Sambuc
156*44bedb31SLionel Sambuc   function inflateSync (strm : Z_Streamp) return Int;  --  zlib.h:565
157*44bedb31SLionel Sambuc
158*44bedb31SLionel Sambuc   function inflateReset (strm : Z_Streamp) return Int; --  zlib.h:580
159*44bedb31SLionel Sambuc
160*44bedb31SLionel Sambuc   function compress
161*44bedb31SLionel Sambuc     (dest      : Byte_Access;
162*44bedb31SLionel Sambuc      destLen   : ULong_Access;
163*44bedb31SLionel Sambuc      source    : Byte_Access;
164*44bedb31SLionel Sambuc      sourceLen : ULong)
165*44bedb31SLionel Sambuc      return      Int;           -- zlib.h:601
166*44bedb31SLionel Sambuc
167*44bedb31SLionel Sambuc   function compress2
168*44bedb31SLionel Sambuc     (dest      : Byte_Access;
169*44bedb31SLionel Sambuc      destLen   : ULong_Access;
170*44bedb31SLionel Sambuc      source    : Byte_Access;
171*44bedb31SLionel Sambuc      sourceLen : ULong;
172*44bedb31SLionel Sambuc      level     : Int)
173*44bedb31SLionel Sambuc      return      Int;          -- zlib.h:615
174*44bedb31SLionel Sambuc
175*44bedb31SLionel Sambuc   function uncompress
176*44bedb31SLionel Sambuc     (dest      : Byte_Access;
177*44bedb31SLionel Sambuc      destLen   : ULong_Access;
178*44bedb31SLionel Sambuc      source    : Byte_Access;
179*44bedb31SLionel Sambuc      sourceLen : ULong)
180*44bedb31SLionel Sambuc      return      Int;
181*44bedb31SLionel Sambuc
182*44bedb31SLionel Sambuc   function gzopen (path : Chars_Ptr; mode : Chars_Ptr) return gzFile;
183*44bedb31SLionel Sambuc
184*44bedb31SLionel Sambuc   function gzdopen (fd : Int; mode : Chars_Ptr) return gzFile;
185*44bedb31SLionel Sambuc
186*44bedb31SLionel Sambuc   function gzsetparams
187*44bedb31SLionel Sambuc     (file     : gzFile;
188*44bedb31SLionel Sambuc      level    : Int;
189*44bedb31SLionel Sambuc      strategy : Int)
190*44bedb31SLionel Sambuc      return     Int;
191*44bedb31SLionel Sambuc
192*44bedb31SLionel Sambuc   function gzread
193*44bedb31SLionel Sambuc     (file : gzFile;
194*44bedb31SLionel Sambuc      buf  : Voidp;
195*44bedb31SLionel Sambuc      len  : UInt)
196*44bedb31SLionel Sambuc      return Int;
197*44bedb31SLionel Sambuc
198*44bedb31SLionel Sambuc   function gzwrite
199*44bedb31SLionel Sambuc     (file : in gzFile;
200*44bedb31SLionel Sambuc      buf  : in Voidp;
201*44bedb31SLionel Sambuc      len  : in UInt)
202*44bedb31SLionel Sambuc      return Int;
203*44bedb31SLionel Sambuc
204*44bedb31SLionel Sambuc   function gzprintf (file : in gzFile; format : in Chars_Ptr) return Int;
205*44bedb31SLionel Sambuc
206*44bedb31SLionel Sambuc   function gzputs (file : in gzFile; s : in Chars_Ptr) return Int;
207*44bedb31SLionel Sambuc
208*44bedb31SLionel Sambuc   function gzgets
209*44bedb31SLionel Sambuc     (file : gzFile;
210*44bedb31SLionel Sambuc      buf  : Chars_Ptr;
211*44bedb31SLionel Sambuc      len  : Int)
212*44bedb31SLionel Sambuc      return Chars_Ptr;
213*44bedb31SLionel Sambuc
214*44bedb31SLionel Sambuc   function gzputc (file : gzFile; char : Int) return Int;
215*44bedb31SLionel Sambuc
216*44bedb31SLionel Sambuc   function gzgetc (file : gzFile) return Int;
217*44bedb31SLionel Sambuc
218*44bedb31SLionel Sambuc   function gzflush (file : gzFile; flush : Int) return Int;
219*44bedb31SLionel Sambuc
220*44bedb31SLionel Sambuc   function gzseek
221*44bedb31SLionel Sambuc     (file   : gzFile;
222*44bedb31SLionel Sambuc      offset : Int;
223*44bedb31SLionel Sambuc      whence : Int)
224*44bedb31SLionel Sambuc      return   Int;
225*44bedb31SLionel Sambuc
226*44bedb31SLionel Sambuc   function gzrewind (file : gzFile) return Int;
227*44bedb31SLionel Sambuc
228*44bedb31SLionel Sambuc   function gztell (file : gzFile) return Int;
229*44bedb31SLionel Sambuc
230*44bedb31SLionel Sambuc   function gzeof (file : gzFile) return Int;
231*44bedb31SLionel Sambuc
232*44bedb31SLionel Sambuc   function gzclose (file : gzFile) return Int;
233*44bedb31SLionel Sambuc
234*44bedb31SLionel Sambuc   function gzerror (file : gzFile; errnum : Int_Access) return Chars_Ptr;
235*44bedb31SLionel Sambuc
236*44bedb31SLionel Sambuc   function adler32
237*44bedb31SLionel Sambuc     (adler : ULong;
238*44bedb31SLionel Sambuc      buf   : Byte_Access;
239*44bedb31SLionel Sambuc      len   : UInt)
240*44bedb31SLionel Sambuc      return  ULong;
241*44bedb31SLionel Sambuc
242*44bedb31SLionel Sambuc   function crc32
243*44bedb31SLionel Sambuc     (crc  : ULong;
244*44bedb31SLionel Sambuc      buf  : Byte_Access;
245*44bedb31SLionel Sambuc      len  : UInt)
246*44bedb31SLionel Sambuc      return ULong;
247*44bedb31SLionel Sambuc
248*44bedb31SLionel Sambuc   function deflateInit
249*44bedb31SLionel Sambuc     (strm        : Z_Streamp;
250*44bedb31SLionel Sambuc      level       : Int;
251*44bedb31SLionel Sambuc      version     : Chars_Ptr;
252*44bedb31SLionel Sambuc      stream_size : Int)
253*44bedb31SLionel Sambuc      return        Int;
254*44bedb31SLionel Sambuc
255*44bedb31SLionel Sambuc   function deflateInit2
256*44bedb31SLionel Sambuc     (strm        : Z_Streamp;
257*44bedb31SLionel Sambuc      level       : Int;
258*44bedb31SLionel Sambuc      method      : Int;
259*44bedb31SLionel Sambuc      windowBits  : Int;
260*44bedb31SLionel Sambuc      memLevel    : Int;
261*44bedb31SLionel Sambuc      strategy    : Int;
262*44bedb31SLionel Sambuc      version     : Chars_Ptr;
263*44bedb31SLionel Sambuc      stream_size : Int)
264*44bedb31SLionel Sambuc      return        Int;
265*44bedb31SLionel Sambuc
266*44bedb31SLionel Sambuc   function Deflate_Init
267*44bedb31SLionel Sambuc     (strm       : Z_Streamp;
268*44bedb31SLionel Sambuc      level      : Int;
269*44bedb31SLionel Sambuc      method     : Int;
270*44bedb31SLionel Sambuc      windowBits : Int;
271*44bedb31SLionel Sambuc      memLevel   : Int;
272*44bedb31SLionel Sambuc      strategy   : Int)
273*44bedb31SLionel Sambuc      return       Int;
274*44bedb31SLionel Sambuc   pragma Inline (Deflate_Init);
275*44bedb31SLionel Sambuc
276*44bedb31SLionel Sambuc   function inflateInit
277*44bedb31SLionel Sambuc     (strm        : Z_Streamp;
278*44bedb31SLionel Sambuc      version     : Chars_Ptr;
279*44bedb31SLionel Sambuc      stream_size : Int)
280*44bedb31SLionel Sambuc      return        Int;
281*44bedb31SLionel Sambuc
282*44bedb31SLionel Sambuc   function inflateInit2
283*44bedb31SLionel Sambuc     (strm        : in Z_Streamp;
284*44bedb31SLionel Sambuc      windowBits  : in Int;
285*44bedb31SLionel Sambuc      version     : in Chars_Ptr;
286*44bedb31SLionel Sambuc      stream_size : in Int)
287*44bedb31SLionel Sambuc      return      Int;
288*44bedb31SLionel Sambuc
289*44bedb31SLionel Sambuc   function inflateBackInit
290*44bedb31SLionel Sambuc     (strm        : in Z_Streamp;
291*44bedb31SLionel Sambuc      windowBits  : in Int;
292*44bedb31SLionel Sambuc      window      : in Byte_Access;
293*44bedb31SLionel Sambuc      version     : in Chars_Ptr;
294*44bedb31SLionel Sambuc      stream_size : in Int)
295*44bedb31SLionel Sambuc      return      Int;
296*44bedb31SLionel Sambuc   --  Size of window have to be 2**windowBits.
297*44bedb31SLionel Sambuc
298*44bedb31SLionel Sambuc   function Inflate_Init (strm : Z_Streamp; windowBits : Int) return Int;
299*44bedb31SLionel Sambuc   pragma Inline (Inflate_Init);
300*44bedb31SLionel Sambuc
301*44bedb31SLionel Sambuc   function zError (err : Int) return Chars_Ptr;
302*44bedb31SLionel Sambuc
303*44bedb31SLionel Sambuc   function inflateSyncPoint (z : Z_Streamp) return Int;
304*44bedb31SLionel Sambuc
305*44bedb31SLionel Sambuc   function get_crc_table return ULong_Access;
306*44bedb31SLionel Sambuc
307*44bedb31SLionel Sambuc   --  Interface to the available fields of the z_stream structure.
308*44bedb31SLionel Sambuc   --  The application must update next_in and avail_in when avail_in has
309*44bedb31SLionel Sambuc   --  dropped to zero. It must update next_out and avail_out when avail_out
310*44bedb31SLionel Sambuc   --  has dropped to zero. The application must initialize zalloc, zfree and
311*44bedb31SLionel Sambuc   --  opaque before calling the init function.
312*44bedb31SLionel Sambuc
313*44bedb31SLionel Sambuc   procedure Set_In
314*44bedb31SLionel Sambuc     (Strm   : in out Z_Stream;
315*44bedb31SLionel Sambuc      Buffer : in Voidp;
316*44bedb31SLionel Sambuc      Size   : in UInt);
317*44bedb31SLionel Sambuc   pragma Inline (Set_In);
318*44bedb31SLionel Sambuc
319*44bedb31SLionel Sambuc   procedure Set_Out
320*44bedb31SLionel Sambuc     (Strm   : in out Z_Stream;
321*44bedb31SLionel Sambuc      Buffer : in Voidp;
322*44bedb31SLionel Sambuc      Size   : in UInt);
323*44bedb31SLionel Sambuc   pragma Inline (Set_Out);
324*44bedb31SLionel Sambuc
325*44bedb31SLionel Sambuc   procedure Set_Mem_Func
326*44bedb31SLionel Sambuc     (Strm   : in out Z_Stream;
327*44bedb31SLionel Sambuc      Opaque : in Voidp;
328*44bedb31SLionel Sambuc      Alloc  : in alloc_func;
329*44bedb31SLionel Sambuc      Free   : in free_func);
330*44bedb31SLionel Sambuc   pragma Inline (Set_Mem_Func);
331*44bedb31SLionel Sambuc
332*44bedb31SLionel Sambuc   function Last_Error_Message (Strm : in Z_Stream) return String;
333*44bedb31SLionel Sambuc   pragma Inline (Last_Error_Message);
334*44bedb31SLionel Sambuc
335*44bedb31SLionel Sambuc   function Avail_Out (Strm : in Z_Stream) return UInt;
336*44bedb31SLionel Sambuc   pragma Inline (Avail_Out);
337*44bedb31SLionel Sambuc
338*44bedb31SLionel Sambuc   function Avail_In (Strm : in Z_Stream) return UInt;
339*44bedb31SLionel Sambuc   pragma Inline (Avail_In);
340*44bedb31SLionel Sambuc
341*44bedb31SLionel Sambuc   function Total_In (Strm : in Z_Stream) return ULong;
342*44bedb31SLionel Sambuc   pragma Inline (Total_In);
343*44bedb31SLionel Sambuc
344*44bedb31SLionel Sambuc   function Total_Out (Strm : in Z_Stream) return ULong;
345*44bedb31SLionel Sambuc   pragma Inline (Total_Out);
346*44bedb31SLionel Sambuc
347*44bedb31SLionel Sambuc   function inflateCopy
348*44bedb31SLionel Sambuc     (dest   : in Z_Streamp;
349*44bedb31SLionel Sambuc      Source : in Z_Streamp)
350*44bedb31SLionel Sambuc      return Int;
351*44bedb31SLionel Sambuc
352*44bedb31SLionel Sambuc   function compressBound (Source_Len : in ULong) return ULong;
353*44bedb31SLionel Sambuc
354*44bedb31SLionel Sambuc   function deflateBound
355*44bedb31SLionel Sambuc     (Strm       : in Z_Streamp;
356*44bedb31SLionel Sambuc      Source_Len : in ULong)
357*44bedb31SLionel Sambuc      return     ULong;
358*44bedb31SLionel Sambuc
359*44bedb31SLionel Sambuc   function gzungetc (C : in Int; File : in  gzFile) return Int;
360*44bedb31SLionel Sambuc
361*44bedb31SLionel Sambuc   function zlibCompileFlags return ULong;
362*44bedb31SLionel Sambuc
363*44bedb31SLionel Sambucprivate
364*44bedb31SLionel Sambuc
365*44bedb31SLionel Sambuc   type Z_Stream is record            -- zlib.h:68
366*44bedb31SLionel Sambuc      Next_In   : Voidp      := Nul;  -- next input byte
367*44bedb31SLionel Sambuc      Avail_In  : UInt       := 0;    -- number of bytes available at next_in
368*44bedb31SLionel Sambuc      Total_In  : ULong      := 0;    -- total nb of input bytes read so far
369*44bedb31SLionel Sambuc      Next_Out  : Voidp      := Nul;  -- next output byte should be put there
370*44bedb31SLionel Sambuc      Avail_Out : UInt       := 0;    -- remaining free space at next_out
371*44bedb31SLionel Sambuc      Total_Out : ULong      := 0;    -- total nb of bytes output so far
372*44bedb31SLionel Sambuc      msg       : Chars_Ptr;          -- last error message, NULL if no error
373*44bedb31SLionel Sambuc      state     : Voidp;              -- not visible by applications
374*44bedb31SLionel Sambuc      zalloc    : alloc_func := null; -- used to allocate the internal state
375*44bedb31SLionel Sambuc      zfree     : free_func  := null; -- used to free the internal state
376*44bedb31SLionel Sambuc      opaque    : Voidp;              -- private data object passed to
377*44bedb31SLionel Sambuc                                      --  zalloc and zfree
378*44bedb31SLionel Sambuc      data_type : Int;                -- best guess about the data type:
379*44bedb31SLionel Sambuc                                      --  ascii or binary
380*44bedb31SLionel Sambuc      adler     : ULong;              -- adler32 value of the uncompressed
381*44bedb31SLionel Sambuc                                      --  data
382*44bedb31SLionel Sambuc      reserved  : ULong;              -- reserved for future use
383*44bedb31SLionel Sambuc   end record;
384*44bedb31SLionel Sambuc
385*44bedb31SLionel Sambuc   pragma Convention (C, Z_Stream);
386*44bedb31SLionel Sambuc
387*44bedb31SLionel Sambuc   pragma Import (C, zlibVersion, "zlibVersion");
388*44bedb31SLionel Sambuc   pragma Import (C, Deflate, "deflate");
389*44bedb31SLionel Sambuc   pragma Import (C, DeflateEnd, "deflateEnd");
390*44bedb31SLionel Sambuc   pragma Import (C, Inflate, "inflate");
391*44bedb31SLionel Sambuc   pragma Import (C, InflateEnd, "inflateEnd");
392*44bedb31SLionel Sambuc   pragma Import (C, deflateSetDictionary, "deflateSetDictionary");
393*44bedb31SLionel Sambuc   pragma Import (C, deflateCopy, "deflateCopy");
394*44bedb31SLionel Sambuc   pragma Import (C, deflateReset, "deflateReset");
395*44bedb31SLionel Sambuc   pragma Import (C, deflateParams, "deflateParams");
396*44bedb31SLionel Sambuc   pragma Import (C, inflateSetDictionary, "inflateSetDictionary");
397*44bedb31SLionel Sambuc   pragma Import (C, inflateSync, "inflateSync");
398*44bedb31SLionel Sambuc   pragma Import (C, inflateReset, "inflateReset");
399*44bedb31SLionel Sambuc   pragma Import (C, compress, "compress");
400*44bedb31SLionel Sambuc   pragma Import (C, compress2, "compress2");
401*44bedb31SLionel Sambuc   pragma Import (C, uncompress, "uncompress");
402*44bedb31SLionel Sambuc   pragma Import (C, gzopen, "gzopen");
403*44bedb31SLionel Sambuc   pragma Import (C, gzdopen, "gzdopen");
404*44bedb31SLionel Sambuc   pragma Import (C, gzsetparams, "gzsetparams");
405*44bedb31SLionel Sambuc   pragma Import (C, gzread, "gzread");
406*44bedb31SLionel Sambuc   pragma Import (C, gzwrite, "gzwrite");
407*44bedb31SLionel Sambuc   pragma Import (C, gzprintf, "gzprintf");
408*44bedb31SLionel Sambuc   pragma Import (C, gzputs, "gzputs");
409*44bedb31SLionel Sambuc   pragma Import (C, gzgets, "gzgets");
410*44bedb31SLionel Sambuc   pragma Import (C, gzputc, "gzputc");
411*44bedb31SLionel Sambuc   pragma Import (C, gzgetc, "gzgetc");
412*44bedb31SLionel Sambuc   pragma Import (C, gzflush, "gzflush");
413*44bedb31SLionel Sambuc   pragma Import (C, gzseek, "gzseek");
414*44bedb31SLionel Sambuc   pragma Import (C, gzrewind, "gzrewind");
415*44bedb31SLionel Sambuc   pragma Import (C, gztell, "gztell");
416*44bedb31SLionel Sambuc   pragma Import (C, gzeof, "gzeof");
417*44bedb31SLionel Sambuc   pragma Import (C, gzclose, "gzclose");
418*44bedb31SLionel Sambuc   pragma Import (C, gzerror, "gzerror");
419*44bedb31SLionel Sambuc   pragma Import (C, adler32, "adler32");
420*44bedb31SLionel Sambuc   pragma Import (C, crc32, "crc32");
421*44bedb31SLionel Sambuc   pragma Import (C, deflateInit, "deflateInit_");
422*44bedb31SLionel Sambuc   pragma Import (C, inflateInit, "inflateInit_");
423*44bedb31SLionel Sambuc   pragma Import (C, deflateInit2, "deflateInit2_");
424*44bedb31SLionel Sambuc   pragma Import (C, inflateInit2, "inflateInit2_");
425*44bedb31SLionel Sambuc   pragma Import (C, zError, "zError");
426*44bedb31SLionel Sambuc   pragma Import (C, inflateSyncPoint, "inflateSyncPoint");
427*44bedb31SLionel Sambuc   pragma Import (C, get_crc_table, "get_crc_table");
428*44bedb31SLionel Sambuc
429*44bedb31SLionel Sambuc   --  since zlib 1.2.0:
430*44bedb31SLionel Sambuc
431*44bedb31SLionel Sambuc   pragma Import (C, inflateCopy, "inflateCopy");
432*44bedb31SLionel Sambuc   pragma Import (C, compressBound, "compressBound");
433*44bedb31SLionel Sambuc   pragma Import (C, deflateBound, "deflateBound");
434*44bedb31SLionel Sambuc   pragma Import (C, gzungetc, "gzungetc");
435*44bedb31SLionel Sambuc   pragma Import (C, zlibCompileFlags, "zlibCompileFlags");
436*44bedb31SLionel Sambuc
437*44bedb31SLionel Sambuc   pragma Import (C, inflateBackInit, "inflateBackInit_");
438*44bedb31SLionel Sambuc
439*44bedb31SLionel Sambuc   --  I stopped binding the inflateBack routines, becouse realize that
440*44bedb31SLionel Sambuc   --  it does not support zlib and gzip headers for now, and have no
441*44bedb31SLionel Sambuc   --  symmetric deflateBack routines.
442*44bedb31SLionel Sambuc   --  ZLib-Ada is symmetric regarding deflate/inflate data transformation
443*44bedb31SLionel Sambuc   --  and has a similar generic callback interface for the
444*44bedb31SLionel Sambuc   --  deflate/inflate transformation based on the regular Deflate/Inflate
445*44bedb31SLionel Sambuc   --  routines.
446*44bedb31SLionel Sambuc
447*44bedb31SLionel Sambuc   --  pragma Import (C, inflateBack, "inflateBack");
448*44bedb31SLionel Sambuc   --  pragma Import (C, inflateBackEnd, "inflateBackEnd");
449*44bedb31SLionel Sambuc
450*44bedb31SLionel Sambucend ZLib.Thin;
451