Skip to content
Snippets Groups Projects
Gmsh.tab.cpp 234 KiB
Newer Older
#line 2013 "Gmsh.y"
{ yyval.d = yyvsp[-2].d != yyvsp[0].d ;    ;
#line 2014 "Gmsh.y"
{ yyval.d = yyvsp[-2].d && yyvsp[0].d ;    ;
#line 2015 "Gmsh.y"
{ yyval.d = yyvsp[-2].d || yyvsp[0].d ;    ;
#line 2016 "Gmsh.y"
{ yyval.d = yyvsp[-4].d? yyvsp[-2].d : yyvsp[0].d ; ;
#line 2017 "Gmsh.y"
{ yyval.d = exp(yyvsp[-1].d);      ;
#line 2018 "Gmsh.y"
{ yyval.d = log(yyvsp[-1].d);      ;
#line 2019 "Gmsh.y"
{ yyval.d = log10(yyvsp[-1].d);    ;
#line 2020 "Gmsh.y"
{ yyval.d = sqrt(yyvsp[-1].d);     ;
#line 2021 "Gmsh.y"
{ yyval.d = sin(yyvsp[-1].d);      ;
#line 2022 "Gmsh.y"
{ yyval.d = asin(yyvsp[-1].d);     ;
#line 2023 "Gmsh.y"
{ yyval.d = cos(yyvsp[-1].d);      ;
#line 2024 "Gmsh.y"
{ yyval.d = acos(yyvsp[-1].d);     ;
#line 2025 "Gmsh.y"
{ yyval.d = tan(yyvsp[-1].d);      ;
#line 2026 "Gmsh.y"
{ yyval.d = atan(yyvsp[-1].d);     ;
#line 2027 "Gmsh.y"
{ yyval.d = atan2(yyvsp[-3].d,yyvsp[-1].d); ;
#line 2028 "Gmsh.y"
{ yyval.d = sinh(yyvsp[-1].d);     ;
#line 2029 "Gmsh.y"
{ yyval.d = cosh(yyvsp[-1].d);     ;
#line 2030 "Gmsh.y"
{ yyval.d = tanh(yyvsp[-1].d);     ;
#line 2031 "Gmsh.y"
{ yyval.d = fabs(yyvsp[-1].d);     ;
Christophe Geuzaine's avatar
Christophe Geuzaine committed
    break;}
#line 2032 "Gmsh.y"
{ yyval.d = floor(yyvsp[-1].d);    ;
David Colignon's avatar
David Colignon committed
    break;}
#line 2033 "Gmsh.y"
{ yyval.d = ceil(yyvsp[-1].d);     ;
    break;}
#line 2034 "Gmsh.y"
{ yyval.d = fmod(yyvsp[-3].d,yyvsp[-1].d);  ;
Christophe Geuzaine's avatar
Christophe Geuzaine committed
    break;}
#line 2035 "Gmsh.y"
{ yyval.d = fmod(yyvsp[-3].d,yyvsp[-1].d);  ;
#line 2036 "Gmsh.y"
{ yyval.d = sqrt(yyvsp[-3].d*yyvsp[-3].d+yyvsp[-1].d*yyvsp[-1].d); ;
#line 2037 "Gmsh.y"
{ yyval.d = yyvsp[-1].d*(double)rand()/(double)RAND_MAX; ;
#line 2046 "Gmsh.y"
{ yyval.d = yyvsp[0].d; ;
#line 2047 "Gmsh.y"
{ yyval.d = 3.141592653589793; ;
    break;}
case 285:
#line 2048 "Gmsh.y"
{ yyval.d = ParUtil::Instance()->rank(); ;
    break;}
case 286:
#line 2049 "Gmsh.y"
{ yyval.d = ParUtil::Instance()->size(); ;
    break;}
case 287:
#line 2054 "Gmsh.y"
      if (!(pSymbol = (Symbol*)List_PQuery(Symbol_L, &TheSymbol, CompareSymbols))) {
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	vyyerror("Unknown variable '%s'", yyvsp[0].c) ;
	yyval.d = 0. ;
      }
	yyval.d = *(double*)List_Pointer_Fast(pSymbol->val, 0) ;
case 288:
#line 2065 "Gmsh.y"
{
      TheSymbol.Name = yyvsp[-3].c ;
      if (!(pSymbol = (Symbol*)List_PQuery(Symbol_L, &TheSymbol, CompareSymbols))) {
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	vyyerror("Unknown variable '%s'", yyvsp[-3].c) ;
	yyval.d = 0. ;
      }
      else{
	if((pd = (double*)List_Pointer_Test(pSymbol->val, (int)yyvsp[-1].d)))
	  yyval.d = *pd ;
	else{
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	  vyyerror("Uninitialized variable '%s[%d]'", yyvsp[-3].c, (int)yyvsp[-1].d) ;
	  yyval.d = 0. ;
	}
      }
    ;
    break;}
case 289:
#line 2082 "Gmsh.y"
{
      TheSymbol.Name = yyvsp[-1].c ;
      if (!(pSymbol = (Symbol*)List_PQuery(Symbol_L, &TheSymbol, CompareSymbols))) {
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	vyyerror("Unknown variable '%s'", yyvsp[-1].c) ;
	yyval.d = 0. ;
      }
      else
	yyval.d = (*(double*)List_Pointer_Fast(pSymbol->val, 0) += yyvsp[0].i) ;
case 290:
#line 2093 "Gmsh.y"
{
      TheSymbol.Name = yyvsp[-4].c ;
      if (!(pSymbol = (Symbol*)List_PQuery(Symbol_L, &TheSymbol, CompareSymbols))) {
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	vyyerror("Unknown variable '%s'", yyvsp[-4].c) ;
	yyval.d = 0. ;
      }
      else{
	if((pd = (double*)List_Pointer_Test(pSymbol->val, (int)yyvsp[-2].d)))
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	  vyyerror("Uninitialized variable '%s[%d]'", yyvsp[-4].c, (int)yyvsp[-2].d) ;
	  yyval.d = 0. ;
	}
      }
    ;
    break;}
case 291:
#line 2112 "Gmsh.y"
      if(!(pNumCat = Get_NumberOptionCategory(yyvsp[-2].c))){
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	vyyerror("Unknown numeric option class '%s'", yyvsp[-2].c);
	yyval.d = 0. ;
      }
	if(!(pNumOpt =  (double (*) (int, int, double))Get_NumberOption(yyvsp[0].c, pNumCat))){
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	  vyyerror("Unknown numeric option '%s.%s'", yyvsp[-2].c, yyvsp[0].c);
	  yyval.d = 0. ;
	}
case 292:
#line 2128 "Gmsh.y"
      if(!(pNumCat = Get_NumberOptionCategory(yyvsp[-5].c))){
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	vyyerror("Unknown numeric option class '%s'", yyvsp[-5].c);
	yyval.d = 0. ;
      }
	if(!(pNumOpt =  (double (*) (int, int, double))Get_NumberOption(yyvsp[0].c, pNumCat))){
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	  vyyerror("Unknown numeric option '%s[%d].%s'", yyvsp[-5].c, (int)yyvsp[-3].d, yyvsp[0].c);
	  yyval.d = 0. ;
	else
	  yyval.d = pNumOpt((int)yyvsp[-3].d, GMSH_GET, 0);
case 293:
#line 2144 "Gmsh.y"
      if(!(pNumCat = Get_NumberOptionCategory(yyvsp[-3].c))){
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	vyyerror("Unknown numeric option class '%s'", yyvsp[-3].c);
	yyval.d = 0. ;
      }
	if(!(pNumOpt =  (double (*) (int, int, double))Get_NumberOption(yyvsp[-1].c, pNumCat))){
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	  vyyerror("Unknown numeric option '%s.%s'", yyvsp[-3].c, yyvsp[-1].c);
	  yyval.d = 0. ;
	}
	else
	  yyval.d = pNumOpt(0, GMSH_SET|GMSH_GUI, pNumOpt(0, GMSH_GET, 0)+yyvsp[0].i);
case 294:
#line 2160 "Gmsh.y"
      if(!(pNumCat = Get_NumberOptionCategory(yyvsp[-6].c))){
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	vyyerror("Unknown numeric option class '%s'", yyvsp[-6].c);
	yyval.d = 0. ;
      }
	if(!(pNumOpt =  (double (*) (int, int, double))Get_NumberOption(yyvsp[-1].c, pNumCat))){
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	  vyyerror("Unknown numeric option '%s[%d].%s'", yyvsp[-6].c, (int)yyvsp[-4].d, yyvsp[-1].c);
	  yyval.d = 0. ;
	else
	  yyval.d = pNumOpt((int)yyvsp[-4].d, GMSH_SET|GMSH_GUI, pNumOpt((int)yyvsp[-4].d, GMSH_GET, 0)+yyvsp[0].i);
case 295:
#line 2178 "Gmsh.y"
Christophe Geuzaine's avatar
Christophe Geuzaine committed
{
      memcpy(yyval.v, yyvsp[0].v, 5*sizeof(double)) ;
case 296:
#line 2182 "Gmsh.y"
{
      for(i=0 ; i<5 ; i++) yyval.v[i] = -yyvsp[0].v[i] ;
case 297:
#line 2186 "Gmsh.y"
Christophe Geuzaine's avatar
Christophe Geuzaine committed
{ 
      for(i=0 ; i<5 ; i++) yyval.v[i] = yyvsp[0].v[i];
case 298:
#line 2190 "Gmsh.y"
{ 
      for(i=0 ; i<5 ; i++) yyval.v[i] = yyvsp[-2].v[i] - yyvsp[0].v[i] ;
case 299:
#line 2194 "Gmsh.y"
{
      for(i=0 ; i<5 ; i++) yyval.v[i] = yyvsp[-2].v[i] + yyvsp[0].v[i] ;
case 300:
#line 2200 "Gmsh.y"
Christophe Geuzaine's avatar
Christophe Geuzaine committed
{ 
      yyval.v[0]=yyvsp[-9].d;  yyval.v[1]=yyvsp[-7].d;  yyval.v[2]=yyvsp[-5].d;  yyval.v[3]=yyvsp[-3].d; yyval.v[4]=yyvsp[-1].d;
case 301:
#line 2204 "Gmsh.y"
{ 
      yyval.v[0]=yyvsp[-7].d;  yyval.v[1]=yyvsp[-5].d;  yyval.v[2]=yyvsp[-3].d;  yyval.v[3]=yyvsp[-1].d; yyval.v[4]=1.0;
case 302:
#line 2208 "Gmsh.y"
      yyval.v[0]=yyvsp[-5].d;  yyval.v[1]=yyvsp[-3].d;  yyval.v[2]=yyvsp[-1].d;  yyval.v[3]=0.0; yyval.v[4]=1.0;
case 303:
#line 2212 "Gmsh.y"
      yyval.v[0]=yyvsp[-5].d;  yyval.v[1]=yyvsp[-3].d;  yyval.v[2]=yyvsp[-1].d;  yyval.v[3]=0.0; yyval.v[4]=1.0;
#line 2219 "Gmsh.y"
case 305:
#line 2222 "Gmsh.y"
#line 2228 "Gmsh.y"
case 307:
#line 2231 "Gmsh.y"
David Colignon's avatar
David Colignon committed
{
    ;
    break;}
#line 2237 "Gmsh.y"
{
    ;
    break;}
case 309:
#line 2240 "Gmsh.y"
       yyval.l=yyvsp[-1].l;
case 310:
#line 2244 "Gmsh.y"
Christophe Geuzaine's avatar
Christophe Geuzaine committed
{
       yyval.l=yyvsp[-1].l;
Christophe Geuzaine's avatar
Christophe Geuzaine committed
    ;
    break;}
case 311:
#line 2251 "Gmsh.y"
      yyval.l = List_Create(2,1,sizeof(List_T*)) ;
      List_Add(yyval.l, &(yyvsp[0].l)) ;
case 312:
#line 2256 "Gmsh.y"
{
      List_Add(yyval.l, &(yyvsp[0].l)) ;
    ;
    break;}
case 313:
#line 2264 "Gmsh.y"
      yyval.l = List_Create(2,1,sizeof(double)) ;
      List_Add(yyval.l, &(yyvsp[0].d)) ;
case 314:
#line 2269 "Gmsh.y"
      yyval.l = yyvsp[0].l ;
case 315:
#line 2273 "Gmsh.y"
{
      yyval.l=yyvsp[-1].l;
    ;
    break;}
case 316:
#line 2277 "Gmsh.y"
Christophe Geuzaine's avatar
Christophe Geuzaine committed
      yyval.l=yyvsp[-1].l;
      for(i=0 ; i<List_Nbr(yyval.l) ; i++){
	pd = (double*)List_Pointer(yyval.l, i);
	(*pd) = - (*pd);
case 317:
#line 2288 "Gmsh.y"
{ 
      yyval.l = List_Create(2,1,sizeof(double)) ; 
      for(d=yyvsp[-2].d ; (yyvsp[-2].d<yyvsp[0].d)?(d<=yyvsp[0].d):(d>=yyvsp[0].d) ; (yyvsp[-2].d<yyvsp[0].d)?(d+=1.):(d-=1.)) 
	List_Add(yyval.l, &d) ;
    ;
    break;}
case 318:
#line 2294 "Gmsh.y"
      yyval.l = List_Create(2,1,sizeof(double)) ; 
      if(!yyvsp[0].d || (yyvsp[-4].d<yyvsp[-2].d && yyvsp[0].d<0) || (yyvsp[-4].d>yyvsp[-2].d && yyvsp[0].d>0)){
        vyyerror("Wrong increment in '%g:%g:%g'", yyvsp[-4].d, yyvsp[-2].d, yyvsp[0].d) ;
	List_Add(yyval.l, &(yyvsp[-4].d)) ;
      }
      else
	for(d=yyvsp[-4].d ; (yyvsp[0].d>0)?(d<=yyvsp[-2].d):(d>=yyvsp[-2].d) ; d+=yyvsp[0].d)
	  List_Add(yyval.l, &d) ;
   ;
case 319:
#line 2305 "Gmsh.y"
{
      yyval.l = List_Create(2,1,sizeof(double)) ;
Christophe Geuzaine's avatar
Christophe Geuzaine committed
      TheSymbol.Name = yyvsp[-2].c ;
      if (!(pSymbol = (Symbol*)List_PQuery(Symbol_L, &TheSymbol, CompareSymbols))) {
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	vyyerror("Unknown variable '%s'", yyvsp[-2].c) ;
	d = 0.0 ;
	List_Add(yyval.l, &d);
      }
      else{
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	for(i = 0 ; i < List_Nbr(pSymbol->val) ; i++)
	  List_Add(yyval.l, (double*)List_Pointer_Fast(pSymbol->val, i)) ;
case 320:
#line 2319 "Gmsh.y"
      yyval.l = List_Create(2,1,sizeof(double)) ;
      TheSymbol.Name = yyvsp[-2].c ;
      if (!(pSymbol = (Symbol*)List_PQuery(Symbol_L, &TheSymbol, CompareSymbols))) {
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	vyyerror("Unknown variable '%s'", yyvsp[-2].c) ;
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	d = 0.0 ;
	List_Add(yyval.l, &d);
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	for(i = 0 ; i < List_Nbr(pSymbol->val) ; i++){
	  d = - *(double*)List_Pointer_Fast(pSymbol->val, i);
	  List_Add(yyval.l, &d) ;
	}
case 321:
#line 2335 "Gmsh.y"
      yyval.l = List_Create(2,1,sizeof(double)) ;
      TheSymbol.Name = yyvsp[-5].c ;
      if (!(pSymbol = (Symbol*)List_PQuery(Symbol_L, &TheSymbol, CompareSymbols))) {
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	vyyerror("Unknown variable '%s'", yyvsp[-5].c) ;
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	d = 0.0 ;
	List_Add(yyval.l, &d);
      }
      else{
	for(i = 0 ; i < List_Nbr(yyvsp[-2].l) ; i++){
	  j = (int)(*(double*)List_Pointer_Fast(yyvsp[-2].l, i));
	  if((pd = (double*)List_Pointer_Test(pSymbol->val, j)))
	    List_Add(yyval.l, pd) ;
	  else
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	    vyyerror("Uninitialized variable '%s[%d]'", yyvsp[-5].c, j) ;	  
      List_Delete(yyvsp[-2].l);
case 322:
#line 2355 "Gmsh.y"
{
      yyval.l = List_Create(2,1,sizeof(double)) ;
      TheSymbol.Name = yyvsp[-5].c ;
      if (!(pSymbol = (Symbol*)List_PQuery(Symbol_L, &TheSymbol, CompareSymbols))) {
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	vyyerror("Unknown variable '%s'", yyvsp[-5].c) ;
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	d = 0.0 ;
	List_Add(yyval.l, &d);
      }
      else{
	for(i = 0 ; i < List_Nbr(yyvsp[-2].l) ; i++){
	  j = (int)(*(double*)List_Pointer_Fast(yyvsp[-2].l, i));
	  if((pd = (double*)List_Pointer_Test(pSymbol->val, j))){
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	    d = - *pd;
	    List_Add(yyval.l, &d) ;
	  }
	  else
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	    vyyerror("Uninitialized variable '%s[%d]'", yyvsp[-5].c, j) ;	  
	}
      }
      List_Delete(yyvsp[-2].l);
    ;
    break;}
case 323:
#line 2380 "Gmsh.y"
{
      yyval.l = List_Create(2,1,sizeof(double)) ;
      List_Add(yyval.l, &(yyvsp[0].d)) ;
    ;
    break;}
case 324:
#line 2385 "Gmsh.y"
Christophe Geuzaine's avatar
Christophe Geuzaine committed
{
      yyval.l = yyvsp[0].l ;
    ;
    break;}
case 325:
#line 2389 "Gmsh.y"
{
      List_Add(yyval.l, &(yyvsp[0].d)) ;
    ;
    break;}
case 326:
#line 2393 "Gmsh.y"
      for(i=0 ; i<List_Nbr(yyvsp[0].l) ; i++){
	List_Read(yyvsp[0].l, i, &d) ;
	List_Add(yyval.l, &d) ;
      List_Delete(yyvsp[0].l);
case 327:
#line 2405 "Gmsh.y"
{
      yyval.u = PACK_COLOR((int)yyvsp[-7].d, (int)yyvsp[-5].d, (int)yyvsp[-3].d, (int)yyvsp[-1].d);
    ;
    break;}
case 328:
#line 2409 "Gmsh.y"
{
      yyval.u = PACK_COLOR((int)yyvsp[-5].d, (int)yyvsp[-3].d, (int)yyvsp[-1].d, 255);
    ;
    break;}
case 329:
#line 2420 "Gmsh.y"
{
      yyval.u = Get_ColorForString(ColorString, -1, yyvsp[0].c, &flag);
Christophe Geuzaine's avatar
Christophe Geuzaine committed
      if(flag) vyyerror("Unknown color '%s'", yyvsp[0].c);
case 330:
#line 2425 "Gmsh.y"
      if(!(pColCat = Get_ColorOptionCategory(yyvsp[-4].c))){
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	vyyerror("Unknown color option class '%s'", yyvsp[-4].c);
	yyval.u = 0 ;
      }
	if(!(pColOpt =  (unsigned int (*) (int, int, unsigned int))Get_ColorOption(yyvsp[0].c, pColCat))){
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	  vyyerror("Unknown color option '%s.Color.%s'", yyvsp[-4].c, yyvsp[0].c);
	  yyval.u = 0 ;
	}
case 331:
#line 2444 "Gmsh.y"
      yyval.l = yyvsp[-1].l;
case 332:
#line 2448 "Gmsh.y"
      yyval.l = List_Create(256,10,sizeof(unsigned int)) ;
      ColorTable *ct = Get_ColorTable((int)yyvsp[-3].d);
      if(!ct)
	vyyerror("View[%d] does not exist", (int)yyvsp[-3].d);
	  List_Add(yyval.l, &ct->table[i]);
case 333:
#line 2462 "Gmsh.y"
      yyval.l = List_Create(256,10,sizeof(unsigned int)) ;
      List_Add(yyval.l, &(yyvsp[0].u)) ;
case 334:
#line 2467 "Gmsh.y"
      List_Add(yyval.l, &(yyvsp[0].u)) ;
case 335:
#line 2474 "Gmsh.y"
{
      yyval.c = yyvsp[0].c;
    ;
    break;}
case 336:
#line 2478 "Gmsh.y"
{
      yyval.c = (char *)Malloc((strlen(yyvsp[-3].c)+strlen(yyvsp[-1].c)+1)*sizeof(char)) ;
      strcpy(yyval.c, yyvsp[-3].c) ;  
      strcat(yyval.c, yyvsp[-1].c) ;
      Free(yyvsp[-3].c);
      Free(yyvsp[-1].c);
    ;
    break;}
case 337:
#line 2486 "Gmsh.y"
{
      yyval.c = (char *)Malloc((strlen(yyvsp[-1].c)+1)*sizeof(char)) ;
      for(i=strlen(yyvsp[-1].c)-1; i>=0; i--){
	if(yyvsp[-1].c[i] == '.'){
	  strncpy(yyval.c,yyvsp[-1].c,i);
	  yyval.c[i]='\0';
	  break;
	}
      }
      if(i<=0) strcpy(yyval.c,yyvsp[-1].c);
      Free(yyvsp[-1].c);
    ;
    break;}
case 338:
#line 2499 "Gmsh.y"
{
      yyval.c = yyvsp[-1].c;
    ;
    break;}
case 339:
#line 2503 "Gmsh.y"
      for(i = 0 ; i<List_Nbr(yyvsp[-1].l) ; i++){
	if(!i){
	  str = strtok(yyvsp[-3].c, "%");
	  strcpy(tmpstring, str);
	}
	str = strtok(NULL, "%");
	if(str){
	  strcpy(tmpstring2, "%");
	  strcat(tmpstring2, str);
	  sprintf(tmpstring3, tmpstring2, *(double*)List_Pointer(yyvsp[-1].l,i)); 
	  strcat(tmpstring, tmpstring3);
	}
	else{
Christophe Geuzaine's avatar
Christophe Geuzaine committed
	  vyyerror("Missing %d parameter(s) in Sprintf format",
		   List_Nbr(yyvsp[-1].l)-i);
      yyval.c = (char*)Malloc((strlen(tmpstring)+1)*sizeof(char));
      strcpy(yyval.c, tmpstring);
      List_Delete(yyvsp[-1].l);
      Free(yyvsp[-3].c);
    ;
    break;}
case 340:
#line 2528 "Gmsh.y"
{ 
      if(!(pStrCat = Get_StringOptionCategory(yyvsp[-3].c)))
	vyyerror("Unknown string option class '%s'", yyvsp[-3].c);
      else{
	if(!(pStrOpt = (char *(*) (int, int, char *))Get_StringOption(yyvsp[-1].c, pStrCat)))
	  vyyerror("Unknown string option '%s.%s'", yyvsp[-3].c, yyvsp[-1].c);
	else{
	  str = pStrOpt(0,GMSH_GET,NULL) ;
	  yyval.c = (char*)Malloc((strlen(str)+1)*sizeof(char));
	  strcpy(yyval.c, str);
	}
      }
    ;
    break;}
case 341:
#line 2542 "Gmsh.y"
{ 
      if(!(pStrCat = Get_StringOptionCategory(yyvsp[-6].c)))
	vyyerror("Unknown string option class '%s'", yyvsp[-6].c);
      else{
	if(!(pStrOpt = (char *(*) (int, int, char *))Get_StringOption(yyvsp[-1].c, pStrCat)))
	  vyyerror("Unknown string option '%s[%d].%s'", yyvsp[-6].c, (int)yyvsp[-4].d, yyvsp[-1].c);
	else{
	  str = pStrOpt((int)yyvsp[-4].d,GMSH_GET,NULL) ;
	  yyval.c = (char*)Malloc((strlen(str)+1)*sizeof(char));
	  strcpy(yyval.c, str);
	}
      }
}
   /* the action file gets copied in in place of this dollarsign */
#line 543 "/usr/lib/bison.simple"

  yyvsp -= yylen;
  yyssp -= yylen;
#ifdef YYLSP_NEEDED
  yylsp -= yylen;
#endif

#if YYDEBUG != 0
  if (yydebug)
    {
      short *ssp1 = yyss - 1;
      fprintf (stderr, "state stack now");
      while (ssp1 != yyssp)
	fprintf (stderr, " %d", *++ssp1);
      fprintf (stderr, "\n");
    }
#endif

  *++yyvsp = yyval;

#ifdef YYLSP_NEEDED
  yylsp++;
  if (yylen == 0)
    {
      yylsp->first_line = yylloc.first_line;
      yylsp->first_column = yylloc.first_column;
      yylsp->last_line = (yylsp-1)->last_line;
      yylsp->last_column = (yylsp-1)->last_column;
      yylsp->text = 0;
    }
  else
    {
      yylsp->last_line = (yylsp+yylen-1)->last_line;
      yylsp->last_column = (yylsp+yylen-1)->last_column;
    }
#endif

  /* Now "shift" the result of the reduction.
     Determine what state that goes to,
     based on the state we popped back to
     and the rule number reduced by.  */

  yyn = yyr1[yyn];

  yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
  if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
    yystate = yytable[yystate];
  else
    yystate = yydefgoto[yyn - YYNTBASE];

  goto yynewstate;

yyerrlab:   /* here on detecting error */

  if (! yyerrstatus)
    /* If not already recovering from an error, report this error.  */
    {
      ++yynerrs;

#ifdef YYERROR_VERBOSE
      yyn = yypact[yystate];

      if (yyn > YYFLAG && yyn < YYLAST)
	{
	  int size = 0;
	  char *msg;
	  int x, count;

	  count = 0;
	  /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */
	  for (x = (yyn < 0 ? -yyn : 0);
	       x < (sizeof(yytname) / sizeof(char *)); x++)
	    if (yycheck[x + yyn] == x)
	      size += strlen(yytname[x]) + 15, count++;
	  msg = (char *) malloc(size + 15);
	  if (msg != 0)
	    {
	      strcpy(msg, "parse error");

	      if (count < 5)
		{
		  count = 0;
		  for (x = (yyn < 0 ? -yyn : 0);
		       x < (sizeof(yytname) / sizeof(char *)); x++)
		    if (yycheck[x + yyn] == x)
		      {
			strcat(msg, count == 0 ? ", expecting `" : " or `");
			strcat(msg, yytname[x]);
			strcat(msg, "'");
			count++;
		      }
		}
	      yyerror(msg);
	      free(msg);
	    }
	  else
	    yyerror ("parse error; also virtual memory exceeded");
	}
      else
#endif /* YYERROR_VERBOSE */
	yyerror("parse error");
    }

  goto yyerrlab1;
yyerrlab1:   /* here on error raised explicitly by an action */

  if (yyerrstatus == 3)
    {
      /* if just tried and failed to reuse lookahead token after an error, discard it.  */

      /* return failure if at end of input */
      if (yychar == YYEOF)
	YYABORT;

#if YYDEBUG != 0
      if (yydebug)
	fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
#endif

      yychar = YYEMPTY;
    }

  /* Else will try to reuse lookahead token
     after shifting the error token.  */

  yyerrstatus = 3;		/* Each real token shifted decrements this */

  goto yyerrhandle;

yyerrdefault:  /* current state does not do anything special for the error token. */

#if 0
  /* This is wrong; only states that explicitly want error tokens
     should shift them.  */
  yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
  if (yyn) goto yydefault;
#endif

yyerrpop:   /* pop the current state because it cannot handle the error token */

  if (yyssp == yyss) YYABORT;
  yyvsp--;
  yystate = *--yyssp;
#ifdef YYLSP_NEEDED
  yylsp--;
#endif

#if YYDEBUG != 0
  if (yydebug)
    {
      short *ssp1 = yyss - 1;
      fprintf (stderr, "Error: state stack now");
      while (ssp1 != yyssp)
	fprintf (stderr, " %d", *++ssp1);
      fprintf (stderr, "\n");
    }
#endif

yyerrhandle:

  yyn = yypact[yystate];
  if (yyn == YYFLAG)
    goto yyerrdefault;

  yyn += YYTERROR;
  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
    goto yyerrdefault;

  yyn = yytable[yyn];
  if (yyn < 0)
    {
      if (yyn == YYFLAG)
	goto yyerrpop;
      yyn = -yyn;
      goto yyreduce;
    }
  else if (yyn == 0)
    goto yyerrpop;

  if (yyn == YYFINAL)
    YYACCEPT;

#if YYDEBUG != 0
  if (yydebug)
    fprintf(stderr, "Shifting error token, ");
#endif

  *++yyvsp = yylval;
#ifdef YYLSP_NEEDED
  *++yylsp = yylloc;
#endif

  yystate = yyn;
  goto yynewstate;

 yyacceptlab:
  /* YYACCEPT comes here.  */
  if (yyfree_stacks)
    {
      free (yyss);
      free (yyvs);
#ifdef YYLSP_NEEDED
      free (yyls);
#endif
    }
  return 0;

 yyabortlab:
  /* YYABORT comes here.  */
  if (yyfree_stacks)
    {
      free (yyss);
      free (yyvs);
#ifdef YYLSP_NEEDED
      free (yyls);
#endif
    }
  return 1;
#line 2557 "Gmsh.y"
  if(!Symbol_L)
    Symbol_L = List_Create(50,10,sizeof(Symbol));
  else
    List_Reset(Symbol_L);
  int i;
  for(i = 0 ; i < List_Nbr(Symbol_L) ; i++)
    List_Delete(((Symbol*)List_Pointer_Fast(Symbol_L,i))->val);
  List_Delete(Symbol_L);
}

int CompareSymbols (const void *a, const void *b){
  return(strcmp(((Symbol*)a)->Name,((Symbol*)b)->Name));
}
  
void yyerror(char *s){
  Msg(PARSER_ERROR, "'%s', line %d : %s (%s)",yyname,yylineno-1,s,yytext);
  yyerrorstate=1;
}

Christophe Geuzaine's avatar
Christophe Geuzaine committed
void vyyerror(char *fmt, ...){
Christophe Geuzaine's avatar
Christophe Geuzaine committed
  char tmp[TEXT_BUFFER_SIZE];

  va_start (args, fmt);
  vsprintf (tmp, fmt, args);
  va_end (args);

  Msg(PARSER_ERROR, "'%s', line %d : %s", yyname, yylineno-1, tmp);
  yyerrorstate=1;
}