source: Vago/zlib-1.2.8/contrib/ada/zlib-thin.adb@ 1067

Last change on this file since 1067 was 1049, checked in by s10k, 8 years ago
File size: 3.3 KB
Line 
1----------------------------------------------------------------
2-- ZLib for Ada thick binding. --
3-- --
4-- Copyright (C) 2002-2003 Dmitriy Anisimkov --
5-- --
6-- Open source license information is in the zlib.ads file. --
7----------------------------------------------------------------
8
9-- $Id: zlib-thin.adb,v 1.8 2003/12/14 18:27:31 vagul Exp $
10
11package body ZLib.Thin is
12
13 ZLIB_VERSION : constant Chars_Ptr := zlibVersion;
14
15 Z_Stream_Size : constant Int := Z_Stream'Size / System.Storage_Unit;
16
17 --------------
18 -- Avail_In --
19 --------------
20
21 function Avail_In (Strm : in Z_Stream) return UInt is
22 begin
23 return Strm.Avail_In;
24 end Avail_In;
25
26 ---------------
27 -- Avail_Out --
28 ---------------
29
30 function Avail_Out (Strm : in Z_Stream) return UInt is
31 begin
32 return Strm.Avail_Out;
33 end Avail_Out;
34
35 ------------------
36 -- Deflate_Init --
37 ------------------
38
39 function Deflate_Init
40 (strm : Z_Streamp;
41 level : Int;
42 method : Int;
43 windowBits : Int;
44 memLevel : Int;
45 strategy : Int)
46 return Int is
47 begin
48 return deflateInit2
49 (strm,
50 level,
51 method,
52 windowBits,
53 memLevel,
54 strategy,
55 ZLIB_VERSION,
56 Z_Stream_Size);
57 end Deflate_Init;
58
59 ------------------
60 -- Inflate_Init --
61 ------------------
62
63 function Inflate_Init (strm : Z_Streamp; windowBits : Int) return Int is
64 begin
65 return inflateInit2 (strm, windowBits, ZLIB_VERSION, Z_Stream_Size);
66 end Inflate_Init;
67
68 ------------------------
69 -- Last_Error_Message --
70 ------------------------
71
72 function Last_Error_Message (Strm : in Z_Stream) return String is
73 use Interfaces.C.Strings;
74 begin
75 if Strm.msg = Null_Ptr then
76 return "";
77 else
78 return Value (Strm.msg);
79 end if;
80 end Last_Error_Message;
81
82 ------------
83 -- Set_In --
84 ------------
85
86 procedure Set_In
87 (Strm : in out Z_Stream;
88 Buffer : in Voidp;
89 Size : in UInt) is
90 begin
91 Strm.Next_In := Buffer;
92 Strm.Avail_In := Size;
93 end Set_In;
94
95 ------------------
96 -- Set_Mem_Func --
97 ------------------
98
99 procedure Set_Mem_Func
100 (Strm : in out Z_Stream;
101 Opaque : in Voidp;
102 Alloc : in alloc_func;
103 Free : in free_func) is
104 begin
105 Strm.opaque := Opaque;
106 Strm.zalloc := Alloc;
107 Strm.zfree := Free;
108 end Set_Mem_Func;
109
110 -------------
111 -- Set_Out --
112 -------------
113
114 procedure Set_Out
115 (Strm : in out Z_Stream;
116 Buffer : in Voidp;
117 Size : in UInt) is
118 begin
119 Strm.Next_Out := Buffer;
120 Strm.Avail_Out := Size;
121 end Set_Out;
122
123 --------------
124 -- Total_In --
125 --------------
126
127 function Total_In (Strm : in Z_Stream) return ULong is
128 begin
129 return Strm.Total_In;
130 end Total_In;
131
132 ---------------
133 -- Total_Out --
134 ---------------
135
136 function Total_Out (Strm : in Z_Stream) return ULong is
137 begin
138 return Strm.Total_Out;
139 end Total_Out;
140
141end ZLib.Thin;
Note: See TracBrowser for help on using the repository browser.