1
0
mirror of https://github.com/php/php-src.git synced 2026-03-28 10:12:18 +01:00

Implement fast scanning in the multithreaded environment

This commit is contained in:
Zeev Suraski
2001-08-01 02:36:05 +00:00
parent 0ccc2fd9ef
commit f93bfc47df
2 changed files with 17 additions and 24 deletions

View File

@@ -693,34 +693,29 @@ void yyFlexLexer::switch_streams( istream* new_in, ostream* new_out )
yyout = new_out;
}
#ifdef YY_INTERACTIVE
int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
#else
int yyFlexLexer::LexerInput( char* buf, int max_size )
#endif
{
if ( yyin->eof() || yyin->fail() )
return 0;
if ( yyin->eof() || yyin->fail() )
return 0;
#ifdef YY_INTERACTIVE
yyin->get( buf[0] );
if (yy_current_buffer->yy_is_interactive) {
yyin->get( buf[0] );
if ( yyin->eof() )
return 0;
if ( yyin->eof() )
return 0;
if ( yyin->bad() )
return -1;
if ( yyin->bad() )
return -1;
return 1;
return 1;
} else {
(void) yyin->read( buf, max_size );
#else
(void) yyin->read( buf, max_size );
if ( yyin->bad() )
return -1;
else
return yyin->gcount();
#endif
if ( yyin->bad() )
return -1;
else
return yyin->gcount();
}
}
void yyFlexLexer::LexerOutput( const char* buf, int size )
@@ -1213,7 +1208,7 @@ void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, istream* file )
#endif
#endif
%+
b->yy_is_interactive = 0;
b->yy_is_interactive = (file == (istream *) &cin) ? 1 : 0;
%*
}

View File

@@ -78,8 +78,6 @@
#define YY_DECL int lex_scan(zval *zendlval TSRMLS_DC)
#endif
#define YY_INTERACTIVE
#define ECHO { ZEND_WRITE( yytext, yyleng ); }
#ifdef ZTS