Skip to content
Snippets Groups Projects
Gmsh.yy.cpp 94.2 KiB
Newer Older
return tParametric;
case 130:
return tPolarSphere;
case 131:
Christophe Geuzaine's avatar
Christophe Geuzaine committed
#line 219 "Gmsh.l"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
case 132:
YY_RULE_SETUP
#line 220 "Gmsh.l"
return tPlugin;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
case 133:
YY_RULE_SETUP
Christophe Geuzaine's avatar
Christophe Geuzaine committed
#line 222 "Gmsh.l"
return tQuadTriAddVerts;
case 134:
YY_RULE_SETUP
#line 223 "Gmsh.l"
return tQuadTriNoNewVerts;
YY_RULE_SETUP
Christophe Geuzaine's avatar
Christophe Geuzaine committed
#line 225 "Gmsh.l"
return tQuadTriDbl;
Christophe Geuzaine's avatar
Christophe Geuzaine committed
YY_RULE_SETUP
#line 226 "Gmsh.l"
return tQuadTriSngl;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
YY_RULE_SETUP
return tRecombine;
return tRecombLaterals;
YY_RULE_SETUP
return tRecursive;
Christophe Geuzaine's avatar
Christophe Geuzaine committed
case 140:
YY_RULE_SETUP
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
case 141:
Matti Pellika's avatar
 
Matti Pellika committed
YY_RULE_SETUP
Matti Pellika's avatar
 
Matti Pellika committed
YY_RULE_SETUP
return tRefineMesh;
return tRelocateMesh;
Matti Pellika's avatar
 
Matti Pellika committed
case 146:
Christophe Geuzaine's avatar
Christophe Geuzaine committed
#line 237 "Gmsh.l"
Matti Pellika's avatar
 
Matti Pellika committed
case 147:
YY_RULE_SETUP
#line 238 "Gmsh.l"
return tReverse;
	YY_BREAK
YY_RULE_SETUP
return tScaleLast;
	YY_BREAK
return tSmoother;
return tSetOrder;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
YY_RULE_SETUP
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	YY_BREAK
YY_RULE_SETUP
Christophe Geuzaine's avatar
Christophe Geuzaine committed
YY_RULE_SETUP
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	YY_BREAK
YY_RULE_SETUP
Christophe Geuzaine's avatar
Christophe Geuzaine committed
case 161:
YY_RULE_SETUP
return tStrReplace;
	YY_BREAK
Christophe Geuzaine's avatar
Christophe Geuzaine committed
YY_RULE_SETUP
return tStrPrefix;
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	YY_BREAK
YY_RULE_SETUP
return tStrRelative;
YY_RULE_SETUP
case 165:
Christophe Geuzaine's avatar
Christophe Geuzaine committed
case 166:
return tStrChoice;
case 167:
YY_RULE_SETUP
Christophe Geuzaine's avatar
Christophe Geuzaine committed
#line 259 "Gmsh.l"
return tShow;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
YY_RULE_SETUP
#line 260 "Gmsh.l"
return tSymmetry;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	YY_BREAK
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
YY_RULE_SETUP
#line 261 "Gmsh.l"
return tSyncModel;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	YY_BREAK
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
YY_RULE_SETUP
return tText2D;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	YY_BREAK
return tText3D;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
case 172:
return tTextAttributes;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
case 173:
return tTime;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
case 174:
return tTransfinite;
return tTransfQuadTri;
return tTranslate;
return tTanh;
Christophe Geuzaine's avatar
Christophe Geuzaine committed
#line 271 "Gmsh.l"
return tTan;
#line 272 "Gmsh.l"
return tToday;
#line 273 "Gmsh.l"
return tTotalMemory;
Christophe Geuzaine's avatar
Christophe Geuzaine committed
YY_RULE_SETUP
#line 275 "Gmsh.l"
return tUndefineConstant;
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	YY_BREAK
#line 276 "Gmsh.l"
return tUsing;
YY_RULE_SETUP
#line 278 "Gmsh.l"
return tVolume;
	YY_BREAK
