Skip to content
Snippets Groups Projects
Gmsh.tab.cpp 389 KiB
Newer Older
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

/* Line 1464 of yacc.c  */
#line 4358 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      (yyval.l) = List_Create(2, 1, sizeof(double));
      if(!gmsh_yysymbols.count((yyvsp[(3) - (4)].c)))
	yymsg(0, "Unknown variable '%s'", (yyvsp[(3) - (4)].c));
      else{
        gmsh_yysymbol &s(gmsh_yysymbols[(yyvsp[(3) - (4)].c)]);
	for(unsigned int i = 0; i < s.value.size(); i++)
	  List_Add((yyval.l), &s.value[i]);
      }
      Free((yyvsp[(3) - (4)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1464 of yacc.c  */
#line 4370 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      (yyval.l) = List_Create(2, 1, sizeof(double));
      if(!gmsh_yysymbols.count((yyvsp[(1) - (6)].c)))
	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)]);
	for(int i = 0; i < List_Nbr((yyvsp[(4) - (6)].l)); i++){
	  int index = (int)(*(double*)List_Pointer_Fast((yyvsp[(4) - (6)].l), i));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  if((int)s.value.size() < index + 1)
	    yymsg(0, "Uninitialized variable '%s[%d]'", (yyvsp[(1) - (6)].c), index);
	  else
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	    List_Add((yyval.l), &s.value[index]);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free((yyvsp[(1) - (6)].c));
      List_Delete((yyvsp[(4) - (6)].l));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1464 of yacc.c  */
#line 4391 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      (yyval.l) = List_Create(2, 1, sizeof(double));
      List_Add((yyval.l), &((yyvsp[(1) - (1)].d)));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1464 of yacc.c  */
#line 4396 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      (yyval.l) = (yyvsp[(1) - (1)].l);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1464 of yacc.c  */
#line 4400 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      List_Add((yyval.l), &((yyvsp[(3) - (3)].d)));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1464 of yacc.c  */
#line 4404 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      for(int i = 0; i < List_Nbr((yyvsp[(3) - (3)].l)); i++){
	double d;
	List_Read((yyvsp[(3) - (3)].l), i, &d);
	List_Add((yyval.l), &d);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      List_Delete((yyvsp[(3) - (3)].l));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1464 of yacc.c  */
#line 4416 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      (yyval.u) = CTX::instance()->packColor((int)(yyvsp[(2) - (9)].d), (int)(yyvsp[(4) - (9)].d), (int)(yyvsp[(6) - (9)].d), (int)(yyvsp[(8) - (9)].d));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1464 of yacc.c  */
#line 4420 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      (yyval.u) = CTX::instance()->packColor((int)(yyvsp[(2) - (7)].d), (int)(yyvsp[(4) - (7)].d), (int)(yyvsp[(6) - (7)].d), 255);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1464 of yacc.c  */
#line 4432 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      (yyval.u) = GetColorForString(-1, (yyvsp[(1) - (1)].c), &flag);
      if(flag) yymsg(0, "Unknown color '%s'", (yyvsp[(1) - (1)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free((yyvsp[(1) - (1)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1464 of yacc.c  */
#line 4439 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      unsigned int val = 0;
      ColorOption(GMSH_GET, (yyvsp[(1) - (5)].c), 0, (yyvsp[(5) - (5)].c), val);
      (yyval.u) = val;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free((yyvsp[(1) - (5)].c)); Free((yyvsp[(5) - (5)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1464 of yacc.c  */
#line 4449 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      (yyval.l) = (yyvsp[(2) - (3)].l);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1464 of yacc.c  */
#line 4453 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      (yyval.l) = List_Create(256, 10, sizeof(unsigned int));
      GmshColorTable *ct = GetColorTable((int)(yyvsp[(3) - (6)].d));
	yymsg(0, "View[%d] does not exist", (int)(yyvsp[(3) - (6)].d));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	for(int i = 0; i < ct->size; i++)
	  List_Add((yyval.l), &ct->table[i]);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free((yyvsp[(1) - (6)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1464 of yacc.c  */
#line 4468 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      (yyval.l) = List_Create(256, 10, sizeof(unsigned int));
      List_Add((yyval.l), &((yyvsp[(1) - (1)].u)));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1464 of yacc.c  */
#line 4473 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      List_Add((yyval.l), &((yyvsp[(3) - (3)].u)));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1464 of yacc.c  */
#line 4480 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      (yyval.c) = (yyvsp[(1) - (1)].c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1464 of yacc.c  */
#line 4484 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      if(!gmsh_yystringsymbols.count((yyvsp[(1) - (1)].c))){
	yymsg(0, "Unknown string variable '%s'", (yyvsp[(1) - (1)].c));
	(yyval.c) = (yyvsp[(1) - (1)].c);
	std::string val = gmsh_yystringsymbols[(yyvsp[(1) - (1)].c)];
	(yyval.c) = (char *)Malloc((val.size() + 1) * sizeof(char));
	strcpy((yyval.c), val.c_str());
	Free((yyvsp[(1) - (1)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1464 of yacc.c  */
#line 4497 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      std::string out;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      StringOption(GMSH_GET, (yyvsp[(1) - (3)].c), 0, (yyvsp[(3) - (3)].c), out);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      (yyval.c) = (char*)Malloc((out.size() + 1) * sizeof(char));
      strcpy((yyval.c), out.c_str());
      Free((yyvsp[(1) - (3)].c)); Free((yyvsp[(3) - (3)].c));
/* Line 1464 of yacc.c  */
#line 4505 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      std::string out;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      StringOption(GMSH_GET, (yyvsp[(1) - (6)].c), (int)(yyvsp[(3) - (6)].d), (yyvsp[(6) - (6)].c), out);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      (yyval.c) = (char*)Malloc((out.size() + 1) * sizeof(char));
      strcpy((yyval.c), out.c_str());
      Free((yyvsp[(1) - (6)].c)); Free((yyvsp[(6) - (6)].c));
/* Line 1464 of yacc.c  */
#line 4516 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      (yyval.c) = (yyvsp[(1) - (1)].c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1464 of yacc.c  */
#line 4520 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      (yyval.c) = (char *)Malloc(32 * sizeof(char));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      time_t now;
      time(&now);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      strcpy((yyval.c), ctime(&now));
      (yyval.c)[strlen((yyval.c)) - 1] = '\0';
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1464 of yacc.c  */
#line 4528 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
Christophe Geuzaine's avatar
Christophe Geuzaine committed
      const char *env = GetEnvironmentVar((yyvsp[(3) - (4)].c));
      if(!env) env = "";
      (yyval.c) = (char *)Malloc((sizeof(env) + 1) * sizeof(char));
      strcpy((yyval.c), env);
      Free((yyvsp[(3) - (4)].c));
/* Line 1464 of yacc.c  */
#line 4536 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      std::string s = Msg::GetString((yyvsp[(3) - (6)].c), (yyvsp[(5) - (6)].c));
      (yyval.c) = (char *)Malloc((s.size() + 1) * sizeof(char));
      strcpy((yyval.c), s.c_str());
      Free((yyvsp[(3) - (6)].c));
      Free((yyvsp[(5) - (6)].c));
/* Line 1464 of yacc.c  */
#line 4544 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      (yyval.c) = (char *)Malloc((strlen((yyvsp[(3) - (6)].c)) + strlen((yyvsp[(5) - (6)].c)) + 1) * sizeof(char));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      strcpy((yyval.c), (yyvsp[(3) - (6)].c));
      strcat((yyval.c), (yyvsp[(5) - (6)].c));
      Free((yyvsp[(3) - (6)].c));
      Free((yyvsp[(5) - (6)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1464 of yacc.c  */
#line 4552 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      (yyval.c) = (char *)Malloc((strlen((yyvsp[(3) - (4)].c)) + 1) * sizeof(char));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      int i;
      for(i = strlen((yyvsp[(3) - (4)].c)) - 1; i >= 0; i--){
	if((yyvsp[(3) - (4)].c)[i] == '.'){
	  strncpy((yyval.c), (yyvsp[(3) - (4)].c), i);
	  (yyval.c)[i]='\0';
	  break;
	}
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(i <= 0) strcpy((yyval.c), (yyvsp[(3) - (4)].c));
      Free((yyvsp[(3) - (4)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1464 of yacc.c  */
#line 4566 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      (yyval.c) = (char *)Malloc((strlen((yyvsp[(3) - (4)].c)) + 1) * sizeof(char));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      int i;
      for(i = strlen((yyvsp[(3) - (4)].c)) - 1; i >= 0; i--){
	if((yyvsp[(3) - (4)].c)[i] == '/' || (yyvsp[(3) - (4)].c)[i] == '\\')
	  break;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      if(i <= 0)
	strcpy((yyval.c), (yyvsp[(3) - (4)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      else
	strcpy((yyval.c), &(yyvsp[(3) - (4)].c)[i+1]);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Free((yyvsp[(3) - (4)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1464 of yacc.c  */
#line 4580 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      (yyval.c) = (yyvsp[(3) - (4)].c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

/* Line 1464 of yacc.c  */
#line 4584 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
Christophe Geuzaine's avatar
Christophe Geuzaine committed
      char tmpstring[5000];
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      int i = PrintListOfDouble((yyvsp[(3) - (6)].c), (yyvsp[(5) - (6)].l), tmpstring);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(i < 0){
	yymsg(0, "Too few arguments in Sprintf");
	(yyval.c) = (yyvsp[(3) - (6)].c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      else if(i > 0){
	yymsg(0, "%d extra argument%s in Sprintf", i, (i > 1) ? "s" : "");
	(yyval.c) = (yyvsp[(3) - (6)].c);
	(yyval.c) = (char*)Malloc((strlen(tmpstring) + 1) * sizeof(char));
	strcpy((yyval.c), tmpstring);
	Free((yyvsp[(3) - (6)].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      List_Delete((yyvsp[(5) - (6)].l));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;


/* Line 1464 of yacc.c  */
#line 10363 "Gmsh.tab.cpp"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      default: break;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);

  YYPOPSTACK (yylen);
  yylen = 0;
  YY_STACK_PRINT (yyss, yyssp);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
  /* 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.  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    yystate = yydefgoto[yyn - YYNTOKENS];
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
/*------------------------------------.
| yyerrlab -- here on detecting error |
`------------------------------------*/
yyerrlab:
  /* If not already recovering from an error, report this error.  */
  if (!yyerrstatus)
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#if ! YYERROR_VERBOSE
      yyerror (YY_("syntax error"));
#else
      {
	YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
	if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
	  {
	    YYSIZE_T yyalloc = 2 * yysize;
	    if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
	      yyalloc = YYSTACK_ALLOC_MAXIMUM;
	    if (yymsg != yymsgbuf)
	      YYSTACK_FREE (yymsg);
	    yymsg = (char *) YYSTACK_ALLOC (yyalloc);
	    if (yymsg)
	      yymsg_alloc = yyalloc;
	    else
	      {
		yymsg = yymsgbuf;
		yymsg_alloc = sizeof yymsgbuf;
	      }
	  }

	if (0 < yysize && yysize <= yymsg_alloc)
	  {
	    (void) yysyntax_error (yymsg, yystate, yychar);
	    yyerror (yymsg);
	  }
	else
	  {
	    yyerror (YY_("syntax error"));
	    if (yysize != 0)
	      goto yyexhaustedlab;
	  }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
#endif
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

      /* If just tried and failed to reuse lookahead token after an
	 error, discard it.  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if (yychar <= YYEOF)
	{
	  /* Return failure if at end of input.  */
	  if (yychar == YYEOF)
	    YYABORT;
	}
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      else
	{
	  yydestruct ("Error: discarding",
		      yytoken, &yylval);
	  yychar = YYEMPTY;
	}
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

  /* Else will try to reuse lookahead token after shifting the error
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
     token.  */
  goto yyerrlab1;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
/*---------------------------------------------------.
| yyerrorlab -- error raised explicitly by YYERROR.  |
`---------------------------------------------------*/
yyerrorlab:
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
  /* Pacify compilers like GCC when the user code never invokes
     YYERROR and the label yyerrorlab therefore never appears in user
     code.  */
  if (/*CONSTCOND*/ 0)
     goto yyerrorlab;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
  /* Do not reclaim the symbols of the rule which action triggered
     this YYERROR.  */
  YYPOPSTACK (yylen);
  yylen = 0;
  YY_STACK_PRINT (yyss, yyssp);
  yystate = *yyssp;
  goto yyerrlab1;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
/*-------------------------------------------------------------.
| yyerrlab1 -- common code for both syntax error and YYERROR.  |
`-------------------------------------------------------------*/
yyerrlab1:
  yyerrstatus = 3;	/* Each real token shifted decrements this.  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
  for (;;)
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      yyn = yypact[yystate];
      if (yyn != YYPACT_NINF)
	{
	  yyn += YYTERROR;
	  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
	    {
	      yyn = yytable[yyn];
	      if (0 < yyn)
		break;
	    }
	}
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      /* Pop the current state because it cannot handle the error token.  */
      if (yyssp == yyss)
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      yydestruct ("Error: popping",
		  yystos[yystate], yyvsp);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      YYPOPSTACK (1);
      yystate = *yyssp;
      YY_STACK_PRINT (yyss, yyssp);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
  *++yyvsp = yylval;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed


  /* Shift the error token.  */
  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

/*-------------------------------------.
| yyacceptlab -- YYACCEPT comes here.  |
`-------------------------------------*/
yyacceptlab:
  yyresult = 0;
  goto yyreturn;

/*-----------------------------------.
| yyabortlab -- YYABORT comes here.  |
`-----------------------------------*/
yyabortlab:
  yyresult = 1;
  goto yyreturn;

#if !defined(yyoverflow) || YYERROR_VERBOSE
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
/*-------------------------------------------------.
| yyexhaustedlab -- memory exhaustion comes here.  |
`-------------------------------------------------*/
yyexhaustedlab:
  yyerror (YY_("memory exhausted"));
  yyresult = 2;
  /* Fall through.  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#endif
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
yyreturn:
     yydestruct ("Cleanup: discarding lookahead",
		 yytoken, &yylval);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
  /* Do not reclaim the symbols of the rule which action triggered
     this YYABORT or YYACCEPT.  */
  YYPOPSTACK (yylen);
  YY_STACK_PRINT (yyss, yyssp);
  while (yyssp != yyss)
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      yydestruct ("Cleanup: popping",
		  yystos[*yyssp], yyvsp);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      YYPOPSTACK (1);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#ifndef yyoverflow
  if (yyss != yyssa)
    YYSTACK_FREE (yyss);
#endif
#if YYERROR_VERBOSE
  if (yymsg != yymsgbuf)
    YYSTACK_FREE (yymsg);
#endif
  /* Make sure YYID is used.  */
  return YYID (yyresult);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed


/* Line 1684 of yacc.c  */
#line 4604 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

int PrintListOfDouble(char *format, List_T *list, char *buffer)
{
Christophe Geuzaine's avatar
Christophe Geuzaine committed
  // if format does not contain formatting characters, dump the list (useful for
  // quick debugging of lists)
  for(unsigned int i = 0; i < strlen(format); i++)
    if(format[i] == '%') numFormats++;
  if(!numFormats){
    strcpy(buffer, format);
    for(int i = 0; i < List_Nbr(list); i++){
      double d;
      List_Read(list, i, &d);
      char tmp[256];
Christophe Geuzaine's avatar
Christophe Geuzaine committed
      sprintf(tmp, " [%d]%g", i, d);
  char tmp1[256], tmp2[256];
  int j = 0, k = 0;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
  buffer[j] = '\0';

  while(j < (int)strlen(format) && format[j] != '%') j++;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
  strncpy(buffer, format, j);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
  for(int i = 0; i < List_Nbr(list); i++){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    if(j < (int)strlen(format)){
      if(format[j] == '%'){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      while(j < (int)strlen(format) && format[j] != '%') j++;
      if(k != j){
	strncpy(tmp1, &(format[k]), j-k);
	tmp1[j-k] = '\0';
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	sprintf(tmp2, tmp1, *(double*)List_Pointer(list, i));
	strcat(buffer, tmp2);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    else
  }
  if(j != (int)strlen(format))
    return -1;
  return 0;
}
fullMatrix<double> ListOfListOfDouble2Matrix(List_T *list)
{
  int M = List_Nbr(list);
  int N = 0;
  for(int i = 0; i < M; i++){
    List_T *line = *(List_T**)List_Pointer_Fast(list, i);
    N = std::max(N, List_Nbr(line));
  }
  fullMatrix<double> mat(M, N);
  for(int i = 0; i < M; i++){
    List_T *line = *(List_T**)List_Pointer_Fast(list, i);
    for(int j = 0; j < List_Nbr(line); j++){
      double val;
      List_Read(line, j, &val);
Christophe Geuzaine's avatar
Christophe Geuzaine committed
      mat(i, j) = val;
Christophe Geuzaine's avatar
Christophe Geuzaine committed
  for(int i = 0; i < List_Nbr(list); i++)
    List_Delete(*(List_T**)List_Pointer(list, i));
  List_Delete(list);
Christophe Geuzaine's avatar
Christophe Geuzaine committed
void yyerror(const char *s)
  Msg::Error("'%s', line %d : %s (%s)", gmsh_yyname.c_str(), gmsh_yylineno - 1,
             s, gmsh_yytext);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
  gmsh_yyerrorstate++;
void yymsg(int level, const char *fmt, ...)
Christophe Geuzaine's avatar
Christophe Geuzaine committed
  char tmp[1024];
  va_start(args, fmt);
  vsprintf(tmp, fmt, args);
  va_end(args);
    Msg::Error("'%s', line %d : %s", gmsh_yyname.c_str(), gmsh_yylineno - 1, tmp);
    Msg::Warning("'%s', line %d : %s", gmsh_yyname.c_str(), gmsh_yylineno - 1, tmp);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed