Newer
Older
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
{
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 298:
#line 2924 "Gmsh.y"
{
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 299:
#line 2928 "Gmsh.y"
{
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 300:
#line 2935 "Gmsh.y"
{
;
break;}
case 301:
#line 2938 "Gmsh.y"
{
yyval.l = yyvsp[-1].l;
;
break;}
case 302:
#line 2942 "Gmsh.y"
{
yyval.l = yyvsp[-1].l;
;
break;}
case 303:
#line 2949 "Gmsh.y"
{
yyval.l = List_Create(2, 1, sizeof(List_T*));
List_Add(yyval.l, &(yyvsp[0].l));
;
break;}
case 304:
#line 2954 "Gmsh.y"
{
List_Add(yyval.l, &(yyvsp[0].l));
;
break;}
case 305:
#line 2962 "Gmsh.y"
{
yyval.l = List_Create(2, 1, sizeof(double));
List_Add(yyval.l, &(yyvsp[0].d));
;
break;}
case 306:
#line 2967 "Gmsh.y"
{
yyval.l = yyvsp[0].l;
;
break;}
case 307:
#line 2971 "Gmsh.y"
{
yyval.l = List_Create(2, 1, sizeof(double));
;
break;}
case 308:
#line 2976 "Gmsh.y"
{
yyval.l = yyvsp[-1].l;
;
break;}
case 309:
#line 2980 "Gmsh.y"
{
yyval.l = yyvsp[-1].l;
for(int i = 0; i < List_Nbr(yyval.l); i++){
pd = (double*)List_Pointer(yyval.l, i);
;
break;}
case 310:
#line 2992 "Gmsh.y"
{
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 311:
#line 2998 "Gmsh.y"
{
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 312:
#line 3009 "Gmsh.y"
{
// 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);
}
;
break;}
case 313:
#line 3029 "Gmsh.y"
{
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);
List_Delete(yyvsp[0].l);
;
break;}
case 314:
#line 3039 "Gmsh.y"
{
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);
List_Delete(yyvsp[0].l);
;
break;}
case 315:
#line 3049 "Gmsh.y"
{
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);
List_Delete(yyvsp[0].l);
;
break;}
case 316:
#line 3059 "Gmsh.y"
{
yyval.l = List_Create(2, 1, sizeof(double));
Free(yyvsp[-2].c);
;
break;}
case 317:
#line 3076 "Gmsh.y"
{
yyval.l = List_Create(2, 1, sizeof(double));
for(int i = 0; i < List_Nbr(pSymbol->val); i++){
double d = - *(double*)List_Pointer_Fast(pSymbol->val, i);
Free(yyvsp[-2].c);
;
break;}
case 318:
#line 3095 "Gmsh.y"
{
yyval.l = List_Create(2, 1, sizeof(double));
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 319:
#line 3119 "Gmsh.y"
{
yyval.l = List_Create(2, 1, sizeof(double));
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);
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
Free(yyvsp[-5].c);
List_Delete(yyvsp[-2].l);
;
break;}
case 320:
#line 3148 "Gmsh.y"
{
yyval.l = List_Create(2, 1, sizeof(double));
List_Add(yyval.l, &(yyvsp[0].d));
;
break;}
case 321:
#line 3153 "Gmsh.y"
{
yyval.l = yyvsp[0].l;
;
break;}
case 322:
#line 3157 "Gmsh.y"
{
List_Add(yyval.l, &(yyvsp[0].d));
;
break;}
case 323:
#line 3161 "Gmsh.y"
{
for(int i = 0; i < List_Nbr(yyvsp[0].l); i++){
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
List_Read(yyvsp[0].l, i, &d);
List_Add(yyval.l, &d);
}
List_Delete(yyvsp[0].l);
;
break;}
case 324:
#line 3174 "Gmsh.y"
{
yyval.u = CTX.PACK_COLOR((int)yyvsp[-7].d, (int)yyvsp[-5].d, (int)yyvsp[-3].d, (int)yyvsp[-1].d);
;
break;}
case 325:
#line 3178 "Gmsh.y"
{
yyval.u = CTX.PACK_COLOR((int)yyvsp[-5].d, (int)yyvsp[-3].d, (int)yyvsp[-1].d, 255);
;
break;}
case 326:
#line 3190 "Gmsh.y"
{
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 327:
#line 3197 "Gmsh.y"
{
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 328:
#line 3219 "Gmsh.y"
{
yyval.l = yyvsp[-1].l;
;
break;}
case 329:
#line 3223 "Gmsh.y"
{
yyval.l = List_Create(256, 10, sizeof(unsigned int));
GmshColorTable *ct = Get_ColorTable((int)yyvsp[-3].d);

Christophe Geuzaine
committed
if(!ct)
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
Free(yyvsp[-5].c);
;
break;}
case 330:
#line 3238 "Gmsh.y"
{
yyval.l = List_Create(256, 10, sizeof(unsigned int));
List_Add(yyval.l, &(yyvsp[0].u));
;
break;}
case 331:
#line 3243 "Gmsh.y"
{
List_Add(yyval.l, &(yyvsp[0].u));
;
break;}
case 332:
#line 3250 "Gmsh.y"
{
yyval.c = yyvsp[0].c;
;
break;}
case 333:
#line 3254 "Gmsh.y"
{
yyval.c = (char *)Malloc(32*sizeof(char));
strcpy(yyval.c, ctime(&now));
yyval.c[strlen(yyval.c) - 1] = '\0';
;
break;}
case 334:
#line 3262 "Gmsh.y"
{
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 335:
#line 3270 "Gmsh.y"
{
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 336:
#line 3284 "Gmsh.y"
{
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 337:
#line 3298 "Gmsh.y"
{
yyval.c = yyvsp[-1].c;
;
break;}
case 338:
#line 3302 "Gmsh.y"
{

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 339:
#line 3321 "Gmsh.y"
{
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;
#if YYDEBUG != 0
if (yydebug)
{
short *ssp1 = yyss - 1;
fprintf (stderr, "state stack now");
while (ssp1 != yyssp)
fprintf (stderr, " %d", *++ssp1);
fprintf (stderr, "\n");
}
#endif
*++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;
yyn = yypact[yystate];
{
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)
{
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++;
}
}
else
}
else
}
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
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);
}
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
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
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);