xref: /PHP-5.6/Zend/zend_globals.h (revision 3537e95d)
1 /*
2    +----------------------------------------------------------------------+
3    | Zend Engine                                                          |
4    +----------------------------------------------------------------------+
5    | Copyright (c) 1998-2016 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 	HashTable *current_import_function;
135 	HashTable *current_import_const;
136 	zend_bool  in_namespace;
137 	zend_bool  has_bracketed_namespaces;
138 
139 	HashTable const_filenames;
140 
141 	zend_compiler_context context;
142 	zend_stack context_stack;
143 
144 	/* interned strings */
145 	char *interned_strings_start;
146 	char *interned_strings_end;
147 	char *interned_strings_top;
148 	char *interned_strings_snapshot_top;
149 #ifndef ZTS
150 	char *interned_empty_string;
151 #endif
152 
153 	HashTable interned_strings;
154 
155 	const zend_encoding **script_encoding_list;
156 	size_t script_encoding_list_size;
157 	zend_bool multibyte;
158 	zend_bool detect_unicode;
159 	zend_bool encoding_declared;
160 
161 #ifdef ZTS
162 	zval ***static_members_table;
163 	int last_static_member;
164 #endif
165 };
166 
167 
168 struct _zend_executor_globals {
169 	zval **return_value_ptr_ptr;
170 
171 	zval uninitialized_zval;
172 	zval *uninitialized_zval_ptr;
173 
174 	zval error_zval;
175 	zval *error_zval_ptr;
176 
177 	/* symbol table cache */
178 	HashTable *symtable_cache[SYMTABLE_CACHE_SIZE];
179 	HashTable **symtable_cache_limit;
180 	HashTable **symtable_cache_ptr;
181 
182 	zend_op **opline_ptr;
183 
184 	HashTable *active_symbol_table;
185 	HashTable symbol_table;		/* main symbol table */
186 
187 	HashTable included_files;	/* files already included */
188 
189 	JMP_BUF *bailout;
190 
191 	int error_reporting;
192 	int orig_error_reporting;
193 	int exit_status;
194 
195 	zend_op_array *active_op_array;
196 
197 	HashTable *function_table;	/* function symbol table */
198 	HashTable *class_table;		/* class table */
199 	HashTable *zend_constants;	/* constants table */
200 
201 	zend_class_entry *scope;
202 	zend_class_entry *called_scope; /* Scope of the calling class */
203 
204 	zval *This;
205 
206 	long precision;
207 
208 	int ticks_count;
209 
210 	zend_bool in_execution;
211 	HashTable *in_autoload;
212 	zend_function *autoload_func;
213 	zend_bool full_tables_cleanup;
214 
215 	/* for extended information support */
216 	zend_bool no_extensions;
217 
218 #ifdef ZEND_WIN32
219 	zend_bool timed_out;
220 	OSVERSIONINFOEX windows_version_info;
221 #endif
222 
223 	HashTable regular_list;
224 	HashTable persistent_list;
225 
226 	zend_vm_stack argument_stack;
227 
228 	int user_error_handler_error_reporting;
229 	zval *user_error_handler;
230 	zval *user_exception_handler;
231 	zend_stack user_error_handlers_error_reporting;
232 	zend_ptr_stack user_error_handlers;
233 	zend_ptr_stack user_exception_handlers;
234 
235 	zend_error_handling_t  error_handling;
236 	zend_class_entry      *exception_class;
237 
238 	/* timeout support */
239 	int timeout_seconds;
240 
241 	int lambda_count;
242 
243 	HashTable *ini_directives;
244 	HashTable *modified_ini_directives;
245 	zend_ini_entry *error_reporting_ini_entry;
246 
247 	zend_objects_store objects_store;
248 	zval *exception, *prev_exception;
249 	zend_op *opline_before_exception;
250 	zend_op exception_op[3];
251 
252 	struct _zend_execute_data *current_execute_data;
253 
254 	struct _zend_module_entry *current_module;
255 
256 	zend_property_info std_property_info;
257 
258 	zend_bool active;
259 
260 	zend_op *start_op;
261 
262 	void *saved_fpu_cw_ptr;
263 #if XPFPA_HAVE_CW
264 	XPFPA_CW_DATATYPE saved_fpu_cw;
265 #endif
266 
267 	void *reserved[ZEND_MAX_RESERVED_RESOURCES];
268 };
269 
270 struct _zend_ini_scanner_globals {
271 	zend_file_handle *yy_in;
272 	zend_file_handle *yy_out;
273 
274 	unsigned int yy_leng;
275 	unsigned char *yy_start;
276 	unsigned char *yy_text;
277 	unsigned char *yy_cursor;
278 	unsigned char *yy_marker;
279 	unsigned char *yy_limit;
280 	int yy_state;
281 	zend_stack state_stack;
282 
283 	char *filename;
284 	int lineno;
285 
286 	/* Modes are: ZEND_INI_SCANNER_NORMAL, ZEND_INI_SCANNER_RAW, ZEND_INI_SCANNER_TYPED */
287 	int scanner_mode;
288 };
289 
290 struct _zend_php_scanner_globals {
291 	zend_file_handle *yy_in;
292 	zend_file_handle *yy_out;
293 
294 	unsigned int yy_leng;
295 	unsigned char *yy_start;
296 	unsigned char *yy_text;
297 	unsigned char *yy_cursor;
298 	unsigned char *yy_marker;
299 	unsigned char *yy_limit;
300 	int yy_state;
301 	zend_stack state_stack;
302 	zend_ptr_stack heredoc_label_stack;
303 
304 	/* original (unfiltered) script */
305 	unsigned char *script_org;
306 	size_t script_org_size;
307 
308 	/* filtered script */
309 	unsigned char *script_filtered;
310 	size_t script_filtered_size;
311 
312 	/* input/output filters */
313 	zend_encoding_filter input_filter;
314 	zend_encoding_filter output_filter;
315 	const zend_encoding *script_encoding;
316 };
317 
318 #endif /* ZEND_GLOBALS_H */
319 
320 /*
321  * Local variables:
322  * tab-width: 4
323  * c-basic-offset: 4
324  * indent-tabs-mode: t
325  * End:
326  */
327