phanto          Thu Jan 16 12:49:21 2003 EDT

  Removed files:               
    /php4/ext/rpc       layer.h 

  Modified files:              
    /php4/ext/rpc       handler.h php_rpc.h rpc.c rpc.h 
    /php4/ext/rpc/com   php_com.h com.c com.h 
    /php4/ext/rpc/skeleton      skeleton.c skeleton.h 
  Log:
  make layers loadable as self-sustaining php extension
  which registeres itself in the rpc framework.
  
Index: php4/ext/rpc/handler.h
diff -u php4/ext/rpc/handler.h:1.13 php4/ext/rpc/handler.h:1.14
--- php4/ext/rpc/handler.h:1.13 Tue Dec 31 11:07:21 2002
+++ php4/ext/rpc/handler.h      Thu Jan 16 12:49:20 2003
@@ -22,31 +22,22 @@
 #include "php.h"
 #include "php_ini.h"
 
-#define RPC_HANDLER(layer)                             {#layer, layer##_handler_init, 
layer##_handler_shutdown,        \
-                                                                               
&layer##_object_handlers, &layer##_class_entry,                         \
-                                                                               
layer##_function_entry, layer##_method_entry,                           \
-                                                                               
layer##_ini_entry}
-
-#define RPC_DECLARE_HANDLER(layer)             void layer##_handler_init(int 
module_number TSRMLS_DC);         \
-                                                                               void 
layer##_handler_shutdown(TSRMLS_D);                                        \
-                                                                               
rpc_object_handlers layer##_object_handlers;                            \
+#define RPC_REGISTER_LAYER(layer)              
+rpc_register_layer(&layer##_handler_entry TSRMLS_CC);
+#define RPC_DECLARE_HANDLER(layer)             rpc_object_handlers 
+layer##_object_handlers;                            \
                                                                                
zend_class_entry *layer##_class_entry;                                          \
                                                                                
function_entry layer##_function_entry[];                                        \
                                                                                
function_entry layer##_method_entry[];                                          \
-                                                                               
zend_ini_entry layer##_ini_entry[];
+                                                                               static 
+rpc_handler_entry layer##_handler_entry =                        \
+                                                                                      
+ {#layer, &layer##_object_handlers, &layer##_class_entry,\
+                                                                                      
+ layer##_function_entry, layer##_method_entry}
 
-#define RPC_INIT_FUNCTION(layer)               void layer##_handler_init(int 
module_number TSRMLS_DC)
-#define RPC_SHUTDOWN_FUNCTION(layer)   void layer##_handler_shutdown(TSRMLS_D)
-
-#define RPC_REGISTER_HANDLERS_START(layer)             zend_class_entry 
*layer##_class_entry;                          \
+#define RPC_REGISTER_HANDLERS_BEGIN(layer)             zend_class_entry 
+*layer##_class_entry;                          \
                                                                                       
         rpc_object_handlers layer##_object_handlers = {
 
 #define RPC_REGISTER_HANDLERS_END()                            };
 
-#define RPC_INI_START(layer)                   zend_ini_entry layer##_ini_entry[] = {
-#define RPC_INI_END()                                  { 0, 0, NULL, 0, NULL, NULL, 
NULL, NULL, NULL, 0, NULL, 0, 0, NULL } };
-  
-#define RPC_FUNCTION_ENTRY_START(layer)        function_entry 
layer##_function_entry[] = {                             \
+#define RPC_FUNCTION_ENTRY(layer)              layer##_function_entry
+#define RPC_FUNCTION_ENTRY_BEGIN(layer)        function_entry 
+layer##_function_entry[] = {                             \
                                                                                       
 ZEND_FALIAS(layer##_load, rpc_load, NULL)                       \
                                                                                       
 ZEND_FALIAS(layer##_call, rpc_call, NULL)                       \
                                                                                       
 ZEND_FALIAS(layer##_get, rpc_get, NULL)                         \
@@ -57,7 +48,7 @@
 #define RPC_FUNCTION_ENTRY_END()                       {NULL, NULL, NULL}             
                                         \
                                                                                };
 
-#define RPC_METHOD_ENTRY_START(layer)  function_entry layer##_method_entry[] = {
+#define RPC_METHOD_ENTRY_BEGIN(layer)  function_entry layer##_method_entry[] = {
 
 #define RPC_METHOD_ENTRY_END()                         {NULL, NULL, NULL}             
                                         \
                                                                                };
@@ -103,13 +94,10 @@
 /* handler entry */
 typedef struct _rpc_handler_entry {
        char                                    *name;
-       void (*rpc_handler_init)();
-       void (*rpc_handler_shutdown)();
        rpc_object_handlers             *handlers;
        zend_class_entry                **ce;
        function_entry                  *functions;
        function_entry                  *methods;
-       zend_ini_entry                  *ini;
 } rpc_handler_entry;
 
 /* class/method/function hash */
@@ -139,5 +127,6 @@
        zend_uint                               dummy;
 } rpc_proxy;
 
+ZEND_API rpc_register_layer(rpc_handler_entry *entry TSRMLS_DC);
 
 #endif /* HANDLER_H */
Index: php4/ext/rpc/php_rpc.h
diff -u php4/ext/rpc/php_rpc.h:1.8 php4/ext/rpc/php_rpc.h:1.9
--- php4/ext/rpc/php_rpc.h:1.8  Tue Dec 31 11:07:21 2002
+++ php4/ext/rpc/php_rpc.h      Thu Jan 16 12:49:20 2003
@@ -34,16 +34,14 @@
 ZEND_RSHUTDOWN_FUNCTION(rpc);
 ZEND_MINFO_FUNCTION(rpc);
 
-ZEND_FUNCTION(rpc_load);
-ZEND_FUNCTION(rpc_call);
-ZEND_FUNCTION(rpc_set);
-ZEND_FUNCTION(rpc_get);
-ZEND_FUNCTION(rpc_singleton);
-ZEND_FUNCTION(rpc_poolable);
+ZEND_API ZEND_FUNCTION(rpc_load);
+ZEND_API ZEND_FUNCTION(rpc_call);
+ZEND_API ZEND_FUNCTION(rpc_set);
+ZEND_API ZEND_FUNCTION(rpc_get);
+ZEND_API ZEND_FUNCTION(rpc_singleton);
+ZEND_API ZEND_FUNCTION(rpc_poolable);
 
 ZEND_API void rpc_error(int type, const char *format, ...);
 ZEND_API zend_object_value rpc_objects_new(zend_class_entry * TSRMLS_DC);
-
-#define phpext_rpc_ptr &rpc_module_entry
 
 #endif /* PHP_RPC_H */
Index: php4/ext/rpc/rpc.c
diff -u php4/ext/rpc/rpc.c:1.17 php4/ext/rpc/rpc.c:1.18
--- php4/ext/rpc/rpc.c:1.17     Sat Jan 11 04:51:52 2003
+++ php4/ext/rpc/rpc.c  Thu Jan 16 12:49:20 2003
@@ -26,14 +26,15 @@
 
 #include "php_rpc.h"
 #include "rpc.h"
-#include "layer.h"
 #include "hash.h"
+#include "handler.h"
 
 static void rpc_instance_dtor(void *);
 static void rpc_class_dtor(void *);
 static void rpc_string_dtor(void *);
 
 static void rpc_objects_delete(void *, zend_object_handle TSRMLS_DC);
+static void rpc_ini_cb(void *arg TSRMLS_DC);
 
 /* object handler */
 static zval* rpc_read(zval *, zval *, int  TSRMLS_DC);
@@ -102,79 +103,33 @@
 
 zend_class_entry rpc_class_entry;
 
+static zend_class_entry *rpc_entry;
 static zend_function *rpc_ctor;
-static HashTable *handlers;
-static TsHashTable *pool;
-static TsHashTable *classes;
-static zend_llist *classes_list;
+static HashTable handlers;
+static TsHashTable pool;
+static TsHashTable classes;
+static zend_llist classes_list;
+static zend_llist layers;
 
 #ifdef COMPILE_DL_RPC
 ZEND_GET_MODULE(rpc);
 #endif
 
-ZEND_INI_BEGIN()
-ZEND_INI_END()
-
 /* {{{ ZEND_MINIT_FUNCTION
  */
 ZEND_MINIT_FUNCTION(rpc)
 {
        zend_internal_function *zif;
-       zend_class_entry *rpc_entry;
 
        /* rpc base class entry */
        INIT_CLASS_ENTRY(rpc_class_entry, "rpc", NULL);
        rpc_entry = zend_register_internal_class(&rpc_class_entry TSRMLS_CC);
 
-       handlers = (HashTable *) pemalloc(sizeof(HashTable), TRUE);
-       pool = (TsHashTable *) pemalloc(sizeof(TsHashTable), TRUE);
-       classes = (TsHashTable *) pemalloc(sizeof(TsHashTable), TRUE);
-       classes_list = (zend_llist *) pemalloc(sizeof(zend_llist), TRUE);
-
-       zend_hash_init(handlers, 0, NULL, NULL, TRUE);  
-       zend_ts_hash_init(pool, sizeof(rpc_internal **), NULL, rpc_instance_dtor, 
TRUE);
-       zend_ts_hash_init(classes, 0, NULL, NULL, TRUE);
-       zend_llist_init(classes_list, sizeof(rpc_class_hash **), rpc_class_dtor, TRUE);
-
-       FOREACH_HANDLER {
-               /*
-                       handle = DL_LOAD(path);
-       if (!handle) {
-#ifndef ZEND_WIN32
-               fprintf(stderr, "Failed loading %s:  %s\n", path, DL_ERROR());
-#else
-               fprintf(stderr, "Failed loading %s\n", path);
-#endif
-               return FAILURE;
-       }
-
-       extension_version_info = (zend_extension_version_info *) 
DL_FETCH_SYMBOL(handle, "extension_version_info");
-       new_extension = (zend_extension *) DL_FETCH_SYMBOL(handle, 
"zend_extension_entry");
-       if (!extension_version_info || !new_extension) {
-               fprintf(stderr, "%s doesn't appear to be a valid Zend extension\n", 
path);
-               return FAILURE;
-       }
-*/
-               zend_class_entry ce;
-
-               HANDLER.rpc_handler_init(module_number TSRMLS_CC);
-               
-               /* create a class entry for every rpc handler */
-               INIT_CLASS_ENTRY(ce,
-                                                HANDLER.name,
-                                                HANDLER.methods);
-
-               ce.create_object = rpc_objects_new;
-
-               /* load all available rpc handler into a hash */
-               zend_hash_add(handlers, HANDLER.name, strlen(HANDLER.name) + 1, 
&(HANDLER.handlers), sizeof(rpc_object_handlers *), NULL);
-
-               /* register classes and functions */
-               *HANDLER.ce = zend_register_internal_class_ex(&ce, rpc_entry, NULL 
TSRMLS_CC);
-               zend_register_functions(NULL, HANDLER.functions, NULL, 
MODULE_PERSISTENT TSRMLS_CC);
-               zend_register_ini_entries(HANDLER.ini, module_number TSRMLS_CC);
-       }
-
+       zend_hash_init(&handlers, 0, NULL, NULL, TRUE); 
+       zend_ts_hash_init(&pool, sizeof(rpc_internal **), NULL, rpc_instance_dtor, 
+TRUE);
+       zend_ts_hash_init(&classes, 0, NULL, NULL, TRUE);
+       zend_llist_init(&classes_list, sizeof(rpc_class_hash **), rpc_class_dtor, 
+TRUE);
+       zend_llist_init(&layers, sizeof(char *), NULL, TRUE);
 
        zif = (zend_internal_function *) emalloc(sizeof(zend_internal_function));
 
@@ -188,8 +143,6 @@
        zend_hash_add(&(rpc_entry->function_table), rpc_entry->name, 
rpc_entry->name_length + 1, zif, sizeof(zend_function), &rpc_ctor);
        efree(zif);
 
-       REGISTER_INI_ENTRIES();
-
        return SUCCESS;
 }
 /* }}} */
