[PHP-DEV] CVS update: php31/main From: shane (php-dev <email protected>)
Date: 05/31/98

Date: Sunday May 31, 1998 @ 18:10
Author: shane

Update of /repository/php31/main
In directory asf:/tmp/cvs-serv618/main

Modified Files:
        head.c main.c php.h phpsapi_core.dsp
Log Message:
Working to get a non-thread safe cgi version to compile again.

Index: php31/main/head.c
diff -c php31/main/head.c:1.3 php31/main/head.c:1.4
*** php31/main/head.c:1.3 Sun May 31 12:44:27 1998
--- php31/main/head.c Sun May 31 18:10:46 1998
***************
*** 26,32 ****
     | Authors: Rasmus Lerdorf <rasmus <email protected>> |
     +----------------------------------------------------------------------+
   */
! /* $Id: head.c,v 1.3 1998/05/31 16:44:27 shane Exp $ */
  #ifdef THREAD_SAFE
  #include "tls.h"
  #endif
--- 26,32 ----
     | Authors: Rasmus Lerdorf <rasmus <email protected>> |
     +----------------------------------------------------------------------+
   */
! /* $Id: head.c,v 1.4 1998/05/31 22:10:46 shane Exp $ */
  #ifdef THREAD_SAFE
  #include "tls.h"
  #endif
***************
*** 103,112 ****
                          GLOBAL(cont_type) = estrdup(r + 1);
                  } else {
                          *r = ':';
! GLOBAL(sapi_rqst)->insert_header(php3_globals,arg1->value.str.val);
                  }
          } else {
! GLOBAL(sapi_rqst)->insert_header(php3_globals,arg1->value.str.val);
          }
  }
  
--- 103,112 ----
                          GLOBAL(cont_type) = estrdup(r + 1);
                  } else {
                          *r = ':';
! GLOBAL(sapi_rqst)->insert_header(SAPI_GLOBAL_PASS arg1->value.str.val);
                  }
          } else {
! GLOBAL(sapi_rqst)->insert_header(SAPI_GLOBAL_PASS arg1->value.str.val);
          }
  }
  
***************
*** 134,153 ****
                          php3_treat_data(PARSE_POST, NULL); /* POST Data */
                  }
                  if (!GLOBAL(cont_type)) {
! GLOBAL(sapi_rqst)->insert_header(php3_globals,"Content-type: text/html");
! GLOBAL(sapi_rqst)->send_header(php3_globals);
                  } else {
                          tempstr = emalloc(strlen(GLOBAL(cont_type)) + sizeof("Content-type:") +1);
                          if(tempstr) {
                                  strcpy(tempstr, "Content-type:");
                                  strcpy(tempstr + sizeof("Content-type:") - 1, GLOBAL(cont_type));
! GLOBAL(sapi_rqst)->insert_header(php3_globals,tempstr);
                                  efree(tempstr);
                          }
! GLOBAL(sapi_rqst)->send_header(php3_globals);
                          efree(GLOBAL(cont_type));
                  }
! GLOBAL(sapi_rqst)->flush(php3_globals);
                  GLOBAL(php3_HeaderPrinted) = 1;
                  GLOBAL(header_called) = 1;
          }
--- 134,153 ----
                          php3_treat_data(PARSE_POST, NULL); /* POST Data */
                  }
                  if (!GLOBAL(cont_type)) {
! GLOBAL(sapi_rqst)->insert_header(SAPI_GLOBAL_PASS "Content-type: text/html");
! GLOBAL(sapi_rqst)->send_header(SAPI_GLOBAL_PASS_V);
                  } else {
                          tempstr = emalloc(strlen(GLOBAL(cont_type)) + sizeof("Content-type:") +1);
                          if(tempstr) {
                                  strcpy(tempstr, "Content-type:");
                                  strcpy(tempstr + sizeof("Content-type:") - 1, GLOBAL(cont_type));
! GLOBAL(sapi_rqst)->insert_header(SAPI_GLOBAL_PASS tempstr);
                                  efree(tempstr);
                          }
! GLOBAL(sapi_rqst)->send_header(SAPI_GLOBAL_PASS_V);
                          efree(GLOBAL(cont_type));
                  }
! GLOBAL(sapi_rqst)->flush(SAPI_GLOBAL_PASS_V);
                  GLOBAL(php3_HeaderPrinted) = 1;
                  GLOBAL(header_called) = 1;
          }
