2 |
- |
1 |
/* Copyright (C) 1994, 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: interp.h,v 1.6 2003/10/15 08:53:13 igor Exp $ */
|
|
|
18 |
/* Internal interfaces to interp.c and iinit.c */
|
|
|
19 |
|
|
|
20 |
#ifndef interp_INCLUDED
|
|
|
21 |
# define interp_INCLUDED
|
|
|
22 |
|
|
|
23 |
/* ------ iinit.c ------ */
|
|
|
24 |
|
|
|
25 |
/* Enter a name and value into systemdict. */
|
|
|
26 |
int i_initial_enter_name(i_ctx_t *, const char *, const ref *);
|
|
|
27 |
#define initial_enter_name(nstr, pvalue)\
|
|
|
28 |
i_initial_enter_name(i_ctx_p, nstr, pvalue)
|
|
|
29 |
|
|
|
30 |
/* Remove a name from systemdict. */
|
|
|
31 |
void i_initial_remove_name(i_ctx_t *, const char *);
|
|
|
32 |
#define initial_remove_name(nstr)\
|
|
|
33 |
i_initial_remove_name(i_ctx_p, nstr)
|
|
|
34 |
|
|
|
35 |
/* ------ interp.c ------ */
|
|
|
36 |
|
|
|
37 |
/*
|
|
|
38 |
* Maximum number of arguments (and results) for an operator,
|
|
|
39 |
* determined by operand stack block size.
|
|
|
40 |
*/
|
|
|
41 |
extern const int gs_interp_max_op_num_args;
|
|
|
42 |
|
|
|
43 |
/*
|
|
|
44 |
* Number of slots to reserve at the start of op_def_table for
|
|
|
45 |
* operators which are hard-coded into the interpreter loop.
|
|
|
46 |
*/
|
|
|
47 |
extern const int gs_interp_num_special_ops;
|
|
|
48 |
|
|
|
49 |
/*
|
|
|
50 |
* Create an operator during initialization.
|
|
|
51 |
* If operator is hard-coded into the interpreter,
|
|
|
52 |
* assign it a special type and index.
|
|
|
53 |
*/
|
|
|
54 |
void gs_interp_make_oper(ref * opref, op_proc_t, int index);
|
|
|
55 |
|
|
|
56 |
/*
|
|
|
57 |
* Call the garbage collector, updating the context pointer properly.
|
|
|
58 |
*/
|
|
|
59 |
int interp_reclaim(i_ctx_t **pi_ctx_p, int space);
|
|
|
60 |
|
|
|
61 |
/* Get the name corresponding to an error number. */
|
|
|
62 |
int gs_errorname(i_ctx_t *, int, ref *);
|
|
|
63 |
|
|
|
64 |
/* Put a string in $error /errorinfo. */
|
|
|
65 |
int gs_errorinfo_put_string(i_ctx_t *, const char *);
|
|
|
66 |
|
|
|
67 |
/* Initialize the interpreter. */
|
|
|
68 |
int gs_interp_init(i_ctx_t **pi_ctx_p, const ref *psystem_dict,
|
|
|
69 |
gs_dual_memory_t *dmem);
|
|
|
70 |
|
|
|
71 |
#ifndef gs_context_state_t_DEFINED
|
|
|
72 |
# define gs_context_state_t_DEFINED
|
|
|
73 |
typedef struct gs_context_state_s gs_context_state_t;
|
|
|
74 |
#endif
|
|
|
75 |
|
|
|
76 |
/*
|
|
|
77 |
* Create initial stacks for the interpreter.
|
|
|
78 |
* We export this for creating new contexts.
|
|
|
79 |
*/
|
|
|
80 |
int gs_interp_alloc_stacks(gs_ref_memory_t * smem,
|
|
|
81 |
gs_context_state_t * pcst);
|
|
|
82 |
|
|
|
83 |
/*
|
|
|
84 |
* Free the stacks when destroying a context. This is the inverse of
|
|
|
85 |
* create_stacks.
|
|
|
86 |
*/
|
|
|
87 |
void gs_interp_free_stacks(gs_ref_memory_t * smem,
|
|
|
88 |
gs_context_state_t * pcst);
|
|
|
89 |
|
|
|
90 |
/* Reset the interpreter. */
|
|
|
91 |
void gs_interp_reset(i_ctx_t *i_ctx_p);
|
|
|
92 |
|
|
|
93 |
/* Define the top-level interface to the interpreter. */
|
|
|
94 |
int gs_interpret(i_ctx_t **pi_ctx_p, ref * pref, int user_errors,
|
|
|
95 |
int *pexit_code, ref * perror_object);
|
|
|
96 |
|
|
|
97 |
#endif /* interp_INCLUDED */
|