@@ -198,21 +151,14 @@
  */
 ZEND_MSHUTDOWN_FUNCTION(rpc)
 {
-       FOREACH_HANDLER {
-               HANDLER.rpc_handler_shutdown(TSRMLS_C);
-       }
-
        /* destroy instances first */
-       zend_ts_hash_destroy(pool);
-
-       zend_ts_hash_destroy(classes);
-       zend_llist_destroy(classes_list);
-       zend_hash_destroy(handlers);
+       zend_ts_hash_destroy(&pool);
 
-       pefree(handlers, TRUE);
-       pefree(classes, TRUE);
+       zend_ts_hash_destroy(&classes);
+       zend_llist_destroy(&classes_list);
+       zend_llist_destroy(&layers);
+       zend_hash_destroy(&handlers);
 
-       UNREGISTER_INI_ENTRIES();
        return SUCCESS;
 }
 /* }}} */
@@ -222,12 +168,28 @@
 ZEND_MINFO_FUNCTION(rpc)
 {
        php_info_print_table_start();
-       php_info_print_table_header(2, "rpc support", "enabled");
+       zend_llist_apply(&layers, rpc_ini_cb TSRMLS_CC);
        php_info_print_table_end();
 
        DISPLAY_INI_ENTRIES();
 }
 /* }}} */
+       
+ZEND_API rpc_register_layer(rpc_handler_entry *entry TSRMLS_DC)
+{
+       zend_class_entry ce;
+
+       INIT_CLASS_ENTRY(ce, entry->name, entry->methods);
+
+       ce.create_object = rpc_objects_new;
+
+       /* load all available rpc handler into a hash */
+       zend_hash_add(&handlers, entry->name, strlen(entry->name) + 1, 
+&(entry->handlers), sizeof(rpc_object_handlers *), NULL);
+       zend_llist_add_element(&layers, &(entry->name)); 
+
+       /* register classes */
+       *(entry->ce) = zend_register_internal_class_ex(&ce, rpc_entry, NULL TSRMLS_CC);
+}
 
 static void rpc_class_dtor(void *pDest)
 {
@@ -267,6 +229,12 @@
        pefree(*intern, TRUE);
 }
 
