summaryrefslogtreecommitdiff
path: root/Zend/zend_builtin_functions.c
diff options
context:
space:
mode:
authorZeev Suraski <zeev@php.net>2003-08-03 17:40:44 +0000
committerZeev Suraski <zeev@php.net>2003-08-03 17:40:44 +0000
commitf8bbafd604528c7162b7b1706a09e12545fb2dcb (patch)
tree9e65cf36603173dc4aebc1fb2971b79cb1b7e7b1 /Zend/zend_builtin_functions.c
parentf05452fbcdceac2d1d8176d2c1b69c741af54ae9 (diff)
downloadphp-git-f8bbafd604528c7162b7b1706a09e12545fb2dcb.tar.gz
ntroduce infrastructure for supplying information about arguments,
including: - Whether or not to pass by ref (replaces the old arg_types, with arg_info) - Argument name (for future use, maybe introspection) - Class/Interface name (for type hints) - If a class/interface name is available, whether to allow a null instance Both user and builtin functions share the same data structures. To declare a builtin function that expects its first arg to be an instance of class 'Person', its second argument as a regular arg, and its third by reference, use: ZEND_BEGIN_ARG_INFO(my_func_arg_info, 0) ZEND_ARG_OBJ_INFO(0, someone, Person, 1) ZEND_ARG_PASS_INFO(0) ZEND_ARG_PASS_INFO(1) ZEND_END_ARG_INFO(); and use my_func_arg_info as the arg_info parameter to the ZEND_FE() family of macros. The first arg to each ZEND_ARG_*() macro is whether or not to pass by ref. The boolean arg to ZEND_BEGIN_ARG_INFO() tells the engine whether to treat the arguments for which there's no explicit information as pass by reference or not. The boolean argument to ZEND_ARG_OBJ_INFO() (4th arg) is whether or not to allownull values.
Diffstat (limited to 'Zend/zend_builtin_functions.c')
-rw-r--r--Zend/zend_builtin_functions.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c
index 6fc3017c3a..1032d79204 100644
--- a/Zend/zend_builtin_functions.c
+++ b/Zend/zend_builtin_functions.c
@@ -80,9 +80,33 @@ static ZEND_FUNCTION(zend_thread_id);
#endif
#endif
-ZEND_API unsigned char first_arg_force_ref[] = { 1, BYREF_FORCE };
-ZEND_API unsigned char second_arg_force_ref[] = { 2, BYREF_NONE, BYREF_FORCE };
-ZEND_API unsigned char third_arg_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE };
+ZEND_API
+ ZEND_BEGIN_ARG_INFO(first_arg_force_ref, 0)
+ ZEND_ARG_PASS_INFO(1)
+ ZEND_END_ARG_INFO();
+
+
+ZEND_API
+ ZEND_BEGIN_ARG_INFO(second_arg_force_ref, 0)
+ ZEND_ARG_PASS_INFO(0)
+ ZEND_ARG_PASS_INFO(1)
+ ZEND_END_ARG_INFO();
+
+ZEND_API
+ ZEND_BEGIN_ARG_INFO(third_arg_force_ref, 0)
+ ZEND_ARG_PASS_INFO(0)
+ ZEND_ARG_PASS_INFO(0)
+ ZEND_ARG_PASS_INFO(1)
+ ZEND_END_ARG_INFO();
+
+
+ZEND_API
+ ZEND_BEGIN_ARG_INFO(fourth_arg_force_ref, 0)
+ ZEND_ARG_PASS_INFO(0)
+ ZEND_ARG_PASS_INFO(0)
+ ZEND_ARG_PASS_INFO(0)
+ ZEND_ARG_PASS_INFO(1)
+ ZEND_END_ARG_INFO();
static zend_function_entry builtin_functions[] = {
ZEND_FE(zend_version, NULL)
@@ -1712,6 +1736,7 @@ ZEND_FUNCTION(get_extension_funcs)
}
/* }}} */
+
/*
* Local variables:
* tab-width: 4