Newer
Older
{
for(int 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));
;}
break;
case 313:
{
(yyval.u) = CTX.PACK_COLOR((int)(yyvsp[-7].d), (int)(yyvsp[-5].d), (int)(yyvsp[-3].d), (int)(yyvsp[-1].d));
;}
break;
case 314:
{
(yyval.u) = CTX.PACK_COLOR((int)(yyvsp[-5].d), (int)(yyvsp[-3].d), (int)(yyvsp[-1].d), 255);
;}
break;
case 315:
(yyval.u) = Get_ColorForString(ColorString, -1, (yyvsp[0].c), &flag);
if(flag) yymsg(GERROR, "Unknown color '%s'", (yyvsp[0].c));
Free((yyvsp[0].c));
;}
break;
case 316:
unsigned int (*pColOpt)(int num, int action, unsigned int value);
StringXColor *pColCat;
if(!(pColCat = Get_ColorOptionCategory((yyvsp[-4].c)))){
yymsg(GERROR, "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))){
yymsg(GERROR, "Unknown color option '%s.Color.%s'", (yyvsp[-4].c), (yyvsp[0].c));
(yyval.u) = 0;
Free((yyvsp[-4].c)); Free((yyvsp[0].c));
;}
break;
case 317:
{
(yyval.l) = (yyvsp[-1].l);
;}
break;
case 318:
{
(yyval.l) = List_Create(256, 10, sizeof(unsigned int));
GmshColorTable *ct = Get_ColorTable((int)(yyvsp[-3].d));

Christophe Geuzaine
committed
if(!ct)
yymsg(GERROR, "View[%d] does not exist", (int)(yyvsp[-3].d));
Free((yyvsp[-5].c));
;}
break;
case 319:
{
(yyval.l) = List_Create(256, 10, sizeof(unsigned int));
List_Add((yyval.l), &((yyvsp[0].u)));
;}
break;
case 320:
{
List_Add((yyval.l), &((yyvsp[0].u)));
;}
break;
case 321:
{
(yyval.c) = (yyvsp[0].c);
;}
break;
case 322:
{
(yyval.c) = (char *)Malloc(32*sizeof(char));
strcpy((yyval.c), ctime(&now));
(yyval.c)[strlen((yyval.c)) - 1] = '\0';
;}
break;
case 323:
{
(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 324:
{
(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';
if(i <= 0) strcpy((yyval.c), (yyvsp[-1].c));
Free((yyvsp[-1].c));
;}
break;
case 325:
{
(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] == '/' || (yyvsp[-1].c)[i] == '\\')
strcpy((yyval.c), &(yyvsp[-1].c)[i+1]);
Free((yyvsp[-1].c));
;}
break;
case 326:
{
(yyval.c) = (yyvsp[-1].c);
;}
break;
case 327:
int i = PrintListOfDouble((yyvsp[-3].c), (yyvsp[-1].l), tmpstring);

Christophe Geuzaine
committed
yymsg(GERROR, "Too few arguments in Sprintf");
else if(i > 0){
yymsg(GERROR, "%d extra argument%s in Sprintf", i, (i>1)?"s":"");
(yyval.c) = (char*)Malloc((strlen(tmpstring)+1)*sizeof(char));
strcpy((yyval.c), tmpstring);
Free((yyvsp[-3].c));
}
List_Delete((yyvsp[-1].l));
;}
break;
case 328:
char* (*pStrOpt)(int num, int action, char *value);
StringXString *pStrCat;
if(!(pStrCat = Get_StringOptionCategory((yyvsp[-3].c)))){
yymsg(GERROR, "Unknown string option class '%s'", (yyvsp[-3].c));
(yyval.c) = (char*)Malloc(sizeof(char));
(yyval.c)[0] = '\0';
if(!(pStrOpt = (char *(*) (int, int, char *))Get_StringOption((yyvsp[-1].c), pStrCat))){
yymsg(GERROR, "Unknown string option '%s.%s'", (yyvsp[-3].c), (yyvsp[-1].c));
(yyval.c) = (char*)Malloc(sizeof(char));
(yyval.c)[0] = '\0';
(yyval.c) = (char*)Malloc((strlen(str)+1)*sizeof(char));
strcpy((yyval.c), str);
char* (*pStrOpt)(int num, int action, char *value);
StringXString *pStrCat;
if(!(pStrCat = Get_StringOptionCategory((yyvsp[-6].c)))){
yymsg(GERROR, "Unknown string option class '%s'", (yyvsp[-6].c));
(yyval.c) = (char*)Malloc(sizeof(char));
(yyval.c)[0] = '\0';
if(!(pStrOpt = (char *(*) (int, int, char *))Get_StringOption((yyvsp[-1].c), pStrCat))){
yymsg(GERROR, "Unknown string option '%s[%d].%s'", (yyvsp[-6].c), (int)(yyvsp[-4].d), (yyvsp[-1].c));
(yyval.c) = (char*)Malloc(sizeof(char));
(yyval.c)[0] = '\0';
char *str = pStrOpt((int)(yyvsp[-4].d), GMSH_GET, NULL);
(yyval.c) = (char*)Malloc((strlen(str)+1)*sizeof(char));
strcpy((yyval.c), str);
;}
break;
}
/* Line 1037 of yacc.c. */
#line 7244 "Gmsh.tab.cpp"
yyvsp -= yylen;
yyssp -= yylen;
*++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
yystate = yydefgoto[yyn - YYNTOKENS];
goto yynewstate;
/*------------------------------------.
| yyerrlab -- here on detecting error |
`------------------------------------*/
yyerrlab:
/* If not already recovering from an error, report this error. */
if (!yyerrstatus)
{
++yynerrs;
yyn = yypact[yystate];
if (YYPACT_NINF < yyn && yyn < YYLAST)
{
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
YYSIZE_T yysize = 0;
int yytype = YYTRANSLATE (yychar);
const char* yyprefix;
char *yymsg;
int yyx;
/* Start YYX at -YYN if negative to avoid negative indexes in
YYCHECK. */
int yyxbegin = yyn < 0 ? -yyn : 0;
/* Stay within bounds of both yycheck and yytname. */
int yychecklim = YYLAST - yyn;
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
int yycount = 0;
yyprefix = ", expecting ";
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
{
yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
yycount += 1;
if (yycount == 5)
{
yysize = 0;
break;
}
}
yysize += (sizeof ("syntax error, unexpected ")
+ yystrlen (yytname[yytype]));
yymsg = (char *) YYSTACK_ALLOC (yysize);
if (yymsg != 0)
char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
yyp = yystpcpy (yyp, yytname[yytype]);
{
yyprefix = ", expecting ";
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
yyp = yystpcpy (yyp, yyprefix);
yyp = yystpcpy (yyp, yytname[yyx]);
yyprefix = " or ";
}
yyerror (yymsg);
YYSTACK_FREE (yymsg);
}
else
yyerror ("syntax error; also virtual memory exhausted");
}
else
}
if (yyerrstatus == 3)
{
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
/* If just tried and failed to reuse look-ahead token after an
error, discard it. */
if (yychar <= YYEOF)
{
/* If at end of input, pop the error token,
then the rest of the stack, then return failure. */
if (yychar == YYEOF)
for (;;)
{
YYPOPSTACK;
if (yyssp == yyss)
YYABORT;
yydestruct ("Error: popping",
yystos[*yyssp], yyvsp);
}
}
else
{
yydestruct ("Error: discarding", yytoken, &yylval);
yychar = YYEMPTY;
}
/* Else will try to reuse look-ahead token after shifting the error
token. */
goto yyerrlab1;
/*---------------------------------------------------.
| yyerrorlab -- error raised explicitly by YYERROR. |
`---------------------------------------------------*/
yyerrorlab:
#ifdef __GNUC__
/* Pacify GCC when the user code never invokes YYERROR and the label
yyerrorlab therefore never appears in user code. */
if (0)
goto yyerrorlab;
yyvsp -= yylen;
yyssp -= yylen;
yystate = *yyssp;
goto yyerrlab1;
/*-------------------------------------------------------------.
| yyerrlab1 -- common code for both syntax error and YYERROR. |
`-------------------------------------------------------------*/
yyerrlab1:
yyerrstatus = 3; /* Each real token shifted decrements this. */
for (;;)
{
yyn = yypact[yystate];
if (yyn != YYPACT_NINF)
{
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)
YYABORT;
yydestruct ("Error: popping", yystos[yystate], yyvsp);
YYPOPSTACK;
yystate = *yyssp;
YY_STACK_PRINT (yyss, yyssp);
}
if (yyn == YYFINAL)
YYACCEPT;
/* Shift the error token. */
YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
yystate = yyn;
goto yynewstate;
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
/*-------------------------------------.
| yyacceptlab -- YYACCEPT comes here. |
`-------------------------------------*/
yyacceptlab:
yyresult = 0;
goto yyreturn;
/*-----------------------------------.
| yyabortlab -- YYABORT comes here. |
`-----------------------------------*/
yyabortlab:
yydestruct ("Error: discarding lookahead",
yytoken, &yylval);
yychar = YYEMPTY;
yyresult = 1;
goto yyreturn;
#ifndef yyoverflow
/*----------------------------------------------.
| yyoverflowlab -- parser overflow comes here. |
`----------------------------------------------*/
yyoverflowlab:
yyerror ("parser stack overflow");
yyresult = 2;
/* Fall through. */
yyreturn:
#ifndef yyoverflow
if (yyss != yyssa)
YYSTACK_FREE (yyss);
}
void DeleteSymbol(void *a, void *b){
Symbol *s = (Symbol*)a;
Free(s->Name);
List_Delete(s->val);
}
int CompareSymbols (const void *a, const void *b){
}
void InitSymbols(void){
if(Symbol_T){
Tree_Action(Symbol_T, DeleteSymbol);
Tree_Delete(Symbol_T);
}
Symbol_T = Tree_Create(sizeof(Symbol), CompareSymbols);
}
int PrintListOfDouble(char *format, List_T *list, char *buffer){
buffer[j] = '\0';
while(j < (int)strlen(format) && format[j] != '%') j++;
strncpy(buffer, format, j);
buffer[j]='\0';
strcat(buffer, tmp2);
}
}
else{
return List_Nbr(list)-i;
}
}
if(j != (int)strlen(format))
return -1;
return 0;
}

