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

Date: Thursday May 28, 1998 @ 22:02
Author: shane

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

Modified Files:
        main.c php.h
Log Message:
ISAPI improving. Now will work sometimes concurrently in threads. Some specific access violations cropping up.

Index: php31/main/main.c
diff -c php31/main/main.c:1.5 php31/main/main.c:1.6
*** php31/main/main.c:1.5 Thu May 28 15:21:04 1998
--- php31/main/main.c Thu May 28 22:02:57 1998
***************
*** 29,35 ****
     +----------------------------------------------------------------------+
   */
  
! /* $Id: main.c,v 1.5 1998/05/28 19:21:04 shane Exp $ */
  
  /* #define CRASH_DETECTION */
  
--- 29,35 ----
     +----------------------------------------------------------------------+
   */
  
! /* $Id: main.c,v 1.6 1998/05/29 02:02:57 shane Exp $ */
  
  /* #define CRASH_DETECTION */
  
***************
*** 690,696 ****
          GLOBAL(initialized) &= ~INIT_ENVIRONMENT; /* does not require any special shutdown */
  
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:INIT_SYMBOL_TABLE\n",GLOBAL(sapi_rqst));
          OutputDebugString(logmessage);
  #endif
          /* remove classes and user-functions */
--- 690,696 ----
          GLOBAL(initialized) &= ~INIT_ENVIRONMENT; /* does not require any special shutdown */
  
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:INIT_SYMBOL_TABLE\n",GLOBAL(sapi_rqst)->scid);
          OutputDebugString(logmessage);
  #endif
          /* remove classes and user-functions */
***************
*** 698,704 ****
                  hash_apply(&GLOBAL(function_table), (int (*)(void *)) is_not_internal_function);
          }
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:INIT_FUNCTION_TABLE\n",GLOBAL(sapi_rqst));
          OutputDebugString(logmessage);
  #endif
          if (GLOBAL(initialized) & INIT_TOKEN_CACHE) {
--- 698,704 ----
                  hash_apply(&GLOBAL(function_table), (int (*)(void *)) is_not_internal_function);
          }
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:INIT_FUNCTION_TABLE\n",GLOBAL(sapi_rqst)->scid);
          OutputDebugString(logmessage);
  #endif
          if (GLOBAL(initialized) & INIT_TOKEN_CACHE) {
***************
*** 706,712 ****
                  GLOBAL(initialized) &= ~INIT_TOKEN_CACHE;
          }
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:INIT_TOKEN_CACHE\n",GLOBAL(sapi_rqst));
          OutputDebugString(logmessage);
  #endif
          if (GLOBAL(initialized) & INIT_CSS) {
--- 706,712 ----
                  GLOBAL(initialized) &= ~INIT_TOKEN_CACHE;
          }
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:INIT_TOKEN_CACHE\n",GLOBAL(sapi_rqst)->scid);
          OutputDebugString(logmessage);
  #endif
          if (GLOBAL(initialized) & INIT_CSS) {
***************
*** 714,720 ****
                  GLOBAL(initialized) &= ~INIT_CSS;
          }
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:INIT_CSS\n",GLOBAL(sapi_rqst));
          OutputDebugString(logmessage);
  #endif
          if (GLOBAL(initialized) & INIT_FOR_STACK) {
--- 714,720 ----
                  GLOBAL(initialized) &= ~INIT_CSS;
          }
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:INIT_CSS\n",GLOBAL(sapi_rqst)->scid);
          OutputDebugString(logmessage);
  #endif
          if (GLOBAL(initialized) & INIT_FOR_STACK) {
***************
*** 722,728 ****
                  GLOBAL(initialized) &= ~INIT_FOR_STACK;
          }
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:INIT_FOR_STACK\n",GLOBAL(sapi_rqst));
          OutputDebugString(logmessage);
  #endif
          if (GLOBAL(initialized) & INIT_SWITCH_STACK) {
--- 722,728 ----
                  GLOBAL(initialized) &= ~INIT_FOR_STACK;
          }
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:INIT_FOR_STACK\n",GLOBAL(sapi_rqst)->scid);
          OutputDebugString(logmessage);
  #endif
          if (GLOBAL(initialized) & INIT_SWITCH_STACK) {
***************
*** 736,742 ****
                  GLOBAL(initialized) &= ~INIT_SWITCH_STACK;
          }
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:INIT_SWITCH_STACK\n",GLOBAL(sapi_rqst));
          OutputDebugString(logmessage);
  #endif
          if (GLOBAL(initialized) & INIT_INCLUDE_STACK) {
--- 736,742 ----
                  GLOBAL(initialized) &= ~INIT_SWITCH_STACK;
          }
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:INIT_SWITCH_STACK\n",GLOBAL(sapi_rqst)->scid);
          OutputDebugString(logmessage);
  #endif
          if (GLOBAL(initialized) & INIT_INCLUDE_STACK) {
***************
*** 744,750 ****
                  GLOBAL(initialized) &= ~INIT_INCLUDE_STACK;
          }
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:INIT_INCLUDE_STACK\n",GLOBAL(sapi_rqst));
          OutputDebugString(logmessage);
  #endif
          if (GLOBAL(initialized) & INIT_FUNCTION_STATE_STACK) {
--- 744,750 ----
                  GLOBAL(initialized) &= ~INIT_INCLUDE_STACK;
          }
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:INIT_INCLUDE_STACK\n",GLOBAL(sapi_rqst)->scid);
          OutputDebugString(logmessage);
  #endif
          if (GLOBAL(initialized) & INIT_FUNCTION_STATE_STACK) {
***************
*** 771,777 ****
                  GLOBAL(initialized) &= ~INIT_FUNCTION_STATE_STACK;
          }
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:INIT_FUNCTION_STATE_STACK\n",GLOBAL(sapi_rqst));
          OutputDebugString(logmessage);
  #endif
          if (GLOBAL(initialized) & INIT_VARIABLE_UNASSIGN_STACK) {
--- 771,777 ----
                  GLOBAL(initialized) &= ~INIT_FUNCTION_STATE_STACK;
          }
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:INIT_FUNCTION_STATE_STACK\n",GLOBAL(sapi_rqst)->scid);
          OutputDebugString(logmessage);
  #endif
          if (GLOBAL(initialized) & INIT_VARIABLE_UNASSIGN_STACK) {
***************
*** 788,794 ****
          }
  
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:INIT_VARIABLE_UNASSIGN_STACK\n",GLOBAL(sapi_rqst));
          OutputDebugString(logmessage);
  #endif
          if (GLOBAL(initialized) & INIT_LIST) {
--- 788,794 ----
          }
  
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:INIT_VARIABLE_UNASSIGN_STACK\n",GLOBAL(sapi_rqst)->scid);
          OutputDebugString(logmessage);
  #endif
          if (GLOBAL(initialized) & INIT_LIST) {
***************
*** 797,811 ****
          }
          
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:INIT_LIST\n",GLOBAL(sapi_rqst));
          OutputDebugString(logmessage);
  #endif
          /* clean temporary dl's, run request shutdown's for modules */
          hash_apply(&GLOBAL(module_registry), (int (*)(void *)) module_registry_cleanup);
  
!
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:temporary dl's\n",GLOBAL(sapi_rqst));
          OutputDebugString(logmessage);
  #endif
          if (GLOBAL(module_initialized) & INIT_CONSTANTS) {
--- 797,811 ----
          }
          
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:INIT_LIST\n",GLOBAL(sapi_rqst)->scid);
          OutputDebugString(logmessage);
  #endif
          /* clean temporary dl's, run request shutdown's for modules */
          hash_apply(&GLOBAL(module_registry), (int (*)(void *)) module_registry_cleanup);
  
! /* FIXME the above line causes access violations in threads*/
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:temporary dl's\n",GLOBAL(sapi_rqst)->scid);
          OutputDebugString(logmessage);
  #endif
          if (GLOBAL(module_initialized) & INIT_CONSTANTS) {
***************
*** 814,820 ****
          }
  
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:INIT_CONSTANTS\n",GLOBAL(sapi_rqst));
          OutputDebugString(logmessage);
  #endif
          if (GLOBAL(initialized) & INIT_INCLUDE_NAMES_HASH) {
--- 814,820 ----
          }
  
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:INIT_CONSTANTS\n",GLOBAL(sapi_rqst)->scid);
          OutputDebugString(logmessage);
  #endif
          if (GLOBAL(initialized) & INIT_INCLUDE_NAMES_HASH) {
***************
*** 822,828 ****
                  GLOBAL(initialized) &= ~INIT_INCLUDE_NAMES_HASH;
          }
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:INIT_INCLUDE_NAMES_HASH\n",GLOBAL(sapi_rqst));
          OutputDebugString(logmessage);
  #endif
          if (GLOBAL(initialized) & INIT_SCANNER) {
--- 822,828 ----
                  GLOBAL(initialized) &= ~INIT_INCLUDE_NAMES_HASH;
          }
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:INIT_INCLUDE_NAMES_HASH\n",GLOBAL(sapi_rqst)->scid);
          OutputDebugString(logmessage);
  #endif
          if (GLOBAL(initialized) & INIT_SCANNER) {
***************
*** 830,836 ****
                  GLOBAL(initialized) &= ~INIT_SCANNER;
          }
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:INIT_SCANNER\n",GLOBAL(sapi_rqst));
          OutputDebugString(logmessage);
  #endif
          if (GLOBAL(initialized) & INIT_MEMORY_MANAGER) {
--- 830,836 ----
                  GLOBAL(initialized) &= ~INIT_SCANNER;
          }
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:INIT_SCANNER\n",GLOBAL(sapi_rqst)->scid);
          OutputDebugString(logmessage);
  #endif
          if (GLOBAL(initialized) & INIT_MEMORY_MANAGER) {
***************
*** 838,844 ****
                  GLOBAL(initialized) &= ~INIT_MEMORY_MANAGER;
          }
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:INIT_MEMORY_MANAGER\n",GLOBAL(sapi_rqst));
          OutputDebugString(logmessage);
  #endif
          if (GLOBAL(initialized)) {
--- 838,844 ----
                  GLOBAL(initialized) &= ~INIT_MEMORY_MANAGER;
          }
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:INIT_MEMORY_MANAGER\n",GLOBAL(sapi_rqst)->scid);
          OutputDebugString(logmessage);
  #endif
          if (GLOBAL(initialized)) {
***************
*** 846,852 ****
          }
          php3_unset_timeout(_INLINE_TLS_VOID);
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:timer unset\n",GLOBAL(sapi_rqst));
          OutputDebugString(logmessage);
  #endif
  
