[srm-cvs] CVS Update: - Implement the SRM function get_loaded_bananas() to retrieve all currently

From: <d.rethans[@]jdimedia.nl>
Date: Fri Apr 12 2002 - 19:59:45 CEST

Date: Fri Apr 12 19:59:45 CEST 2002
User: Derick Rethans
Directory: sapi_srm

Log Message:
 [0.50]
 - Implement the SRM function get_loaded_bananas() to retrieve all currently
   loaded Bananas.
 
Modified files:
           sapi_srm/srm.c (version: 1.48)
           sapi_srm/srm.h (version: 1.9)

[FILE: /sapi_srm/srm.c]

--- sapi_srm/srm.c:1.47 Mon Mar 04 18:57:17 2002 GMT
+++ sapi_srm/srm.c Fri Apr 12 15:59:44 2002 GMT
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: cvstemp,v 1.47 2002/03/04 19:57:17 derick Exp $ */
+/* $Id: cvstemp,v 1.48 2002/04/12 17:59:44 derick Exp $ */
 
 #include "php.h"
 #include "php_ini.h"
@@ -599,6 +599,7 @@
 BEGIN_FUNC_LIST(sphp_functions)
         SRM_FE (start_banana, NULL)
         SRM_FE (banana_function_call, NULL)
+ SRM_FE (get_loaded_bananas, NULL)
 END_FUNC_LIST
 
 /* SRM Module entry struct */
@@ -710,6 +711,22 @@
 /* }}} */
 
 
+/* {{{ helper void srm_add_banana_info_to_list (data, e)
+ 'e' to the list 'data' and adds some extra information about the function*/
+static void srm_add_banana_info_to_list (void *data, srm_hash_element* e)
+{
+ struct srm_value *record;
+ srmapp_handle *handle = (srmapp_handle *) e->ptr;
+
+ record = srm_value_init();
+ VALP_SET_STR(record);
+ SRMVALP_STR(record) = strdup (handle->classname);
+ record->value_length = strlen (handle->classname);
+ srm_llist_insert_next ((srm_llist *) data, NULL, (void *) record);
+}
+/* }}} */
+
+
 /* {{{ function php_function_callback (string command [, mixed param...])
    This function is called then a PHP function in the library is requested */
 SRM_FUNCTION(php_function_callback)
@@ -797,7 +814,7 @@
                         SRM_RETVAL_U32(handle->id);
                         srm_fmt_message (LL_DATA, "SRM-SAPI", "Loaded class '%s' with handle %d.", class_name, handle->id);
                 } else {
- srm_fmt_message (LL_DATA, "SRM-SAPI", "Loaded class '%s' with handle %d.", class_name, handle->id);
+ srm_fmt_message (LL_DATA, "SRM-SAPI", "Could not load the class '%s'.", class_name);
                         SRM_RETVAL_BOOL(FALSE);
                 }
         }
@@ -890,6 +907,21 @@
         srm_fmt_message (LL_DATA, "Event", "%s:%d", __FILE__, __LINE__);
 }
 /* }}} */
+
+
+/* {{{ function list get_loaded_bananas()
+ Lists all loaded bananas */
+SRM_FUNCTION(get_loaded_bananas)
+{
+ srm_llist* list;
+
+ /* Initializing return list */
+ list = srm_llist_alloc (SRM_LLIST_VALUE_FREE);
+ srm_hash_apply (srmapp_hash, (void*) list, srm_add_banana_info_to_list);
+ SRM_RETVAL_LIST(list);
+}
+/* }}} */
+
 
 /* {{{ function bool load() */
 SRM_LOAD(sphp)

[FILE: /sapi_srm/srm.h]

--- sapi_srm/srm.h:1.8 Thu Jan 31 20:47:15 2002 GMT
+++ sapi_srm/srm.h Fri Apr 12 15:59:45 2002 GMT
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: cvstemp,v 1.8 2002/01/31 21:47:15 derick Exp $ */
+/* $Id: cvstemp,v 1.9 2002/04/12 17:59:45 derick Exp $ */
 
 #ifndef __SAPI_SRM_H__
 #define __SAPI_SRM_H__
@@ -59,5 +59,6 @@
 SRM_UNLOAD(sphp);
 SRM_FUNCTION(start_banana);
 SRM_FUNCTION(banana_function_call);
+SRM_FUNCTION(get_loaded_bananas);
 SRM_FUNCTION(php_function_callback);
 #endif
Received on Fri Apr 12 20:57:04 2002

This archive was generated by hypermail 2.1.8 : Tue Jan 06 2009 - 12:00:02 CET