1 ----------------------------------------------------------------
2 -- ZLib for Ada thick binding. --
4 -- Copyright (C) 2002-2003 Dmitriy Anisimkov --
6 -- Open source license information is in the zlib.ads file. --
7 ----------------------------------------------------------------
9 -- $Id: zlib-thin.adb,v 1.8 2003/12/14 18:27:31 vagul Exp $
11 package body ZLib
.Thin
is
13 ZLIB_VERSION
: constant Chars_Ptr
:= zlibVersion
;
15 Z_Stream_Size
: constant Int
:= Z_Stream
'Size / System
.Storage_Unit
;
21 function Avail_In
(Strm
: in Z_Stream
) return UInt
is
30 function Avail_Out
(Strm
: in Z_Stream
) return UInt
is
32 return Strm
.Avail_Out
;
63 function Inflate_Init
(strm
: Z_Streamp
; windowBits
: Int
) return Int
is
65 return inflateInit2
(strm
, windowBits
, ZLIB_VERSION
, Z_Stream_Size
);
68 ------------------------
69 -- Last_Error_Message --
70 ------------------------
72 function Last_Error_Message
(Strm
: in Z_Stream
) return String is
73 use Interfaces
.C
.Strings
;
75 if Strm
.msg
= Null_Ptr
then
78 return Value
(Strm
.msg
);
80 end Last_Error_Message
;
87 (Strm
: in out Z_Stream
;
91 Strm
.Next_In
:= Buffer
;
92 Strm
.Avail_In
:= Size
;
99 procedure Set_Mem_Func
100 (Strm
: in out Z_Stream
;
102 Alloc
: in alloc_func
;
103 Free
: in free_func
) is
105 Strm
.opaque
:= Opaque
;
106 Strm
.zalloc
:= Alloc
;
115 (Strm
: in out Z_Stream
;
119 Strm
.Next_Out
:= Buffer
;
120 Strm
.Avail_Out
:= Size
;
127 function Total_In
(Strm
: in Z_Stream
) return ULong
is
129 return Strm
.Total_In
;
136 function Total_Out
(Strm
: in Z_Stream
) return ULong
is
138 return Strm
.Total_Out
;