Skip to content
Snippets Groups Projects
Gmsh.tab.cpp 300 KiB
Newer Older
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strcmp(yyvsp[0].c, "TH")){
	ViewElementIdx = 17; ViewNumNodes = 8; ViewNumComp = 9;
	ViewValueList = View->TH; ViewNumList = &View->NbTH;
      }
      else if(!strcmp(yyvsp[0].c, "SI")){
	ViewElementIdx = 18; ViewNumNodes = 6; ViewNumComp = 1;
	ViewValueList = View->SI; ViewNumList = &View->NbSI;
      }
      else if(!strcmp(yyvsp[0].c, "VI")){
	ViewElementIdx = 19; ViewNumNodes = 6; ViewNumComp = 3;
	ViewValueList = View->VI; ViewNumList = &View->NbVI;
      }
      else if(!strcmp(yyvsp[0].c, "TI")){
	ViewElementIdx = 20; ViewNumNodes = 6; ViewNumComp = 9;
	ViewValueList = View->TI; ViewNumList = &View->NbTI;
      }
      else if(!strcmp(yyvsp[0].c, "SY")){
	ViewElementIdx = 21; ViewNumNodes = 5; ViewNumComp = 1;
	ViewValueList = View->SY; ViewNumList = &View->NbSY;
      }
      else if(!strcmp(yyvsp[0].c, "VY")){
	ViewElementIdx = 22; ViewNumNodes = 5; ViewNumComp = 3;
	ViewValueList = View->VY; ViewNumList = &View->NbVY;
      }
      else if(!strcmp(yyvsp[0].c, "TY")){
	ViewElementIdx = 23; ViewNumNodes = 5; ViewNumComp = 9;
	ViewValueList = View->TY; ViewNumList = &View->NbTY;
      }
      else if(!strcmp(yyvsp[0].c, "SL2")){
	ViewElementIdx = 3; ViewNumNodes = 3; ViewNumComp = 1;
	ViewValueList = View->SL2; ViewNumList = &View->NbSL2;
      }
      else if(!strcmp(yyvsp[0].c, "VL2")){
	ViewElementIdx = 4; ViewNumNodes = 3; ViewNumComp = 3;
	ViewValueList = View->VL2; ViewNumList = &View->NbVL2;
      }
      else if(!strcmp(yyvsp[0].c, "TL2")){
	ViewElementIdx = 5; ViewNumNodes = 3; ViewNumComp = 9;
	ViewValueList = View->TL2; ViewNumList = &View->NbTL2;
      }
      else if(!strcmp(yyvsp[0].c, "ST2")){
	ViewElementIdx = 6; ViewNumNodes = 6; ViewNumComp = 1;
	ViewValueList = View->ST2; ViewNumList = &View->NbST2;
      }
      else if(!strcmp(yyvsp[0].c, "VT2")){
	ViewElementIdx = 7; ViewNumNodes = 6; ViewNumComp = 3;
	ViewValueList = View->VT2; ViewNumList = &View->NbVT2;
      }
      else if(!strcmp(yyvsp[0].c, "TT2")){
	ViewElementIdx = 8; ViewNumNodes = 6; ViewNumComp = 9;
	ViewValueList = View->TT2; ViewNumList = &View->NbTT2;
      }
      else if(!strcmp(yyvsp[0].c, "SQ2")){
	ViewElementIdx = 9; ViewNumNodes = 9; ViewNumComp = 1;
	ViewValueList = View->SQ2; ViewNumList = &View->NbSQ2;
      }
      else if(!strcmp(yyvsp[0].c, "VQ2")){
	ViewElementIdx = 10; ViewNumNodes = 9; ViewNumComp = 3;
	ViewValueList = View->VQ2; ViewNumList = &View->NbVQ2;
      }
      else if(!strcmp(yyvsp[0].c, "TQ2")){
	ViewElementIdx = 11; ViewNumNodes = 9; ViewNumComp = 9;
	ViewValueList = View->TQ2; ViewNumList = &View->NbTQ2;
      }
      else if(!strcmp(yyvsp[0].c, "SS2")){
	ViewElementIdx = 12; ViewNumNodes = 10; ViewNumComp = 1;
	ViewValueList = View->SS2; ViewNumList = &View->NbSS2;
      }
      else if(!strcmp(yyvsp[0].c, "VS2")){
	ViewElementIdx = 13; ViewNumNodes = 10; ViewNumComp = 3;
	ViewValueList = View->VS2; ViewNumList = &View->NbVS2;
      }
      else if(!strcmp(yyvsp[0].c, "TS2")){
	ViewElementIdx = 14; ViewNumNodes = 10; ViewNumComp = 9;
	ViewValueList = View->TS2; ViewNumList = &View->NbTS2;
      }
      else if(!strcmp(yyvsp[0].c, "SH2")){
	ViewElementIdx = 15; ViewNumNodes = 27; ViewNumComp = 1;
	ViewValueList = View->SH2; ViewNumList = &View->NbSH2;
      }
      else if(!strcmp(yyvsp[0].c, "VH2")){
	ViewElementIdx = 16; ViewNumNodes = 27; ViewNumComp = 3;
	ViewValueList = View->VH2; ViewNumList = &View->NbVH2;
      }
      else if(!strcmp(yyvsp[0].c, "TH2")){
	ViewElementIdx = 17; ViewNumNodes = 27; ViewNumComp = 9;
	ViewValueList = View->TH2; ViewNumList = &View->NbTH2;
      }
      else if(!strcmp(yyvsp[0].c, "SI2")){
	ViewElementIdx = 18; ViewNumNodes = 18; ViewNumComp = 1;
	ViewValueList = View->SI2; ViewNumList = &View->NbSI2;
      }
      else if(!strcmp(yyvsp[0].c, "VI2")){
	ViewElementIdx = 19; ViewNumNodes = 18; ViewNumComp = 3;
	ViewValueList = View->VI2; ViewNumList = &View->NbVI2;
      }
      else if(!strcmp(yyvsp[0].c, "TI2")){
	ViewElementIdx = 20; ViewNumNodes = 18; ViewNumComp = 9;
	ViewValueList = View->TI2; ViewNumList = &View->NbTI2;
      }
      else if(!strcmp(yyvsp[0].c, "SY2")){
	ViewElementIdx = 21; ViewNumNodes = 14; ViewNumComp = 1;
	ViewValueList = View->SY2; ViewNumList = &View->NbSY2;
      }
      else if(!strcmp(yyvsp[0].c, "VY2")){
	ViewElementIdx = 22; ViewNumNodes = 14; ViewNumComp = 3;
	ViewValueList = View->VY2; ViewNumList = &View->NbVY2;
      }
      else if(!strcmp(yyvsp[0].c, "TY2")){
	ViewElementIdx = 23; ViewNumNodes = 14; ViewNumComp = 9;
	ViewValueList = View->TY2; ViewNumList = &View->NbTY2;
      }
      else{
	yymsg(GERROR, "Unknown element type '%s'", yyvsp[0].c);	
	ViewElementIdx = -1; ViewNumNodes = 0; ViewNumComp = 0;
	ViewValueList = NULL; ViewNumList = NULL;
      }
      Free(yyvsp[0].c);
      ViewCoordIdx = 0;
