Newer
Older
{
(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
committed
if(!gmsh_yysymbols.count((yyvsp[(1) - (6)].c)))
yymsg(0, "Unknown variable '%s'", (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));
yymsg(0, "Uninitialized variable '%s[%d]'", (yyvsp[(1) - (6)].c), index);
else
Free((yyvsp[(1) - (6)].c));
List_Delete((yyvsp[(4) - (6)].l));

Christophe Geuzaine
committed
{
(yyval.l) = List_Create(2, 1, sizeof(double));
List_Add((yyval.l), &((yyvsp[(1) - (1)].d)));

Christophe Geuzaine
committed

Christophe Geuzaine
committed

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
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
committed
(yyval.u) = CTX::instance()->packColor((int)(yyvsp[(2) - (7)].d), (int)(yyvsp[(4) - (7)].d), (int)(yyvsp[(6) - (7)].d), 255);

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
committed
unsigned int val = 0;
ColorOption(GMSH_GET, (yyvsp[(1) - (5)].c), 0, (yyvsp[(5) - (5)].c), val);
(yyval.u) = val;

Christophe Geuzaine
committed

Christophe Geuzaine
committed
GmshColorTable *ct = GetColorTable((int)(yyvsp[(3) - (6)].d));

Christophe Geuzaine
committed
if(!ct)
yymsg(0, "View[%d] does not exist", (int)(yyvsp[(3) - (6)].d));
List_Add((yyval.l), &ct->table[i]);

Christophe Geuzaine
committed
{
(yyval.l) = List_Create(256, 10, sizeof(unsigned int));
List_Add((yyval.l), &((yyvsp[(1) - (1)].u)));

Christophe Geuzaine
committed

Christophe Geuzaine
committed

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
committed
StringOption(GMSH_GET, (yyvsp[(1) - (3)].c), 0, (yyvsp[(3) - (3)].c), out);
(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));

Christophe Geuzaine
committed
StringOption(GMSH_GET, (yyvsp[(1) - (6)].c), (int)(yyvsp[(3) - (6)].d), (yyvsp[(6) - (6)].c), out);
(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));

Christophe Geuzaine
committed

Christophe Geuzaine
committed
(yyval.c) = (char *)Malloc(32 * sizeof(char));
strcpy((yyval.c), ctime(&now));
(yyval.c)[strlen((yyval.c)) - 1] = '\0';

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));

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));

Christophe Geuzaine
committed
(yyval.c) = (char *)Malloc((strlen((yyvsp[(3) - (6)].c)) + strlen((yyvsp[(5) - (6)].c)) + 1) * sizeof(char));
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
committed
(yyval.c) = (char *)Malloc((strlen((yyvsp[(3) - (4)].c)) + 1) * sizeof(char));
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;
}
if(i <= 0) strcpy((yyval.c), (yyvsp[(3) - (4)].c));
Free((yyvsp[(3) - (4)].c));

Christophe Geuzaine
committed
(yyval.c) = (char *)Malloc((strlen((yyvsp[(3) - (4)].c)) + 1) * sizeof(char));
for(i = strlen((yyvsp[(3) - (4)].c)) - 1; i >= 0; i--){
if((yyvsp[(3) - (4)].c)[i] == '/' || (yyvsp[(3) - (4)].c)[i] == '\\')
break;
strcpy((yyval.c), (yyvsp[(3) - (4)].c));
strcpy((yyval.c), &(yyvsp[(3) - (4)].c)[i+1]);

Christophe Geuzaine
committed

Christophe Geuzaine
committed
int i = PrintListOfDouble((yyvsp[(3) - (6)].c), (yyvsp[(5) - (6)].l), tmpstring);
yymsg(0, "Too few arguments in Sprintf");
(yyval.c) = (yyvsp[(3) - (6)].c);
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
committed
#line 10363 "Gmsh.tab.cpp"
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
YYPOPSTACK (yylen);
yylen = 0;
YY_STACK_PRINT (yyss, yyssp);
*++yyvsp = yyval;
/* 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 - YYNTOKENS] + *yyssp;
if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
yystate = yytable[yystate];
else
goto yynewstate;
/*------------------------------------.
| yyerrlab -- here on detecting error |
`------------------------------------*/
yyerrlab:
/* If not already recovering from an error, report this error. */
if (!yyerrstatus)
{
++yynerrs;
#if ! YYERROR_VERBOSE
yyerror (YY_("syntax error"));
#else
{
10400
10401
10402
10403
10404
10405
10406
10407
10408
10409
10410
10411
10412
10413
10414
10415
10416
10417
10418
10419
10420
10421
10422
10423
10424
10425
10426
10427
10428
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;
}
if (yyerrstatus == 3)
{

Christophe Geuzaine
committed
/* 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;
}
{
yydestruct ("Error: discarding",
yytoken, &yylval);
yychar = YYEMPTY;
}

Christophe Geuzaine
committed
/* Else will try to reuse lookahead token after shifting the error
/*---------------------------------------------------.
| yyerrorlab -- error raised explicitly by YYERROR. |
`---------------------------------------------------*/
yyerrorlab:
/* 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;
/* 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;
/*-------------------------------------------------------------.
| yyerrlab1 -- common code for both syntax error and YYERROR. |
`-------------------------------------------------------------*/
yyerrlab1:
yyerrstatus = 3; /* Each real token shifted decrements this. */
{
yyn += YYTERROR;
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
{
yyn = yytable[yyn];
if (0 < yyn)
break;
}
}
/* Pop the current state because it cannot handle the error token. */
if (yyssp == yyss)
yystos[yystate], yyvsp);
YYPOPSTACK (1);
yystate = *yyssp;
YY_STACK_PRINT (yyss, yyssp);
}
/* Shift the error token. */
YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
yystate = yyn;
goto yynewstate;
/*-------------------------------------.
| yyacceptlab -- YYACCEPT comes here. |
`-------------------------------------*/
yyacceptlab:
yyresult = 0;
goto yyreturn;
/*-----------------------------------.
| yyabortlab -- YYABORT comes here. |
`-----------------------------------*/
yyabortlab:
yyresult = 1;
goto yyreturn;

Christophe Geuzaine
committed
#if !defined(yyoverflow) || YYERROR_VERBOSE
/*-------------------------------------------------.
| yyexhaustedlab -- memory exhaustion comes here. |
`-------------------------------------------------*/
yyexhaustedlab:
yyerror (YY_("memory exhausted"));
yyresult = 2;
/* Fall through. */

Christophe Geuzaine
committed
if (yychar != YYEMPTY)
yydestruct ("Cleanup: discarding lookahead",
yytoken, &yylval);
/* 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)
yystos[*yyssp], yyvsp);
#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
committed
int PrintListOfDouble(char *format, List_T *list, char *buffer)
{
// if format does not contain formatting characters, dump the list (useful for
// quick debugging of lists)
int numFormats = 0;

Christophe Geuzaine
committed
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];
strcat(buffer, tmp);
}
return 0;
}
char tmp1[256], tmp2[256];
int j = 0, k = 0;
buffer[j] = '\0';
while(j < (int)strlen(format) && format[j] != '%') j++;
buffer[j] = '\0';
strcat(buffer, "%");
j++;
strncpy(tmp1, &(format[k]), j-k);
tmp1[j-k] = '\0';
strcat(buffer, tmp2);
return List_Nbr(list) - i;
}
if(j != (int)strlen(format))
return -1;
return 0;
}

Christophe Geuzaine
committed
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));
}
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);
}
}
for(int i = 0; i < List_Nbr(list); i++)
List_Delete(*(List_T**)List_Pointer(list, i));
List_Delete(list);
return mat;
}
Msg::Error("'%s', line %d : %s (%s)", gmsh_yyname.c_str(), gmsh_yylineno - 1,
s, gmsh_yytext);
}
void yymsg(int level, const char *fmt, ...)
va_list args;
va_start(args, fmt);
vsprintf(tmp, fmt, args);
va_end(args);

Christophe Geuzaine
committed
if(level == 0){
Msg::Error("'%s', line %d : %s", gmsh_yyname.c_str(), gmsh_yylineno - 1, tmp);
gmsh_yyerrorstate++;
}
else
Msg::Warning("'%s', line %d : %s", gmsh_yyname.c_str(), gmsh_yylineno - 1, tmp);
}