Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 186 lines (158 sloc) 5.746 kb
573b460 @andigutmans Zend Library
andigutmans authored
1 /*
2 +----------------------------------------------------------------------+
3 | Zend Engine |
4 +----------------------------------------------------------------------+
ccfc46b - Happy new year and PHP 5 for rest of the files too..
foobar authored
5 | Copyright (c) 1998-2004 Zend Technologies Ltd. (http://www.zend.com) |
573b460 @andigutmans Zend Library
andigutmans authored
6 +----------------------------------------------------------------------+
d863d52 Update headers.
Sebastian Bergmann authored
7 | This source file is subject to version 2.00 of the Zend license, |
b5b1117 @zsuraski License update
zsuraski authored
8 | that is bundled with this package in the file LICENSE, and is |
f68c7ff updating license information in the headers.
James Cox authored
9 | available through the world-wide-web at the following url: |
d863d52 Update headers.
Sebastian Bergmann authored
10 | http://www.zend.com/license/2_00.txt. |
b5b1117 @zsuraski License update
zsuraski authored
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. |
573b460 @andigutmans Zend Library
andigutmans authored
14 +----------------------------------------------------------------------+
15 | Authors: Andi Gutmans <andi@zend.com> |
16 | Zeev Suraski <zeev@zend.com> |
17 +----------------------------------------------------------------------+
18 */
19
333406b - Added some missing CVS $Id$ tags, headers and footers.
foobar authored
20 /* $Id$ */
b5b1117 @zsuraski License update
zsuraski authored
21
a617217 Replace macros which begin with an underscore through an appropiately
Sascha Schumann authored
22 #ifndef ZEND_EXECUTE_H
23 #define ZEND_EXECUTE_H
573b460 @andigutmans Zend Library
andigutmans authored
24
25 #include "zend_compile.h"
26 #include "zend_hash.h"
df74f1d Add optional support for C0x inline semantics.
Sascha Schumann authored
27 #include "zend_variables.h"
51b9245 @andigutmans - More object junk
andigutmans authored
28 #include "zend_operators.h"
573b460 @andigutmans Zend Library
andigutmans authored
29
1250c43 @zsuraski * Add struct name to all typedef's so that they can be debugged with …
zsuraski authored
30 typedef union _temp_variable {
573b460 @andigutmans Zend Library
andigutmans authored
31 zval tmp_var;
4fff038 @andigutmans - Changed Ts{}.var to Ts{}.var.ptr_ptr.
andigutmans authored
32 struct {
33 zval **ptr_ptr;
b56fd46 @andigutmans - First part of the patch which makes reads use ptr and not ptr_ptr.
andigutmans authored
34 zval *ptr;
3a42bab @zsuraski Fix behavior of return-by-reference functions. Remove erroneous warn…
zsuraski authored
35 zend_bool fcall_returned_reference;
4fff038 @andigutmans - Changed Ts{}.var to Ts{}.var.ptr_ptr.
andigutmans authored
36 } var;
21f0964 @andigutmans - Hopefully fix bug #26696.
andigutmans authored
37 struct {
38 zval tmp_var;
39 zval *str;
40 zend_uint offset;
41 } str_offset;
e94e3e1 @zsuraski Some cleanup
zsuraski authored
42 zend_class_entry *class_entry;
573b460 @andigutmans Zend Library
andigutmans authored
43 } temp_variable;
44
45
0450ab9 @zsuraski MFZE1 (Expose more C++ APIs)
zsuraski authored
46 BEGIN_EXTERN_C()
2c254ba @zsuraski Get rid of ELS_*(), and use TSRMLS_*() instead.
zsuraski authored
47 ZEND_API extern void (*zend_execute)(zend_op_array *op_array TSRMLS_DC);
2c44fab - Ported the zend_execute_internal hook to ZendEngine2.
Derick Rethans authored
48 ZEND_API extern void (*zend_execute_internal)(zend_execute_data *execute_data_ptr, int return_value_used TSRMLS_DC);
573b460 @andigutmans Zend Library
andigutmans authored
49
b4f3b9d @zsuraski Redesigned thread safety mechanism - nua nua
zsuraski authored
50 void init_executor(TSRMLS_D);
2c254ba @zsuraski Get rid of ELS_*(), and use TSRMLS_*() instead.
zsuraski authored
51 void shutdown_executor(TSRMLS_D);
52 ZEND_API void execute(zend_op_array *op_array TSRMLS_DC);
2c44fab - Ported the zend_execute_internal hook to ZendEngine2.
Derick Rethans authored
53 ZEND_API void execute_internal(zend_execute_data *execute_data_ptr, int return_value_used TSRMLS_DC);
573b460 @andigutmans Zend Library
andigutmans authored
54 ZEND_API int zend_is_true(zval *op);
3df0288 Improove debug capabilities
Marcus Boerger authored
55 #define safe_free_zval_ptr(p) safe_free_zval_ptr_rel(p ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
56 static inline void safe_free_zval_ptr_rel(zval *p ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
df74f1d Add optional support for C0x inline semantics.
Sascha Schumann authored
57 {
2c254ba @zsuraski Get rid of ELS_*(), and use TSRMLS_*() instead.
zsuraski authored
58 TSRMLS_FETCH();
df74f1d Add optional support for C0x inline semantics.
Sascha Schumann authored
59
60 if (p!=EG(uninitialized_zval_ptr)) {
3df0288 Improove debug capabilities
Marcus Boerger authored
61 FREE_ZVAL_REL(p);
df74f1d Add optional support for C0x inline semantics.
Sascha Schumann authored
62 }
63 }
690c85b @andigutmans - Fix bug in class constants
andigutmans authored
64 ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***ce TSRMLS_DC);
b4f3b9d @zsuraski Redesigned thread safety mechanism - nua nua
zsuraski authored
65 ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC);
d3473d1 - Provide a unified way to display uncaught exceptions, which shows
Marcus Boerger authored
66 ZEND_API int zend_eval_string_ex(char *str, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC);
6608f07 @smalyshev Mega-commit: Enter the new object model
smalyshev authored
67
99771d9 Remove --enable-c9x-inline option. We now use a syntax which is compa…
Sascha Schumann authored
68 static inline int i_zend_is_true(zval *op)
df74f1d Add optional support for C0x inline semantics.
Sascha Schumann authored
69 {
70 int result;
71
72 switch (op->type) {
73 case IS_NULL:
74 result = 0;
75 break;
76 case IS_LONG:
77 case IS_BOOL:
78 case IS_RESOURCE:
79 result = (op->value.lval?1:0);
80 break;
81 case IS_DOUBLE:
82 result = (op->value.dval ? 1 : 0);
83 break;
84 case IS_STRING:
85 if (op->value.str.len == 0
86 || (op->value.str.len==1 && op->value.str.val[0]=='0')) {
87 result = 0;
88 } else {
89 result = 1;
90 }
91 break;
92 case IS_ARRAY:
93 result = (zend_hash_num_elements(op->value.ht)?1:0);
94 break;
95 case IS_OBJECT:
97e7ce7 @smalyshev fix the fix
smalyshev authored
96 if(IS_ZEND_STD_OBJECT(*op)) {
f9c6520 @smalyshev Fix object true value: if we are in compat mode and it's Zend object -
smalyshev authored
97 TSRMLS_FETCH();
97e7ce7 @smalyshev fix the fix
smalyshev authored
98 if(EG(ze1_compatibility_mode)) {
99 result = (zend_hash_num_elements(Z_OBJPROP_P(op))?1:0);
100 } else {
101 result = 1;
102 }
f9c6520 @smalyshev Fix object true value: if we are in compat mode and it's Zend object -
smalyshev authored
103 } else {
104 result = 1;
105 }
df74f1d Add optional support for C0x inline semantics.
Sascha Schumann authored
106 break;
107 default:
108 result = 0;
109 break;
110 }
111 return result;
112 }
113
d76cf1d @zsuraski More TSRMLS_FETCH work
zsuraski authored
114 ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC);
573b460 @andigutmans Zend Library
andigutmans authored
115
39a7f4c @zsuraski This patch is a go. Not fully optimized yet, but working properly.
zsuraski authored
116 /* dedicated Zend executor functions - do not use! */
2c254ba @zsuraski Get rid of ELS_*(), and use TSRMLS_*() instead.
zsuraski authored
117 static inline void zend_ptr_stack_clear_multiple(TSRMLS_D)
df74f1d Add optional support for C0x inline semantics.
Sascha Schumann authored
118 {
119 void **p = EG(argument_stack).top_element-2;
120 int delete_count = (ulong) *p;
121
122 EG(argument_stack).top -= (delete_count+2);
123 while (--delete_count>=0) {
124 zval_ptr_dtor((zval **) --p);
125 }
126 EG(argument_stack).top_element = p;
127 }
128
2c254ba @zsuraski Get rid of ELS_*(), and use TSRMLS_*() instead.
zsuraski authored
129 static inline int zend_ptr_stack_get_arg(int requested_arg, void **data TSRMLS_DC)
df74f1d Add optional support for C0x inline semantics.
Sascha Schumann authored
130 {
131 void **p = EG(argument_stack).top_element-2;
132 int arg_count = (ulong) *p;
133
134 if (requested_arg>arg_count) {
135 return FAILURE;
136 }
137 *data = (p-arg_count+requested_arg-1);
138 return SUCCESS;
139 }
39a7f4c @zsuraski This patch is a go. Not fully optimized yet, but working properly.
zsuraski authored
140
b4f3b9d @zsuraski Redesigned thread safety mechanism - nua nua
zsuraski authored
141 void execute_new_code(TSRMLS_D);
573b460 @andigutmans Zend Library
andigutmans authored
142
143
144 /* services */
4187439 @zsuraski More TSRMLS_FETCH work
zsuraski authored
145 ZEND_API char *get_active_function_name(TSRMLS_D);
2c254ba @zsuraski Get rid of ELS_*(), and use TSRMLS_*() instead.
zsuraski authored
146 ZEND_API char *zend_get_executed_filename(TSRMLS_D);
147 ZEND_API uint zend_get_executed_lineno(TSRMLS_D);
4187439 @zsuraski More TSRMLS_FETCH work
zsuraski authored
148 ZEND_API zend_bool zend_is_executing(TSRMLS_D);
573b460 @andigutmans Zend Library
andigutmans authored
149
848e51f @zsuraski Expose all timeout functions
zsuraski authored
150 ZEND_API void zend_set_timeout(long seconds);
4187439 @zsuraski More TSRMLS_FETCH work
zsuraski authored
151 ZEND_API void zend_unset_timeout(TSRMLS_D);
b72a273 @andigutmans - Forgot ZEND_API
andigutmans authored
152 ZEND_API void zend_timeout(int dummy);
9d7122f @zsuraski Generalize fetch_class
zsuraski authored
153 ZEND_API zend_class_entry *zend_fetch_class(char *class_name, uint class_name_len, int fetch_type TSRMLS_DC);
c5d8422 @zsuraski Reinstate early-binding for classes.
zsuraski authored
154 void zend_verify_abstract_class(zend_class_entry *ce TSRMLS_DC);
84eb48f @zsuraski Ok, this time here's some real Win32 system programming :)
zsuraski authored
155
ef0bd3d @zsuraski - Move timeout code to Zend
zsuraski authored
156 #ifdef ZEND_WIN32
84eb48f @zsuraski Ok, this time here's some real Win32 system programming :)
zsuraski authored
157 void zend_init_timeout_thread();
158 void zend_shutdown_timeout_thread();
159 #define WM_REGISTER_ZEND_TIMEOUT (WM_USER+1)
160 #define WM_UNREGISTER_ZEND_TIMEOUT (WM_USER+2)
ef0bd3d @zsuraski - Move timeout code to Zend
zsuraski authored
161 #endif
162
573b460 @andigutmans Zend Library
andigutmans authored
163 #define zendi_zval_copy_ctor(p) zval_copy_ctor(&(p))
164 #define zendi_zval_dtor(p) zval_dtor(&(p))
165
166 #define active_opline (*EG(opline_ptr))
167
2c254ba @zsuraski Get rid of ELS_*(), and use TSRMLS_*() instead.
zsuraski authored
168 void zend_assign_to_variable_reference(znode *result, zval **variable_ptr_ptr, zval **value_ptr_ptr, temp_variable *Ts TSRMLS_DC);
573b460 @andigutmans Zend Library
andigutmans authored
169
e8214a3 @andigutmans - Commit Marcus' cleanup of abstract and static inheritance and improve
andigutmans authored
170 /* The following tries to resolve the classname of a zval of type object.
171 * Since it is slow it should be only used in error messages.
172 */
173 #define Z_OBJ_CLASS_NAME_P(zval) ((zval) && (zval)->type == IS_OBJECT && Z_OBJ_HT_P(zval)->get_class_entry != NULL && Z_OBJ_HT_P(zval)->get_class_entry(zval TSRMLS_CC) ? Z_OBJ_HT_P(zval)->get_class_entry(zval TSRMLS_CC)->name : "")
174
0450ab9 @zsuraski MFZE1 (Expose more C++ APIs)
zsuraski authored
175 END_EXTERN_C()
176
a617217 Replace macros which begin with an underscore through an appropiately
Sascha Schumann authored
177 #endif /* ZEND_EXECUTE_H */
333406b - Added some missing CVS $Id$ tags, headers and footers.
foobar authored
178
179 /*
180 * Local variables:
181 * tab-width: 4
182 * c-basic-offset: 4
183 * indent-tabs-mode: t
184 * End:
185 */
Something went wrong with that request. Please try again.