[srm-cvs] CVS Update: - Make the SAPI work again

From: <d.rethans[@]jdimedia.nl>
Date: Fri Apr 04 2003 - 09:30:54 CEST

Date: Fri Apr 4 09:30:51 CEST 2003
User: Derick Rethans
Directory: sapi_srm

Log Message:
 [0.50]
 - Make the SAPI work again
 
Modified files:
           sapi_srm/srm.c (version: 1.55)

[FILE: /sapi_srm/srm.c]

--- sapi_srm/srm.c:1.54 Thu Sep 19 06:48:48 2002 GMT
+++ sapi_srm/srm.c Fri Apr 04 05:30:50 2003 GMT
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: cvstemp,v 1.54 2002/09/19 08:48:48 derick Exp $ */
+/* $Id: cvstemp,v 1.55 2003/04/04 07:30:50 derick Exp $ */
 
 #include "php.h"
 #include "php_ini.h"
@@ -42,7 +42,6 @@
 #include <srm_client.h>
 #include <srm_modules.h>
 #include "srm.h"
-#include "srm_util.h"
 
 #define SRMSG(v) TSRMG(srm_globals_id, srm_globals_struct *, v)
 
@@ -107,7 +106,7 @@
 /* php_srm_sapi_write() writes data out (used for debugging only!) */
 static int php_srm_sapi_write(const char *str, uint str_length TSRMLS_DC)
 {
- srm_fmt_message (LL_DATA, "PHP DBG", "%s", str);
+ printf("[%s] %s", "PHP DBG", str);
         return str_length;
 }
 
@@ -266,12 +265,12 @@
         srm_event *e;
 
         /* Wait for signal on the semaphore */
- srm_fmt_message (LL_DATA, "Event", "%s:%d: /* Wait for signal on the semaphore */", __FILE__, __LINE__);
+ printf("[Event ] %s:%d: /* Wait for signal on the semaphore */", __FILE__, __LINE__);
         sem_wait(&srmapp_pool.data[handle].msg_sem);
 
         /* Return event */
         e = srmapp_pool.data[handle].event;
- srm_fmt_message (LL_DATA, "Event", "%s:%d", __FILE__, __LINE__);
+ printf("[Event ] %s:%d", __FILE__, __LINE__);
 
         return e;
 }
@@ -287,7 +286,7 @@
         srmapp_pool.data[handle].res = result;
 
         /* Signal that the result is available */
- srm_fmt_message (LL_DATA, "Event", "%s:%d: /* Signal semaphore that the result available */", __FILE__, __LINE__);
+ printf("[Event ] %s:%d: /* Signal semaphore that the result available */", __FILE__, __LINE__);
         sem_post(&srmapp_pool.data[handle].res_sem);
 }
 /* }}} */
@@ -297,17 +296,17 @@
 {
         srm_value *res_val;
 
- srm_fmt_message (LL_DATA, "Event", "In use = %d", srmapp_pool.data[handle].used);
+ printf("[Event ] In use = %d", srmapp_pool.data[handle].used);
         if (srmapp_pool.data[handle].used == 1) {
                 /* Add message to queue */
                 srmapp_pool.data[handle].event = event;
- srm_fmt_message (LL_DATA, "Event", "%s:%d: /* Signal semaphore that a message is available */", __FILE__, __LINE__);
+ printf("[Event ] %s:%d: /* Signal semaphore that a message is available */", __FILE__, __LINE__);
                 sem_post(&srmapp_pool.data[handle].msg_sem);
 
                 /* Wait for signal on result to be available */
- srm_fmt_message (LL_DATA, "Event", "%s:%d: /* Wait for signal on result to be available */", __FILE__, __LINE__);
+ printf("[Event ] %s:%d: /* Wait for signal on result to be available */", __FILE__, __LINE__);
                 sem_wait(&srmapp_pool.data[handle].res_sem);
- srm_fmt_message (LL_DATA, "Event", "%s:%d", __FILE__, __LINE__);
+ printf("[Event ] %s:%d", __FILE__, __LINE__);
 
                 res_val = srmapp_pool.data[handle].res->data;
                 res_val->ref_count++;
@@ -372,7 +371,7 @@
                                 SRMVALP_SET_BINSTR (result->data, error_buf, strlen(error_buf), 1);
                                 VALP_SET_WARNING(result->data);
 
- srm_fmt_message (LL_DATA, "Event", error_buf);
+ printf("[Event ] %s", error_buf);
                         }
         
                 } else if (strncmp ("banana_set", function, 11) == 0) {
@@ -400,11 +399,11 @@
                         if (call_user_function (NULL, &object, php_cmd, &ret_val, argc, params TSRMLS_CC) == FAILURE) {
                                 /* Add error to return queue */
                                 SRMVALP_SET_BINSTR(result->data, "Error occured calling function", 30, 1);
- srm_fmt_message (LL_DATA, "Event", "Error occured calling PHP function");
+ printf("[Event ] Error occured calling PHP function\n");
                         } else {
                                 /* Add result to return queue */
                                 result->data = zval_to_srmval (&ret_val);
- srm_fmt_message (LL_DATA, "Event", "No Error occured calling PHP function");
+ printf("[Event ] No Error occured calling PHP function\n");
                         }
 
                         FREE_ZVAL(php_cmd);
@@ -413,7 +412,7 @@
                         memset(error_buf, 0, 256);
                         sprintf (error_buf, "banana::run(): %s does not exist\n", function);
 
- srm_fmt_message (LL_DATA, "Event", error_buf);
+ printf("[Event ] %s\n", error_buf);
                         result->data = srm_value_init();
                         VALP_SET_STR(result->data);
                         SRMVALP_STR(result->data) = strdup(error_buf);
@@ -466,7 +465,6 @@
 
                         /* Add it to the function hash */
                         srm_hash_add (function_hash, function_name, strlen(function_name), info);
- srm_fmt_message (LL_STARTUP, "SRM-SAPI", "- Loading PHP function %s", function_name);
                 }
         }
 