Christophe Geuzaine's avatar
Christophe Geuzaine committed
#line 281 "Gmsh.l"
case 185:
#line 282 "Gmsh.l"
case 186:
#line 283 "Gmsh.l"
case 187:
#line 283 "Gmsh.l"
{ gmsh_yylval.d = atof((char *)gmsh_yytext); return tDOUBLE; }
	YY_BREAK
case 188:
#line 285 "Gmsh.l"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
{ gmsh_yylval.c = strsave((char*)gmsh_yytext); return tSTRING; }
case 189:
#line 287 "Gmsh.l"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
return gmsh_yytext[0];
case 190:
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
YY_RULE_SETUP
#line 289 "Gmsh.l"
#line 2300 "Gmsh.yy.cpp"
	yyterminate();

	case YY_END_OF_BUFFER:
		{
		/* Amount of text matched not including the EOB char. */
		int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;

		/* Undo the effects of YY_DO_BEFORE_ACTION. */
		*yy_cp = (yy_hold_char);
		YY_RESTORE_YY_MORE_OFFSET

		if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
			{
			/* We're scanning a new file or input source.  It's
			 * possible that this happened because the user
			 * just pointed gmsh_yyin at a new source and called
			 * gmsh_yylex().  If so, then we have to assure
			 * consistency between YY_CURRENT_BUFFER and our
			 * globals.  Here is the right place to do so, because
			 * this is the first action (other than possibly a
			 * back-up) that will match for the new input source.
			 */
			(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
			YY_CURRENT_BUFFER_LVALUE->yy_input_file = gmsh_yyin;
			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
			}

		/* Note that here we test for yy_c_buf_p "<=" to the position
		 * of the first EOB in the buffer, since yy_c_buf_p will
		 * already have been incremented past the NUL character
		 * (since all states make transitions on EOB to the
		 * end-of-buffer state).  Contrast this with the test
		 * in input().
		 */
		if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
			{ /* This was really a NUL. */
			yy_state_type yy_next_state;

			(yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;

			yy_current_state = yy_get_previous_state(  );

			/* Okay, we're now positioned to make the NUL
			 * transition.  We couldn't have
			 * yy_get_previous_state() go ahead and do it
			 * for us because it doesn't know how to deal
			 * with the possibility of jamming (and we don't
			 * want to build jamming into it because then it
			 * will run more slowly).
			 */

			yy_next_state = yy_try_NUL_trans( yy_current_state );

			yy_bp = (yytext_ptr) + YY_MORE_ADJ;

			if ( yy_next_state )
				{
				/* Consume the NUL. */
				yy_cp = ++(yy_c_buf_p);
				yy_current_state = yy_next_state;
				goto yy_match;
				}

			else
				{
				yy_cp = (yy_c_buf_p);
				goto yy_find_action;
				}
			}

		else switch ( yy_get_next_buffer(  ) )
			{
			case EOB_ACT_END_OF_FILE:
				{
				(yy_did_buffer_switch_on_eof) = 0;

				if ( gmsh_yywrap( ) )
					{
					/* Note: because we've taken care in
					 * yy_get_next_buffer() to have set up
					 * gmsh_yytext, we can now set up
					 * yy_c_buf_p so that if some total
					 * hoser (like flex itself) wants to
					 * call the scanner after we return the
					 * YY_NULL, it'll still work - another
					 * YY_NULL will get returned.
					 */
					(yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;

					yy_act = YY_STATE_EOF(YY_START);
					goto do_action;
					}

				else
					{
					if ( ! (yy_did_buffer_switch_on_eof) )
						YY_NEW_FILE;
					}
				break;
				}

			case EOB_ACT_CONTINUE_SCAN:
				(yy_c_buf_p) =
					(yytext_ptr) + yy_amount_of_matched_text;

				yy_current_state = yy_get_previous_state(  );

				yy_cp = (yy_c_buf_p);
				yy_bp = (yytext_ptr) + YY_MORE_ADJ;
				goto yy_match;

			case EOB_ACT_LAST_MATCH:
				(yy_c_buf_p) =
				&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];

				yy_current_state = yy_get_previous_state(  );

				yy_cp = (yy_c_buf_p);
				yy_bp = (yytext_ptr) + YY_MORE_ADJ;
				goto yy_find_action;
			}
		break;
		}

	default:
		YY_FATAL_ERROR(
			"fatal flex scanner internal error--no action found" );
	} /* end of action switch */
		} /* end of scanning one token */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
} /* end of gmsh_yylex */

