2 |
- |
1 |
/* Copyright (C) 1998 Aladdin Enterprises. All rights reserved.
|
|
|
2 |
|
|
|
3 |
This software is provided AS-IS with no warranty, either express or
|
|
|
4 |
implied.
|
|
|
5 |
|
|
|
6 |
This software is distributed under license and may not be copied,
|
|
|
7 |
modified or distributed except as expressly authorized under the terms
|
|
|
8 |
of the license contained in the file LICENSE in this distribution.
|
|
|
9 |
|
|
|
10 |
For more information about licensing, please refer to
|
|
|
11 |
http://www.ghostscript.com/licensing/. For information on
|
|
|
12 |
commercial licensing, go to http://www.artifex.com/licensing/ or
|
|
|
13 |
contact Artifex Software, Inc., 101 Lucas Valley Road #110,
|
|
|
14 |
San Rafael, CA 94903, U.S.A., +1(415)492-9861.
|
|
|
15 |
*/
|
|
|
16 |
|
|
|
17 |
/* $Id: szlibxx.h,v 1.5 2002/06/16 05:00:54 lpd Exp $ */
|
|
|
18 |
/* Implementation definitions for zlib interface */
|
|
|
19 |
/* Must be compiled with -I$(ZSRCDIR) */
|
|
|
20 |
|
|
|
21 |
#ifndef szlibxx_INCLUDED
|
|
|
22 |
# define szlibxx_INCLUDED
|
|
|
23 |
|
|
|
24 |
#include "szlibx.h"
|
|
|
25 |
#include "zlib.h"
|
|
|
26 |
|
|
|
27 |
/*
|
|
|
28 |
* We don't want to allocate zlib's private data directly from
|
|
|
29 |
* the C heap, but we must allocate it as immovable; and to avoid
|
|
|
30 |
* garbage collection issues, we must keep GC-traceable pointers
|
|
|
31 |
* to every block allocated. Since the stream state itself is movable,
|
|
|
32 |
* we have to allocate an immovable block for the z_stream state as well.
|
|
|
33 |
*/
|
|
|
34 |
typedef struct zlib_block_s zlib_block_t;
|
|
|
35 |
struct zlib_block_s {
|
|
|
36 |
void *data;
|
|
|
37 |
zlib_block_t *next;
|
|
|
38 |
zlib_block_t *prev;
|
|
|
39 |
};
|
|
|
40 |
#define private_st_zlib_block() /* in szlibc.c */\
|
|
|
41 |
gs_private_st_ptrs3(st_zlib_block, zlib_block_t, "zlib_block_t",\
|
|
|
42 |
zlib_block_enum_ptrs, zlib_block_reloc_ptrs, next, prev, data)
|
|
|
43 |
/* The typedef is in szlibx.h */
|
|
|
44 |
/*typedef*/ struct zlib_dynamic_state_s {
|
|
|
45 |
gs_memory_t *memory;
|
|
|
46 |
zlib_block_t *blocks;
|
|
|
47 |
z_stream zstate;
|
|
|
48 |
} /*zlib_dynamic_state_t*/;
|
|
|
49 |
#define private_st_zlib_dynamic_state() /* in szlibc.c */\
|
|
|
50 |
gs_private_st_ptrs1(st_zlib_dynamic_state, zlib_dynamic_state_t,\
|
|
|
51 |
"zlib_dynamic_state_t", zlib_dynamic_enum_ptrs, zlib_dynamic_reloc_ptrs,\
|
|
|
52 |
blocks)
|
|
|
53 |
|
|
|
54 |
/*
|
|
|
55 |
* Provide zlib-compatible allocation and freeing functions.
|
|
|
56 |
* The mem pointer actually points to the dynamic state.
|
|
|
57 |
*/
|
|
|
58 |
void *s_zlib_alloc(void *mem, uint items, uint size);
|
|
|
59 |
void s_zlib_free(void *mem, void *address);
|
|
|
60 |
|
|
|
61 |
/* Internal procedure to allocate and free the dynamic state. */
|
|
|
62 |
int s_zlib_alloc_dynamic_state(stream_zlib_state *ss);
|
|
|
63 |
void s_zlib_free_dynamic_state(stream_zlib_state *ss);
|
|
|
64 |
|
|
|
65 |
#endif /* szlibxx_INCLUDED */
|