Skip to content
Snippets Groups Projects
Gmsh.tab.cpp 273 KiB
Newer Older
#line 2371 "Gmsh.y"
      if(!(pNumCat = Get_NumberOptionCategory(yyvsp[-3].c))){
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	vyyerror("Unknown numeric option class '%s'", yyvsp[-3].c);
	yyval.d = 0. ;
      }
	if(!(pNumOpt =  (double (*) (int, int, double))Get_NumberOption(yyvsp[-1].c, pNumCat))){
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	  vyyerror("Unknown numeric option '%s.%s'", yyvsp[-3].c, yyvsp[-1].c);
	  yyval.d = 0. ;
	}
	else
	  yyval.d = pNumOpt(0, GMSH_SET|GMSH_GUI, pNumOpt(0, GMSH_GET, 0)+yyvsp[0].i);
#line 2387 "Gmsh.y"
      if(!(pNumCat = Get_NumberOptionCategory(yyvsp[-6].c))){
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	vyyerror("Unknown numeric option class '%s'", yyvsp[-6].c);
	yyval.d = 0. ;
      }
	if(!(pNumOpt =  (double (*) (int, int, double))Get_NumberOption(yyvsp[-1].c, pNumCat))){
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	  vyyerror("Unknown numeric option '%s[%d].%s'", yyvsp[-6].c, (int)yyvsp[-4].d, yyvsp[-1].c);
	  yyval.d = 0. ;
	else
	  yyval.d = pNumOpt((int)yyvsp[-4].d, GMSH_SET|GMSH_GUI, pNumOpt((int)yyvsp[-4].d, GMSH_GET, 0)+yyvsp[0].i);
#line 2405 "Gmsh.y"
Christophe Geuzaine's avatar
Christophe Geuzaine committed
{
      memcpy(yyval.v, yyvsp[0].v, 5*sizeof(double)) ;
#line 2409 "Gmsh.y"
{
      for(i=0 ; i<5 ; i++) yyval.v[i] = -yyvsp[0].v[i] ;
#line 2413 "Gmsh.y"
Christophe Geuzaine's avatar
Christophe Geuzaine committed
{ 
      for(i=0 ; i<5 ; i++) yyval.v[i] = yyvsp[0].v[i];
#line 2417 "Gmsh.y"
{ 
      for(i=0 ; i<5 ; i++) yyval.v[i] = yyvsp[-2].v[i] - yyvsp[0].v[i] ;
#line 2421 "Gmsh.y"
{
      for(i=0 ; i<5 ; i++) yyval.v[i] = yyvsp[-2].v[i] + yyvsp[0].v[i] ;
#line 2428 "Gmsh.y"
Christophe Geuzaine's avatar
Christophe Geuzaine committed
{ 
      yyval.v[0]=yyvsp[-9].d;  yyval.v[1]=yyvsp[-7].d;  yyval.v[2]=yyvsp[-5].d;  yyval.v[3]=yyvsp[-3].d; yyval.v[4]=yyvsp[-1].d;
#line 2432 "Gmsh.y"
{ 
      yyval.v[0]=yyvsp[-7].d;  yyval.v[1]=yyvsp[-5].d;  yyval.v[2]=yyvsp[-3].d;  yyval.v[3]=yyvsp[-1].d; yyval.v[4]=1.0;
#line 2436 "Gmsh.y"
Christophe Geuzaine's avatar
Christophe Geuzaine committed
      yyval.v[0]=yyvsp[-5].d;  yyval.v[1]=yyvsp[-3].d;  yyval.v[2]=yyvsp[-1].d;  yyval.v[3]=0.0; yyval.v[4]=1.0;
#line 2440 "Gmsh.y"
      yyval.v[0]=yyvsp[-5].d;  yyval.v[1]=yyvsp[-3].d;  yyval.v[2]=yyvsp[-1].d;  yyval.v[3]=0.0; yyval.v[4]=1.0;
#line 2447 "Gmsh.y"
#line 2450 "Gmsh.y"
David Colignon's avatar
David Colignon committed
{
    ;
    break;}
#line 2456 "Gmsh.y"
#line 2459 "Gmsh.y"
#line 2465 "Gmsh.y"
Christophe Geuzaine's avatar
Christophe Geuzaine committed
{
    ;
    break;}
#line 2468 "Gmsh.y"
Christophe Geuzaine's avatar
Christophe Geuzaine committed
       yyval.l=yyvsp[-1].l;
#line 2472 "Gmsh.y"
       yyval.l=yyvsp[-1].l;
#line 2479 "Gmsh.y"
Christophe Geuzaine's avatar
Christophe Geuzaine committed
{
      yyval.l = List_Create(2,1,sizeof(List_T*)) ;
Christophe Geuzaine's avatar
Christophe Geuzaine committed
      List_Add(yyval.l, &(yyvsp[0].l)) ;
    ;
    break;}
#line 2484 "Gmsh.y"
{
      List_Add(yyval.l, &(yyvsp[0].l)) ;
    ;
    break;}
#line 2492 "Gmsh.y"
      yyval.l = List_Create(2,1,sizeof(double)) ;
      List_Add(yyval.l, &(yyvsp[0].d)) ;
#line 2497 "Gmsh.y"
      yyval.l = yyvsp[0].l ;
#line 2501 "Gmsh.y"
{
      yyval.l=yyvsp[-1].l;
    ;
    break;}
#line 2505 "Gmsh.y"
Christophe Geuzaine's avatar
Christophe Geuzaine committed
      yyval.l=yyvsp[-1].l;
      for(i=0 ; i<List_Nbr(yyval.l) ; i++){
	pd = (double*)List_Pointer(yyval.l, i);
	(*pd) = - (*pd);
#line 2516 "Gmsh.y"
{ 
      yyval.l = List_Create(2,1,sizeof(double)) ; 
      for(d=yyvsp[-2].d ; (yyvsp[-2].d<yyvsp[0].d)?(d<=yyvsp[0].d):(d>=yyvsp[0].d) ; (yyvsp[-2].d<yyvsp[0].d)?(d+=1.):(d-=1.)) 
	List_Add(yyval.l, &d) ;
    ;
    break;}
#line 2522 "Gmsh.y"
      yyval.l = List_Create(2,1,sizeof(double)) ; 
      if(!yyvsp[0].d || (yyvsp[-4].d<yyvsp[-2].d && yyvsp[0].d<0) || (yyvsp[-4].d>yyvsp[-2].d && yyvsp[0].d>0)){
        vyyerror("Wrong increment in '%g:%g:%g'", yyvsp[-4].d, yyvsp[-2].d, yyvsp[0].d) ;
	List_Add(yyval.l, &(yyvsp[-4].d)) ;
      }
      else
	for(d=yyvsp[-4].d ; (yyvsp[0].d>0)?(d<=yyvsp[-2].d):(d>=yyvsp[-2].d) ; d+=yyvsp[0].d)
	  List_Add(yyval.l, &d) ;
   ;
#line 2533 "Gmsh.y"
{
      yyval.l = List_Create(2,1,sizeof(double)) ;
Christophe Geuzaine's avatar
Christophe Geuzaine committed
      TheSymbol.Name = yyvsp[-2].c ;
      if (!(pSymbol = (Symbol*)List_PQuery(Symbol_L, &TheSymbol, CompareSymbols))) {
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	vyyerror("Unknown variable '%s'", yyvsp[-2].c) ;
	d = 0.0 ;
	List_Add(yyval.l, &d);
      }
      else{
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	for(i = 0 ; i < List_Nbr(pSymbol->val) ; i++)
	  List_Add(yyval.l, (double*)List_Pointer_Fast(pSymbol->val, i)) ;
#line 2547 "Gmsh.y"
      yyval.l = List_Create(2,1,sizeof(double)) ;
      TheSymbol.Name = yyvsp[-2].c ;
      if (!(pSymbol = (Symbol*)List_PQuery(Symbol_L, &TheSymbol, CompareSymbols))) {
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	vyyerror("Unknown variable '%s'", yyvsp[-2].c) ;
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	d = 0.0 ;
	List_Add(yyval.l, &d);
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	for(i = 0 ; i < List_Nbr(pSymbol->val) ; i++){
	  d = - *(double*)List_Pointer_Fast(pSymbol->val, i);
	  List_Add(yyval.l, &d) ;
	}
#line 2563 "Gmsh.y"
      yyval.l = List_Create(2,1,sizeof(double)) ;
      TheSymbol.Name = yyvsp[-5].c ;
      if (!(pSymbol = (Symbol*)List_PQuery(Symbol_L, &TheSymbol, CompareSymbols))) {
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	vyyerror("Unknown variable '%s'", yyvsp[-5].c) ;
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	d = 0.0 ;
	List_Add(yyval.l, &d);
      }
      else{
	for(i = 0 ; i < List_Nbr(yyvsp[-2].l) ; i++){
	  j = (int)(*(double*)List_Pointer_Fast(yyvsp[-2].l, i));
	  if((pd = (double*)List_Pointer_Test(pSymbol->val, j)))
	    List_Add(yyval.l, pd) ;
	  else
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	    vyyerror("Uninitialized variable '%s[%d]'", yyvsp[-5].c, j) ;	  
      List_Delete(yyvsp[-2].l);
#line 2583 "Gmsh.y"
{
      yyval.l = List_Create(2,1,sizeof(double)) ;
      TheSymbol.Name = yyvsp[-5].c ;
      if (!(pSymbol = (Symbol*)List_PQuery(Symbol_L, &TheSymbol, CompareSymbols))) {
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	vyyerror("Unknown variable '%s'", yyvsp[-5].c) ;
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	d = 0.0 ;
	List_Add(yyval.l, &d);
      }
      else{
	for(i = 0 ; i < List_Nbr(yyvsp[-2].l) ; i++){
	  j = (int)(*(double*)List_Pointer_Fast(yyvsp[-2].l, i));
	  if((pd = (double*)List_Pointer_Test(pSymbol->val, j))){
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	    d = - *pd;
	    List_Add(yyval.l, &d) ;
	  }
	  else
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	    vyyerror("Uninitialized variable '%s[%d]'", yyvsp[-5].c, j) ;	  
	}
      }
      List_Delete(yyvsp[-2].l);
    ;
    break;}
#line 2608 "Gmsh.y"
{
      yyval.l = List_Create(2,1,sizeof(double)) ;
      List_Add(yyval.l, &(yyvsp[0].d)) ;
    ;
    break;}
#line 2613 "Gmsh.y"
Christophe Geuzaine's avatar
Christophe Geuzaine committed
{
      yyval.l = yyvsp[0].l ;
    ;
    break;}
#line 2617 "Gmsh.y"
{
      List_Add(yyval.l, &(yyvsp[0].d)) ;
    ;
    break;}
#line 2621 "Gmsh.y"
      for(i=0 ; i<List_Nbr(yyvsp[0].l) ; i++){
	List_Read(yyvsp[0].l, i, &d) ;
	List_Add(yyval.l, &d) ;
      List_Delete(yyvsp[0].l);
#line 2633 "Gmsh.y"
{
      yyval.u = PACK_COLOR((int)yyvsp[-7].d, (int)yyvsp[-5].d, (int)yyvsp[-3].d, (int)yyvsp[-1].d);
    ;
    break;}
#line 2637 "Gmsh.y"
{
      yyval.u = PACK_COLOR((int)yyvsp[-5].d, (int)yyvsp[-3].d, (int)yyvsp[-1].d, 255);
    ;
    break;}
#line 2648 "Gmsh.y"
{
      yyval.u = Get_ColorForString(ColorString, -1, yyvsp[0].c, &flag);
Christophe Geuzaine's avatar
Christophe Geuzaine committed
      if(flag) vyyerror("Unknown color '%s'", yyvsp[0].c);
#line 2653 "Gmsh.y"
      if(!(pColCat = Get_ColorOptionCategory(yyvsp[-4].c))){
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	vyyerror("Unknown color option class '%s'", yyvsp[-4].c);
	yyval.u = 0 ;
      }
	if(!(pColOpt =  (unsigned int (*) (int, int, unsigned int))Get_ColorOption(yyvsp[0].c, pColCat))){
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	  vyyerror("Unknown color option '%s.Color.%s'", yyvsp[-4].c, yyvsp[0].c);
	  yyval.u = 0 ;
	}
#line 2672 "Gmsh.y"
      yyval.l = yyvsp[-1].l;
#line 2676 "Gmsh.y"
      yyval.l = List_Create(256,10,sizeof(unsigned int)) ;
      GmshColorTable *ct = Get_ColorTable((int)yyvsp[-3].d);
      if(!ct)
	vyyerror("View[%d] does not exist", (int)yyvsp[-3].d);
	  List_Add(yyval.l, &ct->table[i]);
#line 2690 "Gmsh.y"
      yyval.l = List_Create(256,10,sizeof(unsigned int)) ;
      List_Add(yyval.l, &(yyvsp[0].u)) ;
#line 2695 "Gmsh.y"
      List_Add(yyval.l, &(yyvsp[0].u)) ;
#line 2702 "Gmsh.y"
{
      yyval.c = yyvsp[0].c;
    ;
    break;}
#line 2706 "Gmsh.y"
{
      yyval.c = (char *)Malloc((strlen(yyvsp[-3].c)+strlen(yyvsp[-1].c)+1)*sizeof(char)) ;
      strcpy(yyval.c, yyvsp[-3].c) ;  
      strcat(yyval.c, yyvsp[-1].c) ;
      Free(yyvsp[-3].c);
      Free(yyvsp[-1].c);
    ;
    break;}
#line 2714 "Gmsh.y"
{
      yyval.c = (char *)Malloc((strlen(yyvsp[-1].c)+1)*sizeof(char)) ;
      for(i=strlen(yyvsp[-1].c)-1; i>=0; i--){
	if(yyvsp[-1].c[i] == '.'){
	  strncpy(yyval.c,yyvsp[-1].c,i);
	  yyval.c[i]='\0';
	  break;
	}
      }
      if(i<=0) strcpy(yyval.c,yyvsp[-1].c);
      Free(yyvsp[-1].c);
    ;
    break;}
#line 2727 "Gmsh.y"
{
      yyval.c = yyvsp[-1].c;
    ;
    break;}
#line 2731 "Gmsh.y"
      i = PrintListOfDouble(yyvsp[-3].c,yyvsp[-1].l,tmpstring);
      if(i<0){
	vyyerror("Too few arguments in Sprintf");
	yyval.c = yyvsp[-3].c;
      }
      else if(i>0){
	vyyerror("Too many arguments (%d) in Sprintf", i);
	yyval.c = yyvsp[-3].c;
      }
      else{
	yyval.c = (char*)Malloc((strlen(tmpstring)+1)*sizeof(char));
	strcpy(yyval.c, tmpstring);
	Free(yyvsp[-3].c);
      List_Delete(yyvsp[-1].l);
#line 2749 "Gmsh.y"
{ 
      if(!(pStrCat = Get_StringOptionCategory(yyvsp[-3].c)))
	vyyerror("Unknown string option class '%s'", yyvsp[-3].c);
      else{
	if(!(pStrOpt = (char *(*) (int, int, char *))Get_StringOption(yyvsp[-1].c, pStrCat)))
	  vyyerror("Unknown string option '%s.%s'", yyvsp[-3].c, yyvsp[-1].c);
	else{
	  str = pStrOpt(0,GMSH_GET,NULL) ;
	  yyval.c = (char*)Malloc((strlen(str)+1)*sizeof(char));
	  strcpy(yyval.c, str);
	}
      }
    ;
    break;}
#line 2763 "Gmsh.y"
{ 
      if(!(pStrCat = Get_StringOptionCategory(yyvsp[-6].c)))
	vyyerror("Unknown string option class '%s'", yyvsp[-6].c);
      else{
	if(!(pStrOpt = (char *(*) (int, int, char *))Get_StringOption(yyvsp[-1].c, pStrCat)))
	  vyyerror("Unknown string option '%s[%d].%s'", yyvsp[-6].c, (int)yyvsp[-4].d, yyvsp[-1].c);
	else{
	  str = pStrOpt((int)yyvsp[-4].d,GMSH_GET,NULL) ;
	  yyval.c = (char*)Malloc((strlen(str)+1)*sizeof(char));
	  strcpy(yyval.c, str);
	}
      }
Christophe Geuzaine's avatar
Christophe Geuzaine committed

#line 705 "/usr/share/bison/bison.simple"

Christophe Geuzaine's avatar
Christophe Geuzaine committed
#if YYLSP_NEEDED
Christophe Geuzaine's avatar
Christophe Geuzaine committed
#if YYDEBUG
Christophe Geuzaine's avatar
Christophe Geuzaine committed
      short *yyssp1 = yyss - 1;
      YYFPRINTF (stderr, "state stack now");
      while (yyssp1 != yyssp)
	YYFPRINTF (stderr, " %d", *++yyssp1);
      YYFPRINTF (stderr, "\n");
Christophe Geuzaine's avatar
Christophe Geuzaine committed
#if YYLSP_NEEDED
  *++yylsp = yyloc;
Christophe Geuzaine's avatar
Christophe Geuzaine committed
  /* Now `shift' the result of the reduction.  Determine what state
     that goes to, based on the state we popped back to and the rule
     number reduced by.  */

  yyn = yyr1[yyn];

  yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
  if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
    yystate = yytable[yystate];
  else
    yystate = yydefgoto[yyn - YYNTBASE];

  goto yynewstate;


Christophe Geuzaine's avatar
Christophe Geuzaine committed
/*------------------------------------.
| yyerrlab -- here on detecting error |
`------------------------------------*/
yyerrlab:
  /* If not already recovering from an error, report this error.  */
  if (!yyerrstatus)
    {
      ++yynerrs;

#ifdef YYERROR_VERBOSE
      yyn = yypact[yystate];

      if (yyn > YYFLAG && yyn < YYLAST)
	{
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	  YYSIZE_T yysize = 0;
	  char *yymsg;
	  int yyx, yycount;

	  yycount = 0;
	  /* Start YYX at -YYN if negative to avoid negative indexes in
	     YYCHECK.  */
	  for (yyx = yyn < 0 ? -yyn : 0;
	       yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
	    if (yycheck[yyx + yyn] == yyx)
	      yysize += yystrlen (yytname[yyx]) + 15, yycount++;
	  yysize += yystrlen ("parse error, unexpected ") + 1;
	  yysize += yystrlen (yytname[YYTRANSLATE (yychar)]);
	  yymsg = (char *) YYSTACK_ALLOC (yysize);
	  if (yymsg != 0)
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	      char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
	      yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]);
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	      if (yycount < 5)
Christophe Geuzaine's avatar
Christophe Geuzaine committed
		  yycount = 0;
		  for (yyx = yyn < 0 ? -yyn : 0;
		       yyx < (int) (sizeof (yytname) / sizeof (char *));
		       yyx++)
		    if (yycheck[yyx + yyn] == yyx)
Christophe Geuzaine's avatar
Christophe Geuzaine committed
			const char *yyq = ! yycount ? ", expecting " : " or ";
			yyp = yystpcpy (yyp, yyq);
			yyp = yystpcpy (yyp, yytname[yyx]);
			yycount++;
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	      yyerror (yymsg);
	      YYSTACK_FREE (yymsg);
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	    yyerror ("parse error; also virtual memory exhausted");
Christophe Geuzaine's avatar
Christophe Geuzaine committed
#endif /* defined (YYERROR_VERBOSE) */
	yyerror ("parse error");
Christophe Geuzaine's avatar
Christophe Geuzaine committed

/*--------------------------------------------------.
| yyerrlab1 -- error raised explicitly by an action |
`--------------------------------------------------*/
yyerrlab1:
Christophe Geuzaine's avatar
Christophe Geuzaine committed
      /* If just tried and failed to reuse lookahead token after an
	 error, discard it.  */

      /* return failure if at end of input */
      if (yychar == YYEOF)
	YYABORT;
Christophe Geuzaine's avatar
Christophe Geuzaine committed
      YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
		  yychar, yytname[yychar1]));
Christophe Geuzaine's avatar
Christophe Geuzaine committed
  /* Else will try to reuse lookahead token after shifting the error
     token.  */

  yyerrstatus = 3;		/* Each real token shifted decrements this */

  goto yyerrhandle;


Christophe Geuzaine's avatar
Christophe Geuzaine committed
/*-------------------------------------------------------------------.
| yyerrdefault -- current state does not do anything special for the |
| error token.                                                       |
`-------------------------------------------------------------------*/
yyerrdefault:
#if 0
  /* This is wrong; only states that explicitly want error tokens
     should shift them.  */
Christophe Geuzaine's avatar
Christophe Geuzaine committed

  /* If its default is to accept any token, ok.  Otherwise pop it.  */
  yyn = yydefact[yystate];
  if (yyn)
    goto yydefault;
Christophe Geuzaine's avatar
Christophe Geuzaine committed
/*---------------------------------------------------------------.
| yyerrpop -- pop the current state because it cannot handle the |
| error token                                                    |
`---------------------------------------------------------------*/
yyerrpop:
  if (yyssp == yyss)
    YYABORT;
Christophe Geuzaine's avatar
Christophe Geuzaine committed
#if YYLSP_NEEDED
Christophe Geuzaine's avatar
Christophe Geuzaine committed
#if YYDEBUG
Christophe Geuzaine's avatar
Christophe Geuzaine committed
      short *yyssp1 = yyss - 1;
      YYFPRINTF (stderr, "Error: state stack now");
      while (yyssp1 != yyssp)
	YYFPRINTF (stderr, " %d", *++yyssp1);
      YYFPRINTF (stderr, "\n");
Christophe Geuzaine's avatar
Christophe Geuzaine committed
/*--------------.
| yyerrhandle.  |
`--------------*/
yyerrhandle:
  yyn = yypact[yystate];
  if (yyn == YYFLAG)
    goto yyerrdefault;

  yyn += YYTERROR;
  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
    goto yyerrdefault;

  yyn = yytable[yyn];
  if (yyn < 0)
    {
      if (yyn == YYFLAG)
	goto yyerrpop;
      yyn = -yyn;
      goto yyreduce;
    }
  else if (yyn == 0)
    goto yyerrpop;

  if (yyn == YYFINAL)
    YYACCEPT;

Christophe Geuzaine's avatar
Christophe Geuzaine committed
  YYDPRINTF ((stderr, "Shifting error token, "));
Christophe Geuzaine's avatar
Christophe Geuzaine committed
#if YYLSP_NEEDED
  *++yylsp = yylloc;
#endif

  yystate = yyn;
  goto yynewstate;
Christophe Geuzaine's avatar
Christophe Geuzaine committed
/*-------------------------------------.
| yyacceptlab -- YYACCEPT comes here.  |
`-------------------------------------*/
yyacceptlab:
  yyresult = 0;
  goto yyreturn;

/*-----------------------------------.
| yyabortlab -- YYABORT comes here.  |
`-----------------------------------*/
yyabortlab:
  yyresult = 1;
  goto yyreturn;

/*---------------------------------------------.
| yyoverflowab -- parser overflow comes here.  |
`---------------------------------------------*/
yyoverflowlab:
  yyerror ("parser stack overflow");
  yyresult = 2;
  /* Fall through.  */

yyreturn:
#ifndef yyoverflow
  if (yyss != yyssa)
    YYSTACK_FREE (yyss);
Christophe Geuzaine's avatar
Christophe Geuzaine committed
  return yyresult;
#line 2778 "Gmsh.y"
  if(!Symbol_L)
    Symbol_L = List_Create(50,10,sizeof(Symbol));
  else
    List_Reset(Symbol_L);
  int i;
  for(i = 0 ; i < List_Nbr(Symbol_L) ; i++)
    List_Delete(((Symbol*)List_Pointer_Fast(Symbol_L,i))->val);
  List_Delete(Symbol_L);
}

int CompareSymbols (const void *a, const void *b){
  return(strcmp(((Symbol*)a)->Name,((Symbol*)b)->Name));
}

int PrintListOfDouble(char *format, List_T *list, char *buffer){
  int i, j, k;
  char tmp1[256], tmp2[256];

  j=0;
  while(format[j]!='%') j++;
  strncpy(buffer, format, j); 
  buffer[j]='\0'; 
  for(i = 0 ; i<List_Nbr(list) ; i++){
    k = j;
    j++;
    if(j<(int)strlen(format)){
      if(format[j]=='%'){
	strcat(buffer, "%");
	j++;
      }
      while(format[j]!='%' && j<(int)strlen(format)) j++;
      if(k != j){
	strncpy(tmp1, &(format[k]),j-k);
	tmp1[j-k]='\0';
	sprintf(tmp2, tmp1, *(double*)List_Pointer(list,i)); 
	strcat(buffer, tmp2);
      }
    }
    else{
      return List_Nbr(list)-i;
      break ;
    }
  }
  if(j != (int)strlen(format))
    return -1;
  return 0;
}
  
void yyerror(char *s){
  Msg(PARSER_ERROR, "'%s', line %d : %s (%s)",yyname,yylineno-1,s,yytext);
  yyerrorstate=1;
}

Christophe Geuzaine's avatar
Christophe Geuzaine committed
void vyyerror(char *fmt, ...){
Christophe Geuzaine's avatar
Christophe Geuzaine committed
  char tmp[1024];

  va_start (args, fmt);
  vsprintf (tmp, fmt, args);
  va_end (args);

  Msg(PARSER_ERROR, "'%s', line %d : %s", yyname, yylineno-1, tmp);
  yyerrorstate=1;
}