1 /* 2 +----------------------------------------------------------------------+ 3 | Zend Engine | 4 +----------------------------------------------------------------------+ 5 | Copyright (c) 1998-2014 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 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 parse_error; 105 zend_bool in_compilation; 106 zend_bool short_tags; 107 zend_bool asp_tags; 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 zend_compiler_context context; 141 zend_stack context_stack; 142 143 /* interned strings */ 144 char *interned_strings_start; 145 char *interned_strings_end; 146 char *interned_strings_top; 147 char *interned_strings_snapshot_top; 148 149 HashTable interned_strings; 150 151 const zend_encoding **script_encoding_list; 152 size_t script_encoding_list_size; 153 zend_bool multibyte; 154 zend_bool detect_unicode; 155 zend_bool encoding_declared; 156 157 #ifdef ZTS 158 zval ***static_members_table; 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 zend_ini_entry *error_reporting_ini_entry; 244 245 zend_objects_store objects_store; 246 zval *exception, *prev_exception; 247 zend_op *opline_before_exception; 248 zend_op exception_op[3]; 249 250 struct _zend_execute_data *current_execute_data; 251 252 struct _zend_module_entry *current_module; 253 254 zend_property_info std_property_info; 255 256 zend_bool active; 257 258 zend_op *start_op; 259 260 void *saved_fpu_cw_ptr; 261 #if XPFPA_HAVE_CW 262 XPFPA_CW_DATATYPE saved_fpu_cw; 263 #endif 264 265 void *reserved[ZEND_MAX_RESERVED_RESOURCES]; 266 }; 267 268 struct _zend_ini_scanner_globals { 269 zend_file_handle *yy_in; 270 zend_file_handle *yy_out; 271 272 unsigned int yy_leng; 273 unsigned char *yy_start; 274 unsigned char *yy_text; 275 unsigned char *yy_cursor; 276 unsigned char *yy_marker; 277 unsigned char *yy_limit; 278 int yy_state; 279 zend_stack state_stack; 280 281 char *filename; 282 int lineno; 283 284 /* Modes are: ZEND_INI_SCANNER_NORMAL, ZEND_INI_SCANNER_RAW */ 285 int scanner_mode; 286 }; 287 288 struct _zend_php_scanner_globals { 289 zend_file_handle *yy_in; 290 zend_file_handle *yy_out; 291 292 unsigned int yy_leng; 293 unsigned char *yy_start; 294 unsigned char *yy_text; 295 unsigned char *yy_cursor; 296 unsigned char *yy_marker; 297 unsigned char *yy_limit; 298 int yy_state; 299 zend_stack state_stack; 300 301 /* original (unfiltered) script */ 302 unsigned char *script_org; 303 size_t script_org_size; 304 305 /* filtered script */ 306 unsigned char *script_filtered; 307 size_t script_filtered_size; 308 309 /* input/output filters */ 310 zend_encoding_filter input_filter; 311 zend_encoding_filter output_filter; 312 const zend_encoding *script_encoding; 313 }; 314 315 #endif /* ZEND_GLOBALS_H */ 316 317 /* 318 * Local variables: 319 * tab-width: 4 320 * c-basic-offset: 4 321 * indent-tabs-mode: t 322 * End: 323 */ 324