/* yy_get_next_buffer - try to read in a new buffer
 *
 * Returns a code representing an action:
 *	EOB_ACT_LAST_MATCH -
 *	EOB_ACT_CONTINUE_SCAN - continue scanning from current position
 *	EOB_ACT_END_OF_FILE - end of file
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
static int yy_get_next_buffer (void)
{
    	register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
	register char *source = (yytext_ptr);
	register int number_to_move, i;
	int ret_val;

	if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
		YY_FATAL_ERROR(
		"fatal flex scanner internal error--end of buffer missed" );

	if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
		{ /* 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 single character, the EOB, so
			 * treat this as a final EOF.
			 */
			return EOB_ACT_END_OF_FILE;
			}

		else
			{
			/* We matched some text prior to the EOB, first
			 * process it.
			 */
			return EOB_ACT_LAST_MATCH;
			}
		}

	/* Try to read more data. */

	/* First move last chars to start of buffer. */
	number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;

	for ( i = 0; i < number_to_move; ++i )
		*(dest++) = *(source++);

	if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
		/* don't do the read, it's not guaranteed to return an EOF,
		 * just force an EOF
		 */
		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;

	else
		{
Christophe Geuzaine's avatar
Christophe Geuzaine committed
			yy_size_t num_to_read =
			YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;

		while ( num_to_read <= 0 )
			{ /* Not enough room in the buffer - grow it. */

			/* just a shorter name for the current buffer */
			YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;

			int yy_c_buf_p_offset =
				(int) ((yy_c_buf_p) - b->yy_ch_buf);

			if ( b->yy_is_our_buffer )
				{
Christophe Geuzaine's avatar
Christophe Geuzaine committed
				yy_size_t new_size = b->yy_buf_size * 2;

				if ( new_size <= 0 )
					b->yy_buf_size += b->yy_buf_size / 8;
				else
					b->yy_buf_size *= 2;

				b->yy_ch_buf = (char *)
					/* Include room in for 2 EOB chars. */
					gmsh_yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
				}
			else
				/* Can't grow it, we don't own it. */
				b->yy_ch_buf = 0;

			if ( ! b->yy_ch_buf )
				YY_FATAL_ERROR(
				"fatal error - scanner input buffer overflow" );

			(yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];

			num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
						number_to_move - 1;

			}

		if ( num_to_read > YY_READ_BUF_SIZE )
			num_to_read = YY_READ_BUF_SIZE;

		/* Read in more data. */
		YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
Christophe Geuzaine's avatar
Christophe Geuzaine committed
			(yy_n_chars), num_to_read );

		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
		}

	if ( (yy_n_chars) == 0 )
		{
		if ( number_to_move == YY_MORE_ADJ )
			{
			ret_val = EOB_ACT_END_OF_FILE;
			gmsh_yyrestart(gmsh_yyin  );
			}

		else
			{
			ret_val = EOB_ACT_LAST_MATCH;
			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
				YY_BUFFER_EOF_PENDING;
			}
		}

	else
		ret_val = EOB_ACT_CONTINUE_SCAN;

	if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
		/* Extend the array by 50%, plus the number we really need. */
		yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
		YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) gmsh_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );
		if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
			YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
	}

	(yy_n_chars) += number_to_move;
	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;

	(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
}

