summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTeodor Sigaev2003-08-15 13:44:35 +0000
committerTeodor Sigaev2003-08-15 13:44:35 +0000
commitd3fe721a40b153c59595926afea9ec6475fdd000 (patch)
treef1f8d7e63dac7afbe9a8cee9342f74faff58defa
parent432ca9116bc51f6cfe6e88be33dbe6cb078cda9d (diff)
Eliminate function start_parse_fh and macro YY_INPUT
-rw-r--r--contrib/tsearch/parser.h1
-rw-r--r--contrib/tsearch/parser.l39
-rw-r--r--contrib/tsearch2/wordparser/parser.h1
-rw-r--r--contrib/tsearch2/wordparser/parser.l38
4 files changed, 0 insertions, 79 deletions
diff --git a/contrib/tsearch/parser.h b/contrib/tsearch/parser.h
index f3aa0b8c06b..469b9c043ff 100644
--- a/contrib/tsearch/parser.h
+++ b/contrib/tsearch/parser.h
@@ -5,7 +5,6 @@ char *token;
int tokenlen;
int tsearch_yylex(void);
void start_parse_str(char *, int);
-void start_parse_fh(FILE *, int);
void end_parse(void);
#endif
diff --git a/contrib/tsearch/parser.l b/contrib/tsearch/parser.l
index 4323bda7ef0..2bf3dcba076 100644
--- a/contrib/tsearch/parser.l
+++ b/contrib/tsearch/parser.l
@@ -22,36 +22,6 @@ char *s = NULL; /* to return WHOLE hyphenated-word */
YY_BUFFER_STATE buf = NULL; /* buffer to parse; it need for parse from string */
-int lrlimit = -1; /* for limiting read from filehandle ( -1 - unlimited read ) */
-int bytestoread = 0; /* for limiting read from filehandle */
-
-/* redefine macro for read limited length */
-#define YY_INPUT(buf,result,max_size) \
- if ( yy_current_buffer->yy_is_interactive ) { \
- int c = '*', n; \
- for ( n = 0; n < max_size && \
- (c = getc( tsearch_yyin )) != EOF && c != '\n'; ++n ) \
- buf[n] = (char) c; \
- if ( c == '\n' ) \
- buf[n++] = (char) c; \
- if ( c == EOF && ferror( tsearch_yyin ) ) \
- YY_FATAL_ERROR( "input in flex scanner failed" ); \
- result = n; \
- } else { \
- if ( lrlimit == 0 ) \
- result=YY_NULL; \
- else { \
- if ( lrlimit>0 ) { \
- bytestoread = ( lrlimit > max_size ) ? max_size : lrlimit; \
- lrlimit -= bytestoread; \
- } else \
- bytestoread = max_size; \
- if ( ((result = fread( buf, 1, bytestoread, tsearch_yyin )) == 0) \
- && ferror( tsearch_yyin ) ) \
- YY_FATAL_ERROR( "input in flex scanner failed" ); \
- } \
- }
-
%}
%option 8bit
@@ -327,13 +297,4 @@ void start_parse_str(char* str, int limit) {
BEGIN INITIAL;
}
-/* start parse from filehandle */
-void start_parse_fh( FILE* fh, int limit ) {
- if (buf) end_parse();
- lrlimit = ( limit ) ? limit : -1;
- buf = tsearch_yy_create_buffer( fh, YY_BUF_SIZE );
- tsearch_yy_switch_to_buffer( buf );
- BEGIN INITIAL;
-}
-
diff --git a/contrib/tsearch2/wordparser/parser.h b/contrib/tsearch2/wordparser/parser.h
index 55cf0051ed0..1ce18741977 100644
--- a/contrib/tsearch2/wordparser/parser.h
+++ b/contrib/tsearch2/wordparser/parser.h
@@ -5,7 +5,6 @@ char *token;
int tokenlen;
int tsearch2_yylex(void);
void start_parse_str(char *, int);
-void start_parse_fh(FILE *, int);
void end_parse(void);
#endif
diff --git a/contrib/tsearch2/wordparser/parser.l b/contrib/tsearch2/wordparser/parser.l
index 49824f55259..23cfedaa201 100644
--- a/contrib/tsearch2/wordparser/parser.l
+++ b/contrib/tsearch2/wordparser/parser.l
@@ -23,36 +23,6 @@ char *s = NULL; /* to return WHOLE hyphenated-word */
YY_BUFFER_STATE buf = NULL; /* buffer to parse; it need for parse from string */
-int lrlimit = -1; /* for limiting read from filehandle ( -1 - unlimited read ) */
-int bytestoread = 0; /* for limiting read from filehandle */
-
-/* redefine macro for read limited length */
-#define YY_INPUT(buf,result,max_size) \
- if ( yy_current_buffer->yy_is_interactive ) { \
- int c = '*', n; \
- for ( n = 0; n < max_size && \
- (c = getc( tsearch2_yyin )) != EOF && c != '\n'; ++n ) \
- buf[n] = (char) c; \
- if ( c == '\n' ) \
- buf[n++] = (char) c; \
- if ( c == EOF && ferror( tsearch2_yyin ) ) \
- YY_FATAL_ERROR( "input in flex scanner failed" ); \
- result = n; \
- } else { \
- if ( lrlimit == 0 ) \
- result=YY_NULL; \
- else { \
- if ( lrlimit>0 ) { \
- bytestoread = ( lrlimit > max_size ) ? max_size : lrlimit; \
- lrlimit -= bytestoread; \
- } else \
- bytestoread = max_size; \
- if ( ((result = fread( buf, 1, bytestoread, tsearch2_yyin )) == 0) \
- && ferror( tsearch2_yyin ) ) \
- YY_FATAL_ERROR( "input in flex scanner failed" ); \
- } \
- }
-
%}
%option 8bit
@@ -334,13 +304,5 @@ void start_parse_str(char* str, int limit) {
BEGIN INITIAL;
}
-/* start parse from filehandle */
-void start_parse_fh( FILE* fh, int limit ) {
- if (buf) end_parse();
- lrlimit = ( limit ) ? limit : -1;
- buf = tsearch2_yy_create_buffer( fh, YY_BUF_SIZE );
- tsearch2_yy_switch_to_buffer( buf );
- BEGIN INITIAL;
-}