#line 625 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(ViewValueList){
	if(ViewCoordIdx != 3 * ViewNumNodes){
	  yymsg(GERROR, "Wrong number of node coordinates (%d != %d)", 
		ViewCoordIdx, 3 * ViewNumNodes);
	  double d = 0;
	  for(int i = 0; i < 3 * ViewNumNodes; i++)
	    List_Add(ViewValueList, &d);
	}
	else{
	  for(int i = 0; i < 3; i++)
	    for(int j = 0; j < ViewNumNodes; j++)
	      List_Add(ViewValueList, &ViewCoord[3*j+i]);
	}
	ViewNumListTmp = List_Nbr(ViewValueList);
      }
#line 643 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(ViewValueList){  
	if((List_Nbr(ViewValueList) - ViewNumListTmp) % (ViewNumComp * ViewNumNodes)) 
	  ViewErrorFlags[ViewElementIdx]++;
	(*ViewNumList)++;
      }
#line 654 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      for(int i = 0; i < (int)strlen(yyvsp[0].c)+1; i++) List_Add(View->T2C, &yyvsp[0].c[i]); 
      Free(yyvsp[0].c);
#line 659 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      for(int i = 0; i < (int)strlen(yyvsp[0].c)+1; i++) List_Add(View->T2C, &yyvsp[0].c[i]); 
      Free(yyvsp[0].c);
#line 667 "Gmsh.y"
      List_Add(View->T2D, &yyvsp[-5].d); List_Add(View->T2D, &yyvsp[-3].d);
      List_Add(View->T2D, &yyvsp[-1].d); 
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      double d = List_Nbr(View->T2C);
      List_Add(View->T2D, &d); 
#line 674 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      View->NbT2++;
#line 681 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      for(int i = 0; i < (int)strlen(yyvsp[0].c)+1; i++) List_Add(View->T3C, &yyvsp[0].c[i]); 
      Free(yyvsp[0].c);
#line 686 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      for(int i = 0; i < (int)strlen(yyvsp[0].c)+1; i++) List_Add(View->T3C, &yyvsp[0].c[i]); 
      Free(yyvsp[0].c);
