]> git.ipfire.org Git - thirdparty/cups.git/blob - pstoraster/iutil.h
Import cups.org releases
[thirdparty/cups.git] / pstoraster / iutil.h
1 /* Copyright (C) 1991, 1995, 1997, 1998 Aladdin Enterprises. All rights reserved.
2
3 This file is part of GNU Ghostscript.
4
5 GNU Ghostscript is distributed in the hope that it will be useful, but
6 WITHOUT ANY WARRANTY. No author or distributor accepts responsibility
7 to anyone for the consequences of using it or for whether it serves any
8 particular purpose or works at all, unless he says so in writing. Refer
9 to the GNU General Public License for full details.
10
11 Everyone is granted permission to copy, modify and redistribute GNU
12 Ghostscript, but only under the conditions described in the GNU General
13 Public License. A copy of this license is supposed to have been given
14 to you along with GNU Ghostscript so you can know your rights and
15 responsibilities. It should be in a file named COPYING. Among other
16 things, the copyright notice and this notice must be preserved on all
17 copies.
18
19 Aladdin Enterprises supports the work of the GNU Project, but is not
20 affiliated with the Free Software Foundation or the GNU Project. GNU
21 Ghostscript, as distributed by Aladdin Enterprises, does not require any
22 GNU software to build or run it.
23 */
24
25 /*$Id$ */
26 /* Requires imemory.h, ostack.h */
27
28 #ifndef iutil_INCLUDED
29 # define iutil_INCLUDED
30
31 /* ------ Object utilities ------ */
32
33 /* Copy refs from one place to another. */
34 /* (If we are copying to the stack, we can just use memcpy.) */
35 void refcpy_to_new(P3(ref * to, const ref * from, uint size));
36 int refcpy_to_old(P5(ref * aref, uint index, const ref * from, uint size,
37 client_name_t cname));
38
39 /* Fill an array with nulls. */
40 void refset_null(P2(ref * to, uint size));
41
42 /* Compare two objects for equality. */
43 bool obj_eq(P2(const ref *, const ref *));
44
45 /* Compare two objects for identity. */
46 /* (This is not a standard PostScript concept.) */
47 bool obj_ident_eq(P2(const ref *, const ref *));
48
49 /*
50 * Create a printable representation of an object, a la cvs (full_print =
51 * false) or == (full_print = true). Return 0 if OK, <0 if the destination
52 * wasn't large enough or the object's contents weren't readable.
53 * If the object was a string or name, store a pointer to its characters
54 * even if it was too large. Note that if full_print is true, the only
55 * allowed types are boolean, integer, and real.
56 */
57 int obj_cvp(P6(const ref * op, byte * str, uint len, uint * prlen,
58 const byte ** pchars, bool full_print));
59 /* obj_cvs is equivalent to obj_cvp with full_print = false. */
60 int obj_cvs(P5(const ref * op, byte * str, uint len, uint * prlen,
61 const byte ** pchars));
62
63 /* Get an element from an array (packed or not). */
64 int array_get(P3(const ref *, long, ref *));
65
66 /* Get an element from a packed array. */
67 /* (This works for ordinary arrays too.) */
68 /* Source and destination are allowed to overlap if the source is packed, */
69 /* or if they are identical. */
70 void packed_get(P2(const ref_packed *, ref *));
71
72 /* Check to make sure an interval contains no object references */
73 /* to a space younger than a given one. */
74 /* Return 0 or e_invalidaccess. */
75 int refs_check_space(P3(const ref * refs, uint size, uint space));
76
77 /* ------ String utilities ------ */
78
79 /* Convert a C string to a string object. */
80 int string_to_ref(P4(const char *, ref *, gs_ref_memory_t *, client_name_t));
81
82 /* Convert a string object to a C string. */
83 /* Return 0 iff the buffer can't be allocated. */
84 char *ref_to_string(P3(const ref *, gs_memory_t *, client_name_t));
85
86 /* ------ Operand utilities ------ */
87
88 /* Get N numeric operands from the stack or an array. */
89 int num_params(P3(const ref *, int, double *));
90
91 /* float_params can lose accuracy for large integers. */
92 int float_params(P3(const ref *, int, float *));
93
94 /* Get a single real parameter. */
95 /* The only possible error is e_typecheck. */
96 int real_param(P2(const ref *, double *));
97
98 /* float_param can lose accuracy for large integers. */
99 int float_param(P2(const ref *, float *));
100
101 /* Get an integer parameter in a given range. */
102 int int_param(P3(const ref *, int, int *));
103
104 /* Make real values on the stack. */
105 /* Return e_limitcheck for infinities or double->float overflow. */
106 int make_reals(P3(ref *, const double *, int));
107 int make_floats(P3(ref *, const float *, int));
108
109 /* Define the gs_matrix type if necessary. */
110 #ifndef gs_matrix_DEFINED
111 # define gs_matrix_DEFINED
112 typedef struct gs_matrix_s gs_matrix;
113 #endif
114
115 /* Read a matrix operand. */
116 int read_matrix(P2(const ref *, gs_matrix *));
117
118 /* Write a matrix operand. */
119 int write_matrix(P2(ref *, const gs_matrix *));
120
121 #endif /* iutil_INCLUDED */