Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 459 lines (388 sloc) 19.996 kb
573b4602 » andigutmans
1999-04-07 Zend Library
1 /*
2 +----------------------------------------------------------------------+
3 | Zend Engine |
4 +----------------------------------------------------------------------+
d2c9e807 » andigutmans
2001-02-26 - Update copyright year
5 | Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
573b4602 » andigutmans
1999-04-07 Zend Library
6 +----------------------------------------------------------------------+
5e55e47f » zsuraski
2000-03-06 It's official now...
7 | This source file is subject to version 0.92 of the Zend license, |
b5b11177 » zsuraski
1999-07-16 License update
8 | that is bundled with this package in the file LICENSE, and is |
9 | available at through the world-wide-web at |
5e55e47f » zsuraski
2000-03-06 It's official now...
10 | http://www.zend.com/license/0_92.txt. |
b5b11177 » zsuraski
1999-07-16 License update
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. |
573b4602 » andigutmans
1999-04-07 Zend Library
14 +----------------------------------------------------------------------+
15 | Authors: Andi Gutmans <andi@zend.com> |
16 | Zeev Suraski <zeev@zend.com> |
17 +----------------------------------------------------------------------+
18 */
19
b5b11177 » zsuraski
1999-07-16 License update
20
b982307d » Sascha Schumann
2000-07-02 Change header protection macros to conform to standard.
21 #ifndef ZEND_API_H
22 #define ZEND_API_H
573b4602 » andigutmans
1999-04-07 Zend Library
23
7080fa5b » andigutmans
2001-02-26 - Rename modules.h to zend_modules.h
24 #include "zend_modules.h"
573b4602 » andigutmans
1999-04-07 Zend Library
25 #include "zend_list.h"
b7a5b3c3 » zsuraski
1999-12-27 - Generalize the fast cache mechanism
26 #include "zend_fast_cache.h"
5dba4774 » zsuraski
2000-03-25 - Some header dependencies cleanup
27 #include "zend_operators.h"
28 #include "zend_variables.h"
df74f1df » Sascha Schumann
2000-06-13 Add optional support for C0x inline semantics.
29 #include "zend_execute.h"
573b4602 » andigutmans
1999-04-07 Zend Library
30
e9d126a7 » andigutmans
2000-03-29 - Make sure zend_API.h has Zend'ish versions of the ZEND macros so that
31 #define ZEND_FN(name) zend_if_##name
342c6e0b » zsuraski
1999-04-18 Whatnot:
32 #define ZEND_NAMED_FUNCTION(name) void name(INTERNAL_FUNCTION_PARAMETERS)
e9d126a7 » andigutmans
2000-03-29 - Make sure zend_API.h has Zend'ish versions of the ZEND macros so that
33 #define ZEND_FUNCTION(name) ZEND_NAMED_FUNCTION(ZEND_FN(name))
34
35 #define ZEND_NAMED_FE(zend_name, name, arg_types) { #zend_name, name, arg_types },
36 #define ZEND_FE(name, arg_types) ZEND_NAMED_FE(name, ZEND_FN(name), arg_types)
37 #define ZEND_FALIAS(name, alias, arg_types) ZEND_NAMED_FE(name, ZEND_FN(alias), arg_types)
342c6e0b » zsuraski
1999-04-18 Whatnot:
38
e9d126a7 » andigutmans
2000-03-29 - Make sure zend_API.h has Zend'ish versions of the ZEND macros so that
39 #define ZEND_MINIT(module) zend_minit_##module
40 #define ZEND_MSHUTDOWN(module) zend_mshutdown_##module
41 #define ZEND_RINIT(module) zend_rinit_##module
42 #define ZEND_RSHUTDOWN(module) zend_rshutdown_##module
43 #define ZEND_MINFO(module) zend_info_##module
44 #define ZEND_GINIT(module) zend_ginit_##module
45 #define ZEND_GSHUTDOWN(module) zend_gshutdown_##module
342c6e0b » zsuraski
1999-04-18 Whatnot:
46
e9d126a7 » andigutmans
2000-03-29 - Make sure zend_API.h has Zend'ish versions of the ZEND macros so that
47 #define ZEND_MINIT_FUNCTION(module) int ZEND_MINIT(module)(INIT_FUNC_ARGS)
48 #define ZEND_MSHUTDOWN_FUNCTION(module) int ZEND_MSHUTDOWN(module)(SHUTDOWN_FUNC_ARGS)
49 #define ZEND_RINIT_FUNCTION(module) int ZEND_RINIT(module)(INIT_FUNC_ARGS)
50 #define ZEND_RSHUTDOWN_FUNCTION(module) int ZEND_RSHUTDOWN(module)(SHUTDOWN_FUNC_ARGS)
51 #define ZEND_MINFO_FUNCTION(module) void ZEND_MINFO(module)(ZEND_MODULE_INFO_FUNC_ARGS)
52 #define ZEND_GINIT_FUNCTION(module) int ZEND_GINIT(module)(GINIT_FUNC_ARGS)
53 #define ZEND_GSHUTDOWN_FUNCTION(module) int ZEND_GSHUTDOWN(module)(void)
342c6e0b » zsuraski
1999-04-18 Whatnot:
54
0b6d923b » Sascha Schumann
2000-05-02 Add ZEND_GET_MODULE(name). This is a short-cut for the common
55 #define ZEND_GET_MODULE(name) \
56 ZEND_DLEXPORT zend_module_entry *get_module(void) { return &name##_module_entry; }
0d21940d » zsuraski
2000-04-01 Generalize some common thread-safety stuff
57
58 #define ZEND_BEGIN_MODULE_GLOBALS(module_name) \
59 typedef struct _zend_##module_name##_globals {
60 #define ZEND_END_MODULE_GLOBALS(module_name) \
61 } zend_##module_name##_globals;
62
63 #ifdef ZTS
64
65 #define ZEND_DECLARE_MODULE_GLOBALS(module_name) \
66 static ts_rsrc_id module_name##_globals_id;
67 #define ZEND_INIT_MODULE_GLOBALS(module_name, globals_ctor, globals_dtor) \
68 module_name##_globals_id = ts_allocate_id(sizeof(zend_##module_name##_globals), (ts_allocate_ctor) globals_ctor, (ts_allocate_dtor) globals_dtor);
69
70 #else
71
72 #define ZEND_DECLARE_MODULE_GLOBALS(module_name) \
73 static zend_##module_name##_globals module_name##_globals;
74 #define ZEND_INIT_MODULE_GLOBALS(module_name, globals_ctor, globals_dtor) \
75 globals_ctor(&module_name##_globals);
76
77 #endif
78
79
80
741b8161 » zsuraski
1999-05-28 * Support getThis() for internal functions.
81 #define INIT_CLASS_ENTRY(class_container, class_name, functions) \
82 { \
83 class_container.name = strdup(class_name); \
84 class_container.name_length = sizeof(class_name)-1; \
85 class_container.builtin_functions = functions; \
86 class_container.handle_function_call = NULL; \
87 class_container.handle_property_get = NULL; \
88 class_container.handle_property_set = NULL; \
89 }
90
91 #define INIT_OVERLOADED_CLASS_ENTRY(class_container, class_name, functions, handle_fcall, handle_propget, handle_propset) \
92 { \
93 class_container.name = strdup(class_name); \
94 class_container.name_length = sizeof(class_name)-1; \
95 class_container.builtin_functions = functions; \
96 class_container.handle_function_call = handle_fcall; \
97 class_container.handle_property_get = handle_propget; \
98 class_container.handle_property_set = handle_propset; \
99 }
100
101
102
573b4602 » andigutmans
1999-04-07 Zend Library
103 int zend_next_free_module(void);
104
f77e6a44 » zsuraski
2000-02-19 Generalize macros
105 ZEND_API int zend_get_parameters(int ht, int param_count, ...);
cd7d5546 » zsuraski
1999-12-18 - Introduce ZEND_NUM_ARGS(), to replace ARG_COUNT(ht)
106 ZEND_API int zend_get_parameters_array(int ht, int param_count, zval **argument_array);
f77e6a44 » zsuraski
2000-02-19 Generalize macros
107 ZEND_API int zend_get_parameters_ex(int param_count, ...);
cd7d5546 » zsuraski
1999-12-18 - Introduce ZEND_NUM_ARGS(), to replace ARG_COUNT(ht)
108 ZEND_API int zend_get_parameters_array_ex(int param_count, zval ***argument_array);
39f9487e » andigutmans
1999-04-14 -Tiny patches
109
9deab411 » andigutmans
1999-04-19 Add a couple of ZEND_API's
110 ZEND_API int ParameterPassedByReference(int ht, uint n);
39f9487e » andigutmans
1999-04-14 -Tiny patches
111
fce92e3c » zsuraski
2000-06-12 Avoid using E_CORE_* errorlevels in any place which is not in the glo…
112 int zend_register_functions(zend_function_entry *functions, HashTable *function_table, int type);
741b8161 » zsuraski
1999-05-28 * Support getThis() for internal functions.
113 void zend_unregister_functions(zend_function_entry *functions, int count, HashTable *function_table);
7a87fcbb » zsuraski
1999-04-21 Thread safety patch. We're still not quite there but it compiles agai…
114 ZEND_API int zend_register_module(zend_module_entry *module_entry);
eb0e6946 » andigutmans
2000-06-09 - Andrei, this is for you!
115
6ce07a85 » andigutmans
2000-06-09 - Change register_internal_class to zend_register_internal_class for
116 ZEND_API zend_class_entry *zend_register_internal_class(zend_class_entry *class_entry);
eb0e6946 » andigutmans
2000-06-09 - Andrei, this is for you!
117 ZEND_API zend_class_entry *zend_register_internal_class_ex(zend_class_entry *class_entry, zend_class_entry *parent_ce, char *parent_name);
118
bfbe8618 » zsuraski
1999-05-09 Almost forgot to commit those
119 ZEND_API zend_module_entry *zend_get_module(int module_number);
bc7abb33 » zsuraski
2000-05-29 Allow disabling of functions for security reasons
120 ZEND_API int zend_disable_function(char *function_name, uint function_name_length);
573b4602 » andigutmans
1999-04-07 Zend Library
121
122 ZEND_API void wrong_param_count(void);
8fe03659 » Andrei Zmievski
2001-02-01 Added zend_is_callable() function that checks whether passed zval
123 ZEND_API zend_bool zend_is_callable(zval *function);
573b4602 » andigutmans
1999-04-07 Zend Library
124
741b8161 » zsuraski
1999-05-28 * Support getThis() for internal functions.
125 #define getThis() (this_ptr)
126
131d9cb2 » zsuraski
2000-04-01 *** empty log message ***
127 #define WRONG_PARAM_COUNT ZEND_WRONG_PARAM_COUNT()
128 #define WRONG_PARAM_COUNT_WITH_RETVAL(ret) ZEND_WRONG_PARAM_COUNT_WITH_RETVAL(ret)
a1ad2872 » zsuraski
1999-12-18 - The tree compiles again
129 #define ARG_COUNT(dummy) (ht)
130 #define ZEND_NUM_ARGS() (ht)
131d9cb2 » zsuraski
2000-04-01 *** empty log message ***
131 #define ZEND_WRONG_PARAM_COUNT() { wrong_param_count(); return; }
132 #define ZEND_WRONG_PARAM_COUNT_WITH_RETVAL(ret) { wrong_param_count(); return ret; }
573b4602 » andigutmans
1999-04-07 Zend Library
133
80bdd19e » zsuraski
2000-02-11 Fine tune Andi's patch
134 #ifndef ZEND_WIN32
573b4602 » andigutmans
1999-04-07 Zend Library
135 #define DLEXPORT
136 #endif
137
e0628436 » Andrei Zmievski
2000-02-03 *** empty log message ***
138 ZEND_API int zend_startup_module(zend_module_entry *module);
573b4602 » andigutmans
1999-04-07 Zend Library
139
ceba50b6 » zsuraski
2000-02-19 - Fix a nasty bug in the hash, introduced in the recent migration to …
140 #define array_init(arg) _array_init((arg) ZEND_FILE_LINE_CC)
141 #define object_init(arg) _object_init((arg) ZEND_FILE_LINE_CC)
142 #define object_init_ex(arg, ce) _object_init_ex((arg), (ce) ZEND_FILE_LINE_CC)
143 ZEND_API int _array_init(zval *arg ZEND_FILE_LINE_DC);
144 ZEND_API int _object_init(zval *arg ZEND_FILE_LINE_DC);
145 ZEND_API int _object_init_ex(zval *arg, zend_class_entry *ce ZEND_FILE_LINE_DC);
6847fefa » Thies C. Arntzen
1999-10-04 added add_*_resource() and add_*_bool() functions
146
147 /* no longer supported */
148 ZEND_API int add_assoc_function(zval *arg, char *key,void (*function_ptr)(INTERNAL_FUNCTION_PARAMETERS));
149
ef95a346 » andigutmans
2001-01-20 - Patch from Sterling. Add API calls to add zval's as array indeces/
150 ZEND_API int add_assoc_long_ex(zval *arg, char *key, uint key_len, long n);
0611acb9 » andigutmans
2001-01-31 - Change unset() functions to null(). unset() is legacy
151 ZEND_API int add_assoc_null_ex(zval *arg, char *key, uint key_len);
ef95a346 » andigutmans
2001-01-20 - Patch from Sterling. Add API calls to add zval's as array indeces/
152 ZEND_API int add_assoc_bool_ex(zval *arg, char *key, uint key_len, int b);
153 ZEND_API int add_assoc_resource_ex(zval *arg, char *key, uint key_len, int r);
154 ZEND_API int add_assoc_double_ex(zval *arg, char *key, uint key_len, double d);
155 ZEND_API int add_assoc_string_ex(zval *arg, char *key, uint key_len, char *str, int duplicate);
156 ZEND_API int add_assoc_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, int duplicate);
157 ZEND_API int add_assoc_zval_ex(zval *arg, char *key, uint key_len, zval *value);
158
159 #define add_assoc_long(__arg, __key, __n) add_assoc_long_ex(__arg, __key, strlen(__key)+1, __n)
0611acb9 » andigutmans
2001-01-31 - Change unset() functions to null(). unset() is legacy
160 #define add_assoc_null(__arg, __key) add_assoc_null_ex(__arg, __key, strlen(__key) + 1)
ef95a346 » andigutmans
2001-01-20 - Patch from Sterling. Add API calls to add zval's as array indeces/
161 #define add_assoc_bool(__arg, __key, __b) add_assoc_bool_ex(__arg, __key, strlen(__key)+1, __b)
162 #define add_assoc_resource(__arg, __key, __r) add_assoc_resource_ex(__arg, __key, strlen(__key)+1, __r)
163 #define add_assoc_double(__arg, __key, __d) add_assoc_double_ex(__arg, __key, strlen(__key)+1, __d)
164 #define add_assoc_string(__arg, __key, __str, __duplicate) add_assoc_string_ex(__arg, __key, strlen(__key)+1, __str, __duplicate)
165 #define add_assoc_stringl(__arg, __key, __str, __length, __duplicate) add_assoc_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate)
166 #define add_assoc_zval(__arg, __key, __value) add_assoc_zval_ex(__arg, __key, strlen(__key)+1, __value)
6847fefa » Thies C. Arntzen
1999-10-04 added add_*_resource() and add_*_bool() functions
167
0611acb9 » andigutmans
2001-01-31 - Change unset() functions to null(). unset() is legacy
168 /* unset() functions are only suported for legacy modules and null() functions should be used */
169 #define add_assoc_unset(__arg, __key) add_assoc_null_ex(__arg, __key, strlen(__key) + 1)
170 #define add_index_unset(__arg, __key) add_index_null(__arg, __key)
171 #define add_next_index_unset(__arg) add_next_index_null(__arg)
172 #define add_property_unset(__arg, __key) add_property_null(__arg, __key)
173
573b4602 » andigutmans
1999-04-07 Zend Library
174 ZEND_API int add_index_long(zval *arg, uint idx, long n);
0611acb9 » andigutmans
2001-01-31 - Change unset() functions to null(). unset() is legacy
175 ZEND_API int add_index_null(zval *arg, uint idx);
6847fefa » Thies C. Arntzen
1999-10-04 added add_*_resource() and add_*_bool() functions
176 ZEND_API int add_index_bool(zval *arg, uint idx, int b);
177 ZEND_API int add_index_resource(zval *arg, uint idx, int r);
573b4602 » andigutmans
1999-04-07 Zend Library
178 ZEND_API int add_index_double(zval *arg, uint idx, double d);
179 ZEND_API int add_index_string(zval *arg, uint idx, char *str, int duplicate);
180 ZEND_API int add_index_stringl(zval *arg, uint idx, char *str, uint length, int duplicate);
57f99633 » Andrei Zmievski
2001-01-22 Make add_index_zval() available to the outside world.
181 ZEND_API int add_index_zval(zval *arg, uint index, zval *value);
6847fefa » Thies C. Arntzen
1999-10-04 added add_*_resource() and add_*_bool() functions
182
573b4602 » andigutmans
1999-04-07 Zend Library
183 ZEND_API int add_next_index_long(zval *arg, long n);
0611acb9 » andigutmans
2001-01-31 - Change unset() functions to null(). unset() is legacy
184 ZEND_API int add_next_index_null(zval *arg);
6847fefa » Thies C. Arntzen
1999-10-04 added add_*_resource() and add_*_bool() functions
185 ZEND_API int add_next_index_bool(zval *arg, int b);
186 ZEND_API int add_next_index_resource(zval *arg, int r);
573b4602 » andigutmans
1999-04-07 Zend Library
187 ZEND_API int add_next_index_double(zval *arg, double d);
188 ZEND_API int add_next_index_string(zval *arg, char *str, int duplicate);
189 ZEND_API int add_next_index_stringl(zval *arg, char *str, uint length, int duplicate);
ef95a346 » andigutmans
2001-01-20 - Patch from Sterling. Add API calls to add zval's as array indeces/
190 ZEND_API int add_next_index_zval(zval *arg, zval *value);
191
192 ZEND_API int add_get_assoc_string_ex(zval *arg, char *key, uint key_len, char *str, void **dest, int duplicate);
193 ZEND_API int add_get_assoc_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, void **dest, int duplicate);
194
195 #define add_get_assoc_string(__arg, __key, __str, __dest, __duplicate) add_get_assoc_string_ex(__arg, __key, strlen(__key)+1, __str, __dest, __duplicate)
196 #define add_get_assoc_stringl(__arg, __key, __str, __length, __dest, __duplicate) add_get_assoc_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __dest, __duplicate)
573b4602 » andigutmans
1999-04-07 Zend Library
197
198 ZEND_API int add_get_index_long(zval *arg, uint idx, long l, void **dest);
199 ZEND_API int add_get_index_double(zval *arg, uint idx, double d, void **dest);
200 ZEND_API int add_get_index_string(zval *arg, uint idx, char *str, void **dest, int duplicate);
201 ZEND_API int add_get_index_stringl(zval *arg, uint idx, char *str, uint length, void **dest, int duplicate);
202
ef95a346 » andigutmans
2001-01-20 - Patch from Sterling. Add API calls to add zval's as array indeces/
203 ZEND_API int add_property_long_ex(zval *arg, char *key, uint key_len, long l);
0611acb9 » andigutmans
2001-01-31 - Change unset() functions to null(). unset() is legacy
204 ZEND_API int add_property_null_ex(zval *arg, char *key, uint key_len);
ef95a346 » andigutmans
2001-01-20 - Patch from Sterling. Add API calls to add zval's as array indeces/
205 ZEND_API int add_property_bool_ex(zval *arg, char *key, uint key_len, int b);
206 ZEND_API int add_property_resource_ex(zval *arg, char *key, uint key_len, long r);
207 ZEND_API int add_property_double_ex(zval *arg, char *key, uint key_len, double d);
208 ZEND_API int add_property_string_ex(zval *arg, char *key, uint key_len, char *str, int duplicate);
209 ZEND_API int add_property_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, int duplicate);
210 ZEND_API int add_property_zval_ex(zval *arg, char *key, uint key_len, zval *value);
211
212 #define add_property_long(__arg, __key, __n) add_property_long_ex(__arg, __key, strlen(__key)+1, __n)
0611acb9 » andigutmans
2001-01-31 - Change unset() functions to null(). unset() is legacy
213 #define add_property_null(__arg, __key) add_property_null_ex(__arg, __key, strlen(__key) + 1)
ef95a346 » andigutmans
2001-01-20 - Patch from Sterling. Add API calls to add zval's as array indeces/
214 #define add_property_bool(__arg, __key, __b) add_property_bool_ex(__arg, __key, strlen(__key)+1, __b)
215 #define add_property_resource(__arg, __key, __r) add_property_resource_ex(__arg, __key, strlen(__key)+1, __r)
216 #define add_property_double(__arg, __key, __d) add_property_double_ex(__arg, __key, strlen(__key)+1, __d)
217 #define add_property_string(__arg, __key, __str, __duplicate) add_property_string_ex(__arg, __key, strlen(__key)+1, __str, __duplicate)
218 #define add_property_stringl(__arg, __key, __str, __length, __duplicate) add_property_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate)
219 #define add_property_zval(__arg, __key, __value) add_property_zval_ex(__arg, __key, strlen(__key)+1, __value)
220
be895bcb » zsuraski
2000-12-13 Fix call_user_function() with objects - it could leak under certain c…
221 ZEND_API int call_user_function(HashTable *function_table, zval **object_pp, zval *function_name, zval *retval_ptr, int param_count, zval *params[]);
222 ZEND_API int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *function_name, zval **retval_ptr_ptr, int param_count, zval **params[], int no_separation, HashTable *symbol_table);
573b4602 » andigutmans
1999-04-07 Zend Library
223
f962a35d » Andrei Zmievski
1999-12-04 Added zend_set_hash_symbol() function.
224 ZEND_API int zend_set_hash_symbol(zval *symbol, char *name, int name_length,
225 int is_ref, int num_symbol_tables, ...);
226
573b4602 » andigutmans
1999-04-07 Zend Library
227 #define add_method(arg,key,method) add_assoc_function((arg),(key),(method))
228
af22085c » Thies C. Arntzen
2000-01-04 added ZVAL_*() macros.
229 #define ZVAL_RESOURCE(z,l) { \
230 (z)->type = IS_RESOURCE; \
231 (z)->value.lval = l; \
232 }
233 #define ZVAL_BOOL(z,b) { \
234 (z)->type = IS_BOOL; \
235 (z)->value.lval = b; \
236 }
237 #define ZVAL_NULL(z) { \
238 (z)->type = IS_NULL; \
239 }
240 #define ZVAL_LONG(z,l) { \
241 (z)->type = IS_LONG; \
242 (z)->value.lval = l; \
243 }
244 #define ZVAL_DOUBLE(z,d) { \
245 (z)->type = IS_DOUBLE; \
246 (z)->value.dval = d; \
247 }
248 #define ZVAL_STRING(z,s,duplicate) { \
249 char *__s=(s); \
250 (z)->value.str.len = strlen(__s); \
251 (z)->value.str.val = (duplicate?estrndup(__s,(z)->value.str.len):__s); \
252 (z)->type = IS_STRING; \
253 }
254 #define ZVAL_STRINGL(z,s,l,duplicate) { \
255 char *__s=(s); int __l=l; \
256 (z)->value.str.len = __l; \
257 (z)->value.str.val = (duplicate?estrndup(__s,__l):__s); \
258 (z)->type = IS_STRING; \
259 }
260
261 #define ZVAL_EMPTY_STRING(z) { \
262 (z)->value.str.len = 0; \
1f793fd0 » smalyshev
2000-08-17 Fix EMPTY_STRING macros
263 (z)->value.str.val = empty_string; \
af22085c » Thies C. Arntzen
2000-01-04 added ZVAL_*() macros.
264 (z)->type = IS_STRING; \
265 }
266
267 #define ZVAL_FALSE { (z)->value.lval = 0; (z)->type = IS_BOOL; }
268 #define ZVAL_TRUE { (z)->value.lval = 1; (z)->type = IS_BOOL; }
269
eb5c6da5 » Thies C. Arntzen
1999-07-05 added RETVAL_RESOURCE and RETURN_RESOURCE
270 #define RETVAL_RESOURCE(l) { \
271 return_value->type = IS_RESOURCE;\
272 return_value->value.lval = l; \
273 }
1fe57c95 » zsuraski
1999-12-22 - Fix function_exists()
274 #define RETVAL_BOOL(b) { \
275 return_value->type = IS_BOOL; \
276 return_value->value.lval = b; \
277 }
fb6a1b8b » Thies C. Arntzen
2000-01-19 RETURN_NULL -> RETURN_NULL() // we don't want macros without an argumnet
278 #define RETVAL_NULL() { \
bdefd5da » andigutmans
2000-01-04 - Change IS_UNSET -> IS_NULL
279 return_value->type = IS_NULL; \
f2d703e9 » zsuraski
1999-12-31 - Nuke undefined_variable_string
280 }
1f985ede » zsuraski
1999-05-27 Moved all #define's for SET_ and RETURN_ to zend_API.h
281 #define RETVAL_LONG(l) { \
282 return_value->type = IS_LONG; \
283 return_value->value.lval = l; \
284 }
285 #define RETVAL_DOUBLE(d) { \
286 return_value->type = IS_DOUBLE; \
287 return_value->value.dval = d; \
288 }
289 #define RETVAL_STRING(s,duplicate) { \
290 char *__s=(s); \
291 return_value->value.str.len = strlen(__s); \
292 return_value->value.str.val = (duplicate?estrndup(__s,return_value->value.str.len):__s); \
293 return_value->type = IS_STRING; \
294 }
295 #define RETVAL_STRINGL(s,l,duplicate) { \
296 char *__s=(s); int __l=l; \
297 return_value->value.str.len = __l; \
298 return_value->value.str.val = (duplicate?estrndup(__s,__l):__s); \
299 return_value->type = IS_STRING; \
300 }
301
af22085c » Thies C. Arntzen
2000-01-04 added ZVAL_*() macros.
302 #define RETVAL_EMPTY_STRING() { \
303 return_value->value.str.len = 0; \
1f793fd0 » smalyshev
2000-08-17 Fix EMPTY_STRING macros
304 return_value->value.str.val = empty_string; \
af22085c » Thies C. Arntzen
2000-01-04 added ZVAL_*() macros.
305 return_value->type = IS_STRING; \
306 }
307
1f985ede » zsuraski
1999-05-27 Moved all #define's for SET_ and RETURN_ to zend_API.h
308 #define RETVAL_FALSE { return_value->value.lval = 0; return_value->type = IS_BOOL; }
309 #define RETVAL_TRUE { return_value->value.lval = 1; return_value->type = IS_BOOL; }
310
eb5c6da5 » Thies C. Arntzen
1999-07-05 added RETVAL_RESOURCE and RETURN_RESOURCE
311 #define RETURN_RESOURCE(l) { \
312 return_value->type = IS_RESOURCE;\
313 return_value->value.lval = l; \
314 return; \
315 }
1fe57c95 » zsuraski
1999-12-22 - Fix function_exists()
316
317 #define RETURN_BOOL(b) { \
318 return_value->type = IS_BOOL; \
319 return_value->value.lval = b; \
320 return; \
321 }
322
fb6a1b8b » Thies C. Arntzen
2000-01-19 RETURN_NULL -> RETURN_NULL() // we don't want macros without an argumnet
323 #define RETURN_NULL() { \
bdefd5da » andigutmans
2000-01-04 - Change IS_UNSET -> IS_NULL
324 return_value->type = IS_NULL; \
f2d703e9 » zsuraski
1999-12-31 - Nuke undefined_variable_string
325 return; \
326 }
327
1f985ede » zsuraski
1999-05-27 Moved all #define's for SET_ and RETURN_ to zend_API.h
328 #define RETURN_LONG(l) { \
329 return_value->type = IS_LONG; \
330 return_value->value.lval = l; \
331 return; \
332 }
333 #define RETURN_DOUBLE(d) { \
334 return_value->type = IS_DOUBLE; \
335 return_value->value.dval = d; \
336 return; \
337 }
338 #define RETURN_STRING(s,duplicate) { \
339 char *__s=(s); \
340 return_value->value.str.len = strlen(__s); \
341 return_value->value.str.val = (duplicate?estrndup(__s,return_value->value.str.len):__s); \
342 return_value->type = IS_STRING; \
343 return; \
344 }
345 #define RETURN_STRINGL(s,l,duplicate) { \
346 char *__s=(s); int __l=l; \
347 return_value->value.str.len = __l; \
348 return_value->value.str.val = (duplicate?estrndup(__s,__l):__s); \
349 return_value->type = IS_STRING; \
350 return; \
351 }
352
af22085c » Thies C. Arntzen
2000-01-04 added ZVAL_*() macros.
353 #define RETURN_EMPTY_STRING() { \
354 return_value->value.str.len = 0; \
1f793fd0 » smalyshev
2000-08-17 Fix EMPTY_STRING macros
355 return_value->value.str.val = empty_string; \
af22085c » Thies C. Arntzen
2000-01-04 added ZVAL_*() macros.
356 return_value->type = IS_STRING; \
357 return; \
358 }
359
1f985ede » zsuraski
1999-05-27 Moved all #define's for SET_ and RETURN_ to zend_API.h
360 #define RETURN_FALSE { RETVAL_FALSE; return; }
361 #define RETURN_TRUE { RETVAL_TRUE; return; }
362
48ffdd79 » zsuraski
1999-07-30 * Setting variables in the global scope wasn't handling is_ref's prop…
363 #define SET_VAR_STRING(n,v) { \
364 { \
235386b2 » zsuraski
1999-12-26 Change ALLOC_ZVAL() semantics
365 zval *var; \
48ffdd79 » zsuraski
1999-07-30 * Setting variables in the global scope wasn't handling is_ref's prop…
366 char *str=(v); /* prevent 'v' from being evaluated more than once */ \
367 \
235386b2 » zsuraski
1999-12-26 Change ALLOC_ZVAL() semantics
368 ALLOC_ZVAL(var); \
48ffdd79 » zsuraski
1999-07-30 * Setting variables in the global scope wasn't handling is_ref's prop…
369 var->value.str.val = (str); \
370 var->value.str.len = strlen((str)); \
371 var->type = IS_STRING; \
6393ab14 » zsuraski
1999-08-06 Now that's an annoying bug.
372 ZEND_SET_GLOBAL_VAR(n, var); \
48ffdd79 » zsuraski
1999-07-30 * Setting variables in the global scope wasn't handling is_ref's prop…
373 } \
1f985ede » zsuraski
1999-05-27 Moved all #define's for SET_ and RETURN_ to zend_API.h
374 }
48ffdd79 » zsuraski
1999-07-30 * Setting variables in the global scope wasn't handling is_ref's prop…
375
376 #define SET_VAR_STRINGL(n,v,l) { \
377 { \
235386b2 » zsuraski
1999-12-26 Change ALLOC_ZVAL() semantics
378 zval *var; \
48ffdd79 » zsuraski
1999-07-30 * Setting variables in the global scope wasn't handling is_ref's prop…
379 \
235386b2 » zsuraski
1999-12-26 Change ALLOC_ZVAL() semantics
380 ALLOC_ZVAL(var); \
48ffdd79 » zsuraski
1999-07-30 * Setting variables in the global scope wasn't handling is_ref's prop…
381 var->value.str.val = (v); \
382 var->value.str.len = (l); \
383 var->type = IS_STRING; \
384 ZEND_SET_GLOBAL_VAR(n, var); \
385 } \
1f985ede » zsuraski
1999-05-27 Moved all #define's for SET_ and RETURN_ to zend_API.h
386 }
48ffdd79 » zsuraski
1999-07-30 * Setting variables in the global scope wasn't handling is_ref's prop…
387
388 #define SET_VAR_LONG(n,v) { \
389 { \
235386b2 » zsuraski
1999-12-26 Change ALLOC_ZVAL() semantics
390 zval *var; \
48ffdd79 » zsuraski
1999-07-30 * Setting variables in the global scope wasn't handling is_ref's prop…
391 \
235386b2 » zsuraski
1999-12-26 Change ALLOC_ZVAL() semantics
392 ALLOC_ZVAL(var); \
48ffdd79 » zsuraski
1999-07-30 * Setting variables in the global scope wasn't handling is_ref's prop…
393 var->value.lval = (v); \
394 var->type = IS_LONG; \
395 ZEND_SET_GLOBAL_VAR(n, var); \
396 } \
1f985ede » zsuraski
1999-05-27 Moved all #define's for SET_ and RETURN_ to zend_API.h
397 }
48ffdd79 » zsuraski
1999-07-30 * Setting variables in the global scope wasn't handling is_ref's prop…
398
399 #define SET_VAR_DOUBLE(n,v) { \
400 { \
235386b2 » zsuraski
1999-12-26 Change ALLOC_ZVAL() semantics
401 zval *var; \
48ffdd79 » zsuraski
1999-07-30 * Setting variables in the global scope wasn't handling is_ref's prop…
402 \
235386b2 » zsuraski
1999-12-26 Change ALLOC_ZVAL() semantics
403 ALLOC_ZVAL(var); \
48ffdd79 » zsuraski
1999-07-30 * Setting variables in the global scope wasn't handling is_ref's prop…
404 var->value.dval = (v); \
405 var->type = IS_DOUBLE; \
406 ZEND_SET_GLOBAL_VAR(n, var); \
407 } \
1f985ede » zsuraski
1999-05-27 Moved all #define's for SET_ and RETURN_ to zend_API.h
408 }
409
410
c34560b5 » andigutmans
1999-12-03 - Remove _EX and make it the old _LENGTH
411 #define ZEND_SET_SYMBOL(symtable, name, var) \
412 { \
413 char *_name = (name); \
414 \
4c8259b5 » andigutmans
1999-12-04 - Call ZEND_SET_SYMBOL_WITH_LENGTH() with refcount 1 from the standard
415 ZEND_SET_SYMBOL_WITH_LENGTH(symtable, _name, strlen(_name)+1, var, 1, 0); \
48ffdd79 » zsuraski
1999-07-30 * Setting variables in the global scope wasn't handling is_ref's prop…
416 }
417
c34560b5 » andigutmans
1999-12-03 - Remove _EX and make it the old _LENGTH
418 #define ZEND_SET_SYMBOL_WITH_LENGTH(symtable, name, name_length, var, _refcount, _is_ref) \
48ffdd79 » zsuraski
1999-07-30 * Setting variables in the global scope wasn't handling is_ref's prop…
419 { \
420 zval **orig_var; \
421 \
620d0134 » zsuraski
1999-07-30 Support symbols in any symbol table, not just the active one
422 if (zend_hash_find(symtable, (name), (name_length), (void **) &orig_var)==SUCCESS \
48ffdd79 » zsuraski
1999-07-30 * Setting variables in the global scope wasn't handling is_ref's prop…
423 && PZVAL_IS_REF(*orig_var)) { \
158088ca » zsuraski
1999-12-01 Allow to set the reference count explicitly for ZEND_SET_SYMBOL_WITH_…
424 (var)->refcount = (*orig_var)->refcount; \
52a30fd2 » Andrei Zmievski
1999-10-18 Be safe, use ().
425 (var)->is_ref = 1; \
48ffdd79 » zsuraski
1999-07-30 * Setting variables in the global scope wasn't handling is_ref's prop…
426 \
2ddc4fe4 » zsuraski
1999-12-01 Make it possible to explicitly set refcount in ZEND_SET_SYMBOL_WITH_L…
427 if (_refcount) { \
428 (var)->refcount += _refcount-1; \
429 } \
48ffdd79 » zsuraski
1999-07-30 * Setting variables in the global scope wasn't handling is_ref's prop…
430 zval_dtor(*orig_var); \
158088ca » zsuraski
1999-12-01 Allow to set the reference count explicitly for ZEND_SET_SYMBOL_WITH_…
431 **orig_var = *(var); \
62b2087a » andigutmans
1999-12-24 - Create two new macro's. ALLOC_ZVAL() and FREE_ZVAL(z) and make Zend…
432 FREE_ZVAL(var); \
48ffdd79 » zsuraski
1999-07-30 * Setting variables in the global scope wasn't handling is_ref's prop…
433 } else { \
2f5efbde » andigutmans
1999-12-02 - Add _EX macro for Andrei
434 (var)->is_ref = _is_ref; \
158088ca » zsuraski
1999-12-01 Allow to set the reference count explicitly for ZEND_SET_SYMBOL_WITH_…
435 if (_refcount) { \
436 (var)->refcount = _refcount; \
437 } \
438 zend_hash_update(symtable, (name), (name_length), &(var), sizeof(zval *), NULL); \
48ffdd79 » zsuraski
1999-07-30 * Setting variables in the global scope wasn't handling is_ref's prop…
439 } \
440 }
441
620d0134 » zsuraski
1999-07-30 Support symbols in any symbol table, not just the active one
442
443 #define ZEND_SET_GLOBAL_VAR(name, var) \
444 ZEND_SET_SYMBOL(&EG(symbol_table), name, var)
445
e3450661 » Andrei Zmievski
1999-12-03 *** empty log message ***
446 #define ZEND_SET_GLOBAL_VAR_WITH_LENGTH(name, name_length, var, _refcount, _is_ref) \
447 ZEND_SET_SYMBOL_WITH_LENGTH(&EG(symbol_table), name, name_length, var, _refcount, _is_ref)
fec413c5 » Andrei Zmievski
1999-12-03 Added ZEND_SET_GLOBAL_VAR_WITH_LENGTH_EX() macro.
448
06a18f16 » andigutmans
1999-09-20 - Add some internal functions to Zend
449 #define HASH_OF(p) ((p)->type==IS_ARRAY ? (p)->value.ht : (((p)->type==IS_OBJECT ? (p)->value.obj.properties : NULL)))
af22085c » Thies C. Arntzen
2000-01-04 added ZVAL_*() macros.
450 #define ZVAL_IS_NULL(z) ((z)->type==IS_NULL)
06a18f16 » andigutmans
1999-09-20 - Add some internal functions to Zend
451
b982307d » Sascha Schumann
2000-07-02 Change header protection macros to conform to standard.
452 #endif /* ZEND_API_H */
573b4602 » andigutmans
1999-04-07 Zend Library
453
454 /*
455 * Local variables:
456 * tab-width: 4
457 * c-basic-offset: 4
458 * End:
459 */
Something went wrong with that request. Please try again.