#line 694 "Gmsh.y"
      List_Add(View->T3D, &yyvsp[-7].d); List_Add(View->T3D, &yyvsp[-5].d);
      List_Add(View->T3D, &yyvsp[-3].d); List_Add(View->T3D, &yyvsp[-1].d); 
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      double d = List_Nbr(View->T3C);
      List_Add(View->T3D, &d); 
#line 701 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      View->NbT3++;
#line 709 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      View->adaptive = new Adaptive_Post_View(View, yyvsp[-5].l, yyvsp[-2].l);
#line 716 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      ViewValueList = View->Time;
#line 720 "Gmsh.y"
#line 727 "Gmsh.y"
    { yyval.i = 0; ;}
    break;

  case 93:
#line 728 "Gmsh.y"
    { yyval.i = 1; ;}
    break;

  case 94:
#line 729 "Gmsh.y"
    { yyval.i = 2; ;}
    break;

  case 95:
#line 730 "Gmsh.y"
    { yyval.i = 3; ;}
    break;

  case 96:
#line 731 "Gmsh.y"
    { yyval.i = 4; ;}
    break;

  case 97:
#line 735 "Gmsh.y"
    { yyval.i = 1; ;}
    break;

  case 98:
#line 736 "Gmsh.y"
    { yyval.i = -1; ;}
    break;

  case 99:
#line 744 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Symbol TheSymbol;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Symbol *pSymbol;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(!(pSymbol = (Symbol*)Tree_PQuery(Symbol_T, &TheSymbol))){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  TheSymbol.val = List_Create(1, 1, sizeof(double));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  Tree_Add(Symbol_T, &TheSymbol);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	else{
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  yymsg(GERROR, "Unknown variable '%s'", yyvsp[-3].c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  Free(yyvsp[-3].c);
	}
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	double *pd = (double*)List_Pointer_Fast(pSymbol->val, 0); 
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	case 0 : *pd = yyvsp[-1].d; break;
	case 1 : *pd += yyvsp[-1].d; break;
	case 2 : *pd -= yyvsp[-1].d; break;
	case 3 : *pd *= yyvsp[-1].d; break;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  if(yyvsp[-1].d) *pd /= yyvsp[-1].d; 
	  else yymsg(GERROR, "Division by zero in '%s /= %g'", yyvsp[-3].c, yyvsp[-1].d);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	Free(yyvsp[-3].c);
