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

new StrChoice function

parent fea969de
No related branches found
No related tags found
No related merge requests found
......@@ -255,6 +255,7 @@ StrPrefix return tStrPrefix;
StrRelative return tStrRelative;
StrFind return tStrFind;
StrCmp return tStrCmp;
StrChoice return tStrChoice;
Show return tShow;
Symmetry return tSymmetry;
SyncModel return tSyncModel;
......
This diff is collapsed.
......@@ -90,128 +90,129 @@ extern int gmsh_yydebug;
tStrReplace = 299,
tStrFind = 300,
tStrCmp = 301,
tTextAttributes = 302,
tBoundingBox = 303,
tDraw = 304,
tSetChanged = 305,
tToday = 306,
tFixRelativePath = 307,
tSyncModel = 308,
tOnelabAction = 309,
tOnelabRun = 310,
tCpu = 311,
tMemory = 312,
tTotalMemory = 313,
tCreateTopology = 314,
tCreateTopologyNoHoles = 315,
tDistanceFunction = 316,
tDefineConstant = 317,
tUndefineConstant = 318,
tDefineNumber = 319,
tDefineString = 320,
tPoint = 321,
tCircle = 322,
tEllipse = 323,
tLine = 324,
tSphere = 325,
tPolarSphere = 326,
tSurface = 327,
tSpline = 328,
tVolume = 329,
tCharacteristic = 330,
tLength = 331,
tParametric = 332,
tElliptic = 333,
tRefineMesh = 334,
tAdaptMesh = 335,
tRelocateMesh = 336,
tPlane = 337,
tRuled = 338,
tTransfinite = 339,
tComplex = 340,
tPhysical = 341,
tCompound = 342,
tPeriodic = 343,
tUsing = 344,
tPlugin = 345,
tDegenerated = 346,
tRecursive = 347,
tRotate = 348,
tTranslate = 349,
tSymmetry = 350,
tDilate = 351,
tExtrude = 352,
tLevelset = 353,
tRecombine = 354,
tSmoother = 355,
tSplit = 356,
tDelete = 357,
tCoherence = 358,
tIntersect = 359,
tMeshAlgorithm = 360,
tReverse = 361,
tLayers = 362,
tScaleLast = 363,
tHole = 364,
tAlias = 365,
tAliasWithOptions = 366,
tCopyOptions = 367,
tQuadTriAddVerts = 368,
tQuadTriNoNewVerts = 369,
tQuadTriSngl = 370,
tQuadTriDbl = 371,
tRecombLaterals = 372,
tTransfQuadTri = 373,
tText2D = 374,
tText3D = 375,
tInterpolationScheme = 376,
tTime = 377,
tCombine = 378,
tBSpline = 379,
tBezier = 380,
tNurbs = 381,
tNurbsOrder = 382,
tNurbsKnots = 383,
tColor = 384,
tColorTable = 385,
tFor = 386,
tIn = 387,
tEndFor = 388,
tIf = 389,
tEndIf = 390,
tExit = 391,
tAbort = 392,
tField = 393,
tReturn = 394,
tCall = 395,
tFunction = 396,
tShow = 397,
tHide = 398,
tGetValue = 399,
tGetEnv = 400,
tGetString = 401,
tHomology = 402,
tCohomology = 403,
tBetti = 404,
tSetOrder = 405,
tExists = 406,
tFileExists = 407,
tGMSH_MAJOR_VERSION = 408,
tGMSH_MINOR_VERSION = 409,
tGMSH_PATCH_VERSION = 410,
tAFFECTDIVIDE = 411,
tAFFECTTIMES = 412,
tAFFECTMINUS = 413,
tAFFECTPLUS = 414,
tOR = 415,
tAND = 416,
tNOTEQUAL = 417,
tEQUAL = 418,
tGREATEROREQUAL = 419,
tLESSOREQUAL = 420,
UNARYPREC = 421,
tMINUSMINUS = 422,
tPLUSPLUS = 423
tStrChoice = 302,
tTextAttributes = 303,
tBoundingBox = 304,
tDraw = 305,
tSetChanged = 306,
tToday = 307,
tFixRelativePath = 308,
tSyncModel = 309,
tOnelabAction = 310,
tOnelabRun = 311,
tCpu = 312,
tMemory = 313,
tTotalMemory = 314,
tCreateTopology = 315,
tCreateTopologyNoHoles = 316,
tDistanceFunction = 317,
tDefineConstant = 318,
tUndefineConstant = 319,
tDefineNumber = 320,
tDefineString = 321,
tPoint = 322,
tCircle = 323,
tEllipse = 324,
tLine = 325,
tSphere = 326,
tPolarSphere = 327,
tSurface = 328,
tSpline = 329,
tVolume = 330,
tCharacteristic = 331,
tLength = 332,
tParametric = 333,
tElliptic = 334,
tRefineMesh = 335,
tAdaptMesh = 336,
tRelocateMesh = 337,
tPlane = 338,
tRuled = 339,
tTransfinite = 340,
tComplex = 341,
tPhysical = 342,
tCompound = 343,
tPeriodic = 344,
tUsing = 345,
tPlugin = 346,
tDegenerated = 347,
tRecursive = 348,
tRotate = 349,
tTranslate = 350,
tSymmetry = 351,
tDilate = 352,
tExtrude = 353,
tLevelset = 354,
tRecombine = 355,
tSmoother = 356,
tSplit = 357,
tDelete = 358,
tCoherence = 359,
tIntersect = 360,
tMeshAlgorithm = 361,
tReverse = 362,
tLayers = 363,
tScaleLast = 364,
tHole = 365,
tAlias = 366,
tAliasWithOptions = 367,
tCopyOptions = 368,
tQuadTriAddVerts = 369,
tQuadTriNoNewVerts = 370,
tQuadTriSngl = 371,
tQuadTriDbl = 372,
tRecombLaterals = 373,
tTransfQuadTri = 374,
tText2D = 375,
tText3D = 376,
tInterpolationScheme = 377,
tTime = 378,
tCombine = 379,
tBSpline = 380,
tBezier = 381,
tNurbs = 382,
tNurbsOrder = 383,
tNurbsKnots = 384,
tColor = 385,
tColorTable = 386,
tFor = 387,
tIn = 388,
tEndFor = 389,
tIf = 390,
tEndIf = 391,
tExit = 392,
tAbort = 393,
tField = 394,
tReturn = 395,
tCall = 396,
tFunction = 397,
tShow = 398,
tHide = 399,
tGetValue = 400,
tGetEnv = 401,
tGetString = 402,
tHomology = 403,
tCohomology = 404,
tBetti = 405,
tSetOrder = 406,
tExists = 407,
tFileExists = 408,
tGMSH_MAJOR_VERSION = 409,
tGMSH_MINOR_VERSION = 410,
tGMSH_PATCH_VERSION = 411,
tAFFECTDIVIDE = 412,
tAFFECTTIMES = 413,
tAFFECTMINUS = 414,
tAFFECTPLUS = 415,
tOR = 416,
tAND = 417,
tNOTEQUAL = 418,
tEQUAL = 419,
tGREATEROREQUAL = 420,
tLESSOREQUAL = 421,
UNARYPREC = 422,
tMINUSMINUS = 423,
tPLUSPLUS = 424
};
#endif
......@@ -232,7 +233,7 @@ typedef union YYSTYPE
/* Line 2053 of yacc.c */
#line 236 "Gmsh.tab.hpp"
#line 237 "Gmsh.tab.hpp"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
......
......@@ -114,7 +114,7 @@ struct doubleXstring{
%token tAtan tAtan2 tSinh tCosh tTanh tFabs tFloor tCeil tRound
%token tFmod tModulo tHypot tList
%token tPrintf tError tStr tSprintf tStrCat tStrPrefix tStrRelative tStrReplace
%token tStrFind tStrCmp
%token tStrFind tStrCmp tStrChoice
%token tTextAttributes
%token tBoundingBox tDraw tSetChanged tToday tFixRelativePath tSyncModel
%token tOnelabAction tOnelabRun
......@@ -5302,6 +5302,17 @@ StringExpr :
}
List_Delete($3);
}
| tStrChoice LP FExpr ',' StringExpr ',' StringExpr RP
{
if($3){
$$ = $5;
Free($7);
}
else{
$$ = $7;
Free($5);
}
}
| tSprintf LP StringExprVar RP
{
$$ = $3;
......@@ -5325,7 +5336,7 @@ StringExpr :
}
List_Delete($5);
}
| tFixRelativePath '(' StringExprVar ')'
| tFixRelativePath LP StringExprVar RP
{
std::string tmp = FixRelativePath(gmsh_yyname, $3);
$$ = (char*)Malloc((tmp.size() + 1) * sizeof(char));
......
This diff is collapsed.
......@@ -1112,6 +1112,7 @@ Character expressions are defined as:
StrRelative ( @var{char-expression} ) |
StrCat ( @var{char-expression} <,@dots{}> ) |
Str ( @var{char-expression} <,@dots{}> ) |
StrChoice ( @var{expression}, @var{char-expression}, @var{char-expression}) |
Sprintf ( @var{char-expression} , @var{expression-list} ) |
Sprintf ( @var{char-expression} ) |
Sprintf ( @var{char-option} ) |
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment