]> granicus.if.org Git - php/commitdiff
MFZE1
authorZeev Suraski <zeev@php.net>
Wed, 19 Sep 2001 22:34:11 +0000 (22:34 +0000)
committerZeev Suraski <zeev@php.net>
Wed, 19 Sep 2001 22:34:11 +0000 (22:34 +0000)
Zend/flex.skl
Zend/zend.c
Zend/zend_globals.h
Zend/zend_ini_scanner.l
Zend/zend_language_scanner.l

index 5d6ec00467110ad8cdb782a4b799fb16603afde6..a01decf394c536d2307225cb073474147a6a9d4f 100644 (file)
@@ -98,7 +98,7 @@ class istream;
 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
 
 /* Special action meaning "start processing a new file". */
-#define YY_NEW_FILE yyrestart( yyin TSRMLS_CC )
+#define YY_NEW_FILE yyrestart( SCNG(yy_in) TSRMLS_CC )
 
 #define YY_END_OF_BUFFER_CHAR 0
 
@@ -276,14 +276,14 @@ static void yy_flex_free YY_PROTO(( void * ));
 #define yy_set_interactive(is_interactive) \
        { \
        if ( ! yy_current_buffer ) \
-               yy_current_buffer = yy_create_buffer( SCNG(yyin), YY_BUF_SIZE TSRMLS_CC ); \
+               yy_current_buffer = yy_create_buffer( SCNG(yy_in), YY_BUF_SIZE TSRMLS_CC ); \
        yy_current_buffer->yy_is_interactive = is_interactive; \
        }
 
 #define yy_set_bol(at_bol) \
        { \
        if ( ! yy_current_buffer ) \
-               yy_current_buffer = yy_create_buffer( SCNG(yyin), YY_BUF_SIZE TSRMLS_CC ); \
+               yy_current_buffer = yy_create_buffer( SCNG(yy_in), YY_BUF_SIZE TSRMLS_CC ); \
        yy_current_buffer->yy_at_bol = at_bol; \
        }
 
@@ -296,7 +296,10 @@ static void yy_flex_free YY_PROTO(( void * ));
 #define yytext SCNG(yy_text)
 #undef yytext_ptr
 #define yytext_ptr SCNG(yy_text)
-
+#undef yyin
+#define yyin SCNG(yy_in)
+#undef yyout
+#define yyout SCNG(yy_out)
 
 %- Standard (non-C++) definition
 static yy_state_type yy_get_previous_state YY_PROTO(( TSRMLS_D ));
@@ -324,6 +327,8 @@ static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
 #undef yyleng
 #undef yytext
 #undef yytext_ptr
+#undef yyin
+#undef yyout
 
 %% data tables for the DFA and the user's section 1 definitions go here
 
@@ -410,7 +415,7 @@ YY_MALLOC_DECL
 /* This used to be an fputs(), but since the string might contain NUL's,
  * we now use fwrite().
  */
-#define ECHO (void) fwrite( yytext, yyleng, 1, SCNG(yyout) )
+#define ECHO (void) fwrite( yytext, yyleng, 1, SCNG(yy_out) )
 %+ C++ definition
 #define ECHO LexerOutput( yytext, yyleng )
 %*
@@ -495,23 +500,23 @@ YY_DECL
                if ( ! yy_start )
                        yy_start = 1;   /* first start state */
 
-               if ( ! SCNG(yyin) )
+               if ( ! SCNG(yy_in) )
 %-
-                       SCNG(yyin) = stdin;
+                       SCNG(yy_in) = stdin;
 %+
-                       SCNG(yyin) = &cin;
+                       SCNG(yy_in) = &cin;
 %*
 
-               if ( ! SCNG(yyout) )
+               if ( ! SCNG(yy_out) )
 %-
-                       SCNG(yyout) = stdout;
+                       SCNG(yy_out) = stdout;
 %+
-                       SCNG(yyout) = &cout;
+                       SCNG(yy_out) = &cout;
 %*
 
                if ( ! yy_current_buffer )
                        yy_current_buffer =
-                               yy_create_buffer( SCNG(yyin), YY_BUF_SIZE TSRMLS_CC );
+                               yy_create_buffer( SCNG(yy_in), YY_BUF_SIZE TSRMLS_CC );
 
                yy_load_buffer_state(TSRMLS_C);
                }
