From fe4f535715d9b4df6852676c8fa7089dc81041a9 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Thu, 11 Jan 2001 16:03:27 +0000
Subject: [PATCH] *** empty log message ***

---
 Parser/Gmsh.tab.cpp | 12 +++---
 Parser/Gmsh.y       |  6 +--
 Parser/Gmsh.yy.cpp  | 92 ++++++++++++++++++++++++++++++---------------
 3 files changed, 71 insertions(+), 39 deletions(-)

diff --git a/Parser/Gmsh.tab.cpp b/Parser/Gmsh.tab.cpp
index 0c3573c4e5..7fb463b036 100644
--- a/Parser/Gmsh.tab.cpp
+++ b/Parser/Gmsh.tab.cpp
@@ -170,7 +170,7 @@
 #line 1 "Gmsh.y"
  
 
-// $Id: Gmsh.tab.cpp,v 1.60 2001-01-11 16:00:28 colignon Exp $
+// $Id: Gmsh.tab.cpp,v 1.61 2001-01-11 16:03:26 geuzaine Exp $
 
 #include <stdarg.h>
 
@@ -2500,7 +2500,7 @@ static const short yycheck[] = {    23,
    166,   167,    -1,    -1,    -1,    -1,    -1,   173,    -1,   175
 };
 /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
-#line 3 "/usr/share/bison.simple"
+#line 3 "/usr/local/share/bison.simple"
 
 /* Skeleton output parser for bison,
    Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
@@ -2693,7 +2693,7 @@ __yy_memcpy (char *to, char *from, int count)
 #endif
 #endif
 
-#line 196 "/usr/share/bison.simple"
+#line 196 "/usr/local/share/bison.simple"
 
 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
    into yyparse.  The argument should have type void *.
@@ -4595,12 +4595,12 @@ case 203:
       }
       else if(!strcmp(yyvsp[-2].c, "Print")){
 
-	//if(!CTX.interactive) CreateFile($2, CTX.print.format);
+	if(!CTX.interactive) CreateFile(yyvsp[-1].c, CTX.print.format);
 
       }
       else if(!strcmp(yyvsp[-2].c, "Save")){
 
-	//CreateFile($2, CTX.mesh.format);
+	CreateFile(yyvsp[-1].c, CTX.mesh.format);
 
       }
       else if(!strcmp(yyvsp[-2].c, "Merge")){
@@ -5871,7 +5871,7 @@ case 342:
     break;}
 }
    /* the action file gets copied in in place of this dollarsign */
-#line 498 "/usr/share/bison.simple"
+#line 498 "/usr/local/share/bison.simple"
 
   yyvsp -= yylen;
   yyssp -= yylen;
diff --git a/Parser/Gmsh.y b/Parser/Gmsh.y
index 8820bedddd..0c36b4315c 100644
--- a/Parser/Gmsh.y
+++ b/Parser/Gmsh.y
@@ -1,6 +1,6 @@
 %{ 
 
-// $Id: Gmsh.y,v 1.53 2001-01-11 16:00:28 colignon Exp $
+// $Id: Gmsh.y,v 1.54 2001-01-11 16:03:27 geuzaine Exp $
 
 #include <stdarg.h>
 
@@ -1630,12 +1630,12 @@ Command :
       }
       else if(!strcmp($1, "Print")){
 
-	//if(!CTX.interactive) CreateFile($2, CTX.print.format);
+	if(!CTX.interactive) CreateFile($2, CTX.print.format);
 
       }
       else if(!strcmp($1, "Save")){
 
-	//CreateFile($2, CTX.mesh.format);
+	CreateFile($2, CTX.mesh.format);
 
       }
       else if(!strcmp($1, "Merge")){
diff --git a/Parser/Gmsh.yy.cpp b/Parser/Gmsh.yy.cpp
index e6d918e4cc..d5f136c57f 100644
--- a/Parser/Gmsh.yy.cpp
+++ b/Parser/Gmsh.yy.cpp
@@ -2,7 +2,7 @@
 /* A lexical scanner generated by flex */
 
 /* Scanner skeleton version:
- * $Header: /cvsroot/gmsh/Parser/Gmsh.yy.cpp,v 1.60 2001-01-11 16:00:28 colignon Exp $
+ * $Header: /cvsroot/gmsh/Parser/Gmsh.yy.cpp,v 1.61 2001-01-11 16:03:27 geuzaine Exp $
  */
 
 #define FLEX_SCANNER
@@ -127,6 +127,7 @@ extern FILE *yyin, *yyout;
 		{ \
 		/* Undo effects of setting up yytext. */ \
 		*yy_cp = yy_hold_char; \
+		YY_RESTORE_YY_MORE_OFFSET \
 		yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
 		YY_DO_BEFORE_ACTION; /* set up yytext again */ \
 		} \
@@ -236,7 +237,7 @@ void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
 #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
 
 YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
-YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *str ));
+YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
 YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
 
 static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
@@ -970,12 +971,13 @@ static char *yy_last_accepting_cpos;
 #define REJECT reject_used_but_not_detected
 #define yymore() yymore_used_but_not_detected
 #define YY_MORE_ADJ 0
+#define YY_RESTORE_YY_MORE_OFFSET
 char *yytext;
 #line 1 "Gmsh.l"
 #define INITIAL 0
 #line 2 "Gmsh.l"
 
-// $Id: Gmsh.yy.cpp,v 1.60 2001-01-11 16:00:28 colignon Exp $
+// $Id: Gmsh.yy.cpp,v 1.61 2001-01-11 16:03:27 geuzaine Exp $
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -1018,7 +1020,7 @@ void   skipline(void);
 	     && ferror( yyin ) )					\
      YY_FATAL_ERROR( "input in flex scanner failed" );
 
-#line 1022 "Gmsh.yy.cpp"
+#line 1024 "Gmsh.yy.cpp"
 
 /* Macros after this point can all be overridden by user definitions in
  * section 1.
@@ -1040,6 +1042,10 @@ static void yyunput YY_PROTO(( int c, char *buf_ptr ));
 static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
 #endif
 
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen YY_PROTO(( yyconst char * ));
+#endif
+
 #ifndef YY_NO_INPUT
 #ifdef __cplusplus
 static int yyinput YY_PROTO(( void ));
@@ -1168,7 +1174,7 @@ YY_DECL
 #line 63 "Gmsh.l"
 
 
-#line 1172 "Gmsh.yy.cpp"
+#line 1178 "Gmsh.yy.cpp"
 
 	if ( yy_init )
 		{
@@ -2142,7 +2148,7 @@ YY_RULE_SETUP
 #line 273 "Gmsh.l"
 ECHO;
 	YY_BREAK
-#line 2146 "Gmsh.yy.cpp"
+#line 2152 "Gmsh.yy.cpp"
 case YY_STATE_EOF(INITIAL):
 	yyterminate();
 
@@ -2153,6 +2159,7 @@ case YY_STATE_EOF(INITIAL):
 
 		/* Undo the effects of YY_DO_BEFORE_ACTION. */
 		*yy_cp = yy_hold_char;
