Skip to content
Snippets Groups Projects
Commit bb86220e authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

Corrected syntax

parent 736436f7
Branches
Tags
No related merge requests found
/* $Id: Geo.cpp,v 1.4 2000-11-26 15:43:45 geuzaine Exp $ */
/* $Id: Geo.cpp,v 1.5 2000-11-28 14:42:42 geuzaine Exp $ */
#include "Gmsh.h"
#include "Const.h"
......@@ -73,21 +73,21 @@ void add_infile(char *text, char *fich){
void del_pnt(int p1, char *fich){
char text[BUFFSIZE];
sprintf(text,"Delete {\n Point(%d);\n}",p1);
sprintf(text,"Delete {\n Point{%d};\n}",p1);
add_infile(text,fich);
}
void del_seg(int p1, char *fich){
char text[BUFFSIZE];
sprintf(text,"Delete {\n Line(%d);\n}",p1);
sprintf(text,"Delete {\n Line{%d};\n}",p1);
add_infile(text,fich);
}
void del_srf(int p1, char *fich){
char text[BUFFSIZE];
sprintf(text,"Delete {\n Surface(%d);\n}",p1);
sprintf(text,"Delete {\n Surface{%d};\n}",p1);
add_infile(text,fich);
}
......@@ -164,10 +164,10 @@ void add_trsfline (int N, int *l, char *fich){
}
if(Mode_Transfinite == 0)
sprintf(text2,"} = %s;",nb_pts);
else if(Mode_Transfinite == 1)
sprintf(text2,"} = %s Using Progression %s;",nb_pts,mode_value);
else if(Mode_Transfinite == 2)
sprintf(text2,"} = %s Using Bump %s;",nb_pts,mode_value);
else if(Mode_Transfinite == 1)
sprintf(text2,"} = %s Using Power %s;",nb_pts,mode_value);
strcat(text,text2);
add_infile(text,fich);
}
......@@ -191,16 +191,16 @@ void add_point(char *fich){
void add_attractor(char *fich, int ip, int typ){
char text[BUFFSIZE];
if(typ == 0) {
sprintf(text,"Attractor Point (%s,%s,%s) = {%d};",
attrx_text,attry_text,attrdec_text,ip);
sprintf(text,"Attractor Point {%d} = {%s,%s,%s} = ;",
ip,attrx_text,attry_text,attrdec_text);
}
else if(typ == 1){
sprintf(text,"Attractor Line (%s,%s,%s) = {%d};",
attrx_text,attry_text,attrdec_text,ip);
sprintf(text,"Attractor Line {%d} = {%s,%s,%s};",
ip, attrx_text,attry_text,attrdec_text);
}
else if(typ == 2) {
sprintf(text,"Attractor Surface (%s,%s,%s) = {%d};",
attrx_text,attry_text,attrdec_text,ip);
sprintf(text,"Attractor Surface {%d} = {%s,%s,%s};",
ip,attrx_text,attry_text,attrdec_text);
}
add_infile(text,fich);
}
......@@ -454,7 +454,7 @@ void add_physical_entity(List_T *list, char *fich, int type, int *num){
void extrude(int s, char *fich, char *what){
char text[BUFFSIZE];
sprintf(text,"Extrude %s (%d, {%s,%s,%s});",what,s,tx_text,ty_text,tz_text);
sprintf(text,"Extrude %s {%d, {%s,%s,%s}};",what,s,tx_text,ty_text,tz_text);
add_infile(text,fich);
add_infile("Coherence;",fich);
}
......@@ -462,10 +462,10 @@ void translate_seg(int add, int s, char *fich){
char text[BUFFSIZE];
if(add)
sprintf(text,"Translate({%s,%s,%s}) {\n Duplicata { Line(%d); }\n}",
sprintf(text,"Translate {%s,%s,%s} {\n Duplicata { Line{%d}; }\n}",
tx_text,ty_text,tz_text,s);
else
sprintf(text,"Translate({%s,%s,%s}) {\n Line(%d);\n}",
sprintf(text,"Translate {%s,%s,%s} {\n Line{%d};\n}",
tx_text,ty_text,tz_text,s);
add_infile(text,fich);
add_infile("Coherence;",fich);
......@@ -476,10 +476,10 @@ void translate_surf(int add, int s, char *fich){
char text[BUFFSIZE];
if(add)
sprintf(text,"Translate({%s,%s,%s}) {\n Duplicata { Surface(%d); }\n}",
sprintf(text,"Translate {%s,%s,%s} {\n Duplicata { Surface{%d}; }\n}",
tx_text,ty_text,tz_text,s);
else
sprintf(text,"Translate({%s,%s,%s}) {\n Surface(%d);\n}",
sprintf(text,"Translate {%s,%s,%s} {\n Surface{%d};\n}",
tx_text,ty_text,tz_text,s);
add_infile(text,fich);
add_infile("Coherence;",fich);
......@@ -489,10 +489,10 @@ void translate_pt(int add, int s, char *fich){
char text[BUFFSIZE];
if(add)
sprintf(text,"Translate({%s,%s,%s}) {\n Duplicata { Point(%d); }\n}",
sprintf(text,"Translate {%s,%s,%s} {\n Duplicata { Point{%d}; }\n}",
tx_text,ty_text,tz_text,s);
else
sprintf(text,"Translate({%s,%s,%s}) {\n Point(%d);\n}",
sprintf(text,"Translate {%s,%s,%s} {\n Point{%d};\n}",
tx_text,ty_text,tz_text,s);
add_infile(text,fich);
add_infile("Coherence;",fich);
......@@ -502,10 +502,10 @@ void rotate(int add, int s, char *fich, char *quoi){
char text[BUFFSIZE];
if(add)
sprintf(text,"Rotate({%s,%s,%s},{%s,%s,%s},%s) {\n Duplicata { %s(%d); }\n}",
sprintf(text,"Rotate { {%s,%s,%s},{%s,%s,%s},%s } {\n Duplicata { %s{%d}; }\n}",
ax_text,ay_text,az_text,px_text,py_text,pz_text,angle_text, quoi,s);
else
sprintf(text,"Rotate({%s,%s,%s},{%s,%s,%s},%s) {\n %s(%d);\n }",
sprintf(text,"Rotate { {%s,%s,%s},{%s,%s,%s},%s } {\n %s{%d};\n }",
ax_text,ay_text,az_text,px_text,py_text,pz_text,angle_text, quoi,s);
add_infile(text,fich);
add_infile("Coherence;",fich);
......@@ -515,10 +515,10 @@ void dilate(int add, int s, char *fich, char *quoi){
char text[BUFFSIZE];
if(add)
sprintf(text,"Dilate({%s,%s,%s},%s) {\n Duplicata { %s(%d); }\n}",
sprintf(text,"Dilate { {%s,%s,%s},%s } {\n Duplicata { %s{%d}; }\n}",
dx_text,dy_text,dz_text,df_text, quoi,s);
else
sprintf(text,"Dilate({%s,%s,%s},%s) {\n %s(%d);\n }",
sprintf(text,"Dilate { {%s,%s,%s},%s } {\n %s{%d};\n }",
dx_text,dy_text,dz_text,df_text, quoi,s);
add_infile(text,fich);
add_infile("Coherence;",fich);
......@@ -528,7 +528,7 @@ void dilate(int add, int s, char *fich, char *quoi){
void protude(int s, char *fich, char *what){
char text[BUFFSIZE];
sprintf(text,"Extrude %s(%d, {%s,%s,%s}, {%s,%s,%s}, %s);",what,s,ax_text,ay_text,
sprintf(text,"Extrude %s {%d, {%s,%s,%s}, {%s,%s,%s}, %s};",what,s,ax_text,ay_text,
az_text,px_text,py_text,pz_text,angle_text);
add_infile(text,fich);
add_infile("Coherence;",fich);
......
This diff is collapsed.
%{ /* $Id: Gmsh.y,v 1.8 2000-11-28 11:28:35 geuzaine Exp $ */
%{ /* $Id: Gmsh.y,v 1.9 2000-11-28 14:42:44 geuzaine Exp $ */
#include <stdarg.h>
......@@ -697,21 +697,21 @@ Shape :
$$.Type = MSH_PHYSICAL_POINT;
$$.Num = (int)$4;
}
| tAttractor tPoint '(' FExpr ',' FExpr ',' FExpr ')' tAFFECT ListOfDouble tEND
| tAttractor tPoint ListOfDouble tAFFECT '(' FExpr ',' FExpr ',' FExpr ')' tEND
{
Vertex *v;
Attractor *a;
double p;
int ip;
for(int i=0;i<List_Nbr($11);i++){
List_Read($11,i,&p);
for(int i=0;i<List_Nbr($3);i++){
List_Read($3,i,&p);
ip = (int)p;
v = FindVertex(ip,THEM);
if(!v)
vyyerror("Unkown Point %d", ip);
else{
a = Create_Attractor(List_Nbr(THEM->Metric->Attractors)+1,
$4,$6,$8,v,NULL,NULL);
$6,$8,$10,v,NULL,NULL);
List_Add(THEM->Metric->Attractors,&a);
}
}
......@@ -727,7 +727,7 @@ Shape :
v->lc = $5;
}
}
| tPoint '(' FExpr ')' tEND
| tPoint '{' FExpr '}' tEND
{
$$.Type = MSH_POINT;
$$.Num = (int)$3;
......@@ -747,21 +747,21 @@ Shape :
$$.Type = MSH_SEGM_SPLN;
$$.Num = (int)$3;
}
| tAttractor tLine '(' FExpr ',' FExpr ',' FExpr ')' tAFFECT ListOfDouble tEND
| tAttractor tLine ListOfDouble tAFFECT '{' FExpr ',' FExpr ',' FExpr '}' tEND
{
Curve *c;
Attractor *a;
double p;
int ip;
for(int i=0;i<List_Nbr($11);i++){
List_Read($11,i,&p);
for(int i=0;i<List_Nbr($3);i++){
List_Read($3,i,&p);
ip = (int)p;
c = FindCurve(ip,THEM);
if(!c)
vyyerror("Unkown Curve %d", ip);
else{
a = Create_Attractor(List_Nbr(THEM->Metric->Attractors)+1,
$4,$6,$8,NULL,c,NULL);
$6,$8,$10,NULL,c,NULL);
List_Add(THEM->Metric->Attractors,&a);
}
}
......@@ -789,7 +789,7 @@ Shape :
$$.Num = (int)$3;
}
| tParametric '(' FExpr ')' tAFFECT
'(' FExpr ',' FExpr ',' tBIGSTR ',' tBIGSTR ',' tBIGSTR ')' tEND
'{' FExpr ',' FExpr ',' tBIGSTR ',' tBIGSTR ',' tBIGSTR '}' tEND
{
Cdbseg101((int)$3,MSH_SEGM_PARAMETRIC,2,NULL,NULL,-1,-1,$7,$9,$11,$13,$15);
$$.Type = MSH_SEGM_PARAMETRIC ;
......@@ -813,15 +813,6 @@ Shape :
Cdbz101((int)$4,$$.Type,0,0,0,0,0,NULL,$7,NULL);
$$.Num = (int)$4;
}
| tLine '(' FExpr ')' tEND
{
$$.Num = (int)$3;
Curve *c = FindCurve($$.Num,THEM);
if(!c)
vyyerror("Unkown Curve %d", $$.Num);
else
$$.Type = c->Typ;
}
| tBSpline '(' FExpr ')' tAFFECT ListOfDouble tEND
{
Cdbseg101((int)$3,MSH_SEGM_BSPLN,2,$6,NULL,-1,-1,0.,1.,NULL,NULL,NULL);
......@@ -847,6 +838,15 @@ Shape :
AddCurveInDataBase ((int)$3,MSH_SEGM_NURBS,(int)$10,Temp,$8,-1,-1,0.,1.);
List_Delete(Temp);
}
| tLine '{' FExpr '}' tEND
{
$$.Num = (int)$3;
Curve *c = FindCurve($$.Num,THEM);
if(!c)
vyyerror("Unkown Curve %d", $$.Num);
else
$$.Type = c->Typ;
}
/* -------- Surfaces -------- */
......@@ -922,7 +922,7 @@ Shape :
$$.Type = MSH_SURF_LOOP;
$$.Num = (int)$4;
}
| tSurface '(' FExpr ')' tEND
| tSurface '{' FExpr '}' tEND
{
$$.Num = (int)$3;
Surface *s = FindSurface($$.Num,THEM);
......@@ -959,22 +959,22 @@ Shape :
------------------- */
Transform :
tTranslate '(' VExpr ')' '{' MultipleShape '}'
tTranslate VExpr '{' MultipleShape '}'
{
TranslateShapes ($3[0],$3[1],$3[2],$6,1);
$$ = $6;
TranslateShapes ($2[0],$2[1],$2[2],$4,1);
$$ = $4;
}
| tRotate '(' VExpr ',' VExpr ',' FExpr ')' '{' MultipleShape '}'
| tRotate '{' VExpr ',' VExpr ',' FExpr '}' '{' MultipleShape '}'
{
RotateShapes($3[0],$3[1],$3[2],$5[0],$5[1],$5[2],$7,$10);
$$ = $10;
}
| tSymmetry '(' VExpr ')' '{' MultipleShape '}'
| tSymmetry VExpr '{' MultipleShape '}'
{
SymmetryShapes($3[0],$3[1],$3[2],$3[3],$6,1);
$$ = $6;
SymmetryShapes($2[0],$2[1],$2[2],$2[3],$4,1);
$$ = $4;
}
| tDilate '(' VExpr ',' FExpr ')' '{' MultipleShape '}'
| tDilate '{' VExpr ',' FExpr '}' '{' MultipleShape '}'
{
DilatShapes($3[0],$3[1],$3[2],$5,$8,1);
$$ = $8;
......@@ -1068,48 +1068,39 @@ Macro :
--------------- */
Extrude :
tExtrude '(' FExpr ',' VExpr ')' tEND
tExtrude tPoint '{' FExpr ',' VExpr '}' tEND
{
Extrude_ProtudeSurface(1,(int)$3,$5[0],$5[1],$5[2],0.,0.,0.,0.,0,NULL);
}
| tExtrude tSurface '(' FExpr ',' VExpr ')' tEND
{
Extrude_ProtudeSurface(1,(int)$4,$6[0],$6[1],$6[2],0.,0.,0.,0.,0,NULL);
}
| tExtrude '(' FExpr ',' VExpr ',' VExpr ',' FExpr ')' tEND
{
Extrude_ProtudeSurface(0,(int)$3,$5[0],$5[1],$5[2],$7[0],$7[1],$7[2],$9,0,NULL);
}
| tExtrude tSurface '(' FExpr ',' VExpr ',' VExpr ',' FExpr ')' tEND
{
Extrude_ProtudeSurface(0,(int)$4,$6[0],$6[1],$6[2],$8[0],$8[1],$8[2],$10,0,NULL);
Curve *pc, *prc;
Extrude_ProtudePoint(1,(int)$4,$6[0],$6[1],$6[2],0.,0.,0.,0.,&pc,&prc,NULL);
}
| tExtrude tPoint '(' FExpr ',' VExpr ',' VExpr ',' FExpr ')' tEND
| tExtrude tPoint '{' FExpr ',' VExpr ',' VExpr ',' FExpr '}' tEND
{
Curve *pc, *prc;
Extrude_ProtudePoint(0,(int)$4,$6[0],$6[1],$6[2],$8[0],$8[1],$8[2],$10,
&pc,&prc,NULL);
}
| tExtrude tPoint '(' FExpr ',' VExpr ')' tEND
| tExtrude tLine'{' FExpr ',' VExpr '}' tEND
{
Curve *pc, *prc;
Extrude_ProtudePoint(1,(int)$4,$6[0],$6[1],$6[2],0.,0.,0.,0.,&pc,&prc,NULL);
Extrude_ProtudeCurve(1,(int)$4,$6[0],$6[1],$6[2],0.,0.,0.,0.,NULL);
}
| tExtrude tLine'(' FExpr ',' VExpr ',' VExpr ',' FExpr ')' tEND
| tExtrude tLine'{' FExpr ',' VExpr ',' VExpr ',' FExpr '}' tEND
{
Extrude_ProtudeCurve(0,(int)$4,$6[0],$6[1],$6[2],$8[0],$8[1],$8[2],$10,NULL);
}
| tExtrude tLine'(' FExpr ',' VExpr ')' tEND
| tExtrude tSurface '{' FExpr ',' VExpr '}' tEND
{
Extrude_ProtudeCurve(1,(int)$4,$6[0],$6[1],$6[2],0.,0.,0.,0.,NULL);
Extrude_ProtudeSurface(1,(int)$4,$6[0],$6[1],$6[2],0.,0.,0.,0.,0,NULL);
}
| tExtrude tSurface '{' FExpr ',' VExpr ',' VExpr ',' FExpr '}' tEND
{
Extrude_ProtudeSurface(0,(int)$4,$6[0],$6[1],$6[2],$8[0],$8[1],$8[2],$10,0,NULL);
}
| tExtrude tSurface '(' FExpr ',' VExpr ')' '{' ExtrudeParameters '}' tEND
| tExtrude tSurface '{' FExpr ',' VExpr '}' '{' ExtrudeParameters '}' tEND
{
int vol = NEWREG();
Extrude_ProtudeSurface(1,(int)$4,$6[0],$6[1],$6[2],0.,0.,0.,0.,vol,&extr);
}
| tExtrude tSurface '(' FExpr ',' VExpr ',' VExpr ',' FExpr ')'
'{' ExtrudeParameters '}'tEND
| tExtrude tSurface '{' FExpr ',' VExpr ',' VExpr ',' FExpr '}' '{' ExtrudeParameters '}'tEND
{
int vol = NEWREG();
Extrude_ProtudeSurface(0,(int)$4,$6[0],$6[1],$6[2],$8[0],$8[1],$8[2],$10,vol,&extr);
......
......@@ -2,7 +2,7 @@
/* A lexical scanner generated by flex */
/* Scanner skeleton version:
* $Header: /cvsroot/gmsh/Parser/Gmsh.yy.cpp,v 1.10 2000-11-28 11:28:35 geuzaine Exp $
* $Header: /cvsroot/gmsh/Parser/Gmsh.yy.cpp,v 1.11 2000-11-28 14:42:44 geuzaine Exp $
*/
#define FLEX_SCANNER
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment