Return to spl_functions.h CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / spl |
1.1 ! misho 1: /* ! 2: +----------------------------------------------------------------------+ ! 3: | PHP Version 5 | ! 4: +----------------------------------------------------------------------+ ! 5: | Copyright (c) 1997-2012 The PHP Group | ! 6: +----------------------------------------------------------------------+ ! 7: | This source file is subject to version 3.01 of the PHP license, | ! 8: | that is bundled with this package in the file LICENSE, and is | ! 9: | available through the world-wide-web at the following url: | ! 10: | http://www.php.net/license/3_01.txt | ! 11: | If you did not receive a copy of the PHP license and are unable to | ! 12: | obtain it through the world-wide-web, please send a note to | ! 13: | license@php.net so we can mail you a copy immediately. | ! 14: +----------------------------------------------------------------------+ ! 15: | Authors: Marcus Boerger <helly@php.net> | ! 16: +----------------------------------------------------------------------+ ! 17: */ ! 18: ! 19: /* $Id: spl_functions.h 321634 2012-01-01 13:15:04Z felipe $ */ ! 20: ! 21: #ifndef PHP_FUNCTIONS_H ! 22: #define PHP_FUNCTIONS_H ! 23: ! 24: #include "php.h" ! 25: ! 26: typedef zend_object_value (*create_object_func_t)(zend_class_entry *class_type TSRMLS_DC); ! 27: ! 28: #define REGISTER_SPL_STD_CLASS(class_name, obj_ctor) \ ! 29: spl_register_std_class(&spl_ce_ ## class_name, # class_name, obj_ctor, NULL TSRMLS_CC); ! 30: ! 31: #define REGISTER_SPL_STD_CLASS_EX(class_name, obj_ctor, funcs) \ ! 32: spl_register_std_class(&spl_ce_ ## class_name, # class_name, obj_ctor, funcs TSRMLS_CC); ! 33: ! 34: #define REGISTER_SPL_SUB_CLASS_EX(class_name, parent_class_name, obj_ctor, funcs) \ ! 35: spl_register_sub_class(&spl_ce_ ## class_name, spl_ce_ ## parent_class_name, # class_name, obj_ctor, funcs TSRMLS_CC); ! 36: ! 37: #define REGISTER_SPL_INTERFACE(class_name) \ ! 38: spl_register_interface(&spl_ce_ ## class_name, # class_name, spl_funcs_ ## class_name TSRMLS_CC); ! 39: ! 40: #define REGISTER_SPL_IMPLEMENTS(class_name, interface_name) \ ! 41: zend_class_implements(spl_ce_ ## class_name TSRMLS_CC, 1, spl_ce_ ## interface_name); ! 42: ! 43: #define REGISTER_SPL_ITERATOR(class_name) \ ! 44: zend_class_implements(spl_ce_ ## class_name TSRMLS_CC, 1, zend_ce_iterator); ! 45: ! 46: #define REGISTER_SPL_PROPERTY(class_name, prop_name, prop_flags) \ ! 47: spl_register_property(spl_ce_ ## class_name, prop_name, sizeof(prop_name)-1, prop_flags TSRMLS_CC); ! 48: ! 49: #define REGISTER_SPL_CLASS_CONST_LONG(class_name, const_name, value) \ ! 50: zend_declare_class_constant_long(spl_ce_ ## class_name, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC); ! 51: ! 52: void spl_register_std_class(zend_class_entry ** ppce, char * class_name, create_object_func_t ctor, const zend_function_entry * function_list TSRMLS_DC); ! 53: void spl_register_sub_class(zend_class_entry ** ppce, zend_class_entry * parent_ce, char * class_name, create_object_func_t ctor, const zend_function_entry * function_list TSRMLS_DC); ! 54: void spl_register_interface(zend_class_entry ** ppce, char * class_name, const zend_function_entry *functions TSRMLS_DC); ! 55: ! 56: void spl_register_property( zend_class_entry * class_entry, char *prop_name, int prop_name_len, int prop_flags TSRMLS_DC); ! 57: ! 58: /* sub: whether to allow subclasses/interfaces ! 59: allow = 0: allow all classes and interfaces ! 60: allow > 0: allow all that match and mask ce_flags ! 61: allow < 0: disallow all that match and mask ce_flags ! 62: */ ! 63: void spl_add_class_name(zval * list, zend_class_entry * pce, int allow, int ce_flags TSRMLS_DC); ! 64: void spl_add_interfaces(zval * list, zend_class_entry * pce, int allow, int ce_flags TSRMLS_DC); ! 65: int spl_add_classes(zend_class_entry *pce, zval *list, int sub, int allow, int ce_flags TSRMLS_DC); ! 66: ! 67: /* caller must efree(return) */ ! 68: char * spl_gen_private_prop_name(zend_class_entry *ce, char *prop_name, int prop_len, int *name_len TSRMLS_DC); ! 69: ! 70: #define SPL_ME(class_name, function_name, arg_info, flags) \ ! 71: PHP_ME( spl_ ## class_name, function_name, arg_info, flags) ! 72: ! 73: #define SPL_ABSTRACT_ME(class_name, function_name, arg_info) \ ! 74: ZEND_ABSTRACT_ME( spl_ ## class_name, function_name, arg_info) ! 75: ! 76: #define SPL_METHOD(class_name, function_name) \ ! 77: PHP_METHOD(spl_ ## class_name, function_name) ! 78: ! 79: #define SPL_MA(class_name, function_name, alias_class, alias_function, arg_info, flags) \ ! 80: PHP_MALIAS(spl_ ## alias_class, function_name, alias_function, arg_info, flags) ! 81: #endif /* PHP_FUNCTIONS_H */ ! 82: ! 83: /* ! 84: * Local Variables: ! 85: * c-basic-offset: 4 ! 86: * tab-width: 4 ! 87: * End: ! 88: * vim600: fdm=marker ! 89: * vim: noet sw=4 ts=4 ! 90: */