@@ -566,7 +571,7 @@ do_action:  /* This label is used only to access EOF actions. */
                         * back-up) that will match for the new input source.
                         */
                        yy_n_chars = yy_current_buffer->yy_n_chars;
-                       yy_current_buffer->yy_input_file = yyin;
+                       yy_current_buffer->yy_input_file = SCNG(yy_in);
                        yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
                        }
 
@@ -677,8 +682,8 @@ do_action:  /* This label is used only to access EOF actions. */
 %+
 yyFlexLexer::yyFlexLexer( istream* arg_yyin, ostream* arg_yyout )
        {
-       SCNG(yyin) = arg_yyin;
-       SCNG(yyout) = arg_yyout;
+       SCNG(yy_in) = arg_yyin;
+       SCNG(yy_out) = arg_yyout;
        yy_c_buf_p = 0;
        yy_init = 1;
        yy_start = 0;
@@ -719,37 +724,37 @@ void yyFlexLexer::switch_streams( istream* new_in, ostream* new_out )
                }
 
        if ( new_out )
-               SCNG(yyout) = new_out;
+               SCNG(yy_out) = new_out;
        }
 
 int yyFlexLexer::LexerInput( char* buf, int max_size )
        {
-               if ( SCNG(yyin)->eof() || SCNG(yyin)->fail() )
+               if ( SCNG(yy_in)->eof() || SCNG(yy_in)->fail() )
                        return 0;
 
                if (yy_current_buffer->yy_is_interactive) {
-                       SCNG(yyin)->get( buf[0] );
+                       SCNG(yy_in)->get( buf[0] );
 
-                       if ( SCNG(yyin)->eof() )
+                       if ( SCNG(yy_in)->eof() )
                                return 0;
 
-                       if ( SCNG(yyin)->bad() )
+                       if ( SCNG(yy_in)->bad() )
                                return -1;
 
                        return 1;
                } else {
-                       (void) SCNG(yyin)->read( buf, max_size );
+                       (void) SCNG(yy_in)->read( buf, max_size );
 
-                       if ( SCNG(yyin)->bad() )
+                       if ( SCNG(yy_in)->bad() )
                                return -1;
                        else
-                               return SCNG(yyin)->gcount();
+                               return SCNG(yy_in)->gcount();
                }
        }
 
 void yyFlexLexer::LexerOutput( const char* buf, int size )
        {
-       (void) SCNG(yyout)->write( buf, size );
+       (void) SCNG(yy_out)->write( buf, size );
        }
 %*
 
@@ -871,7 +876,7 @@ int yyFlexLexer::yy_get_next_buffer(TSRMLS_D)
                if ( number_to_move == YY_MORE_ADJ )
                        {
                        ret_val = EOB_ACT_END_OF_FILE;
-                       yyrestart( SCNG(yyin) TSRMLS_CC );
+                       yyrestart( SCNG(yy_in) TSRMLS_CC );
                        }
 
                else
@@ -1045,7 +1050,7 @@ int yyFlexLexer::yyinput(TSRMLS_D)
                                         */
 
                                        /* Reset buffer status. */
-                                       yyrestart( SCNG(yyin) TSRMLS_CC );
+                                       yyrestart( SCNG(yy_in) TSRMLS_CC );
 
                                        /* fall through */
 
