Permalink
Browse files

Add oo support function zend_class_implements()

  • Loading branch information...
Marcus Boerger
Marcus Boerger committed Oct 15, 2003
1 parent d148ff7 commit 4073a08488e6a99e6438d9c15d72084c6b078c9d
Showing with 21 additions and 0 deletions.
  1. +20 −0 Zend/zend_API.c
  2. +1 −0 Zend/zend_API.h
View
@@ -1445,6 +1445,26 @@ ZEND_API zend_class_entry *zend_register_internal_class_ex(zend_class_entry *cla
return register_class;
}
+ZEND_API void zend_class_implements(zend_class_entry *class_entry TSRMLS_DC, int num_interfaces, ...)
+{
+ zend_class_entry *interface_entry;
+ va_list interface_list;
+
+ if (class_entry->type & ZEND_INTERNAL_CLASS) {
+ class_entry->interfaces = realloc(class_entry->interfaces, sizeof(zend_class_entry*) * (class_entry->num_interfaces+num_interfaces));
+ } else {
+ class_entry->interfaces = erealloc(class_entry->interfaces, sizeof(zend_class_entry*) * (class_entry->num_interfaces+num_interfaces));
+ }
+
+ va_start(interface_list, num_interfaces);
+ while (num_interfaces--) {
+ interface_entry = va_arg(interface_list, zend_class_entry *);
+ class_entry->interfaces[class_entry->num_interfaces++] = interface_entry;
+ zend_do_implement_interface(class_entry, interface_entry);
+ }
+ va_end(interface_list);
+}
+
ZEND_API zend_class_entry *zend_register_internal_class(zend_class_entry *orig_class_entry TSRMLS_DC)
{
zend_class_entry *class_entry = malloc(sizeof(zend_class_entry));
View
@@ -158,6 +158,7 @@ ZEND_API int zend_register_module(zend_module_entry *module_entry);
ZEND_API zend_class_entry *zend_register_internal_class(zend_class_entry *class_entry TSRMLS_DC);
ZEND_API zend_class_entry *zend_register_internal_class_ex(zend_class_entry *class_entry, zend_class_entry *parent_ce, char *parent_name TSRMLS_DC);
+ZEND_API void zend_class_implements(zend_class_entry *class_entry TSRMLS_DC, int num_interfaces, ...);
ZEND_API int zend_disable_function(char *function_name, uint function_name_length TSRMLS_DC);
ZEND_API int zend_disable_class(char *class_name, uint class_name_length TSRMLS_DC);

0 comments on commit 4073a08

Please sign in to comment.