+		YY_RESTORE_YY_MORE_OFFSET
 
 		if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
 			{
@@ -2298,7 +2305,7 @@ static int yy_get_next_buffer()
 		{ /* Don't try to fill the buffer, so this is an EOF. */
 		if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
 			{
-			/* We matched a singled characater, the EOB, so
+			/* We matched a single character, the EOB, so
 			 * treat this as a final EOF.
 			 */
 			return EOB_ACT_END_OF_FILE;
@@ -2325,7 +2332,7 @@ static int yy_get_next_buffer()
 		/* don't do the read, it's not guaranteed to return an EOF,
 		 * just force an EOF
 		 */
-		yy_n_chars = 0;
+		yy_current_buffer->yy_n_chars = yy_n_chars = 0;
 
 	else
 		{
@@ -2380,6 +2387,8 @@ static int yy_get_next_buffer()
 		/* Read in more data. */
 		YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
 			yy_n_chars, num_to_read );
+
+		yy_current_buffer->yy_n_chars = yy_n_chars;
 		}
 
 	if ( yy_n_chars == 0 )
@@ -2504,7 +2513,8 @@ register char *yy_bp;
 
 		yy_cp += (int) (dest - source);
 		yy_bp += (int) (dest - source);
-		yy_n_chars = yy_current_buffer->yy_buf_size;
+		yy_current_buffer->yy_n_chars =
+			yy_n_chars = yy_current_buffer->yy_buf_size;
 
 		if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
 			YY_FATAL_ERROR( "flex scanner push-back overflow" );
@@ -2542,19 +2552,31 @@ static int input()
 
 		else
 			{ /* need more input */
-			yytext_ptr = yy_c_buf_p;
+			int offset = yy_c_buf_p - yytext_ptr;
 			++yy_c_buf_p;
 
 			switch ( yy_get_next_buffer() )
 				{
+				case EOB_ACT_LAST_MATCH:
+					/* This happens because yy_g_n_b()
+					 * sees that we've accumulated a
+					 * token and flags that we need to
+					 * try matching the token before
+					 * proceeding.  But for input(),
+					 * there's no matching to consider.
+					 * So convert the EOB_ACT_LAST_MATCH
+					 * to EOB_ACT_END_OF_FILE.
+					 */
+
+					/* Reset buffer status. */
+					yyrestart( yyin );
+
+					/* fall through */
+
 				case EOB_ACT_END_OF_FILE:
 					{
 					if ( yywrap() )
-						{
-						yy_c_buf_p =
-						yytext_ptr + YY_MORE_ADJ;
 						return EOF;
-						}
 
 					if ( ! yy_did_buffer_switch_on_eof )
 						YY_NEW_FILE;
@@ -2566,17 +2588,8 @@ static int input()
 					}
 
 				case EOB_ACT_CONTINUE_SCAN:
-					yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
+					yy_c_buf_p = yytext_ptr + offset;
 					break;
-
-				case EOB_ACT_LAST_MATCH:
-#ifdef __cplusplus
-					YY_FATAL_ERROR(
-					"unexpected last match in yyinput()" );
-#else
-					YY_FATAL_ERROR(
-					"unexpected last match in input()" );
-#endif
 				}
 			}
 		}
@@ -2740,6 +2753,9 @@ YY_BUFFER_STATE b;
 #endif
 
 	{
+	if ( ! b )
+		return;
+
 	b->yy_n_chars = 0;
 
 	/* We always need two end-of-buffer characters.  The first causes
@@ -2799,17 +2815,17 @@ yy_size_t size;
 
 #ifndef YY_NO_SCAN_STRING
 #ifdef YY_USE_PROTOS
-YY_BUFFER_STATE yy_scan_string( yyconst char *str )
+YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
 #else
-YY_BUFFER_STATE yy_scan_string( str )
-yyconst char *str;
+YY_BUFFER_STATE yy_scan_string( yy_str )
+yyconst char *yy_str;
 #endif
 	{
 	int len;
-	for ( len = 0; str[len]; ++len )
+	for ( len = 0; yy_str[len]; ++len )
 		;
 
-	return yy_scan_bytes( str, len );
+	return yy_scan_bytes( yy_str, len );
 	}
 #endif
 
@@ -2930,7 +2946,7 @@ char msg[];
 		{ \
 		/* Undo effects of setting up yytext. */ \
 		yytext[yyleng] = yy_hold_char; \
-		yy_c_buf_p = yytext + n - YY_MORE_ADJ; \
+		yy_c_buf_p = yytext + n; \
 		yy_hold_char = *yy_c_buf_p; \
 		*yy_c_buf_p = '\0'; \
 		yyleng = n; \
@@ -2956,6 +2972,22 @@ int n;
 	}
 #endif
 
+#ifdef YY_NEED_STRLEN
+#ifdef YY_USE_PROTOS
+static int yy_flex_strlen( yyconst char *s )
+#else
+static int yy_flex_strlen( s )
+yyconst char *s;
+#endif
+	{
+	register int n;
+	for ( n = 0; s[n]; ++n )
+		;
+
+	return n;
+	}
+#endif
+
 
 #ifdef YY_USE_PROTOS
 static void *yy_flex_alloc( yy_size_t size )
-- 
GitLab