Skip to content
Snippets Groups Projects
Gmsh.tab.cpp 251 KiB
Newer Older
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ViewElementIdx = -1; ViewNumNodes = 0; ViewNumComp = 0;
	ViewValueList = NULL; ViewNumList = NULL;
      }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free(yyvsp[0].c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      ViewCoordIdx = 0;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;
    break;}
case 35:
#line 433 "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);
      }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;
    break;}
case 36:
#line 451 "Gmsh.y"
{
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(ViewValueList){  
	if((List_Nbr(ViewValueList) - ViewNumListTmp) % (ViewNumComp * ViewNumNodes)) 
	  ViewErrorFlags[ViewElementIdx]++;
	(*ViewNumList)++;
      }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;
    break;}
case 37:
#line 462 "Gmsh.y"
{ 
      for(int i = 0; i < (int)strlen(yyvsp[0].c)+1; i++) List_Add(View->T2C, &yyvsp[0].c[i]); 
      Free(yyvsp[0].c);
    ;
    break;}
case 38:
#line 467 "Gmsh.y"
{ 
      for(int i = 0; i < (int)strlen(yyvsp[0].c)+1; i++) List_Add(View->T2C, &yyvsp[0].c[i]); 
      Free(yyvsp[0].c);
    ;
    break;}
case 39:
#line 475 "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); 
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;
    break;}
case 40:
#line 482 "Gmsh.y"
{
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      View->NbT2++;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;
    break;}
case 41:
#line 489 "Gmsh.y"
{ 
      for(int i = 0; i < (int)strlen(yyvsp[0].c)+1; i++) List_Add(View->T3C, &yyvsp[0].c[i]); 
      Free(yyvsp[0].c);
    ;
    break;}
case 42:
#line 494 "Gmsh.y"
{ 
      for(int i = 0; i < (int)strlen(yyvsp[0].c)+1; i++) List_Add(View->T3C, &yyvsp[0].c[i]); 
      Free(yyvsp[0].c);
    ;
    break;}
case 43:
#line 502 "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); 
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;
    break;}
case 44:
#line 509 "Gmsh.y"
{
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      View->NbT3++;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;
    break;}
case 45:
#line 517 "Gmsh.y"
{
      View->adaptive = new Adaptive_Post_View(View, yyvsp[-5].l, yyvsp[-2].l);
    ;
    break;}
case 46:
#line 524 "Gmsh.y"
{
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      ViewValueList = View->Time;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;
    break;}
case 47:
#line 528 "Gmsh.y"
{
    ;
    break;}
case 48:
#line 533 "Gmsh.y"
{
      (*View->Grains) [(int)yyvsp[-3].d] = yyvsp[-1].l;
    ;
    break;}
case 49:
#line 541 "Gmsh.y"
{ yyval.i = 0; ;
    break;}
case 50:
#line 542 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
{ yyval.i = 1; ;
    break;}
case 51:
#line 543 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
{ yyval.i = 2; ;
    break;}
case 52:
#line 544 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
{ yyval.i = 3; ;
    break;}
case 53:
#line 545 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
{ yyval.i = 4; ;
    break;}
case 54:
#line 549 "Gmsh.y"
{ yyval.i = 1; ;
    break;}
case 55:
#line 550 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
{ yyval.i = -1; ;
    break;}
case 56:
#line 558 "Gmsh.y"
{
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Symbol TheSymbol;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      TheSymbol.Name = yyvsp[-3].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
	if(!yyvsp[-2].i){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  TheSymbol.val = List_Create(1, 1, sizeof(double));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  List_Put(TheSymbol.val, 0, &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[-3].c);
	  Free(yyvsp[-3].c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	}
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	double *pd = (double*)List_Pointer_Fast(pSymbol->val, 0); 
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	switch(yyvsp[-2].i){
	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);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;
    break;}
case 57:
#line 589 "Gmsh.y"
{
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Symbol TheSymbol;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      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
	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
	  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);
	  Free(yyvsp[-6].c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	}
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	double *pd;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	if((pd = (double*)List_Pointer_Test(pSymbol->val, (int)yyvsp[-4].d))){
	  switch(yyvsp[-2].i){
	  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);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  if(!yyvsp[-2].i)
	    List_Put(pSymbol->val, (int)yyvsp[-4].d, &yyvsp[-1].d);
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);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;
    break;}
