]> granicus.if.org Git - php/commitdiff
Provide basis for shared libraries/dlls to contain internal extensions
authorSam Ruby <rubys@php.net>
Tue, 7 Dec 1999 20:49:01 +0000 (20:49 +0000)
committerSam Ruby <rubys@php.net>
Tue, 7 Dec 1999 20:49:01 +0000 (20:49 +0000)
main.h
main/SAPI.c
main/internal_functions.c.in
main/internal_functions_win32.c
main/main.c
main/php.h

diff --git a/main.h b/main.h
index c06954d2c9e1f1cf774677b4c6353342c1fb47cb..e476f490dde981c741f182f1d9312c84cf9b1b3b 100644 (file)
--- a/main.h
+++ b/main.h
@@ -36,6 +36,10 @@ PHPAPI void php_module_shutdown(void);
 PHPAPI void php_module_shutdown_for_exec(void);
 PHPAPI int php_module_shutdown_wrapper(sapi_module_struct *sapi_globals);
 
+PHPAPI int php_startup_extensions(zend_module_entry **ptr, int count);
+PHPAPI int php_global_startup_extensions(zend_module_entry **ptr, int count);
+PHPAPI int php_global_shutdown_extensions(zend_module_entry **ptr, int count);
+
 PHPAPI void php_execute_script(zend_file_handle *primary_file CLS_DC ELS_DC PLS_DC);
 
 extern void php_call_shutdown_functions(void);
index 01be19857efa59b086922f0e539b9260d78ad9f4..b88b8ebf8c2646339ff2d3518d8b73f564b48b71 100644 (file)
@@ -76,12 +76,12 @@ SAPI_API void sapi_startup(sapi_module_struct *sf)
        sapi_globals_id = ts_allocate_id(sizeof(sapi_globals_struct), NULL, NULL);
 #endif
 
-       module_global_startup_modules();
+       php_global_startup_internal_extensions();
 }
 
 SAPI_API void sapi_shutdown(void)
 {
-       module_global_shutdown_modules();
+       php_global_shutdown_internal_extensions();
        zend_hash_destroy(&known_post_content_types);
 }
 
index 7b3020fa3d3e20a8a777805f9d25f04ae574d630..da89aaab041230b3326a17acad47764b6b1f91b8 100644 (file)
@@ -21,6 +21,7 @@
 /* $Id$ */
 
 #include "php.h"
+#include "main.h"
 #include "modules.h"
 #include "internal_functions_registry.h"
 #include "zend_compile.h"
@@ -38,7 +39,7 @@ unsigned char first_arg_allow_ref[] = { 1, BYREF_ALLOW };
 unsigned char second_arg_force_ref[] = { 2, BYREF_NONE, BYREF_FORCE };
 unsigned char second_arg_allow_ref[] = { 2, BYREF_NONE, BYREF_ALLOW };
 
-zend_module_entry *php3_builtin_modules[] = {
+zend_module_entry *php_builtin_extensions[] = {
        phpext_regex_ptr,
        phpext_dl_ptr,
        phpext_file_ptr,
@@ -59,52 +60,22 @@ zend_module_entry *php3_builtin_modules[] = {
 @EXT_MODULE_PTRS@
 };
 
+#define EXTCOUNT (sizeof(php_builtin_extensions)/sizeof(zend_module_entry *))
+       
 
-int module_startup_modules(void)
+int php_startup_internal_extensions(void)
 {
-       zend_module_entry **ptr = php3_builtin_modules, **end = ptr+(sizeof(php3_builtin_modules)/sizeof(zend_module_entry *));
-
-       while (ptr < end) {
-               if (*ptr) {
-                       if (zend_startup_module(*ptr)==FAILURE) {
-                               return FAILURE;
-                       }
-               }
-               ptr++;
-       }
-       return SUCCESS;
+       return php_startup_extensions(php_builtin_extensions, EXTCOUNT);
 }
 
-int module_global_startup_modules(void)
+int php_global_startup_internal_extensions(void)
 {
-       zend_module_entry **ptr = php3_builtin_modules, **end = ptr+(sizeof(php3_builtin_modules)/sizeof(zend_module_entry *));
-
-       while (ptr < end) {
-               if (*ptr) {
-                       if ((*ptr)->global_startup_func && 
-                                       (*ptr)->global_startup_func()==FAILURE) {
-                               return FAILURE;
-                       }
-               }
-               ptr++;
-       }
-       return SUCCESS;
+       return php_global_startup_extensions(php_builtin_extensions, EXTCOUNT);
 }
 
-int module_global_shutdown_modules(void)
+int php_global_shutdown_internal_extensions(void)
 {
-       zend_module_entry **ptr = php3_builtin_modules, **end = ptr+(sizeof(php3_builtin_modules)/sizeof(zend_module_entry *));
-
-       while (ptr < end) {
-               if (*ptr) {
-                       if ((*ptr)->global_shutdown_func && 
-                                       (*ptr)->global_shutdown_func()==FAILURE) {
-                               return FAILURE;
-                       }
-               }
-               ptr++;
-       }
-       return SUCCESS;
+       return php_global_shutdown_extensions(php_builtin_extensions, EXTCOUNT);
 }
 
 /*
index c93de106b53fa0962873f9529de540c68adea1ac..b4666e87030800ac0588934fee747a488575023a 100644 (file)
@@ -22,6 +22,7 @@
 
 
 #include "php.h"
+#include "main.h"
 #include "modules.h"
 #include "internal_functions_registry.h"
 #include "zend_compile.h"
@@ -62,7 +63,7 @@ unsigned char first_arg_allow_ref[] = { 1, BYREF_ALLOW };
 unsigned char second_arg_force_ref[] = { 2, BYREF_NONE, BYREF_FORCE };
 unsigned char second_arg_allow_ref[] = { 2, BYREF_NONE, BYREF_ALLOW };
 
-zend_module_entry *php3_builtin_modules[] = {
+zend_module_entry *php_builtin_extensions[] = {
     phpext_dl_ptr,
     phpext_file_ptr,
     phpext_fsock_ptr,
@@ -89,52 +90,22 @@ zend_module_entry *php3_builtin_modules[] = {
        phpext_assert_ptr
 };
 
+#define EXTCOUNT (sizeof(php_builtin_extensions)/sizeof(zend_module_entry *))
+
        
-int module_startup_modules(void)
+int php_startup_internal_extensions(void)
 {
-       zend_module_entry **ptr = php3_builtin_modules, **end = ptr+(sizeof(php3_builtin_modules)/sizeof(zend_module_entry *));
-
-       while (ptr < end) {
-               if (*ptr) {
-                       if (zend_startup_module(*ptr)==FAILURE) {
-                               return FAILURE;
-                       }
-               }
-               ptr++;
-       }
-       return SUCCESS;
+       return php_startup_extensions(php_builtin_extensions, EXTCOUNT);
 }
 
-int module_global_startup_modules(void)
+int php_global_startup_internal_extensions(void)
 {
-       zend_module_entry **ptr = php3_builtin_modules, **end = ptr+(sizeof(php3_builtin_modules)/sizeof(zend_module_entry *));
-
-       while (ptr < end) {
-               if (*ptr) {
-                       if ((*ptr)->global_startup_func && 
-                                       (*ptr)->global_startup_func()==FAILURE) {
-                               return FAILURE;
-                       }
-               }
-               ptr++;
-       }
-       return SUCCESS;
+       return php_global_startup_extensions(php_builtin_extensions, EXTCOUNT);
 }
 
-int module_global_shutdown_modules(void)
+int php_global_shutdown_internal_extensions(void)
 {
-       zend_module_entry **ptr = php3_builtin_modules, **end = ptr+(sizeof(php3_builtin_modules)/sizeof(zend_module_entry *));
-
-       while (ptr < end) {
-               if (*ptr) {
-                       if ((*ptr)->global_shutdown_func && 
-                                       (*ptr)->global_shutdown_func()==FAILURE) {
-                               return FAILURE;
-                       }
-               }
-               ptr++;
-       }
-       return SUCCESS;
+       return php_global_shutdown_extensions(php_builtin_extensions, EXTCOUNT);
 }
 
 
index 08674d470a899e14faa2752f645cdc623d35a27e..f21d3563e763d7337463ed19f3ac953ae6608709 100644 (file)
@@ -854,6 +854,54 @@ static void core_globals_ctor(php_core_globals *core_globals)
 #endif
 
 
+int php_startup_extensions(zend_module_entry **ptr, int count)
+{
+       zend_module_entry **end = ptr+count;
+
+       while (ptr < end) {
+               if (*ptr) {
+                       if (zend_startup_module(*ptr)==FAILURE) {
+                               return FAILURE;
+                       }
+               }
+               ptr++;
+       }
+       return SUCCESS;
+}
+
+int php_global_startup_extensions(zend_module_entry **ptr, int count)
+{
+       zend_module_entry **end = ptr+count;
+
+       while (ptr < end) {
+               if (*ptr) {
+                       if ((*ptr)->global_startup_func && 
+                                       (*ptr)->global_startup_func()==FAILURE) {
+                               return FAILURE;
+                       }
+               }
+               ptr++;
+       }
+       return SUCCESS;
+}
+
+int php_global_shutdown_extensions(zend_module_entry **ptr, int count)
+{
+       zend_module_entry **end = ptr+count;
+
+       while (ptr < end) {
+               if (*ptr) {
+                       if ((*ptr)->global_shutdown_func && 
+                                       (*ptr)->global_shutdown_func()==FAILURE) {
+                               return FAILURE;
+                       }
+               }
+               ptr++;
+       }
+       return SUCCESS;
+}
+
+
 int php_module_startup(sapi_module_struct *sf)
 {
        zend_utility_functions zuf;
@@ -934,8 +982,8 @@ int php_module_startup(sapi_module_struct *sf)
        zend_set_utility_values(&zuv);
        php_startup_SAPI_content_types();
 
-       if (module_startup_modules() == FAILURE) {
-               php_printf("Unable to start modules\n");
+       if (php_startup_internal_extensions() == FAILURE) {
+               php_printf("Unable to start builtin modules\n");
                return FAILURE;
        }
        module_initialized = 1;
index 47f0f367c8b28fcbfc5a77b26cce088b6a633f3b..6caa8c445cbb3351c548149f1a5677a86c3b8030 100644 (file)
@@ -312,9 +312,9 @@ extern void html_putc(char c);
 #define phpin zendin
 
 /* functions */
-int module_startup_modules(void);
-int module_global_startup_modules(void);
-int module_global_shutdown_modules(void);
+int php_startup_internal_extensions(void);
+int php_global_startup_internal_extensions(void);
+int php_global_shutdown_internal_extensions(void);
 
 int mergesort(void *base, size_t nmemb, register size_t size, int (*cmp) (const void *, const void *));