helly           Thu Nov 17 17:59:41 2005 EDT

  Modified files:              
    /php-src/ext/reflection     php_reflection.c php_reflection.h 
  Log:
  - Move Reflection into its own extension
  
http://cvs.php.net/diff.php/php-src/ext/reflection/php_reflection.c?r1=1.189&r2=1.190&ty=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.189 
php-src/ext/reflection/php_reflection.c:1.190
--- php-src/ext/reflection/php_reflection.c:1.189       Tue Nov 15 10:20:19 2005
+++ php-src/ext/reflection/php_reflection.c     Thu Nov 17 17:59:38 2005
@@ -19,7 +19,17 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: php_reflection.c,v 1.189 2005/11/15 15:20:19 dmitry Exp $ */
+/* $Id: php_reflection.c,v 1.190 2005/11/17 22:59:38 helly Exp $ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "php.h"
+#include "php_ini.h"
+#include "php_reflection.h"
+#include "ext/standard/info.h"
+
 #include "zend.h"
 #include "zend_API.h"
 #include "zend_exceptions.h"
@@ -29,16 +39,34 @@
 #include "zend_interfaces.h"
 
 /* Class entry pointers */
-ZEND_API zend_class_entry *reflector_ptr;
-ZEND_API zend_class_entry *reflection_exception_ptr;
-ZEND_API zend_class_entry *reflection_ptr;
-ZEND_API zend_class_entry *reflection_function_ptr;
-ZEND_API zend_class_entry *reflection_parameter_ptr;
-ZEND_API zend_class_entry *reflection_class_ptr;
-ZEND_API zend_class_entry *reflection_object_ptr;
-ZEND_API zend_class_entry *reflection_method_ptr;
-ZEND_API zend_class_entry *reflection_property_ptr;
-ZEND_API zend_class_entry *reflection_extension_ptr;
+PHPAPI zend_class_entry *reflector_ptr;
+PHPAPI zend_class_entry *reflection_exception_ptr;
+PHPAPI zend_class_entry *reflection_ptr;
+PHPAPI zend_class_entry *reflection_function_ptr;
+PHPAPI zend_class_entry *reflection_parameter_ptr;
+PHPAPI zend_class_entry *reflection_class_ptr;
+PHPAPI zend_class_entry *reflection_object_ptr;
+PHPAPI zend_class_entry *reflection_method_ptr;
+PHPAPI zend_class_entry *reflection_property_ptr;
+PHPAPI zend_class_entry *reflection_extension_ptr;
+
+ZEND_BEGIN_MODULE_GLOBALS(reflection)
+ZEND_END_MODULE_GLOBALS(reflection)
+
+#ifdef ZTS
+# define REFLECTION_G(v) \
+       TSRMG(reflection_globals_id, zend_reflection_globals*, v)
+extern int reflection_globals_id;
+#else
+# define REFLECTION_G(v) (reflection_globals.v)
+extern zend_reflection_globals reflectionglobals;
+#endif
+
+#ifdef COMPILE_DL_REFLECTION
+ZEND_GET_MODULE(reflection)
+#endif
+
+ZEND_DECLARE_MODULE_GLOBALS(reflection)
 
 /* Method macros */
 
@@ -921,7 +949,7 @@
 /* }}} */
 
 /* {{{ zend_reflection_class_factory */
-ZEND_API void zend_reflection_class_factory(zend_class_entry *ce, zval *object 
TSRMLS_DC)
+PHPAPI void zend_reflection_class_factory(zend_class_entry *ce, zval *object 
TSRMLS_DC)
 {
        reflection_object *intern;
        zval *name;
@@ -4132,6 +4160,10 @@
 };
 /* }}} */
 
+function_entry reflection_ext_functions[] = { /* {{{ */
+       {NULL, NULL, NULL}
+}; /* }}} */
+
 static zend_object_handlers *zend_std_obj_handlers;
 
 /* {{{ _reflection_write_property */
@@ -4152,10 +4184,17 @@
 }
 /* }}} */
 