Christophe Geuzaine
committed
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
int CheckViewErrorFlags(Post_View *v){
if(View->adaptive) return 0; // hope for the best :-)
char *name[8] = { "point", "line", "triangle", "quadrangle",
"tetrahedron", "hexahedron", "prism", "pyramid" };
char *type[3] = { "scalar", "vector", "tensor" };
if(8 * 3 != VIEW_NB_ELEMENT_TYPES){
Msg(GERROR, "Please upgrade CheckViewErrorFlags!");
return 0;
}
for(int i = 0; i < VIEW_NB_ELEMENT_TYPES; i++)
if(ViewErrorFlags[i])
Msg(GERROR, "%d %s %s%s in View[%d] contain%s a wrong number of values",
ViewErrorFlags[i], type[i%3], name[i/3], (ViewErrorFlags[i] > 1) ? "s" : "",
v->Index, (ViewErrorFlags[i] > 1) ? "" : "s");
return 0;
}
void yyerror(char *s){
Msg(GERROR, "'%s', line %d : %s (%s)", yyname, yylineno-1, s, yytext);
}

Christophe Geuzaine
committed
void yymsg(int type, char *fmt, ...){
va_list args;
va_start (args, fmt);
vsprintf (tmp, fmt, args);
va_end (args);

Christophe Geuzaine
committed
Msg(type, "'%s', line %d : %s", yyname, yylineno-1, tmp);
}