xref: /plan9/sys/src/cmd/gs/src/iesdata.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: iesdata.h,v 1.4 2002/02/21 22:24:53 giles Exp $ */
18 /* Generic execution stack structure definition */
19 
20 #ifndef iesdata_INCLUDED
21 #  define iesdata_INCLUDED
22 
23 #include "isdata.h"
24 
25 /* Define the execution stack structure. */
26 typedef struct exec_stack_s {
27 
28     ref_stack_t stack;		/* the actual execution stack */
29 
30 /*
31  * To improve performance, we cache the currentfile pointer
32  * (i.e., `shallow-bind' it in Lisp terminology).  The invariant is as
33  * follows: either esfile points to the currentfile slot on the estack
34  * (i.e., the topmost slot with an executable file), or it is 0.
35  * To maintain the invariant, it is sufficient that whenever a routine
36  * pushes or pops anything on the estack, if the object *might* be
37  * an executable file, invoke esfile_clear_cache(); alternatively,
38  * immediately after pushing an object, invoke esfile_check_cache().
39  */
40     ref *current_file;
41 
42 } exec_stack_t;
43 
44 /*
45  * current_file is cleared by garbage collection, so we don't declare it
46  * as a pointer.
47  */
48 #define public_st_exec_stack()	/* in interp.c */\
49   gs_public_st_suffix_add0(st_exec_stack, exec_stack_t, "exec_stack_t",\
50     exec_stack_enum_ptrs, exec_stack_reloc_ptrs, st_ref_stack)
51 #define st_exec_stack_num_ptrs st_ref_stack_num_ptrs
52 
53 #endif /* iesdata_INCLUDED */
54