Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 162 lines (134 sloc) 4.427 kb
573b460 @andigutmans Zend Library
andigutmans authored
1 /*
2 +----------------------------------------------------------------------+
3 | Zend Engine |
4 +----------------------------------------------------------------------+
d2c9e80 @andigutmans - Update copyright year
andigutmans authored
5 | Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
573b460 @andigutmans Zend Library
andigutmans authored
6 +----------------------------------------------------------------------+
5e55e47 @zsuraski It's official now...
zsuraski authored
7 | This source file is subject to version 0.92 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 |
5e55e47 @zsuraski It's official now...
zsuraski authored
10 | http://www.zend.com/license/0_92.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 …
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;
41 int offset;
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;
47 } EA;
48 } temp_variable;
49
50
2c254ba @zsuraski Get rid of ELS_*(), and use TSRMLS_*() instead.
zsuraski authored
51 ZEND_API extern void (*zend_execute)(zend_op_array *op_array TSRMLS_DC);
573b460 @andigutmans Zend Library
andigutmans authored
52
b4f3b9d @zsuraski Redesigned thread safety mechanism - nua nua
zsuraski authored
53 void init_executor(TSRMLS_D);
2c254ba @zsuraski Get rid of ELS_*(), and use TSRMLS_*() instead.
zsuraski authored
54 void shutdown_executor(TSRMLS_D);
55 ZEND_API void execute(zend_op_array *op_array TSRMLS_DC);
573b460 @andigutmans Zend Library
andigutmans authored
56 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
57 static inline void safe_free_zval_ptr(zval *p)
df74f1d Add optional support for C0x inline semantics.
Sascha Schumann authored
58 {
2c254ba @zsuraski Get rid of ELS_*(), and use TSRMLS_*() instead.
zsuraski authored
59 TSRMLS_FETCH();
df74f1d Add optional support for C0x inline semantics.
Sascha Schumann authored
60
61 if (p!=EG(uninitialized_zval_ptr)) {
62 FREE_ZVAL(p);
63 }
64 }
65
b4f3b9d @zsuraski Redesigned thread safety mechanism - nua nua
zsuraski authored
66 ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC);
99771d9 Remove --enable-c9x-inline option. We now use a syntax which is compa…
Sascha Schumann authored
67 static inline int i_zend_is_true(zval *op)
df74f1d Add optional support for C0x inline semantics.
Sascha Schumann authored
68 {
69 int result;
70
71 switch (op->type) {
72 case IS_NULL:
73 result = 0;
74 break;
75 case IS_LONG:
76 case IS_BOOL:
77 case IS_RESOURCE:
78 result = (op->value.lval?1:0);
79 break;
80 case IS_DOUBLE:
81 result = (op->value.dval ? 1 : 0);
82 break;
83 case IS_STRING:
84 if (op->value.str.len == 0
85 || (op->value.str.len==1 && op->value.str.val[0]=='0')) {
86 result = 0;
87 } else {
88 result = 1;
89 }
90 break;
91 case IS_ARRAY:
92 result = (zend_hash_num_elements(op->value.ht)?1:0);
93 break;
94 case IS_OBJECT:
51b9245 @andigutmans - More object junk
andigutmans authored
95 result = (zend_hash_num_elements(Z_OBJPROP_P(op))?1:0);
df74f1d Add optional support for C0x inline semantics.
Sascha Schumann authored
96 break;
97 default:
98 result = 0;
99 break;
100 }
101 return result;
102 }
103
13b6762 @zsuraski Fix a bug in static initializers/default values/class member variable…
zsuraski authored
104 ZEND_API int zval_update_constant(zval **pp, void *arg);
573b460 @andigutmans Zend Library
andigutmans authored
105
39a7f4c @zsuraski This patch is a go. Not fully optimized yet, but working properly.
zsuraski authored
106 /* dedicated Zend executor functions - do not use! */
2c254ba @zsuraski Get rid of ELS_*(), and use TSRMLS_*() instead.
zsuraski authored
107 static inline void zend_ptr_stack_clear_multiple(TSRMLS_D)
df74f1d Add optional support for C0x inline semantics.
Sascha Schumann authored
108 {
109 void **p = EG(argument_stack).top_element-2;
110 int delete_count = (ulong) *p;
111
112 EG(argument_stack).top -= (delete_count+2);
113 while (--delete_count>=0) {
114 zval_ptr_dtor((zval **) --p);
115 }
116 EG(argument_stack).top_element = p;
117 }
118
2c254ba @zsuraski Get rid of ELS_*(), and use TSRMLS_*() instead.
zsuraski authored
119 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
120 {
121 void **p = EG(argument_stack).top_element-2;
122 int arg_count = (ulong) *p;
123
124 if (requested_arg>arg_count) {
125 return FAILURE;
126 }
127 *data = (p-arg_count+requested_arg-1);
128 return SUCCESS;
129 }
39a7f4c @zsuraski This patch is a go. Not fully optimized yet, but working properly.
zsuraski authored
130
b4f3b9d @zsuraski Redesigned thread safety mechanism - nua nua
zsuraski authored
131 void execute_new_code(TSRMLS_D);
573b460 @andigutmans Zend Library
andigutmans authored
132
133
134 /* services */
4187439 @zsuraski More TSRMLS_FETCH work
zsuraski authored
135 ZEND_API char *get_active_function_name(TSRMLS_D);
2c254ba @zsuraski Get rid of ELS_*(), and use TSRMLS_*() instead.
zsuraski authored
136 ZEND_API char *zend_get_executed_filename(TSRMLS_D);
137 ZEND_API uint zend_get_executed_lineno(TSRMLS_D);
4187439 @zsuraski More TSRMLS_FETCH work
zsuraski authored
138 ZEND_API zend_bool zend_is_executing(TSRMLS_D);
573b460 @andigutmans Zend Library
andigutmans authored
139
848e51f @zsuraski Expose all timeout functions
zsuraski authored
140 ZEND_API void zend_set_timeout(long seconds);
4187439 @zsuraski More TSRMLS_FETCH work
zsuraski authored
141 ZEND_API void zend_unset_timeout(TSRMLS_D);
b72a273 @andigutmans - Forgot ZEND_API
andigutmans authored
142 ZEND_API void zend_timeout(int dummy);
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_OVERLOADED_OBJECT 1
159 #define IS_STRING_OFFSET 2
160
a617217 Replace macros which begin with an underscore through an appropiately
Sascha Schumann authored
161 #endif /* ZEND_EXECUTE_H */
Something went wrong with that request. Please try again.