1
/* Copyright (C) 2001-2006 Artifex Software, Inc.
4
This software is provided AS-IS with no warranty, either express or
7
This software is distributed under license and may not be copied, modified
8
or distributed except as expressly authorized under the terms of that
9
license. Refer to licensing information at http://www.artifex.com/
10
or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134,
11
San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information.
14
/* $Id: srlx.h 8022 2007-06-05 22:23:38Z giles $ */
15
/* Definitions for RunLength filters */
16
/* Requires scommon.h; strimpl.h if any templates are referenced */
19
# define srlx_INCLUDED
22
#define stream_RL_state_common\
24
bool EndOfData /* true if 128 = EOD */
27
typedef struct stream_RLE_state_s {
28
stream_RL_state_common;
29
/* The following parameters are set by the client. */
31
/* The following change dynamically. */
32
ulong record_left; /* bytes left in current record */
33
int copy_left; /* # of bytes waiting to be copied */
36
#define private_st_RLE_state() /* in srle.c */\
37
gs_private_st_simple(st_RLE_state, stream_RLE_state, "RunLengthEncode state")
38
/* We define the initialization procedure here, so that clients */
39
/* can avoid a procedure call. */
40
#define s_RLE_set_defaults_inline(ss)\
41
((ss)->EndOfData = true, (ss)->record_size = 0)
42
#define s_RLE_init_inline(ss)\
44
((ss)->record_size == 0 ? ((ss)->record_size = max_uint) :\
47
extern const stream_template s_RLE_template;
50
typedef struct stream_RLD_state_s {
51
stream_RL_state_common;
52
/* The following change dynamically. */
53
int copy_left; /* # of output bytes waiting to be produced */
54
int copy_data; /* -1 if copying, repeated byte if repeating */
57
#define private_st_RLD_state() /* in srld.c */\
58
gs_private_st_simple(st_RLD_state, stream_RLD_state, "RunLengthDecode state")
59
/* We define the initialization procedure here, so that clients */
60
/* can avoid a procedure call. */
61
#define s_RLD_set_defaults_inline(ss)\
62
((ss)->EndOfData = true)
63
#define s_RLD_init_inline(ss)\
64
((ss)->min_left = ((ss)->EndOfData ? 1 : 0), (ss)->copy_left = 0)
65
extern const stream_template s_RLD_template;
67
#endif /* srlx_INCLUDED */