Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 168 lines (138 sloc) 4.483 kb
573b460 @andigutmans Zend Library
andigutmans authored
1 /*
2 +----------------------------------------------------------------------+
3 | Zend Engine |
4 +----------------------------------------------------------------------+
62dc854 Happy New Year.
Sebastian Bergmann authored
5 | Copyright (c) 1998-2002 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 |
9 | available at through the world-wide-web at |
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
b5b1117 @zsuraski License update
zsuraski authored
20
a617217 Replace macros which begin with an underscore through an appropiately
Sascha Schumann authored
21 #ifndef ZEND_EXECUTE_H
22 #define ZEND_EXECUTE_H
573b460 @andigutmans Zend Library
andigutmans authored
23
24 #include "zend_compile.h"
25 #include "zend_hash.h"
df74f1d Add optional support for C0x inline semantics.
Sascha Schumann authored
26 #include "zend_variables.h"
51b9245 @andigutmans - More object junk
andigutmans authored
27 #include "zend_operators.h"
573b460 @andigutmans Zend Library
andigutmans authored
28
1250c43 @zsuraski * Add struct name to all typedef's so that they can be debugged with MSV...
zsuraski authored
29 typedef union _temp_variable {
573b460 @andigutmans Zend Library
andigutmans authored
30 zval tmp_var;
4fff038 @andigutmans - Changed Ts{}.var to Ts{}.var.ptr_ptr.
andigutmans authored
31 struct {
32 zval **ptr_ptr;
b56fd46 @andigutmans - First part of the patch which makes reads use ptr and not ptr_ptr.
andigutmans authored
33 zval *ptr;
4fff038 @andigutmans - Changed Ts{}.var to Ts{}.var.ptr_ptr.
andigutmans authored
34 } var;
573b460 @andigutmans Zend Library
andigutmans authored
35 struct {
028cf1a @zsuraski Fix bug #1812
zsuraski authored
36 zval tmp_var; /* a dummy */
573b460 @andigutmans Zend Library
andigutmans authored
37
a9159c2 @andigutmans Initial preparation for OO overloading patch
andigutmans authored
38 union {
39 struct {
40 zval *str;
51e797f some type cleanup work
Harald Radi authored
41 zend_uint offset;
a9159c2 @andigutmans Initial preparation for OO overloading patch
andigutmans authored
42 } str_offset;
e663d85 @zsuraski Fix object overloading support
zsuraski authored
43 zend_property_reference overloaded_element;
a9159c2 @andigutmans Initial preparation for OO overloading patch
andigutmans authored
44 } data;
45
573b460 @andigutmans Zend Library
andigutmans authored
46 unsigned char type;
26578c3 @andigutmans - Initial support for nested class definitions
andigutmans authored
47 zend_class_entry *class_entry;
573b460 @andigutmans Zend Library
andigutmans authored
48 } EA;
49 } temp_variable;
50
51
0450ab9 @zsuraski MFZE1 (Expose more C++ APIs)
zsuraski authored
52 BEGIN_EXTERN_C()
2c254ba @zsuraski Get rid of ELS_*(), and use TSRMLS_*() instead.
zsuraski authored
53 ZEND_API extern void (*zend_execute)(zend_op_array *op_array TSRMLS_DC);
573b460 @andigutmans Zend Library
andigutmans authored
54
b4f3b9d @zsuraski Redesigned thread safety mechanism - nua nua
zsuraski authored
55 void init_executor(TSRMLS_D);
2c254ba @zsuraski Get rid of ELS_*(), and use TSRMLS_*() instead.
zsuraski authored
56 void shutdown_executor(TSRMLS_D);
57 ZEND_API void execute(zend_op_array *op_array TSRMLS_DC);
573b460 @andigutmans Zend Library
andigutmans authored
58 ZEND_API int zend_is_true(zval *op);
99771d9 Remove --enable-c9x-inline option. We now use a syntax which is compatib...
Sascha Schumann authored
59 static inline void safe_free_zval_ptr(zval *p)
df74f1d Add optional support for C0x inline semantics.
Sascha Schumann authored
60 {
2c254ba @zsuraski Get rid of ELS_*(), and use TSRMLS_*() instead.
zsuraski authored
61 TSRMLS_FETCH();
df74f1d Add optional support for C0x inline semantics.
Sascha Schumann authored
62
63 if (p!=EG(uninitialized_zval_ptr)) {
64 FREE_ZVAL(p);
65 }
66 }
67
b4f3b9d @zsuraski Redesigned thread safety mechanism - nua nua
zsuraski authored
68 ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC);
6608f07 @smalyshev Mega-commit: Enter the new object model
smalyshev authored
69
99771d9 Remove --enable-c9x-inline option. We now use a syntax which is compatib...
Sascha Schumann authored
70 static inline int i_zend_is_true(zval *op)
df74f1d Add optional support for C0x inline semantics.
Sascha Schumann authored
71 {
72 int result;
73
74 switch (op->type) {
75 case IS_NULL:
76 result = 0;
77 break;
78 case IS_LONG:
79 case IS_BOOL:
80 case IS_RESOURCE:
81 result = (op->value.lval?1:0);
82 break;
83 case IS_DOUBLE:
84 result = (op->value.dval ? 1 : 0);
85 break;
86 case IS_STRING:
87 if (op->value.str.len == 0
88 || (op->value.str.len==1 && op->value.str.val[0]=='0')) {
89 result = 0;
90 } else {
91 result = 1;
92 }
93 break;
94 case IS_ARRAY:
95 result = (zend_hash_num_elements(op->value.ht)?1:0);
96 break;
97 case IS_OBJECT:
6608f07 @smalyshev Mega-commit: Enter the new object model
smalyshev authored
98 /* OBJ-TBI */
99 result = 1;
df74f1d Add optional support for C0x inline semantics.
Sascha Schumann authored
100 break;
101 default:
102 result = 0;
103 break;
104 }
105 return result;
106 }
107
d76cf1d @zsuraski More TSRMLS_FETCH work
zsuraski authored
108 ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC);
573b460 @andigutmans Zend Library
andigutmans authored
109
39a7f4c @zsuraski This patch is a go. Not fully optimized yet, but working properly.
zsuraski authored
110 /* dedicated Zend executor functions - do not use! */
2c254ba @zsuraski Get rid of ELS_*(), and use TSRMLS_*() instead.
zsuraski authored
111 static inline void zend_ptr_stack_clear_multiple(TSRMLS_D)
df74f1d Add optional support for C0x inline semantics.
Sascha Schumann authored
112 {
113 void **p = EG(argument_stack).top_element-2;
114 int delete_count = (ulong) *p;
115
116 EG(argument_stack).top -= (delete_count+2);
117 while (--delete_count>=0) {
118 zval_ptr_dtor((zval **) --p);
119 }
120 EG(argument_stack).top_element = p;
121 }
122
2c254ba @zsuraski Get rid of ELS_*(), and use TSRMLS_*() instead.
zsuraski authored
123 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
124 {
125 void **p = EG(argument_stack).top_element-2;
126 int arg_count = (ulong) *p;
127
128 if (requested_arg>arg_count) {
129 return FAILURE;
130 }
131 *data = (p-arg_count+requested_arg-1);
132 return SUCCESS;
133 }
39a7f4c @zsuraski This patch is a go. Not fully optimized yet, but working properly.
zsuraski authored
134
b4f3b9d @zsuraski Redesigned thread safety mechanism - nua nua
zsuraski authored
135 void execute_new_code(TSRMLS_D);
573b460 @andigutmans Zend Library
andigutmans authored
136
137
138 /* services */
4187439 @zsuraski More TSRMLS_FETCH work
zsuraski authored
139 ZEND_API char *get_active_function_name(TSRMLS_D);
2c254ba @zsuraski Get rid of ELS_*(), and use TSRMLS_*() instead.
zsuraski authored
140 ZEND_API char *zend_get_executed_filename(TSRMLS_D);
141 ZEND_API uint zend_get_executed_lineno(TSRMLS_D);
4187439 @zsuraski More TSRMLS_FETCH work
zsuraski authored
142 ZEND_API zend_bool zend_is_executing(TSRMLS_D);
573b460 @andigutmans Zend Library
andigutmans authored
143
848e51f @zsuraski Expose all timeout functions
zsuraski authored
144 ZEND_API void zend_set_timeout(long seconds);
4187439 @zsuraski More TSRMLS_FETCH work
zsuraski authored
145 ZEND_API void zend_unset_timeout(TSRMLS_D);
b72a273 @andigutmans - Forgot ZEND_API
andigutmans authored
146 ZEND_API void zend_timeout(int dummy);
84eb48f @zsuraski Ok, this time here's some real Win32 system programming :)
zsuraski authored
147
ef0bd3d @zsuraski - Move timeout code to Zend
zsuraski authored
148 #ifdef ZEND_WIN32
84eb48f @zsuraski Ok, this time here's some real Win32 system programming :)
zsuraski authored
149 void zend_init_timeout_thread();
150 void zend_shutdown_timeout_thread();
151 #define WM_REGISTER_ZEND_TIMEOUT (WM_USER+1)
152 #define WM_UNREGISTER_ZEND_TIMEOUT (WM_USER+2)
ef0bd3d @zsuraski - Move timeout code to Zend
zsuraski authored
153 #endif
154
573b460 @andigutmans Zend Library
andigutmans authored
155 #define zendi_zval_copy_ctor(p) zval_copy_ctor(&(p))
156 #define zendi_zval_dtor(p) zval_dtor(&(p))
157
158 #define active_opline (*EG(opline_ptr))
159
2c254ba @zsuraski Get rid of ELS_*(), and use TSRMLS_*() instead.
zsuraski authored
160 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
161
162 #define IS_OVERLOADED_OBJECT 1
163 #define IS_STRING_OFFSET 2
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 */
Something went wrong with that request. Please try again.