Skip to content
Snippets Groups Projects
Gmsh.tab.cpp 449 KiB
Newer Older
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;}
    break;

  case 456:
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#line 3788 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      yyval.l = List_Create(2, 1, sizeof(double));
      Symbol TheSymbol;
      TheSymbol.Name = yyvsp[-2].c;
      Symbol *pSymbol;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(!(pSymbol = (Symbol*)Tree_PQuery(Symbol_T, &TheSymbol))) {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	yymsg(GERROR, "Unknown variable '%s'", yyvsp[-2].c);
	double d = 0.0;
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	List_Add(yyval.l, &d);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	for(int i = 0; i < List_Nbr(pSymbol->val); i++){
	  double d = - *(double*)List_Pointer_Fast(pSymbol->val, i);
	  List_Add(yyval.l, &d);
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	}
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;}
    break;

  case 457:
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#line 3806 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      yyval.l = List_Create(2, 1, sizeof(double));
      Symbol TheSymbol;
      TheSymbol.Name = yyvsp[-5].c;
      Symbol *pSymbol;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(!(pSymbol = (Symbol*)Tree_PQuery(Symbol_T, &TheSymbol))) {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	yymsg(GERROR, "Unknown variable '%s'", yyvsp[-5].c);
	double d = 0.0;
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	List_Add(yyval.l, &d);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	for(int i = 0; i < List_Nbr(yyvsp[-2].l); i++){
	  int j = (int)(*(double*)List_Pointer_Fast(yyvsp[-2].l, i));
	  double *pd;
	  if((pd = (double*)List_Pointer_Test(pSymbol->val, j)))
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	    List_Add(yyval.l, pd);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	    yymsg(GERROR, "Uninitialized variable '%s[%d]'", yyvsp[-5].c, j);	  
      List_Delete(yyvsp[-2].l);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;}
    break;

  case 458:
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#line 3829 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      yyval.l = List_Create(2, 1, sizeof(double));
      Symbol TheSymbol;
      TheSymbol.Name = yyvsp[-5].c;
      Symbol *pSymbol;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(!(pSymbol = (Symbol*)Tree_PQuery(Symbol_T, &TheSymbol))) {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	yymsg(GERROR, "Unknown variable '%s'", yyvsp[-5].c);
	double d = 0.0;
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	List_Add(yyval.l, &d);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	for(int i = 0; i < List_Nbr(yyvsp[-2].l); i++){
	  int j = (int)(*(double*)List_Pointer_Fast(yyvsp[-2].l, i));
	  double *pd;
	  if((pd = (double*)List_Pointer_Test(pSymbol->val, j))){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	    double d = - *pd;
	    List_Add(yyval.l, &d);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	    yymsg(GERROR, "Uninitialized variable '%s[%d]'", yyvsp[-5].c, j);	  
	}
      }
      List_Delete(yyvsp[-2].l);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;}
    break;

  case 459:
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#line 3857 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      yyval.l = List_Create(2, 1, sizeof(double));
      List_Add(yyval.l, &(yyvsp[0].d));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;}
    break;

  case 460:
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#line 3862 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      yyval.l = yyvsp[0].l;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;}
    break;

  case 461:
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#line 3866 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      List_Add(yyval.l, &(yyvsp[0].d));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;}
    break;

  case 462:
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#line 3870 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      for(int i = 0; i < List_Nbr(yyvsp[0].l); i++){
	double d;
	List_Read(yyvsp[0].l, i, &d);
	List_Add(yyval.l, &d);
      List_Delete(yyvsp[0].l);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;}
    break;

  case 463:
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#line 3883 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      yyval.u = PACK_COLOR((int)yyvsp[-7].d, (int)yyvsp[-5].d, (int)yyvsp[-3].d, (int)yyvsp[-1].d);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;}
    break;

  case 464:
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#line 3887 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      yyval.u = PACK_COLOR((int)yyvsp[-5].d, (int)yyvsp[-3].d, (int)yyvsp[-1].d, 255);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;}
    break;

  case 465:
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#line 3899 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      int flag;
      yyval.u = Get_ColorForString(ColorString, -1, yyvsp[0].c, &flag);
      if(flag) yymsg(GERROR, "Unknown color '%s'", yyvsp[0].c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;}
    break;

  case 466:
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#line 3905 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      unsigned int (*pColOpt)(int num, int action, unsigned int value);
      StringXColor *pColCat;
      if(!(pColCat = Get_ColorOptionCategory(yyvsp[-4].c))){
	yymsg(GERROR, "Unknown color option class '%s'", yyvsp[-4].c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	yyval.u = 0;
	if(!(pColOpt =  (unsigned int (*) (int, int, unsigned int))Get_ColorOption(yyvsp[0].c, pColCat))){
	  yymsg(GERROR, "Unknown color option '%s.Color.%s'", yyvsp[-4].c, yyvsp[0].c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  yyval.u = 0;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  yyval.u = pColOpt(0, GMSH_GET, 0);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;}
    break;

  case 467:
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#line 3926 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      yyval.l = yyvsp[-1].l;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;}
    break;

  case 468:
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#line 3930 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      yyval.l = List_Create(256, 10, sizeof(unsigned int));
      GmshColorTable *ct = Get_ColorTable((int)yyvsp[-3].d);
	yymsg(GERROR, "View[%d] does not exist", (int)yyvsp[-3].d);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	for(int i = 0; i < ct->size; i++) 
	  List_Add(yyval.l, &ct->table[i]);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;}
    break;

  case 469:
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#line 3944 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      yyval.l = List_Create(256, 10, sizeof(unsigned int));
      List_Add(yyval.l, &(yyvsp[0].u));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;}
    break;

  case 470:
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#line 3949 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
Jean-François Remacle's avatar
 
Jean-François Remacle committed
      List_Add(yyval.l, &(yyvsp[0].u));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;}
    break;

  case 471:
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#line 3956 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      yyval.c = yyvsp[0].c;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;}
    break;

  case 472:
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#line 3960 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      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);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;}
    break;

  case 473:
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#line 3968 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      yyval.c = (char *)Malloc((strlen(yyvsp[-1].c)+1)*sizeof(char));
      int i;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      for(i = strlen(yyvsp[-1].c)-1; i >= 0; i--){
	if(yyvsp[-1].c[i] == '.'){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  strncpy(yyval.c, yyvsp[-1].c, i);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(i <= 0) strcpy(yyval.c, yyvsp[-1].c);
      Free(yyvsp[-1].c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;}
    break;

  case 474:
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#line 3982 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      yyval.c = yyvsp[-1].c;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;}
    break;

  case 475:
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#line 3986 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      char tmpstring[1024];
      int i = PrintListOfDouble(yyvsp[-3].c, yyvsp[-1].l, tmpstring);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(i < 0){
	yymsg(GERROR, "Too few arguments in Sprintf");
	yyval.c = yyvsp[-3].c;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      else if(i > 0){
	yymsg(GERROR, "%d extra argument%s in Sprintf", i, (i>1)?"s":"");
	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);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;}
    break;

  case 476:
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#line 4005 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    { 
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      char* (*pStrOpt)(int num, int action, char *value);
      StringXString *pStrCat;
      if(!(pStrCat = Get_StringOptionCategory(yyvsp[-3].c)))
	yymsg(GERROR, "Unknown string option class '%s'", yyvsp[-3].c);
      else{
	if(!(pStrOpt = (char *(*) (int, int, char *))Get_StringOption(yyvsp[-1].c, pStrCat)))
	  yymsg(GERROR, "Unknown string option '%s.%s'", yyvsp[-3].c, yyvsp[-1].c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  char *str = pStrOpt(0, GMSH_GET, NULL);
	  yyval.c = (char*)Malloc((strlen(str)+1)*sizeof(char));
	  strcpy(yyval.c, str);
	}
      }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;}
    break;

  case 477:
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#line 4021 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    { 
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      char* (*pStrOpt)(int num, int action, char *value);
      StringXString *pStrCat;
      if(!(pStrCat = Get_StringOptionCategory(yyvsp[-6].c)))
	yymsg(GERROR, "Unknown string option class '%s'", yyvsp[-6].c);
      else{
	if(!(pStrOpt = (char *(*) (int, int, char *))Get_StringOption(yyvsp[-1].c, pStrCat)))
	  yymsg(GERROR, "Unknown string option '%s[%d].%s'", yyvsp[-6].c, (int)yyvsp[-4].d, yyvsp[-1].c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  char *str = pStrOpt((int)yyvsp[-4].d, GMSH_GET, NULL);
	  yyval.c = (char*)Malloc((strlen(str)+1)*sizeof(char));
	  strcpy(yyval.c, str);
	}
      }
/* Line 991 of yacc.c.  */
#line 10300 "Gmsh.tab.cpp"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

  YY_STACK_PRINT (yyss, yyssp);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

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.  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    yystate = yydefgoto[yyn - YYNTOKENS];
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)
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#if YYERROR_VERBOSE
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if (YYPACT_NINF < yyn && yyn < YYLAST)
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  YYSIZE_T yysize = 0;
	  int yytype = YYTRANSLATE (yychar);
	  char *yymsg;
	  int yyx, yycount;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

	  yycount = 0;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  /* 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++)
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	    if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
	      yysize += yystrlen (yytname[yyx]) + 15, yycount++;
	  yysize += yystrlen ("syntax error, unexpected ") + 1;
	  yysize += yystrlen (yytname[yytype]);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  yymsg = (char *) YYSTACK_ALLOC (yysize);
	  if (yymsg != 0)
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	      char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
	      yyp = yystpcpy (yyp, yytname[yytype]);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	      if (yycount < 5)
		  yycount = 0;
		  for (yyx = yyn < 0 ? -yyn : 0;
		       yyx < (int) (sizeof (yytname) / sizeof (char *));
		       yyx++)
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
		    if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
			const char *yyq = ! yycount ? ", expecting " : " or ";
			yyp = yystpcpy (yyp, yyq);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
			yyp = yystpcpy (yyp, yytname[yyx]);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	      yyerror (yymsg);
	      YYSTACK_FREE (yymsg);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	    yyerror ("syntax error; also virtual memory exhausted");
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#endif /* YYERROR_VERBOSE */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	yyerror ("syntax error");
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

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)
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
        {
	  /* Pop the error token.  */
          YYPOPSTACK;
	  /* Pop the rest of the stack.  */
	  while (yyss < yyssp)
	    {
	      YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
	      yydestruct (yystos[*yyssp], yyvsp);
	      YYPOPSTACK;
	    }
	  YYABORT;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
        }
      YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
      yydestruct (yytoken, &yylval);
      yychar = YYEMPTY;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
  /* Else will try to reuse lookahead token after shifting the error
     token.  */
  goto yyerrlab2;
