this may be a bit premature, but how do i inject the classes, functions and constants in my extension into a namespace ?
l0t3k
See below :-)
marcus
/* {{{ register_namespace */
/* You will have to alloc the pns before the call */
void register_namespace(zend_namespace * pns, char *namespace_name TSRMLS_DC)
{
pns->name_length = strlen(namespace_name);
pns->name = namespace_name;
zend_hash_add(&CG(global_namespace).class_table, pns->name, pns->name_length+1, (void **)&pns, sizeof(zend_namespace *), NULL);
zend_init_namespace(pns TSRMLS_CC); } /* }}} */
/* {{{ register_interface */
/* You will have to alloc the pce before the call and namespace_entry must be valid */
void register_interface(zend_class_entry *pce, zend_namespace *namespace_entry, char *class_name TSRMLS_DC)
{
pce->type = ZEND_USER_CLASS;
pce->name_length = strlen(class_name);
pce->name = class_name;
pce->parent = NULL; pce->num_interfaces = 0;
zend_initialize_class_data(pce, 1 TSRMLS_CC); /* entries changed by initialize */ pce->ce_flags = ZEND_ACC_ABSTRACT | ZEND_ACC_INTERFACE; pce->ns = namespace_entry;
zend_hash_add(&namespace_entry->class_table, class_name, pce->name_length+1, &pce, sizeof(zend_class_entry *), NULL);
}
/* }}} */
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php