diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h
index 82e0f103dfb943b692d21fd8628ebd18e1df3f1a..32b49d19c11805deb4c7f4d3cb000f8e3f570c58 100644
--- a/Common/DefaultOptions.h
+++ b/Common/DefaultOptions.h
@@ -120,6 +120,8 @@ StringXString SolverOptions_String[] = {
     "getdp" , 
 #endif
     "System command to launch solver 0 (should not contain the `&' character)" },
+  { F|O, "InputName0" , opt_solver_input_name0 , "" ,
+    "Default input file name for solver 0" },
   { F|O, "Extension0" , opt_solver_extension0 , ".pro" ,
     "Default file name extension for solver 0" },
   { F|O, "MeshName0" , opt_solver_mesh_name0 , "" ,
@@ -169,6 +171,8 @@ StringXString SolverOptions_String[] = {
     "Help string for solver 1" },
   { F|O, "Executable1" , opt_solver_executable1 , "" , 
     "System command to launch solver 1 (should not contain the `&' character)" },
+  { F|O, "InputName1" , opt_solver_input_name1 , "" ,
+    "Default input file name for solver 1" },
   { F|O, "Extension1" , opt_solver_extension1 , "" ,
     "Default file name extension for solver 1" },
   { F|O, "MeshName1" , opt_solver_mesh_name1 , "" ,
@@ -218,6 +222,8 @@ StringXString SolverOptions_String[] = {
     "Help string for solver 2" },
   { F|O, "Executable2" , opt_solver_executable2 , "" , 
     "System command to launch solver 2 (should not contain the `&' character)" },
+  { F|O, "InputName2" , opt_solver_input_name2 , "" ,
+    "Default input file name for solver 2" },
   { F|O, "Extension2" , opt_solver_extension2 , "" ,
     "Default file name extension for solver 2" },
   { F|O, "MeshName2" , opt_solver_mesh_name2 , "" ,
@@ -267,6 +273,8 @@ StringXString SolverOptions_String[] = {
     "Help string for solver 3" },
   { F|O, "Executable3" , opt_solver_executable3 , "" , 
     "System command to launch solver 3 (should not contain the `&' character)" },
+  { F|O, "InputName3" , opt_solver_input_name3 , "" ,
+    "Default input file name for solver 3" },
   { F|O, "Extension3" , opt_solver_extension3 , "" ,
     "Default file name extension for solver 3" },
   { F|O, "MeshName3" , opt_solver_mesh_name3 , "" ,
@@ -316,6 +324,8 @@ StringXString SolverOptions_String[] = {
     "Help string for solver 4" },
   { F|O, "Executable4" , opt_solver_executable4 , "" , 
     "System command to launch solver 4 (should not contain the `&' character)" },
+  { F|O, "InputName4" , opt_solver_input_name4 , "" ,
+    "Default input file name for solver 4" },
   { F|O, "Extension4" , opt_solver_extension4 , "" ,
     "Default file name extension for solver 4" },
   { F|O, "MeshName4" , opt_solver_mesh_name4 , "" ,
diff --git a/Common/Options.cpp b/Common/Options.cpp
index 286a8b9600c4b98b139a43fa08a54d4dbd32d8ba..f00b6973d256765becbb97efe8e2fde6b7e46bed 100644
--- a/Common/Options.cpp
+++ b/Common/Options.cpp
@@ -7,8 +7,9 @@
 #include <stdlib.h>
 #include "GmshConfig.h"
 #include "GmshDefines.h"
-#include "GModel.h"
 #include "GmshMessage.h"
+#include "StringUtils.h"
+#include "GModel.h"
 #include "Generator.h"
 #include "Context.h"
 #include "Options.h"
@@ -16,6 +17,10 @@
 #include "Field.h"
 #include "BackgroundMesh.h"
 
+#if !defined(HAVE_NO_PARSER)
+#include "Parser.h"
+#endif
+
 #if !defined(HAVE_NO_POST)
 #include "PView.h"
 #include "PViewOptions.h"
@@ -1146,6 +1151,50 @@ std::string opt_solver_help4(OPT_ARGS_STR)
   return opt_solver_help(4, action, val);
 }
 
+std::string opt_solver_input_name(OPT_ARGS_STR)
+{
+#if defined(HAVE_FLTK)
+  if(action & GMSH_SET){
+#if !defined(HAVE_NO_PARSER)
+    SINFO[num].input_name = FixRelativePath(gmsh_yyname, val);
+#else
+    SINFO[num].input_name = val;
+#endif
+  }
+  if(FlGui::available() && (action & GMSH_GUI))
+    FlGui::instance()->solver[num]->input[0]->value
+      (SINFO[num].input_name.c_str());
+  return SINFO[num].input_name;
+#else
+  return "undefined";
+#endif
+}
+
+std::string opt_solver_input_name0(OPT_ARGS_STR)
+{
+  return opt_solver_input_name(0, action, val);
+}
+
+std::string opt_solver_input_name1(OPT_ARGS_STR)
+{
+  return opt_solver_input_name(1, action, val);
+}
+
+std::string opt_solver_input_name2(OPT_ARGS_STR)
+{
+  return opt_solver_input_name(2, action, val);
+}
+
+std::string opt_solver_input_name3(OPT_ARGS_STR)
+{
+  return opt_solver_input_name(3, action, val);
+}
+
+std::string opt_solver_input_name4(OPT_ARGS_STR)
+{
+  return opt_solver_input_name(4, action, val);
+}
+
 std::string opt_solver_extension(OPT_ARGS_STR)
 {
 #if defined(HAVE_FLTK)
@@ -1185,8 +1234,16 @@ std::string opt_solver_extension4(OPT_ARGS_STR)
 std::string opt_solver_mesh_name(OPT_ARGS_STR)
 {
 #if defined(HAVE_FLTK)
-  if(action & GMSH_SET)
+  if(action & GMSH_SET){
+#if !defined(HAVE_NO_PARSER)
+    SINFO[num].mesh_name = FixRelativePath(gmsh_yyname, val);
+#else
     SINFO[num].mesh_name = val;
+#endif
+  }
+  if(FlGui::available() && (action & GMSH_GUI))
+    FlGui::instance()->solver[num]->input[1]->value
+      (SINFO[num].mesh_name.c_str());
   return SINFO[num].mesh_name;
 #else
   return "undefined";
@@ -1223,9 +1280,6 @@ std::string opt_solver_mesh_command(OPT_ARGS_STR)
 #if defined(HAVE_FLTK)
   if(action & GMSH_SET)
     SINFO[num].mesh_command = val;
-  if(FlGui::available() && (action & GMSH_GUI))
-    FlGui::instance()->solver[num]->input[1]->value
-      (SINFO[num].mesh_name.c_str());
   return SINFO[num].mesh_command;
 #else
   return "undefined";
diff --git a/Common/Options.h b/Common/Options.h
index 253822d2164ff1ef27887424e215f7ef0e7ca661..5d33eb1d85e6baa4a9fab44846e4a7f1f47e1cf1 100644
--- a/Common/Options.h
+++ b/Common/Options.h
@@ -68,6 +68,12 @@ std::string opt_solver_extension1(OPT_ARGS_STR);
 std::string opt_solver_extension2(OPT_ARGS_STR);
 std::string opt_solver_extension3(OPT_ARGS_STR);
 std::string opt_solver_extension4(OPT_ARGS_STR);
+std::string opt_solver_input_name(OPT_ARGS_STR);
+std::string opt_solver_input_name0(OPT_ARGS_STR);
+std::string opt_solver_input_name1(OPT_ARGS_STR);
+std::string opt_solver_input_name2(OPT_ARGS_STR);
+std::string opt_solver_input_name3(OPT_ARGS_STR);
+std::string opt_solver_input_name4(OPT_ARGS_STR);
 std::string opt_solver_mesh_name(OPT_ARGS_STR);
 std::string opt_solver_mesh_name0(OPT_ARGS_STR);
 std::string opt_solver_mesh_name1(OPT_ARGS_STR);
diff --git a/Common/StringUtils.cpp b/Common/StringUtils.cpp
index 3669bfacb4348084b707cd413f16cfea7206327a..34067658b173d6124aee7ce0c403144bc392daa4 100644
--- a/Common/StringUtils.cpp
+++ b/Common/StringUtils.cpp
@@ -73,6 +73,21 @@ std::string FixWindowsPath(const char *in)
 #endif
 }
 
+std::string FixRelativePath(std::string reference, std::string in)
+{
+  if(in.empty()) return "";
+
+  if(in[0] == '/' || in[0] == '\\' || (in.size() > 2 && in[1] == ':')){
+    // do nothing: 'in' is an absolute path
+    return in;
+  }
+  else{
+    // append 'in' to the path of the parent file
+    std::vector<std::string> split = SplitFileName(reference);
+    return split[0] + in;
+  }
+}
+
 std::vector<std::string> SplitFileName(std::string fileName)
 {
   // returns [path, baseName, extension]
diff --git a/Common/StringUtils.h b/Common/StringUtils.h
index f6cb6990ef974620941bd87995f2fa538b8756b3..ce4111b2ee4e15efb94ea8fae1d2b363b41db23e 100644
--- a/Common/StringUtils.h
+++ b/Common/StringUtils.h
@@ -14,6 +14,7 @@ void SwapBytes(char *array, int size, int n);
 std::string ExtractDoubleQuotedString(const char *str, int len);
 std::string SanitizeTeXString(const char *in, int equation);
 std::string FixWindowsPath(const char *in);
+std::string FixRelativePath(std::string reference, std::string in);
 std::vector<std::string> SplitFileName(std::string fileName);
 std::vector<std::string> SplitWhiteSpace(std::string in, unsigned int len);
 void ReplaceMultiFormat(const char *in, const char *val, char *out);
diff --git a/Fltk/Solvers.h b/Fltk/Solvers.h
index 30dd61b4120c2cf1496a73a74c71cbcc6c00fe7c..62189a6c147b20a4c3fcb34d2bf8b06d0fbefb42 100644
--- a/Fltk/Solvers.h
+++ b/Fltk/Solvers.h
@@ -15,7 +15,7 @@
 class GmshServer;
 
 typedef struct{
-  std::string name, extension, executable_name;
+  std::string name, input_name, extension, executable_name;
   std::string mesh_name, mesh_command;
   std::string socket_command;
   std::string name_command;
diff --git a/Fltk/solverWindow.cpp b/Fltk/solverWindow.cpp
index cff7d3c393f1e734dd5f21b6ab579a4882a022cd..733cebba7e3e0b7b6360309a35ee72ea22f5a993 100644
--- a/Fltk/solverWindow.cpp
+++ b/Fltk/solverWindow.cpp
@@ -24,27 +24,33 @@
 
 void solver_cb(Fl_Widget *w, void *data)
 {
-  static int init = 0, first[MAX_NUM_SOLVERS];
   int num = (int)(long)data;
 
-  if(!init) {
-    for(int i = 0; i < MAX_NUM_SOLVERS; i++)
-      first[i] = 1;
-    init = 1;
+  std::vector<std::string> split = SplitFileName(GModel::current()->getFileName());
+
+  // if the input file field is empty, fill it with a name guessed
+  // from the current model name (only if this file actually exists)
+  if(!strlen(FlGui::instance()->solver[num]->input[0]->value())){
+    std::string inputFile = split[0] + split[1] + SINFO[num].extension;
+    if(!StatFile(inputFile))
+      FlGui::instance()->solver[num]->input[0]->value(inputFile.c_str());
   }
-  if(first[num]) {
-    first[num] = 0;
-    std::vector<std::string> split = SplitFileName(GModel::current()->getFileName());
-    std::string file = split[0] + split[1] + SINFO[num].extension;
-    FlGui::instance()->solver[num]->input[0]->value(file.c_str());
+
+  // if the mesh file field is empty, fill it with a name guessed with
+  // from the current model name
+  if(!strlen(FlGui::instance()->solver[num]->input[1]->value())){
+    std::string meshFile = split[0] + split[1] + ".msh";
+    FlGui::instance()->solver[num]->input[1]->value(meshFile.c_str());
   }
+
   // show the window before calling Solver() to avoid race condition on
   // Windows (if the message window pops up die to an error, the window
   // callbacks get messed up)
   FlGui::instance()->solver[num]->win->show();
 
-  if(SINFO[num].nboptions) {
-    std::string file = FixWindowsPath(FlGui::instance()->solver[num]->input[0]->value());
+  std::string inputFile(FlGui::instance()->solver[num]->input[0]->value());
+  if(SINFO[num].nboptions && inputFile.size()) {
+    std::string file = FixWindowsPath(inputFile.c_str());
     char tmp[256], tmp2[256];
     sprintf(tmp, "\"%s\"", file.c_str());
     sprintf(tmp2, SINFO[num].name_command.c_str(), tmp);
@@ -129,7 +135,7 @@ static void solver_command_cb(Fl_Widget *w, void *data)
       return;
     }
     int val = FlGui::instance()->solver[num]->choice[usedopts]->value();
-    if(val < (int)SINFO[num].option[usedopts].size())
+    if(val >= 0 && val < (int)SINFO[num].option[usedopts].size())
       sprintf(command, SINFO[num].button_command[idx].c_str(), 
               SINFO[num].option[usedopts][val].c_str());
     else{
diff --git a/Parser/Gmsh.tab.cpp b/Parser/Gmsh.tab.cpp
index d13516d9dbebbf268c036a123a6427fb393ccee1..d5d22a9da1a54a6fc451ffadf51d98f3d389d01e 100644
--- a/Parser/Gmsh.tab.cpp
+++ b/Parser/Gmsh.tab.cpp
@@ -344,6 +344,7 @@
 #include "MallocUtils.h"
 #include "ListUtils.h"
 #include "TreeUtils.h"
+#include "StringUtils.h"
 #include "Numeric.h"
 #include "Context.h"
 #include "GModel.h"
@@ -403,7 +404,6 @@ void yymsg(int level, const char *fmt, ...);
 void skip_until(const char *skip, const char *until);
 int PrintListOfDouble(char *format, List_T *list, char *buffer);
 gmshMatrix<double> ListOfListOfDouble2Matrix(List_T *list);
-void FixRelativePath(const char *in, char *out);
 
 
 /* Enabling traces.  */
@@ -1001,42 +1001,42 @@ static const yytype_uint16 yyrline[] =
 {
        0,   146,   146,   147,   152,   154,   158,   159,   160,   161,
      162,   163,   164,   165,   166,   167,   168,   169,   170,   171,
-     172,   176,   180,   187,   192,   207,   220,   249,   263,   274,
-     289,   294,   295,   296,   297,   298,   302,   304,   309,   311,
-     317,   421,   316,   439,   446,   457,   456,   474,   481,   492,
-     491,   508,   525,   548,   547,   561,   562,   563,   564,   565,
-     569,   570,   577,   599,   626,   666,   676,   684,   692,   704,
-     713,   719,   728,   746,   764,   773,   785,   790,   798,   818,
-     841,   848,   854,   874,   895,   921,   933,   950,   954,   965,
-     968,   981,   984,   994,  1018,  1017,  1037,  1059,  1077,  1099,
-    1117,  1147,  1177,  1195,  1213,  1239,  1257,  1256,  1279,  1297,
-    1336,  1342,  1348,  1355,  1380,  1405,  1422,  1421,  1441,  1458,
-    1486,  1503,  1523,  1541,  1559,  1574,  1573,  1599,  1604,  1609,
-    1614,  1619,  1639,  1645,  1656,  1657,  1662,  1665,  1669,  1692,
-    1715,  1738,  1766,  1787,  1808,  1830,  1850,  1946,  1965,  1979,
-    2088,  2097,  2101,  2116,  2143,  2160,  2174,  2180,  2186,  2195,
-    2209,  2253,  2271,  2286,  2305,  2317,  2341,  2345,  2352,  2358,
-    2363,  2369,  2378,  2395,  2412,  2431,  2450,  2478,  2486,  2492,
-    2499,  2503,  2512,  2520,  2528,  2537,  2536,  2549,  2548,  2561,
-    2560,  2573,  2572,  2585,  2592,  2599,  2606,  2613,  2620,  2627,
-    2634,  2641,  2649,  2648,  2660,  2659,  2671,  2670,  2682,  2681,
-    2693,  2692,  2704,  2703,  2715,  2714,  2726,  2725,  2737,  2736,
-    2751,  2754,  2760,  2769,  2789,  2812,  2816,  2840,  2843,  2859,
-    2862,  2875,  2878,  2884,  2887,  2894,  2950,  3020,  3025,  3092,
-    3135,  3161,  3184,  3207,  3210,  3219,  3223,  3239,  3240,  3241,
-    3242,  3243,  3244,  3245,  3246,  3247,  3254,  3255,  3256,  3257,
-    3258,  3259,  3260,  3261,  3262,  3263,  3264,  3265,  3266,  3267,
-    3268,  3269,  3270,  3271,  3272,  3273,  3274,  3275,  3276,  3277,
-    3278,  3279,  3280,  3281,  3282,  3283,  3284,  3285,  3287,  3288,
-    3289,  3290,  3291,  3292,  3293,  3294,  3295,  3296,  3297,  3298,
-    3299,  3300,  3301,  3302,  3303,  3304,  3305,  3306,  3307,  3316,
-    3317,  3318,  3319,  3320,  3321,  3322,  3326,  3339,  3351,  3366,
-    3376,  3386,  3404,  3409,  3414,  3424,  3434,  3442,  3446,  3450,
-    3454,  3458,  3465,  3469,  3473,  3477,  3484,  3489,  3496,  3501,
-    3505,  3510,  3514,  3522,  3533,  3537,  3549,  3557,  3565,  3572,
-    3583,  3603,  3613,  3623,  3633,  3653,  3658,  3662,  3666,  3678,
-    3682,  3694,  3701,  3711,  3715,  3730,  3735,  3742,  3746,  3759,
-    3767,  3778,  3782,  3790,  3798,  3812,  3826,  3830
+     172,   176,   180,   187,   192,   206,   219,   247,   261,   272,
+     287,   292,   293,   294,   295,   296,   300,   302,   307,   309,
+     315,   419,   314,   437,   444,   455,   454,   472,   479,   490,
+     489,   506,   523,   546,   545,   559,   560,   561,   562,   563,
+     567,   568,   575,   597,   624,   664,   674,   682,   690,   702,
+     711,   717,   726,   744,   762,   771,   783,   788,   796,   816,
+     839,   846,   852,   872,   893,   919,   931,   948,   952,   963,
+     966,   979,   982,   992,  1016,  1015,  1035,  1057,  1075,  1097,
+    1115,  1145,  1175,  1193,  1211,  1237,  1255,  1254,  1277,  1295,
+    1334,  1340,  1346,  1353,  1378,  1403,  1420,  1419,  1439,  1456,
+    1484,  1501,  1521,  1539,  1557,  1572,  1571,  1597,  1602,  1607,
+    1612,  1617,  1637,  1643,  1654,  1655,  1660,  1663,  1667,  1690,
+    1713,  1736,  1764,  1785,  1806,  1828,  1848,  1944,  1963,  1977,
+    2086,  2095,  2099,  2114,  2141,  2158,  2172,  2178,  2184,  2193,
+    2207,  2247,  2264,  2279,  2298,  2310,  2334,  2338,  2345,  2351,
+    2356,  2362,  2371,  2388,  2405,  2424,  2443,  2471,  2479,  2485,
+    2492,  2496,  2505,  2513,  2521,  2530,  2529,  2542,  2541,  2554,
+    2553,  2566,  2565,  2578,  2585,  2592,  2599,  2606,  2613,  2620,
+    2627,  2634,  2642,  2641,  2653,  2652,  2664,  2663,  2675,  2674,
+    2686,  2685,  2697,  2696,  2708,  2707,  2719,  2718,  2730,  2729,
+    2744,  2747,  2753,  2762,  2782,  2805,  2809,  2833,  2836,  2852,
+    2855,  2868,  2871,  2877,  2880,  2887,  2943,  3013,  3018,  3085,
+    3128,  3154,  3177,  3200,  3203,  3212,  3216,  3232,  3233,  3234,
+    3235,  3236,  3237,  3238,  3239,  3240,  3247,  3248,  3249,  3250,
+    3251,  3252,  3253,  3254,  3255,  3256,  3257,  3258,  3259,  3260,
+    3261,  3262,  3263,  3264,  3265,  3266,  3267,  3268,  3269,  3270,
+    3271,  3272,  3273,  3274,  3275,  3276,  3277,  3278,  3280,  3281,
+    3282,  3283,  3284,  3285,  3286,  3287,  3288,  3289,  3290,  3291,
+    3292,  3293,  3294,  3295,  3296,  3297,  3298,  3299,  3300,  3309,
+    3310,  3311,  3312,  3313,  3314,  3315,  3319,  3332,  3344,  3359,
+    3369,  3379,  3397,  3402,  3407,  3417,  3427,  3435,  3439,  3443,
+    3447,  3451,  3458,  3462,  3466,  3470,  3477,  3482,  3489,  3494,
+    3498,  3503,  3507,  3515,  3526,  3530,  3542,  3550,  3558,  3565,
+    3576,  3596,  3606,  3616,  3626,  3646,  3651,  3655,  3659,  3671,
+    3675,  3687,  3694,  3704,  3708,  3723,  3728,  3735,  3739,  3752,
+    3760,  3771,  3775,  3783,  3791,  3805,  3819,  3823
 };
 #endif
 
@@ -3960,11 +3960,10 @@ yyreduce:
   case 24:
 #line 193 "Gmsh.y"
     {
-      char tmpstring[1024];
-      FixRelativePath((yyvsp[(6) - (7)].c), tmpstring);
-      FILE *fp = fopen(tmpstring, (yyvsp[(5) - (7)].c));
+      std::string tmp = FixRelativePath(gmsh_yyname, (yyvsp[(6) - (7)].c));
+      FILE *fp = fopen(tmp.c_str(), (yyvsp[(5) - (7)].c));
       if(!fp){
-	yymsg(0, "Unable to open file '%s'", tmpstring);
+	yymsg(0, "Unable to open file '%s'", tmp.c_str());
       }
       else{
 	fprintf(fp, "%s\n", (yyvsp[(3) - (7)].c));
@@ -3976,7 +3975,7 @@ yyreduce:
     break;
 
   case 25:
-#line 208 "Gmsh.y"
+#line 207 "Gmsh.y"
     {
       char tmpstring[1024];
       int i = PrintListOfDouble((yyvsp[(3) - (7)].c), (yyvsp[(5) - (7)].l), tmpstring);
@@ -3992,7 +3991,7 @@ yyreduce:
     break;
 
   case 26:
-#line 221 "Gmsh.y"
+#line 220 "Gmsh.y"
     {
       char tmpstring[1024];
       int i = PrintListOfDouble((yyvsp[(3) - (9)].c), (yyvsp[(5) - (9)].l), tmpstring);
@@ -4001,11 +4000,10 @@ yyreduce:
       else if(i > 0)
 	yymsg(0, "%d extra argument%s in Printf", i, (i > 1) ? "s" : "");
       else{
-	char tmpstring2[1024];
-	FixRelativePath((yyvsp[(8) - (9)].c), tmpstring2);
-	FILE *fp = fopen(tmpstring2, (yyvsp[(7) - (9)].c));
+        std::string tmp = FixRelativePath(gmsh_yyname, (yyvsp[(8) - (9)].c));
+	FILE *fp = fopen(tmp.c_str(), (yyvsp[(7) - (9)].c));
 	if(!fp){
-	  yymsg(0, "Unable to open file '%s'", tmpstring2);
+	  yymsg(0, "Unable to open file '%s'", tmp.c_str());
 	}
 	else{
 	  fprintf(fp, "%s\n", tmpstring);
@@ -4019,7 +4017,7 @@ yyreduce:
     break;
 
   case 27:
-#line 250 "Gmsh.y"
+#line 248 "Gmsh.y"
     { 
 #if !defined(HAVE_NO_POST)
       if(!strcmp((yyvsp[(1) - (6)].c), "View") && ViewData->finalize()){
@@ -4036,7 +4034,7 @@ yyreduce:
     break;
 
   case 28:
-#line 264 "Gmsh.y"
+#line 262 "Gmsh.y"
     {
 #if !defined(HAVE_NO_POST)
       if(!strcmp((yyvsp[(2) - (6)].c), "View")){
@@ -4050,7 +4048,7 @@ yyreduce:
     break;
 
   case 29:
-#line 275 "Gmsh.y"
+#line 273 "Gmsh.y"
     {
 #if !defined(HAVE_NO_POST)
       if(!strcmp((yyvsp[(2) - (6)].c), "View")){
@@ -4064,7 +4062,7 @@ yyreduce:
     break;
 
   case 30:
-#line 289 "Gmsh.y"
+#line 287 "Gmsh.y"
     {
 #if !defined(HAVE_NO_POST)
       ViewData = new PViewDataList(); 
@@ -4073,27 +4071,27 @@ yyreduce:
     break;
 
   case 36:
-#line 303 "Gmsh.y"
+#line 301 "Gmsh.y"
     { ViewCoord.push_back((yyvsp[(1) - (1)].d)); ;}
     break;
 
   case 37:
-#line 305 "Gmsh.y"
+#line 303 "Gmsh.y"
     { ViewCoord.push_back((yyvsp[(3) - (3)].d)); ;}
     break;
 
   case 38:
-#line 310 "Gmsh.y"
+#line 308 "Gmsh.y"
     { if(ViewValueList) ViewValueList->push_back((yyvsp[(1) - (1)].d)); ;}
     break;
 
   case 39:
-#line 312 "Gmsh.y"
+#line 310 "Gmsh.y"
     { if(ViewValueList) ViewValueList->push_back((yyvsp[(3) - (3)].d)); ;}
     break;
 
   case 40:
-#line 317 "Gmsh.y"
+#line 315 "Gmsh.y"
     {
 #if !defined(HAVE_NO_POST)
       if(!strncmp((yyvsp[(1) - (1)].c), "SP", 2)){
@@ -4200,7 +4198,7 @@ yyreduce:
     break;
 
   case 41:
-#line 421 "Gmsh.y"
+#line 419 "Gmsh.y"
     {
 #if !defined(HAVE_NO_POST)
       if(ViewValueList){
@@ -4213,7 +4211,7 @@ yyreduce:
     break;
 
   case 42:
-#line 431 "Gmsh.y"
+#line 429 "Gmsh.y"
     {
 #if !defined(HAVE_NO_POST)
       if(ViewValueList) (*ViewNumList)++;
@@ -4222,7 +4220,7 @@ yyreduce:
     break;
 
   case 43:
-#line 440 "Gmsh.y"
+#line 438 "Gmsh.y"
     { 
 #if !defined(HAVE_NO_POST)
       for(int i = 0; i < (int)strlen((yyvsp[(1) - (1)].c)) + 1; i++) ViewData->T2C.push_back((yyvsp[(1) - (1)].c)[i]);
@@ -4232,7 +4230,7 @@ yyreduce:
     break;
 
   case 44:
-#line 447 "Gmsh.y"
+#line 445 "Gmsh.y"
     { 
 #if !defined(HAVE_NO_POST)
       for(int i = 0; i < (int)strlen((yyvsp[(3) - (3)].c)) + 1; i++) ViewData->T2C.push_back((yyvsp[(3) - (3)].c)[i]);
@@ -4242,7 +4240,7 @@ yyreduce:
     break;
 
   case 45:
-#line 457 "Gmsh.y"
+#line 455 "Gmsh.y"
     { 
 #if !defined(HAVE_NO_POST)
       ViewData->T2D.push_back((yyvsp[(3) - (8)].d)); 
@@ -4254,7 +4252,7 @@ yyreduce:
     break;
 
   case 46:
-#line 466 "Gmsh.y"
+#line 464 "Gmsh.y"
     {
 #if !defined(HAVE_NO_POST)
       ViewData->NbT2++;
@@ -4263,7 +4261,7 @@ yyreduce:
     break;
 
   case 47:
-#line 475 "Gmsh.y"
+#line 473 "Gmsh.y"
     { 
 #if !defined(HAVE_NO_POST)
       for(int i = 0; i < (int)strlen((yyvsp[(1) - (1)].c)) + 1; i++) ViewData->T3C.push_back((yyvsp[(1) - (1)].c)[i]);
@@ -4273,7 +4271,7 @@ yyreduce:
     break;
 
   case 48:
-#line 482 "Gmsh.y"
+#line 480 "Gmsh.y"
     { 
 #if !defined(HAVE_NO_POST)
       for(int i = 0; i < (int)strlen((yyvsp[(3) - (3)].c)) + 1; i++) ViewData->T3C.push_back((yyvsp[(3) - (3)].c)[i]);
@@ -4283,7 +4281,7 @@ yyreduce:
     break;
 
   case 49:
-#line 492 "Gmsh.y"
+#line 490 "Gmsh.y"
     { 
 #if !defined(HAVE_NO_POST)
       ViewData->T3D.push_back((yyvsp[(3) - (10)].d)); ViewData->T3D.push_back((yyvsp[(5) - (10)].d));
@@ -4294,7 +4292,7 @@ yyreduce:
     break;
 
   case 50:
-#line 500 "Gmsh.y"
+#line 498 "Gmsh.y"
     {
 #if !defined(HAVE_NO_POST)
       ViewData->NbT3++;
@@ -4303,7 +4301,7 @@ yyreduce:
     break;
 
   case 51:
-#line 510 "Gmsh.y"
+#line 508 "Gmsh.y"
     {
 #if !defined(HAVE_NO_POST)
       int type = 
@@ -4322,7 +4320,7 @@ yyreduce:
     break;
 
   case 52:
-#line 529 "Gmsh.y"
+#line 527 "Gmsh.y"
     {
 #if !defined(HAVE_NO_POST)
       int type = 
@@ -4341,7 +4339,7 @@ yyreduce:
     break;
 
   case 53:
-#line 548 "Gmsh.y"
+#line 546 "Gmsh.y"
     {
 #if !defined(HAVE_NO_POST)
       ViewValueList = &ViewData->Time;
@@ -4350,48 +4348,48 @@ yyreduce:
     break;
 
   case 54:
-#line 554 "Gmsh.y"
+#line 552 "Gmsh.y"
     {
     ;}
     break;
 
   case 55:
-#line 561 "Gmsh.y"
+#line 559 "Gmsh.y"
     { (yyval.i) = 0; ;}
     break;
 
   case 56:
-#line 562 "Gmsh.y"
+#line 560 "Gmsh.y"
     { (yyval.i) = 1; ;}
     break;
 
   case 57:
-#line 563 "Gmsh.y"
+#line 561 "Gmsh.y"
     { (yyval.i) = 2; ;}
     break;
 
   case 58:
-#line 564 "Gmsh.y"
+#line 562 "Gmsh.y"
     { (yyval.i) = 3; ;}
     break;
 
   case 59:
-#line 565 "Gmsh.y"
+#line 563 "Gmsh.y"
     { (yyval.i) = 4; ;}
     break;
 
   case 60:
-#line 569 "Gmsh.y"
+#line 567 "Gmsh.y"
     { (yyval.i) = 1; ;}
     break;
 
   case 61:
-#line 570 "Gmsh.y"
+#line 568 "Gmsh.y"
     { (yyval.i) = -1; ;}
     break;
 
   case 62:
-#line 578 "Gmsh.y"
+#line 576 "Gmsh.y"
     {
       if(!gmsh_yysymbols.count((yyvsp[(1) - (4)].c))){
 	if(!(yyvsp[(2) - (4)].i))
@@ -4416,7 +4414,7 @@ yyreduce:
     break;
 
   case 63:
-#line 600 "Gmsh.y"
+#line 598 "Gmsh.y"
     {
       int index = (int)(yyvsp[(3) - (7)].d);
       if(!gmsh_yysymbols.count((yyvsp[(1) - (7)].c))){
@@ -4446,7 +4444,7 @@ yyreduce:
     break;
 
   case 64:
-#line 627 "Gmsh.y"
+#line 625 "Gmsh.y"
     {
       if(List_Nbr((yyvsp[(4) - (9)].l)) != List_Nbr((yyvsp[(8) - (9)].l))){
 	yymsg(0, "Incompatible array dimensions in affectation");
@@ -4489,7 +4487,7 @@ yyreduce:
     break;
 
   case 65:
-#line 667 "Gmsh.y"
+#line 665 "Gmsh.y"
     {
       if(gmsh_yysymbols.count((yyvsp[(1) - (6)].c)))
 	gmsh_yysymbols[(yyvsp[(1) - (6)].c)].clear();
@@ -4502,7 +4500,7 @@ yyreduce:
     break;
 
   case 66:
-#line 677 "Gmsh.y"
+#line 675 "Gmsh.y"
     {
       // appends to the list
       for(int i = 0; i < List_Nbr((yyvsp[(5) - (6)].l)); i++)
@@ -4513,7 +4511,7 @@ yyreduce:
     break;
 
   case 67:
-#line 685 "Gmsh.y"
+#line 683 "Gmsh.y"
     {
       if(!gmsh_yysymbols.count((yyvsp[(1) - (3)].c)))
 	yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (3)].c)); 
@@ -4524,7 +4522,7 @@ yyreduce:
     break;
 
   case 68:
-#line 693 "Gmsh.y"
+#line 691 "Gmsh.y"
     {
       if(!gmsh_yysymbols.count((yyvsp[(1) - (6)].c)))
 	yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (6)].c)); 
@@ -4539,7 +4537,7 @@ yyreduce:
     break;
 
   case 69:
-#line 705 "Gmsh.y"
+#line 703 "Gmsh.y"
     { 
       gmsh_yystringsymbols[(yyvsp[(1) - (4)].c)] = std::string((yyvsp[(3) - (4)].c));
       Free((yyvsp[(1) - (4)].c));
@@ -4548,7 +4546,7 @@ yyreduce:
     break;
 
   case 70:
-#line 714 "Gmsh.y"
+#line 712 "Gmsh.y"
     { 
       std::string tmp((yyvsp[(5) - (6)].c));
       StringOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (6)].c), 0, (yyvsp[(3) - (6)].c), tmp);
@@ -4557,7 +4555,7 @@ yyreduce:
     break;
 
   case 71:
-#line 720 "Gmsh.y"
+#line 718 "Gmsh.y"
     { 
       std::string tmp((yyvsp[(8) - (9)].c));
       StringOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (9)].c), (int)(yyvsp[(3) - (9)].d), (yyvsp[(6) - (9)].c), tmp);
@@ -4566,7 +4564,7 @@ yyreduce:
     break;
 
   case 72:
-#line 729 "Gmsh.y"
+#line 727 "Gmsh.y"
     {
       double d = 0.;
       if(NumberOption(GMSH_GET, (yyvsp[(1) - (6)].c), 0, (yyvsp[(3) - (6)].c), d)){
@@ -4587,7 +4585,7 @@ yyreduce:
     break;
 
   case 73:
-#line 747 "Gmsh.y"
+#line 745 "Gmsh.y"
     {
       double d = 0.;
       if(NumberOption(GMSH_GET, (yyvsp[(1) - (9)].c), (int)(yyvsp[(3) - (9)].d), (yyvsp[(6) - (9)].c), d)){
@@ -4608,7 +4606,7 @@ yyreduce:
     break;
 
   case 74:
-#line 765 "Gmsh.y"
+#line 763 "Gmsh.y"
     {
       double d = 0.;
       if(NumberOption(GMSH_GET, (yyvsp[(1) - (5)].c), 0, (yyvsp[(3) - (5)].c), d)){
@@ -4620,7 +4618,7 @@ yyreduce:
     break;
 
   case 75:
-#line 774 "Gmsh.y"
+#line 772 "Gmsh.y"
     {
       double d = 0.;
       if(NumberOption(GMSH_GET, (yyvsp[(1) - (8)].c), (int)(yyvsp[(3) - (8)].d), (yyvsp[(6) - (8)].c), d)){
@@ -4632,7 +4630,7 @@ yyreduce:
     break;
 
   case 76:
-#line 786 "Gmsh.y"
+#line 784 "Gmsh.y"
     {
       ColorOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (8)].c), 0, (yyvsp[(5) - (8)].c), (yyvsp[(7) - (8)].u));
       Free((yyvsp[(1) - (8)].c)); Free((yyvsp[(5) - (8)].c));
@@ -4640,7 +4638,7 @@ yyreduce:
     break;
 
   case 77:
-#line 791 "Gmsh.y"
+#line 789 "Gmsh.y"
     {
       ColorOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (11)].c), (int)(yyvsp[(3) - (11)].d), (yyvsp[(8) - (11)].c), (yyvsp[(10) - (11)].u));
       Free((yyvsp[(1) - (11)].c)); Free((yyvsp[(8) - (11)].c));
@@ -4648,7 +4646,7 @@ yyreduce:
     break;
 
   case 78:
-#line 799 "Gmsh.y"
+#line 797 "Gmsh.y"
     {
       GmshColorTable *ct = GetColorTable(0);
       if(!ct)
@@ -4671,7 +4669,7 @@ yyreduce:
     break;
 
   case 79:
-#line 819 "Gmsh.y"
+#line 817 "Gmsh.y"
     {
       GmshColorTable *ct = GetColorTable((int)(yyvsp[(3) - (9)].d));
       if(!ct)
@@ -4694,7 +4692,7 @@ yyreduce:
     break;
 
   case 80:
-#line 842 "Gmsh.y"
+#line 840 "Gmsh.y"
     {
       if(!strcmp((yyvsp[(1) - (5)].c),"Background"))
 	GModel::current()->getFields()->background_field = (int)(yyvsp[(4) - (5)].d);
@@ -4704,7 +4702,7 @@ yyreduce:
     break;
 
   case 81:
-#line 849 "Gmsh.y"
+#line 847 "Gmsh.y"
     {
       if(!GModel::current()->getFields()->newField((int)(yyvsp[(3) - (7)].d), (yyvsp[(6) - (7)].c)))
 	yymsg(0, "Cannot create field %i of type '%s'", (int)(yyvsp[(3) - (7)].d), (yyvsp[(6) - (7)].c));
@@ -4713,7 +4711,7 @@ yyreduce:
     break;
 
   case 82:
-#line 855 "Gmsh.y"
+#line 853 "Gmsh.y"
     {
       Field *field = GModel::current()->getFields()->get((int)(yyvsp[(3) - (9)].d));
       if(field){
@@ -4736,7 +4734,7 @@ yyreduce:
     break;
 
   case 83:
-#line 875 "Gmsh.y"
+#line 873 "Gmsh.y"
     {
       Field *field = GModel::current()->getFields()->get((int)(yyvsp[(3) - (9)].d));
       if(field){
@@ -4760,7 +4758,7 @@ yyreduce:
     break;
 
   case 84:
-#line 896 "Gmsh.y"
+#line 894 "Gmsh.y"
     {
       Field *field = GModel::current()->getFields()->get((int)(yyvsp[(3) - (11)].d));
       if(field){
@@ -4786,7 +4784,7 @@ yyreduce:
     break;
 
   case 85:
-#line 922 "Gmsh.y"
+#line 920 "Gmsh.y"
     {
 #if !defined(HAVE_NO_POST)
       try {
@@ -4801,7 +4799,7 @@ yyreduce:
     break;
 
   case 86:
-#line 934 "Gmsh.y"
+#line 932 "Gmsh.y"
     {
 #if !defined(HAVE_NO_POST)
       try {
@@ -4816,14 +4814,14 @@ yyreduce:
     break;
 
   case 87:
-#line 951 "Gmsh.y"
+#line 949 "Gmsh.y"
     { 
       (yyval.i) = (int)(yyvsp[(1) - (1)].d); 
     ;}
     break;
 
   case 88:
-#line 955 "Gmsh.y"
+#line 953 "Gmsh.y"
     { 
       (yyval.i) = GModel::current()->setPhysicalName
         (std::string((yyvsp[(1) - (1)].c)), curPhysDim, 
@@ -4833,14 +4831,14 @@ yyreduce:
     break;
 
   case 89:
-#line 965 "Gmsh.y"
+#line 963 "Gmsh.y"
     {
       (yyval.l) = 0;
     ;}
     break;
 
   case 90:
-#line 969 "Gmsh.y"
+#line 967 "Gmsh.y"
     {
       (yyval.l) = List_Create(1, 1, sizeof(Vertex*));
       Vertex *v = FindPoint((int)(yyvsp[(4) - (5)].d));
@@ -4853,21 +4851,21 @@ yyreduce:
     break;
 
   case 91:
-#line 981 "Gmsh.y"
+#line 979 "Gmsh.y"
     {
       for(int i = 0; i < 4; i++) (yyval.v)[i] = 0.;
     ;}
     break;
 
   case 92:
-#line 985 "Gmsh.y"
+#line 983 "Gmsh.y"
     {
       for(int i = 0; i < 4; i++) (yyval.v)[i] = (yyvsp[(2) - (2)].v)[i];
     ;}
     break;
 
   case 93:
-#line 995 "Gmsh.y"
+#line 993 "Gmsh.y"
     {
       int num = (int)(yyvsp[(3) - (7)].d);
       if(FindPoint(num)){
@@ -4893,14 +4891,14 @@ yyreduce:
     break;
 
   case 94:
-#line 1018 "Gmsh.y"
+#line 1016 "Gmsh.y"
     {
       curPhysDim = 0;
     ;}
     break;
 
   case 95:
-#line 1022 "Gmsh.y"
+#line 1020 "Gmsh.y"
     {
       int num = (int)(yyvsp[(5) - (9)].i);
       if(FindPhysicalGroup(num, MSH_PHYSICAL_POINT)){
@@ -4919,7 +4917,7 @@ yyreduce:
     break;
 
   case 96:
-#line 1038 "Gmsh.y"
+#line 1036 "Gmsh.y"
     {      
       for(int i = 0; i < List_Nbr((yyvsp[(3) - (6)].l)); i++){
 	double d;
@@ -4941,7 +4939,7 @@ yyreduce:
     break;
 
   case 97:
-#line 1060 "Gmsh.y"
+#line 1058 "Gmsh.y"
     {
       int num = (int)(yyvsp[(3) - (7)].d);
       if(FindCurve(num)){
@@ -4962,7 +4960,7 @@ yyreduce:
     break;
 
   case 98:
-#line 1078 "Gmsh.y"
+#line 1076 "Gmsh.y"
     {
       for (int i = 0; i < List_Nbr((yyvsp[(3) - (4)].l)); i++){
 	double dnum;
@@ -4986,7 +4984,7 @@ yyreduce:
     break;
 
   case 99:
-#line 1100 "Gmsh.y"
+#line 1098 "Gmsh.y"
     {
       int num = (int)(yyvsp[(3) - (7)].d);
       if(FindCurve(num)){
@@ -5007,7 +5005,7 @@ yyreduce:
     break;
 
   case 100:
-#line 1118 "Gmsh.y"
+#line 1116 "Gmsh.y"
     {
       int num = (int)(yyvsp[(3) - (8)].d);
       if(FindCurve(num)){
@@ -5040,7 +5038,7 @@ yyreduce:
     break;
 
   case 101:
-#line 1148 "Gmsh.y"
+#line 1146 "Gmsh.y"
     {
       int num = (int)(yyvsp[(3) - (8)].d);
       if(FindCurve(num)){
@@ -5073,7 +5071,7 @@ yyreduce:
     break;
 
   case 102:
-#line 1178 "Gmsh.y"
+#line 1176 "Gmsh.y"
     {
       int num = (int)(yyvsp[(3) - (7)].d);
       if(FindCurve(num)){
@@ -5094,7 +5092,7 @@ yyreduce:
     break;
 
   case 103:
-#line 1196 "Gmsh.y"
+#line 1194 "Gmsh.y"
     {
       int num = (int)(yyvsp[(3) - (7)].d);
       if(FindCurve(num)){
@@ -5115,7 +5113,7 @@ yyreduce:
     break;
 
   case 104:
-#line 1214 "Gmsh.y"
+#line 1212 "Gmsh.y"
     {
       int num = (int)(yyvsp[(3) - (11)].d);
       if(List_Nbr((yyvsp[(6) - (11)].l)) + (int)(yyvsp[(10) - (11)].d) + 1 != List_Nbr((yyvsp[(8) - (11)].l))){
@@ -5144,7 +5142,7 @@ yyreduce:
     break;
 
   case 105:
-#line 1240 "Gmsh.y"
+#line 1238 "Gmsh.y"
     {
       int num = (int)(yyvsp[(4) - (8)].d);
       if(FindEdgeLoop(num)){
@@ -5164,14 +5162,14 @@ yyreduce:
     break;
 
   case 106:
-#line 1257 "Gmsh.y"
+#line 1255 "Gmsh.y"
     {
       curPhysDim = 1;
     ;}
     break;
 
   case 107:
-#line 1261 "Gmsh.y"
+#line 1259 "Gmsh.y"
     {
       int num = (int)(yyvsp[(5) - (9)].i);
       if(FindPhysicalGroup(num, MSH_PHYSICAL_LINE)){
@@ -5190,7 +5188,7 @@ yyreduce:
     break;
 
   case 108:
-#line 1280 "Gmsh.y"
+#line 1278 "Gmsh.y"
     {
       int num = (int)(yyvsp[(4) - (8)].d);
       if(FindSurface(num)){
@@ -5211,7 +5209,7 @@ yyreduce:
     break;
 
   case 109:
-#line 1298 "Gmsh.y"
+#line 1296 "Gmsh.y"
     {
       int num = (int)(yyvsp[(4) - (9)].d), type = 0;
       if(FindSurface(num)){
@@ -5253,7 +5251,7 @@ yyreduce:
     break;
 
   case 110:
-#line 1337 "Gmsh.y"
+#line 1335 "Gmsh.y"
     {
       myGmshSurface = 0;
       (yyval.s).Type = 0;
@@ -5262,7 +5260,7 @@ yyreduce:
     break;
 
   case 111:
-#line 1343 "Gmsh.y"
+#line 1341 "Gmsh.y"
     {
       myGmshSurface = gmshSurface::getSurface((int)(yyvsp[(3) - (4)].d));
       (yyval.s).Type = 0;
@@ -5271,7 +5269,7 @@ yyreduce:
     break;
 
   case 112:
-#line 1349 "Gmsh.y"
+#line 1347 "Gmsh.y"
     {
       int num = (int)(yyvsp[(4) - (10)].d);
       myGmshSurface = gmshParametricSurface::NewParametricSurface(num, (yyvsp[(7) - (10)].c), (yyvsp[(8) - (10)].c), (yyvsp[(9) - (10)].c));
@@ -5281,7 +5279,7 @@ yyreduce:
     break;
 
   case 113:
-#line 1356 "Gmsh.y"
+#line 1354 "Gmsh.y"
     {
       int num = (int)(yyvsp[(3) - (7)].d);
       if (List_Nbr((yyvsp[(6) - (7)].l)) != 2){
@@ -5309,7 +5307,7 @@ yyreduce:
     break;
 
   case 114:
-#line 1381 "Gmsh.y"
+#line 1379 "Gmsh.y"
     {
       int num = (int)(yyvsp[(3) - (7)].d);
       if (List_Nbr((yyvsp[(6) - (7)].l)) != 2){
@@ -5337,7 +5335,7 @@ yyreduce:
     break;
 
   case 115:
-#line 1406 "Gmsh.y"
+#line 1404 "Gmsh.y"
     {
       int num = (int)(yyvsp[(4) - (8)].d);
       if(FindSurfaceLoop(num)){
@@ -5356,14 +5354,14 @@ yyreduce:
     break;
 
   case 116:
-#line 1422 "Gmsh.y"
+#line 1420 "Gmsh.y"
     {
       curPhysDim = 2;
     ;}
     break;
 
   case 117:
-#line 1426 "Gmsh.y"
+#line 1424 "Gmsh.y"
     {
       int num = (int)(yyvsp[(5) - (9)].i);
       if(FindPhysicalGroup(num, MSH_PHYSICAL_SURFACE)){
@@ -5382,7 +5380,7 @@ yyreduce:
     break;
 
   case 118:
-#line 1442 "Gmsh.y"
+#line 1440 "Gmsh.y"
     {
       int num = (int)(yyvsp[(4) - (8)].d);
       if(FindPhysicalGroup(num, MSH_PHYSICAL_VOLUME)){
@@ -5402,7 +5400,7 @@ yyreduce:
     break;
 
   case 119:
-#line 1460 "Gmsh.y"
+#line 1458 "Gmsh.y"
     {
       int num = (int)(yyvsp[(4) - (12)].d);
       if(FindPhysicalGroup(num, MSH_PHYSICAL_SURFACE)){
@@ -5432,7 +5430,7 @@ yyreduce:
     break;
 
   case 120:
-#line 1487 "Gmsh.y"
+#line 1485 "Gmsh.y"
     {
       int num = (int)(yyvsp[(4) - (8)].d);
       if(FindPhysicalGroup(num, MSH_PHYSICAL_SURFACE)){
@@ -5452,7 +5450,7 @@ yyreduce:
     break;
 
   case 121:
-#line 1504 "Gmsh.y"
+#line 1502 "Gmsh.y"
     {
       int num = (int)(yyvsp[(4) - (8)].d);
       if(FindPhysicalGroup(num, MSH_PHYSICAL_LINE)){
@@ -5472,7 +5470,7 @@ yyreduce:
     break;
 
   case 122:
-#line 1524 "Gmsh.y"
+#line 1522 "Gmsh.y"
     {
       yymsg(0, "'Complex Volume' command is deprecated: use 'Volume' instead");
       int num = (int)(yyvsp[(4) - (8)].d);
@@ -5493,7 +5491,7 @@ yyreduce:
     break;
 
   case 123:
-#line 1542 "Gmsh.y"
+#line 1540 "Gmsh.y"
     {
       int num = (int)(yyvsp[(3) - (7)].d);
       if(FindVolume(num)){
@@ -5513,7 +5511,7 @@ yyreduce:
     break;
 
   case 124:
-#line 1560 "Gmsh.y"
+#line 1558 "Gmsh.y"
     {
 #if defined(HAVE_OCC)
       std::vector<double> data;
@@ -5529,14 +5527,14 @@ yyreduce:
     break;
 
   case 125:
-#line 1574 "Gmsh.y"
+#line 1572 "Gmsh.y"
     {
       curPhysDim = 3;
     ;}
     break;
 
   case 126:
-#line 1578 "Gmsh.y"
+#line 1576 "Gmsh.y"
     {
       int num = (int)(yyvsp[(5) - (9)].i);
       if(FindPhysicalGroup(num, MSH_PHYSICAL_VOLUME)){
@@ -5555,7 +5553,7 @@ yyreduce:
     break;
 
   case 127:
-#line 1600 "Gmsh.y"
+#line 1598 "Gmsh.y"
     {
       TranslateShapes((yyvsp[(2) - (5)].v)[0], (yyvsp[(2) - (5)].v)[1], (yyvsp[(2) - (5)].v)[2], (yyvsp[(4) - (5)].l));
       (yyval.l) = (yyvsp[(4) - (5)].l);
@@ -5563,7 +5561,7 @@ yyreduce:
     break;
 
   case 128:
-#line 1605 "Gmsh.y"
+#line 1603 "Gmsh.y"
     {
       RotateShapes((yyvsp[(3) - (11)].v)[0], (yyvsp[(3) - (11)].v)[1], (yyvsp[(3) - (11)].v)[2], (yyvsp[(5) - (11)].v)[0], (yyvsp[(5) - (11)].v)[1], (yyvsp[(5) - (11)].v)[2], (yyvsp[(7) - (11)].d), (yyvsp[(10) - (11)].l));
       (yyval.l) = (yyvsp[(10) - (11)].l);
@@ -5571,7 +5569,7 @@ yyreduce:
     break;
 
   case 129:
-#line 1610 "Gmsh.y"
+#line 1608 "Gmsh.y"
     {
       SymmetryShapes((yyvsp[(2) - (5)].v)[0], (yyvsp[(2) - (5)].v)[1], (yyvsp[(2) - (5)].v)[2], (yyvsp[(2) - (5)].v)[3], (yyvsp[(4) - (5)].l));
       (yyval.l) = (yyvsp[(4) - (5)].l);
@@ -5579,7 +5577,7 @@ yyreduce:
     break;
 
   case 130:
-#line 1615 "Gmsh.y"
+#line 1613 "Gmsh.y"
     {
       DilatShapes((yyvsp[(3) - (9)].v)[0], (yyvsp[(3) - (9)].v)[1], (yyvsp[(3) - (9)].v)[2], (yyvsp[(5) - (9)].d), (yyvsp[(8) - (9)].l));
       (yyval.l) = (yyvsp[(8) - (9)].l);
@@ -5587,7 +5585,7 @@ yyreduce:
     break;
 
   case 131:
-#line 1620 "Gmsh.y"
+#line 1618 "Gmsh.y"
     {
       (yyval.l) = List_Create(3, 3, sizeof(Shape));
       if(!strcmp((yyvsp[(1) - (4)].c), "Duplicata")){
@@ -5610,7 +5608,7 @@ yyreduce:
     break;
 
   case 132:
-#line 1640 "Gmsh.y"
+#line 1638 "Gmsh.y"
     { 
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       IntersectCurvesWithSurface((yyvsp[(4) - (9)].l), (int)(yyvsp[(8) - (9)].d), (yyval.l));
@@ -5619,7 +5617,7 @@ yyreduce:
     break;
 
   case 133:
-#line 1646 "Gmsh.y"
+#line 1644 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape*));
       List_T *tmp = ListOfDouble2ListOfInt((yyvsp[(7) - (9)].l));
@@ -5630,31 +5628,31 @@ yyreduce:
     break;
 
   case 134:
-#line 1656 "Gmsh.y"
+#line 1654 "Gmsh.y"
     { (yyval.l) = (yyvsp[(1) - (1)].l); ;}
     break;
 
   case 135:
-#line 1657 "Gmsh.y"
+#line 1655 "Gmsh.y"
     { (yyval.l) = (yyvsp[(1) - (1)].l); ;}
     break;
 
   case 136:
-#line 1662 "Gmsh.y"
+#line 1660 "Gmsh.y"
     {
       (yyval.l) = List_Create(3, 3, sizeof(Shape));
     ;}
     break;
 
   case 137:
-#line 1666 "Gmsh.y"
+#line 1664 "Gmsh.y"
     {
       List_Add((yyval.l), &(yyvsp[(2) - (2)].s));
     ;}
     break;
 
   case 138:
-#line 1670 "Gmsh.y"
+#line 1668 "Gmsh.y"
     {
       for(int i = 0; i < List_Nbr((yyvsp[(4) - (6)].l)); i++){
 	double d;
@@ -5680,7 +5678,7 @@ yyreduce:
     break;
 
   case 139:
-#line 1693 "Gmsh.y"
+#line 1691 "Gmsh.y"
     {
       for(int i = 0; i < List_Nbr((yyvsp[(4) - (6)].l)); i++){
 	double d;
@@ -5706,7 +5704,7 @@ yyreduce:
     break;
 
   case 140:
-#line 1716 "Gmsh.y"
+#line 1714 "Gmsh.y"
     {
       for(int i = 0; i < List_Nbr((yyvsp[(4) - (6)].l)); i++){
 	double d;
@@ -5732,7 +5730,7 @@ yyreduce:
     break;
 
   case 141:
-#line 1739 "Gmsh.y"
+#line 1737 "Gmsh.y"
     {
       for(int i = 0; i < List_Nbr((yyvsp[(4) - (6)].l)); i++){
 	double d;
@@ -5758,7 +5756,7 @@ yyreduce:
     break;
 
   case 142:
-#line 1767 "Gmsh.y"
+#line 1765 "Gmsh.y"
     {
 #if defined(HAVE_DINTEGRATION)
       if(List_Nbr((yyvsp[(7) - (8)].l)) == 4){
@@ -5782,7 +5780,7 @@ yyreduce:
     break;
 
   case 143:
-#line 1789 "Gmsh.y"
+#line 1787 "Gmsh.y"
     {
 #if defined(HAVE_DINTEGRATION)
       if(List_Nbr((yyvsp[(12) - (14)].l)) == 0){
@@ -5805,7 +5803,7 @@ yyreduce:
     break;
 
   case 144:
-#line 1810 "Gmsh.y"
+#line 1808 "Gmsh.y"
     {
 #if defined(HAVE_DINTEGRATION)
       if(List_Nbr((yyvsp[(14) - (16)].l)) == 0){
@@ -5829,7 +5827,7 @@ yyreduce:
     break;
 
   case 145:
-#line 1831 "Gmsh.y"
+#line 1829 "Gmsh.y"
     {
 #if defined(HAVE_DINTEGRATION)
       if(List_Nbr((yyvsp[(10) - (12)].l)) == 1){
@@ -5852,7 +5850,7 @@ yyreduce:
     break;
 
   case 146:
-#line 1851 "Gmsh.y"
+#line 1849 "Gmsh.y"
     {
 #if defined(HAVE_DINTEGRATION)
       if(!strcmp((yyvsp[(2) - (8)].c), "Union")){
@@ -5951,7 +5949,7 @@ yyreduce:
     break;
 
   case 147:
-#line 1947 "Gmsh.y"
+#line 1945 "Gmsh.y"
     {
 #if defined(HAVE_DINTEGRATION)
       if(!strcmp((yyvsp[(2) - (8)].c), "MathEval")){
@@ -5973,7 +5971,7 @@ yyreduce:
     break;
 
   case 148:
-#line 1966 "Gmsh.y"
+#line 1964 "Gmsh.y"
     {
 #if defined(HAVE_DINTEGRATION)
       if(!strcmp((yyvsp[(2) - (6)].c), "CutMesh")){
@@ -5990,7 +5988,7 @@ yyreduce:
     break;
 
   case 149:
-#line 1981 "Gmsh.y"
+#line 1979 "Gmsh.y"
     {
 #if defined(HAVE_DINTEGRATION)
       if(!strcmp((yyvsp[(2) - (14)].c), "Cylinder") && List_Nbr((yyvsp[(12) - (14)].l)) == 1){
@@ -6096,7 +6094,7 @@ yyreduce:
     break;
 
   case 150:
-#line 2089 "Gmsh.y"
+#line 2087 "Gmsh.y"
     {
       for(int i = 0; i < List_Nbr((yyvsp[(3) - (4)].l)); i++){
 	Shape TheShape;
@@ -6108,14 +6106,14 @@ yyreduce:
     break;
 
   case 151:
-#line 2098 "Gmsh.y"
+#line 2096 "Gmsh.y"
     {
       GModel::current()->getFields()->deleteField((int)(yyvsp[(4) - (6)].d));
     ;}
     break;
 
   case 152:
-#line 2102 "Gmsh.y"
+#line 2100 "Gmsh.y"
     {
 #if !defined(HAVE_NO_POST)
       if(!strcmp((yyvsp[(2) - (6)].c), "View")){
@@ -6133,7 +6131,7 @@ yyreduce:
     break;
 
   case 153:
-#line 2117 "Gmsh.y"
+#line 2115 "Gmsh.y"
     {
       if(!strcmp((yyvsp[(2) - (3)].c), "Meshes") || !strcmp((yyvsp[(2) - (3)].c), "All")){
         for(unsigned int i = 0; i < GModel::list.size(); i++){
@@ -6163,7 +6161,7 @@ yyreduce:
     break;
 
   case 154:
-#line 2144 "Gmsh.y"
+#line 2142 "Gmsh.y"
     {
 #if !defined(HAVE_NO_POST)
       if(!strcmp((yyvsp[(2) - (4)].c), "Empty") && !strcmp((yyvsp[(3) - (4)].c), "Views")){
@@ -6178,7 +6176,7 @@ yyreduce:
     break;
 
   case 155:
-#line 2161 "Gmsh.y"
+#line 2159 "Gmsh.y"
     {
       for(int i = 0; i < List_Nbr((yyvsp[(4) - (5)].l)); i++){
 	Shape TheShape;
@@ -6190,7 +6188,7 @@ yyreduce:
     break;
 
   case 156:
-#line 2175 "Gmsh.y"
+#line 2173 "Gmsh.y"
     {
       for(int i = 0; i < 4; i++)
 	VisibilityShape((yyvsp[(2) - (3)].c), i, 1);
@@ -6199,7 +6197,7 @@ yyreduce:
     break;
 
   case 157:
-#line 2181 "Gmsh.y"
+#line 2179 "Gmsh.y"
     {
       for(int i = 0; i < 4; i++)
 	VisibilityShape((yyvsp[(2) - (3)].c), i, 0);
@@ -6208,7 +6206,7 @@ yyreduce:
     break;
 
   case 158:
-#line 2187 "Gmsh.y"
+#line 2185 "Gmsh.y"
     {
       for(int i = 0; i < List_Nbr((yyvsp[(3) - (4)].l)); i++){
 	Shape TheShape;
@@ -6220,7 +6218,7 @@ yyreduce:
     break;
 
   case 159:
-#line 2196 "Gmsh.y"
+#line 2194 "Gmsh.y"
     {
       for(int i = 0; i < List_Nbr((yyvsp[(3) - (4)].l)); i++){
 	Shape TheShape;
@@ -6232,11 +6230,10 @@ yyreduce:
     break;
 
   case 160:
-#line 2210 "Gmsh.y"
+#line 2208 "Gmsh.y"
     {
       if(!strcmp((yyvsp[(1) - (3)].c), "Include")){
-	char tmpstring[1024];
-	FixRelativePath((yyvsp[(2) - (3)].c), tmpstring);
+        std::string tmp = FixRelativePath(gmsh_yyname, (yyvsp[(2) - (3)].c));
 	// Warning: we *don't* close included files (to allow user
 	// functions in these files). If you need to include many many
 	// files and don't have functions in the files, use "Merge"
@@ -6244,31 +6241,28 @@ yyreduce:
 	// open simultaneously. The right solution would be of course
 	// to modify FunctionManager to reopen the files instead of
 	// using the FILE pointer, but hey, I'm lazy...
-	Msg::StatusBar(2, true, "Reading '%s'", tmpstring);
-	ParseFile(tmpstring, false, true);
+	Msg::StatusBar(2, true, "Reading '%s'", tmp.c_str());
+	ParseFile(tmp, false, true);
 	SetBoundingBox();
-	Msg::StatusBar(2, true, "Read '%s'", tmpstring);
+	Msg::StatusBar(2, true, "Read '%s'", tmp.c_str());
       }
       else if(!strcmp((yyvsp[(1) - (3)].c), "Print")){
 	// make sure we have the latest data from GEO_Internals in GModel
 	// (fixes bug where we would have no geometry in the picture if
 	// the print command is in the same file as the geometry)
 	GModel::current()->importGEOInternals();
-	char tmpstring[1024];
-	FixRelativePath((yyvsp[(2) - (3)].c), tmpstring);
-	CreateOutputFile(tmpstring, CTX::instance()->print.format);
+        std::string tmp = FixRelativePath(gmsh_yyname, (yyvsp[(2) - (3)].c));
+	CreateOutputFile(tmp, CTX::instance()->print.format);
       }
       else if(!strcmp((yyvsp[(1) - (3)].c), "Save")){
 	GModel::current()->importGEOInternals();
-	char tmpstring[1024];
-	FixRelativePath((yyvsp[(2) - (3)].c), tmpstring);
-	CreateOutputFile(tmpstring, CTX::instance()->mesh.format);
+        std::string tmp = FixRelativePath(gmsh_yyname, (yyvsp[(2) - (3)].c));
+	CreateOutputFile(tmp, CTX::instance()->mesh.format);
       }
       else if(!strcmp((yyvsp[(1) - (3)].c), "Merge") || !strcmp((yyvsp[(1) - (3)].c), "MergeWithBoundingBox")){
 	// MergeWithBoundingBox is deprecated
-	char tmpstring[1024];
-	FixRelativePath((yyvsp[(2) - (3)].c), tmpstring);
-	MergeFile(tmpstring, true);
+        std::string tmp = FixRelativePath(gmsh_yyname, (yyvsp[(2) - (3)].c));
+	MergeFile(tmp, true);
       }
       else if(!strcmp((yyvsp[(1) - (3)].c), "System"))
 	SystemCall((yyvsp[(2) - (3)].c));
@@ -6279,15 +6273,14 @@ yyreduce:
     break;
 
   case 161:
-#line 2254 "Gmsh.y"
+#line 2248 "Gmsh.y"
     {
 #if !defined(HAVE_NO_POST)
       if(!strcmp((yyvsp[(1) - (7)].c), "Save") && !strcmp((yyvsp[(2) - (7)].c), "View")){
 	int index = (int)(yyvsp[(4) - (7)].d);
 	if(index >= 0 && index < (int)PView::list.size()){
-	  char tmpstring[1024];
-	  FixRelativePath((yyvsp[(6) - (7)].c), tmpstring);
-	  PView::list[index]->write(tmpstring, CTX::instance()->post.fileFormat);
+          std::string tmp = FixRelativePath(gmsh_yyname, (yyvsp[(6) - (7)].c));
+	  PView::list[index]->write(tmp, CTX::instance()->post.fileFormat);
 	}
 	else
 	  yymsg(0, "Unknown view %d", index);
@@ -6300,7 +6293,7 @@ yyreduce:
     break;
 
   case 162:
-#line 2272 "Gmsh.y"
+#line 2265 "Gmsh.y"
     {
 #if !defined(HAVE_NO_POST)
       if(!strcmp((yyvsp[(1) - (7)].c), "Background") && !strcmp((yyvsp[(2) - (7)].c), "Mesh")  && !strcmp((yyvsp[(3) - (7)].c), "View")){
@@ -6318,7 +6311,7 @@ yyreduce:
     break;
 
   case 163:
-#line 2287 "Gmsh.y"
+#line 2280 "Gmsh.y"
     {
       if(!strcmp((yyvsp[(1) - (3)].c), "Sleep")){
 	SleepInSeconds((yyvsp[(2) - (3)].d));
@@ -6340,7 +6333,7 @@ yyreduce:
     break;
 
   case 164:
-#line 2306 "Gmsh.y"
+#line 2299 "Gmsh.y"
     {
 #if !defined(HAVE_NO_POST)
        try {
@@ -6355,7 +6348,7 @@ yyreduce:
     break;
 
   case 165:
-#line 2318 "Gmsh.y"
+#line 2311 "Gmsh.y"
     {
 #if !defined(HAVE_NO_POST)
       if(!strcmp((yyvsp[(2) - (3)].c), "ElementsFromAllViews"))
@@ -6382,14 +6375,14 @@ yyreduce:
     break;
 
   case 166:
-#line 2342 "Gmsh.y"
+#line 2335 "Gmsh.y"
     {
       exit(0);
     ;}
     break;
 
   case 167:
-#line 2346 "Gmsh.y"
+#line 2339 "Gmsh.y"
     {
       // FIXME: this is a hack to force a transfer from the old DB to
       // the new DB. This will become unnecessary if/when we fill the 
@@ -6399,7 +6392,7 @@ yyreduce:
     break;
 
   case 168:
-#line 2353 "Gmsh.y"
+#line 2346 "Gmsh.y"
     {
       CTX::instance()->forcedBBox = 0;
       GModel::current()->importGEOInternals();
@@ -6408,7 +6401,7 @@ yyreduce:
     break;
 
   case 169:
-#line 2359 "Gmsh.y"
+#line 2352 "Gmsh.y"
     {
       CTX::instance()->forcedBBox = 1;
       SetBoundingBox((yyvsp[(3) - (15)].d), (yyvsp[(5) - (15)].d), (yyvsp[(7) - (15)].d), (yyvsp[(9) - (15)].d), (yyvsp[(11) - (15)].d), (yyvsp[(13) - (15)].d));
@@ -6416,7 +6409,7 @@ yyreduce:
     break;
 
   case 170:
-#line 2364 "Gmsh.y"
+#line 2357 "Gmsh.y"
     {
 #if defined(HAVE_OPENGL)
       drawContext::global()->draw();
@@ -6425,14 +6418,14 @@ yyreduce:
     break;
 
   case 171:
-#line 2370 "Gmsh.y"
+#line 2363 "Gmsh.y"
     {
        GModel::current()->createTopologyFromMesh();
     ;}
     break;
 
   case 172:
-#line 2379 "Gmsh.y"
+#line 2372 "Gmsh.y"
     {
       LoopControlVariablesTab[ImbricatedLoop][0] = (yyvsp[(3) - (6)].d);
       LoopControlVariablesTab[ImbricatedLoop][1] = (yyvsp[(5) - (6)].d);
@@ -6452,7 +6445,7 @@ yyreduce:
     break;
 
   case 173:
-#line 2396 "Gmsh.y"
+#line 2389 "Gmsh.y"
     {
       LoopControlVariablesTab[ImbricatedLoop][0] = (yyvsp[(3) - (8)].d);
       LoopControlVariablesTab[ImbricatedLoop][1] = (yyvsp[(5) - (8)].d);
@@ -6472,7 +6465,7 @@ yyreduce:
     break;
 
   case 174:
-#line 2413 "Gmsh.y"
+#line 2406 "Gmsh.y"
     {
       LoopControlVariablesTab[ImbricatedLoop][0] = (yyvsp[(5) - (8)].d);
       LoopControlVariablesTab[ImbricatedLoop][1] = (yyvsp[(7) - (8)].d);
@@ -6494,7 +6487,7 @@ yyreduce:
     break;
 
   case 175:
-#line 2432 "Gmsh.y"
+#line 2425 "Gmsh.y"
     {
       LoopControlVariablesTab[ImbricatedLoop][0] = (yyvsp[(5) - (10)].d);
       LoopControlVariablesTab[ImbricatedLoop][1] = (yyvsp[(7) - (10)].d);
@@ -6516,7 +6509,7 @@ yyreduce:
     break;
 
   case 176:
-#line 2451 "Gmsh.y"
+#line 2444 "Gmsh.y"
     {
       if(ImbricatedLoop <= 0){
 	yymsg(0, "Invalid For/EndFor loop");
@@ -6547,7 +6540,7 @@ yyreduce:
     break;
 
   case 177:
-#line 2479 "Gmsh.y"
+#line 2472 "Gmsh.y"
     {
       if(!FunctionManager::Instance()->createFunction
          ((yyvsp[(2) - (2)].c), gmsh_yyin, gmsh_yyname, gmsh_yylineno))
@@ -6558,7 +6551,7 @@ yyreduce:
     break;
 
   case 178:
-#line 2487 "Gmsh.y"
+#line 2480 "Gmsh.y"
     {
       if(!FunctionManager::Instance()->leaveFunction
          (&gmsh_yyin, gmsh_yyname, gmsh_yylineno))
@@ -6567,7 +6560,7 @@ yyreduce:
     break;
 
   case 179:
-#line 2493 "Gmsh.y"
+#line 2486 "Gmsh.y"
     {
       if(!FunctionManager::Instance()->enterFunction
          ((yyvsp[(2) - (3)].c), &gmsh_yyin, gmsh_yyname, gmsh_yylineno))
@@ -6577,20 +6570,20 @@ yyreduce:
     break;
 
   case 180:
-#line 2500 "Gmsh.y"
+#line 2493 "Gmsh.y"
     {
       if(!(yyvsp[(3) - (4)].d)) skip_until("If", "EndIf");
     ;}
     break;
 
   case 181:
-#line 2504 "Gmsh.y"
+#line 2497 "Gmsh.y"
     {
     ;}
     break;
 
   case 182:
-#line 2513 "Gmsh.y"
+#line 2506 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShapes(TRANSLATE, (yyvsp[(4) - (5)].l), 
@@ -6601,7 +6594,7 @@ yyreduce:
     break;
 
   case 183:
-#line 2521 "Gmsh.y"
+#line 2514 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShapes(ROTATE, (yyvsp[(10) - (11)].l), 
@@ -6612,7 +6605,7 @@ yyreduce:
     break;
 
   case 184:
-#line 2529 "Gmsh.y"
+#line 2522 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShapes(TRANSLATE_ROTATE, (yyvsp[(12) - (13)].l), 
@@ -6623,14 +6616,14 @@ yyreduce:
     break;
 
   case 185:
-#line 2537 "Gmsh.y"
+#line 2530 "Gmsh.y"
     {
       extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false;
     ;}
     break;
 
   case 186:
-#line 2541 "Gmsh.y"
+#line 2534 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShapes(TRANSLATE, (yyvsp[(4) - (7)].l), 
@@ -6641,14 +6634,14 @@ yyreduce:
     break;
 
   case 187:
-#line 2549 "Gmsh.y"
+#line 2542 "Gmsh.y"
     {
       extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false;
     ;}
     break;
 
   case 188:
-#line 2553 "Gmsh.y"
+#line 2546 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShapes(ROTATE, (yyvsp[(10) - (13)].l), 
@@ -6659,14 +6652,14 @@ yyreduce:
     break;
 
   case 189:
-#line 2561 "Gmsh.y"
+#line 2554 "Gmsh.y"
     {
       extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false;
     ;}
     break;
 
   case 190:
-#line 2565 "Gmsh.y"
+#line 2558 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShapes(TRANSLATE_ROTATE, (yyvsp[(12) - (15)].l), 
@@ -6677,14 +6670,14 @@ yyreduce:
     break;
 
   case 191:
-#line 2573 "Gmsh.y"
+#line 2566 "Gmsh.y"
     {
       extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false;
     ;}
     break;
 
   case 192:
-#line 2577 "Gmsh.y"
+#line 2570 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShapes(BOUNDARY_LAYER, (yyvsp[(3) - (6)].l), 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
@@ -6694,7 +6687,7 @@ yyreduce:
     break;
 
   case 193:
-#line 2586 "Gmsh.y"
+#line 2579 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(TRANSLATE, MSH_POINT, (int)(yyvsp[(4) - (8)].d), 
@@ -6704,7 +6697,7 @@ yyreduce:
     break;
 
   case 194:
-#line 2593 "Gmsh.y"
+#line 2586 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(TRANSLATE, MSH_SEGM_LINE, (int)(yyvsp[(4) - (8)].d), 
@@ -6714,7 +6707,7 @@ yyreduce:
     break;
 
   case 195:
-#line 2600 "Gmsh.y"
+#line 2593 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(TRANSLATE, MSH_SURF_PLAN, (int)(yyvsp[(4) - (8)].d), 
@@ -6724,7 +6717,7 @@ yyreduce:
     break;
 
   case 196:
-#line 2607 "Gmsh.y"
+#line 2600 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(ROTATE, MSH_POINT, (int)(yyvsp[(4) - (12)].d), 
@@ -6734,7 +6727,7 @@ yyreduce:
     break;
 
   case 197:
-#line 2614 "Gmsh.y"
+#line 2607 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(ROTATE, MSH_SEGM_LINE, (int)(yyvsp[(4) - (12)].d), 
@@ -6744,7 +6737,7 @@ yyreduce:
     break;
 
   case 198:
-#line 2621 "Gmsh.y"
+#line 2614 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(ROTATE, MSH_SURF_PLAN, (int)(yyvsp[(4) - (12)].d), 
@@ -6754,7 +6747,7 @@ yyreduce:
     break;
 
   case 199:
-#line 2628 "Gmsh.y"
+#line 2621 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(TRANSLATE_ROTATE, MSH_POINT, (int)(yyvsp[(4) - (14)].d), 
@@ -6764,7 +6757,7 @@ yyreduce:
     break;
 
   case 200:
-#line 2635 "Gmsh.y"
+#line 2628 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(TRANSLATE_ROTATE, MSH_SEGM_LINE, (int)(yyvsp[(4) - (14)].d), 
@@ -6774,7 +6767,7 @@ yyreduce:
     break;
 
   case 201:
-#line 2642 "Gmsh.y"
+#line 2635 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(TRANSLATE_ROTATE, MSH_SURF_PLAN, (int)(yyvsp[(4) - (14)].d), 
@@ -6784,14 +6777,14 @@ yyreduce:
     break;
 
   case 202:
-#line 2649 "Gmsh.y"
+#line 2642 "Gmsh.y"
     {
       extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false;
     ;}
     break;
 
   case 203:
-#line 2653 "Gmsh.y"
+#line 2646 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(TRANSLATE, MSH_POINT, (int)(yyvsp[(4) - (12)].d), 
@@ -6801,14 +6794,14 @@ yyreduce:
     break;
 
   case 204:
-#line 2660 "Gmsh.y"
+#line 2653 "Gmsh.y"
     {
       extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false;
     ;}
     break;
 
   case 205:
-#line 2664 "Gmsh.y"
+#line 2657 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(TRANSLATE, MSH_SEGM_LINE, (int)(yyvsp[(4) - (12)].d), 
@@ -6818,14 +6811,14 @@ yyreduce:
     break;
 
   case 206:
-#line 2671 "Gmsh.y"
+#line 2664 "Gmsh.y"
     {
       extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false;
     ;}
     break;
 
   case 207:
-#line 2675 "Gmsh.y"
+#line 2668 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(TRANSLATE, MSH_SURF_PLAN, (int)(yyvsp[(4) - (12)].d), 
@@ -6835,14 +6828,14 @@ yyreduce:
     break;
 
   case 208:
-#line 2682 "Gmsh.y"
+#line 2675 "Gmsh.y"
     {
       extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false;
     ;}
     break;
 
   case 209:
-#line 2686 "Gmsh.y"
+#line 2679 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(ROTATE, MSH_POINT, (int)(yyvsp[(4) - (16)].d), 
@@ -6852,14 +6845,14 @@ yyreduce:
     break;
 
   case 210:
-#line 2693 "Gmsh.y"
+#line 2686 "Gmsh.y"
     {
       extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false;
     ;}
     break;
 
   case 211:
-#line 2697 "Gmsh.y"
+#line 2690 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(ROTATE, MSH_SEGM_LINE, (int)(yyvsp[(4) - (16)].d), 
@@ -6869,14 +6862,14 @@ yyreduce:
     break;
 
   case 212:
-#line 2704 "Gmsh.y"
+#line 2697 "Gmsh.y"
     {
       extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false;
     ;}
     break;
 
   case 213:
-#line 2708 "Gmsh.y"
+#line 2701 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(ROTATE, MSH_SURF_PLAN, (int)(yyvsp[(4) - (16)].d), 
@@ -6886,14 +6879,14 @@ yyreduce:
     break;
 
   case 214:
-#line 2715 "Gmsh.y"
+#line 2708 "Gmsh.y"
     {
       extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false;
     ;}
     break;
 
   case 215:
-#line 2719 "Gmsh.y"
+#line 2712 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(TRANSLATE_ROTATE, MSH_POINT, (int)(yyvsp[(4) - (18)].d), 
@@ -6903,14 +6896,14 @@ yyreduce:
     break;
 
   case 216:
-#line 2726 "Gmsh.y"
+#line 2719 "Gmsh.y"
     {
       extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false;
     ;}
     break;
 
   case 217:
-#line 2730 "Gmsh.y"
+#line 2723 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(TRANSLATE_ROTATE, MSH_SEGM_LINE, (int)(yyvsp[(4) - (18)].d), 
@@ -6920,14 +6913,14 @@ yyreduce:
     break;
 
   case 218:
-#line 2737 "Gmsh.y"
+#line 2730 "Gmsh.y"
     {
       extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false;
     ;}
     break;
 
   case 219:
-#line 2741 "Gmsh.y"
+#line 2734 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(TRANSLATE_ROTATE, MSH_SURF_PLAN, (int)(yyvsp[(4) - (18)].d), 
@@ -6937,19 +6930,19 @@ yyreduce:
     break;
 
   case 220:
-#line 2752 "Gmsh.y"
+#line 2745 "Gmsh.y"
     {
     ;}
     break;
 
   case 221:
-#line 2755 "Gmsh.y"
+#line 2748 "Gmsh.y"
     {
     ;}
     break;
 
   case 222:
-#line 2761 "Gmsh.y"
+#line 2754 "Gmsh.y"
     {
       extr.mesh.ExtrudeMesh = true;
       extr.mesh.NbLayer = 1;
@@ -6961,7 +6954,7 @@ yyreduce:
     break;
 
   case 223:
-#line 2770 "Gmsh.y"
+#line 2763 "Gmsh.y"
     {
       extr.mesh.ExtrudeMesh = true;
       extr.mesh.NbLayer = List_Nbr((yyvsp[(3) - (7)].l));
@@ -6984,7 +6977,7 @@ yyreduce:
     break;
 
   case 224:
-#line 2790 "Gmsh.y"
+#line 2783 "Gmsh.y"
     {
       yymsg(0, "Explicit region numbers in layers are deprecated");
       extr.mesh.ExtrudeMesh = true;
@@ -7010,14 +7003,14 @@ yyreduce:
     break;
 
   case 225:
-#line 2813 "Gmsh.y"
+#line 2806 "Gmsh.y"
     {
       extr.mesh.Recombine = true;
     ;}
     break;
 
   case 226:
-#line 2817 "Gmsh.y"
+#line 2810 "Gmsh.y"
     {
       int num = (int)(yyvsp[(3) - (9)].d);
       if(FindSurface(num)){
@@ -7039,14 +7032,14 @@ yyreduce:
     break;
 
   case 227:
-#line 2840 "Gmsh.y"
+#line 2833 "Gmsh.y"
     {
       (yyval.v)[0] = (yyval.v)[1] = 1.;
     ;}
     break;
 
   case 228:
-#line 2844 "Gmsh.y"
+#line 2837 "Gmsh.y"
     {
       if(!strcmp((yyvsp[(2) - (3)].c), "Progression") || !strcmp((yyvsp[(2) - (3)].c), "Power"))
         (yyval.v)[0] = 1.;
@@ -7062,14 +7055,14 @@ yyreduce:
     break;
 
   case 229:
-#line 2859 "Gmsh.y"
+#line 2852 "Gmsh.y"
     {
       (yyval.i) = -1; // left
     ;}
     break;
 
   case 230:
-#line 2863 "Gmsh.y"
+#line 2856 "Gmsh.y"
     {
       if(!strcmp((yyvsp[(1) - (1)].c), "Right"))
         (yyval.i) = 1;
@@ -7082,35 +7075,35 @@ yyreduce:
     break;
 
   case 231:
-#line 2875 "Gmsh.y"
+#line 2868 "Gmsh.y"
     {
      (yyval.l) = List_Create(1, 1, sizeof(double));
    ;}
     break;
 
   case 232:
-#line 2879 "Gmsh.y"
+#line 2872 "Gmsh.y"
     {
      (yyval.l) = (yyvsp[(2) - (2)].l);
    ;}
     break;
 
   case 233:
-#line 2884 "Gmsh.y"
+#line 2877 "Gmsh.y"
     {
       (yyval.i) = 45;
     ;}
     break;
 
   case 234:
-#line 2888 "Gmsh.y"
+#line 2881 "Gmsh.y"
     {
       (yyval.i) = (int)(yyvsp[(2) - (2)].d);
     ;}
     break;
 
   case 235:
-#line 2895 "Gmsh.y"
+#line 2888 "Gmsh.y"
     {
       int type = (int)(yyvsp[(6) - (7)].v)[0];
       double coef = fabs((yyvsp[(6) - (7)].v)[1]);
@@ -7169,7 +7162,7 @@ yyreduce:
     break;
 
   case 236:
-#line 2951 "Gmsh.y"
+#line 2944 "Gmsh.y"
     {
       int k = List_Nbr((yyvsp[(4) - (6)].l));
       if(k != 0 && k != 3 && k != 4){
@@ -7242,7 +7235,7 @@ yyreduce:
     break;
 
   case 237:
-#line 3021 "Gmsh.y"
+#line 3014 "Gmsh.y"
     {
       yymsg(1, "Elliptic Surface is deprecated: use Transfinite instead (with smoothing)");
       List_Delete((yyvsp[(7) - (8)].l));
@@ -7250,7 +7243,7 @@ yyreduce:
     break;
 
   case 238:
-#line 3026 "Gmsh.y"
+#line 3019 "Gmsh.y"
     {
       int k = List_Nbr((yyvsp[(4) - (5)].l));
       if(k != 0 && k != 6 && k != 8){
@@ -7320,7 +7313,7 @@ yyreduce:
     break;
 
   case 239:
-#line 3093 "Gmsh.y"
+#line 3086 "Gmsh.y"
     {
       if(!(yyvsp[(3) - (5)].l)){
 	List_T *tmp = Tree2List(GModel::current()->getGEOInternals()->Surfaces);
@@ -7366,7 +7359,7 @@ yyreduce:
     break;
 
   case 240:
-#line 3136 "Gmsh.y"
+#line 3129 "Gmsh.y"
     {
       for(int i = 0; i < List_Nbr((yyvsp[(3) - (6)].l)); i++){
 	double d;
@@ -7389,7 +7382,7 @@ yyreduce:
     break;
 
   case 241:
-#line 3162 "Gmsh.y"
+#line 3155 "Gmsh.y"
     { 
       Surface *s = FindSurface((int)(yyvsp[(8) - (10)].d));
       if(s){
@@ -7415,7 +7408,7 @@ yyreduce:
     break;
 
   case 242:
-#line 3185 "Gmsh.y"
+#line 3178 "Gmsh.y"
     {
       Surface *s = FindSurface((int)(yyvsp[(8) - (10)].d));
       if(s){
@@ -7441,26 +7434,26 @@ yyreduce:
     break;
 
   case 243:
-#line 3208 "Gmsh.y"
+#line 3201 "Gmsh.y"
     {
     ;}
     break;
 
   case 244:
-#line 3211 "Gmsh.y"
+#line 3204 "Gmsh.y"
     {
     ;}
     break;
 
   case 245:
-#line 3220 "Gmsh.y"
+#line 3213 "Gmsh.y"
     { 
       ReplaceAllDuplicates();
     ;}
     break;
 
   case 246:
-#line 3224 "Gmsh.y"
+#line 3217 "Gmsh.y"
     { 
       if(!strcmp((yyvsp[(2) - (3)].c), "Geometry"))
         ReplaceAllDuplicates();
@@ -7473,47 +7466,47 @@ yyreduce:
     break;
 
   case 247:
-#line 3239 "Gmsh.y"
+#line 3232 "Gmsh.y"
     { (yyval.d) = (yyvsp[(1) - (1)].d);           ;}
     break;
 
   case 248:
-#line 3240 "Gmsh.y"
+#line 3233 "Gmsh.y"
     { (yyval.d) = (yyvsp[(2) - (3)].d);           ;}
     break;
 
   case 249:
-#line 3241 "Gmsh.y"
+#line 3234 "Gmsh.y"
     { (yyval.d) = -(yyvsp[(2) - (2)].d);          ;}
     break;
 
   case 250:
-#line 3242 "Gmsh.y"
+#line 3235 "Gmsh.y"
     { (yyval.d) = (yyvsp[(2) - (2)].d);           ;}
     break;
 
   case 251:
-#line 3243 "Gmsh.y"
+#line 3236 "Gmsh.y"
     { (yyval.d) = !(yyvsp[(2) - (2)].d);          ;}
     break;
 
   case 252:
-#line 3244 "Gmsh.y"
+#line 3237 "Gmsh.y"
     { (yyval.d) = (yyvsp[(1) - (3)].d) - (yyvsp[(3) - (3)].d);      ;}
     break;
 
   case 253:
-#line 3245 "Gmsh.y"
+#line 3238 "Gmsh.y"
     { (yyval.d) = (yyvsp[(1) - (3)].d) + (yyvsp[(3) - (3)].d);      ;}
     break;
 
   case 254:
-#line 3246 "Gmsh.y"
+#line 3239 "Gmsh.y"
     { (yyval.d) = (yyvsp[(1) - (3)].d) * (yyvsp[(3) - (3)].d);      ;}
     break;
 
   case 255:
-#line 3248 "Gmsh.y"
+#line 3241 "Gmsh.y"
     { 
       if(!(yyvsp[(3) - (3)].d))
 	yymsg(0, "Division by zero in '%g / %g'", (yyvsp[(1) - (3)].d), (yyvsp[(3) - (3)].d));
@@ -7523,307 +7516,307 @@ yyreduce:
     break;
 
   case 256:
-#line 3254 "Gmsh.y"
+#line 3247 "Gmsh.y"
     { (yyval.d) = (int)(yyvsp[(1) - (3)].d) % (int)(yyvsp[(3) - (3)].d);  ;}
     break;
 
   case 257:
-#line 3255 "Gmsh.y"
+#line 3248 "Gmsh.y"
     { (yyval.d) = pow((yyvsp[(1) - (3)].d), (yyvsp[(3) - (3)].d));  ;}
     break;
 
   case 258:
-#line 3256 "Gmsh.y"
+#line 3249 "Gmsh.y"
     { (yyval.d) = (yyvsp[(1) - (3)].d) < (yyvsp[(3) - (3)].d);      ;}
     break;
 
   case 259:
-#line 3257 "Gmsh.y"
+#line 3250 "Gmsh.y"
     { (yyval.d) = (yyvsp[(1) - (3)].d) > (yyvsp[(3) - (3)].d);      ;}
     break;
 
   case 260:
-#line 3258 "Gmsh.y"
+#line 3251 "Gmsh.y"
     { (yyval.d) = (yyvsp[(1) - (3)].d) <= (yyvsp[(3) - (3)].d);     ;}
     break;
 
   case 261:
-#line 3259 "Gmsh.y"
+#line 3252 "Gmsh.y"
     { (yyval.d) = (yyvsp[(1) - (3)].d) >= (yyvsp[(3) - (3)].d);     ;}
     break;
 
   case 262:
-#line 3260 "Gmsh.y"
+#line 3253 "Gmsh.y"
     { (yyval.d) = (yyvsp[(1) - (3)].d) == (yyvsp[(3) - (3)].d);     ;}
     break;
 
   case 263:
-#line 3261 "Gmsh.y"
+#line 3254 "Gmsh.y"
     { (yyval.d) = (yyvsp[(1) - (3)].d) != (yyvsp[(3) - (3)].d);     ;}
     break;
 
   case 264:
-#line 3262 "Gmsh.y"
+#line 3255 "Gmsh.y"
     { (yyval.d) = (yyvsp[(1) - (3)].d) && (yyvsp[(3) - (3)].d);     ;}
     break;
 
   case 265:
-#line 3263 "Gmsh.y"
+#line 3256 "Gmsh.y"
     { (yyval.d) = (yyvsp[(1) - (3)].d) || (yyvsp[(3) - (3)].d);     ;}
     break;
 
   case 266:
-#line 3264 "Gmsh.y"
+#line 3257 "Gmsh.y"
     { (yyval.d) = (yyvsp[(1) - (5)].d) ? (yyvsp[(3) - (5)].d) : (yyvsp[(5) - (5)].d); ;}
     break;
 
   case 267:
-#line 3265 "Gmsh.y"
+#line 3258 "Gmsh.y"
     { (yyval.d) = exp((yyvsp[(3) - (4)].d));      ;}
     break;
 
   case 268:
-#line 3266 "Gmsh.y"
+#line 3259 "Gmsh.y"
     { (yyval.d) = log((yyvsp[(3) - (4)].d));      ;}
     break;
 
   case 269:
-#line 3267 "Gmsh.y"
+#line 3260 "Gmsh.y"
     { (yyval.d) = log10((yyvsp[(3) - (4)].d));    ;}
     break;
 
   case 270:
-#line 3268 "Gmsh.y"
+#line 3261 "Gmsh.y"
     { (yyval.d) = sqrt((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 271:
-#line 3269 "Gmsh.y"
+#line 3262 "Gmsh.y"
     { (yyval.d) = sin((yyvsp[(3) - (4)].d));      ;}
     break;
 
   case 272:
-#line 3270 "Gmsh.y"
+#line 3263 "Gmsh.y"
     { (yyval.d) = asin((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 273:
-#line 3271 "Gmsh.y"
+#line 3264 "Gmsh.y"
     { (yyval.d) = cos((yyvsp[(3) - (4)].d));      ;}
     break;
 
   case 274:
-#line 3272 "Gmsh.y"
+#line 3265 "Gmsh.y"
     { (yyval.d) = acos((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 275:
-#line 3273 "Gmsh.y"
+#line 3266 "Gmsh.y"
     { (yyval.d) = tan((yyvsp[(3) - (4)].d));      ;}
     break;
 
   case 276:
-#line 3274 "Gmsh.y"
+#line 3267 "Gmsh.y"
     { (yyval.d) = atan((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 277:
-#line 3275 "Gmsh.y"
+#line 3268 "Gmsh.y"
     { (yyval.d) = atan2((yyvsp[(3) - (6)].d), (yyvsp[(5) - (6)].d));;}
     break;
 
   case 278:
-#line 3276 "Gmsh.y"
+#line 3269 "Gmsh.y"
     { (yyval.d) = sinh((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 279:
-#line 3277 "Gmsh.y"
+#line 3270 "Gmsh.y"
     { (yyval.d) = cosh((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 280:
-#line 3278 "Gmsh.y"
+#line 3271 "Gmsh.y"
     { (yyval.d) = tanh((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 281:
-#line 3279 "Gmsh.y"
+#line 3272 "Gmsh.y"
     { (yyval.d) = fabs((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 282:
-#line 3280 "Gmsh.y"
+#line 3273 "Gmsh.y"
     { (yyval.d) = floor((yyvsp[(3) - (4)].d));    ;}
     break;
 
   case 283:
-#line 3281 "Gmsh.y"
+#line 3274 "Gmsh.y"
     { (yyval.d) = ceil((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 284:
-#line 3282 "Gmsh.y"
+#line 3275 "Gmsh.y"
     { (yyval.d) = fmod((yyvsp[(3) - (6)].d), (yyvsp[(5) - (6)].d)); ;}
     break;
 
   case 285:
-#line 3283 "Gmsh.y"
+#line 3276 "Gmsh.y"
     { (yyval.d) = fmod((yyvsp[(3) - (6)].d), (yyvsp[(5) - (6)].d)); ;}
     break;
 
   case 286:
-#line 3284 "Gmsh.y"
+#line 3277 "Gmsh.y"
     { (yyval.d) = sqrt((yyvsp[(3) - (6)].d) * (yyvsp[(3) - (6)].d) + (yyvsp[(5) - (6)].d) * (yyvsp[(5) - (6)].d)); ;}
     break;
 
   case 287:
-#line 3285 "Gmsh.y"
+#line 3278 "Gmsh.y"
     { (yyval.d) = (yyvsp[(3) - (4)].d) * (double)rand() / (double)RAND_MAX; ;}
     break;
 
   case 288:
-#line 3287 "Gmsh.y"
+#line 3280 "Gmsh.y"
     { (yyval.d) = exp((yyvsp[(3) - (4)].d));      ;}
     break;
 
   case 289:
-#line 3288 "Gmsh.y"
+#line 3281 "Gmsh.y"
     { (yyval.d) = log((yyvsp[(3) - (4)].d));      ;}
     break;
 
   case 290:
-#line 3289 "Gmsh.y"
+#line 3282 "Gmsh.y"
     { (yyval.d) = log10((yyvsp[(3) - (4)].d));    ;}
     break;
 
   case 291:
-#line 3290 "Gmsh.y"
+#line 3283 "Gmsh.y"
     { (yyval.d) = sqrt((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 292:
-#line 3291 "Gmsh.y"
+#line 3284 "Gmsh.y"
     { (yyval.d) = sin((yyvsp[(3) - (4)].d));      ;}
     break;
 
   case 293:
-#line 3292 "Gmsh.y"
+#line 3285 "Gmsh.y"
     { (yyval.d) = asin((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 294:
-#line 3293 "Gmsh.y"
+#line 3286 "Gmsh.y"
     { (yyval.d) = cos((yyvsp[(3) - (4)].d));      ;}
     break;
 
   case 295:
-#line 3294 "Gmsh.y"
+#line 3287 "Gmsh.y"
     { (yyval.d) = acos((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 296:
-#line 3295 "Gmsh.y"
+#line 3288 "Gmsh.y"
     { (yyval.d) = tan((yyvsp[(3) - (4)].d));      ;}
     break;
 
   case 297:
-#line 3296 "Gmsh.y"
+#line 3289 "Gmsh.y"
     { (yyval.d) = atan((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 298:
-#line 3297 "Gmsh.y"
+#line 3290 "Gmsh.y"
     { (yyval.d) = atan2((yyvsp[(3) - (6)].d), (yyvsp[(5) - (6)].d));;}
     break;
 
   case 299:
-#line 3298 "Gmsh.y"
+#line 3291 "Gmsh.y"
     { (yyval.d) = sinh((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 300:
-#line 3299 "Gmsh.y"
+#line 3292 "Gmsh.y"
     { (yyval.d) = cosh((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 301:
-#line 3300 "Gmsh.y"
+#line 3293 "Gmsh.y"
     { (yyval.d) = tanh((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 302:
-#line 3301 "Gmsh.y"
+#line 3294 "Gmsh.y"
     { (yyval.d) = fabs((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 303:
-#line 3302 "Gmsh.y"
+#line 3295 "Gmsh.y"
     { (yyval.d) = floor((yyvsp[(3) - (4)].d));    ;}
     break;
 
   case 304:
-#line 3303 "Gmsh.y"
+#line 3296 "Gmsh.y"
     { (yyval.d) = ceil((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 305:
-#line 3304 "Gmsh.y"
+#line 3297 "Gmsh.y"
     { (yyval.d) = fmod((yyvsp[(3) - (6)].d), (yyvsp[(5) - (6)].d)); ;}
     break;
 
   case 306:
-#line 3305 "Gmsh.y"
+#line 3298 "Gmsh.y"
     { (yyval.d) = fmod((yyvsp[(3) - (6)].d), (yyvsp[(5) - (6)].d)); ;}
     break;
 
   case 307:
-#line 3306 "Gmsh.y"
+#line 3299 "Gmsh.y"
     { (yyval.d) = sqrt((yyvsp[(3) - (6)].d) * (yyvsp[(3) - (6)].d) + (yyvsp[(5) - (6)].d) * (yyvsp[(5) - (6)].d)); ;}
     break;
 
   case 308:
-#line 3307 "Gmsh.y"
+#line 3300 "Gmsh.y"
     { (yyval.d) = (yyvsp[(3) - (4)].d) * (double)rand() / (double)RAND_MAX; ;}
     break;
 
   case 309:
-#line 3316 "Gmsh.y"
+#line 3309 "Gmsh.y"
     { (yyval.d) = (yyvsp[(1) - (1)].d); ;}
     break;
 
   case 310:
-#line 3317 "Gmsh.y"
+#line 3310 "Gmsh.y"
     { (yyval.d) = 3.141592653589793; ;}
     break;
 
   case 311:
-#line 3318 "Gmsh.y"
+#line 3311 "Gmsh.y"
     { (yyval.d) = Msg::GetCommRank(); ;}
     break;
 
   case 312:
-#line 3319 "Gmsh.y"
+#line 3312 "Gmsh.y"
     { (yyval.d) = Msg::GetCommSize(); ;}
     break;
 
   case 313:
-#line 3320 "Gmsh.y"
+#line 3313 "Gmsh.y"
     { (yyval.d) = GetGmshMajorVersion(); ;}
     break;
 
   case 314:
-#line 3321 "Gmsh.y"
+#line 3314 "Gmsh.y"
     { (yyval.d) = GetGmshMinorVersion(); ;}
     break;
 
   case 315:
-#line 3322 "Gmsh.y"
+#line 3315 "Gmsh.y"
     { (yyval.d) = GetGmshPatchVersion(); ;}
     break;
 
   case 316:
-#line 3327 "Gmsh.y"
+#line 3320 "Gmsh.y"
     {
       if(!gmsh_yysymbols.count((yyvsp[(1) - (1)].c))){
 	yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (1)].c));
@@ -7836,7 +7829,7 @@ yyreduce:
     break;
 
   case 317:
-#line 3340 "Gmsh.y"
+#line 3333 "Gmsh.y"
     {
       char tmpstring[1024];
       sprintf(tmpstring, "%s_%d", (yyvsp[(1) - (5)].c), (int)(yyvsp[(4) - (5)].d)) ;
@@ -7851,7 +7844,7 @@ yyreduce:
     break;
 
   case 318:
-#line 3352 "Gmsh.y"
+#line 3345 "Gmsh.y"
     {
       int index = (int)(yyvsp[(3) - (4)].d);
       if(!gmsh_yysymbols.count((yyvsp[(1) - (4)].c))){
@@ -7869,7 +7862,7 @@ yyreduce:
     break;
 
   case 319:
-#line 3367 "Gmsh.y"
+#line 3360 "Gmsh.y"
     {
       if(!gmsh_yysymbols.count((yyvsp[(2) - (4)].c))){
 	yymsg(0, "Unknown variable '%s'", (yyvsp[(2) - (4)].c));
@@ -7882,7 +7875,7 @@ yyreduce:
     break;
 
   case 320:
-#line 3377 "Gmsh.y"
+#line 3370 "Gmsh.y"
     {
       if(!gmsh_yysymbols.count((yyvsp[(1) - (2)].c))){
 	yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (2)].c));
@@ -7895,7 +7888,7 @@ yyreduce:
     break;
 
   case 321:
-#line 3387 "Gmsh.y"
+#line 3380 "Gmsh.y"
     {
       int index = (int)(yyvsp[(3) - (5)].d);
       if(!gmsh_yysymbols.count((yyvsp[(1) - (5)].c))){
@@ -7913,7 +7906,7 @@ yyreduce:
     break;
 
   case 322:
-#line 3405 "Gmsh.y"
+#line 3398 "Gmsh.y"
     {
       NumberOption(GMSH_GET, (yyvsp[(1) - (3)].c), 0, (yyvsp[(3) - (3)].c), (yyval.d));
       Free((yyvsp[(1) - (3)].c)); Free((yyvsp[(3) - (3)].c));
@@ -7921,7 +7914,7 @@ yyreduce:
     break;
 
   case 323:
-#line 3410 "Gmsh.y"
+#line 3403 "Gmsh.y"
     {
       NumberOption(GMSH_GET, (yyvsp[(1) - (6)].c), (int)(yyvsp[(3) - (6)].d), (yyvsp[(6) - (6)].c), (yyval.d));
       Free((yyvsp[(1) - (6)].c)); Free((yyvsp[(6) - (6)].c));
@@ -7929,7 +7922,7 @@ yyreduce:
     break;
 
   case 324:
-#line 3415 "Gmsh.y"
+#line 3408 "Gmsh.y"
     {
       double d = 0.;
       if(NumberOption(GMSH_GET, (yyvsp[(1) - (4)].c), 0, (yyvsp[(3) - (4)].c), d)){
@@ -7942,7 +7935,7 @@ yyreduce:
     break;
 
   case 325:
-#line 3425 "Gmsh.y"
+#line 3418 "Gmsh.y"
     {
       double d = 0.;
       if(NumberOption(GMSH_GET, (yyvsp[(1) - (7)].c), (int)(yyvsp[(3) - (7)].d), (yyvsp[(6) - (7)].c), d)){
@@ -7955,7 +7948,7 @@ yyreduce:
     break;
 
   case 326:
-#line 3435 "Gmsh.y"
+#line 3428 "Gmsh.y"
     { 
       (yyval.d) = Msg::GetValue((yyvsp[(3) - (6)].c), (yyvsp[(5) - (6)].d));
       Free((yyvsp[(3) - (6)].c));
@@ -7963,70 +7956,70 @@ yyreduce:
     break;
 
   case 327:
-#line 3443 "Gmsh.y"
+#line 3436 "Gmsh.y"
     {
       memcpy((yyval.v), (yyvsp[(1) - (1)].v), 5*sizeof(double));
     ;}
     break;
 
   case 328:
-#line 3447 "Gmsh.y"
+#line 3440 "Gmsh.y"
     {
       for(int i = 0; i < 5; i++) (yyval.v)[i] = -(yyvsp[(2) - (2)].v)[i];
     ;}
     break;
 
   case 329:
-#line 3451 "Gmsh.y"
+#line 3444 "Gmsh.y"
     { 
       for(int i = 0; i < 5; i++) (yyval.v)[i] = (yyvsp[(2) - (2)].v)[i];
     ;}
     break;
 
   case 330:
-#line 3455 "Gmsh.y"
+#line 3448 "Gmsh.y"
     { 
       for(int i = 0; i < 5; i++) (yyval.v)[i] = (yyvsp[(1) - (3)].v)[i] - (yyvsp[(3) - (3)].v)[i];
     ;}
     break;
 
   case 331:
-#line 3459 "Gmsh.y"
+#line 3452 "Gmsh.y"
     {
       for(int i = 0; i < 5; i++) (yyval.v)[i] = (yyvsp[(1) - (3)].v)[i] + (yyvsp[(3) - (3)].v)[i];
     ;}
     break;
 
   case 332:
-#line 3466 "Gmsh.y"
+#line 3459 "Gmsh.y"
     { 
       (yyval.v)[0] = (yyvsp[(2) - (11)].d);  (yyval.v)[1] = (yyvsp[(4) - (11)].d);  (yyval.v)[2] = (yyvsp[(6) - (11)].d);  (yyval.v)[3] = (yyvsp[(8) - (11)].d); (yyval.v)[4] = (yyvsp[(10) - (11)].d);
     ;}
     break;
 
   case 333:
-#line 3470 "Gmsh.y"
+#line 3463 "Gmsh.y"
     { 
       (yyval.v)[0] = (yyvsp[(2) - (9)].d);  (yyval.v)[1] = (yyvsp[(4) - (9)].d);  (yyval.v)[2] = (yyvsp[(6) - (9)].d);  (yyval.v)[3] = (yyvsp[(8) - (9)].d); (yyval.v)[4] = 1.0;
     ;}
     break;
 
   case 334:
-#line 3474 "Gmsh.y"
+#line 3467 "Gmsh.y"
     {
       (yyval.v)[0] = (yyvsp[(2) - (7)].d);  (yyval.v)[1] = (yyvsp[(4) - (7)].d);  (yyval.v)[2] = (yyvsp[(6) - (7)].d);  (yyval.v)[3] = 0.0; (yyval.v)[4] = 1.0;
     ;}
     break;
 
   case 335:
-#line 3478 "Gmsh.y"
+#line 3471 "Gmsh.y"
     {
       (yyval.v)[0] = (yyvsp[(2) - (7)].d);  (yyval.v)[1] = (yyvsp[(4) - (7)].d);  (yyval.v)[2] = (yyvsp[(6) - (7)].d);  (yyval.v)[3] = 0.0; (yyval.v)[4] = 1.0;
     ;}
     break;
 
   case 336:
-#line 3485 "Gmsh.y"
+#line 3478 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(List_T*));
       List_Add((yyval.l), &((yyvsp[(1) - (1)].l)));
@@ -8034,14 +8027,14 @@ yyreduce:
     break;
 
   case 337:
-#line 3490 "Gmsh.y"
+#line 3483 "Gmsh.y"
     {
       List_Add((yyval.l), &((yyvsp[(3) - (3)].l)));
     ;}
     break;
 
   case 338:
-#line 3497 "Gmsh.y"
+#line 3490 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(double));
       List_Add((yyval.l), &((yyvsp[(1) - (1)].d)));
@@ -8049,14 +8042,14 @@ yyreduce:
     break;
 
   case 339:
-#line 3502 "Gmsh.y"
+#line 3495 "Gmsh.y"
     {
       (yyval.l) = (yyvsp[(1) - (1)].l);
     ;}
     break;
 
   case 340:
-#line 3506 "Gmsh.y"
+#line 3499 "Gmsh.y"
     {
       // creates an empty list
       (yyval.l) = List_Create(2, 1, sizeof(double));
@@ -8064,14 +8057,14 @@ yyreduce:
     break;
 
   case 341:
-#line 3511 "Gmsh.y"
+#line 3504 "Gmsh.y"
     {
       (yyval.l) = (yyvsp[(2) - (3)].l);
     ;}
     break;
 
   case 342:
-#line 3515 "Gmsh.y"
+#line 3508 "Gmsh.y"
     {
       (yyval.l) = (yyvsp[(3) - (4)].l);
       for(int i = 0; i < List_Nbr((yyval.l)); i++){
@@ -8082,7 +8075,7 @@ yyreduce:
     break;
 
   case 343:
-#line 3523 "Gmsh.y"
+#line 3516 "Gmsh.y"
     {
       (yyval.l) = (yyvsp[(4) - (5)].l);
       for(int i = 0; i < List_Nbr((yyval.l)); i++){
@@ -8093,14 +8086,14 @@ yyreduce:
     break;
 
   case 344:
-#line 3534 "Gmsh.y"
+#line 3527 "Gmsh.y"
     { 
       (yyval.l) = (yyvsp[(1) - (1)].l); 
     ;}
     break;
 
   case 345:
-#line 3538 "Gmsh.y"
+#line 3531 "Gmsh.y"
     {
       if(!strcmp((yyvsp[(1) - (1)].c), "*") || !strcmp((yyvsp[(1) - (1)].c), "all"))
         (yyval.l) = 0;
@@ -8112,7 +8105,7 @@ yyreduce:
     break;
 
   case 346:
-#line 3550 "Gmsh.y"
+#line 3543 "Gmsh.y"
     {
       (yyval.l) = (yyvsp[(2) - (2)].l);
       for(int i = 0; i < List_Nbr((yyval.l)); i++){
@@ -8123,7 +8116,7 @@ yyreduce:
     break;
 
   case 347:
-#line 3558 "Gmsh.y"
+#line 3551 "Gmsh.y"
     {
       (yyval.l) = (yyvsp[(3) - (3)].l);
       for(int i = 0; i < List_Nbr((yyval.l)); i++){
@@ -8134,7 +8127,7 @@ yyreduce:
     break;
 
   case 348:
-#line 3566 "Gmsh.y"
+#line 3559 "Gmsh.y"
     { 
       (yyval.l) = List_Create(2, 1, sizeof(double)); 
       for(double d = (yyvsp[(1) - (3)].d); ((yyvsp[(1) - (3)].d) < (yyvsp[(3) - (3)].d)) ? (d <= (yyvsp[(3) - (3)].d)) : (d >= (yyvsp[(3) - (3)].d)); 
@@ -8144,7 +8137,7 @@ yyreduce:
     break;
 
   case 349:
-#line 3573 "Gmsh.y"
+#line 3566 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(double)); 
       if(!(yyvsp[(5) - (5)].d) || ((yyvsp[(1) - (5)].d) < (yyvsp[(3) - (5)].d) && (yyvsp[(5) - (5)].d) < 0) || ((yyvsp[(1) - (5)].d) > (yyvsp[(3) - (5)].d) && (yyvsp[(5) - (5)].d) > 0)){
@@ -8158,7 +8151,7 @@ yyreduce:
     break;
 
   case 350:
-#line 3584 "Gmsh.y"
+#line 3577 "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
@@ -8181,7 +8174,7 @@ yyreduce:
     break;
 
   case 351:
-#line 3604 "Gmsh.y"
+#line 3597 "Gmsh.y"
     {
       (yyval.l) = List_Create(List_Nbr((yyvsp[(1) - (1)].l)), 1, sizeof(double));
       for(int i = 0; i < List_Nbr((yyvsp[(1) - (1)].l)); i++){
@@ -8194,7 +8187,7 @@ yyreduce:
     break;
 
   case 352:
-#line 3614 "Gmsh.y"
+#line 3607 "Gmsh.y"
     {
       (yyval.l) = List_Create(List_Nbr((yyvsp[(1) - (1)].l)), 1, sizeof(double));
       for(int i = 0; i < List_Nbr((yyvsp[(1) - (1)].l)); i++){
@@ -8207,7 +8200,7 @@ yyreduce:
     break;
 
   case 353:
-#line 3624 "Gmsh.y"
+#line 3617 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(double));
       if(!gmsh_yysymbols.count((yyvsp[(1) - (3)].c)))
@@ -8220,7 +8213,7 @@ yyreduce:
     break;
 
   case 354:
-#line 3634 "Gmsh.y"
+#line 3627 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(double));
       if(!gmsh_yysymbols.count((yyvsp[(1) - (6)].c)))
@@ -8240,7 +8233,7 @@ yyreduce:
     break;
 
   case 355:
-#line 3654 "Gmsh.y"
+#line 3647 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(double));
       List_Add((yyval.l), &((yyvsp[(1) - (1)].d)));
@@ -8248,21 +8241,21 @@ yyreduce:
     break;
 
   case 356:
-#line 3659 "Gmsh.y"
+#line 3652 "Gmsh.y"
     {
       (yyval.l) = (yyvsp[(1) - (1)].l);
     ;}
     break;
 
   case 357:
-#line 3663 "Gmsh.y"
+#line 3656 "Gmsh.y"
     {
       List_Add((yyval.l), &((yyvsp[(3) - (3)].d)));
     ;}
     break;
 
   case 358:
-#line 3667 "Gmsh.y"
+#line 3660 "Gmsh.y"
     {
       for(int i = 0; i < List_Nbr((yyvsp[(3) - (3)].l)); i++){
 	double d;
@@ -8274,21 +8267,21 @@ yyreduce:
     break;
 
   case 359:
-#line 3679 "Gmsh.y"
+#line 3672 "Gmsh.y"
     {
       (yyval.u) = CTX::instance()->packColor((int)(yyvsp[(2) - (9)].d), (int)(yyvsp[(4) - (9)].d), (int)(yyvsp[(6) - (9)].d), (int)(yyvsp[(8) - (9)].d));
     ;}
     break;
 
   case 360:
-#line 3683 "Gmsh.y"
+#line 3676 "Gmsh.y"
     {
       (yyval.u) = CTX::instance()->packColor((int)(yyvsp[(2) - (7)].d), (int)(yyvsp[(4) - (7)].d), (int)(yyvsp[(6) - (7)].d), 255);
     ;}
     break;
 
   case 361:
-#line 3695 "Gmsh.y"
+#line 3688 "Gmsh.y"
     {
       int flag;
       (yyval.u) = GetColorForString(ColorString, -1, (yyvsp[(1) - (1)].c), &flag);
@@ -8298,7 +8291,7 @@ yyreduce:
     break;
 
   case 362:
-#line 3702 "Gmsh.y"
+#line 3695 "Gmsh.y"
     {
       unsigned int val = 0;
       ColorOption(GMSH_GET, (yyvsp[(1) - (5)].c), 0, (yyvsp[(5) - (5)].c), val);
@@ -8308,14 +8301,14 @@ yyreduce:
     break;
 
   case 363:
-#line 3712 "Gmsh.y"
+#line 3705 "Gmsh.y"
     {
       (yyval.l) = (yyvsp[(2) - (3)].l);
     ;}
     break;
 
   case 364:
-#line 3716 "Gmsh.y"
+#line 3709 "Gmsh.y"
     {
       (yyval.l) = List_Create(256, 10, sizeof(unsigned int));
       GmshColorTable *ct = GetColorTable((int)(yyvsp[(3) - (6)].d));
@@ -8330,7 +8323,7 @@ yyreduce:
     break;
 
   case 365:
-#line 3731 "Gmsh.y"
+#line 3724 "Gmsh.y"
     {
       (yyval.l) = List_Create(256, 10, sizeof(unsigned int));
       List_Add((yyval.l), &((yyvsp[(1) - (1)].u)));
@@ -8338,21 +8331,21 @@ yyreduce:
     break;
 
   case 366:
-#line 3736 "Gmsh.y"
+#line 3729 "Gmsh.y"
     {
       List_Add((yyval.l), &((yyvsp[(3) - (3)].u)));
     ;}
     break;
 
   case 367:
-#line 3743 "Gmsh.y"
+#line 3736 "Gmsh.y"
     {
       (yyval.c) = (yyvsp[(1) - (1)].c);
     ;}
     break;
 
   case 368:
-#line 3747 "Gmsh.y"
+#line 3740 "Gmsh.y"
     {
       if(!gmsh_yystringsymbols.count((yyvsp[(1) - (1)].c))){
 	yymsg(0, "Unknown string variable '%s'", (yyvsp[(1) - (1)].c));
@@ -8368,7 +8361,7 @@ yyreduce:
     break;
 
   case 369:
-#line 3760 "Gmsh.y"
+#line 3753 "Gmsh.y"
     { 
       std::string out;
       StringOption(GMSH_GET, (yyvsp[(1) - (3)].c), 0, (yyvsp[(3) - (3)].c), out);
@@ -8379,7 +8372,7 @@ yyreduce:
     break;
 
   case 370:
-#line 3768 "Gmsh.y"
+#line 3761 "Gmsh.y"
     { 
       std::string out;
       StringOption(GMSH_GET, (yyvsp[(1) - (6)].c), (int)(yyvsp[(3) - (6)].d), (yyvsp[(6) - (6)].c), out);
@@ -8390,14 +8383,14 @@ yyreduce:
     break;
 
   case 371:
-#line 3779 "Gmsh.y"
+#line 3772 "Gmsh.y"
     {
       (yyval.c) = (yyvsp[(1) - (1)].c);
     ;}
     break;
 
   case 372:
-#line 3783 "Gmsh.y"
+#line 3776 "Gmsh.y"
     {
       (yyval.c) = (char *)Malloc(32 * sizeof(char));
       time_t now;
@@ -8408,7 +8401,7 @@ yyreduce:
     break;
 
   case 373:
-#line 3791 "Gmsh.y"
+#line 3784 "Gmsh.y"
     {
       (yyval.c) = (char *)Malloc((strlen((yyvsp[(3) - (6)].c)) + strlen((yyvsp[(5) - (6)].c)) + 1) * sizeof(char));
       strcpy((yyval.c), (yyvsp[(3) - (6)].c));
@@ -8419,7 +8412,7 @@ yyreduce:
     break;
 
   case 374:
-#line 3799 "Gmsh.y"
+#line 3792 "Gmsh.y"
     {
       (yyval.c) = (char *)Malloc((strlen((yyvsp[(3) - (4)].c)) + 1) * sizeof(char));
       int i;
@@ -8436,7 +8429,7 @@ yyreduce:
     break;
 
   case 375:
-#line 3813 "Gmsh.y"
+#line 3806 "Gmsh.y"
     {
       (yyval.c) = (char *)Malloc((strlen((yyvsp[(3) - (4)].c)) + 1) * sizeof(char));
       int i;
@@ -8453,14 +8446,14 @@ yyreduce:
     break;
 
   case 376:
-#line 3827 "Gmsh.y"
+#line 3820 "Gmsh.y"
     {
       (yyval.c) = (yyvsp[(3) - (4)].c);
     ;}
     break;
 
   case 377:
-#line 3831 "Gmsh.y"
+#line 3824 "Gmsh.y"
     {
       char tmpstring[1024];
       int i = PrintListOfDouble((yyvsp[(3) - (6)].c), (yyvsp[(5) - (6)].l), tmpstring);
@@ -8483,7 +8476,7 @@ yyreduce:
 
 
 /* Line 1267 of yacc.c.  */
-#line 8487 "Gmsh.tab.cpp"
+#line 8480 "Gmsh.tab.cpp"
       default: break;
     }
   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -8697,7 +8690,7 @@ yyreturn:
 }
 
 
-#line 3851 "Gmsh.y"
+#line 3844 "Gmsh.y"
 
 
 int PrintListOfDouble(char *format, List_T *list, char *buffer)
@@ -8758,23 +8751,6 @@ gmshMatrix<double> ListOfListOfDouble2Matrix(List_T *list)
   return mat;
 }
 
-void FixRelativePath(const char *in, char *out)
-{
-  if(in[0] == '/' || in[0] == '\\' || (strlen(in)>2 && in[1] == ':')){
-    // do nothing: 'in' is an absolute path
-    strcpy(out, in);
-  }
-  else{
-    // append 'in' to the path of the parent file
-    strcpy(out, gmsh_yyname.c_str());
-    int i = strlen(out) - 1 ;
-    while(i >= 0 && gmsh_yyname.c_str()[i] != '/' && 
-          gmsh_yyname.c_str()[i] != '\\') i-- ;
-    out[i+1] = '\0';
-    strcat(out, in);
-  }
-}
-
 void yyerror(const char *s)
 {
   Msg::Error("'%s', line %d : %s (%s)", gmsh_yyname.c_str(), gmsh_yylineno - 1,
diff --git a/Parser/Gmsh.y b/Parser/Gmsh.y
index d4a4ae90bb298751b4abb3131551b350b547a213..aff675d53c5953cff7c51d1d90446098cdd5bbb3 100644
--- a/Parser/Gmsh.y
+++ b/Parser/Gmsh.y
@@ -13,6 +13,7 @@
 #include "MallocUtils.h"
 #include "ListUtils.h"
 #include "TreeUtils.h"
+#include "StringUtils.h"
 #include "Numeric.h"
 #include "Context.h"
 #include "GModel.h"
@@ -72,7 +73,6 @@ void yymsg(int level, const char *fmt, ...);
 void skip_until(const char *skip, const char *until);
 int PrintListOfDouble(char *format, List_T *list, char *buffer);
 gmshMatrix<double> ListOfListOfDouble2Matrix(List_T *list);
-void FixRelativePath(const char *in, char *out);
 %}
 
 %union {
@@ -191,11 +191,10 @@ Printf :
     }
   | tPrintf '(' tBIGSTR ')' SendToFile StringExprVar tEND
     {
-      char tmpstring[1024];
-      FixRelativePath($6, tmpstring);
-      FILE *fp = fopen(tmpstring, $5);
+      std::string tmp = FixRelativePath(gmsh_yyname, $6);
+      FILE *fp = fopen(tmp.c_str(), $5);
       if(!fp){
-	yymsg(0, "Unable to open file '%s'", tmpstring);
+	yymsg(0, "Unable to open file '%s'", tmp.c_str());
       }
       else{
 	fprintf(fp, "%s\n", $3);
@@ -226,11 +225,10 @@ Printf :
       else if(i > 0)
 	yymsg(0, "%d extra argument%s in Printf", i, (i > 1) ? "s" : "");
       else{
-	char tmpstring2[1024];
-	FixRelativePath($8, tmpstring2);
-	FILE *fp = fopen(tmpstring2, $7);
+        std::string tmp = FixRelativePath(gmsh_yyname, $8);
+	FILE *fp = fopen(tmp.c_str(), $7);
 	if(!fp){
-	  yymsg(0, "Unable to open file '%s'", tmpstring2);
+	  yymsg(0, "Unable to open file '%s'", tmp.c_str());
 	}
 	else{
 	  fprintf(fp, "%s\n", tmpstring);
@@ -2209,8 +2207,7 @@ Command :
     tSTRING StringExpr tEND
     {
       if(!strcmp($1, "Include")){
-	char tmpstring[1024];
-	FixRelativePath($2, tmpstring);
+        std::string tmp = FixRelativePath(gmsh_yyname, $2);
 	// Warning: we *don't* close included files (to allow user
 	// functions in these files). If you need to include many many
 	// files and don't have functions in the files, use "Merge"
@@ -2218,31 +2215,28 @@ Command :
 	// open simultaneously. The right solution would be of course
 	// to modify FunctionManager to reopen the files instead of
 	// using the FILE pointer, but hey, I'm lazy...
-	Msg::StatusBar(2, true, "Reading '%s'", tmpstring);
-	ParseFile(tmpstring, false, true);
+	Msg::StatusBar(2, true, "Reading '%s'", tmp.c_str());
+	ParseFile(tmp, false, true);
 	SetBoundingBox();
-	Msg::StatusBar(2, true, "Read '%s'", tmpstring);
+	Msg::StatusBar(2, true, "Read '%s'", tmp.c_str());
       }
       else if(!strcmp($1, "Print")){
 	// make sure we have the latest data from GEO_Internals in GModel
 	// (fixes bug where we would have no geometry in the picture if
 	// the print command is in the same file as the geometry)
 	GModel::current()->importGEOInternals();
-	char tmpstring[1024];
-	FixRelativePath($2, tmpstring);
-	CreateOutputFile(tmpstring, CTX::instance()->print.format);
+        std::string tmp = FixRelativePath(gmsh_yyname, $2);
+	CreateOutputFile(tmp, CTX::instance()->print.format);
       }
       else if(!strcmp($1, "Save")){
 	GModel::current()->importGEOInternals();
-	char tmpstring[1024];
-	FixRelativePath($2, tmpstring);
-	CreateOutputFile(tmpstring, CTX::instance()->mesh.format);
+        std::string tmp = FixRelativePath(gmsh_yyname, $2);
+	CreateOutputFile(tmp, CTX::instance()->mesh.format);
       }
       else if(!strcmp($1, "Merge") || !strcmp($1, "MergeWithBoundingBox")){
 	// MergeWithBoundingBox is deprecated
-	char tmpstring[1024];
-	FixRelativePath($2, tmpstring);
-	MergeFile(tmpstring, true);
+        std::string tmp = FixRelativePath(gmsh_yyname, $2);
+	MergeFile(tmp, true);
       }
       else if(!strcmp($1, "System"))
 	SystemCall($2);
@@ -2256,9 +2250,8 @@ Command :
       if(!strcmp($1, "Save") && !strcmp($2, "View")){
 	int index = (int)$4;
 	if(index >= 0 && index < (int)PView::list.size()){
-	  char tmpstring[1024];
-	  FixRelativePath($6, tmpstring);
-	  PView::list[index]->write(tmpstring, CTX::instance()->post.fileFormat);
+          std::string tmp = FixRelativePath(gmsh_yyname, $6);
+	  PView::list[index]->write(tmp, CTX::instance()->post.fileFormat);
 	}
 	else
 	  yymsg(0, "Unknown view %d", index);
@@ -3908,23 +3901,6 @@ gmshMatrix<double> ListOfListOfDouble2Matrix(List_T *list)
   return mat;
 }
 
-void FixRelativePath(const char *in, char *out)
-{
-  if(in[0] == '/' || in[0] == '\\' || (strlen(in)>2 && in[1] == ':')){
-    // do nothing: 'in' is an absolute path
-    strcpy(out, in);
-  }
-  else{
-    // append 'in' to the path of the parent file
-    strcpy(out, gmsh_yyname.c_str());
-    int i = strlen(out) - 1 ;
-    while(i >= 0 && gmsh_yyname.c_str()[i] != '/' && 
-          gmsh_yyname.c_str()[i] != '\\') i-- ;
-    out[i+1] = '\0';
-    strcat(out, in);
-  }
-}
-
 void yyerror(const char *s)
 {
   Msg::Error("'%s', line %d : %s (%s)", gmsh_yyname.c_str(), gmsh_yylineno - 1,