diff --git a/Adapt/Adapt.cpp b/Adapt/Adapt.cpp
index d9ffd9852cbc226e04d9a1c6690ec4d028bb1dd5..289f368fb6a9eff3be88b4b23cb49731455d4401 100644
--- a/Adapt/Adapt.cpp
+++ b/Adapt/Adapt.cpp
@@ -1,4 +1,4 @@
-/* $Id: Adapt.cpp,v 1.2 2000-11-26 15:43:44 geuzaine Exp $ */
+// $Id: Adapt.cpp,v 1.3 2001-01-08 08:05:39 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Adapt.h"
diff --git a/Adapt/Adapt.h b/Adapt/Adapt.h
index eda49f666732425d1e6a0154b02f0ea767df53ba..d4885075d44088c640e7d4d589ed26e919aaa702 100644
--- a/Adapt/Adapt.h
+++ b/Adapt/Adapt.h
@@ -1,4 +1,3 @@
-/* $Id: Adapt.h,v 1.4 2000-11-26 15:43:44 geuzaine Exp $ */
 #ifndef _ADAPT_H_
 #define _ADAPT_H_
 
diff --git a/Adapt/Makefile b/Adapt/Makefile
index 035393d427f75c7f83822e4e442be346362846ab..871d2791ef0354fc2ddee0601e4ddb999c23a0a7 100644
--- a/Adapt/Makefile
+++ b/Adapt/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.6 2000-12-29 10:27:00 geuzaine Exp $
+# $Id: Makefile,v 1.7 2001-01-08 08:05:39 geuzaine Exp $
 #
 # Makefile for "libAdapt.a"
 #
@@ -6,18 +6,18 @@
 .IGNORE:
 
 CC        = c++
-C_FLAGS   = -g
-
-OS_FLAGS  = -D_XMOTIF
-
 RM        = rm
-RMFLAGS   = -f
 RANLIB    = ranlib
 
 LIB       = ../lib/libAdapt.a
 INCLUDE   = -I../Common -I../DataStr
 
-CFLAGS    = $(C_FLAGS) $(OS_FLAGS) $(INCLUDE) 
+C_FLAGS       = -g -Wall
+OS_FLAGS      = 
+VERSION_FLAGS = 
+
+RMFLAGS   = -f
+CFLAGS    = $(C_FLAGS) $(OS_FLAGS) $(VERSION_FLAGS) $(INCLUDE) 
 
 SRC = Adapt.cpp \
       mnbrak.cpp \
diff --git a/Adapt/brent.cpp b/Adapt/brent.cpp
index f6e8aba188a570d7a01bb4894ec13c397f2924f3..706d32781079a58085f47aa224e23000fe1eae3d 100644
--- a/Adapt/brent.cpp
+++ b/Adapt/brent.cpp
@@ -1,4 +1,4 @@
-/* $Id: brent.cpp,v 1.3 2000-11-26 15:43:44 geuzaine Exp $ */
+// $Id: brent.cpp,v 1.4 2001-01-08 08:05:39 geuzaine Exp $
 
 
 #include <math.h>
diff --git a/Adapt/dsvdcmp.cpp b/Adapt/dsvdcmp.cpp
index 1f02e9457539b719cef8208ba704913ed91aa28d..d143484240e1132eef4259f6a4a8360b8bd018d9 100644
--- a/Adapt/dsvdcmp.cpp
+++ b/Adapt/dsvdcmp.cpp
@@ -1,4 +1,4 @@
-/* $Id: dsvdcmp.cpp,v 1.3 2000-11-26 15:43:44 geuzaine Exp $ */
+// $Id: dsvdcmp.cpp,v 1.4 2001-01-08 08:05:39 geuzaine Exp $
 #include <math.h>
 
 #include "nrutil.h"
diff --git a/Adapt/fdjac.cpp b/Adapt/fdjac.cpp
index 6e225fc4808b5364861079339d13bd7ef399af2f..7a02e764987ec196c4b3f5426701a7e874c56571 100644
--- a/Adapt/fdjac.cpp
+++ b/Adapt/fdjac.cpp
@@ -1,4 +1,4 @@
-/* $Id: fdjac.cpp,v 1.3 2000-11-26 15:43:44 geuzaine Exp $ */
+// $Id: fdjac.cpp,v 1.4 2001-01-08 08:05:39 geuzaine Exp $
 #include <math.h>
 #define NRANSI
 #include "nrutil.h"
@@ -29,4 +29,3 @@ fdjac (int n, float x[], float fvec[], float **df,
 }
 #undef EPS
 #undef NRANSI
-/* (C) Copr. 1986-92 Numerical Recipes Software J!0. */
diff --git a/Adapt/fmin.cpp b/Adapt/fmin.cpp
index 7d311ab0f46ae7042f8e3445fe6753c9cc95288e..a81d482a0829034d223bc56a7702730c087c2e4e 100644
--- a/Adapt/fmin.cpp
+++ b/Adapt/fmin.cpp
@@ -1,4 +1,4 @@
-/* $Id: fmin.cpp,v 1.2 2000-11-23 14:11:24 geuzaine Exp $ */
+// $Id: fmin.cpp,v 1.3 2001-01-08 08:05:40 geuzaine Exp $
 #define NRANSI
 #include "nrutil.h"
 
@@ -18,4 +18,3 @@ fmin (float x[])
   return 0.5 * sum;
 }
 #undef NRANSI
-/* (C) Copr. 1986-92 Numerical Recipes Software J!0. */
diff --git a/Adapt/lnsrch.cpp b/Adapt/lnsrch.cpp
index 6151fc9fffcca0619117e7f90c2e40d44fc5d860..e45de2cdf0023706491657e6c9ffe64312815c43 100644
--- a/Adapt/lnsrch.cpp
+++ b/Adapt/lnsrch.cpp
@@ -1,4 +1,4 @@
-/* $Id: lnsrch.cpp,v 1.3 2000-11-26 15:43:44 geuzaine Exp $ */
+// $Id: lnsrch.cpp,v 1.4 2001-01-08 08:05:40 geuzaine Exp $
 #include <math.h>
 #define NRANSI
 #include "nrutil.h"
@@ -78,4 +78,3 @@ lnsrch (int n, float xold[], float fold, float g[], float p[], float x[],
 #undef ALF
 #undef TOLX
 #undef NRANSI
-/* (C) Copr. 1986-92 Numerical Recipes Software J!0. */
diff --git a/Adapt/lubksb.cpp b/Adapt/lubksb.cpp
index 4717929d34dce384e1ea135931f93123ceedd74a..65d5dce895e4caf582bb38f675550fc280d7be60 100644
--- a/Adapt/lubksb.cpp
+++ b/Adapt/lubksb.cpp
@@ -1,4 +1,4 @@
-/* $Id: lubksb.cpp,v 1.3 2000-11-26 15:43:44 geuzaine Exp $ */
+// $Id: lubksb.cpp,v 1.4 2001-01-08 08:05:40 geuzaine Exp $
 void 
 lubksb (float **a, int n, int *indx, float b[])
 {
@@ -25,4 +25,3 @@ lubksb (float **a, int n, int *indx, float b[])
       b[i] = sum / a[i][i];
     }
 }
-/* (C) Copr. 1986-92 Numerical Recipes Software J!0. */
diff --git a/Adapt/ludcmp.cpp b/Adapt/ludcmp.cpp
index f1ac9539321f6cc43a43921c1dd2b3515370d165..c8a00772375dbc2fe1dee875351e367a8851b694 100644
--- a/Adapt/ludcmp.cpp
+++ b/Adapt/ludcmp.cpp
@@ -1,4 +1,4 @@
-/* $Id: ludcmp.cpp,v 1.3 2000-11-26 15:43:44 geuzaine Exp $ */
+// $Id: ludcmp.cpp,v 1.4 2001-01-08 08:05:40 geuzaine Exp $
 #include <math.h>
 #define NRANSI
 #include "nrutil.h"
@@ -70,4 +70,3 @@ ludcmp (float **a, int n, int *indx, float *d)
 }
 #undef TINY
 #undef NRANSI
-/* (C) Copr. 1986-92 Numerical Recipes Software J!0. */
diff --git a/Adapt/mnbrak.cpp b/Adapt/mnbrak.cpp
index 1326e32bace0fbbe034495544fb281f146f8da3e..5c3edaf06310c8aa45cb06b0b449f24d1049e0d0 100644
--- a/Adapt/mnbrak.cpp
+++ b/Adapt/mnbrak.cpp
@@ -1,4 +1,4 @@
-/* $Id: mnbrak.cpp,v 1.3 2000-11-26 15:43:44 geuzaine Exp $ */
+// $Id: mnbrak.cpp,v 1.4 2001-01-08 08:05:40 geuzaine Exp $
 #include <math.h>
 #define NRANSI
 #include "nrutil.h"
@@ -77,4 +77,3 @@ mnbrak (double *ax, double *bx, double *cx, double *fa, double *fb, double *fc,
 #undef TINY
 #undef SHFT
 #undef NRANSI
-/* (C) Copr. 1986-92 Numerical Recipes Software J!0. */
diff --git a/Adapt/newt.cpp b/Adapt/newt.cpp
index 0b6f13c0955cef7fcc27e94cc8835a93aa7df241..f01cb9aed6cc40f82b23287dc7c3a19b63d2a5a3 100644
--- a/Adapt/newt.cpp
+++ b/Adapt/newt.cpp
@@ -1,4 +1,4 @@
-/* $Id: newt.cpp,v 1.3 2000-11-26 15:43:44 geuzaine Exp $ */
+// $Id: newt.cpp,v 1.4 2001-01-08 08:05:40 geuzaine Exp $
 #include <math.h>
 #define NRANSI
 #include "nrutil.h"
@@ -105,4 +105,3 @@ newt (float x[], int n, int *check,
 #undef STPMX
 #undef FREERETURN
 #undef NRANSI
-/* (C) Copr. 1986-92 Numerical Recipes Software J!0. */
diff --git a/Adapt/nrutil.cpp b/Adapt/nrutil.cpp
index c2d854ebf0ee2d99d72758511b7f3e4a3fc601e6..c4140f61126fbd2af0ee1484eb64e5c06921009f 100644
--- a/Adapt/nrutil.cpp
+++ b/Adapt/nrutil.cpp
@@ -1,4 +1,4 @@
-/* $Id: nrutil.cpp,v 1.3 2000-11-26 15:43:44 geuzaine Exp $ */
+// $Id: nrutil.cpp,v 1.4 2001-01-08 08:05:40 geuzaine Exp $
 #include <stdio.h>
 #include <stddef.h>
 #include <stdlib.h>
diff --git a/Adapt/nrutil.h b/Adapt/nrutil.h
index 080d0fd56b6fb565e8e4153835e5a618bdc0a963..b1f26bc36859d917e2709e145f29de686bff73b6 100644
--- a/Adapt/nrutil.h
+++ b/Adapt/nrutil.h
@@ -1,4 +1,3 @@
-/* $Id: nrutil.h,v 1.3 2000-11-26 15:43:44 geuzaine Exp $ */
 #ifndef _NR_UTILS_H_
 #define _NR_UTILS_H_
 
diff --git a/Box/Box.cpp b/Box/Box.cpp
index 60cb94a5a047be133bb04ce3ce98f391aa3e6440..bf71d6dccd07b952a4346cc369a82c84fa5a668a 100644
--- a/Box/Box.cpp
+++ b/Box/Box.cpp
@@ -1,4 +1,4 @@
-/* $Id: Box.cpp,v 1.17 2000-12-21 12:30:34 geuzaine Exp $ */
+// $Id: Box.cpp,v 1.18 2001-01-08 08:05:40 geuzaine Exp $
 
 #include <signal.h>
 
@@ -9,7 +9,8 @@
 #include "Views.h"
 #include "Parser.h"
 #include "Context.h"
-#include "Main.h"
+#include "OpenFile.h"
+#include "GetOptions.h"
 #include "MinMax.h"
 #include "Version.h"
 
@@ -17,53 +18,15 @@
 
 extern List_T *Post_ViewList;
 
-char *TheFileNameTab[MAX_OPEN_FILES];
-char *ThePathForIncludes=NULL, *TheBgmFileName=NULL;
-int   VERBOSE = 0 ;
-
-char gmsh_progname[]  = "This is Gmsh (non-interactive)" ;
-char gmsh_copyright[] = "Copyright (C) 1997-2001 J.-F. Remacle, C. Geuzaine";
-char gmsh_version[]   = "Version          : " ;
-char gmsh_os[]        = "Operating System : " GMSH_OS ;
-char gmsh_date[]      = "Build Date       : " GMSH_DATE ;
-char gmsh_host[]      = "Build Host       : " GMSH_HOST ;
-char gmsh_packager[]  = "Packager         : " GMSH_PACKAGER ;
-char gmsh_url[]       = "URL              : http://www.geuz.org/gmsh/" ;
-char gmsh_email[]     = "E-Mail           : Christophe.Geuzaine@ulg.ac.be\n"
-                        "                   Remacle@scorec.rpi.edu" ;
-char gmsh_help[]      = 
-  "Usage: %s [options] [files]\n"
-  "Geometry options:\n"
-  "  -0                    output flattened parsed geometry and exit\n"
-  "Mesh options:\n"
-  "  -1, -2, -3            perform batch 1D, 2D and 3D mesh generation\n"
-  "  -smooth int           set mesh smoothing (default: 3)\n"
-  "  -degree int           set mesh degree (default: 1)\n"
-  "  -format msh|unv|gref  set output mesh format (default: msh)\n"
-  "  -algo iso|aniso       select mesh algorithm (default: iso)\n"
-  "  -scale float          set global scaling factor (default: 1.0)\n"
-  "  -meshscale float      set mesh scaling factor (default: 1.0)\n"
-  "  -clscale float        set characteristic length scaling factor (default: 1.0)\n"
-  "  -bgm file             load backround mesh from file\n"
-  "Other options:\n"      
-  "  -v                    print debug information\n"
-  "  -path string          set path for included files\n"
-  "  -version              show version number\n"
-  "  -info                 show detailed version information\n"
-  "  -help                 show this message\n"
-  ;
-
-
 /* dummy defs for link purposes */
 
-void ZeroHighlight(Mesh *){}
 void AddViewInUI(int, char *, int){}
 void draw_polygon_2d (double, double, double, int, double *, double *, double *){}
 void set_r(int, double){}
 void Init(void){}
 void Draw(void){}
+void DrawUI(void){}
 void Replot(void){}
-void Get_AnimTime(void){}
 void CreateFile(char *, int){}
 
 /* ------------------------------------------------------------------------ */
@@ -75,7 +38,7 @@ void Info (int level, char *arg0){
   case 0 :
     fprintf(stderr, "%s\n", gmsh_progname);
     fprintf(stderr, "%s\n", gmsh_copyright);
-    fprintf(stderr, gmsh_help, arg0);
+    fprintf(stderr, gmsh_options, arg0);
     exit(1);
   case 1:
     fprintf(stderr, "%.2f\n", GMSH_VERSION);
@@ -94,253 +57,6 @@ void Info (int level, char *arg0){
   }
 }
 
-/* ------------------------------------------------------------------------ */
-/*  p a r s e                                                               */
-/* ------------------------------------------------------------------------ */
-
-void ParseFile(char *f){
-  char String[256];
-
-  strncpy(yyname,f,NAME_STR_L);
-  yyerrorstate=0;
-  yylineno=1;
-
-  if(!(yyin = fopen(yyname,"r"))){
-    Msg(INFO, "File '%s' Does not Exist", f);
-    return;
-  }
-  
-  fpos_t position;
-  fgetpos(yyin, &position);
-  fgets(String, sizeof(String), yyin) ; 
-  fsetpos(yyin, &position);
-
-  if(!strncmp(String, "$PTS", 4) || 
-     !strncmp(String, "$NO", 3) || 
-     !strncmp(String, "$ELM", 4)){
-    if(THEM->status < 0) mai3d(THEM, 0);
-    Read_Mesh(THEM, yyin, FORMAT_MSH);
-  }
-  else if(!strncmp(String, "$PostFormat", 11) ||
-          !strncmp(String, "$View", 5)){
-    Read_View(yyin, yyname);
-  }
-  else{
-    while(!feof(yyin)) yyparse();
-  }
-  fclose(yyin);
-}
-
-
-void MergeProblem(char *name){
-  Msg(INFOS, "Merging %s",name); 
-
-  ParseFile(name);  
-  if (yyerrorstate) return;
-}
-
-void OpenProblem(char *name){
-  char ext[6];
-  
-  InitSymbols();
-  Init_Mesh(&M, 1);
-
-  strncpy(TheFileName,name,NAME_STR_L);
-  strncpy(TheBaseFileName,name,NAME_STR_L);
-
-  strcpy(ext,name+(strlen(name)-4));
-  if(!strcmp(ext,".GEO") || 
-     !strcmp(ext,".geo") || 
-     !strcmp(ext,".msh") || 
-     !strcmp(ext,".pos")){
-    TheBaseFileName[strlen(name)-4] = '\0';
-  }
-  else{
-    strcat(TheFileName,".geo");
-  }
-
-  strncpy(THEM->name, TheBaseFileName,NAME_STR_L);
-
-  Msg(INFOS, "Opening %s", TheFileName); 
-
-  ParseFile(TheFileName);  
-
-  ApplyLcFactor(THEM);
-  mai3d(THEM,0);  
-  Maillage_Dimension_0(&M);
-  ZeroHighlight(&M); 
-  CalculateMinMax(THEM->Points);  
-}
-
-/* ------------------------------------------------------------------------ */
-/*  G e t _ O p t i o n s                                                   */
-/* ------------------------------------------------------------------------ */
-
-void Get_Options (int argc, char *argv[], int *nbfiles) {
-  int i=1;
-
-  if(argc < 2) Info(0,argv[0]);
-
-  TheFileNameTab[0] = "unnamed.geo" ;
-  *nbfiles = 0;
-  
-  while (i < argc) {
-    
-    if (argv[i][0] == '-') {
-      
-      if(!strcmp(argv[i]+1, "0")){ 
-        CTX.interactive = -1; i++;
-      }
-      else if(!strcmp(argv[i]+1, "1")){ 
-        CTX.interactive = 1; i++;
-      }
-      else if(!strcmp(argv[i]+1, "2")){ 
-        CTX.interactive = 2; i++;
-      }
-      else if(!strcmp(argv[i]+1, "3")){ 
-        CTX.interactive = 3; i++;
-      }
-      else if(!strcmp(argv[i]+1, "v")){ 
-        VERBOSE = 1; i++;
-      }
-      else if(!strcmp(argv[i]+1, "path")){ 
-        i++;
-        if(argv[i] != NULL) ThePathForIncludes = argv[i++];
-        else{
-          fprintf(stderr, ERROR_STR "Missing String\n");
-          exit(1);
-        }
-      }
-      else if(!strcmp(argv[i]+1, "bgm")){ 
-        i++;
-        if(argv[i] != NULL) TheBgmFileName = argv[i++];
-        else{
-          fprintf(stderr, ERROR_STR "Missing File Name\n");
-          exit(1);
-        }
-      }
-      else if(!strcmp(argv[i]+1, "smooth")){ 
-        i++;
-        if(argv[i] != NULL) CTX.mesh.nb_smoothing = atoi(argv[i++]);
-        else{
-          fprintf(stderr, ERROR_STR "Missing Number\n");
-          exit(1);
-        }
-      }
-      else if(!strcmp(argv[i]+1, "scale")){
-        i++;
-        if(argv[i] != NULL) CTX.geom.scaling_factor = atof(argv[i++]);
-        else{
-          fprintf(stderr, ERROR_STR "Missing Number\n");
-          exit(1);
-        }
-      }
-      else if(!strcmp(argv[i]+1, "meshscale")){
-        i++;
-        if(argv[i] != NULL) CTX.mesh.scaling_factor = atof(argv[i++]);
-        else{
-          fprintf(stderr, ERROR_STR "Missing Number\n");
-          exit(1);
-        }
-      }
-      else if(!strcmp(argv[i]+1, "clscale")){
-        i++;
-        if(argv[i]!=NULL){
-          CTX.mesh.lc_factor = atof(argv[i++]);
-          if(CTX.mesh.lc_factor <= 0.0){
-            fprintf(stderr, ERROR_STR 
-                    "Characteristic Length Factor Must be > 0\n");
-            exit(1);
-          }
-        }
-        else {    
-          fprintf(stderr, ERROR_STR "Missing Number\n");
-          exit(1);
-        }
-      }
-      else if(!strcmp(argv[i]+1, "degree")){  
-        i++;
-        if(argv[i]!=NULL){
-          CTX.mesh.degree = atoi(argv[i++]);
-          if(CTX.mesh.degree != 1 || CTX.mesh.degree != 2){
-            fprintf(stderr, ERROR_STR "Wrong degree\n");
-            exit(1);
-          }
-        }
-        else {    
-          fprintf(stderr, ERROR_STR "Missing Number\n");
-          exit(1);
-        }
-      }
-      else if(!strcmp(argv[i]+1, "format")){  
-        i++;
-        if(argv[i]!=NULL){
-          if(!strcmp(argv[i],"msh"))
-            CTX.mesh.format = FORMAT_MSH ;
-          else if(!strcmp(argv[i],"unv"))
-            CTX.mesh.format = FORMAT_UNV ;
-          else if(!strcmp(argv[i],"gref"))
-            CTX.mesh.format = FORMAT_GREF ;
-          else{
-            fprintf(stderr, ERROR_STR "Unknown mesh format\n");
-            exit(1);
-          }
-          i++;
-        }
-        else {    
-          fprintf(stderr, ERROR_STR "Missing format\n");
-          exit(1);
-        }
-      }
-      else if(!strcmp(argv[i]+1, "algo")){  
-        i++;
-        if(argv[i]!=NULL){
-          if(!strcmp(argv[i],"iso"))
-            CTX.mesh.algo = DELAUNAY_OLDALGO ;
-          else if(!strcmp(argv[i],"aniso"))
-            CTX.mesh.algo = DELAUNAY_NEWALGO ;
-          else{
-            fprintf(stderr, ERROR_STR "Unknown mesh algorithm\n");
-            exit(1);
-          }
-          i++;
-        }
-        else {    
-          fprintf(stderr, ERROR_STR "Missing algorithm\n");
-          exit(1);
-        }
-      }
-      else if(!strcmp(argv[i]+1, "info")){
-        Info(2,argv[0]); 
-      }
-      else if(!strcmp(argv[i]+1, "version")){
-        Info(1,argv[0]); 
-      }
-      else if(!strcmp(argv[i]+1, "help")){
-        Info(0,argv[0]);
-      }
-      else{
-        fprintf(stderr, WARNING_STR "Unknown option '%s'\n", argv[i]);
-        Info(0,argv[0]);
-      }
-    }
-
-    else {
-      if(*nbfiles < MAX_OPEN_FILES){
-        TheFileNameTab[(*nbfiles)++] = argv[i++]; 
-      }
-      else{
-        fprintf(stderr, ERROR_STR "Too many input files\n");
-        exit(1);
-      }
-    }
-
-  }
-
-  strncpy(TheFileName, TheFileNameTab[0], NAME_STR_L);
-
-}
-
 /* ------------------------------------------------------------------------ */
 /*  m a i n                                                                 */
 /* ------------------------------------------------------------------------ */
@@ -355,7 +71,7 @@ int main(int argc, char *argv[]){
   signal(SIGSEGV, Signal);
   signal(SIGFPE,  Signal); 
 
-  OpenProblem(TheFileName);
+  OpenProblem(CTX.filename);
   if(yyerrorstate)
     exit(1);
   else{
@@ -431,7 +147,7 @@ void Msg(int level, char *fmt, ...){
     break ;
 
   case PARSER_INFO :
-    if(VERBOSE){
+    if(CTX.verbosity == 5){
       fprintf(stderr, PARSER_INFO_STR);
       vfprintf(stderr, fmt, args); fprintf(stderr, "\n");
     }
@@ -442,7 +158,7 @@ void Msg(int level, char *fmt, ...){
   case INFO :
   case SELECT :
   case STATUS :
-    if(VERBOSE){
+    if(CTX.verbosity == 5){
       fprintf(stderr, INFO_STR);
       vfprintf(stderr, fmt, args); fprintf(stderr, "\n");
     }
diff --git a/Box/Makefile b/Box/Makefile
index 1cd7bdb4ceae24e65fb938b7f9dff65afca79ab7..26f0846761f13075ab0793a7a8e829826126911c 100644
--- a/Box/Makefile
+++ b/Box/Makefile
@@ -1,24 +1,22 @@
-# $Id: Makefile,v 1.3 2000-12-29 10:27:00 geuzaine Exp $
+# $Id: Makefile,v 1.4 2001-01-08 08:05:40 geuzaine Exp $
 #
 # Makefile for ".a"
 #
 
 .IGNORE:
 
-CC            = c++
-C_FLAGS       = -g
-
-VERSION_FLAGS = 
-OS_FLAGS      = 
-
+CC       = c++
 RM       = rm
-RMFLAGS  = -f
 RANLIB   = ranlib
-
 LIB      = ../lib/libBox.a
 INCLUDE  = -I../Common -I../DataStr -I../Geo\
-           -I../Graphics -I../Mesh -I../Parser -I../Unix
+           -I../Graphics -I../Mesh -I../Parser -I../Motif -I../Fltk
+
+C_FLAGS       = -g
+OS_FLAGS      = 
+VERSION_FLAGS = 
 
+RMFLAGS  = -f
 CFLAGS   = $(C_FLAGS) $(OS_FLAGS) $(VERSION_FLAGS) $(INCLUDE) 
 
 SRC = Box.cpp
diff --git a/Common/ColorTable.cpp b/Common/ColorTable.cpp
index e75d882381cb7b1d1285fd600b4092117e756b4d..1b48ee6689d9fbcabbb85b7607a281e8f7035069 100644
--- a/Common/ColorTable.cpp
+++ b/Common/ColorTable.cpp
@@ -1,4 +1,4 @@
-/* $Id: ColorTable.cpp,v 1.1 2000-12-08 10:56:36 geuzaine Exp $ */
+// $Id: ColorTable.cpp,v 1.2 2001-01-08 08:05:40 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "ColorTable.h"
diff --git a/Common/ColorTable.h b/Common/ColorTable.h
index 2104760eae966e5ffbc340384cb92686779e52cf..ac8f2cb77af03616eb0f4b8739e887122a3f1198 100644
--- a/Common/ColorTable.h
+++ b/Common/ColorTable.h
@@ -1,4 +1,3 @@
-/* $Id: ColorTable.h,v 1.1 2000-12-08 10:56:36 geuzaine Exp $ */
 #ifndef _COLORTABLE_H_
 #define _COLORTABLE_H_
 
diff --git a/Common/Colors.h b/Common/Colors.h
index 79f3f23682485c1507ada2a8be5c653e1574ffc0..50266ba6bdb66973a0613e23554e170113597f0f 100644
--- a/Common/Colors.h
+++ b/Common/Colors.h
@@ -1,4 +1,3 @@
-/* $Id: Colors.h,v 1.4 2000-12-08 22:17:47 geuzaine Exp $ */
 #ifndef _COLORS_H_
 #define _COLORS_H_
 
diff --git a/Common/Const.h b/Common/Const.h
index 843d71cf3a0b7de8e5ea206f75e7553fd6fbf015..6bcaad118dd492a1cd1e35851792b674168e8099 100644
--- a/Common/Const.h
+++ b/Common/Const.h
@@ -1,4 +1,3 @@
-/* $Id: Const.h,v 1.5 2000-11-26 18:43:48 geuzaine Exp $ */
 #ifndef _CONSTS_H_
 #define _CONSTS_H_
 
diff --git a/Common/Context.cpp b/Common/Context.cpp
index 2b65dc134a7386008061a41937a8ea4143ddaae7..88413e215fec260a8e64be949d4a8e64029abc2d 100644
--- a/Common/Context.cpp
+++ b/Common/Context.cpp
@@ -1,4 +1,4 @@
-/* $Id: Context.cpp,v 1.24 2000-12-22 17:01:37 geuzaine Exp $ */
+// $Id: Context.cpp,v 1.25 2001-01-08 08:05:40 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Const.h"
diff --git a/Common/Context.h b/Common/Context.h
index a32ee1c9bc23f8323e6d88fde40e10cc2ca82184..e35cabfc8a23186152abcdc7dffc18195f914215 100644
--- a/Common/Context.h
+++ b/Common/Context.h
@@ -1,17 +1,16 @@
-/* $Id: Context.h,v 1.25 2000-12-28 18:58:37 geuzaine Exp $ */
 #ifndef _CONTEXT_H_
 #define _CONTEXT_H_
 
-/* 
-   Interface-independant context
- */
+// Interface-independant context 
+
+#include "Const.h"
 
 #define GMSH_INT     1
 #define GMSH_LONG    2
 #define GMSH_FLOAT   3
 #define GMSH_DOUBLE  4
 
-/* How RGBA values are packed and unpacked into/from a 4-byte integer */
+// How RGBA values are packed and unpacked into/from a 4-byte integer 
 
 #  ifdef _LITTLE_ENDIAN
 #    define PACK_COLOR(R,G,B,A)   ( (A)<<24 | (B)<<16 | (G)<<8 | (R) )
@@ -28,12 +27,12 @@
 #  endif
 
 typedef struct{
-  int id;                       /* the current rgbacolors id */
+  int id;                       // the current rgbacolors id 
   
-  /* general colors */
+  // general colors 
   unsigned int bg, fg, text, axes, small_axes;
   
-  /* geometry colors */
+  // geometry colors 
   struct{
     unsigned int point, line, surface, volume;
     unsigned int point_sel, line_sel, surface_sel, volume_sel;
@@ -42,7 +41,7 @@ typedef struct{
   }
   geom;
   
-  /* mesh colors */
+  // mesh colors 
   struct{
     unsigned int vertex, vertex_supp, line, triangle, quadrangle;
     unsigned int tetrahedron, hexahedron, prism, pyramid;
@@ -55,69 +54,75 @@ typedef struct{
 
 class Context_T {
   public :
-  int interactive;            /* 0=full gfx; -1=just parse; 1,2,3=batch mesh */
-  int verbosity;              /* 0=silent -> 3=debug */
-  int expose;                 /* 1 if everything is ready to expose and draw */
 
-  float rot[4][4];            /* current rotation matrix */
-  double r[3];                /* position angles (if succ. rot. along x, y and z) */
-  double t[3], s[3];          /* current translation and scale */
+  char filename[NAME_STR_L];  // the name of the currently opened file
+  char basefilename[NAME_STR_L]; // the same without the extension
+  char *display;              // forced display host:0.0 under X11 
+
+  int interactive;            // 0=full gfx; -1=just parse; 1,2,3=batch mesh 
+  int verbosity;              // 0=silent -> 3=debug 
+  int expose;                 // 1 if everything is ready to expose and draw 
+
+  float rot[4][4];            // current rotation matrix 
+  double r[3];                // position angles (if succ. rot. along x, y and z) 
+  double t[3], s[3];          // current translation and scale 
   int rlock[3], tlock[3], slock[3];
-                              /* locks for r, t and s */
-  float quaternion[4];        /* the actual quaternion used for "trackball" rotating */
-  int useTrackball;           /* do or do not use the trackball for rotations */
-
-  double min[3];              /* x, y and z min for the current geometry */
-  double max[3];              /* x, y and z max for the current geometry */
-  double range[3];            /* maximum range in the three directions */
-  double lc, lc_middle;       /* characteristic lengths for the whole problem, */
-  double lc_order;            /* and never used in mesh generation (->only for geo/post) */
-
-  int db;                     /* double buffer? */
-  int overlay;                /* overlay graphic window? */
-  int stream;                 /* output stream: TO_SCREEN or TO_FILE */
-  int ortho;                  /* orthogonal projection? */
-  int fast;                   /* inhibit mesh and postpro drawing when changing r,s,t */
-  int command_win;            /* command window? */
-  int display_lists;          /* use display lists? */
-  int font_base;              /* display list indice for the font */
-  int axes, small_axes;       /* draw axes? */
-  int threads, threads_lock;  /* threads?, lock (should be a mutex...) */
-  int alpha;                  /* enable alpha blending */
-  int flash;                  /* authorize colormap flashing (beek) */
-  int same_visual;            /* force same visual for GUI and Graphics */
+                              // locks for r, t and s 
+  float quaternion[4];        // the actual quaternion used for "trackball" rotating 
+  int useTrackball;           // do or do not use the trackball for rotations 
+
+  double min[3];              // x, y and z min for the current geometry 
+  double max[3];              // x, y and z max for the current geometry 
+  double range[3];            // maximum range in the three directions 
+  double lc, lc_middle;       // characteristic lengths for the whole problem, 
+  double lc_order;            // and never used in mesh generation (->only for geo/post) 
+
+  int db;                     // double buffer? 
+  int overlay;                // overlay graphic window? 
+  int stream;                 // output stream: TO_SCREEN or TO_FILE 
+  int ortho;                  // orthogonal projection? 
+  int fast;                   // inhibit mesh and postpro drawing when changing r,s,t 
+  int command_win;            // command window? 
+  int display_lists;          // use display lists? 
+  int font_base;              // display list indice for the font 
+  int axes, small_axes;       // draw axes? 
+  int threads, threads_lock;  // threads?, lock (should be a mutex...) 
+  int alpha;                  // enable alpha blending 
+  int flash;                  // authorize colormap flashing (beek) 
+  int same_visual;            // force same visual for GUI and Graphics 
   
-  char *font;                 /* main font */
-  char *fixed_font;           /* font for colorbar */
+  char *font;                 // main font for UI
+  int fontsize;               // font size for UI
+  char *fixed_font;           // font for colorbar 
 
-  /* OpenGL stuff */
-  int viewport[4];            /* current viewport */
+  // OpenGL stuff 
+  int viewport[4];            // current viewport 
   double vxmin, vxmax, vymin, vymax;
-                              /* current viewport in real coordinates */
-  int light[6];               /* status of light */
-  float light_position[6][4]; /* light sources positions */
-  float shine;                /* specular value */
-  int render_mode;            /* GMSH_RENDER, GMSH_SELECT, GMSH_FEEDBACK */
-  int clip[6];                /* status of clip planes */
-  double clip_plane[6][4];    /* clip planes */
+                              // current viewport in real coordinates 
+  int light[6];               // status of light 
+  float light_position[6][4]; // light sources positions 
+  float shine;                // specular value 
+  int render_mode;            // GMSH_RENDER, GMSH_SELECT, GMSH_FEEDBACK 
+  int clip[6];                // status of clip planes 
+  double clip_plane[6][4];    // clip planes 
   double pixel_equiv_x, pixel_equiv_y ; 
-                              /* approximative equivalent model length of a pixel */
+                              // approximative equivalent model length of a pixel 
   
-  rgbacolors color;           /* all colors except postpro colormaps */
+  rgbacolors color;           // all colors except postpro colormaps 
   
-  /* geometry options */
+  // geometry options 
   struct{
     int vis_type;
     int points, lines, surfaces, volumes;
     int points_num, lines_num, surfaces_num, volumes_num;
     int hidden, shade;
     int highlight;
-    int level;
+    int level, old_circle;
     double normals, tangents;
     double scaling_factor;
   } geom;
 
-  /* mesh options */
+  // mesh options 
   struct {
     int vis_type;
     int draw;
@@ -133,14 +138,14 @@ class Context_T {
     double normals, tangents, explode;
   } mesh;
 
-  /* post processing options */
+  // post processing options 
   struct{
     int draw, scales, link ;
     int  initial_visibility, initial_nbiso, initial_intervals ;
     long anim_delay, nb_views ;
   }post;
 
-  /* print options */
+  // print options 
   struct{
     int format;
     int eps_quality;
diff --git a/Common/GetOptions.cpp b/Common/GetOptions.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..03849ed8d64a4e66a0cd364ca2ca5485fd91a428
--- /dev/null
+++ b/Common/GetOptions.cpp
@@ -0,0 +1,386 @@
+// $Id: GetOptions.cpp,v 1.1 2001-01-08 08:08:47 geuzaine Exp $
+#include "Gmsh.h"
+#include "Const.h"
+#include "Context.h"
+#include "Geo.h"
+#include "Mesh.h"
+#include "Views.h"
+#include "Version.h"
+
+extern Context_T  CTX;
+
+char  *TheFileNameTab[MAX_OPEN_FILES];
+char  *TheBgmFileName=NULL;
+char   ThePathForIncludes[NAME_STR_L];
+
+char gmsh_progname[]  = "This is Gmsh" ;
+char gmsh_copyright[] = "Copyright (C) 1997-2001 J.-F. Remacle, C. Geuzaine";
+char gmsh_version[]   = "Version          : " ;
+char gmsh_os[]        = "Operating System : " GMSH_OS ;
+char gmsh_date[]      = "Build Date       : " GMSH_DATE ;
+char gmsh_host[]      = "Build Host       : " GMSH_HOST ;
+char gmsh_packager[]  = "Packager         : " GMSH_PACKAGER ;
+char gmsh_url[]       = "URL              : http://www.geuz.org/gmsh/" ;
+char gmsh_email[]     = "E-Mail           : Christophe.Geuzaine@ulg.ac.be\n"
+                        "                   Remacle@scorec.rpi.edu" ;
+char gmsh_options[]   =
+  "Usage: %s [options] [files]\n"
+  "Geometry options:\n"
+  "  -0                    parse input files, output flattened geometry, and exit\n"
+  "Mesh options:\n"
+  "  -1, -2, -3            perform batch 1D, 2D and 3D mesh generation\n"
+  "  -format msh|unv|gref  set output mesh format (default: msh)\n"
+  "  -algo iso|aniso       select 2D mesh algorithm (default: iso)\n"
+  "  -smooth int           set mesh smoothing (default: 0)\n"
+  "  -degree int           set mesh degree (default: 1)\n"
+  "  -scale float          set global scaling factor (default: 1.0)\n"
+  "  -meshscale float      set mesh scaling factor (default: 1.0)\n"
+  "  -clscale float        set characteristic length scaling factor (default: 1.0)\n"
+  "  -rand float           set random perturbation factor (default: 1.e-5)\n"
+  "  -bgm file             load backround mesh from file\n"
+#ifndef _BLACKBOX
+  "  -interactive          display 2D mesh construction interactively\n"
+  "Post Processing options:\n"
+  "  -dl                   enable display lists\n"
+  "  -noview               hide all views on startup\n"
+  "  -link                 link all views on startup\n"
+  "Display options:\n"    
+  "  -nodb                 disable double buffering\n"
+  "  -noov                 disable overlay visual\n"
+  "  -alpha                enable alpha blending\n"
+  "  -notrack              don't use trackball mode for rotations\n"
+  "  -display string       specify display\n"
+  "  -perspective          set projection mode to perspective\n"
+  "  -flash                allow colormap flashing\n"
+  "  -samevisual           force same visual for graphics and UI\n"
+#endif
+  "Other options:\n"      
+#ifndef _BLACKBOX
+  "  -v int                set verbosity level (default: 2)\n"
+#else
+  "  -v                    be verbose\n"
+#endif
+  "  -nothreads            disable threads\n"
+  "  -path string          set path for included files\n"
+  "  -version              show version number\n"
+  "  -info                 show detailed version information\n"
+  "  -help                 show this message\n"
+  ;
+
+
+void Get_Options (int argc, char *argv[], int *nbfiles) {
+  int i=1;
+
+#ifdef _BLACKBOX
+  void Info (int level, char *arg0);
+  if(argc < 2) Info(0,argv[0]);
+#endif
+
+  TheFileNameTab[0] = "unnamed.geo" ;
+  *nbfiles = 0;
+  
+  while (i < argc) {
+    
+    if (argv[i][0] == '-') {
+      
+      if(!strcmp(argv[i]+1, "0")){ 
+        CTX.interactive = -1; i++;
+      }
+      else if(!strcmp(argv[i]+1, "1")){ 
+        CTX.interactive = 1; i++;
+      }
+      else if(!strcmp(argv[i]+1, "2")){ 
+        CTX.interactive = 2; i++;
+      }
+      else if(!strcmp(argv[i]+1, "3")){ 
+        CTX.interactive = 3; i++;
+      }
+      else if(!strcmp(argv[i]+1, "path")){ 
+        i++;
+        /* we need to make a copy because of bison */
+        if(argv[i] != NULL) 
+          strncpy(ThePathForIncludes, argv[i++], NAME_STR_L) ;
+        else {    
+          fprintf(stderr, ERROR_STR "Missing String\n");
+          exit(1);
+        }
+      }
+      else if(!strcmp(argv[i]+1, "bgm")){ 
+        i++;
+        if(argv[i] != NULL) TheBgmFileName = argv[i++];
+        else {    
+          fprintf(stderr, ERROR_STR "Missing File Name\n");
+          exit(1);
+        }
+      }
+      else if(!strcmp(argv[i]+1, "old")){ 
+        CTX.geom.old_circle = 1; i++;
+      }
+      else if(!strcmp(argv[i]+1, "quality")){
+        i++;
+        if(argv[i]!=NULL) CTX.mesh.quality = atof(argv[i++]);
+        else {    
+          fprintf(stderr, ERROR_STR "Missing Number\n");
+          exit(1);
+        }
+      }
+      else if(!strcmp(argv[i]+1, "scale")){
+        i++;
+        if(argv[i]!=NULL) CTX.geom.scaling_factor = atof(argv[i++]);
+        else {    
+          fprintf(stderr, ERROR_STR "Missing Number\n");
+          exit(1);
+        }
+      }
+      else if(!strcmp(argv[i]+1, "meshscale")){
+        i++;
+        if(argv[i]!=NULL) CTX.mesh.scaling_factor = atof(argv[i++]);
+        else {    
+          fprintf(stderr, ERROR_STR "Missing Number\n");
+          exit(1);
+        }
+      }
+      else if(!strcmp(argv[i]+1, "rand")){
+        i++;
+        if(argv[i]!=NULL) CTX.mesh.rand_factor = atof(argv[i++]);
+        else {    
+          fprintf(stderr, ERROR_STR "Missing Number\n");
+          exit(1);
+        }
+      }
+      else if(!strcmp(argv[i]+1, "clscale")){
+        i++;
+        if(argv[i]!=NULL){
+          CTX.mesh.lc_factor = atof(argv[i++]);
+          if(CTX.mesh.lc_factor <= 0.0){
+            fprintf(stderr, ERROR_STR 
+                    "Characteristic Length Factor Must be > 0\n");
+            exit(1);
+          }
+        }
+        else {    
+          fprintf(stderr, ERROR_STR "Missing Number\n");
+          exit(1);
+        }
+      }
+      else if(!strcmp(argv[i]+1, "smooth")){ 
+        i++;
+        if(argv[i]!=NULL) CTX.mesh.nb_smoothing = atoi(argv[i++]);
+        else{
+          fprintf(stderr, ERROR_STR "Missing Number\n");
+          exit(1);
+        }
+      }
+      else if(!strcmp(argv[i]+1, "degree")){  
+        i++;
+        if(argv[i]!=NULL){
+          CTX.mesh.degree = atoi(argv[i++]);
+          if(CTX.mesh.degree != 1 || CTX.mesh.degree != 2){
+            fprintf(stderr, ERROR_STR "Wrong Degree\n");
+            exit(1);
+          }
+        }
+        else {    
+          fprintf(stderr, ERROR_STR "Missing Number\n");
+          exit(1);
+        }
+      }
+      else if(!strcmp(argv[i]+1, "format") ||  
+              !strcmp(argv[i]+1, "f")){  
+        i++;
+        if(argv[i]!=NULL){
+          if(!strcmp(argv[i],"msh") || 
+             !strcmp(argv[i],"MSH") || 
+             !strcmp(argv[i],"gmsh")){
+            CTX.mesh.format = FORMAT_MSH ;
+          }
+          else if(!strcmp(argv[i],"unv") ||
+                  !strcmp(argv[i],"UNV") || 
+                  !strcmp(argv[i],"ideas")){
+            CTX.mesh.format = FORMAT_UNV ;
+          }
+          else if(!strcmp(argv[i],"gref") ||
+                  !strcmp(argv[i],"GREF") || 
+                  !strcmp(argv[i],"Gref")){
+            CTX.mesh.format = FORMAT_GREF ;
+          }
+          else{
+            fprintf(stderr, ERROR_STR "Unknown Mesh Format\n");
+            exit(1);
+          }
+          i++;
+        }
+        else {    
+          fprintf(stderr, ERROR_STR "Missing Format\n");
+          exit(1);
+        }
+      }
+      else if(!strcmp(argv[i]+1, "algo")){  
+        i++;
+        if(argv[i]!=NULL){
+          if(!strcmp(argv[i],"iso"))
+            CTX.mesh.algo = DELAUNAY_OLDALGO ;
+          else if(!strcmp(argv[i],"aniso"))
+            CTX.mesh.algo = DELAUNAY_NEWALGO ;
+          else{
+            fprintf(stderr, ERROR_STR "Unknown Mesh Algorithm\n");
+            exit(1);
+          }
+          i++;
+        }
+        else {    
+          fprintf(stderr, ERROR_STR "Missing Algorithm\n");
+          exit(1);
+        }
+      }
+      else if(!strcmp(argv[i]+1, "version") || 
+              !strcmp(argv[i]+1, "-version")){
+        fprintf(stderr, "%.2f\n", GMSH_VERSION);
+        exit(1);
+      }
+      else if(!strcmp(argv[i]+1, "info") || 
+              !strcmp(argv[i]+1, "-info")){
+        fprintf(stderr, "%s%.2f\n", gmsh_version, GMSH_VERSION);
+        fprintf(stderr, "%s\n", gmsh_os);
+        fprintf(stderr, "%s\n", gmsh_date);
+        fprintf(stderr, "%s\n", gmsh_host);
+        fprintf(stderr, "%s\n", gmsh_packager);
+        fprintf(stderr, "%s\n", gmsh_url);
+        fprintf(stderr, "%s\n", gmsh_email);
+        exit(1) ; 
+      }
+      else if(!strcmp(argv[i]+1, "help") || 
+              !strcmp(argv[i]+1, "-help")){
+        fprintf(stderr, "%s\n", gmsh_progname);
+        fprintf(stderr, "%s\n", gmsh_copyright);
+        fprintf(stderr, gmsh_options, argv[0]);
+        exit(1);
+      }
+
+
+#ifdef _BLACKBOX
+      else if(!strcmp(argv[i]+1, "v")){ 
+        CTX.verbosity = 5; i++;
+      }
+#else
+      else if(!strcmp(argv[i]+1, "v")){  
+        i++;
+        if(argv[i]!=NULL) CTX.verbosity = atoi(argv[i++]);
+        else {    
+          fprintf(stderr, ERROR_STR "Missing Number\n");
+          exit(1);
+        }
+      }
+      else if(!strcmp(argv[i]+1, "alpha")){ 
+        CTX.alpha = 1; i++;
+      }
+      else if(!strcmp(argv[i]+1, "notrack")){ 
+        CTX.useTrackball = 0; i++;
+      }
+      else if(!strcmp(argv[i]+1, "flash")){ 
+        CTX.flash = 1; i++;
+      }
+      else if(!strcmp(argv[i]+1, "dual")){ 
+        CTX.mesh.dual = 1; i++;
+      }
+      else if(!strcmp(argv[i]+1, "samevisual")){ 
+        CTX.same_visual = 1; i++;
+      }
+      else if(!strcmp(argv[i]+1, "interactive")){ 
+        CTX.mesh.interactive = 1; i++;
+      }
+      else if(!strcmp(argv[i]+1, "noview")){ 
+        CTX.post.initial_visibility = 0 ; i++;
+      }
+      else if(!strcmp(argv[i]+1, "link")){ 
+        CTX.post.link = 2 ; i++;
+      }
+      else if(!strcmp(argv[i]+1, "fill")){ 
+        CTX.post.initial_intervals = DRAW_POST_CONTINUOUS ; i++;
+      }
+      else if(!strcmp(argv[i]+1, "nbiso")){ 
+        i++ ;
+        if(argv[i]!=NULL) CTX.post.initial_nbiso = atoi(argv[i++]);
+        else{
+          fprintf(stderr, ERROR_STR "Missing Number\n");
+          exit(1);
+        }
+      }
+      else if(!strcmp(argv[i]+1, "command") || 
+              !strcmp(argv[i]+1, "c")){ 
+        CTX.command_win = 1; i++;
+      }
+      else if(!strcmp(argv[i]+1, "nocommand") ||
+              !strcmp(argv[i]+1, "noc")){ 
+        CTX.command_win = 0; i++;
+      }
+      else if(!strcmp(argv[i]+1, "overlay") ||
+              !strcmp(argv[i]+1, "ov")){ 
+        CTX.overlay = 1; i++;
+      }
+      else if(!strcmp(argv[i]+1, "nooverlay") ||
+              !strcmp(argv[i]+1, "noov")){ 
+        CTX.overlay = CTX.geom.highlight = 0; i++;
+      }
+      else if(!strcmp(argv[i]+1, "perspective") ||
+              !strcmp(argv[i]+1, "p")){ 
+        CTX.ortho = 0; i++;
+      }
+      else if(!strcmp(argv[i]+1, "ortho") ||
+              !strcmp(argv[i]+1, "o")){ 
+        CTX.ortho = 0; i++;
+      }
+      else if(!strcmp(argv[i]+1, "threads")){
+        CTX.threads = 1; i++;
+      }
+      else if(!strcmp(argv[i]+1, "nothreads")){
+        CTX.threads = 0; i++;
+      }
+      else if(!strcmp(argv[i]+1, "db")){ 
+        CTX.db = 1; i++;
+      }
+      else if(!strcmp(argv[i]+1, "nodb")){ 
+        CTX.db = 0; CTX.geom.highlight = 0; i++;
+      }
+      else if(!strcmp(argv[i]+1, "dl")){ 
+        CTX.display_lists = 1; i++;
+      }
+      else if(!strcmp(argv[i]+1, "nodl")){ 
+        CTX.display_lists = 0; i++;
+      }
+      else if(!strcmp(argv[i]+1, "display")){
+        i++;
+        if(argv[i]!=NULL){
+	  CTX.display = argv[i];
+          i++;
+	}
+        else {    
+          fprintf(stderr, ERROR_STR "Missing Argument\n");
+          exit(1);
+        }
+      }
+#endif // _BLACKBOX
+
+
+      else{
+        fprintf(stderr, "Unknown Option '%s'\n", argv[i]);
+        fprintf(stderr, gmsh_options, argv[0]);
+        exit(1);
+      }
+    }
+
+    else {
+      if(*nbfiles < MAX_OPEN_FILES)
+        TheFileNameTab[(*nbfiles)++] = argv[i++]; 
+      else{
+        fprintf(stderr, ERROR_STR "Too Many Input Files\n");
+        exit(1);
+      }
+    }
+
+  }
+
+  strncpy(CTX.filename, TheFileNameTab[0], NAME_STR_L);
+
+}
+
diff --git a/Common/GetOptions.h b/Common/GetOptions.h
new file mode 100644
index 0000000000000000000000000000000000000000..fee547c223445c168498c4ab33978a4ba8b78d10
--- /dev/null
+++ b/Common/GetOptions.h
@@ -0,0 +1,13 @@
+#ifndef _GET_OPTIONS_H_
+#define _GET_OPTIONS_H_
+
+extern char gmsh_progname[], gmsh_copyright[], gmsh_version[], gmsh_os[];
+extern char gmsh_date[], gmsh_host[], gmsh_packager[], gmsh_url[];
+extern char gmsh_email[], gmsh_options[];
+
+extern char *TheFileNameTab[MAX_OPEN_FILES], *TheBgmFileName;
+extern char  ThePathForIncludes[NAME_STR_L];
+
+void Get_Options (int argc, char *argv[], int *nbfiles);
+
+#endif
diff --git a/Common/Gmsh.h b/Common/Gmsh.h
index 05c45194ae776b4d35740aa435e5c85e9bdb741b..ec3acf0e79846a2501a75cc417c0cde558033e2e 100644
--- a/Common/Gmsh.h
+++ b/Common/Gmsh.h
@@ -1,4 +1,3 @@
-/* $Id: Gmsh.h,v 1.3 2000-11-23 17:16:37 geuzaine Exp $ */
 #ifndef _GMSH_H_
 #define _GMSH_H_
 
diff --git a/Common/GmshUI.h b/Common/GmshUI.h
index a01dc3791a91789ceb021b6c25fd9851045ec78d..6bc92ed977b2c6fa8893858542c15908f68f41d7 100644
--- a/Common/GmshUI.h
+++ b/Common/GmshUI.h
@@ -1,6 +1,7 @@
-/* $Id: GmshUI.h,v 1.4 2000-12-29 10:27:00 geuzaine Exp $ */
+#ifndef _GMSH_UI_H_
+#define _GMSH_UI_H_
 
-#if defined(_XMOTIF) /* UNIX with X and Motif */
+#if _XMOTIF // X11 Motif for Unix
 
 #include <X11/keysym.h>
 #include <Xm/XmAll.h>
@@ -9,19 +10,12 @@
 #include <GL/glx.h>
 #include <GLwMDrawA.h>
 
-#elif defined(_FLTK) /* FLTK widget set */
+#elif _FLTK // FLTK for both Unix and Windows
 
-#error "Not ready yet for FLTK..."
-
-#elif defined(_WINDOWS) /* Pure Windows */
-
-#include<windows.h>
+#include <FL/Fl.H>
 #include <GL/gl.h>
 #include <GL/glu.h>
-extern "C"{
-#include <GL/glaux.h>
-}
 
-#else
+#endif
 
 #endif
diff --git a/Common/Makefile b/Common/Makefile
index 2369fa1891f01055e01c97948f7641096d3accfa..7e933a521987f4a338418c59466b580e29c25d50 100644
--- a/Common/Makefile
+++ b/Common/Makefile
@@ -1,27 +1,34 @@
-# $Id: Makefile,v 1.7 2000-12-29 10:27:00 geuzaine Exp $
+# $Id: Makefile,v 1.8 2001-01-08 08:05:40 geuzaine Exp $
 #
 # Makefile for "libCommon.a"
 #
 
 .IGNORE:
 
-CC        = c++
-C_FLAGS   = -g -Wall
+CC      = c++
+RANLIB  = ranlib
+RM      = rm
 
-OS_FLAGS  = -D_XMOTIF
+LIB     = ../lib/libCommon.a
+INCLUDE = -I../includes -I../Common -I../DataStr -I../Geo -I../Graphics\
+          -I../Mesh -I../Parser -I../Motif -I../Fltk
 
-RANLIB   = ranlib
-RM       = rm
-RMFLAGS  = -f
+C_FLAGS       = -g -Wall
+OS_FLAGS      = -D_LITTLE_ENDIAN
+VERSION_FLAGS = 
 
-LIB      = ../lib/libCommon.a
-INCLUDE  = -I../includes -I../Common -I../DataStr -I../Geo -I../Graphics\
-           -I../Mesh -I../Parser -I../Unix
+GL_INCLUDE    = -I$(HOME)/SOURCES/Mesa-3.1/include\
+                -I$(HOME)/SOURCES/Mesa-3.1/include/GL
+GUI_INCLUDE   = -I/usr/X11R6/LessTif/Motif1.2/include
 
-CFLAGS = $(C_FLAGS) $(OS_FLAGS) $(INCLUDE) $(GL_INCLUDE)
+RMFLAGS = -f
+CFLAGS  = $(C_FLAGS) $(OS_FLAGS) $(VERSION_FLAGS) $(INCLUDE)\
+          $(GL_INCLUDE) $(GUI_INCLUDE)
 
 SRC =  	Context.cpp\
         Views.cpp\
+        GetOptions.cpp\
+        Timer.cpp\
         ColorTable.cpp
 
 OBJ = $(SRC:.cpp=.o)
@@ -59,6 +66,12 @@ Context.o: Context.cpp Gmsh.h Message.h ../DataStr/Malloc.h \
 Views.o: Views.cpp Gmsh.h Message.h ../DataStr/Malloc.h ../DataStr/List.h \
   ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h Views.h Const.h \
   ColorTable.h Context.h
+GetOptions.o: GetOptions.cpp Gmsh.h Message.h ../DataStr/Malloc.h \
+  ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \
+  Const.h Context.h ../Geo/Geo.h ../Mesh/Mesh.h ../Mesh/Vertex.h \
+  ../Mesh/Simplex.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h \
+  ../Mesh/Metric.h Views.h ColorTable.h Version.h
+Timer.o: Timer.cpp
 ColorTable.o: ColorTable.cpp Gmsh.h Message.h ../DataStr/Malloc.h \
   ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \
-  ColorTable.h Context.h
+  ColorTable.h Context.h Const.h
diff --git a/Common/Message.h b/Common/Message.h
index 7539e141cc948683adcba456877376df00424604..6c840af6598dc02bfe396c3ba9555a6db344aa03 100644
--- a/Common/Message.h
+++ b/Common/Message.h
@@ -1,4 +1,3 @@
-/* $Id: Message.h,v 1.5 2000-11-24 08:04:14 geuzaine Exp $ */
 #ifndef _MESSAGE_H_
 #define _MESSAGE_H_
 
diff --git a/Common/Options.h b/Common/Options.h
index ad6fc7502c3d91164437d46d631780147a461e2f..70248d0bbefbc408d8fef548e004bb8fa6f63754 100644
--- a/Common/Options.h
+++ b/Common/Options.h
@@ -1,4 +1,3 @@
-/* $Id: Options.h,v 1.16 2001-01-01 14:57:35 geuzaine Exp $ */
 #ifndef _OPTIONS_H_
 #define _OPTIONS_H_
 
@@ -14,6 +13,7 @@ extern Context_T   CTX ;
 // STRINGS
 
 StringXString GeneralOptions_String[] = {
+  { "Display" , &CTX.display , "" },
   { NULL , NULL , NULL }
 } ;
 
@@ -41,6 +41,7 @@ StringXNumber GeneralOptions_Number[] = {
   { "Viewport1"    , GMSH_INT,    (void*)&CTX.viewport[1]    , 0. }, 
   { "Viewport2"    , GMSH_INT,    (void*)&CTX.viewport[2]    , 1. }, 
   { "Viewport3"    , GMSH_INT,    (void*)&CTX.viewport[3]    , 1. }, 
+  { "FontSize"     , GMSH_INT,    (void*)&CTX.fontsize      , 12. }, 
   { "Rotation0"    , GMSH_DOUBLE, (void*)&CTX.r[0]          , 0.0 }, 
   { "Rotation1"    , GMSH_DOUBLE, (void*)&CTX.r[1]          , 0.0 }, 
   { "Rotation2"    , GMSH_DOUBLE, (void*)&CTX.r[2]          , 0.0 }, 
@@ -146,6 +147,7 @@ StringXNumber GeometryOptions_Number[] = {
   { "HiddenLines"     , GMSH_INT,    (void*)&CTX.geom.hidden       , 0. }, 
   { "Shading"         , GMSH_INT,    (void*)&CTX.geom.shade        , 0. }, 
   { "Highlight"       , GMSH_INT,    (void*)&CTX.geom.highlight    , 1. }, 
+  { "OldCircle"       , GMSH_INT,    (void*)&CTX.geom.old_circle   , 0. }, 
   { "ScalingFactor"   , GMSH_DOUBLE, (void*)&CTX.geom.scaling_factor , 1.0 }, 
   { NULL              , GMSH_DOUBLE, NULL , 0. }
 } ;
diff --git a/Common/Static.h b/Common/Static.h
index e0d0af1023b0ea12653c6471619fcd89003bfb6c..dc8584b073e0479484a859b9a8085a77acc29604 100644
--- a/Common/Static.h
+++ b/Common/Static.h
@@ -1,11 +1,9 @@
-/* $Id: Static.h,v 1.6 2000-11-26 15:43:44 geuzaine Exp $ */
 #ifndef _STATIC_H_
 #define _STATIC_H_
 
 /* This file defines the static structures for Gmsh. It should be
    included only once, in your 'main' file */
 
-char        TheFileName[NAME_STR_L], TheBaseFileName[NAME_STR_L];
 char        yyname[NAME_STR_L];
 int         yyerrorstate;
 
@@ -15,6 +13,5 @@ Context_T   CTX ;
 Mesh        M, *THEM, *LOCAL;
 
 Tree_T     *EntitesVisibles = NULL;
-int         FLAG_OLD_CIRCLE = 0 ; /* Pour David : cercles > Pi */
 
 #endif
diff --git a/Common/Timer.cpp b/Common/Timer.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..f1794a0e2fc6b642ca95b8472245274230342eab
--- /dev/null
+++ b/Common/Timer.cpp
@@ -0,0 +1,9 @@
+#include <sys/time.h>
+#include <unistd.h>
+
+long GetTime(){
+  struct timeval tp;
+  gettimeofday(&tp, (struct timezone *) 0);
+  return (long)tp.tv_sec * 1000000 + (long)tp.tv_usec;
+}
+
diff --git a/Common/Timer.h b/Common/Timer.h
new file mode 100644
index 0000000000000000000000000000000000000000..a5103b0f2e7c751128a59ff81d7b5c025c031f69
--- /dev/null
+++ b/Common/Timer.h
@@ -0,0 +1,6 @@
+#ifndef _TIMER_H_
+#define _TIMER_H_
+
+long GetTime();
+
+#endif
diff --git a/Common/Views.cpp b/Common/Views.cpp
index 8d1779c26ad52dc47ed2583b6333c1be0596facf..03e9ad84e27546d89ca0280124f053826a53e3bf 100644
--- a/Common/Views.cpp
+++ b/Common/Views.cpp
@@ -1,4 +1,4 @@
-/* $Id: Views.cpp,v 1.20 2000-12-26 20:45:42 geuzaine Exp $ */
+// $Id: Views.cpp,v 1.21 2001-01-08 08:05:40 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Views.h"
diff --git a/Common/Views.h b/Common/Views.h
index 28291b1b1b9b5c8ab91135034a1eaefc6807f7d5..9426516c93cce29aa8431fb2ea401448ae9ff1bd 100644
--- a/Common/Views.h
+++ b/Common/Views.h
@@ -1,4 +1,3 @@
-/* $Id: Views.h,v 1.15 2000-12-26 20:45:42 geuzaine Exp $ */
 #ifndef _VIEWS_H_
 #define _VIEWS_H_
 
diff --git a/DataStr/List.cpp b/DataStr/List.cpp
index 2dc3d5915ccfd12dbe0e7beae1be9b70aef4280f..05737f288a10ea24afa3eb8c004c5e6ad43efc65 100644
--- a/DataStr/List.cpp
+++ b/DataStr/List.cpp
@@ -1,4 +1,4 @@
-/* $Id: List.cpp,v 1.11 2000-12-26 20:45:42 geuzaine Exp $ */
+// $Id: List.cpp,v 1.12 2001-01-08 08:05:40 geuzaine Exp $
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -137,7 +137,7 @@ void *List_Pointer(List_T *liste, int index)
   if ((index < 0) || (index >= liste->n))
     Msg(FATAL, "Wrong List Index in List_Pointer");
     
-  liste->isorder = 0; /* getdp: a examiner... */
+  liste->isorder = 0;
   return(&liste->array[index * liste->size]);
 }
 
@@ -159,7 +159,7 @@ void *List_Pointer_Test(List_T *liste, int index)
   if ((index < 0) || (index >= liste->n))
     return NULL;
     
-  liste->isorder = 0; /* getdp: a examiner... */
+  liste->isorder = 0;
   return(&liste->array[index * liste->size]);
 }
 
diff --git a/DataStr/List.h b/DataStr/List.h
index 9397e43d0c4425a34558c5306760857b3443882b..50e58b3bbfeaf465cbed8d0cc853cf4cf0d8ee05 100644
--- a/DataStr/List.h
+++ b/DataStr/List.h
@@ -1,4 +1,3 @@
-/* $Id: List.h,v 1.7 2000-12-11 16:22:43 geuzaine Exp $ */
 #ifndef _LIST_H_
 #define _LIST_H_
 
diff --git a/DataStr/Makefile b/DataStr/Makefile
index 648437878161fb1875aa2cef0b756c04560af801..8bcc52a90385c01fe65a07c0f7a2c102505a1727 100644
--- a/DataStr/Makefile
+++ b/DataStr/Makefile
@@ -1,21 +1,22 @@
-# $Id: Makefile,v 1.3 2000-11-25 15:26:10 geuzaine Exp $
+# $Id: Makefile,v 1.4 2001-01-08 08:05:40 geuzaine Exp $
 #
-# Makefile for "libSataStr.a"
+# Makefile for "libDataStr.a"
 #
 
 .IGNORE:
 
-CC        = c++
-C_FLAGS   = -g -Wall
-
+CC       = c++
 RM       = rm
-RMFLAGS  = -f
 RANLIB   = ranlib
-
 LIB      = ../lib/libDataStr.a
 INCLUDE  = -I../Common
 
-CFLAGS = $(C_FLAGS) $(OS_FLAGS) $(INCLUDE)
+C_FLAGS       = -g -Wall
+OS_FLAGS      = 
+VERSION_FLAGS = 
+
+RMFLAGS  = -f
+CFLAGS   = $(C_FLAGS) $(OS_FLAGS) $(VERSION_FLAGS) $(INCLUDE)
 
 SRC = List.cpp \
       Malloc.cpp \
diff --git a/DataStr/Malloc.cpp b/DataStr/Malloc.cpp
index 316b2d924e84d87c81838c7fba3db86d266bc5e3..5e1a32a0e735f1714363f00c0e1967ecc8c717fd 100644
--- a/DataStr/Malloc.cpp
+++ b/DataStr/Malloc.cpp
@@ -1,4 +1,4 @@
-/* $Id: Malloc.cpp,v 1.5 2000-12-28 18:58:37 geuzaine Exp $ */
+// $Id: Malloc.cpp,v 1.6 2001-01-08 08:05:40 geuzaine Exp $
 #include <stdio.h>
 #include <stdlib.h>
 #include <malloc.h>
diff --git a/DataStr/Malloc.h b/DataStr/Malloc.h
index 3dd52fa35fcd4ca351b876fc87225bbc7351ad90..aeabacae095d830c7d46d9507cdb45f9a6404339 100644
--- a/DataStr/Malloc.h
+++ b/DataStr/Malloc.h
@@ -1,9 +1,5 @@
-/* $Id: Malloc.h,v 1.3 2000-11-26 18:43:48 geuzaine Exp $ */
-#ifndef _UALLOC_H_
-#define _UALLOC_H_
-
-/* #define size_t unsigned   */
-/* #define NULL ((char *) 0) */
+#ifndef _MALLOC_H_
+#define _MALLOC_H_
 
 void *Malloc(size_t size);
 void *Calloc(size_t num, size_t size);
diff --git a/DataStr/Tools.cpp b/DataStr/Tools.cpp
index a136409e50d32fc130618a746e88be9a64f2c4b2..f8a24c72a456a08518327bf1ba35ab883cbba0f2 100644
--- a/DataStr/Tools.cpp
+++ b/DataStr/Tools.cpp
@@ -1,10 +1,10 @@
-/* $Id: Tools.cpp,v 1.3 2000-11-26 18:43:48 geuzaine Exp $ */
+// $Id: Tools.cpp,v 1.4 2001-01-08 08:05:41 geuzaine Exp $
 
 #include <stdlib.h>
 #include <math.h>
 #include "Tools.h"
 
-/* Comparison functions */
+// Comparison functions
 
 int fcmp_int(const void *a, const void *b){
   return(*(int*)a - *(int*)b );
@@ -23,7 +23,7 @@ int fcmp_double(const void *a, const void *b){
   else                    return  0 ;
 }
 
-/* Tree ==> List transfer */
+// Tree ==> List transfer
 
 List_T *pListeTransfert;
 
@@ -38,7 +38,7 @@ List_T *Tree2List(Tree_T *pTree){
   return(pListeTransfert);
 }
 
-/* Algebraic utilities */
+// Algebraic utilities
 
 Tree_T *pTreeTransfert;
 Tree_T *pTreeTransfert2;
diff --git a/DataStr/Tools.h b/DataStr/Tools.h
index 77a58430d9f9e3abdc813b9f0f1821cc4c09d073..cb5f57b839e68bb8a6a90b810b7bff1557de527e 100644
--- a/DataStr/Tools.h
+++ b/DataStr/Tools.h
@@ -1,4 +1,3 @@
-/* $Id: Tools.h,v 1.3 2000-11-26 18:43:48 geuzaine Exp $ */
 #ifndef _TOOLS_H_
 #define _TOOLS_H_
 
diff --git a/DataStr/Tree.cpp b/DataStr/Tree.cpp
index c2178ebc7785f72fd4829f3e5ed5a565ead53f80..e36eccc5d849318e1de6295d71b47e9feb4e30aa 100644
--- a/DataStr/Tree.cpp
+++ b/DataStr/Tree.cpp
@@ -1,4 +1,4 @@
-/* $Id: Tree.cpp,v 1.4 2000-11-26 18:43:48 geuzaine Exp $ */
+// $Id: Tree.cpp,v 1.5 2001-01-08 08:05:41 geuzaine Exp $
 
 #include <stdlib.h>
 #include <string.h>
diff --git a/DataStr/Tree.h b/DataStr/Tree.h
index 2d37b8c3056db39311e2cccfd7758a07f7600e7a..85be99ed569c2945c825e957ff8c636e41baf316 100644
--- a/DataStr/Tree.h
+++ b/DataStr/Tree.h
@@ -1,4 +1,3 @@
-/* $Id: Tree.h,v 1.3 2000-11-26 18:43:48 geuzaine Exp $ */
 #ifndef _TREE_H_
 #define _TREE_H_
 
diff --git a/DataStr/avl.cpp b/DataStr/avl.cpp
index 8c3808af9041891175e138e7ffa8e5d26d313a17..c10d4b2ce9c07c1854749b64ec06e76b350e7f46 100644
--- a/DataStr/avl.cpp
+++ b/DataStr/avl.cpp
@@ -1,4 +1,4 @@
-/* $Id: avl.cpp,v 1.4 2000-11-26 18:43:48 geuzaine Exp $ */
+// $Id: avl.cpp,v 1.5 2001-01-08 08:05:41 geuzaine Exp $
 
 /*
  * This is a modified version for Gmsh (for c++, 64-bit architectures, etc.)
diff --git a/DataStr/avl.h b/DataStr/avl.h
index 3dd3f84ef3d36531f906d1491959aa307562ece2..6ff601f6bb7fb4cea7d69d966df95b01315355d9 100644
--- a/DataStr/avl.h
+++ b/DataStr/avl.h
@@ -1,4 +1,3 @@
-/* $Id: avl.h,v 1.4 2000-11-26 18:43:48 geuzaine Exp $ */
 #ifndef _AVL_H_
 #define _AVL_H_
 
diff --git a/Geo/CAD.cpp b/Geo/CAD.cpp
index eb917e62ddcb54c4322afde23c6d9649c0606816..ad7080c836eb7cf35d29a884db3a76a1fc81c19d 100644
--- a/Geo/CAD.cpp
+++ b/Geo/CAD.cpp
@@ -1,4 +1,4 @@
-/* $Id: CAD.cpp,v 1.12 2000-12-18 14:18:04 geuzaine Exp $ */
+// $Id: CAD.cpp,v 1.13 2001-01-08 08:05:42 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Geo.h"
diff --git a/Geo/CAD.h b/Geo/CAD.h
index 8a73149626df826275f521d87309e2b8f48d9da9..a8885c56e3b3afb378e121fc10c17be08bc52344 100644
--- a/Geo/CAD.h
+++ b/Geo/CAD.h
@@ -1,4 +1,3 @@
-/* $Id: CAD.h,v 1.5 2000-12-13 22:27:45 geuzaine Exp $ */
 #ifndef _CAD_H_
 #define _CAD_H_
 
diff --git a/Geo/DataBase.cpp b/Geo/DataBase.cpp
index 7093f0321df5f5f982e22682e7ae9890cfa58a51..c6d66e8a27ecd2a546268744d447abdf1a1b53ad 100644
--- a/Geo/DataBase.cpp
+++ b/Geo/DataBase.cpp
@@ -1,4 +1,4 @@
-/* $Id: DataBase.cpp,v 1.6 2000-12-21 12:30:37 geuzaine Exp $ */
+// $Id: DataBase.cpp,v 1.7 2001-01-08 08:05:42 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Const.h"
diff --git a/Geo/DataBase.h b/Geo/DataBase.h
index 13ebd80206301773ae535ac0b5c85ed0dd191b7e..2b4099027fd425e100dbd2c6a8fd06fc6cb0812d 100644
--- a/Geo/DataBase.h
+++ b/Geo/DataBase.h
@@ -1,4 +1,3 @@
-/* $Id: DataBase.h,v 1.3 2000-11-26 15:43:45 geuzaine Exp $ */
 #ifndef _DATABASE_H_
 #define _DATABASE_H_
 
diff --git a/Geo/ExtrudeParams.cpp b/Geo/ExtrudeParams.cpp
index 24d2eaf5be0b00d1a129f0e2a60dab1571d5e930..a3404cab8e48565aa3ab1de2e6d4541a6bd724d6 100644
--- a/Geo/ExtrudeParams.cpp
+++ b/Geo/ExtrudeParams.cpp
@@ -1,4 +1,4 @@
-/* $Id: ExtrudeParams.cpp,v 1.3 2000-11-23 14:11:30 geuzaine Exp $ */
+// $Id: ExtrudeParams.cpp,v 1.4 2001-01-08 08:05:42 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Geo.h"
diff --git a/Geo/ExtrudeParams.h b/Geo/ExtrudeParams.h
index 5ad56228a0278d909cbe37f89ec8bb9d583b2283..faabfcf88ccf8c4d38da34a5c1195957c9c024f3 100644
--- a/Geo/ExtrudeParams.h
+++ b/Geo/ExtrudeParams.h
@@ -1,4 +1,3 @@
-/* $Id: ExtrudeParams.h,v 1.4 2000-11-26 15:43:45 geuzaine Exp $ */
 #ifndef _EXTRUDE_PARAMS_H_
 #define _EXTRUDE_PARAMS_H_
 
diff --git a/Geo/Geo.cpp b/Geo/Geo.cpp
index 29df7a2d25f13ae509525b59696c85690bc2d4a0..50905a371e2eb325fdbd32c48f1a58d23cdcb623 100644
--- a/Geo/Geo.cpp
+++ b/Geo/Geo.cpp
@@ -1,4 +1,4 @@
-/* $Id: Geo.cpp,v 1.11 2000-12-13 13:56:58 geuzaine Exp $ */
+// $Id: Geo.cpp,v 1.12 2001-01-08 08:05:42 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Const.h"
diff --git a/Geo/Geo.h b/Geo/Geo.h
index 2e76dbccccb327f49fad7204928aa8fa567ec5d0..399041339cef48135bf8019d36face1a78ec8392 100644
--- a/Geo/Geo.h
+++ b/Geo/Geo.h
@@ -1,4 +1,3 @@
-/* $Id: Geo.h,v 1.5 2000-12-13 13:56:58 geuzaine Exp $ */
 #ifndef _GEO_H_
 #define _GEO_H_
 
diff --git a/Geo/Makefile b/Geo/Makefile
index 39e2a0b93360f8d24fa53415624aa9faa367eb38..643cbc9f2c3fd012e511d1a0cd936d61b25060d7 100644
--- a/Geo/Makefile
+++ b/Geo/Makefile
@@ -1,23 +1,24 @@
-# $Id: Makefile,v 1.7 2000-12-29 10:27:00 geuzaine Exp $
+# $Id: Makefile,v 1.8 2001-01-08 08:05:42 geuzaine Exp $
 #
 # Makefile for "libGeo.a"
 #
 
 .IGNORE:
 
-CC        = c++
-C_FLAGS   = -g -Wall
+CC      = c++
+RANLIB  = ranlib
+RM      = rm
 
-OS_FLAGS  = -D_XMOTIF
+LIB       = ../lib/libGeo.a
+INCLUDE   = -I../Common -I../DataStr -I../Geo -I../Mesh -I../Parser\
+            -I../Motif -I../Fltk
 
-RANLIB   = ranlib
-RM       = rm
-RMFLAGS  = -f
-
-LIB         = ../lib/libGeo.a
-INCLUDE     = -I../Common -I../DataStr -I../Geo -I../Mesh -I../Parser -I../Unix
+C_FLAGS       = -g -Wall
+OS_FLAGS      = 
+VERSION_FLAGS = 
 
-CFLAGS = $(C_FLAGS) $(OS_FLAGS) $(INCLUDE)
+RMFLAGS  = -f
+CFLAGS   = $(C_FLAGS) $(OS_FLAGS) $(VERSION_FLAGS) $(INCLUDE)
 
 SRC =  	CAD.cpp \
         DataBase.cpp \
@@ -93,4 +94,5 @@ Print_Geo.o: Print_Geo.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h Geo.h ../Mesh/Mesh.h \
   ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Edge.h \
-  ../Geo/ExtrudeParams.h ../Mesh/Metric.h CAD.h ../Common/Context.h
+  ../Geo/ExtrudeParams.h ../Mesh/Metric.h CAD.h ../Common/Context.h \
+  ../Common/Const.h
diff --git a/Geo/MinMax.cpp b/Geo/MinMax.cpp
index 1b62918c35577bd9f37a49ff372ece4bf4d7ea65..ff01d11eccb426418a99705f7d58c84b81fabd19 100644
--- a/Geo/MinMax.cpp
+++ b/Geo/MinMax.cpp
@@ -1,4 +1,4 @@
-/* $Id: MinMax.cpp,v 1.3 2000-11-26 15:43:45 geuzaine Exp $ */
+// $Id: MinMax.cpp,v 1.4 2001-01-08 08:05:42 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Const.h"
diff --git a/Geo/MinMax.h b/Geo/MinMax.h
index bd42ce16c02d851a61af567bc1a7c2a27fccf370..a2abe8b8b417e78f9b7f2608033c26a0c26cc4a1 100644
--- a/Geo/MinMax.h
+++ b/Geo/MinMax.h
@@ -1,4 +1,3 @@
-/* $Id: MinMax.h,v 1.2 2000-11-23 14:11:30 geuzaine Exp $ */
 #ifndef _MINMAX_H_
 #define _MINMAX_H_
 
diff --git a/Geo/Print_Geo.cpp b/Geo/Print_Geo.cpp
index 9a63ca0774320404565f5f4cd38aa8e72585b800..5e3e856e441d677062d35d8dd0d2159ce08d3fc4 100644
--- a/Geo/Print_Geo.cpp
+++ b/Geo/Print_Geo.cpp
@@ -1,4 +1,4 @@
-/* $Id: Print_Geo.cpp,v 1.10 2000-12-10 00:15:33 geuzaine Exp $ */
+// $Id: Print_Geo.cpp,v 1.11 2001-01-08 08:05:43 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Geo.h"
diff --git a/Geo/StepGeomDatabase.cpp b/Geo/StepGeomDatabase.cpp
index 09be0a87ee50edbf300426caaf7c15c0a0f6cb33..f92d455a406125433c0988bc61e288b60e149538 100644
--- a/Geo/StepGeomDatabase.cpp
+++ b/Geo/StepGeomDatabase.cpp
@@ -1,4 +1,4 @@
-/* $Id: StepGeomDatabase.cpp,v 1.4 2000-11-26 15:43:45 geuzaine Exp $ */
+// $Id: StepGeomDatabase.cpp,v 1.5 2001-01-08 08:05:43 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Const.h"
diff --git a/Geo/StepGeomDatabase.h b/Geo/StepGeomDatabase.h
index 6d673b44fea0b5a49286b0e8a4107c95ef633867..f01f018c62452fd32079192f2f1b95ac208b7fdd 100644
--- a/Geo/StepGeomDatabase.h
+++ b/Geo/StepGeomDatabase.h
@@ -1,4 +1,3 @@
-/* $Id: StepGeomDatabase.h,v 1.3 2000-11-26 15:43:45 geuzaine Exp $ */
 #ifndef _STEP_GEOM_DATABASE_H_
 #define _STEP_GEOM_DATABASE_H_
 
diff --git a/Geo/Verif.cpp b/Geo/Verif.cpp
index 8e38177d597ec2f40b1556c9f995cc513e52a608..91d8803188f44010631ccc37ca9c3bb06f4b84b9 100644
--- a/Geo/Verif.cpp
+++ b/Geo/Verif.cpp
@@ -1,4 +1,4 @@
-/* $Id: Verif.cpp,v 1.5 2000-12-19 08:56:54 geuzaine Exp $ */
+// $Id: Verif.cpp,v 1.6 2001-01-08 08:05:43 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Geo.h"
diff --git a/Geo/Verif.h b/Geo/Verif.h
index ea0d4d34080f9a3a8e85e7089d94021c79bb4ad8..dc51b6d7fe00574d8b64f017a19e4ba1d3ed127a 100644
--- a/Geo/Verif.h
+++ b/Geo/Verif.h
@@ -1,4 +1,3 @@
-/* $Id: Verif.h,v 1.2 2000-11-23 14:11:31 geuzaine Exp $ */
 #ifndef _VERIF_H_
 #define _VERIF_H_
 
diff --git a/Graphics/Axes.cpp b/Graphics/Axes.cpp
index 0ed63e1c3bf5b167cf63db0746f640e703d8e370..59e2a30be74f33d7d231211c9bde1c395e2e582a 100644
--- a/Graphics/Axes.cpp
+++ b/Graphics/Axes.cpp
@@ -1,4 +1,4 @@
-/* $Id: Axes.cpp,v 1.1 2000-12-18 08:31:45 geuzaine Exp $ */
+// $Id: Axes.cpp,v 1.2 2001-01-08 08:05:43 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "GmshUI.h"
diff --git a/Graphics/CreateFile.cpp b/Graphics/CreateFile.cpp
index ef5e8b37556f66b6d2409e24167e2e6f15d450a3..d1d1c0997866d9451ed4e49389cfbf47b6f0fd30 100644
--- a/Graphics/CreateFile.cpp
+++ b/Graphics/CreateFile.cpp
@@ -1,9 +1,9 @@
-/* $Id: CreateFile.cpp,v 1.1 2000-12-29 10:27:29 geuzaine Exp $ */
+// $Id: CreateFile.cpp,v 1.2 2001-01-08 08:05:43 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "GmshUI.h"
 #include "Mesh.h"
-#include "Main.h"
+#include "OpenFile.h"
 #include "Draw.h"
 #include "Context.h"
 
@@ -27,12 +27,16 @@ extern XContext_T  XCTX;
 
 
 void CreateFile (char *name, int format) {
-  FILE    *tmp, *fp;
+  FILE    *fp;
   GLint    size3d;
-  char     cmd[1000], ext[10];
-  char     *tmpFileName="tmp.xwd";
+  char     ext[10];
   int      res;
 
+#ifdef _XMOTIF
+  FILE    *tmp;
+  char     cmd[1000], *tmpFileName="tmp.xwd";
+#endif
+
   CTX.print.gl_fonts = 1;
 
   switch(format){
@@ -192,7 +196,7 @@ void CreateFile (char *name, int format) {
       res = GL2PS_OVERFLOW ;
       while(res == GL2PS_OVERFLOW){
 	size3d += 2048*2048 ;
-	gl2psBeginPage(TheBaseFileName, "Gmsh", 
+	gl2psBeginPage(CTX.basefilename, "Gmsh", 
 		       (CTX.print.eps_quality == 1 ? GL2PS_SIMPLE_SORT : GL2PS_BSP_SORT),
 		       GL2PS_SIMPLE_LINE_OFFSET | GL2PS_DRAW_BACKGROUND,
 		       GL_RGBA, 0, NULL, size3d, fp);
diff --git a/Graphics/Draw.cpp b/Graphics/Draw.cpp
index 1d8d3dc55cc0f35d0cca0d3c1ae4faeac416e637..0ec6f3ec0b7580ff6a73e4b6f41c13d13fa6be51 100644
--- a/Graphics/Draw.cpp
+++ b/Graphics/Draw.cpp
@@ -1,4 +1,4 @@
-/* $Id: Draw.cpp,v 1.14 2000-12-29 10:27:00 geuzaine Exp $ */
+// $Id: Draw.cpp,v 1.15 2001-01-08 08:05:43 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -7,19 +7,10 @@
 #include "Draw.h"
 #include "Context.h"
 #include "MinMax.h"
-
 #include "CbGeneral.h"
 
-#ifdef _XMOTIF
-#include "Widgets.h"
-#include "XContext.h"
-extern XContext_T   XCTX ;
-extern Widgets_T    WID ;
-#endif
-
 extern Context_T    CTX ;
 extern Mesh         M;
-extern List_T      *Post_ViewList;
 
 /* ------------------------------------------------------------------------ */
 /*  d r a w                                                                 */
@@ -80,35 +71,6 @@ void Draw2d(void){
   glPopMatrix();
 }
 
-#ifdef _XMOTIF
-void Draw(void){
-  glClearColor(UNPACK_RED(CTX.color.bg)/255.,
-               UNPACK_GREEN(CTX.color.bg)/255.,
-               UNPACK_BLUE(CTX.color.bg)/255.,
-               0.);
-  glClear(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT);
-  if(CTX.db) glDrawBuffer(GL_BACK);    
-  Draw3d();
-  Draw2d();
-  glFlush();
-  if(CTX.db) glXSwapBuffers(XCTX.display,XtWindow(WID.G.glw));
-}
-#else
-void Draw(void){
-  if(CTX.db) glDrawBuffer(GL_BACK);
-  glClearColor(UNPACK_RED(CTX.color.bg)/255.,
-               UNPACK_GREEN(CTX.color.bg)/255.,
-               UNPACK_BLUE(CTX.color.bg)/255.,
-               0.);
-  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);  
-  Draw3d();
-  Draw2d();
-  glFlush();
-  if(CTX.db) MySwapBuffers();
-  if(CTX.db) glDrawBuffer(GL_FRONT);
-}
-#endif
-
 /* ------------------------------------------------------------------------ */
 /*  o r t h o                                                               */
 /* ------------------------------------------------------------------------ */
@@ -166,39 +128,10 @@ void Orthogonalize(int x, int y){
 
 }
 
-
 /* ------------------------------------------------------------------------ */
 /*  i n i t                                                                 */
 /* ------------------------------------------------------------------------ */
 
-#ifdef _XMOTIF
-#include <X11/IntrinsicP.h>
-#endif
-
-void Init(void){
-#ifdef _XMOTIF
-  /* Resize Graphical Window if told to do it */
-  XWindowAttributes  xattrib;
-  XGetWindowAttributes(XtDisplay(WID.G.bottomForm),XtWindow(WID.G.bottomForm),&xattrib);
-  XtResizeWidget(WID.G.shell,
-		 CTX.viewport[2]-CTX.viewport[0],
-		 xattrib.height+CTX.viewport[3]-CTX.viewport[1],
-		 0);
-  /* X11 forbids to change the context (GLX) in GL_FEEDBACK or GL_SELECT mode,
-     which would happen for postscript output */
-  if(CTX.stream == TO_SCREEN)
-    glXMakeCurrent(XtDisplay(WID.G.glw), XtWindow(WID.G.glw), XCTX.glw.context);
-#endif
-  Orthogonalize(0,0);
-}
-
-void InitOv(void){
-#ifdef _XMOTIF
-  glXMakeCurrent(XtDisplay(WID.G.glo), XtWindow(WID.G.glo), XCTX.glo.context);
-#endif
-  Orthogonalize(0,0);
-}
-
 void InitShading(void){
   GLfloat specular[4];
   int i;
@@ -328,69 +261,6 @@ void Filter_SelectionBuffer(int n, GLuint *typ, GLuint *ient, Vertex **thev,
   }
 }
 
-
-#ifdef _XMOTIF
-
-int check_type(int type, Vertex *v, Curve *c, Surface *s){
-  return ( (type==ENT_POINT   && v) ||
-           (type==ENT_LINE    && c) ||
-           (type==ENT_SURFACE && s) ) ;
-}
-
-int SelectEntity(int type, Vertex **v, Curve **c, Surface **s){
-  XEvent          event;
-  XComposeStatus  stat;
-  KeySym          keysym;
-  int             hits;
-  GLuint          ii[SELECTION_BUFFER_SIZE],jj[SELECTION_BUFFER_SIZE];
-  char            buf[100];
-
-  *v = NULL;
-  *c = NULL; 
-  *s = NULL;
-
-  while(1){
-    XtAppNextEvent(XCTX.AppContext,&event);
-    XtDispatchEvent(&event);
-    switch(event.type){
-    case KeyPress :
-      XLookupString(&event.xkey, buf, sizeof(buf), &keysym, &stat);
-      if(keysym == XK_q) return(0);
-      if(keysym == XK_e) return(-1);
-      break;
-    case ButtonPress :
-      Process_SelectionBuffer(event.xbutton.x, event.xbutton.y, &hits, ii, jj);
-      Filter_SelectionBuffer(hits,ii,jj,v,c,s,&M);
-      if(check_type(type,*v,*c,*s)){
-        BeginHighlight();
-        HighlightEntity(*v,*c,*s,1);
-        EndHighlight(1);
-        return(event.xbutton.button);
-      }
-    }
-  }
-}
-
-#else
-
-int SelectEntity(int x, int y, Vertex **v, Curve **c, Surface **s){
-  int             hits,i,j;
-  GLuint          ii[SELECTION_BUFFER_SIZE],jj[SELECTION_BUFFER_SIZE];
-
-  Process_SelectionBuffer(x, y, &hits, ii, jj);
-  *v = NULL;
-  *s = NULL;
-  *c = NULL;
-  Filter_SelectionBuffer(hits,ii,jj,v,c,s,&M);
-  BeginHighlight();
-  HighlightEntity(*v,*c,*s,1);
-  EndHighlight(1);
-  return(1);
-}
-
-#endif
-
-
 /* ------------------------------------------------------------------------ */
 /*  z o o m                                                                 */
 /* ------------------------------------------------------------------------ */
@@ -412,49 +282,3 @@ void myZoom(GLdouble X1, GLdouble X2, GLdouble Y1, GLdouble Y2,
   Draw();
 }
 
-/* ------------------------------------------------------------------------ */
-/*  InitCb, ResizeCb, ExposeCb                                              */
-/* ------------------------------------------------------------------------ */
-
-#ifdef _XMOTIF
-
-void InitCb(Widget w, XtPointer client_data, GLwDrawingAreaCallbackStruct *cb){
-  glXMakeCurrent(XtDisplay(WID.G.glw), XtWindow(WID.G.glw), XCTX.glw.context);
-  CTX.viewport[0] = 0 ;
-  CTX.viewport[1] = 0 ;
-  CTX.viewport[2] = cb->width ;
-  CTX.viewport[3] = cb->height ;
-  glViewport(CTX.viewport[0],
-             CTX.viewport[1],
-             CTX.viewport[2],
-             CTX.viewport[3]);
-}
-
-void ResizeCb(Widget w,XtPointer client_data, GLwDrawingAreaCallbackStruct *cb){
-  CTX.viewport[0] = 0 ;
-  CTX.viewport[1] = 0 ;
-  CTX.viewport[2] = cb->width ;
-  CTX.viewport[3] = cb->height ;
-  glViewport(CTX.viewport[0],
-             CTX.viewport[1],
-             CTX.viewport[2],
-             CTX.viewport[3]);
-  Init();
-  Draw();
-  if(CTX.overlay) InitOv();
-}
-
-void ExposeCb(Widget w,XtPointer client_data, GLwDrawingAreaCallbackStruct *cb){
-
-  /* compress incoming events as much as possible */
-  if(cb->event->xexpose.count != 0){
-    return;
-  }
-
-  if(!CTX.expose) return;
-  Init();
-  Draw(); 
-
-}
-
-#endif
diff --git a/Graphics/Draw.h b/Graphics/Draw.h
index ffa7065c0961b480f2568ff6f8ae83b0e8be043e..2daf890c1ec00bf8003f4adc02ae57fc8b6b1b80 100644
--- a/Graphics/Draw.h
+++ b/Graphics/Draw.h
@@ -1,4 +1,3 @@
-/* $Id: Draw.h,v 1.8 2000-12-20 10:40:52 geuzaine Exp $ */
 #ifndef _DRAW_H_
 #define _DRAW_H_
 
@@ -12,10 +11,11 @@
 #define TO_FILE    2
 
 void Init(void);
-void InitOv(void);
+void InitOverlay(void);
 void InitShading(void);
 void InitNoShading(void);
 void InitPosition(void);
+void Orthogonalize(int x, int y);
 
 void Replot(void);
 
@@ -33,6 +33,8 @@ void HighlightEntityNum(int v, int c, int s, int permanant);
 
 void Draw3d(void);
 void Draw2d(void);
+void DrawUI(void);
+void DrawOverlay(void);
 void Draw(void);
 
 void Draw_String(char *s);
diff --git a/Graphics/Entity.cpp b/Graphics/Entity.cpp
index 1fa0d959beda9272e74b594116e44026d4d37d37..98a4c9b4e25915bc9ace40467f52e8de66bbf917 100644
--- a/Graphics/Entity.cpp
+++ b/Graphics/Entity.cpp
@@ -1,4 +1,4 @@
-/* $Id: Entity.cpp,v 1.3 2000-11-26 15:43:46 geuzaine Exp $ */
+// $Id: Entity.cpp,v 1.4 2001-01-08 08:05:43 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "GmshUI.h"
diff --git a/Graphics/Geom.cpp b/Graphics/Geom.cpp
index 25dad5ae9c79bac0238a0586c634d3b49d110722..dc654821bc1cf738f97fed20e462cb682673d518 100644
--- a/Graphics/Geom.cpp
+++ b/Graphics/Geom.cpp
@@ -1,4 +1,4 @@
-/* $Id: Geom.cpp,v 1.7 2000-12-18 14:18:16 geuzaine Exp $ */
+// $Id: Geom.cpp,v 1.8 2001-01-08 08:05:43 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -784,15 +784,8 @@ void ZeroHighlight(Mesh *m){
 void BeginHighlight(void){
   if(CTX.geom.highlight){
     Highlighted = 1;
-    if(CTX.overlay){ 
-      InitOv();
-    }
-    else{ 
-      Init();
-    }
     glPushMatrix();
     InitPosition();    
-    if(CTX.db) glDrawBuffer(GL_FRONT);
   }  
 }
 
@@ -806,7 +799,6 @@ void EndHighlight(int permanent){
   else{
     if(CTX.geom.highlight) {
       glPopMatrix();
-      if(CTX.db) glDrawBuffer(GL_BACK);
     }
   }
 }
@@ -835,10 +827,6 @@ void HighlightEntity(Vertex *v,Curve *c, Surface *s, int permanent){
     if(permanent && s->Mat == 1) return;
     if(permanent) s->Mat = 1;
     if(CTX.geom.highlight) Draw_Surface(&s,NULL);
-    /*
-    if(s->Typ == MSH_SURF_PLAN)sprintf(Message,"Plan Surf %d {",s->Num);
-    else if(s->Typ == MSH_SURF_REGL)sprintf(Message,"Ruld Surf %d {",s->Num);
-    else*/
     sprintf(Message,"Surface %d {",s->Num);
 
     nbg = List_Nbr(s->s.Generatrices) ;
diff --git a/Graphics/Iso.cpp b/Graphics/Iso.cpp
index 1de8a0d56b5f1d64f815e84d6a5a4adb4bced94e..7c98e10320afc9f14d73eb021093a0751ba496d5 100644
--- a/Graphics/Iso.cpp
+++ b/Graphics/Iso.cpp
@@ -1,4 +1,4 @@
-/* $Id: Iso.cpp,v 1.3 2000-11-26 15:43:46 geuzaine Exp $ */
+// $Id: Iso.cpp,v 1.4 2001-01-08 08:05:43 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Mesh.h"
diff --git a/Graphics/Iso.h b/Graphics/Iso.h
index df774f421f520703db463810c259afb686bc9e30..22777aa1b34cc2bec6ae81200bfec3d08658b041 100644
--- a/Graphics/Iso.h
+++ b/Graphics/Iso.h
@@ -1,4 +1,3 @@
-/* $Id: Iso.h,v 1.3 2000-11-26 15:43:46 geuzaine Exp $ */
 #ifndef _ISO_H_
 #define _ISO_H_
 
diff --git a/Graphics/Makefile b/Graphics/Makefile
index 24bde7246e1a4a30f4a8154af0fe337f8537c9d2..01d68652dba10ebbf511227ca6e464bfddaadfed 100644
--- a/Graphics/Makefile
+++ b/Graphics/Makefile
@@ -1,29 +1,28 @@
-# $Id: Makefile,v 1.10 2000-12-29 10:27:00 geuzaine Exp $
+# $Id: Makefile,v 1.11 2001-01-08 08:05:43 geuzaine Exp $
 #
 # Makefile for "libGraphics.a"
 #
 
 .IGNORE:
 
-CC            = c++
-C_FLAGS       = -g -Wall
+CC       = c++
+RANLIB   = ranlib
+RM       = rm
+LIB      = ../lib/libGraphics.a
+INCLUDE  = -I../Common -I../DataStr -I../Geo -I../Graphics\
+           -I../Motif -I../Fltk -I../Mesh -I../Parser -I../jpeg
 
-VERSION_FLAGS = 
-OS_FLAGS      = -D_XMOTIF
+C_FLAGS       = -g -Wall
+OS_FLAGS      = -D_LITTLE_ENDIAN
+VERSION_FLAGS = -D_XMOTIF
 
 GL_INCLUDE    = -I$(HOME)/SOURCES/Mesa-3.1/include\
                 -I$(HOME)/SOURCES/Mesa-3.1/include/GL
-MOTIF_INCLUDE = -I/usr/X11R6/LessTif/Motif1.2/include
+GUI_INCLUDE   = -I/usr/X11R6/LessTif/Motif1.2/include
 
-RANLIB   = ranlib
-RM       = rm
 RMFLAGS  = -f
-
-LIB      = ../lib/libGraphics.a
-INCLUDE  = -I../Common -I../DataStr -I../Geo -I../Graphics -I../Unix -I../Mesh -I../jpeg
-
 CFLAGS   = $(C_FLAGS) $(OS_FLAGS) $(VERSION_FLAGS) $(INCLUDE)\
-           $(GL_INCLUDE) $(MOTIF_INCLUDE)
+           $(GL_INCLUDE) $(GUI_INCLUDE)
 
 SRC = Draw.cpp \
       Mesh.cpp \
@@ -75,7 +74,7 @@ Draw.o: Draw.cpp ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \
   ../Mesh/Simplex.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h \
   ../Mesh/Metric.h Draw.h ../Common/Views.h ../Common/Const.h \
   ../Common/ColorTable.h ../Common/Context.h ../Geo/MinMax.h \
-  ../Unix/CbGeneral.h ../Unix/Widgets.h ../Unix/XContext.h
+  ../Motif/CbGeneral.h
 Mesh.o: Mesh.cpp ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \
   ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \
   ../Common/GmshUI.h ../Geo/Geo.h ../Mesh/Mesh.h ../Mesh/Vertex.h \
@@ -119,7 +118,7 @@ Scale.o: Scale.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../Common/Const.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Simplex.h \
   ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/Metric.h Draw.h \
   ../Common/Views.h ../Common/ColorTable.h ../Common/Context.h gl2ps.h \
-  ../Unix/XContext.h
+  ../Motif/XContext.h
 Axes.o: Axes.cpp ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \
   ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \
   ../Common/GmshUI.h ../Common/Const.h ../Mesh/Mesh.h ../Mesh/Vertex.h \
@@ -130,9 +129,9 @@ CreateFile.o: CreateFile.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Common/GmshUI.h ../Mesh/Mesh.h \
   ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Edge.h \
-  ../Geo/ExtrudeParams.h ../Mesh/Metric.h ../Unix/Main.h \
+  ../Geo/ExtrudeParams.h ../Mesh/Metric.h ../Parser/OpenFile.h \
   ../Common/Const.h Draw.h ../Common/Views.h ../Common/ColorTable.h \
-  ../Common/Context.h ../Unix/Widgets.h ../Unix/XContext.h XDump.h \
+  ../Common/Context.h ../Motif/Widgets.h ../Motif/XContext.h XDump.h \
   gl2ps.h gl2gif.h gl2jpeg.h gl2ppm.h gl2yuv.h
 XDump.o: XDump.cpp
 gl2ps.o: gl2ps.cpp gl2ps.h
diff --git a/Graphics/Mesh.cpp b/Graphics/Mesh.cpp
index 6c21498b13b262c5883fa98a325789ab4cfffdb2..d392acc168fcfd36621b7e463b9668a45782bf3b 100644
--- a/Graphics/Mesh.cpp
+++ b/Graphics/Mesh.cpp
@@ -1,4 +1,4 @@
-/* $Id: Mesh.cpp,v 1.13 2000-12-18 08:31:45 geuzaine Exp $ */
+// $Id: Mesh.cpp,v 1.14 2001-01-08 08:05:43 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "GmshUI.h"
diff --git a/Graphics/Post.cpp b/Graphics/Post.cpp
index c317afec7064f075915de42b41f883db9af80a7f..51e932732329f4653e6789204fb53166d0214268 100644
--- a/Graphics/Post.cpp
+++ b/Graphics/Post.cpp
@@ -1,4 +1,4 @@
-/* $Id: Post.cpp,v 1.8 2000-12-18 08:31:45 geuzaine Exp $ */
+// $Id: Post.cpp,v 1.9 2001-01-08 08:05:43 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "GmshUI.h"
diff --git a/Graphics/PostSimplex.cpp b/Graphics/PostSimplex.cpp
index eb2133a3c88d4b9f9ad331be19c7055e63937b2f..bef6923b9fa1cd25c79e1fbd5735db01ac4188d7 100644
--- a/Graphics/PostSimplex.cpp
+++ b/Graphics/PostSimplex.cpp
@@ -1,4 +1,4 @@
-/* $Id: PostSimplex.cpp,v 1.9 2000-12-18 16:56:13 geuzaine Exp $ */
+// $Id: PostSimplex.cpp,v 1.10 2001-01-08 08:05:43 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "GmshUI.h"
diff --git a/Graphics/Scale.cpp b/Graphics/Scale.cpp
index 62dd3783a59bdd49a951c87da11128bdd5332a5a..9e5589c210fd83a30d1bb7ea594a7dc1bc56237c 100644
--- a/Graphics/Scale.cpp
+++ b/Graphics/Scale.cpp
@@ -1,4 +1,4 @@
-/* $Id: Scale.cpp,v 1.11 2000-12-29 10:27:00 geuzaine Exp $ */
+// $Id: Scale.cpp,v 1.12 2001-01-08 08:05:43 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "GmshUI.h"
diff --git a/Graphics/XDump.cpp b/Graphics/XDump.cpp
index 5625688502957113a95bbdda3e609a2a20364919..d09e0f9f618c16c0a8977479c644d34e265c3182 100644
--- a/Graphics/XDump.cpp
+++ b/Graphics/XDump.cpp
@@ -1,4 +1,4 @@
-/* $Id: XDump.cpp,v 1.1 2000-12-29 10:28:40 geuzaine Exp $ */
+// $Id: XDump.cpp,v 1.2 2001-01-08 08:05:43 geuzaine Exp $
 
 /* This is a modified version for Gmsh (mainly for c++ compliance) */
 
diff --git a/Graphics/XDump.h b/Graphics/XDump.h
index 057267c706f7f5c0bc30157d6d98feef8e7351ae..981d0be2b0da033f15a9b0ed528f686526b1336c 100644
--- a/Graphics/XDump.h
+++ b/Graphics/XDump.h
@@ -1,4 +1,3 @@
-/* $Id: XDump.h,v 1.1 2000-12-29 10:28:40 geuzaine Exp $ */
 #ifndef _XDUMP_H_
 #define _XDUMP_H_
 
diff --git a/Graphics/gl2gif.cpp b/Graphics/gl2gif.cpp
index 3f5668f59c9b77842f45baa38ee53a4ce2e8c37e..437a9afb81b9cbabbc606542007a6a02d1b5f906 100644
--- a/Graphics/gl2gif.cpp
+++ b/Graphics/gl2gif.cpp
@@ -1,4 +1,5 @@
-/* $Id: gl2gif.cpp,v 1.7 2000-12-29 14:04:28 geuzaine Exp $ */
+// $Id: gl2gif.cpp,v 1.8 2001-01-08 08:05:43 geuzaine Exp $
+
 /* 
  * gl2gif: an OpenGL to GIF printing library
  *
diff --git a/Graphics/gl2jpeg.cpp b/Graphics/gl2jpeg.cpp
index 84ed41d18844ef4e01cf212c5e3dce1b78c45ffe..05df858de754c5e1ddda88e8268854aa8b8cb410 100644
--- a/Graphics/gl2jpeg.cpp
+++ b/Graphics/gl2jpeg.cpp
@@ -1,4 +1,4 @@
-/* $Id: gl2jpeg.cpp,v 1.3 2000-12-28 18:58:20 geuzaine Exp $ */
+// $Id: gl2jpeg.cpp,v 1.4 2001-01-08 08:05:44 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -9,7 +9,6 @@
 void my_output_message (j_common_ptr cinfo){
   char buffer[JMSG_LENGTH_MAX];
 
-  /* Create the message */
   (*cinfo->err->format_message) (cinfo, buffer);
 
   Msg(DEBUG, "%s", buffer);
@@ -20,20 +19,20 @@ void create_jpeg(FILE *outfile, int width, int height, int quality){
   unsigned char *pixels;
   struct jpeg_compress_struct cinfo;
   struct jpeg_error_mgr jerr;
-  JSAMPROW row_pointer[1];      /* pointer to JSAMPLE row[s] */
-  int row_stride;               /* physical row width in image buffer */
+  JSAMPROW row_pointer[1];      // pointer to JSAMPLE row[s]
+  int row_stride;               // physical row width in image buffer
             
   cinfo.err = jpeg_std_error(&jerr);
   cinfo.err->output_message = my_output_message;
 
   jpeg_create_compress(&cinfo);
   jpeg_stdio_dest(&cinfo, outfile);
-  cinfo.image_width = width;       /* image width and height, in pixels */
+  cinfo.image_width = width;       // image width and height, in pixels
   cinfo.image_height = height;
-  cinfo.input_components = 3;      /* # of color components per pixel */
-  cinfo.in_color_space = JCS_RGB;  /* colorspace of input image */
+  cinfo.input_components = 3;      // # of color components per pixel
+  cinfo.in_color_space = JCS_RGB;  // colorspace of input image
   jpeg_set_defaults(&cinfo);                            
-  jpeg_set_quality(&cinfo, quality, TRUE /* limit to baseline-JPEG values */);
+  jpeg_set_quality(&cinfo, quality, TRUE);
   jpeg_start_compress(&cinfo, TRUE);
 
   glPixelStorei(GL_PACK_ALIGNMENT,1);
@@ -44,9 +43,10 @@ void create_jpeg(FILE *outfile, int width, int height, int quality){
   row_stride = width * 3;
   i=cinfo.image_height-1;
   while (i >= 0) {
-    /* jpeg_write_scanlines expects an array of pointers to scanlines.
-     * Here the array is only one element long, but you could pass
-     * more than one scanline at a time if that's more convenient.
+    /* 
+       jpeg_write_scanlines expects an array of pointers to scanlines.
+       Here the array is only one element long, but you could pass
+       more than one scanline at a time if that's more convenient.
      */
     row_pointer[0] = &pixels[i * row_stride];
     (void) jpeg_write_scanlines(&cinfo, row_pointer, 1);
diff --git a/Graphics/gl2ppm.cpp b/Graphics/gl2ppm.cpp
index 27672f3ae252035defd52e38eca2245300507f76..e9aa5e7b4ee66f088f1fcef742b4925eac969606 100644
--- a/Graphics/gl2ppm.cpp
+++ b/Graphics/gl2ppm.cpp
@@ -1,4 +1,4 @@
-/* $Id: gl2ppm.cpp,v 1.4 2000-12-28 18:58:20 geuzaine Exp $ */
+// $Id: gl2ppm.cpp,v 1.5 2001-01-08 08:05:44 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "GmshUI.h"
diff --git a/Graphics/gl2ps.cpp b/Graphics/gl2ps.cpp
index fb77cc1ca7d24711682bd2f246847cd6ef508bbc..795f775d120fd1a716d5820d3450fe3c2477608f 100644
--- a/Graphics/gl2ps.cpp
+++ b/Graphics/gl2ps.cpp
@@ -1,4 +1,5 @@
-/* $Id: gl2ps.cpp,v 1.4 2000-12-17 21:17:29 remacle Exp $ */
+// $Id: gl2ps.cpp,v 1.5 2001-01-08 08:05:44 geuzaine Exp $
+
 /*
  * GL2PS, an OpenGL to Postscript Printing Library, version 0.31
  * Copyright (C) 1999-2000  Christophe Geuzaine 
diff --git a/Graphics/gl2ps.h b/Graphics/gl2ps.h
index 9edf33585bb010c91e80e7f70a42c029beb25130..4499f24645f44a6d9c5646d9893dba54ab918872 100644
--- a/Graphics/gl2ps.h
+++ b/Graphics/gl2ps.h
@@ -1,4 +1,3 @@
-/* $Id: gl2ps.h,v 1.3 2000-11-26 15:43:46 geuzaine Exp $ */
 /*
  * GL2PS, an OpenGL to Postscript Printing Library, version 0.31
  * Copyright (C) 1999-2000  Christophe Geuzaine
diff --git a/Graphics/gl2yuv.cpp b/Graphics/gl2yuv.cpp
index 5a4bb7a848a6ca8013f19de199a5b127b5e9ab05..ba600cc3e29b1032424ae11543286f704c4d180a 100644
--- a/Graphics/gl2yuv.cpp
+++ b/Graphics/gl2yuv.cpp
@@ -1,4 +1,4 @@
-/* $Id: gl2yuv.cpp,v 1.2 2000-12-28 18:58:20 geuzaine Exp $ */
+// $Id: gl2yuv.cpp,v 1.3 2001-01-08 08:05:44 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -40,7 +40,7 @@ void create_yuv(FILE *outfile, int width, int height){
     first = 0;
   }
 
-  /* yuv format assumes even number of rows and columns */
+  // yuv format assumes even number of rows and columns
   height -= height%2;
   width -= width%2;
 
@@ -65,7 +65,7 @@ void create_yuv(FILE *outfile, int width, int height){
     orig_cb[y] = (unsigned char *) Malloc(sizeof(char) * width / 2);
   }
   
-  /* assume ydivisor = 1, so cdivisor = 4 */
+  // assume ydivisor = 1, so cdivisor = 4
   cdivisor = 4;
   
   for (y = 0; y < height; y += 2){
@@ -122,27 +122,24 @@ void create_yuv(FILE *outfile, int width, int height){
     }
   }
 
-  for (y = height-1; y >=0; y--)                      /* Y */
-    fwrite(orig_y[y], 1, width, outfile);
+  // Y
+  for (y = height-1; y >=0; y--) fwrite(orig_y[y], 1, width, outfile);
   
-  for (y = height/2-1; y >=0; y--)                    /* U */
-    fwrite(orig_cb[y], 1, width / 2, outfile);
+  // U
+  for (y = height/2-1; y >=0; y--) fwrite(orig_cb[y], 1, width / 2, outfile);
   
-  for (y = height/2-1; y >=0; y--)                    /* V */
-    fwrite(orig_cr[y], 1, width / 2, outfile);
+  // V
+  for (y = height/2-1; y >=0; y--) fwrite(orig_cr[y], 1, width / 2, outfile);
 
   Free(pixels);
 
-  for (y = 0; y < height; y++)
-    Free(orig_y[y]);
+  for (y = 0; y < height; y++) Free(orig_y[y]);
   Free(orig_y);
 
-  for (y = 0; y < height / 2; y++)
-    Free(orig_cr[y]);
+  for (y = 0; y < height / 2; y++) Free(orig_cr[y]);
   Free(orig_cr);
   
-  for (y = 0; y < height / 2; y++)
-    Free(orig_cb[y]);
+  for (y = 0; y < height / 2; y++) Free(orig_cb[y]);
   Free(orig_cb);
 
 }
diff --git a/Gui/Callbacks.cpp b/Gui/Callbacks.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..20628b02cc80d076d142a14d7ef57e0d5fdf557e
--- /dev/null
+++ b/Gui/Callbacks.cpp
@@ -0,0 +1,112 @@
+
+#include "Gmsh.h"
+#include "GmshUI.h"
+#include "Geo.h"
+#include "Mesh.h"
+#include "Draw.h"
+#include "Views.h"
+#include "OpenFile.h"
+#include "Context.h"
+#include "GUI.h"
+
+#include <FL/fl_file_chooser.H>
+
+extern GUI *WID;
+extern Mesh M;
+extern Context_T CTX;
+
+// File Menu
+
+void file_open_cb(void) {
+  char *newfile;
+  newfile = fl_file_chooser("Open File", "*.geo", NULL);
+  if (newfile != NULL) {
+    OpenProblem(newfile); 
+    Init();
+    Draw(); 
+  }
+}
+
+void file_merge_cb(void) {
+  char *newfile;
+  newfile = fl_file_chooser("Merge File", "*.{geo,pos,msh}", NULL);
+  if (newfile != NULL) {
+    MergeProblem(newfile); 
+    Init();
+    Draw(); 
+  }
+}
+
+void file_save_cb(void) {
+}
+
+void file_save_as_cb(void) {
+}
+
+void file_reload_all_views_cb(void) {
+}
+
+void file_remove_all_views_cb(void) {
+}
+
+void file_quit_cb(void) {
+  exit(0);
+}
+
+// Option Menu
+
+void opt_general_cb(void) {
+  WID->opt_general();
+}
+
+void opt_geometry_cb(void) {
+}
+void opt_mesh_cb(void) {
+}
+void opt_post_cb(void) {
+}
+void opt_stat_cb(void) {
+}
+
+// Help Menu
+
+void help_short_cb(void){
+}
+void help_about_cb(void){
+}
+
+// Module Menu
+
+void mod_geometry_cb(void){
+}
+void mod_mesh_cb(void){
+}
+void mod_post_cb(void){
+}
+
+// View Menus
+
+void view_reload_cb(Fl_Widget* w, void* data){
+  printf("Reload view %d \n", (int)data);
+}
+void view_remove_cb(Fl_Widget* w, void* data){
+  printf("Remove view %d \n", (int)data);
+}
+void view_duplicate_cb(Fl_Widget* w, void* data){
+  printf("Duplicate view %d \n", (int)data);
+}
+void view_lighting_cb(Fl_Widget* w, void* data){
+  printf("Light view %d \n", (int)data);
+}
+void view_elements_cb(Fl_Widget* w, void* data){
+  printf("Show Elements view %d \n", (int)data);
+}
+void view_applybgmesh_cb(Fl_Widget* w, void* data){
+  printf("Apply bgmesh view %d \n", (int)data);
+}
+void view_timestep_cb(Fl_Widget* w, void* data){
+  printf("Timestep view %d \n", (int)data);
+}
+void view_options_cb(Fl_Widget* w, void* data){
+  printf("Options view %d \n", (int)data);
+}
diff --git a/Gui/Callbacks.h b/Gui/Callbacks.h
new file mode 100644
index 0000000000000000000000000000000000000000..f04535f8cda2ad030789dac03791558abac50cfa
--- /dev/null
+++ b/Gui/Callbacks.h
@@ -0,0 +1,34 @@
+#ifndef _CALLBACKS_H_
+#define _CALLBACKS_H_
+
+void file_open_cb(void) ;
+void file_merge_cb(void) ;
+void file_save_cb(void) ;
+void file_save_as_cb(void) ;
+void file_reload_all_views_cb(void) ;
+void file_remove_all_views_cb(void) ;
+void file_quit_cb(void) ;
+
+void opt_general_cb(void) ;
+void opt_geometry_cb(void) ;
+void opt_mesh_cb(void) ;
+void opt_post_cb(void) ;
+void opt_stat_cb(void) ;
+
+void help_short_cb(void) ;
+void help_about_cb(void) ;
+
+void mod_geometry_cb(void) ;
+void mod_mesh_cb(void) ;
+void mod_post_cb(void) ;
+
+void view_reload_cb(Fl_Widget* w, void*) ;
+void view_remove_cb(Fl_Widget* w, void*) ;
+void view_duplicate_cb(Fl_Widget* w, void*) ;
+void view_lighting_cb(Fl_Widget* w, void*) ;
+void view_elements_cb(Fl_Widget* w, void*) ;
+void view_timestep_cb(Fl_Widget* w, void*) ;
+void view_options_cb(Fl_Widget* w, void*) ;
+void view_applybgmesh_cb(Fl_Widget* w, void*) ;
+
+#endif
diff --git a/Gui/GUI.cpp b/Gui/GUI.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..09ea8127e3931bddc0de2587d2b0848538c97d68
--- /dev/null
+++ b/Gui/GUI.cpp
@@ -0,0 +1,316 @@
+
+// To make the interface as visually consistent as possible, please:
+// - use the BH and WB values for button heights and window borders
+// - use CTX.fontsize for font sizes
+// - examine what's already done before adding something new...
+
+#include "Gmsh.h"
+#include "GmshUI.h"
+#include "Context.h"
+#include "Const.h"
+#include "Geo.h"
+#include "Mesh.h"
+#include "Draw.h"
+#include "Version.h"
+#include "GUI.h"
+#include "Callbacks.h"
+
+extern Context_T CTX;
+
+// Definition of the static menus
+
+Fl_Menu_Item m_menubar_table[] = {
+  {"File", 0, 0, 0, FL_SUBMENU},
+    {"Open...",          FL_CTRL+'o', (Fl_Callback *)file_open_cb, 0},
+    {"Merge...",         FL_CTRL+'m', (Fl_Callback *)file_merge_cb, 0, FL_MENU_DIVIDER},
+    {"Save",             FL_CTRL+'s', (Fl_Callback *)file_save_cb, 0},
+    {"Save As...",       FL_CTRL+'p', (Fl_Callback *)file_save_as_cb, 0, FL_MENU_DIVIDER},
+    {"Reload All Views", FL_CTRL+'l', (Fl_Callback *)file_reload_all_views_cb, 0},
+    {"Remove All Views", FL_CTRL+'r', (Fl_Callback *)file_remove_all_views_cb, 0, FL_MENU_DIVIDER},
+    {"Quit",             FL_CTRL+'q', (Fl_Callback *)file_quit_cb, 0},
+    {0},
+  {"Options",0,0,0,FL_SUBMENU},
+    {"Geometry...",        FL_SHIFT+'g', (Fl_Callback *)opt_geometry_cb, 0},
+    {"Mesh...",            FL_SHIFT+'m', (Fl_Callback *)opt_mesh_cb, 0},
+    {"Post-Processing...", FL_SHIFT+'p', (Fl_Callback *)opt_post_cb, 0, FL_MENU_DIVIDER},
+    {"General...",         FL_SHIFT+'o', (Fl_Callback *)opt_general_cb, 0},
+    {"Statistics...",      FL_SHIFT+'i', (Fl_Callback *)opt_stat_cb, 0},
+    {0},
+  {"Help",0,0,0,FL_SUBMENU},
+    {"Short Help...",   0, (Fl_Callback *)help_short_cb, 0, FL_MENU_DIVIDER},
+    {"About...",        0, (Fl_Callback *)help_about_cb, 0},
+    {0},
+  {0}
+};
+
+Fl_Menu_Item m_module_table[] = {
+  {" Geometry",        'g', (Fl_Callback *)mod_geometry_cb, 0},
+  {" Mesh",            'm', (Fl_Callback *)mod_mesh_cb, 0},
+  {" Post-Processing", 'p', (Fl_Callback *)mod_post_cb, 0},
+  {0}
+};
+
+
+// The GUI constructor creates ONLY the widgets that always exist (we
+// want the lowest memory footprint for the interface and the fastest
+// startup time). All optional dialogs are also created only once, but
+// on demand.
+
+GUI::GUI() {
+  int i, x, y;
+
+  BH = 2*CTX.fontsize+2;
+  WB = CTX.fontsize-6;
+
+  if(strlen(CTX.display)) Fl::display(CTX.display);
+
+  // Menu Window
+
+  {
+    int width = 152 ;
+    int height = 450 ;
+
+    m_window = new Fl_Window(width,height);
+    m_window->box(FL_THIN_UP_BOX);
+
+    {
+      Fl_Menu_Bar *o = new Fl_Menu_Bar(0,0,width,BH); 
+      o->menu(m_menubar_table);
+      o->textsize(CTX.fontsize);
+      o->box(FL_UP_BOX);
+    }
+
+    Fl_Box *o = new Fl_Box(0,BH,width,BH+6);
+    o->box(FL_UP_BOX);
+
+    y = BH+3;
+    
+    m_navig_butt[0] = new Fl_Button(2,y,20,BH/2,"@<");
+    m_navig_butt[0]->labeltype(FL_SYMBOL_LABEL);
+    m_navig_butt[0]->box(FL_FLAT_BOX);
+    m_navig_butt[0]->selection_color(FL_WHITE);
+    m_navig_butt[1] = new Fl_Button(2,y+BH/2,20,BH/2,"@>");
+    m_navig_butt[1]->labeltype(FL_SYMBOL_LABEL);
+    m_navig_butt[1]->box(FL_FLAT_BOX);
+    m_navig_butt[1]->selection_color(FL_WHITE);
+    
+    m_module_butt = new Fl_Choice(22,y,width-26,BH);
+    m_module_butt->menu(m_module_table);
+    m_module_butt->textsize(CTX.fontsize);
+    m_module_butt->box(FL_THIN_DOWN_BOX);
+    
+    y = BH+ BH +6;
+    
+    for(i=0; i<NB_BUTT_MAX; i++){
+      m_push_butt[i] = new Fl_Button(0,y+i*BH,width,BH); 
+      m_push_butt[i]->labelsize(CTX.fontsize);
+      m_push_butt[i]->hide();
+      m_toggle_butt[i] = new Fl_Light_Button(0,y+i*BH,width,BH,"test"); 
+      m_toggle_butt[i]->labelsize(CTX.fontsize); 
+      if(i>5)m_toggle_butt[i]->hide();
+      m_popup_butt[i] = new Fl_Menu_Button(0,y+i*BH,width,BH);
+      m_popup_butt[i]->type(Fl_Menu_Button::POPUP3);
+      m_popup_butt[i]->add("Reload", 0, 
+			   (Fl_Callback *)view_reload_cb, (void*)i, 0);
+      m_popup_butt[i]->add("Remove", 0, 
+			   (Fl_Callback *)view_remove_cb, (void*)i, 0);
+      m_popup_butt[i]->add("Duplicate", 0,
+			   (Fl_Callback *)view_duplicate_cb, (void*)i, 0);
+      m_popup_butt[i]->add("Lightning", 0,
+			   (Fl_Callback *)view_lighting_cb, (void*)i, 0);
+      m_popup_butt[i]->add("Show Elements", 0,
+			   (Fl_Callback *)view_elements_cb, (void*)i, 0);
+      m_popup_butt[i]->add("Apply as Background Mesh", 0,
+			   (Fl_Callback *)view_applybgmesh_cb, (void*)i, FL_MENU_DIVIDER);
+      m_popup_butt[i]->add("Time Step...", 0,
+			   (Fl_Callback *)view_timestep_cb, (void*)i, 0);
+      m_popup_butt[i]->add("Options...", 0,
+			   (Fl_Callback *)view_options_cb, (void*)i, 0);
+      m_popup_butt[i]->textsize(CTX.fontsize);
+      if(i>5)m_popup_butt[i]->hide();
+    }
+    
+    m_window->resizable(m_window);
+    
+    m_window->position(800,50);
+    m_window->end();
+    m_window->show();
+
+  }
+    
+  // Graphic Window
+
+  {
+    g_window = new Fl_Window(700,520);
+
+    g_opengl_window = new Opengl_Window(0,0,700,500);
+    
+    {
+      Fl_Group *o = new Fl_Group(0,500,700,20);
+      o->box(FL_THIN_UP_BOX);
+
+      x = 2;
+      g_status_butt[0] = new Fl_Button(x,502,15,16,"X"); x+=15;
+      //g_status_butt[0]->tooltip("Set X view");
+      g_status_butt[1] = new Fl_Button(x,502,15,16,"Y"); x+=15;
+      g_status_butt[2] = new Fl_Button(x,502,15,16,"Z"); x+=15;
+      g_status_butt[3] = new Fl_Button(x,502,16,16,"1:1"); x+=16;
+      g_status_butt[4] = new Fl_Button(x,502,15,16,"?"); x+=15;
+      g_status_butt[5] = new Fl_Button(x,502,15,16,">>"); x+=15;
+      g_status_butt[6] = new Fl_Button(x,502,15,16,"0"); x+=15;
+      for(i = 0 ; i<7 ; i++){
+	g_status_butt[i]->box(FL_FLAT_BOX);
+	g_status_butt[i]->selection_color(FL_WHITE);
+	g_status_butt[i]->labelsize(CTX.fontsize);
+	g_status_butt[i]->align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE|FL_ALIGN_CLIP);
+      }
+
+      g_status_box[0] = new Fl_Box(x,502,(700-x)/3,16);
+      g_status_box[1] = new Fl_Box(x+(700-x)/3,5022,(700-x)/3,16);
+      g_status_box[2] = new Fl_Box(x+2*(700-x)/3,5022,(700-x)/3-2,16);
+      for(i = 0 ; i<3 ; i++){
+	g_status_box[i]->box(FL_FLAT_BOX);
+	g_status_box[i]->labelsize(CTX.fontsize);
+	g_status_box[i]->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE|FL_ALIGN_CLIP);
+      }
+      
+      o->end();
+    }
+
+    g_window->resizable(g_opengl_window);
+    g_window->position(20,30);
+    g_window->end();
+    g_window->show();
+    
+  }
+
+  // Draw the actual scene
+
+  g_opengl_window->redraw();
+
+}
+
+// Definition of general purpose public GUI functions. This is mainly
+// for compatibility with the old Motif programming structure.
+
+void GUI::draw_gl(){
+  g_opengl_window->redraw();
+}
+
+void GUI::draw_gl_overlay(){
+  g_opengl_window->redraw_overlay();
+}
+
+void GUI::run(){
+  Fl::run();
+}
+
+void GUI::check(){
+  Fl::check();
+}
+
+static int initw, inith, init=1;
+void GUI::set_size(int w, int h){
+  if(init){
+    init = 0;
+    initw = w;
+    inith = h;
+  }
+  if(w == initw && h == inith) return;
+  initw = w;
+  inith = h;
+  int hh = g_window->h()-g_opengl_window->h();
+  g_window->size(w,h+hh);
+}
+
+// The window for general options
+
+static int init_opt_general = 0;
+
+void GUI::opt_general(){
+  if(!init_opt_general){
+    init_opt_general = 1 ;
+
+    int width = 280;
+    int height = 5*WB+8*BH ;
+    
+    gen_window = new Fl_Window(width,height);
+    gen_window->box(FL_THIN_UP_BOX);
+    { 
+      Fl_Tabs* o = new Fl_Tabs(WB, WB, width-2*WB, height-3*WB-BH);
+      { 
+	Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Miscellaneous");
+	o->labelsize(CTX.fontsize);
+        gen_butt[0] = new Fl_Check_Button(2*WB, 2*WB+BH, 150, BH, "Show moving axes");
+        gen_butt[1] = new Fl_Check_Button(2*WB, 2*WB+2*BH, 150, BH, "Show small axes");
+        gen_butt[2] = new Fl_Check_Button(2*WB, 2*WB+3*BH, 150, BH, "Enable fast redraw");
+        gen_butt[3] = new Fl_Check_Button(2*WB, 2*WB+4*BH, 150, BH, "Use Display lists");
+        gen_butt[4] = new Fl_Check_Button(2*WB, 2*WB+5*BH, 150, BH, "Enable alpha blending");
+        gen_butt[5] = new Fl_Check_Button(2*WB, 2*WB+6*BH, 150, BH, "Trackball rotation mode");
+	for(int i=0 ; i<6 ; i++){
+	  gen_butt[i]->type(FL_TOGGLE_BUTTON);
+	  gen_butt[i]->down_box(FL_DOWN_BOX);
+	  gen_butt[i]->labelsize(CTX.fontsize);
+	  gen_butt[i]->selection_color(FL_YELLOW);
+	}
+        o->end();
+      }
+      { 
+	Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Projection");
+	o->labelsize(CTX.fontsize);
+        o->hide();
+        gen_butt[6] = new Fl_Check_Button(2*WB, 2*WB+BH, 150, BH, "Orthographic");
+        gen_butt[7] = new Fl_Check_Button(2*WB, 2*WB+2*BH, 150, BH, "Perspective");
+	for(int i=6 ; i<8 ; i++){
+	  gen_butt[i]->type(FL_RADIO_BUTTON);
+	  gen_butt[i]->labelsize(CTX.fontsize);
+	  gen_butt[i]->selection_color(FL_YELLOW);
+	}
+        o->end();
+      }
+      { 
+	Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Light and color");
+	o->labelsize(CTX.fontsize);
+        o->hide();
+        gen_value[0] = new Fl_Value_Input(2*WB, 2*WB+BH, 100, BH, "Color Scheme");
+	gen_value[0]->minimum(1); gen_value[0]->maximum(3); gen_value[0]->step(1);
+	gen_value[1] = new Fl_Value_Input(2*WB, 2*WB+2*BH, 100, BH, "Shininess");
+	gen_value[1]->minimum(0); gen_value[1]->maximum(100); gen_value[1]->step(1);
+        gen_value[2] = new Fl_Value_Input(2*WB, 2*WB+3*BH, 100, BH, "Light Position X");
+	gen_value[2]->minimum(0); gen_value[2]->maximum(100); gen_value[2]->step(1);
+        gen_value[3] = new Fl_Value_Input(2*WB, 2*WB+4*BH, 100, BH, "Light Position Y");
+	gen_value[3]->minimum(0); gen_value[3]->maximum(100); gen_value[3]->step(1);
+        gen_value[4] = new Fl_Value_Input(2*WB, 2*WB+5*BH, 100, BH, "Light Position Z");
+	gen_value[4]->minimum(0); gen_value[4]->maximum(100); gen_value[4]->step(1);
+	for(int i=0 ; i<5 ; i++){
+	  gen_value[i]->labelsize(CTX.fontsize);
+	  gen_value[i]->type(FL_HORIZONTAL);
+	  gen_value[i]->align(FL_ALIGN_RIGHT);
+	}
+        o->end();
+      }
+      o->end();
+
+    }
+
+    { 
+      Fl_Button* o = new Fl_Button(width-2*60-2*WB, height-BH-WB, 60, BH, "cancel");
+      o->labelsize(CTX.fontsize);
+    }
+    { 
+      Fl_Return_Button* o = new Fl_Return_Button(width-60-WB, height-BH-WB, 60, BH, "OK");
+      o->labelsize(CTX.fontsize);
+    }
+
+    gen_window->end();
+    gen_window->show();
+  }
+  else{
+    if(gen_window->shown())
+      gen_window->hide();
+    else
+      gen_window->show();
+    
+  }
+
+}
diff --git a/Gui/GUI.h b/Gui/GUI.h
new file mode 100644
index 0000000000000000000000000000000000000000..5595d2bd74a3e763434d067e8a8cc854a75edce1
--- /dev/null
+++ b/Gui/GUI.h
@@ -0,0 +1,103 @@
+#ifndef _GUI_H_
+#define _GUI_H_
+
+#include <FL/Fl_Window.H>
+#include <FL/Fl_Box.H>
+#include <FL/Fl_Menu_Bar.H>
+#include <FL/fl_draw.H>
+#include <FL/gl.h>
+#include <FL/Fl_Gl_Window.H>
+#include <FL/Fl_Choice.H>
+#include <FL/Fl_Scroll.H>
+#include <FL/Fl_Tabs.H>
+
+#include <FL/Fl_Button.H>
+#include <FL/Fl_Return_Button.H>
+#include <FL/Fl_Toggle_Button.H>
+#include <FL/Fl_Round_Button.H>
+#include <FL/Fl_Light_Button.H>
+#include <FL/Fl_Menu_Button.H>
+#include <FL/Fl_Check_Button.H>
+
+#include <FL/Fl_Value_Input.H>
+
+#define NB_BUTT_MAX  100
+
+// New composite widgets
+
+class Opengl_Window : public Fl_Gl_Window {
+  void draw();
+  void draw_overlay();
+  int handle(int);
+
+  // new
+  void draw_highlight();
+  void clear_overlay();
+  void draw_overlay_zoom();
+  void draw_overlay_highlight();
+
+public:
+  Opengl_Window(int x,int y,int w,int h,const char *l=0)
+    : Fl_Gl_Window(x, y, w, h, l) {}
+};
+
+// The GUI class contains only the important widgets
+
+class GUI{
+
+  int BH; // button height
+  int WB; // window border
+  
+  // Windows
+  Fl_Window  *m_window, *g_window, *gen_window, *geo_window ;
+  Fl_Window  *mesh_window, *post_window, *stat_window ;
+  Fl_Window  *view_window ;
+  Opengl_Window    *g_opengl_window ;
+  
+  // We keep the following widgets for easy further reference
+
+  // menu window
+  Fl_Choice        *m_module_butt ;
+  Fl_Button        *m_navig_butt  [2] ;
+  Fl_Button        *m_push_butt   [NB_BUTT_MAX] ;
+  Fl_Light_Button  *m_toggle_butt [NB_BUTT_MAX] ;
+  Fl_Menu_Button   *m_popup_butt  [NB_BUTT_MAX] ;
+
+  // graphic window
+  Fl_Button        *g_status_butt[7] ;
+  Fl_Box           *g_status_box[3] ;
+
+  // general options window
+  Fl_Check_Button  *gen_butt[10] ;
+  Fl_Value_Input   *gen_value[10] ;
+
+  // geometry options window
+  
+  // mesh options window
+
+  // post-processing options window
+
+  // statistics window
+
+  // view options window
+
+public:
+
+  GUI();
+  void run();
+  void check();
+  void draw_gl();
+  void draw_gl_overlay();
+  void set_size(int w, int h);
+
+  void opt_general();
+  void opt_geometry();
+  void opt_mesh();
+  void opt_post();
+  void opt_stat();
+
+};
+
+
+#endif
+
diff --git a/Gui/Main.cpp b/Gui/Main.cpp
index f4d8c76ac1c4d98d5044914fae252e81a44217b4..4b9218e43951cebd1d93719fe224358e25b01c99 100644
--- a/Gui/Main.cpp
+++ b/Gui/Main.cpp
@@ -1,9 +1,10 @@
-/* $Id: Main.cpp,v 1.1 2001-01-05 09:09:32 geuzaine Exp $ */
+// $Id: Main.cpp,v 1.2 2001-01-08 08:02:57 geuzaine Exp $
 
 #include <signal.h>
 
 #include "Gmsh.h"
 #include "GmshUI.h"
+
 #include "Geo.h"
 #include "Verif.h"
 #include "Mesh.h"
@@ -11,552 +12,35 @@
 #include "Context.h"
 #include "ColorTable.h"
 #include "Parser.h"
-#include "MinMax.h"
-
-#include "Widgets.h"
-#include "Pixmaps.h"
-
-#include "XColors.h"
-#include "XContext.h"
-#include "XRessources.h"
-
-#include "CbContext.h"
-#include "CbGeom.h"
-#include "Register.h"
-#include "Geometry.h"
-
 #include "Static.h"
-#include "XStatic.h"
-
 #include "Version.h"
-
-char gmsh_progname[]  = "This is Gmsh" ;
-char gmsh_copyright[] = "Copyright (C) 1997-2001 J.-F. Remacle, C. Geuzaine";
-char gmsh_version[]   = "Version          : " ;
-char gmsh_os[]        = "Operating System : " GMSH_OS ;
-char gmsh_date[]      = "Build Date       : " GMSH_DATE ;
-char gmsh_host[]      = "Build Host       : " GMSH_HOST ;
-char gmsh_packager[]  = "Packager         : " GMSH_PACKAGER ;
-char gmsh_url[]       = "URL              : http://www.geuz.org/gmsh/" ;
-char gmsh_email[]     = "E-Mail           : Christophe.Geuzaine@ulg.ac.be\n"
-                        "                   Remacle@scorec.rpi.edu" ;
-char gmsh_help[]      = 
-  "Usage: %s [options] [files]\n"
-  "Geometry options:\n"
-  "  -0                    parse input files, output flattened geometry, and exit\n"
-  "Mesh options:\n"
-  "  -1, -2, -3            perform batch 1D, 2D and 3D mesh generation\n"
-  "  -format msh|unv|gref  set output mesh format (default: msh)\n"
-  "  -algo iso|aniso       select 2D mesh algorithm (default: iso)\n"
-  "  -smooth int           set mesh smoothing (default: 0)\n"
-  "  -degree int           set mesh degree (default: 1)\n"
-  "  -scale float          set global scaling factor (default: 1.0)\n"
-  "  -meshscale float      set mesh scaling factor (default: 1.0)\n"
-  "  -clscale float        set characteristic length scaling factor (default: 1.0)\n"
-  "  -rand float           set random perturbation factor (default: 1.e-5)\n"
-  "  -bgm file             load backround mesh from file\n"
-  "  -interactive          display 2D mesh construction interactively\n"
-  "Post Processing options:\n"
-  "  -dl                   enable display lists\n"
-  "  -noview               hide all views on startup\n"
-  "  -link                 link all views on startup\n"
-  "Display options:\n"    
-  "  -nodb                 disable double buffering\n"
-  "  -noov                 disable overlay visual\n"
-  "  -alpha                enable alpha blending\n"
-  "  -notrack              don't use trackball mode for rotations\n"
-  "  -geometry geom        specify main window geometry\n"
-  "  -viewport 9*float     specify rotation, translation and scale\n"
-  "  -display disp         specify display\n"
-  "  -perspective          set projection mode to perspective\n"
-  "  -flash                allow colormap flashing\n"
-  "  -samevisual           force same visual for graphics and UI\n"
-  "Other options:\n"      
-  "  -v int                set verbosity level (default: 2)\n"
-  "  -nothreads            disable threads\n"
-  "  -path string          set path for included files\n"
-  "  -version              show version number\n"
-  "  -info                 show detailed version information\n"
-  "  -help                 show this message\n"
-  ;
-
-char *TheFileNameTab[MAX_OPEN_FILES], *TheBgmFileName=NULL;
-char  ThePathForIncludes[NAME_STR_L];
+#include "GUI.h"
+#include "OpenFile.h"
+#include "GetOptions.h"
 
 extern List_T *Post_ViewList;
+int            SHOW_ALL_ENTITIES ;
 
-/* ------------------------------------------------------------------------ */
-/*  P a r s e                                                               */
-/* ------------------------------------------------------------------------ */
-
-void ParseFile(char *f){
-  char String[256];
-
-  strncpy(yyname,f,NAME_STR_L);
-  yyerrorstate=0;
-  yylineno=1;
-
-  if(!(yyin = fopen(yyname,"r"))){
-    Msg(INFO, "File '%s' Does not Exist", f);
-    return;
-  }
-  
-  fpos_t position;
-  fgetpos(yyin, &position);
-  fgets(String, sizeof(String), yyin) ; 
-  fsetpos(yyin, &position);
-
-  if(!strncmp(String, "$PTS", 4) || 
-     !strncmp(String, "$NO", 3) || 
-     !strncmp(String, "$ELM", 4)){
-    if(THEM->status < 0) mai3d(THEM, 0);
-    Read_Mesh(THEM, yyin, FORMAT_MSH);
-  }
-  else if(!strncmp(String, "$PostFormat", 11) ||
-          !strncmp(String, "$View", 5)){
-    Read_View(yyin, yyname);
-  }
-  else{
-    while(!feof(yyin)) yyparse();
-  }
-  fclose(yyin);
-}
-
-extern int SHOW_ALL_ENTITIES ;
-
-void MergeProblem(char *name){
-  Msg(INFOS, "Merging '%s'",name); 
-
-  ParseFile(name);  
-  if (yyerrorstate) return;
-
-  if (!EntitesVisibles) {
-    RemplirEntitesVisibles(1);
-    SHOW_ALL_ENTITIES = 1;
-  }
-}
-
-void OpenProblem(char *name){
-  char ext[6];
-  
-  InitSymbols();
-  Init_Mesh(&M, 1);
-
-  strncpy(TheFileName,name,NAME_STR_L);
-  strncpy(TheBaseFileName,name,NAME_STR_L);
-
-  strcpy(ext,name+(strlen(name)-4));
-  if(!strcmp(ext,".GEO") || 
-     !strcmp(ext,".geo") || 
-     !strcmp(ext,".msh") || 
-     !strcmp(ext,".pos")){
-    TheBaseFileName[strlen(name)-4] = '\0';
-  }
-  else{
-    strcat(TheFileName,".geo");
-  }
-
-  strncpy(THEM->name, TheBaseFileName,NAME_STR_L);
-
-  if(!CTX.interactive){
-    XtVaSetValues(WID.G.shell,
-                  XmNtitle, TheFileName,
-                  XmNiconName, TheBaseFileName,
-                  NULL);
-  }
-
-  Msg(INFOS, "Opening '%s'", TheFileName); 
-
-  ParseFile(TheFileName);  
-
-  ApplyLcFactor(THEM);
-  mai3d(THEM,0);  
-  Maillage_Dimension_0(&M);
-
-  ZeroHighlight(&M); 
-  CalculateMinMax(THEM->Points);  
-  if (!EntitesVisibles) {
-    RemplirEntitesVisibles(1);
-    SHOW_ALL_ENTITIES = 1;
-  }
-
-}
-
-
-/* ------------------------------------------------------------------------ */
-/*  G e t _ O p t i o n s                                                   */
-/* ------------------------------------------------------------------------ */
-
-void Get_Options (int argc, char *argv[], int *nbfiles) {
-  int i=1;
-
-  TheFileNameTab[0] = "unnamed.geo" ;
-  *nbfiles = 0;
-  
-  while (i < argc) {
-    
-    if (argv[i][0] == '-') {
-      
-      if(!strcmp(argv[i]+1, "0")){ 
-        CTX.interactive = -1; i++;
-      }
-      else if(!strcmp(argv[i]+1, "1")){ 
-        CTX.interactive = 1; i++;
-      }
-      else if(!strcmp(argv[i]+1, "2")){ 
-        CTX.interactive = 2; i++;
-      }
-      else if(!strcmp(argv[i]+1, "3")){ 
-        CTX.interactive = 3; i++;
-      }
-      else if(!strcmp(argv[i]+1, "path")){ 
-        i++;
-        /* we need to make a copy because of bison */
-        if(argv[i] != NULL) 
-          strncpy(ThePathForIncludes, argv[i++], NAME_STR_L) ;
-        else {    
-          fprintf(stderr, ERROR_STR "Missing String\n");
-          exit(1);
-        }
-      }
-      else if(!strcmp(argv[i]+1, "bgm")){ 
-        i++;
-        if(argv[i] != NULL) TheBgmFileName = argv[i++];
-        else {    
-          fprintf(stderr, ERROR_STR "Missing File Name\n");
-          exit(1);
-        }
-      }
-      else if(!strcmp(argv[i]+1, "alpha")){ 
-        CTX.alpha = 1; i++;
-      }
-      else if(!strcmp(argv[i]+1, "notrack")){ 
-        CTX.useTrackball = 0; i++;
-      }
-      else if(!strcmp(argv[i]+1, "flash")){ 
-        CTX.flash = 1; i++;
-      }
-      else if(!strcmp(argv[i]+1, "old")){ 
-        FLAG_OLD_CIRCLE = 1; i++;
-      }
-      else if(!strcmp(argv[i]+1, "dual")){ 
-        CTX.mesh.dual = 1; i++;
-      }
-      else if(!strcmp(argv[i]+1, "samevisual")){ 
-        CTX.same_visual = 1; i++;
-      }
-      else if(!strcmp(argv[i]+1, "interactive")){ 
-        CTX.mesh.interactive = 1; i++;
-      }
-      else if(!strcmp(argv[i]+1, "quality")){
-        i++;
-        if(argv[i]!=NULL) CTX.mesh.quality = atof(argv[i++]);
-        else {    
-          fprintf(stderr, ERROR_STR "Missing Number\n");
-          exit(1);
-        }
-      }
-      else if(!strcmp(argv[i]+1, "scale")){
-        i++;
-        if(argv[i]!=NULL) CTX.geom.scaling_factor = atof(argv[i++]);
-        else {    
-          fprintf(stderr, ERROR_STR "Missing Number\n");
-          exit(1);
-        }
-      }
-      else if(!strcmp(argv[i]+1, "meshscale")){
-        i++;
-        if(argv[i]!=NULL) CTX.mesh.scaling_factor = atof(argv[i++]);
-        else {    
-          fprintf(stderr, ERROR_STR "Missing Number\n");
-          exit(1);
-        }
-      }
-      else if(!strcmp(argv[i]+1, "rand")){
-        i++;
-        if(argv[i]!=NULL) CTX.mesh.rand_factor = atof(argv[i++]);
-        else {    
-          fprintf(stderr, ERROR_STR "Missing Number\n");
-          exit(1);
-        }
-      }
-      else if(!strcmp(argv[i]+1, "clscale")){
-        i++;
-        if(argv[i]!=NULL){
-          CTX.mesh.lc_factor = atof(argv[i++]);
-          if(CTX.mesh.lc_factor <= 0.0){
-            fprintf(stderr, ERROR_STR 
-                    "Characteristic Length Factor Must be > 0\n");
-            exit(1);
-          }
-        }
-        else {    
-          fprintf(stderr, ERROR_STR "Missing Number\n");
-          exit(1);
-        }
-      }
-      else if(!strcmp(argv[i]+1, "smooth")){ 
-        i++;
-        if(argv[i]!=NULL) CTX.mesh.nb_smoothing = atoi(argv[i++]);
-        else{
-          fprintf(stderr, ERROR_STR "Missing Number\n");
-          exit(1);
-        }
-      }
-      else if(!strcmp(argv[i]+1, "degree")){  
-        i++;
-        if(argv[i]!=NULL){
-          CTX.mesh.degree = atoi(argv[i++]);
-          if(CTX.mesh.degree != 1 || CTX.mesh.degree != 2){
-            fprintf(stderr, ERROR_STR "Wrong Degree\n");
-            exit(1);
-          }
-        }
-        else {    
-          fprintf(stderr, ERROR_STR "Missing Number\n");
-          exit(1);
-        }
-      }
-      else if(!strcmp(argv[i]+1, "format") ||  
-              !strcmp(argv[i]+1, "f")){  
-        i++;
-        if(argv[i]!=NULL){
-          if(!strcmp(argv[i],"msh") || 
-             !strcmp(argv[i],"MSH") || 
-             !strcmp(argv[i],"gmsh")){
-            CTX.mesh.format = FORMAT_MSH ;
-          }
-          else if(!strcmp(argv[i],"unv") ||
-                  !strcmp(argv[i],"UNV") || 
-                  !strcmp(argv[i],"ideas")){
-            CTX.mesh.format = FORMAT_UNV ;
-          }
-          else if(!strcmp(argv[i],"gref") ||
-                  !strcmp(argv[i],"GREF") || 
-                  !strcmp(argv[i],"Gref")){
-            CTX.mesh.format = FORMAT_GREF ;
-          }
-          else{
-            fprintf(stderr, ERROR_STR "Unknown Mesh Format\n");
-            exit(1);
-          }
-          i++;
-        }
-        else {    
-          fprintf(stderr, ERROR_STR "Missing Format\n");
-          exit(1);
-        }
-      }
-      else if(!strcmp(argv[i]+1, "algo")){  
-        i++;
-        if(argv[i]!=NULL){
-          if(!strcmp(argv[i],"iso"))
-            CTX.mesh.algo = DELAUNAY_OLDALGO ;
-          else if(!strcmp(argv[i],"aniso"))
-            CTX.mesh.algo = DELAUNAY_NEWALGO ;
-          else{
-            fprintf(stderr, ERROR_STR "Unknown Mesh Algorithm\n");
-            exit(1);
-          }
-          i++;
-        }
-        else {    
-          fprintf(stderr, ERROR_STR "Missing Algorithm\n");
-          exit(1);
-        }
-      }
-      else if(!strcmp(argv[i]+1, "noview")){ 
-        CTX.post.initial_visibility = 0 ; i++;
-      }
-      else if(!strcmp(argv[i]+1, "link")){ 
-        CTX.post.link = 2 ; i++;
-      }
-      else if(!strcmp(argv[i]+1, "fill")){ 
-        CTX.post.initial_intervals = DRAW_POST_DISCRETE ; i++;
-      }
-      else if(!strcmp(argv[i]+1, "nbiso")){ 
-        i++ ;
-        if(argv[i]!=NULL) CTX.post.initial_nbiso = atoi(argv[i++]);
-        else{
-          fprintf(stderr, ERROR_STR "Missing Number\n");
-          exit(1);
-        }
-      }
-      else if(!strcmp(argv[i]+1, "command") || 
-              !strcmp(argv[i]+1, "c")){ 
-        CTX.command_win = 1; i++;
-      }
-      else if(!strcmp(argv[i]+1, "nocommand") ||
-              !strcmp(argv[i]+1, "noc")){ 
-        CTX.command_win = 0; i++;
-      }
-      else if(!strcmp(argv[i]+1, "overlay") ||
-              !strcmp(argv[i]+1, "ov")){ 
-        CTX.overlay = 1; i++;
-      }
-      else if(!strcmp(argv[i]+1, "nooverlay") ||
-              !strcmp(argv[i]+1, "noov")){ 
-        CTX.overlay = CTX.geom.highlight = 0; i++;
-      }
-      else if(!strcmp(argv[i]+1, "perspective") ||
-              !strcmp(argv[i]+1, "p")){ 
-        CTX.ortho = 0; i++;
-      }
-      else if(!strcmp(argv[i]+1, "ortho") ||
-              !strcmp(argv[i]+1, "o")){ 
-        CTX.ortho = 0; i++;
-      }
-      else if(!strcmp(argv[i]+1, "threads")){
-        CTX.threads = 1; i++;
-      }
-      else if(!strcmp(argv[i]+1, "nothreads")){
-        CTX.threads = 0; i++;
-      }
-      else if(!strcmp(argv[i]+1, "viewport")){ 
-        i++ ;
-        if(argv[i]!=NULL){
-          CTX.r[0] = atof(argv[i]) ; i++ ;
-        }
-        if(argv[i]!=NULL){
-          CTX.r[1] = atof(argv[i]) ; i++ ;
-        }
-        if(argv[i]!=NULL){
-          CTX.r[2] = atof(argv[i]) ; i++ ;
-        }
-        if(argv[i]!=NULL){
-          CTX.t[0] = atof(argv[i]) ; i++ ;
-        }
-        if(argv[i]!=NULL){
-          CTX.t[1] = atof(argv[i]) ; i++ ;
-        }
-        if(argv[i]!=NULL){
-          CTX.t[2] = atof(argv[i]) ; i++ ;
-        }
-        if(argv[i]!=NULL){
-          CTX.s[0] = atof(argv[i]) ; i++ ;
-        }
-        if(argv[i]!=NULL){
-          CTX.s[1] = atof(argv[i]) ; i++ ;
-        }
-        if(argv[i]!=NULL){
-          CTX.s[2] = atof(argv[i]) ; i++ ;
-        }
-        else{
-          fprintf(stderr, ERROR_STR "Missing Number\n");
-          exit(1);
-        }
-      }
-      else if(!strcmp(argv[i]+1, "db")){ 
-        CTX.db = 1; i++;
-      }
-      else if(!strcmp(argv[i]+1, "nodb")){ 
-        CTX.db = 0; CTX.geom.highlight = 0; i++;
-      }
-      else if(!strcmp(argv[i]+1, "dl")){ 
-        CTX.display_lists = 1; i++;
-      }
-      else if(!strcmp(argv[i]+1, "nodl")){ 
-        CTX.display_lists = 0; i++;
-      }
-      else if(!strcmp(argv[i]+1, "geometry") ||
-              !strcmp(argv[i]+1, "display")  ||
-              !strcmp(argv[i]+1, "fg")       ||
-              !strcmp(argv[i]+1, "bg")){
-        i++;
-        if(argv[i]!=NULL)
-          i++;
-        else {    
-          fprintf(stderr, ERROR_STR "Missing Argument\n");
-          exit(1);
-        }
-      }
-      else if(!strcmp(argv[i]+1, "iconic")){
-	i++;
-      }
-      else if(!strcmp(argv[i]+1, "v")){  
-        i++;
-        if(argv[i]!=NULL) CTX.verbosity = atoi(argv[i++]);
-        else {    
-          fprintf(stderr, ERROR_STR "Missing Number\n");
-          exit(1);
-        }
-      }
-      else if(!strcmp(argv[i]+1, "version") || 
-              !strcmp(argv[i]+1, "-version")){
-        fprintf(stderr, "%.2f\n", GMSH_VERSION);
-        exit(1);
-      }
-      else if(!strcmp(argv[i]+1, "info") || 
-              !strcmp(argv[i]+1, "-info")){
-        fprintf(stderr, "%s%.2f\n", gmsh_version, GMSH_VERSION);
-        fprintf(stderr, "%s\n", gmsh_os);
-        fprintf(stderr, "%s\n", gmsh_date);
-        fprintf(stderr, "%s\n", gmsh_host);
-        fprintf(stderr, "%s\n", gmsh_packager);
-        fprintf(stderr, "%s\n", gmsh_url);
-        fprintf(stderr, "%s\n", gmsh_email);
-        exit(1) ; 
-      }
-      else if(!strcmp(argv[i]+1, "help") || 
-              !strcmp(argv[i]+1, "-help")){
-        fprintf(stderr, "%s\n", gmsh_progname);
-        fprintf(stderr, "%s\n", gmsh_copyright);
-        fprintf(stderr, gmsh_help, argv[0]);
-        exit(1);
-      }
-      else{
-        fprintf(stderr, "Unknown Option '%s'\n", argv[i]);
-        fprintf(stderr, gmsh_help, argv[0]);
-        exit(1);
-      }
-    }
-
-    else {
-      if(*nbfiles < MAX_OPEN_FILES)
-        TheFileNameTab[(*nbfiles)++] = argv[i++]; 
-      else{
-        fprintf(stderr, ERROR_STR "Too Many Input Files\n");
-        exit(1);
-      }
-    }
-
-  }
+void AddViewInUI(int, char *, int){}
 
-  strncpy(TheFileName, TheFileNameTab[0], NAME_STR_L);
-
-}
-
-char* ShowVisualClass(int cls){
-  if(cls==TrueColor)   return "TrueColor";
-  if(cls==DirectColor) return "DirectColor";
-  if(cls==PseudoColor) return "PseudoColor";
-  if(cls==StaticColor) return "StaticColor";
-  if(cls==GrayScale)   return "GrayScale";
-  if(cls==StaticGray)  return "StaticGray";
-  return "Unknown";
-}
-
-/* ------------------------------------------------------------------------ */
-/*  M a i n                                                                 */
-/* ------------------------------------------------------------------------ */
+GUI *WID ;
 
 int main(int argc, char *argv[]){
   int     i, nbf;
-  XColor  ov_color_def, ov_color_exact;
-  extern char  *TextBuffer, TextAbout[1024];
+  extern char  TextAbout[1024];
  
-  /* Gmsh default context options */
+  // Gmsh default context options
   
   Init_Context();
 
-  /* Command line options */
+  // Command line options
 
   Get_Options(argc, argv, &nbf);
 
   if(CTX.verbosity)
     fprintf(stderr, "%s, Version %.2f\n", gmsh_progname, GMSH_VERSION);
 
-  /* Initialize the static Mesh */
+  // Initialize the static Mesh
 
   M.Vertices = NULL ;
   M.VertexEdges = NULL ;
@@ -570,16 +54,16 @@ int main(int argc, char *argv[]){
   M.PhysicalGroups = NULL ;
   M.Metric = NULL ;
 
-  /* Signal handling */
+  // Signal handling
 
   signal(SIGINT,  Signal); 
   signal(SIGSEGV, Signal);
   signal(SIGFPE,  Signal); 
 
-  /* Non-interactive Gmsh */
+  // Non-interactive Gmsh
 
   if(CTX.interactive){
-    OpenProblem(TheFileName);
+    OpenProblem(CTX.filename);
     if(yyerrorstate)
       exit(1);
     else {
@@ -604,291 +88,50 @@ int main(int argc, char *argv[]){
   }
   
 
-  /* Interactive Gmsh */
+  // Interactive Gmsh
 
-  CTX.interactive = -1 ; /* The GUI is not ready yet for interactivity */
+  CTX.interactive = -1 ; // The GUI is not ready yet for interactivity
 
-  /* Text for about window */
+  // Text for about window
 
   sprintf(TextAbout, "%s\n \n%s%.2f\n%s\n%s\n%s\n%s\n%s\n%s\n \n%s\n \n"
           "Type 'gmsh -help' for command line options",
           gmsh_progname, gmsh_version, GMSH_VERSION, 
           gmsh_os, gmsh_date, gmsh_host, gmsh_packager, 
           gmsh_url, gmsh_email, gmsh_copyright);
-  
-  /* Xlib Threads init */
-  
-#ifdef _USETHREADS  
-  if(CTX.threads){
-    if(!XInitThreads()){
-      Msg(WARNING, "Xlib is not Thread Safe (Reverting to '-nothreads')");
-      CTX.threads = 0;
-    }
-  }
-#else
-  CTX.threads = 0;
-#endif
-  
-  /* Xtoolkit init */
-  
-  XtToolkitInitialize();
-  
-#ifdef _USETHREADS  
-  if(CTX.threads){
-    if(!XtToolkitThreadInitialize()){
-      Msg(WARNING, "Xtoolkit is not Thread Safe (Reverting to '-nothreads')");
-      CTX.threads = 0;
-    }
-  }
-#endif
-  
-  XCTX.AppContext = XtCreateApplicationContext();
-  
-  /* X/Motif default resources */
-
-  XtAppSetFallbackResources(XCTX.AppContext, FallbackResources);
-
-  /* Open display */
-
-  XCTX.display = XtOpenDisplay(XCTX.AppContext, NULL, "gmshGW", ".gmshrc", 
-                               NULL, 0, &argc, argv);
 
-  if(!XCTX.display)
-    Msg(FATAL, "Unable to open the specified display. Set the `DISPLAY'\n"
-        FATAL_NIL "environment variable properly or use the `xhost' command\n"
-        FATAL_NIL "to authorize access to the display");
-
-  /* Check for GLX extension; for Mesa, this is always OK */
-  
-  if(!glXQueryExtension(XCTX.display,NULL,NULL))
-    Msg(FATAL, "The specified display does not support the OpenGL extension (GLX).\n"
-        FATAL_NIL "You may consider using Mesa instead");
-  
-  /* Init with default screen num and default depth */
-  
-  XCTX.scrnum = DefaultScreen(XCTX.display);
-  XCTX.depth  = DefaultDepth(XCTX.display, XCTX.scrnum);
-
-  /* Init with default visual for the gui */
-
-  XCTX.gui.visual = DefaultVisual(XCTX.display,XCTX.scrnum);
-
-  /* Find visual the regular way for glw */
-  
-  if(CTX.db){
-    if(!(XCTX.glw.visinfo = 
-         glXChooseVisual(XCTX.display,XCTX.scrnum, glw_attrib_db))){
-      Msg(WARNING,"GBA Double Buffured Visual not Available");
-      CTX.db = 0;
-    }
-  }
-  
-  if(!CTX.db){
-    if(!(XCTX.glw.visinfo = 
-         glXChooseVisual(XCTX.display,XCTX.scrnum, glw_attrib_sb)))
-      Msg(FATAL, "RGBA Single Buffured Visual not Available");
-  }
+  // Create the GUI
   
-  Msg(DEBUG, "Visual id=%lx depth=%d screen=%d bits/rgb=%d class=%s dblbuf=%d",
-      XCTX.glw.visinfo->visualid, XCTX.glw.visinfo->depth,
-      XCTX.glw.visinfo->screen, XCTX.glw.visinfo->bits_per_rgb,
-#if defined(__cplusplus) || defined(c_plusplus)
-      ShowVisualClass(XCTX.glw.visinfo->c_class), 
-#else
-      ShowVisualClass(XCTX.glw.visinfo->class), 
-#endif
-      CTX.db);
-
-  /* Find visual the regular way for glo */
-  
-#ifndef _NOOV
-  if(CTX.overlay){
-    if(!(XCTX.glo.visinfo = glXChooseVisual(XCTX.display,XCTX.scrnum,glo_attrib))){
-      Msg(DEBUG, "Overlay Visual not Available (Using Blend Function Instead)");
-      CTX.overlay = 0;
-      CTX.geom.highlight = 0;
-    }
-  }
-#else
-  CTX.overlay = 0 ;
-  CTX.geom.highlight = 0;
-#endif
-
-  if(CTX.overlay){
-    Msg(DEBUG,"Overlay Visual id=%lx depth=%d screen=%d bits/rgb=%d class=%s",
-        XCTX.glo.visinfo->visualid, XCTX.glo.visinfo->depth, 
-        XCTX.glo.visinfo->screen, XCTX.glo.visinfo->bits_per_rgb, 
-#if defined(__cplusplus) || defined(c_plusplus)
-        ShowVisualClass(XCTX.glo.visinfo->c_class)
-#else
-        ShowVisualClass(XCTX.glo.visinfo->class)
-#endif
-        );
-  }
+  WID = new GUI();
 
-
-  /* Init with default colormaps */
-
-  XCTX.gui.colormap = DefaultColormap(XCTX.display,0);
-  XCTX.glw.colormap = DefaultColormap(XCTX.display,0);
-  XCTX.glo.colormap = DefaultColormap(XCTX.display,0);
-  
-  /*
-    If not using default visual (i.e. not using the gui visual), we need a colormap for 
-    this visual. Yes, the GL widget can allocate one itself, but we want to make sure 
-    the GUI and the 3D have the same one (if hardware does not allow more than one 
-    simultaneously). This prevents nasty flashing when the window with the 3D widget 
-    looses the focus.
-    */
-  
-  if(!CTX.flash && (XCTX.glw.visinfo->visual != XCTX.gui.visual)){
-    Msg(DEBUG, "Making Another Colormap for Graphic Window");
-    XCTX.glw.colormap = XCreateColormap(XCTX.display, RootWindow(XCTX.display,XCTX.scrnum),
-                                        XCTX.glw.visinfo->visual, AllocNone);
-    if(!XCTX.glw.colormap)
-      Msg(FATAL, "Unable to Create Colormap for Graphic Window (Try Option '-flash')");
-  }
-
-  if(CTX.overlay){
-    if(!CTX.flash && (XCTX.glo.visinfo->visual != XCTX.gui.visual)){
-      Msg(DEBUG, "Making Another Colormap for Overlay Window");
-      XCTX.glo.colormap = XCreateColormap(XCTX.display, RootWindow(XCTX.display,XCTX.scrnum),
-                                          XCTX.glo.visinfo->visual, AllocNone);
-      if(!XCTX.glo.colormap)
-        Msg(FATAL, "Unable to Create Private Colormap for Overlay Window\n"
-            FATAL_NIL "(Try '-noov' and/or '-flash' Options)");
-    }
-  }
-  
-  /* Force to use common visual for GUI and GL? Maybe you can invoke
-     some hardware interrogation function and see if more than one
-     hardware map is supported.  Here, we check for the -samevisual
-     flag */
-  
-  if(CTX.same_visual){
-    XCTX.gui.visual = XCTX.glw.visinfo->visual;
-    XCTX.gui.colormap = XCTX.glw.colormap;
-  }
-
-  /* Create all the motif widgets */
-   
-  CreateWidgets(&WID);
-
-  /* create the OpenGL contexts */
-
-  XCTX.glw.context = glXCreateContext(XtDisplay(WID.G.glw),XCTX.glw.visinfo,NULL,GL_TRUE);  
-
-  if(CTX.overlay){
-    XCTX.glo.context = glXCreateContext(XtDisplay(WID.G.glo),
-                                        XCTX.glo.visinfo,NULL,GL_TRUE);  
-
-    if (!XAllocNamedColor(XCTX.display, XCTX.glo.colormap, 
-                          "white", &ov_color_def, &ov_color_exact)) {
-      Msg(WARNING, "Couldn't Allocate White for Overlay window (Reverting to '-noov')");
-      CTX.overlay = 0;
-    }
-    else
-      XCTX.xcolor.ovwhite = ov_color_def.pixel;
-  }
-
-  if(CTX.overlay){
-    if (!XAllocNamedColor(XCTX.display, XCTX.glo.colormap, 
-                          "black", &ov_color_def, &ov_color_exact)) {
-      Msg(WARNING, "Couldn't Allocate Black for Overlay Window (Reverting to '-noov')");
-      CTX.overlay = 0;
-    }
-    else
-      XCTX.xcolor.ovblack = ov_color_def.pixel;
-  }
-
-  /* X font initialisation */
-  XCTX.xfont.helve = XLoadQueryFont(XCTX.display, CTX.font); 
-  XCTX.xfont.fixed = XLoadQueryFont(XCTX.display, CTX.fixed_font);
-
-  if(XCTX.xfont.helve == NULL){
-    Msg(WARNING, "Unable to Load Font '%s'", CTX.font);
-    XCTX.xfont.helve = XCTX.xfont.fixed ;
-  }
-  if(XCTX.xfont.fixed == NULL)
-    Msg(FATAL, "Unable to Load Font '%s'", CTX.fixed_font);
-  
-  XCTX.xfont.helve_h = XCTX.xfont.helve->max_bounds.ascent + 
-    XCTX.xfont.helve->max_bounds.descent;
-  XCTX.xfont.helve_a = XCTX.xfont.helve->max_bounds.ascent;
-  XCTX.xfont.helve_w = XCTX.xfont.helve->max_bounds.width;
-
-  XCTX.xfont.fixed_h = XCTX.xfont.fixed->max_bounds.ascent +
-    XCTX.xfont.fixed->max_bounds.descent;
-  XCTX.xfont.fixed_a = XCTX.xfont.fixed->max_bounds.ascent;
-  XCTX.xfont.fixed_w = XCTX.xfont.fixed->max_bounds.width;
-
-  /* X color initialisation (set the pixel format and allocate some colors in XCTX) */
-
-  XColorInitialize();
-
-  /* Force widget geometry */
-
-  ForceGeometry(&WID);
-
-  /* Register all the callbacks */
-
-  RegisterCallbacks(&WID);
-
-  /* Realize widgets in the 3 windows (M=menu, G=graphics, C=command) */
-
-  XtRealizeWidget(WID.M.shell);
-  XtRealizeWidget(WID.G.shell);
-  if(CTX.command_win) XtRealizeWidget(WID.C.shell);
-
-  /* Create the pixmaps */
-
-  CreatePixmaps(&WID, &PIX, XCTX.depth);
-
-  /* Select input events for the graphic window and raise overlay window */
-
-  if(CTX.overlay){
-    XRaiseWindow(XtDisplay(WID.G.glo), XtWindow(WID.G.glo));
-    XSelectInput(XtDisplay(WID.G.glo), XtWindow(WID.G.glo), EV_MASK);
-  }
-  else{
-    XSelectInput(XtDisplay(WID.G.glw), XtWindow(WID.G.glw), EV_MASK);
-  }
-
-  /* OpenGL display list for the font */
-
-  if((CTX.font_base = glGenLists(XCTX.xfont.helve->max_char_or_byte2+1)) == 0)
-    Msg(FATAL, "Font out of OpenGL Display Lists");
-
-  glXUseXFont(XCTX.xfont.helve->fid, 
-              XCTX.xfont.helve->min_char_or_byte2, 
-              XCTX.xfont.helve->max_char_or_byte2-XCTX.xfont.helve->min_char_or_byte2+1, 
-              CTX.font_base+XCTX.xfont.helve->min_char_or_byte2);
-
-  /* The GUI is ready */
+  // The GUI is ready
   CTX.interactive = 0 ; 
   CTX.expose = 1 ;
 
-  /* Say welcome! */
+  // Say welcome!
 
-  TextBuffer = (char*)Malloc(1024*sizeof(char));
   Msg(STATUS, "Ready");
   Msg(SELECT, "Gmsh %.2f", GMSH_VERSION);
 
-  /* Open input file */
+  // Display the GUI to have a quick "a la Windows" launch time
+
+  WID->check();
 
-  OpenProblem(TheFileName);
+  // Open input file
 
-  /* Merge all Input Files if any, then init first context (geometry or post) */
+  OpenProblem(CTX.filename);
+
+  // Merge all Input Files, then init first context (geometry or post)
 
   if(nbf > 1){
     for(i=1;i<nbf;i++) MergeProblem(TheFileNameTab[i]);
-    ActualizeContextCb (NULL,(XtPointer)CONTEXT_POST,NULL); 
+    //ActualizeContextCb (NULL,(XtPointer)CONTEXT_POST,NULL); 
   }
   else {
-    ActualizeContextCb(NULL,(XtPointer)CONTEXT_GEOM,NULL);
+    //ActualizeContextCb(NULL,(XtPointer)CONTEXT_GEOM,NULL);
   }
 
-  /* Read background mesh on disk if any */ 
+  // Read background mesh on disk
 
   if(TheBgmFileName){
     MergeProblem(TheBgmFileName);
@@ -897,16 +140,13 @@ int main(int argc, char *argv[]){
     else
       Msg(ERROR, "Invalid Background Mesh (no View)");
   }
-  
-  /* Draw the actual scene */
+
+  // Draw the actual scene
   Init();
   Draw();
 
-  /* Loop until were done */
-  
-  XtAppMainLoop(XCTX.AppContext);
-  
-  /* never here */
-  
+  // loop
+  WID->run();
+
 }
   
diff --git a/Gui/Makefile b/Gui/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..fb9beea508ea9e8a6396be5b93db91eabaf6645f
--- /dev/null
+++ b/Gui/Makefile
@@ -0,0 +1,85 @@
+# $Id: Makefile,v 1.1 2001-01-08 08:03:16 geuzaine Exp $
+#
+# Makefile for "libFltk.a"
+#
+
+.IGNORE:
+
+CC       = c++
+RM       = rm
+RANLIB   = ranlib
+
+LIB      = ../lib/libFltk.a
+INCLUDE  = -I../Common -I../DataStr -I../Graphics -I../Geo\
+           -I../Mesh -I../Parser -I../Fltk
+
+C_FLAGS       = -g -Wall
+OS_FLAGS      = -D_LITTLE_ENDIAN
+VERSION_FLAGS = -D_NOTHREADS -D_FLTK
+
+GL_INCLUDE    = -I$(HOME)/SOURCES/Mesa-3.1/include\
+                -I$(HOME)/SOURCES/Mesa-3.1/include/GL
+GUI_INCLUDE   = -I$(HOME)/SOURCES/fltk
+
+RMFLAGS  = -f
+CFLAGS   = $(C_FLAGS) $(OS_FLAGS) $(VERSION_FLAGS) $(INCLUDE)\
+           $(GUI_INCLUDE) $(GL_INCLUDE)
+
+SRC = Main.cpp \
+      Message.cpp \
+      GUI.cpp\
+      Opengl.cpp\
+      Callbacks.cpp
+
+
+OBJ = $(SRC:.cpp=.o)
+
+.SUFFIXES: .o .cpp
+
+$(LIB): $(OBJ) 
+	ar ruvs $(LIB) $(OBJ) 
+	$(RANLIB) $(LIB)
+
+.cpp.o:
+	$(CC) $(CFLAGS) -c $<
+
+clean:
+	$(RM) $(RMFLAGS) *.o
+
+lint:
+	$(LINT) $(CFLAGS) $(SRC)
+
+depend:
+	(sed '/^# DO NOT DELETE THIS LINE/q' Makefile && \
+	$(CC) -MM $(CFLAGS) ${SRC} \
+	) >Makefile.new
+	cp Makefile Makefile.bak
+	cp Makefile.new Makefile
+	$(RM) $(RMFLAGS) Makefile.new
+
+# DO NOT DELETE THIS LINE
+Main.o: Main.cpp ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \
+  ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \
+  ../Common/GmshUI.h ../Geo/Geo.h ../Geo/Verif.h ../Mesh/Mesh.h \
+  ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Edge.h \
+  ../Geo/ExtrudeParams.h ../Mesh/Metric.h ../Graphics/Draw.h \
+  ../Common/Views.h ../Common/Const.h ../Common/ColorTable.h \
+  ../Common/Context.h ../Parser/Parser.h ../Common/Static.h \
+  ../Common/Version.h GUI.h ../Parser/OpenFile.h ../Common/GetOptions.h
+Message.o: Message.cpp ../Common/Gmsh.h ../Common/Message.h \
+  ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
+  ../DataStr/avl.h ../DataStr/Tools.h ../Common/GmshUI.h \
+  ../Common/Version.h ../Common/Context.h ../Common/Const.h
+GUI.o: GUI.cpp ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \
+  ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \
+  ../Common/GmshUI.h ../Common/Context.h ../Common/Const.h ../Geo/Geo.h \
+  ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Edge.h \
+  ../Geo/ExtrudeParams.h ../Mesh/Metric.h ../Graphics/Draw.h \
+  ../Common/Views.h ../Common/ColorTable.h ../Common/Version.h GUI.h
+Opengl.o: Opengl.cpp ../Common/Gmsh.h ../Common/Message.h \
+  ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
+  ../DataStr/avl.h ../DataStr/Tools.h ../Common/GmshUI.h \
+  ../Common/Context.h ../Common/Const.h ../Geo/Geo.h ../Mesh/Mesh.h \
+  ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Edge.h \
+  ../Geo/ExtrudeParams.h ../Mesh/Metric.h ../Graphics/Draw.h \
+  ../Common/Views.h ../Common/ColorTable.h GUI.h
diff --git a/Gui/Message.cpp b/Gui/Message.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..18b2b3169e6534d767ee5cca96d293f4ad2882fd
--- /dev/null
+++ b/Gui/Message.cpp
@@ -0,0 +1,236 @@
+// $Id: Message.cpp,v 1.1 2001-01-08 08:03:16 geuzaine Exp $
+
+#include <signal.h>
+#include <sys/resource.h>
+
+#include "Gmsh.h"
+#include "GmshUI.h"
+#include "Version.h"
+#include "Context.h"
+
+extern Context_T   CTX;
+
+/* ------------------------------------------------------------------------ */
+/*  S i g n a l                                                             */
+/* ------------------------------------------------------------------------ */
+
+void Signal (int sig_num){
+
+  switch (sig_num){
+  case SIGSEGV : 
+    Msg(FATAL, "Segmentation Violation (Invalid Memory Reference)\n"
+        "------------------------------------------------------\n"
+        "You have discovered a bug in Gmsh. You may e-mail the\n"
+        "context in which it occurred to one of the authors:\n"
+        "type 'gmsh -info' to get feedback information"); 
+    break;
+  case SIGFPE : 
+    Msg(FATAL, "Floating Point Exception (Division by Zero?)"); 
+    break;
+  case SIGINT :
+    Msg(FATAL, "Interrupt (Generated from Terminal Special Character)"); 
+    break;
+  default :
+    Msg(FATAL, "Unknown Signal");
+    break;
+  }
+}
+
+
+/* ------------------------------------------------------------------------ */
+/*  M s g                                                                   */
+/* ------------------------------------------------------------------------ */
+
+char *TextBuffer, TextAbout[1024];
+
+#define PUT_IN_COMMAND_WIN			\
+    vfprintf(stderr, fmt, args); 		\
+    fprintf(stderr, "\n");
+
+
+void Msg(int level, char *fmt, ...){
+  va_list  args;
+  int      abort=0;
+
+  if(level != FATAL && level != ERROR && level != PARSER_ERROR &&
+     CTX.interactive && !CTX.verbosity) 
+    return ;
+
+  va_start (args, fmt);
+
+  switch(level){
+  case FATAL :
+    fprintf(stderr, FATAL_STR);
+    vfprintf(stderr, fmt, args); 
+    fprintf(stderr, "\n");
+    abort = 1; 
+    break;
+  case ERROR :
+    if(CTX.interactive || !CTX.command_win){
+      fprintf(stderr, ERROR_STR);
+      vfprintf(stderr, fmt, args); 
+      fprintf(stderr, "\n");
+    }
+    else{
+      PUT_IN_COMMAND_WIN ;
+    }
+    break;
+  case WARNING :
+    if(CTX.interactive || !CTX.command_win){
+      if(CTX.verbosity > 0){
+        fprintf(stderr, WARNING_STR);
+        vfprintf(stderr, fmt, args); 
+        fprintf(stderr, "\n");
+      }
+    }
+    else{
+      PUT_IN_COMMAND_WIN ;
+    }
+    break;
+  case INFOS :
+    if(CTX.interactive || !CTX.command_win){
+      if(CTX.verbosity > 1){
+        fprintf(stderr, INFOS_STR);
+        vfprintf(stderr, fmt, args); 
+        fprintf(stderr, "\n");
+      }
+    }
+    else{
+      PUT_IN_COMMAND_WIN ;
+    }
+    break;
+  case INFO :
+    if(CTX.interactive){
+      if(CTX.verbosity > 1){
+        fprintf(stderr, INFO_STR);
+        vfprintf(stderr, fmt, args);
+        fprintf(stderr, "\n");
+      }
+    }
+    else{
+      PUT_IN_COMMAND_WIN ;
+      /*
+      vsprintf(TextBuffer, fmt, args);
+      XtVaSetValues(WID.G.infoLabel, XmNlabelString,
+                    XmStringCreateSimple(TextBuffer), NULL);
+      XmUpdateDisplay(WID.G.infoLabel);
+      */
+    }
+    break;
+  case SELECT :
+    if(CTX.interactive){
+      if(CTX.verbosity > 1){
+        fprintf(stderr, SELECT_STR);
+        vfprintf(stderr, fmt, args); 
+        fprintf(stderr, "\n");
+      }
+    }
+    else{
+      PUT_IN_COMMAND_WIN ;
+      /*
+      vsprintf(TextBuffer, fmt, args);
+      XtVaSetValues(WID.G.selectLabel, XmNlabelString, 
+                    XmStringCreateSimple(TextBuffer), NULL);
+      XmUpdateDisplay(WID.G.selectLabel);
+      */
+    }
+    break;
+  case STATUS :
+    if(CTX.interactive){
+      if(CTX.verbosity > 1){
+        fprintf(stderr, STATUS_STR);
+        vfprintf(stderr, fmt, args);
+        fprintf(stderr, "\n");
+      }
+    }
+    else{
+      PUT_IN_COMMAND_WIN ;
+      /*
+      vsprintf(TextBuffer, fmt, args);
+      XtVaSetValues(WID.G.statusLabel, XmNlabelString,
+                    XmStringCreateSimple(TextBuffer), NULL);
+      XmUpdateDisplay(WID.G.statusLabel);
+      */
+    }
+    break;
+  case PARSER_ERROR :
+    if(CTX.interactive || !CTX.command_win){
+      if(CTX.verbosity > 0){
+        fprintf(stderr, PARSER_ERROR_STR);
+        vfprintf(stderr, fmt, args); 
+        fprintf(stderr, "\n");
+      }
+    }
+    else{
+      PUT_IN_COMMAND_WIN ;
+    }
+    break;
+  case PARSER_INFO :
+    if(CTX.interactive || !CTX.command_win){
+      if(CTX.verbosity > 1){
+        fprintf(stderr, PARSER_INFO_STR);
+        vfprintf(stderr, fmt, args); 
+        fprintf(stderr, "\n");
+      }
+    }
+    else{
+      PUT_IN_COMMAND_WIN ;
+    }
+    break;
+  case DEBUG :
+    if(CTX.interactive || !CTX.command_win){
+      if(CTX.verbosity > 2){
+        fprintf(stderr, DEBUG_STR);
+        vfprintf(stderr, fmt, args); 
+        fprintf(stderr, "\n");
+      }
+    }
+    else{
+      PUT_IN_COMMAND_WIN ;
+    }
+    break;
+  }
+
+  va_end (args);
+
+  if(abort) exit(1);
+
+}
+
+
+/* ------------------------------------------------------------------------ */
+/*  C p u                                                                   */
+/* ------------------------------------------------------------------------ */
+
+void GetResources(long *s, long *us, long *mem){
+  static struct rusage r;
+
+  getrusage(RUSAGE_SELF,&r);
+  *s   = (long)r.ru_utime.tv_sec ;
+  *us  = (long)r.ru_utime.tv_usec ;
+  *mem = (long)r.ru_maxrss ;
+}
+
+void PrintResources(FILE *stream, char *fmt, long s, long us, long mem){
+  fprintf(stream, "Resources = %scpu %ld.%ld s / mem %ld kb\n", fmt, s, us, mem);
+}
+
+double Cpu(void){
+  long s, us, mem;
+  GetResources(&s, &us, &mem);
+  return (double)s + (double)us/1.e6 ;
+}
+
+/* ------------------------------------------------------------------------ */
+/*  P r o g r e s s                                                         */
+/* ------------------------------------------------------------------------ */
+
+void Progress(int i){
+}
+
+/* ------------------------------------------------------------------------ */
+/*  E d i t G e o m e t r y                                                 */
+/* ------------------------------------------------------------------------ */
+
+void AddALineInTheEditGeometryForm (char* line){
+}
diff --git a/Gui/Opengl.cpp b/Gui/Opengl.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..22e2da4ab753bc849ac98920f96e2d8ea72e72f8
--- /dev/null
+++ b/Gui/Opengl.cpp
@@ -0,0 +1,470 @@
+// $Id: Opengl.cpp,v 1.1 2001-01-08 08:03:16 geuzaine Exp $
+
+#include "Gmsh.h"
+#include "GmshUI.h"
+#include "Context.h"
+#include "Const.h"
+#include "Geo.h"
+#include "Mesh.h"
+#include "Draw.h"
+#include "GUI.h"
+
+extern GUI *WID;
+extern Mesh M;
+extern Context_T CTX;
+
+void Process_SelectionBuffer(int x, int y, int *n, GLuint *ii, GLuint *jj);
+void Filter_SelectionBuffer(int n, GLuint *typ, GLuint *ient, Vertex **thev,
+                            Curve **thec, Surface **thes, Mesh *m);
+void myZoom(GLdouble X1, GLdouble X2, GLdouble Y1, GLdouble Y2,
+            GLdouble Xc1, GLdouble Xc2, GLdouble Yc1, GLdouble Yc2);
+
+/* ------------------------------------------------------------------------ */
+/*  Init/Draw                                                               */
+/* ------------------------------------------------------------------------ */
+
+void Init(void){
+}
+
+void InitOverlay(void){
+}
+
+void Draw(void){
+  WID->set_size(CTX.viewport[2]-CTX.viewport[0],
+	       CTX.viewport[3]-CTX.viewport[1]);
+  WID->draw_gl();
+}
+
+void DrawOverlay(void){
+  WID->draw_gl_overlay();
+}
+
+void DrawUI(void){
+  WID->check();
+}
+
+
+/* ------------------------------------------------------------------------ 
+    set_XXX
+   ------------------------------------------------------------------------ */
+
+void set_r(int i, double val){
+  if(!CTX.useTrackball){
+    if(!CTX.rlock[i]){
+      CTX.r[i] = val;
+    }
+  }
+}
+
+void set_t(int i, double val){
+  if(!CTX.tlock[i]){
+    CTX.t[i] = val;
+  }
+}
+
+void set_s(int i, double val){
+  if(!CTX.slock[i]){
+    CTX.s[i] = val;
+  }
+}
+
+
+/* ------------------------------------------------------------------------ */
+/*  SelectEntity                                                            */
+/* ------------------------------------------------------------------------ */
+
+int check_type(int type, Vertex *v, Curve *c, Surface *s){
+  return ( (type==ENT_POINT   && v) ||
+           (type==ENT_LINE    && c) ||
+           (type==ENT_SURFACE && s) ) ;
+}
+
+int SelectEntity(int type, Vertex **v, Curve **c, Surface **s){
+  int             hits;
+  GLuint          ii[SELECTION_BUFFER_SIZE],jj[SELECTION_BUFFER_SIZE];
+  int event;
+
+  *v = NULL; *c = NULL; *s = NULL;
+
+  printf("select entity...\n");
+
+  while(1){
+    Fl::check();
+    if((event = Fl::event_key())){
+      if(event == 'q') return(0);
+      if(event == 'e') return(-1);
+    }
+    if(Fl::event_is_click()){
+      Process_SelectionBuffer(Fl::event_x(), Fl::event_y(), &hits, ii, jj);
+      Filter_SelectionBuffer(hits,ii,jj,v,c,s,&M);
+      if(check_type(type,*v,*c,*s)){
+        BeginHighlight();
+        HighlightEntity(*v,*c,*s,1);
+        EndHighlight(1);
+        return(Fl::event_button());
+      }
+    }
+  }
+
+}
+
+
+/* ------------------------------------------------------------------------ */
+/*  The OpenGL Widget                                                       */
+/* ------------------------------------------------------------------------ */
+
+void Opengl_Window::draw() {
+  if (!valid()) {
+    valid(1);
+    CTX.viewport[0] = 0 ;
+    CTX.viewport[1] = 0 ;
+    CTX.viewport[2] = w() ;
+    CTX.viewport[3] = h() ;
+    glViewport(CTX.viewport[0],
+	       CTX.viewport[1],
+	       CTX.viewport[2],
+	       CTX.viewport[3]);
+  }
+  Orthogonalize(0,0);
+  glClearColor(UNPACK_RED(CTX.color.bg)/255.,
+               UNPACK_GREEN(CTX.color.bg)/255.,
+               UNPACK_BLUE(CTX.color.bg)/255.,
+               0.);
+  glClear(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT);
+  Draw3d();
+  Draw2d();
+}
+
+void Opengl_Window::clear_overlay() {
+  if(CTX.overlay) {}
+}
+
+void Opengl_Window::draw_overlay_zoom() {
+  /*
+  if (!valid()) {
+    valid(1);
+    CTX.viewport[0] = 0 ;
+    CTX.viewport[1] = 0 ;
+    CTX.viewport[2] = w() ;
+    CTX.viewport[3] = h() ;
+    glViewport(CTX.viewport[0],
+	       CTX.viewport[1],
+	       CTX.viewport[2],
+	       CTX.viewport[3]);
+  }
+  Orthogonalize(0,0);
+  glClearIndex(0);
+  glClear(GL_COLOR_BUFFER_BIT);  
+
+  glLineWidth(1.);
+  glClearIndex(0);
+  glClear(GL_COLOR_BUFFER_BIT);  
+  glIndexi((CTX.color.bg<CTX.color.fg)?FL_WHITE:FL_BLACK);
+  glBegin(GL_LINE_STRIP);
+  glVertex2d(xb,yb);
+  glVertex2d(xb+movzx,yb);
+  glVertex2d(xb+movzx,yb+movzy);
+  glVertex2d(xb,yb+movzy);
+  glVertex2d(xb,yb);
+  glEnd();
+  */
+}
+
+void Opengl_Window::draw_overlay_highlight(){
+  /*
+  if(CTX.overlay){
+    glXMakeCurrent(XtDisplay(WID.G.glo), XtWindow(WID.G.glo), XCTX.glo.context);
+    if(ov != v || oc != c || os != s) { 
+      glClearIndex(0);
+      glClear(GL_COLOR_BUFFER_BIT);  
+      glIndexi((CTX.color.bg<CTX.color.fg)?XCTX.xcolor.ovwhite:XCTX.xcolor.ovblack);
+      BeginHighlight();
+      HighlightEntity(v,c,s,0);
+      EndHighlight(0);
+    }
+    glXMakeCurrent(XtDisplay(WID.G.glw), XtWindow(WID.G.glw), XCTX.glw.context);
+  }
+  else{
+    if(ov != v || oc != c || os != s) { 
+      if(CTX.geom.highlight){
+	Init();
+	Draw();
+      }
+      BeginHighlight();
+      HighlightEntity(v,c,s,0);
+      EndHighlight(0);
+    }
+  }
+  */
+}
+
+void Opengl_Window::draw_overlay() {
+}
+
+
+static int Modifier=0;
+
+int Opengl_Window::handle(int event) {
+  GLuint          ii[SELECTION_BUFFER_SIZE], jj[SELECTION_BUFFER_SIZE];
+  int             previous_mesh_draw, previous_post_draw ;
+  int             width, height ;
+
+  static int      ibut, hits;
+  static int      ButtonPressed=0, ZoomClick=0, FirstClick=0;
+  static int      x, y, movx, movy;
+  static GLdouble xc1, yc1, xc2, yc2, xt1, yt1, xscale1, yscale1;
+  static GLdouble xb, yb, xc, yc, xe, ye, xz, yz;
+  static GLdouble movzx, movzy;
+  static Vertex   *v=NULL, *ov;
+  static Curve    *c=NULL, *oc;
+  static Surface  *s=NULL, *os;
+  
+  width  = w() ;
+  height = h() ;
+
+  switch (event) {
+
+  /* -------------------------------------------------------------
+     K e y s 
+     ------------------------------------------------------------- */
+
+  case FL_SHORTCUT:
+    /*
+    m = menu->test_shortcut();
+    if (m) {m->do_callback(this, (void*)m); return 1;}
+    */
+    return 0;
+
+  case FL_ENTER :
+  case FL_LEAVE :
+    ButtonPressed = 0;
+    Modifier = 0;
+    return Fl_Gl_Window::handle(event);
+    
+  case FL_FOCUS:
+    return 1;
+
+  case FL_UNFOCUS:
+    return 1;
+
+  case FL_KEYBOARD:
+    
+    switch(Fl::event_key()){
+    case FL_Control_L : case FL_Control_R : 
+      printf("got a ctrl\n");
+      Modifier = 1; 
+      return 1;
+    case FL_Alt_L : case FL_Alt_R : 
+    case FL_Meta_L : case FL_Meta_R : 
+      Modifier = 2; 
+      return 1;
+    default:
+      return Fl_Gl_Window::handle(event);
+    }
+    break;
+    
+  /* -------------------------------------------------------------
+     B u t t o n P r e s s
+     ------------------------------------------------------------- */
+
+  case FL_PUSH:
+
+    ButtonPressed++;
+    FirstClick=1;
+    ibut = Fl::event_button();
+    x    = Fl::event_x();
+    y    = Fl::event_y();
+
+    switch(ibut){
+    case 1:
+      if(!ZoomClick && Modifier){
+        xb = CTX.vxmin + ((GLdouble) x / width) * (CTX.vxmax - CTX.vxmin);
+        yb = CTX.vymax - ((GLdouble) y / height) * (CTX.vymax - CTX.vymin);
+        xc1 = xb/CTX.s[0] - CTX.t[0];
+        yc1 = yb/CTX.s[1] - CTX.t[1];
+        ZoomClick=1;
+        Modifier = 0;
+      }
+      else if(ZoomClick){
+        xe = CTX.vxmin + ((GLdouble) x / width) * (CTX.vxmax - CTX.vxmin);
+        ye = CTX.vymax - ((GLdouble) y / height) * (CTX.vymax - CTX.vymin);
+        xc2 = xe/CTX.s[0] - CTX.t[0];
+        yc2 = ye/CTX.s[1] - CTX.t[1];     
+        ZoomClick=0;
+        clear_overlay();
+        if(xb!=xe && yb!=ye) myZoom(xb,xe,yb,ye,xc1,xc2,yc1,yc2);
+      } 
+      break;
+    case 2:
+      if(Modifier && !ZoomClick){
+        Modifier = 0;
+        set_s(1, CTX.s[0]);
+        set_s(2, CTX.s[0]);
+        Init();
+        Draw();
+      }
+      else{
+        ZoomClick=0;
+        clear_overlay();
+      }
+      break;      
+    case 3:
+      if(Modifier && !ZoomClick){
+        Modifier = 0;
+	if(CTX.useTrackball){
+	  CTX.setQuaternion(0.,0.,0.,1.);
+	}
+	else{
+	  set_r(0,0.); set_r(1,0.); set_r(2,0.); 
+	}
+        set_t(0,0.); set_t(1,0.); set_t(2,0.);
+        set_s(0,1.); set_s(1,1.); set_s(2,1.);
+        Init();
+        Draw();
+      }
+      else{
+        ZoomClick=0;
+        clear_overlay();
+      }
+      break;
+    }
+
+    return 1;
+
+  /* -------------------------------------------------------------
+      B u t t o n R e l e a s e
+     ------------------------------------------------------------- */
+
+  case FL_RELEASE:
+
+    if(ButtonPressed>0){
+      ButtonPressed--;
+      ibut = Fl::event_button();
+      x    = Fl::event_x();
+      y    = Fl::event_y();
+    }
+    if(!ZoomClick){
+      Init();
+      previous_mesh_draw = CTX.mesh.draw ;
+      previous_post_draw = CTX.post.draw ;
+      if(ButtonPressed>0){
+        if(CTX.fast) CTX.mesh.draw = CTX.post.draw = 0;
+      }
+      Draw();
+      CTX.mesh.draw = previous_mesh_draw ;
+      CTX.post.draw = previous_post_draw ;
+    }
+
+    return 1;
+
+      
+  /* -------------------------------------------------------------
+      M o t i o n N o t i f y 
+     ------------------------------------------------------------- */
+
+  case FL_DRAG:
+
+    movx = Fl::event_x()-x;
+    movy = Fl::event_y()-y;
+
+    if(ZoomClick) {
+      printf("should draw the zoom... %d %d %d %d\n", x, y, movx, movy);
+
+      xz = CTX.vxmin + ((GLdouble) Fl::event_x() / width) *
+	(CTX.vxmax - CTX.vxmin);
+      yz = CTX.vymax - ((GLdouble) Fl::event_y() / height) * 
+	(CTX.vymax - CTX.vymin) ;
+
+      movzx = xz - xb; movzy = yz - yb;
+      draw_overlay();
+    }
+    else {
+      if(ButtonPressed){
+
+	clear_overlay();
+
+        if(FirstClick){
+          xc1 = ( ((GLdouble) x / width) * (CTX.vxmax - CTX.vxmin) 
+		  + CTX.vxmin )/CTX.s[0] - CTX.t[0];
+          yc1 = ( CTX.vymax - ((GLdouble) y / height) * 
+		  (CTX.vymax - CTX.vymin))/CTX.s[1] - CTX.t[1];
+          xt1 = CTX.t[0];
+          yt1 = CTX.t[1];
+          xscale1 = CTX.s[0];
+          yscale1 = CTX.s[1];
+          FirstClick=0;
+        }
+
+        switch(ibut){
+        case 1:
+	  
+	  if(CTX.useTrackball){
+	    CTX.addQuaternion ((2.0*x - width) / width,
+			       (height - 2.0*y) / height,
+			       (2.0*Fl::event_x() - width) / width,
+			       (height - 2.0*Fl::event_y()) / height);
+	  }
+	  else{
+	    set_r(1, CTX.r[1] + ((abs(movx) > abs(movy))?180*(float)movx/(float)width:0));
+	    set_r(0, CTX.r[0] + ((abs(movx) > abs(movy))?0:180*(float)movy/(float)height));
+	  }
+          break;
+        case 2:
+	  if(!CTX.useTrackball)
+	    set_r(2, CTX.r[2] + ((abs(movy) > abs(movx))?0:-180*(float)movx/(float)width));         
+
+          set_s(0, CTX.s[0] * ( (abs(movy) > abs(movx)) ?
+                                ( (movy>0) ? (float)(1.04*(abs(movy)+height))/(float)height
+                                  : (float)(height)/(float)(1.04*(abs(movy)+height)) )
+                                : 1.) );                    
+          set_s(1, CTX.s[0]);
+          set_s(2, CTX.s[0]);
+
+          if(abs(movy) > abs(movx)){
+            set_t(0, xt1*(xscale1/CTX.s[0])-xc1*(1.-(xscale1/CTX.s[0])));
+            set_t(1, yt1*(yscale1/CTX.s[1])-yc1*(1.-(yscale1/CTX.s[1])));
+          }
+          break;
+        case 3:
+          xc = ( ((GLdouble) x / width) * (CTX.vxmax - CTX.vxmin) + 
+		 CTX.vxmin ) / CTX.s[0];
+          yc = ( CTX.vymax - ((GLdouble) y / height) *
+		 (CTX.vymax - CTX.vymin)) / CTX.s[1];
+          set_t(0, xc-xc1);
+          set_t(1, yc-yc1);
+          set_t(2, 0.);
+          break;
+        }
+        Init();
+        previous_mesh_draw = CTX.mesh.draw ;
+        previous_post_draw = CTX.post.draw ;
+        if(CTX.fast) CTX.mesh.draw = CTX.post.draw = 0;
+        Draw();
+        CTX.mesh.draw = previous_mesh_draw ;
+        CTX.post.draw = previous_post_draw ;
+      }
+      else{
+        Process_SelectionBuffer(Fl::event_x(), Fl::event_y(), &hits, ii, jj);
+        ov = v; oc = c; os = s; 
+        v = NULL; c = NULL; s = NULL;
+        Filter_SelectionBuffer(hits,ii,jj,&v,&c,&s,&M);
+	draw_overlay_highlight();
+      }
+      x += movx; 
+      y += movy; 
+    }
+
+    return 1;
+
+  /* -------------------------------------------------------------
+      O t h er
+     ------------------------------------------------------------- */
+
+  default:
+    // pass other events to the base class...
+    return Fl_Gl_Window::handle(event);
+
+  }
+
+}
+
diff --git a/Makefile b/Makefile
index 4889e1d36720f01ea5a398819d3da66c38b39664..a58a9aa9f7349eec16dccada6b0c4df6333cd49d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.32 2000-12-29 10:27:00 geuzaine Exp $
+# $Id: Makefile,v 1.33 2001-01-08 08:05:39 geuzaine Exp $
 # ----------------------------------------------------------------------
 #  Makefile for Gmsh  
 # ----------------------------------------------------------------------
@@ -15,28 +15,37 @@
                    -I$(HOME)/SOURCES/Mesa-3.1/include\
                    -I$(HOME)/SOURCES/Mesa-3.1/include/GL
        MOTIF_INC = -I/usr/X11R6/LessTif/Motif1.2/include
+        FLTK_INC = -I$(HOME)/SOURCES/fltk
 
-      OPENGL_LIB = -lGLw -lGLU -lGL
-        MESA_LIB = -L$(HOME)/SOURCES/Mesa-3.1/lib -lGLw -lGLU -lGL
- MESA_STATIC_LIB = $(HOME)/SOURCES/Mesa-static/lib/libGLw.a\
-                   $(HOME)/SOURCES/Mesa-static/lib/libGLU.a\
+      OPENGL_LIB = -lGLU -lGL
+OPENGL_MOTIF_LIB = -lGLw
+        MESA_LIB = -L$(HOME)/SOURCES/Mesa-3.1/lib -lGLU -lGL
+  MESA_MOTIF_LIB = -L$(HOME)/SOURCES/Mesa-3.1/lib -lGLw
+ MESA_STATIC_LIB = $(HOME)/SOURCES/Mesa-static/lib/libGLU.a\
                    $(HOME)/SOURCES/Mesa-static/lib/libGL.a
-#      MOTIF_LIB = /usr/local/lib/libXm.so.2
-       MOTIF_LIB = -L/usr/local/lib -L/usr/X11R6/LessTif/Motif1.2/lib -lXm 
-           X_LIB = -L/usr/X11R6/lib -lXt -lX11 -lXext
+MESA_MOTIF_STATIC_LIB = $(HOME)/SOURCES/Mesa-static/lib/libGLw.a
+#     XMOTIF_LIB = /usr/local/lib/libXm.so.2 -L/usr/X11R6/lib -lXt -lX11 -lXext
+      XMOTIF_LIB = -L/usr/local/lib -L/usr/X11R6/LessTif/Motif1.2/lib -lXm\
+                   -L/usr/X11R6/lib -lXt -lX11 -lXext 
+        FLTK_LIB = -L$(HOME)/SOURCES/fltk/lib -lfltk\
+                   -L/usr/X11R6/lib -lXext -lX11
       THREAD_LIB = -L/usr/lib -lpthread
         JPEG_LIB = jpeg/libjpeg.a
 
-        GMSH_DIR = Adapt Common DataStr Geo Graphics Mesh Parser Unix jpeg
-GMSH_DISTRIB_DIR = $(GMSH_DIR) utils
+        GMSH_DIR = Adapt Common DataStr Geo Graphics Mesh Parser Motif Fltk jpeg utils
+ GMSH_XMOTIF_DIR = Adapt Common DataStr Geo Graphics Mesh Parser Motif jpeg
+   GMSH_FLTK_DIR = Adapt Common DataStr Geo Graphics Mesh Parser Fltk jpeg
     GMSH_BOX_DIR = Adapt Box Common DataStr Geo Mesh Parser
+  GMSH_UTILS_DIR = utils
     GMSH_BIN_DIR = bin
     GMSH_LIB_DIR = lib
     GMSH_DOC_DIR = doc
    GMSH_DEMO_DIR = demos
   GMSH_TUTOR_DIR = tutorial
 GMSH_ARCHIVE_DIR = archives
-        GMSH_LIB = -L$(GMSH_LIB_DIR) -lUnix -lGraphics -lParser -lMesh -lGeo\
+ GMSH_XMOTIF_LIB = -L$(GMSH_LIB_DIR) -lMotif -lGraphics -lParser -lMesh -lGeo\
+                                     -lAdapt -lCommon -lDataStr $(JPEG_LIB)
+   GMSH_FLTK_LIB = -L$(GMSH_LIB_DIR) -lFltk -lParser -lGraphics -lMesh -lGeo\
                                      -lAdapt -lCommon -lDataStr $(JPEG_LIB)
     GMSH_BOX_LIB = -L$(GMSH_LIB_DIR) -lBox -lParser -lMesh -lGeo\
                                      -lAdapt -lCommon -lDataStr
@@ -50,73 +59,92 @@ GMSH_ARCHIVE_DIR = archives
       GMSH_UNAME = `uname`
 
 default: initialtag
-	@for i in $(GMSH_DIR); do (cd $$i && $(MAKE) \
+	@for i in $(GMSH_XMOTIF_DIR); do (cd $$i && $(MAKE) \
+           "CC=$(CC)" \
+           "C_FLAGS=$(FLAGS)" \
+           "OS_FLAGS=-D_LITTLE_ENDIAN" \
+           "VERSION_FLAGS=-D_XMOTIF" \
+           "GL_INCLUDE=$(OPENGL_INC)" \
+           "GUI_INCLUDE=$(MOTIF_INC)" \
+        ); done
+
+fltk: initialtag
+	@for i in $(GMSH_FLTK_DIR); do (cd $$i && $(MAKE) \
            "CC=$(CC)" \
            "C_FLAGS=$(FLAGS)" \
-           "OS_FLAGS=-D_XMOTIF -D_LITTLE_ENDIAN" \
-           "VERSION_FLAGS=" \
+           "OS_FLAGS=-D_LITTLE_ENDIAN" \
+           "VERSION_FLAGS=-D_FLTK" \
            "GL_INCLUDE=$(OPENGL_INC)" \
-           "MOTIF_INCLUDE=$(MOTIF_INC)" \
+           "GUI_INCLUDE=$(FLTK_INC)" \
         ); done
 
 threads: initialtag
-	@for i in $(GMSH_DIR); do (cd $$i && $(MAKE) \
+	@for i in $(GMSH_XMOTIF_DIR); do (cd $$i && $(MAKE) \
            "CC=$(CC)" \
            "C_FLAGS=$(FLAGS)" \
-           "OS_FLAGS=-D_XMOTIF -D_LITTLE_ENDIAN" \
-           "VERSION_FLAGS=" \
+           "OS_FLAGS=-D_LITTLE_ENDIAN" \
+           "VERSION_FLAGS=-D_XMOTIF" \
            "GL_INCLUDE=$(OPENGL_INC)" \
-           "MOTIF_INCLUDE=$(MOTIF_INC)" \
+           "GUI_INCLUDE=$(MOTIF_INC)" \
         ); done
 
 profile: initialtag
-	@for i in $(GMSH_DIR); do (cd $$i && $(MAKE) \
+	@for i in $(GMSH_XMOTIF_DIR); do (cd $$i && $(MAKE) \
            "CC=$(CC)" \
            "C_FLAGS=-O3 -pg" \
-           "OS_FLAGS=-D_XMOTIF -D_LITTLE_ENDIAN" \
-           "VERSION_FLAGS=" \
+           "OS_FLAGS=-D_LITTLE_ENDIAN" \
+           "VERSION_FLAGS=-D_XMOTIF" \
            "GL_INCLUDE=$(OPENGL_INC)" \
-           "MOTIF_INCLUDE=$(MOTIF_INC)" \
+           "GUI_INCLUDE=$(MOTIF_INC)" \
         ); done
-	$(CC) -pg -o $(GMSH_BIN_DIR)/gmsh-profile $(GMSH_LIB) $(OPENGL_LIB) \
-                 $(MOTIF_LIB) $(X_LIB) $(THREAD_LIB) -lm
+	$(CC) -pg -o $(GMSH_BIN_DIR)/gmsh-profile $(GMSH_XMOTIF_LIB)\
+              $(OPENGL_MOTIF_LIB) $(OPENGL_LIB) $(XMOTIF_LIB) $(THREAD_LIB) -lm
 
 gmsh:
-	$(CC) -o $(GMSH_BIN_DIR)/gmsh $(GMSH_LIB) $(OPENGL_LIB) \
-                 $(MOTIF_LIB) $(X_LIB) $(THREAD_LIB) -lm
+	$(CC) -o $(GMSH_BIN_DIR)/gmsh $(GMSH_XMOTIF_LIB)\
+              $(OPENGL_MOTIF_LIB) $(OPENGL_LIB) $(XMOTIF_LIB) $(THREAD_LIB) -lm
 
 gmsh2:
-	$(CC) -o $(GMSH_BIN_DIR)/gmsh $(GMSH_LIB) $(MESA_LIB) \
-                 $(MOTIF_LIB) $(X_LIB) $(THREAD_LIB) -lm
+	$(CC) -o $(GMSH_BIN_DIR)/gmsh $(GMSH_XMOTIF_LIB)\
+              $(MESA_MOTIF_LIB) $(MESA_LIB) $(XMOTIF_LIB) $(THREAD_LIB) -lm
+
+gmsh3:
+	$(CC) -o $(GMSH_BIN_DIR)/gmsh $(GMSH_FLTK_LIB) $(MESA_LIB) \
+                 $(FLTK_LIB) $(THREAD_LIB) -lm
+
+gmsh4:
+	$(CC) -o $(GMSH_BIN_DIR)/gmsh $(GMSH_FLTK_LIB) $(MESA_LIB) \
+                 $(FLTK_LIB) -lfltk_gl $(THREAD_LIB) -lm
 
 gmshm:
-	$(CC) -o $(GMSH_BIN_DIR)/gmshm $(GMSH_LIB) $(MESA_STATIC_LIB) \
-                 $(MOTIF_LIB) $(X_LIB) $(THREAD_LIB) -lm
+	$(CC) -o $(GMSH_BIN_DIR)/gmshm $(GMSH_XMOTIF_LIB)\
+              $(MESA_MOTIF_STATIC_LIB) $(MESA_STATIC_LIB)\
+              $(XMOTIF_LIB) $(THREAD_LIB) -lm
 
 parser:
 	cd Parser && $(MAKE) parser
 
 purge:
-	for i in "." $(GMSH_DISTRIB_DIR) $(GMSH_LIB_DIR) $(GMSH_ARCHIVE_DIR)\
+	for i in "." $(GMSH_DIR) $(GMSH_LIB_DIR) $(GMSH_ARCHIVE_DIR)\
                      $(GMSH_DEMO_DIR) $(GMSH_TUTOR_DIR) $(GMSH_DOC_DIR) $(GMSH_BOX_DIR); \
         do (cd $$i && $(RM) $(RMFLAGS) *~ *~~); \
         done
 
 clean:
-	for i in $(GMSH_DISTRIB_DIR) $(GMSH_DOC_DIR) $(GMSH_LIB_DIR) ; \
+	for i in $(GMSH_DIR) $(GMSH_DOC_DIR) $(GMSH_LIB_DIR) ; \
         do (cd $$i && $(MAKE) clean); \
         done
 
 depend:
-	for i in $(GMSH_DISTRIB_DIR); \
+	for i in $(GMSH_DIR); \
         do (cd $$i && $(MAKE) depend \
            "CC=$(CC)" \
            "GL_INCLUDE=$(OPENGL_INC)" \
-           "MOTIF_INCLUDE=$(MOTIF_INC)" \
+           "GUI_INCLUDE=$(MOTIF_INC) $(FLTK_INC)" \
         ); done
 
 nodepend:
-	for i in $(GMSH_DISTRIB_DIR) ; do \
+	for i in $(GMSH_DIR) ; do \
           (cd $$i && (sed '/^# DO NOT DELETE THIS LINE/q' Makefile) > Makefile.new \
           && cp Makefile Makefile.bak \
           && cp Makefile.new Makefile \
@@ -165,9 +193,9 @@ bb: tag
            "CC=$(CC)" \
            "C_FLAGS=-O3" \
            "OS_FLAGS=" \
-           "VERSION_FLAGS=" \
+           "VERSION_FLAGS=-D_BLACKBOX" \
            "GL_INCLUDE=" \
-           "MOTIF_INCLUDE=" \
+           "GUI_INCLUDE=" \
         ); done
 	$(CC) -o $(GMSH_BIN_DIR)/gmsh-box $(GMSH_BOX_LIB) -lm
 
@@ -176,9 +204,9 @@ bbn: tag
            "CC=g++ -mno-cygwin -I/mingw/include" \
            "C_FLAGS=-O3" \
            "OS_FLAGS=" \
-           "VERSION_FLAGS=" \
+           "VERSION_FLAGS=-D_BLACKBOX" \
            "GL_INCLUDE=" \
-           "MOTIF_INCLUDE=" \
+           "GUI_INCLUDE=" \
         ); done
 	g++ -o $(GMSH_BIN_DIR)/gmsh.exe -mno-cygwin -L/mingw/lib $(GMSH_BOX_LIB) -lm
 
@@ -217,90 +245,90 @@ strip_bin:
 	strip $(GMSH_BIN_DIR)/gmsh
 
 compile_little_endian:
-	@for i in $(GMSH_DISTRIB_DIR); do (cd $$i && $(MAKE) \
+	@for i in $(GMSH_XMOTIF_DIR); do (cd $$i && $(MAKE) \
            "CC=g++" \
            "C_FLAGS=-O3" \
-           "OS_FLAGS=-D_XMOTIF -D_LITTLE_ENDIAN" \
-           "VERSION_FLAGS=" \
+           "OS_FLAGS=-D_LITTLE_ENDIAN" \
+           "VERSION_FLAGS=-D_XMOTIF" \
            "GL_INCLUDE=$(OPENGL_INC)" \
-           "MOTIF_INCLUDE=$(MOTIF_INC)" \
+           "GUI_INCLUDE=$(MOTIF_INC)" \
         ); done
 
 compile_little_endian_2952:
-	@for i in $(GMSH_DISTRIB_DIR); do (cd $$i && $(MAKE) \
+	@for i in $(GMSH_XMOTIF_DIR); do (cd $$i && $(MAKE) \
            "CC=$(HOME)/gcc-2.95.2/bin/g++" \
            "C_FLAGS=-O3" \
-           "OS_FLAGS=-D_XMOTIF -D_LITTLE_ENDIAN" \
-           "VERSION_FLAGS=" \
+           "OS_FLAGS=-D_LITTLE_ENDIAN" \
+           "VERSION_FLAGS=-D_XMOTIF" \
            "GL_INCLUDE=$(OPENGL_INC)" \
-           "MOTIF_INCLUDE=$(MOTIF_INC)" \
+           "GUI_INCLUDE=$(MOTIF_INC)" \
         ); done
 
 compile_little_endian_threads:
-	@for i in $(GMSH_DISTRIB_DIR); do (cd $$i && $(MAKE) \
+	@for i in $(GMSH_XMOTIF_DIR); do (cd $$i && $(MAKE) \
            "CC=g++" \
            "C_FLAGS=-D_REENTRANT -O3" \
-           "OS_FLAGS=-D_XMOTIF -D_LITTLE_ENDIAN" \
-           "VERSION_FLAGS=-D_USETHREADS" \
+           "OS_FLAGS=-D_LITTLE_ENDIAN" \
+           "VERSION_FLAGS=-D_XMOTIF -D_USETHREADS" \
            "GL_INCLUDE=$(OPENGL_INC)" \
-           "MOTIF_INCLUDE=$(MOTIF_INC)" \
+           "GUI_INCLUDE=$(MOTIF_INC)" \
         ); done
 
 compile_big_endian:
-	@for i in $(GMSH_DISTRIB_DIR); do (cd $$i && $(MAKE) \
+	@for i in $(GMSH_XMOTIF_DIR); do (cd $$i && $(MAKE) \
            "CC=g++" \
            "C_FLAGS=-O3" \
-           "OS_FLAGS=-D_XMOTIF" \
-           "VERSION_FLAGS=" \
+           "OS_FLAGS=" \
+           "VERSION_FLAGS=-D_XMOTIF" \
            "GL_INCLUDE=$(OPENGL_INC)" \
-           "MOTIF_INCLUDE=$(MOTIF_INC)" \
+           "GUI_INCLUDE=$(MOTIF_INC)" \
         ); done
 
 # special car -O2 merde dans 3d_smesh.c sur TransfiniteHex()
 compile_sgi:
-	@for i in $(GMSH_DIR); do (cd $$i && $(MAKE) \
+	@for i in $(GMSH_XMOTIF_DIR); do (cd $$i && $(MAKE) \
            "CC=CC" \
            "C_FLAGS=-O2 -o32 -Olimit 3000" \
            "RANLIB=true"\
            "AR=CC -o32 -ar -o"\
-           "OS_FLAGS=-D_XMOTIF" \
-           "VERSION_FLAGS=" \
+           "OS_FLAGS=" \
+           "VERSION_FLAGS=-D_XMOTIF" \
            "GL_INCLUDE=$(OPENGL_INC)" \
-           "MOTIF_INCLUDE=$(MOTIF_INC)" \
+           "GUI_INCLUDE=$(MOTIF_INC)" \
         ); done
 	@for i in Mesh; do (cd $$i && $(MAKE) \
            "CC=CC" \
            "C_FLAGS=-O1 -o32" \
            "AR=CC -o32 -ar -o"\
            "RANLIB=true"\
-           "OS_FLAGS=-D_XMOTIF" \
-           "VERSION_FLAGS=" \
+           "OS_FLAGS=" \
+           "VERSION_FLAGS=-D_XMOTIF" \
            "GL_INCLUDE=$(OPENGL_INC)" \
-           "MOTIF_INCLUDE=$(MOTIF_INC)" \
+           "GUI_INCLUDE=$(MOTIF_INC)" \
         ); done
 
 link_sgi:
-	CC -O2 -o32 -o $(GMSH_BIN_DIR)/gmsh $(GMSH_LIB) $(OPENGL_LIB) \
-              $(MOTIF_LIB) $(X_LIB) -lm
+	CC -O2 -o32 -o $(GMSH_BIN_DIR)/gmsh $(GMSH_XMOTIF_LIB)\
+           $(OPENGL_MOTIF_LIB) $(OPENGL_LIB) $(XMOTIF_LIB) -lm
 
 link_opengl:
-	g++ -o $(GMSH_BIN_DIR)/gmsh $(GMSH_LIB)\
-               $(OPENGL_LIB) $(MOTIF_LIB) $(X_LIB) -lm
+	g++ -o $(GMSH_BIN_DIR)/gmsh $(GMSH_XMOTIF_LIB)\
+            $(OPENGL_MOTIF_LIB) $(OPENGL_LIB) $(XMOTIF_LIB) -lm
 
 link_mesa:
-	g++ -o $(GMSH_BIN_DIR)/gmsh $(GMSH_LIB)\
-               $(MESA_LIB) $(MOTIF_LIB) $(X_LIB) -lm
+	g++ -o $(GMSH_BIN_DIR)/gmsh $(GMSH_XMOTIF_LIB)\
+            $(MESA_MOTIF_LIB) $(MESA_LIB) $(XMOTIF_LIB) -lm
 
 link_mesa_2952:
-	$(HOME)/gcc-2.95.2/bin/g++ -o $(GMSH_BIN_DIR)/gmsh $(GMSH_LIB)\
-               $(MESA_LIB) $(MOTIF_LIB) $(X_LIB) -lm
+	$(HOME)/gcc-2.95.2/bin/g++ -o $(GMSH_BIN_DIR)/gmsh $(GMSH_XMOTIF_LIB)\
+               $(MESA_MOTIF_LIB) $(MESA_LIB) $(XMOTIF_LIB) -lm
 
 link_mesa_threads:
-	g++ -o $(GMSH_BIN_DIR)/gmsh $(GMSH_LIB)\
-               $(MESA_LIB) $(MOTIF_LIB) $(X_LIB) $(THREAD_LIB) -lm
+	g++ -o $(GMSH_BIN_DIR)/gmsh $(GMSH_XMOTIF_LIB)\
+               $(MESA_MOTIF_LIB) $(MESA_LIB) $(XMOTIF_LIB) $(THREAD_LIB) -lm
 
 # special car +s necessaire pour shared libs avec SHLIB_PATH variable.
 link_hp:
-	g++ -Wl,+s -o $(GMSH_BIN_DIR)/gmsh $(GMSH_LIB)\
-                      $(MESA_LIB) $(MOTIF_LIB) $(X_LIB) -lm
+	g++ -Wl,+s -o $(GMSH_BIN_DIR)/gmsh $(GMSH_XMOTIF_LIB)\
+                      $(MESA_MOTIF_LIB) $(MESA_LIB) $(XMOTIF_LIB) -lm
 
diff --git a/Mesh/1D_Mesh.cpp b/Mesh/1D_Mesh.cpp
index 02da012d3035335e44e14239d6d90a2aa5a652d5..597b202d058aabad659bccf77fe2a739870ad68b 100644
--- a/Mesh/1D_Mesh.cpp
+++ b/Mesh/1D_Mesh.cpp
@@ -1,4 +1,4 @@
-/* $Id: 1D_Mesh.cpp,v 1.9 2000-12-06 18:28:30 remacle Exp $ */
+// $Id: 1D_Mesh.cpp,v 1.10 2001-01-08 08:05:44 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Const.h"
diff --git a/Mesh/2D_BGMesh.cpp b/Mesh/2D_BGMesh.cpp
index f1570b9d81abd27eca18cb9238fd504280499be5..8547833db5cc92d8adfde8fa2c540a54fc2db9ed 100644
--- a/Mesh/2D_BGMesh.cpp
+++ b/Mesh/2D_BGMesh.cpp
@@ -1,4 +1,4 @@
-/* $Id: 2D_BGMesh.cpp,v 1.4 2000-11-26 15:43:46 geuzaine Exp $ */
+// $Id: 2D_BGMesh.cpp,v 1.5 2001-01-08 08:05:44 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Const.h"
diff --git a/Mesh/2D_Bowyer.cpp b/Mesh/2D_Bowyer.cpp
index 3fc8e0b56bd3e9bdf933f6861436da229d6f67b1..817dc19b61c154825e4f476421f8c27fd3ab75d5 100644
--- a/Mesh/2D_Bowyer.cpp
+++ b/Mesh/2D_Bowyer.cpp
@@ -1,4 +1,5 @@
-/* $Id: 2D_Bowyer.cpp,v 1.4 2000-11-26 15:43:46 geuzaine Exp $ */
+// $Id: 2D_Bowyer.cpp,v 1.5 2001-01-08 08:05:44 geuzaine Exp $
+
 /*
 
    A L G O R I T H M E       D E      B O W Y E R  -  W A T S O N
diff --git a/Mesh/2D_Bricks.cpp b/Mesh/2D_Bricks.cpp
index 2ddee7a347a12363402f789f02406d67b9b6cd48..ee3303e7edf911934b7c5f874ebaa27ab13c4e19 100644
--- a/Mesh/2D_Bricks.cpp
+++ b/Mesh/2D_Bricks.cpp
@@ -1,4 +1,4 @@
-/* $Id: 2D_Bricks.cpp,v 1.3 2000-11-26 15:43:46 geuzaine Exp $ */
+// $Id: 2D_Bricks.cpp,v 1.4 2001-01-08 08:05:44 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Const.h"
diff --git a/Mesh/2D_Cylindrical.cpp b/Mesh/2D_Cylindrical.cpp
index 145e79b6cd1b1e3ea5d3cb04d6b099b9b2f4aed9..7a289fa575ed4cef6502fa15ad9055a37c0c8e20 100644
--- a/Mesh/2D_Cylindrical.cpp
+++ b/Mesh/2D_Cylindrical.cpp
@@ -1,4 +1,4 @@
-/* $Id: 2D_Cylindrical.cpp,v 1.3 2000-11-23 23:20:35 geuzaine Exp $ */
+// $Id: 2D_Cylindrical.cpp,v 1.4 2001-01-08 08:05:44 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Const.h"
diff --git a/Mesh/2D_DivAndConq.cpp b/Mesh/2D_DivAndConq.cpp
index c8dbfb2a96a69a913e03adbf94352454f55c793b..dc502a44d93d711acafb9c95cfdaccbe40bcee4d 100644
--- a/Mesh/2D_DivAndConq.cpp
+++ b/Mesh/2D_DivAndConq.cpp
@@ -1,4 +1,5 @@
-/* $Id: 2D_DivAndConq.cpp,v 1.7 2000-11-28 12:59:24 geuzaine Exp $ */
+// $Id: 2D_DivAndConq.cpp,v 1.8 2001-01-08 08:05:44 geuzaine Exp $
+
 /*
 
    A L G O R I T H M E    D I V I D E    A N D     C O N Q U E R   
diff --git a/Mesh/2D_Elliptic.cpp b/Mesh/2D_Elliptic.cpp
index e07f01c6b68603667b3407fed3dad6b26d5823e0..8c6454f6d3c358ade0af662cf2d31bf572f33191 100644
--- a/Mesh/2D_Elliptic.cpp
+++ b/Mesh/2D_Elliptic.cpp
@@ -1,4 +1,4 @@
-/* $Id: 2D_Elliptic.cpp,v 1.3 2000-11-26 15:43:46 geuzaine Exp $ */
+// $Id: 2D_Elliptic.cpp,v 1.4 2001-01-08 08:05:44 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Const.h"
diff --git a/Mesh/2D_InitMesh.cpp b/Mesh/2D_InitMesh.cpp
index 167a8b1fa6d460f1283fae25be074cfab293a3f4..029ee44a7e7dbcfe7bc02cd8e621c1e3d5e93d07 100644
--- a/Mesh/2D_InitMesh.cpp
+++ b/Mesh/2D_InitMesh.cpp
@@ -1,4 +1,5 @@
-/* $Id: 2D_InitMesh.cpp,v 1.4 2000-11-26 15:43:46 geuzaine Exp $ */
+// $Id: 2D_InitMesh.cpp,v 1.5 2001-01-08 08:05:44 geuzaine Exp $
+
 /*
  
    Generation du maillage initial 2D
diff --git a/Mesh/2D_Links.cpp b/Mesh/2D_Links.cpp
index 71f36ef2ce11614b2d9c660d81ab96a078963bfb..09b77d25baf17855d2108fefcbf65a6f93a28ba6 100644
--- a/Mesh/2D_Links.cpp
+++ b/Mesh/2D_Links.cpp
@@ -1,4 +1,4 @@
-/* $Id: 2D_Links.cpp,v 1.4 2000-11-26 15:43:46 geuzaine Exp $ */
+// $Id: 2D_Links.cpp,v 1.5 2001-01-08 08:05:44 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Const.h"
diff --git a/Mesh/2D_Mesh.cpp b/Mesh/2D_Mesh.cpp
index dbde0bbdc5c25ebb910e98f729cf0ad19fecfbde..aa208bab6eedb1b6d6b6d2af95ae7623c94eaba7 100644
--- a/Mesh/2D_Mesh.cpp
+++ b/Mesh/2D_Mesh.cpp
@@ -1,4 +1,5 @@
-/* $Id: 2D_Mesh.cpp,v 1.13 2000-12-18 08:31:58 geuzaine Exp $ */
+// $Id: 2D_Mesh.cpp,v 1.14 2001-01-08 08:05:44 geuzaine Exp $
+
 /*
    Maillage Delaunay d'une surface (Point insertion Technique)
 
diff --git a/Mesh/2D_Mesh.h b/Mesh/2D_Mesh.h
index 2713dedb868d26f78afe32a0d779a9cd3be4c9dc..66259a1997e6ffc6d9c21a4171b5d4dc4fad74f1 100644
--- a/Mesh/2D_Mesh.h
+++ b/Mesh/2D_Mesh.h
@@ -1,4 +1,3 @@
-/* $Id: 2D_Mesh.h,v 1.4 2000-11-26 15:43:46 geuzaine Exp $ */
 #ifndef _2D_MESH_H_
 #define _2D_MESH_H_
 
diff --git a/Mesh/2D_Mesh_Aniso.cpp b/Mesh/2D_Mesh_Aniso.cpp
index 9e1dc03308085a90d7392e114abd72f94348bed2..2e09e655b22c8e3561c234a514fac81f2c1af097 100644
--- a/Mesh/2D_Mesh_Aniso.cpp
+++ b/Mesh/2D_Mesh_Aniso.cpp
@@ -1,4 +1,5 @@
-/* $Id: 2D_Mesh_Aniso.cpp,v 1.8 2000-11-26 15:43:46 geuzaine Exp $ */
+// $Id: 2D_Mesh_Aniso.cpp,v 1.9 2001-01-08 08:05:44 geuzaine Exp $
+
 /*
    Jean-Francois Remacle
 
diff --git a/Mesh/2D_Parametric.cpp b/Mesh/2D_Parametric.cpp
index 8cdbe17c485f20c9a6dc5fa48b714f1edae3f242..fa038277b93bafe464b244ae93dcd048d9a54402 100644
--- a/Mesh/2D_Parametric.cpp
+++ b/Mesh/2D_Parametric.cpp
@@ -1,4 +1,4 @@
-/* $Id: 2D_Parametric.cpp,v 1.3 2000-11-26 15:43:46 geuzaine Exp $ */
+// $Id: 2D_Parametric.cpp,v 1.4 2001-01-08 08:05:44 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Const.h"
diff --git a/Mesh/2D_Recombine.cpp b/Mesh/2D_Recombine.cpp
index 722a2a834bf2a8aa16030abc1e2814552e8acbb4..c881da6b66b6b8e1cd66b97a5f81f9da21ef40e7 100644
--- a/Mesh/2D_Recombine.cpp
+++ b/Mesh/2D_Recombine.cpp
@@ -1,4 +1,4 @@
-/* $Id: 2D_Recombine.cpp,v 1.3 2000-11-26 15:43:46 geuzaine Exp $ */
+// $Id: 2D_Recombine.cpp,v 1.4 2001-01-08 08:05:44 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Const.h"
diff --git a/Mesh/2D_SMesh.cpp b/Mesh/2D_SMesh.cpp
index 08985f6d323ad6ceb894cd16f287de47937975b6..e4d410111e174cd7cb7aea1e48f7fbfcca838dc7 100644
--- a/Mesh/2D_SMesh.cpp
+++ b/Mesh/2D_SMesh.cpp
@@ -1,4 +1,5 @@
-/* $Id: 2D_SMesh.cpp,v 1.4 2000-11-26 15:43:46 geuzaine Exp $ */
+// $Id: 2D_SMesh.cpp,v 1.5 2001-01-08 08:05:44 geuzaine Exp $
+
 /*  
   Maillage transfini surfacique                                                 
                                             *s2
diff --git a/Mesh/2D_Tree.cpp b/Mesh/2D_Tree.cpp
index 4fc0c86a737a8717191537af3324e26a4a0a2253..46e0735944f00398a2af98c2328a5803512eb315 100644
--- a/Mesh/2D_Tree.cpp
+++ b/Mesh/2D_Tree.cpp
@@ -1,4 +1,4 @@
-/* $Id: 2D_Tree.cpp,v 1.3 2000-11-26 15:43:46 geuzaine Exp $ */
+// $Id: 2D_Tree.cpp,v 1.4 2001-01-08 08:05:44 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Mesh.h"
diff --git a/Mesh/2D_Util.cpp b/Mesh/2D_Util.cpp
index 56b9764709623e5f8344bc9d2e698e1a6572d9fa..4c607476a20eb3e63fd4218e8e0411844617b040 100644
--- a/Mesh/2D_Util.cpp
+++ b/Mesh/2D_Util.cpp
@@ -1,4 +1,4 @@
-/* $Id: 2D_Util.cpp,v 1.6 2000-11-26 15:43:46 geuzaine Exp $ */
+// $Id: 2D_Util.cpp,v 1.7 2001-01-08 08:05:44 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Const.h"
diff --git a/Mesh/3D_BGMesh.cpp b/Mesh/3D_BGMesh.cpp
index 39966735d45635925a58011f9b13d9afa215c8af..ba947ca1849a0b61be77acfe1243cc9f8e802213 100644
--- a/Mesh/3D_BGMesh.cpp
+++ b/Mesh/3D_BGMesh.cpp
@@ -1,4 +1,4 @@
-/* $Id: 3D_BGMesh.cpp,v 1.12 2000-12-09 22:26:12 geuzaine Exp $ */
+// $Id: 3D_BGMesh.cpp,v 1.13 2001-01-08 08:05:44 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Mesh.h"
diff --git a/Mesh/3D_Bricks.cpp b/Mesh/3D_Bricks.cpp
index fae53f02a05d78ba8a4774b9089c795acd9d1997..bae086d4278f129c21c8db5a49113cb16805ee83 100644
--- a/Mesh/3D_Bricks.cpp
+++ b/Mesh/3D_Bricks.cpp
@@ -1,4 +1,4 @@
-/* $Id: 3D_Bricks.cpp,v 1.5 2000-11-26 15:43:46 geuzaine Exp $ */
+// $Id: 3D_Bricks.cpp,v 1.6 2001-01-08 08:05:45 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Const.h"
diff --git a/Mesh/3D_Coherence.cpp b/Mesh/3D_Coherence.cpp
index d1a77eabf609a503bb92036d9035ba05eb38c45f..7cec4164bb93ca86832e0a7496748e88650d14d5 100644
--- a/Mesh/3D_Coherence.cpp
+++ b/Mesh/3D_Coherence.cpp
@@ -1,4 +1,4 @@
-/* $Id: 3D_Coherence.cpp,v 1.9 2000-12-03 16:25:42 geuzaine Exp $ */
+// $Id: 3D_Coherence.cpp,v 1.10 2001-01-08 08:05:45 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Const.h"
diff --git a/Mesh/3D_Divide.cpp b/Mesh/3D_Divide.cpp
index cc6858e3f6381b2cee0656f397502a62979338fb..7db8a8e1a07ecc4bacae3daa153fd053779362e7 100644
--- a/Mesh/3D_Divide.cpp
+++ b/Mesh/3D_Divide.cpp
@@ -1,4 +1,4 @@
-/* $Id: 3D_Divide.cpp,v 1.6 2000-11-26 18:43:48 geuzaine Exp $ */
+// $Id: 3D_Divide.cpp,v 1.7 2001-01-08 08:05:45 geuzaine Exp $
 
 /* Routine de division des elements tetraedriques
    ou triangulaires
diff --git a/Mesh/3D_Extrude.cpp b/Mesh/3D_Extrude.cpp
index e061cff60354ee5d8329eb80b44c18fad12f7c9d..1f104d35b996041de2916d5946026015c67c568a 100644
--- a/Mesh/3D_Extrude.cpp
+++ b/Mesh/3D_Extrude.cpp
@@ -1,4 +1,4 @@
-/* $Id: 3D_Extrude.cpp,v 1.5 2000-11-26 15:43:46 geuzaine Exp $ */
+// $Id: 3D_Extrude.cpp,v 1.6 2001-01-08 08:05:45 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Const.h"
diff --git a/Mesh/3D_Mesh.cpp b/Mesh/3D_Mesh.cpp
index 051afd80e7e67b7ad020ec625ff10b2b0dd76e73..7a4e5b8496ac992a29b697b6c8f2be3502e6cf34 100644
--- a/Mesh/3D_Mesh.cpp
+++ b/Mesh/3D_Mesh.cpp
@@ -1,4 +1,5 @@
-/* $Id: 3D_Mesh.cpp,v 1.12 2000-12-27 17:25:52 geuzaine Exp $ */
+// $Id: 3D_Mesh.cpp,v 1.13 2001-01-08 08:05:45 geuzaine Exp $
+
 /*
  
   J-F Remacle 1995
diff --git a/Mesh/3D_Mesh.h b/Mesh/3D_Mesh.h
index 72c08559b8ceaa5f072e1d1acf8f24e15fc69d22..48c20ce1396207294c74094c0201b5868027ecc4 100644
--- a/Mesh/3D_Mesh.h
+++ b/Mesh/3D_Mesh.h
@@ -1,4 +1,3 @@
-/* $Id: 3D_Mesh.h,v 1.3 2000-11-26 15:43:46 geuzaine Exp $ */
 #ifndef _3D_MESH_H_
 #define _3D_MESH_H_
 
diff --git a/Mesh/3D_SMesh.cpp b/Mesh/3D_SMesh.cpp
index c37de00148fc0e68ad5ba9e7ac000fb927b92e35..deb0f8eb7942e2c40e37db577639993b5035731d 100644
--- a/Mesh/3D_SMesh.cpp
+++ b/Mesh/3D_SMesh.cpp
@@ -1,4 +1,5 @@
-/* $Id: 3D_SMesh.cpp,v 1.5 2000-11-26 15:43:46 geuzaine Exp $ */
+// $Id: 3D_SMesh.cpp,v 1.6 2001-01-08 08:05:45 geuzaine Exp $
+
 /*  
   Maillage transfini volumique
 
diff --git a/Mesh/Create.cpp b/Mesh/Create.cpp
index 3abd94c805b9dcaa4eb1c412b641714a2254ce01..ec856d16bfc2ea52186531c681d4df14a9f509aa 100644
--- a/Mesh/Create.cpp
+++ b/Mesh/Create.cpp
@@ -1,4 +1,4 @@
-/* $Id: Create.cpp,v 1.6 2000-11-26 15:43:47 geuzaine Exp $ */
+// $Id: Create.cpp,v 1.7 2001-01-08 08:05:45 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Const.h"
@@ -6,9 +6,11 @@
 #include "CAD.h"
 #include "Mesh.h"
 #include "Numeric.h"
+#include "Context.h"
 
-extern Mesh *THEM;
-extern int CurrentSimplexNumber, FLAG_OLD_CIRCLE;
+extern Mesh      *THEM;
+extern Context_T  CTX;
+extern int        CurrentSimplexNumber;
 
 //static double CIRC_GRAN = 2.2;
 
@@ -262,7 +264,7 @@ void End_Curve (Curve * c){
     mat[0][1] = Curve->Circle.invmat[1][0] = dir12[1];
     mat[0][2] = Curve->Circle.invmat[2][0] = dir12[2];
     
-    if(FLAG_OLD_CIRCLE){
+    if(CTX.geom.old_circle){
       if(n[0] == 0.0 && n[1] == 0.0){
         mat[2][0] = Curve->Circle.invmat[0][2] = 0;
         mat[2][1] = Curve->Circle.invmat[1][2] = 0;
diff --git a/Mesh/Create.h b/Mesh/Create.h
index 4b2f87c6abf7a682ccee70abb36c422ca117afa1..522cbb6a0b5d845c328184df212cc3278cbc346c 100644
--- a/Mesh/Create.h
+++ b/Mesh/Create.h
@@ -1,4 +1,3 @@
-/* $Id: Create.h,v 1.3 2000-11-26 15:43:47 geuzaine Exp $ */
 #ifndef _CREATE_H_
 #define _CREATE_H_
 
diff --git a/Mesh/CrossData.cpp b/Mesh/CrossData.cpp
index f831c73c2ed68a4d8ae31304055c557e54b24036..e2f4e0c4c97e46bfa2f7e3a42c97231f87591d24 100644
--- a/Mesh/CrossData.cpp
+++ b/Mesh/CrossData.cpp
@@ -1,4 +1,4 @@
-/* $Id: CrossData.cpp,v 1.3 2000-11-26 15:43:47 geuzaine Exp $ */
+// $Id: CrossData.cpp,v 1.4 2001-01-08 08:05:45 geuzaine Exp $
 
 
 #include "Gmsh.h"
diff --git a/Mesh/Edge.cpp b/Mesh/Edge.cpp
index d845da889f2eed11b307d985fa1426b45784a7e3..00bdb614f5219cda766d08f7fd7022651beea0f4 100644
--- a/Mesh/Edge.cpp
+++ b/Mesh/Edge.cpp
@@ -1,4 +1,4 @@
-/* $Id: Edge.cpp,v 1.3 2000-11-26 15:43:47 geuzaine Exp $ */
+// $Id: Edge.cpp,v 1.4 2001-01-08 08:05:45 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Mesh.h"
diff --git a/Mesh/Edge.h b/Mesh/Edge.h
index 048bf407f1acd269f8b3d16d2ea1850002ab6103..d856e4ae8762dd27f1484645f9a5b150ca3ec3c1 100644
--- a/Mesh/Edge.h
+++ b/Mesh/Edge.h
@@ -1,4 +1,3 @@
-/* $Id: Edge.h,v 1.2 2000-11-23 14:11:35 geuzaine Exp $ */
 #ifndef _EDGE_H_
 #define _EDGE_H_
 
diff --git a/Mesh/Generator.cpp b/Mesh/Generator.cpp
index 822a9f527c780853eab69e7a47ad584d9187c404..430393f3e9dad5aa4afe49a2d9eb3f32ea1b6152 100644
--- a/Mesh/Generator.cpp
+++ b/Mesh/Generator.cpp
@@ -1,11 +1,11 @@
-/* $Id: Generator.cpp,v 1.7 2000-11-26 15:43:47 geuzaine Exp $ */
+// $Id: Generator.cpp,v 1.8 2001-01-08 08:05:45 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Const.h"
 #include "Mesh.h"
 #include "Create.h"
 #include "Context.h"
-#include "Main.h"
+#include "OpenFile.h"
 
 extern Mesh     *THEM;
 extern Context_T CTX;
@@ -195,7 +195,7 @@ void mai3d (Mesh * M, int Asked){
 
   if ((Asked > oldstatus && Asked >= 0 && oldstatus < 0) ||
       (Asked < oldstatus)){
-    OpenProblem (TheFileName);
+    OpenProblem (CTX.filename);
     M->status = 0;
   }
   
diff --git a/Mesh/Interpolation.cpp b/Mesh/Interpolation.cpp
index 9dbf72415cfd78094d0874dc574f83249c29ccb1..14d6645bddae7458dacdce6e69f6fb5b98d11dc6 100644
--- a/Mesh/Interpolation.cpp
+++ b/Mesh/Interpolation.cpp
@@ -1,4 +1,4 @@
-/* $Id: Interpolation.cpp,v 1.6 2000-11-30 14:57:52 geuzaine Exp $ */
+// $Id: Interpolation.cpp,v 1.7 2001-01-08 08:05:45 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Const.h"
diff --git a/Mesh/Interpolation.h b/Mesh/Interpolation.h
index 1a15e7d84182de3f1e9c4b4a090e23a9f43f7bc1..33ca717052fc6d3f86691f0163ab6c5424c62bec 100644
--- a/Mesh/Interpolation.h
+++ b/Mesh/Interpolation.h
@@ -1,4 +1,3 @@
-/* $Id: Interpolation.h,v 1.3 2000-11-26 15:43:47 geuzaine Exp $ */
 #ifndef _INTERPOLATION_H_
 #define _INTERPOLATION_H_
 
diff --git a/Mesh/Makefile b/Mesh/Makefile
index 5c2f41636f0d915c7bae45881b7480ab2b85e3b4..b18e7547c5b585df34c40ed0b396413d1a35ae84 100644
--- a/Mesh/Makefile
+++ b/Mesh/Makefile
@@ -1,24 +1,24 @@
-# $Id: Makefile,v 1.7 2000-12-29 10:27:00 geuzaine Exp $
+# $Id: Makefile,v 1.8 2001-01-08 08:05:45 geuzaine Exp $
 #
 # Makefile for "libMesh.a"
 #
 
 .IGNORE:
 
-CC        = c++
-C_FLAGS   = -g -Wall
-
-OS_FLAGS = -D_XMOTIF
-
-RM       = rm
-RMFLAGS  = -f
+CC      = c++
+RM      = rm
 RANLIB  = ranlib
 
 LIB     = ../lib/libMesh.a
 INCLUDE = -I../Adapt -I../Common -I../DataStr -I../Geo -I../Mesh\
-          -I../Graphics -I../Unix
+          -I../Graphics -I../Motif -I../Parser -I../Fltk
+
+C_FLAGS       = -g -Wall
+OS_FLAGS      = -D_LITTLE_ENDIAN
+VERSION_FLAGS = 
 
-CFLAGS  = $(C_FLAGS) $(OS_FLAGS) $(INCLUDE)
+RMFLAGS  = -f
+CFLAGS   = $(C_FLAGS) $(OS_FLAGS) $(INCLUDE)
 
 SRC = 1D_Mesh.cpp \
       2D_Mesh.cpp \
@@ -203,12 +203,13 @@ Create.o: Create.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Common/Const.h ../Geo/Geo.h \
   ../Geo/CAD.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Simplex.h \
-  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/Metric.h Mesh.h Numeric.h
+  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/Metric.h Mesh.h Numeric.h \
+  ../Common/Context.h
 Generator.o: Generator.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Common/Const.h Mesh.h Vertex.h \
   Simplex.h Edge.h ../Geo/ExtrudeParams.h Metric.h Create.h \
-  ../Common/Context.h ../Unix/Main.h
+  ../Common/Context.h ../Parser/OpenFile.h
 Print_Mesh.o: Print_Mesh.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Common/Const.h ../Geo/Geo.h \
@@ -264,7 +265,8 @@ CrossData.o: CrossData.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../Geo/ExtrudeParams.h Metric.h
 Vertex.o: Vertex.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
-  ../DataStr/avl.h ../DataStr/Tools.h Vertex.h ../Common/Context.h
+  ../DataStr/avl.h ../DataStr/Tools.h Vertex.h ../Common/Context.h \
+  ../Common/Const.h
 Edge.o: Edge.cpp ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \
   ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \
   Mesh.h Vertex.h Simplex.h Edge.h ../Geo/ExtrudeParams.h Metric.h \
diff --git a/Mesh/Matrix.h b/Mesh/Matrix.h
index c3a70187a7c6cf770cc8ac69203a42c306a771bc..f4d546221883d9391e885af48770493fe4681e7a 100644
--- a/Mesh/Matrix.h
+++ b/Mesh/Matrix.h
@@ -1,4 +1,3 @@
-/* $Id: Matrix.h,v 1.3 2000-11-26 15:43:47 geuzaine Exp $ */
 #ifndef _MATRIX_H_
 #define _MATRIX_H_
 
diff --git a/Mesh/Mesh.h b/Mesh/Mesh.h
index 4286e9ff9e482c63ce225e1c30be7a17fdf42e7e..5f6fa4bcd779245309f73503d1bcfbad5e9ea5a6 100644
--- a/Mesh/Mesh.h
+++ b/Mesh/Mesh.h
@@ -1,4 +1,3 @@
-/* $Id: Mesh.h,v 1.11 2000-12-26 17:40:18 geuzaine Exp $ */
 #ifndef _MESH_H_
 #define _MESH_H_
 
diff --git a/Mesh/MeshQuality.cpp b/Mesh/MeshQuality.cpp
index 257fcb331fd3800c7e7b6d5e6b89bce644d77849..e6725df2af48cd2c17b1084631bc3ea7f102360f 100644
--- a/Mesh/MeshQuality.cpp
+++ b/Mesh/MeshQuality.cpp
@@ -1,4 +1,4 @@
-/* $Id: MeshQuality.cpp,v 1.2 2000-11-23 14:11:35 geuzaine Exp $ */
+// $Id: MeshQuality.cpp,v 1.3 2001-01-08 08:05:45 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Const.h"
diff --git a/Mesh/Metric.cpp b/Mesh/Metric.cpp
index 08ee814fc7119679b41ca24d3d439d569ac7f811..2606d9f27248f48774f4df7cfc9e788a53e26ed2 100644
--- a/Mesh/Metric.cpp
+++ b/Mesh/Metric.cpp
@@ -1,4 +1,4 @@
-/* $Id: Metric.cpp,v 1.4 2000-11-28 11:28:32 geuzaine Exp $ */
+// $Id: Metric.cpp,v 1.5 2001-01-08 08:05:46 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Const.h"
diff --git a/Mesh/Metric.h b/Mesh/Metric.h
index 280d65f65cd92dda3cda598223da656a75263d13..af7c8f212862c191536483f95d0de5571b346196 100644
--- a/Mesh/Metric.h
+++ b/Mesh/Metric.h
@@ -1,4 +1,3 @@
-/* $Id: Metric.h,v 1.4 2000-11-26 15:43:47 geuzaine Exp $ */
 #ifndef _METRIC_H_
 #define _METRIC_H_
 
diff --git a/Mesh/Numeric.cpp b/Mesh/Numeric.cpp
index ff43a5f3176a3898573a4b5e1fbf4425273d047b..e5f21226bdbbcf847030533826a74ffeb7e8a1b3 100644
--- a/Mesh/Numeric.cpp
+++ b/Mesh/Numeric.cpp
@@ -1,4 +1,4 @@
-/* $Id: Numeric.cpp,v 1.12 2000-12-18 14:20:45 geuzaine Exp $ */
+// $Id: Numeric.cpp,v 1.13 2001-01-08 08:05:46 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Const.h"
diff --git a/Mesh/Numeric.h b/Mesh/Numeric.h
index 905141c96c80f228f74e2a1a2d6bb3192774d8e4..7d7a05aad4953fe5cbdc14e24a5647baad6f6122 100644
--- a/Mesh/Numeric.h
+++ b/Mesh/Numeric.h
@@ -1,4 +1,3 @@
-/* $Id: Numeric.h,v 1.4 2000-12-18 08:31:58 geuzaine Exp $ */
 #ifndef _NUMERIC_H_
 #define _NUMERIC_H_
 
diff --git a/Mesh/Nurbs.cpp b/Mesh/Nurbs.cpp
index da0e23230e1b6f67afd071124df0b905f8cb8eb5..196a1d08bf92f28e9822a2e3fec1f9d44b32ca9c 100644
--- a/Mesh/Nurbs.cpp
+++ b/Mesh/Nurbs.cpp
@@ -1,4 +1,4 @@
-/* $Id: Nurbs.cpp,v 1.4 2000-11-26 15:43:47 geuzaine Exp $ */
+// $Id: Nurbs.cpp,v 1.5 2001-01-08 08:05:46 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Mesh.h"
diff --git a/Mesh/Print_Mesh.cpp b/Mesh/Print_Mesh.cpp
index c8ba5eef9101bef2c007e1c4d5dd79893f60c684..5efda2dfff4364dcd3c001cd9e479ecbb3d0fb4b 100644
--- a/Mesh/Print_Mesh.cpp
+++ b/Mesh/Print_Mesh.cpp
@@ -1,4 +1,4 @@
-/* $Id: Print_Mesh.cpp,v 1.9 2000-11-30 10:14:09 geuzaine Exp $ */
+// $Id: Print_Mesh.cpp,v 1.10 2001-01-08 08:05:46 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Const.h"
diff --git a/Mesh/Read_Mesh.cpp b/Mesh/Read_Mesh.cpp
index 126a9952bf2e8aa84e4143b03a57bdaafa928882..6c3d7cfe853e283c24e5a5eb798bfaa0872657d7 100644
--- a/Mesh/Read_Mesh.cpp
+++ b/Mesh/Read_Mesh.cpp
@@ -1,4 +1,4 @@
-/* $Id: Read_Mesh.cpp,v 1.4 2000-11-26 18:43:48 geuzaine Exp $ */
+// $Id: Read_Mesh.cpp,v 1.5 2001-01-08 08:05:46 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Geo.h"
diff --git a/Mesh/STL.cpp b/Mesh/STL.cpp
index f64b1cc0d41af0fa1ca6373f1c2bc58719a93f17..78301a535fe6ba1e46980c738eb65c58bd93a79a 100644
--- a/Mesh/STL.cpp
+++ b/Mesh/STL.cpp
@@ -1,4 +1,4 @@
-/* $Id: STL.cpp,v 1.3 2000-11-26 15:43:47 geuzaine Exp $ */
+// $Id: STL.cpp,v 1.4 2001-01-08 08:05:46 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Mesh.h"
diff --git a/Mesh/SecondOrder.cpp b/Mesh/SecondOrder.cpp
index 7e2c58fd41f34f19b185e2dbdfd13219e58394f8..ce347f0ee90c7bfa40b052b1b1037cc424f4be1d 100644
--- a/Mesh/SecondOrder.cpp
+++ b/Mesh/SecondOrder.cpp
@@ -1,4 +1,4 @@
-/* $Id: SecondOrder.cpp,v 1.4 2000-11-26 15:43:47 geuzaine Exp $ */
+// $Id: SecondOrder.cpp,v 1.5 2001-01-08 08:05:46 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Geo.h"
diff --git a/Mesh/Simplex.cpp b/Mesh/Simplex.cpp
index 863798ff44f8318dde591c92d43a51a548490444..989774b9da27fce8c4d89c4f588f9a805d2023da 100644
--- a/Mesh/Simplex.cpp
+++ b/Mesh/Simplex.cpp
@@ -1,4 +1,4 @@
-/* $Id: Simplex.cpp,v 1.9 2000-11-28 17:18:33 geuzaine Exp $ */
+// $Id: Simplex.cpp,v 1.10 2001-01-08 08:05:46 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Const.h"
diff --git a/Mesh/Simplex.h b/Mesh/Simplex.h
index d5737e06ca3e65a764d6dc0b743a1543f6677751..f3a5a39c868a09a14825642bef1dab4c54a57784 100644
--- a/Mesh/Simplex.h
+++ b/Mesh/Simplex.h
@@ -1,4 +1,3 @@
-/* $Id: Simplex.h,v 1.5 2000-11-26 15:43:47 geuzaine Exp $ */
 #ifndef _SIMPLEX_H_
 #define _SIMPLEX_H_
 
diff --git a/Mesh/Smoothing.cpp b/Mesh/Smoothing.cpp
index ab9713c22c96c468eceeabcbf103cd99bc4c160d..c086573a3db0073610bdd5e1c1195f0cb6ea29dc 100644
--- a/Mesh/Smoothing.cpp
+++ b/Mesh/Smoothing.cpp
@@ -1,4 +1,4 @@
-/* $Id: Smoothing.cpp,v 1.3 2000-11-26 15:43:47 geuzaine Exp $ */
+// $Id: Smoothing.cpp,v 1.4 2001-01-08 08:05:46 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Const.h"
diff --git a/Mesh/SwapEdge.cpp b/Mesh/SwapEdge.cpp
index 3513a8754aa46ee2b0661b43655e220af98c189e..42e012d043875e0e7ae2a6812892c6d8b96b5d80 100644
--- a/Mesh/SwapEdge.cpp
+++ b/Mesh/SwapEdge.cpp
@@ -1,4 +1,4 @@
-/* $Id: SwapEdge.cpp,v 1.4 2000-11-26 15:43:47 geuzaine Exp $ */
+// $Id: SwapEdge.cpp,v 1.5 2001-01-08 08:05:46 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Const.h"
diff --git a/Mesh/SwapPatterns.h b/Mesh/SwapPatterns.h
index 9d827f6db9b7800ff1f483ef5e259de21bf5dc3d..db379bdf2b670add6bc229b8cc3342952d7f83b5 100644
--- a/Mesh/SwapPatterns.h
+++ b/Mesh/SwapPatterns.h
@@ -1,4 +1,3 @@
-/* $Id: SwapPatterns.h,v 1.2 2000-11-23 14:11:36 geuzaine Exp $ */
 #ifndef _SWAP_PATTERNS_H_
 #define _SWAP_PATTERNS_H_
 
diff --git a/Mesh/Vertex.cpp b/Mesh/Vertex.cpp
index 88b46c6fd445afe12e6aae38130e82d5bd401c0d..fd9af359f8996fc5f6e0c3f54b8d61d68c23f826 100644
--- a/Mesh/Vertex.cpp
+++ b/Mesh/Vertex.cpp
@@ -1,4 +1,4 @@
-/* $Id: Vertex.cpp,v 1.4 2000-11-26 15:43:47 geuzaine Exp $ */
+// $Id: Vertex.cpp,v 1.5 2001-01-08 08:05:46 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Vertex.h"
diff --git a/Mesh/Vertex.h b/Mesh/Vertex.h
index 23d4d83e36c95797d9668d061d92407f4b09a229..ce6c35d75ae1bb9a98bb50a1126125517fa4ae55 100644
--- a/Mesh/Vertex.h
+++ b/Mesh/Vertex.h
@@ -1,4 +1,3 @@
-/* $Id: Vertex.h,v 1.4 2000-11-25 15:26:11 geuzaine Exp $ */
 #ifndef _VERTEX_H_
 #define _VERTEX_H_
 
diff --git a/Parser/FunctionManager.cpp b/Parser/FunctionManager.cpp
index a2cb07947bf71c11e7c42d9d99958cabb99c7c94..46e9114431ec5515edd451c68ff7aa1ad034222d 100644
--- a/Parser/FunctionManager.cpp
+++ b/Parser/FunctionManager.cpp
@@ -1,4 +1,5 @@
-/* $Id: FunctionManager.cpp,v 1.5 2001-01-01 20:48:40 geuzaine Exp $ */
+// $Id: FunctionManager.cpp,v 1.6 2001-01-08 08:05:47 geuzaine Exp $
+
 #include <stdio.h>
 #include <stack>
 #include <map>
diff --git a/Parser/Gmsh.l b/Parser/Gmsh.l
index d8b8985d47d68f34102df74d893638620bb2928d..225f44eea2c70aaa656396315f22ee00ce166d9f 100644
--- a/Parser/Gmsh.l
+++ b/Parser/Gmsh.l
@@ -1,4 +1,6 @@
-%{ /* $Id: Gmsh.l,v 1.24 2000-12-21 10:20:05 geuzaine Exp $ */
+%{
+
+// $Id: Gmsh.l,v 1.25 2001-01-08 08:05:47 geuzaine Exp $
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/Parser/Gmsh.tab.cpp b/Parser/Gmsh.tab.cpp
index 003d033dd4c088d03b8bf3153ff82847634ec046..c1e80bec226d1551224a855943e743008243607e 100644
--- a/Parser/Gmsh.tab.cpp
+++ b/Parser/Gmsh.tab.cpp
@@ -1,174 +1,175 @@
 
 /*  A Bison parser, made from Gmsh.y
- by  GNU Bison version 1.25
-  */
+    by GNU Bison version 1.28  */
 
 #define YYBISON 1  /* Identify Bison output.  */
 
-#define	tDOUBLE	258
-#define	tSTRING	259
-#define	tBIGSTR	260
-#define	tEND	261
-#define	tAFFECT	262
-#define	tDOTS	263
-#define	tPi	264
-#define	tExp	265
-#define	tLog	266
-#define	tLog10	267
-#define	tSqrt	268
-#define	tSin	269
-#define	tAsin	270
-#define	tCos	271
-#define	tAcos	272
-#define	tTan	273
-#define	tRand	274
-#define	tAtan	275
-#define	tAtan2	276
-#define	tSinh	277
-#define	tCosh	278
-#define	tTanh	279
-#define	tFabs	280
-#define	tFloor	281
-#define	tCeil	282
-#define	tFmod	283
-#define	tModulo	284
-#define	tHypot	285
-#define	tPrintf	286
-#define	tSprintf	287
-#define	tDraw	288
-#define	tPoint	289
-#define	tCircle	290
-#define	tEllipsis	291
-#define	tLine	292
-#define	tSurface	293
-#define	tSpline	294
-#define	tVolume	295
-#define	tCharacteristic	296
-#define	tLength	297
-#define	tParametric	298
-#define	tElliptic	299
-#define	tPlane	300
-#define	tRuled	301
-#define	tTransfinite	302
-#define	tComplex	303
-#define	tPhysical	304
-#define	tUsing	305
-#define	tBump	306
-#define	tProgression	307
-#define	tRotate	308
-#define	tTranslate	309
-#define	tSymmetry	310
-#define	tDilate	311
-#define	tExtrude	312
-#define	tDuplicata	313
-#define	tLoop	314
-#define	tRecombine	315
-#define	tDelete	316
-#define	tCoherence	317
-#define	tIntersect	318
-#define	tView	319
-#define	tAttractor	320
-#define	tLayers	321
-#define	tScalarTetrahedron	322
-#define	tVectorTetrahedron	323
-#define	tTensorTetrahedron	324
-#define	tScalarTriangle	325
-#define	tVectorTriangle	326
-#define	tTensorTriangle	327
-#define	tScalarLine	328
-#define	tVectorLine	329
-#define	tTensorLine	330
-#define	tScalarPoint	331
-#define	tVectorPoint	332
-#define	tTensorPoint	333
-#define	tBSpline	334
-#define	tNurbs	335
-#define	tOrder	336
-#define	tWith	337
-#define	tBounds	338
-#define	tKnots	339
-#define	tColor	340
-#define	tFor	341
-#define	tIn	342
-#define	tEndFor	343
-#define	tIf	344
-#define	tEndIf	345
-#define	tExit	346
-#define	tReturn	347
-#define	tCall	348
-#define	tFunction	349
-#define	tMesh	350
-#define	tB_SPLINE_SURFACE_WITH_KNOTS	351
-#define	tB_SPLINE_CURVE_WITH_KNOTS	352
-#define	tCARTESIAN_POINT	353
-#define	tTRUE	354
-#define	tFALSE	355
-#define	tUNSPECIFIED	356
-#define	tU	357
-#define	tV	358
-#define	tEDGE_CURVE	359
-#define	tVERTEX_POINT	360
-#define	tORIENTED_EDGE	361
-#define	tPLANE	362
-#define	tFACE_OUTER_BOUND	363
-#define	tEDGE_LOOP	364
-#define	tADVANCED_FACE	365
-#define	tVECTOR	366
-#define	tDIRECTION	367
-#define	tAXIS2_PLACEMENT_3D	368
-#define	tISO	369
-#define	tENDISO	370
-#define	tENDSEC	371
-#define	tDATA	372
-#define	tHEADER	373
-#define	tFILE_DESCRIPTION	374
-#define	tFILE_SCHEMA	375
-#define	tFILE_NAME	376
-#define	tMANIFOLD_SOLID_BREP	377
-#define	tCLOSED_SHELL	378
-#define	tADVANCED_BREP_SHAPE_REPRESENTATION	379
-#define	tFACE_BOUND	380
-#define	tCYLINDRICAL_SURFACE	381
-#define	tCONICAL_SURFACE	382
-#define	tCIRCLE	383
-#define	tTRIMMED_CURVE	384
-#define	tGEOMETRIC_SET	385
-#define	tCOMPOSITE_CURVE_SEGMENT	386
-#define	tCONTINUOUS	387
-#define	tCOMPOSITE_CURVE	388
-#define	tTOROIDAL_SURFACE	389
-#define	tPRODUCT_DEFINITION	390
-#define	tPRODUCT_DEFINITION_SHAPE	391
-#define	tSHAPE_DEFINITION_REPRESENTATION	392
-#define	tELLIPSE	393
-#define	tTrimmed	394
-#define	tSolid	395
-#define	tEndSolid	396
-#define	tVertex	397
-#define	tFacet	398
-#define	tNormal	399
-#define	tOuter	400
-#define	tLoopSTL	401
-#define	tEndLoop	402
-#define	tEndFacet	403
-#define	tAFFECTPLUS	404
-#define	tAFFECTMINUS	405
-#define	tAFFECTTIMES	406
-#define	tAFFECTDIVIDE	407
-#define	tOR	408
-#define	tAND	409
-#define	tEQUAL	410
-#define	tNOTEQUAL	411
-#define	tAPPROXEQUAL	412
-#define	tLESSOREQUAL	413
-#define	tGREATEROREQUAL	414
-#define	tCROSSPRODUCT	415
-#define	tPLUSPLUS	416
-#define	tMINUSMINUS	417
-#define	UNARYPREC	418
+#define	tDOUBLE	257
+#define	tSTRING	258
+#define	tBIGSTR	259
+#define	tEND	260
+#define	tAFFECT	261
+#define	tDOTS	262
+#define	tPi	263
+#define	tExp	264
+#define	tLog	265
+#define	tLog10	266
+#define	tSqrt	267
+#define	tSin	268
+#define	tAsin	269
+#define	tCos	270
+#define	tAcos	271
+#define	tTan	272
+#define	tRand	273
+#define	tAtan	274
+#define	tAtan2	275
+#define	tSinh	276
+#define	tCosh	277
+#define	tTanh	278
+#define	tFabs	279
+#define	tFloor	280
+#define	tCeil	281
+#define	tFmod	282
+#define	tModulo	283
+#define	tHypot	284
+#define	tPrintf	285
+#define	tSprintf	286
+#define	tDraw	287
+#define	tPoint	288
+#define	tCircle	289
+#define	tEllipsis	290
+#define	tLine	291
+#define	tSurface	292
+#define	tSpline	293
+#define	tVolume	294
+#define	tCharacteristic	295
+#define	tLength	296
+#define	tParametric	297
+#define	tElliptic	298
+#define	tPlane	299
+#define	tRuled	300
+#define	tTransfinite	301
+#define	tComplex	302
+#define	tPhysical	303
+#define	tUsing	304
+#define	tBump	305
+#define	tProgression	306
+#define	tRotate	307
+#define	tTranslate	308
+#define	tSymmetry	309
+#define	tDilate	310
+#define	tExtrude	311
+#define	tDuplicata	312
+#define	tLoop	313
+#define	tRecombine	314
+#define	tDelete	315
+#define	tCoherence	316
+#define	tIntersect	317
+#define	tView	318
+#define	tAttractor	319
+#define	tLayers	320
+#define	tScalarTetrahedron	321
+#define	tVectorTetrahedron	322
+#define	tTensorTetrahedron	323
+#define	tScalarTriangle	324
+#define	tVectorTriangle	325
+#define	tTensorTriangle	326
+#define	tScalarLine	327
+#define	tVectorLine	328
+#define	tTensorLine	329
+#define	tScalarPoint	330
+#define	tVectorPoint	331
+#define	tTensorPoint	332
+#define	tBSpline	333
+#define	tNurbs	334
+#define	tOrder	335
+#define	tWith	336
+#define	tBounds	337
+#define	tKnots	338
+#define	tColor	339
+#define	tFor	340
+#define	tIn	341
+#define	tEndFor	342
+#define	tIf	343
+#define	tEndIf	344
+#define	tExit	345
+#define	tReturn	346
+#define	tCall	347
+#define	tFunction	348
+#define	tMesh	349
+#define	tB_SPLINE_SURFACE_WITH_KNOTS	350
+#define	tB_SPLINE_CURVE_WITH_KNOTS	351
+#define	tCARTESIAN_POINT	352
+#define	tTRUE	353
+#define	tFALSE	354
+#define	tUNSPECIFIED	355
+#define	tU	356
+#define	tV	357
+#define	tEDGE_CURVE	358
+#define	tVERTEX_POINT	359
+#define	tORIENTED_EDGE	360
+#define	tPLANE	361
+#define	tFACE_OUTER_BOUND	362
+#define	tEDGE_LOOP	363
+#define	tADVANCED_FACE	364
+#define	tVECTOR	365
+#define	tDIRECTION	366
+#define	tAXIS2_PLACEMENT_3D	367
+#define	tISO	368
+#define	tENDISO	369
+#define	tENDSEC	370
+#define	tDATA	371
+#define	tHEADER	372
+#define	tFILE_DESCRIPTION	373
+#define	tFILE_SCHEMA	374
+#define	tFILE_NAME	375
+#define	tMANIFOLD_SOLID_BREP	376
+#define	tCLOSED_SHELL	377
+#define	tADVANCED_BREP_SHAPE_REPRESENTATION	378
+#define	tFACE_BOUND	379
+#define	tCYLINDRICAL_SURFACE	380
+#define	tCONICAL_SURFACE	381
+#define	tCIRCLE	382
+#define	tTRIMMED_CURVE	383
+#define	tGEOMETRIC_SET	384
+#define	tCOMPOSITE_CURVE_SEGMENT	385
+#define	tCONTINUOUS	386
+#define	tCOMPOSITE_CURVE	387
+#define	tTOROIDAL_SURFACE	388
+#define	tPRODUCT_DEFINITION	389
+#define	tPRODUCT_DEFINITION_SHAPE	390
+#define	tSHAPE_DEFINITION_REPRESENTATION	391
+#define	tELLIPSE	392
+#define	tTrimmed	393
+#define	tSolid	394
+#define	tEndSolid	395
+#define	tVertex	396
+#define	tFacet	397
+#define	tNormal	398
+#define	tOuter	399
+#define	tLoopSTL	400
+#define	tEndLoop	401
+#define	tEndFacet	402
+#define	tAFFECTPLUS	403
+#define	tAFFECTMINUS	404
+#define	tAFFECTTIMES	405
+#define	tAFFECTDIVIDE	406
+#define	tOR	407
+#define	tAND	408
+#define	tEQUAL	409
+#define	tNOTEQUAL	410
+#define	tAPPROXEQUAL	411
+#define	tLESSOREQUAL	412
+#define	tGREATEROREQUAL	413
+#define	tCROSSPRODUCT	414
+#define	tPLUSPLUS	415
+#define	tMINUSMINUS	416
+#define	UNARYPREC	417
 
 #line 1 "Gmsh.y"
- /* $Id: Gmsh.tab.cpp,v 1.56 2000-12-21 10:20:05 geuzaine Exp $ */
+ 
+
+// $Id: Gmsh.tab.cpp,v 1.57 2001-01-08 08:05:47 geuzaine Exp $
 
 #include <stdarg.h>
 
@@ -185,9 +186,10 @@
 #include "Options.h"
 #include "Colors.h"
 #include "Parser.h"
-#include "Main.h"
+#include "OpenFile.h"
 #include "FunctionManager.h"
 #include "ColorTable.h"
+#include "Timer.h"
 
 #ifdef __DECCXX // bug in bison
 #include <alloca.h>
@@ -232,7 +234,7 @@ void  yyerror (char *s);
 void  vyyerror (char *fmt, ...);
 void  skip_until (char *skip, char *until);
 
-#line 66 "Gmsh.y"
+#line 69 "Gmsh.y"
 typedef union {
   char    *c;
   int      i;
@@ -256,7 +258,7 @@ typedef union {
 #define	YYFLAG		-32768
 #define	YYNTBASE	182
 
-#define YYTRANSLATE(x) ((unsigned)(x) <= 418 ? yytranslate[x] : 261)
+#define YYTRANSLATE(x) ((unsigned)(x) <= 417 ? yytranslate[x] : 261)
 
 static const short yytranslate[] = {     0,
      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
@@ -284,23 +286,23 @@ static const short yytranslate[] = {     0,
      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-     2,     2,     2,     2,     2,     1,     2,     3,     4,     5,
-     6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
-    16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
-    26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
-    36,    37,    38,    39,    40,    41,    42,    43,    44,    45,
-    46,    47,    48,    49,    50,    51,    52,    53,    54,    55,
-    56,    57,    58,    59,    60,    61,    62,    63,    64,    65,
-    66,    67,    68,    69,    70,    71,    72,    73,    74,    75,
-    76,    77,    78,    79,    80,    81,    82,    83,    84,    85,
-    86,    87,    88,    89,    90,    91,    92,    93,    94,    95,
-    96,    97,    98,    99,   100,   101,   102,   103,   104,   105,
-   106,   107,   108,   109,   110,   111,   112,   113,   114,   115,
-   116,   117,   118,   119,   120,   121,   122,   123,   124,   125,
-   126,   127,   128,   129,   130,   131,   132,   133,   134,   135,
-   136,   137,   138,   139,   140,   141,   142,   143,   144,   145,
-   146,   147,   148,   149,   150,   151,   152,   154,   155,   156,
-   157,   158,   160,   162,   168,   170,   171,   172
+     2,     2,     2,     2,     2,     1,     3,     4,     5,     6,
+     7,     8,     9,    10,    11,    12,    13,    14,    15,    16,
+    17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
+    27,    28,    29,    30,    31,    32,    33,    34,    35,    36,
+    37,    38,    39,    40,    41,    42,    43,    44,    45,    46,
+    47,    48,    49,    50,    51,    52,    53,    54,    55,    56,
+    57,    58,    59,    60,    61,    62,    63,    64,    65,    66,
+    67,    68,    69,    70,    71,    72,    73,    74,    75,    76,
+    77,    78,    79,    80,    81,    82,    83,    84,    85,    86,
+    87,    88,    89,    90,    91,    92,    93,    94,    95,    96,
+    97,    98,    99,   100,   101,   102,   103,   104,   105,   106,
+   107,   108,   109,   110,   111,   112,   113,   114,   115,   116,
+   117,   118,   119,   120,   121,   122,   123,   124,   125,   126,
+   127,   128,   129,   130,   131,   132,   133,   134,   135,   136,
+   137,   138,   139,   140,   141,   142,   143,   144,   145,   146,
+   147,   148,   149,   150,   151,   152,   154,   155,   156,   157,
+   158,   160,   162,   168,   170,   171,   172
 };
 
 #if YYDEBUG != 0
@@ -577,41 +579,41 @@ static const short yyrhs[] = {   184,
 
 #if YYDEBUG != 0
 static const short yyrline[] = { 0,
-   145,   147,   148,   149,   156,   164,   178,   190,   192,   195,
-   197,   198,   201,   207,   212,   213,   214,   217,   221,   224,
-   230,   235,   241,   249,   254,   258,   264,   269,   273,   278,
-   282,   285,   290,   294,   298,   302,   307,   311,   314,   318,
-   322,   326,   330,   334,   338,   341,   345,   348,   352,   355,
-   364,   368,   374,   376,   377,   378,   379,   380,   381,   382,
-   383,   384,   385,   386,   389,   395,   424,   429,   435,   440,
-   441,   442,   443,   444,   445,   446,   447,   448,   449,   450,
-   451,   454,   457,   461,   467,   473,   476,   480,   486,   492,
-   495,   499,   505,   511,   514,   518,   526,   532,   535,   539,
-   547,   553,   556,   560,   568,   574,   577,   581,   593,   599,
-   602,   606,   618,   624,   627,   631,   643,   649,   652,   656,
-   669,   675,   678,   682,   695,   701,   704,   708,   721,   733,
-   749,   761,   770,   782,   790,   802,   810,   822,   830,   842,
-   850,   862,   874,   893,   906,   924,   941,   962,   979,  1000,
-  1017,  1038,  1055,  1076,  1097,  1123,  1140,  1161,  1178,  1201,
-  1214,  1239,  1250,  1256,  1275,  1286,  1294,  1300,  1306,  1325,
-  1331,  1347,  1354,  1360,  1366,  1372,  1378,  1397,  1409,  1415,
-  1434,  1455,  1463,  1469,  1475,  1481,  1493,  1499,  1505,  1517,
-  1523,  1528,  1533,  1540,  1542,  1543,  1546,  1551,  1562,  1580,
-  1588,  1592,  1603,  1655,  1675,  1679,  1698,  1714,  1728,  1753,
-  1778,  1804,  1810,  1815,  1820,  1824,  1834,  1840,  1846,  1850,
-  1854,  1858,  1862,  1867,  1874,  1878,  1883,  1901,  1911,  1929,
-  1946,  1963,  1984,  2004,  2024,  2041,  2065,  2070,  2081,  2083,
-  2086,  2088,  2089,  2090,  2091,  2094,  2096,  2097,  2098,  2099,
-  2100,  2101,  2102,  2103,  2110,  2111,  2112,  2113,  2114,  2115,
-  2116,  2117,  2118,  2119,  2120,  2121,  2122,  2123,  2124,  2125,
-  2126,  2127,  2128,  2129,  2130,  2131,  2132,  2133,  2134,  2135,
-  2136,  2137,  2138,  2139,  2140,  2141,  2146,  2151,  2155,  2167,
-  2185,  2197,  2215,  2227,  2247,  2268,  2292,  2313,  2337,  2358,
-  2383,  2390,  2403,  2410,  2414,  2418,  2422,  2427,  2432,  2436,
-  2440,  2446,  2450,  2455,  2459,  2464,  2468,  2472,  2478,  2484,
-  2490,  2494,  2500,  2515,  2522,  2528,  2537,  2549,  2553,  2561,
-  2574,  2579,  2583,  2588,  2593,  2611,  2616,  2637,  2646,  2652,
-  2657,  2661
+   148,   150,   151,   152,   159,   167,   181,   193,   195,   198,
+   200,   201,   204,   210,   215,   216,   217,   220,   224,   227,
+   233,   238,   244,   252,   257,   261,   267,   272,   276,   281,
+   285,   288,   293,   297,   301,   305,   310,   314,   317,   321,
+   325,   329,   333,   337,   341,   344,   348,   351,   355,   358,
+   367,   371,   377,   379,   380,   381,   382,   383,   384,   385,
+   386,   387,   388,   389,   392,   398,   427,   432,   438,   443,
+   444,   445,   446,   447,   448,   449,   450,   451,   452,   453,
+   454,   457,   460,   464,   470,   476,   479,   483,   489,   495,
+   498,   502,   508,   514,   517,   521,   529,   535,   538,   542,
+   550,   556,   559,   563,   571,   577,   580,   584,   596,   602,
+   605,   609,   621,   627,   630,   634,   646,   652,   655,   659,
+   672,   678,   681,   685,   698,   704,   707,   711,   724,   736,
+   752,   764,   773,   785,   793,   805,   813,   825,   833,   845,
+   853,   865,   877,   896,   909,   927,   944,   965,   982,  1003,
+  1020,  1041,  1058,  1079,  1100,  1126,  1143,  1164,  1181,  1204,
+  1217,  1242,  1253,  1259,  1278,  1289,  1297,  1303,  1309,  1328,
+  1334,  1350,  1357,  1363,  1369,  1375,  1381,  1400,  1412,  1418,
+  1437,  1458,  1466,  1472,  1478,  1484,  1496,  1502,  1508,  1520,
+  1526,  1531,  1536,  1543,  1545,  1546,  1549,  1554,  1565,  1583,
+  1591,  1595,  1606,  1658,  1677,  1681,  1702,  1718,  1732,  1757,
+  1782,  1808,  1814,  1819,  1824,  1828,  1838,  1844,  1850,  1854,
+  1858,  1862,  1866,  1871,  1878,  1882,  1887,  1905,  1915,  1933,
+  1950,  1967,  1988,  2008,  2028,  2045,  2069,  2074,  2085,  2087,
+  2090,  2092,  2093,  2094,  2095,  2098,  2100,  2101,  2102,  2103,
+  2104,  2105,  2106,  2107,  2114,  2115,  2116,  2117,  2118,  2119,
+  2120,  2121,  2122,  2123,  2124,  2125,  2126,  2127,  2128,  2129,
+  2130,  2131,  2132,  2133,  2134,  2135,  2136,  2137,  2138,  2139,
+  2140,  2141,  2142,  2143,  2144,  2145,  2150,  2155,  2159,  2171,
+  2189,  2201,  2219,  2231,  2251,  2272,  2296,  2317,  2341,  2362,
+  2387,  2394,  2407,  2414,  2418,  2422,  2426,  2431,  2436,  2440,
+  2444,  2450,  2454,  2459,  2463,  2468,  2472,  2476,  2482,  2488,
+  2494,  2498,  2504,  2519,  2526,  2532,  2541,  2553,  2557,  2565,
+  2578,  2583,  2587,  2592,  2597,  2615,  2620,  2641,  2650,  2656,
+  2661,  2665
 };
 #endif
 
@@ -2498,7 +2500,8 @@ static const short yycheck[] = {    23,
    166,   167,    -1,    -1,    -1,    -1,    -1,   173,    -1,   175
 };
 /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
-#line 3 "/usr/local/share/bison.simple"
+#line 3 "/usr/lib/bison.simple"
+/* This file comes from bison-1.28.  */
 
 /* Skeleton output parser for bison,
    Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
@@ -2515,46 +2518,66 @@ static const short yycheck[] = {    23,
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 /* As a special exception, when this file is copied by Bison into a
    Bison output file, you may use that output file without restriction.
    This special exception was added by the Free Software Foundation
    in version 1.24 of Bison.  */
 
-#ifndef alloca
+/* This is the parser code that is written into each bison parser
+  when the %semantic_parser declaration is not specified in the grammar.
+  It was written by Richard Stallman by simplifying the hairy parser
+  used when %semantic_parser is specified.  */
+
+#ifndef YYSTACK_USE_ALLOCA
+#ifdef alloca
+#define YYSTACK_USE_ALLOCA
+#else /* alloca not defined */
 #ifdef __GNUC__
+#define YYSTACK_USE_ALLOCA
 #define alloca __builtin_alloca
 #else /* not GNU C.  */
-#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
+#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
+#define YYSTACK_USE_ALLOCA
 #include <alloca.h>
 #else /* not sparc */
-#if defined (MSDOS) && !defined (__TURBOC__)
+/* We think this test detects Watcom and Microsoft C.  */
+/* This used to test MSDOS, but that is a bad idea
+   since that symbol is in the user namespace.  */
+#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
+#if 0 /* No need for malloc.h, which pollutes the namespace;
+	 instead, just don't use alloca.  */
 #include <malloc.h>
+#endif
 #else /* not MSDOS, or __TURBOC__ */
 #if defined(_AIX)
-#include <malloc.h>
+/* I don't know what this was needed for, but it pollutes the namespace.
+   So I turned it off.   rms, 2 May 1997.  */
+/* #include <malloc.h>  */
  #pragma alloca
-#else /* not MSDOS, __TURBOC__, or _AIX */
-#ifdef __hpux
-#ifdef __cplusplus
-extern "C" {
-void *alloca (unsigned int);
-};
-#else /* not __cplusplus */
-void *alloca ();
-#endif /* not __cplusplus */
+#define YYSTACK_USE_ALLOCA
+#else /* not MSDOS, or __TURBOC__, or _AIX */
+#if 0
+#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
+		 and on HPUX 10.  Eventually we can turn this on.  */
+#define YYSTACK_USE_ALLOCA
+#define alloca __builtin_alloca
 #endif /* __hpux */
+#endif
 #endif /* not _AIX */
 #endif /* not MSDOS, or __TURBOC__ */
-#endif /* not sparc.  */
-#endif /* not GNU C.  */
-#endif /* alloca not defined.  */
+#endif /* not sparc */
+#endif /* not GNU C */
+#endif /* alloca not defined */
+#endif /* YYSTACK_USE_ALLOCA not defined */
 
-/* This is the parser code that is written into each bison parser
-  when the %semantic_parser declaration is not specified in the grammar.
-  It was written by Richard Stallman by simplifying the hairy parser
-  used when %semantic_parser is specified.  */
+#ifdef YYSTACK_USE_ALLOCA
+#define YYSTACK_ALLOC alloca
+#else
+#define YYSTACK_ALLOC malloc
+#endif
 
 /* Note: there must be only one dollar sign in this file.
    It is replaced by the list of actions, each action
@@ -2564,8 +2587,8 @@ void *alloca ();
 #define yyclearin	(yychar = YYEMPTY)
 #define YYEMPTY		-2
 #define YYEOF		0
-#define YYACCEPT	return(0)
-#define YYABORT 	return(1)
+#define YYACCEPT	goto yyacceptlab
+#define YYABORT 	goto yyabortlab
 #define YYERROR		goto yyerrlab1
 /* Like YYERROR except do call yyerror.
    This remains here temporarily to ease the
@@ -2646,12 +2669,12 @@ int yydebug;			/*  nonzero means print parse trace	*/
 #ifndef YYMAXDEPTH
 #define YYMAXDEPTH 10000
 #endif
-
-/* Prevent warning if -Wstrict-prototypes.  */
-#ifdef __GNUC__
-int yyparse (void);
-#endif
 
+/* Define __yy_memcpy.  Note that the size argument
+   should be passed with type unsigned int, because that is what the non-GCC
+   definitions require.  With GCC, __builtin_memcpy takes an arg
+   of type size_t, but it can handle unsigned int.  */
+
 #if __GNUC__ > 1		/* GNU C and GNU C++ define this.  */
 #define __yy_memcpy(TO,FROM,COUNT)	__builtin_memcpy(TO,FROM,COUNT)
 #else				/* not GNU C or C++ */
@@ -2663,7 +2686,7 @@ static void
 __yy_memcpy (to, from, count)
      char *to;
      char *from;
-     int count;
+     unsigned int count;
 {
   register char *f = from;
   register char *t = to;
@@ -2678,10 +2701,10 @@ __yy_memcpy (to, from, count)
 /* This is the most reliable way to avoid incompatibilities
    in available built-in functions on various systems.  */
 static void
-__yy_memcpy (char *to, char *from, int count)
+__yy_memcpy (char *to, char *from, unsigned int count)
 {
-  register char *f = from;
   register char *t = to;
+  register char *f = from;
   register int i = count;
 
   while (i-- > 0)
@@ -2691,7 +2714,7 @@ __yy_memcpy (char *to, char *from, int count)
 #endif
 #endif
 
-#line 196 "/usr/local/share/bison.simple"
+#line 217 "/usr/lib/bison.simple"
 
 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
    into yyparse.  The argument should have type void *.
@@ -2712,6 +2735,15 @@ __yy_memcpy (char *to, char *from, int count)
 #define YYPARSE_PARAM_DECL
 #endif /* not YYPARSE_PARAM */
 
+/* Prevent warning if -Wstrict-prototypes.  */
+#ifdef __GNUC__
+#ifdef YYPARSE_PARAM
+int yyparse (void *);
+#else
+int yyparse (void);
+#endif
+#endif
+
 int
 yyparse(YYPARSE_PARAM_ARG)
      YYPARSE_PARAM_DECL
@@ -2740,6 +2772,7 @@ yyparse(YYPARSE_PARAM_ARG)
 #endif
 
   int yystacksize = YYINITDEPTH;
+  int yyfree_stacks = 0;
 
 #ifdef YYPURE
   int yychar;
@@ -2824,18 +2857,32 @@ yynewstate:
       if (yystacksize >= YYMAXDEPTH)
 	{
 	  yyerror("parser stack overflow");
+	  if (yyfree_stacks)
+	    {
+	      free (yyss);
+	      free (yyvs);
+#ifdef YYLSP_NEEDED
+	      free (yyls);
+#endif
+	    }
 	  return 2;
 	}
       yystacksize *= 2;
       if (yystacksize > YYMAXDEPTH)
 	yystacksize = YYMAXDEPTH;
-      yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
-      __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp));
-      yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
-      __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp));
+#ifndef YYSTACK_USE_ALLOCA
+      yyfree_stacks = 1;
+#endif
+      yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
+      __yy_memcpy ((char *)yyss, (char *)yyss1,
+		   size * (unsigned int) sizeof (*yyssp));
+      yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
+      __yy_memcpy ((char *)yyvs, (char *)yyvs1,
+		   size * (unsigned int) sizeof (*yyvsp));
 #ifdef YYLSP_NEEDED
-      yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
-      __yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp));
+      yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
+      __yy_memcpy ((char *)yyls, (char *)yyls1,
+		   size * (unsigned int) sizeof (*yylsp));
 #endif
 #endif /* no yyoverflow */
 
@@ -2996,11 +3043,11 @@ yyreduce:
   switch (yyn) {
 
 case 4:
-#line 149 "Gmsh.y"
+#line 152 "Gmsh.y"
 { yyerrok ; return 1; ;
     break;}
 case 5:
-#line 158 "Gmsh.y"
+#line 161 "Gmsh.y"
 {
       Msg(PARSER_INFO,"STL File Format");
       STL_Surf = Create_Surface(1,MSH_SURF_STL,1);
@@ -3009,7 +3056,7 @@ case 5:
     ;
     break;}
 case 6:
-#line 172 "Gmsh.y"
+#line 175 "Gmsh.y"
 {
       STL_Surf->STL->Add_Facet( yyvsp[-12].d, yyvsp[-11].d, yyvsp[-10].d,
 				yyvsp[-8].d, yyvsp[-7].d, yyvsp[-6].d,
@@ -3018,7 +3065,7 @@ case 6:
     ;
     break;}
 case 7:
-#line 179 "Gmsh.y"
+#line 182 "Gmsh.y"
 {
       Msg(PARSER_INFO,"STL File Format Read");
       Tree_Add(THEM->Surfaces, &STL_Surf);
@@ -3026,79 +3073,79 @@ case 7:
     ;
     break;}
 case 10:
-#line 196 "Gmsh.y"
+#line 199 "Gmsh.y"
 { return 1; ;
     break;}
 case 11:
-#line 197 "Gmsh.y"
+#line 200 "Gmsh.y"
 { return 1; ;
     break;}
 case 12:
-#line 198 "Gmsh.y"
+#line 201 "Gmsh.y"
 { return 1; ;
     break;}
 case 13:
-#line 203 "Gmsh.y"
+#line 206 "Gmsh.y"
 {
       Msg(PARSER_INFO,"Step Iso-10303-21 File Format");
       Create_Step_Solid_BRep();
     ;
     break;}
 case 14:
-#line 208 "Gmsh.y"
+#line 211 "Gmsh.y"
 {
       Msg(PARSER_INFO,"Step Iso-10303-21 File Format Read");
       Resolve_BREP ();
     ;
     break;}
 case 18:
-#line 219 "Gmsh.y"
+#line 222 "Gmsh.y"
 {
     ;
     break;}
 case 19:
-#line 222 "Gmsh.y"
+#line 225 "Gmsh.y"
 {
     ;
     break;}
 case 20:
-#line 226 "Gmsh.y"
+#line 229 "Gmsh.y"
 {
    ;
     break;}
 case 21:
-#line 232 "Gmsh.y"
+#line 235 "Gmsh.y"
 {
         Add_Cartesian_Point((int)yyvsp[-8].d,yyvsp[-4].c,yyvsp[-2].v[0],yyvsp[-2].v[1],yyvsp[-2].v[2]);
     ;
     break;}
 case 22:
-#line 238 "Gmsh.y"
+#line 241 "Gmsh.y"
 {
        Add_BSpline_Curve_With_Knots ((int)yyvsp[-22].d, yyvsp[-18].c, (int) yyvsp[-16].d, yyvsp[-14].l,	yyvsp[-6].l, yyvsp[-4].l, 0., 1.);
     ;
     break;}
 case 23:
-#line 245 "Gmsh.y"
+#line 248 "Gmsh.y"
 {
       Add_BSpline_Surface_With_Knots ((int)yyvsp[-30].d, yyvsp[-26].c, (int) yyvsp[-24].d, (int) yyvsp[-22].d, yyvsp[-20].l, yyvsp[-10].l,
 				      yyvsp[-8].l, yyvsp[-6].l, yyvsp[-4].l, 0., 1., 0., 1. );
     ;
     break;}
 case 24:
-#line 251 "Gmsh.y"
+#line 254 "Gmsh.y"
 {
       Add_Edge_Curve ((int)yyvsp[-14].d, yyvsp[-10].c , (int)yyvsp[-8].d , (int)yyvsp[-6].d, (int)yyvsp[-4].d);
     ;
     break;}
 case 25:
-#line 255 "Gmsh.y"
+#line 258 "Gmsh.y"
 {
       Add_Face_Outer_Bound((int)yyvsp[-10].d,yyvsp[-6].c,(int)yyvsp[-4].d,yyvsp[-2].i,1);
     ;
     break;}
 case 26:
-#line 259 "Gmsh.y"
+#line 262 "Gmsh.y"
 {
       /* La je dois voir la norme ! Face_Bound : trou externe a la surface ! */
       Msg(PARSER_INFO,"Found a Face Bound");
@@ -3106,208 +3153,208 @@ case 26:
     ;
     break;}
 case 27:
-#line 266 "Gmsh.y"
+#line 269 "Gmsh.y"
 {
       Add_Oriented_Edge((int)yyvsp[-14].d,yyvsp[-10].c,(int)yyvsp[-4].d,yyvsp[-2].i);
     ;
     break;}
 case 28:
-#line 270 "Gmsh.y"
+#line 273 "Gmsh.y"
 {
       Add_Edge_Loop((int)yyvsp[-8].d,yyvsp[-4].c,yyvsp[-2].l);
     ;
     break;}
 case 29:
-#line 275 "Gmsh.y"
+#line 278 "Gmsh.y"
 {
       Add_Advanced_Face((int)yyvsp[-12].d,yyvsp[-8].c,yyvsp[-6].l,(int)yyvsp[-4].d,yyvsp[-2].i);
     ;
     break;}
 case 30:
-#line 279 "Gmsh.y"
+#line 282 "Gmsh.y"
 {
       Add_Vertex_Point((int)yyvsp[-8].d,yyvsp[-4].c,(int)yyvsp[-2].d);
     ;
     break;}
 case 31:
-#line 283 "Gmsh.y"
+#line 286 "Gmsh.y"
 {
     ;
     break;}
 case 32:
-#line 287 "Gmsh.y"
+#line 290 "Gmsh.y"
 {
       Add_Axis2_Placement3D  ( (int)yyvsp[-12].d, (int)yyvsp[-4].d, (int)yyvsp[-2].d, (int)yyvsp[-6].d);
     ;
     break;}
 case 33:
-#line 291 "Gmsh.y"
+#line 294 "Gmsh.y"
 {
       Add_Direction((int)yyvsp[-8].d , yyvsp[-4].c, yyvsp[-2].v[0], yyvsp[-2].v[1], yyvsp[-2].v[2]);
     ;
     break;}
 case 34:
-#line 295 "Gmsh.y"
+#line 298 "Gmsh.y"
 {
       Add_Plane((int)yyvsp[-8].d,yyvsp[-4].c,(int)yyvsp[-2].d);
     ;
     break;}
 case 35:
-#line 299 "Gmsh.y"
+#line 302 "Gmsh.y"
 {
       Add_Line ((int)yyvsp[-10].d, yyvsp[-6].c , (int) yyvsp[-4].d, (int)yyvsp[-2].d);
     ;
     break;}
 case 36:
-#line 303 "Gmsh.y"
+#line 306 "Gmsh.y"
 {
       Msg(PARSER_INFO,"Found a Closed shell");
       Add_Closed_Shell((int)yyvsp[-8].d, yyvsp[-4].c , yyvsp[-2].l);
     ;
     break;}
 case 37:
-#line 309 "Gmsh.y"
+#line 312 "Gmsh.y"
 {
     ;
     break;}
 case 38:
-#line 312 "Gmsh.y"
+#line 315 "Gmsh.y"
 {
     ;
     break;}
 case 39:
-#line 315 "Gmsh.y"
+#line 318 "Gmsh.y"
 {
       Add_Cylinder ((int)yyvsp[-10].d, yyvsp[-6].c , (int)yyvsp[-4].d, yyvsp[-2].d);
     ;
     break;}
 case 40:
-#line 319 "Gmsh.y"
+#line 322 "Gmsh.y"
 {
       Add_Cone ((int)yyvsp[-12].d, yyvsp[-8].c , (int)yyvsp[-6].d, yyvsp[-4].d,yyvsp[-2].d);
     ;
     break;}
 case 41:
-#line 323 "Gmsh.y"
+#line 326 "Gmsh.y"
 {
       Add_Torus ((int)yyvsp[-12].d, yyvsp[-8].c , (int)yyvsp[-6].d, yyvsp[-4].d,yyvsp[-2].d);
     ;
     break;}
 case 42:
-#line 327 "Gmsh.y"
+#line 330 "Gmsh.y"
 {
       Add_Circle((int) yyvsp[-10].d, yyvsp[-6].c, (int) yyvsp[-4].d, yyvsp[-2].d);
     ;
     break;}
 case 43:
-#line 331 "Gmsh.y"
+#line 334 "Gmsh.y"
 {
       Add_Ellipsis((int) yyvsp[-12].d, yyvsp[-8].c, (int) yyvsp[-6].d, yyvsp[-4].d, yyvsp[-2].d);
     ;
     break;}
 case 44:
-#line 336 "Gmsh.y"
+#line 339 "Gmsh.y"
 {
     ;
     break;}
 case 45:
-#line 339 "Gmsh.y"
+#line 342 "Gmsh.y"
 {
     ;
     break;}
 case 46:
-#line 343 "Gmsh.y"
+#line 346 "Gmsh.y"
 {
     ;
     break;}
 case 47:
-#line 346 "Gmsh.y"
+#line 349 "Gmsh.y"
 {
     ;
     break;}
 case 48:
-#line 350 "Gmsh.y"
+#line 353 "Gmsh.y"
 {
     ;
     break;}
 case 49:
-#line 353 "Gmsh.y"
+#line 356 "Gmsh.y"
 {
     ;
     break;}
 case 50:
-#line 356 "Gmsh.y"
+#line 359 "Gmsh.y"
 {
     ;
     break;}
 case 51:
-#line 366 "Gmsh.y"
+#line 369 "Gmsh.y"
 {
   ;
     break;}
 case 52:
-#line 369 "Gmsh.y"
+#line 372 "Gmsh.y"
 {
       Msg(PARSER_INFO,"Gmsh File Format Read");
     ;
     break;}
 case 53:
-#line 375 "Gmsh.y"
+#line 378 "Gmsh.y"
 { return 1; ;
     break;}
 case 54:
-#line 376 "Gmsh.y"
+#line 379 "Gmsh.y"
 { return 1; ;
     break;}
 case 55:
-#line 377 "Gmsh.y"
+#line 380 "Gmsh.y"
 { return 1; ;
     break;}
 case 56:
-#line 378 "Gmsh.y"
+#line 381 "Gmsh.y"
 { return 1; ;
     break;}
 case 57:
-#line 379 "Gmsh.y"
+#line 382 "Gmsh.y"
 { return 1; ;
     break;}
 case 58:
-#line 380 "Gmsh.y"
+#line 383 "Gmsh.y"
 { return 1; ;
     break;}
 case 59:
-#line 381 "Gmsh.y"
+#line 384 "Gmsh.y"
 { return 1; ;
     break;}
 case 60:
-#line 382 "Gmsh.y"
+#line 385 "Gmsh.y"
 { return 1; ;
     break;}
 case 61:
-#line 383 "Gmsh.y"
+#line 386 "Gmsh.y"
 { return 1; ;
     break;}
 case 62:
-#line 384 "Gmsh.y"
+#line 387 "Gmsh.y"
 { return 1; ;
     break;}
 case 63:
-#line 385 "Gmsh.y"
+#line 388 "Gmsh.y"
 { return 1; ;
     break;}
 case 64:
-#line 386 "Gmsh.y"
+#line 389 "Gmsh.y"
 { return 1; ;
     break;}
 case 65:
-#line 391 "Gmsh.y"
+#line 394 "Gmsh.y"
 {
       fprintf(stderr, yyvsp[-2].c); 
       fprintf(stderr, "\n"); 
     ;
     break;}
 case 66:
-#line 396 "Gmsh.y"
+#line 399 "Gmsh.y"
 {
       for(i = 0 ; i<List_Nbr(ListOfDouble_L) ; i++){
 	if(!i){
@@ -3332,96 +3379,96 @@ case 66:
     ;
     break;}
 case 67:
-#line 426 "Gmsh.y"
+#line 429 "Gmsh.y"
 { 
       EndView(1, Force_ViewNumber,yyname,yyvsp[-4].c,0.,0.,0.); 
     ;
     break;}
 case 68:
-#line 430 "Gmsh.y"
+#line 433 "Gmsh.y"
 {
       EndView(1, Force_ViewNumber,yyname,yyvsp[-6].c,yyvsp[-4].v[0],yyvsp[-4].v[1],yyvsp[-4].v[2]);
     ;
     break;}
 case 69:
-#line 437 "Gmsh.y"
+#line 440 "Gmsh.y"
 {
       BeginView(1); 
     ;
     break;}
 case 82:
-#line 456 "Gmsh.y"
+#line 459 "Gmsh.y"
 { List_Add(ActualView->SP, &yyvsp[0].d) ; ;
     break;}
 case 83:
-#line 458 "Gmsh.y"
+#line 461 "Gmsh.y"
 { List_Add(ActualView->SP, &yyvsp[0].d) ; ;
     break;}
 case 84:
-#line 463 "Gmsh.y"
+#line 466 "Gmsh.y"
 { 
       List_Add(ActualView->SP, &yyvsp[-5].d); List_Add(ActualView->SP, &yyvsp[-3].d);
       List_Add(ActualView->SP, &yyvsp[-1].d);
     ;
     break;}
 case 85:
-#line 468 "Gmsh.y"
+#line 471 "Gmsh.y"
 {
       ActualView->NbSP++ ;
     ;
     break;}
 case 86:
-#line 475 "Gmsh.y"
+#line 478 "Gmsh.y"
 { List_Add(ActualView->VP, &yyvsp[0].d) ; ;
     break;}
 case 87:
-#line 477 "Gmsh.y"
+#line 480 "Gmsh.y"
 { List_Add(ActualView->VP, &yyvsp[0].d) ; ;
     break;}
 case 88:
-#line 482 "Gmsh.y"
+#line 485 "Gmsh.y"
 { 
       List_Add(ActualView->VP, &yyvsp[-5].d); List_Add(ActualView->VP, &yyvsp[-3].d);
       List_Add(ActualView->VP, &yyvsp[-1].d); 
     ;
     break;}
 case 89:
-#line 487 "Gmsh.y"
+#line 490 "Gmsh.y"
 {
       ActualView->NbVP++ ;
     ;
     break;}
 case 90:
-#line 494 "Gmsh.y"
+#line 497 "Gmsh.y"
 { List_Add(ActualView->TP, &yyvsp[0].d) ; ;
     break;}
 case 91:
-#line 496 "Gmsh.y"
+#line 499 "Gmsh.y"
 { List_Add(ActualView->TP, &yyvsp[0].d) ; ;
     break;}
 case 92:
-#line 501 "Gmsh.y"
+#line 504 "Gmsh.y"
 { 
       List_Add(ActualView->TP, &yyvsp[-5].d); List_Add(ActualView->TP, &yyvsp[-3].d);
       List_Add(ActualView->TP, &yyvsp[-1].d);
     ;
     break;}
 case 93:
-#line 506 "Gmsh.y"
+#line 509 "Gmsh.y"
 {
       ActualView->NbTP++ ;
     ;
     break;}
 case 94:
-#line 513 "Gmsh.y"
+#line 516 "Gmsh.y"
 { List_Add(ActualView->SL, &yyvsp[0].d) ; ;
     break;}
 case 95:
-#line 515 "Gmsh.y"
+#line 518 "Gmsh.y"
 { List_Add(ActualView->SL, &yyvsp[0].d) ; ;
     break;}
 case 96:
-#line 521 "Gmsh.y"
+#line 524 "Gmsh.y"
 { 
       List_Add(ActualView->SL, &yyvsp[-11].d); List_Add(ActualView->SL, &yyvsp[-5].d);
       List_Add(ActualView->SL, &yyvsp[-9].d); List_Add(ActualView->SL, &yyvsp[-3].d);
@@ -3429,21 +3476,21 @@ case 96:
     ;
     break;}
 case 97:
-#line 527 "Gmsh.y"
+#line 530 "Gmsh.y"
 {
       ActualView->NbSL++ ;
     ;
     break;}
 case 98:
-#line 534 "Gmsh.y"
+#line 537 "Gmsh.y"
 { List_Add(ActualView->VL, &yyvsp[0].d) ; ;
     break;}
 case 99:
-#line 536 "Gmsh.y"
+#line 539 "Gmsh.y"
 { List_Add(ActualView->VL, &yyvsp[0].d) ; ;
     break;}
 case 100:
-#line 542 "Gmsh.y"
+#line 545 "Gmsh.y"
 { 
       List_Add(ActualView->SL, &yyvsp[-11].d); List_Add(ActualView->SL, &yyvsp[-5].d);
       List_Add(ActualView->SL, &yyvsp[-9].d); List_Add(ActualView->SL, &yyvsp[-3].d);
@@ -3451,21 +3498,21 @@ case 100:
     ;
     break;}
 case 101:
-#line 548 "Gmsh.y"
+#line 551 "Gmsh.y"
 {
       ActualView->NbVL++ ;
     ;
     break;}
 case 102:
-#line 555 "Gmsh.y"
+#line 558 "Gmsh.y"
 { List_Add(ActualView->TL, &yyvsp[0].d) ; ;
     break;}
 case 103:
-#line 557 "Gmsh.y"
+#line 560 "Gmsh.y"
 { List_Add(ActualView->TL, &yyvsp[0].d) ; ;
     break;}
 case 104:
-#line 563 "Gmsh.y"
+#line 566 "Gmsh.y"
 { 
       List_Add(ActualView->SL, &yyvsp[-11].d); List_Add(ActualView->SL, &yyvsp[-5].d);
       List_Add(ActualView->SL, &yyvsp[-9].d); List_Add(ActualView->SL, &yyvsp[-3].d);
@@ -3473,21 +3520,21 @@ case 104:
     ;
     break;}
 case 105:
-#line 569 "Gmsh.y"
+#line 572 "Gmsh.y"
 {
       ActualView->NbTL++ ;
     ;
     break;}
 case 106:
-#line 576 "Gmsh.y"
+#line 579 "Gmsh.y"
 { List_Add(ActualView->ST, &yyvsp[0].d) ; ;
     break;}
 case 107:
-#line 578 "Gmsh.y"
+#line 581 "Gmsh.y"
 { List_Add(ActualView->ST, &yyvsp[0].d) ; ;
     break;}
 case 108:
-#line 585 "Gmsh.y"
+#line 588 "Gmsh.y"
 { 
       List_Add(ActualView->ST, &yyvsp[-17].d); List_Add(ActualView->ST, &yyvsp[-11].d);
       List_Add(ActualView->ST, &yyvsp[-5].d);
@@ -3498,21 +3545,21 @@ case 108:
     ;
     break;}
 case 109:
-#line 594 "Gmsh.y"
+#line 597 "Gmsh.y"
 {
       ActualView->NbST++ ;
     ;
     break;}
 case 110:
-#line 601 "Gmsh.y"
+#line 604 "Gmsh.y"
 { List_Add(ActualView->VT, &yyvsp[0].d) ; ;
     break;}
 case 111:
-#line 603 "Gmsh.y"
+#line 606 "Gmsh.y"
 { List_Add(ActualView->VT, &yyvsp[0].d) ; ;
     break;}
 case 112:
-#line 610 "Gmsh.y"
+#line 613 "Gmsh.y"
 { 
       List_Add(ActualView->VT, &yyvsp[-17].d); List_Add(ActualView->VT, &yyvsp[-11].d);
       List_Add(ActualView->VT, &yyvsp[-5].d);
@@ -3523,21 +3570,21 @@ case 112:
     ;
     break;}
 case 113:
-#line 619 "Gmsh.y"
+#line 622 "Gmsh.y"
 {
       ActualView->NbVT++ ;
     ;
     break;}
 case 114:
-#line 626 "Gmsh.y"
+#line 629 "Gmsh.y"
 { List_Add(ActualView->TT, &yyvsp[0].d) ; ;
     break;}
 case 115:
-#line 628 "Gmsh.y"
+#line 631 "Gmsh.y"
 { List_Add(ActualView->TT, &yyvsp[0].d) ; ;
     break;}
 case 116:
-#line 635 "Gmsh.y"
+#line 638 "Gmsh.y"
 { 
       List_Add(ActualView->TT, &yyvsp[-17].d); List_Add(ActualView->TT, &yyvsp[-11].d);
       List_Add(ActualView->TT, &yyvsp[-5].d);
@@ -3548,21 +3595,21 @@ case 116:
     ;
     break;}
 case 117:
-#line 644 "Gmsh.y"
+#line 647 "Gmsh.y"
 {
       ActualView->NbTT++ ;
     ;
     break;}
 case 118:
-#line 651 "Gmsh.y"
+#line 654 "Gmsh.y"
 { List_Add(ActualView->SS, &yyvsp[0].d) ; ;
     break;}
 case 119:
-#line 653 "Gmsh.y"
+#line 656 "Gmsh.y"
 { List_Add(ActualView->SS, &yyvsp[0].d) ; ;
     break;}
 case 120:
-#line 661 "Gmsh.y"
+#line 664 "Gmsh.y"
 { 
       List_Add(ActualView->SS, &yyvsp[-23].d);  List_Add(ActualView->SS, &yyvsp[-17].d);
       List_Add(ActualView->SS, &yyvsp[-11].d); List_Add(ActualView->SS, &yyvsp[-5].d);
@@ -3573,21 +3620,21 @@ case 120:
     ;
     break;}
 case 121:
-#line 670 "Gmsh.y"
+#line 673 "Gmsh.y"
 {
       ActualView->NbSS++ ;
     ;
     break;}
 case 122:
-#line 677 "Gmsh.y"
+#line 680 "Gmsh.y"
 { List_Add(ActualView->VS, &yyvsp[0].d) ; ;
     break;}
 case 123:
-#line 679 "Gmsh.y"
+#line 682 "Gmsh.y"
 { List_Add(ActualView->VS, &yyvsp[0].d) ; ;
     break;}
 case 124:
-#line 687 "Gmsh.y"
+#line 690 "Gmsh.y"
 { 
       List_Add(ActualView->VS, &yyvsp[-23].d);  List_Add(ActualView->VS, &yyvsp[-17].d);
       List_Add(ActualView->VS, &yyvsp[-11].d); List_Add(ActualView->VS, &yyvsp[-5].d);
@@ -3598,21 +3645,21 @@ case 124:
     ;
     break;}
 case 125:
-#line 696 "Gmsh.y"
+#line 699 "Gmsh.y"
 {
       ActualView->NbVS++ ;
     ;
     break;}
 case 126:
-#line 703 "Gmsh.y"
+#line 706 "Gmsh.y"
 { List_Add(ActualView->TS, &yyvsp[0].d) ; ;
     break;}
 case 127:
-#line 705 "Gmsh.y"
+#line 708 "Gmsh.y"
 { List_Add(ActualView->TS, &yyvsp[0].d) ; ;
     break;}
 case 128:
-#line 713 "Gmsh.y"
+#line 716 "Gmsh.y"
 { 
       List_Add(ActualView->TS, &yyvsp[-23].d);  List_Add(ActualView->TS, &yyvsp[-17].d);
       List_Add(ActualView->TS, &yyvsp[-11].d); List_Add(ActualView->TS, &yyvsp[-5].d);
@@ -3623,13 +3670,13 @@ case 128:
     ;
     break;}
 case 129:
-#line 722 "Gmsh.y"
+#line 725 "Gmsh.y"
 {
       ActualView->NbTS++ ;
     ;
     break;}
 case 130:
-#line 738 "Gmsh.y"
+#line 741 "Gmsh.y"
 {
       TheSymbol.Name = yyvsp[-3].c;
       if (!(pSymbol = (Symbol*)List_PQuery(Symbol_L, &TheSymbol, CompareSymbols))){
@@ -3643,7 +3690,7 @@ case 130:
     ;
     break;}
 case 131:
-#line 750 "Gmsh.y"
+#line 753 "Gmsh.y"
 {
       TheSymbol.Name = yyvsp[-6].c;
       if (!(pSymbol = (Symbol*)List_PQuery(Symbol_L, &TheSymbol, CompareSymbols))){
@@ -3657,7 +3704,7 @@ case 131:
     ;
     break;}
 case 132:
-#line 762 "Gmsh.y"
+#line 765 "Gmsh.y"
 {
       TheSymbol.Name = yyvsp[-2].c ;
       if (!(pSymbol = (Symbol*)List_PQuery(Symbol_L, &TheSymbol, CompareSymbols)))
@@ -3668,7 +3715,7 @@ case 132:
     ;
     break;}
 case 133:
-#line 771 "Gmsh.y"
+#line 774 "Gmsh.y"
 {
       TheSymbol.Name = yyvsp[-5].c ;
       if (!(pSymbol = (Symbol*)List_PQuery(Symbol_L, &TheSymbol, CompareSymbols)))
@@ -3682,7 +3729,7 @@ case 133:
     ;
     break;}
 case 134:
-#line 783 "Gmsh.y"
+#line 786 "Gmsh.y"
 {
       TheSymbol.Name = yyvsp[-2].c ;
       if (!(pSymbol = (Symbol*)List_PQuery(Symbol_L, &TheSymbol, CompareSymbols)))
@@ -3692,7 +3739,7 @@ case 134:
     ;
     break;}
 case 135:
-#line 791 "Gmsh.y"
+#line 794 "Gmsh.y"
 {
       TheSymbol.Name = yyvsp[-5].c ;
       if (!(pSymbol = (Symbol*)List_PQuery(Symbol_L, &TheSymbol, CompareSymbols)))
@@ -3706,7 +3753,7 @@ case 135:
     ;
     break;}
 case 136:
-#line 803 "Gmsh.y"
+#line 806 "Gmsh.y"
 {
       TheSymbol.Name = yyvsp[-3].c ;
       if (!(pSymbol = (Symbol*)List_PQuery(Symbol_L, &TheSymbol, CompareSymbols)))
@@ -3716,7 +3763,7 @@ case 136:
     ;
     break;}
 case 137:
-#line 811 "Gmsh.y"
+#line 814 "Gmsh.y"
 {
       TheSymbol.Name = yyvsp[-6].c ;
       if (!(pSymbol = (Symbol*)List_PQuery(Symbol_L, &TheSymbol, CompareSymbols)))
@@ -3730,7 +3777,7 @@ case 137:
     ;
     break;}
 case 138:
-#line 823 "Gmsh.y"
+#line 826 "Gmsh.y"
 {
       TheSymbol.Name = yyvsp[-3].c ;
       if (!(pSymbol = (Symbol*)List_PQuery(Symbol_L, &TheSymbol, CompareSymbols)))
@@ -3740,7 +3787,7 @@ case 138:
     ;
     break;}
 case 139:
-#line 831 "Gmsh.y"
+#line 834 "Gmsh.y"
 {
       TheSymbol.Name = yyvsp[-6].c ;
       if (!(pSymbol = (Symbol*)List_PQuery(Symbol_L, &TheSymbol, CompareSymbols)))
@@ -3754,7 +3801,7 @@ case 139:
     ;
     break;}
 case 140:
-#line 843 "Gmsh.y"
+#line 846 "Gmsh.y"
 {
       TheSymbol.Name = yyvsp[-3].c ;
       if (!(pSymbol = (Symbol*)List_PQuery(Symbol_L, &TheSymbol, CompareSymbols)))
@@ -3764,7 +3811,7 @@ case 140:
     ;
     break;}
 case 141:
-#line 851 "Gmsh.y"
+#line 854 "Gmsh.y"
 {
       TheSymbol.Name = yyvsp[-6].c ;
       if (!(pSymbol = (Symbol*)List_PQuery(Symbol_L, &TheSymbol, CompareSymbols)))
@@ -3778,7 +3825,7 @@ case 141:
     ;
     break;}
 case 142:
-#line 863 "Gmsh.y"
+#line 866 "Gmsh.y"
 {
       if(!yyvsp[-1].d)
 	vyyerror("Division by Zero in '%s /= %g'", yyvsp[-3].c, yyvsp[-1].d);
@@ -3792,7 +3839,7 @@ case 142:
     ;
     break;}
 case 143:
-#line 875 "Gmsh.y"
+#line 878 "Gmsh.y"
 {
       if(!yyvsp[-1].d)
 	vyyerror("Division by Zero in '%s[%d] /= %g'", yyvsp[-6].c, (int)yyvsp[-4].d, yyvsp[-1].d);
@@ -3810,7 +3857,7 @@ case 143:
     ;
     break;}
 case 144:
-#line 894 "Gmsh.y"
+#line 897 "Gmsh.y"
 { 
       if(!(pStrCat = Get_StringOptionCategory(yyvsp[-5].c)))
 	vyyerror("Unknown String Option Class '%s'", yyvsp[-5].c);
@@ -3824,7 +3871,7 @@ case 144:
     ;
     break;}
 case 145:
-#line 907 "Gmsh.y"
+#line 910 "Gmsh.y"
 {
       if(strcmp(yyvsp[-10].c, "PostProcessing"))
 	vyyerror("Unknown View Option Class '%s'", yyvsp[-10].c);
@@ -3841,7 +3888,7 @@ case 145:
     ;
     break;}
 case 146:
-#line 925 "Gmsh.y"
+#line 928 "Gmsh.y"
 {
       if(!(pNumCat = Get_NumberOptionCategory(yyvsp[-5].c)))
 	vyyerror("Unknown Numeric Option Class '%s'", yyvsp[-5].c);
@@ -3860,7 +3907,7 @@ case 146:
     ;
     break;}
 case 147:
-#line 942 "Gmsh.y"
+#line 945 "Gmsh.y"
 {
       if(strcmp(yyvsp[-10].c, "PostProcessing"))
 	vyyerror("Unknown View Option Class '%s'", yyvsp[-10].c);
@@ -3882,7 +3929,7 @@ case 147:
     ;
     break;}
 case 148:
-#line 963 "Gmsh.y"
+#line 966 "Gmsh.y"
 {
       if(!(pNumCat = Get_NumberOptionCategory(yyvsp[-5].c)))
 	vyyerror("Unknown Numeric Option Class '%s'", yyvsp[-5].c);
@@ -3901,7 +3948,7 @@ case 148:
     ;
     break;}
 case 149:
-#line 980 "Gmsh.y"
+#line 983 "Gmsh.y"
 {
       if(strcmp(yyvsp[-10].c, "PostProcessing"))
 	vyyerror("Unknown View Option Class '%s'", yyvsp[-10].c);
@@ -3923,7 +3970,7 @@ case 149:
     ;
     break;}
 case 150:
-#line 1001 "Gmsh.y"
+#line 1004 "Gmsh.y"
 {
       if(!(pNumCat = Get_NumberOptionCategory(yyvsp[-5].c)))
 	vyyerror("Unknown Numeric Option Class '%s'", yyvsp[-5].c);
@@ -3942,7 +3989,7 @@ case 150:
     ;
     break;}
 case 151:
-#line 1018 "Gmsh.y"
+#line 1021 "Gmsh.y"
 {
       if(strcmp(yyvsp[-10].c, "PostProcessing"))
 	vyyerror("Unknown View Option Class '%s'", yyvsp[-10].c);
@@ -3964,7 +4011,7 @@ case 151:
     ;
     break;}
 case 152:
-#line 1039 "Gmsh.y"
+#line 1042 "Gmsh.y"
 {
       if(!(pNumCat = Get_NumberOptionCategory(yyvsp[-5].c)))
 	vyyerror("Unknown Numeric Option Class '%s'", yyvsp[-5].c);
@@ -3983,7 +4030,7 @@ case 152:
     ;
     break;}
 case 153:
-#line 1056 "Gmsh.y"
+#line 1059 "Gmsh.y"
 {
       if(strcmp(yyvsp[-10].c, "PostProcessing"))
 	vyyerror("Unknown View Option Class '%s'", yyvsp[-10].c);
@@ -4005,7 +4052,7 @@ case 153:
     ;
     break;}
 case 154:
-#line 1077 "Gmsh.y"
+#line 1080 "Gmsh.y"
 {
       if(!yyvsp[-1].d)
 	vyyerror("Division by Zero in '%s.%s /= %g'", yyvsp[-5].c, yyvsp[-3].c, yyvsp[-1].d);
@@ -4028,7 +4075,7 @@ case 154:
     ;
     break;}
 case 155:
-#line 1098 "Gmsh.y"
+#line 1101 "Gmsh.y"
 {
       if(!yyvsp[-1].d)
 	vyyerror("Division by Zero in '%s.View[%d].%s /= %g'", 
@@ -4055,7 +4102,7 @@ case 155:
     ;
     break;}
 case 156:
-#line 1124 "Gmsh.y"
+#line 1127 "Gmsh.y"
 {
       if(!(pNumCat = Get_NumberOptionCategory(yyvsp[-4].c)))
 	vyyerror("Unknown Numeric Option Class '%s'", yyvsp[-4].c);
@@ -4074,7 +4121,7 @@ case 156:
     ;
     break;}
 case 157:
-#line 1141 "Gmsh.y"
+#line 1144 "Gmsh.y"
 {
       if(strcmp(yyvsp[-10].c, "PostProcessing"))
 	vyyerror("Unknown View Option Class '%s'", yyvsp[-10].c);
@@ -4096,7 +4143,7 @@ case 157:
     ;
     break;}
 case 158:
-#line 1162 "Gmsh.y"
+#line 1165 "Gmsh.y"
 {
       if(!(pNumCat = Get_NumberOptionCategory(yyvsp[-4].c)))
 	vyyerror("Unknown Numeric Option Class '%s'", yyvsp[-4].c);
@@ -4115,7 +4162,7 @@ case 158:
     ;
     break;}
 case 159:
-#line 1179 "Gmsh.y"
+#line 1182 "Gmsh.y"
 {
       if(strcmp(yyvsp[-10].c, "PostProcessing"))
 	vyyerror("Unknown View Option Class '%s'", yyvsp[-10].c);
@@ -4137,7 +4184,7 @@ case 159:
     ;
     break;}
 case 160:
-#line 1202 "Gmsh.y"
+#line 1205 "Gmsh.y"
 {
       if(!(pColCat = Get_ColorOptionCategory(yyvsp[-7].c)))
 	vyyerror("Unknown Color Option Class '%s'", yyvsp[-7].c);
@@ -4151,7 +4198,7 @@ case 160:
     ;
     break;}
 case 161:
-#line 1215 "Gmsh.y"
+#line 1218 "Gmsh.y"
 {
       if(strcmp(yyvsp[-10].c, "PostProcessing"))
 	vyyerror("Unknown View Option Class '%s'", yyvsp[-10].c);
@@ -4171,7 +4218,7 @@ case 161:
     ;
     break;}
 case 162:
-#line 1244 "Gmsh.y"
+#line 1247 "Gmsh.y"
 {
       Cdbpts101((int)yyvsp[-4].d,yyvsp[-1].v[0],yyvsp[-1].v[1],yyvsp[-1].v[2],yyvsp[-1].v[3],yyvsp[-1].v[4]);
       yyval.s.Type = MSH_POINT;
@@ -4179,7 +4226,7 @@ case 162:
     ;
     break;}
 case 163:
-#line 1251 "Gmsh.y"
+#line 1254 "Gmsh.y"
 {
       Cdbz101((int)yyvsp[-4].d,MSH_PHYSICAL_POINT,0,0,0,0,0,NULL,yyvsp[-1].l,NULL);
       yyval.s.Type = MSH_PHYSICAL_POINT;
@@ -4187,7 +4234,7 @@ case 163:
     ;
     break;}
 case 164:
-#line 1257 "Gmsh.y"
+#line 1260 "Gmsh.y"
 {
       Vertex *v;
       Attractor *a;
@@ -4208,7 +4255,7 @@ case 164:
     ;
     break;}
 case 165:
-#line 1276 "Gmsh.y"
+#line 1279 "Gmsh.y"
 {
       for(i=0;i<List_Nbr(yyvsp[-3].l);i++){
 	List_Read(yyvsp[-3].l,i,&d);
@@ -4221,14 +4268,14 @@ case 165:
     ;
     break;}
 case 166:
-#line 1287 "Gmsh.y"
+#line 1290 "Gmsh.y"
 {
       yyval.s.Type = MSH_POINT;
       yyval.s.Num  = (int)yyvsp[-2].d;
     ;
     break;}
 case 167:
-#line 1295 "Gmsh.y"
+#line 1298 "Gmsh.y"
 {
       Cdbseg101((int)yyvsp[-4].d,MSH_SEGM_LINE,1,yyvsp[-1].l,NULL,-1,-1,0.,1.,NULL,NULL,NULL);
       yyval.s.Type = MSH_SEGM_LINE;
@@ -4236,7 +4283,7 @@ case 167:
     ;
     break;}
 case 168:
-#line 1301 "Gmsh.y"
+#line 1304 "Gmsh.y"
 {
       Cdbseg101((int)yyvsp[-4].d,MSH_SEGM_SPLN,3,yyvsp[-1].l,NULL,-1,-1,0.,1.,NULL,NULL,NULL);
       yyval.s.Type = MSH_SEGM_SPLN;
@@ -4244,7 +4291,7 @@ case 168:
     ;
     break;}
 case 169:
-#line 1307 "Gmsh.y"
+#line 1310 "Gmsh.y"
 {
       Curve *c;
       Attractor *a;
@@ -4265,7 +4312,7 @@ case 169:
     ;
     break;}
 case 170:
-#line 1326 "Gmsh.y"
+#line 1329 "Gmsh.y"
 {
       Cdbseg101((int)yyvsp[-4].d,MSH_SEGM_CIRC,2,yyvsp[-1].l,NULL,-1,-1,0.,1.,NULL,NULL,NULL);
       yyval.s.Type = MSH_SEGM_CIRC ;
@@ -4273,7 +4320,7 @@ case 170:
     ;
     break;}
 case 171:
-#line 1332 "Gmsh.y"
+#line 1335 "Gmsh.y"
 {
       List_T *temp;
       int i,j;
@@ -4291,7 +4338,7 @@ case 171:
     ;
     break;}
 case 172:
-#line 1349 "Gmsh.y"
+#line 1352 "Gmsh.y"
 {
       Cdbseg101((int)yyvsp[-14].d,MSH_SEGM_PARAMETRIC,2,NULL,NULL,-1,-1,yyvsp[-10].d,yyvsp[-8].d,yyvsp[-6].c,yyvsp[-4].c,yyvsp[-2].c);
       yyval.s.Type = MSH_SEGM_PARAMETRIC ;
@@ -4299,7 +4346,7 @@ case 172:
     ;
     break;}
 case 173:
-#line 1355 "Gmsh.y"
+#line 1358 "Gmsh.y"
 {
       Cdbseg101((int)yyvsp[-4].d,MSH_SEGM_ELLI,2,yyvsp[-1].l,NULL,-1,-1,0.,1.,NULL,NULL,NULL);
       yyval.s.Type = MSH_SEGM_ELLI ;
@@ -4307,7 +4354,7 @@ case 173:
     ;
     break;}
 case 174:
-#line 1361 "Gmsh.y"
+#line 1364 "Gmsh.y"
 {
       Cdbz101((int)yyvsp[-4].d,MSH_PHYSICAL_LINE,0,0,0,0,0,NULL,yyvsp[-1].l,NULL);
       yyval.s.Type = MSH_PHYSICAL_LINE;
@@ -4315,7 +4362,7 @@ case 174:
     ;
     break;}
 case 175:
-#line 1367 "Gmsh.y"
+#line 1370 "Gmsh.y"
 {
       yyval.s.Type = MSH_SEGM_LOOP;
       Cdbz101((int)yyvsp[-4].d,yyval.s.Type,0,0,0,0,0,NULL,yyvsp[-1].l,NULL);
@@ -4323,7 +4370,7 @@ case 175:
     ;
     break;}
 case 176:
-#line 1373 "Gmsh.y"
+#line 1376 "Gmsh.y"
 {
       Cdbseg101((int)yyvsp[-4].d,MSH_SEGM_BSPLN,2,yyvsp[-1].l,NULL,-1,-1,0.,1.,NULL,NULL,NULL);
       yyval.s.Type = MSH_SEGM_BSPLN;
@@ -4331,7 +4378,7 @@ case 176:
     ;
     break;}
 case 177:
-#line 1379 "Gmsh.y"
+#line 1382 "Gmsh.y"
 {
       List_T *Temp;
       int i;
@@ -4352,7 +4399,7 @@ case 177:
     ;
     break;}
 case 178:
-#line 1398 "Gmsh.y"
+#line 1401 "Gmsh.y"
 {
       yyval.s.Num = (int)yyvsp[-2].d;
       Curve *c = FindCurve(yyval.s.Num,THEM);
@@ -4363,7 +4410,7 @@ case 178:
     ;
     break;}
 case 179:
-#line 1410 "Gmsh.y"
+#line 1413 "Gmsh.y"
 {
       Cdbz101((int)yyvsp[-4].d,MSH_SURF_PLAN,0,0,0,0,0,NULL,yyvsp[-1].l,NULL);
       yyval.s.Type = MSH_SURF_PLAN;
@@ -4371,7 +4418,7 @@ case 179:
     ;
     break;}
 case 180:
-#line 1416 "Gmsh.y"
+#line 1419 "Gmsh.y"
 {
       Surface *s,*support;
       support = FindSurface((int)yyvsp[-4].d,THEM);
@@ -4392,7 +4439,7 @@ case 180:
     ;
     break;}
 case 181:
-#line 1435 "Gmsh.y"
+#line 1438 "Gmsh.y"
 {
       List_Read(yyvsp[-1].l,0,&d);
       i = (int)d;
@@ -4415,7 +4462,7 @@ case 181:
     ;
     break;}
 case 182:
-#line 1458 "Gmsh.y"
+#line 1461 "Gmsh.y"
 {
       CreateNurbsSurface ( (int) yyvsp[-16].d , (int)yyvsp[-4].d , (int)yyvsp[-2].d  , yyvsp[-13].l, yyvsp[-10].l, yyvsp[-8].l);
       yyval.s.Type  = MSH_SURF_NURBS;
@@ -4423,13 +4470,13 @@ case 182:
     ;
     break;}
 case 183:
-#line 1466 "Gmsh.y"
+#line 1469 "Gmsh.y"
 {
       CreateNurbsSurfaceSupport ((int)yyvsp[-16].d, (int) yyvsp[-4].d , (int) yyvsp[-2].d , yyvsp[-13].l, yyvsp[-10].l, yyvsp[-8].l);
     ;
     break;}
 case 184:
-#line 1470 "Gmsh.y"
+#line 1473 "Gmsh.y"
 {
       Cdbz101((int)yyvsp[-4].d,MSH_PHYSICAL_SURFACE,0,0,0,0,0,NULL,yyvsp[-1].l,NULL);
       yyval.s.Type = MSH_PHYSICAL_SURFACE;
@@ -4437,7 +4484,7 @@ case 184:
     ;
     break;}
 case 185:
-#line 1476 "Gmsh.y"
+#line 1479 "Gmsh.y"
 {
       Cdbz101((int)yyvsp[-4].d,MSH_SURF_LOOP,0,0,0,0,0,NULL,yyvsp[-1].l,NULL);
       yyval.s.Type = MSH_SURF_LOOP;
@@ -4445,7 +4492,7 @@ case 185:
     ;
     break;}
 case 186:
-#line 1482 "Gmsh.y"
+#line 1485 "Gmsh.y"
 {
       yyval.s.Num = (int)yyvsp[-2].d;
       Surface *s = FindSurface(yyval.s.Num,THEM);
@@ -4456,7 +4503,7 @@ case 186:
      ;
     break;}
 case 187:
-#line 1494 "Gmsh.y"
+#line 1497 "Gmsh.y"
 {
       Cdbz101((int)yyvsp[-4].d,MSH_VOLUME,0,0,0,0,0,NULL,yyvsp[-1].l,NULL);
       yyval.s.Type = MSH_VOLUME;
@@ -4464,7 +4511,7 @@ case 187:
     ;
     break;}
 case 188:
-#line 1500 "Gmsh.y"
+#line 1503 "Gmsh.y"
 {
       Cdbz101((int)yyvsp[-4].d,MSH_VOLUME,0,0,0,0,0,NULL,yyvsp[-1].l,NULL);
       yyval.s.Type = MSH_VOLUME;
@@ -4472,7 +4519,7 @@ case 188:
     ;
     break;}
 case 189:
-#line 1506 "Gmsh.y"
+#line 1509 "Gmsh.y"
 {
       Cdbz101((int)yyvsp[-4].d,MSH_PHYSICAL_VOLUME,0,0,0,0,0,NULL,yyvsp[-1].l,NULL);
       yyval.s.Type = MSH_PHYSICAL_VOLUME;
@@ -4480,60 +4527,60 @@ case 189:
     ;
     break;}
 case 190:
-#line 1519 "Gmsh.y"
+#line 1522 "Gmsh.y"
 {
       TranslateShapes (yyvsp[-3].v[0],yyvsp[-3].v[1],yyvsp[-3].v[2],yyvsp[-1].l,1);
       yyval.l = yyvsp[-1].l;
     ;
     break;}
 case 191:
-#line 1524 "Gmsh.y"
+#line 1527 "Gmsh.y"
 {
       RotateShapes(yyvsp[-8].v[0],yyvsp[-8].v[1],yyvsp[-8].v[2],yyvsp[-6].v[0],yyvsp[-6].v[1],yyvsp[-6].v[2],yyvsp[-4].d,yyvsp[-1].l);
       yyval.l = yyvsp[-1].l;
     ;
     break;}
 case 192:
-#line 1529 "Gmsh.y"
+#line 1532 "Gmsh.y"
 {
       SymmetryShapes(yyvsp[-3].v[0],yyvsp[-3].v[1],yyvsp[-3].v[2],yyvsp[-3].v[3],yyvsp[-1].l,1);
       yyval.l = yyvsp[-1].l;
     ;
     break;}
 case 193:
-#line 1534 "Gmsh.y"
+#line 1537 "Gmsh.y"
 {
       DilatShapes(yyvsp[-6].v[0],yyvsp[-6].v[1],yyvsp[-6].v[2],yyvsp[-4].d,yyvsp[-1].l,1);
       yyval.l = yyvsp[-1].l;
     ;
     break;}
 case 194:
-#line 1541 "Gmsh.y"
+#line 1544 "Gmsh.y"
 { yyval.l = yyvsp[0].l; ;
     break;}
 case 195:
-#line 1542 "Gmsh.y"
+#line 1545 "Gmsh.y"
 { yyval.l = yyvsp[0].l; ;
     break;}
 case 196:
-#line 1543 "Gmsh.y"
+#line 1546 "Gmsh.y"
 { yyval.l = yyvsp[0].l; ;
     break;}
 case 197:
-#line 1548 "Gmsh.y"
+#line 1551 "Gmsh.y"
 {
       yyval.l = List_Create(3,3,sizeof(Shape));
     ;
     break;}
 case 198:
-#line 1552 "Gmsh.y"
+#line 1555 "Gmsh.y"
 {
       List_Add(yyval.l,&yyvsp[0].s);
       yyval.l = yyvsp[-1].l;
     ;
     break;}
 case 199:
-#line 1564 "Gmsh.y"
+#line 1567 "Gmsh.y"
 {
       yyval.l = List_Create(3,3,sizeof(Shape));
       for(i=0;i<List_Nbr(yyvsp[-1].l);i++){
@@ -4545,7 +4592,7 @@ case 199:
     ;
     break;}
 case 200:
-#line 1582 "Gmsh.y"
+#line 1585 "Gmsh.y"
 {
       for(i=0;i<List_Nbr(yyvsp[-1].l);i++){
 	List_Read (yyvsp[-1].l,i,&TheShape);
@@ -4554,19 +4601,19 @@ case 200:
     ;
     break;}
 case 201:
-#line 1589 "Gmsh.y"
+#line 1592 "Gmsh.y"
 {
 	FreeView((int)yyvsp[-2].d);
       ;
     break;}
 case 202:
-#line 1593 "Gmsh.y"
+#line 1596 "Gmsh.y"
 {
       Init_Mesh(THEM, 1);
     ;
     break;}
 case 203:
-#line 1605 "Gmsh.y"
+#line 1608 "Gmsh.y"
 {
       if(!strcmp(yyvsp[-2].c, "Include")){
 
@@ -4619,14 +4666,13 @@ case 203:
     ;
     break;}
 case 204:
-#line 1656 "Gmsh.y"
+#line 1659 "Gmsh.y"
 {
       if(!strcmp(yyvsp[-2].c, "Sleep")){
 
-	extern long Get_AnimTime();
-	long sleep_time = Get_AnimTime();
+	long sleep_time = GetTime();
 	while(1){
-	  if(Get_AnimTime() - sleep_time > (long)(yyvsp[-1].d*1.e6)) break;
+	  if(GetTime() - sleep_time > (long)(yyvsp[-1].d*1.e6)) break;
 	}
       
       }
@@ -4641,28 +4687,30 @@ case 204:
     ;
     break;}
 case 205:
-#line 1676 "Gmsh.y"
+#line 1678 "Gmsh.y"
 {
       exit(0);
     ;
     break;}
 case 206:
-#line 1680 "Gmsh.y"
+#line 1682 "Gmsh.y"
 {
       if(!CTX.interactive){ // we're in interactive mode
 	if(Tree_Nbr(THEM->Points) != Last_NumberOfPoints){
 	  Last_NumberOfPoints = Tree_Nbr(THEM->Points);
 	  Replot();
+	  DrawUI();
 	}
 	else{
 	  Init();
 	  Draw();
+	  DrawUI();
 	}
       }
     ;
     break;}
 case 207:
-#line 1701 "Gmsh.y"
+#line 1705 "Gmsh.y"
 {
       FILE* ff;
       if(RecursionLevel)
@@ -4678,7 +4726,7 @@ case 207:
     ;
     break;}
 case 208:
-#line 1715 "Gmsh.y"
+#line 1719 "Gmsh.y"
 {
       FILE* ff;
       if(RecursionLevel)
@@ -4694,7 +4742,7 @@ case 208:
     ;
     break;}
 case 209:
-#line 1729 "Gmsh.y"
+#line 1733 "Gmsh.y"
 {
       FILE* ff;
       if(RecursionLevel)
@@ -4721,7 +4769,7 @@ case 209:
     ;
     break;}
 case 210:
-#line 1754 "Gmsh.y"
+#line 1758 "Gmsh.y"
 {
       FILE* ff;
       if(RecursionLevel)
@@ -4748,7 +4796,7 @@ case 210:
     ;
     break;}
 case 211:
-#line 1779 "Gmsh.y"
+#line 1783 "Gmsh.y"
 {
       if(LoopControlVariablesTab[ImbricatedLoop-1][1] >  
 	 LoopControlVariablesTab[ImbricatedLoop-1][0]){
@@ -4776,7 +4824,7 @@ case 211:
     ;
     break;}
 case 212:
-#line 1805 "Gmsh.y"
+#line 1809 "Gmsh.y"
 {
       if(!FunctionManager::Instance()->createFunction(yyvsp[0].c,yyin,yylineno))
 	vyyerror("Redefinition of function %s",yyvsp[0].c);
@@ -4784,39 +4832,39 @@ case 212:
     ;
     break;}
 case 213:
-#line 1811 "Gmsh.y"
+#line 1815 "Gmsh.y"
 {
       if(!FunctionManager::Instance()->leaveFunction(&yyin,yylineno))
 	vyyerror("Error while exiting function");
     ;
     break;}
 case 214:
-#line 1816 "Gmsh.y"
+#line 1820 "Gmsh.y"
 {
       if(!FunctionManager::Instance()->enterFunction(yyvsp[-1].c,&yyin,yylineno))
 	vyyerror("Unknown Function %s",yyvsp[-1].c);
     ;
     break;}
 case 215:
-#line 1821 "Gmsh.y"
+#line 1825 "Gmsh.y"
 {
       if(!yyvsp[-1].d) skip_until("If", "EndIf");
     ;
     break;}
 case 216:
-#line 1825 "Gmsh.y"
+#line 1829 "Gmsh.y"
 {
     ;
     break;}
 case 217:
-#line 1836 "Gmsh.y"
+#line 1840 "Gmsh.y"
 {
       Curve *pc, *prc;
       Extrude_ProtudePoint(1,(int)yyvsp[-4].d,yyvsp[-2].v[0],yyvsp[-2].v[1],yyvsp[-2].v[2],0.,0.,0.,0.,&pc,&prc,NULL);
     ;
     break;}
 case 218:
-#line 1841 "Gmsh.y"
+#line 1845 "Gmsh.y"
 {
       Curve *pc, *prc;
       Extrude_ProtudePoint(0,(int)yyvsp[-8].d,yyvsp[-6].v[0],yyvsp[-6].v[1],yyvsp[-6].v[2],yyvsp[-4].v[0],yyvsp[-4].v[1],yyvsp[-4].v[2],yyvsp[-2].d,
@@ -4824,55 +4872,55 @@ case 218:
     ;
     break;}
 case 219:
-#line 1847 "Gmsh.y"
+#line 1851 "Gmsh.y"
 {
       Extrude_ProtudeCurve(1,(int)yyvsp[-4].d,yyvsp[-2].v[0],yyvsp[-2].v[1],yyvsp[-2].v[2],0.,0.,0.,0.,NULL);
     ;
     break;}
 case 220:
-#line 1851 "Gmsh.y"
+#line 1855 "Gmsh.y"
 {
       Extrude_ProtudeCurve(0,(int)yyvsp[-8].d,yyvsp[-6].v[0],yyvsp[-6].v[1],yyvsp[-6].v[2],yyvsp[-4].v[0],yyvsp[-4].v[1],yyvsp[-4].v[2],yyvsp[-2].d,NULL);
     ;
     break;}
 case 221:
-#line 1855 "Gmsh.y"
+#line 1859 "Gmsh.y"
 {
       Extrude_ProtudeSurface(1,(int)yyvsp[-4].d,yyvsp[-2].v[0],yyvsp[-2].v[1],yyvsp[-2].v[2],0.,0.,0.,0.,0,NULL);
     ;
     break;}
 case 222:
-#line 1859 "Gmsh.y"
+#line 1863 "Gmsh.y"
 {
       Extrude_ProtudeSurface(0,(int)yyvsp[-8].d,yyvsp[-6].v[0],yyvsp[-6].v[1],yyvsp[-6].v[2],yyvsp[-4].v[0],yyvsp[-4].v[1],yyvsp[-4].v[2],yyvsp[-2].d,0,NULL);
     ;
     break;}
 case 223:
-#line 1863 "Gmsh.y"
+#line 1867 "Gmsh.y"
 {
     int vol = NEWREG();
     Extrude_ProtudeSurface(1,(int)yyvsp[-7].d,yyvsp[-5].v[0],yyvsp[-5].v[1],yyvsp[-5].v[2],0.,0.,0.,0.,vol,&extr);
   ;
     break;}
 case 224:
-#line 1868 "Gmsh.y"
+#line 1872 "Gmsh.y"
 {
     int vol = NEWREG();
     Extrude_ProtudeSurface(0,(int)yyvsp[-11].d,yyvsp[-9].v[0],yyvsp[-9].v[1],yyvsp[-9].v[2],yyvsp[-7].v[0],yyvsp[-7].v[1],yyvsp[-7].v[2],yyvsp[-5].d,vol,&extr);
   ;
     break;}
 case 225:
-#line 1876 "Gmsh.y"
+#line 1880 "Gmsh.y"
 {
     ;
     break;}
 case 226:
-#line 1879 "Gmsh.y"
+#line 1883 "Gmsh.y"
 {
     ;
     break;}
 case 227:
-#line 1885 "Gmsh.y"
+#line 1889 "Gmsh.y"
 {
       double d;
       int j;
@@ -4891,13 +4939,13 @@ case 227:
     ;
     break;}
 case 228:
-#line 1902 "Gmsh.y"
+#line 1906 "Gmsh.y"
 {
       extr.mesh.Recombine = true;
     ;
     break;}
 case 229:
-#line 1913 "Gmsh.y"
+#line 1917 "Gmsh.y"
 {
       Curve *c;
       for(i=0;i<List_Nbr(yyvsp[-3].l);i++){
@@ -4916,7 +4964,7 @@ case 229:
     ;
     break;}
 case 230:
-#line 1930 "Gmsh.y"
+#line 1934 "Gmsh.y"
 {
       Curve *c;
       for(i=0;i<List_Nbr(yyvsp[-6].l);i++){
@@ -4935,7 +4983,7 @@ case 230:
     ;
     break;}
 case 231:
-#line 1947 "Gmsh.y"
+#line 1951 "Gmsh.y"
 {
       Curve *c;
       for(i=0;i<List_Nbr(yyvsp[-6].l);i++){
@@ -4954,7 +5002,7 @@ case 231:
     ;
     break;}
 case 232:
-#line 1964 "Gmsh.y"
+#line 1968 "Gmsh.y"
 {
       Surface *s = FindSurface((int)yyvsp[-4].d,THEM);
       if(!s)
@@ -4977,7 +5025,7 @@ case 232:
     ;
     break;}
 case 233:
-#line 1985 "Gmsh.y"
+#line 1989 "Gmsh.y"
 {
       Surface *s = FindSurface((int)yyvsp[-4].d,THEM);
       if(!s)
@@ -4999,7 +5047,7 @@ case 233:
     ;
     break;}
 case 234:
-#line 2005 "Gmsh.y"
+#line 2009 "Gmsh.y"
 {
       Volume *v = FindVolume((int)yyvsp[-4].d,THEM);
       if(!v)
@@ -5021,7 +5069,7 @@ case 234:
     ;
     break;}
 case 235:
-#line 2025 "Gmsh.y"
+#line 2029 "Gmsh.y"
 {
       Surface *s;
       for(i=0;i<List_Nbr(yyvsp[-3].l);i++){
@@ -5040,7 +5088,7 @@ case 235:
     ;
     break;}
 case 236:
-#line 2042 "Gmsh.y"
+#line 2046 "Gmsh.y"
 {
       Surface *s;
       for(i=0;i<List_Nbr(yyvsp[-1].l);i++){
@@ -5059,79 +5107,79 @@ case 236:
     ;
     break;}
 case 237:
-#line 2067 "Gmsh.y"
+#line 2071 "Gmsh.y"
 { 
       Coherence_PS();
     ;
     break;}
 case 238:
-#line 2071 "Gmsh.y"
+#line 2075 "Gmsh.y"
 { 
       IntersectAllSegmentsTogether();
     ;
     break;}
 case 239:
-#line 2082 "Gmsh.y"
+#line 2086 "Gmsh.y"
 { yyval.d = yyvsp[0].d; ;
     break;}
 case 240:
-#line 2083 "Gmsh.y"
+#line 2087 "Gmsh.y"
 { yyval.d = -yyvsp[0].d; ;
     break;}
 case 241:
-#line 2087 "Gmsh.y"
+#line 2091 "Gmsh.y"
 {yyval.i = 1;;
     break;}
 case 242:
-#line 2088 "Gmsh.y"
+#line 2092 "Gmsh.y"
 {yyval.i = 0;;
     break;}
 case 243:
-#line 2089 "Gmsh.y"
+#line 2093 "Gmsh.y"
 {yyval.i = -1;;
     break;}
 case 244:
-#line 2090 "Gmsh.y"
+#line 2094 "Gmsh.y"
 {yyval.i = -1;;
     break;}
 case 245:
-#line 2091 "Gmsh.y"
+#line 2095 "Gmsh.y"
 {yyval.i = -1;;
     break;}
 case 246:
-#line 2095 "Gmsh.y"
+#line 2099 "Gmsh.y"
 { yyval.d = yyvsp[0].d;           ;
     break;}
 case 247:
-#line 2096 "Gmsh.y"
+#line 2100 "Gmsh.y"
 { yyval.d = yyvsp[-1].d ;          ;
     break;}
 case 248:
-#line 2097 "Gmsh.y"
+#line 2101 "Gmsh.y"
 { yyval.d = -yyvsp[0].d ;         ;
     break;}
 case 249:
-#line 2098 "Gmsh.y"
+#line 2102 "Gmsh.y"
 { yyval.d = yyvsp[0].d;           ;
     break;}
 case 250:
-#line 2099 "Gmsh.y"
+#line 2103 "Gmsh.y"
 { yyval.d = !yyvsp[0].d ;         ;
     break;}
 case 251:
-#line 2100 "Gmsh.y"
+#line 2104 "Gmsh.y"
 { yyval.d = yyvsp[-2].d - yyvsp[0].d ;     ;
     break;}
 case 252:
-#line 2101 "Gmsh.y"
+#line 2105 "Gmsh.y"
 { yyval.d = yyvsp[-2].d + yyvsp[0].d ;     ;
     break;}
 case 253:
-#line 2102 "Gmsh.y"
+#line 2106 "Gmsh.y"
 { yyval.d = yyvsp[-2].d * yyvsp[0].d ;     ;
     break;}
 case 254:
-#line 2104 "Gmsh.y"
+#line 2108 "Gmsh.y"
 { 
       if(!yyvsp[0].d)
 	vyyerror("Division by Zero in '%g / %g'", yyvsp[-2].d, yyvsp[0].d);
@@ -5140,143 +5188,143 @@ case 254:
     ;
     break;}
 case 255:
-#line 2110 "Gmsh.y"
+#line 2114 "Gmsh.y"
 { yyval.d = (int)yyvsp[-2].d % (int)yyvsp[0].d ;  ;
     break;}
 case 256:
-#line 2111 "Gmsh.y"
+#line 2115 "Gmsh.y"
 { yyval.d = pow(yyvsp[-2].d,yyvsp[0].d) ;  ;
     break;}
 case 257:
-#line 2112 "Gmsh.y"
+#line 2116 "Gmsh.y"
 { yyval.d = yyvsp[-2].d < yyvsp[0].d ;     ;
     break;}
 case 258:
-#line 2113 "Gmsh.y"
+#line 2117 "Gmsh.y"
 { yyval.d = yyvsp[-2].d > yyvsp[0].d ;     ;
     break;}
 case 259:
-#line 2114 "Gmsh.y"
+#line 2118 "Gmsh.y"
 { yyval.d = yyvsp[-2].d <= yyvsp[0].d ;    ;
     break;}
 case 260:
-#line 2115 "Gmsh.y"
+#line 2119 "Gmsh.y"
 { yyval.d = yyvsp[-2].d >= yyvsp[0].d ;    ;
     break;}
 case 261:
-#line 2116 "Gmsh.y"
+#line 2120 "Gmsh.y"
 { yyval.d = yyvsp[-2].d == yyvsp[0].d ;    ;
     break;}
 case 262:
-#line 2117 "Gmsh.y"
+#line 2121 "Gmsh.y"
 { yyval.d = yyvsp[-2].d != yyvsp[0].d ;    ;
     break;}
 case 263:
-#line 2118 "Gmsh.y"
+#line 2122 "Gmsh.y"
 { yyval.d = yyvsp[-2].d && yyvsp[0].d ;    ;
     break;}
 case 264:
-#line 2119 "Gmsh.y"
+#line 2123 "Gmsh.y"
 { yyval.d = yyvsp[-2].d || yyvsp[0].d ;    ;
     break;}
 case 265:
-#line 2120 "Gmsh.y"
+#line 2124 "Gmsh.y"
 { yyval.d = yyvsp[-4].d? yyvsp[-2].d : yyvsp[0].d ; ;
     break;}
 case 266:
-#line 2121 "Gmsh.y"
+#line 2125 "Gmsh.y"
 { yyval.d = exp(yyvsp[-1].d);      ;
     break;}
 case 267:
-#line 2122 "Gmsh.y"
+#line 2126 "Gmsh.y"
 { yyval.d = log(yyvsp[-1].d);      ;
     break;}
 case 268:
-#line 2123 "Gmsh.y"
+#line 2127 "Gmsh.y"
 { yyval.d = log10(yyvsp[-1].d);    ;
     break;}
 case 269:
-#line 2124 "Gmsh.y"
+#line 2128 "Gmsh.y"
 { yyval.d = sqrt(yyvsp[-1].d);     ;
     break;}
 case 270:
-#line 2125 "Gmsh.y"
+#line 2129 "Gmsh.y"
 { yyval.d = sin(yyvsp[-1].d);      ;
     break;}
 case 271:
-#line 2126 "Gmsh.y"
+#line 2130 "Gmsh.y"
 { yyval.d = asin(yyvsp[-1].d);     ;
     break;}
 case 272:
-#line 2127 "Gmsh.y"
+#line 2131 "Gmsh.y"
 { yyval.d = cos(yyvsp[-1].d);      ;
     break;}
 case 273:
-#line 2128 "Gmsh.y"
+#line 2132 "Gmsh.y"
 { yyval.d = acos(yyvsp[-1].d);     ;
     break;}
 case 274:
-#line 2129 "Gmsh.y"
+#line 2133 "Gmsh.y"
 { yyval.d = tan(yyvsp[-1].d);      ;
     break;}
 case 275:
-#line 2130 "Gmsh.y"
+#line 2134 "Gmsh.y"
 { yyval.d = atan(yyvsp[-1].d);     ;
     break;}
 case 276:
-#line 2131 "Gmsh.y"
+#line 2135 "Gmsh.y"
 { yyval.d = atan2(yyvsp[-3].d,yyvsp[-1].d); ;
     break;}
 case 277:
-#line 2132 "Gmsh.y"
+#line 2136 "Gmsh.y"
 { yyval.d = sinh(yyvsp[-1].d);     ;
     break;}
 case 278:
-#line 2133 "Gmsh.y"
+#line 2137 "Gmsh.y"
 { yyval.d = cosh(yyvsp[-1].d);     ;
     break;}
 case 279:
-#line 2134 "Gmsh.y"
+#line 2138 "Gmsh.y"
 { yyval.d = tanh(yyvsp[-1].d);     ;
     break;}
 case 280:
-#line 2135 "Gmsh.y"
+#line 2139 "Gmsh.y"
 { yyval.d = fabs(yyvsp[-1].d);     ;
     break;}
 case 281:
-#line 2136 "Gmsh.y"
+#line 2140 "Gmsh.y"
 { yyval.d = floor(yyvsp[-1].d);    ;
     break;}
 case 282:
-#line 2137 "Gmsh.y"
+#line 2141 "Gmsh.y"
 { yyval.d = ceil(yyvsp[-1].d);     ;
     break;}
 case 283:
-#line 2138 "Gmsh.y"
+#line 2142 "Gmsh.y"
 { yyval.d = fmod(yyvsp[-3].d,yyvsp[-1].d);  ;
     break;}
 case 284:
-#line 2139 "Gmsh.y"
+#line 2143 "Gmsh.y"
 { yyval.d = fmod(yyvsp[-3].d,yyvsp[-1].d);  ;
     break;}
 case 285:
-#line 2140 "Gmsh.y"
+#line 2144 "Gmsh.y"
 { yyval.d = sqrt(yyvsp[-3].d*yyvsp[-3].d+yyvsp[-1].d*yyvsp[-1].d); ;
     break;}
 case 286:
-#line 2141 "Gmsh.y"
+#line 2145 "Gmsh.y"
 { yyval.d = yyvsp[-1].d*(double)rand()/(double)RAND_MAX; ;
     break;}
 case 287:
-#line 2150 "Gmsh.y"
+#line 2154 "Gmsh.y"
 { yyval.d = yyvsp[0].d; ;
     break;}
 case 288:
-#line 2151 "Gmsh.y"
+#line 2155 "Gmsh.y"
 { yyval.d = 3.141592653589793; ;
     break;}
 case 289:
-#line 2156 "Gmsh.y"
+#line 2160 "Gmsh.y"
 {
       TheSymbol.Name = yyvsp[0].c ;
       if (!(pSymbol = (Symbol*)List_PQuery(Symbol_L, &TheSymbol, CompareSymbols))) {
@@ -5290,7 +5338,7 @@ case 289:
     ;
     break;}
 case 290:
-#line 2168 "Gmsh.y"
+#line 2172 "Gmsh.y"
 {
       TheSymbol.Name = yyvsp[-3].c ;
       if (!(pSymbol = (Symbol*)List_PQuery(Symbol_L, &TheSymbol, CompareSymbols))) {
@@ -5309,7 +5357,7 @@ case 290:
     ;
     break;}
 case 291:
-#line 2186 "Gmsh.y"
+#line 2190 "Gmsh.y"
 {
       TheSymbol.Name = yyvsp[-1].c ;
       if (!(pSymbol = (Symbol*)List_PQuery(Symbol_L, &TheSymbol, CompareSymbols))) {
@@ -5323,7 +5371,7 @@ case 291:
     ;
     break;}
 case 292:
-#line 2198 "Gmsh.y"
+#line 2202 "Gmsh.y"
 {
       TheSymbol.Name = yyvsp[-4].c ;
       if (!(pSymbol = (Symbol*)List_PQuery(Symbol_L, &TheSymbol, CompareSymbols))) {
@@ -5342,7 +5390,7 @@ case 292:
     ;
     break;}
 case 293:
-#line 2216 "Gmsh.y"
+#line 2220 "Gmsh.y"
 {
       TheSymbol.Name = yyvsp[-1].c ;
       if (!(pSymbol = (Symbol*)List_PQuery(Symbol_L, &TheSymbol, CompareSymbols))) {
@@ -5356,7 +5404,7 @@ case 293:
     ;
     break;}
 case 294:
-#line 2228 "Gmsh.y"
+#line 2232 "Gmsh.y"
 {
       TheSymbol.Name = yyvsp[-4].c ;
       if (!(pSymbol = (Symbol*)List_PQuery(Symbol_L, &TheSymbol, CompareSymbols))) {
@@ -5375,7 +5423,7 @@ case 294:
     ;
     break;}
 case 295:
-#line 2248 "Gmsh.y"
+#line 2252 "Gmsh.y"
 {
       if(!(pNumCat = Get_NumberOptionCategory(yyvsp[-2].c))){
 	vyyerror("Unknown Numeric Option Class '%s'", yyvsp[-2].c);
@@ -5398,7 +5446,7 @@ case 295:
     ;
     break;}
 case 296:
-#line 2269 "Gmsh.y"
+#line 2273 "Gmsh.y"
 {
       if(strcmp(yyvsp[-7].c, "PostProcessing")){
 	vyyerror("Unknown View Option Class '%s'", yyvsp[-7].c);
@@ -5423,7 +5471,7 @@ case 296:
     ;
     break;}
 case 297:
-#line 2293 "Gmsh.y"
+#line 2297 "Gmsh.y"
 {
       if(!(pNumCat = Get_NumberOptionCategory(yyvsp[-3].c))){
 	vyyerror("Unknown Numeric Option Class '%s'", yyvsp[-3].c);
@@ -5446,7 +5494,7 @@ case 297:
     ;
     break;}
 case 298:
-#line 2314 "Gmsh.y"
+#line 2318 "Gmsh.y"
 {
       if(strcmp(yyvsp[-8].c, "PostProcessing")){
 	vyyerror("Unknown View Option Class '%s'", yyvsp[-8].c);
@@ -5471,7 +5519,7 @@ case 298:
     ;
     break;}
 case 299:
-#line 2338 "Gmsh.y"
+#line 2342 "Gmsh.y"
 {
       if(!(pNumCat = Get_NumberOptionCategory(yyvsp[-3].c))){
 	vyyerror("Unknown Numeric Option Class '%s'", yyvsp[-3].c);
@@ -5494,7 +5542,7 @@ case 299:
     ;
     break;}
 case 300:
-#line 2359 "Gmsh.y"
+#line 2363 "Gmsh.y"
 {
       if(strcmp(yyvsp[-8].c, "PostProcessing")){
 	vyyerror("Unknown View Option Class '%s'", yyvsp[-8].c);
@@ -5519,7 +5567,7 @@ case 300:
     ;
     break;}
 case 301:
-#line 2385 "Gmsh.y"
+#line 2389 "Gmsh.y"
 { 
       ListOfDouble2_L = List_Create(2,1,sizeof(double)) ; 
       for(d=yyvsp[-2].d ; (yyvsp[-2].d<yyvsp[0].d)?(d<=yyvsp[0].d):(d>=yyvsp[0].d) ; (yyvsp[-2].d<yyvsp[0].d)?(d+=1.):(d-=1.)) 
@@ -5527,7 +5575,7 @@ case 301:
     ;
     break;}
 case 302:
-#line 2391 "Gmsh.y"
+#line 2395 "Gmsh.y"
 {
       ListOfDouble2_L = List_Create(2,1,sizeof(double)) ; 
       if(!yyvsp[0].d || (yyvsp[-4].d<yyvsp[-2].d && yyvsp[0].d<0) || (yyvsp[-4].d>yyvsp[-2].d && yyvsp[0].d>0)){
@@ -5540,7 +5588,7 @@ case 302:
    ;
     break;}
 case 303:
-#line 2405 "Gmsh.y"
+#line 2409 "Gmsh.y"
 {
       memcpy(yyval.v, yyvsp[0].v, 5*sizeof(double)) ;
       //??? Avec ce qui suit, bison se plante sur DEC
@@ -5548,110 +5596,110 @@ case 303:
     ;
     break;}
 case 304:
-#line 2411 "Gmsh.y"
+#line 2415 "Gmsh.y"
 {
       for(i=0 ; i<5 ; i++) yyval.v[i] = -yyvsp[0].v[i] ;
     ;
     break;}
 case 305:
-#line 2415 "Gmsh.y"
+#line 2419 "Gmsh.y"
 { 
       for(i=0 ; i<5 ; i++) yyval.v[i] = yyvsp[0].v[i];
     ;
     break;}
 case 306:
-#line 2419 "Gmsh.y"
+#line 2423 "Gmsh.y"
 { 
       for(i=0 ; i<5 ; i++) yyval.v[i] = yyvsp[-2].v[i] - yyvsp[0].v[i] ;
     ;
     break;}
 case 307:
-#line 2423 "Gmsh.y"
+#line 2427 "Gmsh.y"
 {
       for(i=0 ; i<5 ; i++) yyval.v[i] = yyvsp[-2].v[i] + yyvsp[0].v[i] ;
     ;
     break;}
 case 308:
-#line 2429 "Gmsh.y"
+#line 2433 "Gmsh.y"
 { 
       yyval.v[0]=yyvsp[-9].d;  yyval.v[1]=yyvsp[-7].d;  yyval.v[2]=yyvsp[-5].d;  yyval.v[3]=yyvsp[-3].d; yyval.v[4]=yyvsp[-1].d;
     ;
     break;}
 case 309:
-#line 2433 "Gmsh.y"
+#line 2437 "Gmsh.y"
 { 
       yyval.v[0]=yyvsp[-7].d;  yyval.v[1]=yyvsp[-5].d;  yyval.v[2]=yyvsp[-3].d;  yyval.v[3]=yyvsp[-1].d; yyval.v[4]=1.0;
     ;
     break;}
 case 310:
-#line 2437 "Gmsh.y"
+#line 2441 "Gmsh.y"
 {
       yyval.v[0]=yyvsp[-5].d;  yyval.v[1]=yyvsp[-3].d;  yyval.v[2]=yyvsp[-1].d;  yyval.v[3]=0.0; yyval.v[4]=1.0;
     ;
     break;}
 case 311:
-#line 2441 "Gmsh.y"
+#line 2445 "Gmsh.y"
 {
       yyval.v[0]=yyvsp[-5].d;  yyval.v[1]=yyvsp[-3].d;  yyval.v[2]=yyvsp[-1].d;  yyval.v[3]=0.0; yyval.v[4]=1.0;
     ;
     break;}
 case 312:
-#line 2448 "Gmsh.y"
+#line 2452 "Gmsh.y"
 {
     ;
     break;}
 case 313:
-#line 2451 "Gmsh.y"
+#line 2455 "Gmsh.y"
 {
     ;
     break;}
 case 314:
-#line 2457 "Gmsh.y"
+#line 2461 "Gmsh.y"
 {
     ;
     break;}
 case 315:
-#line 2460 "Gmsh.y"
+#line 2464 "Gmsh.y"
 {
     ;
     break;}
 case 316:
-#line 2466 "Gmsh.y"
+#line 2470 "Gmsh.y"
 {
     ;
     break;}
 case 317:
-#line 2469 "Gmsh.y"
+#line 2473 "Gmsh.y"
 {
        yyval.l=ListOfListOfDouble_L;
     ;
     break;}
 case 318:
-#line 2473 "Gmsh.y"
+#line 2477 "Gmsh.y"
 {
        yyval.l=ListOfListOfDouble_L;
     ;
     break;}
 case 319:
-#line 2480 "Gmsh.y"
+#line 2484 "Gmsh.y"
 {
       ListOfListOfDouble_L = List_Create(2,1,sizeof(List_T*)) ;
       List_Add(ListOfListOfDouble_L, &(yyvsp[0].l)) ;
     ;
     break;}
 case 320:
-#line 2485 "Gmsh.y"
+#line 2489 "Gmsh.y"
 {
       List_Add(ListOfListOfDouble_L, &(yyvsp[0].l)) ;
     ;
     break;}
 case 321:
-#line 2492 "Gmsh.y"
+#line 2496 "Gmsh.y"
 {
     ;
     break;}
 case 322:
-#line 2495 "Gmsh.y"
+#line 2499 "Gmsh.y"
 {
       ListOfDouble_L = List_Create(2,1,sizeof(double)) ;
       List_Add(ListOfDouble_L, &(yyvsp[0].d)) ;
@@ -5659,7 +5707,7 @@ case 322:
     ;
     break;}
 case 323:
-#line 2501 "Gmsh.y"
+#line 2505 "Gmsh.y"
 {
       ListOfDouble_L = List_Create(2,1,sizeof(double)) ;
       TheSymbol.Name = yyvsp[-2].c ;
@@ -5676,20 +5724,20 @@ case 323:
     ;
     break;}
 case 324:
-#line 2516 "Gmsh.y"
+#line 2520 "Gmsh.y"
 {
       yyval.l=ListOfDouble_L;
     ;
     break;}
 case 325:
-#line 2524 "Gmsh.y"
+#line 2528 "Gmsh.y"
 {
       ListOfDouble_L = List_Create(2,1,sizeof(double)) ;
       List_Add(ListOfDouble_L, &(yyvsp[0].d)) ;
     ;
     break;}
 case 326:
-#line 2529 "Gmsh.y"
+#line 2533 "Gmsh.y"
 { 
       ListOfDouble_L = List_Create(2,1,sizeof(double)) ;
       for(i=0 ; i<List_Nbr(ListOfDouble2_L) ; i++){
@@ -5700,7 +5748,7 @@ case 326:
     ;
     break;}
 case 327:
-#line 2538 "Gmsh.y"
+#line 2542 "Gmsh.y"
 { 
       ListOfDouble_L = List_Create(2,1,sizeof(double)) ;
       TheSymbol.Name = yyvsp[-2].c ;
@@ -5714,13 +5762,13 @@ case 327:
     ;
     break;}
 case 328:
-#line 2550 "Gmsh.y"
+#line 2554 "Gmsh.y"
 {
       List_Add(ListOfDouble_L, &(yyvsp[0].d)) ;
     ;
     break;}
 case 329:
-#line 2554 "Gmsh.y"
+#line 2558 "Gmsh.y"
 {
       for(i=0 ; i<List_Nbr(ListOfDouble2_L) ; i++){
 	List_Read(ListOfDouble2_L, i, &d) ;
@@ -5730,7 +5778,7 @@ case 329:
     ;
     break;}
 case 330:
-#line 2562 "Gmsh.y"
+#line 2566 "Gmsh.y"
 {
       TheSymbol.Name = yyvsp[-2].c ;
       if (!(pSymbol = (Symbol*)List_PQuery(Symbol_L, &TheSymbol, CompareSymbols))) {
@@ -5743,33 +5791,33 @@ case 330:
     ;
     break;}
 case 331:
-#line 2576 "Gmsh.y"
+#line 2580 "Gmsh.y"
 {
       yyval.u = PACK_COLOR((int)yyvsp[-7].d, (int)yyvsp[-5].d, (int)yyvsp[-3].d, (int)yyvsp[-1].d);
     ;
     break;}
 case 332:
-#line 2580 "Gmsh.y"
+#line 2584 "Gmsh.y"
 {
       yyval.u = PACK_COLOR((int)yyvsp[-5].d, (int)yyvsp[-3].d, (int)yyvsp[-1].d, 255);
     ;
     break;}
 case 333:
-#line 2584 "Gmsh.y"
+#line 2588 "Gmsh.y"
 {
       yyval.u = Get_ColorForString(ColorString, (int)yyvsp[-1].d, yyvsp[-3].c, &flag);
       if(flag) vyyerror("Unknown Color '%s'", yyvsp[-3].c);
     ;
     break;}
 case 334:
-#line 2589 "Gmsh.y"
+#line 2593 "Gmsh.y"
 {
       yyval.u = Get_ColorForString(ColorString, -1, yyvsp[0].c, &flag);
       if(flag) vyyerror("Unknown Color '%s'", yyvsp[0].c);
     ;
     break;}
 case 335:
-#line 2594 "Gmsh.y"
+#line 2598 "Gmsh.y"
 {
       if(!(pColCat = Get_ColorOptionCategory(yyvsp[-4].c))){
 	vyyerror("Unknown Color Option Class '%s'", yyvsp[-4].c);
@@ -5787,13 +5835,13 @@ case 335:
     ;
     break;}
 case 336:
-#line 2613 "Gmsh.y"
+#line 2617 "Gmsh.y"
 {
       yyval.l = ListOfColor_L;
     ;
     break;}
 case 337:
-#line 2617 "Gmsh.y"
+#line 2621 "Gmsh.y"
 {
       if(!ListOfColor_L)
 	ListOfColor_L = List_Create(256,10,sizeof(unsigned int)) ;
@@ -5814,7 +5862,7 @@ case 337:
     ;
     break;}
 case 338:
-#line 2639 "Gmsh.y"
+#line 2643 "Gmsh.y"
 {
       if(!ListOfColor_L)
 	ListOfColor_L = List_Create(256,10,sizeof(unsigned int)) ;
@@ -5824,25 +5872,25 @@ case 338:
     ;
     break;}
 case 339:
-#line 2647 "Gmsh.y"
+#line 2651 "Gmsh.y"
 {
       List_Add(ListOfColor_L, &(yyvsp[0].u)) ;
     ;
     break;}
 case 340:
-#line 2654 "Gmsh.y"
+#line 2658 "Gmsh.y"
 {
       yyval.c = yyvsp[0].c;
     ;
     break;}
 case 341:
-#line 2658 "Gmsh.y"
+#line 2662 "Gmsh.y"
 {
       yyval.c = yyvsp[-1].c;
     ;
     break;}
 case 342:
-#line 2662 "Gmsh.y"
+#line 2666 "Gmsh.y"
 {
       for(i = 0 ; i<List_Nbr(ListOfDouble_L) ; i++){
 	if(!i){
@@ -5868,7 +5916,7 @@ case 342:
     break;}
 }
    /* the action file gets copied in in place of this dollarsign */
-#line 498 "/usr/local/share/bison.simple"
+#line 543 "/usr/lib/bison.simple"
 
   yyvsp -= yylen;
   yyssp -= yylen;
@@ -6063,8 +6111,32 @@ yyerrhandle:
 
   yystate = yyn;
   goto yynewstate;
+
+ yyacceptlab:
+  /* YYACCEPT comes here.  */
+  if (yyfree_stacks)
+    {
+      free (yyss);
+      free (yyvs);
+#ifdef YYLSP_NEEDED
+      free (yyls);
+#endif
+    }
+  return 0;
+
+ yyabortlab:
+  /* YYABORT comes here.  */
+  if (yyfree_stacks)
+    {
+      free (yyss);
+      free (yyvs);
+#ifdef YYLSP_NEEDED
+      free (yyls);
+#endif
+    }
+  return 1;
 }
-#line 2686 "Gmsh.y"
+#line 2690 "Gmsh.y"
 
 
 void InitSymbols(void){
@@ -6099,3 +6171,4 @@ void vyyerror(char *fmt, ...){
   yyerrorstate=1;
 }
 
+
diff --git a/Parser/Gmsh.tab.cpp.h b/Parser/Gmsh.tab.cpp.h
index ac1bce85bd14f6ee22c6058c6681188269542609..4a4d722c1b66665aab40ec8d45bedb6bea28d804 100644
--- a/Parser/Gmsh.tab.cpp.h
+++ b/Parser/Gmsh.tab.cpp.h
@@ -7,167 +7,167 @@ typedef union {
   Shape    s;
   List_T  *l;
 } YYSTYPE;
-#define	tDOUBLE	258
-#define	tSTRING	259
-#define	tBIGSTR	260
-#define	tEND	261
-#define	tAFFECT	262
-#define	tDOTS	263
-#define	tPi	264
-#define	tExp	265
-#define	tLog	266
-#define	tLog10	267
-#define	tSqrt	268
-#define	tSin	269
-#define	tAsin	270
-#define	tCos	271
-#define	tAcos	272
-#define	tTan	273
-#define	tRand	274
-#define	tAtan	275
-#define	tAtan2	276
-#define	tSinh	277
-#define	tCosh	278
-#define	tTanh	279
-#define	tFabs	280
-#define	tFloor	281
-#define	tCeil	282
-#define	tFmod	283
-#define	tModulo	284
-#define	tHypot	285
-#define	tPrintf	286
-#define	tSprintf	287
-#define	tDraw	288
-#define	tPoint	289
-#define	tCircle	290
-#define	tEllipsis	291
-#define	tLine	292
-#define	tSurface	293
-#define	tSpline	294
-#define	tVolume	295
-#define	tCharacteristic	296
-#define	tLength	297
-#define	tParametric	298
-#define	tElliptic	299
-#define	tPlane	300
-#define	tRuled	301
-#define	tTransfinite	302
-#define	tComplex	303
-#define	tPhysical	304
-#define	tUsing	305
-#define	tBump	306
-#define	tProgression	307
-#define	tRotate	308
-#define	tTranslate	309
-#define	tSymmetry	310
-#define	tDilate	311
-#define	tExtrude	312
-#define	tDuplicata	313
-#define	tLoop	314
-#define	tRecombine	315
-#define	tDelete	316
-#define	tCoherence	317
-#define	tIntersect	318
-#define	tView	319
-#define	tAttractor	320
-#define	tLayers	321
-#define	tScalarTetrahedron	322
-#define	tVectorTetrahedron	323
-#define	tTensorTetrahedron	324
-#define	tScalarTriangle	325
-#define	tVectorTriangle	326
-#define	tTensorTriangle	327
-#define	tScalarLine	328
-#define	tVectorLine	329
-#define	tTensorLine	330
-#define	tScalarPoint	331
-#define	tVectorPoint	332
-#define	tTensorPoint	333
-#define	tBSpline	334
-#define	tNurbs	335
-#define	tOrder	336
-#define	tWith	337
-#define	tBounds	338
-#define	tKnots	339
-#define	tColor	340
-#define	tFor	341
-#define	tIn	342
-#define	tEndFor	343
-#define	tIf	344
-#define	tEndIf	345
-#define	tExit	346
-#define	tReturn	347
-#define	tCall	348
-#define	tFunction	349
-#define	tMesh	350
-#define	tB_SPLINE_SURFACE_WITH_KNOTS	351
-#define	tB_SPLINE_CURVE_WITH_KNOTS	352
-#define	tCARTESIAN_POINT	353
-#define	tTRUE	354
-#define	tFALSE	355
-#define	tUNSPECIFIED	356
-#define	tU	357
-#define	tV	358
-#define	tEDGE_CURVE	359
-#define	tVERTEX_POINT	360
-#define	tORIENTED_EDGE	361
-#define	tPLANE	362
-#define	tFACE_OUTER_BOUND	363
-#define	tEDGE_LOOP	364
-#define	tADVANCED_FACE	365
-#define	tVECTOR	366
-#define	tDIRECTION	367
-#define	tAXIS2_PLACEMENT_3D	368
-#define	tISO	369
-#define	tENDISO	370
-#define	tENDSEC	371
-#define	tDATA	372
-#define	tHEADER	373
-#define	tFILE_DESCRIPTION	374
-#define	tFILE_SCHEMA	375
-#define	tFILE_NAME	376
-#define	tMANIFOLD_SOLID_BREP	377
-#define	tCLOSED_SHELL	378
-#define	tADVANCED_BREP_SHAPE_REPRESENTATION	379
-#define	tFACE_BOUND	380
-#define	tCYLINDRICAL_SURFACE	381
-#define	tCONICAL_SURFACE	382
-#define	tCIRCLE	383
-#define	tTRIMMED_CURVE	384
-#define	tGEOMETRIC_SET	385
-#define	tCOMPOSITE_CURVE_SEGMENT	386
-#define	tCONTINUOUS	387
-#define	tCOMPOSITE_CURVE	388
-#define	tTOROIDAL_SURFACE	389
-#define	tPRODUCT_DEFINITION	390
-#define	tPRODUCT_DEFINITION_SHAPE	391
-#define	tSHAPE_DEFINITION_REPRESENTATION	392
-#define	tELLIPSE	393
-#define	tTrimmed	394
-#define	tSolid	395
-#define	tEndSolid	396
-#define	tVertex	397
-#define	tFacet	398
-#define	tNormal	399
-#define	tOuter	400
-#define	tLoopSTL	401
-#define	tEndLoop	402
-#define	tEndFacet	403
-#define	tAFFECTPLUS	404
-#define	tAFFECTMINUS	405
-#define	tAFFECTTIMES	406
-#define	tAFFECTDIVIDE	407
-#define	tOR	408
-#define	tAND	409
-#define	tEQUAL	410
-#define	tNOTEQUAL	411
-#define	tAPPROXEQUAL	412
-#define	tLESSOREQUAL	413
-#define	tGREATEROREQUAL	414
-#define	tCROSSPRODUCT	415
-#define	tPLUSPLUS	416
-#define	tMINUSMINUS	417
-#define	UNARYPREC	418
+#define	tDOUBLE	257
+#define	tSTRING	258
+#define	tBIGSTR	259
+#define	tEND	260
+#define	tAFFECT	261
+#define	tDOTS	262
+#define	tPi	263
+#define	tExp	264
+#define	tLog	265
+#define	tLog10	266
+#define	tSqrt	267
+#define	tSin	268
+#define	tAsin	269
+#define	tCos	270
+#define	tAcos	271
+#define	tTan	272
+#define	tRand	273
+#define	tAtan	274
+#define	tAtan2	275
+#define	tSinh	276
+#define	tCosh	277
+#define	tTanh	278
+#define	tFabs	279
+#define	tFloor	280
+#define	tCeil	281
+#define	tFmod	282
+#define	tModulo	283
+#define	tHypot	284
+#define	tPrintf	285
+#define	tSprintf	286
+#define	tDraw	287
+#define	tPoint	288
+#define	tCircle	289
+#define	tEllipsis	290
+#define	tLine	291
+#define	tSurface	292
+#define	tSpline	293
+#define	tVolume	294
+#define	tCharacteristic	295
+#define	tLength	296
+#define	tParametric	297
+#define	tElliptic	298
+#define	tPlane	299
+#define	tRuled	300
+#define	tTransfinite	301
+#define	tComplex	302
+#define	tPhysical	303
+#define	tUsing	304
+#define	tBump	305
+#define	tProgression	306
+#define	tRotate	307
+#define	tTranslate	308
+#define	tSymmetry	309
+#define	tDilate	310
+#define	tExtrude	311
+#define	tDuplicata	312
+#define	tLoop	313
+#define	tRecombine	314
+#define	tDelete	315
+#define	tCoherence	316
+#define	tIntersect	317
+#define	tView	318
+#define	tAttractor	319
+#define	tLayers	320
+#define	tScalarTetrahedron	321
+#define	tVectorTetrahedron	322
+#define	tTensorTetrahedron	323
+#define	tScalarTriangle	324
+#define	tVectorTriangle	325
+#define	tTensorTriangle	326
+#define	tScalarLine	327
+#define	tVectorLine	328
+#define	tTensorLine	329
+#define	tScalarPoint	330
+#define	tVectorPoint	331
+#define	tTensorPoint	332
+#define	tBSpline	333
+#define	tNurbs	334
+#define	tOrder	335
+#define	tWith	336
+#define	tBounds	337
+#define	tKnots	338
+#define	tColor	339
+#define	tFor	340
+#define	tIn	341
+#define	tEndFor	342
+#define	tIf	343
+#define	tEndIf	344
+#define	tExit	345
+#define	tReturn	346
+#define	tCall	347
+#define	tFunction	348
+#define	tMesh	349
+#define	tB_SPLINE_SURFACE_WITH_KNOTS	350
+#define	tB_SPLINE_CURVE_WITH_KNOTS	351
+#define	tCARTESIAN_POINT	352
+#define	tTRUE	353
+#define	tFALSE	354
+#define	tUNSPECIFIED	355
+#define	tU	356
+#define	tV	357
+#define	tEDGE_CURVE	358
+#define	tVERTEX_POINT	359
+#define	tORIENTED_EDGE	360
+#define	tPLANE	361
+#define	tFACE_OUTER_BOUND	362
+#define	tEDGE_LOOP	363
+#define	tADVANCED_FACE	364
+#define	tVECTOR	365
+#define	tDIRECTION	366
+#define	tAXIS2_PLACEMENT_3D	367
+#define	tISO	368
+#define	tENDISO	369
+#define	tENDSEC	370
+#define	tDATA	371
+#define	tHEADER	372
+#define	tFILE_DESCRIPTION	373
+#define	tFILE_SCHEMA	374
+#define	tFILE_NAME	375
+#define	tMANIFOLD_SOLID_BREP	376
+#define	tCLOSED_SHELL	377
+#define	tADVANCED_BREP_SHAPE_REPRESENTATION	378
+#define	tFACE_BOUND	379
+#define	tCYLINDRICAL_SURFACE	380
+#define	tCONICAL_SURFACE	381
+#define	tCIRCLE	382
+#define	tTRIMMED_CURVE	383
+#define	tGEOMETRIC_SET	384
+#define	tCOMPOSITE_CURVE_SEGMENT	385
+#define	tCONTINUOUS	386
+#define	tCOMPOSITE_CURVE	387
+#define	tTOROIDAL_SURFACE	388
+#define	tPRODUCT_DEFINITION	389
+#define	tPRODUCT_DEFINITION_SHAPE	390
+#define	tSHAPE_DEFINITION_REPRESENTATION	391
+#define	tELLIPSE	392
+#define	tTrimmed	393
+#define	tSolid	394
+#define	tEndSolid	395
+#define	tVertex	396
+#define	tFacet	397
+#define	tNormal	398
+#define	tOuter	399
+#define	tLoopSTL	400
+#define	tEndLoop	401
+#define	tEndFacet	402
+#define	tAFFECTPLUS	403
+#define	tAFFECTMINUS	404
+#define	tAFFECTTIMES	405
+#define	tAFFECTDIVIDE	406
+#define	tOR	407
+#define	tAND	408
+#define	tEQUAL	409
+#define	tNOTEQUAL	410
+#define	tAPPROXEQUAL	411
+#define	tLESSOREQUAL	412
+#define	tGREATEROREQUAL	413
+#define	tCROSSPRODUCT	414
+#define	tPLUSPLUS	415
+#define	tMINUSMINUS	416
+#define	UNARYPREC	417
 
 
 extern YYSTYPE yylval;
diff --git a/Parser/Gmsh.y b/Parser/Gmsh.y
index 451a9f5f44da01d7cf8ab195351bb1e9bbc740c8..6e80a9491115cb68dc373351e01acc3c9cefa774 100644
--- a/Parser/Gmsh.y
+++ b/Parser/Gmsh.y
@@ -1,4 +1,6 @@
-%{ /* $Id: Gmsh.y,v 1.50 2000-12-21 10:20:05 geuzaine Exp $ */
+%{ 
+
+// $Id: Gmsh.y,v 1.51 2001-01-08 08:05:47 geuzaine Exp $
 
 #include <stdarg.h>
 
@@ -15,9 +17,10 @@
 #include "Options.h"
 #include "Colors.h"
 #include "Parser.h"
-#include "Main.h"
+#include "OpenFile.h"
 #include "FunctionManager.h"
 #include "ColorTable.h"
+#include "Timer.h"
 
 #ifdef __DECCXX // bug in bison
 #include <alloca.h>
@@ -1656,10 +1659,9 @@ Command :
     {
       if(!strcmp($1, "Sleep")){
 
-	extern long Get_AnimTime();
-	long sleep_time = Get_AnimTime();
+	long sleep_time = GetTime();
 	while(1){
-	  if(Get_AnimTime() - sleep_time > (long)($2*1.e6)) break;
+	  if(GetTime() - sleep_time > (long)($2*1.e6)) break;
 	}
       
       }
@@ -1682,10 +1684,12 @@ Command :
 	if(Tree_Nbr(THEM->Points) != Last_NumberOfPoints){
 	  Last_NumberOfPoints = Tree_Nbr(THEM->Points);
 	  Replot();
+	  DrawUI();
 	}
 	else{
 	  Init();
 	  Draw();
+	  DrawUI();
 	}
       }
     }
@@ -2717,3 +2721,4 @@ void vyyerror(char *fmt, ...){
   yyerrorstate=1;
 }
 
+
diff --git a/Parser/Gmsh.yy.cpp b/Parser/Gmsh.yy.cpp
index e7ab8b5f3a8fd132b1a09f71a0539e3378412c5c..b3a1ff650322e690ab6f522b478c4d666b808da7 100644
--- a/Parser/Gmsh.yy.cpp
+++ b/Parser/Gmsh.yy.cpp
@@ -2,7 +2,7 @@
 /* A lexical scanner generated by flex */
 
 /* Scanner skeleton version:
- * $Header: /cvsroot/gmsh/Parser/Gmsh.yy.cpp,v 1.56 2000-12-21 10:20:05 geuzaine Exp $
+ * $Header: /cvsroot/gmsh/Parser/Gmsh.yy.cpp,v 1.57 2001-01-08 08:05:47 geuzaine Exp $
  */
 
 #define FLEX_SCANNER
@@ -977,6 +977,8 @@ char *yytext;
 #define INITIAL 0
 #line 2 "Gmsh.l"
 
+// $Id: Gmsh.yy.cpp,v 1.57 2001-01-08 08:05:47 geuzaine Exp $
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -1018,7 +1020,7 @@ void   skipline(void);
 	     && ferror( yyin ) )					\
      YY_FATAL_ERROR( "input in flex scanner failed" );
 
-#line 1022 "Gmsh.yy.cpp"
+#line 1024 "Gmsh.yy.cpp"
 
 /* Macros after this point can all be overridden by user definitions in
  * section 1.
@@ -1166,13 +1168,13 @@ YY_MALLOC_DECL
 YY_DECL
 	{
 	register yy_state_type yy_current_state;
-	register char *yy_cp, *yy_bp;
+	register char *yy_cp = NULL, *yy_bp = NULL;
 	register int yy_act;
 
-#line 61 "Gmsh.l"
+#line 63 "Gmsh.l"
 
 
-#line 1176 "Gmsh.yy.cpp"
+#line 1178 "Gmsh.yy.cpp"
 
 	if ( yy_init )
 		{
@@ -1257,896 +1259,896 @@ do_action:	/* This label is used only to access EOF actions. */
 
 case 1:
 YY_RULE_SETUP
-#line 63 "Gmsh.l"
+#line 65 "Gmsh.l"
 /* none */ ;
 	YY_BREAK
 case 2:
 YY_RULE_SETUP
-#line 64 "Gmsh.l"
+#line 66 "Gmsh.l"
 return tEND;
 	YY_BREAK
 case 3:
 YY_RULE_SETUP
-#line 65 "Gmsh.l"
+#line 67 "Gmsh.l"
 skipcomments();
 	YY_BREAK
 case 4:
 YY_RULE_SETUP
-#line 66 "Gmsh.l"
+#line 68 "Gmsh.l"
 skipline();
 	YY_BREAK
 case 5:
 YY_RULE_SETUP
-#line 67 "Gmsh.l"
+#line 69 "Gmsh.l"
 {parsestring('\"'); return tBIGSTR;}
 	YY_BREAK
 case 6:
 YY_RULE_SETUP
-#line 68 "Gmsh.l"
+#line 70 "Gmsh.l"
 {parsestring('\''); return tBIGSTR;}
 	YY_BREAK
 case 7:
 YY_RULE_SETUP
-#line 69 "Gmsh.l"
+#line 71 "Gmsh.l"
 {yylval.d = NEWREG(); return tDOUBLE;}
 	YY_BREAK
 case 8:
 YY_RULE_SETUP
-#line 70 "Gmsh.l"
+#line 72 "Gmsh.l"
 {yylval.d = NEWPOINT(); return tDOUBLE;}
 	YY_BREAK
 case 9:
 YY_RULE_SETUP
-#line 71 "Gmsh.l"
+#line 73 "Gmsh.l"
 return tAFFECT;
 	YY_BREAK
 case 10:
 YY_RULE_SETUP
-#line 72 "Gmsh.l"
+#line 74 "Gmsh.l"
 return tAFFECTPLUS ;
 	YY_BREAK
 case 11:
 YY_RULE_SETUP
-#line 73 "Gmsh.l"
+#line 75 "Gmsh.l"
 return tAFFECTMINUS ;
 	YY_BREAK
 case 12:
 YY_RULE_SETUP
-#line 74 "Gmsh.l"
+#line 76 "Gmsh.l"
 return tAFFECTTIMES ;
 	YY_BREAK
 case 13:
 YY_RULE_SETUP
-#line 75 "Gmsh.l"
+#line 77 "Gmsh.l"
 return tAFFECTDIVIDE ;
 	YY_BREAK
 case 14:
 YY_RULE_SETUP
-#line 76 "Gmsh.l"
+#line 78 "Gmsh.l"
 return tDOTS;
 	YY_BREAK
 case 15:
 YY_RULE_SETUP
-#line 77 "Gmsh.l"
+#line 79 "Gmsh.l"
 return tDOTS;
 	YY_BREAK
 case 16:
 YY_RULE_SETUP
-#line 78 "Gmsh.l"
+#line 80 "Gmsh.l"
 return tCROSSPRODUCT ;
 	YY_BREAK
 case 17:
 YY_RULE_SETUP
-#line 79 "Gmsh.l"
+#line 81 "Gmsh.l"
 return tOR ;
 	YY_BREAK
 case 18:
 YY_RULE_SETUP
-#line 80 "Gmsh.l"
+#line 82 "Gmsh.l"
 return tAND ;
 	YY_BREAK
 case 19:
 YY_RULE_SETUP
-#line 81 "Gmsh.l"
+#line 83 "Gmsh.l"
 return tPLUSPLUS ;
 	YY_BREAK
 case 20:
 YY_RULE_SETUP
-#line 82 "Gmsh.l"
+#line 84 "Gmsh.l"
 return tMINUSMINUS ;
 	YY_BREAK
 case 21:
 YY_RULE_SETUP
-#line 83 "Gmsh.l"
+#line 85 "Gmsh.l"
 return tEQUAL ;
 	YY_BREAK
 case 22:
 YY_RULE_SETUP
-#line 84 "Gmsh.l"
+#line 86 "Gmsh.l"
 return tNOTEQUAL ;
 	YY_BREAK
 case 23:
 YY_RULE_SETUP
-#line 85 "Gmsh.l"
+#line 87 "Gmsh.l"
 return tAPPROXEQUAL ;
 	YY_BREAK
 case 24:
 YY_RULE_SETUP
-#line 86 "Gmsh.l"
+#line 88 "Gmsh.l"
 return tLESSOREQUAL ;
 	YY_BREAK
 case 25:
 YY_RULE_SETUP
-#line 87 "Gmsh.l"
+#line 89 "Gmsh.l"
 return tGREATEROREQUAL ;
 	YY_BREAK
 case 26:
 YY_RULE_SETUP
-#line 89 "Gmsh.l"
+#line 91 "Gmsh.l"
 return tAcos ;
 	YY_BREAK
 case 27:
 YY_RULE_SETUP
-#line 90 "Gmsh.l"
+#line 92 "Gmsh.l"
 return tAcos ;
 	YY_BREAK
 case 28:
 YY_RULE_SETUP
-#line 91 "Gmsh.l"
+#line 93 "Gmsh.l"
 return tAsin;
 	YY_BREAK
 case 29:
 YY_RULE_SETUP
-#line 92 "Gmsh.l"
+#line 94 "Gmsh.l"
 return tAsin;
 	YY_BREAK
 case 30:
 YY_RULE_SETUP
-#line 93 "Gmsh.l"
+#line 95 "Gmsh.l"
 return tAtan ;
 	YY_BREAK
 case 31:
 YY_RULE_SETUP
-#line 94 "Gmsh.l"
+#line 96 "Gmsh.l"
 return tAtan ;
 	YY_BREAK
 case 32:
 YY_RULE_SETUP
-#line 95 "Gmsh.l"
+#line 97 "Gmsh.l"
 return tAtan2 ;
 	YY_BREAK
 case 33:
 YY_RULE_SETUP
-#line 96 "Gmsh.l"
+#line 98 "Gmsh.l"
 return tAtan2 ;
 	YY_BREAK
 case 34:
 YY_RULE_SETUP
-#line 97 "Gmsh.l"
+#line 99 "Gmsh.l"
 return tAttractor;
 	YY_BREAK
 case 35:
 YY_RULE_SETUP
-#line 99 "Gmsh.l"
+#line 101 "Gmsh.l"
 return tBump;
 	YY_BREAK
 case 36:
 YY_RULE_SETUP
-#line 100 "Gmsh.l"
+#line 102 "Gmsh.l"
 return tBSpline;
 	YY_BREAK
 case 37:
 YY_RULE_SETUP
-#line 101 "Gmsh.l"
+#line 103 "Gmsh.l"
 return tBounds;
 	YY_BREAK
 case 38:
 YY_RULE_SETUP
-#line 103 "Gmsh.l"
+#line 105 "Gmsh.l"
 return tCeil ;
 	YY_BREAK
 case 39:
 YY_RULE_SETUP
-#line 104 "Gmsh.l"
+#line 106 "Gmsh.l"
 return tCosh ;
 	YY_BREAK
 case 40:
 YY_RULE_SETUP
-#line 105 "Gmsh.l"
+#line 107 "Gmsh.l"
 return tCos ;
 	YY_BREAK
 case 41:
 YY_RULE_SETUP
-#line 106 "Gmsh.l"
+#line 108 "Gmsh.l"
 return tCharacteristic;
 	YY_BREAK
 case 42:
 YY_RULE_SETUP
-#line 107 "Gmsh.l"
+#line 109 "Gmsh.l"
 return tCircle;
 	YY_BREAK
 case 43:
 YY_RULE_SETUP
-#line 108 "Gmsh.l"
+#line 110 "Gmsh.l"
 return tCoherence;
 	YY_BREAK
 case 44:
 YY_RULE_SETUP
-#line 109 "Gmsh.l"
+#line 111 "Gmsh.l"
 return tComplex;
 	YY_BREAK
 case 45:
 YY_RULE_SETUP
-#line 110 "Gmsh.l"
+#line 112 "Gmsh.l"
 return tColor;
 	YY_BREAK
 case 46:
 YY_RULE_SETUP
-#line 111 "Gmsh.l"
+#line 113 "Gmsh.l"
 return tSpline;
 	YY_BREAK
 case 47:
 YY_RULE_SETUP
-#line 112 "Gmsh.l"
+#line 114 "Gmsh.l"
 return tCall;
 	YY_BREAK
 case 48:
 YY_RULE_SETUP
-#line 114 "Gmsh.l"
+#line 116 "Gmsh.l"
 return tDelete;
 	YY_BREAK
 case 49:
 YY_RULE_SETUP
-#line 115 "Gmsh.l"
+#line 117 "Gmsh.l"
 return tDilate;
 	YY_BREAK
 case 50:
 YY_RULE_SETUP
-#line 116 "Gmsh.l"
+#line 118 "Gmsh.l"
 return tDuplicata;
 	YY_BREAK
 case 51:
 YY_RULE_SETUP
-#line 117 "Gmsh.l"
+#line 119 "Gmsh.l"
 return tDraw;
 	YY_BREAK
 case 52:
 YY_RULE_SETUP
-#line 119 "Gmsh.l"
+#line 121 "Gmsh.l"
 return tExp ;
 	YY_BREAK
 case 53:
 YY_RULE_SETUP
-#line 120 "Gmsh.l"
+#line 122 "Gmsh.l"
 return tEllipsis;
 	YY_BREAK
 case 54:
 YY_RULE_SETUP
-#line 121 "Gmsh.l"
+#line 123 "Gmsh.l"
 return tExtrude;
 	YY_BREAK
 case 55:
 YY_RULE_SETUP
-#line 122 "Gmsh.l"
+#line 124 "Gmsh.l"
 return tElliptic;
 	YY_BREAK
 case 56:
 YY_RULE_SETUP
-#line 123 "Gmsh.l"
+#line 125 "Gmsh.l"
 return tELLIPSE;
 	YY_BREAK
 case 57:
 YY_RULE_SETUP
-#line 124 "Gmsh.l"
+#line 126 "Gmsh.l"
 return tEndFor;
 	YY_BREAK
 case 58:
 YY_RULE_SETUP
-#line 125 "Gmsh.l"
+#line 127 "Gmsh.l"
 return tEndIf;
 	YY_BREAK
 case 59:
 YY_RULE_SETUP
-#line 126 "Gmsh.l"
+#line 128 "Gmsh.l"
 return tExit;
 	YY_BREAK
 case 60:
 YY_RULE_SETUP
-#line 128 "Gmsh.l"
+#line 130 "Gmsh.l"
 return tFabs ;
 	YY_BREAK
 case 61:
 YY_RULE_SETUP
-#line 129 "Gmsh.l"
+#line 131 "Gmsh.l"
 return tFloor ;
 	YY_BREAK
 case 62:
 YY_RULE_SETUP
-#line 130 "Gmsh.l"
+#line 132 "Gmsh.l"
 return tFmod ;
 	YY_BREAK
 case 63:
 YY_RULE_SETUP
-#line 131 "Gmsh.l"
+#line 133 "Gmsh.l"
 return tFor;
 	YY_BREAK
 case 64:
 YY_RULE_SETUP
-#line 132 "Gmsh.l"
+#line 134 "Gmsh.l"
 return tFunction;
 	YY_BREAK
 case 65:
 YY_RULE_SETUP
-#line 134 "Gmsh.l"
+#line 136 "Gmsh.l"
 return tHypot ;
 	YY_BREAK
 case 66:
 YY_RULE_SETUP
-#line 136 "Gmsh.l"
+#line 138 "Gmsh.l"
 return tIn;
 	YY_BREAK
 case 67:
 YY_RULE_SETUP
-#line 137 "Gmsh.l"
+#line 139 "Gmsh.l"
 return tIf;
 	YY_BREAK
 case 68:
 YY_RULE_SETUP
-#line 138 "Gmsh.l"
+#line 140 "Gmsh.l"
 return tIntersect;
 	YY_BREAK
 case 69:
 YY_RULE_SETUP
-#line 140 "Gmsh.l"
+#line 142 "Gmsh.l"
 return tKnots;
 	YY_BREAK
 case 70:
 YY_RULE_SETUP
-#line 142 "Gmsh.l"
+#line 144 "Gmsh.l"
 return tLength;
 	YY_BREAK
 case 71:
 YY_RULE_SETUP
-#line 143 "Gmsh.l"
+#line 145 "Gmsh.l"
 return tLine;
 	YY_BREAK
 case 72:
 YY_RULE_SETUP
-#line 144 "Gmsh.l"
+#line 146 "Gmsh.l"
 return tLoop;
 	YY_BREAK
 case 73:
 YY_RULE_SETUP
-#line 145 "Gmsh.l"
+#line 147 "Gmsh.l"
 return tLog ;
 	YY_BREAK
 case 74:
 YY_RULE_SETUP
-#line 146 "Gmsh.l"
+#line 148 "Gmsh.l"
 return tLog10 ;
 	YY_BREAK
 case 75:
 YY_RULE_SETUP
-#line 147 "Gmsh.l"
+#line 149 "Gmsh.l"
 return tLayers;
 	YY_BREAK
 case 76:
 YY_RULE_SETUP
-#line 149 "Gmsh.l"
+#line 151 "Gmsh.l"
 return tModulo ;
 	YY_BREAK
 case 77:
 YY_RULE_SETUP
-#line 150 "Gmsh.l"
+#line 152 "Gmsh.l"
 return tMesh;
 	YY_BREAK
 case 78:
 YY_RULE_SETUP
-#line 152 "Gmsh.l"
+#line 154 "Gmsh.l"
 return tNurbs;
 	YY_BREAK
 case 79:
 YY_RULE_SETUP
-#line 154 "Gmsh.l"
+#line 156 "Gmsh.l"
 return tOrder;
 	YY_BREAK
 case 80:
 YY_RULE_SETUP
-#line 156 "Gmsh.l"
+#line 158 "Gmsh.l"
 return tPhysical;
 	YY_BREAK
 case 81:
 YY_RULE_SETUP
-#line 157 "Gmsh.l"
+#line 159 "Gmsh.l"
 return tPi;
 	YY_BREAK
 case 82:
 YY_RULE_SETUP
-#line 158 "Gmsh.l"
+#line 160 "Gmsh.l"
 return tPlane;
 	YY_BREAK
 case 83:
 YY_RULE_SETUP
-#line 159 "Gmsh.l"
+#line 161 "Gmsh.l"
 return tPoint;
 	YY_BREAK
 case 84:
 YY_RULE_SETUP
-#line 160 "Gmsh.l"
+#line 162 "Gmsh.l"
 return tProgression;
 	YY_BREAK
 case 85:
 YY_RULE_SETUP
-#line 161 "Gmsh.l"
+#line 163 "Gmsh.l"
 return tProgression;
 	YY_BREAK
 case 86:
 YY_RULE_SETUP
-#line 162 "Gmsh.l"
+#line 164 "Gmsh.l"
 return tParametric;
 	YY_BREAK
 case 87:
 YY_RULE_SETUP
-#line 163 "Gmsh.l"
+#line 165 "Gmsh.l"
 return tPrintf ;
 	YY_BREAK
 case 88:
 YY_RULE_SETUP
-#line 165 "Gmsh.l"
+#line 167 "Gmsh.l"
 return tRecombine;
 	YY_BREAK
 case 89:
 YY_RULE_SETUP
-#line 166 "Gmsh.l"
+#line 168 "Gmsh.l"
 return tRotate;
 	YY_BREAK
 case 90:
 YY_RULE_SETUP
-#line 167 "Gmsh.l"
+#line 169 "Gmsh.l"
 return tRuled;
 	YY_BREAK
 case 91:
 YY_RULE_SETUP
-#line 168 "Gmsh.l"
+#line 170 "Gmsh.l"
 return tRand;
 	YY_BREAK
 case 92:
 YY_RULE_SETUP
-#line 169 "Gmsh.l"
+#line 171 "Gmsh.l"
 return tReturn;
 	YY_BREAK
 case 93:
 YY_RULE_SETUP
-#line 171 "Gmsh.l"
+#line 173 "Gmsh.l"
 return tSqrt ;
 	YY_BREAK
 case 94:
 YY_RULE_SETUP
-#line 172 "Gmsh.l"
+#line 174 "Gmsh.l"
 return tSin ;
 	YY_BREAK
 case 95:
 YY_RULE_SETUP
-#line 173 "Gmsh.l"
+#line 175 "Gmsh.l"
 return tSinh ;
 	YY_BREAK
 case 96:
 YY_RULE_SETUP
-#line 174 "Gmsh.l"
+#line 176 "Gmsh.l"
 return tSpline;
 	YY_BREAK
 case 97:
 YY_RULE_SETUP
-#line 175 "Gmsh.l"
+#line 177 "Gmsh.l"
 return tSurface;
 	YY_BREAK
 case 98:
 YY_RULE_SETUP
-#line 176 "Gmsh.l"
+#line 178 "Gmsh.l"
 return tSymmetry;
 	YY_BREAK
 case 99:
 YY_RULE_SETUP
-#line 177 "Gmsh.l"
+#line 179 "Gmsh.l"
 return tSprintf ;
 	YY_BREAK
 case 100:
 YY_RULE_SETUP
-#line 179 "Gmsh.l"
+#line 181 "Gmsh.l"
 return tTransfinite;
 	YY_BREAK
 case 101:
 YY_RULE_SETUP
-#line 180 "Gmsh.l"
+#line 182 "Gmsh.l"
 return tTranslate;
 	YY_BREAK
 case 102:
 YY_RULE_SETUP
-#line 181 "Gmsh.l"
+#line 183 "Gmsh.l"
 return tTanh ;
 	YY_BREAK
 case 103:
 YY_RULE_SETUP
-#line 182 "Gmsh.l"
+#line 184 "Gmsh.l"
 return tTan;
 	YY_BREAK
 case 104:
 YY_RULE_SETUP
-#line 183 "Gmsh.l"
+#line 185 "Gmsh.l"
 return tTrimmed;
 	YY_BREAK
 case 105:
 YY_RULE_SETUP
-#line 185 "Gmsh.l"
+#line 187 "Gmsh.l"
 return tUsing;
 	YY_BREAK
 case 106:
 YY_RULE_SETUP
-#line 187 "Gmsh.l"
+#line 189 "Gmsh.l"
 return tView;
 	YY_BREAK
 case 107:
 YY_RULE_SETUP
-#line 188 "Gmsh.l"
+#line 190 "Gmsh.l"
 return tVolume;
 	YY_BREAK
 case 108:
 YY_RULE_SETUP
-#line 190 "Gmsh.l"
+#line 192 "Gmsh.l"
 return tWith;
 	YY_BREAK
 case 109:
 YY_RULE_SETUP
-#line 192 "Gmsh.l"
+#line 194 "Gmsh.l"
 return tScalarTetrahedron;
 	YY_BREAK
 case 110:
 YY_RULE_SETUP
-#line 193 "Gmsh.l"
+#line 195 "Gmsh.l"
 return tVectorTetrahedron;
 	YY_BREAK
 case 111:
 YY_RULE_SETUP
-#line 194 "Gmsh.l"
+#line 196 "Gmsh.l"
 return tTensorTetrahedron;
 	YY_BREAK
 case 112:
 YY_RULE_SETUP
-#line 195 "Gmsh.l"
+#line 197 "Gmsh.l"
 return tScalarTriangle;
 	YY_BREAK
 case 113:
 YY_RULE_SETUP
-#line 196 "Gmsh.l"
+#line 198 "Gmsh.l"
 return tVectorTriangle;
 	YY_BREAK
 case 114:
 YY_RULE_SETUP
-#line 197 "Gmsh.l"
+#line 199 "Gmsh.l"
 return tTensorTriangle;
 	YY_BREAK
 case 115:
 YY_RULE_SETUP
-#line 198 "Gmsh.l"
+#line 200 "Gmsh.l"
 return tScalarLine;
 	YY_BREAK
 case 116:
 YY_RULE_SETUP
-#line 199 "Gmsh.l"
+#line 201 "Gmsh.l"
 return tVectorLine;
 	YY_BREAK
 case 117:
 YY_RULE_SETUP
-#line 200 "Gmsh.l"
+#line 202 "Gmsh.l"
 return tTensorLine;
 	YY_BREAK
 case 118:
 YY_RULE_SETUP
-#line 201 "Gmsh.l"
+#line 203 "Gmsh.l"
 return tScalarPoint;
 	YY_BREAK
 case 119:
 YY_RULE_SETUP
-#line 202 "Gmsh.l"
+#line 204 "Gmsh.l"
 return tVectorPoint;
 	YY_BREAK
 case 120:
 YY_RULE_SETUP
-#line 203 "Gmsh.l"
+#line 205 "Gmsh.l"
 return tTensorPoint;
 	YY_BREAK
 case 121:
 YY_RULE_SETUP
-#line 206 "Gmsh.l"
+#line 208 "Gmsh.l"
 return tCARTESIAN_POINT;
 	YY_BREAK
 case 122:
 YY_RULE_SETUP
-#line 207 "Gmsh.l"
+#line 209 "Gmsh.l"
 return tB_SPLINE_SURFACE_WITH_KNOTS;
 	YY_BREAK
 case 123:
 YY_RULE_SETUP
-#line 208 "Gmsh.l"
+#line 210 "Gmsh.l"
 return tB_SPLINE_CURVE_WITH_KNOTS;
 	YY_BREAK
 case 124:
 YY_RULE_SETUP
-#line 209 "Gmsh.l"
+#line 211 "Gmsh.l"
 return tUNSPECIFIED;
 	YY_BREAK
 case 125:
 YY_RULE_SETUP
-#line 210 "Gmsh.l"
+#line 212 "Gmsh.l"
 return tCONTINUOUS;
 	YY_BREAK
 case 126:
 YY_RULE_SETUP
-#line 211 "Gmsh.l"
+#line 213 "Gmsh.l"
 return tFALSE;
 	YY_BREAK
 case 127:
 YY_RULE_SETUP
-#line 212 "Gmsh.l"
+#line 214 "Gmsh.l"
 return tTRUE;
 	YY_BREAK
 case 128:
 YY_RULE_SETUP
-#line 213 "Gmsh.l"
+#line 215 "Gmsh.l"
 return tU;
 	YY_BREAK
 case 129:
 YY_RULE_SETUP
-#line 214 "Gmsh.l"
+#line 216 "Gmsh.l"
 return tV;
 	YY_BREAK
 case 130:
 YY_RULE_SETUP
-#line 215 "Gmsh.l"
+#line 217 "Gmsh.l"
 return tORIENTED_EDGE;
 	YY_BREAK
 case 131:
 YY_RULE_SETUP
-#line 216 "Gmsh.l"
+#line 218 "Gmsh.l"
 return tEDGE_CURVE;
 	YY_BREAK
 case 132:
 YY_RULE_SETUP
-#line 217 "Gmsh.l"
+#line 219 "Gmsh.l"
 return tEDGE_LOOP;
 	YY_BREAK
 case 133:
 YY_RULE_SETUP
-#line 218 "Gmsh.l"
+#line 220 "Gmsh.l"
 return tVERTEX_POINT;
 	YY_BREAK
 case 134:
 YY_RULE_SETUP
-#line 219 "Gmsh.l"
+#line 221 "Gmsh.l"
 return tFACE_OUTER_BOUND;
 	YY_BREAK
 case 135:
 YY_RULE_SETUP
-#line 220 "Gmsh.l"
+#line 222 "Gmsh.l"
 return tFACE_BOUND;
 	YY_BREAK
 case 136:
 YY_RULE_SETUP
-#line 221 "Gmsh.l"
+#line 223 "Gmsh.l"
 return tADVANCED_FACE;
 	YY_BREAK
 case 137:
 YY_RULE_SETUP
-#line 222 "Gmsh.l"
+#line 224 "Gmsh.l"
 return tLine;
 	YY_BREAK
 case 138:
 YY_RULE_SETUP
-#line 223 "Gmsh.l"
+#line 225 "Gmsh.l"
 return tVECTOR;
 	YY_BREAK
 case 139:
 YY_RULE_SETUP
-#line 224 "Gmsh.l"
+#line 226 "Gmsh.l"
 return tDIRECTION;
 	YY_BREAK
 case 140:
 YY_RULE_SETUP
-#line 225 "Gmsh.l"
+#line 227 "Gmsh.l"
 return tAXIS2_PLACEMENT_3D;
 	YY_BREAK
 case 141:
 YY_RULE_SETUP
-#line 226 "Gmsh.l"
+#line 228 "Gmsh.l"
 return tPLANE;
 	YY_BREAK
 case 142:
 YY_RULE_SETUP
-#line 227 "Gmsh.l"
+#line 229 "Gmsh.l"
 return tHEADER;
 	YY_BREAK
 case 143:
 YY_RULE_SETUP
-#line 228 "Gmsh.l"
+#line 230 "Gmsh.l"
 return tDATA;
 	YY_BREAK
 case 144:
 YY_RULE_SETUP
-#line 229 "Gmsh.l"
+#line 231 "Gmsh.l"
 return tFILE_SCHEMA;
 	YY_BREAK
 case 145:
 YY_RULE_SETUP
-#line 230 "Gmsh.l"
+#line 232 "Gmsh.l"
 return tFILE_NAME;
 	YY_BREAK
 case 146:
 YY_RULE_SETUP
-#line 231 "Gmsh.l"
+#line 233 "Gmsh.l"
 return tFILE_DESCRIPTION;
 	YY_BREAK
 case 147:
 YY_RULE_SETUP
-#line 232 "Gmsh.l"
+#line 234 "Gmsh.l"
 return tISO;
 	YY_BREAK
 case 148:
 YY_RULE_SETUP
-#line 233 "Gmsh.l"
+#line 235 "Gmsh.l"
 return tENDISO;
 	YY_BREAK
 case 149:
 YY_RULE_SETUP
-#line 234 "Gmsh.l"
+#line 236 "Gmsh.l"
 return tENDSEC;
 	YY_BREAK
 case 150:
 YY_RULE_SETUP
-#line 235 "Gmsh.l"
+#line 237 "Gmsh.l"
 return tCLOSED_SHELL;
 	YY_BREAK
 case 151:
 YY_RULE_SETUP
-#line 236 "Gmsh.l"
+#line 238 "Gmsh.l"
 return  tADVANCED_BREP_SHAPE_REPRESENTATION;
 	YY_BREAK
 case 152:
 YY_RULE_SETUP
-#line 237 "Gmsh.l"
+#line 239 "Gmsh.l"
 return tMANIFOLD_SOLID_BREP;
 	YY_BREAK
 case 153:
 YY_RULE_SETUP
-#line 238 "Gmsh.l"
+#line 240 "Gmsh.l"
 return tCYLINDRICAL_SURFACE;
 	YY_BREAK
 case 154:
 YY_RULE_SETUP
-#line 239 "Gmsh.l"
+#line 241 "Gmsh.l"
 return tCONICAL_SURFACE;
 	YY_BREAK
 case 155:
 YY_RULE_SETUP
-#line 240 "Gmsh.l"
+#line 242 "Gmsh.l"
 return tTOROIDAL_SURFACE;
 	YY_BREAK
 case 156:
 YY_RULE_SETUP
-#line 241 "Gmsh.l"
+#line 243 "Gmsh.l"
 return tCIRCLE;
 	YY_BREAK
 case 157:
 YY_RULE_SETUP
-#line 242 "Gmsh.l"
+#line 244 "Gmsh.l"
 return tTRIMMED_CURVE;
 	YY_BREAK
 case 158:
 YY_RULE_SETUP
-#line 243 "Gmsh.l"
+#line 245 "Gmsh.l"
 return tGEOMETRIC_SET;
 	YY_BREAK
 case 159:
 YY_RULE_SETUP
-#line 244 "Gmsh.l"
+#line 246 "Gmsh.l"
 return tCOMPOSITE_CURVE_SEGMENT;
 	YY_BREAK
 case 160:
 YY_RULE_SETUP
-#line 245 "Gmsh.l"
+#line 247 "Gmsh.l"
 return tCOMPOSITE_CURVE;
 	YY_BREAK
 case 161:
 YY_RULE_SETUP
-#line 246 "Gmsh.l"
+#line 248 "Gmsh.l"
 return tPRODUCT_DEFINITION;
 	YY_BREAK
 case 162:
 YY_RULE_SETUP
-#line 247 "Gmsh.l"
+#line 249 "Gmsh.l"
 return tPRODUCT_DEFINITION_SHAPE;
 	YY_BREAK
 case 163:
 YY_RULE_SETUP
-#line 248 "Gmsh.l"
+#line 250 "Gmsh.l"
 return tSHAPE_DEFINITION_REPRESENTATION;
 	YY_BREAK
 case 164:
 YY_RULE_SETUP
-#line 250 "Gmsh.l"
+#line 252 "Gmsh.l"
 return tVertex;
 	YY_BREAK
 case 165:
 YY_RULE_SETUP
-#line 251 "Gmsh.l"
+#line 253 "Gmsh.l"
 return tFacet;
 	YY_BREAK
 case 166:
 YY_RULE_SETUP
-#line 252 "Gmsh.l"
+#line 254 "Gmsh.l"
 return tNormal;
 	YY_BREAK
 case 167:
 YY_RULE_SETUP
-#line 253 "Gmsh.l"
+#line 255 "Gmsh.l"
 return tOuter;
 	YY_BREAK
 case 168:
 YY_RULE_SETUP
-#line 254 "Gmsh.l"
+#line 256 "Gmsh.l"
 return tLoopSTL;
 	YY_BREAK
 case 169:
 YY_RULE_SETUP
-#line 255 "Gmsh.l"
+#line 257 "Gmsh.l"
 return tEndLoop;
 	YY_BREAK
 case 170:
 YY_RULE_SETUP
-#line 256 "Gmsh.l"
+#line 258 "Gmsh.l"
 return tEndFacet;
 	YY_BREAK
 case 171:
 YY_RULE_SETUP
-#line 257 "Gmsh.l"
+#line 259 "Gmsh.l"
 {skipline();return tEndSolid;}
 	YY_BREAK
 case 172:
 YY_RULE_SETUP
-#line 258 "Gmsh.l"
+#line 260 "Gmsh.l"
 {skipline();return tSolid;}
 	YY_BREAK
 case 173:
 YY_RULE_SETUP
-#line 260 "Gmsh.l"
+#line 262 "Gmsh.l"
 {yylval.d = (double)atoi((char*)(yytext+1)); return tDOUBLE;}
 	YY_BREAK
 case 174:
-#line 263 "Gmsh.l"
+#line 265 "Gmsh.l"
 case 175:
-#line 264 "Gmsh.l"
+#line 266 "Gmsh.l"
 case 176:
-#line 265 "Gmsh.l"
+#line 267 "Gmsh.l"
 case 177:
 YY_RULE_SETUP
-#line 265 "Gmsh.l"
+#line 267 "Gmsh.l"
 {yylval.d = atof((char *)yytext); return tDOUBLE;}
 	YY_BREAK
 case 178:
 YY_RULE_SETUP
-#line 267 "Gmsh.l"
+#line 269 "Gmsh.l"
 {yylval.c = strsave((char*)yytext); return tSTRING;}
 	YY_BREAK
 case 179:
 YY_RULE_SETUP
-#line 269 "Gmsh.l"
+#line 271 "Gmsh.l"
 return yytext[0];
 	YY_BREAK
 case 180:
 YY_RULE_SETUP
-#line 271 "Gmsh.l"
+#line 273 "Gmsh.l"
 ECHO;
 	YY_BREAK
-#line 2150 "Gmsh.yy.cpp"
+#line 2152 "Gmsh.yy.cpp"
 case YY_STATE_EOF(INITIAL):
 	yyterminate();
 
@@ -3032,7 +3034,7 @@ int main()
 	return 0;
 	}
 #endif
-#line 271 "Gmsh.l"
+#line 273 "Gmsh.l"
 
 
 #undef yywrap
diff --git a/Parser/Makefile b/Parser/Makefile
index 4aac5c6048340c9699a62f1a31cbeba655acdba8..f27e2e73495f2ee080f76f15c1c58f3d6850a447 100644
--- a/Parser/Makefile
+++ b/Parser/Makefile
@@ -1,30 +1,36 @@
-# $Id: Makefile,v 1.10 2000-12-29 10:27:00 geuzaine Exp $
+# $Id: Makefile,v 1.11 2001-01-08 08:05:47 geuzaine Exp $
 #
 # Makefile for "libParser.a"
 #
 
 .IGNORE:
 
-CC        = c++
-C_FLAGS   = -g -Wall
-
-OS_FLAGS  = -D_XMOTIF
-
+CC       = c++
 AR       = ar ruvs
 RANLIB   = ranlib
 RM       = rm
-RMFLAGS  = -f
 YACC     = bison
 LEX      = flex
 
 LIB      = ../lib/libParser.a
 INCLUDE  = -I../includes -I../Common -I../DataStr -I../Geo -I../Graphics\
-           -I../Mesh -I../Unix
+           -I../Mesh -I../Motif -I../Fltk
 
-CFLAGS = $(C_FLAGS) $(OS_FLAGS) $(INCLUDE) 
+C_FLAGS       = -g -Wall
+OS_FLAGS      = -D_LITTLE_ENDIAN
+VERSION_FLAGS = -D_XMOTIF
+
+GL_INCLUDE    = -I$(HOME)/SOURCES/Mesa-3.1/include\
+                -I$(HOME)/SOURCES/Mesa-3.1/include/GL
+GUI_INCLUDE   = -I/usr/X11R6/LessTif/Motif1.2/include
+
+RMFLAGS  = -f
+CFLAGS   = $(C_FLAGS) $(OS_FLAGS) $(VERSION_FLAGS) $(INCLUDE)\
+           $(GL_INCLUDE) $(GUI_INCLUDE)
 
 SRC =  	Gmsh.yy.cpp \
 	Gmsh.tab.cpp\
+        OpenFile.cpp\
 	FunctionManager.cpp
 
 OBJ = $(SRC:.cpp=.o)
@@ -70,5 +76,14 @@ Gmsh.tab.o: Gmsh.tab.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../Geo/ExtrudeParams.h ../Mesh/Metric.h ../Geo/DataBase.h \
   ../Mesh/Create.h ../Common/Views.h ../Common/ColorTable.h \
   ../Geo/StepGeomDatabase.h ../Common/Options.h ../Graphics/Draw.h \
-  ../Common/Colors.h Parser.h ../Unix/Main.h FunctionManager.h
+  ../Common/Colors.h Parser.h OpenFile.h FunctionManager.h \
+  ../Common/Timer.h
+OpenFile.o: OpenFile.cpp ../Common/Gmsh.h ../Common/Message.h \
+  ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
+  ../DataStr/avl.h ../DataStr/Tools.h ../Common/Const.h \
+  ../Common/Context.h Parser.h OpenFile.h ../Geo/Geo.h ../Mesh/Mesh.h \
+  ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Edge.h \
+  ../Geo/ExtrudeParams.h ../Mesh/Metric.h ../Common/Views.h \
+  ../Common/ColorTable.h ../Geo/MinMax.h ../Common/GmshUI.h \
+  ../Graphics/Draw.h ../Motif/Widgets.h
 FunctionManager.o: FunctionManager.cpp FunctionManager.h
diff --git a/Parser/OpenFile.cpp b/Parser/OpenFile.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..61b7b16e77fc69f6b812a7d8063da228140c0a4b
--- /dev/null
+++ b/Parser/OpenFile.cpp
@@ -0,0 +1,128 @@
+// $Id: OpenFile.cpp,v 1.1 2001-01-08 08:08:47 geuzaine Exp $
+#include "Gmsh.h"
+#include "Const.h"
+#include "Context.h"
+#include "Parser.h"
+#include "OpenFile.h"
+#include "Geo.h"
+#include "Mesh.h"
+#include "Views.h"
+#include "MinMax.h"
+
+#ifndef _BLACKBOX
+#include "GmshUI.h"
+#include "Draw.h"
+extern int        SHOW_ALL_ENTITIES ;
+extern Tree_T    *EntitesVisibles;
+extern void RemplirEntitesVisibles (int add_rem);
+#endif
+
+#ifdef _XMOTIF
+#include "Widgets.h"
+extern Widgets_T WID;
+#endif
+
+extern Mesh      *THEM, M;
+extern Context_T  CTX;
+
+void ParseFile(char *f){
+  char String[256];
+
+  strncpy(yyname,f,NAME_STR_L);
+  yyerrorstate=0;
+  yylineno=1;
+
+  if(!(yyin = fopen(yyname,"r"))){
+    Msg(INFO, "File '%s' Does not Exist", f);
+    return;
+  }
+  
+  fpos_t position;
+  fgetpos(yyin, &position);
+  fgets(String, sizeof(String), yyin) ; 
+  fsetpos(yyin, &position);
+
+  if(!strncmp(String, "$PTS", 4) || 
+     !strncmp(String, "$NO", 3) || 
+     !strncmp(String, "$ELM", 4)){
+    if(THEM->status < 0) mai3d(THEM, 0);
+    Read_Mesh(THEM, yyin, FORMAT_MSH);
+  }
+  else if(!strncmp(String, "$PostFormat", 11) ||
+          !strncmp(String, "$View", 5)){
+    Read_View(yyin, yyname);
+  }
+  else{
+    while(!feof(yyin)) yyparse();
+  }
+  fclose(yyin);
+}
+
+void MergeProblem(char *name){
+  Msg(INFOS, "Merging '%s'",name); 
+
+  ParseFile(name);  
+  if (yyerrorstate) return;
+
+#ifndef _BLACKBOX
+  if (!EntitesVisibles) {
+    RemplirEntitesVisibles(1);
+    SHOW_ALL_ENTITIES = 1;
+  }
+#endif
+}
+
+void OpenProblem(char *name){
+  char ext[6];
+  
+  InitSymbols();
+  Init_Mesh(&M, 1);
+
+  strncpy(CTX.filename,name,NAME_STR_L);
+  strncpy(CTX.basefilename,name,NAME_STR_L);
+
+  strcpy(ext,name+(strlen(name)-4));
+  if(!strcmp(ext,".GEO") || 
+     !strcmp(ext,".geo") || 
+     !strcmp(ext,".msh") || 
+     !strcmp(ext,".pos")){
+    CTX.basefilename[strlen(name)-4] = '\0';
+  }
+  else{
+    strcat(CTX.filename,".geo");
+  }
+
+  strncpy(THEM->name, CTX.basefilename,NAME_STR_L);
+
+#ifdef _XMOTIF
+  if(!CTX.interactive){
+    XtVaSetValues(WID.G.shell,
+                  XmNtitle, CTX.filename,
+                  XmNiconName, CTX.basefilename,
+                  NULL);
+  }
+#endif
+
+  Msg(INFOS, "Opening '%s'", CTX.filename); 
+
+  ParseFile(CTX.filename);  
+
+  ApplyLcFactor(THEM);
+  mai3d(THEM,0);  
+  Maillage_Dimension_0(&M);
+
+#ifndef _BLACKBOX
+  ZeroHighlight(&M); 
+#endif
+
+  CalculateMinMax(THEM->Points);  
+
+#ifndef _BLACKBOX
+  if (!EntitesVisibles) {
+    RemplirEntitesVisibles(1);
+    SHOW_ALL_ENTITIES = 1;
+  }
+#endif
+
+}
+
diff --git a/Parser/OpenFile.h b/Parser/OpenFile.h
new file mode 100644
index 0000000000000000000000000000000000000000..b8e084b3408a96ccad9a166102ac51d6dfbe403c
--- /dev/null
+++ b/Parser/OpenFile.h
@@ -0,0 +1,9 @@
+#ifndef _OPENFILE_H_
+#define _OPENFILE_H_
+
+#include "Const.h"
+
+void OpenProblem(char *name);
+void MergeProblem(char *name);
+
+#endif
diff --git a/Parser/Parser.h b/Parser/Parser.h
index 46cd44a339f9efc820c5a2016ce99ec4dffcf3b9..f6b9878808f06c3fbde01b7bfcfa4712495b77fb 100644
--- a/Parser/Parser.h
+++ b/Parser/Parser.h
@@ -1,4 +1,3 @@
-/* $Id: Parser.h,v 1.4 2000-12-11 16:23:15 geuzaine Exp $ */
 #ifndef _PARSER_H_
 #define _PARSER_H_
 
diff --git a/Unix/Bitmaps.h b/Unix/Bitmaps.h
index d4b1c446c62670365bf86ce91c3c178440b98e9c..a088563c1882bec639d6a656dab02076eaffa434 100644
--- a/Unix/Bitmaps.h
+++ b/Unix/Bitmaps.h
@@ -1,4 +1,3 @@
-/* $Id: Bitmaps.h,v 1.2 2000-11-23 14:11:40 geuzaine Exp $ */
 #ifndef _BITMAPS_H_
 #define _BITMAPS_H_
 
diff --git a/Unix/CbColorbar.cpp b/Unix/CbColorbar.cpp
index 6a4296b037d5eee59d9bd82bff4a21406915356f..295f28ddba0c5af27b234be4d381831dc6194966 100644
--- a/Unix/CbColorbar.cpp
+++ b/Unix/CbColorbar.cpp
@@ -1,4 +1,4 @@
-/* $Id: CbColorbar.cpp,v 1.4 2000-12-08 10:56:51 geuzaine Exp $ */
+// $Id: CbColorbar.cpp,v 1.5 2001-01-08 08:03:39 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "GmshUI.h"
diff --git a/Unix/CbColorbar.h b/Unix/CbColorbar.h
index 91c439e508ca1e1ae9d99e56f11c0e381e23a1b6..ac94bf00fdb96718842a322af206489e0ab99cfa 100644
--- a/Unix/CbColorbar.h
+++ b/Unix/CbColorbar.h
@@ -1,6 +1,5 @@
-/* $Id: CbColorbar.h,v 1.3 2000-11-26 15:43:47 geuzaine Exp $ */
-#ifndef _COLORBAR_H
-#define _COLORBAR_H
+#ifndef _CB_COLORBAR_H
+#define _CB_COLORBAR_H
 
 typedef struct _colorbar {
   Window window;
diff --git a/Unix/CbContext.cpp b/Unix/CbContext.cpp
index fa99ffd5bc2ddfb9e9437d0ee99b6fe63065b272..6282a17f0232069c8abe87ccd6dd44f9a01117f9 100644
--- a/Unix/CbContext.cpp
+++ b/Unix/CbContext.cpp
@@ -1,4 +1,4 @@
-/* $Id: CbContext.cpp,v 1.9 2000-12-21 10:41:03 geuzaine Exp $ */
+// $Id: CbContext.cpp,v 1.10 2001-01-08 08:03:39 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "GmshUI.h"
diff --git a/Unix/CbContext.h b/Unix/CbContext.h
index b1887b4b35ff1953e5f26d87cabcd9130f4139f6..7a888f7c709ed32d4082324b784b74268dfa3f57 100644
--- a/Unix/CbContext.h
+++ b/Unix/CbContext.h
@@ -1,4 +1,3 @@
-/* $Id: CbContext.h,v 1.3 2000-11-23 23:20:35 geuzaine Exp $ */
 #ifndef _CB_CONTEXT_H_
 #define _CB_CONTEXT_H_
 
diff --git a/Unix/CbFile.cpp b/Unix/CbFile.cpp
index f73429948730ca3c73b03e12cb9a8222341e1783..af63c3a614f268f500ee14075b505d2f50551a66 100644
--- a/Unix/CbFile.cpp
+++ b/Unix/CbFile.cpp
@@ -1,8 +1,8 @@
-/* $Id: CbFile.cpp,v 1.20 2000-12-29 10:27:00 geuzaine Exp $ */
+// $Id: CbFile.cpp,v 1.21 2001-01-08 08:03:40 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "GmshUI.h"
-#include "Main.h"
+#include "OpenFile.h"
 #include "Mesh.h"
 #include "Draw.h"
 #include "Widgets.h"
diff --git a/Unix/CbFile.h b/Unix/CbFile.h
index ad634dbaa9d685bef32635a9d39cb209cb5bec14..d2405785e718148ea8b066339e487d0968f9972b 100644
--- a/Unix/CbFile.h
+++ b/Unix/CbFile.h
@@ -1,4 +1,3 @@
-/* $Id: CbFile.h,v 1.7 2000-12-21 14:53:10 geuzaine Exp $ */
 #ifndef _CB_FILE_H_
 #define _CB_FILE_H_
 
diff --git a/Unix/CbGeneral.cpp b/Unix/CbGeneral.cpp
index 43beda97d01d71423c6117fdac57dac3d7ded99a..94b3ea785a742f18a754b535c0b37c94bffed9cd 100644
--- a/Unix/CbGeneral.cpp
+++ b/Unix/CbGeneral.cpp
@@ -1,4 +1,4 @@
-/* $Id: CbGeneral.cpp,v 1.6 2000-12-10 00:06:50 geuzaine Exp $ */
+// $Id: CbGeneral.cpp,v 1.7 2001-01-08 08:03:40 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "GmshUI.h"
diff --git a/Unix/CbGeneral.h b/Unix/CbGeneral.h
index 320048bc6cbd9ec987701388996f45c4dcf797ba..d9854cb8778c0403ccc2a36b88849f260360f503 100644
--- a/Unix/CbGeneral.h
+++ b/Unix/CbGeneral.h
@@ -1,4 +1,3 @@
-/* $Id: CbGeneral.h,v 1.2 2000-11-23 14:11:40 geuzaine Exp $ */
 #ifndef _CB_GENERAL_H_
 #define _CB_GENERAL_H_
 
diff --git a/Unix/CbGeom.cpp b/Unix/CbGeom.cpp
index 35eed44663e40e6139ff7a82368657c7ea6b60cd..98332e2bb0d187dbf40f2229a96f1161b0be1890 100644
--- a/Unix/CbGeom.cpp
+++ b/Unix/CbGeom.cpp
@@ -1,4 +1,4 @@
-/* $Id: CbGeom.cpp,v 1.10 2000-12-13 14:08:12 geuzaine Exp $ */
+// $Id: CbGeom.cpp,v 1.11 2001-01-08 08:03:40 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -8,7 +8,7 @@
 #include "Widgets.h"
 #include "Context.h"
 #include "Verif.h"
-#include "Main.h"
+#include "OpenFile.h"
 
 #include "CbGeom.h"
 
@@ -16,7 +16,6 @@ extern Context_T  CTX;
 extern Widgets_T  WID;
 
 extern Mesh  M;
-extern char  TheFileName[256];
 
 extern char  x_text[100], y_text[100], z_text[100], l_text[100];
 extern char  tx_text[100], ty_text[100], tz_text[100];
@@ -81,13 +80,13 @@ void geom_event_handler (int event) {
   switch (event) {
 
   case GEOM_PARSE :
-    OpenProblem(TheFileName);
+    OpenProblem(CTX.filename);
     Init();
     Draw();
     break;
 
   case GEOM_ELEM_ADD_NEW_POINT :
-    add_point(TheFileName);
+    add_point(CTX.filename);
     ZeroHighlight(&M);
     Replot();
     break;
@@ -106,10 +105,10 @@ void geom_event_handler (int event) {
       if (ib == -1){ /* 'e' */
         if(n >= 2) {
           switch(event){
-          case GEOM_ELEM_ADD_NEW_LINE   : add_multline(n,p,TheFileName); break;
-          case GEOM_ELEM_ADD_NEW_SPLINE : add_spline  (n,p,TheFileName); break;
-          case GEOM_ELEM_ADD_NEW_BEZIER : add_bezier  (n,p,TheFileName); break;
-          case GEOM_ELEM_ADD_NEW_BSPLINE: add_bspline (n,p,TheFileName); break;
+          case GEOM_ELEM_ADD_NEW_LINE   : add_multline(n,p,CTX.filename); break;
+          case GEOM_ELEM_ADD_NEW_SPLINE : add_spline  (n,p,CTX.filename); break;
+          case GEOM_ELEM_ADD_NEW_BEZIER : add_bezier  (n,p,CTX.filename); break;
+          case GEOM_ELEM_ADD_NEW_BSPLINE: add_bspline (n,p,CTX.filename); break;
           }
         }
         n=0;
@@ -142,7 +141,7 @@ void geom_event_handler (int event) {
         break;
       }
       if(n == 3){
-        add_circ(p[1],p[0],p[2],TheFileName); /* begin, center, end */
+        add_circ(p[1],p[0],p[2],CTX.filename); /* begin, center, end */
         ZeroHighlight(&M);
         Replot();
         n=0;
@@ -168,7 +167,7 @@ void geom_event_handler (int event) {
         break;
       }
       if(n == 4){
-        add_ell(p[3],p[2],p[0],p[1],TheFileName);
+        add_ell(p[3],p[2],p[0],p[1],CTX.filename);
         ZeroHighlight(&M);
         Replot();
         n=0;
@@ -201,9 +200,9 @@ void geom_event_handler (int event) {
         }       
         if(SelectContour (type, (type==ENT_LINE)?c->Num:s->Num, Liste1)){
           if(type==ENT_LINE) 
-            add_loop(Liste1,TheFileName,&zone);
+            add_loop(Liste1,CTX.filename,&zone);
           else
-            add_vol(Liste1,TheFileName,&zone);
+            add_vol(Liste1,CTX.filename,&zone);
           List_Reset(Liste1);
           List_Add(Liste2,&zone);
           while(1){
@@ -216,18 +215,18 @@ void geom_event_handler (int event) {
             }
             if(SelectContour (type, (type==ENT_LINE)?c->Num:s->Num, Liste1)){
               if(type==ENT_LINE) 
-                add_loop(Liste1,TheFileName,&zone);
+                add_loop(Liste1,CTX.filename,&zone);
               else
-                add_vol(Liste1,TheFileName,&zone);
+                add_vol(Liste1,CTX.filename,&zone);
               List_Reset(Liste1);
               List_Add(Liste2,&zone);
             }
           }
           if(List_Nbr(Liste2)){
             switch(event){
-            case GEOM_ELEM_ADD_NEW_RULED_SURF : add_surf(Liste2,TheFileName,0,1); break;
-            case GEOM_ELEM_ADD_NEW_PLANE_SURF : add_surf(Liste2,TheFileName,0,2); break;
-            case GEOM_ELEM_ADD_NEW_VOLUME :  add_multvol(Liste2,TheFileName); break;
+            case GEOM_ELEM_ADD_NEW_RULED_SURF : add_surf(Liste2,CTX.filename,0,1); break;
+            case GEOM_ELEM_ADD_NEW_PLANE_SURF : add_surf(Liste2,CTX.filename,0,2); break;
+            case GEOM_ELEM_ADD_NEW_VOLUME :  add_multvol(Liste2,CTX.filename); break;
             }
             ZeroHighlight(&M);
             Replot();
@@ -251,7 +250,7 @@ void geom_event_handler (int event) {
         Replot();
         break;
       }
-      translate_pt(event==GEOM_ELEM_ADD_TRANSLATE_POINT?1:0,v->Num,TheFileName);
+      translate_pt(event==GEOM_ELEM_ADD_TRANSLATE_POINT?1:0,v->Num,CTX.filename);
       ZeroHighlight(&M);
       Replot();
     }
@@ -265,7 +264,7 @@ void geom_event_handler (int event) {
         Replot();
         break;
       }
-      translate_seg(event==GEOM_ELEM_ADD_TRANSLATE_LINE?1:0,c->Num,TheFileName);
+      translate_seg(event==GEOM_ELEM_ADD_TRANSLATE_LINE?1:0,c->Num,CTX.filename);
       ZeroHighlight(&M);
       Replot();
     }
@@ -279,7 +278,7 @@ void geom_event_handler (int event) {
         Replot();
         break;
       }
-      translate_surf(event==GEOM_ELEM_ADD_TRANSLATE_SURF?1:0,s->Num,TheFileName);
+      translate_surf(event==GEOM_ELEM_ADD_TRANSLATE_SURF?1:0,s->Num,CTX.filename);
       ZeroHighlight(&M);
       Replot();
     }
@@ -295,7 +294,7 @@ void geom_event_handler (int event) {
         Replot();
         break;
       }
-      rotate(event==GEOM_ELEM_ADD_ROTATE_POINT?1:0,v->Num,TheFileName,"Point");
+      rotate(event==GEOM_ELEM_ADD_ROTATE_POINT?1:0,v->Num,CTX.filename,"Point");
       ZeroHighlight(&M);
       Replot();
     }
@@ -309,7 +308,7 @@ void geom_event_handler (int event) {
         Replot();
         break;
       }
-      rotate(event==GEOM_ELEM_ADD_ROTATE_LINE?1:0,c->Num,TheFileName,"Line");
+      rotate(event==GEOM_ELEM_ADD_ROTATE_LINE?1:0,c->Num,CTX.filename,"Line");
       ZeroHighlight(&M);
       Replot();
     }
@@ -323,7 +322,7 @@ void geom_event_handler (int event) {
         Replot();
         break;
       }
-      rotate(event==GEOM_ELEM_ADD_ROTATE_SURF?1:0,s->Num,TheFileName,"Surface");
+      rotate(event==GEOM_ELEM_ADD_ROTATE_SURF?1:0,s->Num,CTX.filename,"Surface");
       ZeroHighlight(&M);
       Replot();
     }
@@ -341,8 +340,8 @@ void geom_event_handler (int event) {
         break;
       }
       event==GEOM_ELEM_EXTRUDE_TRANSLATE_POINT ? 
-        extrude(v->Num,TheFileName, "Point") :
-        protude(v->Num,TheFileName, "Point") ;
+        extrude(v->Num,CTX.filename, "Point") :
+        protude(v->Num,CTX.filename, "Point") ;
       ZeroHighlight(&M);
       Replot();
     }
@@ -357,8 +356,8 @@ void geom_event_handler (int event) {
         break;
       }
       event==GEOM_ELEM_EXTRUDE_TRANSLATE_LINE ? 
-        extrude(c->Num,TheFileName, "Line") :
-        protude(c->Num,TheFileName, "Line") ;
+        extrude(c->Num,CTX.filename, "Line") :
+        protude(c->Num,CTX.filename, "Line") ;
       ZeroHighlight(&M);
       Replot();
     }
@@ -373,8 +372,8 @@ void geom_event_handler (int event) {
         break;
       }
       event==GEOM_ELEM_EXTRUDE_TRANSLATE_SURF ? 
-        extrude(s->Num,TheFileName, "Surface") :
-        protude(s->Num,TheFileName, "Surface") ;
+        extrude(s->Num,CTX.filename, "Surface") :
+        protude(s->Num,CTX.filename, "Surface") ;
       ZeroHighlight(&M);
       Replot();
     }
@@ -394,16 +393,16 @@ void geom_event_handler (int event) {
       }
       switch(event){
       case GEOM_ELEM_ADD_DILATE_POINT :
-	dilate(1,v->Num,TheFileName,"Point");
+	dilate(1,v->Num,CTX.filename,"Point");
 	break;
       case GEOM_ELEM_MOVE_DILATE_POINT :
-	dilate(0,v->Num,TheFileName,"Point");
+	dilate(0,v->Num,CTX.filename,"Point");
 	break;
       case GEOM_ELEM_ADD_SYMMETRY_POINT :
-	symmetry(1,v->Num,TheFileName,"Point");
+	symmetry(1,v->Num,CTX.filename,"Point");
 	break;
       case GEOM_ELEM_MOVE_SYMMETRY_POINT :
-	symmetry(0,v->Num,TheFileName,"Point");
+	symmetry(0,v->Num,CTX.filename,"Point");
 	break;
       }
       ZeroHighlight(&M);
@@ -423,16 +422,16 @@ void geom_event_handler (int event) {
       }
       switch(event){
       case GEOM_ELEM_ADD_DILATE_LINE :
-	dilate(1,c->Num,TheFileName,"Line");
+	dilate(1,c->Num,CTX.filename,"Line");
 	break;
       case GEOM_ELEM_MOVE_DILATE_LINE :
-	dilate(0,c->Num,TheFileName,"Line");
+	dilate(0,c->Num,CTX.filename,"Line");
 	break;
       case GEOM_ELEM_ADD_SYMMETRY_LINE :
-	symmetry(1,c->Num,TheFileName,"Line");
+	symmetry(1,c->Num,CTX.filename,"Line");
 	break;
       case GEOM_ELEM_MOVE_SYMMETRY_LINE :
-	symmetry(0,c->Num,TheFileName,"Line");
+	symmetry(0,c->Num,CTX.filename,"Line");
 	break;
       }
       ZeroHighlight(&M);
@@ -452,16 +451,16 @@ void geom_event_handler (int event) {
       }
       switch(event){
       case GEOM_ELEM_ADD_DILATE_SURF :
-	dilate(1,s->Num,TheFileName,"Surface");
+	dilate(1,s->Num,CTX.filename,"Surface");
 	break;
       case GEOM_ELEM_MOVE_DILATE_SURF :
-	dilate(0,s->Num,TheFileName,"Surface");
+	dilate(0,s->Num,CTX.filename,"Surface");
 	break;
       case GEOM_ELEM_ADD_SYMMETRY_SURF :
-	symmetry(1,s->Num,TheFileName,"Surface");
+	symmetry(1,s->Num,CTX.filename,"Surface");
 	break;
       case GEOM_ELEM_MOVE_SYMMETRY_SURF :
-	symmetry(0,s->Num,TheFileName,"Surface");
+	symmetry(0,s->Num,CTX.filename,"Surface");
 	break;
       }
       ZeroHighlight(&M);
@@ -480,7 +479,7 @@ void geom_event_handler (int event) {
         Replot();
         break;
       }
-      del_pnt(v->Num,TheFileName);
+      del_pnt(v->Num,CTX.filename);
       ZeroHighlight(&M);
       Replot();
     }
@@ -493,7 +492,7 @@ void geom_event_handler (int event) {
         Replot();
         break;
       }
-      del_seg(c->Num,TheFileName);
+      del_seg(c->Num,CTX.filename);
       ZeroHighlight(&M);
       Replot();
     }
@@ -506,7 +505,7 @@ void geom_event_handler (int event) {
         Replot();
         break;
       }
-      del_srf(s->Num,TheFileName);
+      del_srf(s->Num,CTX.filename);
       ZeroHighlight(&M);
       Replot();
     }
@@ -515,7 +514,7 @@ void geom_event_handler (int event) {
 
   case GEOM_ELEM_SKETCH :
     Msg(STATUS,"Verifying Geometry");
-    add_infile("Coherence;",TheFileName);
+    add_infile("Coherence;",CTX.filename);
     ZeroHighlight(&M);
     Replot();
     break;
@@ -549,7 +548,7 @@ void geom_event_handler (int event) {
       }
       if(ib == -1){ /* end */
         if(List_Nbr(Liste1)){
-          add_physical_entity(Liste1,TheFileName,type,&zone);
+          add_physical_entity(Liste1,CTX.filename,type,&zone);
           List_Reset(Liste1);
           ZeroHighlight(&M);
           Replot();
@@ -596,7 +595,7 @@ void GeomCb (Widget w, XtPointer client_data, XtPointer call_data){
 
   switch((long int)client_data){
 
-  case GEOM_PARAMETER_ADD   : add_param(name_text,value_text,TheFileName); break;
+  case GEOM_PARAMETER_ADD   : add_param(name_text,value_text,CTX.filename); break;
   case GEOM_PARAMETER_NAME  : strcpy(name_text,XmTextGetString(w)); break;
   case GEOM_PARAMETER_VALUE : strcpy(value_text,XmTextGetString(w)); break;
   case GEOM_POINT_ADD  : geom_event_handler(GEOM_ELEM_ADD_NEW_POINT); Replot(); break;
diff --git a/Unix/CbGeom.h b/Unix/CbGeom.h
index 20167497e55973449c1994df93b7a6d60064eef0..08f85e139e6cdc7984268fd3eda05c50cf9f66f0 100644
--- a/Unix/CbGeom.h
+++ b/Unix/CbGeom.h
@@ -1,4 +1,3 @@
-/* $Id: CbGeom.h,v 1.3 2000-12-13 13:57:00 geuzaine Exp $ */
 #ifndef _CB_GEOM_H_
 #define _CB_GEOM_H_
 
diff --git a/Unix/CbInput.cpp b/Unix/CbInput.cpp
index b36433db91cd8a8e42ec4f23e6c7b222e792b3b6..b21d052cc96c8907e01b1ee54093f8f0a2c67db6 100644
--- a/Unix/CbInput.cpp
+++ b/Unix/CbInput.cpp
@@ -1,4 +1,4 @@
-/* $Id: CbInput.cpp,v 1.15 2000-12-22 20:10:32 geuzaine Exp $ */
+// $Id: CbInput.cpp,v 1.16 2001-01-08 08:03:40 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -532,7 +532,7 @@ void InputCb (Widget w, XtPointer client_data, GLwDrawingAreaCallbackStruct *cb)
 	(CTX.vymax - CTX.vymin) ;
       if(CTX.overlay) {
         movzx = xz - xb; movzy = yz - yb;
-        InitOv();
+        InitOverlay();
         glLineWidth(1.);
         glClearIndex(0);
         glClear(GL_COLOR_BUFFER_BIT);  
diff --git a/Unix/CbMesh.cpp b/Unix/CbMesh.cpp
index 490e6a0fcc6b9c07f39cd2eb4a22f53c2f5df28d..337b0c53faeec5c43ebf913aa7c8e0af33f76b58 100644
--- a/Unix/CbMesh.cpp
+++ b/Unix/CbMesh.cpp
@@ -1,4 +1,4 @@
-/* $Id: CbMesh.cpp,v 1.5 2000-11-26 15:43:48 geuzaine Exp $ */
+// $Id: CbMesh.cpp,v 1.6 2001-01-08 08:03:40 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -12,7 +12,6 @@
 extern Widgets_T  WID;
 extern Context_T  CTX;
 extern Mesh       M;
-extern char       TheFileName[NAME_STR_L];
 
 extern char   trsf_pts_text[100], trsf_type_text[100];
 extern char   trsf_vol_text[100], char_length_text[100];
@@ -142,7 +141,7 @@ void mesh_event_handler (int event) {
       }
       if (ib == -1){ /* 'e' */
         if(n >= 1) {
-          add_charlength(n,p,TheFileName); break;
+          add_charlength(n,p,CTX.filename); break;
         }
         n=0;
         ZeroHighlight(&M);
@@ -167,7 +166,7 @@ void mesh_event_handler (int event) {
       }
       if (ib == -1){ /* 'e' */
         if(n >= 1) {
-          add_recosurf(n,p,TheFileName); break;
+          add_recosurf(n,p,CTX.filename); break;
         }
         n=0;
         ZeroHighlight(&M);
@@ -215,13 +214,13 @@ void mesh_event_handler (int event) {
               switch (event) {    
               case MESH_DEFINE_TRSF_SURFACE :
                 if(n == 3+1 || n == 4+1)
-                  add_trsfsurf(n,p,TheFileName); 
+                  add_trsfsurf(n,p,CTX.filename); 
                 else
                   Msg(INFO, "Wrong Number of Points for Transfinite Surface");
                 break;
               case MESH_DEFINE_TRSF_VOLUME :
                 if(n == 6 || n == 8)
-                  add_trsfvol(n,p,TheFileName);
+                  add_trsfvol(n,p,CTX.filename);
                 else
                   Msg(INFO, "Wrong Number of Points for Transfinite Volume");
                 break;
@@ -243,7 +242,7 @@ void mesh_event_handler (int event) {
       }
       if (ib == -1){ /* 'e' */
         if (event == MESH_DEFINE_TRSF_LINE){ 
-          if(n >= 1) add_trsfline(n,p,TheFileName);
+          if(n >= 1) add_trsfline(n,p,CTX.filename);
         }
         n=0;
         ZeroHighlight(&M);
diff --git a/Unix/CbMesh.h b/Unix/CbMesh.h
index bd1fe0ce86d9e3a507ccacf43b88cfb09c6d5d93..b5fe82fd27016d1d4fb80dd4a5b7befd29d5c4d1 100644
--- a/Unix/CbMesh.h
+++ b/Unix/CbMesh.h
@@ -1,4 +1,3 @@
-/* $Id: CbMesh.h,v 1.3 2000-11-26 15:43:48 geuzaine Exp $ */
 #ifndef _CB_MESH_H_
 #define _CB_MESH_H_
 
diff --git a/Unix/CbOptions.cpp b/Unix/CbOptions.cpp
index cd720195e773f2b0ccbd06bb271cbcfd94cea399..1e65db005b9fbfab89d27167f963c57939d68682 100644
--- a/Unix/CbOptions.cpp
+++ b/Unix/CbOptions.cpp
@@ -1,4 +1,4 @@
-/* $Id: CbOptions.cpp,v 1.19 2000-12-29 14:04:29 geuzaine Exp $ */
+// $Id: CbOptions.cpp,v 1.20 2001-01-08 08:03:40 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -11,6 +11,7 @@
 #include "Context.h"
 #include "XContext.h"
 #include "Register.h"
+#include "Timer.h"
 
 #include "CbGeneral.h"
 #include "CbOptions.h"
@@ -18,9 +19,6 @@
 #include "CbMesh.h"
 #include "CbPost.h"
 
-#include <sys/time.h>
-#include <unistd.h>
-
 extern Context_T  CTX;
 extern XContext_T XCTX ;
 extern Widgets_T  WID;
@@ -37,12 +35,6 @@ static long anim_time ;
     O p t i o n s C b                                                       
    ------------------------------------------------------------------------ */
 
-long Get_AnimTime(){
-  struct timeval tp;
-  gettimeofday(&tp, (struct timezone *) 0);
-  return (long)tp.tv_sec * 1000000 + (long)tp.tv_usec;
-}
-
 void OptionsCb (Widget w, XtPointer client_data, XtPointer call_data){
   int                i, e;
   char              *c, label[32];
@@ -325,7 +317,7 @@ void OptionsCb (Widget w, XtPointer client_data, XtPointer call_data){
     stop_anim = 0 ;
     Set_AnimPixmap(&WID, &PIX, 0) ;
     Set_AnimCallback(&WID, 0) ;
-    anim_time = Get_AnimTime();
+    anim_time = GetTime();
     while(1){
       if(XtAppPending(XCTX.AppContext)){
         XtAppNextEvent(XCTX.AppContext,&event);
@@ -333,8 +325,8 @@ void OptionsCb (Widget w, XtPointer client_data, XtPointer call_data){
         if(stop_anim) break ;
       }
       else{
-        if(Get_AnimTime() - anim_time > CTX.post.anim_delay){
-          anim_time = Get_AnimTime();
+        if(GetTime() - anim_time > CTX.post.anim_delay){
+          anim_time = GetTime();
           MarkAllViewsChanged(2);
           Init(); Draw();
         }
diff --git a/Unix/CbOptions.h b/Unix/CbOptions.h
index 165aa5f00ff410d4a68ca680019794438bdcc99f..086c9dc4a409b5515e2629017e36b26905f09c95 100644
--- a/Unix/CbOptions.h
+++ b/Unix/CbOptions.h
@@ -1,4 +1,3 @@
-/* $Id: CbOptions.h,v 1.13 2000-12-29 14:04:29 geuzaine Exp $ */
 #ifndef _CB_OPTIONS_H_
 #define _CB_OPTIONS_H_
 
diff --git a/Unix/CbPost.cpp b/Unix/CbPost.cpp
index 53cac81cfcb243bf44ae43d26dd5f6f34be7dcb3..3c5436b3022035c54fb8863e190c956730e69d32 100644
--- a/Unix/CbPost.cpp
+++ b/Unix/CbPost.cpp
@@ -1,4 +1,4 @@
-/* $Id: CbPost.cpp,v 1.10 2000-12-29 10:27:00 geuzaine Exp $ */
+// $Id: CbPost.cpp,v 1.11 2001-01-08 08:03:40 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -10,7 +10,7 @@
 #include "Widgets.h"
 #include "Context.h"
 #include "XContext.h"
-#include "Main.h"
+#include "OpenFile.h"
 
 #include "CbPost.h"
 #include "CbGeom.h"
diff --git a/Unix/CbPost.h b/Unix/CbPost.h
index 6784a97ef3114b6c668c724897d5759d95c5ea46..d5b135fb6b9e26514e03fea8f69ebc00e1ce7a14 100644
--- a/Unix/CbPost.h
+++ b/Unix/CbPost.h
@@ -1,4 +1,3 @@
-/* $Id: CbPost.h,v 1.4 2000-11-26 15:43:48 geuzaine Exp $ */
 #ifndef _CB_POST_H_
 #define _CB_POST_H_
 
diff --git a/Unix/Geometry.cpp b/Unix/Geometry.cpp
index 7427cea6a7c33c45d35186468422706f4a7c15ed..228a9c19ebc995920527cec28479a00ab8616bc7 100644
--- a/Unix/Geometry.cpp
+++ b/Unix/Geometry.cpp
@@ -1,4 +1,4 @@
-/* $Id: Geometry.cpp,v 1.8 2000-12-20 15:28:48 geuzaine Exp $ */
+// $Id: Geometry.cpp,v 1.9 2001-01-08 08:03:40 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "GmshUI.h"
diff --git a/Unix/Geometry.h b/Unix/Geometry.h
index a92c8fcc9a5a35a71cae9ec3ec7dca081b539037..9793884fc83258996240a4f5bb8d79c7683c22c3 100644
--- a/Unix/Geometry.h
+++ b/Unix/Geometry.h
@@ -1,4 +1,3 @@
-/* $Id: Geometry.h,v 1.2 2000-11-23 14:11:41 geuzaine Exp $ */
 #ifndef _GEOMETRY_H_
 #define _GEOMETRY_H_
 
diff --git a/Unix/Help.h b/Unix/Help.h
index c50f4fa62f609cb094091d3b07374b99db3c653e..813b0127cb83c87b6216cf27e3f2aa40acfee106 100644
--- a/Unix/Help.h
+++ b/Unix/Help.h
@@ -1,4 +1,3 @@
-/* $Id: Help.h,v 1.6 2000-12-26 11:59:06 geuzaine Exp $ */
 #ifndef _HELP_H_
 #define _HELP_H_
 
diff --git a/Unix/Info.h b/Unix/Info.h
index 1238e4efb5b6103515a58c8620196e8ce4f5cc81..6ce1718e8618777e3a30a1ad413ab6bf3491efe1 100644
--- a/Unix/Info.h
+++ b/Unix/Info.h
@@ -1,4 +1,3 @@
-/* $Id: Info.h,v 1.3 2000-11-24 12:57:25 geuzaine Exp $ */
 #ifndef _INFO_H_
 #define _INFO_H_
 
diff --git a/Unix/Main.cpp b/Unix/Main.cpp
index 9c4b7bdefeb47f42c867c1a7ec49ce081b3d2b5c..109c66055b8b217c7b1a9f1260504b4e3659d04c 100644
--- a/Unix/Main.cpp
+++ b/Unix/Main.cpp
@@ -1,4 +1,4 @@
-/* $Id: Main.cpp,v 1.34 2000-12-27 17:25:52 geuzaine Exp $ */
+// $Id: Main.cpp,v 1.35 2001-01-08 08:03:40 geuzaine Exp $
 
 #include <signal.h>
 
@@ -11,521 +11,26 @@
 #include "Context.h"
 #include "ColorTable.h"
 #include "Parser.h"
-#include "MinMax.h"
 
 #include "Widgets.h"
 #include "Pixmaps.h"
-
 #include "XColors.h"
 #include "XContext.h"
 #include "XRessources.h"
-
 #include "CbContext.h"
 #include "CbGeom.h"
 #include "Register.h"
 #include "Geometry.h"
+#include "OpenFile.h"
+#include "GetOptions.h"
 
 #include "Static.h"
 #include "XStatic.h"
 
 #include "Version.h"
 
-char gmsh_progname[]  = "This is Gmsh" ;
-char gmsh_copyright[] = "Copyright (C) 1997-2001 J.-F. Remacle, C. Geuzaine";
-char gmsh_version[]   = "Version          : " ;
-char gmsh_os[]        = "Operating System : " GMSH_OS ;
-char gmsh_date[]      = "Build Date       : " GMSH_DATE ;
-char gmsh_host[]      = "Build Host       : " GMSH_HOST ;
-char gmsh_packager[]  = "Packager         : " GMSH_PACKAGER ;
-char gmsh_url[]       = "URL              : http://www.geuz.org/gmsh/" ;
-char gmsh_email[]     = "E-Mail           : Christophe.Geuzaine@ulg.ac.be\n"
-                        "                   Remacle@scorec.rpi.edu" ;
-char gmsh_help[]      = 
-  "Usage: %s [options] [files]\n"
-  "Geometry options:\n"
-  "  -0                    parse input files, output flattened geometry, and exit\n"
-  "Mesh options:\n"
-  "  -1, -2, -3            perform batch 1D, 2D and 3D mesh generation\n"
-  "  -format msh|unv|gref  set output mesh format (default: msh)\n"
-  "  -algo iso|aniso       select 2D mesh algorithm (default: iso)\n"
-  "  -smooth int           set mesh smoothing (default: 0)\n"
-  "  -degree int           set mesh degree (default: 1)\n"
-  "  -scale float          set global scaling factor (default: 1.0)\n"
-  "  -meshscale float      set mesh scaling factor (default: 1.0)\n"
-  "  -clscale float        set characteristic length scaling factor (default: 1.0)\n"
-  "  -rand float           set random perturbation factor (default: 1.e-5)\n"
-  "  -bgm file             load backround mesh from file\n"
-  "  -interactive          display 2D mesh construction interactively\n"
-  "Post Processing options:\n"
-  "  -dl                   enable display lists\n"
-  "  -noview               hide all views on startup\n"
-  "  -link                 link all views on startup\n"
-  "Display options:\n"    
-  "  -nodb                 disable double buffering\n"
-  "  -noov                 disable overlay visual\n"
-  "  -alpha                enable alpha blending\n"
-  "  -notrack              don't use trackball mode for rotations\n"
-  "  -geometry geom        specify main window geometry\n"
-  "  -viewport 9*float     specify rotation, translation and scale\n"
-  "  -display disp         specify display\n"
-  "  -perspective          set projection mode to perspective\n"
-  "  -flash                allow colormap flashing\n"
-  "  -samevisual           force same visual for graphics and UI\n"
-  "Other options:\n"      
-  "  -v int                set verbosity level (default: 2)\n"
-  "  -nothreads            disable threads\n"
-  "  -path string          set path for included files\n"
-  "  -version              show version number\n"
-  "  -info                 show detailed version information\n"
-  "  -help                 show this message\n"
-  ;
-
-char *TheFileNameTab[MAX_OPEN_FILES], *TheBgmFileName=NULL;
-char  ThePathForIncludes[NAME_STR_L];
-
 extern List_T *Post_ViewList;
 
-/* ------------------------------------------------------------------------ */
-/*  P a r s e                                                               */
-/* ------------------------------------------------------------------------ */
-
-void ParseFile(char *f){
-  char String[256];
-
-  strncpy(yyname,f,NAME_STR_L);
-  yyerrorstate=0;
-  yylineno=1;
-
-  if(!(yyin = fopen(yyname,"r"))){
-    Msg(INFO, "File '%s' Does not Exist", f);
-    return;
-  }
-  
-  fpos_t position;
-  fgetpos(yyin, &position);
-  fgets(String, sizeof(String), yyin) ; 
-  fsetpos(yyin, &position);
-
-  if(!strncmp(String, "$PTS", 4) || 
-     !strncmp(String, "$NO", 3) || 
-     !strncmp(String, "$ELM", 4)){
-    if(THEM->status < 0) mai3d(THEM, 0);
-    Read_Mesh(THEM, yyin, FORMAT_MSH);
-  }
-  else if(!strncmp(String, "$PostFormat", 11) ||
-          !strncmp(String, "$View", 5)){
-    Read_View(yyin, yyname);
-  }
-  else{
-    while(!feof(yyin)) yyparse();
-  }
-  fclose(yyin);
-}
-
-extern int SHOW_ALL_ENTITIES ;
-
-void MergeProblem(char *name){
-  Msg(INFOS, "Merging '%s'",name); 
-
-  ParseFile(name);  
-  if (yyerrorstate) return;
-
-  if (!EntitesVisibles) {
-    RemplirEntitesVisibles(1);
-    SHOW_ALL_ENTITIES = 1;
-  }
-}
-
-void OpenProblem(char *name){
-  char ext[6];
-  
-  InitSymbols();
-  Init_Mesh(&M, 1);
-
-  strncpy(TheFileName,name,NAME_STR_L);
-  strncpy(TheBaseFileName,name,NAME_STR_L);
-
-  strcpy(ext,name+(strlen(name)-4));
-  if(!strcmp(ext,".GEO") || 
-     !strcmp(ext,".geo") || 
-     !strcmp(ext,".msh") || 
-     !strcmp(ext,".pos")){
-    TheBaseFileName[strlen(name)-4] = '\0';
-  }
-  else{
-    strcat(TheFileName,".geo");
-  }
-
-  strncpy(THEM->name, TheBaseFileName,NAME_STR_L);
-
-  if(!CTX.interactive){
-    XtVaSetValues(WID.G.shell,
-                  XmNtitle, TheFileName,
-                  XmNiconName, TheBaseFileName,
-                  NULL);
-  }
-
-  Msg(INFOS, "Opening '%s'", TheFileName); 
-
-  ParseFile(TheFileName);  
-
-  ApplyLcFactor(THEM);
-  mai3d(THEM,0);  
-  Maillage_Dimension_0(&M);
-
-  ZeroHighlight(&M); 
-  CalculateMinMax(THEM->Points);  
-  if (!EntitesVisibles) {
-    RemplirEntitesVisibles(1);
-    SHOW_ALL_ENTITIES = 1;
-  }
-
-}
-
-
-/* ------------------------------------------------------------------------ */
-/*  G e t _ O p t i o n s                                                   */
-/* ------------------------------------------------------------------------ */
-
-void Get_Options (int argc, char *argv[], int *nbfiles) {
-  int i=1;
-
-  TheFileNameTab[0] = "unnamed.geo" ;
-  *nbfiles = 0;
-  
-  while (i < argc) {
-    
-    if (argv[i][0] == '-') {
-      
-      if(!strcmp(argv[i]+1, "0")){ 
-        CTX.interactive = -1; i++;
-      }
-      else if(!strcmp(argv[i]+1, "1")){ 
-        CTX.interactive = 1; i++;
-      }
-      else if(!strcmp(argv[i]+1, "2")){ 
-        CTX.interactive = 2; i++;
-      }
-      else if(!strcmp(argv[i]+1, "3")){ 
-        CTX.interactive = 3; i++;
-      }
-      else if(!strcmp(argv[i]+1, "path")){ 
-        i++;
-        /* we need to make a copy because of bison */
-        if(argv[i] != NULL) 
-          strncpy(ThePathForIncludes, argv[i++], NAME_STR_L) ;
-        else {    
-          fprintf(stderr, ERROR_STR "Missing String\n");
-          exit(1);
-        }
-      }
-      else if(!strcmp(argv[i]+1, "bgm")){ 
-        i++;
-        if(argv[i] != NULL) TheBgmFileName = argv[i++];
-        else {    
-          fprintf(stderr, ERROR_STR "Missing File Name\n");
-          exit(1);
-        }
-      }
-      else if(!strcmp(argv[i]+1, "alpha")){ 
-        CTX.alpha = 1; i++;
-      }
-      else if(!strcmp(argv[i]+1, "notrack")){ 
-        CTX.useTrackball = 0; i++;
-      }
-      else if(!strcmp(argv[i]+1, "flash")){ 
-        CTX.flash = 1; i++;
-      }
-      else if(!strcmp(argv[i]+1, "old")){ 
-        FLAG_OLD_CIRCLE = 1; i++;
-      }
-      else if(!strcmp(argv[i]+1, "dual")){ 
-        CTX.mesh.dual = 1; i++;
-      }
-      else if(!strcmp(argv[i]+1, "samevisual")){ 
-        CTX.same_visual = 1; i++;
-      }
-      else if(!strcmp(argv[i]+1, "interactive")){ 
-        CTX.mesh.interactive = 1; i++;
-      }
-      else if(!strcmp(argv[i]+1, "quality")){
-        i++;
-        if(argv[i]!=NULL) CTX.mesh.quality = atof(argv[i++]);
-        else {    
-          fprintf(stderr, ERROR_STR "Missing Number\n");
-          exit(1);
-        }
-      }
-      else if(!strcmp(argv[i]+1, "scale")){
-        i++;
-        if(argv[i]!=NULL) CTX.geom.scaling_factor = atof(argv[i++]);
-        else {    
-          fprintf(stderr, ERROR_STR "Missing Number\n");
-          exit(1);
-        }
-      }
-      else if(!strcmp(argv[i]+1, "meshscale")){
-        i++;
-        if(argv[i]!=NULL) CTX.mesh.scaling_factor = atof(argv[i++]);
-        else {    
-          fprintf(stderr, ERROR_STR "Missing Number\n");
-          exit(1);
-        }
-      }
-      else if(!strcmp(argv[i]+1, "rand")){
-        i++;
-        if(argv[i]!=NULL) CTX.mesh.rand_factor = atof(argv[i++]);
-        else {    
-          fprintf(stderr, ERROR_STR "Missing Number\n");
-          exit(1);
-        }
-      }
-      else if(!strcmp(argv[i]+1, "clscale")){
-        i++;
-        if(argv[i]!=NULL){
-          CTX.mesh.lc_factor = atof(argv[i++]);
-          if(CTX.mesh.lc_factor <= 0.0){
-            fprintf(stderr, ERROR_STR 
-                    "Characteristic Length Factor Must be > 0\n");
-            exit(1);
-          }
-        }
-        else {    
-          fprintf(stderr, ERROR_STR "Missing Number\n");
-          exit(1);
-        }
-      }
-      else if(!strcmp(argv[i]+1, "smooth")){ 
-        i++;
-        if(argv[i]!=NULL) CTX.mesh.nb_smoothing = atoi(argv[i++]);
-        else{
-          fprintf(stderr, ERROR_STR "Missing Number\n");
-          exit(1);
-        }
-      }
-      else if(!strcmp(argv[i]+1, "degree")){  
-        i++;
-        if(argv[i]!=NULL){
-          CTX.mesh.degree = atoi(argv[i++]);
-          if(CTX.mesh.degree != 1 || CTX.mesh.degree != 2){
-            fprintf(stderr, ERROR_STR "Wrong Degree\n");
-            exit(1);
-          }
-        }
-        else {    
-          fprintf(stderr, ERROR_STR "Missing Number\n");
-          exit(1);
-        }
-      }
-      else if(!strcmp(argv[i]+1, "format") ||  
-              !strcmp(argv[i]+1, "f")){  
-        i++;
-        if(argv[i]!=NULL){
-          if(!strcmp(argv[i],"msh") || 
-             !strcmp(argv[i],"MSH") || 
-             !strcmp(argv[i],"gmsh")){
-            CTX.mesh.format = FORMAT_MSH ;
-          }
-          else if(!strcmp(argv[i],"unv") ||
-                  !strcmp(argv[i],"UNV") || 
-                  !strcmp(argv[i],"ideas")){
-            CTX.mesh.format = FORMAT_UNV ;
-          }
-          else if(!strcmp(argv[i],"gref") ||
-                  !strcmp(argv[i],"GREF") || 
-                  !strcmp(argv[i],"Gref")){
-            CTX.mesh.format = FORMAT_GREF ;
-          }
-          else{
-            fprintf(stderr, ERROR_STR "Unknown Mesh Format\n");
-            exit(1);
-          }
-          i++;
-        }
-        else {    
-          fprintf(stderr, ERROR_STR "Missing Format\n");
-          exit(1);
-        }
-      }
-      else if(!strcmp(argv[i]+1, "algo")){  
-        i++;
-        if(argv[i]!=NULL){
-          if(!strcmp(argv[i],"iso"))
-            CTX.mesh.algo = DELAUNAY_OLDALGO ;
-          else if(!strcmp(argv[i],"aniso"))
-            CTX.mesh.algo = DELAUNAY_NEWALGO ;
-          else{
-            fprintf(stderr, ERROR_STR "Unknown Mesh Algorithm\n");
-            exit(1);
-          }
-          i++;
-        }
-        else {    
-          fprintf(stderr, ERROR_STR "Missing Algorithm\n");
-          exit(1);
-        }
-      }
-      else if(!strcmp(argv[i]+1, "noview")){ 
-        CTX.post.initial_visibility = 0 ; i++;
-      }
-      else if(!strcmp(argv[i]+1, "link")){ 
-        CTX.post.link = 2 ; i++;
-      }
-      else if(!strcmp(argv[i]+1, "fill")){ 
-        CTX.post.initial_intervals = DRAW_POST_DISCRETE ; i++;
-      }
-      else if(!strcmp(argv[i]+1, "nbiso")){ 
-        i++ ;
-        if(argv[i]!=NULL) CTX.post.initial_nbiso = atoi(argv[i++]);
-        else{
-          fprintf(stderr, ERROR_STR "Missing Number\n");
-          exit(1);
-        }
-      }
-      else if(!strcmp(argv[i]+1, "command") || 
-              !strcmp(argv[i]+1, "c")){ 
-        CTX.command_win = 1; i++;
-      }
-      else if(!strcmp(argv[i]+1, "nocommand") ||
-              !strcmp(argv[i]+1, "noc")){ 
-        CTX.command_win = 0; i++;
-      }
-      else if(!strcmp(argv[i]+1, "overlay") ||
-              !strcmp(argv[i]+1, "ov")){ 
-        CTX.overlay = 1; i++;
-      }
-      else if(!strcmp(argv[i]+1, "nooverlay") ||
-              !strcmp(argv[i]+1, "noov")){ 
-        CTX.overlay = CTX.geom.highlight = 0; i++;
-      }
-      else if(!strcmp(argv[i]+1, "perspective") ||
-              !strcmp(argv[i]+1, "p")){ 
-        CTX.ortho = 0; i++;
-      }
-      else if(!strcmp(argv[i]+1, "ortho") ||
-              !strcmp(argv[i]+1, "o")){ 
-        CTX.ortho = 0; i++;
-      }
-      else if(!strcmp(argv[i]+1, "threads")){
-        CTX.threads = 1; i++;
-      }
-      else if(!strcmp(argv[i]+1, "nothreads")){
-        CTX.threads = 0; i++;
-      }
-      else if(!strcmp(argv[i]+1, "viewport")){ 
-        i++ ;
-        if(argv[i]!=NULL){
-          CTX.r[0] = atof(argv[i]) ; i++ ;
-        }
-        if(argv[i]!=NULL){
-          CTX.r[1] = atof(argv[i]) ; i++ ;
-        }
-        if(argv[i]!=NULL){
-          CTX.r[2] = atof(argv[i]) ; i++ ;
-        }
-        if(argv[i]!=NULL){
-          CTX.t[0] = atof(argv[i]) ; i++ ;
-        }
-        if(argv[i]!=NULL){
-          CTX.t[1] = atof(argv[i]) ; i++ ;
-        }
-        if(argv[i]!=NULL){
-          CTX.t[2] = atof(argv[i]) ; i++ ;
-        }
-        if(argv[i]!=NULL){
-          CTX.s[0] = atof(argv[i]) ; i++ ;
-        }
-        if(argv[i]!=NULL){
-          CTX.s[1] = atof(argv[i]) ; i++ ;
-        }
-        if(argv[i]!=NULL){
-          CTX.s[2] = atof(argv[i]) ; i++ ;
-        }
-        else{
-          fprintf(stderr, ERROR_STR "Missing Number\n");
-          exit(1);
-        }
-      }
-      else if(!strcmp(argv[i]+1, "db")){ 
-        CTX.db = 1; i++;
-      }
-      else if(!strcmp(argv[i]+1, "nodb")){ 
-        CTX.db = 0; CTX.geom.highlight = 0; i++;
-      }
-      else if(!strcmp(argv[i]+1, "dl")){ 
-        CTX.display_lists = 1; i++;
-      }
-      else if(!strcmp(argv[i]+1, "nodl")){ 
-        CTX.display_lists = 0; i++;
-      }
-      else if(!strcmp(argv[i]+1, "geometry") ||
-              !strcmp(argv[i]+1, "display")  ||
-              !strcmp(argv[i]+1, "fg")       ||
-              !strcmp(argv[i]+1, "bg")){
-        i++;
-        if(argv[i]!=NULL)
-          i++;
-        else {    
-          fprintf(stderr, ERROR_STR "Missing Argument\n");
-          exit(1);
-        }
-      }
-      else if(!strcmp(argv[i]+1, "iconic")){
-	i++;
-      }
-      else if(!strcmp(argv[i]+1, "v")){  
-        i++;
-        if(argv[i]!=NULL) CTX.verbosity = atoi(argv[i++]);
-        else {    
-          fprintf(stderr, ERROR_STR "Missing Number\n");
-          exit(1);
-        }
-      }
-      else if(!strcmp(argv[i]+1, "version") || 
-              !strcmp(argv[i]+1, "-version")){
-        fprintf(stderr, "%.2f\n", GMSH_VERSION);
-        exit(1);
-      }
-      else if(!strcmp(argv[i]+1, "info") || 
-              !strcmp(argv[i]+1, "-info")){
-        fprintf(stderr, "%s%.2f\n", gmsh_version, GMSH_VERSION);
-        fprintf(stderr, "%s\n", gmsh_os);
-        fprintf(stderr, "%s\n", gmsh_date);
-        fprintf(stderr, "%s\n", gmsh_host);
-        fprintf(stderr, "%s\n", gmsh_packager);
-        fprintf(stderr, "%s\n", gmsh_url);
-        fprintf(stderr, "%s\n", gmsh_email);
-        exit(1) ; 
-      }
-      else if(!strcmp(argv[i]+1, "help") || 
-              !strcmp(argv[i]+1, "-help")){
-        fprintf(stderr, "%s\n", gmsh_progname);
-        fprintf(stderr, "%s\n", gmsh_copyright);
-        fprintf(stderr, gmsh_help, argv[0]);
-        exit(1);
-      }
-      else{
-        fprintf(stderr, "Unknown Option '%s'\n", argv[i]);
-        fprintf(stderr, gmsh_help, argv[0]);
-        exit(1);
-      }
-    }
-
-    else {
-      if(*nbfiles < MAX_OPEN_FILES)
-        TheFileNameTab[(*nbfiles)++] = argv[i++]; 
-      else{
-        fprintf(stderr, ERROR_STR "Too Many Input Files\n");
-        exit(1);
-      }
-    }
-
-  }
-
-  strncpy(TheFileName, TheFileNameTab[0], NAME_STR_L);
-
-}
-
 char* ShowVisualClass(int cls){
   if(cls==TrueColor)   return "TrueColor";
   if(cls==DirectColor) return "DirectColor";
@@ -536,10 +41,6 @@ char* ShowVisualClass(int cls){
   return "Unknown";
 }
 
-/* ------------------------------------------------------------------------ */
-/*  M a i n                                                                 */
-/* ------------------------------------------------------------------------ */
-
 int main(int argc, char *argv[]){
   int     i, nbf;
   XColor  ov_color_def, ov_color_exact;
@@ -579,7 +80,7 @@ int main(int argc, char *argv[]){
   /* Non-interactive Gmsh */
 
   if(CTX.interactive){
-    OpenProblem(TheFileName);
+    OpenProblem(CTX.filename);
     if(yyerrorstate)
       exit(1);
     else {
@@ -876,7 +377,7 @@ int main(int argc, char *argv[]){
 
   /* Open input file */
 
-  OpenProblem(TheFileName);
+  OpenProblem(CTX.filename);
 
   /* Merge all Input Files if any, then init first context (geometry or post) */
 
diff --git a/Unix/Makefile b/Unix/Makefile
index ed72553abfc203b14f9b5c16a86a7db5e238b5c9..8b5e4717cfa97b0d501e77796a70d66355c212af 100644
--- a/Unix/Makefile
+++ b/Unix/Makefile
@@ -1,36 +1,36 @@
-# $Id: Makefile,v 1.6 2000-12-29 10:27:00 geuzaine Exp $
+# $Id: Makefile,v 1.7 2001-01-08 08:03:40 geuzaine Exp $
 #
-# Makefile for "libUnix.a"
+# Makefile for "libMotif.a"
 #
 
 .IGNORE:
 
-CC            = c++
-C_FLAGS       = -g -Wall
+CC       = c++
+RM       = rm
+RANLIB   = ranlib
 
-VERSION_FLAGS = -D_NOTHREADS
-OS_FLAGS      = -D_XMOTIF 
+LIB      = ../lib/libMotif.a
+INCLUDE  = -I../Common -I../DataStr -I../Graphics -I../Geo\
+           -I../Mesh -I../Parser -I../Motif -I../Fltk
+
+C_FLAGS       = -g -Wall
+OS_FLAGS      = -D_LITTLE_ENDIAN
+VERSION_FLAGS = -D_XMOTIF -D_NOTHREADS
 
 GL_INCLUDE    = -I$(HOME)/SOURCES/Mesa-3.1/include\
                 -I$(HOME)/SOURCES/Mesa-3.1/include/GL
-MOTIF_INCLUDE = -I/usr/X11R6/LessTif/Motif1.2/include
+GUI_INCLUDE   = -I/usr/X11R6/LessTif/Motif1.2/include
 
-RM       = rm
 RMFLAGS  = -f
-RANLIB   = ranlib
-
-LIB      = ../lib/libUnix.a
-INCLUDE  = -I../Common -I../DataStr -I../Graphics -I../Geo\
-           -I../Mesh -I../Parser -I../Unix
-
 CFLAGS   = $(C_FLAGS) $(OS_FLAGS) $(VERSION_FLAGS) $(INCLUDE)\
-           $(MOTIF_INCLUDE) $(GL_INCLUDE)
+           $(GUI_INCLUDE) $(GL_INCLUDE)
 
 SRC = Main.cpp \
       Widgets.cpp \
       Geometry.cpp \
       Register.cpp \
       Pixmaps.cpp \
+      Opengl.cpp \
       XColors.cpp \
       Message.cpp \
       CbContext.cpp \
@@ -76,35 +76,43 @@ Main.o: Main.cpp ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \
   ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Edge.h \
   ../Geo/ExtrudeParams.h ../Mesh/Metric.h ../Graphics/Draw.h \
   ../Common/Views.h ../Common/Const.h ../Common/ColorTable.h \
-  ../Common/Context.h ../Parser/Parser.h ../Geo/MinMax.h Widgets.h \
-  Pixmaps.h XColors.h XContext.h XRessources.h CbContext.h CbGeom.h \
-  Register.h Geometry.h ../Common/Static.h XStatic.h ../Common/Version.h
+  ../Common/Context.h ../Parser/Parser.h Widgets.h Pixmaps.h XColors.h \
+  XContext.h XRessources.h CbContext.h CbGeom.h Register.h Geometry.h \
+  ../Parser/OpenFile.h ../Common/GetOptions.h ../Common/Static.h \
+  XStatic.h ../Common/Version.h
 Widgets.o: Widgets.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Common/GmshUI.h ../Mesh/Mesh.h \
   ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Edge.h \
-  ../Geo/ExtrudeParams.h ../Mesh/Metric.h ../Common/Context.h XContext.h \
-  Info.h Widgets.h Help.h
+  ../Geo/ExtrudeParams.h ../Mesh/Metric.h ../Common/Context.h \
+  ../Common/Const.h XContext.h Info.h Widgets.h Help.h
 Geometry.o: Geometry.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Common/GmshUI.h \
-  ../Common/Context.h XContext.h Widgets.h
+  ../Common/Context.h ../Common/Const.h XContext.h Widgets.h
 Register.o: Register.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Common/GmshUI.h \
-  ../Common/Context.h XContext.h Widgets.h Register.h CbOptions.h \
-  CbContext.h CbFile.h CbGeom.h CbMesh.h CbPost.h
+  ../Common/Context.h ../Common/Const.h XContext.h Widgets.h Register.h \
+  CbOptions.h CbContext.h CbFile.h CbGeom.h CbMesh.h CbPost.h
 Pixmaps.o: Pixmaps.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Common/GmshUI.h Widgets.h \
-  ../Common/Context.h Pixmaps.h Bitmaps.h XColors.h
+  ../Common/Context.h ../Common/Const.h Pixmaps.h Bitmaps.h XColors.h
+Opengl.o: Opengl.cpp ../Common/Gmsh.h ../Common/Message.h \
+  ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
+  ../DataStr/avl.h ../DataStr/Tools.h ../Common/GmshUI.h ../Geo/Geo.h \
+  ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Edge.h \
+  ../Geo/ExtrudeParams.h ../Mesh/Metric.h ../Graphics/Draw.h \
+  ../Common/Views.h ../Common/Const.h ../Common/ColorTable.h \
+  ../Common/Context.h ../Geo/MinMax.h Widgets.h XContext.h
 XColors.o: XColors.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Common/GmshUI.h XContext.h
 Message.o: Message.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Common/GmshUI.h \
-  ../Common/Version.h ../Common/Context.h Widgets.h
+  ../Common/Version.h ../Common/Context.h ../Common/Const.h Widgets.h
 CbContext.o: CbContext.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Common/GmshUI.h ../Geo/Geo.h \
@@ -118,8 +126,8 @@ CbPost.o: CbPost.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Edge.h \
   ../Geo/ExtrudeParams.h ../Mesh/Metric.h ../Graphics/Draw.h \
   ../Common/Views.h ../Common/Const.h ../Common/ColorTable.h Widgets.h \
-  ../Common/Context.h XContext.h Main.h CbPost.h CbGeom.h CbMesh.h \
-  CbColorbar.h
+  ../Common/Context.h XContext.h ../Parser/OpenFile.h CbPost.h CbGeom.h \
+  CbMesh.h CbColorbar.h
 CbColorbar.o: CbColorbar.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Common/GmshUI.h \
@@ -131,7 +139,7 @@ CbGeom.o: CbGeom.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Edge.h \
   ../Geo/ExtrudeParams.h ../Mesh/Metric.h ../Graphics/Draw.h \
   ../Common/Views.h ../Common/Const.h ../Common/ColorTable.h Widgets.h \
-  ../Common/Context.h ../Geo/Verif.h Main.h CbGeom.h
+  ../Common/Context.h ../Geo/Verif.h ../Parser/OpenFile.h CbGeom.h
 CbMesh.o: CbMesh.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Common/GmshUI.h ../Geo/Geo.h \
@@ -146,15 +154,16 @@ CbOptions.o: CbOptions.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/Metric.h \
   ../Graphics/Draw.h ../Common/Views.h ../Common/Const.h \
   ../Common/ColorTable.h Widgets.h Pixmaps.h ../Common/Context.h \
-  XContext.h Register.h CbGeneral.h CbOptions.h CbGeom.h CbMesh.h \
-  CbPost.h
+  XContext.h Register.h ../Common/Timer.h CbGeneral.h CbOptions.h \
+  CbGeom.h CbMesh.h CbPost.h
 CbFile.o: CbFile.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
-  ../DataStr/avl.h ../DataStr/Tools.h ../Common/GmshUI.h Main.h \
-  ../Common/Const.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Simplex.h \
-  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/Metric.h \
-  ../Graphics/Draw.h ../Common/Views.h ../Common/ColorTable.h Widgets.h \
-  ../Common/Context.h CbFile.h CbColorbar.h
+  ../DataStr/avl.h ../DataStr/Tools.h ../Common/GmshUI.h \
+  ../Parser/OpenFile.h ../Common/Const.h ../Mesh/Mesh.h ../Mesh/Vertex.h \
+  ../Mesh/Simplex.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h \
+  ../Mesh/Metric.h ../Graphics/Draw.h ../Common/Views.h \
+  ../Common/ColorTable.h Widgets.h ../Common/Context.h CbFile.h \
+  CbColorbar.h
 CbInput.o: CbInput.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Common/GmshUI.h ../Mesh/Mesh.h \
diff --git a/Unix/Message.cpp b/Unix/Message.cpp
index 2a2384822ae340fadf4f424bdbbfdd8def0e2bc2..85fb171efe61569cbe36c238cd36c4a38d9951d3 100644
--- a/Unix/Message.cpp
+++ b/Unix/Message.cpp
@@ -1,4 +1,4 @@
-/* $Id: Message.cpp,v 1.6 2000-11-26 15:43:48 geuzaine Exp $ */
+// $Id: Message.cpp,v 1.7 2001-01-08 08:03:40 geuzaine Exp $
 
 #include <signal.h>
 #include <sys/resource.h>
diff --git a/Unix/Pixmaps.cpp b/Unix/Pixmaps.cpp
index 9fb484432204b900596b0fad2b8308621eb968fd..538497a47820c59fe6bcf08832efd01471099fa3 100644
--- a/Unix/Pixmaps.cpp
+++ b/Unix/Pixmaps.cpp
@@ -1,4 +1,4 @@
-/* $Id: Pixmaps.cpp,v 1.3 2000-11-26 15:43:48 geuzaine Exp $ */
+// $Id: Pixmaps.cpp,v 1.4 2001-01-08 08:03:40 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "GmshUI.h"
diff --git a/Unix/Pixmaps.h b/Unix/Pixmaps.h
index 47e9eeb47a1ca0785adbd9f4e5348c8d32777d12..88b301ef76f55c0d4cba456887d8b24caf8c2e3d 100644
--- a/Unix/Pixmaps.h
+++ b/Unix/Pixmaps.h
@@ -1,4 +1,3 @@
-/* $Id: Pixmaps.h,v 1.2 2000-11-23 14:11:41 geuzaine Exp $ */
 #ifndef _PIXMAPS_H_
 #define _PIXMAPS_H_
 
diff --git a/Unix/Register.cpp b/Unix/Register.cpp
index a62f679e1ae3e912498be79497f2a70eb12a690a..bf4a49455d8f9d6c621e7b412a0267591398b1d0 100644
--- a/Unix/Register.cpp
+++ b/Unix/Register.cpp
@@ -1,4 +1,4 @@
-/* $Id: Register.cpp,v 1.19 2000-12-29 14:04:29 geuzaine Exp $ */
+// $Id: Register.cpp,v 1.20 2001-01-08 08:03:40 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "GmshUI.h"
diff --git a/Unix/Register.h b/Unix/Register.h
index 1803ac7729ea295a2fa38fd8a60f6712903e964f..126a166dc5cc1dc0286b44b8103653490e1f3266 100644
--- a/Unix/Register.h
+++ b/Unix/Register.h
@@ -1,4 +1,3 @@
-/* $Id: Register.h,v 1.5 2000-11-26 15:43:48 geuzaine Exp $ */
 #ifndef _REGISTER_H_
 #define _REGISTER_H_
 
diff --git a/Unix/Widgets.cpp b/Unix/Widgets.cpp
index e5b3ddef1347275b4f83a33ca069cdb35de3f278..d475328422e3e3995f034dad4237939dc3d00589 100644
--- a/Unix/Widgets.cpp
+++ b/Unix/Widgets.cpp
@@ -1,4 +1,4 @@
-/* $Id: Widgets.cpp,v 1.28 2000-12-29 14:04:29 geuzaine Exp $ */
+// $Id: Widgets.cpp,v 1.29 2001-01-08 08:03:41 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "GmshUI.h"
diff --git a/Unix/Widgets.h b/Unix/Widgets.h
index d51fded87a8da886589e33f8a0ba0d2a92ade512..f79631b63de98cc05ba69fc52b7a8fcd104b4a3c 100644
--- a/Unix/Widgets.h
+++ b/Unix/Widgets.h
@@ -1,4 +1,3 @@
-/* $Id: Widgets.h,v 1.11 2000-12-20 15:28:48 geuzaine Exp $ */
 #ifndef _WIDGETS_H_
 #define _WIDGETS_H_
 
diff --git a/Unix/XColors.cpp b/Unix/XColors.cpp
index cdc9c704009c2d3a43b62a289f48188134a31d64..5268e9cc2807a6a6ce65876c7728ff0029438a89 100644
--- a/Unix/XColors.cpp
+++ b/Unix/XColors.cpp
@@ -1,4 +1,5 @@
-/* $Id: XColors.cpp,v 1.4 2000-11-26 15:43:48 geuzaine Exp $ */
+// $Id: XColors.cpp,v 1.5 2001-01-08 08:03:41 geuzaine Exp $
+
 /*
   Attention. Toutes les couleurs sont crees a partir de la colormap de
   l'interface : XCTX.gui.colormap
diff --git a/Unix/XColors.h b/Unix/XColors.h
index 3b1d4de819d78adc5354db6c273b238f4e854649..2a8088dd489eac01fc35595778d51ef58431e4f4 100644
--- a/Unix/XColors.h
+++ b/Unix/XColors.h
@@ -1,4 +1,3 @@
-/* $Id: XColors.h,v 1.2 2000-11-23 14:11:41 geuzaine Exp $ */
 #ifndef _XCOLORS_H_
 #define _XCOLORS_H_
 
diff --git a/Unix/XContext.h b/Unix/XContext.h
index 4f43666d21e928f99504877ded2e930cc80e7849..9ce7d6cdc13a9f9142a877322971771f00ba5c3a 100644
--- a/Unix/XContext.h
+++ b/Unix/XContext.h
@@ -1,4 +1,3 @@
-/* $Id: XContext.h,v 1.3 2000-11-26 15:43:48 geuzaine Exp $ */
 #ifndef _XCONTEXT_H_
 #define _XCONTEXT_H_
 
diff --git a/Unix/XCursor.cpp b/Unix/XCursor.cpp
index 1280df00446dc9d0d279d6d266d08c161146bce6..e7033dc20cf26a2f8b907932680f8941136cc243 100644
--- a/Unix/XCursor.cpp
+++ b/Unix/XCursor.cpp
@@ -1,4 +1,4 @@
-/* $Id: XCursor.cpp,v 1.2 2000-11-23 14:11:41 geuzaine Exp $ */
+// $Id: XCursor.cpp,v 1.3 2001-01-08 08:03:41 geuzaine Exp $
 
 #include <X11/cursorfont.h>
 
diff --git a/Unix/XRessources.h b/Unix/XRessources.h
index 5e0e0de60685c9eb823f0cb103024d5a8bcf8f4d..0901139af98da9b585249913fbbe4651b30b2c58 100644
--- a/Unix/XRessources.h
+++ b/Unix/XRessources.h
@@ -1,5 +1,3 @@
-/* $Id: XRessources.h,v 1.4 2000-12-20 15:28:48 geuzaine Exp $ */
-
 /* 
    Les resources ci-dessous sont prises en compte par defaut. Toutre 
    resource definie dans ~/.gmshrc ou dans APP_DEFAULTS/.gmshrc est 
diff --git a/Unix/XStatic.h b/Unix/XStatic.h
index 2d461e06815d90b9c5742c22594802e3d885ef79..ad1ecb04947395e8fe9dcbb1a8d78f0e6f701856 100644
--- a/Unix/XStatic.h
+++ b/Unix/XStatic.h
@@ -1,4 +1,3 @@
-/* $Id: XStatic.h,v 1.3 2000-11-26 18:43:48 geuzaine Exp $ */
 #ifndef _XSTATIC_H_
 #define _XSTATIC_H_