Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / devs / diskimage / z_library / init.c
blob803c5cde40d864d23688886a60b089f2ca57e648
1 /* Copyright 2007-2012 Fredrik Wikstrom. All rights reserved.
2 **
3 ** Redistribution and use in source and binary forms, with or without
4 ** modification, are permitted provided that the following conditions
5 ** are met:
6 **
7 ** 1. Redistributions of source code must retain the above copyright
8 ** notice, this list of conditions and the following disclaimer.
9 **
10 ** 2. Redistributions in binary form must reproduce the above copyright
11 ** notice, this list of conditions and the following disclaimer in the
12 ** documentation and/or other materials provided with the distribution.
14 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
15 ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 ** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
18 ** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19 ** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20 ** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21 ** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22 ** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23 ** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24 ** POSSIBILITY OF SUCH DAMAGE.
27 #include <exec/exec.h>
28 #include <dos/dos.h>
29 #include <proto/exec.h>
30 #include <zlib.h>
31 #include "support.h"
32 #include <SDI_compiler.h>
33 #include "z.library_rev.h"
35 #define LIBNAME "z.library"
36 const char USED_VAR verstag[] = VERSTAG;
38 #ifndef __AROS__
39 #define IPTR ULONG
40 #endif
42 struct ExecBase *SysBase;
44 struct ZBase {
45 struct Library libNode;
46 UWORD pad;
47 BPTR seglist;
50 int malloc_init(void);
51 void malloc_exit(void);
53 #ifdef __AROS__
54 static AROS_UFP3(struct ZBase *, LibInit,
55 AROS_UFPA(struct ZBase *, libBase, D0),
56 AROS_UFPA(BPTR, seglist, A0),
57 AROS_UFPA(struct ExecBase *, exec_base, A6)
59 static AROS_LD1(struct ZBase *, LibOpen,
60 AROS_LPA(ULONG, version, D0),
61 struct ZBase *, libBase, 1, Zlib
63 static AROS_LD0(BPTR, LibClose,
64 struct ZBase *, libBase, 2, Zlib
66 static AROS_LD0(BPTR, LibExpunge,
67 struct ZBase *, libBase, 3, Zlib
69 static AROS_LD0(APTR, LibReserved,
70 struct ZBase *, libBase, 4, Zlib
72 static AROS_LD0(const char *, ZlibVersion,
73 struct ZBase *, libBase, 5, Zlib
75 static AROS_LD2(LONG, DeflateInit,
76 AROS_LPA(z_streamp, strm, A0),
77 AROS_LPA(LONG, level, D0),
78 struct ZBase *, libBase, 6, Zlib
80 static AROS_LD2(LONG, Deflate,
81 AROS_LPA(z_streamp, strm, A0),
82 AROS_LPA(LONG, flush, D0),
83 struct ZBase *, libBase, 7, Zlib
85 static AROS_LD1(LONG, DeflateEnd,
86 AROS_LPA(z_streamp, strm, A0),
87 struct ZBase *, libBase, 8, Zlib
89 static AROS_LD1(LONG, InflateInit,
90 AROS_LPA(z_streamp, strm, A0),
91 struct ZBase *, libBase, 9, Zlib
93 static AROS_LD2(LONG, Inflate,
94 AROS_LPA(z_streamp, strm, A0),
95 AROS_LPA(LONG, flush, D0),
96 struct ZBase *, libBase, 10, Zlib
98 static AROS_LD1(LONG, InflateEnd,
99 AROS_LPA(z_streamp, strm, A0),
100 struct ZBase *, libBase, 11, Zlib
102 static AROS_LD6(LONG, DeflateInit2,
103 AROS_LPA(z_streamp, strm, A0),
104 AROS_LPA(LONG, level, D0),
105 AROS_LPA(LONG, method, D1),
106 AROS_LPA(LONG, windowBits, D2),
107 AROS_LPA(LONG, memLevel, D3),
108 AROS_LPA(LONG, strategy, D4),
109 struct ZBase *, libBase, 12, Zlib
111 static AROS_LD3(LONG, DeflateSetDictionary,
112 AROS_LPA(z_streamp, strm, A0),
113 AROS_LPA(APTR, dictionary, A1),
114 AROS_LPA(ULONG, dictLength, D0),
115 struct ZBase *, libBase, 13, Zlib
117 static AROS_LD2(LONG, DeflateCopy,
118 AROS_LPA(z_streamp, dest, A0),
119 AROS_LPA(z_streamp, source, A1),
120 struct ZBase *, libBase, 14, Zlib
122 static AROS_LD1(LONG, DeflateReset,
123 AROS_LPA(z_streamp, strm, A0),
124 struct ZBase *, libBase, 15, Zlib
126 static AROS_LD3(LONG, DeflateParams,
127 AROS_LPA(z_streamp, strm, A0),
128 AROS_LPA(LONG, level, D0),
129 AROS_LPA(LONG, strategy, D1),
130 struct ZBase *, libBase, 16, Zlib
132 static AROS_LD2(LONG, InflateInit2,
133 AROS_LPA(z_streamp, strm, A0),
134 AROS_LPA(LONG, windowBits, D0),
135 struct ZBase *, libBase, 17, Zlib
137 static AROS_LD3(LONG, InflateSetDictionary,
138 AROS_LPA(z_streamp, strm, A0),
139 AROS_LPA(APTR, dictionary, A1),
140 AROS_LPA(ULONG, dictLength, D0),
141 struct ZBase *, libBase, 18, Zlib
143 static AROS_LD1(LONG, InflateReset,
144 AROS_LPA(z_streamp, strm, A0),
145 struct ZBase *, libBase, 19, Zlib
147 static AROS_LD4(LONG, Compress,
148 AROS_LPA(APTR, dest, A0),
149 AROS_LPA(ULONG *, destLen, A1),
150 AROS_LPA(APTR, source, A2),
151 AROS_LPA(ULONG, sourceLen, D0),
152 struct ZBase *, libBase, 20, Zlib
154 static AROS_LD4(LONG, Uncompress,
155 AROS_LPA(APTR, dest, A0),
156 AROS_LPA(ULONG *, destLen, A1),
157 AROS_LPA(APTR, source, A2),
158 AROS_LPA(ULONG, sourceLen, D0),
159 struct ZBase *, libBase, 21, Zlib
161 static AROS_LD3(ULONG, Adler32,
162 AROS_LPA(ULONG, adler, D0),
163 AROS_LPA(APTR, buf, A0),
164 AROS_LPA(ULONG, len, D1),
165 struct ZBase *, libBase, 22, Zlib
167 static AROS_LD3(ULONG, CRC32,
168 AROS_LPA(ULONG, crc, D0),
169 AROS_LPA(APTR, buf, A0),
170 AROS_LPA(ULONG, len, D1),
171 struct ZBase *, libBase, 23, Zlib
173 static AROS_LD1(LONG, InflateSync,
174 AROS_LPA(z_streamp, strm, A0),
175 struct ZBase *, libBase, 24, Zlib
177 #else
178 static struct ZBase *LibInit (REG(d0, struct ZBase *libBase), REG(a0, BPTR seglist),
179 REG(a6, struct ExecBase *exec_base));
180 static struct ZBase *Zlib_LibOpen (REG(a6, struct ZBase *libBase), REG(d0, ULONG version));
181 static BPTR Zlib_LibClose (REG(a6, struct ZBase *libBase));
182 static BPTR Zlib_LibExpunge (REG(a6, struct ZBase *libBase));
183 static APTR Zlib_LibReserved (REG(a6, struct ZBase *libBase));
184 static const char *Zlib_ZlibVersion(void);
185 static LONG Zlib_DeflateInit(REG(a0, z_streamp strm), REG(d0, LONG level));
186 static LONG Zlib_Deflate(REG(a0, z_streamp strm), REG(d0, LONG flush));
187 static LONG Zlib_DeflateEnd(REG(a0, z_streamp strm));
188 static LONG Zlib_InflateInit(REG(a0, z_streamp strm));
189 static LONG Zlib_Inflate(REG(a0, z_streamp strm), REG(d0, LONG flush));
190 static LONG Zlib_InflateEnd(REG(a0, z_streamp strm));
191 static LONG Zlib_DeflateInit2(REG(a0, z_streamp strm), REG(d0, LONG level), REG(d1, LONG method),
192 REG(d2, LONG windowBits), REG(d3, LONG memLevel), REG(d4, LONG strategy));
193 static LONG Zlib_DeflateSetDictionary(REG(a0, z_streamp strm), REG(a1, APTR dictionary),
194 REG(d0, ULONG dictLength));
195 static LONG Zlib_DeflateCopy(REG(a0, z_streamp dest), REG(a1, z_streamp source));
196 static LONG Zlib_DeflateReset(REG(a0, z_streamp strm));
197 static LONG Zlib_DeflateParams(REG(a0, z_streamp strm), REG(d0, LONG level), REG(d1, LONG strategy));
198 static LONG Zlib_InflateInit2(REG(a0, z_streamp strm), REG(d0, LONG windowBits));
199 static LONG Zlib_InflateSetDictionary(REG(a0, z_streamp strm), REG(a1, APTR dictionary),
200 REG(d0, ULONG dictLength));
201 static LONG Zlib_InflateReset(REG(a0, z_streamp strm));
202 static LONG Zlib_Compress(REG(a0, APTR dest), REG(a1, ULONG *destLen), REG(a2, APTR source),
203 REG(d0, ULONG sourceLen));
204 static LONG Zlib_Uncompress(REG(a0, APTR dest), REG(a1, ULONG *destLen), REG(a2, APTR source),
205 REG(d0, ULONG sourceLen));
206 static ULONG Zlib_Adler32(REG(d0, ULONG adler), REG(a0, APTR buf), REG(d1, ULONG len));
207 static ULONG Zlib_CRC32(REG(d0, ULONG crc), REG(a0, APTR buf), REG(d1, ULONG len));
208 static LONG Zlib_InflateSync(REG(a0, z_streamp strm));
209 #endif
211 #ifdef __AROS__
212 #ifdef ABIV1
213 #define LIB_ENTRY(a,b) AROS_SLIB_ENTRY(a, Zlib, b)
214 #else
215 #define LIB_ENTRY(a,b) AROS_SLIB_ENTRY(a, Zlib)
216 #endif
217 #else
218 #define LIB_ENTRY(a,b) Zlib_##a
219 #endif
221 CONST_APTR LibVectors[] = {
222 (APTR)LIB_ENTRY(LibOpen, 1),
223 (APTR)LIB_ENTRY(LibClose, 2),
224 (APTR)LIB_ENTRY(LibExpunge, 3),
225 (APTR)LIB_ENTRY(LibReserved, 4),
226 (APTR)LIB_ENTRY(ZlibVersion, 5),
227 (APTR)LIB_ENTRY(DeflateInit, 6),
228 (APTR)LIB_ENTRY(Deflate, 7),
229 (APTR)LIB_ENTRY(DeflateEnd, 8),
230 (APTR)LIB_ENTRY(InflateInit, 9),
231 (APTR)LIB_ENTRY(Inflate, 10),
232 (APTR)LIB_ENTRY(InflateEnd, 11),
233 (APTR)LIB_ENTRY(DeflateInit2, 12),
234 (APTR)LIB_ENTRY(DeflateSetDictionary, 13),
235 (APTR)LIB_ENTRY(DeflateCopy, 14),
236 (APTR)LIB_ENTRY(DeflateReset, 15),
237 (APTR)LIB_ENTRY(DeflateParams, 16),
238 (APTR)LIB_ENTRY(InflateInit2, 17),
239 (APTR)LIB_ENTRY(InflateSetDictionary, 18),
240 (APTR)LIB_ENTRY(InflateReset, 19),
241 (APTR)LIB_ENTRY(Compress, 20),
242 (APTR)LIB_ENTRY(Uncompress, 21),
243 (APTR)LIB_ENTRY(Adler32, 22),
244 (APTR)LIB_ENTRY(CRC32, 23),
245 (APTR)LIB_ENTRY(InflateSync, 24),
246 (APTR)-1
249 const IPTR LibInitTab[] = {
250 sizeof(struct ZBase),
251 (IPTR)LibVectors,
252 (IPTR)NULL,
253 (IPTR)LibInit
256 const struct Resident USED_VAR ROMTag = {
257 RTC_MATCHWORD,
258 (struct Resident *)&ROMTag,
259 (APTR)(&ROMTag + 1),
260 RTF_AUTOINIT,
261 VERSION,
262 NT_LIBRARY,
264 (STRPTR)LIBNAME,
265 (STRPTR)VSTRING,
266 (APTR)LibInitTab
269 #ifdef __AROS__
270 static AROS_UFH3(struct ZBase *, LibInit,
271 AROS_UFHA(struct ZBase *, libBase, D0),
272 AROS_UFHA(BPTR, seglist, A0),
273 AROS_UFHA(struct ExecBase *, exec_base, A6)
276 AROS_USERFUNC_INIT
277 #else
278 static struct ZBase *LibInit (REG(d0, struct ZBase *libBase), REG(a0, BPTR seglist),
279 REG(a6, struct ExecBase *exec_base))
281 #endif
282 libBase->libNode.lib_Node.ln_Type = NT_LIBRARY;
283 libBase->libNode.lib_Node.ln_Pri = 0;
284 libBase->libNode.lib_Node.ln_Name = LIBNAME;
285 libBase->libNode.lib_Flags = LIBF_SUMUSED|LIBF_CHANGED;
286 libBase->libNode.lib_Version = VERSION;
287 libBase->libNode.lib_Revision = REVISION;
288 libBase->libNode.lib_IdString = VSTRING;
290 libBase->seglist = seglist;
291 SysBase = exec_base;
293 if (malloc_init()) {
294 get_crc_table();
295 return libBase;
298 DeleteLibrary((struct Library *)libBase);
300 return NULL;
301 #ifdef __AROS__
302 AROS_USERFUNC_EXIT
303 #endif
306 #ifdef __AROS__
307 static AROS_LH1(struct ZBase *, LibOpen,
308 AROS_LHA(ULONG, version, D0),
309 struct ZBase *, libBase, 1, Zlib
312 AROS_LIBFUNC_INIT
313 #else
314 static struct ZBase *Zlib_LibOpen (REG(a6, struct ZBase *libBase), REG(d0, ULONG version)) {
315 #endif
316 libBase->libNode.lib_OpenCnt++;
317 libBase->libNode.lib_Flags &= ~LIBF_DELEXP;
318 return libBase;
319 #ifdef __AROS__
320 AROS_LIBFUNC_EXIT
321 #endif
324 #ifdef __AROS__
325 static AROS_LH0(BPTR, LibClose,
326 struct ZBase *, libBase, 2, Zlib
329 AROS_LIBFUNC_INIT
330 #else
331 static BPTR Zlib_LibClose (REG(a6, struct ZBase *libBase)) {
332 #endif
333 libBase->libNode.lib_OpenCnt--;
334 return 0;
335 #ifdef __AROS__
336 AROS_LIBFUNC_EXIT
337 #endif
340 #ifdef __AROS__
341 static AROS_LH0(BPTR, LibExpunge,
342 struct ZBase *, libBase, 3, Zlib
345 AROS_LIBFUNC_INIT
346 #else
347 static BPTR Zlib_LibExpunge (REG(a6, struct ZBase *libBase)) {
348 #endif
349 BPTR result = 0;
351 if (libBase->libNode.lib_OpenCnt > 0) {
352 libBase->libNode.lib_Flags |= LIBF_DELEXP;
353 return 0;
356 Remove(&libBase->libNode.lib_Node);
358 result = libBase->seglist;
360 malloc_exit();
362 DeleteLibrary((struct Library *)libBase);
364 return result;
365 #ifdef __AROS__
366 AROS_LIBFUNC_EXIT
367 #endif
370 #ifdef __AROS__
371 static AROS_LH0(APTR, LibReserved,
372 struct ZBase *, libBase, 4, Zlib
375 AROS_LIBFUNC_INIT
376 return NULL;
377 AROS_LIBFUNC_EXIT
379 #else
380 static APTR Zlib_LibReserved (REG(a6, struct ZBase *libBase)) {
381 return NULL;
383 #endif
385 #ifdef __AROS__
386 static AROS_LH0(const char *, ZlibVersion,
387 struct ZBase *, libBase, 5, Zlib
390 AROS_LIBFUNC_INIT
391 #else
392 static const char *Zlib_ZlibVersion(void) {
393 #endif
394 return zlibVersion();
395 #ifdef __AROS__
396 AROS_LIBFUNC_EXIT
397 #endif
400 #ifdef __AROS__
401 static AROS_LH2(LONG, DeflateInit,
402 AROS_LHA(z_streamp, strm, A0),
403 AROS_LHA(LONG, level, D0),
404 struct ZBase *, libBase, 6, Zlib
407 AROS_LIBFUNC_INIT
408 #else
409 static LONG Zlib_DeflateInit(REG(a0, z_streamp strm), REG(d0, LONG level)) {
410 #endif
411 return deflateInit(strm, level);
412 #ifdef __AROS__
413 AROS_LIBFUNC_EXIT
414 #endif
417 #ifdef __AROS__
418 static AROS_LH2(LONG, Deflate,
419 AROS_LHA(z_streamp, strm, A0),
420 AROS_LHA(LONG, flush, D0),
421 struct ZBase *, libBase, 7, Zlib
424 AROS_LIBFUNC_INIT
425 #else
426 static LONG Zlib_Deflate(REG(a0, z_streamp strm), REG(d0, LONG flush)) {
427 #endif
428 return deflate(strm, flush);
429 #ifdef __AROS__
430 AROS_LIBFUNC_EXIT
431 #endif
434 #ifdef __AROS__
435 static AROS_LH1(LONG, DeflateEnd,
436 AROS_LHA(z_streamp, strm, A0),
437 struct ZBase *, libBase, 8, Zlib
440 AROS_LIBFUNC_INIT
441 #else
442 static LONG Zlib_DeflateEnd(REG(a0, z_streamp strm)) {
443 #endif
444 return deflateEnd(strm);
445 #ifdef __AROS__
446 AROS_LIBFUNC_EXIT
447 #endif
450 #ifdef __AROS__
451 static AROS_LH1(LONG, InflateInit,
452 AROS_LHA(z_streamp, strm, A0),
453 struct ZBase *, libBase, 9, Zlib
456 AROS_LIBFUNC_INIT
457 #else
458 static LONG Zlib_InflateInit(REG(a0, z_streamp strm)) {
459 #endif
460 return inflateInit(strm);
461 #ifdef __AROS__
462 AROS_LIBFUNC_EXIT
463 #endif
466 #ifdef __AROS__
467 static AROS_LH2(LONG, Inflate,
468 AROS_LHA(z_streamp, strm, A0),
469 AROS_LHA(LONG, flush, D0),
470 struct ZBase *, libBase, 10, Zlib
473 AROS_LIBFUNC_INIT
474 #else
475 static LONG Zlib_Inflate(REG(a0, z_streamp strm), REG(d0, LONG flush)) {
476 #endif
477 return inflate(strm, flush);
478 #ifdef __AROS__
479 AROS_LIBFUNC_EXIT
480 #endif
483 #ifdef __AROS__
484 static AROS_LH1(LONG, InflateEnd,
485 AROS_LHA(z_streamp, strm, A0),
486 struct ZBase *, libBase, 11, Zlib
489 AROS_LIBFUNC_INIT
490 #else
491 static LONG Zlib_InflateEnd(REG(a0, z_streamp strm)) {
492 #endif
493 return inflateEnd(strm);
494 #ifdef __AROS__
495 AROS_LIBFUNC_EXIT
496 #endif
499 #ifdef __AROS__
500 static AROS_LH6(LONG, DeflateInit2,
501 AROS_LHA(z_streamp, strm, A0),
502 AROS_LHA(LONG, level, D0),
503 AROS_LHA(LONG, method, D1),
504 AROS_LHA(LONG, windowBits, D2),
505 AROS_LHA(LONG, memLevel, D3),
506 AROS_LHA(LONG, strategy, D4),
507 struct ZBase *, libBase, 12, Zlib
510 AROS_LIBFUNC_INIT
511 #else
512 static LONG Zlib_DeflateInit2(REG(a0, z_streamp strm), REG(d0, LONG level), REG(d1, LONG method),
513 REG(d2, LONG windowBits), REG(d3, LONG memLevel), REG(d4, LONG strategy))
515 #endif
516 return deflateInit2(strm, level, method, windowBits, memLevel, strategy);
517 #ifdef __AROS__
518 AROS_LIBFUNC_EXIT
519 #endif
522 #ifdef __AROS__
523 static AROS_LH3(LONG, DeflateSetDictionary,
524 AROS_LHA(z_streamp, strm, A0),
525 AROS_LHA(APTR, dictionary, A1),
526 AROS_LHA(ULONG, dictLength, D0),
527 struct ZBase *, libBase, 13, Zlib
530 AROS_LIBFUNC_INIT
531 #else
532 static LONG Zlib_DeflateSetDictionary(REG(a0, z_streamp strm), REG(a1, APTR dictionary),
533 REG(d0, ULONG dictLength))
535 #endif
536 return deflateSetDictionary(strm, dictionary, dictLength);
537 #ifdef __AROS__
538 AROS_LIBFUNC_EXIT
539 #endif
542 #ifdef __AROS__
543 static AROS_LH2(LONG, DeflateCopy,
544 AROS_LHA(z_streamp, dest, A0),
545 AROS_LHA(z_streamp, source, A1),
546 struct ZBase *, libBase, 14, Zlib
549 AROS_LIBFUNC_INIT
550 #else
551 static LONG Zlib_DeflateCopy(REG(a0, z_streamp dest), REG(a1, z_streamp source)) {
552 #endif
553 return deflateCopy(dest, source);
554 #ifdef __AROS__
555 AROS_LIBFUNC_EXIT
556 #endif
559 #ifdef __AROS__
560 static AROS_LH1(LONG, DeflateReset,
561 AROS_LHA(z_streamp, strm, A0),
562 struct ZBase *, libBase, 15, Zlib
565 AROS_LIBFUNC_INIT
566 #else
567 static LONG Zlib_DeflateReset(REG(a0, z_streamp strm)) {
568 #endif
569 return deflateReset(strm);
570 #ifdef __AROS__
571 AROS_LIBFUNC_EXIT
572 #endif
575 #ifdef __AROS__
576 static AROS_LH3(LONG, DeflateParams,
577 AROS_LHA(z_streamp, strm, A0),
578 AROS_LHA(LONG, level, D0),
579 AROS_LHA(LONG, strategy, D1),
580 struct ZBase *, libBase, 16, Zlib
583 AROS_LIBFUNC_INIT
584 #else
585 static LONG Zlib_DeflateParams(REG(a0, z_streamp strm), REG(d0, LONG level), REG(d1, LONG strategy)) {
586 #endif
587 return deflateParams(strm, level, strategy);
588 #ifdef __AROS__
589 AROS_LIBFUNC_EXIT
590 #endif
593 #ifdef __AROS__
594 static AROS_LH2(LONG, InflateInit2,
595 AROS_LHA(z_streamp, strm, A0),
596 AROS_LHA(LONG, windowBits, D0),
597 struct ZBase *, libBase, 17, Zlib
600 AROS_LIBFUNC_INIT
601 #else
602 static LONG Zlib_InflateInit2(REG(a0, z_streamp strm), REG(d0, LONG windowBits)) {
603 #endif
604 return inflateInit2(strm, windowBits);
605 #ifdef __AROS__
606 AROS_LIBFUNC_EXIT
607 #endif
610 #ifdef __AROS__
611 static AROS_LH3(LONG, InflateSetDictionary,
612 AROS_LHA(z_streamp, strm, A0),
613 AROS_LHA(APTR, dictionary, A1),
614 AROS_LHA(ULONG, dictLength, D0),
615 struct ZBase *, libBase, 18, Zlib
618 AROS_LIBFUNC_INIT
619 #else
620 static LONG Zlib_InflateSetDictionary(REG(a0, z_streamp strm), REG(a1, APTR dictionary),
621 REG(d0, ULONG dictLength))
623 #endif
624 return inflateSetDictionary(strm, dictionary, dictLength);
625 #ifdef __AROS__
626 AROS_LIBFUNC_EXIT
627 #endif
630 #ifdef __AROS__
631 static AROS_LH1(LONG, InflateReset,
632 AROS_LHA(z_streamp, strm, A0),
633 struct ZBase *, libBase, 19, Zlib
636 AROS_LIBFUNC_INIT
637 #else
638 static LONG Zlib_InflateReset(REG(a0, z_streamp strm)) {
639 #endif
640 return inflateReset(strm);
641 #ifdef __AROS__
642 AROS_LIBFUNC_EXIT
643 #endif
646 #ifdef __AROS__
647 static AROS_LH4(LONG, Compress,
648 AROS_LHA(APTR, dest, A0),
649 AROS_LHA(ULONG *, destLen, A1),
650 AROS_LHA(APTR, source, A2),
651 AROS_LHA(ULONG, sourceLen, D0),
652 struct ZBase *, libBase, 20, Zlib
655 AROS_LIBFUNC_INIT
656 #else
657 static LONG Zlib_Compress(REG(a0, APTR dest), REG(a1, ULONG *destLen), REG(a2, APTR source),
658 REG(d0, ULONG sourceLen))
660 #endif
661 return compress(dest, destLen, source, sourceLen);
662 #ifdef __AROS__
663 AROS_LIBFUNC_EXIT
664 #endif
667 #ifdef __AROS__
668 static AROS_LH4(LONG, Uncompress,
669 AROS_LHA(APTR, dest, A0),
670 AROS_LHA(ULONG *, destLen, A1),
671 AROS_LHA(APTR, source, A2),
672 AROS_LHA(ULONG, sourceLen, D0),
673 struct ZBase *, libBase, 21, Zlib
676 AROS_LIBFUNC_INIT
677 #else
678 static LONG Zlib_Uncompress(REG(a0, APTR dest), REG(a1, ULONG *destLen), REG(a2, APTR source),
679 REG(d0, ULONG sourceLen))
681 #endif
682 return uncompress(dest, destLen, source, sourceLen);
683 #ifdef __AROS__
684 AROS_LIBFUNC_EXIT
685 #endif
688 #ifdef __AROS__
689 static AROS_LH3(ULONG, Adler32,
690 AROS_LHA(ULONG, adler, D0),
691 AROS_LHA(APTR, buf, A0),
692 AROS_LHA(ULONG, len, D1),
693 struct ZBase *, libBase, 22, Zlib
696 AROS_LIBFUNC_INIT
697 #else
698 static ULONG Zlib_Adler32(REG(d0, ULONG adler), REG(a0, APTR buf), REG(d1, ULONG len)) {
699 #endif
700 return adler32(adler, buf, len);
701 #ifdef __AROS__
702 AROS_LIBFUNC_EXIT
703 #endif
706 #ifdef __AROS__
707 static AROS_LH3(ULONG, CRC32,
708 AROS_LHA(ULONG, crc, D0),
709 AROS_LHA(APTR, buf, A0),
710 AROS_LHA(ULONG, len, D1),
711 struct ZBase *, libBase, 23, Zlib
714 AROS_LIBFUNC_INIT
715 #else
716 static ULONG Zlib_CRC32(REG(d0, ULONG crc), REG(a0, APTR buf), REG(d1, ULONG len)) {
717 #endif
718 return crc32(crc, buf, len);
719 #ifdef __AROS__
720 AROS_LIBFUNC_EXIT
721 #endif
724 #ifdef __AROS__
725 static AROS_LH1(LONG, InflateSync,
726 AROS_LHA(z_streamp, strm, A0),
727 struct ZBase *, libBase, 24, Zlib
730 AROS_LIBFUNC_INIT
731 #else
732 static LONG Zlib_InflateSync(REG(a0, z_streamp strm)) {
733 #endif
734 return inflateSync(strm);
735 #ifdef __AROS__
736 AROS_LIBFUNC_EXIT
737 #endif