/*----------------------------------------------------.
| yyerrlab1 -- error raised explicitly by an action.  |
`----------------------------------------------------*/
yyerrlab1:
  /* Suppress GCC warning that yyerrlab1 is unused when no action
     invokes YYERROR.  */
#if defined (__GNUC_MINOR__) && 2093 <= (__GNUC__ * 1000 + __GNUC_MINOR__) \
    && !defined __cplusplus
  __attribute__ ((__unused__))
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#endif


  goto yyerrlab2;

/*---------------------------------------------------------------.
| yyerrlab2 -- pop states until the error token can be shifted.  |
`---------------------------------------------------------------*/
yyerrlab2:
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
  yyerrstatus = 3;	/* Each real token shifted decrements this.  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
  for (;;)
    {
      yyn = yypact[yystate];
      if (yyn != YYPACT_NINF)
	{
	  yyn += YYTERROR;
	  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
	    {
	      yyn = yytable[yyn];
	      if (0 < yyn)
		break;
	    }
	}
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      /* Pop the current state because it cannot handle the error token.  */
      if (yyssp == yyss)
	YYABORT;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
      yydestruct (yystos[yystate], yyvsp);
      yyvsp--;
      yystate = *--yyssp;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      YY_STACK_PRINT (yyss, yyssp);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
  YYDPRINTF ((stderr, "Shifting error token, "));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

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;

