From f8bbafd604528c7162b7b1706a09e12545fb2dcb Mon Sep 17 00:00:00 2001 From: Zeev Suraski Date: Sun, 3 Aug 2003 17:40:44 +0000 Subject: 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. --- Zend/zend_modules.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'Zend/zend_modules.h') diff --git a/Zend/zend_modules.h b/Zend/zend_modules.h index 572f52c315..1d56f1e89a 100644 --- a/Zend/zend_modules.h +++ b/Zend/zend_modules.h @@ -31,9 +31,11 @@ #define ZEND_MODULE_INFO_FUNC_ARGS zend_module_entry *zend_module TSRMLS_DC #define ZEND_MODULE_INFO_FUNC_ARGS_PASSTHRU zend_module TSRMLS_CC -ZEND_API extern unsigned char first_arg_force_ref[]; -ZEND_API extern unsigned char second_arg_force_ref[]; -ZEND_API extern unsigned char third_arg_force_ref[]; +ZEND_API extern struct _zend_arg_info first_arg_force_ref[2]; +ZEND_API extern struct _zend_arg_info second_arg_force_ref[3]; +ZEND_API extern struct _zend_arg_info third_arg_force_ref[4]; +ZEND_API extern struct _zend_arg_info fourth_arg_force_ref[5]; +ZEND_API extern struct _zend_arg_info all_args_by_ref[1]; #define ZEND_MODULE_API_NO 20020429 #ifdef ZTS @@ -65,7 +67,7 @@ struct _zend_module_entry { unsigned char zts; struct _zend_ini_entry *ini_entry; char *name; - zend_function_entry *functions; + struct _zend_function_entry *functions; int (*module_startup_func)(INIT_FUNC_ARGS); int (*module_shutdown_func)(SHUTDOWN_FUNC_ARGS); int (*request_startup_func)(INIT_FUNC_ARGS); -- cgit v1.2.1