***************
*** 249,255 ****
          if(tempstr1) {
                  strcpy(tempstr1, "Set-Cookie: ");
                  strcpy(tempstr1 + sizeof("Set-Cookie: ") - 1, tempstr);
! GLOBAL(sapi_rqst)->insert_header(php3_globals,tempstr1);
                  efree(tempstr1);
          }
          if (domain) efree(domain);
--- 249,255 ----
          if(tempstr1) {
                  strcpy(tempstr1, "Set-Cookie: ");
                  strcpy(tempstr1 + sizeof("Set-Cookie: ") - 1, tempstr);
! GLOBAL(sapi_rqst)->insert_header(SAPI_GLOBAL_PASS tempstr1);
                  efree(tempstr1);
          }
          if (domain) efree(domain);
Index: php31/main/main.c
diff -c php31/main/main.c:1.17 php31/main/main.c:1.18
*** php31/main/main.c:1.17 Sun May 31 16:23:24 1998
--- php31/main/main.c Sun May 31 18:10:47 1998
***************
*** 29,35 ****
     +----------------------------------------------------------------------+
   */
  
! /* $Id: main.c,v 1.17 1998/05/31 20:23:24 shane Exp $ */
  
  /* #define CRASH_DETECTION */
  
--- 29,35 ----
     +----------------------------------------------------------------------+
   */
  
! /* $Id: main.c,v 1.18 1998/05/31 22:10:47 shane Exp $ */
  
  /* #define CRASH_DETECTION */
  
***************
*** 38,44 ****
  #endif
  #include <stdio.h>
  #include "php.h"
! #ifdef MSVC5
  #include "os/nt/time.h"
  #include "os/nt/signal.h"
  #include <process.h>
--- 38,44 ----
  #endif
  #include <stdio.h>
  #include "php.h"
! #if WIN32|WINNT
  #include "os/nt/time.h"
  #include "os/nt/signal.h"
  #include <process.h>
***************
*** 216,222 ****
          }
          /* Otherwise fall back to the default logging location. */
          if (php3_header()) {
! GLOBAL(sapi_rqst)->log(php3_globals, log_message);
          }
  }
  
--- 216,222 ----
          }
          /* Otherwise fall back to the default logging location. */
          if (php3_header()) {
! GLOBAL(sapi_rqst)->log(SAPI_GLOBAL_PASS log_message);
          }
  }
  
***************
*** 245,251 ****
          /* fix for memory manager shutting down before request is started! */
          if(GLOBAL(sapi_rqst) && !GLOBAL(sapi_rqst)->cgi){
  #endif
! ret = GLOBAL(sapi_rqst)->writeclient(php3_globals, buffer, size);
  #if DEBUG
          }
  #endif
--- 245,251 ----
          /* fix for memory manager shutting down before request is started! */
          if(GLOBAL(sapi_rqst) && !GLOBAL(sapi_rqst)->cgi){
  #endif
! ret = GLOBAL(sapi_rqst)->writeclient(SAPI_GLOBAL_PASS buffer, size);
  #if DEBUG
          }
  #endif
***************
*** 511,519 ****
           * The php3_shutdown function needs to free all outstanding allocated
           * memory.
           */
! GLOBAL(sapi_rqst)->block_alarms(php3_globals);
! GLOBAL(sapi_rqst)->register_cleanup(php3_globals, NULL, php3_request_shutdown, php3_request_shutdown_for_exec);
! GLOBAL(sapi_rqst)->unblock_alarms(php3_globals);
  
          /* initialize global variables */
          {
--- 511,519 ----
           * The php3_shutdown function needs to free all outstanding allocated
           * memory.
           */
! GLOBAL(sapi_rqst)->block_alarms(SAPI_GLOBAL_PASS_V);
! GLOBAL(sapi_rqst)->register_cleanup(SAPI_GLOBAL_PASS NULL, php3_request_shutdown, php3_request_shutdown_for_exec);
! GLOBAL(sapi_rqst)->unblock_alarms(SAPI_GLOBAL_PASS_V);
  
          /* initialize global variables */
          {
***************
*** 786,793 ****
          debug_log("%d:timer unset\n",GetCurrentThreadId());
  #endif
  
! GLOBAL(sapi_rqst)->request_shutdown(php3_globals);
! GLOBAL(sapi_rqst)->flush(php3_globals);
  }
  
  static int php3_config_ini_startup(INLINE_TLS_VOID)
--- 786,793 ----
          debug_log("%d:timer unset\n",GetCurrentThreadId());
  #endif
  
! GLOBAL(sapi_rqst)->request_shutdown(SAPI_GLOBAL_PASS_V);
! GLOBAL(sapi_rqst)->flush(SAPI_GLOBAL_PASS_V);
  }
  
  static int php3_config_ini_startup(INLINE_TLS_VOID)