@@ -1092,7 +1097,7 @@ void yyFlexLexer::yyrestart( istream* input_file TSRMLS_DC )
 %*
        {
        if ( ! yy_current_buffer )
-               yy_current_buffer = yy_create_buffer( SCNG(yyin), YY_BUF_SIZE TSRMLS_CC );
+               yy_current_buffer = yy_create_buffer( SCNG(yy_in), YY_BUF_SIZE TSRMLS_CC );
 
        yy_init_buffer( yy_current_buffer, input_file TSRMLS_CC );
        yy_load_buffer_state(TSRMLS_C);
@@ -1151,7 +1156,7 @@ void yyFlexLexer::yy_load_buffer_state()
        {
        yy_n_chars = yy_current_buffer->yy_n_chars;
        yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
-       SCNG(yyin) = yy_current_buffer->yy_input_file;
+       SCNG(yy_in) = yy_current_buffer->yy_input_file;
        yy_hold_char = *yy_c_buf_p;
        }
 
index 56e50c082dd447755a226ff08216f5a59c04228d..aed08ed5fdca1fd0296663d28658345be9cf2814 100644 (file)
@@ -369,6 +369,8 @@ static void scanner_globals_ctor(zend_scanner_globals *scanner_globals_p TSRMLS_
        scanner_globals_p->init = 1;
        scanner_globals_p->start = 0;
        scanner_globals_p->current_buffer = NULL;
+       scanner_globals_p->yy_in = NULL;
+       scanner_globals_p->yy_out = NULL;
 }
 
 
index dcd15bd3e34ff838d6c40472db30421ea96b53e0..a6151b866b647fe56295415b1d64f2949a6874c9 100644 (file)
@@ -222,8 +222,8 @@ struct _zend_alloc_globals {
 
 
 struct _zend_scanner_globals {
-       FILE *yyin;
-       FILE *yyout;
+       FILE *yy_in;
+       FILE *yy_out;
        int yy_leng;
        char *yy_text;
        struct yy_buffer_state *current_buffer;
index 1f8f0f4b7bf2916630c6dbcd98bc2b3aef76ec53..636b37600cc0cb791d1d499c0e6091383e650fd8 100644 (file)
@@ -20,6 +20,8 @@
 #define yyleng SCNG(yy_leng)
 #define yytext SCNG(yy_text)
 #define yytext_ptr SCNG(yy_text)
+#define yyin SCNG(yy_in)
+#define yyout SCNG(yy_out)
 
 #include "zend.h"
 #include "zend_globals.h"
index 9010f8fab961abe4f979ad08312f0feabeabb05f..7b24957478196008e51a99996f0c1470b2d9b961 100644 (file)
@@ -22,6 +22,8 @@
 #define yyleng SCNG(yy_leng)
 #define yytext SCNG(yy_text)
 #define yytext_ptr SCNG(yy_text)
+#define yyin SCNG(yy_in)
+#define yyout SCNG(yy_out)
 
 %}
 
@@ -135,7 +137,7 @@ END_EXTERN_C()
 static inline void save_lexical_state(zend_lex_state *lex_state TSRMLS_DC)
 {
        memcpy(&lex_state->buffer_state, &YY_CURRENT_BUFFER, sizeof(YY_BUFFER_STATE));
-       lex_state->in = yyin;
+       lex_state->in = SCNG(yy_in);
        lex_state->state = YYSTATE;
        lex_state->filename = zend_get_compiled_filename(TSRMLS_C);
        lex_state->lineno = CG(zend_lineno);
@@ -153,7 +155,7 @@ static inline void restore_lexical_state(zend_lex_state *lex_state TSRMLS_DC)
        }
                
        yy_delete_buffer(original_buffer_state TSRMLS_CC);
-       yyin = lex_state->in;
+       SCNG(yy_in) = lex_state->in;
        BEGIN(lex_state->state);
        CG(zend_lineno) = lex_state->lineno;
        zend_restore_compiled_filename(lex_state->filename TSRMLS_CC);
@@ -228,8 +230,8 @@ ZEND_API int open_file_for_scanning(zend_file_handle *file_handle TSRMLS_DC)
                zend_llist_add_element(&CG(open_files), file_handle);
        }
        /* Reset the scanner for scanning the new file */
-       yyin = file_handle->handle.fp;
-       yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE TSRMLS_CC) TSRMLS_CC);
+       SCNG(yy_in) = file_handle->handle.fp;
+       yy_switch_to_buffer(yy_create_buffer(SCNG(yy_in), YY_BUF_SIZE TSRMLS_CC) TSRMLS_CC);
        BEGIN(INITIAL);
 
        if (file_handle->opened_path) {
@@ -343,7 +345,7 @@ static inline int prepare_string_for_scanning(zval *str, char *filename TSRMLS_D
 
        str->value.str.val[str->value.str.len+1]=0;
 
-       yyin=NULL;
+       SCNG(yy_in)=NULL;
        yy_scan_buffer(str->value.str.val, str->value.str.len+2 TSRMLS_CC);
 
        zend_set_compiled_filename(filename TSRMLS_CC);