--- 846,852 ----
          }
          php3_unset_timeout(_INLINE_TLS_VOID);
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:timer unset\n",GLOBAL(sapi_rqst)->scid);
          OutputDebugString(logmessage);
  #endif
  
***************
*** 2226,2232 ****
  #if DEBUG && WIN32
          char logmessage[1024];
  #endif
! YY_TLS_VARS;
          TLS_VARS;
  
          GLOBAL(php3_preprocess) = sapi_info->preprocess;
--- 2226,2232 ----
  #if DEBUG && WIN32
          char logmessage[1024];
  #endif
! // YY_TLS_VARS;
          TLS_VARS;
  
          GLOBAL(php3_preprocess) = sapi_info->preprocess;
***************
*** 2234,2240 ****
          GLOBAL(sapi_rqst) = sapi_info;
  
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:enter request startup\n",GLOBAL(sapi_rqst));
          OutputDebugString(logmessage);
  #endif
          if (php3_request_startup(_INLINE_TLS_VOID) == FAILURE) {
--- 2234,2240 ----
          GLOBAL(sapi_rqst) = sapi_info;
  
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:enter request startup\n",GLOBAL(sapi_rqst)->scid);
          OutputDebugString(logmessage);
  #endif
          if (php3_request_startup(_INLINE_TLS_VOID) == FAILURE) {
***************
*** 2242,2248 ****
          }
  
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:request startup success\n",GLOBAL(sapi_rqst));
          OutputDebugString(logmessage);
  #endif
          /* now we estrdup the rqst_filename into filename so the include hash works right */
--- 2242,2248 ----
          }
  
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:request startup success\n",GLOBAL(sapi_rqst)->scid);
          OutputDebugString(logmessage);
  #endif
          /* now we estrdup the rqst_filename into filename so the include hash works right */
***************
*** 2269,2275 ****
             if it is null at this point
           */
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:opening file %s\n",GLOBAL(sapi_rqst),sapi_info->filename);
          OutputDebugString(logmessage);
  #endif
          in = php3_fopen_for_parser();
--- 2269,2275 ----
             if it is null at this point
           */
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:opening file %s\n",GLOBAL(sapi_rqst)->scid,sapi_info->filename);
          OutputDebugString(logmessage);
  #endif
          in = php3_fopen_for_parser();