@@ -489,7 +487,7 @@
    Free event struct */
 static void srm_event_dtor (srm_event *e)
 {
- srm_fmt_message (LL_DATA, "EVENT", "destroying event");
+ printf("[Event ] destroying event\n");
 
 #warning fixme: destroy parameters too
         free (e->function);
@@ -504,7 +502,7 @@
    Free event result struct */
 static void srm_event_result_dtor (srm_event_result *e)
 {
- srm_fmt_message (LL_DATA, "EVENT", "destroying event result");
+ printf("[Event ] destroying event result\n");
         /* Remove the handle from the hash */
         srm_value_free (e->data);
 }
@@ -521,15 +519,15 @@
         h = (srmapp_handle *) data;
 
         /* Mark the slot as free again */
- srm_fmt_message (LL_DATA, "Event", "%s:%d", __FILE__, __LINE__);
+ printf("[Event ] %s:%d\n", __FILE__, __LINE__);
         sem_wait (&srmapp_pool.mutex);
- srm_fmt_message (LL_DATA, "Event", "%s:%d", __FILE__, __LINE__);
+ printf("[Event ] %s:%d\n", __FILE__, __LINE__);
         srmapp_pool.data[h->id].used = FALSE;
- srm_fmt_message (LL_DATA, "Event", "%s:%d", __FILE__, __LINE__);
+ printf("[Event ] %s:%d\n", __FILE__, __LINE__);
         sem_getvalue (&srmapp_pool.data[h->id].lock, &i);
         sem_getvalue (&srmapp_pool.data[h->id].msg_sem, &j);
         sem_getvalue (&srmapp_pool.data[h->id].res_sem, &k);
- srm_fmt_message (LL_DATA, "DBG", "Semaphore values: %d %d %d", i, j, k);
+ printf("[Event ] Semaphore values: %d %d %d\n", i, j, k);
         if (j == 1) {
                 result = malloc (sizeof (srm_event_result));
                 result->data = srm_value_init();
@@ -575,9 +573,9 @@
         SET_VAR_LONG("__handle", h->id);
 
         if (zend_execute_scripts(ZEND_REQUIRE TSRMLS_CC, NULL, 1, &file_handle) == SUCCESS) {
- srm_fmt_message (LL_DATA, "DBG", "Script ran succesfully");
+ printf("[Event ] Script ran succesfully\n");
         } else {
- srm_fmt_message (LL_DATA, "DBG", "Script ran UNsuccesfully");
+ printf("[Event ] Script ran UNsuccesfully\n");
                 srmapp_pool.data[h->id].used = FALSE;
         }
         efree (SG(server_context));
@@ -658,15 +656,15 @@
         file_handle.opened_path = NULL;
 
         /* Start output buffering to redirect errors to the logfile */
- php_start_ob_buffer (NULL, 0, 0 TSRMLS_CC);
+// php_start_ob_buffer (NULL, 0, 0 TSRMLS_CC);
 
         /* Load the function library by executing the script */
         php_execute_script(&file_handle TSRMLS_CC);
 
         /* Get data outputted by the script and direct it to the error log */
- php_ob_get_buffer (errors TSRMLS_CC);
- php_end_ob_buffer (0, 0 TSRMLS_CC);
- srm_fmt_message (LL_STARTUP, "SRM-SAPI", "%s", Z_STRVAL_P(errors));
+// php_ob_get_buffer (errors TSRMLS_CC);
+// php_end_ob_buffer (0, 0 TSRMLS_CC);
+// srm_fmt_message (LL_STARTUP, "SRM-SAPI", "%s", Z_STRVAL_P(errors));
 
         /* Destruct the errors ZVAL */
         zval_dtor(errors);
@@ -808,7 +806,7 @@
            otherwise start it, and return the handle. */
         if (srm_hash_find (srmapp_hash, class_name, strlen(class_name), (void *) &handle) == SRM_SUCCESS) {
                 SRM_RETVAL_U32(handle->id);
- srm_fmt_message (LL_STARTUP, "SRM-SAPI", "The class '%s' has already been started and has handle %d.", class_name, handle->id);
+ printf("[SRM-SAPI] The class '%s' has already been started and has handle %d.\n", class_name, handle->id);
                 return;
         } else {
                 handle = ecalloc (1, sizeof (srmapp_handle));
@@ -816,9 +814,9 @@
                 if (handle->id != -1) {
                         srm_hash_add (srmapp_hash, class_name, strlen(class_name), handle);
                         SRM_RETVAL_U32(handle->id);
- srm_fmt_message (LL_DATA, "SRM-SAPI", "Loaded class '%s' with handle %d.", class_name, handle->id);
+ printf("[SRM-SAPI] Loaded class '%s' with handle %d.\n", class_name, handle->id);
                 } else {
- srm_fmt_message (LL_DATA, "SRM-SAPI", "Could not load the class '%s'.", class_name);
+ printf("[SRM-SAPI] Could not load the class '%s'.\n", class_name);
                         SRM_RETVAL_BOOL(FALSE);
                 }
         }
@@ -865,7 +863,7 @@
                 SRM_RETVAL_BOOL(FALSE);
         }
 
- srm_fmt_message (LL_DATA, "Event", "%s:%d", __FILE__, __LINE__);
+ printf("[Event ] %s:%d\n", __FILE__, __LINE__);
         /* Get function name */
         e = SRM_LLIST_HEAD (input->list);
 
@@ -905,12 +903,12 @@
         event->params = params;
         event->argc = argc > 2 ? argc - 2 : 0;
 
- srm_fmt_message (LL_DATA, "Event", "%s:%d", __FILE__, __LINE__);
+ printf("[Event ] %s:%d\n", __FILE__, __LINE__);
 
         res_val = exec_event (handle1, event);
 
         srm_value_copy (output, res_val);
- srm_fmt_message (LL_DATA, "Event", "%s:%d", __FILE__, __LINE__);
+ printf("[Event ] %s:%d\n", __FILE__, __LINE__);
 }
 /* }}} */
 
Received on Fri Apr 4 09:30:58 2003

This archive was generated by hypermail 2.1.8 : Tue Jan 06 2009 - 09:00:03 CET