-/* {{{ zend_register_reflection_api */
-ZEND_API void zend_register_reflection_api(TSRMLS_D) {
+static void reflection_init_globals(zend_reflection_globals *globals) /* {{{ */
+{
+       /* Initialize your global struct */
+} /* }}} */
+
+PHP_MINIT_FUNCTION(reflection) /* {{{ */
+{
        zend_class_entry _reflection_entry;
 
+       ZEND_INIT_MODULE_GLOBALS(reflection, reflection_init_globals, NULL);
+
        zend_std_obj_handlers = zend_get_std_object_handlers();
        memcpy(&reflection_object_handlers, zend_get_std_object_handlers(), 
sizeof(zend_object_handlers));
        reflection_object_handlers.clone_obj = NULL;
@@ -4230,8 +4269,32 @@
        REGISTER_MAIN_LONG_CONSTANT("C_IMPLICIT_ABSTRACT", 
ZEND_ACC_IMPLICIT_ABSTRACT_CLASS, CONST_PERSISTENT|CONST_CS);
        REGISTER_MAIN_LONG_CONSTANT("C_EXPLICIT_ABSTRACT", 
ZEND_ACC_EXPLICIT_ABSTRACT_CLASS, CONST_PERSISTENT|CONST_CS);
        REGISTER_MAIN_LONG_CONSTANT("C_FINAL", ZEND_ACC_FINAL_CLASS, 
CONST_PERSISTENT|CONST_CS);
-}
-/* }}} */
+       
+       return SUCCESS;
+} /* }}} */
+
+PHP_MINFO_FUNCTION(reflection) /* {{{ */
+{
+       php_info_print_table_start();
+       php_info_print_table_header(2, "Reflection", "enabled");
+
+       php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.190 
2005/11/17 22:59:38 helly Exp $");
+
+       php_info_print_table_end();
+} /* }}} */
+
+zend_module_entry reflection_module_entry = { /* {{{ */
+       STANDARD_MODULE_HEADER,
+       "Reflection",
+       reflection_ext_functions,
+       PHP_MINIT(reflection),
+       NULL,
+       NULL,
+       NULL,
+       PHP_MINFO(reflection),
+       "0.1",
+       STANDARD_MODULE_PROPERTIES
+}; /* }}} */
 
 /*
  * Local variables:
http://cvs.php.net/diff.php/php-src/ext/reflection/php_reflection.h?r1=1.7&r2=1.8&ty=u
Index: php-src/ext/reflection/php_reflection.h
diff -u php-src/ext/reflection/php_reflection.h:1.7 
php-src/ext/reflection/php_reflection.h:1.8
--- php-src/ext/reflection/php_reflection.h:1.7 Mon Oct  3 06:04:33 2005
+++ php-src/ext/reflection/php_reflection.h     Thu Nov 17 17:59:39 2005
@@ -16,31 +16,35 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: php_reflection.h,v 1.7 2005/10/03 10:04:33 helly Exp $ */
+/* $Id: php_reflection.h,v 1.8 2005/11/17 22:59:39 helly Exp $ */
 
-#ifndef ZEND_REFLECTION_API_H
-#define ZEND_REFLECTION_API_H
+#ifndef PHP_REFLECTION_H
+#define PHP_REFLECTION_H
+
+#include "php.h"
+
+extern zend_module_entry reflection_module_entry;
+#define phpext_reflection_ptr &reflection_module_entry
 
 BEGIN_EXTERN_C()
 
 /* Class entry pointers */
-extern ZEND_API zend_class_entry *reflector_ptr;
-extern ZEND_API zend_class_entry *reflection_exception_ptr;
-extern ZEND_API zend_class_entry *reflection_ptr;
-extern ZEND_API zend_class_entry *reflection_function_ptr;
-extern ZEND_API zend_class_entry *reflection_parameter_ptr;
-extern ZEND_API zend_class_entry *reflection_class_ptr;
-extern ZEND_API zend_class_entry *reflection_object_ptr;
-extern ZEND_API zend_class_entry *reflection_method_ptr;
-extern ZEND_API zend_class_entry *reflection_property_ptr;
-extern ZEND_API zend_class_entry *reflection_extension_ptr;
+extern PHPAPI zend_class_entry *reflector_ptr;
+extern PHPAPI zend_class_entry *reflection_exception_ptr;
+extern PHPAPI zend_class_entry *reflection_ptr;
+extern PHPAPI zend_class_entry *reflection_function_ptr;
+extern PHPAPI zend_class_entry *reflection_parameter_ptr;
+extern PHPAPI zend_class_entry *reflection_class_ptr;
+extern PHPAPI zend_class_entry *reflection_object_ptr;
+extern PHPAPI zend_class_entry *reflection_method_ptr;
+extern PHPAPI zend_class_entry *reflection_property_ptr;
+extern PHPAPI zend_class_entry *reflection_extension_ptr;
 
-ZEND_API void zend_register_reflection_api(TSRMLS_D);
-ZEND_API void zend_reflection_class_factory(zend_class_entry *ce, zval *object 
TSRMLS_DC);
+PHPAPI void zend_reflection_class_factory(zend_class_entry *ce, zval *object 
TSRMLS_DC);
        
 END_EXTERN_C()
 
-#endif
+#endif /* PHP_REFLECTION_H */
 
 /*
  * Local variables:

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to