1 /* 2 +----------------------------------------------------------------------+ 3 | Zend Engine | 4 +----------------------------------------------------------------------+ 5 | Copyright (c) 1998-2017 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 #include "zend_multiply.h" 40 #include "zend_arena.h" 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_vm_stack *zend_vm_stack; 67 typedef struct _zend_ini_entry zend_ini_entry; 68 69 70 struct _zend_compiler_globals { 71 zend_stack loop_var_stack; 72 73 zend_class_entry *active_class_entry; 74 75 zend_string *compiled_filename; 76 77 int zend_lineno; 78 79 zend_op_array *active_op_array; 80 81 HashTable *function_table; /* function symbol table */ 82 HashTable *class_table; /* class table */ 83 84 HashTable filenames_table; 85 86 HashTable *auto_globals; 87 88 zend_bool parse_error; 89 zend_bool in_compilation; 90 zend_bool short_tags; 91 92 zend_bool unclean_shutdown; 93 94 zend_bool ini_parser_unbuffered_errors; 95 96 zend_llist open_files; 97 98 struct _zend_ini_parser_param *ini_parser_param; 99 100 uint32_t start_lineno; 101 zend_bool increment_lineno; 102 103 zend_string *doc_comment; 104 105 uint32_t compiler_options; /* set of ZEND_COMPILE_* constants */ 106 107 HashTable const_filenames; 108 109 zend_oparray_context context; 110 zend_file_context file_context; 111 112 zend_arena *arena; 113 114 zend_string *empty_string; 115 zend_string *one_char_string[256]; 116 117 HashTable interned_strings; 118 119 const zend_encoding **script_encoding_list; 120 size_t script_encoding_list_size; 121 zend_bool multibyte; 122 zend_bool detect_unicode; 123 zend_bool encoding_declared; 124 125 zend_ast *ast; 126 zend_arena *ast_arena; 127 128 zend_stack delayed_oplines_stack; 129 130 #ifdef ZTS 131 zval **static_members_table; 132 int last_static_member; 133 #endif 134 }; 135 136 137 struct _zend_executor_globals { 138 zval uninitialized_zval; 139 zval error_zval; 140 141 /* symbol table cache */ 142 zend_array *symtable_cache[SYMTABLE_CACHE_SIZE]; 143 zend_array **symtable_cache_limit; 144 zend_array **symtable_cache_ptr; 145 146 zend_array symbol_table; /* main symbol table */ 147 148 HashTable included_files; /* files already included */ 149 150 JMP_BUF *bailout; 151 152 int error_reporting; 153 int exit_status; 154 155 HashTable *function_table; /* function symbol table */ 156 HashTable *class_table; /* class table */ 157 HashTable *zend_constants; /* constants table */ 158 159 zval *vm_stack_top; 160 zval *vm_stack_end; 161 zend_vm_stack vm_stack; 162 163 struct _zend_execute_data *current_execute_data; 164 zend_class_entry *scope; 165 166 zend_long precision; 167 168 int ticks_count; 169 170 HashTable *in_autoload; 171 zend_function *autoload_func; 172 zend_bool full_tables_cleanup; 173 174 /* for extended information support */ 175 zend_bool no_extensions; 176 177 #ifdef ZEND_WIN32 178 zend_bool timed_out; 179 OSVERSIONINFOEX windows_version_info; 180 #endif 181 182 HashTable regular_list; 183 HashTable persistent_list; 184 185 int user_error_handler_error_reporting; 186 zval user_error_handler; 187 zval user_exception_handler; 188 zend_stack user_error_handlers_error_reporting; 189 zend_stack user_error_handlers; 190 zend_stack user_exception_handlers; 191 192 zend_error_handling_t error_handling; 193 zend_class_entry *exception_class; 194 195 /* timeout support */ 196 zend_long timeout_seconds; 197 198 int lambda_count; 199 200 HashTable *ini_directives; 201 HashTable *modified_ini_directives; 202 zend_ini_entry *error_reporting_ini_entry; 203 204 zend_objects_store objects_store; 205 zend_object *exception, *prev_exception; 206 const zend_op *opline_before_exception; 207 zend_op exception_op[3]; 208 209 struct _zend_module_entry *current_module; 210 211 zend_bool active; 212 zend_bool valid_symbol_table; 213 214 zend_long assertions; 215 216 uint32_t ht_iterators_count; /* number of allocatd slots */ 217 uint32_t ht_iterators_used; /* number of used slots */ 218 HashTableIterator *ht_iterators; 219 HashTableIterator ht_iterators_slots[16]; 220 221 void *saved_fpu_cw_ptr; 222 #if XPFPA_HAVE_CW 223 XPFPA_CW_DATATYPE saved_fpu_cw; 224 #endif 225 226 zend_function trampoline; 227 zend_op call_trampoline_op; 228 229 void *reserved[ZEND_MAX_RESERVED_RESOURCES]; 230 }; 231 232 struct _zend_ini_scanner_globals { 233 zend_file_handle *yy_in; 234 zend_file_handle *yy_out; 235 236 unsigned int yy_leng; 237 unsigned char *yy_start; 238 unsigned char *yy_text; 239 unsigned char *yy_cursor; 240 unsigned char *yy_marker; 241 unsigned char *yy_limit; 242 int yy_state; 243 zend_stack state_stack; 244 245 char *filename; 246 int lineno; 247 248 /* Modes are: ZEND_INI_SCANNER_NORMAL, ZEND_INI_SCANNER_RAW, ZEND_INI_SCANNER_TYPED */ 249 int scanner_mode; 250 }; 251 252 typedef enum { 253 ON_TOKEN, 254 ON_FEEDBACK, 255 ON_STOP 256 } zend_php_scanner_event; 257 258 struct _zend_php_scanner_globals { 259 zend_file_handle *yy_in; 260 zend_file_handle *yy_out; 261 262 unsigned int yy_leng; 263 unsigned char *yy_start; 264 unsigned char *yy_text; 265 unsigned char *yy_cursor; 266 unsigned char *yy_marker; 267 unsigned char *yy_limit; 268 int yy_state; 269 zend_stack state_stack; 270 zend_ptr_stack heredoc_label_stack; 271 272 /* original (unfiltered) script */ 273 unsigned char *script_org; 274 size_t script_org_size; 275 276 /* filtered script */ 277 unsigned char *script_filtered; 278 size_t script_filtered_size; 279 280 /* input/output filters */ 281 zend_encoding_filter input_filter; 282 zend_encoding_filter output_filter; 283 const zend_encoding *script_encoding; 284 285 /* initial string length after scanning to first variable */ 286 int scanned_string_len; 287 288 /* hooks */ 289 void (* on_event)(zend_php_scanner_event event, int token, int line); 290 }; 291 292 #endif /* ZEND_GLOBALS_H */ 293 294 /* 295 * Local variables: 296 * tab-width: 4 297 * c-basic-offset: 4 298 * indent-tabs-mode: t 299 * End: 300 */ 301