xref: /plan9/sys/src/cmd/gs/src/gxcllzw.c (revision 593dc095aefb2a85c828727bbfa9da139a49bdf4)
1 /* Copyright (C) 1997 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: gxcllzw.c,v 1.4 2002/02/21 22:24:53 giles Exp $ */
18 /* LZW filter initialization for RAM-based band lists */
19 #include "std.h"
20 #include "gstypes.h"
21 #include "gsmemory.h"
22 #include "gxclmem.h"
23 #include "slzwx.h"
24 
25 private stream_LZW_state cl_LZWE_state;
26 private stream_LZW_state cl_LZWD_state;
27 
28 /* Initialize the states to be copied. */
29 void
gs_cl_lzw_init(gs_memory_t * mem)30 gs_cl_lzw_init(gs_memory_t * mem)
31 {
32     s_LZW_set_defaults((stream_state *) & cl_LZWE_state);
33     cl_LZWE_state.template = &s_LZWE_template;
34     s_LZW_set_defaults((stream_state *) & cl_LZWD_state);
35     cl_LZWD_state.template = &s_LZWD_template;
36 }
37 
38 /* Return the prototypes for compressing/decompressing the band list. */
39 const stream_state *
clist_compressor_state(void * client_data)40 clist_compressor_state(void *client_data)
41 {
42     return (const stream_state *)&cl_LZWE_state;
43 }
44 const stream_state *
clist_decompressor_state(void * client_data)45 clist_decompressor_state(void *client_data)
46 {
47     return (const stream_state *)&cl_LZWD_state;
48 }
49