]> granicus.if.org Git - flex/commitdiff
Support for read()/fread()
authorVern Paxson <vern@ee.lbl.gov>
Sat, 20 Nov 1993 15:05:34 +0000 (15:05 +0000)
committerVern Paxson <vern@ee.lbl.gov>
Sat, 20 Nov 1993 15:05:34 +0000 (15:05 +0000)
section 1 definitions precede default macro definitions

flex.skl

index fae24cebb07bb4192f4ae07221a9f527d7d38d38..98d848089a5191046d8c884d9a9b7aa2705b371b 100644 (file)
--- a/flex.skl
+++ b/flex.skl
@@ -60,6 +60,7 @@
 #define YY_PROTO(proto) ()
 #endif
 
+%% section 1 definitions go here
 
 /* Amount of stuff to slurp up with each read. */
 #ifndef YY_READ_BUF_SIZE
  */
 #ifndef YY_INPUT
 #define YY_INPUT(buf,result,max_size) \
-%- Standard (non-C++) definition
-       if ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \
+%% fread()/read() definition of YY_INPUT goes here unless we're doing C++
 %+ C++ definition
        if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
 %*
-               YY_FATAL_ERROR( "read() in flex scanner failed" );
+               YY_FATAL_ERROR( "input in flex scanner failed" );
 #endif
 
 /* No semi-colon after return; correct usage is to write "yyterminate();" -
  * we don't want an extra ';' after the "return" because that will cause
  * some compilers to complain about unreachable statements.
  */
+#ifndef yyterminate
 #define yyterminate() return YY_NULL
+#endif
+
 #define YY_NULL 0
 
 /* Report a fatal error. */
@@ -285,8 +288,6 @@ static int input YY_PROTO(( void ));
 #endif
 %*
 
-%% section 1 definitions go here
-
 %- Standard (non-C++) definition
 static yy_state_type yy_get_previous_state YY_PROTO(( void ));
 static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));