cvs: /php4 SAPI.c internal_functions.c.in internal_functions_win32.c main.c main.h php.h

From: Date: Tue, 07 Dec 1999 20:49:32 +0000
Subject: cvs: /php4 SAPI.c internal_functions.c.in internal_functions_win32.c main.c main.h php.h
Groups: php.version4 
Request: Send a blank email to php-version4+get-7641@lists.php.net to get a copy of this message
rubys Tue Dec 7 15:49:32 1999 EDT Modified files: /php4 SAPI.c internal_functions.c.in internal_functions_win32.c main.c main.h php.h Log: Provide basis for shared libraries/dlls to contain internal extensions Index: php4/SAPI.c diff -u php4/SAPI.c:1.35 php4/SAPI.c:1.36 --- php4/SAPI.c:1.35 Sun Dec 5 11:25:28 1999 +++ php4/SAPI.c Tue Dec 7 15:49:01 1999 @@ -76,12 +76,12 @@ 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: php4/internal_functions.c.in diff -u php4/internal_functions.c.in:1.10 php4/internal_functions.c.in:1.11 --- php4/internal_functions.c.in:1.10 Tue Dec 7 06:37:29 1999 +++ php4/internal_functions.c.in Tue Dec 7 15:49:01 1999 @@ -18,9 +18,10 @@ */ -/* $Id: internal_functions.c.in,v 1.10 1999/12/07 11:37:29 thies Exp $ */ +/* $Id: internal_functions.c.in,v 1.11 1999/12/07 20:49:01 rubys Exp $ */ #include "php.h" +#include "main.h" #include "modules.h" #include "internal_functions_registry.h" #include "zend_compile.h" @@ -38,7 +39,7 @@ 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 @@ @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: php4/internal_functions_win32.c diff -u php4/internal_functions_win32.c:1.19 php4/internal_functions_win32.c:1.20 --- php4/internal_functions_win32.c:1.19 Tue Dec 7 06:37:29 1999 +++ php4/internal_functions_win32.c Tue Dec 7 15:49:01 1999 @@ -18,10 +18,11 @@ */ -/* $Id: internal_functions_win32.c,v 1.19 1999/12/07 11:37:29 thies Exp $ */ +/* $Id: internal_functions_win32.c,v 1.20 1999/12/07 20:49:01 rubys Exp $ */ #include "php.h" +#include "main.h" #include "modules.h" #include "internal_functions_registry.h" #include "zend_compile.h" @@ -62,7 +63,7 @@ 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 @@ 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: php4/main.c diff -u php4/main.c:1.152 php4/main.c:1.153 --- php4/main.c:1.152 Sun Dec 5 11:25:28 1999 +++ php4/main.c Tue Dec 7 15:49:01 1999 @@ -19,7 +19,7 @@ */ -/* $Id: main.c,v 1.152 1999/12/05 16:25:28 sas Exp $ */ +/* $Id: main.c,v 1.153 1999/12/07 20:49:01 rubys Exp $ */ #include <stdio.h> @@ -854,6 +854,54 @@ #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 @@ 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: php4/main.h diff -u php4/main.h:1.12 php4/main.h:1.13 --- php4/main.h:1.12 Sun Dec 5 09:16:35 1999 +++ php4/main.h Tue Dec 7 15:49:01 1999 @@ -18,7 +18,7 @@ */ -/* $Id: main.h,v 1.12 1999/12/05 14:16:35 rasmus Exp $ */ +/* $Id: main.h,v 1.13 1999/12/07 20:49:01 rubys Exp $ */ #ifndef _MAIN_H @@ -35,6 +35,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); Index: php4/php.h diff -u php4/php.h:1.49 php4/php.h:1.50 --- php4/php.h:1.49 Sat Dec 4 18:03:01 1999 +++ php4/php.h Tue Dec 7 15:49:01 1999 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php.h,v 1.49 1999/12/04 23:03:01 zeev Exp $ */ +/* $Id: php.h,v 1.50 1999/12/07 20:49:01 rubys Exp $ */ #ifndef _PHP_H #define _PHP_H @@ -312,9 +312,9 @@ #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 *));

« previous php.version4 (#7641) next »