case 58:
#line 628 "Gmsh.y"
{
      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
      }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	Symbol TheSymbol;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	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))){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  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++){
	      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);
	    Free(yyvsp[-8].c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  }
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);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	    double *pd;
	    if((pd = (double*)List_Pointer_Test(pSymbol->val, j))){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	      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);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	      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);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      List_Delete(yyvsp[-5].l);
      List_Delete(yyvsp[-1].l);
    ;
    break;}
case 59:
#line 682 "Gmsh.y"
{
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Symbol TheSymbol;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      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));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	List_Copy(yyvsp[-1].l, TheSymbol.val);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	Tree_Add(Symbol_T, &TheSymbol);
      }
      else{
	List_Reset(pSymbol->val);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	List_Copy(yyvsp[-1].l, pSymbol->val);
	Free(yyvsp[-5].c);
      }
      List_Delete(yyvsp[-1].l);
    ;
    break;}
case 60:
#line 699 "Gmsh.y"
{
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      // appends to the list
      Symbol TheSymbol;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      TheSymbol.Name = yyvsp[-5].c;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Symbol *pSymbol;
      if(!(pSymbol = (Symbol*)Tree_PQuery(Symbol_T, &TheSymbol))){
	TheSymbol.val = List_Create(5, 5, sizeof(double));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	List_Copy(yyvsp[-1].l, TheSymbol.val);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	Tree_Add(Symbol_T, &TheSymbol);
      }
      else{
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	for(int i = 0; i < List_Nbr(yyvsp[-1].l); i++)
	  List_Add(pSymbol->val, List_Pointer(yyvsp[-1].l, i));
	Free(yyvsp[-5].c);
      }
      List_Delete(yyvsp[-1].l);
    ;
    break;}
case 61:
#line 717 "Gmsh.y"
{
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Symbol TheSymbol;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      TheSymbol.Name = yyvsp[-2].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
	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);
    ;
    break;}
case 62:
#line 728 "Gmsh.y"
{
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Symbol TheSymbol;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      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)))
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	yymsg(GERROR, "Unknown variable '%s'", yyvsp[-5].c); 
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	double *pd;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	if((pd = (double*)List_Pointer_Test(pSymbol->val, (int)yyvsp[-3].d)))
	  *pd += yyvsp[-1].i;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  yymsg(GERROR, "Uninitialized variable '%s[%d]'", yyvsp[-5].c, (int)yyvsp[-3].d);
      }
      Free(yyvsp[-5].c);
    ;
    break;}
case 63:
#line 747 "Gmsh.y"
{ 
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      char* (*pStrOpt)(int num, int action, char *value);
      StringXString *pStrCat;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(!(pStrCat = Get_StringOptionCategory(yyvsp[-5].c)))
	yymsg(GERROR, "Unknown string option class '%s'", yyvsp[-5].c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	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);
      }
      Free(yyvsp[-5].c); Free(yyvsp[-3].c); //FIXME: somtimes leak $5
    ;
    break;}
