Browse Source

Updated flex code snips for 64bit fix

Greg 14 years ago
parent
commit
3e5997bfcf
1 changed files with 22 additions and 0 deletions
  1. 22 0
      gmsrc/src/gm/flex.skl

+ 22 - 0
gmsrc/src/gm/flex.skl

@@ -378,6 +378,7 @@ YY_MALLOC_DECL
 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
  * is returned in "result".
  * is returned in "result".
  */
  */
+/* 
 #ifndef YY_INPUT
 #ifndef YY_INPUT
 #define YY_INPUT(buf,result,max_size) \
 #define YY_INPUT(buf,result,max_size) \
 %% fread()/read() definition of YY_INPUT goes here unless we're doing C++
 %% fread()/read() definition of YY_INPUT goes here unless we're doing C++
@@ -386,6 +387,27 @@ YY_MALLOC_DECL
       YY_FATAL_ERROR( "input in flex scanner failed" );
       YY_FATAL_ERROR( "input in flex scanner failed" );
 %*
 %*
 #endif
 #endif
+*/
+// _GD_ added cast for 64bit build
+#ifndef YY_INPUT
+#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( yyin )) != EOF && c != '\n'; ++n ) \
+			buf[n] = (char) c; \
+		if ( c == '\n' ) \
+			buf[n++] = (char) c; \
+		if ( c == EOF && ferror( yyin ) ) \
+			YY_FATAL_ERROR( "input in flex scanner failed" ); \
+		result = n; \
+		} \
+	else if ( ((result = (int)fread( buf, 1, max_size, yyin )) == 0) \
+		  && ferror( yyin ) ) \
+		YY_FATAL_ERROR( "input in flex scanner failed" );
+#endif
+
 
 
 /* No semi-colon after return; correct usage is to write "yyterminate();" -
 /* No semi-colon after return; correct usage is to write "yyterminate();" -
  * we don't want an extra ';' after the "return" because that will cause
  * we don't want an extra ';' after the "return" because that will cause