+static void rpc_ini_cb(void *arg TSRMLS_DC)
+{
+       char *name = *((char **) arg);
+       php_info_print_table_header(2, name, "loaded");
+}
+
 static zend_object_value rpc_create_proxy(TSRMLS_D)
 {
        zend_object_value *zov;
@@ -302,9 +270,9 @@
                pefree(intern, TRUE);
        } else if (RPC_CLASS(intern) && RPC_CLASS(intern)->poolable) {
                if (RPC_CLASS(intern)->name.str) {
-                       zend_ts_hash_add(pool, RPC_CLASS(intern)->name.str, 
RPC_CLASS(intern)->name.len + 1, &intern, sizeof(rpc_internal *), NULL);
+                       zend_ts_hash_add(&pool, RPC_CLASS(intern)->name.str, 
+RPC_CLASS(intern)->name.len + 1, &intern, sizeof(rpc_internal *), NULL);
                } else {
-                       zend_ts_hash_index_update(pool, RPC_CLASS(intern)->name.len + 
1, &intern, sizeof(rpc_internal *), NULL);
+                       zend_ts_hash_index_update(&pool, RPC_CLASS(intern)->name.len + 
+1, &intern, sizeof(rpc_internal *), NULL);
                }
        } else {
                if (intern->data != NULL) {
@@ -450,7 +418,7 @@
 /**/
 
 /* constructor */
-ZEND_FUNCTION(rpc_load)
+ZEND_API ZEND_FUNCTION(rpc_load)
 {
        zval *object = getThis();
        zval ***args, ***args_free;
@@ -511,7 +479,7 @@
                                GET_SIGNATURE(intern, class_val.str, class_val.len, 
hash_val, num_args, arg_types);
 
                                /* check if already hashed */   
-                               if (zend_ts_hash_find(classes, hash_val.str, 
hash_val.len + 1, (void **) &class_hash_find) != SUCCESS) {
+                               if (zend_ts_hash_find(&classes, hash_val.str, 
+hash_val.len + 1, (void **) &class_hash_find) != SUCCESS) {
                                        class_hash = pemalloc(sizeof(rpc_class_hash), 
TRUE);
 
                                        /* set up the cache */
@@ -541,17 +509,17 @@
                                         * also track all instaces in a llist for 
destruction later on, because there might be duplicate entries in
                                         * the hashtable and we can't determine if a 
pointer references to an already freed element
                                         */
-                                       zend_ts_hash_add(classes, hash_val.str, 
hash_val.len + 1, &class_hash, sizeof(rpc_class_hash *), (void **) &class_hash_find);
-                                       tsrm_mutex_lock(classes->mx_writer);
-                                       zend_llist_add_element(classes_list, 
class_hash_find);
-                                       tsrm_mutex_unlock(classes->mx_writer);
+                                       zend_ts_hash_add(&classes, hash_val.str, 
+hash_val.len + 1, &class_hash, sizeof(rpc_class_hash *), (void **) &class_hash_find);
+                                       tsrm_mutex_lock(classes.mx_writer);
+                                       zend_llist_add_element(&classes_list, 
+class_hash_find);
+                                       tsrm_mutex_unlock(classes.mx_writer);
 
                                        if (class_hash->name.str) {
                                                /* register string hashcode */
-                                               zend_ts_hash_add(classes, 
class_hash->name.str, class_hash->name.len + 1, &class_hash, sizeof(rpc_class_hash *), 
NULL);
+                                               zend_ts_hash_add(&classes, 
+class_hash->name.str, class_hash->name.len + 1, &class_hash, sizeof(rpc_class_hash 
+*), NULL);
                                        } else if (!class_hash->name.str && 
(RPC_HT(intern)->hash_type & HASH_AS_INT)) {
                                                /* register int hashcode */
-                                               zend_ts_hash_index_update(classes, 
class_hash->name.len, &class_hash, sizeof(rpc_class_hash *), NULL);
+                                               zend_ts_hash_index_update(&classes, 
+class_hash->name.len, &class_hash, sizeof(rpc_class_hash *), NULL);
                                        }
                                } else {
                                        class_hash = *class_hash_find;
@@ -567,7 +535,7 @@
                }
        } else {
                /* integer classname (hashcode) */
-               if (zend_ts_hash_index_find(classes, class_val.len, (void**) 
&class_hash_find) != SUCCESS) {
+               if (zend_ts_hash_index_find(&classes, class_val.len, (void**) 
+&class_hash_find) != SUCCESS) {
                        class_hash = pemalloc(sizeof(rpc_class_hash), TRUE);
 
                        /* set up the cache */
@@ -588,7 +556,7 @@
                        intern->ce = class_hash->ce;
 
                        /* register int hashcode, we don't know more */
-                       zend_ts_hash_index_update(classes, class_hash->name.len, 
&class_hash, sizeof(rpc_class_hash *), NULL);
+                       zend_ts_hash_index_update(&classes, class_hash->name.len, 
+&class_hash, sizeof(rpc_class_hash *), NULL);
                } else {
                        class_hash = *class_hash_find;
                        intern->ce = class_hash->ce;
@@ -602,7 +570,7 @@
                /* assign cache structure */
                RPC_CLASS(intern) = class_hash;
                
-               if (zend_ts_hash_remove_key_or_index(pool, 
RPC_CLASS(intern)->name.str, RPC_CLASS(intern)->name.len + 1, (void **) &pool_intern) 
== SUCCESS) {
+               if (zend_ts_hash_remove_key_or_index(&pool, 
+RPC_CLASS(intern)->name.str, RPC_CLASS(intern)->name.len + 1, (void **) &pool_intern) 
+== SUCCESS) {
                        intern->data = pool_intern->data;
                        
                        pefree(pool_intern, TRUE);
@@ -631,7 +599,7 @@
        }
 }
 
-ZEND_FUNCTION(rpc_call)
+ZEND_API ZEND_FUNCTION(rpc_call)
 {
        zval *object = getThis();
        zval ***args, ***args_free;
@@ -714,7 +682,7 @@
        }
 }
 
-ZEND_FUNCTION(rpc_set)
+ZEND_API ZEND_FUNCTION(rpc_set)
 {
        zval *object, *value;
        char *property = NULL;
@@ -739,7 +707,7 @@
        }
 }
 
-ZEND_FUNCTION(rpc_get)
+ZEND_API ZEND_FUNCTION(rpc_get)
 {
        zval *object;
        char *property = NULL;
@@ -764,7 +732,7 @@
        }
 }
 
-ZEND_FUNCTION(rpc_singleton)
+ZEND_API ZEND_FUNCTION(rpc_singleton)
 {
        zval *object;
        rpc_internal *intern;
@@ -783,7 +751,7 @@
        }
 }
 
-ZEND_FUNCTION(rpc_poolable)
+ZEND_API ZEND_FUNCTION(rpc_poolable)
 {
        zval *object;
        rpc_internal *intern;
@@ -830,7 +798,7 @@
        intern->function_table.mx_writer = tsrm_mutex_alloc();
        intern->mx_handler = tsrm_mutex_alloc();
 
-       if (zend_hash_find(handlers, class_type->name, class_type->name_length + 1, 
(void **) &(intern->handlers)) != SUCCESS) {
+       if (zend_hash_find(&handlers, class_type->name, class_type->name_length + 1, 
+(void **) &(intern->handlers)) != SUCCESS) {
                /* TODO: exception */
        }
 
Index: php4/ext/rpc/rpc.h
diff -u php4/ext/rpc/rpc.h:1.11 php4/ext/rpc/rpc.h:1.12
--- php4/ext/rpc/rpc.h:1.11     Tue Dec 31 11:07:22 2002
+++ php4/ext/rpc/rpc.h  Thu Jan 16 12:49:20 2003
@@ -19,10 +19,6 @@
 #ifndef RPC_H
 #define RPC_H
 
-#define FOREACH_HANDLER for (__handler_counter=0; __handler_counter < HANDLER_COUNT; 
__handler_counter++)
-#define HANDLER handler_entries[__handler_counter]
-#define HANDLER_COUNT (sizeof(handler_entries) / sizeof(rpc_handler_entry))
-
 #define RPC_HT(intern) (*((intern)->handlers))
 #define RPC_CLASS(intern) ((intern)->hash)
 
@@ -126,7 +122,5 @@
 #define FREE_SIGNATURE(hash_val, arg_types)                                           
                                                                                       
                  \
                                                efree(arg_types);                      
                                                                                       
                                          \
                                                efree(hash_val.str);
-
-static int __handler_counter;
 
 #endif
Index: php4/ext/rpc/com/php_com.h
diff -u /dev/null php4/ext/rpc/com/php_com.h:1.14
--- /dev/null   Thu Jan 16 12:49:21 2003
+++ php4/ext/rpc/com/php_com.h  Thu Jan 16 12:49:21 2003
@@ -0,0 +1,25 @@
+/*
+   +----------------------------------------------------------------------+
+   | PHP Version 4                                                        |
+   +----------------------------------------------------------------------+
+   | Copyright (c) 1997-2003 The PHP Group                                |
+   +----------------------------------------------------------------------+
+   | This source file is subject to version 2.02 of the PHP license,      |
+   | that is bundled with this package in the file LICENSE, and is        |
+   | available at through the world-wide-web at                           |
+   | http://www.php.net/license/2_02.txt.                                 |
+   | If you did not receive a copy of the PHP license and are unable to   |
+   | obtain it through the world-wide-web, please send a note to          |
+   | [EMAIL PROTECTED] so we can mail you a copy immediately.               |
+   +----------------------------------------------------------------------+
+   | Author: Harald Radi <[EMAIL PROTECTED]>                                  |
+   +----------------------------------------------------------------------+
+ */
+
+#ifndef PHP_COM_H
+#define PHP_COM_H
+
+extern zend_module_entry com_module_entry;
+#define phpext_com_ptr &com_module_entry
+
+#endif /* PHP_COM_H */
\ No newline at end of file
Index: php4/ext/rpc/com/com.c
diff -u php4/ext/rpc/com/com.c:1.12 php4/ext/rpc/com/com.c:1.13
--- php4/ext/rpc/com/com.c:1.12 Tue Dec 31 11:07:22 2002
+++ php4/ext/rpc/com/com.c      Thu Jan 16 12:49:20 2003
@@ -50,7 +50,7 @@
 static unsigned char arg1and2_force_ref[] = { 2, BYREF_FORCE, BYREF_FORCE };
 
 /* register rpc callback function */
-RPC_REGISTER_HANDLERS_START(com)
+RPC_REGISTER_HANDLERS_BEGIN(com)
 TRUE,                                                  /* poolable */
 HASH_AS_INT_WITH_SIGNATURE,
 com_hash,
@@ -68,16 +68,16 @@
 RPC_REGISTER_HANDLERS_END()
 
 /* register ini settings */
-RPC_INI_START(com)
+PHP_INI_BEGIN()
 PHP_INI_ENTRY_EX("com.allow_dcom", "0", PHP_INI_SYSTEM, NULL, 
php_ini_boolean_displayer_cb)
 PHP_INI_ENTRY_EX("com.autoregister_typelib", "0", PHP_INI_SYSTEM, NULL, 
php_ini_boolean_displayer_cb)
 PHP_INI_ENTRY_EX("com.autoregister_verbose", "0", PHP_INI_SYSTEM, NULL, 
php_ini_boolean_displayer_cb)
 PHP_INI_ENTRY_EX("com.autoregister_casesensitive", "1", PHP_INI_SYSTEM, NULL, 
php_ini_boolean_displayer_cb)
 PHP_INI_ENTRY("com.typelib_file", "", PHP_INI_SYSTEM, com_typelib_file_change)
-RPC_INI_END()
+PHP_INI_END()
 
 /* register userspace functions */
-RPC_FUNCTION_ENTRY_START(com)
+RPC_FUNCTION_ENTRY_BEGIN(com)
        ZEND_FALIAS(com_invoke, rpc_call,               NULL)
        ZEND_FE(com_addref,                     NULL)
        ZEND_FE(com_release,            NULL)
@@ -90,8 +90,21 @@
        ZEND_FE(com_print_typeinfo,     NULL)
 RPC_FUNCTION_ENTRY_END()
 
+zend_module_entry com_module_entry = {
+       ZE2_STANDARD_MODULE_HEADER,
+       "com",
+       RPC_FUNCTION_ENTRY(com),
+       ZEND_MINIT(com),
+       ZEND_MSHUTDOWN(com),
+       NULL,
+       NULL,
+       ZEND_MINFO(com),
+       "0.1a",
+       STANDARD_MODULE_PROPERTIES
+};
+
 /* register class methods */
-RPC_METHOD_ENTRY_START(com)
+RPC_METHOD_ENTRY_BEGIN(com)
        ZEND_FALIAS(addref,             com_addref,             NULL)
        ZEND_FALIAS(release,    com_release,    NULL)
        ZEND_FALIAS(next,               com_next,               NULL)
@@ -101,20 +114,35 @@
 RPC_METHOD_ENTRY_END()
 
 
-/* init function that is called before the class is registered
- * so you can do any tricky stuff in here
- */
-RPC_INIT_FUNCTION(com)
+ZEND_MINIT_FUNCTION(com)
 {
        CreateBindCtx(0, &pBindCtx);
        php_variant_init(module_number TSRMLS_CC);
+
+       RPC_REGISTER_LAYER(com);
+       REGISTER_INI_ENTRIES();
+
+       return SUCCESS;
 }
 
-RPC_SHUTDOWN_FUNCTION(com)
+ZEND_MSHUTDOWN_FUNCTION(com)
 {
        php_variant_shutdown(TSRMLS_C);
        pBindCtx->lpVtbl->Release(pBindCtx);
+
+       UNREGISTER_INI_ENTRIES();
+
+       return SUCCESS;
 }
+
+ZEND_MINFO_FUNCTION(com)
+{
+       DISPLAY_INI_ENTRIES();
+}
+
+#ifdef COMPILE_DL_COM
+ZEND_GET_MODULE(com);
+#endif
 
 /* rpc handler functions */
 
Index: php4/ext/rpc/com/com.h
diff -u php4/ext/rpc/com/com.h:1.3 php4/ext/rpc/com/com.h:1.4
--- php4/ext/rpc/com/com.h:1.3  Tue Dec 31 11:07:22 2002
+++ php4/ext/rpc/com/com.h      Thu Jan 16 12:49:21 2003
@@ -24,6 +24,10 @@
 
 RPC_DECLARE_HANDLER(com);
 
+ZEND_MINIT_FUNCTION(com);
+ZEND_MSHUTDOWN_FUNCTION(com);
+ZEND_MINFO_FUNCTION(com);
+
 ZEND_FUNCTION(com_addref);
 ZEND_FUNCTION(com_release);
 ZEND_FUNCTION(com_isenum);
Index: php4/ext/rpc/skeleton/skeleton.c
diff -u php4/ext/rpc/skeleton/skeleton.c:1.2 php4/ext/rpc/skeleton/skeleton.c:1.3
--- php4/ext/rpc/skeleton/skeleton.c:1.2        Tue Dec 31 11:07:24 2002
+++ php4/ext/rpc/skeleton/skeleton.c    Thu Jan 16 12:49:21 2003
@@ -36,7 +36,7 @@
 static int skeleton_get_properties(HashTable **, void **);
 
 /* register rpc callback function */
-RPC_REGISTER_HANDLERS_START(skeleton)
+RPC_REGISTER_HANDLERS_BEGIN(skeleton)
 FALSE,                                         /* poolable TRUE|FALSE*/
 DONT_HASH,                                     /* hash function name lookups to avoid 
reflection of the object for each
                                             * method call. hashing is done either by 
mapping only the function name
Index: php4/ext/rpc/skeleton/skeleton.h
diff -u php4/ext/rpc/skeleton/skeleton.h:1.2 php4/ext/rpc/skeleton/skeleton.h:1.3
--- php4/ext/rpc/skeleton/skeleton.h:1.2        Tue Dec 31 11:07:25 2002
+++ php4/ext/rpc/skeleton/skeleton.h    Thu Jan 16 12:49:21 2003
@@ -16,10 +16,6 @@
    +----------------------------------------------------------------------+
  */
 
-/* TODO: include this file in ext/rpc/layer.h and add your handlers to
- * the handler_entries[] array.
- */
-
 #ifndef SKELETON_H
 #define SKELETON_H
 

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

Reply via email to