xref: /plan9/sys/src/cmd/gs/src/gsparams.h (revision 593dc095aefb2a85c828727bbfa9da139a49bdf4)
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: gsparams.h,v 1.5 2002/06/16 08:45:42 lpd Exp $ */
18 /* Serializer/expander for gs_parm_list's */
19 
20 #ifndef gsparams_INCLUDED
21 #  define gsparams_INCLUDED
22 
23 /* Initial version 2/1/98 by John Desrosiers (soho@crl.com) */
24 /* 8/8/98 L. Peter Deutsch (ghost@aladdin.com) Completely redesigned
25    to use stream rather than buffer API (but retained former API for
26    compatibility as well). */
27 
28 #include "stream.h"
29 #include "gsparam.h"
30 
31 #if 0	/****************/
32 
33 /* ------ Future interface, implemented in gsparam2.c ------ */
34 
35 /*
36  * Serialize the contents of a gs_param_list, including sub-collections,
37  * onto a stream.  The list must be in READ mode.
38  */
39 int gs_param_list_puts(stream *dest, gs_param_list *list);
40 
41 /*
42  * Unserialize a parameter list, including sub-collections, from a stream.
43  * The list must be in WRITE mode.
44  */
45 int gs_param_list_gets(stream *src, gs_param_list *list, gs_memory_t *mem);
46 
47 #else	/****************/
48 
49 /* ------ Present interface, implemented in gsparams.c ------ */
50 
51 /*
52  * Serialize a parameter list into a buffer.  Return the actual number
53  * of bytes required to store the list, or a negative error code.
54  * The list was stored successfully iff the return value is positive and
55  * less than or equal to the buffer size.  Note that the buffer may be
56  * NULL, in which case nothing is stored (but the size is still returned).
57  */
58 int gs_param_list_serialize(gs_param_list *list, byte *buf, int buf_size);
59 
60 /*
61  * Unserialize a parameter list from a buffer.  Return the actual number
62  * of bytes occupied by the list, or a negative error code.  The buffer
63  * must be void * aligned.
64  */
65 int gs_param_list_unserialize(gs_param_list *list, const byte *buf);
66 
67 #endif	/****************/
68 
69 #endif /* gsparams_INCLUDED */
70