1 /* Copyright (C) 1994, 2000 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: zfbcp.c,v 1.5 2002/02/21 22:24:54 giles Exp $ */
18 /* (T)BCP filter creation */
19 #include "memory_.h"
20 #include "ghost.h"
21 #include "oper.h"
22 #include "gsstruct.h"
23 #include "ialloc.h"
24 #include "stream.h"
25 #include "strimpl.h"
26 #include "sbcp.h"
27 #include "ifilter.h"
28
29 /* Define null handlers for the BCP out-of-band signals. */
30 private int
no_bcp_signal_interrupt(stream_state * st)31 no_bcp_signal_interrupt(stream_state * st)
32 {
33 return 0;
34 }
35 private int
no_bcp_request_status(stream_state * st)36 no_bcp_request_status(stream_state * st)
37 {
38 return 0;
39 }
40
41 /* <source> BCPEncode/filter <file> */
42 /* <source> <dict> BCPEncode/filter <file> */
43 private int
zBCPE(i_ctx_t * i_ctx_p)44 zBCPE(i_ctx_t *i_ctx_p)
45 {
46 return filter_write_simple(i_ctx_p, &s_BCPE_template);
47 }
48
49 /* <target> BCPDecode/filter <file> */
50 /* <target> <dict> BCPDecode/filter <file> */
51 private int
zBCPD(i_ctx_t * i_ctx_p)52 zBCPD(i_ctx_t *i_ctx_p)
53 {
54 stream_BCPD_state state;
55
56 state.signal_interrupt = no_bcp_signal_interrupt;
57 state.request_status = no_bcp_request_status;
58 return filter_read(i_ctx_p, 0, &s_BCPD_template, (stream_state *)&state, 0);
59 }
60
61 /* <source> TBCPEncode/filter <file> */
62 /* <source> <dict> TBCPEncode/filter <file> */
63 private int
zTBCPE(i_ctx_t * i_ctx_p)64 zTBCPE(i_ctx_t *i_ctx_p)
65 {
66 return filter_write_simple(i_ctx_p, &s_TBCPE_template);
67 }
68
69 /* <target> TBCPDecode/filter <file> */
70 /* <target> <dict> TBCPDecode/filter <file> */
71 private int
zTBCPD(i_ctx_t * i_ctx_p)72 zTBCPD(i_ctx_t *i_ctx_p)
73 {
74 stream_BCPD_state state;
75
76 state.signal_interrupt = no_bcp_signal_interrupt;
77 state.request_status = no_bcp_request_status;
78 return filter_read(i_ctx_p, 0, &s_TBCPD_template, (stream_state *)&state, 0);
79 }
80
81 /* ------ Initialization procedure ------ */
82
83 const op_def zfbcp_op_defs[] =
84 {
85 op_def_begin_filter(),
86 {"1BCPEncode", zBCPE},
87 {"1BCPDecode", zBCPD},
88 {"1TBCPEncode", zTBCPE},
89 {"1TBCPDecode", zTBCPD},
90 op_def_end(0)
91 };
92