#line 775 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Symbol TheSymbol;
      TheSymbol.Name = yyvsp[-6].c;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Symbol *pSymbol;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(!(pSymbol = (Symbol*)Tree_PQuery(Symbol_T, &TheSymbol))){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  TheSymbol.val = List_Create(5, 5, sizeof(double));
	  List_Put(TheSymbol.val, (int)yyvsp[-4].d, &yyvsp[-1].d);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  Tree_Add(Symbol_T, &TheSymbol);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	else{
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  yymsg(GERROR, "Unknown variable '%s'", yyvsp[-6].c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  Free(yyvsp[-6].c);
	}
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	double *pd;
	if((pd = (double*)List_Pointer_Test(pSymbol->val, (int)yyvsp[-4].d))){
	  switch(yyvsp[-2].i){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  case 0 : *pd = yyvsp[-1].d; break;
	  case 1 : *pd += yyvsp[-1].d; break;
	  case 2 : *pd -= yyvsp[-1].d; break;
	  case 3 : *pd *= yyvsp[-1].d; break;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	    if(yyvsp[-1].d) *pd /= yyvsp[-1].d; 
	    else yymsg(GERROR, "Division by zero in '%s[%d] /= %g'", yyvsp[-6].c, (int)yyvsp[-4].d, yyvsp[-1].d);
	    break;
	  }
	}
	else{
	  if(!yyvsp[-2].i)
	    List_Put(pSymbol->val, (int)yyvsp[-4].d, &yyvsp[-1].d);
	  else
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	    yymsg(GERROR, "Uninitialized variable '%s[%d]'", yyvsp[-6].c, (int)yyvsp[-4].d);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	Free(yyvsp[-6].c);
#line 814 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(List_Nbr(yyvsp[-5].l) != List_Nbr(yyvsp[-1].l)){
	yymsg(GERROR, "Incompatible array dimensions in affectation");
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	Free(yyvsp[-8].c);
      }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	Symbol TheSymbol;
	TheSymbol.Name = yyvsp[-8].c;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	Symbol *pSymbol;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	if(!(pSymbol = (Symbol*)Tree_PQuery(Symbol_T, &TheSymbol))){
	  if(!yyvsp[-2].i){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	    TheSymbol.val = List_Create(5, 5, sizeof(double));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	    for(int i = 0; i < List_Nbr(yyvsp[-5].l); i++){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	      List_Put(TheSymbol.val, (int)(*(double*)List_Pointer(yyvsp[-5].l, i)),
		       (double*)List_Pointer(yyvsp[-1].l, i));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	    Tree_Add(Symbol_T, &TheSymbol);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  else{
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	    yymsg(GERROR, "Unknown variable '%s'", yyvsp[-8].c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	    Free(yyvsp[-8].c);
	  }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  for(int i = 0; i < List_Nbr(yyvsp[-5].l); i++){
	    int j = (int)(*(double*)List_Pointer(yyvsp[-5].l, i));
	    double d = *(double*)List_Pointer(yyvsp[-1].l, i);
	    double *pd;
	    if((pd = (double*)List_Pointer_Test(pSymbol->val, j))){
	      switch(yyvsp[-2].i){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	      case 0 : *pd = d; break;
	      case 1 : *pd += d; break;
	      case 2 : *pd -= d; break;
	      case 3 : *pd *= d; break;
	      case 4 : 
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
		if(yyvsp[-1].l) *pd /= d; 
		else yymsg(GERROR, "Division by zero in '%s[%d] /= %g'", yyvsp[-8].c, j, d);
		break;
	      }
	    }
	    else{
	      if(!yyvsp[-2].i)
		List_Put(pSymbol->val, j, &d);
	      else
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
		yymsg(GERROR, "Uninitialized variable '%s[%d]'", yyvsp[-8].c, j);	  
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  Free(yyvsp[-8].c);
	}
      }
      List_Delete(yyvsp[-5].l);
      List_Delete(yyvsp[-1].l);
#line 868 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Symbol TheSymbol;
      TheSymbol.Name = yyvsp[-5].c;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Symbol *pSymbol;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(!(pSymbol = (Symbol*)Tree_PQuery(Symbol_T, &TheSymbol))){
	TheSymbol.val = List_Create(5, 5, sizeof(double));
	List_Copy(yyvsp[-1].l, TheSymbol.val);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	Tree_Add(Symbol_T, &TheSymbol);
      }
      else{
	List_Reset(pSymbol->val);
	List_Copy(yyvsp[-1].l, pSymbol->val);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	Free(yyvsp[-5].c);
      List_Delete(yyvsp[-1].l);
#line 885 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Symbol TheSymbol;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      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); 
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	*(double*)List_Pointer_Fast(pSymbol->val, 0) += yyvsp[-1].i;
      Free(yyvsp[-2].c);
#line 896 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      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); 
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	double *pd;
	if((pd = (double*)List_Pointer_Test(pSymbol->val, (int)yyvsp[-3].d)))
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  *pd += yyvsp[-1].i;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  yymsg(GERROR, "Uninitialized variable '%s[%d]'", yyvsp[-5].c, (int)yyvsp[-3].d);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free(yyvsp[-5].c);
#line 915 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      char* (*pStrOpt)(int num, int action, char *value);
      StringXString *pStrCat;
      if(!(pStrCat = Get_StringOptionCategory(yyvsp[-5].c)))
	yymsg(GERROR, "Unknown string option class '%s'", yyvsp[-5].c);
	if(!(pStrOpt = (char *(*) (int, int, char *))Get_StringOption(yyvsp[-3].c, pStrCat)))
	  yymsg(GERROR, "Unknown string option '%s.%s'", yyvsp[-5].c, yyvsp[-3].c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  pStrOpt(0, GMSH_SET|GMSH_GUI, yyvsp[-1].c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free(yyvsp[-5].c); Free(yyvsp[-3].c); //FIXME: somtimes leak $5
#line 929 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      char* (*pStrOpt)(int num, int action, char *value);
      StringXString *pStrCat;
      if(!(pStrCat = Get_StringOptionCategory(yyvsp[-8].c)))
	yymsg(GERROR, "Unknown string option class '%s'", yyvsp[-8].c);
	if(!(pStrOpt = (char *(*) (int, int, char *))Get_StringOption(yyvsp[-3].c, pStrCat)))
	  yymsg(GERROR, "Unknown string option '%s[%d].%s'", yyvsp[-8].c, (int)yyvsp[-6].d, yyvsp[-3].c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  pStrOpt((int)yyvsp[-6].d, GMSH_SET|GMSH_GUI, yyvsp[-1].c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free(yyvsp[-8].c); Free(yyvsp[-3].c); //FIXME: somtimes leak $8
#line 946 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      double (*pNumOpt)(int num, int action, double value);
      StringXNumber *pNumCat;
      if(!(pNumCat = Get_NumberOptionCategory(yyvsp[-5].c)))
	yymsg(GERROR, "Unknown numeric option class '%s'", yyvsp[-5].c);
	if(!(pNumOpt = (double (*) (int, int, double))Get_NumberOption(yyvsp[-3].c, pNumCat)))
	  yymsg(GERROR, "Unknown numeric option '%s.%s'", yyvsp[-5].c, yyvsp[-3].c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  double d = 0;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  case 0 : d = yyvsp[-1].d; break;
	  case 1 : d = pNumOpt(0, GMSH_GET, 0) + yyvsp[-1].d; break;
	  case 2 : d = pNumOpt(0, GMSH_GET, 0) - yyvsp[-1].d; break;
	  case 3 : d = pNumOpt(0, GMSH_GET, 0) * yyvsp[-1].d; break;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	    if(yyvsp[-1].d) d = pNumOpt(0, GMSH_GET, 0) / yyvsp[-1].d; 
	    else yymsg(GERROR, "Division by zero in '%s.%s /= %g'", yyvsp[-5].c, yyvsp[-3].c, yyvsp[-1].d);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  pNumOpt(0, GMSH_SET|GMSH_GUI, d);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free(yyvsp[-5].c); Free(yyvsp[-3].c);
#line 972 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      double (*pNumOpt)(int num, int action, double value);
      StringXNumber *pNumCat;
      if(!(pNumCat = Get_NumberOptionCategory(yyvsp[-8].c)))
	yymsg(GERROR, "Unknown numeric option class '%s'", yyvsp[-8].c);
	if(!(pNumOpt =  (double (*) (int, int, double))Get_NumberOption(yyvsp[-3].c, pNumCat)))
	  yymsg(GERROR, "Unknown numeric option '%s[%d].%s'", yyvsp[-8].c, (int)yyvsp[-6].d, yyvsp[-3].c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  double d = 0;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  case 0 : d = yyvsp[-1].d; break;
	  case 1 : d = pNumOpt((int)yyvsp[-6].d, GMSH_GET, 0) + yyvsp[-1].d; break;
	  case 2 : d = pNumOpt((int)yyvsp[-6].d, GMSH_GET, 0) - yyvsp[-1].d; break;
	  case 3 : d = pNumOpt((int)yyvsp[-6].d, GMSH_GET, 0) * yyvsp[-1].d; break;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	    if(yyvsp[-1].d) d = pNumOpt((int)yyvsp[-6].d, GMSH_GET, 0) / yyvsp[-1].d;
	    else yymsg(GERROR, "Division by zero in '%s[%d].%s /= %g'", 
		       yyvsp[-8].c, (int)yyvsp[-6].d, yyvsp[-3].c, yyvsp[-1].d);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  pNumOpt((int)yyvsp[-6].d, GMSH_SET|GMSH_GUI, d);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free(yyvsp[-8].c); Free(yyvsp[-3].c);
#line 999 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      double (*pNumOpt)(int num, int action, double value);
      StringXNumber *pNumCat;
      if(!(pNumCat = Get_NumberOptionCategory(yyvsp[-4].c)))
	yymsg(GERROR, "Unknown numeric option class '%s'", yyvsp[-4].c);
	if(!(pNumOpt =  (double (*) (int, int, double))Get_NumberOption(yyvsp[-2].c, pNumCat)))
	  yymsg(GERROR, "Unknown numeric option '%s.%s'", yyvsp[-4].c, yyvsp[-2].c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  pNumOpt(0, GMSH_SET|GMSH_GUI, pNumOpt(0, GMSH_GET, 0)+yyvsp[-1].i);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free(yyvsp[-4].c); Free(yyvsp[-2].c);
#line 1013 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      double (*pNumOpt)(int num, int action, double value);
      StringXNumber *pNumCat;
      if(!(pNumCat = Get_NumberOptionCategory(yyvsp[-7].c)))
	yymsg(GERROR, "Unknown numeric option class '%s'", yyvsp[-7].c);
	if(!(pNumOpt =  (double (*) (int, int, double))Get_NumberOption(yyvsp[-2].c, pNumCat)))
	  yymsg(GERROR, "Unknown numeric option '%s[%d].%s'", yyvsp[-7].c, (int)yyvsp[-5].d, yyvsp[-2].c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  pNumOpt((int)yyvsp[-5].d, GMSH_SET|GMSH_GUI, pNumOpt((int)yyvsp[-5].d, GMSH_GET, 0)+yyvsp[-1].i);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free(yyvsp[-7].c); Free(yyvsp[-2].c);
#line 1030 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      unsigned int (*pColOpt)(int num, int action, unsigned int value);
      StringXColor *pColCat;
      if(!(pColCat = Get_ColorOptionCategory(yyvsp[-7].c)))
	yymsg(GERROR, "Unknown color option class '%s'", yyvsp[-7].c);
	if(!(pColOpt =  (unsigned int (*) (int, int, unsigned int))Get_ColorOption(yyvsp[-3].c, pColCat)))
	  yymsg(GERROR, "Unknown color option '%s.Color.%s'", yyvsp[-7].c, yyvsp[-3].c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  pColOpt(0, GMSH_SET|GMSH_GUI, yyvsp[-1].u);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free(yyvsp[-7].c); Free(yyvsp[-3].c);
#line 1044 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      unsigned int (*pColOpt)(int num, int action, unsigned int value);
      StringXColor *pColCat;
      if(!(pColCat = Get_ColorOptionCategory(yyvsp[-10].c)))
	yymsg(GERROR, "Unknown color option class '%s'", yyvsp[-10].c);
	if(!(pColOpt =  (unsigned int (*) (int, int, unsigned int))Get_ColorOption(yyvsp[-3].c, pColCat)))
	  yymsg(GERROR, "Unknown color option '%s[%d].Color.%s'", yyvsp[-10].c, (int)yyvsp[-8].d, yyvsp[-3].c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  pColOpt((int)yyvsp[-8].d, GMSH_SET|GMSH_GUI, yyvsp[-1].u);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free(yyvsp[-10].c); Free(yyvsp[-3].c);
#line 1061 "Gmsh.y"
      GmshColorTable *ct = Get_ColorTable(0);
	yymsg(GERROR, "View[%d] does not exist", 0);
      else{
	ct->size = List_Nbr(yyvsp[-1].l);
	if(ct->size > COLORTABLE_NBMAX_COLOR)
	  yymsg(GERROR, "Too many (%d>%d) colors in View[%d].ColorTable", 
		ct->size, COLORTABLE_NBMAX_COLOR, 0);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  for(int i = 0; i < ct->size; i++) List_Read(yyvsp[-1].l, i, &ct->table[i]);
	if(ct->size == 1){
	  ct->size = 2;
	  ct->table[1] = ct->table[0];
	}
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free(yyvsp[-5].c);
      List_Delete(yyvsp[-1].l);
#line 1081 "Gmsh.y"
      GmshColorTable *ct = Get_ColorTable((int)yyvsp[-6].d);
	yymsg(GERROR, "View[%d] does not exist", (int)yyvsp[-6].d);
	ct->size = List_Nbr(yyvsp[-1].l);
	if(ct->size > COLORTABLE_NBMAX_COLOR)
	  yymsg(GERROR, "Too many (%d>%d) colors in View[%d].ColorTable", 
		   ct->size, COLORTABLE_NBMAX_COLOR, (int)yyvsp[-6].d);
	else
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  for(int i = 0; i < ct->size; i++) List_Read(yyvsp[-1].l, i, &ct->table[i]);
	if(ct->size == 1){
	  ct->size = 2;
	  ct->table[1] = ct->table[0];
	}
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free(yyvsp[-8].c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      List_Delete(yyvsp[-1].l);
#line 1104 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      try {
	GMSH_PluginManager::instance()->setPluginOption(yyvsp[-6].c, yyvsp[-3].c, yyvsp[-1].d); 
      }
      catch (...) {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	yymsg(GERROR, "Unknown option '%s' or plugin '%s'", yyvsp[-3].c, yyvsp[-6].c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free(yyvsp[-6].c); Free(yyvsp[-3].c);
#line 1114 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      try {
	GMSH_PluginManager::instance()->setPluginOption(yyvsp[-6].c, yyvsp[-3].c, yyvsp[-1].c); 
      }
      catch (...) {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	yymsg(GERROR, "Unknown option '%s' or plugin '%s'", yyvsp[-3].c, yyvsp[-6].c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free(yyvsp[-6].c); Free(yyvsp[-3].c); // FIXME: sometimes leak $8
#line 1133 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      int num = (int)yyvsp[-4].d;
      if(FindPoint(num, THEM)){
	yymsg(GERROR, "Point %d already exists", num);
      }
      else{
	Vertex *v = Create_Vertex(num, CTX.geom.scaling_factor * yyvsp[-1].v[0],
				  CTX.geom.scaling_factor * yyvsp[-1].v[1],
				  CTX.geom.scaling_factor * yyvsp[-1].v[2],
				  CTX.geom.scaling_factor * yyvsp[-1].v[3], 1.0);
	Tree_Add(THEM->Points, &v);
      }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      yyval.s.Num = num;
#line 1149 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      int num = (int)yyvsp[-4].d;
      if(FindPhysicalGroup(num, MSH_PHYSICAL_POINT, THEM)){
	yymsg(GERROR, "Physical point %d already exists", num);
      }
      else{
	List_T *temp = ListOfDouble2ListOfInt(yyvsp[-1].l);
	PhysicalGroup *p = Create_PhysicalGroup(num, MSH_PHYSICAL_POINT, temp);
	List_Delete(temp);
	List_Add(THEM->PhysicalGroups, &p);
      }
      List_Delete(yyvsp[-1].l);
      yyval.s.Type = MSH_PHYSICAL_POINT;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      yyval.s.Num = num;
#line 1165 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      for(int i = 0; i < List_Nbr(yyvsp[-9].l); i++){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	double p;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      	List_Read(yyvsp[-9].l, i, &p);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
        Vertex *v = FindPoint((int)p, THEM);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  yymsg(WARNING, "Unknown point %d", (int)p);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  Attractor *a = Create_Attractor(List_Nbr(THEM->Metric->Attractors)+1,
					  yyvsp[-6].d, yyvsp[-4].d, yyvsp[-2].d, v, NULL, NULL);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  List_Add(THEM->Metric->Attractors, &a);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      List_Delete(yyvsp[-9].l);
      // dummy values
      yyval.s.Type = 0;
      yyval.s.Num = 0;
#line 1184 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      for(int i = 0; i < List_Nbr(yyvsp[-3].l); i++){
	double d;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	List_Read(yyvsp[-3].l, i, &d);
	Vertex *v = FindPoint((int)d, THEM);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  yymsg(WARNING, "Unknown point %d", (int)d);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      List_Delete(yyvsp[-3].l);
      // dummy values
      yyval.s.Type = 0;
      yyval.s.Num = 0;
#line 1203 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      int num = (int)yyvsp[-4].d;
      if(FindCurve(num, THEM)){
	yymsg(GERROR, "Curve %d already exists", num);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      else{
	List_T *temp = ListOfDouble2ListOfInt(yyvsp[-1].l);
	Curve *c = Create_Curve(num, MSH_SEGM_LINE, 1, temp, NULL,
				-1, -1, 0., 1.);
	Tree_Add(THEM->Curves, &c);
	CreateReversedCurve(THEM, c);
	List_Delete(temp);
      }
      List_Delete(yyvsp[-1].l);
      yyval.s.Type = MSH_SEGM_LINE;
      yyval.s.Num = num;
#line 1221 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      int num = (int)yyvsp[-4].d;
      if(FindCurve(num, THEM)){
	yymsg(GERROR, "Curve %d already exists", num);
      }
      else{
	List_T *temp = ListOfDouble2ListOfInt(yyvsp[-1].l);
	Curve *c = Create_Curve(num, MSH_SEGM_SPLN, 3, temp, NULL,
				-1, -1, 0., 1.);
	Tree_Add(THEM->Curves, &c);
	CreateReversedCurve(THEM, c);
	List_Delete(temp);
      }
      List_Delete(yyvsp[-1].l);
      yyval.s.Type = MSH_SEGM_SPLN;
      yyval.s.Num = num;
#line 1239 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      int num = (int)yyvsp[-4].d;
      if(FindCurve(num, THEM)){
	yymsg(GERROR, "Curve %d already exists", num);
      }
      else{
	List_T *temp = ListOfDouble2ListOfInt(yyvsp[-1].l);
	Curve *c = Create_Curve(num, MSH_SEGM_CIRC, 2, temp, NULL,
				-1, -1, 0., 1.);
	Tree_Add(THEM->Curves, &c);
	CreateReversedCurve(THEM, c);
	List_Delete(temp);
      }
      List_Delete(yyvsp[-1].l);
      yyval.s.Type = MSH_SEGM_CIRC;
      yyval.s.Num = num;
#line 1257 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      int num = (int)yyvsp[-6].d;
      if(FindCurve(num, THEM)){
	yymsg(GERROR, "Curve %d already exists", num);
      }
      else{
	List_T *temp = ListOfDouble2ListOfInt(yyvsp[-3].l);
	Curve *c = Create_Curve(num, MSH_SEGM_CIRC, 2, temp, NULL,
				-1, -1, 0., 1.);
	c->Circle.n[0] = yyvsp[-1].v[0];
	c->Circle.n[1] = yyvsp[-1].v[1];
	c->Circle.n[2] = yyvsp[-1].v[2];
	End_Curve(c);
	Tree_Add(THEM->Curves, &c);
	Curve *rc = CreateReversedCurve(THEM, c);
	rc->Circle.n[0] = yyvsp[-1].v[0];
	rc->Circle.n[1] = yyvsp[-1].v[1];
	rc->Circle.n[2] = yyvsp[-1].v[2];
	End_Curve(rc);
	List_Delete(temp);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      List_Delete(yyvsp[-3].l);
      yyval.s.Type = MSH_SEGM_CIRC;
      yyval.s.Num = num;
#line 1283 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      int num = (int)yyvsp[-4].d;
      if(FindCurve(num, THEM)){
	yymsg(GERROR, "Curve %d already exists", num);
      }
      else{
	List_T *temp = ListOfDouble2ListOfInt(yyvsp[-1].l);
	Curve *c = Create_Curve(num, MSH_SEGM_ELLI, 2, temp, NULL,
				-1, -1, 0., 1.);
	Tree_Add(THEM->Curves, &c);
	CreateReversedCurve(THEM, c);
	List_Delete(temp);
      }
      List_Delete(yyvsp[-1].l);
      yyval.s.Type = MSH_SEGM_ELLI;
      yyval.s.Num = num;
#line 1301 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      int num = (int)yyvsp[-6].d;
      if(FindCurve(num, THEM)){
	yymsg(GERROR, "Curve %d already exists", num);
      }
      else{
	List_T *temp = ListOfDouble2ListOfInt(yyvsp[-3].l);
	Curve *c = Create_Curve(num, MSH_SEGM_ELLI, 2, temp, NULL,
				-1, -1, 0., 1.);
	c->Circle.n[0] = yyvsp[-1].v[0];
	c->Circle.n[1] = yyvsp[-1].v[1];
	c->Circle.n[2] = yyvsp[-1].v[2];
	End_Curve(c);
	Tree_Add(THEM->Curves, &c);
	Curve *rc = CreateReversedCurve(THEM, c);
	rc->Circle.n[0] = yyvsp[-1].v[0];
	rc->Circle.n[1] = yyvsp[-1].v[1];
	rc->Circle.n[2] = yyvsp[-1].v[2];
	End_Curve(c);
	List_Delete(temp);
      }
      List_Delete(yyvsp[-3].l);
      yyval.s.Type = MSH_SEGM_ELLI;
      yyval.s.Num = num;
#line 1328 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      int num = (int)yyvsp[-14].d;
      if(FindCurve(num, THEM)){
	yymsg(GERROR, "Curve %d already exists", num);
      }
      else{
	Curve *c = Create_Curve(num, MSH_SEGM_PARAMETRIC, 2, NULL, NULL,
				-1, -1, yyvsp[-10].d, yyvsp[-8].d);
	strcpy(c->functu, yyvsp[-6].c);
	strcpy(c->functv, yyvsp[-4].c);
	strcpy(c->functw, yyvsp[-2].c);
	Tree_Add(THEM->Curves, &c);
	CreateReversedCurve(THEM, c);
      }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free(yyvsp[-6].c); Free(yyvsp[-4].c); Free(yyvsp[-2].c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      yyval.s.Type = MSH_SEGM_PARAMETRIC;
      yyval.s.Num = num;
#line 1347 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      int num = (int)yyvsp[-4].d;
      if(List_Nbr(yyvsp[-1].l) < 4){
	yymsg(GERROR, "Too few control points for BSpline %d (%d < 4)", num,
	      List_Nbr(yyvsp[-1].l));
      }
      else{
	if(FindCurve(num, THEM)){
	  yymsg(GERROR, "Curve %d already exists", num);
	}
	else{
	  List_T *temp = ListOfDouble2ListOfInt(yyvsp[-1].l);
	  Curve *c = Create_Curve(num, MSH_SEGM_BSPLN, 2, temp, NULL,
				  -1, -1, 0., 1.);
	  Tree_Add(THEM->Curves, &c);
	  CreateReversedCurve(THEM, c);
	  List_Delete(temp);
	}
      }
      List_Delete(yyvsp[-1].l);
      yyval.s.Type = MSH_SEGM_BSPLN;
      yyval.s.Num = num;
#line 1371 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      int num = (int)yyvsp[-4].d;
      if(List_Nbr(yyvsp[-1].l) < 4){
	yymsg(GERROR, "Too few control points for Bezier curve %d (%d < 4)", num,
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else{
	if(FindCurve(num, THEM)){
	  yymsg(GERROR, "Curve %d already exists", num);
	}
	else{
	  List_T *temp = ListOfDouble2ListOfInt(yyvsp[-1].l);
	  Curve *c = Create_Curve(num, MSH_SEGM_BEZIER, 2, temp, NULL,
				  -1, -1, 0., 1.);
	  Tree_Add(THEM->Curves, &c);
	  CreateReversedCurve(THEM, c);
	  List_Delete(temp);
	}
      }
      List_Delete(yyvsp[-1].l);
      yyval.s.Type = MSH_SEGM_BEZIER;
      yyval.s.Num = num;
#line 1395 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      int num = (int)yyvsp[-8].d;
      if(List_Nbr(yyvsp[-5].l) + (int)yyvsp[-1].d + 1 != List_Nbr(yyvsp[-3].l)){
	yymsg(GERROR, "Wrong definition of Nurbs Curve %d: "
	      "got %d knots, need N + D + 1 = %d + %d + 1 = %d",
	      (int)yyvsp[-8].d, List_Nbr(yyvsp[-3].l), List_Nbr(yyvsp[-5].l), (int)yyvsp[-1].d, List_Nbr(yyvsp[-5].l) + (int)yyvsp[-1].d + 1);