Newer
Older

Christophe Geuzaine
committed
if(flag) yymsg(GERROR, "Unknown color '%s'", yyvsp[0].c);
if(!(pColCat = Get_ColorOptionCategory(yyvsp[-4].c))){

Christophe Geuzaine
committed
yymsg(GERROR, "Unknown color option class '%s'", yyvsp[-4].c);

Christophe Geuzaine
committed
if(!(pColOpt = (unsigned int (*) (int, int, unsigned int))Get_ColorOption(yyvsp[0].c, pColCat))){

Christophe Geuzaine
committed
yymsg(GERROR, "Unknown color option '%s.Color.%s'", yyvsp[-4].c, yyvsp[0].c);

Christophe Geuzaine
committed
yyval.u = pColOpt(0,GMSH_GET,0) ;
yyval.l = List_Create(256,10,sizeof(unsigned int)) ;
GmshColorTable *ct = Get_ColorTable((int)yyvsp[-3].d);

Christophe Geuzaine
committed
if(!ct)

Christophe Geuzaine
committed
yymsg(GERROR, "View[%d] does not exist", (int)yyvsp[-3].d);

Christophe Geuzaine
committed
for(i=0 ; i<ct->size ; i++)
yyval.l = List_Create(256,10,sizeof(unsigned int)) ;
List_Add(yyval.l, &(yyvsp[0].u)) ;
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);
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);
i = PrintListOfDouble(yyvsp[-3].c,yyvsp[-1].l,tmpstring);
if(i<0){

Christophe Geuzaine
committed
yymsg(GERROR, "Too few arguments in Sprintf");

Christophe Geuzaine
committed
yymsg(GERROR, "Too many arguments (%d) in Sprintf", i);
}
else{
yyval.c = (char*)Malloc((strlen(tmpstring)+1)*sizeof(char));
strcpy(yyval.c, tmpstring);
if(!(pStrCat = Get_StringOptionCategory(yyvsp[-3].c)))

Christophe Geuzaine
committed
yymsg(GERROR, "Unknown string option class '%s'", yyvsp[-3].c);
else{
if(!(pStrOpt = (char *(*) (int, int, char *))Get_StringOption(yyvsp[-1].c, pStrCat)))

Christophe Geuzaine
committed
yymsg(GERROR, "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);
}
}
if(!(pStrCat = Get_StringOptionCategory(yyvsp[-6].c)))

Christophe Geuzaine
committed
yymsg(GERROR, "Unknown string option class '%s'", yyvsp[-6].c);
else{
if(!(pStrOpt = (char *(*) (int, int, char *))Get_StringOption(yyvsp[-1].c, pStrCat)))

Christophe Geuzaine
committed
yymsg(GERROR, "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);
}
}
yyvsp -= yylen;
yyssp -= yylen;
if (yydebug)
{
short *yyssp1 = yyss - 1;
YYFPRINTF (stderr, "state stack now");
while (yyssp1 != yyssp)
YYFPRINTF (stderr, " %d", *++yyssp1);
YYFPRINTF (stderr, "\n");
}
#endif
*++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 - YYNTBASE] + *yyssp;
if (yystate >= 0 && 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;
yyn = yypact[yystate];
{
YYSIZE_T yysize = 0;
char *yymsg;
int yyx, yycount;
yycount = 0;
/* Start YYX at -YYN if negative to avoid negative indexes in
YYCHECK. */
for (yyx = yyn < 0 ? -yyn : 0;
yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
yysize += yystrlen (yytname[yyx]) + 15, yycount++;
yysize += yystrlen ("parse error, unexpected ") + 1;
yymsg = (char *) YYSTACK_ALLOC (yysize);
if (yymsg != 0)
{
char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
if (yycount < 5)
{
yycount = 0;
for (yyx = yyn < 0 ? -yyn : 0;
yyx < (int) (sizeof (yytname) / sizeof (char *));
yyx++)
{
const char *yyq = ! yycount ? ", expecting " : " or ";
yyp = yystpcpy (yyp, yyq);
yyp = yystpcpy (yyp, yytname[yyx]);
yycount++;
}
}
yyerror (yymsg);
YYSTACK_FREE (yymsg);
}
else
yyerror ("parse error; also virtual memory exhausted");
}
else
yyerror ("parse error");
}

Christophe Geuzaine
committed
goto yyerrlab1;
/*--------------------------------------------------.
| yyerrlab1 -- error raised explicitly by an action |
`--------------------------------------------------*/
if (yyerrstatus == 3)
{
/* If just tried and failed to reuse lookahead token after an
error, discard it. */
if (yychar == YYEOF)
YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
yychar, yytname[yychar1]));
yychar = YYEMPTY;
}
/* Else will try to reuse lookahead token after shifting the error
token. */
/*-------------------------------------------------------------------.
| yyerrdefault -- current state does not do anything special for the |
| error token. |
`-------------------------------------------------------------------*/
yyerrdefault:
#if 0
/* This is wrong; only states that explicitly want error tokens
should shift them. */
/* If its default is to accept any token, ok. Otherwise pop it. */
yyn = yydefact[yystate];
if (yyn)
goto yydefault;
#endif
/*---------------------------------------------------------------.
| yyerrpop -- pop the current state because it cannot handle the |
| error token |
`---------------------------------------------------------------*/
yyerrpop:
if (yyssp == yyss)
YYABORT;
yyvsp--;
yystate = *--yyssp;
#if YYLSP_NEEDED
yylsp--;
#endif
if (yydebug)
{
short *yyssp1 = yyss - 1;
YYFPRINTF (stderr, "Error: state stack now");
while (yyssp1 != yyssp)
YYFPRINTF (stderr, " %d", *++yyssp1);
YYFPRINTF (stderr, "\n");
}
#endif
/*--------------.
| yyerrhandle. |
`--------------*/
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;
}
if (yyn == YYFINAL)
YYACCEPT;
YYDPRINTF ((stderr, "Shifting error token, "));
*++yyvsp = yylval;
yystate = yyn;
goto yynewstate;
/*-------------------------------------.
| yyacceptlab -- YYACCEPT comes here. |
`-------------------------------------*/
yyacceptlab:
yyresult = 0;
goto yyreturn;
/*-----------------------------------.
| yyabortlab -- YYABORT comes here. |
`-----------------------------------*/
yyabortlab:
yyresult = 1;
goto yyreturn;
/*---------------------------------------------.
| yyoverflowab -- parser overflow comes here. |
`---------------------------------------------*/
yyoverflowlab:
yyerror ("parser stack overflow");
yyresult = 2;
/* Fall through. */
yyreturn:
#ifndef yyoverflow
if (yyss != yyssa)
YYSTACK_FREE (yyss);
return yyresult;
}
void InitSymbols(void){
if(!Symbol_L)
Symbol_L = List_Create(50,10,sizeof(Symbol));
else
List_Reset(Symbol_L);
}
void DeleteSymbols(void){
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));
}
8396
8397
8398
8399
8400
8401
8402
8403
8404
8405
8406
8407
8408
8409
8410
8411
8412
8413
8414
8415
8416
8417
8418
8419
8420
8421
8422
8423
8424
8425
8426
8427
8428
8429
int PrintListOfDouble(char *format, List_T *list, char *buffer){
int i, j, k;
char tmp1[256], tmp2[256];
j=0;
while(format[j]!='%') j++;
strncpy(buffer, format, j);
buffer[j]='\0';
for(i = 0 ; i<List_Nbr(list) ; i++){
k = j;
j++;
if(j<(int)strlen(format)){
if(format[j]=='%'){
strcat(buffer, "%");
j++;
}
while(format[j]!='%' && j<(int)strlen(format)) j++;
if(k != j){
strncpy(tmp1, &(format[k]),j-k);
tmp1[j-k]='\0';
sprintf(tmp2, tmp1, *(double*)List_Pointer(list,i));
strcat(buffer, tmp2);
}
}
else{
return List_Nbr(list)-i;
break ;
}
}
if(j != (int)strlen(format))
return -1;
return 0;
}

Christophe Geuzaine
committed
void yyerror(char *s){

Christophe Geuzaine
committed
Msg(GERROR, "'%s', line %d : %s (%s)",yyname,yylineno-1,s,yytext);
yyerrorstate=1;
}

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);
if(type == GERROR) yyerrorstate=1;
}