Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 161 lines (133 sloc) 4.407 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"
573b460 @andigutmans Zend Library
andigutmans authored
27
1250c43 @zsuraski * Add struct name to all typedef's so that they can be debugged with …
zsuraski authored
28 typedef union _temp_variable {
573b460 @andigutmans Zend Library
andigutmans authored
29 zval tmp_var;
4fff038 @andigutmans - Changed Ts{}.var to Ts{}.var.ptr_ptr.
andigutmans authored
30 struct {
31 zval **ptr_ptr;
b56fd46 @andigutmans - First part of the patch which makes reads use ptr and not ptr_ptr.
andigutmans authored
32 zval *ptr;
4fff038 @andigutmans - Changed Ts{}.var to Ts{}.var.ptr_ptr.
andigutmans authored
33 } var;
573b460 @andigutmans Zend Library
andigutmans authored
34 struct {
028cf1a @zsuraski Fix bug #1812
zsuraski authored
35 zval tmp_var; /* a dummy */
573b460 @andigutmans Zend Library
andigutmans authored
36
a9159c2 @andigutmans Initial preparation for OO overloading patch
andigutmans authored
37 union {
38 struct {
39 zval *str;
40 int offset;
41 } str_offset;
e663d85 @zsuraski Fix object overloading support
zsuraski authored
42 zend_property_reference overloaded_element;
a9159c2 @andigutmans Initial preparation for OO overloading patch
andigutmans authored
43 } data;
44
573b460 @andigutmans Zend Library
andigutmans authored
45 unsigned char type;
46 } EA;
47 } temp_variable;
48
49
2c254ba @zsuraski Get rid of ELS_*(), and use TSRMLS_*() instead.
zsuraski authored
50 ZEND_API extern void (*zend_execute)(zend_op_array *op_array TSRMLS_DC);
573b460 @andigutmans Zend Library
andigutmans authored
51
2c254ba @zsuraski Get rid of ELS_*(), and use TSRMLS_*() instead.
zsuraski authored
52 void init_executor(CLS_D TSRMLS_DC);
53 void shutdown_executor(TSRMLS_D);
54 ZEND_API void execute(zend_op_array *op_array TSRMLS_DC);
573b460 @andigutmans Zend Library
andigutmans authored
55 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
56 static inline void safe_free_zval_ptr(zval *p)
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)) {
61 FREE_ZVAL(p);
62 }
63 }
64
2c254ba @zsuraski Get rid of ELS_*(), and use TSRMLS_*() instead.
zsuraski authored
65 ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name CLS_DC TSRMLS_DC);
99771d9 Remove --enable-c9x-inline option. We now use a syntax which is compa…
Sascha Schumann authored
66 static inline int i_zend_is_true(zval *op)
df74f1d Add optional support for C0x inline semantics.
Sascha Schumann authored
67 {
68 int result;
69
70 switch (op->type) {
71 case IS_NULL:
72 result = 0;
73 break;
74 case IS_LONG:
75 case IS_BOOL:
76 case IS_RESOURCE:
77 result = (op->value.lval?1:0);
78 break;
79 case IS_DOUBLE:
80 result = (op->value.dval ? 1 : 0);
81 break;
82 case IS_STRING:
83 if (op->value.str.len == 0
84 || (op->value.str.len==1 && op->value.str.val[0]=='0')) {
85 result = 0;
86 } else {
87 result = 1;
88 }
89 break;
90 case IS_ARRAY:
91 result = (zend_hash_num_elements(op->value.ht)?1:0);
92 break;
93 case IS_OBJECT:
94 result = (zend_hash_num_elements(op->value.obj.properties)?1:0);
95 break;
96 default:
97 result = 0;
98 break;
99 }
100 return result;
101 }
102
13b6762 @zsuraski Fix a bug in static initializers/default values/class member variable…
zsuraski authored
103 ZEND_API int zval_update_constant(zval **pp, void *arg);
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
573b460 @andigutmans Zend Library
andigutmans authored
130 void execute_new_code(CLS_D);
131
132
133 /* services */
9353650 Fix warnings surfacing in maintainer-mode.
Stig S. Bakken authored
134 ZEND_API char *get_active_function_name(void);
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);
b6197bc @zsuraski Maintain a state of whether we're compiling and/or executing
zsuraski authored
137 ZEND_API zend_bool zend_is_executing(void);
573b460 @andigutmans Zend Library
andigutmans authored
138
848e51f @zsuraski Expose all timeout functions
zsuraski authored
139 ZEND_API void zend_set_timeout(long seconds);
140 ZEND_API void zend_unset_timeout(void);
b72a273 @andigutmans - Forgot ZEND_API
andigutmans authored
141 ZEND_API void zend_timeout(int dummy);
84eb48f @zsuraski Ok, this time here's some real Win32 system programming :)
zsuraski authored
142
ef0bd3d @zsuraski - Move timeout code to Zend
zsuraski authored
143 #ifdef ZEND_WIN32
84eb48f @zsuraski Ok, this time here's some real Win32 system programming :)
zsuraski authored
144 void zend_init_timeout_thread();
145 void zend_shutdown_timeout_thread();
146 #define WM_REGISTER_ZEND_TIMEOUT (WM_USER+1)
147 #define WM_UNREGISTER_ZEND_TIMEOUT (WM_USER+2)
ef0bd3d @zsuraski - Move timeout code to Zend
zsuraski authored
148 #endif
149
573b460 @andigutmans Zend Library
andigutmans authored
150 #define zendi_zval_copy_ctor(p) zval_copy_ctor(&(p))
151 #define zendi_zval_dtor(p) zval_dtor(&(p))
152
153 #define active_opline (*EG(opline_ptr))
154
2c254ba @zsuraski Get rid of ELS_*(), and use TSRMLS_*() instead.
zsuraski authored
155 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
156
157 #define IS_OVERLOADED_OBJECT 1
158 #define IS_STRING_OFFSET 2
159
a617217 Replace macros which begin with an underscore through an appropiately
Sascha Schumann authored
160 #endif /* ZEND_EXECUTE_H */
Something went wrong with that request. Please try again.