/* yy_get_previous_state - get the state just before the EOB char was reached */

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    static yy_state_type yy_get_previous_state (void)
{
	register yy_state_type yy_current_state;
	register char *yy_cp;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    
	yy_current_state = (yy_start);

	for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
		{
		register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
		if ( yy_accept[yy_current_state] )
			{
			(yy_last_accepting_state) = yy_current_state;
			(yy_last_accepting_cpos) = yy_cp;
			}
		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
			{
			yy_current_state = (int) yy_def[yy_current_state];
			if ( yy_current_state >= 930 )
				yy_c = yy_meta[(unsigned int) yy_c];
			}
		yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
		}

	return yy_current_state;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
}

/* yy_try_NUL_trans - try to make a transition on the NUL character
 *
 * synopsis
 *	next_state = yy_try_NUL_trans( current_state );
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
{
	register int yy_is_jam;
    	register char *yy_cp = (yy_c_buf_p);

	register YY_CHAR yy_c = 1;
	if ( yy_accept[yy_current_state] )
		{
		(yy_last_accepting_state) = yy_current_state;
		(yy_last_accepting_cpos) = yy_cp;
		}
	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
		{
		yy_current_state = (int) yy_def[yy_current_state];
		if ( yy_current_state >= 930 )
			yy_c = yy_meta[(unsigned int) yy_c];
		}
	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
	yy_is_jam = (yy_current_state == 929);
		return yy_is_jam ? 0 : yy_current_state;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
}
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    static void yyunput (int c, register char * yy_bp )
{
	register char *yy_cp;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    
    yy_cp = (yy_c_buf_p);
	/* undo effects of setting up gmsh_yytext */
	*yy_cp = (yy_hold_char);
	if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
		{ /* need to shift things up to make room */
		/* +2 for EOB chars. */
Christophe Geuzaine's avatar
Christophe Geuzaine committed
		register yy_size_t number_to_move = (yy_n_chars) + 2;
		register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
					YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
		register char *source =
				&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
		while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
			*--dest = *--source;
		yy_cp += (int) (dest - source);
		yy_bp += (int) (dest - source);
		YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
			(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
		if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
			YY_FATAL_ERROR( "flex scanner push-back overflow" );
		}
	(yytext_ptr) = yy_bp;
	(yy_hold_char) = *yy_cp;
	(yy_c_buf_p) = yy_cp;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
}
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#ifndef YY_NO_INPUT
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    static int yyinput (void)
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    static int input  (void)
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
{
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    
	*(yy_c_buf_p) = (yy_hold_char);

	if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
		{
		/* yy_c_buf_p now points to the character we want to return.
		 * If this occurs *before* the EOB characters, then it's a
		 * valid NUL; if not, then we've hit the end of the buffer.
		 */
		if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
			/* This was really a NUL. */
			*(yy_c_buf_p) = '\0';

		else
			{ /* need more input */
Christophe Geuzaine's avatar
Christophe Geuzaine committed
			yy_size_t 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. */
					gmsh_yyrestart(gmsh_yyin );

					/*FALLTHROUGH*/

				case EOB_ACT_END_OF_FILE:
					{
					if ( gmsh_yywrap( ) )

					if ( ! (yy_did_buffer_switch_on_eof) )
						YY_NEW_FILE;
				case EOB_ACT_CONTINUE_SCAN:
					(yy_c_buf_p) = (yytext_ptr) + offset;
					break;
				}
			}
		}
	c = *(unsigned char *) (yy_c_buf_p);	/* cast for 8-bit char's */
	*(yy_c_buf_p) = '\0';	/* preserve gmsh_yytext */
	(yy_hold_char) = *++(yy_c_buf_p);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
}
#endif	/* ifndef YY_NO_INPUT */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
/** Immediately switch to a different input stream.
 * @param input_file A readable stream.
 * 
 * @note This function does not reset the start condition to @c INITIAL .
 */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    void gmsh_yyrestart  (FILE * input_file )
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
{
    
	if ( ! YY_CURRENT_BUFFER ){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
        gmsh_yyensure_buffer_stack ();
		YY_CURRENT_BUFFER_LVALUE =
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
            gmsh_yy_create_buffer(gmsh_yyin,YY_BUF_SIZE );
	gmsh_yy_init_buffer(YY_CURRENT_BUFFER,input_file );
	gmsh_yy_load_buffer_state( );
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
}
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
/** Switch to a different input buffer.
 * @param new_buffer The new input buffer.
 * 
 */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    void gmsh_yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer )
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
{
    
	/* TODO. We should be able to replace this entire function body
	 * with
	 *		gmsh_yypop_buffer_state();
	 *		gmsh_yypush_buffer_state(new_buffer);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
     */
	gmsh_yyensure_buffer_stack ();
	if ( YY_CURRENT_BUFFER == new_buffer )
		return;

	if ( YY_CURRENT_BUFFER )
		{
		/* Flush out information for old buffer. */
		*(yy_c_buf_p) = (yy_hold_char);
		YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
		}

	YY_CURRENT_BUFFER_LVALUE = new_buffer;
	gmsh_yy_load_buffer_state( );

	/* We don't actually know whether we did this switch during
	 * EOF (gmsh_yywrap()) processing, but the only time this flag
	 * is looked at is after gmsh_yywrap() is called, so it's safe
	 * to go ahead and always set it.
	 */
	(yy_did_buffer_switch_on_eof) = 1;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
}
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
static void gmsh_yy_load_buffer_state  (void)
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
{
    	(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
	(yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
	gmsh_yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
	(yy_hold_char) = *(yy_c_buf_p);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
}
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
/** Allocate and initialize an input buffer state.
 * @param file A readable stream.
 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
 * 
 * @return the allocated buffer state.
 */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    YY_BUFFER_STATE gmsh_yy_create_buffer  (FILE * file, int  size )
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
{
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    
	b = (YY_BUFFER_STATE) gmsh_yyalloc(sizeof( struct yy_buffer_state )  );
	if ( ! b )
		YY_FATAL_ERROR( "out of dynamic memory in gmsh_yy_create_buffer()" );
	b->yy_buf_size = size;
	/* yy_ch_buf has to be 2 characters longer than the size given because
	 * we need to put in 2 end-of-buffer characters.
	 */
	b->yy_ch_buf = (char *) gmsh_yyalloc(b->yy_buf_size + 2  );
	if ( ! b->yy_ch_buf )
		YY_FATAL_ERROR( "out of dynamic memory in gmsh_yy_create_buffer()" );
	b->yy_is_our_buffer = 1;
	gmsh_yy_init_buffer(b,file );
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
}
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
/** Destroy the buffer.
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
 * @param b a buffer created with gmsh_yy_create_buffer()
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
 * 
 */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    void gmsh_yy_delete_buffer (YY_BUFFER_STATE  b )
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
{
    
	if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
		YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
	if ( b->yy_is_our_buffer )
		gmsh_yyfree((void *) b->yy_ch_buf  );
	gmsh_yyfree((void *) b  );
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
}
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
/* Initializes or reinitializes a buffer.
 * This function is sometimes called more than once on the same buffer,
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
 * such as during a gmsh_yyrestart() or at EOF.
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
 */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    static void gmsh_yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file )
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
{
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    
	gmsh_yy_flush_buffer(b );
	b->yy_input_file = file;
	b->yy_fill_buffer = 1;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    /* If b is the current buffer, then gmsh_yy_init_buffer was _probably_
     * called from gmsh_yyrestart() or through yy_get_next_buffer.
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
     * In that case, we don't want to reset the lineno or column.
     */
    if (b != YY_CURRENT_BUFFER){
        b->yy_bs_lineno = 1;
        b->yy_bs_column = 0;
    }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
        b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
    
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
}
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
 * 
 */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    void gmsh_yy_flush_buffer (YY_BUFFER_STATE  b )
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
{
	/* We always need two end-of-buffer characters.  The first causes
	 * a transition to the end-of-buffer state.  The second causes
	 * a jam in that state.
	 */
	b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
	b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
	b->yy_buf_pos = &b->yy_ch_buf[0];
	b->yy_at_bol = 1;
	b->yy_buffer_status = YY_BUFFER_NEW;
	if ( b == YY_CURRENT_BUFFER )
		gmsh_yy_load_buffer_state( );
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
}

/** Pushes the new state onto the stack. The new state becomes
 *  the current state. This function will allocate the stack
 *  if necessary.
 *  @param new_buffer The new state.
 *  
 */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
void gmsh_yypush_buffer_state (YY_BUFFER_STATE new_buffer )
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
{
    	if (new_buffer == NULL)
		return;

	gmsh_yyensure_buffer_stack();

	/* This block is copied from gmsh_yy_switch_to_buffer. */
	if ( YY_CURRENT_BUFFER )
		{
		/* Flush out information for old buffer. */
		*(yy_c_buf_p) = (yy_hold_char);
		YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
		}

	/* Only push if top exists. Otherwise, replace top. */
	if (YY_CURRENT_BUFFER)
		(yy_buffer_stack_top)++;
	YY_CURRENT_BUFFER_LVALUE = new_buffer;

	/* copied from gmsh_yy_switch_to_buffer. */
	gmsh_yy_load_buffer_state( );
	(yy_did_buffer_switch_on_eof) = 1;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
}

/** Removes and deletes the top of the stack, if present.
 *  The next element becomes the new top.
 *  
 */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
void gmsh_yypop_buffer_state (void)
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
{
    	if (!YY_CURRENT_BUFFER)
		return;

	gmsh_yy_delete_buffer(YY_CURRENT_BUFFER );
	YY_CURRENT_BUFFER_LVALUE = NULL;
	if ((yy_buffer_stack_top) > 0)
		--(yy_buffer_stack_top);

	if (YY_CURRENT_BUFFER) {
		gmsh_yy_load_buffer_state( );
		(yy_did_buffer_switch_on_eof) = 1;
	}
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
}
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
/* Allocates the stack if it does not exist.
 *  Guarantees space for at least one push.
 */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
static void gmsh_yyensure_buffer_stack (void)
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
{
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	yy_size_t num_to_alloc;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    
	if (!(yy_buffer_stack)) {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

		/* First allocation is just for 2 elements, since we don't know if this
		 * scanner will even need a stack. We use 2 instead of 1 to avoid an
		 * immediate realloc on the next call.
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
         */
		num_to_alloc = 1;
		(yy_buffer_stack) = (struct yy_buffer_state**)gmsh_yyalloc
								(num_to_alloc * sizeof(struct yy_buffer_state*)
								);
		if ( ! (yy_buffer_stack) )
			YY_FATAL_ERROR( "out of dynamic memory in gmsh_yyensure_buffer_stack()" );
								  
		memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
				
		(yy_buffer_stack_max) = num_to_alloc;
		(yy_buffer_stack_top) = 0;
		return;
	}

	if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){

		/* Increase the buffer to prepare for a possible push. */
		int grow_size = 8 /* arbitrary grow size */;

		num_to_alloc = (yy_buffer_stack_max) + grow_size;
		(yy_buffer_stack) = (struct yy_buffer_state**)gmsh_yyrealloc
								((yy_buffer_stack),
								num_to_alloc * sizeof(struct yy_buffer_state*)
								);
		if ( ! (yy_buffer_stack) )
			YY_FATAL_ERROR( "out of dynamic memory in gmsh_yyensure_buffer_stack()" );

		/* zero only the new slots.*/
		memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
		(yy_buffer_stack_max) = num_to_alloc;
	}
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
}