Rev 6617 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6617 | Rev 6639 | ||
---|---|---|---|
1 | ; zutil.inc -- internal interface and configuration of the compression library |
1 | ; zutil.inc -- internal interface and configuration of the compression library |
2 | ; Copyright (C) 1995-2013 Jean-loup Gailly. |
2 | ; Copyright (C) 1995-2013 Jean-loup Gailly. |
3 | ; For conditions of distribution and use, see copyright notice in zlib.inc |
3 | ; For conditions of distribution and use, see copyright notice in zlib.inc |
4 | 4 | ||
5 | ; WARNING: this file should *not* be used by applications. It is |
5 | ; WARNING: this file should *not* be used by applications. It is |
6 | ; part of the implementation of the compression library and is |
6 | ; part of the implementation of the compression library and is |
7 | ; subject to change. Applications should only use zlib.inc. |
7 | ; subject to change. Applications should only use zlib.inc. |
8 | 8 | ||
9 | 9 | ||
10 | macro ERR_MSG err |
10 | macro ERR_MSG err |
11 | { |
11 | { |
12 | mov ecx,Z_NEED_DICT-err |
12 | mov ecx,Z_NEED_DICT |
- | 13 | sub ecx,err |
|
13 | mov ecx,[4*ecx+z_errmsg] |
14 | mov ecx,[4*ecx+z_errmsg] |
14 | } |
15 | } |
15 | 16 | ||
16 | macro ERR_RETURN strm,err |
17 | macro ERR_RETURN strm,err |
17 | { |
18 | { |
18 | ERR_MSG err |
19 | ERR_MSG err |
19 | mov [strm+z_stream.msg],ecx |
20 | mov [strm+z_stream.msg],ecx |
20 | mov eax,err |
21 | mov eax,err |
21 | } |
22 | } |
22 | ; To be used only when the state is known to be valid |
23 | ; To be used only when the state is known to be valid |
23 | 24 | ||
24 | ; /* common constants */ |
25 | ; /* common constants */ |
25 | 26 | ||
26 | ;#ifndef DEF_WBITS |
27 | ;#ifndef DEF_WBITS |
27 | ;# define DEF_WBITS MAX_WBITS |
28 | ;# define DEF_WBITS MAX_WBITS |
28 | ;end if |
29 | ;end if |
29 | ; default windowBits for decompression. MAX_WBITS is for compression only |
30 | ; default windowBits for decompression. MAX_WBITS is for compression only |
30 | 31 | ||
31 | ;#if MAX_MEM_LEVEL >= 8 |
32 | ;#if MAX_MEM_LEVEL >= 8 |
32 | DEF_MEM_LEVEL equ 8 |
33 | DEF_MEM_LEVEL equ 8 |
33 | ;#else |
34 | ;#else |
34 | ;# define DEF_MEM_LEVEL MAX_MEM_LEVEL |
35 | ;# define DEF_MEM_LEVEL MAX_MEM_LEVEL |
35 | ;end if |
36 | ;end if |
36 | ; default memLevel |
37 | ; default memLevel |
37 | 38 | ||
38 | STORED_BLOCK equ 0 |
39 | STORED_BLOCK equ 0 |
39 | STATIC_TREES equ 1 |
40 | STATIC_TREES equ 1 |
40 | DYN_TREES equ 2 |
41 | DYN_TREES equ 2 |
41 | ; The three kinds of block type |
42 | ; The three kinds of block type |
42 | 43 | ||
43 | MIN_MATCH equ 3 |
44 | MIN_MATCH equ 3 |
44 | MAX_MATCH equ 258 |
45 | MAX_MATCH equ 258 |
45 | ; The minimum and maximum match lengths |
46 | ; The minimum and maximum match lengths |
46 | 47 | ||
47 | PRESET_DICT equ 0x20 ;preset dictionary flag in zlib header |
48 | PRESET_DICT equ 0x20 ;preset dictionary flag in zlib header |
48 | 49 | ||
49 | ; /* common defaults */ |
50 | ; /* common defaults */ |
50 | 51 | ||
51 | OS_CODE equ 0x03 ;assume Unix |
52 | OS_CODE equ 0x03 ;assume Unix |
52 | 53 | ||
53 | ; /* functions */ |
54 | ; /* functions */ |
54 | 55 | ||
55 | ; Diagnostic functions |
56 | ; Diagnostic functions |
56 | ;if DEBUG eq 1 |
57 | ;if DEBUG eq 1 |
57 | ;# define Trace(x) {if (z_verbose>=0) fprintf x ;} |
58 | ;# define Trace(x) {if (z_verbose>=0) fprintf x ;} |
58 | ;# define Tracev(x) {if (z_verbose>0) fprintf x ;} |
59 | ;# define Tracev(x) {if (z_verbose>0) fprintf x ;} |
59 | macro Tracevv mes1, mes2 |
60 | macro Tracevv mes1, mes2 |
60 | { |
61 | { |
61 | ;zlib_debug 'Tracevv = %d', mes1 |
62 | ;zlib_debug 'Tracevv = %d', mes1 |
62 | } |
63 | } |
63 | ;# define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;} |
64 | ;# define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;} |
64 | ;# define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;} |
65 | ;# define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;} |
65 | ;end if |
66 | ;end if |
66 | 67 | ||
67 | macro ZALLOC strm, items, size |
68 | macro ZALLOC strm, items, size |
68 | { |
69 | { |
69 | stdcall dword[strm+z_stream.zalloc], [strm+z_stream.opaque], items, size |
70 | stdcall dword[strm+z_stream.zalloc], [strm+z_stream.opaque], items, size |
70 | } |
71 | } |
71 | macro ZFREE strm, p2addr |
72 | macro ZFREE strm, p2addr |
72 | { |
73 | { |
73 | stdcall dword[strm+z_stream.zfree], dword[strm+z_stream.opaque], p2addr |
74 | stdcall dword[strm+z_stream.zfree], dword[strm+z_stream.opaque], p2addr |
74 | } |
75 | } |
75 | macro TRY_FREE s, p |
76 | macro TRY_FREE s, p |
76 | { |
77 | { |
77 | local .end0 |
78 | local .end0 |
78 | cmp p,0 |
79 | cmp p,0 |
79 | je .end0 |
80 | je .end0 |
80 | ZFREE s, p |
81 | ZFREE s, p |
81 | .end0: |
82 | .end0: |
82 | } |
83 | } |
83 | 84 | ||
84 | ; Reverse the bytes in a 32-bit value |
85 | ; Reverse the bytes in a 32-bit value |
85 | macro ZSWAP32 q |
86 | macro ZSWAP32 q |
86 | { |
87 | { |
87 | bswap q |
88 | bswap q |
88 | } |
89 | } |