summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2003-08-03 22:29:20 +0000
committerMarcus Boerger <helly@php.net>2003-08-03 22:29:20 +0000
commit3b4f9d7b58fc2291795488c4dbedaac4d9532b68 (patch)
tree36294d4d18f62af7d009da61ad2b46066a86669b
parent1f8fd69e781ad7d1b57bca825a7709051a81594f (diff)
downloadphp-git-3b4f9d7b58fc2291795488c4dbedaac4d9532b68.tar.gz
Latest zend updates
-rwxr-xr-xext/spl/php_spl.c61
-rwxr-xr-xext/spl/spl_engine.c11
-rwxr-xr-xext/spl/spl_functions.c21
-rwxr-xr-xext/spl/spl_functions.h8
4 files changed, 59 insertions, 42 deletions
diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c
index 1dc8b94b5a..6634e156b5 100755
--- a/ext/spl/php_spl.c
+++ b/ext/spl/php_spl.c
@@ -99,6 +99,58 @@ static void spl_init_globals(zend_spl_globals *spl_globals)
}
/* }}} */
+PHP_FUNCTION(spl_abstract) {}
+
+#define SPL_ABSTRACT_FE(class, name, arg_info) \
+ { #name, ZEND_FN(spl_abstract), arg_info, sizeof(arg_info)/sizeof(struct _zend_arg_info)-1, ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC },
+
+static
+ZEND_BEGIN_ARG_INFO(arginfo_one_param, 0)
+ ZEND_ARG_PASS_INFO(0)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO(arginfo_two_params, 0)
+ ZEND_ARG_PASS_INFO(0)
+ ZEND_ARG_PASS_INFO(0)
+ZEND_END_ARG_INFO();
+
+function_entry spl_funcs_iterator[] = {
+ SPL_ABSTRACT_FE(iterator, new_iterator, NULL)
+ {NULL, NULL, NULL}
+};
+
+function_entry spl_funcs_forward[] = {
+ SPL_ABSTRACT_FE(forward, current, NULL)
+ SPL_ABSTRACT_FE(forward, next, NULL)
+ SPL_ABSTRACT_FE(forward, has_more, NULL)
+ {NULL, NULL, NULL}
+};
+
+function_entry spl_funcs_sequence[] = {
+ SPL_ABSTRACT_FE(sequence, rewind, NULL)
+ {NULL, NULL, NULL}
+};
+
+function_entry spl_funcs_assoc[] = {
+ SPL_ABSTRACT_FE(assoc, key, NULL)
+ {NULL, NULL, NULL}
+};
+
+function_entry *spl_funcs_forward_assoc = NULL;
+function_entry *spl_funcs_sequence_assoc = NULL;
+
+function_entry spl_funcs_array_read[] = {
+ SPL_ABSTRACT_FE(array_read, get, arginfo_one_param)
+ SPL_ABSTRACT_FE(array_read, exists, arginfo_one_param)
+ {NULL, NULL, NULL}
+};
+
+function_entry spl_funcs_array_access[] = {
+ SPL_ABSTRACT_FE(array_access, set, arginfo_two_params)
+ {NULL, NULL, NULL}
+};
+
/* {{{ PHP_MINIT_FUNCTION(spl)
*/
PHP_MINIT_FUNCTION(spl)
@@ -106,19 +158,13 @@ PHP_MINIT_FUNCTION(spl)
ZEND_INIT_MODULE_GLOBALS(spl, spl_init_globals, NULL);
REGISTER_SPL_INTERFACE(iterator);
- REGISTER_SPL_INTF_FUNC(iterator, new_iterator);
REGISTER_SPL_INTERFACE(forward);
- REGISTER_SPL_INTF_FUNC(forward, current);
- REGISTER_SPL_INTF_FUNC(forward, next);
- REGISTER_SPL_INTF_FUNC(forward, has_more);
REGISTER_SPL_INTERFACE(sequence);
- REGISTER_SPL_INTF_FUNC(sequence, rewind);
REGISTER_SPL_IMPLEMENT(sequence, forward);
REGISTER_SPL_INTERFACE(assoc);
- REGISTER_SPL_INTF_FUNC(assoc, key);
REGISTER_SPL_INTERFACE(forward_assoc);
REGISTER_SPL_IMPLEMENT(forward_assoc, assoc);
@@ -129,12 +175,9 @@ PHP_MINIT_FUNCTION(spl)
REGISTER_SPL_IMPLEMENT(sequence_assoc, sequence);
REGISTER_SPL_INTERFACE(array_read);
- REGISTER_SPL_INTF_FUNC(array_read, get);
- REGISTER_SPL_INTF_FUNC(array_read, exists);
REGISTER_SPL_INTERFACE(array_access);
REGISTER_SPL_IMPLEMENT(array_access, array_read);
- REGISTER_SPL_INTF_FUNC(array_access, set);
PHP_MINIT(spl_array)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(spl_directory)(INIT_FUNC_ARGS_PASSTHRU);
diff --git a/ext/spl/spl_engine.c b/ext/spl/spl_engine.c
index 35d233c7d1..17394f854d 100755
--- a/ext/spl/spl_engine.c
+++ b/ext/spl/spl_engine.c
@@ -176,10 +176,9 @@ spl_is_a spl_implements(zend_class_entry *ce)
/* {{{ spl_call_method */
int spl_call_method(zval **object_pp, zend_class_entry *obj_ce, zend_function **fn_proxy, char *function_name, int fname_len, zval **retval, HashTable *symbol_table TSRMLS_DC, int param_count, ...)
{
- int i, l;
+ int i;
zval *arg;
zval *param;
- unsigned char *arg_types;
zval **original_return_value;
HashTable *calling_symbol_table;
zend_function_state *original_function_state_ptr;
@@ -219,15 +218,11 @@ int spl_call_method(zval **object_pp, zend_class_entry *obj_ce, zend_function **
va_start(args, param_count);
if (param_count) {
- if ((arg_types = EX(function_state).function->common.arg_types) != NULL) {
- l = arg_types[0];
- } else {
- l = 0;
- }
for (i=1; i<=param_count; i++) {
arg = va_arg(args, zval*);
- if (i<=l && arg_types[i]==BYREF_FORCE && !PZVAL_IS_REF(arg)) {
+ if (ARG_SHOULD_BE_SENT_BY_REF(EX(function_state).function, i)
+ && !PZVAL_IS_REF(arg)) {
if (arg->refcount > 1) {
zval *new_zval;
diff --git a/ext/spl/spl_functions.c b/ext/spl/spl_functions.c
index 5efbaa7df3..32baa34f23 100755
--- a/ext/spl/spl_functions.c
+++ b/ext/spl/spl_functions.c
@@ -35,11 +35,11 @@ void spl_destroy_class(zend_class_entry ** ppce)
/* }}} */
/* {{{ spl_register_interface */
-void spl_register_interface(zend_class_entry ** ppce, char * class_name TSRMLS_DC)
+void spl_register_interface(zend_class_entry ** ppce, char * class_name, zend_function_entry *functions TSRMLS_DC)
{
zend_class_entry ce;
- INIT_CLASS_ENTRY(ce, class_name, NULL);
+ INIT_CLASS_ENTRY(ce, class_name, functions);
ce.name_length = strlen(class_name);
*ppce = zend_register_internal_class(&ce TSRMLS_CC);
@@ -62,23 +62,6 @@ void spl_register_std_class(zend_class_entry ** ppce, char * class_name, void *
}
/* }}} */
-/* {{{ spl_register_interface_function */
-void spl_register_interface_function(zend_class_entry * class_entry, char * fn_name TSRMLS_DC)
-{
- zend_function function, *reg_function;
- zend_internal_function *pfunction = (zend_internal_function *)&function;
-
- pfunction->type = ZEND_INTERNAL_FUNCTION;
- pfunction->handler = NULL;
- pfunction->arg_types = NULL;
- pfunction->function_name = fn_name;
- pfunction->scope = class_entry;
- pfunction->fn_flags = ZEND_ACC_ABSTRACT | ZEND_ACC_PUBLIC;
- pfunction->prototype = NULL;
- zend_hash_add(&class_entry->function_table, fn_name, strlen(fn_name)+1, &function, sizeof(zend_function), (void**)&reg_function);
-}
-/* }}} */
-
/* {{{ spl_register_parent_ce */
void spl_register_parent_ce(zend_class_entry * class_entry, zend_class_entry * parent_class TSRMLS_DC)
{
diff --git a/ext/spl/spl_functions.h b/ext/spl/spl_functions.h
index 0e4871c757..3eddbe0d84 100755
--- a/ext/spl/spl_functions.h
+++ b/ext/spl/spl_functions.h
@@ -30,10 +30,7 @@ typedef zend_object_value (*create_object_func_t)(zend_class_entry *class_type T
spl_register_std_class(&spl_ce_ ## class_name, "spl_" # class_name, obj_ctor, funcs TSRMLS_CC);
#define REGISTER_SPL_INTERFACE(class_name) \
- spl_register_interface(&spl_ce_ ## class_name, "spl_" # class_name TSRMLS_CC);
-
-#define REGISTER_SPL_INTF_FUNC(class_name, function_name) \
- spl_register_interface_function(spl_ce_ ## class_name, # function_name TSRMLS_CC);
+ spl_register_interface(&spl_ce_ ## class_name, "spl_" # class_name, spl_funcs_ ## class_name TSRMLS_CC);
#define REGISTER_SPL_PARENT_CE(class_name, parent_class) \
spl_register_parent_ce(spl_ce_ ## class_name, spl_ce_ ## parent_class TSRMLS_CC);
@@ -51,9 +48,8 @@ void spl_destroy_class(zend_class_entry ** ppce);
void spl_register_std_class(zend_class_entry ** ppce, char * class_name, create_object_func_t ctor, function_entry * function_list TSRMLS_DC);
-void spl_register_interface(zend_class_entry ** ppce, char * class_name TSRMLS_DC);
+void spl_register_interface(zend_class_entry ** ppce, char * class_name, zend_function_entry *functions TSRMLS_DC);
-void spl_register_interface_function(zend_class_entry * class_entry, char * fn_name TSRMLS_DC);
void spl_register_parent_ce(zend_class_entry * class_entry, zend_class_entry * parent_class TSRMLS_DC);
void spl_register_implement(zend_class_entry * class_entry, zend_class_entry * interface_entry TSRMLS_DC);
void spl_register_functions(zend_class_entry * class_entry, function_entry * function_list TSRMLS_DC);