#ifndef yyoverflow
/*----------------------------------------------.
| yyoverflowlab -- parser overflow comes here.  |
`----------------------------------------------*/
yyoverflowlab:
  yyerror ("parser stack overflow");
  yyresult = 2;
  /* Fall through.  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#endif
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
yyreturn:
#ifndef yyoverflow
  if (yyss != yyssa)
    YYSTACK_FREE (yyss);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
  return yyresult;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed


Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#line 4038 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
void DeleteSymbol(void *a, void *b){
  Symbol *s = (Symbol*)a;
  Free(s->Name);
  List_Delete(s->val);
}

int CompareSymbols (const void *a, const void *b){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
  return(strcmp(((Symbol*)a)->Name, ((Symbol*)b)->Name));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
void InitSymbols(void){
  if(Symbol_T){
    Tree_Action(Symbol_T, DeleteSymbol);
    Tree_Delete(Symbol_T);
  }
  Symbol_T = Tree_Create(sizeof(Symbol), CompareSymbols);
}

int PrintListOfDouble(char *format, List_T *list, char *buffer){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
  int j, k;
  char tmp1[256], tmp2[256];

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
  j = 0;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
  buffer[j] = '\0';

  while(j < (int)strlen(format) && format[j] != '%') j++;
  strncpy(buffer, format, j); 
  buffer[j]='\0'; 
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
  for(int i = 0; i < List_Nbr(list); i++){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    if(j < (int)strlen(format)){
      if(format[j] == '%'){
	strcat(buffer, "%");
	j++;
      }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      while(j < (int)strlen(format) && format[j] != '%') j++;
      if(k != j){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	strncpy(tmp1, &(format[k]), j-k);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	tmp1[j-k] = '\0';
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	sprintf(tmp2, tmp1, *(double*)List_Pointer(list, i)); 
	strcat(buffer, tmp2);
      }
    }
    else{
      return List_Nbr(list)-i;
    }
  }
  if(j != (int)strlen(format))
    return -1;
  return 0;
}
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
int CheckViewErrorFlags(Post_View *v){
  if(View->adaptive) return 0; // hope for the best :-)

  char *name[8] = { "point", "line", "triangle", "quadrangle", 
		    "tetrahedron", "hexahedron", "prism", "pyramid" };
  char *type[3] = { "scalar", "vector", "tensor" };

  if(8 * 3 != VIEW_NB_ELEMENT_TYPES){
    Msg(GERROR, "Please upgrade CheckViewErrorFlags!");
    return 0;
  }
  
  for(int i = 0; i < VIEW_NB_ELEMENT_TYPES; i++)
    if(ViewErrorFlags[i])
      Msg(GERROR, "%d %s %s%s in View[%d] contain%s a wrong number of values",
	  ViewErrorFlags[i], type[i%3], name[i/3], (ViewErrorFlags[i] > 1) ? "s" : "",
	  v->Index, (ViewErrorFlags[i] > 1) ? "" : "s");
  
  return 0;
}

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
  Msg(GERROR, "'%s', line %d : %s (%s)", yyname, yylineno-1, s, yytext);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
  yyerrorstate++;
Christophe Geuzaine's avatar
Christophe Geuzaine committed
  char tmp[1024];

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

  Msg(type, "'%s', line %d : %s", yyname, yylineno-1, tmp);

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
  if(type == GERROR) yyerrorstate++;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed