Newer
Older
{ yyval.d = yyvsp[-1].d*(double)rand()/(double)RAND_MAX; ;
break;}
case 287:
{ yyval.d = ParUtil::Instance()->rank(); ;
break;}
case 290:
{ yyval.d = ParUtil::Instance()->size(); ;
break;}
case 291:
{ yyval.d = Get_GmshMajorVersion(); ;
break;}
case 292:
{ yyval.d = Get_GmshMinorVersion(); ;
break;}
case 293:
#line 2907 "Gmsh.y"
{ yyval.d = Get_GmshPatchVersion(); ;
break;}
case 294:
yymsg(GERROR, "Unknown variable '%s'", yyvsp[0].c);
yyval.d = 0.;

Christophe Geuzaine
committed
else
yyval.d = *(double*)List_Pointer_Fast(pSymbol->val, 0);
Free(yyvsp[0].c);
;
break;}
case 295:
Symbol TheSymbol;
TheSymbol.Name = tmpstring;
Symbol *pSymbol;
if(!(pSymbol = (Symbol*)Tree_PQuery(Symbol_T, &TheSymbol))) {
yymsg(GERROR, "Unknown variable '%s'", tmpstring);
yyval.d = *(double*)List_Pointer_Fast(pSymbol->val, 0);
Free(yyvsp[-4].c);
;
break;}
case 296:
yymsg(GERROR, "Unknown variable '%s'", yyvsp[-3].c);
yyval.d = 0.;
if((pd = (double*)List_Pointer_Test(pSymbol->val, (int)yyvsp[-1].d)))
yyval.d = *pd;
yymsg(GERROR, "Uninitialized variable '%s[%d]'", yyvsp[-3].c, (int)yyvsp[-1].d);
yyval.d = 0.;
yymsg(GERROR, "Unknown variable '%s'", yyvsp[-2].c);
yyval.d = 0.;
yymsg(GERROR, "Unknown variable '%s'", yyvsp[-1].c);
yyval.d = 0.;

Christophe Geuzaine
committed
else
yyval.d = (*(double*)List_Pointer_Fast(pSymbol->val, 0) += yyvsp[0].i);
Free(yyvsp[-1].c);
;
break;}
case 299:
yymsg(GERROR, "Unknown variable '%s'", yyvsp[-4].c);
yyval.d = 0.;
if((pd = (double*)List_Pointer_Test(pSymbol->val, (int)yyvsp[-2].d)))
yyval.d = (*pd += yyvsp[0].i);
yymsg(GERROR, "Uninitialized variable '%s[%d]'", yyvsp[-4].c, (int)yyvsp[-2].d);
yyval.d = 0.;
double (*pNumOpt)(int num, int action, double value);
StringXNumber *pNumCat;
if(!(pNumCat = Get_NumberOptionCategory(yyvsp[-2].c))){
yymsg(GERROR, "Unknown numeric option class '%s'", yyvsp[-2].c);
yyval.d = 0.;
if(!(pNumOpt = (double (*) (int, int, double))Get_NumberOption(yyvsp[0].c, pNumCat))){
yymsg(GERROR, "Unknown numeric option '%s.%s'", yyvsp[-2].c, yyvsp[0].c);
yyval.d = 0.;

Christophe Geuzaine
committed
else
Free(yyvsp[-2].c); Free(yyvsp[0].c);
;
break;}
case 301:
double (*pNumOpt)(int num, int action, double value);
StringXNumber *pNumCat;
if(!(pNumCat = Get_NumberOptionCategory(yyvsp[-5].c))){
yymsg(GERROR, "Unknown numeric option class '%s'", yyvsp[-5].c);
yyval.d = 0.;
if(!(pNumOpt = (double (*) (int, int, double))Get_NumberOption(yyvsp[0].c, pNumCat))){
yymsg(GERROR, "Unknown numeric option '%s[%d].%s'", yyvsp[-5].c, (int)yyvsp[-3].d, yyvsp[0].c);
yyval.d = 0.;

Christophe Geuzaine
committed
else
Free(yyvsp[-5].c); Free(yyvsp[0].c);
;
break;}
case 302:
double (*pNumOpt)(int num, int action, double value);
StringXNumber *pNumCat;
if(!(pNumCat = Get_NumberOptionCategory(yyvsp[-3].c))){
yymsg(GERROR, "Unknown numeric option class '%s'", yyvsp[-3].c);
yyval.d = 0.;
if(!(pNumOpt = (double (*) (int, int, double))Get_NumberOption(yyvsp[-1].c, pNumCat))){
yymsg(GERROR, "Unknown numeric option '%s.%s'", yyvsp[-3].c, yyvsp[-1].c);
yyval.d = 0.;

Christophe Geuzaine
committed
else
yyval.d = pNumOpt(0, GMSH_SET|GMSH_GUI, pNumOpt(0, GMSH_GET, 0)+yyvsp[0].i);
Free(yyvsp[-3].c); Free(yyvsp[-1].c);
;
break;}
case 303:
double (*pNumOpt)(int num, int action, double value);
StringXNumber *pNumCat;
if(!(pNumCat = Get_NumberOptionCategory(yyvsp[-6].c))){
yymsg(GERROR, "Unknown numeric option class '%s'", yyvsp[-6].c);
yyval.d = 0.;
if(!(pNumOpt = (double (*) (int, int, double))Get_NumberOption(yyvsp[-1].c, pNumCat))){
yymsg(GERROR, "Unknown numeric option '%s[%d].%s'", yyvsp[-6].c, (int)yyvsp[-4].d, yyvsp[-1].c);
yyval.d = 0.;

Christophe Geuzaine
committed
else
yyval.d = pNumOpt((int)yyvsp[-4].d, GMSH_SET|GMSH_GUI, pNumOpt((int)yyvsp[-4].d, GMSH_GET, 0)+yyvsp[0].i);
Free(yyvsp[-6].c); Free(yyvsp[-1].c);
;
break;}
case 304:
{
yyval.d = GetValue(yyvsp[-3].c, yyvsp[-1].d);
Free(yyvsp[-3].c);
;
break;}
case 305:
{
memcpy(yyval.v, yyvsp[0].v, 5*sizeof(double));
;
break;}
case 306:
{
for(int i = 0; i < 5; i++) yyval.v[i] = -yyvsp[0].v[i];
;
break;}
case 307:
{
for(int i = 0; i < 5; i++) yyval.v[i] = yyvsp[0].v[i];
;
break;}
case 308:
{
for(int i = 0; i < 5; i++) yyval.v[i] = yyvsp[-2].v[i] - yyvsp[0].v[i];
;
break;}
case 309:
{
for(int i = 0; i < 5; i++) yyval.v[i] = yyvsp[-2].v[i] + yyvsp[0].v[i];
;
break;}
case 310:
{
yyval.v[0] = yyvsp[-9].d; yyval.v[1] = yyvsp[-7].d; yyval.v[2] = yyvsp[-5].d; yyval.v[3] = yyvsp[-3].d; yyval.v[4] = yyvsp[-1].d;
;
break;}
case 311:
{
yyval.v[0] = yyvsp[-7].d; yyval.v[1] = yyvsp[-5].d; yyval.v[2] = yyvsp[-3].d; yyval.v[3] = yyvsp[-1].d; yyval.v[4] = 1.0;
;
break;}
case 312:
{
yyval.v[0] = yyvsp[-5].d; yyval.v[1] = yyvsp[-3].d; yyval.v[2] = yyvsp[-1].d; yyval.v[3] = 0.0; yyval.v[4] = 1.0;
;
break;}
case 313:
{
yyval.v[0] = yyvsp[-5].d; yyval.v[1] = yyvsp[-3].d; yyval.v[2] = yyvsp[-1].d; yyval.v[3] = 0.0; yyval.v[4] = 1.0;
;
break;}
case 314:
{
yyval.l = List_Create(2, 1, sizeof(List_T*));
List_Add(yyval.l, &(yyvsp[0].l));
;
break;}
case 315:
{
List_Add(yyval.l, &(yyvsp[0].l));
;
break;}
case 316:
{
yyval.l = List_Create(2, 1, sizeof(double));
List_Add(yyval.l, &(yyvsp[0].d));
;
break;}
case 317:
yyval.l = List_Create(2, 1, sizeof(double));
;
break;}
case 319:
{
yyval.l = yyvsp[-1].l;
for(int i = 0; i < List_Nbr(yyval.l); i++){
double *pd = (double*)List_Pointer(yyval.l, i);
{
yyval.l = yyvsp[-1].l;
for(int i = 0; i < List_Nbr(yyval.l); i++){
double *pd = (double*)List_Pointer(yyval.l, i);
(*pd) *= yyvsp[-4].d;
}
;
break;}
case 322:
{
yyval.l = yyvsp[0].l;
for(int i = 0; i < List_Nbr(yyval.l); i++){
double *pd = (double*)List_Pointer(yyval.l, i);
{
yyval.l = yyvsp[0].l;
for(int i = 0; i < List_Nbr(yyval.l); i++){
double *pd = (double*)List_Pointer(yyval.l, i);
(*pd) *= yyvsp[-2].d;
}
;
break;}
case 324:
{
yyval.l = List_Create(2, 1, sizeof(double));
for(double d = yyvsp[-2].d; (yyvsp[-2].d < yyvsp[0].d) ? (d <= yyvsp[0].d) : (d >= yyvsp[0].d); (yyvsp[-2].d < yyvsp[0].d) ? (d += 1.) : (d -= 1.))
List_Add(yyval.l, &d);
;
break;}
case 325:
{
yyval.l = List_Create(2, 1, sizeof(double));
if(!yyvsp[0].d || (yyvsp[-4].d < yyvsp[-2].d && yyvsp[0].d < 0) || (yyvsp[-4].d > yyvsp[-2].d && yyvsp[0].d > 0)){
yymsg(GERROR, "Wrong increment in '%g:%g:%g'", yyvsp[-4].d, yyvsp[-2].d, yyvsp[0].d);
List_Add(yyval.l, &(yyvsp[-4].d));
for(double d = yyvsp[-4].d; (yyvsp[0].d > 0) ? (d <= yyvsp[-2].d) : (d >= yyvsp[-2].d); d += yyvsp[0].d)
List_Add(yyval.l, &d);
;
break;}
case 326:
// Returns the coordinates of a point and fills a list with it.
// This allows to ensure e.g. that relative point positions are
// always conserved
Vertex *v = FindPoint((int)yyvsp[-1].d);
yyval.l = List_Create(3, 1, sizeof(double));
List_Add(yyval.l, &d);
List_Add(yyval.l, &d);
List_Add(yyval.l, &d);
List_Add(yyval.l, &v->Pos.X);
List_Add(yyval.l, &v->Pos.Y);
List_Add(yyval.l, &v->Pos.Z);
{
yyval.l = List_Create(List_Nbr(yyvsp[0].l), 1, sizeof(double));
for(int i = 0; i < List_Nbr(yyvsp[0].l); i++){
Shape *s = (Shape*) List_Pointer(yyvsp[0].l, i);
{
yyval.l = List_Create(List_Nbr(yyvsp[0].l), 1, sizeof(double));
for(int i = 0; i < List_Nbr(yyvsp[0].l); i++){
Shape *s = (Shape*) List_Pointer(yyvsp[0].l, i);
{
yyval.l = List_Create(List_Nbr(yyvsp[0].l), 1, sizeof(double));
for(int i = 0; i < List_Nbr(yyvsp[0].l); i++){
Shape *s = (Shape*) List_Pointer(yyvsp[0].l, i);
for(int i = 0; i < List_Nbr(yyvsp[-2].l); i++){
int j = (int)(*(double*)List_Pointer_Fast(yyvsp[-2].l, i));
if((pd = (double*)List_Pointer_Test(pSymbol->val, j)))
yymsg(GERROR, "Uninitialized variable '%s[%d]'", yyvsp[-5].c, j);
Free(yyvsp[-5].c);
List_Delete(yyvsp[-2].l);
;
break;}
case 332:
{
yyval.l = List_Create(2, 1, sizeof(double));
List_Add(yyval.l, &(yyvsp[0].d));
;
break;}
case 333:
{
List_Add(yyval.l, &(yyvsp[0].d));
;
break;}
case 335:
{
yyval.u = CTX.PACK_COLOR((int)yyvsp[-7].d, (int)yyvsp[-5].d, (int)yyvsp[-3].d, (int)yyvsp[-1].d);
;
break;}
case 337:
{
yyval.u = CTX.PACK_COLOR((int)yyvsp[-5].d, (int)yyvsp[-3].d, (int)yyvsp[-1].d, 255);
;
break;}
case 338:
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 339:
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 340:
{
yyval.l = List_Create(256, 10, sizeof(unsigned int));
GmshColorTable *ct = Get_ColorTable((int)yyvsp[-3].d);

Christophe Geuzaine
committed
if(!ct)
{
yyval.l = List_Create(256, 10, sizeof(unsigned int));
List_Add(yyval.l, &(yyvsp[0].u));
;
break;}
case 343:
{
List_Add(yyval.l, &(yyvsp[0].u));
;
break;}
case 344:
strcpy(yyval.c, ctime(&now));
yyval.c[strlen(yyval.c) - 1] = '\0';
;
break;}
case 348:
{
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 349:
{
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 350:
{
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 351:

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 353:
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;}
}
/* the action file gets copied in in place of this dollarsign */
#line 543 "/usr/share/bison.simple"
yyvsp -= yylen;
yyssp -= yylen;
#ifdef YYLSP_NEEDED
yylsp -= yylen;
#endif
#if YYDEBUG != 0
if (yydebug)
{
short *ssp1 = yyss - 1;
fprintf (stderr, "state stack now");
while (ssp1 != yyssp)
fprintf (stderr, " %d", *++ssp1);
fprintf (stderr, "\n");
*++yyvsp = yyval;
#ifdef YYLSP_NEEDED
yylsp++;
if (yylen == 0)
{
yylsp->first_line = yylloc.first_line;
yylsp->first_column = yylloc.first_column;
yylsp->last_line = (yylsp-1)->last_line;
yylsp->last_column = (yylsp-1)->last_column;
yylsp->text = 0;
}
else
{
yylsp->last_line = (yylsp+yylen-1)->last_line;
yylsp->last_column = (yylsp+yylen-1)->last_column;
}
#endif
/* 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;
if (! yyerrstatus)
/* If not already recovering from an error, report this error. */
{
++yynerrs;
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
if (yyn > YYFLAG && yyn < YYLAST)
{
int size = 0;
char *msg;
int x, count;
count = 0;
/* Start X at -yyn if nec to avoid negative indexes in yycheck. */
for (x = (yyn < 0 ? -yyn : 0);
x < (sizeof(yytname) / sizeof(char *)); x++)
if (yycheck[x + yyn] == x)
size += strlen(yytname[x]) + 15, count++;
msg = (char *) malloc(size + 15);
if (msg != 0)
{
strcpy(msg, "parse error");
if (count < 5)
{
count = 0;
for (x = (yyn < 0 ? -yyn : 0);
x < (sizeof(yytname) / sizeof(char *)); x++)
if (yycheck[x + yyn] == x)
{
strcat(msg, count == 0 ? ", expecting `" : " or `");
strcat(msg, yytname[x]);
strcat(msg, "'");
count++;
}
}
yyerror(msg);
free(msg);
}
else
yyerror ("parse error; also virtual memory exceeded");
}
else
#endif /* YYERROR_VERBOSE */
yyerror("parse error");
}
goto yyerrlab1;
yyerrlab1: /* here on error raised explicitly by an action */
if (yyerrstatus == 3)
{
/* 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;
#if YYDEBUG != 0
if (yydebug)
fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
#endif
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. */
#if 0
/* This is wrong; only states that explicitly want error tokens
should shift them. */
yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
if (yyn) goto yydefault;
#endif
yyerrpop: /* pop the current state because it cannot handle the error token */
if (yyssp == yyss) YYABORT;
yyvsp--;
yystate = *--yyssp;
#ifdef YYLSP_NEEDED
yylsp--;
#endif
short *ssp1 = yyss - 1;
fprintf (stderr, "Error: state stack now");
while (ssp1 != yyssp)
fprintf (stderr, " %d", *++ssp1);
fprintf (stderr, "\n");
}
#endif
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;
#if YYDEBUG != 0
if (yydebug)
fprintf(stderr, "Shifting error token, ");
#endif
*++yyvsp = yylval;
#ifdef YYLSP_NEEDED
*++yylsp = yylloc;
#endif
yystate = yyn;
goto yynewstate;
yyacceptlab:
/* YYACCEPT comes here. */
if (yyfree_stacks)
{
free (yyss);
free (yyvs);
#ifdef YYLSP_NEEDED
free (yyls);
yyabortlab:
/* YYABORT comes here. */
if (yyfree_stacks)
free (yyss);
free (yyvs);
#ifdef YYLSP_NEEDED
free (yyls);
#endif
}
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';