***************
*** 1078,1084 ****
          if (GLOBAL(module_initialized)) {
                  php3_error(E_WARNING, "Unknown resource in module shutdown");
          }
! GLOBAL(sapi_rqst)->flush(php3_globals);
  }
  
  
--- 1078,1084 ----
          if (GLOBAL(module_initialized)) {
                  php3_error(E_WARNING, "Unknown resource in module shutdown");
          }
! GLOBAL(sapi_rqst)->flush(SAPI_GLOBAL_PASS_V);
  }
  
  
***************
*** 1135,1141 ****
  
  
          /* this replaces server specific hashing by moving it into sapi*/
! GLOBAL(sapi_rqst)->hash_server_env(php3_globals);
  
  
          /* need argc/argv support as well */
--- 1135,1141 ----
  
  
          /* this replaces server specific hashing by moving it into sapi*/
! GLOBAL(sapi_rqst)->hash_server_env(SAPI_GLOBAL_PASS_V);
  
  
          /* need argc/argv support as well */
***************
*** 1306,1313 ****
  /* sapi process start
  /*****************************************************************************/
  int _php3_sapi_process_start(){
          php3_globals_struct *php3_globals;
!
  #if WIN32_WINNT
          _fmode = _O_BINARY; /*sets default for file streams to binary */
          /* make the stdio mode be binary */
--- 1306,1314 ----
  /* sapi process start
  /*****************************************************************************/
  int _php3_sapi_process_start(){
+ #ifdef THREAD_SAFE
          php3_globals_struct *php3_globals;
! #endif
  #if WIN32_WINNT
          _fmode = _O_BINARY; /*sets default for file streams to binary */
          /* make the stdio mode be binary */
***************
*** 1322,1327 ****
--- 1323,1329 ----
          debug_log("########################\n%d:Process Start\n",GetCurrentThreadId());
  #endif
  
+ #ifdef THREAD_SAFE
          PHP3_MUTEX_ALLOC(gLock);
          PHP3_CRITICAL_ALLOC(Tls_crit);
          if (!PHP3_TLS_PROC_STARTUP(TlsIndex))return 0;
***************
*** 1340,1345 ****
--- 1342,1348 ----
                  return 0;
          
          php3_globals->sapi_rqst=NULL;
+ #endif /* THREAD SAFE*/
  
          start_memory_manager();
          if (php3_config_ini_startup(_INLINE_TLS_VOID) == FAILURE) {
***************
*** 1349,1355 ****
  #if defined(CRASH_DETECTION)
          debug_log("%d:INI Load Success\n",GetCurrentThreadId());
  #endif
! if (php3_module_startup(php3_globals) == FAILURE) {
                  shutdown_memory_manager();
                  return 0;
          }
--- 1352,1358 ----
  #if defined(CRASH_DETECTION)
          debug_log("%d:INI Load Success\n",GetCurrentThreadId());
  #endif
! if (php3_module_startup(SAPI_GLOBAL_PASS_V) == FAILURE) {
                  shutdown_memory_manager();
                  return 0;
          }
***************
*** 1364,1371 ****
  /* sapi thread start
  /*****************************************************************************/
  int _php3_sapi_thread_start(){
          php3_globals_struct *php3_globals;
-
  #if defined(CRASH_DETECTION)
                  debug_log("########################\n%d:Thread Start\n",GetCurrentThreadId());
  #endif
--- 1367,1374 ----
  /* sapi thread start
  /*****************************************************************************/
  int _php3_sapi_thread_start(){
+ #ifdef THREAD_SAFE
          php3_globals_struct *php3_globals;
  #if defined(CRASH_DETECTION)
                  debug_log("########################\n%d:Thread Start\n",GetCurrentThreadId());
  #endif
***************
*** 1380,1388 ****
          if(!yy_init_tls())return 0;
  
          php3_globals->sapi_rqst=NULL;
  
          start_memory_manager();
! if (php3_module_startup(php3_globals) == FAILURE){
                  shutdown_memory_manager();
                  return 0;
          }
--- 1383,1392 ----
          if(!yy_init_tls())return 0;
  
          php3_globals->sapi_rqst=NULL;
+ #endif /* THREAD SAFE */
  
          start_memory_manager();
! if (php3_module_startup(SAPI_GLOBAL_PASS_V) == FAILURE){
                  shutdown_memory_manager();
                  return 0;
          }
***************
*** 1397,1408 ****
  /* sapi thread end
  /*****************************************************************************/
  int _php3_sapi_thread_end(){
          php3_globals_struct *php3_globals;
-
          PHP3_TLS_GET(TlsIndex,php3_globals);
! php3_module_shutdown(php3_globals);
          PHP3_TLS_THREAD_FREE(php3_globals);
          yy_destroy_tls();
  #if defined(CRASH_DETECTION)
          debug_log("%d:DLL Thread End Success\n",GetCurrentThreadId());
  #endif
--- 1401,1415 ----
  /* sapi thread end
  /*****************************************************************************/
  int _php3_sapi_thread_end(){
+ #ifdef THREAD_SAFE
          php3_globals_struct *php3_globals;
          PHP3_TLS_GET(TlsIndex,php3_globals);
! #endif
! php3_module_shutdown(SAPI_GLOBAL_PASS_V);
! #ifdef THREAD_SAFE
          PHP3_TLS_THREAD_FREE(php3_globals);
          yy_destroy_tls();
+ #endif
  #if defined(CRASH_DETECTION)
          debug_log("%d:DLL Thread End Success\n",GetCurrentThreadId());
  #endif
***************
*** 1413,1422 ****
  /* sapi process end
  /*****************************************************************************/
  int _php3_sapi_process_end(){
          php3_globals_struct *php3_globals;
-
          PHP3_TLS_GET(TlsIndex,php3_globals);
! php3_module_shutdown(php3_globals);
          PHP3_TLS_THREAD_FREE(php3_globals);
          PHP3_TLS_PROC_SHUTDOWN(TlsIndex);
          yy_destroy_tls();
--- 1420,1431 ----
  /* sapi process end
  /*****************************************************************************/
  int _php3_sapi_process_end(){
+ #ifdef THREAD_SAFE
          php3_globals_struct *php3_globals;
          PHP3_TLS_GET(TlsIndex,php3_globals);
! #endif
! php3_module_shutdown(SAPI_GLOBAL_PASS_V);
! #ifdef THREAD_SAFE
          PHP3_TLS_THREAD_FREE(php3_globals);
          PHP3_TLS_PROC_SHUTDOWN(TlsIndex);
          yy_destroy_tls();
***************
*** 1425,1430 ****
--- 1434,1440 ----
  #endif
          PHP3_MUTEX_FREE(gLock);
          PHP3_CRITICAL_FREE(Tls_crit);
+ #endif
          return 1;
  }
  
***************
*** 1490,1503 ****
          }
          if (sapi_info->info_only) {
                  _php3_info();
! php3_request_shutdown((void *) GLOBAL(sapi_rqst), php3_globals);
                  return (1);
          }
  
          /* if its not cgi, require that we have a filename now */
          if (!sapi_info->cgi && !sapi_info->filename) {
                  php3_printf("No input file specified.\n");
! php3_request_shutdown((void *) GLOBAL(sapi_rqst), php3_globals);
                  return 0;
          }
          /*
--- 1500,1513 ----
          }
          if (sapi_info->info_only) {
                  _php3_info();
! php3_request_shutdown((void *) GLOBAL(sapi_rqst) _INLINE_TLS);
                  return (1);
          }
  
          /* if its not cgi, require that we have a filename now */
          if (!sapi_info->cgi && !sapi_info->filename) {
                  php3_printf("No input file specified.\n");
! php3_request_shutdown((void *) GLOBAL(sapi_rqst) _INLINE_TLS);
                  return 0;
          }
          /*
***************
*** 1512,1518 ****
  
          if (sapi_info->cgi && !in) {
                  php3_printf("No input file specified for cgi.\n");
! php3_request_shutdown((void *) GLOBAL(sapi_rqst), php3_globals);
                  return 0;
          }
  #if defined(CRASH_DETECTION)
--- 1522,1528 ----
  
          if (sapi_info->cgi && !in) {
                  php3_printf("No input file specified for cgi.\n");
! php3_request_shutdown((void *) GLOBAL(sapi_rqst) _INLINE_TLS);
                  return 0;
          }
  #if defined(CRASH_DETECTION)
***************
*** 1583,1589 ****
          debug_log("%d:start request shutdown\n",GetCurrentThreadId());
  #endif
                  php3_header(); /* Make sure headers have been sent */
! php3_request_shutdown((void *) GLOBAL(sapi_rqst), php3_globals);
  #if defined(CRASH_DETECTION)
          debug_log("%d:request shutdown done\n",GetCurrentThreadId());
  #endif
--- 1593,1599 ----
          debug_log("%d:start request shutdown\n",GetCurrentThreadId());
  #endif
                  php3_header(); /* Make sure headers have been sent */
! php3_request_shutdown((void *) GLOBAL(sapi_rqst) _INLINE_TLS);
  #if defined(CRASH_DETECTION)
          debug_log("%d:request shutdown done\n",GetCurrentThreadId());
  #endif
Index: php31/main/php.h
diff -c php31/main/php.h:1.11 php31/main/php.h:1.12
*** php31/main/php.h:1.11 Sun May 31 15:44:00 1998
--- php31/main/php.h Sun May 31 18:10:47 1998
***************
*** 28,34 ****
     +----------------------------------------------------------------------+
   */
  
! /* $Id: php.h,v 1.11 1998/05/31 19:44:00 shane Exp $ */
  
  #ifndef _PHP_H
  #define _PHP_H
--- 28,34 ----
     +----------------------------------------------------------------------+
   */
  
! /* $Id: php.h,v 1.12 1998/05/31 22:10:47 shane Exp $ */
  
  #ifndef _PHP_H
  #define _PHP_H
***************
*** 57,65 ****
  #else
  # include "config.h"
  # define PHPAPI
- # define THREAD_LS
  #endif
  
  #if HAVE_ALLOCA_H
  #include <alloca.h>
  #endif
--- 57,66 ----
  #else
  # include "config.h"
  # define PHPAPI
  #endif
  
+ #include "sapi/sapi.h"
+
  #if HAVE_ALLOCA_H
  #include <alloca.h>
  #endif
***************
*** 208,218 ****
  
  #define EXEC_INPUT_BUF 4096
  
- #if defined(USE_SAPI) && defined(COMPILE_DL)
- #define PUTS(a) php3_printf("%s",a)
- #define PUTC(a) PUTS(a)
- #define PHPWRITE(a,n) php3_write((a),(n))
- #endif
  
  #define E_ERROR 0x1
  #define E_WARNING 0x2
--- 209,214 ----
Index: php31/main/phpsapi_core.dsp
diff -c php31/main/phpsapi_core.dsp:1.6 php31/main/phpsapi_core.dsp:1.7
*** php31/main/phpsapi_core.dsp:1.6 Sun May 31 16:44:26 1998
--- php31/main/phpsapi_core.dsp Sun May 31 18:10:47 1998
***************
*** 44,50 ****
  # PROP Ignore_Export_Lib 0
  # PROP Target_Dir ""
  # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
! # ADD CPP /nologo /MT /W3 /GX /O2 /I "\src\phpcvs\php3" /I "regex\\" /I "\src\mysql\include" /D "NDEBUG" /D "THREAD_SAFE" /D "USE_SAPI" /D "MSVC5" /D "WIN32" /D "_WINDOWS" /YX /FD /c
  # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
  # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
  # ADD BASE RSC /l 0x409 /d "NDEBUG"
--- 44,50 ----
  # PROP Ignore_Export_Lib 0
  # PROP Target_Dir ""
  # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
! # ADD CPP /nologo /MT /W3 /GX /O2 /I "../" /I "../../main" /I "./" /D "NDEBUG" /D "THREAD_SAFE" /D "USE_SAPI" /D "MSVC5" /D "WIN32" /D "_WINDOWS" /YX /FD /c
  # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
  # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
  # ADD BASE RSC /l 0x409 /d "NDEBUG"
***************
*** 640,648 ****
  SOURCE=..\ext\standard\url.h
  # End Source File
  # End Group
- # Begin Source File
-
- SOURCE=..\sapi\isapi_sapi.c
- # End Source File
  # End Target
  # End Project
--- 640,644 ----