CVS update: php31/main

From: Date: Sun, 06 Sep 1998 21:34:37 +0000
Subject: CVS update: php31/main
Groups: php.dev 
Request: Send a blank email to php-dev+get-847@lists.php.net to get a copy of this message
Date: Sunday September 6, 1998 @ 17:34 Author: zeev Update of /repository/php31/main In directory asf:/u2/tmp/cvs-serv21481/main Modified Files: Makefile.am automated_configuration.h automated_configuration_definitions.h constants.h debugger.c fopen-wrappers.c language-scanner.l main.c makeparser.bat mtparser.bat php.h phpsapi_core.dsp Added Files: ini-parser.y ini-scanner.l Removed Files: configuration-parser.y configuration-scanner.l Log Message: * Rename the configuration stuff to ini * Some automated configuration patches * Begin to incorporate automated configuration * Lots of beautification Index: php31/main/Makefile.am diff -c php31/main/Makefile.am:2.7 php31/main/Makefile.am:2.8 *** php31/main/Makefile.am:2.7 Tue Sep 1 16:21:23 1998 --- php31/main/Makefile.am Sun Sep 6 17:34:33 1998 *************** *** 30,53 **** INCLUDES=@INCLUDES@ -I$(top_srcdir) CLEANFILES=\ ! configuration-scanner.c configuration-parser.[ch] \ language-scanner.c language-parser.[ch] \ *-parser.output noinst_LIBRARIES=libphpcore.a libphpcore_a_SOURCES=\ ! configuration-parser.y language-parser.y \ ! configuration-scanner.l language-scanner.l \ alloc.c list.c php3_threads.c constants.c main.c \ safe_mode.c debugger.c mime.c snprintf.c fopen-wrappers.c \ operators.c stack.c head.c php3_hash.c tls.c highlight.c \ php3_ini.c token_cache.c internal_functions.c php3_sprintf.c \ variables.c post.c php3_realpath.c string_buffer.c dl.c ! configuration-parser.h: $(srcdir)/configuration-parser.y ! bison -p cfg -v -d $< -o configuration-parser.c ! configuration-parser.c: $(srcdir)/configuration-parser.y ! bison -p cfg -v -d $< -o configuration-parser.c language-parser.c: $(srcdir)/language-parser.y bison -p php -v -d $< -o language-parser.c --- 30,53 ---- INCLUDES=@INCLUDES@ -I$(top_srcdir) CLEANFILES=\ ! ini-scanner.c ini-parser.[ch] \ language-scanner.c language-parser.[ch] \ *-parser.output noinst_LIBRARIES=libphpcore.a libphpcore_a_SOURCES=\ ! ini-parser.y language-parser.y \ ! ini-scanner.l language-scanner.l \ alloc.c list.c php3_threads.c constants.c main.c \ safe_mode.c debugger.c mime.c snprintf.c fopen-wrappers.c \ operators.c stack.c head.c php3_hash.c tls.c highlight.c \ php3_ini.c token_cache.c internal_functions.c php3_sprintf.c \ variables.c post.c php3_realpath.c string_buffer.c dl.c ! ini-parser.h: $(srcdir)/ini-parser.y ! bison -p ini -v -d $< -o ini-parser.c ! ini-parser.c: $(srcdir)/ini-parser.y ! bison -p ini -v -d $< -o ini-parser.c language-parser.c: $(srcdir)/language-parser.y bison -p php -v -d $< -o language-parser.c *************** *** 55,62 **** language-parser.h: $(srcdir)/language-parser.y bison -p php -v -d $< -o language-parser.c ! configuration-scanner.c: $(srcdir)/configuration-scanner.l configuration-parser.h ! flex -Pcfg -o$@ -i $(srcdir)/configuration-scanner.l language-scanner.c: $(srcdir)/language-scanner.l language-parser.h flex -Pphp -o$@ -i $(srcdir)/language-scanner.l --- 55,62 ---- language-parser.h: $(srcdir)/language-parser.y bison -p php -v -d $< -o language-parser.c ! ini-scanner.c: $(srcdir)/ini-scanner.l ini-parser.h ! flex -Pini -o$@ -i $(srcdir)/ini-scanner.l language-scanner.c: $(srcdir)/language-scanner.l language-parser.h flex -Pphp -o$@ -i $(srcdir)/language-scanner.l Index: php31/main/automated_configuration.h diff -c php31/main/automated_configuration.h:2.6 php31/main/automated_configuration.h:2.7 *** php31/main/automated_configuration.h:2.6 Thu Sep 3 14:41:55 1998 --- php31/main/automated_configuration.h Sun Sep 6 17:34:33 1998 *************** *** 1,19 **** #include "automated_configuration_definitions.h" ! BEGIN_INI_TABLE() ! INI_ENTRY(engine, AC_BOOL, 1, AC_NO, "Turn the PHP engine on/off") ! INI_ENTRY(use_registry, AC_BOOL, 0, AC_NO, "Use Win32 Registry for per-server vars") ! INI_ENTRY(use_registry_dir, AC_BOOL, 0, AC_NO_SAFEMODE, "Use Win32 Registry for per-directory vars") ! INI_ENTRY(short_open_tag, AC_BOOL, 1, AC_YES, "Allow <? as an open tag") ! INI_ENTRY(precision, AC_LONG, 14, AC_YES, "Precision of floating point numbers") ! INI_ENTRY(y2k_compliance, AC_BOOL, 0, AC_YES, "Year 2000 compliance") ! INI_ENTRY(safe_mode, AC_BOOL, 0, AC_NO, "Turn safe mode on/off") INI_ENTRY(safe_mode_exec_dir, AC_STRING, NULL, AC_NO, "Directory for safe mode execution") ! INI_ENTRY(last_modified, AC_BOOL, 0, AC_YES, "Last-modified: ..?") ! INI_ENTRY(xbithack, AC_BOOL, 0, AC_NO, "Whether to turn on xbithack or not") INI_ENTRY(arg_separator, AC_STRING, "&", AC_YES, "The GET method argument separator") INI_ENTRY(gpc_order, AC_STRING, "GPC", AC_YES, "The order of GET/POST/Cookie data") ! INI_ENTRY(enable_dl, AC_BOOL, 1, AC_NO, "Whether to enable dynamic extensions or not") INI_ENTRY(open_basedir, AC_STRING, NULL, AC_NO_SAFEMODE, "Only open files from the base dir of a request") /* highlight entries */ --- 1,25 ---- + /* This file holds all the core (non-module-specific) ini entries. + * At a later time, we'd have to add some magic that would add to it + * the automated_configuration.h.stub files from every module that + * is compiled statically. + */ + #include "automated_configuration_definitions.h" ! BEGIN_INI_TABLE(core) ! INI_ENTRY(engine, AC_BOOL, 1L, AC_NO, "Turn the PHP engine on/off") ! INI_ENTRY(use_registry, AC_BOOL, 0L, AC_NO, "Use Win32 Registry for per-server vars") ! INI_ENTRY(use_registry_dir, AC_BOOL, 0L, AC_NO_SAFEMODE, "Use Win32 Registry for per-directory vars") ! INI_ENTRY(short_open_tag, AC_BOOL, 1L, AC_YES, "Allow <? as an open tag") ! INI_ENTRY(precision, AC_LONG, 14L, AC_YES, "Precision of floating point numbers") ! INI_ENTRY(y2k_compliance, AC_BOOL, 0L, AC_YES, "Year 2000 compliance") ! INI_ENTRY(safe_mode, AC_BOOL, 0L, AC_NO, "Turn safe mode on/off") INI_ENTRY(safe_mode_exec_dir, AC_STRING, NULL, AC_NO, "Directory for safe mode execution") ! INI_ENTRY(last_modified, AC_BOOL, 0L, AC_YES, "Last-modified: ..?") ! INI_ENTRY(xbithack, AC_BOOL, 0L, AC_NO, "Whether to turn on xbithack or not") INI_ENTRY(arg_separator, AC_STRING, "&", AC_YES, "The GET method argument separator") INI_ENTRY(gpc_order, AC_STRING, "GPC", AC_YES, "The order of GET/POST/Cookie data") ! INI_ENTRY(enable_dl, AC_BOOL, 1L, AC_NO, "Whether to enable dynamic extensions or not") INI_ENTRY(open_basedir, AC_STRING, NULL, AC_NO_SAFEMODE, "Only open files from the base dir of a request") /* highlight entries */ *************** *** 81,86 **** /* browscap */ INI_ENTRY(browscap, AC_STRING, NULL, AC_YES, "Path to browscap file") - /* browscap */ - GROUP_INI_ENTRY(bcmath, scale, AC_LONG, 0, AC_YES, "BCMath Default Scale") END_INI_TABLE() --- 87,92 ---- /* browscap */ INI_ENTRY(browscap, AC_STRING, NULL, AC_YES, "Path to browscap file") END_INI_TABLE() + + #undef AC_MODULE_NAME Index: php31/main/automated_configuration_definitions.h diff -c php31/main/automated_configuration_definitions.h:2.4 php31/main/automated_configuration_definitions.h:2.5 *** php31/main/automated_configuration_definitions.h:2.4 Thu Sep 3 14:41:55 1998 --- php31/main/automated_configuration_definitions.h Sun Sep 6 17:34:33 1998 *************** *** 57,63 **** # define AC_STRING char * # define AC_BOOL AC_LONG ! # define BEGIN_INI_TABLE() typedef struct { # define END_INI_TABLE() } php3_ini_structure; # define INI_ENTRY(name, type, default_value, user_modifyable, description) \ type name; --- 57,63 ---- # define AC_STRING char * # define AC_BOOL AC_LONG ! # define BEGIN_INI_TABLE(name) typedef struct { # define END_INI_TABLE() } php3_ini_structure; # define INI_ENTRY(name, type, default_value, user_modifyable, description) \ type name; *************** *** 89,106 **** /***************************************** * Initialization and maintainance table * *****************************************/ - typedef union { - long lval; - double dval; - char *strval; - } php3_ini_cache_entry_value; typedef struct { char *name; void *cache_address; int type; ! php3_ini_cache_entry_value default_value; ! php3_ini_cache_entry_value old_value; } php3_ini_cache_entry; # define AC_LONG IS_LONG --- 89,101 ---- /***************************************** * Initialization and maintainance table * *****************************************/ typedef struct { char *name; void *cache_address; int type; ! void *default_value; ! void *old_value; } php3_ini_cache_entry; # define AC_LONG IS_LONG *************** *** 108,120 **** # define AC_STRING IS_STRING # define AC_BOOL AC_LONG ! # define BEGIN_INI_TABLE() php3_ini_cache_entry[] = { ! # define END_INI_TABLE() { NULL, NULL, 0, {0}, {0} } \ }; # define INI_ENTRY(name, type, default_value, user_modifyable, description) \ ! { #name, &php3_ini.name, type, { default_value }, {0} }, # define GROUP_INI_ENTRY(group_name, name, type, default_value, user_modifyable, description) \ ! { #group_name "." #name, &php3_ini.name, type, { default_value }, {0} }, # define ACP_ALWAYS 0x1 --- 103,115 ---- # define AC_STRING IS_STRING # define AC_BOOL AC_LONG ! # define BEGIN_INI_TABLE(name) static php3_ini_cache_entry php3_ini_cache_##name[] = { ! # define END_INI_TABLE() { NULL, NULL, 0, 0, 0 } \ }; # define INI_ENTRY(name, type, default_value, user_modifyable, description) \ ! { #name, &php3_ini_master.name, type, (void *) default_value, (void *) 0 }, # define GROUP_INI_ENTRY(group_name, name, type, default_value, user_modifyable, description) \ ! { #group_name "." #name, &php3_ini_master.group_name##_##name, type, (void *) default_value, (void *) 0 }, # define ACP_ALWAYS 0x1 *************** *** 169,175 **** # define AC_STRING 0x4 # define AC_BOOL 0x8 ! # define BEGIN_INI_TABLE() \ char *php3_apache_command_handler(cmd_parms *cmd, php3_ini_structure *conf, char *arg) \ { \ switch((int) cmd->info) { --- 164,170 ---- # define AC_STRING 0x4 # define AC_BOOL 0x8 ! # define BEGIN_INI_TABLE(name) \ char *php3_apache_command_handler(cmd_parms *cmd, php3_ini_structure *conf, char *arg) \ { \ switch((int) cmd->info) { *************** *** 219,225 **** # define AC_STRING IS_STRING # define AC_BOOL AC_LONG ! # define BEGIN_INI_TABLE() command_rec php3_commands[] = { # define END_INI_TABLE() { NULL, NULL, NULL, NULL, NULL, NULL } \ }; # define INI_ENTRY(name, type, default_value, user_modifyable, description) \ --- 214,220 ---- # define AC_STRING IS_STRING # define AC_BOOL AC_LONG ! # define BEGIN_INI_TABLE(name) command_rec php3_commands[] = { # define END_INI_TABLE() { NULL, NULL, NULL, NULL, NULL, NULL } \ }; # define INI_ENTRY(name, type, default_value, user_modifyable, description) \ *************** *** 253,259 **** #elif defined(AC_REGISTRY_TABLE) && !defined(AC_REGISTRY_TABLE_DONE) ! # define BEGIN_INI_TABLE() struct _php3_reg_vars php3_reg_vars[]={ # define END_INI_TABLE() {NULL,NULL,0,0,0} }; # define AC_LONG 1 # define AC_DOUBLE 3 --- 248,254 ---- #elif defined(AC_REGISTRY_TABLE) && !defined(AC_REGISTRY_TABLE_DONE) ! # define BEGIN_INI_TABLE(name) struct _php3_reg_vars php3_reg_vars[]={ # define END_INI_TABLE() {NULL,NULL,0,0,0} }; # define AC_LONG 1 # define AC_DOUBLE 3 *************** *** 268,275 **** { #group_name "." #name, (void *)&GLOBAL(php3_ini)->group_name##_##name, type, user_modifyable, NULL }, #elif defined(AC_REGISTRY_TABLE_FREE) && !defined(AC_REGISTRY_TABLE_FREE_DONE) ! # define BEGIN_INI_TABLE() # define END_INI_TABLE() # define AC_LONG 0 # define AC_DOUBLE 0 --- 263,292 ---- { #group_name "." #name, (void *)&GLOBAL(php3_ini)->group_name##_##name, type, user_modifyable, NULL }, + + + + + + + + + + + + + + + + + + + + + + #elif defined(AC_REGISTRY_TABLE_FREE) && !defined(AC_REGISTRY_TABLE_FREE_DONE) ! # define BEGIN_INI_TABLE(name) # define END_INI_TABLE() # define AC_LONG 0 # define AC_DOUBLE 0 *************** *** 283,290 **** # define GROUP_INI_ENTRY(group_name, name, type, default_value, user_modifyable, description) \ if (user_modifyable && type) efree(GLOBAL(php3_ini)->group_name##_##name; #elif defined(AC_INFO_TABLE) && !defined(AC_INFO_TABLE_DONE) ! # define BEGIN_INI_TABLE() # define END_INI_TABLE() # define AC_LONG 1 # define AC_DOUBLE 2 --- 300,316 ---- # define GROUP_INI_ENTRY(group_name, name, type, default_value, user_modifyable, description) \ if (user_modifyable && type) efree(GLOBAL(php3_ini)->group_name##_##name; + + + + + + + + + #elif defined(AC_INFO_TABLE) && !defined(AC_INFO_TABLE_DONE) ! # define BEGIN_INI_TABLE(name) # define END_INI_TABLE() # define AC_LONG 1 # define AC_DOUBLE 2 *************** *** 298,324 **** # define GROUP_INI_ENTRY(group_name, name, type, default_value, user_modifyable, description) \ PHP3_CONF_OUT( #group_name "." #name , type, php3_ini_master.group_name##_##name, GLOBAL(php3_ini)->group_name##_##name); - #elif defined(AC_MASTER_INI_TABLE) && !defined(AC_MASTER_INI_TABLE_DONE) - # define BEGIN_INI_TABLE() - # define END_INI_TABLE() - # define AC_LONG 1 - # define AC_DOUBLE 2 - # define AC_STRING 3 - # define AC_BOOL AC_LONG - # define AC_YES 1 - # define AC_NO 0 - # define AC_NO_SAFEMODE AC_NO ! # define INI_ENTRY(name, type, default_value, user_modifyable, description) \ ! if(!cfg_get_ini_var(type, #name, (void *)&php3_ini_master.name)){php3_ini_master.name=default_value;} ! # define GROUP_INI_ENTRY(group_name, name, type, default_value, user_modifyable, description) \ ! if(!cfg_get_ini_var(type, #group_name "." #name, (void *)&php3_ini_master.group_name##_##name)){php3_ini_master.group_name##_##name=default_value;} #else ! # define BEGIN_INI_TABLE() # define END_INI_TABLE() # define INI_ENTRY(name, type, default_value, user_modifyable, description, name_separator, variable_separator) # define GROUP_INI_ENTRY(group_name, name, type, default_value, user_modifyable, description, name_separator, variable_separator) --- 324,339 ---- # define GROUP_INI_ENTRY(group_name, name, type, default_value, user_modifyable, description) \ PHP3_CONF_OUT( #group_name "." #name , type, php3_ini_master.group_name##_##name, GLOBAL(php3_ini)->group_name##_##name); ! ! ! #else ! # define BEGIN_INI_TABLE(name) # define END_INI_TABLE() # define INI_ENTRY(name, type, default_value, user_modifyable, description, name_separator, variable_separator) # define GROUP_INI_ENTRY(group_name, name, type, default_value, user_modifyable, description, name_separator, variable_separator) Index: php31/main/constants.h diff -c php31/main/constants.h:2.1 php31/main/constants.h:2.2 *** php31/main/constants.h:2.1 Thu Aug 13 19:51:11 1998 --- php31/main/constants.h Sun Sep 6 17:34:35 1998 *************** *** 30,40 **** extern PHPAPI void php3_register_double_constant(char *name, uint name_len, double dval, int flags, int module_number); extern PHPAPI void php3_register_string_constant(char *name, uint name_len, char *strval, int flags, int module_number); extern PHPAPI void php3_register_stringl_constant(char *name, uint name_len, char *strval, uint strlen, int flags, int module_number); ! extern int php3_get_constants(char *name, uint name_len, pval *result); extern void php3_define(INTERNAL_FUNCTION_PARAMETERS); extern void php3_defined(INTERNAL_FUNCTION_PARAMETERS); - - #endif --- 30,38 ---- extern PHPAPI void php3_register_double_constant(char *name, uint name_len, double dval, int flags, int module_number); extern PHPAPI void php3_register_string_constant(char *name, uint name_len, char *strval, int flags, int module_number); extern PHPAPI void php3_register_stringl_constant(char *name, uint name_len, char *strval, uint strlen, int flags, int module_number); ! extern int php3_get_constant(char *name, uint name_len, pval *result); extern void php3_define(INTERNAL_FUNCTION_PARAMETERS); extern void php3_defined(INTERNAL_FUNCTION_PARAMETERS); #endif Index: php31/main/debugger.c diff -c php31/main/debugger.c:2.0 php31/main/debugger.c:2.1 *** php31/main/debugger.c:2.0 Fri Jul 3 09:17:15 1998 --- php31/main/debugger.c Sun Sep 6 17:34:35 1998 *************** *** 247,252 **** --- 247,256 ---- { TLS_VARS; + /* FIXME + * this will be done automatically when all the configuration magic is done + */ + /* if (cfg_get_string("debugger.host", &GLOBAL(debugger_host)) == FAILURE) { GLOBAL(debugger_host) = "localhost"; } *************** *** 256,261 **** --- 260,267 ---- if (cfg_get_long("debugger.enabled", &GLOBAL(debugger_default)) == FAILURE) { GLOBAL(debugger_default) = 0; } + */ + GLOBAL(myhostname) = find_hostname(); GLOBAL(mypid) = getpid(); Index: php31/main/fopen-wrappers.c diff -c php31/main/fopen-wrappers.c:2.3 php31/main/fopen-wrappers.c:2.4 *** php31/main/fopen-wrappers.c:2.3 Thu Aug 20 08:46:11 1998 --- php31/main/fopen-wrappers.c Sun Sep 6 17:34:35 1998 *************** *** 27,33 **** | Jim Winstead <jimw@php.net> | +----------------------------------------------------------------------+ */ ! /* $Id: fopen-wrappers.c,v 2.3 1998/08/20 12:46:11 rasmus Exp $ */ #ifdef THREAD_SAFE #include "tls.h" --- 27,33 ---- | Jim Winstead <jimw@php.net> | +----------------------------------------------------------------------+ */ ! /* $Id: fopen-wrappers.c,v 2.4 1998/09/06 21:34:35 zeev Exp $ */ #ifdef THREAD_SAFE #include "tls.h" *************** *** 477,483 **** efree(tmp); } /* if the user has configured who they are, send a From: line */ ! if (cfg_get_string("from", &scratch) == SUCCESS) { SOCK_WRITE("From: ", *socketd); SOCK_WRITE(scratch, *socketd); SOCK_WRITE("\n", *socketd); --- 477,483 ---- efree(tmp); } /* if the user has configured who they are, send a From: line */ ! if (ini_get_string("from", &scratch) == SUCCESS) { SOCK_WRITE("From: ", *socketd); SOCK_WRITE(scratch, *socketd); SOCK_WRITE("\n", *socketd); *************** *** 639,645 **** } else { /* if the user has configured who they are, send that as the password */ ! if (cfg_get_string("from", &scratch) == SUCCESS) { SOCK_WRITE(scratch, *socketd); } else { SOCK_WRITE("anonymous", *socketd); --- 639,645 ---- } else { /* if the user has configured who they are, send that as the password */ ! if (ini_get_string("from", &scratch) == SUCCESS) { SOCK_WRITE(scratch, *socketd); } else { SOCK_WRITE("anonymous", *socketd); Index: php31/main/language-scanner.l diff -c php31/main/language-scanner.l:2.10 php31/main/language-scanner.l:2.11 *** php31/main/language-scanner.l:2.10 Tue Sep 1 17:44:15 1998 --- php31/main/language-scanner.l Sun Sep 6 17:34:36 1998 *************** *** 59,68 **** #include "post.h" #include "constants.h" - #if WIN32|WINNT - extern int php3_get_constant(char *name, uint name_len, pval *result); - #endif - #define YY_DECL int lex_scan(pval *phplval) #define ECHO { GLOBAL(sapi_rqst)->writeclient(SAPI_GLOBAL_PASS yytext, yyleng ); } --- 59,64 ---- *************** *** 138,144 **** static void html_puts(char *s, uint len) { register char *ptr=s, *end=s+len; - int add_lineno=0; while (ptr<end) { html_putc(*ptr++); --- 134,139 ---- *************** *** 1004,1011 **** <DOUBLE_QUOTES>[`]+ { - int i; - phplval->value.str.val = (char *) estrndup(yytext, yyleng); phplval->value.str.len = yyleng; phplval->type = IS_STRING; --- 999,1004 ---- *************** *** 1014,1021 **** <BACKQUOTE>["]+ { - int i; - phplval->value.str.val = (char *) estrndup(yytext, yyleng); phplval->value.str.len = yyleng; phplval->type = IS_STRING; --- 1007,1012 ---- *************** *** 1130,1136 **** <DOUBLE_QUOTES,BACKQUOTE,INITIAL,IN_PHP><<EOF>> { - int retval; TLS_VARS; if (!end_current_file_execution(_INLINE_TLS_VOID)) { --- 1121,1126 ---- Index: php31/main/main.c diff -c php31/main/main.c:2.33 php31/main/main.c:2.34 *** php31/main/main.c:2.33 Thu Sep 3 14:41:55 1998 --- php31/main/main.c Sun Sep 6 17:34:36 1998 *************** *** 29,35 **** +----------------------------------------------------------------------+ */ ! /* $Id: main.c,v 2.33 1998/09/03 18:41:55 shane Exp $ */ /* #define CRASH_DETECTION */ --- 29,35 ---- +----------------------------------------------------------------------+ */ ! /* $Id: main.c,v 2.34 1998/09/06 21:34:36 zeev Exp $ */ /* #define CRASH_DETECTION */ *************** *** 87,93 **** #include "sapi/sapi.h" #ifdef THREAD_SAFE ! /*This is indeed a global!*/ TLS_T TlsIndex; CRITICAL_SECT_T Tls_crit; MUTEX_T gLock; --- 87,93 ---- #include "sapi/sapi.h" #ifdef THREAD_SAFE ! /* This is indeed a global! */ TLS_T TlsIndex; CRITICAL_SECT_T Tls_crit; MUTEX_T gLock; *************** *** 101,143 **** char *php3_ini_path = NULL; #ifndef THREAD_SAFE int error_reporting, tmp_error_reporting; int initialized; /* keep track of which resources were successfully initialized */ static int module_initialized = 0; int shutdown_requested; unsigned char header_is_being_sent; unsigned int max_execution_time = 0; ! #if PHP_DEBUGGER extern int debugger_on; ! #endif ! #if WIN32|WINNT unsigned int wintimer; unsigned int timerstart; unsigned int wintimer_counter = 0; ! #endif - HashTable configuration_hash; - - extern FILE *phpin; - php3_ini_structure *php3_ini; - - unsigned int client_alive=1; #endif /* not THREAD_SAFE */ void _php3_build_argv(char *); static void php3_timeout(int dummy); static void php3_set_timeout(long seconds INLINE_TLS); extern void php3_treat_headers(INLINE_TLS_VOID); #if defined(CRASH_DETECTION) ! /****************************************************************************** ! /* function to log debug messages ! /* we may have to throw some server specific stuff into this ! /* function for debugging purposes. ! /*****************************************************************************/ PHPAPI void debug_log(const char *format,...) { va_list args; --- 101,149 ---- char *php3_ini_path = NULL; + #ifndef THREAD_SAFE + int error_reporting, tmp_error_reporting; int initialized; /* keep track of which resources were successfully initialized */ static int module_initialized = 0; int shutdown_requested; unsigned char header_is_being_sent; unsigned int max_execution_time = 0; + HashTable configuration_hash; + extern FILE *phpin; + php3_ini_structure *php3_ini; + unsigned int client_alive=1; ! ! # if PHP_DEBUGGER extern int debugger_on; ! # endif ! ! # if WIN32|WINNT unsigned int wintimer; unsigned int timerstart; unsigned int wintimer_counter = 0; ! # endif #endif /* not THREAD_SAFE */ + #define AC_INIT_TABLE + #include "automated_configuration.h" + void _php3_build_argv(char *); static void php3_timeout(int dummy); static void php3_set_timeout(long seconds INLINE_TLS); extern void php3_treat_headers(INLINE_TLS_VOID); #if defined(CRASH_DETECTION) ! /* ! * function to log debug messages ! * we may have to throw some server specific stuff into this ! * function for debugging purposes. ! * ! */ PHPAPI void debug_log(const char *format,...) { va_list args; *************** *** 153,164 **** if(php3_globals && GLOBAL(sapi_rqst)){ /* be sure we realy are started up first!*/ GLOBAL(sapi_rqst)->debug_log(SAPI_GLOBAL_PASS buffer); } - #if MSVC5 - else{ - } #endif #endif ! OutputDebugString(buffer); va_end(args); } #endif --- 159,172 ---- if(php3_globals && GLOBAL(sapi_rqst)){ /* be sure we realy are started up first!*/ GLOBAL(sapi_rqst)->debug_log(SAPI_GLOBAL_PASS buffer); } #endif + + #if MSVC5 + OutputDebugString(buffer); + #else + fprintf(stderr,buffer); #endif ! va_end(args); } #endif *************** *** 196,201 **** --- 204,210 ---- php3_error(E_PARSE, error); } + void php3_log_err(char *log_message) { FILE *log_file; *************** *** 207,224 **** if (strcmp(GLOBAL(php3_ini)->error_log, "syslog")) { syslog(LOG_NOTICE, log_message); return; - } else { - #endif - log_file = fopen(GLOBAL(php3_ini)->error_log, "a"); - if (log_file != NULL) { - fprintf(log_file, log_message); - fprintf(log_file, "\n"); - fclose(log_file); - return; - } - #if HAVE_SYLOG_H } #endif } /* Otherwise fall back to the default logging location. */ if (php3_header()) { --- 216,230 ---- if (strcmp(GLOBAL(php3_ini)->error_log, "syslog")) { syslog(LOG_NOTICE, log_message); return; } #endif + log_file = fopen(GLOBAL(php3_ini)->error_log, "a"); + if (log_file != NULL) { + fprintf(log_file, log_message); + fprintf(log_file, "\n"); + fclose(log_file); + return; + } } /* Otherwise fall back to the default logging location. */ if (php3_header()) { *************** *** 227,236 **** } - /* is 4K big enough? */ - #define PRINTF_BUFFER_SIZE 1024*4 /*wrapper for modules to use PHPWRITE */ PHPAPI int php3_write(void *buf, int size) { --- 233,241 ---- } + /*wrapper for modules to use PHPWRITE */ PHPAPI int php3_write(void *buf, int size) { *************** *** 255,260 **** --- 260,269 ---- return 0; } + + /* is 4K big enough? */ + #define PRINTF_BUFFER_SIZE 1024*4 + PHPAPI int php3_printf(const char *format,...) { va_list args; *************** *** 265,283 **** va_start(args, format); size = vsprintf(buffer, format, args); ! #if DEBUG /* fix for memory manager shutting down before request is started! */ - if(GLOBAL(sapi_rqst)){ - #endif - ret=php3_sapi_writeclient(buffer, size _INLINE_TLS); #if DEBUG ! } ! #endif ! #if defined(CRASH_DETECTION) ! else{ debug_log(buffer); } #endif va_end(args); return ret; } --- 274,294 ---- va_start(args, format); size = vsprintf(buffer, format, args); ! /* fix for memory manager shutting down before request is started! */ #if DEBUG ! if(GLOBAL(sapi_rqst)) { ! ret=php3_sapi_writeclient(buffer, size _INLINE_TLS); ! } else { ! # if defined(CRASH_DETECTION) debug_log(buffer); + # endif + ret=0; } + #else /* DEBUG=0 */ + ret=php3_sapi_writeclient(buffer, size _INLINE_TLS); #endif + va_end(args); return ret; } *************** *** 852,890 **** } - int cfg_get_ini_var(int type, char *name, void *address){ - if (type == 1) { - if (cfg_get_long( name, ((long *)address)) == FAILURE) { - return 0; - } - #if 1 /* keep around a bit longer whilst I debug further */ - else { - char buf[20]; - OutputDebugString(name); - OutputDebugString(" = "); - snprintf(buf,20,"%u",*((long *)address)); - OutputDebugString(buf); - OutputDebugString("\n"); - } - #endif - } else if(type == 3) { - if (cfg_get_string( name, ((char **)address)) == FAILURE) { - return 0; - } - #if 1 /* keep around a bit longer whilst I debug further */ - else { - OutputDebugString(name); - OutputDebugString(" = "); - OutputDebugString(*((char **)address)); - OutputDebugString("\n"); - } - #endif - } - } - - static int php3_config_ini_startup(INLINE_TLS_VOID) { if (php3_init_config() == FAILURE) { php3_printf("PHP: Unable to parse configuration file.\n"); return FAILURE; --- 863,872 ---- } static int php3_config_ini_startup(INLINE_TLS_VOID) { + php3_ini_cache_entry *p = php3_ini_cache_core; + if (php3_init_config() == FAILURE) { php3_printf("PHP: Unable to parse configuration file.\n"); return FAILURE; *************** *** 894,905 **** #endif /* now using the new nifty auto configurator */ ! { ! #define AC_MASTER_INI_TABLE ! #include "automated_configuration_definitions.h" ! #include "automated_configuration.h" ! #undef AC_MASTER_INI_TABLE } #if defined(CRASH_DETECTION) debug_log("%d:INI OK\n",GetCurrentThreadId()); #endif --- 876,904 ---- #endif /* now using the new nifty auto configurator */ ! while (p->name) { ! switch (p->type) { ! case IS_STRING: ! if (ini_get_string(p->name, (char **) p->cache_address)==FAILURE) { ! #if 0 ! printf("'%s' -> '%s'\n", p->name,(char *) p->default_value); ! #endif ! *((char **) p->cache_address) = (char *) p->default_value; ! } ! break; ! case IS_LONG: ! if (ini_get_long(p->name, (long *) p->cache_address)==FAILURE) { ! #if 0 ! printf("'%s' -> %d\n", p->name, (long) p->default_value); ! #endif ! *((long *) p->cache_address) = (long) p->default_value; ! } ! break; ! } ! p++; } + + #if defined(CRASH_DETECTION) debug_log("%d:INI OK\n",GetCurrentThreadId()); #endif *************** *** 921,929 **** int php3_module_startup(INLINE_TLS_VOID) { #ifdef THREAD_SAFE ! /* FIXME this is simply to prevent accidentaly double calling startup, ! should be removed at some point when we are closer to being ! able to stabalize stuff */ if (GLOBAL(module_initialized)) { return SUCCESS; } --- 920,930 ---- int php3_module_startup(INLINE_TLS_VOID) { #ifdef THREAD_SAFE ! /* FIXME ! * this is simply to prevent accidentaly double calling startup, ! * should be removed at some point when we are closer to being ! * able to stabalize stuff. ! */ if (GLOBAL(module_initialized)) { return SUCCESS; } *************** *** 1191,1202 **** - /****************************************************************************** /* ! /* This is the main SAPI code. The cgi, apache and fhttpd main functions ! /* and code has been removed, and switched into the sapi directory. ! /* ! /*****************************************************************************/ #ifdef THREAD_SAFE extern flex_globals *yy_init_tls(void); --- 1192,1201 ---- /* ! * This is the main SAPI code. The cgi, apache and fhttpd main functions ! * and code has been removed, and switched into the sapi directory. ! */ #ifdef THREAD_SAFE extern flex_globals *yy_init_tls(void); *************** *** 1205,1223 **** extern int _php3_load_module(php3_module_entry *module_entry, void *handle); - /****************************************************************************** - /* sapi process start - /* - /* In the windows world this function will be called from dllmain on - /* process startup. Only one thread per process can call dllmain with - /* the flag to initialize the dll as process startup, so we 'should' be - /* safe here. - /* - /* In unix, whenever threads are done for it, we will have to make sure - /* that it is handled the same way. /* ! /* this is the same for process_end. ! /*****************************************************************************/ PHPAPI int _php3_sapi_process_start(php3_module_entry *module_info){ #ifdef THREAD_SAFE php3_globals_struct *php3_globals; --- 1204,1222 ---- extern int _php3_load_module(php3_module_entry *module_entry, void *handle); /* ! * sapi process start ! * ! * In the windows world this function will be called from dllmain on ! * process startup. Only one thread per process can call dllmain with ! * the flag to initialize the dll as process startup, so we 'should' be ! * safe here. ! * ! * In unix, whenever threads are done for it, we will have to make sure ! * that it is handled the same way. ! * ! * this is the same for process_end. ! */ PHPAPI int _php3_sapi_process_start(php3_module_entry *module_info){ #ifdef THREAD_SAFE php3_globals_struct *php3_globals; *************** *** 1291,1303 **** return 1; } - /****************************************************************************** - /* sapi thread start /* ! /* we have to be sure that thread_start and thread_end functions are ! /* reentrant and thread safe. Multiple threads can be in here at the ! /* same time. ! /*****************************************************************************/ PHPAPI int _php3_sapi_thread_start(php3_module_entry *module_info){ #ifdef THREAD_SAFE php3_globals_struct *php3_globals; --- 1290,1303 ---- return 1; } /* ! * sapi thread start ! * ! * we have to be sure that thread_start and thread_end functions are ! * reentrant and thread safe. Multiple threads can be in here at the ! * same time. ! * ! */ PHPAPI int _php3_sapi_thread_start(php3_module_entry *module_info){ #ifdef THREAD_SAFE php3_globals_struct *php3_globals; *************** *** 1346,1354 **** return 1; } ! /****************************************************************************** ! /* sapi thread end ! /*****************************************************************************/ PHPAPI int _php3_sapi_thread_end(){ #ifdef THREAD_SAFE php3_globals_struct *php3_globals; --- 1346,1354 ---- return 1; } ! /* ! * sapi thread end ! */ PHPAPI int _php3_sapi_thread_end(){ #ifdef THREAD_SAFE php3_globals_struct *php3_globals; *************** *** 1370,1378 **** return 1; } ! /****************************************************************************** ! /* sapi process end ! /*****************************************************************************/ PHPAPI int _php3_sapi_process_end(){ #ifdef THREAD_SAFE php3_globals_struct *php3_globals; --- 1370,1378 ---- return 1; } ! /* ! * sapi process end ! */ PHPAPI int _php3_sapi_process_end(){ #ifdef THREAD_SAFE php3_globals_struct *php3_globals; *************** *** 1398,1423 **** } ! /****************************************************************************** ! /* sapi main. called each request from the server interface file (sapi) ! /*****************************************************************************/ PHPAPI int php3_sapi_main(struct sapi_request_info *sapi_info, php3_module_entry *module_info) { int c; FILE *in = NULL; - #ifdef THREAD_SAFE flex_globals *php_gbl; php3_globals_struct *php3_globals; - #if defined(CRASH_DETECTION) - debug_log("%d:main entered\n",GetCurrentThreadId()); - if(!TlsIndex)debug_log("%d:Invalid TLSIndex!\n",GetCurrentThreadId()); #endif ! if(TlsIndex){PHP3_TLS_GET(TlsIndex,php3_globals);}else{return FAILURE;} ! #if defined(CRASH_DETECTION) debug_log("%d:main tls initialized\n",GetCurrentThreadId()); ! #endif if (!php3_globals) { /* uninitialized thread, initialize now */ _php3_sapi_thread_start(module_info); --- 1398,1432 ---- } ! /* ! * sapi main. called each request from the server interface file (sapi) ! */ PHPAPI int php3_sapi_main(struct sapi_request_info *sapi_info, php3_module_entry *module_info) { int c; FILE *in = NULL; #ifdef THREAD_SAFE flex_globals *php_gbl; php3_globals_struct *php3_globals; #endif ! ! ! #ifdef THREAD_SAFE ! # if defined(CRASH_DETECTION) ! debug_log("%d:main entered\n",GetCurrentThreadId()); ! if (!TlsIndex) { ! debug_log("%d:Invalid TLSIndex!\n",GetCurrentThreadId()); ! } ! # endif ! if(TlsIndex) { ! PHP3_TLS_GET(TlsIndex,php3_globals); ! } else { ! return FAILURE; ! } ! # if defined(CRASH_DETECTION) debug_log("%d:main tls initialized\n",GetCurrentThreadId()); ! # endif if (!php3_globals) { /* uninitialized thread, initialize now */ _php3_sapi_thread_start(module_info); *************** *** 1451,1457 **** return FAILURE; } - php3_treat_headers(_INLINE_TLS_VOID); #if defined(CRASH_DETECTION) --- 1460,1465 ---- Index: php31/main/makeparser.bat diff -c php31/main/makeparser.bat:2.0 php31/main/makeparser.bat:2.1 *** php31/main/makeparser.bat:2.0 Fri Jul 3 09:17:22 1998 --- php31/main/makeparser.bat Sun Sep 6 17:34:36 1998 *************** *** 1,6 **** bison -p php -v -d language-parser.y flex -Pphp -olanguage-scanner.c -i language-scanner.l ! bison -p cfg -v -d configuration-parser.y ! flex -Pcfg -oconfiguration-scanner.c -i configuration-scanner.l ! copy configuration-parser.tab.h configuration-parser.h copy language-parser.tab.h language-parser.h --- 1,6 ---- bison -p php -v -d language-parser.y flex -Pphp -olanguage-scanner.c -i language-scanner.l ! bison -p ini -v -d ini-parser.y ! flex -Pini -oini-scanner.c -i ini-scanner.l ! copy ini-parser.tab.h ini-parser.h copy language-parser.tab.h language-parser.h Index: php31/main/mtparser.bat diff -c php31/main/mtparser.bat:2.1 php31/main/mtparser.bat:2.2 *** php31/main/mtparser.bat:2.1 Fri Jul 24 10:04:10 1998 --- php31/main/mtparser.bat Sun Sep 6 17:34:36 1998 *************** *** 1,6 **** bison -S bison.simple -p php -v -d language-parser.y plex -x -m %3 -Pphp -olanguage-scanner.c -i language-scanner.l ! bison -p cfg -v -d configuration-parser.y ! flex -Pcfg -oconfiguration-scanner.c -i configuration-scanner.l ! copy configuration-parser.tab.h configuration-parser.h copy language-parser.tab.h language-parser.h --- 1,6 ---- bison -S bison.simple -p php -v -d language-parser.y plex -x -m %3 -Pphp -olanguage-scanner.c -i language-scanner.l ! bison -p ini -v -d ini-parser.y ! flex -Pini -oini-scanner.c -i ini-scanner.l ! copy ini-parser.tab.h ini-parser.h copy language-parser.tab.h language-parser.h Index: php31/main/php.h diff -c php31/main/php.h:2.11 php31/main/php.h:2.12 *** php31/main/php.h:2.11 Thu Aug 27 16:55:45 1998 --- php31/main/php.h Sun Sep 6 17:34:37 1998 *************** *** 28,34 **** +----------------------------------------------------------------------+ */ ! /* $Id: php.h,v 2.11 1998/08/27 20:55:45 shane Exp $ */ #ifndef _PHP_H #define _PHP_H --- 28,34 ---- +----------------------------------------------------------------------+ */ ! /* $Id: php.h,v 2.12 1998/09/06 21:34:37 zeev Exp $ */ #ifndef _PHP_H #define _PHP_H *************** *** 231,241 **** #define INTERNAL_FUNCTION_PARAMETERS HashTable *ht, pval *return_value, HashTable *list, HashTable *plist #define INTERNAL_FUNCTION_PARAM_PASSTHRU ht, return_value, list, plist ! #define PHP_FUNCTION(name) void name(INTERNAL_FUNCTION_PARAMETERS) ! #define PHP3_FUNCTION(name) PHP_FUNCTION(php3_##name) ! #define PHP_FE(php_name, name, arg_types) { #php_name, name, arg_types }, ! #define PHP3_FE(name, arg_types) { #name, php3_##name, arg_types }, typedef union { long lval; /* long value */ --- 231,245 ---- #define INTERNAL_FUNCTION_PARAMETERS HashTable *ht, pval *return_value, HashTable *list, HashTable *plist #define INTERNAL_FUNCTION_PARAM_PASSTHRU ht, return_value, list, plist ! ! #define PHP_NAMED_FUNCTION(name) void name(INTERNAL_FUNCTION_PARAMETERS) ! #define PHP_FUNCTION(name) PHP_NAMED_FUNCTION(php3_##name) ! #define PHP_NAMED_FE(php_name, name, arg_types) { #php_name, name, arg_types }, ! #define PHP_FE(name, arg_types) PHP_NAMED_FE(#name, php3_##name, arg_types) ! ! #define BEGIN_FUNCTION_ENTRIES(struct_name) function_entry struct_name[] = { ! #define END_FUNCTION_ENTRIES() { NULL, NULL, NULL}, }; typedef union { long lval; /* long value */ *************** *** 365,371 **** #endif #ifdef THREAD_SAFE ! /*FIXME this is a quick fix to get this var in external modules */ PHPAPI int _php3_le_index_ptr(void); #else extern PHPAPI int le_index_ptr; /* list entry type for index pointers */ --- 369,375 ---- #endif #ifdef THREAD_SAFE ! /* FIXME this is a quick fix to get this var in external modules */ PHPAPI int _php3_le_index_ptr(void); #else extern PHPAPI int le_index_ptr; /* list entry type for index pointers */ *************** *** 379,385 **** extern void php3_log_err(char *log_message); extern int Debug(char *format,...); extern int phpparse(void); ! extern int cfgparse(void); extern void reset_scanner(void); extern void html_putc(char c); extern int end_current_file_execution(INLINE_TLS_VOID); --- 383,389 ---- extern void php3_log_err(char *log_message); extern int Debug(char *format,...); extern int phpparse(void); ! extern int iniparse(void); extern void reset_scanner(void); extern void html_putc(char c); extern int end_current_file_execution(INLINE_TLS_VOID); *************** *** 406,414 **** /* configuration abstraction layer */ ! extern PHPAPI int cfg_get_long(char *varname, long *result); ! extern PHPAPI int cfg_get_double(char *varname, double *result); ! extern PHPAPI int cfg_get_string(char *varname, char **result); #ifndef THREAD_SAFE extern PHPAPI php3_ini_structure *php3_ini; #endif --- 410,419 ---- /* configuration abstraction layer */ ! extern PHPAPI int ini_get_long(char *varname, long *result); ! extern PHPAPI int ini_get_double(char *varname, double *result); ! extern PHPAPI int ini_get_string(char *varname, char **result); ! #ifndef THREAD_SAFE extern PHPAPI php3_ini_structure *php3_ini; #endif Index: php31/main/phpsapi_core.dsp diff -c php31/main/phpsapi_core.dsp:2.11 php31/main/phpsapi_core.dsp:2.12 *** php31/main/phpsapi_core.dsp:2.11 Tue Sep 1 17:44:15 1998 --- php31/main/phpsapi_core.dsp Sun Sep 6 17:34:37 1998 *************** *** 101,115 **** # End Source File # Begin Source File ! SOURCE=".\configuration-parser.tab.c" # End Source File # Begin Source File ! SOURCE=".\configuration-parser.tab.h" # End Source File # Begin Source File ! SOURCE=".\configuration-scanner.c" # End Source File # Begin Source File --- 101,115 ---- # End Source File # Begin Source File ! SOURCE=".\ini-parser.tab.c" # End Source File # Begin Source File ! SOURCE=".\ini-parser.tab.h" # End Source File # Begin Source File ! SOURCE=".\ini-scanner.c" # End Source File # Begin Source File -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#847) next »