Newer
Older
}
/* Count tokens shifted since error; after three, turn off error
status. */
if (yyerrstatus)
yyerrstatus--;

Christophe Geuzaine
committed
/* Shift the lookahead token. */

Christophe Geuzaine
committed
/* Discard the shifted token. */
yychar = YYEMPTY;
*++yyvsp = yylval;
/*-----------------------------------------------------------.
| yydefault -- do the default action for the current state. |
`-----------------------------------------------------------*/
yydefault:
yyn = yydefact[yystate];
if (yyn == 0)
goto yyerrlab;
/*-----------------------------.
| yyreduce -- Do a reduction. |
`-----------------------------*/
yyreduce:
yylen = yyr2[yyn];
/* If YYLEN is nonzero, implement the default value of the action:
`$$ = $1'.
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
committed

Christophe Geuzaine
committed
#line 164 "Gmsh.y"

Christophe Geuzaine
committed

Christophe Geuzaine
committed
#line 175 "Gmsh.y"

Christophe Geuzaine
committed

Christophe Geuzaine
committed
#line 176 "Gmsh.y"

Christophe Geuzaine
committed

Christophe Geuzaine
committed
#line 177 "Gmsh.y"

Christophe Geuzaine
committed

Christophe Geuzaine
committed
#line 178 "Gmsh.y"

Christophe Geuzaine
committed

Christophe Geuzaine
committed
#line 179 "Gmsh.y"
{ List_Delete((yyvsp[(1) - (1)].l)); return 1; ;}

Christophe Geuzaine
committed

Christophe Geuzaine
committed
#line 180 "Gmsh.y"

Christophe Geuzaine
committed

Christophe Geuzaine
committed
#line 181 "Gmsh.y"

Christophe Geuzaine
committed

Christophe Geuzaine
committed
#line 182 "Gmsh.y"

Christophe Geuzaine
committed

Christophe Geuzaine
committed
#line 183 "Gmsh.y"
{ List_Delete((yyvsp[(1) - (1)].l)); return 1; ;}

Christophe Geuzaine
committed

Christophe Geuzaine
committed
#line 184 "Gmsh.y"

Christophe Geuzaine
committed

Christophe Geuzaine
committed
#line 185 "Gmsh.y"

Christophe Geuzaine
committed

Christophe Geuzaine
committed
#line 186 "Gmsh.y"

Christophe Geuzaine
committed

Christophe Geuzaine
committed
#line 187 "Gmsh.y"

Christophe Geuzaine
committed

Christophe Geuzaine
committed
#line 188 "Gmsh.y"

Christophe Geuzaine
committed

Christophe Geuzaine
committed
#line 189 "Gmsh.y"
break;
case 21:

Christophe Geuzaine
committed

Christophe Geuzaine
committed
#line 190 "Gmsh.y"

Christophe Geuzaine
committed

Christophe Geuzaine
committed
#line 191 "Gmsh.y"

Christophe Geuzaine
committed

Christophe Geuzaine
committed
#line 196 "Gmsh.y"
(yyval.c) = (char*)"w";

Christophe Geuzaine
committed

Christophe Geuzaine
committed
#line 200 "Gmsh.y"
(yyval.c) = (char*)"a";

Christophe Geuzaine
committed

Christophe Geuzaine
committed
#line 207 "Gmsh.y"
Msg::Direct((yyvsp[(3) - (5)].c));

Christophe Geuzaine
committed

Christophe Geuzaine
committed
#line 212 "Gmsh.y"
{
Msg::Error((yyvsp[(3) - (5)].c));
Free((yyvsp[(3) - (5)].c));
break;
case 27:
#line 217 "Gmsh.y"
std::string tmp = FixRelativePath(gmsh_yyname, (yyvsp[(6) - (7)].c));
FILE *fp = fopen(tmp.c_str(), (yyvsp[(5) - (7)].c));
yymsg(0, "Unable to open file '%s'", tmp.c_str());
fprintf(fp, "%s\n", (yyvsp[(3) - (7)].c));
fclose(fp);
case 28:

Christophe Geuzaine
committed
#line 231 "Gmsh.y"
int i = PrintListOfDouble((yyvsp[(3) - (7)].c), (yyvsp[(5) - (7)].l), tmpstring);
yymsg(0, "Too few arguments in Printf");
yymsg(0, "%d extra argument%s in Printf", i, (i > 1) ? "s" : "");
Msg::Direct(tmpstring);
Free((yyvsp[(3) - (7)].c));
List_Delete((yyvsp[(5) - (7)].l));
case 29:
#line 244 "Gmsh.y"
{
int i = PrintListOfDouble((yyvsp[(3) - (7)].c), (yyvsp[(5) - (7)].l), tmpstring);
if(i < 0)
yymsg(0, "Too few arguments in Error");
else if(i > 0)
yymsg(0, "%d extra argument%s in Error", i, (i > 1) ? "s" : "");
else
Msg::Error(tmpstring);
Free((yyvsp[(3) - (7)].c));
List_Delete((yyvsp[(5) - (7)].l));
break;
case 30:

Christophe Geuzaine
committed
#line 257 "Gmsh.y"
int i = PrintListOfDouble((yyvsp[(3) - (9)].c), (yyvsp[(5) - (9)].l), tmpstring);
yymsg(0, "Too few arguments in Printf");
yymsg(0, "%d extra argument%s in Printf", i, (i > 1) ? "s" : "");
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);
}
Free((yyvsp[(3) - (9)].c));
Free((yyvsp[(8) - (9)].c));
List_Delete((yyvsp[(5) - (9)].l));
case 31:

Christophe Geuzaine
committed
#line 285 "Gmsh.y"
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
committed
#endif
case 32:

Christophe Geuzaine
committed
#line 299 "Gmsh.y"
int index = (int)(yyvsp[(4) - (6)].d);
if(index >= 0 && index < (int)PView::list.size())
new PView(PView::list[index], false);

Christophe Geuzaine
committed
#endif
case 33:

Christophe Geuzaine
committed
#line 310 "Gmsh.y"
int index = (int)(yyvsp[(4) - (6)].d);
if(index >= 0 && index < (int)PView::list.size())
new PView(PView::list[index], true);

Christophe Geuzaine
committed
#endif
case 34:

Christophe Geuzaine
committed
#line 324 "Gmsh.y"

Christophe Geuzaine
committed
#endif
case 40:

Christophe Geuzaine
committed
#line 338 "Gmsh.y"
{ ViewCoord.push_back((yyvsp[(1) - (1)].d)); ;}
case 41:

Christophe Geuzaine
committed
#line 340 "Gmsh.y"
{ ViewCoord.push_back((yyvsp[(3) - (3)].d)); ;}
case 42:

Christophe Geuzaine
committed
#line 345 "Gmsh.y"
{ if(ViewValueList) ViewValueList->push_back((yyvsp[(1) - (1)].d)); ;}
case 43:

Christophe Geuzaine
committed
#line 347 "Gmsh.y"
{ if(ViewValueList) ViewValueList->push_back((yyvsp[(3) - (3)].d)); ;}
break;
case 44:

Christophe Geuzaine
committed
#line 352 "Gmsh.y"

Christophe Geuzaine
committed
if(!strncmp((yyvsp[(1) - (1)].c), "SP", 2)){
ViewValueList = &ViewData->SP; ViewNumList = &ViewData->NbSP;

Christophe Geuzaine
committed
else if(!strncmp((yyvsp[(1) - (1)].c), "VP", 2)){
ViewValueList = &ViewData->VP; ViewNumList = &ViewData->NbVP;

Christophe Geuzaine
committed
else if(!strncmp((yyvsp[(1) - (1)].c), "TP", 2)){
ViewValueList = &ViewData->TP; ViewNumList = &ViewData->NbTP;

Christophe Geuzaine
committed
else if(!strncmp((yyvsp[(1) - (1)].c), "SL", 2)){
ViewValueList = &ViewData->SL; ViewNumList = &ViewData->NbSL;

Jean-François Remacle
committed
if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_LIN);

Christophe Geuzaine
committed
else if(!strncmp((yyvsp[(1) - (1)].c), "VL", 2)){
ViewValueList = &ViewData->VL; ViewNumList = &ViewData->NbVL;

Jean-François Remacle
committed
if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_LIN);

Christophe Geuzaine
committed
else if(!strncmp((yyvsp[(1) - (1)].c), "TL", 2)){
ViewValueList = &ViewData->TL; ViewNumList = &ViewData->NbTL;

Jean-François Remacle
committed
if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_LIN);

Christophe Geuzaine
committed
else if(!strncmp((yyvsp[(1) - (1)].c), "ST", 2)){
ViewValueList = &ViewData->ST; ViewNumList = &ViewData->NbST;

Jean-François Remacle
committed
if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_TRI);

Christophe Geuzaine
committed
else if(!strncmp((yyvsp[(1) - (1)].c), "VT", 2)){
ViewValueList = &ViewData->VT; ViewNumList = &ViewData->NbVT;

Jean-François Remacle
committed
if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_TRI);

Christophe Geuzaine
committed
else if(!strncmp((yyvsp[(1) - (1)].c), "TT", 2)){
ViewValueList = &ViewData->TT; ViewNumList = &ViewData->NbTT;

Jean-François Remacle
committed
if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_TRI);

Christophe Geuzaine
committed
else if(!strncmp((yyvsp[(1) - (1)].c), "SQ", 2)){
ViewValueList = &ViewData->SQ; ViewNumList = &ViewData->NbSQ;

Jean-François Remacle
committed
if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_QUA);

Christophe Geuzaine
committed
else if(!strncmp((yyvsp[(1) - (1)].c), "VQ", 2)){
ViewValueList = &ViewData->VQ; ViewNumList = &ViewData->NbVQ;

Jean-François Remacle
committed
if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_QUA);

Christophe Geuzaine
committed
else if(!strncmp((yyvsp[(1) - (1)].c), "TQ", 2)){
ViewValueList = &ViewData->TQ; ViewNumList = &ViewData->NbTQ;

Jean-François Remacle
committed
if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_QUA);

Christophe Geuzaine
committed
else if(!strncmp((yyvsp[(1) - (1)].c), "SS", 2)){
ViewValueList = &ViewData->SS; ViewNumList = &ViewData->NbSS;

Jean-François Remacle
committed
if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_TET);

Christophe Geuzaine
committed
else if(!strncmp((yyvsp[(1) - (1)].c), "VS", 2)){
ViewValueList = &ViewData->VS; ViewNumList = &ViewData->NbVS;

Jean-François Remacle
committed
if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_TET);

Christophe Geuzaine
committed
else if(!strncmp((yyvsp[(1) - (1)].c), "TS", 2)){
ViewValueList = &ViewData->TS; ViewNumList = &ViewData->NbTS;

Jean-François Remacle
committed
if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_TET);

Christophe Geuzaine
committed
else if(!strncmp((yyvsp[(1) - (1)].c), "SH", 2)){
ViewValueList = &ViewData->SH; ViewNumList = &ViewData->NbSH;

Jean-François Remacle
committed
if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_HEX);

Christophe Geuzaine
committed
else if(!strncmp((yyvsp[(1) - (1)].c), "VH", 2)){
ViewValueList = &ViewData->VH; ViewNumList = &ViewData->NbVH;

Jean-François Remacle
committed
if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_HEX);

Christophe Geuzaine
committed
else if(!strncmp((yyvsp[(1) - (1)].c), "TH", 2)){
ViewValueList = &ViewData->TH; ViewNumList = &ViewData->NbTH;

Jean-François Remacle
committed
if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_HEX);

Christophe Geuzaine
committed
else if(!strncmp((yyvsp[(1) - (1)].c), "SI", 2)){
ViewValueList = &ViewData->SI; ViewNumList = &ViewData->NbSI;

Jean-François Remacle
committed
if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_PRI);

Christophe Geuzaine
committed
else if(!strncmp((yyvsp[(1) - (1)].c), "VI", 2)){
ViewValueList = &ViewData->VI; ViewNumList = &ViewData->NbVI;

Jean-François Remacle
committed
if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_PRI);

Christophe Geuzaine
committed
else if(!strncmp((yyvsp[(1) - (1)].c), "TI", 2)){
ViewValueList = &ViewData->TI; ViewNumList = &ViewData->NbTI;

Jean-François Remacle
committed
if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_PRI);

Christophe Geuzaine
committed
else if(!strncmp((yyvsp[(1) - (1)].c), "SY", 2)){
ViewValueList = &ViewData->SY; ViewNumList = &ViewData->NbSY;

Jean-François Remacle
committed
if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_PYR);

Christophe Geuzaine
committed
else if(!strncmp((yyvsp[(1) - (1)].c), "VY", 2)){
ViewValueList = &ViewData->VY; ViewNumList = &ViewData->NbVY;

Jean-François Remacle
committed
if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_PYR);

Christophe Geuzaine
committed
else if(!strncmp((yyvsp[(1) - (1)].c), "TY", 2)){
ViewValueList = &ViewData->TY; ViewNumList = &ViewData->NbTY;

Jean-François Remacle
committed
if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_PYR);
ViewValueList = 0; ViewNumList = 0;

Christophe Geuzaine
committed
#endif
case 45:

Christophe Geuzaine
committed
#line 456 "Gmsh.y"
for(int i = 0; i < 3; i++)
ViewValueList->push_back(ViewCoord[3 * j + i]);

Christophe Geuzaine
committed
#endif
case 46:

Christophe Geuzaine
committed
#line 466 "Gmsh.y"

Christophe Geuzaine
committed
#endif
case 47:

Christophe Geuzaine
committed
#line 475 "Gmsh.y"

Christophe Geuzaine
committed
for(int i = 0; i < (int)strlen((yyvsp[(1) - (1)].c)) + 1; i++) ViewData->T2C.push_back((yyvsp[(1) - (1)].c)[i]);

Christophe Geuzaine
committed
#endif
case 48:

Christophe Geuzaine
committed
#line 482 "Gmsh.y"

Christophe Geuzaine
committed
for(int i = 0; i < (int)strlen((yyvsp[(3) - (3)].c)) + 1; i++) ViewData->T2C.push_back((yyvsp[(3) - (3)].c)[i]);

Christophe Geuzaine
committed
#endif
case 49:

Christophe Geuzaine
committed
#line 492 "Gmsh.y"

Christophe Geuzaine
committed
ViewData->T2D.push_back((yyvsp[(5) - (8)].d));
ViewData->T2D.push_back((yyvsp[(7) - (8)].d));
ViewData->T2D.push_back(ViewData->T2C.size());

Christophe Geuzaine
committed
#endif
case 50:

Christophe Geuzaine
committed
#line 501 "Gmsh.y"

Christophe Geuzaine
committed
#endif
case 51:

Christophe Geuzaine
committed
#line 510 "Gmsh.y"

Christophe Geuzaine
committed
for(int i = 0; i < (int)strlen((yyvsp[(1) - (1)].c)) + 1; i++) ViewData->T3C.push_back((yyvsp[(1) - (1)].c)[i]);

Christophe Geuzaine
committed
#endif
case 52:

Christophe Geuzaine
committed
#line 517 "Gmsh.y"

Christophe Geuzaine
committed
for(int i = 0; i < (int)strlen((yyvsp[(3) - (3)].c)) + 1; i++) ViewData->T3C.push_back((yyvsp[(3) - (3)].c)[i]);

Christophe Geuzaine
committed
#endif
case 53:

Christophe Geuzaine
committed
#line 527 "Gmsh.y"

Christophe Geuzaine
committed
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
committed
#endif
case 54:

Christophe Geuzaine
committed
#line 535 "Gmsh.y"

Christophe Geuzaine
committed
#endif
case 55:

Christophe Geuzaine
committed
#line 545 "Gmsh.y"
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 :
ViewData->setInterpolationMatrices(type, ListOfListOfDouble2Matrix((yyvsp[(3) - (8)].l)),
ListOfListOfDouble2Matrix((yyvsp[(6) - (8)].l)));

Christophe Geuzaine
committed
#endif
case 56:

Christophe Geuzaine
committed
#line 564 "Gmsh.y"
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 :
ViewData->setInterpolationMatrices(type, ListOfListOfDouble2Matrix((yyvsp[(3) - (14)].l)),
ListOfListOfDouble2Matrix((yyvsp[(6) - (14)].l)),
ListOfListOfDouble2Matrix((yyvsp[(12) - (14)].l)));

Christophe Geuzaine
committed
#endif
case 57:

Christophe Geuzaine
committed
#line 583 "Gmsh.y"

Christophe Geuzaine
committed
ViewValueList = &ViewData->Time;

Christophe Geuzaine
committed
#endif
case 58:

Christophe Geuzaine
committed
#line 589 "Gmsh.y"
case 59:

Christophe Geuzaine
committed
#line 596 "Gmsh.y"
case 60:

Christophe Geuzaine
committed
#line 597 "Gmsh.y"
case 61:

Christophe Geuzaine
committed
#line 598 "Gmsh.y"
case 62:

Christophe Geuzaine
committed
#line 599 "Gmsh.y"
case 63:

Christophe Geuzaine
committed
#line 600 "Gmsh.y"
case 64:

Christophe Geuzaine
committed
#line 604 "Gmsh.y"
case 65:

Christophe Geuzaine
committed
#line 605 "Gmsh.y"
case 67:

Christophe Geuzaine
committed
#line 614 "Gmsh.y"
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));
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
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));
case 68:

Christophe Geuzaine
committed
#line 677 "Gmsh.y"
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
{
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));
case 69:
#line 707 "Gmsh.y"
int index = (int)(yyvsp[(3) - (7)].d);
if(!gmsh_yysymbols.count((yyvsp[(1) - (7)].c))){
if(!(yyvsp[(5) - (7)].i)){
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));
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));
case 70:

Christophe Geuzaine
committed
#line 740 "Gmsh.y"
{
if(List_Nbr((yyvsp[(4) - (9)].l)) != List_Nbr((yyvsp[(8) - (9)].l))){
yymsg(0, "Incompatible array dimensions in affectation");
if(!gmsh_yysymbols.count((yyvsp[(1) - (9)].c))){
if(!(yyvsp[(7) - (9)].i)){
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));
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{
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
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));
List_Delete((yyvsp[(4) - (9)].l));
List_Delete((yyvsp[(8) - (9)].l));
case 71:

Christophe Geuzaine
committed
#line 786 "Gmsh.y"
if(!gmsh_yysymbols.count((yyvsp[(1) - (3)].c)))

Christophe Geuzaine
committed
else{
gmsh_yysymbol &s(gmsh_yysymbols[(yyvsp[(1) - (3)].c)]);
if(!s.list && s.value.empty())

Christophe Geuzaine
committed
yymsg(0, "Uninitialized variable '%s'", (yyvsp[(1) - (3)].c));

Christophe Geuzaine
committed
else
Matti Pellika
committed
yymsg(0, "Variable '%s' is a list", (yyvsp[(1) - (3)].c));

Christophe Geuzaine
committed
}
case 72:

Christophe Geuzaine
committed
#line 801 "Gmsh.y"
if(!gmsh_yysymbols.count((yyvsp[(1) - (6)].c)))
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));
case 73:

Christophe Geuzaine
committed
#line 817 "Gmsh.y"
gmsh_yystringsymbols[(yyvsp[(1) - (4)].c)] = std::string((yyvsp[(3) - (4)].c));
Free((yyvsp[(1) - (4)].c));
Free((yyvsp[(3) - (4)].c));
case 74:

Christophe Geuzaine
committed
#line 826 "Gmsh.y"
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))
case 75:

Christophe Geuzaine
committed
#line 832 "Gmsh.y"
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))
case 76:

Christophe Geuzaine
committed
#line 841 "Gmsh.y"
{
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;