Skip to content
Snippets Groups Projects
Gmsh.tab.cpp 280 KiB
Newer Older
      Free((yyvsp[-4].c));
      (yyval.l) = NULL;
    ;}
    break;

  case 120:
#line 1664 "Gmsh.y"
    {
      for(int i = 0; i < List_Nbr((yyvsp[-1].l)); i++){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	Shape TheShape;
	List_Read((yyvsp[-1].l), i, &TheShape);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	DeleteShape(TheShape.Type, TheShape.Num);
      List_Delete((yyvsp[-1].l));
    ;}
    break;

  case 121:
#line 1673 "Gmsh.y"
    {
      if(!strcmp((yyvsp[-4].c), "View")){
	RemoveViewByIndex((int)(yyvsp[-2].d));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      else{
	yymsg(GERROR, "Unknown command 'Delete %s'", (yyvsp[-4].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      Free((yyvsp[-4].c));
    ;}
    break;

  case 122:
#line 1683 "Gmsh.y"
    {
      if(!strcmp((yyvsp[-1].c), "Meshes") || !strcmp((yyvsp[-1].c), "All")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	Init_Mesh(THEM);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strcmp((yyvsp[-1].c), "Physicals")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	List_Action(THEM->PhysicalGroups, Free_PhysicalGroup);
	List_Reset(THEM->PhysicalGroups);
      }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      else{
	yymsg(GERROR, "Unknown command 'Delete %s'", (yyvsp[-1].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      Free((yyvsp[-1].c));
    ;}
    break;

  case 123:
#line 1697 "Gmsh.y"
    {
      if(!strcmp((yyvsp[-2].c), "Empty") && !strcmp((yyvsp[-1].c), "Views")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	for(int i = List_Nbr(CTX.post.list) - 1; i >= 0; i--){
	  Post_View *v = *(Post_View **) List_Pointer(CTX.post.list, i);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  if(v->empty())
	    RemoveViewByIndex(i);
	}
      }
      else{
	yymsg(GERROR, "Unknown command 'Delete %s %s'", (yyvsp[-2].c), (yyvsp[-1].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      Free((yyvsp[-2].c)); Free((yyvsp[-1].c));
    ;}
    break;

  case 124:
#line 1716 "Gmsh.y"
    {
      for(int i = 0; i < List_Nbr((yyvsp[-1].l)); i++){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	Shape TheShape;
	List_Read((yyvsp[-1].l), i, &TheShape);
	ColorShape(TheShape.Type, TheShape.Num, (yyvsp[-3].u));
      }
      List_Delete((yyvsp[-1].l));      
    ;}
    break;

  case 125:
#line 1730 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      int m = (CTX.visibility_mode == 2) ? VIS_MESH : 
	((CTX.visibility_mode == 1) ? VIS_GEOM : VIS_GEOM|VIS_MESH);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      for(int i = 2; i < 6; i++)
	SetVisibilityByNumber((yyvsp[-1].c), i, m);
      Free((yyvsp[-1].c));
    ;}
    break;

  case 126:
#line 1738 "Gmsh.y"
    {
      for(int i = 2; i < 6; i++)
	SetVisibilityByNumber((yyvsp[-1].c), i, 0);
      Free((yyvsp[-1].c));
    ;}
    break;

  case 127:
#line 1744 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      int m = (CTX.visibility_mode == 2) ? VIS_MESH :
	((CTX.visibility_mode == 1) ? VIS_GEOM : VIS_GEOM|VIS_MESH);
      for(int i = 0; i < List_Nbr((yyvsp[-1].l)); i++){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	Shape TheShape;
	List_Read((yyvsp[-1].l), i, &TheShape);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	VisibilityShape(TheShape.Type, TheShape.Num, m);
      }
      List_Delete((yyvsp[-1].l));
    ;}
    break;

  case 128:
#line 1755 "Gmsh.y"
    {
      for(int i = 0; i < List_Nbr((yyvsp[-1].l)); i++){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	Shape TheShape;
	List_Read((yyvsp[-1].l), i, &TheShape);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	VisibilityShape(TheShape.Type, TheShape.Num, 0);
      }
      List_Delete((yyvsp[-1].l));
    ;}
    break;

  case 129:
#line 1769 "Gmsh.y"
    {
      if(!strcmp((yyvsp[-2].c), "Include")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	char tmpstring[1024];
	FixRelativePath((yyvsp[-1].c), tmpstring);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	// Warning: we *don't* close included files (to allow user
	// functions in these files). If you need to include many many
	// files and don't have functions in the files, use "Merge"
	// instead: some OSes limit the number of files a process can
	// open simultaneously. The right solution would be of course
	// to modify FunctionManager to reopen the files instead of
	// using the FILE pointer, but hey, I'm lazy...
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ParseFile(tmpstring, 0, 0, 1);
      else if(!strcmp((yyvsp[-2].c), "Print")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#if defined(HAVE_FLTK)
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	if(!CTX.batch){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  char tmpstring[1024];
	  FixRelativePath((yyvsp[-1].c), tmpstring);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  CreateOutputFile(tmpstring, CTX.print.format);
	}
Christophe Geuzaine's avatar
Christophe Geuzaine committed
#endif
Christophe Geuzaine's avatar
Christophe Geuzaine committed
      }
      else if(!strcmp((yyvsp[-2].c), "Save")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#if defined(HAVE_FLTK)
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	char tmpstring[1024];
	FixRelativePath((yyvsp[-1].c), tmpstring);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	CreateOutputFile(tmpstring, CTX.mesh.format);
Christophe Geuzaine's avatar
Christophe Geuzaine committed
#endif
      else if(!strcmp((yyvsp[-2].c), "Merge") || !strcmp((yyvsp[-2].c), "MergeWithBoundingBox")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	// MergeWithBoundingBox is deprecated
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	char tmpstring[1024];
	FixRelativePath((yyvsp[-1].c), tmpstring);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	MergeProblem(tmpstring, 1);
      else if(!strcmp((yyvsp[-2].c), "System")){
	SystemCall((yyvsp[-1].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      else{
	yymsg(GERROR, "Unknown command '%s'", (yyvsp[-2].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      Free((yyvsp[-2].c)); Free((yyvsp[-1].c));
    ;}
    break;

  case 130:
#line 1813 "Gmsh.y"
    {
      if(!strcmp((yyvsp[-6].c), "Save") && !strcmp((yyvsp[-5].c), "View")){
	Post_View **vv = (Post_View **)List_Pointer_Test(CTX.post.list, (int)(yyvsp[-3].d));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	if(vv){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  char tmpstring[1024];
	  FixRelativePath((yyvsp[-1].c), tmpstring);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  WriteView(*vv, tmpstring, CTX.post.file_format, 0);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	}
      }
      else{
	yymsg(GERROR, "Unknown command '%s'", (yyvsp[-6].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      Free((yyvsp[-6].c)); Free((yyvsp[-5].c)); Free((yyvsp[-1].c));
    ;}
    break;

  case 131:
#line 1828 "Gmsh.y"
    {
      if(!strcmp((yyvsp[-6].c), "Background") && !strcmp((yyvsp[-5].c), "Mesh")  && !strcmp((yyvsp[-4].c), "View")){
	Post_View **vv = (Post_View **)List_Pointer_Test(CTX.post.list, (int)(yyvsp[-2].d));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	if(vv) BGMWithView(*vv);
      }
      else{
	yymsg(GERROR, "Unknown command '%s'", (yyvsp[-6].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      Free((yyvsp[-6].c)); Free((yyvsp[-5].c)); Free((yyvsp[-4].c));
    ;}
    break;

  case 132:
#line 1839 "Gmsh.y"
    {
      if(!strcmp((yyvsp[-2].c), "Sleep")){
	SleepInSeconds((yyvsp[-1].d));
      else if(!strcmp((yyvsp[-2].c), "Remesh")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ReMesh(THEM);
      }
      else if(!strcmp((yyvsp[-2].c), "Mesh")){
	yymsg(GERROR, "Mesh directives are not (yet) allowed in scripts");
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      else{
	yymsg(GERROR, "Unknown command '%s'", (yyvsp[-2].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      Free((yyvsp[-2].c));
    ;}
    break;

  case 133:
#line 1855 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
       try {
	 GMSH_PluginManager::instance()->action((yyvsp[-4].c), (yyvsp[-1].c), 0);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
       }
       catch(...) {
	 yymsg(GERROR, "Unknown action '%s' or plugin '%s'", (yyvsp[-1].c), (yyvsp[-4].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
       }
       Free((yyvsp[-4].c)); Free((yyvsp[-1].c));
     ;}
    break;

  case 134:
#line 1865 "Gmsh.y"
    {
      if(!strcmp((yyvsp[-1].c), "ElementsFromAllViews"))
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	CombineViews(0, 1, CTX.post.combine_remove_orig);
      else if(!strcmp((yyvsp[-1].c), "ElementsFromVisibleViews"))
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	CombineViews(0, 0, CTX.post.combine_remove_orig);
      else if(!strcmp((yyvsp[-1].c), "ElementsByViewName"))
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	CombineViews(0, 2, CTX.post.combine_remove_orig);
      else if(!strcmp((yyvsp[-1].c), "TimeStepsFromAllViews"))
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	CombineViews(1, 1, CTX.post.combine_remove_orig);
      else if(!strcmp((yyvsp[-1].c), "TimeStepsFromVisibleViews"))
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	CombineViews(1, 0, CTX.post.combine_remove_orig);
      else if(!strcmp((yyvsp[-1].c), "TimeStepsByViewName"))
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	CombineViews(1, 2, CTX.post.combine_remove_orig);
      else if(!strcmp((yyvsp[-1].c), "Views"))
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	CombineViews(0, 1, CTX.post.combine_remove_orig);
      else if(!strcmp((yyvsp[-1].c), "TimeSteps"))
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	CombineViews(1, 2, CTX.post.combine_remove_orig);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      else
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	yymsg(GERROR, "Unknown 'Combine' command");
      Free((yyvsp[-1].c));
    ;}
    break;

  case 135:
#line 1887 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      exit(0);
#line 1891 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      CTX.forced_bbox = 0;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      SetBoundingBox();
#line 1896 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      CTX.forced_bbox = 1;
      SetBoundingBox((yyvsp[-12].d), (yyvsp[-10].d), (yyvsp[-8].d), (yyvsp[-6].d), (yyvsp[-4].d), (yyvsp[-2].d));
    ;}
    break;

  case 138:
#line 1901 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#if defined(HAVE_FLTK)
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(!CTX.batch) // we're in interactive mode
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	Draw();
Christophe Geuzaine's avatar
Christophe Geuzaine committed
#endif
#line 1914 "Gmsh.y"
    {
      LoopControlVariablesTab[ImbricatedLoop][0] = (yyvsp[-3].d);
      LoopControlVariablesTab[ImbricatedLoop][1] = (yyvsp[-1].d);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      LoopControlVariablesTab[ImbricatedLoop][2] = 1.0;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      LoopControlVariablesNameTab[ImbricatedLoop] = NULL;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      fgetpos(yyin, &yyposImbricatedLoopsTab[ImbricatedLoop]);
      yylinenoImbricatedLoopsTab[ImbricatedLoop] = yylineno;
      ImbricatedLoop++;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(ImbricatedLoop > MAX_RECUR_LOOPS-1){
	yymsg(GERROR, "Reached maximum number of imbricated loops");
	ImbricatedLoop = MAX_RECUR_LOOPS-1;
      }
      if((yyvsp[-3].d) > (yyvsp[-1].d)) skip_until("For", "EndFor");
    ;}
    break;

  case 140:
#line 1929 "Gmsh.y"
    {
      LoopControlVariablesTab[ImbricatedLoop][0] = (yyvsp[-5].d);
      LoopControlVariablesTab[ImbricatedLoop][1] = (yyvsp[-3].d);
      LoopControlVariablesTab[ImbricatedLoop][2] = (yyvsp[-1].d);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      LoopControlVariablesNameTab[ImbricatedLoop] = NULL;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      fgetpos(yyin, &yyposImbricatedLoopsTab[ImbricatedLoop]);
      yylinenoImbricatedLoopsTab[ImbricatedLoop] = yylineno;
      ImbricatedLoop++;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(ImbricatedLoop > MAX_RECUR_LOOPS-1){
	yymsg(GERROR, "Reached maximum number of imbricated loops");
	ImbricatedLoop = MAX_RECUR_LOOPS-1;
      }
      if(((yyvsp[-1].d) > 0. && (yyvsp[-5].d) > (yyvsp[-3].d)) || ((yyvsp[-1].d) < 0. && (yyvsp[-5].d) < (yyvsp[-3].d)))
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	skip_until("For", "EndFor");
#line 1945 "Gmsh.y"
    {
      LoopControlVariablesTab[ImbricatedLoop][0] = (yyvsp[-3].d);
      LoopControlVariablesTab[ImbricatedLoop][1] = (yyvsp[-1].d);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      LoopControlVariablesTab[ImbricatedLoop][2] = 1.0;
      LoopControlVariablesNameTab[ImbricatedLoop] = (yyvsp[-6].c);
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))){
	TheSymbol.val = List_Create(1, 1, sizeof(double));
	List_Put(TheSymbol.val, 0, &(yyvsp[-3].d));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	Tree_Add(Symbol_T, &TheSymbol);
	List_Write(pSymbol->val, 0, &(yyvsp[-3].d));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      fgetpos(yyin, &yyposImbricatedLoopsTab[ImbricatedLoop]);
      yylinenoImbricatedLoopsTab[ImbricatedLoop] = yylineno;
      ImbricatedLoop++;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(ImbricatedLoop > MAX_RECUR_LOOPS-1){
	yymsg(GERROR, "Reached maximum number of imbricated loops");
	ImbricatedLoop = MAX_RECUR_LOOPS-1;
      }
      if((yyvsp[-3].d) > (yyvsp[-1].d)) skip_until("For", "EndFor");
    ;}
    break;

  case 142:
#line 1971 "Gmsh.y"
    {
      LoopControlVariablesTab[ImbricatedLoop][0] = (yyvsp[-5].d);
      LoopControlVariablesTab[ImbricatedLoop][1] = (yyvsp[-3].d);
      LoopControlVariablesTab[ImbricatedLoop][2] = (yyvsp[-1].d);
      LoopControlVariablesNameTab[ImbricatedLoop] = (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))){
	TheSymbol.val = List_Create(1, 1, sizeof(double));
	List_Put(TheSymbol.val, 0, &(yyvsp[-5].d));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	Tree_Add(Symbol_T, &TheSymbol);
	List_Write(pSymbol->val, 0, &(yyvsp[-5].d));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      fgetpos(yyin, &yyposImbricatedLoopsTab[ImbricatedLoop]);
      yylinenoImbricatedLoopsTab[ImbricatedLoop] = yylineno;
      ImbricatedLoop++;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(ImbricatedLoop > MAX_RECUR_LOOPS-1){
	yymsg(GERROR, "Reached maximum number of imbricated loops");
	ImbricatedLoop = MAX_RECUR_LOOPS-1;
      }
      if(((yyvsp[-1].d) > 0. && (yyvsp[-5].d) > (yyvsp[-3].d)) || ((yyvsp[-1].d) < 0. && (yyvsp[-5].d) < (yyvsp[-3].d)))
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	skip_until("For", "EndFor");
#line 1998 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(ImbricatedLoop <= 0){
	yymsg(GERROR, "Invalid For/EndFor loop");
	ImbricatedLoop = 0;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	double x0 = LoopControlVariablesTab[ImbricatedLoop-1][0];
	double x1 = LoopControlVariablesTab[ImbricatedLoop-1][1];
	double step = LoopControlVariablesTab[ImbricatedLoop-1][2];
	int do_next = (step > 0.) ? (x0+step <= x1) : (x0+step >= x1);
	if(do_next){
	  LoopControlVariablesTab[ImbricatedLoop-1][0] +=
	    LoopControlVariablesTab[ImbricatedLoop-1][2];
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  if(LoopControlVariablesNameTab[ImbricatedLoop-1]){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	    Symbol TheSymbol;
	    TheSymbol.Name = LoopControlVariablesNameTab[ImbricatedLoop-1];
	    Symbol *pSymbol;
	    if(!(pSymbol = (Symbol*)Tree_PQuery(Symbol_T, &TheSymbol)))
	      yymsg(GERROR, "Unknown loop variable");
	    else
	      *(double*)List_Pointer_Fast(pSymbol->val, 0) += 
		LoopControlVariablesTab[ImbricatedLoop-1][2];
	  }
	  fsetpos(yyin, &yyposImbricatedLoopsTab[ImbricatedLoop-1]);
	  yylineno = yylinenoImbricatedLoopsTab[ImbricatedLoop-1];
	}
	else{
	  ImbricatedLoop--;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	}
#line 2030 "Gmsh.y"
    {
      if(!FunctionManager::Instance()->createFunction((yyvsp[0].c), yyin, yyname, yylineno))
	yymsg(GERROR, "Redefinition of function %s", (yyvsp[0].c));
      skip_until(NULL, "Return");
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      //FIXME: wee leak $2
#line 2037 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(!FunctionManager::Instance()->leaveFunction(&yyin, yyname, yylineno))
	yymsg(GERROR, "Error while exiting function");
#line 2042 "Gmsh.y"
    {
      if(!FunctionManager::Instance()->enterFunction((yyvsp[-1].c), &yyin, yyname, yylineno))
	yymsg(GERROR, "Unknown function %s", (yyvsp[-1].c));
      //FIXME: wee leak $2
    ;}
    break;

  case 147:
#line 2048 "Gmsh.y"
    {
      if(!(yyvsp[-1].d)) skip_until("If", "EndIf");
    ;}
    break;

  case 148:
#line 2052 "Gmsh.y"
#line 2061 "Gmsh.y"
    {
      (yyval.l) = List_Create(2, 1, sizeof(Shape));
      ExtrudeShapes(TRANSLATE, (yyvsp[-1].l), 
		    (yyvsp[-3].v)[0], (yyvsp[-3].v)[1], (yyvsp[-3].v)[2], 0., 0., 0., 0., 0., 0., 0.,
		    NULL, (yyval.l));
      List_Delete((yyvsp[-1].l));
    ;}
    break;

  case 150:
#line 2069 "Gmsh.y"
    {
      (yyval.l) = List_Create(2, 1, sizeof(Shape));
      ExtrudeShapes(ROTATE, (yyvsp[-1].l), 
		    0., 0., 0., (yyvsp[-8].v)[0], (yyvsp[-8].v)[1], (yyvsp[-8].v)[2], (yyvsp[-6].v)[0], (yyvsp[-6].v)[1], (yyvsp[-6].v)[2], (yyvsp[-4].d),
		    NULL, (yyval.l));
      List_Delete((yyvsp[-1].l));
    ;}
    break;

  case 151:
#line 2077 "Gmsh.y"
    {
      (yyval.l) = List_Create(2, 1, sizeof(Shape));
      ExtrudeShapes(TRANSLATE_ROTATE, (yyvsp[-1].l), 
		    (yyvsp[-10].v)[0], (yyvsp[-10].v)[1], (yyvsp[-10].v)[2], (yyvsp[-8].v)[0], (yyvsp[-8].v)[1], (yyvsp[-8].v)[2], (yyvsp[-6].v)[0], (yyvsp[-6].v)[1], (yyvsp[-6].v)[2], (yyvsp[-4].d),
		    NULL, (yyval.l));
      List_Delete((yyvsp[-1].l));
    ;}
    break;

  case 152:
#line 2085 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      extr.mesh.ExtrudeMesh = false;
      extr.mesh.Recombine = false;
#line 2090 "Gmsh.y"
    {
      (yyval.l) = List_Create(2, 1, sizeof(Shape));
      ExtrudeShapes(TRANSLATE, (yyvsp[-3].l), 
		    (yyvsp[-5].v)[0], (yyvsp[-5].v)[1], (yyvsp[-5].v)[2], 0., 0., 0., 0., 0., 0., 0.,
		    &extr, (yyval.l));
      List_Delete((yyvsp[-3].l));
    ;}
    break;

  case 154:
#line 2098 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      extr.mesh.ExtrudeMesh = false;
      extr.mesh.Recombine = false;
#line 2103 "Gmsh.y"
    {
      (yyval.l) = List_Create(2, 1, sizeof(Shape));
      ExtrudeShapes(ROTATE, (yyvsp[-3].l), 
		    0., 0., 0., (yyvsp[-10].v)[0], (yyvsp[-10].v)[1], (yyvsp[-10].v)[2], (yyvsp[-8].v)[0], (yyvsp[-8].v)[1], (yyvsp[-8].v)[2], (yyvsp[-6].d),
		    &extr, (yyval.l));
      List_Delete((yyvsp[-3].l));
    ;}
    break;

  case 156:
#line 2111 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      extr.mesh.ExtrudeMesh = false;
      extr.mesh.Recombine = false;
#line 2116 "Gmsh.y"
    {
      (yyval.l) = List_Create(2, 1, sizeof(Shape));
      ExtrudeShapes(TRANSLATE_ROTATE, (yyvsp[-3].l), 
		    (yyvsp[-12].v)[0], (yyvsp[-12].v)[1], (yyvsp[-12].v)[2], (yyvsp[-10].v)[0], (yyvsp[-10].v)[1], (yyvsp[-10].v)[2], (yyvsp[-8].v)[0], (yyvsp[-8].v)[1], (yyvsp[-8].v)[2], (yyvsp[-6].d),
		    &extr, (yyval.l));
      List_Delete((yyvsp[-3].l));
    ;}
    break;

  case 158:
#line 2126 "Gmsh.y"
    {
      (yyval.l) = List_Create(2, 1, sizeof(Shape));
      ExtrudeShape(TRANSLATE, MSH_POINT, (int)(yyvsp[-4].d), 
		   (yyvsp[-2].v)[0], (yyvsp[-2].v)[1], (yyvsp[-2].v)[2], 0., 0., 0., 0., 0., 0., 0.,
		   NULL, (yyval.l));
    ;}
    break;

  case 159:
#line 2133 "Gmsh.y"
    {
      (yyval.l) = List_Create(2, 1, sizeof(Shape));
      ExtrudeShape(TRANSLATE, MSH_SEGM_LINE, (int)(yyvsp[-4].d), 
		   (yyvsp[-2].v)[0], (yyvsp[-2].v)[1], (yyvsp[-2].v)[2], 0., 0., 0., 0., 0., 0., 0.,
		   NULL, (yyval.l));
    ;}
    break;

  case 160:
#line 2140 "Gmsh.y"
    {
      (yyval.l) = List_Create(2, 1, sizeof(Shape));
      ExtrudeShape(TRANSLATE, MSH_SURF_PLAN, (int)(yyvsp[-4].d), 
		   (yyvsp[-2].v)[0], (yyvsp[-2].v)[1], (yyvsp[-2].v)[2], 0., 0., 0., 0., 0., 0., 0.,
		   NULL, (yyval.l));
    ;}
    break;

  case 161:
#line 2147 "Gmsh.y"
    {
      (yyval.l) = List_Create(2, 1, sizeof(Shape));
      ExtrudeShape(ROTATE, MSH_POINT, (int)(yyvsp[-8].d), 
		   0., 0., 0., (yyvsp[-6].v)[0], (yyvsp[-6].v)[1], (yyvsp[-6].v)[2], (yyvsp[-4].v)[0], (yyvsp[-4].v)[1], (yyvsp[-4].v)[2], (yyvsp[-2].d),
		   NULL, (yyval.l));
    ;}
    break;

  case 162:
#line 2154 "Gmsh.y"
    {
      (yyval.l) = List_Create(2, 1, sizeof(Shape));
      ExtrudeShape(ROTATE, MSH_SEGM_LINE, (int)(yyvsp[-8].d), 
		   0., 0., 0., (yyvsp[-6].v)[0], (yyvsp[-6].v)[1], (yyvsp[-6].v)[2], (yyvsp[-4].v)[0], (yyvsp[-4].v)[1], (yyvsp[-4].v)[2], (yyvsp[-2].d),
		   NULL, (yyval.l));
    ;}
    break;

  case 163:
#line 2161 "Gmsh.y"
    {
      (yyval.l) = List_Create(2, 1, sizeof(Shape));
      ExtrudeShape(ROTATE, MSH_SURF_PLAN, (int)(yyvsp[-8].d), 
		   0., 0., 0., (yyvsp[-6].v)[0], (yyvsp[-6].v)[1], (yyvsp[-6].v)[2], (yyvsp[-4].v)[0], (yyvsp[-4].v)[1], (yyvsp[-4].v)[2], (yyvsp[-2].d),
		   NULL, (yyval.l));
    ;}
    break;

  case 164:
#line 2168 "Gmsh.y"
    {
      (yyval.l) = List_Create(2, 1, sizeof(Shape));
      ExtrudeShape(TRANSLATE_ROTATE, MSH_POINT, (int)(yyvsp[-10].d), 
		   (yyvsp[-8].v)[0], (yyvsp[-8].v)[1], (yyvsp[-8].v)[2], (yyvsp[-6].v)[0], (yyvsp[-6].v)[1], (yyvsp[-6].v)[2], (yyvsp[-4].v)[0], (yyvsp[-4].v)[1], (yyvsp[-4].v)[2], (yyvsp[-2].d),
		   NULL, (yyval.l));
    ;}
    break;

  case 165:
#line 2175 "Gmsh.y"
    {
      (yyval.l) = List_Create(2, 1, sizeof(Shape));
      ExtrudeShape(TRANSLATE_ROTATE, MSH_SEGM_LINE, (int)(yyvsp[-10].d), 
		   (yyvsp[-8].v)[0], (yyvsp[-8].v)[1], (yyvsp[-8].v)[2], (yyvsp[-6].v)[0], (yyvsp[-6].v)[1], (yyvsp[-6].v)[2], (yyvsp[-4].v)[0], (yyvsp[-4].v)[1], (yyvsp[-4].v)[2], (yyvsp[-2].d),
		   NULL, (yyval.l));
    ;}
    break;

  case 166:
#line 2182 "Gmsh.y"
    {
      (yyval.l) = List_Create(2, 1, sizeof(Shape));
      ExtrudeShape(TRANSLATE_ROTATE, MSH_SURF_PLAN, (int)(yyvsp[-10].d), 
		   (yyvsp[-8].v)[0], (yyvsp[-8].v)[1], (yyvsp[-8].v)[2], (yyvsp[-6].v)[0], (yyvsp[-6].v)[1], (yyvsp[-6].v)[2], (yyvsp[-4].v)[0], (yyvsp[-4].v)[1], (yyvsp[-4].v)[2], (yyvsp[-2].d),
		   NULL, (yyval.l));
    ;}
    break;

  case 167:
#line 2189 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      extr.mesh.ExtrudeMesh = false;
      extr.mesh.Recombine = false;
#line 2194 "Gmsh.y"
    {
      (yyval.l) = List_Create(2, 1, sizeof(Shape));
      ExtrudeShape(TRANSLATE, MSH_POINT, (int)(yyvsp[-8].d), 
		   (yyvsp[-6].v)[0], (yyvsp[-6].v)[1], (yyvsp[-6].v)[2], 0., 0., 0., 0., 0., 0., 0.,
		   &extr, (yyval.l));
    ;}
    break;

  case 169:
#line 2201 "Gmsh.y"
      extr.mesh.ExtrudeMesh = false;
      extr.mesh.Recombine = false;
#line 2206 "Gmsh.y"
    {
      (yyval.l) = List_Create(2, 1, sizeof(Shape));
      ExtrudeShape(TRANSLATE, MSH_SEGM_LINE, (int)(yyvsp[-8].d), 
		   (yyvsp[-6].v)[0], (yyvsp[-6].v)[1], (yyvsp[-6].v)[2], 0., 0., 0., 0., 0., 0., 0.,
		   &extr, (yyval.l));
    ;}
    break;

  case 171:
#line 2213 "Gmsh.y"
      extr.mesh.ExtrudeMesh = false;
      extr.mesh.Recombine = false;
#line 2218 "Gmsh.y"
    {
      (yyval.l) = List_Create(2, 1, sizeof(Shape));
      ExtrudeShape(TRANSLATE, MSH_SURF_PLAN, (int)(yyvsp[-8].d), 
		   (yyvsp[-6].v)[0], (yyvsp[-6].v)[1], (yyvsp[-6].v)[2], 0., 0., 0., 0., 0., 0., 0.,
		   &extr, (yyval.l));
    ;}
    break;

  case 173:
#line 2225 "Gmsh.y"
      extr.mesh.ExtrudeMesh = false;
      extr.mesh.Recombine = false;
#line 2230 "Gmsh.y"
    {
      (yyval.l) = List_Create(2, 1, sizeof(Shape));
      ExtrudeShape(ROTATE, MSH_POINT, (int)(yyvsp[-12].d), 
		   0., 0., 0., (yyvsp[-10].v)[0], (yyvsp[-10].v)[1], (yyvsp[-10].v)[2], (yyvsp[-8].v)[0], (yyvsp[-8].v)[1], (yyvsp[-8].v)[2], (yyvsp[-6].d),
		   &extr, (yyval.l));
    ;}
    break;

  case 175:
#line 2237 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      extr.mesh.ExtrudeMesh = false;
      extr.mesh.Recombine = false;
#line 2242 "Gmsh.y"
    {
      (yyval.l) = List_Create(2, 1, sizeof(Shape));
      ExtrudeShape(ROTATE, MSH_SEGM_LINE, (int)(yyvsp[-12].d), 
		   0., 0., 0., (yyvsp[-10].v)[0], (yyvsp[-10].v)[1], (yyvsp[-10].v)[2], (yyvsp[-8].v)[0], (yyvsp[-8].v)[1], (yyvsp[-8].v)[2], (yyvsp[-6].d),
		   &extr, (yyval.l));
    ;}
    break;

  case 177:
#line 2249 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      extr.mesh.ExtrudeMesh = false;
      extr.mesh.Recombine = false;
#line 2254 "Gmsh.y"
    {
      (yyval.l) = List_Create(2, 1, sizeof(Shape));
      ExtrudeShape(ROTATE, MSH_SURF_PLAN, (int)(yyvsp[-12].d), 
		   0., 0., 0., (yyvsp[-10].v)[0], (yyvsp[-10].v)[1], (yyvsp[-10].v)[2], (yyvsp[-8].v)[0], (yyvsp[-8].v)[1], (yyvsp[-8].v)[2], (yyvsp[-6].d),
		   &extr, (yyval.l));
    ;}
    break;

  case 179:
#line 2261 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      extr.mesh.ExtrudeMesh = false;
      extr.mesh.Recombine = false;
#line 2266 "Gmsh.y"
    {
      (yyval.l) = List_Create(2, 1, sizeof(Shape));
      ExtrudeShape(TRANSLATE_ROTATE, MSH_POINT, (int)(yyvsp[-14].d), 
		   (yyvsp[-12].v)[0], (yyvsp[-12].v)[1], (yyvsp[-12].v)[2], (yyvsp[-10].v)[0], (yyvsp[-10].v)[1], (yyvsp[-10].v)[2], (yyvsp[-8].v)[0], (yyvsp[-8].v)[1], (yyvsp[-8].v)[2], (yyvsp[-6].d),
		   &extr, (yyval.l));
    ;}
    break;

  case 181:
#line 2273 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      extr.mesh.ExtrudeMesh = false;
      extr.mesh.Recombine = false;
#line 2278 "Gmsh.y"
    {
      (yyval.l) = List_Create(2, 1, sizeof(Shape));
      ExtrudeShape(TRANSLATE_ROTATE, MSH_SEGM_LINE, (int)(yyvsp[-14].d), 
		   (yyvsp[-12].v)[0], (yyvsp[-12].v)[1], (yyvsp[-12].v)[2], (yyvsp[-10].v)[0], (yyvsp[-10].v)[1], (yyvsp[-10].v)[2], (yyvsp[-8].v)[0], (yyvsp[-8].v)[1], (yyvsp[-8].v)[2], (yyvsp[-6].d),
		   &extr, (yyval.l));
    ;}
    break;

  case 183:
#line 2285 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      extr.mesh.ExtrudeMesh = false;
      extr.mesh.Recombine = false;
#line 2290 "Gmsh.y"
    {
      (yyval.l) = List_Create(2, 1, sizeof(Shape));
      ExtrudeShape(TRANSLATE_ROTATE, MSH_SURF_PLAN, (int)(yyvsp[-14].d), 
		   (yyvsp[-12].v)[0], (yyvsp[-12].v)[1], (yyvsp[-12].v)[2], (yyvsp[-10].v)[0], (yyvsp[-10].v)[1], (yyvsp[-10].v)[2], (yyvsp[-8].v)[0], (yyvsp[-8].v)[1], (yyvsp[-8].v)[2], (yyvsp[-6].d),
		   &extr, (yyval.l));
    ;}
    break;

  case 185:
#line 2301 "Gmsh.y"
#line 2304 "Gmsh.y"
#line 2310 "Gmsh.y"
      double d;
      extr.mesh.ExtrudeMesh = true;
      extr.mesh.NbLayer = List_Nbr((yyvsp[-6].l));
      if(List_Nbr((yyvsp[-6].l)) == List_Nbr((yyvsp[-4].l)) && List_Nbr((yyvsp[-6].l)) == List_Nbr((yyvsp[-2].l))){
	extr.mesh.NbElmLayer = (int*)Malloc(extr.mesh.NbLayer*sizeof(int));
	extr.mesh.ZonLayer = (int*)Malloc(extr.mesh.NbLayer*sizeof(int));
	extr.mesh.hLayer = (double*)Malloc(extr.mesh.NbLayer*sizeof(double));
	for(int i = 0; i < List_Nbr((yyvsp[-6].l)); i++){
	  List_Read((yyvsp[-6].l), i, &d);
	  extr.mesh.NbElmLayer[i] = (d>0)?(int)d:1;
	  List_Read((yyvsp[-4].l), i, &d);
	  extr.mesh.ZonLayer[i] = (int)d;
	  List_Read((yyvsp[-2].l), i, &d);
	  extr.mesh.hLayer[i] = d;
	}
      }
      else{
	yymsg(GERROR, "Wrong layer definition {%d, %d, %d}", 
	      List_Nbr((yyvsp[-6].l)), List_Nbr((yyvsp[-4].l)), List_Nbr((yyvsp[-2].l)));
      }
      List_Delete((yyvsp[-6].l));
      List_Delete((yyvsp[-4].l));
      List_Delete((yyvsp[-2].l));
    ;}
    break;

  case 188:
#line 2336 "Gmsh.y"
      double d;
      extr.mesh.ExtrudeMesh = true;
      extr.mesh.NbLayer = List_Nbr((yyvsp[-4].l));
      if(List_Nbr((yyvsp[-4].l)) == List_Nbr((yyvsp[-2].l))){
	extr.mesh.NbElmLayer = (int*)Malloc(extr.mesh.NbLayer*sizeof(int));
	extr.mesh.ZonLayer = (int*)Malloc(extr.mesh.NbLayer*sizeof(int));
	extr.mesh.hLayer = (double*)Malloc(extr.mesh.NbLayer*sizeof(double));
	for(int i = 0; i < List_Nbr((yyvsp[-4].l)); i++){
	  List_Read((yyvsp[-4].l), i, &d);
	  extr.mesh.NbElmLayer[i] = (d>0)?(int)d:1;
	  extr.mesh.ZonLayer[i] = 0;
	  List_Read((yyvsp[-2].l), i, &d);
	  extr.mesh.hLayer[i] = d;
	}
      }
      else{
	yymsg(GERROR, "Wrong layer definition {%d, %d}", 
	      List_Nbr((yyvsp[-4].l)), List_Nbr((yyvsp[-2].l)));
      }
      List_Delete((yyvsp[-4].l));
      List_Delete((yyvsp[-2].l));
    ;}
    break;

  case 189:
#line 2360 "Gmsh.y"
      extr.mesh.Recombine = true;
#line 2369 "Gmsh.y"
    {
      for(int i = 0; i < List_Nbr((yyvsp[-3].l)); i++){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	double d;
	List_Read((yyvsp[-3].l), i, &d);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	int j = (int)fabs(d);
        Curve *c = FindCurve(j, THEM);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  yymsg(WARNING, "Unknown curve %d", j);
	  c->ipar[0] = ((yyvsp[-1].d)>2)?(int)(yyvsp[-1].d):2;
	  c->ipar[1] = sign(d);
	  c->dpar[0] = 1.0;
      List_Delete((yyvsp[-3].l));
    ;}
    break;

  case 191:
#line 2387 "Gmsh.y"
    {
      for(int i = 0; i < List_Nbr((yyvsp[-6].l)); i++){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	double d;
	List_Read((yyvsp[-6].l), i, &d);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	int j = (int)fabs(d);
        Curve *c = FindCurve(j, THEM);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  yymsg(WARNING, "Unknown curve %d", j);
	  c->ipar[0] = ((yyvsp[-4].d)>2)?(int)(yyvsp[-4].d):2;
	  c->ipar[1] = sign(d); /* Progresion : code 1 ou -1 */
	  c->dpar[0] = fabs((yyvsp[-1].d));
      List_Delete((yyvsp[-6].l));
    ;}
    break;

  case 192:
#line 2405 "Gmsh.y"
    {
      for(int i = 0; i < List_Nbr((yyvsp[-6].l)); i++){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	double d;
	List_Read((yyvsp[-6].l), i, &d);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	int j = (int)fabs(d);
        Curve *c = FindCurve(j, THEM);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  yymsg(WARNING, "Unknown curve %d", j);
	  c->ipar[0] = ((yyvsp[-4].d)>2)?(int)(yyvsp[-4].d):2;
	  c->ipar[1] = 2*sign(d); /* Bump : code 2 ou -2 */
	  c->dpar[0] = fabs((yyvsp[-1].d));
      List_Delete((yyvsp[-6].l));
    ;}
    break;

  case 193:
#line 2423 "Gmsh.y"
    {
      Surface *s = FindSurface((int)(yyvsp[-4].d), THEM);
	yymsg(WARNING, "Unknown surface %d", (int)(yyvsp[-4].d));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	s->Recombine_Dir = 1;
	int k = List_Nbr((yyvsp[-1].l));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	if(k != 3 && k != 4){
	  yymsg(GERROR, "Wrong definition of Transfinite Surface %d: "
		"%d points instead of 3 or 4" , (int)(yyvsp[-4].d), k);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  List_Reset(s->TrsfPoints);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  for(int i = 0; i < k; i++){
	    double d;
	    List_Read((yyvsp[-1].l), i, &d);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	    int j = (int)fabs(d);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	    Vertex *v = FindPoint(j, THEM);
	    if(!v)
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	      yymsg(WARNING, "Unknown point %d", j);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	    else
	      List_Add(s->TrsfPoints, &v);
      List_Delete((yyvsp[-1].l));
    ;}
    break;

  case 194:
#line 2452 "Gmsh.y"
    {
      Surface *s = FindSurface((int)(yyvsp[-5].d), THEM);
	yymsg(WARNING, "Unknown surface %d", (int)(yyvsp[-5].d));
      else{
	s->Method = TRANSFINI;
	int k = List_Nbr((yyvsp[-2].l));
	if(k != 3 && k != 4){
	  yymsg(GERROR, "Wrong definition of Transfinite Surface %d: "
		"%d points instead of 3 or 4" , (int)(yyvsp[-5].d), k);
	}
	else{
	  List_Reset(s->TrsfPoints);
	  if (!strcmp((yyvsp[-1].c), "Right"))
	    s->Recombine_Dir = 1;
	  else if (!strcmp((yyvsp[-1].c), "Left"))
	    s->Recombine_Dir = -1;
	  else
	    s->Recombine_Dir = 0;
	  for(int i = 0; i < k; i++){
	    double d;
	    List_Read((yyvsp[-2].l), i, &d);
	    int j = (int)fabs(d);
	    Vertex *v = FindPoint(j, THEM);