case 64:
#line 761 "Gmsh.y"
{ 
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      char* (*pStrOpt)(int num, int action, char *value);
      StringXString *pStrCat;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(!(pStrCat = Get_StringOptionCategory(yyvsp[-8].c)))
	yymsg(GERROR, "Unknown string option class '%s'", yyvsp[-8].c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	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
    ;
    break;}
case 65:
#line 778 "Gmsh.y"
{
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      double (*pNumOpt)(int num, int action, double value);
      StringXNumber *pNumCat;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(!(pNumCat = Get_NumberOptionCategory(yyvsp[-5].c)))
	yymsg(GERROR, "Unknown numeric option class '%s'", yyvsp[-5].c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	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
	  switch(yyvsp[-2].i){
	  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);
    ;
    break;}
case 66:
#line 804 "Gmsh.y"
{
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      double (*pNumOpt)(int num, int action, double value);
      StringXNumber *pNumCat;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(!(pNumCat = Get_NumberOptionCategory(yyvsp[-8].c)))
	yymsg(GERROR, "Unknown numeric option class '%s'", yyvsp[-8].c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	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
	  switch(yyvsp[-2].i){
	  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'", 
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
		       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);
    ;
    break;}
case 67:
#line 831 "Gmsh.y"
{
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      double (*pNumOpt)(int num, int action, double value);
      StringXNumber *pNumCat;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(!(pNumCat = Get_NumberOptionCategory(yyvsp[-4].c)))
	yymsg(GERROR, "Unknown numeric option class '%s'", yyvsp[-4].c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	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);
    ;
    break;}
case 68:
#line 845 "Gmsh.y"
{
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      double (*pNumOpt)(int num, int action, double value);
      StringXNumber *pNumCat;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(!(pNumCat = Get_NumberOptionCategory(yyvsp[-7].c)))
	yymsg(GERROR, "Unknown numeric option class '%s'", yyvsp[-7].c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	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);
    ;
    break;}
case 69:
#line 862 "Gmsh.y"
{
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      unsigned int (*pColOpt)(int num, int action, unsigned int value);
      StringXColor *pColCat;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(!(pColCat = Get_ColorOptionCategory(yyvsp[-7].c)))
	yymsg(GERROR, "Unknown color option class '%s'", yyvsp[-7].c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	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);
    ;
    break;}
case 70:
#line 876 "Gmsh.y"
{
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      unsigned int (*pColOpt)(int num, int action, unsigned int value);
      StringXColor *pColCat;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(!(pColCat = Get_ColorOptionCategory(yyvsp[-10].c)))
	yymsg(GERROR, "Unknown color option class '%s'", yyvsp[-10].c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	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);
    ;
    break;}
case 71:
#line 893 "Gmsh.y"
{
      GmshColorTable *ct = Get_ColorTable(0);
	yymsg(GERROR, "View[%d] does not exist", 0);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	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);
    ;
    break;}
case 72:
#line 913 "Gmsh.y"
{
      GmshColorTable *ct = Get_ColorTable((int)yyvsp[-6].d);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	yymsg(GERROR, "View[%d] does not exist", (int)yyvsp[-6].d);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ct->size = List_Nbr(yyvsp[-1].l);
	  yymsg(GERROR, "Too many (%d>%d) colors in View[%d].ColorTable", 
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
		   ct->size, COLORTABLE_NBMAX_COLOR, (int)yyvsp[-6].d);
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);
      List_Delete(yyvsp[-1].l);
    ;
    break;}
case 73:
#line 936 "Gmsh.y"
{
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      try {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	GMSH_PluginManager::instance()->setPluginOption(yyvsp[-6].c, yyvsp[-3].c, yyvsp[-1].d); 
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      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);
    ;
    break;}
case 74:
#line 946 "Gmsh.y"
{
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      try {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	GMSH_PluginManager::instance()->setPluginOption(yyvsp[-6].c, yyvsp[-3].c, yyvsp[-1].c); 
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      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
    ;
    break;}
case 75:
#line 965 "Gmsh.y"
{
      int num = (int)yyvsp[-4].d;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(FindPoint(num, THEM)){
	yymsg(GERROR, "Point %d already exists", num);
      }
      else{
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	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);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	Tree_Add(THEM->Points, &v);
      }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      yyval.s.Type = MSH_POINT;
      yyval.s.Num = num;
    ;
    break;}
case 76:
#line 981 "Gmsh.y"
{
      int num = (int)yyvsp[-4].d;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(FindPhysicalGroup(num, MSH_PHYSICAL_POINT, THEM)){
	yymsg(GERROR, "Physical point %d already exists", num);
      }
      else{
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	List_T *temp = ListOfDouble2ListOfInt(yyvsp[-1].l);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	PhysicalGroup *p = Create_PhysicalGroup(num, MSH_PHYSICAL_POINT, temp);
	List_Delete(temp);
	List_Add(THEM->PhysicalGroups, &p);
      }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      List_Delete(yyvsp[-1].l);
      yyval.s.Type = MSH_PHYSICAL_POINT;
      yyval.s.Num = num;
    ;
    break;}
case 77:
#line 997 "Gmsh.y"
{
      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,
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
					  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);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      // dummy values
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      yyval.s.Type = 0;
      yyval.s.Num = 0;
    ;
    break;}
