Skip to content
Snippets Groups Projects
Gmsh.tab.cpp 406 KiB
Newer Older
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

  case 421:
/* Line 1778 of yacc.c  */
#line 4616 "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;

  case 422:
/* Line 1778 of yacc.c  */
#line 4620 "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;

  case 423:
/* Line 1778 of yacc.c  */
#line 4632 "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;

  case 424:
/* Line 1778 of yacc.c  */
#line 4639 "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;

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

  case 426:
/* Line 1778 of yacc.c  */
#line 4653 "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;

  case 427:
/* Line 1778 of yacc.c  */
#line 4668 "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;

  case 428:
/* Line 1778 of yacc.c  */
#line 4673 "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;

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

  case 430:
/* Line 1778 of yacc.c  */
#line 4684 "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;

  case 431:
/* Line 1778 of yacc.c  */
#line 4697 "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));
  case 432:
/* Line 1778 of yacc.c  */
#line 4705 "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));
  case 433:
/* Line 1778 of yacc.c  */
#line 4716 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    {
      (yyval.c) = (yyvsp[(1) - (1)].c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    break;

  case 434:
/* Line 1778 of yacc.c  */
#line 4720 "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;

  case 435:
/* Line 1778 of yacc.c  */
#line 4728 "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));
  case 436:
/* Line 1778 of yacc.c  */
#line 4736 "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));
  case 437:
/* Line 1778 of yacc.c  */
#line 4744 "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;

  case 438:
/* Line 1778 of yacc.c  */
#line 4752 "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;

  case 439:
/* Line 1778 of yacc.c  */
#line 4766 "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;

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

  case 441:
/* Line 1778 of yacc.c  */
#line 4784 "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;

  case 442:
/* Line 1778 of yacc.c  */
#line 4806 "Gmsh.y"
    {
      (yyval.l) = List_Create(20,20,sizeof(char*));
      List_Add((yyval.l), &((yyvsp[(1) - (1)].c)));
  case 443:
/* Line 1778 of yacc.c  */
#line 4811 "Gmsh.y"
    { List_Add((yyval.l), &((yyvsp[(3) - (3)].c))); }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

/* Line 1778 of yacc.c  */
#line 10272 "Gmsh.tab.cpp"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      default: break;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
    }
  /* User semantic actions sometimes alter yychar, and that requires
     that yytoken be updated with the new translation.  We take the
     approach of translating immediately before every use of yytoken.
     One alternative is translating here after every semantic action,
     but that translation would be missed if the semantic action invokes
     YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
     if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
     incorrect destructor might then be invoked immediately.  In the
     case of YYERROR or YYBACKUP, subsequent parser actions might lead
     to an incorrect destructor call or verbose syntax error message
     before the lookahead is translated.  */
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:
  /* Make sure we have latest lookahead translation.  See comments at
     user semantic actions for why this is necessary.  */
  yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
  /* 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
# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
                                        yyssp, yytoken)
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      {
        char const *yymsgp = YY_("syntax error");
        int yysyntax_error_status;
        yysyntax_error_status = YYSYNTAX_ERROR;
        if (yysyntax_error_status == 0)
          yymsgp = yymsg;
        else if (yysyntax_error_status == 1)
          {
            if (yymsg != yymsgbuf)
              YYSTACK_FREE (yymsg);
            yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
            if (!yymsg)
              {
                yymsg = yymsgbuf;
                yymsg_alloc = sizeof yymsgbuf;
                yysyntax_error_status = 2;
              }
            else
              {
                yysyntax_error_status = YYSYNTAX_ERROR;
                yymsgp = yymsg;
              }
          }
        yyerror (yymsgp);
        if (yysyntax_error_status == 2)
          goto yyexhaustedlab;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
# undef YYSYNTAX_ERROR
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 (!yypact_value_is_default (yyn))
	{
	  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);
  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
  *++yyvsp = yylval;
  YY_IGNORE_MAYBE_UNINITIALIZED_END
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:
    {
      /* Make sure we have latest lookahead translation.  See comments at
         user semantic actions for why this is necessary.  */
      yytoken = YYTRANSLATE (yychar);
      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 2041 of yacc.c  */
#line 4814 "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);