Index: Zend/zend_builtin_functions.c =================================================================== RCS file: /repository/ZendEngine2/zend_builtin_functions.c,v retrieving revision 1.277.2.12.2.15 diff -u -p -d -r1.277.2.12.2.15 zend_builtin_functions.c --- Zend/zend_builtin_functions.c 1 Jan 2007 09:35:46 -0000 1.277.2.12.2.15 +++ Zend/zend_builtin_functions.c 11 Feb 2007 11:36:28 -0000 @@ -73,6 +73,7 @@ static ZEND_FUNCTION(get_resource_type); static ZEND_FUNCTION(get_loaded_extensions); static ZEND_FUNCTION(extension_loaded); static ZEND_FUNCTION(get_extension_funcs); +static ZEND_FUNCTION(get_extension_classes); static ZEND_FUNCTION(get_defined_constants); static ZEND_FUNCTION(debug_backtrace); static ZEND_FUNCTION(debug_print_backtrace); @@ -135,6 +136,7 @@ static zend_function_entry builtin_funct ZEND_FE(get_loaded_extensions, NULL) ZEND_FE(extension_loaded, NULL) ZEND_FE(get_extension_funcs, NULL) + ZEND_FE(get_extension_classes, NULL) ZEND_FE(get_defined_constants, NULL) ZEND_FE(debug_backtrace, NULL) ZEND_FE(debug_print_backtrace, NULL) @@ -2156,6 +2158,52 @@ ZEND_FUNCTION(get_extension_funcs) } /* }}} */ +/* {{{ proto array get_extension_classes(string extension_name) + Returns an array with the names of classes belonging to the named extension */ +ZEND_FUNCTION(get_extension_classes) +{ + char *extension_name; + int extension_name_len, i = 0; + zend_module_entry *module = NULL; + zend_class_entry **class_entry; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, \"s\", &extension_name, &extension_name_len) == FAILURE) { + return; + } + + if (strncasecmp(extension_name, \"zend\", sizeof(\"zend\"))) { + char *lcname = zend_str_tolower_dup(extension_name, extension_name_len); + if (zend_hash_find(&module_registry, lcname, extension_name_len + 1, (void**)&module) == FAILURE) { + efree(lcname); + RETURN_FALSE; + } + efree(lcname); + } + + array_init(return_value); + + for (zend_hash_internal_pointer_reset(EG(class_table)); + zend_hash_get_current_data(EG(class_table), (void **) &class_entry) == SUCCESS; + zend_hash_move_forward(EG(class_table))) { + + if (!module) { + /* looking for engine internal classes */ + if (!(*class_entry)->module) { + add_next_index_string(return_value, (*class_entry)->name, 1); + i++; + } + } else if ((*class_entry)->module && (*class_entry)->module->module_number == module->module_number) { + add_next_index_string(return_value, (*class_entry)->name, 1); + i++; + } + } + if (!i) { + zval_dtor(return_value); + RETURN_FALSE; + } +} +/* }}} */ + /* * Local variables: * tab-width: 4