]>
git.ipfire.org Git - thirdparty/cups.git/blob - pstoraster/zmisc3.c
1 /* Copyright (C) 1997, 1998 Aladdin Enterprises. All rights reserved.
3 This file is part of GNU Ghostscript.
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.
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
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.
26 /* Miscellaneous LanguageLevel 3 operators */
37 return gs_clipsave(igs
);
42 zcliprestore(os_ptr op
)
44 return gs_cliprestore(igs
);
47 /* <proc1> <proc2> .eqproc <bool> */
49 * Test whether two procedures are equal to depth 10.
50 * This is the equality test used by idiom recognition in 'bind'.
52 #define MAX_DEPTH 10 /* depth is per Adobe specification */
53 typedef struct ref2_s
{
57 zeqproc(register os_ptr op
)
59 ref2_t stack
[MAX_DEPTH
+ 1];
62 make_array(&stack
[0].proc1
, 0, 1, op
- 1);
63 make_array(&stack
[0].proc2
, 0, 1, op
);
67 if (r_size(&top
->proc1
) == 0) {
68 /* Finished these arrays, go up to next level. */
70 /* We're done matching: it succeeded. */
78 /* Look at the next elements of the arrays. */
79 i
= r_size(&top
->proc1
) - 1;
80 array_get(&top
->proc1
, i
, &top
[1].proc1
);
81 array_get(&top
->proc2
, i
, &top
[1].proc2
);
82 r_dec_size(&top
->proc1
, 1);
85 * Amazingly enough, the objects' executable attributes are not
86 * required to match. This means { x load } will match { /x load },
87 * even though this is clearly wrong.
90 if (r_has_attr(&top
->proc1
, a_executable
) !=
91 r_has_attr(&top
->proc2
, a_executable
)
95 if (obj_eq(&top
->proc1
, &top
->proc2
)) {
96 /* Names don't match strings. */
97 if (r_type(&top
->proc1
) != r_type(&top
->proc2
) &&
98 (r_type(&top
->proc1
) == t_name
||
99 r_type(&top
->proc2
) == t_name
)
102 --top
; /* no recursion */
105 if (r_is_array(&top
->proc1
) && r_is_array(&top
->proc2
) &&
106 r_size(&top
->proc1
) == r_size(&top
->proc2
) &&
107 top
< stack
+ (MAX_DEPTH
- 1)
109 /* Descend into the arrays. */
114 /* An exit from the loop indicates that matching failed. */
120 /* ------ Initialization procedure ------ */
122 const op_def zmisc3_op_defs
[] =
125 {"0cliprestore", zcliprestore
},
126 {"0clipsave", zclipsave
},
127 {"2.eqproc", zeqproc
},