xref: /PHP-5.5/Zend/zend_globals.h (revision 73c1be26)
1 /*
2    +----------------------------------------------------------------------+
3    | Zend Engine                                                          |
4    +----------------------------------------------------------------------+
5    | Copyright (c) 1998-2015 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 #include "zend_float.h"
38 #include "zend_multibyte.h"
39 
40 /* Define ZTS if you want a thread-safe Zend */
41 /*#undef ZTS*/
42 
43 #ifdef ZTS
44 
45 BEGIN_EXTERN_C()
46 ZEND_API extern int compiler_globals_id;
47 ZEND_API extern int executor_globals_id;
48 END_EXTERN_C()
49 
50 #endif
51 
52 #define SYMTABLE_CACHE_SIZE 32
53 
54 
55 #include "zend_compile.h"
56 
57 /* excpt.h on Digital Unix 4.0 defines function_table */
58 #undef function_table
59 
60 #define ZEND_EARLY_BINDING_COMPILE_TIME 0
61 #define ZEND_EARLY_BINDING_DELAYED      1
62 #define ZEND_EARLY_BINDING_DELAYED_ALL  2
63 
64 typedef struct _zend_declarables {
65 	zval ticks;
66 } zend_declarables;
67 
68 typedef struct _zend_vm_stack *zend_vm_stack;
69 typedef struct _zend_ini_entry zend_ini_entry;
70 
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 	zend_op_array *active_op_array;
93 
94 	HashTable *function_table;	/* function symbol table */
95 	HashTable *class_table;		/* class table */
96 
97 	HashTable filenames_table;
98 
99 	HashTable *auto_globals;
100 
101 	zend_bool parse_error;
102 	zend_bool in_compilation;
103 	zend_bool short_tags;
104 	zend_bool asp_tags;
105 
106 	zend_declarables declarables;
107 
108 	zend_bool unclean_shutdown;
109 
110 	zend_bool ini_parser_unbuffered_errors;
111 
112 	zend_llist open_files;
113 
114 	long catch_begin;
115 
116 	struct _zend_ini_parser_param *ini_parser_param;
117 
118 	int interactive;
119 
120 	zend_uint start_lineno;
121 	zend_bool increment_lineno;
122 
123 	znode implementing_class;
124 
125 	zend_uint access_type;
126 
127 	char *doc_comment;
128 	zend_uint doc_comment_len;
129 
130 	zend_uint compiler_options; /* set of ZEND_COMPILE_* constants */
131 
132 	zval      *current_namespace;
133 	HashTable *current_import;
134 	zend_bool  in_namespace;
135 	zend_bool  has_bracketed_namespaces;
136 
137 	zend_compiler_context context;
138 	zend_stack context_stack;
139 
140 	/* interned strings */
141 	char *interned_strings_start;
142 	char *interned_strings_end;
143 	char *interned_strings_top;
144 	char *interned_strings_snapshot_top;
145 
146 	HashTable interned_strings;
147 
148 	const zend_encoding **script_encoding_list;
149 	size_t script_encoding_list_size;
150 	zend_bool multibyte;
151 	zend_bool detect_unicode;
152 	zend_bool encoding_declared;
153 
154 #ifdef ZTS
155 	zval ***static_members_table;
156 	int last_static_member;
157 #endif
158 };
159 
160 
161 struct _zend_executor_globals {
162 	zval **return_value_ptr_ptr;
163 
164 	zval uninitialized_zval;
165 	zval *uninitialized_zval_ptr;
166 
167 	zval error_zval;
168 	zval *error_zval_ptr;
169 
170 	/* symbol table cache */
171 	HashTable *symtable_cache[SYMTABLE_CACHE_SIZE];
172 	HashTable **symtable_cache_limit;
173 	HashTable **symtable_cache_ptr;
174 
175 	zend_op **opline_ptr;
176 
177 	HashTable *active_symbol_table;
178 	HashTable symbol_table;		/* main symbol table */
179 
180 	HashTable included_files;	/* files already included */
181 
182 	JMP_BUF *bailout;
183 
184 	int error_reporting;
185 	int orig_error_reporting;
186 	int exit_status;
187 
188 	zend_op_array *active_op_array;
189 
190 	HashTable *function_table;	/* function symbol table */
191 	HashTable *class_table;		/* class table */
192 	HashTable *zend_constants;	/* constants table */
193 
194 	zend_class_entry *scope;
195 	zend_class_entry *called_scope; /* Scope of the calling class */
196 
197 	zval *This;
198 
199 	long precision;
200 
201 	int ticks_count;
202 
203 	zend_bool in_execution;
204 	HashTable *in_autoload;
205 	zend_function *autoload_func;
206 	zend_bool full_tables_cleanup;
207 
208 	/* for extended information support */
209 	zend_bool no_extensions;
210 
211 #ifdef ZEND_WIN32
212 	zend_bool timed_out;
213 	OSVERSIONINFOEX windows_version_info;
214 #endif
215 
216 	HashTable regular_list;
217 	HashTable persistent_list;
218 
219 	zend_vm_stack argument_stack;
220 
221 	int user_error_handler_error_reporting;
222 	zval *user_error_handler;
223 	zval *user_exception_handler;
224 	zend_stack user_error_handlers_error_reporting;
225 	zend_ptr_stack user_error_handlers;
226 	zend_ptr_stack user_exception_handlers;
227 
228 	zend_error_handling_t  error_handling;
229 	zend_class_entry      *exception_class;
230 
231 	/* timeout support */
232 	int timeout_seconds;
233 
234 	int lambda_count;
235 
236 	HashTable *ini_directives;
237 	HashTable *modified_ini_directives;
238 	zend_ini_entry *error_reporting_ini_entry;
239 
240 	zend_objects_store objects_store;
241 	zval *exception, *prev_exception;
242 	zend_op *opline_before_exception;
243 	zend_op exception_op[3];
244 
245 	struct _zend_execute_data *current_execute_data;
246 
247 	struct _zend_module_entry *current_module;
248 
249 	zend_property_info std_property_info;
250 
251 	zend_bool active;
252 
253 	zend_op *start_op;
254 
255 	void *saved_fpu_cw_ptr;
256 #if XPFPA_HAVE_CW
257 	XPFPA_CW_DATATYPE saved_fpu_cw;
258 #endif
259 
260 	void *reserved[ZEND_MAX_RESERVED_RESOURCES];
261 };
262 
263 struct _zend_ini_scanner_globals {
264 	zend_file_handle *yy_in;
265 	zend_file_handle *yy_out;
266 
267 	unsigned int yy_leng;
268 	unsigned char *yy_start;
269 	unsigned char *yy_text;
270 	unsigned char *yy_cursor;
271 	unsigned char *yy_marker;
272 	unsigned char *yy_limit;
273 	int yy_state;
274 	zend_stack state_stack;
275 
276 	char *filename;
277 	int lineno;
278 
279 	/* Modes are: ZEND_INI_SCANNER_NORMAL, ZEND_INI_SCANNER_RAW */
280 	int scanner_mode;
281 };
282 
283 struct _zend_php_scanner_globals {
284 	zend_file_handle *yy_in;
285 	zend_file_handle *yy_out;
286 
287 	unsigned int yy_leng;
288 	unsigned char *yy_start;
289 	unsigned char *yy_text;
290 	unsigned char *yy_cursor;
291 	unsigned char *yy_marker;
292 	unsigned char *yy_limit;
293 	int yy_state;
294 	zend_stack state_stack;
295 	zend_ptr_stack heredoc_label_stack;
296 
297 	/* original (unfiltered) script */
298 	unsigned char *script_org;
299 	size_t script_org_size;
300 
301 	/* filtered script */
302 	unsigned char *script_filtered;
303 	size_t script_filtered_size;
304 
305 	/* input/output filters */
306 	zend_encoding_filter input_filter;
307 	zend_encoding_filter output_filter;
308 	const zend_encoding *script_encoding;
309 };
310 
311 #endif /* ZEND_GLOBALS_H */
312 
313 /*
314  * Local variables:
315  * tab-width: 4
316  * c-basic-offset: 4
317  * indent-tabs-mode: t
318  * End:
319  */
320