CVS update: php31/main

From: Date: Fri, 21 Aug 1998 02:12:56 +0000
Subject: CVS update: php31/main
Groups: php.dev 
Request: Send a blank email to php-dev+get-383@lists.php.net to get a copy of this message
Date: Thursday August 20, 1998 @ 22:12 Author: zeev Update of /repository/php31/main In directory asf:/tmp/cvs-serv19368/main Modified Files: control_structures.h control_structures_inline.h language-parser.y language-scanner.l main.c token_cache.c token_cache.h Log Message: phpchar optimization + improvement Index: php31/main/control_structures.h diff -c php31/main/control_structures.h:2.2 php31/main/control_structures.h:2.3 *** php31/main/control_structures.h:2.2 Thu Aug 20 21:21:38 1998 --- php31/main/control_structures.h Thu Aug 20 22:12:55 1998 *************** *** 29,35 **** */ ! /* $Id: control_structures.h,v 2.2 1998/08/21 01:21:38 zeev Exp $ */ #ifndef _CONTROL_STRUCTURES_H --- 29,35 ---- */ ! /* $Id: control_structures.h,v 2.3 1998/08/21 02:12:55 zeev Exp $ */ #ifndef _CONTROL_STRUCTURES_H *************** *** 63,68 **** --- 63,69 ---- extern TokenCacheManager token_cache_manager; extern Stack css, input_source_stack, for_stack, function_state_stack, switch_stack; extern Stack phpchar_stack, variable_unassign_stack; + extern int *active_phpchar; extern int ExecuteFlag, Execute; extern int php3_display_source; extern int php3_preprocess; Index: php31/main/control_structures_inline.h diff -c php31/main/control_structures_inline.h:2.5 php31/main/control_structures_inline.h:2.6 *** php31/main/control_structures_inline.h:2.5 Thu Aug 20 19:33:53 1998 --- php31/main/control_structures_inline.h Thu Aug 20 22:12:55 1998 *************** *** 29,35 **** */ ! /* $Id: control_structures_inline.h,v 2.5 1998/08/20 23:33:53 zeev Exp $ */ #ifdef THREAD_SAFE #include "tls.h" --- 29,35 ---- */ ! /* $Id: control_structures_inline.h,v 2.6 1998/08/21 02:12:55 zeev Exp $ */ #ifdef THREAD_SAFE #include "tls.h" *************** *** 49,58 **** extern inline int cs_global_variable(pval *varname INLINE_TLS); extern inline int cs_static_variable(pval *varname, pval *value INLINE_TLS); extern inline void cs_start_while(pval *while_token, pval *expr INLINE_TLS); ! extern inline void cs_end_while(pval *while_token, int *yychar INLINE_TLS); extern inline void cs_start_do_while(pval *do_token INLINE_TLS); extern inline void cs_force_eval_do_while( INLINE_TLS_VOID); ! extern inline void cs_end_do_while(pval *do_token, pval *expr, int *yychar INLINE_TLS); extern inline void cs_start_if (pval *expr INLINE_TLS); extern inline void cs_end_if ( INLINE_TLS_VOID); extern inline int cs_break_continue(pval *expr, int op_type INLINE_TLS); --- 49,58 ---- extern inline int cs_global_variable(pval *varname INLINE_TLS); extern inline int cs_static_variable(pval *varname, pval *value INLINE_TLS); extern inline void cs_start_while(pval *while_token, pval *expr INLINE_TLS); ! extern inline void cs_end_while(pval *while_token INLINE_TLS); extern inline void cs_start_do_while(pval *do_token INLINE_TLS); extern inline void cs_force_eval_do_while( INLINE_TLS_VOID); ! extern inline void cs_end_do_while(pval *do_token, pval *expr INLINE_TLS); extern inline void cs_start_if (pval *expr INLINE_TLS); extern inline void cs_end_if ( INLINE_TLS_VOID); extern inline int cs_break_continue(pval *expr, int op_type INLINE_TLS); *************** *** 68,74 **** extern inline void for_pre_expr2(pval *for_token INLINE_TLS); extern inline void for_pre_expr3(pval *for_token, pval *expr2 INLINE_TLS); extern inline void for_pre_statement(pval *for_token, pval *expr2, pval *expr3 INLINE_TLS); ! extern inline void for_post_statement(pval *for_token, pval *first_semicolon, pval *second_semicolon, pval *close_parentheses, int *yychar INLINE_TLS); extern inline void cs_return(pval *expr INLINE_TLS); extern inline void cs_start_include(pval *include_token INLINE_TLS); extern inline void cs_end_include(pval *include_token, pval *expr INLINE_TLS); --- 68,74 ---- extern inline void for_pre_expr2(pval *for_token INLINE_TLS); extern inline void for_pre_expr3(pval *for_token, pval *expr2 INLINE_TLS); extern inline void for_pre_statement(pval *for_token, pval *expr2, pval *expr3 INLINE_TLS); ! extern inline void for_post_statement(pval *for_token, pval *first_semicolon, pval *second_semicolon, pval *close_parentheses INLINE_TLS); extern inline void cs_return(pval *expr INLINE_TLS); extern inline void cs_start_include(pval *include_token INLINE_TLS); extern inline void cs_end_include(pval *include_token, pval *expr INLINE_TLS); *************** *** 81,88 **** extern inline void cs_questionmark_op_pre_expr2(pval *truth_value INLINE_TLS); extern inline void cs_questionmark_op_post_expr2(pval *result, pval *truth_value, pval *expr1, pval *expr2 INLINE_TLS); extern inline void cs_functioncall_pre_variable_passing(pval *function_name, pval *class_ptr, unsigned char free_function_name INLINE_TLS); ! extern inline void cs_functioncall_post_variable_passing(pval *function_name, int *yychar INLINE_TLS); ! extern inline void cs_functioncall_end(pval *result, pval *function_name, pval *close_parentheses, int *yychar, unsigned char free_function_name INLINE_TLS); extern inline void cs_switch_start(pval *switch_token, pval *expr INLINE_TLS); extern inline void cs_switch_case_pre(pval *case_expr INLINE_TLS); extern inline void cs_switch_case_post( INLINE_TLS_VOID); --- 81,88 ---- extern inline void cs_questionmark_op_pre_expr2(pval *truth_value INLINE_TLS); extern inline void cs_questionmark_op_post_expr2(pval *result, pval *truth_value, pval *expr1, pval *expr2 INLINE_TLS); extern inline void cs_functioncall_pre_variable_passing(pval *function_name, pval *class_ptr, unsigned char free_function_name INLINE_TLS); ! extern inline void cs_functioncall_post_variable_passing(pval *function_name INLINE_TLS); ! extern inline void cs_functioncall_end(pval *result, pval *function_name, pval *close_parentheses, unsigned char free_function_name INLINE_TLS); extern inline void cs_switch_start(pval *switch_token, pval *expr INLINE_TLS); extern inline void cs_switch_case_pre(pval *case_expr INLINE_TLS); extern inline void cs_switch_case_post( INLINE_TLS_VOID); *************** *** 228,234 **** } } ! inline void cs_end_while(pval *while_token,int *yychar INLINE_TLS) { #if (_DEBUG_ & CONTROL_DEBUG) fprintf(stderr, "end of while, execute=%d, changecount=%d, changetype=%d\n", Execute, GLOBAL(function_state).loop_change_level, GLOBAL(function_state).loop_change_level); --- 228,234 ---- } } ! inline void cs_end_while(pval *while_token INLINE_TLS) { #if (_DEBUG_ & CONTROL_DEBUG) fprintf(stderr, "end of while, execute=%d, changecount=%d, changetype=%d\n", Execute, GLOBAL(function_state).loop_change_level, GLOBAL(function_state).loop_change_level); *************** *** 236,247 **** if (GLOBAL(Execute)) { tc_set_token(&GLOBAL(token_cache_manager), while_token->offset, CONTINUED_WHILE); ! seek_token(&GLOBAL(token_cache_manager), while_token->offset, yychar); } else { if ((GLOBAL(function_state).loop_change_type != DO_NOTHING) && (GLOBAL(function_state).loop_change_level == GLOBAL(function_state).loop_nest_level)) { if (GLOBAL(function_state).loop_change_type == DO_CONTINUE) { tc_set_token(&GLOBAL(token_cache_manager), while_token->offset, CONTINUED_WHILE); ! seek_token(&GLOBAL(token_cache_manager), while_token->offset, yychar); } GLOBAL(function_state).loop_change_type = DO_NOTHING; GLOBAL(function_state).loop_change_level = 0; --- 236,247 ---- if (GLOBAL(Execute)) { tc_set_token(&GLOBAL(token_cache_manager), while_token->offset, CONTINUED_WHILE); ! seek_token(&GLOBAL(token_cache_manager), while_token->offset); } else { if ((GLOBAL(function_state).loop_change_type != DO_NOTHING) && (GLOBAL(function_state).loop_change_level == GLOBAL(function_state).loop_nest_level)) { if (GLOBAL(function_state).loop_change_type == DO_CONTINUE) { tc_set_token(&GLOBAL(token_cache_manager), while_token->offset, CONTINUED_WHILE); ! seek_token(&GLOBAL(token_cache_manager), while_token->offset); } GLOBAL(function_state).loop_change_type = DO_NOTHING; GLOBAL(function_state).loop_change_level = 0; *************** *** 277,283 **** } ! inline void cs_end_do_while(pval *do_token, pval *expr, int *yychar INLINE_TLS) { #if (_DEBUG_ & CONTROL_DEBUG) fprintf(stderr, "end of while, execute=%d, changecount=%d, changetype=%d\n", Execute, GLOBAL(function_state).loop_change_level, GLOBAL(function_state).loop_change_level); --- 277,283 ---- } ! inline void cs_end_do_while(pval *do_token, pval *expr INLINE_TLS) { #if (_DEBUG_ & CONTROL_DEBUG) fprintf(stderr, "end of while, execute=%d, changecount=%d, changetype=%d\n", Execute, GLOBAL(function_state).loop_change_level, GLOBAL(function_state).loop_change_level); *************** *** 286,292 **** if (GLOBAL(Execute) && yystype_true(expr)) { yystype_destructor(expr _INLINE_TLS); tc_set_token(&GLOBAL(token_cache_manager), do_token->offset, CONTINUED_DOWHILE); ! seek_token(&GLOBAL(token_cache_manager), do_token->offset, yychar); } else { if (GLOBAL(Execute)) { yystype_destructor(expr _INLINE_TLS); --- 286,292 ---- if (GLOBAL(Execute) && yystype_true(expr)) { yystype_destructor(expr _INLINE_TLS); tc_set_token(&GLOBAL(token_cache_manager), do_token->offset, CONTINUED_DOWHILE); ! seek_token(&GLOBAL(token_cache_manager), do_token->offset); } else { if (GLOBAL(Execute)) { yystype_destructor(expr _INLINE_TLS); *************** *** 606,612 **** } } ! inline void for_post_statement(pval *for_token, pval *first_semicolon, pval *second_semicolon, pval *close_parentheses, int *yychar INLINE_TLS) { if (stack_int_top(&GLOBAL(for_stack)) != (long) for_token->offset) { /* first iteration */ stack_push(&GLOBAL(for_stack), &for_token->offset, sizeof(int)); --- 606,612 ---- } } ! inline void for_post_statement(pval *for_token, pval *first_semicolon, pval *second_semicolon, pval *close_parentheses INLINE_TLS) { if (stack_int_top(&GLOBAL(for_stack)) != (long) for_token->offset) { /* first iteration */ stack_push(&GLOBAL(for_stack), &for_token->offset, sizeof(int)); *************** *** 617,628 **** } if (GLOBAL(Execute)) { tc_set_token(&GLOBAL(token_cache_manager), for_token->offset, CONTINUED_FOR); ! seek_token(&GLOBAL(token_cache_manager), for_token->offset, yychar); } else { if ((GLOBAL(function_state).loop_change_type != DO_NOTHING) && (GLOBAL(function_state).loop_change_level == GLOBAL(function_state).loop_nest_level)) { if (GLOBAL(function_state).loop_change_type == DO_CONTINUE) { tc_set_token(&GLOBAL(token_cache_manager), for_token->offset, CONTINUED_FOR); ! seek_token(&GLOBAL(token_cache_manager), for_token->offset, yychar); } else { if (stack_int_top(&GLOBAL(for_stack)) == (long) for_token->offset) { #if (_DEBUG_ & CONTROL_DEBUG) --- 617,628 ---- } if (GLOBAL(Execute)) { tc_set_token(&GLOBAL(token_cache_manager), for_token->offset, CONTINUED_FOR); ! seek_token(&GLOBAL(token_cache_manager), for_token->offset); } else { if ((GLOBAL(function_state).loop_change_type != DO_NOTHING) && (GLOBAL(function_state).loop_change_level == GLOBAL(function_state).loop_nest_level)) { if (GLOBAL(function_state).loop_change_type == DO_CONTINUE) { tc_set_token(&GLOBAL(token_cache_manager), for_token->offset, CONTINUED_FOR); ! seek_token(&GLOBAL(token_cache_manager), for_token->offset); } else { if (stack_int_top(&GLOBAL(for_stack)) == (long) for_token->offset) { #if (_DEBUG_ & CONTROL_DEBUG) *************** *** 897,903 **** } ! inline void cs_functioncall_post_variable_passing(pval *function_name, int *yychar INLINE_TLS) { if (function_name->cs_data.function_call_type) { stack_push(&GLOBAL(css), &GLOBAL(ExecuteFlag), sizeof(int)); --- 897,903 ---- } ! inline void cs_functioncall_post_variable_passing(pval *function_name INLINE_TLS) { if (function_name->cs_data.function_call_type) { stack_push(&GLOBAL(css), &GLOBAL(ExecuteFlag), sizeof(int)); *************** *** 911,917 **** switch (GLOBAL(function_state).function_type) { case IS_USER_FUNCTION: GLOBAL(active_symbol_table) = GLOBAL(function_state).symbol_table; ! seek_token(&GLOBAL(token_cache_manager), function_name->offset, yychar); break; case IS_INTERNAL_FUNCTION: GLOBAL(function_state).handler(GLOBAL(function_state).symbol_table,&GLOBAL(return_value),&GLOBAL(list),&GLOBAL(plist)); --- 911,917 ---- switch (GLOBAL(function_state).function_type) { case IS_USER_FUNCTION: GLOBAL(active_symbol_table) = GLOBAL(function_state).symbol_table; ! seek_token(&GLOBAL(token_cache_manager), function_name->offset); break; case IS_INTERNAL_FUNCTION: GLOBAL(function_state).handler(GLOBAL(function_state).symbol_table,&GLOBAL(return_value),&GLOBAL(list),&GLOBAL(plist)); *************** *** 923,929 **** } ! inline void cs_functioncall_end(pval *result, pval *function_name, pval *close_parentheses, int *yychar, unsigned char free_function_name INLINE_TLS) { if (function_name->cs_data.function_call_type) { FunctionState *fs_ptr; --- 923,929 ---- } ! inline void cs_functioncall_end(pval *result, pval *function_name, pval *close_parentheses, unsigned char free_function_name INLINE_TLS) { if (function_name->cs_data.function_call_type) { FunctionState *fs_ptr; *************** *** 953,959 **** /* jump back */ if (GLOBAL(function_state).function_type == IS_USER_FUNCTION) { ! seek_token(&GLOBAL(token_cache_manager), close_parentheses->offset + 1, yychar); } /* get previous function state */ --- 953,959 ---- /* jump back */ if (GLOBAL(function_state).function_type == IS_USER_FUNCTION) { ! seek_token(&GLOBAL(token_cache_manager), close_parentheses->offset + 1); } /* get previous function state */ Index: php31/main/language-parser.y diff -c php31/main/language-parser.y:2.3 php31/main/language-parser.y:2.4 *** php31/main/language-parser.y:2.3 Thu Aug 20 21:21:38 1998 --- php31/main/language-parser.y Thu Aug 20 22:12:55 1998 *************** *** 31,37 **** */ ! /* $Id: language-parser.y,v 2.3 1998/08/21 01:21:38 zeev Exp $ */ /* --- 31,37 ---- */ ! /* $Id: language-parser.y,v 2.4 1998/08/21 02:12:55 zeev Exp $ */ /* *************** *** 268,280 **** %% /* Rules */ statement_list: statement_list statement ! | /* empty */ { ! active_phpchar = &yychar; ! ! stack_push(&GLOBAL(phpchar_stack), (void *) &active_phpchar, sizeof(int *)); ! } ; --- 268,292 ---- %% /* Rules */ + script: + { + stack_push(&GLOBAL(phpchar_stack), (void *) &active_phpchar, sizeof(int *)); + active_phpchar = &yychar; + } + statement_list + { + int **tmp; + + stack_top(&GLOBAL(phpchar_stack), (void **) &tmp); + active_phpchar = *tmp; + stack_del_top(&GLOBAL(phpchar_stack)); + } + + ; + statement_list: statement_list statement ! | /* empty */ ; *************** *** 282,294 **** '{' statement_list '}' | IF '(' expr ')' { cs_start_if (&$3 _INLINE_TLS); } statement elseif_list else_single { cs_end_if ( _INLINE_TLS_VOID); } | IF '(' expr ')' ':' { cs_start_if (&$3 _INLINE_TLS); } statement_list new_elseif_list new_else_single { cs_end_if ( _INLINE_TLS_VOID); } ENDIF ';' ! | WHILE '(' expr ')' { cs_start_while(&$1, &$3 _INLINE_TLS); } while_statement { cs_end_while(&$1,&yychar _INLINE_TLS); } while_iterations ! | DO { cs_start_do_while(&$1 _INLINE_TLS); } statement WHILE { cs_force_eval_do_while( _INLINE_TLS_VOID); } '(' expr ')' ';'{ cs_end_do_while(&$1,&$7,&yychar _INLINE_TLS); } do_while_iterations | FOR { for_pre_expr1(&$1 _INLINE_TLS); } '(' for_expr { if (GLOBAL(Execute)) yystype_destructor(&$4 _INLINE_TLS); for_pre_expr2(&$1 _INLINE_TLS); } ';' for_expr { for_pre_expr3(&$1,&$7 _INLINE_TLS); } ';' for_expr { for_pre_statement(&$1,&$7,&$10 _INLINE_TLS); } ! ')' for_statement { for_post_statement(&$1,&$6,&$9,&$12,&yychar _INLINE_TLS); } for_iterations | SWITCH '(' expr ')' { cs_switch_start(&$1,&$3 _INLINE_TLS); } switch_case_list { cs_switch_end(&$3 _INLINE_TLS); } | BREAK ';' { DO_OR_DIE(cs_break_continue(NULL,DO_BREAK _INLINE_TLS)) } | BREAK expr ';' { DO_OR_DIE(cs_break_continue(&$2,DO_BREAK _INLINE_TLS)) } --- 294,306 ---- '{' statement_list '}' | IF '(' expr ')' { cs_start_if (&$3 _INLINE_TLS); } statement elseif_list else_single { cs_end_if ( _INLINE_TLS_VOID); } | IF '(' expr ')' ':' { cs_start_if (&$3 _INLINE_TLS); } statement_list new_elseif_list new_else_single { cs_end_if ( _INLINE_TLS_VOID); } ENDIF ';' ! | WHILE '(' expr ')' { cs_start_while(&$1, &$3 _INLINE_TLS); } while_statement { cs_end_while(&$1 _INLINE_TLS); } while_iterations ! | DO { cs_start_do_while(&$1 _INLINE_TLS); } statement WHILE { cs_force_eval_do_while( _INLINE_TLS_VOID); } '(' expr ')' ';'{ cs_end_do_while(&$1,&$7 _INLINE_TLS); } do_while_iterations | FOR { for_pre_expr1(&$1 _INLINE_TLS); } '(' for_expr { if (GLOBAL(Execute)) yystype_destructor(&$4 _INLINE_TLS); for_pre_expr2(&$1 _INLINE_TLS); } ';' for_expr { for_pre_expr3(&$1,&$7 _INLINE_TLS); } ';' for_expr { for_pre_statement(&$1,&$7,&$10 _INLINE_TLS); } ! ')' for_statement { for_post_statement(&$1,&$6,&$9,&$12 _INLINE_TLS); } for_iterations | SWITCH '(' expr ')' { cs_switch_start(&$1,&$3 _INLINE_TLS); } switch_case_list { cs_switch_end(&$3 _INLINE_TLS); } | BREAK ';' { DO_OR_DIE(cs_break_continue(NULL,DO_BREAK _INLINE_TLS)) } | BREAK expr ';' { DO_OR_DIE(cs_break_continue(&$2,DO_BREAK _INLINE_TLS)) } *************** *** 337,349 **** while_iterations: /* empty */ ! | while_iterations CONTINUED_WHILE '(' expr ')' { cs_start_while(&$2, &$4 _INLINE_TLS); } while_statement { cs_end_while(&$2,&yychar _INLINE_TLS); } ; do_while_iterations: ! | do_while_iterations CONTINUED_DOWHILE { cs_start_do_while(&$2 _INLINE_TLS); } statement WHILE { cs_force_eval_do_while( _INLINE_TLS_VOID); } '(' expr ')' ';'{ cs_end_do_while(&$2,&$8,&yychar _INLINE_TLS); } ; --- 349,361 ---- while_iterations: /* empty */ ! | while_iterations CONTINUED_WHILE '(' expr ')' { cs_start_while(&$2, &$4 _INLINE_TLS); } while_statement { cs_end_while(&$2 _INLINE_TLS); } ; do_while_iterations: ! | do_while_iterations CONTINUED_DOWHILE { cs_start_do_while(&$2 _INLINE_TLS); } statement WHILE { cs_force_eval_do_while( _INLINE_TLS_VOID); } '(' expr ')' ';'{ cs_end_do_while(&$2,&$8 _INLINE_TLS); } ; *************** *** 353,359 **** '(' for_expr { if (GLOBAL(Execute)) yystype_destructor(&$5 _INLINE_TLS); for_pre_expr2(&$2 _INLINE_TLS); } ';' for_expr { for_pre_expr3(&$2,&$8 _INLINE_TLS); } ';' for_expr { for_pre_statement(&$2,&$8,&$11 _INLINE_TLS); } ! ')' for_statement { for_post_statement(&$2,&$7,&$10,&$13,&yychar _INLINE_TLS); } ; --- 365,371 ---- '(' for_expr { if (GLOBAL(Execute)) yystype_destructor(&$5 _INLINE_TLS); for_pre_expr2(&$2 _INLINE_TLS); } ';' for_expr { for_pre_expr3(&$2,&$8 _INLINE_TLS); } ';' for_expr { for_pre_statement(&$2,&$8,&$11 _INLINE_TLS); } ! ')' for_statement { for_post_statement(&$2,&$7,&$10,&$13 _INLINE_TLS); } ; *************** *** 534,550 **** expr ':' { cs_questionmark_op_pre_expr2(&$1 _INLINE_TLS); } expr { cs_questionmark_op_post_expr2(&$$,&$1,&$4,&$7 _INLINE_TLS); } | var { cs_functioncall_pre_variable_passing(&$1,NULL,1 _INLINE_TLS); } ! '(' function_call_parameter_list ')' { cs_functioncall_post_variable_passing(&$1,&yychar _INLINE_TLS); } ! possible_function_call { cs_functioncall_end(&$$,&$1,&$5,&yychar,1 _INLINE_TLS);} | internal_functions_in_yacc | '$' unambiguous_class_name PHP_CLASS_OPERATOR var { cs_functioncall_pre_variable_passing(&$4,&$2,1 _INLINE_TLS); } ! '(' function_call_parameter_list ')' { cs_functioncall_post_variable_passing(&$4,&yychar _INLINE_TLS); } ! possible_function_call { cs_functioncall_end(&$$,&$4,&$8,&yychar,1 _INLINE_TLS); } | NEW var { assign_new_object(&$$,&$2,1 _INLINE_TLS); } | NEW var { assign_new_object(&$$,&$2,0 _INLINE_TLS); } '(' { if (!GLOBAL(shutdown_requested) && GLOBAL(Execute)) { pval object_pointer; object_pointer.value.varptr.yystype = &$3; cs_functioncall_pre_variable_passing(&$2, &object_pointer, 1 _INLINE_TLS); } } ! function_call_parameter_list ')' { cs_functioncall_post_variable_passing(&$2, &yychar _INLINE_TLS); } ! possible_function_call { cs_functioncall_end(&$$, &$2, &$7, &yychar, 1 _INLINE_TLS); $$ = $3; } | INT_CAST expr { if (GLOBAL(Execute)) { convert_to_long(&$2); $$ = $2; } } | DOUBLE_CAST expr { if (GLOBAL(Execute)) { convert_to_double(&$2); $$ = $2; } } | STRING_CAST expr { if (GLOBAL(Execute)) { convert_to_string(&$2); $$ = $2; } } --- 546,562 ---- expr ':' { cs_questionmark_op_pre_expr2(&$1 _INLINE_TLS); } expr { cs_questionmark_op_post_expr2(&$$,&$1,&$4,&$7 _INLINE_TLS); } | var { cs_functioncall_pre_variable_passing(&$1,NULL,1 _INLINE_TLS); } ! '(' function_call_parameter_list ')' { cs_functioncall_post_variable_passing(&$1 _INLINE_TLS); } ! possible_function_call { cs_functioncall_end(&$$,&$1,&$5,1 _INLINE_TLS);} | internal_functions_in_yacc | '$' unambiguous_class_name PHP_CLASS_OPERATOR var { cs_functioncall_pre_variable_passing(&$4,&$2,1 _INLINE_TLS); } ! '(' function_call_parameter_list ')' { cs_functioncall_post_variable_passing(&$4 _INLINE_TLS); } ! possible_function_call { cs_functioncall_end(&$$,&$4,&$8,1 _INLINE_TLS); } | NEW var { assign_new_object(&$$,&$2,1 _INLINE_TLS); } | NEW var { assign_new_object(&$$,&$2,0 _INLINE_TLS); } '(' { if (!GLOBAL(shutdown_requested) && GLOBAL(Execute)) { pval object_pointer; object_pointer.value.varptr.yystype = &$3; cs_functioncall_pre_variable_passing(&$2, &object_pointer, 1 _INLINE_TLS); } } ! function_call_parameter_list ')' { cs_functioncall_post_variable_passing(&$2 _INLINE_TLS); } ! possible_function_call { cs_functioncall_end(&$$, &$2, &$7, 1 _INLINE_TLS); $$ = $3; } | INT_CAST expr { if (GLOBAL(Execute)) { convert_to_long(&$2); $$ = $2; } } | DOUBLE_CAST expr { if (GLOBAL(Execute)) { convert_to_double(&$2); $$ = $2; } } | STRING_CAST expr { if (GLOBAL(Execute)) { convert_to_string(&$2); $$ = $2; } } *************** *** 728,737 **** %% ! inline void clear_lookahead(int *yychar) { ! if (yychar) { ! *yychar=YYEMPTY; } } --- 740,751 ---- %% ! inline void clear_lookahead() { ! TLS_VARS; ! ! if (GLOBAL(active_phpchar)) { ! *GLOBAL(active_phpchar)=YYEMPTY; } } *************** *** 747,752 **** --- 761,767 ---- pval class_ptr; int original_shutdown_requested; TLS_VARS; + original_shutdown_requested=GLOBAL(shutdown_requested); /* save the location to go back to */ *************** *** 776,787 **** for (i=0; i<param_count; i++) { _php3_hash_next_index_pointer_insert(GLOBAL(function_state).function_symbol_table, params[i]); } ! cs_functioncall_post_variable_passing(function_name, NULL _INLINE_TLS); phpparse(); if (GLOBAL(shutdown_requested)) { /* we died during this function call */ return FAILURE; } GLOBAL(shutdown_requested) = original_shutdown_requested; ! cs_functioncall_end(retval,function_name,&return_offset,NULL,0 _INLINE_TLS); return SUCCESS; } --- 791,802 ---- for (i=0; i<param_count; i++) { _php3_hash_next_index_pointer_insert(GLOBAL(function_state).function_symbol_table, params[i]); } ! cs_functioncall_post_variable_passing(function_name _INLINE_TLS); phpparse(); if (GLOBAL(shutdown_requested)) { /* we died during this function call */ return FAILURE; } GLOBAL(shutdown_requested) = original_shutdown_requested; ! cs_functioncall_end(retval,function_name,&return_offset,0 _INLINE_TLS); return SUCCESS; } Index: php31/main/language-scanner.l diff -c php31/main/language-scanner.l:2.2 php31/main/language-scanner.l:2.3 *** php31/main/language-scanner.l:2.2 Thu Aug 13 18:48:59 1998 --- php31/main/language-scanner.l Thu Aug 20 22:12:55 1998 *************** *** 307,313 **** switch(lex_state->type) { case LEX_STATE_CONDITIONAL_INCLUDE: /* switching out of include() */ ! seek_token(&GLOBAL(token_cache_manager),lex_state->return_offset, NULL); #if WIN32|WINNT if(yyin->_tmpfname=="url"){ closesocket(yyin->_file); --- 307,313 ---- switch(lex_state->type) { case LEX_STATE_CONDITIONAL_INCLUDE: /* switching out of include() */ ! seek_token(&GLOBAL(token_cache_manager),lex_state->return_offset); #if WIN32|WINNT if(yyin->_tmpfname=="url"){ closesocket(yyin->_file); *************** *** 325,331 **** return 1; break; case LEX_STATE_EVAL: /* switching out of eval() */ ! seek_token(&GLOBAL(token_cache_manager),lex_state->return_offset, NULL); BEGIN(lex_state->state); yy_switch_to_buffer(lex_state->buffer_state); STR_FREE(lex_state->eval_string); --- 325,331 ---- return 1; break; case LEX_STATE_EVAL: /* switching out of eval() */ ! seek_token(&GLOBAL(token_cache_manager),lex_state->return_offset); BEGIN(lex_state->state); yy_switch_to_buffer(lex_state->buffer_state); STR_FREE(lex_state->eval_string); *************** *** 1140,1146 **** switch(lex_state->type) { case LEX_STATE_CONDITIONAL_INCLUDE: /* switching out of include() */ ! seek_token(&GLOBAL(token_cache_manager),lex_state->return_offset, NULL); #if WIN32|WINNT if(yyin->_tmpfname=="url"){ closesocket(yyin->_file); --- 1140,1146 ---- switch(lex_state->type) { case LEX_STATE_CONDITIONAL_INCLUDE: /* switching out of include() */ ! seek_token(&GLOBAL(token_cache_manager),lex_state->return_offset); #if WIN32|WINNT if(yyin->_tmpfname=="url"){ closesocket(yyin->_file); *************** *** 1157,1163 **** return DONE_EVAL; break; case LEX_STATE_EVAL: /* switching out of eval() */ ! seek_token(&GLOBAL(token_cache_manager),lex_state->return_offset, NULL); BEGIN(lex_state->state); yy_switch_to_buffer(lex_state->buffer_state); STR_FREE(lex_state->eval_string); --- 1157,1163 ---- return DONE_EVAL; break; case LEX_STATE_EVAL: /* switching out of eval() */ ! seek_token(&GLOBAL(token_cache_manager),lex_state->return_offset); BEGIN(lex_state->state); yy_switch_to_buffer(lex_state->buffer_state); STR_FREE(lex_state->eval_string); Index: php31/main/main.c diff -c php31/main/main.c:2.10 php31/main/main.c:2.11 *** php31/main/main.c:2.10 Thu Aug 20 21:21:38 1998 --- php31/main/main.c Thu Aug 20 22:12:55 1998 *************** *** 29,35 **** +----------------------------------------------------------------------+ */ ! /* $Id: main.c,v 2.10 1998/08/21 01:21:38 zeev Exp $ */ /* #define CRASH_DETECTION */ --- 29,35 ---- +----------------------------------------------------------------------+ */ ! /* $Id: main.c,v 2.11 1998/08/21 02:12:55 zeev Exp $ */ /* #define CRASH_DETECTION */ *************** *** 610,615 **** --- 610,616 ---- php3_printf("Unable to initialize phpchar stack.\n"); return FAILURE; } + active_phpchar = NULL; GLOBAL(initialized) |= INIT_PHPCHAR_STACK; if (stack_init(&GLOBAL(input_source_stack)) == FAILURE) { Index: php31/main/token_cache.c diff -c php31/main/token_cache.c:2.1 php31/main/token_cache.c:2.2 *** php31/main/token_cache.c:2.1 Thu Aug 13 18:49:00 1998 --- php31/main/token_cache.c Thu Aug 20 22:12:56 1998 *************** *** 29,35 **** */ ! /* $Id: token_cache.c,v 2.1 1998/08/13 22:49:00 shane Exp $ */ #ifdef THREAD_SAFE #include "tls.h" --- 29,35 ---- */ ! /* $Id: token_cache.c,v 2.2 1998/08/21 02:12:56 zeev Exp $ */ #ifdef THREAD_SAFE #include "tls.h" *************** *** 175,186 **** } ! int seek_token(TokenCacheManager *tcm, int token_number, int *yychar) { int t_offset, tc_offset; TLS_VARS; ! clear_lookahead(yychar); tc_offset = token_number / MAX_TOKENS_PER_CACHE; if (tc_offset >= tcm->initialized) { --- 175,186 ---- } ! int seek_token(TokenCacheManager *tcm, int token_number) { int t_offset, tc_offset; TLS_VARS; ! clear_lookahead(); tc_offset = token_number / MAX_TOKENS_PER_CACHE; if (tc_offset >= tcm->initialized) { Index: php31/main/token_cache.h diff -c php31/main/token_cache.h:2.1 php31/main/token_cache.h:2.2 *** php31/main/token_cache.h:2.1 Thu Aug 13 18:49:01 1998 --- php31/main/token_cache.h Thu Aug 20 22:12:56 1998 *************** *** 29,35 **** */ ! /* $Id: token_cache.h,v 2.1 1998/08/13 22:49:01 shane Exp $ */ #ifndef _TOKEN_CACHE --- 29,35 ---- */ ! /* $Id: token_cache.h,v 2.2 1998/08/21 02:12:56 zeev Exp $ */ #ifndef _TOKEN_CACHE *************** *** 66,72 **** #ifndef THREAD_SAFE extern int read_next_token(TokenCacheManager *tcm, Token **token, pval *phplval); #endif ! extern int seek_token(TokenCacheManager *tcm, int offset, int *yychar); extern int tc_switch(TokenCacheManager *tcm, int start, int end, int middle); extern inline int tc_set_token(TokenCacheManager *tcm, int offset, int type); extern inline int tc_get_token(TokenCacheManager *tcm, int offset); --- 66,72 ---- #ifndef THREAD_SAFE extern int read_next_token(TokenCacheManager *tcm, Token **token, pval *phplval); #endif ! extern int seek_token(TokenCacheManager *tcm, int offset); extern int tc_switch(TokenCacheManager *tcm, int start, int end, int middle); extern inline int tc_set_token(TokenCacheManager *tcm, int offset, int type); extern inline int tc_get_token(TokenCacheManager *tcm, int offset); *************** *** 78,84 **** extern int tcm_new(TokenCacheManager *tcm); extern void tcm_save(TokenCacheManager *tcm); extern int tcm_load(TokenCacheManager *tcm, FILE *input); ! extern void clear_lookahead(int *yychar); extern inline int last_token_suggests_variable_reference(void); --- 78,84 ---- extern int tcm_new(TokenCacheManager *tcm); extern void tcm_save(TokenCacheManager *tcm); extern int tcm_load(TokenCacheManager *tcm, FILE *input); ! extern void clear_lookahead(); extern inline int last_token_suggests_variable_reference(void); -- 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 (#383) next »