Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 176 lines (147 sloc) 5.324 kB
573b460 @andigutmans Zend Library
andigutmans authored
1 /*
2 +----------------------------------------------------------------------+
3 | Zend Engine |
4 +----------------------------------------------------------------------+
2c5d4b8 Bump year.
Sebastian Bergmann authored
5 | Copyright (c) 1998-2003 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;
e94e3e1 @zsuraski Some cleanup
zsuraski authored
35 struct {
36 zval *str;
37 zend_uint offset;
38 } str_offset;
4fff038 @andigutmans - Changed Ts{}.var to Ts{}.var.ptr_ptr.
andigutmans authored
39 } var;
e94e3e1 @zsuraski Some cleanup
zsuraski authored
40 zend_class_entry *class_entry;
573b460 @andigutmans Zend Library
andigutmans authored
41 } temp_variable;
42
43
0450ab9 @zsuraski MFZE1 (Expose more C++ APIs)
zsuraski authored
44 BEGIN_EXTERN_C()
2c254ba @zsuraski Get rid of ELS_*(), and use TSRMLS_*() instead.
zsuraski authored
45 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
46 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
47
b4f3b9d @zsuraski Redesigned thread safety mechanism - nua nua
zsuraski authored
48 void init_executor(TSRMLS_D);
2c254ba @zsuraski Get rid of ELS_*(), and use TSRMLS_*() instead.
zsuraski authored
49 void shutdown_executor(TSRMLS_D);
50 ZEND_API void execute(zend_op_array *op_array TSRMLS_DC);
2c44fab - Ported the zend_execute_internal hook to ZendEngine2.
Derick Rethans authored
51 ZEND_API void execute_internal(zend_execute_data *execute_data_ptr, int return_value_used TSRMLS_DC);
573b460 @andigutmans Zend Library
andigutmans authored
52 ZEND_API int zend_is_true(zval *op);
99771d9 Remove --enable-c9x-inline option. We now use a syntax which is compa…
Sascha Schumann authored
53 static inline void safe_free_zval_ptr(zval *p)
df74f1d Add optional support for C0x inline semantics.
Sascha Schumann authored
54 {
2c254ba @zsuraski Get rid of ELS_*(), and use TSRMLS_*() instead.
zsuraski authored
55 TSRMLS_FETCH();
df74f1d Add optional support for C0x inline semantics.
Sascha Schumann authored
56
57 if (p!=EG(uninitialized_zval_ptr)) {
58 FREE_ZVAL(p);
59 }
60 }
690c85b @andigutmans - Fix bug in class constants
andigutmans authored
61 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
62 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
63 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
64
99771d9 Remove --enable-c9x-inline option. We now use a syntax which is compa…
Sascha Schumann authored
65 static inline int i_zend_is_true(zval *op)
df74f1d Add optional support for C0x inline semantics.
Sascha Schumann authored
66 {
67 int result;
68
69 switch (op->type) {
70 case IS_NULL:
71 result = 0;
72 break;
73 case IS_LONG:
74 case IS_BOOL:
75 case IS_RESOURCE:
76 result = (op->value.lval?1:0);
77 break;
78 case IS_DOUBLE:
79 result = (op->value.dval ? 1 : 0);
80 break;
81 case IS_STRING:
82 if (op->value.str.len == 0
83 || (op->value.str.len==1 && op->value.str.val[0]=='0')) {
84 result = 0;
85 } else {
86 result = 1;
87 }
88 break;
89 case IS_ARRAY:
90 result = (zend_hash_num_elements(op->value.ht)?1:0);
91 break;
92 case IS_OBJECT:
6608f07 @smalyshev Mega-commit: Enter the new object model
smalyshev authored
93 /* OBJ-TBI */
94 result = 1;
df74f1d Add optional support for C0x inline semantics.
Sascha Schumann authored
95 break;
96 default:
97 result = 0;
98 break;
99 }
100 return result;
101 }
102
d76cf1d @zsuraski More TSRMLS_FETCH work
zsuraski authored
103 ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC);
573b460 @andigutmans Zend Library
andigutmans authored
104
39a7f4c @zsuraski This patch is a go. Not fully optimized yet, but working properly.
zsuraski authored
105 /* dedicated Zend executor functions - do not use! */
2c254ba @zsuraski Get rid of ELS_*(), and use TSRMLS_*() instead.
zsuraski authored
106 static inline void zend_ptr_stack_clear_multiple(TSRMLS_D)
df74f1d Add optional support for C0x inline semantics.
Sascha Schumann authored
107 {
108 void **p = EG(argument_stack).top_element-2;
109 int delete_count = (ulong) *p;
110
111 EG(argument_stack).top -= (delete_count+2);
112 while (--delete_count>=0) {
113 zval_ptr_dtor((zval **) --p);
114 }
115 EG(argument_stack).top_element = p;
116 }
117
2c254ba @zsuraski Get rid of ELS_*(), and use TSRMLS_*() instead.
zsuraski authored
118 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
119 {
120 void **p = EG(argument_stack).top_element-2;
121 int arg_count = (ulong) *p;
122
123 if (requested_arg>arg_count) {
124 return FAILURE;
125 }
126 *data = (p-arg_count+requested_arg-1);
127 return SUCCESS;
128 }
39a7f4c @zsuraski This patch is a go. Not fully optimized yet, but working properly.
zsuraski authored
129
b4f3b9d @zsuraski Redesigned thread safety mechanism - nua nua
zsuraski authored
130 void execute_new_code(TSRMLS_D);
573b460 @andigutmans Zend Library
andigutmans authored
131
132
133 /* services */
4187439 @zsuraski More TSRMLS_FETCH work
zsuraski authored
134 ZEND_API char *get_active_function_name(TSRMLS_D);
2c254ba @zsuraski Get rid of ELS_*(), and use TSRMLS_*() instead.
zsuraski authored
135 ZEND_API char *zend_get_executed_filename(TSRMLS_D);
136 ZEND_API uint zend_get_executed_lineno(TSRMLS_D);
4187439 @zsuraski More TSRMLS_FETCH work
zsuraski authored
137 ZEND_API zend_bool zend_is_executing(TSRMLS_D);
573b460 @andigutmans Zend Library
andigutmans authored
138
848e51f @zsuraski Expose all timeout functions
zsuraski authored
139 ZEND_API void zend_set_timeout(long seconds);
4187439 @zsuraski More TSRMLS_FETCH work
zsuraski authored
140 ZEND_API void zend_unset_timeout(TSRMLS_D);
b72a273 @andigutmans - Forgot ZEND_API
andigutmans authored
141 ZEND_API void zend_timeout(int dummy);
9d7122f @zsuraski Generalize fetch_class
zsuraski authored
142 ZEND_API zend_class_entry *zend_fetch_class(char *class_name, uint class_name_len, int fetch_type TSRMLS_DC);
84eb48f @zsuraski Ok, this time here's some real Win32 system programming :)
zsuraski authored
143
ef0bd3d @zsuraski - Move timeout code to Zend
zsuraski authored
144 #ifdef ZEND_WIN32
84eb48f @zsuraski Ok, this time here's some real Win32 system programming :)
zsuraski authored
145 void zend_init_timeout_thread();
146 void zend_shutdown_timeout_thread();
147 #define WM_REGISTER_ZEND_TIMEOUT (WM_USER+1)
148 #define WM_UNREGISTER_ZEND_TIMEOUT (WM_USER+2)
ef0bd3d @zsuraski - Move timeout code to Zend
zsuraski authored
149 #endif
150
573b460 @andigutmans Zend Library
andigutmans authored
151 #define zendi_zval_copy_ctor(p) zval_copy_ctor(&(p))
152 #define zendi_zval_dtor(p) zval_dtor(&(p))
153
154 #define active_opline (*EG(opline_ptr))
155
2c254ba @zsuraski Get rid of ELS_*(), and use TSRMLS_*() instead.
zsuraski authored
156 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
157
158 #define IS_STRING_OFFSET 2
159
e8214a3 @andigutmans - Commit Marcus' cleanup of abstract and static inheritance and improve
andigutmans authored
160 /* The following tries to resolve the classname of a zval of type object.
161 * Since it is slow it should be only used in error messages.
162 */
163 #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 : "")
164
0450ab9 @zsuraski MFZE1 (Expose more C++ APIs)
zsuraski authored
165 END_EXTERN_C()
166
a617217 Replace macros which begin with an underscore through an appropiately
Sascha Schumann authored
167 #endif /* ZEND_EXECUTE_H */
333406b - Added some missing CVS $Id$ tags, headers and footers.
foobar authored
168
169 /*
170 * Local variables:
171 * tab-width: 4
172 * c-basic-offset: 4
173 * indent-tabs-mode: t
174 * End:
175 */
Something went wrong with that request. Please try again.