xref: /PHP-5.3/Zend/zend_globals.h (revision 831fbcf3)
1 /*
2    +----------------------------------------------------------------------+
3    | Zend Engine                                                          |
4    +----------------------------------------------------------------------+
5    | Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
6    +----------------------------------------------------------------------+
7    | This source file is subject to version 2.00 of the Zend license,     |
8    | that is bundled with this package in the file LICENSE, and is        |
9    | available through the world-wide-web at the following url:           |
10    | http://www.zend.com/license/2_00.txt.                                |
11    | If you did not receive a copy of the Zend license and are unable to  |
12    | obtain it through the world-wide-web, please send a note to          |
13    | license@zend.com so we can mail you a copy immediately.              |
14    +----------------------------------------------------------------------+
15    | Authors: Andi Gutmans <andi@zend.com>                                |
16    |          Zeev Suraski <zeev@zend.com>                                |
17    +----------------------------------------------------------------------+
18 */
19 
20 /* $Id$ */
21 
22 #ifndef ZEND_GLOBALS_H
23 #define ZEND_GLOBALS_H
24 
25 
26 #include <setjmp.h>
27 
28 #include "zend_globals_macros.h"
29 
30 #include "zend_stack.h"
31 #include "zend_ptr_stack.h"
32 #include "zend_hash.h"
33 #include "zend_llist.h"
34 #include "zend_objects.h"
35 #include "zend_objects_API.h"
36 #include "zend_modules.h"
37 
38 #ifdef ZEND_MULTIBYTE
39 #include "zend_multibyte.h"
40 #endif /* ZEND_MULTIBYTE */
41 
42 /* Define ZTS if you want a thread-safe Zend */
43 /*#undef ZTS*/
44 
45 #ifdef ZTS
46 
47 BEGIN_EXTERN_C()
48 ZEND_API extern int compiler_globals_id;
49 ZEND_API extern int executor_globals_id;
50 END_EXTERN_C()
51 
52 #endif
53 
54 #define SYMTABLE_CACHE_SIZE 32
55 
56 
57 #include "zend_compile.h"
58 
59 /* excpt.h on Digital Unix 4.0 defines function_table */
60 #undef function_table
61 
62 #define ZEND_EARLY_BINDING_COMPILE_TIME 0
63 #define ZEND_EARLY_BINDING_DELAYED      1
64 #define ZEND_EARLY_BINDING_DELAYED_ALL  2
65 
66 typedef struct _zend_declarables {
67 	zval ticks;
68 } zend_declarables;
69 
70 typedef struct _zend_vm_stack *zend_vm_stack;
71 
72 struct _zend_compiler_globals {
73 	zend_stack bp_stack;
74 	zend_stack switch_cond_stack;
75 	zend_stack foreach_copy_stack;
76 	zend_stack object_stack;
77 	zend_stack declare_stack;
78 
79 	zend_class_entry *active_class_entry;
80 
81 	/* variables for list() compilation */
82 	zend_llist list_llist;
83 	zend_llist dimension_llist;
84 	zend_stack list_stack;
85 
86 	zend_stack function_call_stack;
87 
88 	char *compiled_filename;
89 
90 	int zend_lineno;
91 
92 	char *heredoc;
93 	int heredoc_len;
94 
95 	zend_op_array *active_op_array;
96 
97 	HashTable *function_table;	/* function symbol table */
98 	HashTable *class_table;		/* class table */
99 
100 	HashTable filenames_table;
101 
102 	HashTable *auto_globals;
103 
104 	zend_bool in_compilation;
105 	zend_bool short_tags;
106 	zend_bool asp_tags;
107 	zend_bool allow_call_time_pass_reference;
108 
109 	zend_declarables declarables;
110 
111 	zend_bool unclean_shutdown;
112 
113 	zend_bool ini_parser_unbuffered_errors;
114 
115 	zend_llist open_files;
116 
117 	long catch_begin;
118 
119 	struct _zend_ini_parser_param *ini_parser_param;
120 
121 	int interactive;
122 
123 	zend_uint start_lineno;
124 	zend_bool increment_lineno;
125 
126 	znode implementing_class;
127 
128 	zend_uint access_type;
129 
130 	char *doc_comment;
131 	zend_uint doc_comment_len;
132 
133 	zend_uint compiler_options; /* set of ZEND_COMPILE_* constants */
134 
135 	zval      *current_namespace;
136 	HashTable *current_import;
137 	zend_bool  in_namespace;
138 	zend_bool  has_bracketed_namespaces;
139 
140 	HashTable *labels;
141 	zend_stack labels_stack;
142 
143 #ifdef ZEND_MULTIBYTE
144 	zend_encoding **script_encoding_list;
145 	size_t script_encoding_list_size;
146 	zend_bool detect_unicode;
147 	zend_bool encoding_declared;
148 
149 	zend_encoding *internal_encoding;
150 
151 	/* multibyte utility functions */
152 	zend_encoding_detector encoding_detector;
153 	zend_encoding_converter encoding_converter;
154 	zend_encoding_oddlen encoding_oddlen;
155 #endif /* ZEND_MULTIBYTE */
156 
157 #ifdef ZTS
158 	HashTable **static_members;
159 	int last_static_member;
160 #endif
161 };
162 
163 
164 struct _zend_executor_globals {
165 	zval **return_value_ptr_ptr;
166 
167 	zval uninitialized_zval;
168 	zval *uninitialized_zval_ptr;
169 
170 	zval error_zval;
171 	zval *error_zval_ptr;
172 
173 	zend_ptr_stack arg_types_stack;
174 
175 	/* symbol table cache */
176 	HashTable *symtable_cache[SYMTABLE_CACHE_SIZE];
177 	HashTable **symtable_cache_limit;
178 	HashTable **symtable_cache_ptr;
179 
180 	zend_op **opline_ptr;
181 
182 	HashTable *active_symbol_table;
183 	HashTable symbol_table;		/* main symbol table */
184 
185 	HashTable included_files;	/* files already included */
186 
187 	JMP_BUF *bailout;
188 
189 	int error_reporting;
190 	int orig_error_reporting;
191 	int exit_status;
192 
193 	zend_op_array *active_op_array;
194 
195 	HashTable *function_table;	/* function symbol table */
196 	HashTable *class_table;		/* class table */
197 	HashTable *zend_constants;	/* constants table */
198 
199 	zend_class_entry *scope;
200 	zend_class_entry *called_scope; /* Scope of the calling class */
201 
202 	zval *This;
203 
204 	long precision;
205 
206 	int ticks_count;
207 
208 	zend_bool in_execution;
209 	HashTable *in_autoload;
210 	zend_function *autoload_func;
211 	zend_bool full_tables_cleanup;
212 
213 	/* for extended information support */
214 	zend_bool no_extensions;
215 
216 #ifdef ZEND_WIN32
217 	zend_bool timed_out;
218 	OSVERSIONINFOEX windows_version_info;
219 #endif
220 
221 	HashTable regular_list;
222 	HashTable persistent_list;
223 
224 	zend_vm_stack argument_stack;
225 
226 	int user_error_handler_error_reporting;
227 	zval *user_error_handler;
228 	zval *user_exception_handler;
229 	zend_stack user_error_handlers_error_reporting;
230 	zend_ptr_stack user_error_handlers;
231 	zend_ptr_stack user_exception_handlers;
232 
233 	zend_error_handling_t  error_handling;
234 	zend_class_entry      *exception_class;
235 
236 	/* timeout support */
237 	int timeout_seconds;
238 
239 	int lambda_count;
240 
241 	HashTable *ini_directives;
242 	HashTable *modified_ini_directives;
243 
244 	zend_objects_store objects_store;
245 	zval *exception, *prev_exception;
246 	zend_op *opline_before_exception;
247 	zend_op exception_op[3];
248 
249 	struct _zend_execute_data *current_execute_data;
250 
251 	struct _zend_module_entry *current_module;
252 
253 	zend_property_info std_property_info;
254 
255 	zend_bool active;
256 
257 	void *saved_fpu_cw;
258 
259 	void *reserved[ZEND_MAX_RESERVED_RESOURCES];
260 };
261 
262 struct _zend_ini_scanner_globals {
263 	zend_file_handle *yy_in;
264 	zend_file_handle *yy_out;
265 
266 	unsigned int yy_leng;
267 	unsigned char *yy_start;
268 	unsigned char *yy_text;
269 	unsigned char *yy_cursor;
270 	unsigned char *yy_marker;
271 	unsigned char *yy_limit;
272 	int yy_state;
273 	zend_stack state_stack;
274 
275 	char *filename;
276 	int lineno;
277 
278 	/* Modes are: ZEND_INI_SCANNER_NORMAL, ZEND_INI_SCANNER_RAW */
279 	int scanner_mode;
280 };
281 
282 struct _zend_php_scanner_globals {
283 	zend_file_handle *yy_in;
284 	zend_file_handle *yy_out;
285 
286 	unsigned int yy_leng;
287 	unsigned char *yy_start;
288 	unsigned char *yy_text;
289 	unsigned char *yy_cursor;
290 	unsigned char *yy_marker;
291 	unsigned char *yy_limit;
292 	int yy_state;
293 	zend_stack state_stack;
294 
295 #ifdef ZEND_MULTIBYTE
296 	/* original (unfiltered) script */
297 	unsigned char *script_org;
298 	size_t script_org_size;
299 
300 	/* filtered script */
301 	unsigned char *script_filtered;
302 	size_t script_filtered_size;
303 
304 	/* input/ouput filters */
305 	zend_encoding_filter input_filter;
306 	zend_encoding_filter output_filter;
307 	zend_encoding *script_encoding;
308 	zend_encoding *internal_encoding;
309 #endif /* ZEND_MULTIBYTE */
310 };
311 
312 #endif /* ZEND_GLOBALS_H */
313 
314 /*
315  * Local variables:
316  * tab-width: 4
317  * c-basic-offset: 4
318  * indent-tabs-mode: t
319  * End:
320  */
321