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