Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
12e97e2b
Commit
12e97e2b
authored
24 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
Generalized ListOfDouble
parent
294014a6
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
Parser/Gmsh.tab.cpp
+1387
-1296
1387 additions, 1296 deletions
Parser/Gmsh.tab.cpp
Parser/Gmsh.y
+84
-39
84 additions, 39 deletions
Parser/Gmsh.y
Parser/Gmsh.yy.cpp
+2
-2
2 additions, 2 deletions
Parser/Gmsh.yy.cpp
with
1473 additions
and
1337 deletions
Parser/Gmsh.tab.cpp
+
1387
−
1296
View file @
12e97e2b
Source diff could not be displayed: it is too large. Options to address this:
view the blob
.
This diff is collapsed.
Click to expand it.
Parser/Gmsh.y
+
84
−
39
View file @
12e97e2b
%{
%{
// $Id: Gmsh.y,v 1.6
7
2001-0
2-23 00:07:51 remacl
e Exp $
// $Id: Gmsh.y,v 1.6
8
2001-0
3-22 16:09:32 geuzain
e Exp $
#include <stdarg.h>
#include <stdarg.h>
...
@@ -50,7 +50,6 @@ static int i,j,k,flag,RecursionLevel=0,ImbricatedLoop = 0;
...
@@ -50,7 +50,6 @@ static int i,j,k,flag,RecursionLevel=0,ImbricatedLoop = 0;
static int Last_NumberOfPoints = 0;
static int Last_NumberOfPoints = 0;
static double d, *pd;
static double d, *pd;
static ExtrudeParams extr;
static ExtrudeParams extr;
static List_T *ListOfDouble_L,*ListOfDouble2_L;
static List_T *ListOfListOfDouble_L, *ListOfColor_L=NULL;
static List_T *ListOfListOfDouble_L, *ListOfColor_L=NULL;
static char *str;
static char *str;
static StringXString *pStrCat;
static StringXString *pStrCat;
...
@@ -117,8 +116,10 @@ void skip_until (char *skip, char *until);
...
@@ -117,8 +116,10 @@ void skip_until (char *skip, char *until);
%type <i> BoolExpr, NumericAffectation, NumericIncrement
%type <i> BoolExpr, NumericAffectation, NumericIncrement
%type <u> ColorExpr
%type <u> ColorExpr
%type <c> StringExpr
%type <c> StringExpr
%type <l> FExpr_Range
%type <l> ListOfDouble RecursiveListOfDouble
%type <l> ListOfShapes Duplicata Transform MultipleShape
%type <l> ListOfShapes Duplicata Transform MultipleShape
%type <l> ListOfStrings
ListOfDouble
ListOfListOfDouble ListOfColor
%type <l> ListOfStrings ListOfListOfDouble ListOfColor
%type <s> Shape
%type <s> Shape
/* ------------------------------------------------------------------ */
/* ------------------------------------------------------------------ */
...
@@ -396,7 +397,7 @@ Printf :
...
@@ -396,7 +397,7 @@ Printf :
}
}
| tPrintf '(' tBIGSTR ',' RecursiveListOfDouble ')' tEND
| tPrintf '(' tBIGSTR ',' RecursiveListOfDouble ')' tEND
{
{
for(i = 0 ; i<List_Nbr(
ListOfDouble_L
) ; i++){
for(i = 0 ; i<List_Nbr(
$5
) ; i++){
if(!i){
if(!i){
str = strtok($3, "%");
str = strtok($3, "%");
strcpy(tmpstring, str);
strcpy(tmpstring, str);
...
@@ -405,12 +406,12 @@ Printf :
...
@@ -405,12 +406,12 @@ Printf :
if(str){
if(str){
strcpy(tmpstring2, "%");
strcpy(tmpstring2, "%");
strcat(tmpstring2, str);
strcat(tmpstring2, str);
sprintf(tmpstring3, tmpstring2, *(double*)List_Pointer(
ListOfDouble_L
,i));
sprintf(tmpstring3, tmpstring2, *(double*)List_Pointer(
$5
,i));
strcat(tmpstring, tmpstring3);
strcat(tmpstring, tmpstring3);
}
}
else{
else{
vyyerror("Missing %d Parameter(s) in Printf Format",
vyyerror("Missing %d Parameter(s) in Printf Format",
List_Nbr(
ListOfDouble_L
)-i);
List_Nbr(
$5
)-i);
break ;
break ;
}
}
}
}
...
@@ -2055,20 +2056,20 @@ FExpr_Single :
...
@@ -2055,20 +2056,20 @@ FExpr_Single :
FExpr_Range :
FExpr_Range :
FExpr tDOTS FExpr
FExpr tDOTS FExpr
{
{
ListOfDouble2_L
= List_Create(2,1,sizeof(double)) ;
$$
= List_Create(2,1,sizeof(double)) ;
for(d=$1 ; ($1<$3)?(d<=$3):(d>=$3) ; ($1<$3)?(d+=1.):(d-=1.))
for(d=$1 ; ($1<$3)?(d<=$3):(d>=$3) ; ($1<$3)?(d+=1.):(d-=1.))
List_Add(
ListOfDouble2_L
, &d) ;
List_Add(
$$
, &d) ;
}
}
| FExpr tDOTS FExpr tDOTS FExpr
| FExpr tDOTS FExpr tDOTS FExpr
{
{
ListOfDouble2_L
= List_Create(2,1,sizeof(double)) ;
$$
= List_Create(2,1,sizeof(double)) ;
if(!$5 || ($1<$3 && $5<0) || ($1>$3 && $5>0)){
if(!$5 || ($1<$3 && $5<0) || ($1>$3 && $5>0)){
vyyerror("Wrong Increment in '%g:%g:%g'", $1, $3, $5) ;
vyyerror("Wrong Increment in '%g:%g:%g'", $1, $3, $5) ;
List_Add(
ListOfDouble2_L
, &($1)) ;
List_Add(
$$
, &($1)) ;
}
}
else
else
for(d=$1 ; ($5>0)?(d<=$3):(d>=$3) ; d+=$5)
for(d=$1 ; ($5>0)?(d<=$3):(d>=$3) ; d+=$5)
List_Add(
ListOfDouble2_L
, &d) ;
List_Add(
$$
, &d) ;
}
}
;
;
...
@@ -2163,28 +2164,45 @@ ListOfDouble :
...
@@ -2163,28 +2164,45 @@ ListOfDouble :
}
}
| FExpr
| FExpr
{
{
ListOfDouble_L = List_Create(2,1,sizeof(double)) ;
$$ = List_Create(2,1,sizeof(double)) ;
List_Add(ListOfDouble_L, &($1)) ;
List_Add($$, &($1)) ;
$$=ListOfDouble_L;
}
}
| tSTRING '[' ']'
| tSTRING '[' ']'
{
{
ListOfDouble_L
= List_Create(2,1,sizeof(double)) ;
$$
= List_Create(2,1,sizeof(double)) ;
TheSymbol.Name = $1 ;
TheSymbol.Name = $1 ;
if (!(pSymbol = (Symbol*)List_PQuery(Symbol_L, &TheSymbol, CompareSymbols))) {
if (!(pSymbol = (Symbol*)List_PQuery(Symbol_L, &TheSymbol, CompareSymbols))) {
vyyerror("Unknown Variable '%s'", $1) ;
vyyerror("Unknown Variable '%s'", $1) ;
d = 0.0 ;
d = 0.0 ;
List_Add(
ListOfDouble_L
, &d);
List_Add(
$$
, &d);
}
}
else{
else{
for(i = 0 ; i < List_Nbr(pSymbol->val) ; i++)
for(i = 0 ; i < List_Nbr(pSymbol->val) ; i++)
List_Add(ListOfDouble_L, (double*)List_Pointer_Fast(pSymbol->val, i)) ;
List_Add($$, (double*)List_Pointer_Fast(pSymbol->val, i)) ;
}
}
| tSTRING '[' '{' RecursiveListOfDouble '}' ']'
{
$$ = List_Create(2,1,sizeof(double)) ;
TheSymbol.Name = $1 ;
if (!(pSymbol = (Symbol*)List_PQuery(Symbol_L, &TheSymbol, CompareSymbols))) {
vyyerror("Unknown Variable '%s'", $1) ;
d = 0.0 ;
List_Add($$, &d);
}
else{
for(i = 0 ; i < List_Nbr($4) ; i++){
j = (int)(*(double*)List_Pointer_Fast($4, i));
if((pd = (double*)List_Pointer_Test(pSymbol->val, j)))
List_Add($$, pd) ;
else
vyyerror("Uninitialized Variable '%s[%d]'", $1, j) ;
}
}
}
$$=ListOfDouble_L;
}
}
| '{' RecursiveListOfDouble '}'
| '{' RecursiveListOfDouble '}'
{
{
$$=
ListOfDouble_L
;
$$=
$2
;
}
}
;
;
...
@@ -2192,41 +2210,52 @@ ListOfDouble :
...
@@ -2192,41 +2210,52 @@ ListOfDouble :
RecursiveListOfDouble :
RecursiveListOfDouble :
FExpr
FExpr
{
{
ListOfDouble_L
= List_Create(2,1,sizeof(double)) ;
$$
= List_Create(2,1,sizeof(double)) ;
List_Add(
ListOfDouble_L
, &($1)) ;
List_Add(
$$
, &($1)) ;
}
}
| FExpr_Range
| FExpr_Range
{
{
ListOfDouble_L = List_Create(2,1,sizeof(double)) ;
$$ = $1;
for(i=0 ; i<List_Nbr(ListOfDouble2_L) ; i++){
List_Read(ListOfDouble2_L, i, &d) ;
List_Add(ListOfDouble_L, &d) ;
}
List_Delete(ListOfDouble2_L);
}
}
| tSTRING '[' ']'
| tSTRING '[' ']'
{
{
ListOfDouble_L
= List_Create(2,1,sizeof(double)) ;
$$
= List_Create(2,1,sizeof(double)) ;
TheSymbol.Name = $1 ;
TheSymbol.Name = $1 ;
if (!(pSymbol = (Symbol*)List_PQuery(Symbol_L, &TheSymbol, CompareSymbols))) {
if (!(pSymbol = (Symbol*)List_PQuery(Symbol_L, &TheSymbol, CompareSymbols))) {
vyyerror("Unknown Variable '%s'", $1) ;
vyyerror("Unknown Variable '%s'", $1) ;
}
}
else{
else{
for(i = 0 ; i < List_Nbr(pSymbol->val) ; i++)
for(i = 0 ; i < List_Nbr(pSymbol->val) ; i++)
List_Add(ListOfDouble_L, (double*)List_Pointer_Fast(pSymbol->val, i)) ;
List_Add($$, (double*)List_Pointer_Fast(pSymbol->val, i)) ;
}
}
| tSTRING '[' '{' RecursiveListOfDouble '}' ']'
{
$$ = List_Create(2,1,sizeof(double)) ;
TheSymbol.Name = $1 ;
if (!(pSymbol = (Symbol*)List_PQuery(Symbol_L, &TheSymbol, CompareSymbols))) {
vyyerror("Unknown Variable '%s'", $1) ;
}
else{
for(i = 0 ; i < List_Nbr($4) ; i++){
j = (int)(*(double*)List_Pointer_Fast($4, i));
if((pd = (double*)List_Pointer_Test(pSymbol->val, j)))
List_Add($$, pd) ;
else
vyyerror("Uninitialized Variable '%s[%d]'", $1, j) ;
}
}
}
}
}
| RecursiveListOfDouble ',' FExpr
| RecursiveListOfDouble ',' FExpr
{
{
List_Add(
ListOfDouble_L
, &($3)) ;
List_Add(
$$
, &($3)) ;
}
}
| RecursiveListOfDouble ',' FExpr_Range
| RecursiveListOfDouble ',' FExpr_Range
{
{
for(i=0 ; i<List_Nbr(
ListOfDouble2_L
) ; i++){
for(i=0 ; i<List_Nbr(
$3
) ; i++){
List_Read(
ListOfDouble2_L
, i, &d) ;
List_Read(
$3
, i, &d) ;
List_Add(
ListOfDouble_L
, &d) ;
List_Add(
$$
, &d) ;
}
}
List_Delete(ListOfDouble2_L);
}
}
| RecursiveListOfDouble ',' tSTRING '[' ']'
| RecursiveListOfDouble ',' tSTRING '[' ']'
{
{
...
@@ -2236,7 +2265,23 @@ RecursiveListOfDouble :
...
@@ -2236,7 +2265,23 @@ RecursiveListOfDouble :
}
}
else{
else{
for(i = 0 ; i < List_Nbr(pSymbol->val) ; i++)
for(i = 0 ; i < List_Nbr(pSymbol->val) ; i++)
List_Add(ListOfDouble_L, (double*)List_Pointer_Fast(pSymbol->val, i)) ;
List_Add($$, (double*)List_Pointer_Fast(pSymbol->val, i)) ;
}
}
| RecursiveListOfDouble ',' tSTRING '[' '{' RecursiveListOfDouble '}' ']'
{
TheSymbol.Name = $3 ;
if (!(pSymbol = (Symbol*)List_PQuery(Symbol_L, &TheSymbol, CompareSymbols))) {
vyyerror("Unknown Variable '%s'", $3) ;
}
else{
for(i = 0 ; i < List_Nbr($6) ; i++){
j = (int)(*(double*)List_Pointer_Fast($6, i));
if((pd = (double*)List_Pointer_Test(pSymbol->val, j)))
List_Add($$, pd) ;
else
vyyerror("Uninitialized Variable '%s[%d]'", $3, j) ;
}
}
}
}
}
;
;
...
@@ -2326,7 +2371,7 @@ StringExpr :
...
@@ -2326,7 +2371,7 @@ StringExpr :
}
}
| tSprintf '(' tBIGSTR ',' RecursiveListOfDouble ')'
| tSprintf '(' tBIGSTR ',' RecursiveListOfDouble ')'
{
{
for(i = 0 ; i<List_Nbr(
ListOfDouble_L
) ; i++){
for(i = 0 ; i<List_Nbr(
$5
) ; i++){
if(!i){
if(!i){
str = strtok($3, "%");
str = strtok($3, "%");
strcpy(tmpstring, str);
strcpy(tmpstring, str);
...
@@ -2335,12 +2380,12 @@ StringExpr :
...
@@ -2335,12 +2380,12 @@ StringExpr :
if(str){
if(str){
strcpy(tmpstring2, "%");
strcpy(tmpstring2, "%");
strcat(tmpstring2, str);
strcat(tmpstring2, str);
sprintf(tmpstring3, tmpstring2, *(double*)List_Pointer(
ListOfDouble_L
,i));
sprintf(tmpstring3, tmpstring2, *(double*)List_Pointer(
$5
,i));
strcat(tmpstring, tmpstring3);
strcat(tmpstring, tmpstring3);
}
}
else{
else{
vyyerror("Missing %d Parameter(s) in Sprintf Format",
vyyerror("Missing %d Parameter(s) in Sprintf Format",
List_Nbr(
ListOfDouble_L
)-i);
List_Nbr(
$5
)-i);
break ;
break ;
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Parser/Gmsh.yy.cpp
+
2
−
2
View file @
12e97e2b
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
/* A lexical scanner generated by flex */
/* A lexical scanner generated by flex */
/* Scanner skeleton version:
/* Scanner skeleton version:
* $Header: /cvsroot/gmsh/Parser/Gmsh.yy.cpp,v 1.7
7
2001-03-
09 08:16:31
geuzaine Exp $
* $Header: /cvsroot/gmsh/Parser/Gmsh.yy.cpp,v 1.7
8
2001-03-
22 16:09:32
geuzaine Exp $
*/
*/
#define FLEX_SCANNER
#define FLEX_SCANNER
...
@@ -978,7 +978,7 @@ char *yytext;
...
@@ -978,7 +978,7 @@ char *yytext;
#define INITIAL 0
#define INITIAL 0
#line 2 "Gmsh.l"
#line 2 "Gmsh.l"
// $Id: Gmsh.yy.cpp,v 1.7
7
2001-03-
09 08:16:31
geuzaine Exp $
// $Id: Gmsh.yy.cpp,v 1.7
8
2001-03-
22 16:09:32
geuzaine Exp $
#include
<stdio.h>
#include
<stdio.h>
#include
<stdlib.h>
#include
<stdlib.h>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment