xref: /plan9/sys/src/cmd/gs/src/spsdf.h (revision 593dc095aefb2a85c828727bbfa9da139a49bdf4)
1 /* Copyright (C) 1999 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: spsdf.h,v 1.5 2002/06/16 05:00:54 lpd Exp $ */
18 /* Common output syntax and parameters for PostScript and PDF writers */
19 
20 #ifndef spsdf_INCLUDED
21 #  define spsdf_INCLUDED
22 
23 #include "gsparam.h"
24 
25 /* Define an opaque type for streams. */
26 #ifndef stream_DEFINED
27 #  define stream_DEFINED
28 typedef struct stream_s stream;
29 #endif
30 
31 /* ---------------- Symbolic data printing ---------------- */
32 
33 /* Print a PostScript string in the most efficient form. */
34 #define PRINT_BINARY_OK 1
35 #define PRINT_ASCII85_OK 2
36 #define PRINT_HEX_NOT_OK 4
37 void s_write_ps_string(stream * s, const byte * str, uint size, int print_ok);
38 
39 /*
40  * Create a stream that just keeps track of how much has been written
41  * to it.  We use this for measuring data that will be stored rather
42  * than written to an actual stream.
43  */
44 int s_alloc_position_stream(stream ** ps, gs_memory_t * mem);
45 
46 /*
47  * Create/release a parameter list for printing (non-default) filter
48  * parameters.  This should probably migrate to a lower level....
49  */
50 typedef struct param_printer_params_s {
51     const char *prefix;		/* before entire object, if any params */
52     const char *suffix;		/* after entire object, if any params */
53     const char *item_prefix;	/* before each param */
54     const char *item_suffix;	/* after each param */
55     int print_ok;
56 } param_printer_params_t;
57 /*
58  * The implementation structure should be opaque, but there are a few
59  * clients that need to be able to stack-allocate it.
60  */
61 typedef struct printer_param_list_s {
62     gs_param_list_common;
63     stream *strm;
64     param_printer_params_t params;
65     bool any;
66 } printer_param_list_t;
67 #define private_st_printer_param_list()	/* in spsdf.c */\
68   gs_private_st_ptrs1(st_printer_param_list, printer_param_list_t,\
69     "printer_param_list_t", printer_plist_enum_ptrs, printer_plist_reloc_ptrs,\
70     strm)
71 
72 #define param_printer_params_default_values 0, 0, 0, "\n", 0
73 extern const param_printer_params_t param_printer_params_default;
74 int s_alloc_param_printer(gs_param_list ** pplist,
75 			  const param_printer_params_t * ppp, stream * s,
76 			  gs_memory_t * mem);
77 void s_free_param_printer(gs_param_list * plist);
78 /* Initialize or release a list without allocating or freeing it. */
79 int s_init_param_printer(printer_param_list_t *prlist,
80 			 const param_printer_params_t * ppp, stream * s);
81 void s_release_param_printer(printer_param_list_t *prlist);
82 
83 #endif /* spsdf_INCLUDED */
84