Skip to content
Snippets Groups Projects
Gmsh.tab.cpp 383 KiB
Newer Older
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
  /* yyn is the number of a rule to reduce with.  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
  /* If YYLEN is nonzero, implement the default value of the action:
     `$$ = $1'.
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
     Otherwise, the following line sets YYVAL to garbage.
     This behavior is undocumented and Bison
     users should not rely upon it.  Assigning to YYVAL
     unconditionally makes the parser a bit smaller, and it avoids a
     GCC warning that YYVAL may be used uninitialized.  */
  yyval = yyvsp[1-yylen];
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
  YY_REDUCE_PRINT (yyn);
  switch (yyn)
    {
        case 3:
/* Line 1806 of yacc.c  */
    { yyerrok; return 1; }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

  case 6:
/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

  case 7:
/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

  case 8:
/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

  case 9:
/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

  case 10:
/* Line 1806 of yacc.c  */
    { List_Delete((yyvsp[(1) - (1)].l)); return 1; }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

  case 11:
/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

  case 12:
/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

  case 13:
/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

  case 14:
/* Line 1806 of yacc.c  */
    { List_Delete((yyvsp[(1) - (1)].l)); return 1; }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

  case 15:
/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

  case 16:
/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

  case 17:
/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

  case 18:
/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

  case 19:
/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

  case 20:
/* Line 1806 of yacc.c  */
/* Line 1806 of yacc.c  */
Matti Pellika's avatar
 
Matti Pellika committed
    break;

  case 22:
/* Line 1806 of yacc.c  */
/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free((yyvsp[(3) - (5)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      std::string tmp = FixRelativePath(gmsh_yyname, (yyvsp[(6) - (7)].c));
      FILE *fp = fopen(tmp.c_str(), (yyvsp[(5) - (7)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(!fp){
	yymsg(0, "Unable to open file '%s'", tmp.c_str());
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else{
	fprintf(fp, "%s\n", (yyvsp[(3) - (7)].c));
	fclose(fp);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free((yyvsp[(3) - (7)].c));
      Free((yyvsp[(6) - (7)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      char tmpstring[1024];
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      int i = PrintListOfDouble((yyvsp[(3) - (7)].c), (yyvsp[(5) - (7)].l), tmpstring);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(i < 0)
	yymsg(0, "Too few arguments in Printf");
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      else if(i > 0)
	yymsg(0, "%d extra argument%s in Printf", i, (i > 1) ? "s" : "");
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      else
	Msg::Direct(tmpstring);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free((yyvsp[(3) - (7)].c));
      List_Delete((yyvsp[(5) - (7)].l));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      char tmpstring[1024];
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      int i = PrintListOfDouble((yyvsp[(3) - (9)].c), (yyvsp[(5) - (9)].l), tmpstring);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(i < 0)
	yymsg(0, "Too few arguments in Printf");
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      else if(i > 0)
	yymsg(0, "%d extra argument%s in Printf", i, (i > 1) ? "s" : "");
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      else{
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
        std::string tmp = FixRelativePath(gmsh_yyname, (yyvsp[(8) - (9)].c));
	FILE *fp = fopen(tmp.c_str(), (yyvsp[(7) - (9)].c));
	if(!fp){
	  yymsg(0, "Unable to open file '%s'", tmp.c_str());
	}
	else{
	  fprintf(fp, "%s\n", tmpstring);
	  fclose(fp);
	}
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free((yyvsp[(3) - (9)].c));
      Free((yyvsp[(8) - (9)].c));
      List_Delete((yyvsp[(5) - (9)].l));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
#if defined(HAVE_POST)
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(!strcmp((yyvsp[(1) - (6)].c), "View") && ViewData->finalize()){
	ViewData->setName((yyvsp[(2) - (6)].c));
	ViewData->setFileName(gmsh_yyname);
	ViewData->setFileIndex(gmsh_yyviewindex++);
	new PView(ViewData);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      else
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free((yyvsp[(1) - (6)].c)); Free((yyvsp[(2) - (6)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
#if defined(HAVE_POST)
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(!strcmp((yyvsp[(2) - (6)].c), "View")){
	int index = (int)(yyvsp[(4) - (6)].d);
	if(index >= 0 && index < (int)PView::list.size())
	  new PView(PView::list[index], false);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free((yyvsp[(2) - (6)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
#if defined(HAVE_POST)
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(!strcmp((yyvsp[(2) - (6)].c), "View")){
	int index = (int)(yyvsp[(4) - (6)].d);
	if(index >= 0 && index < (int)PView::list.size())
	  new PView(PView::list[index], true);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free((yyvsp[(2) - (6)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
#if defined(HAVE_POST)
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      ViewData = new PViewDataList();
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1806 of yacc.c  */
    { ViewCoord.push_back((yyvsp[(1) - (1)].d)); }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1806 of yacc.c  */
    { ViewCoord.push_back((yyvsp[(3) - (3)].d)); }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1806 of yacc.c  */
    { if(ViewValueList) ViewValueList->push_back((yyvsp[(1) - (1)].d)); }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1806 of yacc.c  */
    { if(ViewValueList) ViewValueList->push_back((yyvsp[(3) - (3)].d)); }
/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
#if defined(HAVE_POST)
      if(!strncmp((yyvsp[(1) - (1)].c), "SP", 2)){
	ViewValueList = &ViewData->SP; ViewNumList = &ViewData->NbSP;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strncmp((yyvsp[(1) - (1)].c), "VP", 2)){
	ViewValueList = &ViewData->VP; ViewNumList = &ViewData->NbVP;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strncmp((yyvsp[(1) - (1)].c), "TP", 2)){
	ViewValueList = &ViewData->TP; ViewNumList = &ViewData->NbTP;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strncmp((yyvsp[(1) - (1)].c), "SL", 2)){
	ViewValueList = &ViewData->SL; ViewNumList = &ViewData->NbSL;
        if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_LIN);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strncmp((yyvsp[(1) - (1)].c), "VL", 2)){
	ViewValueList = &ViewData->VL; ViewNumList = &ViewData->NbVL;
        if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_LIN);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strncmp((yyvsp[(1) - (1)].c), "TL", 2)){
	ViewValueList = &ViewData->TL; ViewNumList = &ViewData->NbTL;
        if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_LIN);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strncmp((yyvsp[(1) - (1)].c), "ST", 2)){
	ViewValueList = &ViewData->ST; ViewNumList = &ViewData->NbST;
        if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_TRI);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strncmp((yyvsp[(1) - (1)].c), "VT", 2)){
	ViewValueList = &ViewData->VT; ViewNumList = &ViewData->NbVT;
        if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_TRI);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strncmp((yyvsp[(1) - (1)].c), "TT", 2)){
	ViewValueList = &ViewData->TT; ViewNumList = &ViewData->NbTT;
        if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_TRI);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strncmp((yyvsp[(1) - (1)].c), "SQ", 2)){
	ViewValueList = &ViewData->SQ; ViewNumList = &ViewData->NbSQ;
        if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_QUA);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strncmp((yyvsp[(1) - (1)].c), "VQ", 2)){
	ViewValueList = &ViewData->VQ; ViewNumList = &ViewData->NbVQ;
        if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_QUA);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strncmp((yyvsp[(1) - (1)].c), "TQ", 2)){
	ViewValueList = &ViewData->TQ; ViewNumList = &ViewData->NbTQ;
        if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_QUA);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strncmp((yyvsp[(1) - (1)].c), "SS", 2)){
	ViewValueList = &ViewData->SS; ViewNumList = &ViewData->NbSS;
        if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_TET);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strncmp((yyvsp[(1) - (1)].c), "VS", 2)){
	ViewValueList = &ViewData->VS; ViewNumList = &ViewData->NbVS;
        if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_TET);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strncmp((yyvsp[(1) - (1)].c), "TS", 2)){
	ViewValueList = &ViewData->TS; ViewNumList = &ViewData->NbTS;
        if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_TET);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strncmp((yyvsp[(1) - (1)].c), "SH", 2)){
	ViewValueList = &ViewData->SH; ViewNumList = &ViewData->NbSH;
        if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_HEX);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strncmp((yyvsp[(1) - (1)].c), "VH", 2)){
	ViewValueList = &ViewData->VH; ViewNumList = &ViewData->NbVH;
        if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_HEX);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strncmp((yyvsp[(1) - (1)].c), "TH", 2)){
	ViewValueList = &ViewData->TH; ViewNumList = &ViewData->NbTH;
        if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_HEX);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strncmp((yyvsp[(1) - (1)].c), "SI", 2)){
	ViewValueList = &ViewData->SI; ViewNumList = &ViewData->NbSI;
        if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_PRI);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strncmp((yyvsp[(1) - (1)].c), "VI", 2)){
	ViewValueList = &ViewData->VI; ViewNumList = &ViewData->NbVI;
        if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_PRI);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strncmp((yyvsp[(1) - (1)].c), "TI", 2)){
	ViewValueList = &ViewData->TI; ViewNumList = &ViewData->NbTI;
        if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_PRI);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strncmp((yyvsp[(1) - (1)].c), "SY", 2)){
	ViewValueList = &ViewData->SY; ViewNumList = &ViewData->NbSY;
        if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_PYR);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strncmp((yyvsp[(1) - (1)].c), "VY", 2)){
	ViewValueList = &ViewData->VY; ViewNumList = &ViewData->NbVY;
        if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_PYR);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else if(!strncmp((yyvsp[(1) - (1)].c), "TY", 2)){
	ViewValueList = &ViewData->TY; ViewNumList = &ViewData->NbTY;
        if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_PYR);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      else{
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	yymsg(0, "Unknown element type '%s'", (yyvsp[(1) - (1)].c));
	ViewValueList = 0; ViewNumList = 0;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
Christophe Geuzaine's avatar
Christophe Geuzaine committed
      ViewCoord.clear();
      Free((yyvsp[(1) - (1)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
#if defined(HAVE_POST)
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(ViewValueList){
	for(int i = 0; i < 3; i++)
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  for(unsigned int j = 0; j < ViewCoord.size() / 3; j++)
	    ViewValueList->push_back(ViewCoord[3 * j + i]);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
#if defined(HAVE_POST)
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(ViewValueList) (*ViewNumList)++;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
#if defined(HAVE_POST)
      for(int i = 0; i < (int)strlen((yyvsp[(1) - (1)].c)) + 1; i++) ViewData->T2C.push_back((yyvsp[(1) - (1)].c)[i]);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free((yyvsp[(1) - (1)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
#if defined(HAVE_POST)
      for(int i = 0; i < (int)strlen((yyvsp[(3) - (3)].c)) + 1; i++) ViewData->T2C.push_back((yyvsp[(3) - (3)].c)[i]);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free((yyvsp[(3) - (3)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
#if defined(HAVE_POST)
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      ViewData->T2D.push_back((yyvsp[(3) - (8)].d));
      ViewData->T2D.push_back((yyvsp[(5) - (8)].d));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      ViewData->T2D.push_back((yyvsp[(7) - (8)].d));
      ViewData->T2D.push_back(ViewData->T2C.size());
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
#if defined(HAVE_POST)
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      ViewData->NbT2++;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
#if defined(HAVE_POST)
      for(int i = 0; i < (int)strlen((yyvsp[(1) - (1)].c)) + 1; i++) ViewData->T3C.push_back((yyvsp[(1) - (1)].c)[i]);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free((yyvsp[(1) - (1)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
#if defined(HAVE_POST)
      for(int i = 0; i < (int)strlen((yyvsp[(3) - (3)].c)) + 1; i++) ViewData->T3C.push_back((yyvsp[(3) - (3)].c)[i]);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free((yyvsp[(3) - (3)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
#if defined(HAVE_POST)
      ViewData->T3D.push_back((yyvsp[(3) - (10)].d)); ViewData->T3D.push_back((yyvsp[(5) - (10)].d));
      ViewData->T3D.push_back((yyvsp[(7) - (10)].d)); ViewData->T3D.push_back((yyvsp[(9) - (10)].d));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      ViewData->T3D.push_back(ViewData->T3C.size());
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
#if defined(HAVE_POST)
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      ViewData->NbT3++;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
#if defined(HAVE_POST)
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      int type =
	(ViewData->NbSL || ViewData->NbVL) ? TYPE_LIN :
	(ViewData->NbST || ViewData->NbVT) ? TYPE_TRI :
	(ViewData->NbSQ || ViewData->NbVQ) ? TYPE_QUA :
	(ViewData->NbSS || ViewData->NbVS) ? TYPE_TET :
	(ViewData->NbSY || ViewData->NbVY) ? TYPE_PYR :
	(ViewData->NbSI || ViewData->NbVI) ? TYPE_PRI :
      	(ViewData->NbSH || ViewData->NbVH) ? TYPE_HEX :
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      ViewData->setInterpolationMatrices(type, ListOfListOfDouble2Matrix((yyvsp[(3) - (8)].l)),
                                         ListOfListOfDouble2Matrix((yyvsp[(6) - (8)].l)));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
#if defined(HAVE_POST)
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      int type =
	(ViewData->NbSL || ViewData->NbVL) ? TYPE_LIN :
	(ViewData->NbST || ViewData->NbVT) ? TYPE_TRI :
	(ViewData->NbSQ || ViewData->NbVQ) ? TYPE_QUA :
	(ViewData->NbSS || ViewData->NbVS) ? TYPE_TET :
      	(ViewData->NbSH || ViewData->NbVH) ? TYPE_HEX :
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      ViewData->setInterpolationMatrices(type, ListOfListOfDouble2Matrix((yyvsp[(3) - (14)].l)),
                                         ListOfListOfDouble2Matrix((yyvsp[(6) - (14)].l)),
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
                                         ListOfListOfDouble2Matrix((yyvsp[(9) - (14)].l)),
                                         ListOfListOfDouble2Matrix((yyvsp[(12) - (14)].l)));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
#if defined(HAVE_POST)
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

Matti Pellika's avatar
 
Matti Pellika committed
  case 57:
/* Line 1806 of yacc.c  */
    { (yyval.i) = 0; }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

Matti Pellika's avatar
 
Matti Pellika committed
  case 58:
/* Line 1806 of yacc.c  */
    { (yyval.i) = 1; }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

Matti Pellika's avatar
 
Matti Pellika committed
  case 59:
/* Line 1806 of yacc.c  */
    { (yyval.i) = 2; }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

Matti Pellika's avatar
 
Matti Pellika committed
  case 60:
/* Line 1806 of yacc.c  */
    { (yyval.i) = 3; }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

Matti Pellika's avatar
 
Matti Pellika committed
  case 61:
/* Line 1806 of yacc.c  */
    { (yyval.i) = 4; }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

Matti Pellika's avatar
 
Matti Pellika committed
  case 62:
/* Line 1806 of yacc.c  */
    { (yyval.i) = 1; }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

Matti Pellika's avatar
 
Matti Pellika committed
  case 63:
/* Line 1806 of yacc.c  */
    { (yyval.i) = -1; }
/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(!gmsh_yysymbols.count((yyvsp[(1) - (4)].c)) && (yyvsp[(2) - (4)].i) && List_Nbr((yyvsp[(3) - (4)].l)) == 1){
        yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (4)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
        gmsh_yysymbol &s(gmsh_yysymbols[(yyvsp[(1) - (4)].c)]);
        if(!(yyvsp[(2) - (4)].i)) s.list = (List_Nbr((yyvsp[(3) - (4)].l)) != 1); // list if 0 or > 1 elements
        if(!s.list){ // single expression
          if(List_Nbr((yyvsp[(3) - (4)].l)) != 1){
            yymsg(0, "Cannot assign list to variable '%s'", (yyvsp[(1) - (4)].c));
          }
          else{
            double d;
            List_Read((yyvsp[(3) - (4)].l), 0, &d);
            if(s.value.empty()){
              if((yyvsp[(2) - (4)].i)) yymsg(1, "Uninitialized variable '%s'", (yyvsp[(1) - (4)].c));
              s.value.resize(1, 0.);
            }
            switch((yyvsp[(2) - (4)].i)){
            case 0 : s.value[0] = d; break;
            case 1 : s.value[0] += d; break;
            case 2 : s.value[0] -= d; break;
            case 3 : s.value[0] *= d; break;
            case 4 :
              if(d) s.value[0] /= d;
              else yymsg(0, "Division by zero in '%s /= %g'", (yyvsp[(1) - (4)].c), d);
              break;
            }
          }
        }
        else{ // list of expressions
          switch((yyvsp[(2) - (4)].i)){
          case 0: // affect
            s.value.clear(); // fall-through
          case 1: // append
            for(int i = 0; i < List_Nbr((yyvsp[(3) - (4)].l)); i++){
              double d;
              List_Read((yyvsp[(3) - (4)].l), i, &d);
              s.value.push_back(d);
            }
            break;
          case 2: // remove
            for(int i = 0; i < List_Nbr((yyvsp[(3) - (4)].l)); i++){
              double d;
              List_Read((yyvsp[(3) - (4)].l), i, &d);
              std::vector<double>::iterator it = std::find(s.value.begin(),
                                                           s.value.end(), d);
              if(it != s.value.end()) s.value.erase(it);
            }
            break;
          default:
            yymsg(0, "Operators *= and /= not available for lists");
            break;
          }
        }
      }
      Free((yyvsp[(1) - (4)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      List_Delete((yyvsp[(3) - (4)].l));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      gmsh_yysymbol &s(gmsh_yysymbols[(yyvsp[(1) - (6)].c)]);
      s.list = true;
      double d;
      switch((yyvsp[(4) - (6)].i)){
      case 0: // affect
        s.value.clear(); // fall-through
      case 1: // append
        for(int i = 0; i < List_Nbr((yyvsp[(5) - (6)].l)); i++){
          List_Read((yyvsp[(5) - (6)].l), i, &d);
          s.value.push_back(d);
        }
        break;
      case 2: // remove
        for(int i = 0; i < List_Nbr((yyvsp[(5) - (6)].l)); i++){
          List_Read((yyvsp[(5) - (6)].l), i, &d);
          std::vector<double>::iterator it = std::find(s.value.begin(),
                                                       s.value.end(), d);
          if(it != s.value.end()) s.value.erase(it);
        }
        break;
      default:
        yymsg(0, "Operators *= and /= not available for lists");
        break;
      }
      Free((yyvsp[(1) - (6)].c));
      List_Delete((yyvsp[(5) - (6)].l));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

  case 67:

/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      int index = (int)(yyvsp[(3) - (7)].d);
      if(!gmsh_yysymbols.count((yyvsp[(1) - (7)].c))){
	if(!(yyvsp[(5) - (7)].i)){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
          gmsh_yysymbol &s(gmsh_yysymbols[(yyvsp[(1) - (7)].c)]);
          s.list = true;
	  s.value.resize(index + 1, 0.);
	  s.value[index] = (yyvsp[(6) - (7)].d);
	}
	else
	  yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (7)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
        gmsh_yysymbol &s(gmsh_yysymbols[(yyvsp[(1) - (7)].c)]);
        if(s.list){
          if((int)s.value.size() < index + 1) s.value.resize(index + 1, 0.);
          switch((yyvsp[(5) - (7)].i)){
          case 0 : s.value[index] = (yyvsp[(6) - (7)].d); break;
          case 1 : s.value[index] += (yyvsp[(6) - (7)].d); break;
          case 2 : s.value[index] -= (yyvsp[(6) - (7)].d); break;
          case 3 : s.value[index] *= (yyvsp[(6) - (7)].d); break;
          case 4 :
            if((yyvsp[(6) - (7)].d)) s.value[index] /= (yyvsp[(6) - (7)].d);
            else yymsg(0, "Division by zero in '%s[%d] /= %g'", (yyvsp[(1) - (7)].c), index, (yyvsp[(6) - (7)].d));
            break;
          }
        }
        else
          yymsg(0, "Variable '%s' is not a list", (yyvsp[(1) - (7)].c));
      Free((yyvsp[(1) - (7)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
  case 68:
/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      if(List_Nbr((yyvsp[(4) - (9)].l)) != List_Nbr((yyvsp[(8) - (9)].l))){
	yymsg(0, "Incompatible array dimensions in affectation");
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
	if(!gmsh_yysymbols.count((yyvsp[(1) - (9)].c))){
	  if(!(yyvsp[(7) - (9)].i)){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
            gmsh_yysymbol &s(gmsh_yysymbols[(yyvsp[(1) - (9)].c)]);
            s.list = true;
	    for(int i = 0; i < List_Nbr((yyvsp[(4) - (9)].l)); i++){
	      int index = (int)(*(double*)List_Pointer((yyvsp[(4) - (9)].l), i));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	      s.value.resize(index + 1, 0.);
	      s.value[index] = *(double*)List_Pointer((yyvsp[(8) - (9)].l), i);
	    }
	  }
	  else
	    yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (9)].c));
	}
	else{
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
          gmsh_yysymbol &s(gmsh_yysymbols[(yyvsp[(1) - (9)].c)]);
          if(s.list){
            for(int i = 0; i < List_Nbr((yyvsp[(4) - (9)].l)); i++){
              int index = (int)(*(double*)List_Pointer((yyvsp[(4) - (9)].l), i));
              double d = *(double*)List_Pointer((yyvsp[(8) - (9)].l), i);
              if((int)s.value.size() < index + 1) s.value.resize(index + 1, 0.);
              switch((yyvsp[(7) - (9)].i)){
              case 0 : s.value[index] = d; break;
              case 1 : s.value[index] += d; break;
              case 2 : s.value[index] -= d; break;
              case 3 : s.value[index] *= d; break;
              case 4 :
                if((yyvsp[(8) - (9)].l)) s.value[index] /= d;
                else yymsg(0, "Division by zero in '%s[%d] /= %g'", (yyvsp[(1) - (9)].c), index, d);
                break;
              }
            }
          }
          else
            yymsg(0, "Variable '%s' is not a list", (yyvsp[(1) - (9)].c));
        }
      Free((yyvsp[(1) - (9)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      List_Delete((yyvsp[(4) - (9)].l));
      List_Delete((yyvsp[(8) - (9)].l));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      if(!gmsh_yysymbols.count((yyvsp[(1) - (3)].c)))
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (3)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
        gmsh_yysymbol &s(gmsh_yysymbols[(yyvsp[(1) - (3)].c)]);
        if(!s.list && s.value.empty())
          yymsg(0, "Uninitialized variable '%s'", (yyvsp[(1) - (3)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
        else if(!s.list)
          s.value[0] += (yyvsp[(2) - (3)].i);
          yymsg(0, "Variable '%s' is a list", (yyvsp[(1) - (3)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free((yyvsp[(1) - (3)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
  case 70:
/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      if(!gmsh_yysymbols.count((yyvsp[(1) - (6)].c)))
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (6)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
        gmsh_yysymbol &s(gmsh_yysymbols[(yyvsp[(1) - (6)].c)]);
        if(s.list){
          int index = (int)(yyvsp[(3) - (6)].d);
          if((int)s.value.size() < index + 1) s.value.resize(index + 1, 0.);
          s.value[index] += (yyvsp[(5) - (6)].i);
        }
        else
          yymsg(0, "Variable '%s' is not a list", (yyvsp[(1) - (6)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free((yyvsp[(1) - (6)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
  case 71:
/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      gmsh_yystringsymbols[(yyvsp[(1) - (4)].c)] = std::string((yyvsp[(3) - (4)].c));
      Free((yyvsp[(1) - (4)].c));
      Free((yyvsp[(3) - (4)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
  case 72:
/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      std::string tmp((yyvsp[(5) - (6)].c));
      StringOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (6)].c), 0, (yyvsp[(3) - (6)].c), tmp);
      Free((yyvsp[(1) - (6)].c)); Free((yyvsp[(3) - (6)].c)); Free((yyvsp[(5) - (6)].c))
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
  case 73:
/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      std::string tmp((yyvsp[(8) - (9)].c));
      StringOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (9)].c), (int)(yyvsp[(3) - (9)].d), (yyvsp[(6) - (9)].c), tmp);
      Free((yyvsp[(1) - (9)].c)); Free((yyvsp[(6) - (9)].c)); Free((yyvsp[(8) - (9)].c))
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    ;}
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
  case 74:
/* Line 1806 of yacc.c  */
    {
      double d = 0.;
      if(NumberOption(GMSH_GET, (yyvsp[(1) - (6)].c), 0, (yyvsp[(3) - (6)].c), d)){
	switch((yyvsp[(4) - (6)].i)){
	case 0 : d = (yyvsp[(5) - (6)].d); break;
	case 1 : d += (yyvsp[(5) - (6)].d); break;
	case 2 : d -= (yyvsp[(5) - (6)].d); break;
	case 3 : d *= (yyvsp[(5) - (6)].d); break;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	case 4 :
	  if((yyvsp[(5) - (6)].d)) d /= (yyvsp[(5) - (6)].d);
	  else yymsg(0, "Division by zero in '%s.%s /= %g'", (yyvsp[(1) - (6)].c), (yyvsp[(3) - (6)].c), (yyvsp[(5) - (6)].d));
	  break;
	}
	NumberOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (6)].c), 0, (yyvsp[(3) - (6)].c), d);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free((yyvsp[(1) - (6)].c)); Free((yyvsp[(3) - (6)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
  case 75:
/* Line 1806 of yacc.c  */
    {
      double d = 0.;
      if(NumberOption(GMSH_GET, (yyvsp[(1) - (9)].c), (int)(yyvsp[(3) - (9)].d), (yyvsp[(6) - (9)].c), d)){
	switch((yyvsp[(7) - (9)].i)){
	case 0 : d = (yyvsp[(8) - (9)].d); break;
	case 1 : d += (yyvsp[(8) - (9)].d); break;
	case 2 : d -= (yyvsp[(8) - (9)].d); break;
	case 3 : d *= (yyvsp[(8) - (9)].d); break;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	case 4 :
	  if((yyvsp[(8) - (9)].d)) d /= (yyvsp[(8) - (9)].d);
	  else yymsg(0, "Division by zero in '%s[%d].%s /= %g'", (yyvsp[(1) - (9)].c), (int)(yyvsp[(3) - (9)].d), (yyvsp[(6) - (9)].c), (yyvsp[(8) - (9)].d));
	  break;
	}
	NumberOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (9)].c), (int)(yyvsp[(3) - (9)].d), (yyvsp[(6) - (9)].c), d);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free((yyvsp[(1) - (9)].c)); Free((yyvsp[(6) - (9)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
  case 76:
/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      double d = 0.;
      if(NumberOption(GMSH_GET, (yyvsp[(1) - (5)].c), 0, (yyvsp[(3) - (5)].c), d)){
	d += (yyvsp[(4) - (5)].i);
	NumberOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (5)].c), 0, (yyvsp[(3) - (5)].c), d);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free((yyvsp[(1) - (5)].c)); Free((yyvsp[(3) - (5)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
  case 77:
/* Line 1806 of yacc.c  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      double d = 0.;
      if(NumberOption(GMSH_GET, (yyvsp[(1) - (8)].c), (int)(yyvsp[(3) - (8)].d), (yyvsp[(6) - (8)].c), d)){
	d += (yyvsp[(7) - (8)].i);
	NumberOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (8)].c), (int)(yyvsp[(3) - (8)].d), (yyvsp[(6) - (8)].c), d);