case 78:
#line 1016 "Gmsh.y"
{
      for(int i = 0; i < List_Nbr(yyvsp[-3].l); i++){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	double d;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	List_Read(yyvsp[-3].l, i, &d);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	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
	  v->lc = yyvsp[-1].d;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      List_Delete(yyvsp[-3].l);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      // dummy values
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      yyval.s.Type = 0;
      yyval.s.Num = 0;
    ;
    break;}
case 79:
#line 1035 "Gmsh.y"
{
      int num = (int)yyvsp[-4].d;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(FindCurve(num, THEM)){
	yymsg(GERROR, "Curve %d already exists", num);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      else{
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	List_T *temp = ListOfDouble2ListOfInt(yyvsp[-1].l);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	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);
      }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      List_Delete(yyvsp[-1].l);
      yyval.s.Type = MSH_SEGM_LINE;
      yyval.s.Num = num;
    ;
    break;}
case 80:
#line 1053 "Gmsh.y"
{
      int num = (int)yyvsp[-4].d;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(FindCurve(num, THEM)){
	yymsg(GERROR, "Curve %d already exists", num);
      }
      else{
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	List_T *temp = ListOfDouble2ListOfInt(yyvsp[-1].l);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	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);
      }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      List_Delete(yyvsp[-1].l);
      yyval.s.Type = MSH_SEGM_SPLN;
      yyval.s.Num = num;
    ;
    break;}
case 81:
#line 1071 "Gmsh.y"
{
      int num = (int)yyvsp[-4].d;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(FindCurve(num, THEM)){
	yymsg(GERROR, "Curve %d already exists", num);
      }
      else{
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	List_T *temp = ListOfDouble2ListOfInt(yyvsp[-1].l);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	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);
      }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      List_Delete(yyvsp[-1].l);
      yyval.s.Type = MSH_SEGM_CIRC;
      yyval.s.Num = num;
    ;
    break;}
case 82:
#line 1089 "Gmsh.y"
{
      int num = (int)yyvsp[-6].d;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(FindCurve(num, THEM)){
	yymsg(GERROR, "Curve %d already exists", num);
      }
      else{
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	List_T *temp = ListOfDouble2ListOfInt(yyvsp[-3].l);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	Curve *c = Create_Curve(num, MSH_SEGM_CIRC, 2, temp, NULL,
				-1, -1, 0., 1.);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	c->Circle.n[0] = yyvsp[-1].v[0];
	c->Circle.n[1] = yyvsp[-1].v[1];
	c->Circle.n[2] = yyvsp[-1].v[2];
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	End_Curve(c);
	Tree_Add(THEM->Curves, &c);
	Curve *rc = CreateReversedCurve(THEM, c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	rc->Circle.n[0] = yyvsp[-1].v[0];
	rc->Circle.n[1] = yyvsp[-1].v[1];
	rc->Circle.n[2] = yyvsp[-1].v[2];
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	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;
    ;
    break;}
case 83:
#line 1115 "Gmsh.y"
{
      int num = (int)yyvsp[-4].d;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(FindCurve(num, THEM)){
	yymsg(GERROR, "Curve %d already exists", num);
      }
      else{
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	List_T *temp = ListOfDouble2ListOfInt(yyvsp[-1].l);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	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);
      }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      List_Delete(yyvsp[-1].l);
      yyval.s.Type = MSH_SEGM_ELLI;
      yyval.s.Num = num;
    ;
    break;}
case 84:
#line 1133 "Gmsh.y"
{
      int num = (int)yyvsp[-6].d;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(FindCurve(num, THEM)){
	yymsg(GERROR, "Curve %d already exists", num);
      }
      else{
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	List_T *temp = ListOfDouble2ListOfInt(yyvsp[-3].l);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	Curve *c = Create_Curve(num, MSH_SEGM_ELLI, 2, temp, NULL,
				-1, -1, 0., 1.);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	c->Circle.n[0] = yyvsp[-1].v[0];
	c->Circle.n[1] = yyvsp[-1].v[1];
	c->Circle.n[2] = yyvsp[-1].v[2];
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	End_Curve(c);
	Tree_Add(THEM->Curves, &c);
	Curve *rc = CreateReversedCurve(THEM, c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	rc->Circle.n[0] = yyvsp[-1].v[0];
	rc->Circle.n[1] = yyvsp[-1].v[1];
	rc->Circle.n[2] = yyvsp[-1].v[2];
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	End_Curve(c);
	List_Delete(temp);
      }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      List_Delete(yyvsp[-3].l);
      yyval.s.Type = MSH_SEGM_ELLI;
      yyval.s.Num = num;
    ;
    break;}
case 85:
#line 1160 "Gmsh.y"
{
      int num = (int)yyvsp[-14].d;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(FindCurve(num, THEM)){
	yymsg(GERROR, "Curve %d already exists", num);
      }
      else{
	Curve *c = Create_Curve(num, MSH_SEGM_PARAMETRIC, 2, NULL, NULL,
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
				-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);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	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);
      yyval.s.Type = MSH_SEGM_PARAMETRIC;
      yyval.s.Num = num;
    ;
    break;}
case 86:
#line 1179 "Gmsh.y"
{
      int num = (int)yyvsp[-4].d;
      if(List_Nbr(yyvsp[-1].l) < 4){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	yymsg(GERROR, "Too few control points for BSpline %d (%d < 4)", num,
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	      List_Nbr(yyvsp[-1].l));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else{
	if(FindCurve(num, THEM)){
	  yymsg(GERROR, "Curve %d already exists", num);
	}
	else{
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  List_T *temp = ListOfDouble2ListOfInt(yyvsp[-1].l);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  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);
	}
      }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      List_Delete(yyvsp[-1].l);
      yyval.s.Type = MSH_SEGM_BSPLN;
      yyval.s.Num = num;
    ;
    break;}
case 87:
#line 1203 "Gmsh.y"
{
      int num = (int)yyvsp[-4].d;
      if(List_Nbr(yyvsp[-1].l) < 4){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	yymsg(GERROR, "Too few control points for Bezier curve %d (%d < 4)", num,
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	      List_Nbr(yyvsp[-1].l));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else{
	if(FindCurve(num, THEM)){
	  yymsg(GERROR, "Curve %d already exists", num);
	}
	else{
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  List_T *temp = ListOfDouble2ListOfInt(yyvsp[-1].l);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  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);
	}
      }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      List_Delete(yyvsp[-1].l);
      yyval.s.Type = MSH_SEGM_BEZIER;
      yyval.s.Num = num;
    ;
    break;}
case 88:
#line 1227 "Gmsh.y"
{
      int num = (int)yyvsp[-8].d;
      if(List_Nbr(yyvsp[-5].l) + (int)yyvsp[-1].d + 1 != List_Nbr(yyvsp[-3].l)){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	yymsg(GERROR, "Wrong definition of Nurbs Curve %d: "
	      "got %d knots, need N + D + 1 = %d + %d + 1 = %d",
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	      (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);
Christophe Geuzaine's avatar
Christophe Geuzaine committed
      }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      else{
	if(FindCurve(num, THEM)){
	  yymsg(GERROR, "Curve %d already exists", num);
	}
	else{
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  List_T *temp = ListOfDouble2ListOfInt(yyvsp[-5].l);
	  Curve *c = Create_Curve(num, MSH_SEGM_NURBS, (int)yyvsp[-1].d, temp, yyvsp[-3].l,
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
				  -1, -1, 0., 1.);
	  Tree_Add(THEM->Curves, &c);
	  CreateReversedCurve(THEM, c);
	  List_Delete(temp);
	}
      }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      List_Delete(yyvsp[-5].l);
      List_Delete(yyvsp[-3].l);
      yyval.s.Type = MSH_SEGM_NURBS;
      yyval.s.Num = num;
    ;
    break;}
case 89:
#line 1253 "Gmsh.y"
{
      int num = (int)yyvsp[-4].d;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(FindEdgeLoop(num, THEM)){
	yymsg(GERROR, "Line loop %d already exists", num);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	List_T *temp = ListOfDouble2ListOfInt(yyvsp[-1].l);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	sortEdgesInLoop(num, temp);
	EdgeLoop *l = Create_EdgeLoop(num, temp);
	Tree_Add(THEM->EdgeLoops, &l);
	List_Delete(temp);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      List_Delete(yyvsp[-1].l);
      yyval.s.Type = MSH_SEGM_LOOP;
      yyval.s.Num = num;
    ;
    break;}
case 90:
#line 1270 "Gmsh.y"
{
      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
	Curve *c = FindCurve((int)p, THEM);
        if(!c)
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  yymsg(WARNING, "Unknown curve %d", (int)p);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	else{
	  Attractor *a = Create_Attractor(List_Nbr(THEM->Metric->Attractors)+1,
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
					  yyvsp[-6].d, yyvsp[-4].d, yyvsp[-2].d, NULL, c, NULL);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  List_Add(THEM->Metric->Attractors, &a);
        }
      }
      // dummy values
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      yyval.s.Type = 0;
      yyval.s.Num = 0;
    ;
    break;}
case 91:
#line 1288 "Gmsh.y"
{
      int num = (int)yyvsp[-4].d;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(FindPhysicalGroup(num, MSH_PHYSICAL_LINE, THEM)){
	yymsg(GERROR, "Physical line %d already exists", num);
      }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	List_T *temp = ListOfDouble2ListOfInt(yyvsp[-1].l);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	PhysicalGroup *p = Create_PhysicalGroup(num, MSH_PHYSICAL_LINE, temp);
	List_Delete(temp);
	List_Add(THEM->PhysicalGroups, &p);
      }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      List_Delete(yyvsp[-1].l);
      yyval.s.Type = MSH_PHYSICAL_LINE;
      yyval.s.Num = num;
    ;
    break;}
case 92:
#line 1307 "Gmsh.y"
{
      int num = (int)yyvsp[-4].d;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(FindSurface(num, THEM)){
	yymsg(GERROR, "Surface %d already exists", num);
      }
      else{
	Surface *s = Create_Surface(num, MSH_SURF_PLAN);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	List_T *temp = ListOfDouble2ListOfInt(yyvsp[-1].l);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	setSurfaceGeneratrices(s, temp);
	List_Delete(temp);
	s->Support = s;
	End_Surface(s);
	Tree_Add(THEM->Surfaces, &s);
      }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      List_Delete(yyvsp[-1].l);
      yyval.s.Type = MSH_SURF_PLAN;
      yyval.s.Num = num;
    ;
    break;}
case 93:
#line 1326 "Gmsh.y"
{
      int num = (int)yyvsp[-4].d, type = 0;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(FindSurface(num, THEM)){
	yymsg(GERROR, "Surface %d already exists", num);
      }
      else{
	double d;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	List_Read(yyvsp[-1].l, 0, &d);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	EdgeLoop *el = FindEdgeLoop((int)fabs(d), THEM);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	if(!el){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  yymsg(GERROR, "Unknown line loop %d", (int)d);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	}
	else{
	  int j = List_Nbr(el->Curves);
	  if(j == 4){
	    type = MSH_SURF_REGL;
	  }
	  else if(j == 3){
	    type = MSH_SURF_TRIC;
	  }
	  else{
	    yymsg(GERROR, "Wrong definition of Ruled Surface %d: "
		  "%d borders instead of 3 or 4", num, j);
	    type = MSH_SURF_PLAN;
	  }
	  Surface *s = Create_Surface(num, type);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  List_T *temp = ListOfDouble2ListOfInt(yyvsp[-1].l);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  setSurfaceGeneratrices(s, temp);
	  List_Delete(temp);
	  s->Support = s;
	  End_Surface(s);
	  Tree_Add(THEM->Surfaces, &s);
	}
      }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      List_Delete(yyvsp[-1].l);
      yyval.s.Type = type;
      yyval.s.Num = num;
    ;
    break;}
case 94:
#line 1365 "Gmsh.y"