***************
*** 2280,2286 ****
                  return 0;
          }
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:opening file success\n",GLOBAL(sapi_rqst));
          OutputDebugString(logmessage);
  #endif
          if (sapi_info->cgi && in) {
--- 2280,2286 ----
                  return 0;
          }
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:opening file success\n",GLOBAL(sapi_rqst)->scid);
          OutputDebugString(logmessage);
  #endif
          if (sapi_info->cgi && in) {
***************
*** 2323,2345 ****
          }
          if (sapi_info->preprocess==PREPROCESS_NONE) {
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:begin parse\n",GLOBAL(sapi_rqst));
          OutputDebugString(logmessage);
  #endif
                  php3_parse(GLOBAL(phpin) _INLINE_TLS);
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:parse done\n",GLOBAL(sapi_rqst));
          OutputDebugString(logmessage);
  #endif
          } else {
                  pval yylval;
  
  #ifdef THREAD_SAFE
! while (phplex(&yylval, php3_globals, php_gbl)); /* create the token cache */
  #else
! while (phplex(&yylval)); /* create the token cache */
  #endif
! tcm_save(&GLOBAL(token_cache_manager));
          }
  
          if (sapi_info->display_source_mode) {
--- 2323,2345 ----
          }
          if (sapi_info->preprocess==PREPROCESS_NONE) {
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:begin parse\n",GLOBAL(sapi_rqst)->scid);
          OutputDebugString(logmessage);
  #endif
                  php3_parse(GLOBAL(phpin) _INLINE_TLS);
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:parse done\n",GLOBAL(sapi_rqst)->scid);
          OutputDebugString(logmessage);
  #endif
          } else {
                  pval yylval;
  
  #ifdef THREAD_SAFE
! //while (phplex(&yylval, php3_globals, php_gbl)); /* create the token cache */
  #else
! //while (phplex(&yylval)); /* create the token cache */
  #endif
! //tcm_save(&GLOBAL(token_cache_manager));
          }
  
          if (sapi_info->display_source_mode) {
***************
*** 2347,2359 ****
          }
          if (GLOBAL(initialized)) {
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:start request shutdown\n",GLOBAL(sapi_rqst));
          OutputDebugString(logmessage);
  #endif
                  php3_header(); /* Make sure headers have been sent */
                  php3_request_shutdown((void *) GLOBAL(sapi_rqst), php3_globals);
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:request shutdown done\n",GLOBAL(sapi_rqst));
          OutputDebugString(logmessage);
  #endif
                  return SUCCESS;
--- 2347,2359 ----
          }
          if (GLOBAL(initialized)) {
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:start request shutdown\n",GLOBAL(sapi_rqst)->scid);
          OutputDebugString(logmessage);
  #endif
                  php3_header(); /* Make sure headers have been sent */
                  php3_request_shutdown((void *) GLOBAL(sapi_rqst), php3_globals);
  #if DEBUG && WIN32
! snprintf(logmessage,1024,"%d:request shutdown done\n",GLOBAL(sapi_rqst)->scid);
          OutputDebugString(logmessage);
  #endif
                  return SUCCESS;
***************
*** 2399,2405 ****
                          if (!tls_create())
                                  return 0;
                          php3_globals = TlsGetValue(TlsIndex);
! yy_init_tls();
  
                          if (php3_config_ini_startup(_INLINE_TLS_VOID) == FAILURE) {
                                  return 0;
--- 2399,2406 ----
                          if (!tls_create())
                                  return 0;
                          php3_globals = TlsGetValue(TlsIndex);
! if(!yy_init_tls())
! return 0;
  
                          if (php3_config_ini_startup(_INLINE_TLS_VOID) == FAILURE) {
                                  return 0;
***************
*** 2417,2423 ****
                          if (!tls_create())
                                  return 0;
                          php3_globals = TlsGetValue(TlsIndex);
! yy_init_tls();
                          if (php3_module_startup(php3_globals) == FAILURE) {
                                  ErrorExit("module startup failed");
                                  return 0;
--- 2418,2425 ----
                          if (!tls_create())
                                  return 0;
                          php3_globals = TlsGetValue(TlsIndex);
! if(!yy_init_tls())
! return 0;
                          if (php3_module_startup(php3_globals) == FAILURE) {
                                  ErrorExit("module startup failed");
                                  return 0;
Index: php31/main/php.h
diff -c php31/main/php.h:1.3 php31/main/php.h:1.4
*** php31/main/php.h:1.3 Wed May 27 23:25:47 1998
--- php31/main/php.h Thu May 28 22:02:58 1998
***************
*** 28,34 ****
     +----------------------------------------------------------------------+
   */
  
! /* $Id: php.h,v 1.3 1998/05/28 03:25:47 shane Exp $ */
  
  #ifndef _PHP_H
  #define _PHP_H
--- 28,34 ----
     +----------------------------------------------------------------------+
   */
  
! /* $Id: php.h,v 1.4 1998/05/29 02:02:58 shane Exp $ */
  
  #ifndef _PHP_H
  #define _PHP_H
***************
*** 85,93 ****
  #if THREAD_SAFE
  #define GLOBAL(a) php3_globals->a
  #define STATIC GLOBAL
! #define TLS_VARS \
! php3_globals_struct *php3_globals; \
! php3_globals = TlsGetValue(TlsIndex);
  #define CREATE_MUTEX(a,b) a = CreateMutex (NULL, FALSE, b);
  #define SET_MUTEX(a) WaitForSingleObject( a, INFINITE );
  #define FREE_MUTEX(a) ReleaseMutex(a);
--- 85,93 ----
  #if THREAD_SAFE
  #define GLOBAL(a) php3_globals->a
  #define STATIC GLOBAL
! #define TLS_VARS php3_globals_struct *php3_globals;\
! if(!TlsIndex)OutputDebugString("Invalid TLSIndex!\n");\
! php3_globals = TlsGetValue(TlsIndex)
  #define CREATE_MUTEX(a,b) a = CreateMutex (NULL, FALSE, b);
  #define SET_MUTEX(a) WaitForSingleObject( a, INFINITE );
  #define FREE_MUTEX(a) ReleaseMutex(a);