diff --git a/Box/Box.cpp b/Box/Box.cpp
deleted file mode 100644
index 2bc4bf57af1bb081157d021783f1a9da4339a0cf..0000000000000000000000000000000000000000
--- a/Box/Box.cpp
+++ /dev/null
@@ -1,219 +0,0 @@
-// $Id: Box.cpp,v 1.52 2008-04-28 10:10:51 geuzaine Exp $
-//
-// Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-// 
-// Please report all bugs and problems to <gmsh@geuz.org>.
-
-#include "GModel.h"
-#include "Gmsh.h"
-#include "Message.h"
-#include "Generator.h"
-#include "Parser.h"
-#include "Context.h"
-#include "Options.h"
-#include "OpenFile.h"
-#include "CommandLine.h"
-#include "CreateFile.h"
-#include "ParUtil.h"
-#include "Field.h"
-#include "BackgroundMesh.h"
-
-Context_T CTX;
-
-// Print some help/info messages
-
-static void Info(int level, char *arg0)
-{
-  switch (level) {
-  case 0:
-    if(ParUtil::Instance()->master()) {
-      fprintf(stderr, "%s\n", gmsh_progname);
-      fprintf(stderr, "%s\n", gmsh_copyright);
-      Print_Usage(arg0);
-    }
-    ParUtil::Instance()->Exit();
-  case 1:
-    if(ParUtil::Instance()->master())
-      fprintf(stderr, "%s\n", Get_GmshVersion());
-    ParUtil::Instance()->Exit();
-  case 2:
-    if(ParUtil::Instance()->master()) {
-      fprintf(stderr, "%s%s\n", gmsh_version, Get_GmshVersion());
-      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);
-    }
-    ParUtil::Instance()->Exit();
-  default:
-    break;
-  }
-}
-
-// Main routine for the batch (black box) version
-
-int GMSHBOX(int argc, char *argv[])
-{
-  ParUtil::Instance()->init(argc, argv);
-
-  if(argc < 2) Info(0, argv[0]);
-
-  GmshInitialize(argc, argv);
-
-  new GModel;
-
-  OpenProject(CTX.filename);
-  for(unsigned int i = 1; i < CTX.files.size(); i++)
-    MergeFile(CTX.files[i].c_str());
-#if !defined(HAVE_NO_POST)
-  if(CTX.bgm_filename) {
-    MergeFile(CTX.bgm_filename);
-    if(PView::list.size())
-      GModel::current()->getFields()->set_background_mesh(PView::list.size() - 1);
-    else
-      fprintf(stderr, ERROR_STR "Invalid background mesh (no view)\n");
-  }
-#endif
-  if(CTX.batch > 0) {
-    GModel::current()->mesh(CTX.batch);
-    CreateOutputFile(CTX.output_filename, CTX.mesh.format);
-  }
-  else if(CTX.batch == -1)
-    CreateOutputFile(CTX.output_filename, FORMAT_GEO);
-
-  ParUtil::Instance()->Barrier(__LINE__, __FILE__);
-
-  GmshFinalize();
-  return 1;
-}
-
-// General purpose message routine
-
-void Msg(int level, const char *fmt, ...)
-{
-  va_list args;
-  int abort = 0;
-
-  va_start(args, fmt);
-
-  switch (level) {
-
-  case PROGRESS:
-  case STATUS1N:
-  case STATUS2N:
-    break;
-
-  case DIRECT:
-    if(CTX.verbosity >= 2 && ParUtil::Instance()->master()) {
-      vfprintf(stdout, fmt, args);
-      fprintf(stdout, "\n");
-    }
-    break;
-
-  case FATAL:
-  case FATAL3: abort = 1;
-  case FATAL1:
-  case FATAL2:
-    fprintf(stderr, FATAL_STR);
-    fprintf(stderr, "[on processor %d] ", ParUtil::Instance()->rank());
-    vfprintf(stderr, fmt, args);
-    fprintf(stderr, "\n");
-    break;
-
-  case GERROR:
-  case GERROR1:
-  case GERROR2:
-  case GERROR3:
-    fprintf(stderr, ERROR_STR);
-    fprintf(stderr, "[on processor %d] ", ParUtil::Instance()->rank());
-    vfprintf(stderr, fmt, args);
-    fprintf(stderr, "\n");
-    break;
-
-  case WARNING:
-  case WARNING1:
-  case WARNING2:
-  case WARNING3:
-    if(CTX.verbosity >= 1) {
-      fprintf(stderr, WARNING_STR);
-      fprintf(stderr, "[on processor %d] ", ParUtil::Instance()->rank());
-      vfprintf(stderr, fmt, args);
-      fprintf(stderr, "\n");
-    }
-    break;
-
-  case DEBUG:
-  case DEBUG1:
-  case DEBUG2:
-  case DEBUG3:
-    if(CTX.verbosity >= 4 && ParUtil::Instance()->master()) {
-      fprintf(stderr, DEBUG_STR);
-      vfprintf(stderr, fmt, args);
-      fprintf(stderr, "\n");
-    }
-    break;
-
-  default:
-    if(CTX.verbosity >= 2 && ParUtil::Instance()->master()) {
-      fprintf(stderr, INFO_STR);
-      vfprintf(stderr, fmt, args);
-      fprintf(stderr, "\n");
-    }
-    break;
-  }
-
-  va_end(args);
-
-  if(abort)
-    exit(1);
-}
-
-// interactive value dialog
-
-double GetValue(const char *text, double defaultval)
-{
-  if(CTX.nopopup)
-    return defaultval;
-
-  printf("%s (default=%.16g): ", text, defaultval);
-  char str[256];
-  fgets(str, sizeof(str), stdin);
-  if(!strlen(str) || !strcmp(str, "\n"))
-    return defaultval;
-  else
-    return atof(str);
-}
-
-bool GetBinaryAnswer(const char *question, const char *yes, const char *no, 
-                     bool defaultval)
-{
-  if(CTX.nopopup || CTX.batch)
-    return defaultval;
-
-  char answ[256];
-
-  while(1){
-    printf("%s (%s/%s)",question,yes,no);
-    scanf("%s ",answ);
-    if (!strcmp(answ,yes))return true;
-    if (!strcmp(answ,no))return false;
-  }
-}
-
diff --git a/Box/Main.cpp b/Box/Main.cpp
deleted file mode 100644
index 39487bdff08d1a6e1d6d6e5b0f234a64970790e1..0000000000000000000000000000000000000000
--- a/Box/Main.cpp
+++ /dev/null
@@ -1,6 +0,0 @@
-extern int GMSHBOX(int argc, char *argv[]);
-
-int main(int argc, char *argv[])
-{
-  return GMSHBOX(argc, argv);
-}
diff --git a/Box/Makefile b/Box/Makefile
deleted file mode 100644
index a4e7833609881740dd4b810add2609d23196de0f..0000000000000000000000000000000000000000
--- a/Box/Makefile
+++ /dev/null
@@ -1,79 +0,0 @@
-# $Id: Makefile,v 1.50 2008-04-23 23:00:39 geuzaine Exp $
-#
-# Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-# 
-# Please report all bugs and problems to <gmsh@geuz.org>.
-
-include ../variables
-
-LIB = ../lib/libGmshBox${LIBEXT}
-
-INC = ${DASH}I../Common ${DASH}I../DataStr ${DASH}I../Geo ${DASH}I../Mesh\
-      ${DASH}I../Post ${DASH}I../Graphics ${DASH}I../Numeric ${DASH}I../Parser\
-      ${DASH}I../Fltk ${DASH}I../Plugin ${DASH}I../Parallel\
-      ${DASH}I../contrib/ANN/include
-
-CFLAGS  = ${OPTIM} ${FLAGS} ${INC} ${SYSINCLUDE}
-
-SRC = Box.cpp
-
-OBJ = ${SRC:.cpp=${OBJEXT}}
-
-.SUFFIXES: ${OBJEXT} .cpp
-
-${LIB}: ${OBJ} Main${OBJEXT}
-	${AR} ${ARFLAGS}${LIB} ${OBJ} 
-	${RANLIB} ${LIB}
-
-cpobj: ${OBJ} 
-	cp -f ${OBJ} ../lib/
-
-.cpp${OBJEXT}:
-	${CXX} ${CFLAGS} ${DASH}c $<
-
-clean:
-	rm -f *.o *.obj
-
-depend:
-	(sed '/^# DO NOT DELETE THIS LINE/q' Makefile && \
-	${CXX} -MM ${CFLAGS} ${SRC} \
-	) >Makefile.new
-	cp Makefile Makefile.bak
-	cp Makefile.new Makefile
-	rm -f Makefile.new
-
-# DO NOT DELETE THIS LINE
-Box.o: Box.cpp ../Geo/GModel.h ../Geo/GVertex.h ../Geo/GEntity.h \
-  ../Geo/Range.h ../Geo/SPoint3.h ../Geo/SBoundingBox3d.h \
-  ../Geo/SPoint3.h ../Geo/GPoint.h ../Geo/SPoint2.h ../Geo/GEdge.h \
-  ../Geo/GEntity.h ../Geo/GVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h \
-  ../Geo/SPoint3.h ../Geo/SPoint2.h ../Geo/GFace.h ../Geo/GEntity.h \
-  ../Geo/GPoint.h ../Geo/GEdgeLoop.h ../Geo/GEdge.h ../Geo/SPoint2.h \
-  ../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h ../Geo/GEntity.h \
-  ../Geo/SBoundingBox3d.h ../Common/Gmsh.h ../Common/Message.h \
-  ../Mesh/Generator.h ../Parser/Parser.h ../DataStr/List.h \
-  ../DataStr/Tree.h ../DataStr/avl.h ../Common/Context.h \
-  ../Common/Options.h ../Post/ColorTable.h ../Parser/OpenFile.h \
-  ../Common/CommandLine.h ../Parser/CreateFile.h ../Parallel/ParUtil.h \
-  ../Mesh/Field.h ../Geo/Geo.h ../Common/GmshDefines.h \
-  ../Geo/gmshSurface.h ../Geo/Pair.h ../Geo/Range.h ../Geo/SPoint2.h \
-  ../Geo/SPoint3.h ../Geo/SVector3.h ../Geo/SBoundingBox3d.h \
-  ../Numeric/Numeric.h ../Numeric/NumericEmbedded.h ../Geo/SPoint2.h \
-  ../Geo/ExtrudeParams.h ../Common/SmoothData.h ../Post/PView.h \
-  ../Post/PViewData.h ../Post/PViewOptions.h ../Post/ColorTable.h \
-  ../Mesh/BackgroundMesh.h
diff --git a/Common/CommandLine.cpp b/Common/CommandLine.cpp
index 5c47911f140ed74507d6b15953c0bbf26fbd9b00..cc4a773dd72fcbf5811d4d1224a12f250acc07ca 100644
--- a/Common/CommandLine.cpp
+++ b/Common/CommandLine.cpp
@@ -1,4 +1,4 @@
-// $Id: CommandLine.cpp,v 1.128 2008-04-28 10:10:51 geuzaine Exp $
+// $Id: CommandLine.cpp,v 1.129 2008-05-04 08:31:11 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -74,63 +74,63 @@ void Print_Usage(const char *name)
   // If you make changes in this routine, please also change the
   // texinfo documentation (doc/texinfo/command_line.texi) as well as
   // the man page (doc/gmsh.1)
-  Msg(DIRECT, "Usage: %s [options] [files]", name);
-  Msg(DIRECT, "Geometry options:");
-  Msg(DIRECT, "  -0                    Output unrolled geometry, then exit");
-  Msg(DIRECT, "  -tol float            Set geometrical tolerance");
-  Msg(DIRECT, "Mesh options:");
-  Msg(DIRECT, "  -1, -2, -3            Perform 1D, 2D or 3D mesh generation, then exit");
-  Msg(DIRECT, "  -saveall              Save all elements (discard physical group definitions)");
-  Msg(DIRECT, "  -o file               Specify mesh output file name");
-  Msg(DIRECT, "  -format string        Set output mesh format (msh, msh1, msh2, unv, vrml, stl, mesh,");
-  Msg(DIRECT, "                          bdf, p3d, cgns, med)");
-  Msg(DIRECT, "  -bin                  Use binary format when available");  
-  Msg(DIRECT, "  -algo string          Select mesh algorithm (de, del2d, frontal, iso, netgen, tetgen)");
-  Msg(DIRECT, "  -smooth int           Set number of mesh smoothing steps");
-  Msg(DIRECT, "  -optimize[_netgen]    Optimize quality of tetrahedral elements");
-  Msg(DIRECT, "  -order int            Set mesh order (1, ..., 5)");
-  Msg(DIRECT, "  -optimize_hom         Optimize higher order meshes (in 2D)");
-  Msg(DIRECT, "  -clscale float        Set characteristic length scaling factor");
-  Msg(DIRECT, "  -clmin float          Set minimum characteristic length");
-  Msg(DIRECT, "  -clmax float          Set maximum characteristic length");
-  Msg(DIRECT, "  -clcurv               Compute characteristic lengths from curvatures");
-  Msg(DIRECT, "  -epslc1d              Set the accuracy of the evaluation of the LCFIELD for 1D mesh");
-  Msg(DIRECT, "  -swapangle            Set the treshold angle (in degree) between two adjacent faces");
-  Msg(DIRECT, "                          below which a swap is allowed");
-  Msg(DIRECT, "  -rand float           Set random perturbation factor");
-  Msg(DIRECT, "  -bgm file             Load background mesh from file");
+  Msg::Direct("Usage: %s [options] [files]", name);
+  Msg::Direct("Geometry options:");
+  Msg::Direct("  -0                    Output unrolled geometry, then exit");
+  Msg::Direct("  -tol float            Set geometrical tolerance");
+  Msg::Direct("Mesh options:");
+  Msg::Direct("  -1, -2, -3            Perform 1D, 2D or 3D mesh generation, then exit");
+  Msg::Direct("  -saveall              Save all elements (discard physical group definitions)");
+  Msg::Direct("  -o file               Specify mesh output file name");
+  Msg::Direct("  -format string        Set output mesh format (msh, msh1, msh2, unv, vrml, stl, mesh,");
+  Msg::Direct("                          bdf, p3d, cgns, med)");
+  Msg::Direct("  -bin                  Use binary format when available");  
+  Msg::Direct("  -algo string          Select mesh algorithm (de, del2d, frontal, iso, netgen, tetgen)");
+  Msg::Direct("  -smooth int           Set number of mesh smoothing steps");
+  Msg::Direct("  -optimize[_netgen]    Optimize quality of tetrahedral elements");
+  Msg::Direct("  -order int            Set mesh order (1, ..., 5)");
+  Msg::Direct("  -optimize_hom         Optimize higher order meshes (in 2D)");
+  Msg::Direct("  -clscale float        Set characteristic length scaling factor");
+  Msg::Direct("  -clmin float          Set minimum characteristic length");
+  Msg::Direct("  -clmax float          Set maximum characteristic length");
+  Msg::Direct("  -clcurv               Compute characteristic lengths from curvatures");
+  Msg::Direct("  -epslc1d              Set the accuracy of the evaluation of the LCFIELD for 1D mesh");
+  Msg::Direct("  -swapangle            Set the treshold angle (in degree) between two adjacent faces");
+  Msg::Direct("                          below which a swap is allowed");
+  Msg::Direct("  -rand float           Set random perturbation factor");
+  Msg::Direct("  -bgm file             Load background mesh from file");
 #if defined(HAVE_FLTK)
-  Msg(DIRECT, "Post-processing options:");
-  Msg(DIRECT, "  -noview               Hide all views on startup");
-  Msg(DIRECT, "  -link int             Select link mode between views (0, 1, 2, 3, 4)");
-  Msg(DIRECT, "  -combine              Combine views having identical names into multi-time-step views");
-  Msg(DIRECT, "Display options:");    
-  Msg(DIRECT, "  -nodb                 Disable double buffering");
-  Msg(DIRECT, "  -fontsize int         Specify the font size for the GUI");
-  Msg(DIRECT, "  -theme string         Specify FLTK GUI theme");
-  Msg(DIRECT, "  -display string       Specify display");
+  Msg::Direct("Post-processing options:");
+  Msg::Direct("  -noview               Hide all views on startup");
+  Msg::Direct("  -link int             Select link mode between views (0, 1, 2, 3, 4)");
+  Msg::Direct("  -combine              Combine views having identical names into multi-time-step views");
+  Msg::Direct("Display options:");    
+  Msg::Direct("  -nodb                 Disable double buffering");
+  Msg::Direct("  -fontsize int         Specify the font size for the GUI");
+  Msg::Direct("  -theme string         Specify FLTK GUI theme");
+  Msg::Direct("  -display string       Specify display");
 #endif
-  Msg(DIRECT, "Other options:");      
-  Msg(DIRECT, "  -                     Parse input files, then exit");
+  Msg::Direct("Other options:");      
+  Msg::Direct("  -                     Parse input files, then exit");
 #if defined(HAVE_FLTK)
-  Msg(DIRECT, "  -a, -g, -m, -s, -p    Start in automatic, geometry, mesh, solver or post-processing mode");
+  Msg::Direct("  -a, -g, -m, -s, -p    Start in automatic, geometry, mesh, solver or post-processing mode");
 #endif
-  Msg(DIRECT, "  -pid                  Print process id on stdout");
-  Msg(DIRECT, "  -listen               Always listen to incoming connection requests");
-  Msg(DIRECT, "  -v int                Set verbosity level");
-  Msg(DIRECT, "  -nopopup              Don't popup dialog windows in scripts");
-  Msg(DIRECT, "  -string \"string\"      Parse option string at startup");
-  Msg(DIRECT, "  -option file          Parse option file at startup");
-  Msg(DIRECT, "  -convert files        Convert files into latest binary formats, then exit");
-  Msg(DIRECT, "  -version              Show version number");
-  Msg(DIRECT, "  -info                 Show detailed version information");
-  Msg(DIRECT, "  -help                 Show this message");
+  Msg::Direct("  -pid                  Print process id on stdout");
+  Msg::Direct("  -listen               Always listen to incoming connection requests");
+  Msg::Direct("  -v int                Set verbosity level");
+  Msg::Direct("  -nopopup              Don't popup dialog windows in scripts");
+  Msg::Direct("  -string \"string\"      Parse option string at startup");
+  Msg::Direct("  -option file          Parse option file at startup");
+  Msg::Direct("  -convert files        Convert files into latest binary formats, then exit");
+  Msg::Direct("  -version              Show version number");
+  Msg::Direct("  -info                 Show detailed version information");
+  Msg::Direct("  -help                 Show this message");
 }
 
 char *Get_BuildOptions(void)
 {
-  static int first=1;
-  static char opt[128] = "";
+  static int first = 1;
+  static char opt[256] = "";
   
   if(first){
 #if defined(HAVE_GSL)
@@ -176,6 +176,10 @@ char *Get_BuildOptions(void)
 
 void Get_Options(int argc, char *argv[])
 {
+  // print messages on terminal
+  int terminal = CTX.terminal;
+  CTX.terminal = 1;
+
   // Create a dummy model during option processing so we cannot crash
   // the parser, and so we can load files for -convert
   GModel *dummy = new GModel();
@@ -259,42 +263,32 @@ void Get_Options(int argc, char *argv[])
         i++;
         if(argv[i] != NULL)
           ParseString(argv[i++]);
-        else {
-          fprintf(stderr, ERROR_STR "Missing string\n");
-          exit(1);
-        }
+        else
+	  Msg::Fatal("Missing string");
       }
       else if(!strcmp(argv[i] + 1, "option")) {
         i++;
         if(argv[i] != NULL)
           ParseFile(argv[i++], 1);
-        else {
-          fprintf(stderr, ERROR_STR "Missing file name\n");
-          exit(1);
-        }
+        else
+	  Msg::Fatal("Missing file name");
       }
       else if(!strcmp(argv[i] + 1, "o")) {
         i++;
         if(argv[i] != NULL)
           CTX.output_filename = argv[i++];
-        else {
-          fprintf(stderr, ERROR_STR "Missing file name\n");
-          exit(1);
-        }
+        else
+	  Msg::Fatal("Missing file name");
       }
       else if(!strcmp(argv[i] + 1, "bgm")) {
         i++;
-        if(argv[i] != NULL){
+        if(argv[i] != NULL)
 	  CTX.bgm_filename = argv[i++];
-	}
-	else{
-	  fprintf(stderr, ERROR_STR "Missing file name\n");
-          exit(1);
-        }
+	else
+	  Msg::Fatal("Missing file name");
       }
       else if(!strcmp(argv[i] + 1, "convert")) {
         i++;
-        CTX.terminal = 1;
         CTX.batch = 1;
         while(i < argc) {
           char filename[256];
@@ -316,113 +310,85 @@ void Get_Options(int argc, char *argv[])
           }
           i++;
         }
-        exit(1);
+	Msg::Exit(0);
       }
       else if(!strcmp(argv[i] + 1, "tol")) {
         i++;
         if(argv[i] != NULL)
           CTX.geom.tolerance = atof(argv[i++]);
-        else {
-          fprintf(stderr, ERROR_STR "Missing number\n");
-          exit(1);
-        }
+        else
+	  Msg::Fatal("Missing number");
       }
       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
+	  Msg::Fatal("Missing number");
       }
       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
+	  Msg::Fatal("Missing number");
       }
       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
+	  Msg::Fatal("Missing number");
       }
       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);
-          }
+          if(CTX.mesh.lc_factor <= 0.0)
+	    Msg::Fatal("Characteristic length factor must be > 0");
         }
+        else
+	  Msg::Fatal("Missing number");
       }
       else if(!strcmp(argv[i] + 1, "clmin")) {
         i++;
         if(argv[i] != NULL) {
           CTX.mesh.lc_min = atof(argv[i++]);
-          if(CTX.mesh.lc_min <= 0.0) {
-            fprintf(stderr, ERROR_STR
-                    "Minimum length size must be > 0\n");
-            exit(1);
-          }
-        }
-        else {
-          fprintf(stderr, ERROR_STR "Missing number\n");
-          exit(1);
+          if(CTX.mesh.lc_min <= 0.0)
+	    Msg::Fatal("Minimum length size must be > 0");
         }
+        else
+	  Msg::Fatal("Missing number");
       }
       else if(!strcmp(argv[i] + 1, "clmax")) {
         i++;
         if(argv[i] != NULL) {
           CTX.mesh.lc_max = atof(argv[i++]);
-          if(CTX.mesh.lc_max <= 0.0) {
-            fprintf(stderr, ERROR_STR
-                    "Maximum length size must be > 0\n");
-            exit(1);
-          }
-        }
-        else {
-          fprintf(stderr, ERROR_STR "Missing number\n");
-          exit(1);
+          if(CTX.mesh.lc_max <= 0.0)
+	    Msg::Fatal("Maximum length size must be > 0");
         }
+        else
+          Msg::Fatal("Missing number");
       }
       else if(!strcmp(argv[i] + 1, "epslc1d")) {
         i++;
         if(argv[i] != NULL) {
           CTX.mesh.lc_integration_precision = atof(argv[i++]);
-          if(CTX.mesh.lc_integration_precision <= 0.0) {
-            fprintf(stderr, ERROR_STR 
-                    "Integration Accuraci for evaluation of 1D LC FIELD must be > 0\n");
-            exit(1);
-          }
-        }
-        else {
-          fprintf(stderr, ERROR_STR "Missing number\n");
-          exit(1);
+          if(CTX.mesh.lc_integration_precision <= 0.0)
+	    Msg::Fatal("Integration accuracy must be > 0");
         }
+        else
+	  Msg::Fatal("Missing number");
       }
       else if(!strcmp(argv[i] + 1, "swapangle")) {
         i++;
         if(argv[i] != NULL) {
           CTX.mesh.allow_swap_edge_angle = atof(argv[i++]);
-          if(CTX.mesh.allow_swap_edge_angle <= 0.0) {
-            fprintf(stderr, ERROR_STR "Treshold angle for edge swap  must be > 0\n");
-            exit(1);
-          }
-        }
-        else {
-          fprintf(stderr, ERROR_STR "Missing number\n");
-          exit(1);
+          if(CTX.mesh.allow_swap_edge_angle <= 0.0)
+	    Msg::Fatal("Treshold angle for edge swap must be > 0");
         }
+        else
+	  Msg::Fatal("Missing number");
       }
       else if(!strcmp(argv[i] + 1, "clcurv")) {
         CTX.mesh.lc_from_curvature = 1;
@@ -432,19 +398,15 @@ void Get_Options(int argc, char *argv[])
         i++;
         if(argv[i] != NULL)
           CTX.mesh.nb_smoothing = atoi(argv[i++]);
-        else {
-          fprintf(stderr, ERROR_STR "Missing number\n");
-          exit(1);
-        }
+        else
+	  Msg::Fatal("Missing number");
       }
       else if(!strcmp(argv[i] + 1, "order") || !strcmp(argv[i] + 1, "degree")) {
         i++;
         if(argv[i] != NULL)
           opt_mesh_order(0, GMSH_SET, atof(argv[i++]));
-        else {
-          fprintf(stderr, ERROR_STR "Missing number\n");
-          exit(1);
-        }
+        else
+	  Msg::Fatal("Missing number");
       }
       else if(!strcmp(argv[i] + 1, "c1")) {
         i++;
@@ -453,26 +415,18 @@ void Get_Options(int argc, char *argv[])
       else if(!strcmp(argv[i] + 1, "statreport")) {
         i++;
         CTX.create_append_statreport = 1;
-        if(argv[i] != NULL) {
-          strcpy(CTX.statreport,argv[i]);
-          i++;
-        }
-        else {
-          fprintf(stderr, ERROR_STR "Missing argument\n");
-          exit(1);
-        }
+        if(argv[i] != NULL)
+          strcpy(CTX.statreport, argv[i++]);
+        else
+	  Msg::Fatal("Missing argument");
       }
       else if(!strcmp(argv[i] + 1, "append_statreport")) {
         i++;
         CTX.create_append_statreport = 2;
-        if(argv[i] != NULL) {
-          strcpy(CTX.statreport,argv[i]);
-          i++;
-        }
-        else {
-          fprintf(stderr, ERROR_STR "Missing argument\n");
-          exit(1);
-        }
+        if(argv[i] != NULL)
+          strcpy(CTX.statreport, argv[i++]);
+        else
+	  Msg::Fatal("Missing argument");
       }
       else if(!strcmp(argv[i] + 1, "optimize_hom")) {
         i++;
@@ -507,16 +461,12 @@ void Get_Options(int argc, char *argv[])
             CTX.mesh.format = FORMAT_CGNS;
           else if(!strcmp(argv[i], "med"))
             CTX.mesh.format = FORMAT_MED;
-          else {
-            fprintf(stderr, ERROR_STR "Unknown mesh format\n");
-            exit(1);
-          }
+          else
+	    Msg::Fatal("Unknown mesh format");
           i++;
         }
-        else {
-          fprintf(stderr, ERROR_STR "Missing format\n");
-          exit(1);
-        }
+        else
+	  Msg::Fatal("Missing format");
       }
       else if(!strcmp(argv[i] + 1, "bin")) {
         i++;
@@ -537,16 +487,12 @@ void Get_Options(int argc, char *argv[])
             CTX.mesh.algo2d = ALGO_2D_MESHADAPT;
           else if(!strncmp(argv[i], "del", 3) || !strncmp(argv[i], "iso", 3))
             CTX.mesh.algo2d = ALGO_2D_MESHADAPT_DELAUNAY;
-          else {
-            fprintf(stderr, ERROR_STR "Unknown mesh algorithm\n");
-            exit(1);
-          }
+          else
+	    Msg::Fatal("Unknown mesh algorithm");
           i++;
         }
-        else {
-          fprintf(stderr, ERROR_STR "Missing algorithm\n");
-          exit(1);
-        }
+        else
+	  Msg::Fatal("Missing algorithm");
       }
       else if(!strcmp(argv[i] + 1, "listen")) {
         CTX.solver.listen = 1;
@@ -554,7 +500,7 @@ void Get_Options(int argc, char *argv[])
       }
       else if(!strcmp(argv[i] + 1, "version") || !strcmp(argv[i] + 1, "-version")) {
         fprintf(stderr, "%s\n", GMSH_VERSION);
-        exit(1);
+	Msg::Exit(0);
       }
       else if(!strcmp(argv[i] + 1, "info") || !strcmp(argv[i] + 1, "-info")) {
         fprintf(stderr, "%s%s\n", gmsh_version, GMSH_VERSION);
@@ -572,27 +518,24 @@ void Get_Options(int argc, char *argv[])
         fprintf(stderr, "%s\n", gmsh_packager);
         fprintf(stderr, "%s\n", gmsh_url);
         fprintf(stderr, "%s\n", gmsh_email);
-        exit(1);
+	Msg::Exit(0);
       }
       else if(!strcmp(argv[i] + 1, "help") || !strcmp(argv[i] + 1, "-help")) {
         fprintf(stderr, "%s\n", gmsh_progname);
         fprintf(stderr, "%s\n", gmsh_copyright);
-        CTX.terminal = 1;
         Print_Usage(argv[0]);
-        exit(1);
+	Msg::Exit(0);
       }
       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);
-        }
+	  Msg::SetVerbosity(atoi(argv[i++]));
+        else
+	  Msg::Fatal("Missing number");
       }
 #if defined(HAVE_FLTK)
       else if(!strcmp(argv[i] + 1, "term")) {
-        CTX.terminal = 1;
+        terminal = 1;
         i++;
       }
       else if(!strcmp(argv[i] + 1, "dual")) {
@@ -607,10 +550,8 @@ void Get_Options(int argc, char *argv[])
         i++;
         if(argv[i] != NULL)
           CTX.post.link = atoi(argv[i++]);
-        else {
-          fprintf(stderr, ERROR_STR "Missing number\n");
-          exit(1);
-        }
+        else
+	  Msg::Fatal("Missing number");
       }
       else if(!strcmp(argv[i] + 1, "smoothview")) {
         CTX.post.smooth = 1;
@@ -626,36 +567,24 @@ void Get_Options(int argc, char *argv[])
       }
       else if(!strcmp(argv[i] + 1, "fontsize")) {
         i++;
-        if(argv[i] != NULL) {
-          CTX.fontsize = atoi(argv[i]);
-          i++;
-        }
-        else {
-          fprintf(stderr, ERROR_STR "Missing number\n");
-          exit(1);
-        }
+        if(argv[i] != NULL)
+          CTX.fontsize = atoi(argv[i++]);
+        else
+	  Msg::Fatal("Missing number");
       }
       else if(!strcmp(argv[i] + 1, "theme") || !strcmp(argv[i] + 1, "scheme")) {
         i++;
-        if(argv[i] != NULL) {
-          CTX.gui_theme = argv[i];
-          i++;
-        }
-        else {
-          fprintf(stderr, ERROR_STR "Missing argument\n");
-          exit(1);
-        }
+        if(argv[i] != NULL)
+          CTX.gui_theme = argv[i++];
+        else
+	  Msg::Fatal("Missing argument");
       }
       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);
-        }
+        if(argv[i] != NULL)
+          CTX.display = argv[i++];
+        else
+	  Msg::Fatal("Missing argument");
       }
 #endif
 #if defined(__APPLE__)
@@ -667,10 +596,9 @@ void Get_Options(int argc, char *argv[])
       }
 #endif
       else {
-        fprintf(stderr, "Unknown option '%s'\n", argv[i]);
-        CTX.terminal = 1;
+	Msg::Error("Unknown option '%s'", argv[i]);
         Print_Usage(argv[0]);
-        exit(1);
+	Msg::Exit(1);
       }
 
     }
@@ -686,4 +614,6 @@ void Get_Options(int argc, char *argv[])
     strncpy(CTX.filename, CTX.files[0].c_str(), 255);
 
   delete dummy;
+
+  CTX.terminal = terminal;
 }
diff --git a/Common/Context.h b/Common/Context.h
index b9c77f1f07c489884552c7b011fe9fd4652d006b..2fad261388eba2088268596d32471a3e8f449609 100644
--- a/Common/Context.h
+++ b/Common/Context.h
@@ -76,7 +76,6 @@ class Context_T {
   int system_menu_bar; // use the system menu bar on MacOS?
   int batch; // 0=full gfx; -1=just parse; 1,2,3=batch 1D, 2D, 3D mesh 
   int initial_context; // 0=automatic; 1=geom; 2=mesh; 3=solver; 4=post 
-  int verbosity; // 0=silent -> 3=debug 
   int nopopup; // never popup dialogs in scripts (use default values instead)
   int non_modal_windows; // make all windows "non modal"
   double rot[16]; // current rotation matrix 
diff --git a/Common/Gmsh.cpp b/Common/Gmsh.cpp
index 6a56ac579cd2ac0fb1f80c2c8589e662d3f7db86..c6eda17d78b925daa299099ee961d56956f26fb0 100644
--- a/Common/Gmsh.cpp
+++ b/Common/Gmsh.cpp
@@ -1,4 +1,4 @@
-// $Id: Gmsh.cpp,v 1.5 2008-04-28 10:10:51 geuzaine Exp $
+// $Id: Gmsh.cpp,v 1.6 2008-05-04 08:31:11 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -20,18 +20,31 @@
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
 #include <string>
+#include "GmshDefines.h"
+#include "GModel.h"
+#include "Message.h"
 #include "Parser.h"
+#include "OpenFile.h"
+#include "CreateFile.h"
 #include "Options.h"
 #include "CommandLine.h"
 #include "OS.h"
 #include "Numeric.h"
+#include "Generator.h"
+#include "Field.h"
+#include "Context.h"
 
 #if !defined(HAVE_NO_POST)
 #include "PluginManager.h"
 #endif
 
+Context_T CTX;
+
 int GmshInitialize(int argc, char **argv)
 {
+  // Initialize messages (parallel stuff, etc.)
+  Msg::Init(argc, argv);
+
   // Initialize the symbol tree that will hold variable names in the
   // parser
   InitSymbols();
@@ -55,27 +68,39 @@ int GmshInitialize(int argc, char **argv)
   return 1;
 }
 
-int GmshNewModel()
+int GmshFinalize()
 {
-  // Create a new model and add it to the model list, and make it the
-  // current model
-  return 0;
+  return 1;
 }
 
-int GmshMerge(std::string fileName)
+int GmshBatch()
 {
-  // Merge CAD or mesh data in the current model, or create
-  // post-processing data associated with the current model
-  return 0;
-}
+  if(!GModel::current()) return 0;
 
-int GmshClear()
-{
-  // Destroys all models and post-processing views
-  return 0;
-}
+  OpenProject(CTX.filename);
+  for(unsigned int i = 1; i < CTX.files.size(); i++)
+    MergeFile(CTX.files[i].c_str());
+#if !defined(HAVE_NO_POST)
+  if(CTX.bgm_filename) {
+    MergeFile(CTX.bgm_filename);
+    if(PView::list.size())
+      GModel::current()->getFields()->set_background_mesh(PView::list.size() - 1);
+    else
+      Msg::Error("Invalid background mesh (no view)");
+  }
+#endif
+  if(CTX.batch == 4) {
+    AdaptMesh(GModel::current());
+    CreateOutputFile(CTX.output_filename, CTX.mesh.format);
+  }
+  else if(CTX.batch > 0) {
+    GModel::current()->mesh(CTX.batch);
+    CreateOutputFile(CTX.output_filename, CTX.mesh.format);
+  }
+  else if(CTX.batch == -1)
+    CreateOutputFile(CTX.output_filename, FORMAT_GEO);
+  else if(CTX.batch == -2)
+    GModel::current()->checkMeshCoherence();
 
-int GmshFinalize()
-{
   return 1;
 }
diff --git a/Common/Gmsh.h b/Common/Gmsh.h
index dbf587db048f83533c9e6e261f8eec0ca72d3f58..d2b1b63bd1f81e8b40755d836af6ef29c7c93037 100644
--- a/Common/Gmsh.h
+++ b/Common/Gmsh.h
@@ -21,5 +21,6 @@
 
 int GmshInitialize(int argc, char **argv);
 int GmshFinalize();
+int GmshBatch();
 
 #endif
diff --git a/Common/License.cpp b/Common/License.cpp
index cd996e8c13475ec9243dea9984d12e0998a05d95..dd0ce26944b719121566dda9fd372a771a767a42 100644
--- a/Common/License.cpp
+++ b/Common/License.cpp
@@ -1,4 +1,4 @@
-// $Id: License.cpp,v 1.13 2008-03-20 11:44:02 geuzaine Exp $
+// $Id: License.cpp,v 1.14 2008-05-04 08:31:11 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -23,365 +23,365 @@
 
 void print_license(void)
 {
-  Msg(DIRECT, "Gmsh is provided under the terms of the GNU General Public License");
-  Msg(DIRECT, "(GPL) with the following exception:");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "  The copyright holders of Gmsh give you permission to combine Gmsh");
-  Msg(DIRECT, "  with code included in the standard release of Triangle (written by");
-  Msg(DIRECT, "  Jonathan Shewchuk), TetGen (written by Hang Si) and Netgen (written");
-  Msg(DIRECT, "  by Joachim Schoberl) under their respective licenses. You may copy");
-  Msg(DIRECT, "  and distribute such a system following the terms of the GNU GPL for");
-  Msg(DIRECT, "  Gmsh and the licenses of the other code concerned, provided that you");
-  Msg(DIRECT, "  include the source code of that other code when and as the GNU GPL");
-  Msg(DIRECT, "  requires distribution of source code.");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "  Note that people who make modified versions of Gmsh are not");
-  Msg(DIRECT, "  obligated to grant this special exception for their modified");
-  Msg(DIRECT, "  versions; it is their choice whether to do so. The GNU General");
-  Msg(DIRECT, "  Public License gives permission to release a modified version");
-  Msg(DIRECT, "  without this exception; this exception also makes it possible to");
-  Msg(DIRECT, "  release a modified version which carries forward this exception.");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "End of exception.");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "             GNU GENERAL PUBLIC LICENSE");
-  Msg(DIRECT, "                Version 2, June 1991");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, " Copyright (C) 1989, 1991 Free Software Foundation, Inc.");
-  Msg(DIRECT, " 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA");
-  Msg(DIRECT, " Everyone is permitted to copy and distribute verbatim copies");
-  Msg(DIRECT, " of this license document, but changing it is not allowed.");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "                     Preamble");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "  The licenses for most software are designed to take away your");
-  Msg(DIRECT, "freedom to share and change it.  By contrast, the GNU General Public");
-  Msg(DIRECT, "License is intended to guarantee your freedom to share and change free");
-  Msg(DIRECT, "software--to make sure the software is free for all its users.  This");
-  Msg(DIRECT, "General Public License applies to most of the Free Software");
-  Msg(DIRECT, "Foundation's software and to any other program whose authors commit to");
-  Msg(DIRECT, "using it.  (Some other Free Software Foundation software is covered by");
-  Msg(DIRECT, "the GNU Library General Public License instead.)  You can apply it to");
-  Msg(DIRECT, "your programs, too.");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "  When we speak of free software, we are referring to freedom, not");
-  Msg(DIRECT, "price.  Our General Public Licenses are designed to make sure that you");
-  Msg(DIRECT, "have the freedom to distribute copies of free software (and charge for");
-  Msg(DIRECT, "this service if you wish), that you receive source code or can get it");
-  Msg(DIRECT, "if you want it, that you can change the software or use pieces of it");
-  Msg(DIRECT, "in new free programs; and that you know you can do these things.");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "  To protect your rights, we need to make restrictions that forbid");
-  Msg(DIRECT, "anyone to deny you these rights or to ask you to surrender the rights.");
-  Msg(DIRECT, "These restrictions translate to certain responsibilities for you if you");
-  Msg(DIRECT, "distribute copies of the software, or if you modify it.");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "  For example, if you distribute copies of such a program, whether");
-  Msg(DIRECT, "gratis or for a fee, you must give the recipients all the rights that");
-  Msg(DIRECT, "you have.  You must make sure that they, too, receive or can get the");
-  Msg(DIRECT, "source code.  And you must show them these terms so they know their");
-  Msg(DIRECT, "rights.");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "  We protect your rights with two steps: (1) copyright the software, and");
-  Msg(DIRECT, "(2) offer you this license which gives you legal permission to copy,");
-  Msg(DIRECT, "distribute and/or modify the software.");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "  Also, for each author's protection and ours, we want to make certain");
-  Msg(DIRECT, "that everyone understands that there is no warranty for this free");
-  Msg(DIRECT, "software.  If the software is modified by someone else and passed on, we");
-  Msg(DIRECT, "want its recipients to know that what they have is not the original, so");
-  Msg(DIRECT, "that any problems introduced by others will not reflect on the original");
-  Msg(DIRECT, "authors' reputations.");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "  Finally, any free program is threatened constantly by software");
-  Msg(DIRECT, "patents.  We wish to avoid the danger that redistributors of a free");
-  Msg(DIRECT, "program will individually obtain patent licenses, in effect making the");
-  Msg(DIRECT, "program proprietary.  To prevent this, we have made it clear that any");
-  Msg(DIRECT, "patent must be licensed for everyone's free use or not licensed at all.");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "  The precise terms and conditions for copying, distribution and");
-  Msg(DIRECT, "modification follow.");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "             GNU GENERAL PUBLIC LICENSE");
-  Msg(DIRECT, "   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "  0. This License applies to any program or other work which contains");
-  Msg(DIRECT, "a notice placed by the copyright holder saying it may be distributed");
-  Msg(DIRECT, "under the terms of this General Public License.  The \"Program\", below,");
-  Msg(DIRECT, "refers to any such program or work, and a \"work based on the Program\" ");
-  Msg(DIRECT, "means either the Program or any derivative work under copyright law:");
-  Msg(DIRECT, "that is to say, a work containing the Program or a portion of it,");
-  Msg(DIRECT, "either verbatim or with modifications and/or translated into another");
-  Msg(DIRECT, "language.  (Hereinafter, translation is included without limitation in");
-  Msg(DIRECT, "the term \"modification\".)  Each licensee is addressed as \"you\".");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "Activities other than copying, distribution and modification are not");
-  Msg(DIRECT, "covered by this License; they are outside its scope.  The act of");
-  Msg(DIRECT, "running the Program is not restricted, and the output from the Program");
-  Msg(DIRECT, "is covered only if its contents constitute a work based on the");
-  Msg(DIRECT, "Program (independent of having been made by running the Program).");
-  Msg(DIRECT, "Whether that is true depends on what the Program does.");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "  1. You may copy and distribute verbatim copies of the Program's");
-  Msg(DIRECT, "source code as you receive it, in any medium, provided that you");
-  Msg(DIRECT, "conspicuously and appropriately publish on each copy an appropriate");
-  Msg(DIRECT, "copyright notice and disclaimer of warranty; keep intact all the");
-  Msg(DIRECT, "notices that refer to this License and to the absence of any warranty;");
-  Msg(DIRECT, "and give any other recipients of the Program a copy of this License");
-  Msg(DIRECT, "along with the Program.");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "You may charge a fee for the physical act of transferring a copy, and");
-  Msg(DIRECT, "you may at your option offer warranty protection in exchange for a fee.");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "  2. You may modify your copy or copies of the Program or any portion");
-  Msg(DIRECT, "of it, thus forming a work based on the Program, and copy and");
-  Msg(DIRECT, "distribute such modifications or work under the terms of Section 1");
-  Msg(DIRECT, "above, provided that you also meet all of these conditions:");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "    a) You must cause the modified files to carry prominent notices");
-  Msg(DIRECT, "    stating that you changed the files and the date of any change.");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "    b) You must cause any work that you distribute or publish, that in");
-  Msg(DIRECT, "    whole or in part contains or is derived from the Program or any");
-  Msg(DIRECT, "    part thereof, to be licensed as a whole at no charge to all third");
-  Msg(DIRECT, "    parties under the terms of this License.");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "    c) If the modified program normally reads commands interactively");
-  Msg(DIRECT, "    when run, you must cause it, when started running for such");
-  Msg(DIRECT, "    interactive use in the most ordinary way, to print or display an");
-  Msg(DIRECT, "    announcement including an appropriate copyright notice and a");
-  Msg(DIRECT, "    notice that there is no warranty (or else, saying that you provide");
-  Msg(DIRECT, "    a warranty) and that users may redistribute the program under");
-  Msg(DIRECT, "    these conditions, and telling the user how to view a copy of this");
-  Msg(DIRECT, "    License.  (Exception: if the Program itself is interactive but");
-  Msg(DIRECT, "    does not normally print such an announcement, your work based on");
-  Msg(DIRECT, "    the Program is not required to print an announcement.)");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "These requirements apply to the modified work as a whole.  If");
-  Msg(DIRECT, "identifiable sections of that work are not derived from the Program,");
-  Msg(DIRECT, "and can be reasonably considered independent and separate works in");
-  Msg(DIRECT, "themselves, then this License, and its terms, do not apply to those");
-  Msg(DIRECT, "sections when you distribute them as separate works.  But when you");
-  Msg(DIRECT, "distribute the same sections as part of a whole which is a work based");
-  Msg(DIRECT, "on the Program, the distribution of the whole must be on the terms of");
-  Msg(DIRECT, "this License, whose permissions for other licensees extend to the");
-  Msg(DIRECT, "entire whole, and thus to each and every part regardless of who wrote it.");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "Thus, it is not the intent of this section to claim rights or contest");
-  Msg(DIRECT, "your rights to work written entirely by you; rather, the intent is to");
-  Msg(DIRECT, "exercise the right to control the distribution of derivative or");
-  Msg(DIRECT, "collective works based on the Program.");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "In addition, mere aggregation of another work not based on the Program");
-  Msg(DIRECT, "with the Program (or with a work based on the Program) on a volume of");
-  Msg(DIRECT, "a storage or distribution medium does not bring the other work under");
-  Msg(DIRECT, "the scope of this License.");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "  3. You may copy and distribute the Program (or a work based on it,");
-  Msg(DIRECT, "under Section 2) in object code or executable form under the terms of");
-  Msg(DIRECT, "Sections 1 and 2 above provided that you also do one of the following:");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "    a) Accompany it with the complete corresponding machine-readable");
-  Msg(DIRECT, "    source code, which must be distributed under the terms of Sections");
-  Msg(DIRECT, "    1 and 2 above on a medium customarily used for software interchange; or,");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "    b) Accompany it with a written offer, valid for at least three");
-  Msg(DIRECT, "    years, to give any third party, for a charge no more than your");
-  Msg(DIRECT, "    cost of physically performing source distribution, a complete");
-  Msg(DIRECT, "    machine-readable copy of the corresponding source code, to be");
-  Msg(DIRECT, "    distributed under the terms of Sections 1 and 2 above on a medium");
-  Msg(DIRECT, "    customarily used for software interchange; or,");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "    c) Accompany it with the information you received as to the offer");
-  Msg(DIRECT, "    to distribute corresponding source code.  (This alternative is");
-  Msg(DIRECT, "    allowed only for noncommercial distribution and only if you");
-  Msg(DIRECT, "    received the program in object code or executable form with such");
-  Msg(DIRECT, "    an offer, in accord with Subsection b above.)");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "The source code for a work means the preferred form of the work for");
-  Msg(DIRECT, "making modifications to it.  For an executable work, complete source");
-  Msg(DIRECT, "code means all the source code for all modules it contains, plus any");
-  Msg(DIRECT, "associated interface definition files, plus the scripts used to");
-  Msg(DIRECT, "control compilation and installation of the executable.  However, as a");
-  Msg(DIRECT, "special exception, the source code distributed need not include");
-  Msg(DIRECT, "anything that is normally distributed (in either source or binary");
-  Msg(DIRECT, "form) with the major components (compiler, kernel, and so on) of the");
-  Msg(DIRECT, "operating system on which the executable runs, unless that component");
-  Msg(DIRECT, "itself accompanies the executable.");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "If distribution of executable or object code is made by offering");
-  Msg(DIRECT, "access to copy from a designated place, then offering equivalent");
-  Msg(DIRECT, "access to copy the source code from the same place counts as");
-  Msg(DIRECT, "distribution of the source code, even though third parties are not");
-  Msg(DIRECT, "compelled to copy the source along with the object code.");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "  4. You may not copy, modify, sublicense, or distribute the Program");
-  Msg(DIRECT, "except as expressly provided under this License.  Any attempt");
-  Msg(DIRECT, "otherwise to copy, modify, sublicense or distribute the Program is");
-  Msg(DIRECT, "void, and will automatically terminate your rights under this License.");
-  Msg(DIRECT, "However, parties who have received copies, or rights, from you under");
-  Msg(DIRECT, "this License will not have their licenses terminated so long as such");
-  Msg(DIRECT, "parties remain in full compliance.");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "  5. You are not required to accept this License, since you have not");
-  Msg(DIRECT, "signed it.  However, nothing else grants you permission to modify or");
-  Msg(DIRECT, "distribute the Program or its derivative works.  These actions are");
-  Msg(DIRECT, "prohibited by law if you do not accept this License.  Therefore, by");
-  Msg(DIRECT, "modifying or distributing the Program (or any work based on the");
-  Msg(DIRECT, "Program), you indicate your acceptance of this License to do so, and");
-  Msg(DIRECT, "all its terms and conditions for copying, distributing or modifying");
-  Msg(DIRECT, "the Program or works based on it.");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "  6. Each time you redistribute the Program (or any work based on the");
-  Msg(DIRECT, "Program), the recipient automatically receives a license from the");
-  Msg(DIRECT, "original licensor to copy, distribute or modify the Program subject to");
-  Msg(DIRECT, "these terms and conditions.  You may not impose any further");
-  Msg(DIRECT, "restrictions on the recipients' exercise of the rights granted herein.");
-  Msg(DIRECT, "You are not responsible for enforcing compliance by third parties to");
-  Msg(DIRECT, "this License.");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "  7. If, as a consequence of a court judgment or allegation of patent");
-  Msg(DIRECT, "infringement or for any other reason (not limited to patent issues),");
-  Msg(DIRECT, "conditions are imposed on you (whether by court order, agreement or");
-  Msg(DIRECT, "otherwise) that contradict the conditions of this License, they do not");
-  Msg(DIRECT, "excuse you from the conditions of this License.  If you cannot");
-  Msg(DIRECT, "distribute so as to satisfy simultaneously your obligations under this");
-  Msg(DIRECT, "License and any other pertinent obligations, then as a consequence you");
-  Msg(DIRECT, "may not distribute the Program at all.  For example, if a patent");
-  Msg(DIRECT, "license would not permit royalty-free redistribution of the Program by");
-  Msg(DIRECT, "all those who receive copies directly or indirectly through you, then");
-  Msg(DIRECT, "the only way you could satisfy both it and this License would be to");
-  Msg(DIRECT, "refrain entirely from distribution of the Program.");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "If any portion of this section is held invalid or unenforceable under");
-  Msg(DIRECT, "any particular circumstance, the balance of the section is intended to");
-  Msg(DIRECT, "apply and the section as a whole is intended to apply in other");
-  Msg(DIRECT, "circumstances.");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "It is not the purpose of this section to induce you to infringe any");
-  Msg(DIRECT, "patents or other property right claims or to contest validity of any");
-  Msg(DIRECT, "such claims; this section has the sole purpose of protecting the");
-  Msg(DIRECT, "integrity of the free software distribution system, which is");
-  Msg(DIRECT, "implemented by public license practices.  Many people have made");
-  Msg(DIRECT, "generous contributions to the wide range of software distributed");
-  Msg(DIRECT, "through that system in reliance on consistent application of that");
-  Msg(DIRECT, "system; it is up to the author/donor to decide if he or she is willing");
-  Msg(DIRECT, "to distribute software through any other system and a licensee cannot");
-  Msg(DIRECT, "impose that choice.");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "This section is intended to make thoroughly clear what is believed to");
-  Msg(DIRECT, "be a consequence of the rest of this License.");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "  8. If the distribution and/or use of the Program is restricted in");
-  Msg(DIRECT, "certain countries either by patents or by copyrighted interfaces, the");
-  Msg(DIRECT, "original copyright holder who places the Program under this License");
-  Msg(DIRECT, "may add an explicit geographical distribution limitation excluding");
-  Msg(DIRECT, "those countries, so that distribution is permitted only in or among");
-  Msg(DIRECT, "countries not thus excluded.  In such case, this License incorporates");
-  Msg(DIRECT, "the limitation as if written in the body of this License.");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "  9. The Free Software Foundation may publish revised and/or new versions");
-  Msg(DIRECT, "of the General Public License from time to time.  Such new versions will");
-  Msg(DIRECT, "be similar in spirit to the present version, but may differ in detail to");
-  Msg(DIRECT, "address new problems or concerns.");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "Each version is given a distinguishing version number.  If the Program");
-  Msg(DIRECT, "specifies a version number of this License which applies to it and \"any");
-  Msg(DIRECT, "later version\", you have the option of following the terms and conditions");
-  Msg(DIRECT, "either of that version or of any later version published by the Free");
-  Msg(DIRECT, "Software Foundation.  If the Program does not specify a version number of");
-  Msg(DIRECT, "this License, you may choose any version ever published by the Free Software");
-  Msg(DIRECT, "Foundation.");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "  10. If you wish to incorporate parts of the Program into other free");
-  Msg(DIRECT, "programs whose distribution conditions are different, write to the author");
-  Msg(DIRECT, "to ask for permission.  For software which is copyrighted by the Free");
-  Msg(DIRECT, "Software Foundation, write to the Free Software Foundation; we sometimes");
-  Msg(DIRECT, "make exceptions for this.  Our decision will be guided by the two goals");
-  Msg(DIRECT, "of preserving the free status of all derivatives of our free software and");
-  Msg(DIRECT, "of promoting the sharing and reuse of software generally.");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "                     NO WARRANTY");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY");
-  Msg(DIRECT, "FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN");
-  Msg(DIRECT, "OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES");
-  Msg(DIRECT, "PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED");
-  Msg(DIRECT, "OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF");
-  Msg(DIRECT, "MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS");
-  Msg(DIRECT, "TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE");
-  Msg(DIRECT, "PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,");
-  Msg(DIRECT, "REPAIR OR CORRECTION.");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING");
-  Msg(DIRECT, "WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR");
-  Msg(DIRECT, "REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,");
-  Msg(DIRECT, "INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING");
-  Msg(DIRECT, "OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED");
-  Msg(DIRECT, "TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY");
-  Msg(DIRECT, "YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER");
-  Msg(DIRECT, "PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE");
-  Msg(DIRECT, "POSSIBILITY OF SUCH DAMAGES.");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "              END OF TERMS AND CONDITIONS");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "     How to Apply These Terms to Your New Programs");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "  If you develop a new program, and you want it to be of the greatest");
-  Msg(DIRECT, "possible use to the public, the best way to achieve this is to make it");
-  Msg(DIRECT, "free software which everyone can redistribute and change under these terms.");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "  To do so, attach the following notices to the program.  It is safest");
-  Msg(DIRECT, "to attach them to the start of each source file to most effectively");
-  Msg(DIRECT, "convey the exclusion of warranty; and each file should have at least");
-  Msg(DIRECT, "the \"copyright\" line and a pointer to where the full notice is found.");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "    <one line to give the program's name and a brief idea of what it does.>");
-  Msg(DIRECT, "    Copyright (C) <year>  <name of author>");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "    This program is free software; you can redistribute it and/or modify");
-  Msg(DIRECT, "    it under the terms of the GNU General Public License as published by");
-  Msg(DIRECT, "    the Free Software Foundation; either version 2 of the License, or");
-  Msg(DIRECT, "    (at your option) any later version.");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "    This program is distributed in the hope that it will be useful,");
-  Msg(DIRECT, "    but WITHOUT ANY WARRANTY; without even the implied warranty of");
-  Msg(DIRECT, "    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the");
-  Msg(DIRECT, "    GNU General Public License for more details.");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "    You should have received a copy of the GNU General Public License");
-  Msg(DIRECT, "    along with this program; if not, write to the Free Software");
-  Msg(DIRECT, "    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "Also add information on how to contact you by electronic and paper mail.");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "If the program is interactive, make it output a short notice like this");
-  Msg(DIRECT, "when it starts in an interactive mode:");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "    Gnomovision version 69, Copyright (C) year name of author");
-  Msg(DIRECT, "    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.");
-  Msg(DIRECT, "    This is free software, and you are welcome to redistribute it");
-  Msg(DIRECT, "    under certain conditions; type `show c' for details.");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "The hypothetical commands `show w' and `show c' should show the appropriate");
-  Msg(DIRECT, "parts of the General Public License.  Of course, the commands you use may");
-  Msg(DIRECT, "be called something other than `show w' and `show c'; they could even be");
-  Msg(DIRECT, "mouse-clicks or menu items--whatever suits your program.");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "You should also get your employer (if you work as a programmer) or your");
-  Msg(DIRECT, "school, if any, to sign a \"copyright disclaimer\" for the program, if");
-  Msg(DIRECT, "necessary.  Here is a sample; alter the names:");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "  Yoyodyne, Inc., hereby disclaims all copyright interest in the program");
-  Msg(DIRECT, "  `Gnomovision' (which makes passes at compilers) written by James Hacker.");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "  <signature of Ty Coon>, 1 April 1989");
-  Msg(DIRECT, "  Ty Coon, President of Vice");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "This General Public License does not permit incorporating your program into");
-  Msg(DIRECT, "proprietary programs.  If your program is a subroutine library, you may");
-  Msg(DIRECT, "consider it more useful to permit linking proprietary applications with the");
-  Msg(DIRECT, "library.  If this is what you want to do, use the GNU Library General");
-  Msg(DIRECT, "Public License instead of this License.");
+  Msg::Direct("Gmsh is provided under the terms of the GNU General Public License");
+  Msg::Direct("(GPL) with the following exception:");
+  Msg::Direct(" ");
+  Msg::Direct("  The copyright holders of Gmsh give you permission to combine Gmsh");
+  Msg::Direct("  with code included in the standard release of Triangle (written by");
+  Msg::Direct("  Jonathan Shewchuk), TetGen (written by Hang Si) and Netgen (written");
+  Msg::Direct("  by Joachim Schoberl) under their respective licenses. You may copy");
+  Msg::Direct("  and distribute such a system following the terms of the GNU GPL for");
+  Msg::Direct("  Gmsh and the licenses of the other code concerned, provided that you");
+  Msg::Direct("  include the source code of that other code when and as the GNU GPL");
+  Msg::Direct("  requires distribution of source code.");
+  Msg::Direct(" ");
+  Msg::Direct("  Note that people who make modified versions of Gmsh are not");
+  Msg::Direct("  obligated to grant this special exception for their modified");
+  Msg::Direct("  versions; it is their choice whether to do so. The GNU General");
+  Msg::Direct("  Public License gives permission to release a modified version");
+  Msg::Direct("  without this exception; this exception also makes it possible to");
+  Msg::Direct("  release a modified version which carries forward this exception.");
+  Msg::Direct(" ");
+  Msg::Direct("End of exception.");
+  Msg::Direct(" ");
+  Msg::Direct("             GNU GENERAL PUBLIC LICENSE");
+  Msg::Direct("                Version 2, June 1991");
+  Msg::Direct(" ");
+  Msg::Direct(" Copyright (C) 1989, 1991 Free Software Foundation, Inc.");
+  Msg::Direct(" 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA");
+  Msg::Direct(" Everyone is permitted to copy and distribute verbatim copies");
+  Msg::Direct(" of this license document, but changing it is not allowed.");
+  Msg::Direct(" ");
+  Msg::Direct("                     Preamble");
+  Msg::Direct(" ");
+  Msg::Direct("  The licenses for most software are designed to take away your");
+  Msg::Direct("freedom to share and change it.  By contrast, the GNU General Public");
+  Msg::Direct("License is intended to guarantee your freedom to share and change free");
+  Msg::Direct("software--to make sure the software is free for all its users.  This");
+  Msg::Direct("General Public License applies to most of the Free Software");
+  Msg::Direct("Foundation's software and to any other program whose authors commit to");
+  Msg::Direct("using it.  (Some other Free Software Foundation software is covered by");
+  Msg::Direct("the GNU Library General Public License instead.)  You can apply it to");
+  Msg::Direct("your programs, too.");
+  Msg::Direct(" ");
+  Msg::Direct("  When we speak of free software, we are referring to freedom, not");
+  Msg::Direct("price.  Our General Public Licenses are designed to make sure that you");
+  Msg::Direct("have the freedom to distribute copies of free software (and charge for");
+  Msg::Direct("this service if you wish), that you receive source code or can get it");
+  Msg::Direct("if you want it, that you can change the software or use pieces of it");
+  Msg::Direct("in new free programs; and that you know you can do these things.");
+  Msg::Direct(" ");
+  Msg::Direct("  To protect your rights, we need to make restrictions that forbid");
+  Msg::Direct("anyone to deny you these rights or to ask you to surrender the rights.");
+  Msg::Direct("These restrictions translate to certain responsibilities for you if you");
+  Msg::Direct("distribute copies of the software, or if you modify it.");
+  Msg::Direct(" ");
+  Msg::Direct("  For example, if you distribute copies of such a program, whether");
+  Msg::Direct("gratis or for a fee, you must give the recipients all the rights that");
+  Msg::Direct("you have.  You must make sure that they, too, receive or can get the");
+  Msg::Direct("source code.  And you must show them these terms so they know their");
+  Msg::Direct("rights.");
+  Msg::Direct(" ");
+  Msg::Direct("  We protect your rights with two steps: (1) copyright the software, and");
+  Msg::Direct("(2) offer you this license which gives you legal permission to copy,");
+  Msg::Direct("distribute and/or modify the software.");
+  Msg::Direct(" ");
+  Msg::Direct("  Also, for each author's protection and ours, we want to make certain");
+  Msg::Direct("that everyone understands that there is no warranty for this free");
+  Msg::Direct("software.  If the software is modified by someone else and passed on, we");
+  Msg::Direct("want its recipients to know that what they have is not the original, so");
+  Msg::Direct("that any problems introduced by others will not reflect on the original");
+  Msg::Direct("authors' reputations.");
+  Msg::Direct(" ");
+  Msg::Direct("  Finally, any free program is threatened constantly by software");
+  Msg::Direct("patents.  We wish to avoid the danger that redistributors of a free");
+  Msg::Direct("program will individually obtain patent licenses, in effect making the");
+  Msg::Direct("program proprietary.  To prevent this, we have made it clear that any");
+  Msg::Direct("patent must be licensed for everyone's free use or not licensed at all.");
+  Msg::Direct(" ");
+  Msg::Direct("  The precise terms and conditions for copying, distribution and");
+  Msg::Direct("modification follow.");
+  Msg::Direct(" ");
+  Msg::Direct("             GNU GENERAL PUBLIC LICENSE");
+  Msg::Direct("   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION");
+  Msg::Direct(" ");
+  Msg::Direct("  0. This License applies to any program or other work which contains");
+  Msg::Direct("a notice placed by the copyright holder saying it may be distributed");
+  Msg::Direct("under the terms of this General Public License.  The \"Program\", below,");
+  Msg::Direct("refers to any such program or work, and a \"work based on the Program\" ");
+  Msg::Direct("means either the Program or any derivative work under copyright law:");
+  Msg::Direct("that is to say, a work containing the Program or a portion of it,");
+  Msg::Direct("either verbatim or with modifications and/or translated into another");
+  Msg::Direct("language.  (Hereinafter, translation is included without limitation in");
+  Msg::Direct("the term \"modification\".)  Each licensee is addressed as \"you\".");
+  Msg::Direct(" ");
+  Msg::Direct("Activities other than copying, distribution and modification are not");
+  Msg::Direct("covered by this License; they are outside its scope.  The act of");
+  Msg::Direct("running the Program is not restricted, and the output from the Program");
+  Msg::Direct("is covered only if its contents constitute a work based on the");
+  Msg::Direct("Program (independent of having been made by running the Program).");
+  Msg::Direct("Whether that is true depends on what the Program does.");
+  Msg::Direct(" ");
+  Msg::Direct("  1. You may copy and distribute verbatim copies of the Program's");
+  Msg::Direct("source code as you receive it, in any medium, provided that you");
+  Msg::Direct("conspicuously and appropriately publish on each copy an appropriate");
+  Msg::Direct("copyright notice and disclaimer of warranty; keep intact all the");
+  Msg::Direct("notices that refer to this License and to the absence of any warranty;");
+  Msg::Direct("and give any other recipients of the Program a copy of this License");
+  Msg::Direct("along with the Program.");
+  Msg::Direct(" ");
+  Msg::Direct("You may charge a fee for the physical act of transferring a copy, and");
+  Msg::Direct("you may at your option offer warranty protection in exchange for a fee.");
+  Msg::Direct(" ");
+  Msg::Direct("  2. You may modify your copy or copies of the Program or any portion");
+  Msg::Direct("of it, thus forming a work based on the Program, and copy and");
+  Msg::Direct("distribute such modifications or work under the terms of Section 1");
+  Msg::Direct("above, provided that you also meet all of these conditions:");
+  Msg::Direct(" ");
+  Msg::Direct("    a) You must cause the modified files to carry prominent notices");
+  Msg::Direct("    stating that you changed the files and the date of any change.");
+  Msg::Direct(" ");
+  Msg::Direct("    b) You must cause any work that you distribute or publish, that in");
+  Msg::Direct("    whole or in part contains or is derived from the Program or any");
+  Msg::Direct("    part thereof, to be licensed as a whole at no charge to all third");
+  Msg::Direct("    parties under the terms of this License.");
+  Msg::Direct(" ");
+  Msg::Direct("    c) If the modified program normally reads commands interactively");
+  Msg::Direct("    when run, you must cause it, when started running for such");
+  Msg::Direct("    interactive use in the most ordinary way, to print or display an");
+  Msg::Direct("    announcement including an appropriate copyright notice and a");
+  Msg::Direct("    notice that there is no warranty (or else, saying that you provide");
+  Msg::Direct("    a warranty) and that users may redistribute the program under");
+  Msg::Direct("    these conditions, and telling the user how to view a copy of this");
+  Msg::Direct("    License.  (Exception: if the Program itself is interactive but");
+  Msg::Direct("    does not normally print such an announcement, your work based on");
+  Msg::Direct("    the Program is not required to print an announcement.)");
+  Msg::Direct(" ");
+  Msg::Direct("These requirements apply to the modified work as a whole.  If");
+  Msg::Direct("identifiable sections of that work are not derived from the Program,");
+  Msg::Direct("and can be reasonably considered independent and separate works in");
+  Msg::Direct("themselves, then this License, and its terms, do not apply to those");
+  Msg::Direct("sections when you distribute them as separate works.  But when you");
+  Msg::Direct("distribute the same sections as part of a whole which is a work based");
+  Msg::Direct("on the Program, the distribution of the whole must be on the terms of");
+  Msg::Direct("this License, whose permissions for other licensees extend to the");
+  Msg::Direct("entire whole, and thus to each and every part regardless of who wrote it.");
+  Msg::Direct(" ");
+  Msg::Direct("Thus, it is not the intent of this section to claim rights or contest");
+  Msg::Direct("your rights to work written entirely by you; rather, the intent is to");
+  Msg::Direct("exercise the right to control the distribution of derivative or");
+  Msg::Direct("collective works based on the Program.");
+  Msg::Direct(" ");
+  Msg::Direct("In addition, mere aggregation of another work not based on the Program");
+  Msg::Direct("with the Program (or with a work based on the Program) on a volume of");
+  Msg::Direct("a storage or distribution medium does not bring the other work under");
+  Msg::Direct("the scope of this License.");
+  Msg::Direct(" ");
+  Msg::Direct("  3. You may copy and distribute the Program (or a work based on it,");
+  Msg::Direct("under Section 2) in object code or executable form under the terms of");
+  Msg::Direct("Sections 1 and 2 above provided that you also do one of the following:");
+  Msg::Direct(" ");
+  Msg::Direct("    a) Accompany it with the complete corresponding machine-readable");
+  Msg::Direct("    source code, which must be distributed under the terms of Sections");
+  Msg::Direct("    1 and 2 above on a medium customarily used for software interchange; or,");
+  Msg::Direct(" ");
+  Msg::Direct("    b) Accompany it with a written offer, valid for at least three");
+  Msg::Direct("    years, to give any third party, for a charge no more than your");
+  Msg::Direct("    cost of physically performing source distribution, a complete");
+  Msg::Direct("    machine-readable copy of the corresponding source code, to be");
+  Msg::Direct("    distributed under the terms of Sections 1 and 2 above on a medium");
+  Msg::Direct("    customarily used for software interchange; or,");
+  Msg::Direct(" ");
+  Msg::Direct("    c) Accompany it with the information you received as to the offer");
+  Msg::Direct("    to distribute corresponding source code.  (This alternative is");
+  Msg::Direct("    allowed only for noncommercial distribution and only if you");
+  Msg::Direct("    received the program in object code or executable form with such");
+  Msg::Direct("    an offer, in accord with Subsection b above.)");
+  Msg::Direct(" ");
+  Msg::Direct("The source code for a work means the preferred form of the work for");
+  Msg::Direct("making modifications to it.  For an executable work, complete source");
+  Msg::Direct("code means all the source code for all modules it contains, plus any");
+  Msg::Direct("associated interface definition files, plus the scripts used to");
+  Msg::Direct("control compilation and installation of the executable.  However, as a");
+  Msg::Direct("special exception, the source code distributed need not include");
+  Msg::Direct("anything that is normally distributed (in either source or binary");
+  Msg::Direct("form) with the major components (compiler, kernel, and so on) of the");
+  Msg::Direct("operating system on which the executable runs, unless that component");
+  Msg::Direct("itself accompanies the executable.");
+  Msg::Direct(" ");
+  Msg::Direct("If distribution of executable or object code is made by offering");
+  Msg::Direct("access to copy from a designated place, then offering equivalent");
+  Msg::Direct("access to copy the source code from the same place counts as");
+  Msg::Direct("distribution of the source code, even though third parties are not");
+  Msg::Direct("compelled to copy the source along with the object code.");
+  Msg::Direct(" ");
+  Msg::Direct("  4. You may not copy, modify, sublicense, or distribute the Program");
+  Msg::Direct("except as expressly provided under this License.  Any attempt");
+  Msg::Direct("otherwise to copy, modify, sublicense or distribute the Program is");
+  Msg::Direct("void, and will automatically terminate your rights under this License.");
+  Msg::Direct("However, parties who have received copies, or rights, from you under");
+  Msg::Direct("this License will not have their licenses terminated so long as such");
+  Msg::Direct("parties remain in full compliance.");
+  Msg::Direct(" ");
+  Msg::Direct("  5. You are not required to accept this License, since you have not");
+  Msg::Direct("signed it.  However, nothing else grants you permission to modify or");
+  Msg::Direct("distribute the Program or its derivative works.  These actions are");
+  Msg::Direct("prohibited by law if you do not accept this License.  Therefore, by");
+  Msg::Direct("modifying or distributing the Program (or any work based on the");
+  Msg::Direct("Program), you indicate your acceptance of this License to do so, and");
+  Msg::Direct("all its terms and conditions for copying, distributing or modifying");
+  Msg::Direct("the Program or works based on it.");
+  Msg::Direct(" ");
+  Msg::Direct("  6. Each time you redistribute the Program (or any work based on the");
+  Msg::Direct("Program), the recipient automatically receives a license from the");
+  Msg::Direct("original licensor to copy, distribute or modify the Program subject to");
+  Msg::Direct("these terms and conditions.  You may not impose any further");
+  Msg::Direct("restrictions on the recipients' exercise of the rights granted herein.");
+  Msg::Direct("You are not responsible for enforcing compliance by third parties to");
+  Msg::Direct("this License.");
+  Msg::Direct(" ");
+  Msg::Direct("  7. If, as a consequence of a court judgment or allegation of patent");
+  Msg::Direct("infringement or for any other reason (not limited to patent issues),");
+  Msg::Direct("conditions are imposed on you (whether by court order, agreement or");
+  Msg::Direct("otherwise) that contradict the conditions of this License, they do not");
+  Msg::Direct("excuse you from the conditions of this License.  If you cannot");
+  Msg::Direct("distribute so as to satisfy simultaneously your obligations under this");
+  Msg::Direct("License and any other pertinent obligations, then as a consequence you");
+  Msg::Direct("may not distribute the Program at all.  For example, if a patent");
+  Msg::Direct("license would not permit royalty-free redistribution of the Program by");
+  Msg::Direct("all those who receive copies directly or indirectly through you, then");
+  Msg::Direct("the only way you could satisfy both it and this License would be to");
+  Msg::Direct("refrain entirely from distribution of the Program.");
+  Msg::Direct(" ");
+  Msg::Direct("If any portion of this section is held invalid or unenforceable under");
+  Msg::Direct("any particular circumstance, the balance of the section is intended to");
+  Msg::Direct("apply and the section as a whole is intended to apply in other");
+  Msg::Direct("circumstances.");
+  Msg::Direct(" ");
+  Msg::Direct("It is not the purpose of this section to induce you to infringe any");
+  Msg::Direct("patents or other property right claims or to contest validity of any");
+  Msg::Direct("such claims; this section has the sole purpose of protecting the");
+  Msg::Direct("integrity of the free software distribution system, which is");
+  Msg::Direct("implemented by public license practices.  Many people have made");
+  Msg::Direct("generous contributions to the wide range of software distributed");
+  Msg::Direct("through that system in reliance on consistent application of that");
+  Msg::Direct("system; it is up to the author/donor to decide if he or she is willing");
+  Msg::Direct("to distribute software through any other system and a licensee cannot");
+  Msg::Direct("impose that choice.");
+  Msg::Direct(" ");
+  Msg::Direct("This section is intended to make thoroughly clear what is believed to");
+  Msg::Direct("be a consequence of the rest of this License.");
+  Msg::Direct(" ");
+  Msg::Direct("  8. If the distribution and/or use of the Program is restricted in");
+  Msg::Direct("certain countries either by patents or by copyrighted interfaces, the");
+  Msg::Direct("original copyright holder who places the Program under this License");
+  Msg::Direct("may add an explicit geographical distribution limitation excluding");
+  Msg::Direct("those countries, so that distribution is permitted only in or among");
+  Msg::Direct("countries not thus excluded.  In such case, this License incorporates");
+  Msg::Direct("the limitation as if written in the body of this License.");
+  Msg::Direct(" ");
+  Msg::Direct("  9. The Free Software Foundation may publish revised and/or new versions");
+  Msg::Direct("of the General Public License from time to time.  Such new versions will");
+  Msg::Direct("be similar in spirit to the present version, but may differ in detail to");
+  Msg::Direct("address new problems or concerns.");
+  Msg::Direct(" ");
+  Msg::Direct("Each version is given a distinguishing version number.  If the Program");
+  Msg::Direct("specifies a version number of this License which applies to it and \"any");
+  Msg::Direct("later version\", you have the option of following the terms and conditions");
+  Msg::Direct("either of that version or of any later version published by the Free");
+  Msg::Direct("Software Foundation.  If the Program does not specify a version number of");
+  Msg::Direct("this License, you may choose any version ever published by the Free Software");
+  Msg::Direct("Foundation.");
+  Msg::Direct(" ");
+  Msg::Direct("  10. If you wish to incorporate parts of the Program into other free");
+  Msg::Direct("programs whose distribution conditions are different, write to the author");
+  Msg::Direct("to ask for permission.  For software which is copyrighted by the Free");
+  Msg::Direct("Software Foundation, write to the Free Software Foundation; we sometimes");
+  Msg::Direct("make exceptions for this.  Our decision will be guided by the two goals");
+  Msg::Direct("of preserving the free status of all derivatives of our free software and");
+  Msg::Direct("of promoting the sharing and reuse of software generally.");
+  Msg::Direct(" ");
+  Msg::Direct("                     NO WARRANTY");
+  Msg::Direct(" ");
+  Msg::Direct("  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY");
+  Msg::Direct("FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN");
+  Msg::Direct("OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES");
+  Msg::Direct("PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED");
+  Msg::Direct("OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF");
+  Msg::Direct("MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS");
+  Msg::Direct("TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE");
+  Msg::Direct("PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,");
+  Msg::Direct("REPAIR OR CORRECTION.");
+  Msg::Direct(" ");
+  Msg::Direct("  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING");
+  Msg::Direct("WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR");
+  Msg::Direct("REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,");
+  Msg::Direct("INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING");
+  Msg::Direct("OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED");
+  Msg::Direct("TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY");
+  Msg::Direct("YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER");
+  Msg::Direct("PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE");
+  Msg::Direct("POSSIBILITY OF SUCH DAMAGES.");
+  Msg::Direct(" ");
+  Msg::Direct("              END OF TERMS AND CONDITIONS");
+  Msg::Direct(" ");
+  Msg::Direct("     How to Apply These Terms to Your New Programs");
+  Msg::Direct(" ");
+  Msg::Direct("  If you develop a new program, and you want it to be of the greatest");
+  Msg::Direct("possible use to the public, the best way to achieve this is to make it");
+  Msg::Direct("free software which everyone can redistribute and change under these terms.");
+  Msg::Direct(" ");
+  Msg::Direct("  To do so, attach the following notices to the program.  It is safest");
+  Msg::Direct("to attach them to the start of each source file to most effectively");
+  Msg::Direct("convey the exclusion of warranty; and each file should have at least");
+  Msg::Direct("the \"copyright\" line and a pointer to where the full notice is found.");
+  Msg::Direct(" ");
+  Msg::Direct("    <one line to give the program's name and a brief idea of what it does.>");
+  Msg::Direct("    Copyright (C) <year>  <name of author>");
+  Msg::Direct(" ");
+  Msg::Direct("    This program is free software; you can redistribute it and/or modify");
+  Msg::Direct("    it under the terms of the GNU General Public License as published by");
+  Msg::Direct("    the Free Software Foundation; either version 2 of the License, or");
+  Msg::Direct("    (at your option) any later version.");
+  Msg::Direct(" ");
+  Msg::Direct("    This program is distributed in the hope that it will be useful,");
+  Msg::Direct("    but WITHOUT ANY WARRANTY; without even the implied warranty of");
+  Msg::Direct("    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the");
+  Msg::Direct("    GNU General Public License for more details.");
+  Msg::Direct(" ");
+  Msg::Direct("    You should have received a copy of the GNU General Public License");
+  Msg::Direct("    along with this program; if not, write to the Free Software");
+  Msg::Direct("    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA");
+  Msg::Direct(" ");
+  Msg::Direct(" ");
+  Msg::Direct("Also add information on how to contact you by electronic and paper mail.");
+  Msg::Direct(" ");
+  Msg::Direct("If the program is interactive, make it output a short notice like this");
+  Msg::Direct("when it starts in an interactive mode:");
+  Msg::Direct(" ");
+  Msg::Direct("    Gnomovision version 69, Copyright (C) year name of author");
+  Msg::Direct("    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.");
+  Msg::Direct("    This is free software, and you are welcome to redistribute it");
+  Msg::Direct("    under certain conditions; type `show c' for details.");
+  Msg::Direct(" ");
+  Msg::Direct("The hypothetical commands `show w' and `show c' should show the appropriate");
+  Msg::Direct("parts of the General Public License.  Of course, the commands you use may");
+  Msg::Direct("be called something other than `show w' and `show c'; they could even be");
+  Msg::Direct("mouse-clicks or menu items--whatever suits your program.");
+  Msg::Direct(" ");
+  Msg::Direct("You should also get your employer (if you work as a programmer) or your");
+  Msg::Direct("school, if any, to sign a \"copyright disclaimer\" for the program, if");
+  Msg::Direct("necessary.  Here is a sample; alter the names:");
+  Msg::Direct(" ");
+  Msg::Direct("  Yoyodyne, Inc., hereby disclaims all copyright interest in the program");
+  Msg::Direct("  `Gnomovision' (which makes passes at compilers) written by James Hacker.");
+  Msg::Direct(" ");
+  Msg::Direct("  <signature of Ty Coon>, 1 April 1989");
+  Msg::Direct("  Ty Coon, President of Vice");
+  Msg::Direct(" ");
+  Msg::Direct("This General Public License does not permit incorporating your program into");
+  Msg::Direct("proprietary programs.  If your program is a subroutine library, you may");
+  Msg::Direct("consider it more useful to permit linking proprietary applications with the");
+  Msg::Direct("library.  If this is what you want to do, use the GNU Library General");
+  Msg::Direct("Public License instead of this License.");
 }
diff --git a/Common/Main.cpp b/Common/Main.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..79ec38e877854d65e00aab800dabb75aa6b76e65
--- /dev/null
+++ b/Common/Main.cpp
@@ -0,0 +1,46 @@
+// $Id: Main.cpp,v 1.1 2008-05-04 08:31:11 geuzaine Exp $
+//
+// Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+// 
+// Please report all bugs and problems to <gmsh@geuz.org>.
+
+#include "Gmsh.h"
+#include "GModel.h"
+#include "CommandLine.h"
+#include "Message.h"
+#include "Context.h"
+
+extern Context_T CTX;
+
+int main(int argc, char *argv[])
+{
+  CTX.terminal = 1;
+
+  if(argc < 2){
+    Print_Usage(argv[0]);
+    exit(0);
+  }
+
+  GmshInitialize(argc, argv);
+  new GModel;
+  GmshBatch();
+  GmshFinalize();
+
+  Msg::Exit(0);
+  return 1;
+}
diff --git a/Common/Makefile b/Common/Makefile
index 0f6b0e5560c7e6f1e06434db3ab6eedeb99ba37c..be12f05b7bde29f177deebf7b4ae4c985dc0bbf1 100644
--- a/Common/Makefile
+++ b/Common/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.171 2008-04-28 10:10:51 geuzaine Exp $
+# $Id: Makefile,v 1.172 2008-05-04 08:31:11 geuzaine Exp $
 #
 # Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 #
@@ -36,6 +36,7 @@ SRC = Context.cpp\
       CommandLine.cpp\
       Gmsh.cpp\
       OS.cpp\
+      Message.cpp\
       Visibility.cpp\
       Trackball.cpp\
       VertexArray.cpp\
@@ -47,7 +48,7 @@ OBJ = ${SRC:.cpp=${OBJEXT}}
 
 .SUFFIXES: ${OBJEXT} .cpp
 
-${LIB}: ${OBJ} 
+${LIB}: ${OBJ} Main${OBJEXT}
 	${AR} ${ARFLAGS}${LIB} ${OBJ}
 	${RANLIB} ${LIB}
 
@@ -77,9 +78,9 @@ OctreeInternals.o: OctreeInternals.cpp Message.h OctreeInternals.h
 Options.o: Options.cpp GmshUI.h GmshDefines.h Message.h \
   ../Graphics/Draw.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \
   ../Mesh/Generator.h Context.h Options.h ../Post/ColorTable.h \
-  ../Mesh/BackgroundMesh.h ../Post/PView.h ../Post/PViewData.h \
-  ../DataStr/List.h ../Post/PViewOptions.h ../Post/ColorTable.h \
-  ../Post/adaptiveData.h ../Common/GmshMatrix.h ../Plugin/PluginManager.h \
+  ../Mesh/BackgroundMesh.h ../Post/PView.h ../Post/PViewOptions.h \
+  ../Post/ColorTable.h ../Post/PViewData.h ../Post/adaptiveData.h \
+  ../DataStr/List.h ../Common/GmshMatrix.h ../Plugin/PluginManager.h \
   ../Plugin/Plugin.h ../Common/Options.h ../Common/Message.h \
   ../Post/PViewDataList.h ../Post/PViewData.h ../Fltk/Solvers.h \
   ../Fltk/GUI.h ../Fltk/Opengl_Window.h ../Fltk/Colorbar_Window.h \
@@ -99,18 +100,38 @@ CommandLine.o: CommandLine.cpp GmshUI.h GmshDefines.h GmshVersion.h \
   ../Geo/SPoint3.h ../Geo/SPoint2.h ../Geo/GFace.h ../Geo/GEntity.h \
   ../Geo/GPoint.h ../Geo/GEdgeLoop.h ../Geo/GEdge.h ../Geo/SPoint2.h \
   ../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h ../Geo/GEntity.h \
-  ../Geo/SBoundingBox3d.h ../Parser/CreateFile.h OS.h ../Post/PView.h \
-  ../Post/PViewData.h ../DataStr/List.h ../Post/PViewOptions.h \
-  ../Post/ColorTable.h
-Gmsh.o: Gmsh.cpp ../Parser/Parser.h ../DataStr/List.h ../DataStr/Tree.h \
-  ../DataStr/avl.h Options.h ../Post/ColorTable.h CommandLine.h OS.h \
-  ../Numeric/Numeric.h ../Numeric/NumericEmbedded.h \
+  ../Geo/SBoundingBox3d.h ../Parser/CreateFile.h OS.h ../Post/PView.h
+Gmsh.o: Gmsh.cpp GmshDefines.h ../Geo/GModel.h ../Geo/GVertex.h \
+  ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Geo/GPoint.h \
+  ../Geo/SPoint2.h ../Geo/GEdge.h ../Geo/GEntity.h ../Geo/GVertex.h \
+  ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/SPoint3.h ../Geo/SPoint2.h \
+  ../Geo/GFace.h ../Geo/GEntity.h ../Geo/GPoint.h ../Geo/GEdgeLoop.h \
+  ../Geo/GEdge.h ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h \
+  ../Geo/GRegion.h ../Geo/GEntity.h ../Geo/SBoundingBox3d.h Message.h \
+  ../Parser/Parser.h ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h \
+  ../Parser/OpenFile.h ../Parser/CreateFile.h Options.h \
+  ../Post/ColorTable.h CommandLine.h OS.h ../Numeric/Numeric.h \
+  ../Numeric/NumericEmbedded.h ../Mesh/Generator.h ../Mesh/Field.h \
+  ../Geo/Geo.h ../Common/GmshDefines.h ../Geo/gmshSurface.h ../Geo/Pair.h \
+  ../Geo/Range.h ../Geo/SPoint2.h ../Geo/SPoint3.h ../Geo/SVector3.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint2.h ../Geo/ExtrudeParams.h \
+  ../Common/SmoothData.h ../Post/PView.h Context.h \
   ../Plugin/PluginManager.h ../Plugin/Plugin.h ../Common/Options.h \
-  ../Common/Message.h ../Post/PView.h ../Post/PViewData.h \
-  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Post/PViewOptions.h \
-  ../Post/ColorTable.h ../Post/PViewDataList.h ../Post/PViewData.h \
+  ../Common/Message.h ../Post/PViewDataList.h ../Post/PViewData.h \
   ../Common/GmshMatrix.h
 OS.o: OS.cpp Message.h
+Message.o: Message.cpp Message.h Options.h ../Post/ColorTable.h Context.h \
+  OS.h ../Fltk/GUI.h ../Fltk/Opengl_Window.h ../Fltk/Colorbar_Window.h \
+  ../Common/GmshUI.h ../Fltk/Popup_Button.h \
+  ../Fltk/SpherePosition_Widget.h ../Mesh/Field.h ../Geo/Geo.h \
+  ../Common/GmshDefines.h ../Geo/gmshSurface.h ../Geo/Pair.h \
+  ../Geo/Range.h ../Geo/SPoint2.h ../Geo/SPoint3.h ../Geo/SVector3.h \
+  ../Geo/SPoint3.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \
+  ../Numeric/Numeric.h ../Numeric/NumericEmbedded.h ../DataStr/List.h \
+  ../DataStr/Tree.h ../DataStr/avl.h ../Geo/SPoint2.h \
+  ../Geo/ExtrudeParams.h ../Common/SmoothData.h ../Post/PView.h \
+  ../Fltk/GUI_Extras.h
 Visibility.o: Visibility.cpp Visibility.h GmshDefines.h ../Geo/GVertex.h \
   ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
   ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Geo/GPoint.h \
diff --git a/Common/Message.cpp b/Common/Message.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..9967dad256a9ad9cf087bea5100cba3faec60598
--- /dev/null
+++ b/Common/Message.cpp
@@ -0,0 +1,528 @@
+// $Id: Message.cpp,v 1.1 2008-05-04 08:31:11 geuzaine Exp $
+//
+// Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+// 
+// Please report all bugs and problems to <gmsh@geuz.org>.
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include "Message.h"
+#include "Options.h"
+#include "Context.h"
+#include "OS.h"
+
+#if defined(HAVE_MPI)
+#include <mpi.h>
+#endif
+
+#if defined(HAVE_FLTK)
+#include "GUI.h"
+#include "GUI_Extras.h"
+extern GUI *WID;
+#endif
+
+extern Context_T CTX;
+
+int Message::_commRank = 0;
+int Message::_commSize = 1;
+int Message::_verbosity = 3;
+int Message::_progressMeterStep = 10;
+int Message::_progressMeterCurrent = 0;
+std::map<std::string, double> Message::_timers;
+int Message::_warningCount = 0;
+int Message::_errorCount = 0;
+
+#if defined(HAVE_NO_VSNPRINTF)
+int vsnprintf(char *str, size_t size, const char *fmt, va_list ap)
+{
+  if(strlen(fmt) > size - 1){ // just copy the format
+    strncpy(str, fmt, size - 1);
+    str[size - 1] = '\0';
+    return size;
+  }
+  return vsprintf(str, fmt, ap);
+}
+#endif
+
+void Message::Init(int argc, char **argv)
+{
+#if defined(HAVE_MPI)
+  MPI_Init(&argc, &argv);
+  MPI_Comm_rank(MPI_COMM_WORLD, &_commRank);
+  MPI_Comm_size(MPI_COMM_WORLD, &_commSize);
+  MPI_Errhandler_set(MPI_COMM_WORLD, MPI_ERRORS_RETURN);
+#endif
+}
+
+void Message::Exit(int level)
+{
+  // delete the temp file
+  if(!_commRank) UnlinkFile(CTX.tmp_filename_fullpath);
+
+  // exit directly on abnormal program termination (level != 0). We
+  // used to call abort() to flush open streams, but on modern OSes
+  // this calls the annoying "report this crash to the mothership"
+  // window... so just exit!
+  if(level){
+#if defined(HAVE_MPI)
+    MPI_Finalize();
+#endif
+    exit(level);
+  }
+  
+#if defined(HAVE_FLTK)
+  // if we exit cleanly (level==0) and we are in full GUI mode, save
+  // the persistent info to disk
+  if(WID && !CTX.batch && !_commRank) {
+    if(CTX.session_save) {
+      CTX.position[0] = WID->m_window->x();
+      CTX.position[1] = WID->m_window->y();
+      CTX.gl_position[0] = WID->g_window->x();
+      CTX.gl_position[1] = WID->g_window->y();
+      CTX.msg_position[0] = WID->msg_window->x();
+      CTX.msg_position[1] = WID->msg_window->y();
+      CTX.msg_size[0] = WID->msg_window->w();
+      CTX.msg_size[1] = WID->msg_window->h();
+      CTX.opt_position[0] = WID->opt_window->x();
+      CTX.opt_position[1] = WID->opt_window->y();
+      CTX.plugin_position[0] = WID->plugin_window->x();
+      CTX.plugin_position[1] = WID->plugin_window->y();
+      CTX.plugin_size[0] = WID->plugin_window->w();
+      CTX.plugin_size[1] = WID->plugin_window->h();
+      CTX.field_position[0] = WID->field_window->x();
+      CTX.field_position[1] = WID->field_window->y();
+      CTX.field_size[0] = WID->field_window->w();
+      CTX.field_size[1] = WID->field_window->h();
+      CTX.stat_position[0] = WID->stat_window->x();
+      CTX.stat_position[1] = WID->stat_window->y();
+      CTX.vis_position[0] = WID->vis_window->x();
+      CTX.vis_position[1] = WID->vis_window->y();
+      CTX.clip_position[0] = WID->clip_window->x();
+      CTX.clip_position[1] = WID->clip_window->y();
+      CTX.manip_position[0] = WID->manip_window->x();
+      CTX.manip_position[1] = WID->manip_window->y();
+      CTX.ctx_position[0] = WID->context_geometry_window->x();
+      CTX.ctx_position[1] = WID->context_geometry_window->y();
+      CTX.solver_position[0] = WID->solver[0].window->x();
+      CTX.solver_position[1] = WID->solver[0].window->y();
+      file_chooser_get_position(&CTX.file_chooser_position[0],
+                                &CTX.file_chooser_position[1]);
+      Print_Options(0, GMSH_SESSIONRC, 0, 0, CTX.session_filename_fullpath);
+    }
+    if(CTX.options_save)
+      Print_Options(0, GMSH_OPTIONSRC, 1, 0, CTX.options_filename_fullpath);
+  }
+#endif
+
+#if defined(HAVE_MPI)
+  MPI_Finalize();
+#endif
+  exit(0);
+}
+
+void Message::Fatal(const char *fmt, ...)
+{
+  _errorCount++;
+
+  if(_verbosity < 1) return;
+  va_list args;
+  va_start(args, fmt);
+
+#if defined(HAVE_FLTK)
+  if(WID){
+    WID->check();
+    char str[1024];
+    vsnprintf(str, sizeof(str), fmt, args);
+    std::string tmp = std::string("@C1@.") + "Fatal   : " + str;
+    WID->add_message(tmp.c_str());
+    WID->create_message_window();
+    WID->save_message(CTX.error_filename_fullpath);
+    WID->fatal_error(CTX.error_filename_fullpath);
+  }
+#endif
+
+  if(CTX.terminal){
+    if(_commSize > 1)
+      fprintf(stderr, "Fatal   : [On processor %d] ", _commRank);
+    else
+      fprintf(stderr, "Fatal   : ");
+    vfprintf(stderr, fmt, args);
+    fprintf(stderr, "\n");
+    fflush(stderr);
+  }
+
+  va_end(args);
+  Exit(1);
+}
+
+void Message::Error(const char *fmt, ...)
+{
+  _errorCount++;
+
+  if(_verbosity < 1) return;
+  va_list args;
+  va_start(args, fmt);
+
+#if defined(HAVE_FLTK)
+  if(WID){
+    WID->check();
+    char str[1024];
+    vsnprintf(str, sizeof(str), fmt, args);
+    va_end(args);
+    std::string tmp = std::string("@C1@.") + "Error   : " + str;
+    WID->add_message(tmp.c_str());
+    WID->create_message_window();
+  }
+#endif
+
+  if(CTX.terminal){
+    if(_commSize > 1) 
+      fprintf(stderr, "Error   : [On processor %d]", _commRank);
+    else
+      fprintf(stderr, "Error   : ");
+    vfprintf(stderr, fmt, args);
+    fprintf(stderr, "\n");
+    fflush(stderr);
+  }
+
+  va_end(args);
+}
+
+void Message::Warning(const char *fmt, ...)
+{
+  _warningCount++;
+
+  if(_commRank || _verbosity < 2) return;
+  va_list args;
+  va_start(args, fmt);
+
+#if defined(HAVE_FLTK)
+  if(WID){
+    WID->check();
+    char str[1024];
+    vsnprintf(str, sizeof(str), fmt, args);
+    std::string tmp = std::string("@C1@.") + "Warning : " + str;
+    WID->add_message(tmp.c_str());
+  }
+#endif
+
+  if(CTX.terminal){
+    fprintf(stderr, "Warning : ");
+    vfprintf(stderr, fmt, args);
+    fprintf(stderr, "\n");
+    fflush(stderr);
+  }
+
+  va_end(args);
+}
+
+void Message::Info(const char *fmt, ...)
+{
+  if(_commRank || _verbosity < 3) return;
+  va_list args;
+  va_start(args, fmt);
+
+#if defined(HAVE_FLTK)
+  if(WID){
+    WID->check();
+    char str[1024];
+    vsnprintf(str, sizeof(str), fmt, args);
+    std::string tmp = std::string("Info    : ") + str;
+    WID->add_message(tmp.c_str());
+  }
+#endif
+
+  if(CTX.terminal){
+    fprintf(stdout, "Info    : ");
+    vfprintf(stdout, fmt, args);
+    fprintf(stdout, "\n");
+    fflush(stdout);
+  }
+
+  va_end(args);
+}
+
+void Message::Direct(const char *fmt, ...)
+{
+  if(_commRank || _verbosity < 3) return;
+  va_list args;
+  va_start(args, fmt);
+  char str[1024];
+  vsnprintf(str, sizeof(str), fmt, args);
+  va_end(args);
+  Direct(3, str);
+}
+
+void Message::Direct(int level, const char *fmt, ...)
+{
+  if(_commRank || _verbosity < level) return;
+  va_list args;
+  va_start(args, fmt);
+
+#if defined(HAVE_FLTK)
+  if(WID){
+    WID->check();
+    char str[1024];
+    vsnprintf(str, sizeof(str), fmt, args);
+    std::string tmp;
+    if(level < 3)
+      tmp = std::string("@C1@.") + str;
+    else
+      tmp = std::string("@C4@.") + str;
+    WID->add_message(tmp.c_str());
+    if(level == 1)
+      WID->create_message_window();
+  }
+#endif
+  
+  if(CTX.terminal){
+    vfprintf(stdout, fmt, args);
+    fprintf(stdout, "\n");
+    fflush(stdout);
+  }
+
+  va_end(args);
+}
+
+void Message::Status(int num, bool log, const char *fmt, ...)
+{
+  if(_commRank || _verbosity < 3) return;
+  if(num < 1 || num > 3) return;
+  va_list args;
+  va_start(args, fmt);
+
+#if defined(HAVE_FLTK)
+  if(WID){
+    if(log) WID->check();
+    char str[1024];
+    vsnprintf(str, sizeof(str), fmt, args);
+    WID->set_status(str, num - 1);
+    if(log){
+      std::string tmp = std::string("Info    : ") + str;
+      WID->add_message(tmp.c_str());
+    }
+  }
+#endif
+
+  if(log && CTX.terminal){
+    fprintf(stdout, "Info    : ");
+    vfprintf(stdout, fmt, args);
+    fprintf(stdout, "\n");
+    fflush(stdout);
+  }
+
+  va_end(args);
+}
+
+void Message::Debug(const char *fmt, ...)
+{
+  if(_verbosity < 99) return;
+  va_list args;
+  va_start(args, fmt);
+
+#if defined(HAVE_FLTK)
+  if(WID){
+    char str[1024];
+    vsnprintf(str, sizeof(str), fmt, args);
+    std::string tmp = std::string("Debug   : ") + str;
+    WID->add_message(tmp.c_str());
+  }
+#endif
+
+  if(CTX.terminal){
+    if(_commSize > 1) 
+      fprintf(stdout, "Debug   : [On processor %d] ", _commRank);
+    else
+      fprintf(stdout, "Debug   : ");
+    vfprintf(stdout, fmt, args);
+    fprintf(stdout, "\n");
+    fflush(stdout);
+  }
+
+  va_end(args);
+}
+
+void Message::ProgressMeter(int n, int N, const char *fmt, ...)
+{
+  if(_commRank || _verbosity < 3) return;
+
+  double percent = 100. * (double)n/(double)N;
+  if(percent >= _progressMeterCurrent){
+    va_list args;
+    va_start(args, fmt);
+#if defined(HAVE_FLTK)
+    if(WID){
+      char str[1024], str2[1024];
+      vsnprintf(str, sizeof(str), fmt, args);
+      if(strlen(fmt)) strcat(str, " ");
+      sprintf(str2, "(%d %%)", _progressMeterCurrent);
+      strcat(str, str2);
+      WID->set_status(str, 1);
+      WID->check();
+    }
+#endif
+    if(CTX.terminal){
+      vfprintf(stdout, fmt, args);
+      if(strlen(fmt)) fprintf(stdout, " ");
+      fprintf(stdout, "(%d %%)                     \r", _progressMeterCurrent);
+      fflush(stdout);
+    }
+    va_end(args);
+    while(_progressMeterCurrent < percent)
+      _progressMeterCurrent += _progressMeterStep;
+  }
+
+  if(n > N - 1){
+#if defined(HAVE_FLTK)
+    if(WID) WID->set_status("", 1);
+#endif
+    if(CTX.terminal){
+      fprintf(stdout, "Done!                                              \r");
+      fflush(stdout);
+    }
+  }
+}
+
+void Message::PrintTimers()
+{
+  // do a single stdio call!
+  std::string str;
+  for(std::map<std::string, double>::iterator it = _timers.begin(); 
+      it != _timers.end(); it++){
+    if(it != _timers.begin()) str += ", ";
+    char tmp[256];
+    sprintf(tmp, "%s = %gs ", it->first.c_str(), it->second);
+    str += std::string(tmp);
+  }
+  if(!str.size()) return;
+
+  if(CTX.terminal){
+    if(_commSize > 1) 
+      fprintf(stdout, "Timers  : [On processor %d] %s\n", _commRank, str.c_str());
+    else
+      fprintf(stdout, "Timers  : %s\n", str.c_str());
+    fflush(stdout);
+  }
+}
+
+void Message::PrintErrorCounter(const char *title)
+{
+  if(_commRank || _verbosity < 1) return;
+  if(!_warningCount && !_errorCount) return;
+
+  std::string prefix = _errorCount ? "Error   : " : "Warning : ";
+  std::string help("Check the full log for details");
+  std::string line(std::max(strlen(title), help.size()), '-');
+  char warn[128], err[128];
+  sprintf(warn, "%5d warning%s", _warningCount, _warningCount == 1 ? "" : "s");
+  sprintf(err, "%5d error%s", _errorCount, _errorCount == 1 ? "" : "s");
+
+#if defined(HAVE_FLTK)
+  if(WID){
+    std::string red("@C1@.");
+    WID->add_message((red + prefix + line).c_str());
+    WID->add_message((red + prefix + title).c_str());
+    WID->add_message((red + prefix + warn).c_str());
+    WID->add_message((red + prefix + err).c_str());
+    WID->add_message((red + prefix + help).c_str());
+    WID->add_message((red + prefix + line).c_str());
+    if(_errorCount){
+      WID->create_message_window();
+      fl_beep();
+    }
+  }
+#endif
+
+  if(CTX.terminal){
+    fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n", (prefix + line).c_str(), 
+	    (prefix + title).c_str(), (prefix + warn).c_str(),
+	    (prefix + err).c_str(), (prefix + help).c_str(), 
+	    (prefix + line).c_str());
+    fflush(stderr);
+  }
+}
+
+double Message::GetValue(const char *text, double defaultval)
+{
+  if(CTX.nopopup) return defaultval;
+
+#if defined(HAVE_FLTK)
+  if(WID && !CTX.batch){
+    char defaultstr[256];
+    sprintf(defaultstr, "%.16g", defaultval);
+    const char *ret = fl_input(text, defaultstr);
+    if(!ret)
+      return defaultval;
+    else
+      return atof(ret);
+  }
+#endif
+
+  printf("%s (default=%.16g): ", text, defaultval);
+  char str[256];
+  char *ret = fgets(str, sizeof(str), stdin);
+  if(!ret || !strlen(str) || !strcmp(str, "\n"))
+    return defaultval;
+  else
+    return atof(str);
+}
+
+bool Message::GetBinaryAnswer(const char *question, const char *yes, 
+			      const char *no,  bool defaultval)
+{
+  if(CTX.nopopup || CTX.batch) return defaultval;
+
+#if defined(HAVE_FLTK)
+  if(fl_choice(question, no, yes, NULL))
+    return true;
+  else
+    return false;
+#endif
+
+  char answ[256];
+  while(1){
+    printf("%s (%s/%s)", question, yes, no);
+    scanf("%s ", answ);
+    if(!strcmp(answ, yes)) return true;
+    if(!strcmp(answ, no)) return false;
+  }
+}
+
+void Message::Barrier()
+{
+#if defined(HAVE_MPI)
+  MPI_Barrier(MPI_COMM_WORLD);
+#endif
+}
+
+#if defined(_OPENMP)
+
+#include <omp.h>
+
+int Message::GetNumThreads(){ return omp_get_num_threads(); }
+int Message::GetMaxThreads(){ return omp_get_max_threads(); }
+int Message::GetThreadNum(){ return omp_get_thread_num(); }
+
+#else
+
+int Message::GetNumThreads(){ return 1; }
+int Message::GetMaxThreads(){ return 1; }
+int Message::GetThreadNum(){ return 0; }
+
+#endif
diff --git a/Common/Message.h b/Common/Message.h
index c4f0ea39ad83617272b7bfb643f5f838d8689693..fb9280b8dc63feb1779499497d41ae3007ac121c 100644
--- a/Common/Message.h
+++ b/Common/Message.h
@@ -20,59 +20,59 @@
 // 
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
+#include <map>
+#include <vector>
+#include <string>
 #include <stdarg.h>
 
-#define FATAL          1  // Fatal error (causes Gmsh to exit)
-#define FATAL1         2  // First part of a multiline FATAL message 
-#define FATAL2         3  // Middle part of a multiline FATAL message
-#define FATAL3         4  // Last part of a multiline FATAL message  
+// a class to manage messages
+class Message {
+ private:
+  // current cpu number and total number of cpus
+  static int _commRank, _commSize;
+  // verbosity level
+  static int _verbosity;
+  // step (in %) of the progress meter and current progress %
+  static int _progressMeterStep, _progressMeterCurrent;
+  // timers
+  static std::map<std::string, double> _timers;
+  // counters
+  static int _warningCount, _errorCount;
+ public:
+  Message() {}
+  static void Init(int argc, char **argv);
+  static void Exit(int level);
+  static int GetCommRank(){ return _commRank; }
+  static int GetCommSize(){ return _commSize; }
+  static void SetCommRank(int val){ _commRank = val; }
+  static void SetCommSize(int val){ _commSize = val; }
+  static void Barrier();
+  static int GetNumThreads();
+  static int GetMaxThreads();
+  static int GetThreadNum();
+  static void SetVerbosity(int val){ _verbosity = val; }
+  static int GetVerbosity(){ return _verbosity; }
+  static void Fatal(const char *fmt, ...);
+  static void Error(const char *fmt, ...);
+  static void Warning(const char *fmt, ...);
+  static void Info(const char *fmt, ...);
+  static void Direct(const char *fmt, ...);
+  static void Direct(int level, const char *fmt, ...);
+  static void Status(int num, bool log, const char *fmt, ...);
+  static void Debug(const char *fmt, ...);
+  static void ProgressMeter(int n, int N, const char *fmt, ...);
+  static void ProgressMeter(int n, int N){ ProgressMeter(n, N, ""); }
+  static void SetProgressMeterStep(int step){ _progressMeterStep = step; }
+  static void ResetProgressMeter(){ if(!_commRank) _progressMeterCurrent = 0; }
+  static double &Timer(std::string str){ return _timers[str]; }
+  static void PrintTimers();
+  static void ResetErrorCounter(){ _warningCount = 0; _errorCount = 0; }
+  static void PrintErrorCounter(const char *title);
+  static double GetValue(const char *text, double defaultval);
+  static bool GetBinaryAnswer(const char *question, const char *yes, 
+			      const char *no,  bool defaultval=true);
+};
 
-#define GERROR         5  // Error (but Gmsh can live with it)
-#define GERROR1        6  // First part of a multiline ERROR message 
-#define GERROR2        7  // Middle part of a multiline ERROR message
-#define GERROR3        8  // Last part of a multiline ERROR message  
-
-#define WARNING        9  // Warning
-#define WARNING1      10  // First part of a multiline WARNING message 
-#define WARNING2      11  // Middle part of a multiline WARNING message
-#define WARNING3      12  // Last part of a multiline WARNING message  
-
-#define INFO          13  // Long informations
-#define INFO1         14  // First part of a multiline INFO message 
-#define INFO2         15  // Middle part of a multiline INFO message
-#define INFO3         16  // Last part of a multiline INFO message  
-
-#define DEBUG         17  // Long debug information
-#define DEBUG1        18  // First part of a multiline DEBUG message 
-#define DEBUG2        19  // Middle part of a multiline DEBUG message
-#define DEBUG3        20  // Last part of a multiline DEBUG message  
-
-#define STATUS1       21  // left status bar
-#define STATUS2       22  // right status bar
-
-#define STATUS1N      24  // Same as STATUS1, but not going into the log file
-#define STATUS2N      25  // Same as STATUS2, but not going into the log file
-
-#define ONSCREEN      27  // Persistent on-screen message
-
-#define DIRECT        30  // Direct message (no special formatting)
-#define SOLVER        31  // Solver message
-#define SOLVERR       32  // Solver errors and warnings
-
-#define PROGRESS      40  // Progress indicator
-
-#define WHITE_STR          "        : "
-#define FATAL_STR          "Fatal   : "
-#define ERROR_STR          "Error   : "
-#define WARNING_STR        "Warning : "
-#define INFO_STR           "Info    : "
-#define DEBUG_STR          "Debug   : "
-#define STATUS_STR         "Info    : "
-
-void   Msg(int level, const char *fmt, ...);
-void   Exit(int);
-double GetValue(const char *text, double defaultval);
-bool   GetBinaryAnswer(const char *question, const char *yes, const char *no, 
-                       bool defaultval=true);
+typedef Message Msg;
 
 #endif
diff --git a/Common/OS.cpp b/Common/OS.cpp
index a837680c34875591c641e45972450f4d599027b6..c5b953aee49b855d19b5020bc147ebd0815617ee 100644
--- a/Common/OS.cpp
+++ b/Common/OS.cpp
@@ -1,4 +1,4 @@
-// $Id: OS.cpp,v 1.12 2008-02-17 08:47:56 geuzaine Exp $
+// $Id: OS.cpp,v 1.13 2008-05-04 08:31:11 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -101,7 +101,7 @@ void CheckResources(){
   // can cause crashes in the recursive calls (e.g. for tet
   // classification in 3D Delaunay)
   if(r.rlim_cur < 16 * 1024 * 1024){
-    Msg(INFO, "Increasing process stack size (%d kB < 16 MB)", r.rlim_cur / 1024);
+    Msg::Info("Increasing process stack size (%d kB < 16 MB)", r.rlim_cur / 1024);
     r.rlim_cur = r.rlim_max;
     setrlimit(RLIMIT_STACK, &r);
   }
@@ -167,16 +167,16 @@ int SystemCall(const char *command)
   PROCESS_INFORMATION prInfo;
   memset(&suInfo, 0, sizeof(suInfo));
   suInfo.cb = sizeof(suInfo);
-  Msg(INFO, "Calling '%s'", command);
+  Msg::Info("Calling '%s'", command);
   CreateProcess(NULL, (char*)command, NULL, NULL, FALSE,
                 NORMAL_PRIORITY_CLASS, NULL, NULL, &suInfo, &prInfo);
   return 0;
 #else
   if(!system(NULL)) {
-    Msg(GERROR, "Could not find /bin/sh: aborting system call");
+    Msg::Error("Could not find /bin/sh: aborting system call");
     return 1;
   }
-  Msg(INFO, "Calling '%s'", command);
+  Msg::Info("Calling '%s'", command);
   return system(command);
 #endif
 }
diff --git a/Common/OctreeInternals.cpp b/Common/OctreeInternals.cpp
index aa260011ea0879310dc0c90742aa3b9e4f868cea..af1e528db11c37786376354de76833a93aba16eb 100644
--- a/Common/OctreeInternals.cpp
+++ b/Common/OctreeInternals.cpp
@@ -1,4 +1,4 @@
-// $Id: OctreeInternals.cpp,v 1.5 2008-03-20 11:44:02 geuzaine Exp $
+// $Id: OctreeInternals.cpp,v 1.6 2008-05-04 08:31:11 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -67,13 +67,13 @@ int initializeOctantBuckets(double *_orig, double *_size, int _maxElem,
   (*globalPara)->numBuckets = initial_buckets_num;
   *buckets_head = new octantBucket;
   if (!(*buckets_head)) {
-    Msg(GERROR, "initializeOctantBuckets could not allocate enough space");
+    Msg::Error("initializeOctantBuckets could not allocate enough space");
     return (0);
   } // if could not allocate buckets 
 
   buckets = new octantBucket[8];
   if (!buckets) { 
-    Msg(GERROR, "initializeOctantBuckets could not allocate enough space");
+    Msg::Error("initializeOctantBuckets could not allocate enough space");
     return (0);
   }
 
@@ -189,7 +189,7 @@ int addElement2Bucket(octantBucket *_bucket, void * _element,
         ptr2 = ptr1;
         ptr1 = ptr1->next;
         if (ptrBucket == NULL)
-          Msg(GERROR, "Wrong , ptrBucket = NULL. A bug here!");
+          Msg::Error("Wrong , ptrBucket = NULL. A bug here!");
         ptr2->next = ptrBucket->lhead;
         ptrBucket->lhead = ptr2;
         (ptrBucket->numElements)++;
@@ -410,7 +410,7 @@ void * searchAllElements(octantBucket *_buckets_head, double *_pt, globalInfo *_
 
   ptrBucket = findElementBucket(_buckets_head, _pt);
   if (ptrBucket == NULL) {
-    Msg(GERROR, "The point is not in the domain");
+    Msg::Error("The point is not in the domain");
     return NULL;
   }
 
@@ -440,6 +440,6 @@ void * searchAllElements(octantBucket *_buckets_head, double *_pt, globalInfo *_
   if (flag1)
     return (void *)(_elements);
   
-  Msg(WARNING, "This point is not found in any element! It is not in the domain");
+  Msg::Warning("This point is not found in any element! It is not in the domain");
   return NULL;
 }
diff --git a/Common/Options.cpp b/Common/Options.cpp
index 5a17a55054e6f60d7f67ab885fcc5b8f71f22bad..4c17d96bc5240fe9fd21dd9e07ac55257b2f608a 100644
--- a/Common/Options.cpp
+++ b/Common/Options.cpp
@@ -1,4 +1,4 @@
-// $Id: Options.cpp,v 1.396 2008-04-28 10:10:51 geuzaine Exp $
+// $Id: Options.cpp,v 1.397 2008-05-04 08:31:11 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -33,6 +33,8 @@ extern Context_T CTX;
 
 #if !defined(HAVE_NO_POST)
 #include "PView.h"
+#include "PViewOptions.h"
+#include "PViewData.h"
 #include "adaptiveData.h"
 #include "PluginManager.h"
 #endif
@@ -200,9 +202,9 @@ static void Print_OptionCategory(int level, int diff, int help, const char *cat,
     fprintf(file, "//\n");
   }
   else {
-    Msg(DIRECT, "//");
-    Msg(DIRECT, "// %s", cat);
-    Msg(DIRECT, "//");
+    Msg::Direct("//");
+    Msg::Direct("// %s", cat);
+    Msg::Direct("//");
   }
 }
 
@@ -251,13 +253,13 @@ static void Print_ColorTable(int num, int diff, const char *prefix, FILE *file)
   if(file)
     fprintf(file, "%s\n", tmp);
   else
-    Msg(DIRECT, tmp);
+    Msg::Direct(tmp);
   ColorTable_Print(&opt->CT, file);
   sprintf(tmp, "};");
   if(file)
     fprintf(file, "%s\n", tmp);
   else
-    Msg(DIRECT, tmp);
+    Msg::Direct(tmp);
 #endif
 }
 
@@ -268,7 +270,7 @@ void Print_Options(int num, int level, int diff, int help, const char *filename)
   if(filename) {
     file = fopen(filename, "w");
     if(!file) {
-      Msg(GERROR, "Unable to open file '%s'", filename);
+      Msg::Error("Unable to open file '%s'", filename);
       return;
     }
   }
@@ -395,7 +397,7 @@ void Print_OptionsDoc()
   
   file = fopen("opt_general.texi", "w");
   if(!file) {
-    Msg(GERROR, "Unable to open file 'opt_general.texi'");
+    Msg::Error("Unable to open file 'opt_general.texi'");
     return;
   }
   fprintf(file, "%s@ftable @code\n", warn);
@@ -407,7 +409,7 @@ void Print_OptionsDoc()
 
   file = fopen("opt_print.texi", "w");
   if(!file) {
-    Msg(GERROR, "Unable to open file 'opt_print.texi'");
+    Msg::Error("Unable to open file 'opt_print.texi'");
     return;
   }
   fprintf(file, "%s@ftable @code\n", warn);
@@ -419,7 +421,7 @@ void Print_OptionsDoc()
 
   file = fopen("opt_geometry.texi", "w");
   if(!file) {
-    Msg(GERROR, "Unable to open file 'opt_geometry.texi'");
+    Msg::Error("Unable to open file 'opt_geometry.texi'");
     return;
   }
   fprintf(file, "%s@ftable @code\n", warn);
@@ -431,7 +433,7 @@ void Print_OptionsDoc()
 
   file = fopen("opt_mesh.texi", "w");
   if(!file) {
-    Msg(GERROR, "Unable to open file 'opt_mesh.texi'");
+    Msg::Error("Unable to open file 'opt_mesh.texi'");
     return;
   }
   fprintf(file, "%s@ftable @code\n", warn);
@@ -443,7 +445,7 @@ void Print_OptionsDoc()
 
   file = fopen("opt_solver.texi", "w");
   if(!file) {
-    Msg(GERROR, "Unable to open file 'opt_solver.texi'");
+    Msg::Error("Unable to open file 'opt_solver.texi'");
     return;
   }
   fprintf(file, "%s@ftable @code\n", warn);
@@ -455,7 +457,7 @@ void Print_OptionsDoc()
 
   file = fopen("opt_post.texi", "w");
   if(!file) {
-    Msg(GERROR, "Unable to open file 'opt_post.texi'");
+    Msg::Error("Unable to open file 'opt_post.texi'");
     return;
   }
   fprintf(file, "%s@ftable @code\n", warn);
@@ -468,7 +470,7 @@ void Print_OptionsDoc()
 #if !defined(HAVE_NO_POST)
   file = fopen("opt_view.texi", "w");
   if(!file) {
-    Msg(GERROR, "Unable to open file 'opt_view.texi'");
+    Msg::Error("Unable to open file 'opt_view.texi'");
     return;
   }
   fprintf(file, "%s@ftable @code\n", warn);
@@ -484,7 +486,7 @@ void Print_OptionsDoc()
 
   file = fopen("opt_plugin.texi", "w");
   if(!file) {
-    Msg(GERROR, "Unable to open file 'opt_plugin.texi'");
+    Msg::Error("Unable to open file 'opt_plugin.texi'");
     return;
   }
   fprintf(file, "%s@ftable @code\n", warn);
@@ -594,7 +596,7 @@ void Print_StringOptions(int num, int level, int diff, int help,
         if(file)
           fprintf(file, "%s\n", tmp);
         else
-          Msg(DIRECT, "%s", tmp);
+          Msg::Direct("%s", tmp);
       }
     }
     i++;
@@ -696,7 +698,7 @@ void Print_NumberOptions(int num, int level, int diff, int help,
         if(file)
           fprintf(file, "%s\n", tmp);
         else
-          Msg(DIRECT, tmp);
+          Msg::Direct(tmp);
       }
     }
     i++;
@@ -818,7 +820,7 @@ void Print_ColorOptions(int num, int level, int diff, int help,
         if(file)
           fprintf(file, "%s\n", tmp);
         else
-          Msg(DIRECT, tmp);
+          Msg::Direct(tmp);
       }
     }
     i++;
@@ -861,7 +863,7 @@ int Get_ColorForString(StringX4Int SX4I[], int alpha,
     opt = &PViewOptions::reference;                             \
   else{                                                         \
     if(num < 0 || num >= (int)PView::list.size()){              \
-      Msg(WARNING, "View[%d] does not exist", num);             \
+      Msg::Warning("View[%d] does not exist", num);             \
       return (error_val);                                       \
     }                                                           \
     view = PView::list[num];                                    \
@@ -2893,13 +2895,14 @@ double opt_general_shine_exponent(OPT_ARGS_NUM)
 
 double opt_general_verbosity(OPT_ARGS_NUM)
 {
-  if(action & GMSH_SET)
-    CTX.verbosity = (int)val;
+  if(action & GMSH_SET){
+    Msg::SetVerbosity((int)val);
+  }
 #if defined(HAVE_FLTK)
   if(WID && (action & GMSH_GUI))
-    WID->gen_value[5]->value(CTX.verbosity);
+    WID->gen_value[5]->value(Msg::GetVerbosity());
 #endif
-  return CTX.verbosity;
+  return Msg::GetVerbosity();
 }
 
 double opt_general_nopopup(OPT_ARGS_NUM)
@@ -2953,11 +2956,11 @@ double opt_general_orthographic(OPT_ARGS_NUM)
   if(WID && (action & GMSH_GUI)) {
     if(CTX.ortho){
       WID->gen_choice[2]->value(0);
-      if(!CTX.batch) Msg(STATUS2N, "Orthographic projection");
+      if(!CTX.batch) Msg::Status(2, false, "Orthographic projection");
     }
     else{
       WID->gen_choice[2]->value(1);
-      if(!CTX.batch) Msg(STATUS2N, "Perspective projection");
+      if(!CTX.batch) Msg::Status(2, false, "Perspective projection");
     }
   }
 #endif
@@ -2971,11 +2974,11 @@ double opt_general_mouse_selection(OPT_ARGS_NUM)
 #if defined(HAVE_FLTK)
   if(WID && (action & GMSH_GUI)) {
     if(CTX.mouse_selection){
-      if(!CTX.batch) Msg(STATUS2N, "Mouse selection ON");
+      if(!CTX.batch) Msg::Status(2, false, "Mouse selection ON");
       WID->g_status_butt[9]->color(FL_BACKGROUND_COLOR);
     }
     else{
-      if(!CTX.batch) Msg(STATUS2N, "Mouse selection OFF");
+      if(!CTX.batch) Msg::Status(2, false, "Mouse selection OFF");
       WID->g_status_butt[9]->color(FL_RED);
     }
     WID->g_status_butt[9]->redraw();
diff --git a/Common/ShapeFunctions.h b/Common/ShapeFunctions.h
index 43bc45dbe91ac82d006ba3d0e48b50d2ef74c6a5..6f41b9400519cb4f0994504154c21a97c04bfccc 100644
--- a/Common/ShapeFunctions.h
+++ b/Common/ShapeFunctions.h
@@ -21,6 +21,7 @@
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
 #include "Numeric.h"
+#include "Message.h"
 
 #define ONE  (1. + 1.e-6)
 #define ZERO (-1.e-6)
@@ -184,12 +185,12 @@ public:
   }
   virtual double integrateCirculation(double val[])
   {
-    Msg(GERROR, "integrateCirculation not available for this element");
+    Msg::Error("integrateCirculation not available for this element");
     return 0.;
   }
   virtual double integrateFlux(double val[])
   {
-    Msg(GERROR, "integrateFlux not available for this element");
+    Msg::Error("integrateFlux not available for this element");
     return 0.;
   }
   virtual void xyz2uvw(double xyz[3], double uvw[3])
@@ -230,7 +231,7 @@ public:
       uvw[2] = wn;
       iter++ ;
     }
-    //if(error > tol) Msg(WARNING, "Newton did not converge in xyz2uvw") ;
+    //if(error > tol) Msg::Warning("Newton did not converge in xyz2uvw") ;
   }
   virtual int isInside(double u, double v, double w) = 0;
   double maxEdgeLength()
@@ -930,7 +931,7 @@ class elementFactory{
       else if(numNodes == 5) return new pyramid(x, y, z);
       else return new tetrahedron(x, y, z);
     default: 
-      Msg(GERROR, "Unknown type of element in factory");
+      Msg::Error("Unknown type of element in factory");
       return NULL;
     }
   }
diff --git a/Common/VertexArray.cpp b/Common/VertexArray.cpp
index 8c30daada5104ca5384b52e51b8801dfa576f348..98438762904268aab31f35231c4795af5f319052 100644
--- a/Common/VertexArray.cpp
+++ b/Common/VertexArray.cpp
@@ -1,4 +1,4 @@
-// $Id: VertexArray.cpp,v 1.30 2008-03-20 11:44:02 geuzaine Exp $
+// $Id: VertexArray.cpp,v 1.31 2008-05-04 08:31:11 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -94,7 +94,7 @@ void VertexArray::add(double *x, double *y, double *z, SVector3 *n,
       return;
     _barycenters.insert(pc);
   }
-  
+
   for(int i = 0; i < npe; i++){
     addVertex(x[i], y[i], z[i]);
     if(n) addNormal(n[i].x(), n[i].y(), n[i].z());
diff --git a/DataStr/List.cpp b/DataStr/List.cpp
index 9b4dfe014a5f037012cc244e36f4aa3f1a751177..0d7d4c7ca1a12bafb42369d518bd4fec96a175b3 100644
--- a/DataStr/List.cpp
+++ b/DataStr/List.cpp
@@ -1,4 +1,4 @@
-// $Id: List.cpp,v 1.44 2008-03-20 11:44:02 geuzaine Exp $
+// $Id: List.cpp,v 1.45 2008-05-04 08:31:11 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -126,14 +126,14 @@ int List_Replace(List_T * liste, void *data,
 void List_Read(List_T * liste, int index, void *data)
 {
   if((index < 0) || (index >= liste->n))
-    Msg(FATAL, "Wrong list index (read)");
+    Msg::Fatal("Wrong list index (read)");
   memcpy(data, &liste->array[index * liste->size], liste->size);
 }
 
 void List_Write(List_T * liste, int index, void *data)
 {
   if((index < 0) || (index >= liste->n))
-    Msg(GERROR, "Wrong list index (write)");
+    Msg::Error("Wrong list index (write)");
   else {
     liste->isorder = 0;
     memcpy(&liste->array[index * liste->size], data, liste->size);
@@ -143,7 +143,7 @@ void List_Write(List_T * liste, int index, void *data)
 void List_Put(List_T * liste, int index, void *data)
 {
   if(index < 0)
-    Msg(GERROR, "Wrong list index (put)");
+    Msg::Error("Wrong list index (put)");
   else {
     if(index >= liste->n) {
       liste->n = index + 1;
@@ -165,7 +165,7 @@ void List_Pop(List_T * liste)
 void *List_Pointer(List_T * liste, int index)
 {
   if((index < 0) || (index >= liste->n))
-    Msg(FATAL, "Wrong list index (pointer)");
+    Msg::Fatal("Wrong list index (pointer)");
 
   liste->isorder = 0;
   return (&liste->array[index * liste->size]);
@@ -174,7 +174,7 @@ void *List_Pointer(List_T * liste, int index)
 void *List_Pointer_NoChange(List_T * liste, int index)
 {
   if((index < 0) || (index >= liste->n))
-    Msg(FATAL, "Wrong list index (pointer)");
+    Msg::Fatal("Wrong list index (pointer)");
 
   return (&liste->array[index * liste->size]);
 }
@@ -486,7 +486,7 @@ List_T *List_CreateFromFile(int n, int incr, int size, FILE * file, int format,
       }
     }
     else{
-      Msg(GERROR, "Bad type of data to create list from (size = %d)", size);
+      Msg::Error("Bad type of data to create list from (size = %d)", size);
       error = 1;
     }
     break;
@@ -499,13 +499,13 @@ List_T *List_CreateFromFile(int n, int incr, int size, FILE * file, int format,
       swap_bytes(liste->array, size, n);
     break;
   default:
-    Msg(GERROR, "Unknown list format");
+    Msg::Error("Unknown list format");
     error = 1;
     break;
   }
 
   if(error){
-    Msg(GERROR, "Read error");
+    Msg::Error("Read error");
     liste->n = 0;
   }
 
@@ -534,14 +534,14 @@ void List_WriteToFile(List_T * liste, FILE * file, int format)
       for(i = 0; i < n; i++)
         fputc(*((char *)&liste->array[i * liste->size]), file);
     else
-      Msg(GERROR, "Bad type of data to write list to file (size = %d)",
+      Msg::Error("Bad type of data to write list to file (size = %d)",
           liste->size);
     break;
   case LIST_FORMAT_BINARY:
     safe_fwrite(liste->array, liste->size, n, file);
     break;
   default:
-    Msg(GERROR, "Unknown list format");
+    Msg::Error("Unknown list format");
     break;
   }
 }
@@ -598,7 +598,7 @@ List_T *List_CreateFromFileOld(int n, int incr, int size, FILE * file, int forma
       }
     }
     else {
-      Msg(GERROR, "Bad type of data to create list from (size = %d)", size);
+      Msg::Error("Bad type of data to create list from (size = %d)", size);
       error = 1;
     }
     return liste;
@@ -611,13 +611,13 @@ List_T *List_CreateFromFileOld(int n, int incr, int size, FILE * file, int forma
       swap_bytes(liste->array, size, n);
     return liste;
   default:
-    Msg(GERROR, "Unknown list format");
+    Msg::Error("Unknown list format");
     error = 1;
     break;
   }
 
   if(error){
-    Msg(GERROR, "Read error");
+    Msg::Error("Read error");
     liste->n = 0;
   }
 
diff --git a/DataStr/List.h b/DataStr/List.h
index 539eff6ea8f80eb03eb0c147e284e88f166c7824..a352caa8d60541fb2f53b1c3d62c5d6b5c121815 100644
--- a/DataStr/List.h
+++ b/DataStr/List.h
@@ -29,14 +29,15 @@
 #define LIST_FORMAT_ASCII       0
 #define LIST_FORMAT_BINARY      1
 
-typedef struct {
+class List_T {
+public:
   int nmax;
   int size;
   int incr;
   int n;
   int isorder;
   char *array;
-} List_T;
+};
 
 List_T *List_Create(int n, int incr, int size);
 void    List_Delete(List_T *liste);
diff --git a/DataStr/Malloc.cpp b/DataStr/Malloc.cpp
index ab521e6f68a9abc7850cee21da9ed9cca3d064d7..5e40abc24d9c59aabca5542fcb88ace60ab90064 100644
--- a/DataStr/Malloc.cpp
+++ b/DataStr/Malloc.cpp
@@ -1,4 +1,4 @@
-// $Id: Malloc.cpp,v 1.22 2008-02-17 08:47:56 geuzaine Exp $
+// $Id: Malloc.cpp,v 1.23 2008-05-04 08:31:11 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -33,7 +33,7 @@ void *Malloc(size_t size)
     return (NULL);
   ptr = malloc(size);
   if(ptr == NULL)
-    Msg(FATAL, "Out of memory (buy some more RAM!)");
+    Msg::Fatal("Out of memory (buy some more RAM!)");
   return (ptr);
 }
 
@@ -45,7 +45,7 @@ void *Calloc(size_t num, size_t size)
     return (NULL);
   ptr = calloc(num, size);
   if(ptr == NULL)
-    Msg(FATAL, "Out of memory (buy some more RAM!)");
+    Msg::Fatal("Out of memory (buy some more RAM!)");
   return (ptr);
 }
 
@@ -55,7 +55,7 @@ void *Realloc(void *ptr, size_t size)
     return (NULL);
   ptr = realloc(ptr, size);
   if(ptr == NULL)
-    Msg(FATAL, "Out of memory (buy some more RAM!)");
+    Msg::Fatal("Out of memory (buy some more RAM!)");
   return (ptr);
 }
 
diff --git a/DataStr/SafeIO.cpp b/DataStr/SafeIO.cpp
index 40b61db86a3a1d278d6aa5b73febd6b3dc2fd57b..10da6164d115153ad38e2c5bf18cfc45e497528b 100644
--- a/DataStr/SafeIO.cpp
+++ b/DataStr/SafeIO.cpp
@@ -1,4 +1,4 @@
-// $Id: SafeIO.cpp,v 1.11 2008-02-17 08:47:56 geuzaine Exp $
+// $Id: SafeIO.cpp,v 1.12 2008-05-04 08:31:11 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -49,7 +49,7 @@ int safe_fprintf(FILE * stream, char *fmt, ...)
   va_end(args);
 
   if(ferror(stream)) {
-    Msg(GERROR, strerror(errno));
+    Msg::Error(strerror(errno));
     clearerr(stream);
     return 1;
   }
@@ -65,13 +65,13 @@ int safe_fwrite(const void *ptr, size_t size, size_t nmemb, FILE * stream)
 
   if(result < nmemb) {
     if(result >= 0)     /* Partial write */
-      Msg(GERROR, "Disk full");
+      Msg::Error("Disk full");
     else
-      Msg(GERROR, strerror(errno));
+      Msg::Error(strerror(errno));
     if(fflush(stream) < 0)
-      Msg(GERROR, "EOF reached");
+      Msg::Error("EOF reached");
     if(fclose(stream) < 0)
-      Msg(GERROR, strerror(errno));
+      Msg::Error(strerror(errno));
     return 1;
   }
   return 0;
diff --git a/DataStr/Tree.cpp b/DataStr/Tree.cpp
index c0a12bb756a225756ed58881a0949293a7eab465..592d434b077b2f3c86bf4f165df7f431bc75d9dc 100644
--- a/DataStr/Tree.cpp
+++ b/DataStr/Tree.cpp
@@ -1,4 +1,4 @@
-// $Id: Tree.cpp,v 1.23 2008-02-17 08:47:56 geuzaine Exp $
+// $Id: Tree.cpp,v 1.24 2008-05-04 08:31:11 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -55,7 +55,7 @@ void Tree_Add(Tree_T * tree, void *data)
   void *ptr;
 
   if(!tree)
-    Msg(GERROR, "Impossible to add in unallocated tree");
+    Msg::Error("Impossible to add in unallocated tree");
   else {
     ptr = Malloc(tree->size);
     memcpy(ptr, data, tree->size);
@@ -68,7 +68,7 @@ void *Tree_AddP(Tree_T * tree, void *data)
   void *ptr;
 
   if(!tree)
-    Msg(FATAL, "Impossible to add in unallocated tree");
+    Msg::Fatal("Impossible to add in unallocated tree");
   ptr = Malloc(tree->size);
   memcpy(ptr, data, tree->size);
   avl_insert(tree->root, ptr, ptr);
@@ -99,7 +99,7 @@ int Tree_Replace(Tree_T * tree, void *data)
   int state;
 
   if(!tree) {
-    Msg(GERROR, "Impossible to replace in unallocated tree");
+    Msg::Error("Impossible to replace in unallocated tree");
     return (0);
   }
   state = avl_lookup(tree->root, data, &ptr);
diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp
index 8d2a1991a91dc148a79818fa967ab3421268e003..a54db494bf8204b654db118de756983d8ea2d944 100644
--- a/Fltk/Callbacks.cpp
+++ b/Fltk/Callbacks.cpp
@@ -1,4 +1,4 @@
-// $Id: Callbacks.cpp,v 1.581 2008-04-22 07:37:09 geuzaine Exp $
+// $Id: Callbacks.cpp,v 1.582 2008-05-04 08:31:11 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -39,6 +39,8 @@
 #include "Draw.h"
 #include "SelectBuffer.h"
 #include "PView.h"
+#include "PViewOptions.h"
+#include "PViewData.h"
 #include "CreateFile.h"
 #include "OpenFile.h"
 #include "CommandLine.h"
@@ -585,7 +587,7 @@ void file_new_cb(CALLBACK_ARGS)
     }
     FILE *fp = fopen(name.c_str(), "w");
     if(!fp){
-      Msg(GERROR, "Unable to open file '%s'", name.c_str());
+      Msg::Error("Unable to open file '%s'", name.c_str());
       return;
     }
     time_t now;
@@ -822,7 +824,7 @@ void file_rename_cb(CALLBACK_ARGS)
 
 void file_quit_cb(CALLBACK_ARGS)
 {
-  Exit(0);
+  Msg::Exit(0);
 }
 
 // Option Menu
@@ -860,9 +862,9 @@ void options_browser_cb(CALLBACK_ARGS)
 
 void options_save_cb(CALLBACK_ARGS)
 {
-  Msg(STATUS2, "Writing '%s'", CTX.options_filename_fullpath);
+  Msg::Status(2, true, "Writing '%s'", CTX.options_filename_fullpath);
   Print_Options(0, GMSH_OPTIONSRC, 1, 1, CTX.options_filename_fullpath);
-  Msg(STATUS2, "Wrote '%s'", CTX.options_filename_fullpath);
+  Msg::Status(2, true, "Wrote '%s'", CTX.options_filename_fullpath);
 }
 
 void options_restore_defaults_cb(CALLBACK_ARGS)
@@ -898,7 +900,7 @@ void general_options_rotation_center_select_cb(CALLBACK_ARGS)
   std::vector<GRegion*> regions;
   std::vector<MElement*> elements;
 
-  Msg(ONSCREEN, "Select entity\n[Press 'q' to abort]");
+  Msg::Status(3, false, "Select entity\n[Press 'q' to abort]");
   char ib = SelectEntity(ENT_ALL, vertices, edges, faces, regions, elements);
   if(ib == 'l') {
     SPoint3 pc(0., 0., 0.);
@@ -919,7 +921,7 @@ void general_options_rotation_center_select_cb(CALLBACK_ARGS)
   }
   ZeroHighlight();
   Draw();
-  Msg(ONSCREEN, "");
+  Msg::Status(3, false, "");
 }
 
 void general_options_ok_cb(CALLBACK_ARGS)
@@ -1906,7 +1908,7 @@ void message_copy_cb(CALLBACK_ARGS)
     if(WID->msg_browser->selected(i)) {
       const char *c = WID->msg_browser->text(i);
       if(strlen(buff) + strlen(c) > BUFFL - 2) {
-        Msg(GERROR, "Text selection too large to copy");
+        Msg::Error("Text selection too large to copy");
         break;
       }
       if(c[0] == '@')
@@ -2290,7 +2292,7 @@ void visibility_interactive_cb(CALLBACK_ARGS)
     if(what == ENT_ALL) 
       CTX.mesh.changed = ENT_ALL;
     Draw();
-    Msg(ONSCREEN, "Select %s\n[Press %s'q' to abort]", 
+    Msg::Status(3, false, "Select %s\n[Press %s'q' to abort]", 
         help, mode ? "" : "'u' to undo or ");
 
     char ib = SelectEntity(what, vertices, edges, faces, regions, elements);
@@ -2315,7 +2317,7 @@ void visibility_interactive_cb(CALLBACK_ARGS)
   CTX.mesh.changed = ENT_ALL;
   CTX.pick_elements = 0;
   Draw();  
-  Msg(ONSCREEN, "");
+  Msg::Status(3, false, "");
 }
 
 // Clipping planes menu
@@ -2435,123 +2437,123 @@ void manip_update_cb(CALLBACK_ARGS)
 
 void help_short_cb(CALLBACK_ARGS)
 {
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "Keyboard shortcuts:");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "  Left arrow    Go to previous time step"); 
-  Msg(DIRECT, "  Right arrow   Go to next time step"); 
-  Msg(DIRECT, "  Up arrow      Make previous view visible"); 
-  Msg(DIRECT, "  Down arrow    Make next view visible"); 
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "  <             Go back to previous context");
-  Msg(DIRECT, "  >             Go forward to next context");
-  Msg(DIRECT, "  0             Reload project file");
-  Msg(DIRECT, "  1 or F1       Mesh lines");
-  Msg(DIRECT, "  2 or F2       Mesh surfaces");
-  Msg(DIRECT, "  3 or F3       Mesh volumes");
-  Msg(DIRECT, "  Escape        Cancel lasso zoom/selection, toggle mouse selection ON/OFF");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "  g             Go to geometry module");
-  Msg(DIRECT, "  m             Go to mesh module");
-  Msg(DIRECT, "  p             Go to post-processing module");
-  Msg(DIRECT, "  s             Go to solver module");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "  Shift+a       Bring all windows to front");
-  Msg(DIRECT, "  Shift+g       Show geometry options");
-  Msg(DIRECT, "  Shift+m       Show mesh options");
-  Msg(DIRECT, "  Shift+o       Show general options"); 
-  Msg(DIRECT, "  Shift+p       Show post-processing options");
-  Msg(DIRECT, "  Shift+s       Show solver options"); 
-  Msg(DIRECT, "  Shift+u       Show post-processing view plugins");
-  Msg(DIRECT, "  Shift+w       Show post-processing view options");
-  Msg(DIRECT, "  Shift+Escape  Enable full mouse selection");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "  " CC("i") "        Show statistics window"); 
-  Msg(DIRECT, "  " CC("l") "        Show message console");
+  Msg::Direct(" ");
+  Msg::Direct("Keyboard shortcuts:");
+  Msg::Direct(" ");
+  Msg::Direct("  Left arrow    Go to previous time step"); 
+  Msg::Direct("  Right arrow   Go to next time step"); 
+  Msg::Direct("  Up arrow      Make previous view visible"); 
+  Msg::Direct("  Down arrow    Make next view visible"); 
+  Msg::Direct(" ");
+  Msg::Direct("  <             Go back to previous context");
+  Msg::Direct("  >             Go forward to next context");
+  Msg::Direct("  0             Reload project file");
+  Msg::Direct("  1 or F1       Mesh lines");
+  Msg::Direct("  2 or F2       Mesh surfaces");
+  Msg::Direct("  3 or F3       Mesh volumes");
+  Msg::Direct("  Escape        Cancel lasso zoom/selection, toggle mouse selection ON/OFF");
+  Msg::Direct(" ");
+  Msg::Direct("  g             Go to geometry module");
+  Msg::Direct("  m             Go to mesh module");
+  Msg::Direct("  p             Go to post-processing module");
+  Msg::Direct("  s             Go to solver module");
+  Msg::Direct(" ");
+  Msg::Direct("  Shift+a       Bring all windows to front");
+  Msg::Direct("  Shift+g       Show geometry options");
+  Msg::Direct("  Shift+m       Show mesh options");
+  Msg::Direct("  Shift+o       Show general options"); 
+  Msg::Direct("  Shift+p       Show post-processing options");
+  Msg::Direct("  Shift+s       Show solver options"); 
+  Msg::Direct("  Shift+u       Show post-processing view plugins");
+  Msg::Direct("  Shift+w       Show post-processing view options");
+  Msg::Direct("  Shift+Escape  Enable full mouse selection");
+  Msg::Direct(" ");
+  Msg::Direct("  " CC("i") "        Show statistics window"); 
+  Msg::Direct("  " CC("l") "        Show message console");
 #if defined(__APPLE__)
-  Msg(DIRECT, "  " CC("m") "        Minimize window"); 
+  Msg::Direct("  " CC("m") "        Minimize window"); 
 #endif
-  Msg(DIRECT, "  " CC("n") "        Create new project file"); 
-  Msg(DIRECT, "  " CC("o") "        Open project file"); 
-  Msg(DIRECT, "  " CC("q") "        Quit");
-  Msg(DIRECT, "  " CC("r") "        Rename project file");
-  Msg(DIRECT, "  " CC("s") "        Save file as");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "  Shift+" CC("c") "  Show clipping plane window");
-  Msg(DIRECT, "  Shift+" CC("m") "  Show manipulator window"); 
-  Msg(DIRECT, "  Shift+" CC("n") "  Show option window"); 
-  Msg(DIRECT, "  Shift+" CC("o") "  Merge file(s)"); 
-  Msg(DIRECT, "  Shift+" CC("s") "  Save mesh in default format");
-  Msg(DIRECT, "  Shift+" CC("u") "  Show plugin window");
-  Msg(DIRECT, "  Shift+" CC("v") "  Show visibility window");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "  Alt+a         Loop through axes modes"); 
-  Msg(DIRECT, "  Alt+b         Hide/show bounding boxes");
-  Msg(DIRECT, "  Alt+c         Loop through predefined color schemes");
-  Msg(DIRECT, "  Alt+e         Hide/Show element outlines for visible post-processing views");
-  Msg(DIRECT, "  Alt+f         Change redraw mode (fast/full)"); 
-  Msg(DIRECT, "  Alt+h         Hide/show all post-processing views"); 
-  Msg(DIRECT, "  Alt+i         Hide/show all post-processing view scales");
-  Msg(DIRECT, "  Alt+l         Hide/show geometry lines");
-  Msg(DIRECT, "  Alt+m         Toggle visibility of all mesh entities");
-  Msg(DIRECT, "  Alt+n         Hide/show all post-processing view annotations");
-  Msg(DIRECT, "  Alt+o         Change projection mode (orthographic/perspective)");
-  Msg(DIRECT, "  Alt+p         Hide/show geometry points");
-  Msg(DIRECT, "  Alt+r         Loop through range modes for visible post-processing views"); 
-  Msg(DIRECT, "  Alt+s         Hide/show geometry surfaces");
-  Msg(DIRECT, "  Alt+t         Loop through interval modes for visible post-processing views"); 
-  Msg(DIRECT, "  Alt+v         Hide/show geometry volumes");
-  Msg(DIRECT, "  Alt+w         Enable/disable all lighting");
-  Msg(DIRECT, "  Alt+x         Set X view"); 
-  Msg(DIRECT, "  Alt+y         Set Y view"); 
-  Msg(DIRECT, "  Alt+z         Set Z view"); 
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "  Alt+Shift+a   Hide/show small axes"); 
-  Msg(DIRECT, "  Alt+Shift+b   Hide/show mesh volume faces");
-  Msg(DIRECT, "  Alt+Shift+d   Hide/show mesh surface faces");
-  Msg(DIRECT, "  Alt+Shift+l   Hide/show mesh lines");
-  Msg(DIRECT, "  Alt+Shift+o   Adjust projection parameters");
-  Msg(DIRECT, "  Alt+Shift+p   Hide/show mesh points");
-  Msg(DIRECT, "  Alt+Shift+s   Hide/show mesh surface edges");
-  Msg(DIRECT, "  Alt+Shift+v   Hide/show mesh volume edges");
-  Msg(DIRECT, "  Alt+Shift+w   Reverse all mesh normals");
-  Msg(DIRECT, "  Alt+Shift+x   Set -X view"); 
-  Msg(DIRECT, "  Alt+Shift+y   Set -Y view"); 
-  Msg(DIRECT, "  Alt+Shift+z   Set -Z view"); 
-  Msg(DIRECT, " ");
+  Msg::Direct("  " CC("n") "        Create new project file"); 
+  Msg::Direct("  " CC("o") "        Open project file"); 
+  Msg::Direct("  " CC("q") "        Quit");
+  Msg::Direct("  " CC("r") "        Rename project file");
+  Msg::Direct("  " CC("s") "        Save file as");
+  Msg::Direct(" ");
+  Msg::Direct("  Shift+" CC("c") "  Show clipping plane window");
+  Msg::Direct("  Shift+" CC("m") "  Show manipulator window"); 
+  Msg::Direct("  Shift+" CC("n") "  Show option window"); 
+  Msg::Direct("  Shift+" CC("o") "  Merge file(s)"); 
+  Msg::Direct("  Shift+" CC("s") "  Save mesh in default format");
+  Msg::Direct("  Shift+" CC("u") "  Show plugin window");
+  Msg::Direct("  Shift+" CC("v") "  Show visibility window");
+  Msg::Direct(" ");
+  Msg::Direct("  Alt+a         Loop through axes modes"); 
+  Msg::Direct("  Alt+b         Hide/show bounding boxes");
+  Msg::Direct("  Alt+c         Loop through predefined color schemes");
+  Msg::Direct("  Alt+e         Hide/Show element outlines for visible post-processing views");
+  Msg::Direct("  Alt+f         Change redraw mode (fast/full)"); 
+  Msg::Direct("  Alt+h         Hide/show all post-processing views"); 
+  Msg::Direct("  Alt+i         Hide/show all post-processing view scales");
+  Msg::Direct("  Alt+l         Hide/show geometry lines");
+  Msg::Direct("  Alt+m         Toggle visibility of all mesh entities");
+  Msg::Direct("  Alt+n         Hide/show all post-processing view annotations");
+  Msg::Direct("  Alt+o         Change projection mode (orthographic/perspective)");
+  Msg::Direct("  Alt+p         Hide/show geometry points");
+  Msg::Direct("  Alt+r         Loop through range modes for visible post-processing views"); 
+  Msg::Direct("  Alt+s         Hide/show geometry surfaces");
+  Msg::Direct("  Alt+t         Loop through interval modes for visible post-processing views"); 
+  Msg::Direct("  Alt+v         Hide/show geometry volumes");
+  Msg::Direct("  Alt+w         Enable/disable all lighting");
+  Msg::Direct("  Alt+x         Set X view"); 
+  Msg::Direct("  Alt+y         Set Y view"); 
+  Msg::Direct("  Alt+z         Set Z view"); 
+  Msg::Direct(" ");
+  Msg::Direct("  Alt+Shift+a   Hide/show small axes"); 
+  Msg::Direct("  Alt+Shift+b   Hide/show mesh volume faces");
+  Msg::Direct("  Alt+Shift+d   Hide/show mesh surface faces");
+  Msg::Direct("  Alt+Shift+l   Hide/show mesh lines");
+  Msg::Direct("  Alt+Shift+o   Adjust projection parameters");
+  Msg::Direct("  Alt+Shift+p   Hide/show mesh points");
+  Msg::Direct("  Alt+Shift+s   Hide/show mesh surface edges");
+  Msg::Direct("  Alt+Shift+v   Hide/show mesh volume edges");
+  Msg::Direct("  Alt+Shift+w   Reverse all mesh normals");
+  Msg::Direct("  Alt+Shift+x   Set -X view"); 
+  Msg::Direct("  Alt+Shift+y   Set -Y view"); 
+  Msg::Direct("  Alt+Shift+z   Set -Z view"); 
+  Msg::Direct(" ");
   WID->create_message_window();
 }
 
 void help_mouse_cb(CALLBACK_ARGS)
 {
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "Mouse actions:");
-  Msg(DIRECT, " ");
-  Msg(DIRECT, "  Move                - Highlight the entity under the mouse pointer");
-  Msg(DIRECT, "                        and display its properties in the status bar");
-  Msg(DIRECT, "                      - Resize a lasso zoom or a lasso (un)selection");
-  Msg(DIRECT, "  Left button         - Rotate");
-  Msg(DIRECT, "                      - Select an entity");
-  Msg(DIRECT, "                      - Accept a lasso zoom or a lasso selection"); 
-  Msg(DIRECT, "  Ctrl+Left button    Start a lasso zoom or a lasso (un)selection"); 
-  Msg(DIRECT, "  Middle button       - Zoom");
-  Msg(DIRECT, "                      - Unselect an entity");
-  Msg(DIRECT, "                      - Accept a lasso zoom or a lasso unselection");
-  Msg(DIRECT, "  Ctrl+Middle button  Orthogonalize display"); 
-  Msg(DIRECT, "  Right button        - Pan");
-  Msg(DIRECT, "                      - Cancel a lasso zoom or a lasso (un)selection");
-  Msg(DIRECT, "                      - Pop-up menu on post-processing view button");
-  Msg(DIRECT, "  Ctrl+Right button   Reset to default viewpoint");   
-  Msg(DIRECT, " ");   
-  Msg(DIRECT, "  For a 2 button mouse, Middle button = Shift+Left button");
-  Msg(DIRECT, "  For a 1 button mouse, Middle button = Shift+Left button, Right button = Alt+Left button");
-  Msg(DIRECT, " ");
+  Msg::Direct(" ");
+  Msg::Direct("Mouse actions:");
+  Msg::Direct(" ");
+  Msg::Direct("  Move                - Highlight the entity under the mouse pointer");
+  Msg::Direct("                        and display its properties in the status bar");
+  Msg::Direct("                      - Resize a lasso zoom or a lasso (un)selection");
+  Msg::Direct("  Left button         - Rotate");
+  Msg::Direct("                      - Select an entity");
+  Msg::Direct("                      - Accept a lasso zoom or a lasso selection"); 
+  Msg::Direct("  Ctrl+Left button    Start a lasso zoom or a lasso (un)selection"); 
+  Msg::Direct("  Middle button       - Zoom");
+  Msg::Direct("                      - Unselect an entity");
+  Msg::Direct("                      - Accept a lasso zoom or a lasso unselection");
+  Msg::Direct("  Ctrl+Middle button  Orthogonalize display"); 
+  Msg::Direct("  Right button        - Pan");
+  Msg::Direct("                      - Cancel a lasso zoom or a lasso (un)selection");
+  Msg::Direct("                      - Pop-up menu on post-processing view button");
+  Msg::Direct("  Ctrl+Right button   Reset to default viewpoint");   
+  Msg::Direct(" ");   
+  Msg::Direct("  For a 2 button mouse, Middle button = Shift+Left button");
+  Msg::Direct("  For a 1 button mouse, Middle button = Shift+Left button, Right button = Alt+Left button");
+  Msg::Direct(" ");
   WID->create_message_window();
 }
 
 void help_command_line_cb(CALLBACK_ARGS)
 {
-  Msg(DIRECT, " ");
+  Msg::Direct(" ");
   Print_Usage("gmsh");
   WID->create_message_window();
 }
@@ -2559,7 +2561,7 @@ void help_command_line_cb(CALLBACK_ARGS)
 void help_license_cb(CALLBACK_ARGS)
 {
   extern void print_license();
-  Msg(DIRECT, " ");
+  Msg::Direct(" ");
   print_license();
   WID->create_message_window();
 }
@@ -2582,7 +2584,7 @@ void _replace_multi_format(const char *in, const char *val, char *out)
         j += strlen(val);
       }
       else{
-        Msg(WARNING, "Skipping unknown format '%%%c' in '%s'", in[i + 1], in);
+        Msg::Warning("Skipping unknown format '%%%c' in '%s'", in[i + 1], in);
         i += 2;
       }
     }
@@ -2695,7 +2697,7 @@ void geometry_elementary_add_new_point_cb(CALLBACK_ARGS)
 
   while(1) {
     WID->g_opengl_window->AddPointMode = true;
-    Msg(ONSCREEN, "Move mouse and/or enter coordinates\n"
+    Msg::Status(3, false, "Move mouse and/or enter coordinates\n"
         "[Press 'Shift' to hold position, 'e' to add point or 'q' to abort]");
     std::vector<GVertex*> vertices;
     std::vector<GEdge*> edges;
@@ -2718,7 +2720,7 @@ void geometry_elementary_add_new_point_cb(CALLBACK_ARGS)
     }
   }
 
-  Msg(ONSCREEN, "");
+  Msg::Status(3, false, "");
 }
 
 static void _new_multiline(int type)
@@ -2737,10 +2739,10 @@ static void _new_multiline(int type)
   int n = 0;
   while(1) {
     if(n == 0)
-      Msg(ONSCREEN, "Select control points\n"
+      Msg::Status(3, false, "Select control points\n"
           "[Press 'e' to end selection or 'q' to abort]");
     else
-      Msg(ONSCREEN, "Select control points\n"
+      Msg::Status(3, false, "Select control points\n"
           "[Press 'e' to end selection, 'u' to undo last selection or 'q' to abort]");
     char ib = SelectEntity(ENT_POINT, vertices, edges, faces, regions, elements);
     if(ib == 'l') {
@@ -2751,7 +2753,7 @@ static void _new_multiline(int type)
       Draw();
     }
     if(ib == 'r') {
-      Msg(WARNING, "Entity de-selection not supported yet during multi-line creation");
+      Msg::Warning("Entity de-selection not supported yet during multi-line creation");
     }
     if(ib == 'e') {
       if(n >= 2) {
@@ -2789,7 +2791,7 @@ static void _new_multiline(int type)
     }
   }
 
-  Msg(ONSCREEN, "");
+  Msg::Status(3, false, "");
 }
 
 void geometry_elementary_add_new_line_cb(CALLBACK_ARGS)
@@ -2813,10 +2815,10 @@ void geometry_elementary_add_new_line_cb(CALLBACK_ARGS)
   int n = 0;
   while(1) {
     if(n == 0)
-      Msg(ONSCREEN, "Select start point\n"
+      Msg::Status(3, false, "Select start point\n"
           "[Press 'q' to abort]");
     if(n == 1)
-      Msg(ONSCREEN, "Select end point\n"
+      Msg::Status(3, false, "Select end point\n"
           "[Press 'u' to undo last selection or 'q' to abort]");
     char ib = SelectEntity(ENT_POINT, vertices, edges, faces, regions, elements);
     if(ib == 'l') {
@@ -2825,7 +2827,7 @@ void geometry_elementary_add_new_line_cb(CALLBACK_ARGS)
       p[n++] = vertices[0]->tag();
     }
     if(ib == 'r') {
-      Msg(WARNING, "Entity de-selection not supported yet during line creation");
+      Msg::Warning("Entity de-selection not supported yet during line creation");
     }
     if(ib == 'u') {
       if(n > 0){
@@ -2848,7 +2850,7 @@ void geometry_elementary_add_new_line_cb(CALLBACK_ARGS)
     }
   }
 
-  Msg(ONSCREEN, "");
+  Msg::Status(3, false, "");
 }
 
 void geometry_elementary_add_new_spline_cb(CALLBACK_ARGS)
@@ -2877,13 +2879,13 @@ void geometry_elementary_add_new_circle_cb(CALLBACK_ARGS)
   int n = 0;
   while(1) {
     if(n == 0)
-      Msg(ONSCREEN, "Select start point\n"
+      Msg::Status(3, false, "Select start point\n"
           "[Press 'q' to abort]");
     if(n == 1)
-      Msg(ONSCREEN, "Select center point\n"
+      Msg::Status(3, false, "Select center point\n"
           "[Press 'u' to undo last selection or 'q' to abort]");
     if(n == 2)
-      Msg(ONSCREEN, "Select end point\n"
+      Msg::Status(3, false, "Select end point\n"
           "[Press 'u' to undo last selection or 'q' to abort]");
     char ib = SelectEntity(ENT_POINT, vertices, edges, faces, regions, elements);
     if(ib == 'l') {
@@ -2892,7 +2894,7 @@ void geometry_elementary_add_new_circle_cb(CALLBACK_ARGS)
       p[n++] = vertices[0]->tag();
     }
     if(ib == 'r') {
-      Msg(WARNING, "Entity de-selection not supported yet during circle creation");
+      Msg::Warning("Entity de-selection not supported yet during circle creation");
     }
     if(ib == 'u') {
       if(n > 0){
@@ -2915,7 +2917,7 @@ void geometry_elementary_add_new_circle_cb(CALLBACK_ARGS)
     }
   }
 
-  Msg(ONSCREEN, "");
+  Msg::Status(3, false, "");
 }
 
 void geometry_elementary_add_new_ellipse_cb(CALLBACK_ARGS)
@@ -2934,16 +2936,16 @@ void geometry_elementary_add_new_ellipse_cb(CALLBACK_ARGS)
   int n = 0;
   while(1) {
     if(n == 0)
-      Msg(ONSCREEN, "Select start point\n"
+      Msg::Status(3, false, "Select start point\n"
           "[Press 'q' to abort]");
     if(n == 1)
-      Msg(ONSCREEN, "Select center point\n"
+      Msg::Status(3, false, "Select center point\n"
           "[Press 'u' to undo last selection or 'q' to abort]");
     if(n == 2)
-      Msg(ONSCREEN, "Select major axis point\n"
+      Msg::Status(3, false, "Select major axis point\n"
           "[Press 'u' to undo last selection or 'q' to abort]");
     if(n == 3)
-      Msg(ONSCREEN, "Select end point\n"
+      Msg::Status(3, false, "Select end point\n"
           "[Press 'u' to undo last selection or 'q' to abort]");
     char ib = SelectEntity(ENT_POINT, vertices, edges, faces, regions, elements);
     if(ib == 'l') {
@@ -2952,7 +2954,7 @@ void geometry_elementary_add_new_ellipse_cb(CALLBACK_ARGS)
       p[n++] = vertices[0]->tag();
     }
     if(ib == 'r') {
-      Msg(WARNING, "Entity de-selection not supported yet during ellipse creation");
+      Msg::Warning("Entity de-selection not supported yet during ellipse creation");
     }
     if(ib == 'u') {
       if(n > 0){
@@ -2975,7 +2977,7 @@ void geometry_elementary_add_new_ellipse_cb(CALLBACK_ARGS)
     }
   }
 
-  Msg(ONSCREEN, "");
+  Msg::Status(3, false, "");
 }
 
 static void _new_surface_volume(int mode)
@@ -3009,18 +3011,18 @@ static void _new_surface_volume(int mode)
     while(1) {
       if(type == ENT_LINE){
         if(!List_Nbr(List1))
-          Msg(ONSCREEN, "Select surface boundary\n"
+          Msg::Status(3, false, "Select surface boundary\n"
               "[Press 'q' to abort]");
         else
-          Msg(ONSCREEN, "Select surface boundary\n"
+          Msg::Status(3, false, "Select surface boundary\n"
               "[Press 'u' to undo last selection or 'q' to abort]");
       }
       else{
         if(!List_Nbr(List1))
-          Msg(ONSCREEN, "Select volume boundary\n"
+          Msg::Status(3, false, "Select volume boundary\n"
               "[Press 'q' to abort]");
         else
-          Msg(ONSCREEN, "Select volume boundary\n"
+          Msg::Status(3, false, "Select volume boundary\n"
               "[Press 'u' to undo last selection or 'q' to abort]");
       }
 
@@ -3042,7 +3044,7 @@ static void _new_surface_volume(int mode)
         }
       }
       if(ib == 'r') {
-        Msg(WARNING, "Entity de-selection not supported yet during surface/volume creation");
+        Msg::Warning("Entity de-selection not supported yet during surface/volume creation");
       }
       if(ib == 'l') {
         int num = (type == ENT_LINE) ? edges[0]->tag() : faces[0]->tag();
@@ -3055,10 +3057,10 @@ static void _new_surface_volume(int mode)
           List_Add(List2, &num);
           while(1) {
             if(!List_Nbr(List1))
-              Msg(ONSCREEN, "Select hole boundaries (if none, press 'e')\n"
+              Msg::Status(3, false, "Select hole boundaries (if none, press 'e')\n"
                   "[Press 'e' to end selection or 'q' to abort]");
             else
-              Msg(ONSCREEN, "Select hole boundaries\n"
+              Msg::Status(3, false, "Select hole boundaries\n"
                   "[Press 'e' to end selection, 'u' to undo last selection or 'q' to abort]");
             ib = SelectEntity(type, vertices, edges, faces, regions, elements);
             if(ib == 'q') {
@@ -3095,7 +3097,7 @@ static void _new_surface_volume(int mode)
               }
             }
             if(ib == 'r') {
-              Msg(WARNING, "Entity de-selection not supported yet during surface/volume creation");
+              Msg::Warning("Entity de-selection not supported yet during surface/volume creation");
             }
           }
           if(List_Nbr(List2)) {
@@ -3118,7 +3120,7 @@ stopall:;
   List_Delete(List1);
   List_Delete(List2);
 
-  Msg(ONSCREEN, "");
+  Msg::Status(3, false, "");
 }
 
 void geometry_elementary_add_new_planesurface_cb(CALLBACK_ARGS)
@@ -3167,7 +3169,7 @@ static void _action_point_line_surface_volume(int action, int mode, const char *
     opt_geometry_volumes(0, GMSH_SET | GMSH_GUI, 1);
   }
   else{
-    Msg(GERROR, "Unknown entity to select");
+    Msg::Error("Unknown entity to select");
     return;
   }
 
@@ -3180,10 +3182,10 @@ static void _action_point_line_surface_volume(int action, int mode, const char *
   List_T *List1 = List_Create(5, 5, sizeof(int));
   while(1) {
     if(!List_Nbr(List1))
-      Msg(ONSCREEN, "Select %s\n"
+      Msg::Status(3, false, "Select %s\n"
           "[Press 'e' to end selection or 'q' to abort]", str);
     else
-      Msg(ONSCREEN, "Select %s\n"
+      Msg::Status(3, false, "Select %s\n"
           "[Press 'e' to end selection, 'u' to undo last selection or 'q' to abort]", str);
 
     char ib = SelectEntity(type, vertices, edges, faces, regions, elements);
@@ -3282,7 +3284,7 @@ static void _action_point_line_surface_volume(int action, int mode, const char *
       }
     }
     if(ib == 'i') {
-      Msg(GERROR, "Inverting selection!");
+      Msg::Error("Inverting selection!");
     }
     if(ib == 'e') {
       if(List_Nbr(List1)){
@@ -3346,7 +3348,7 @@ static void _action_point_line_surface_volume(int action, int mode, const char *
           add_recosurf(List1, CTX.filename);
           break;
         default:
-          Msg(GERROR, "Unknown action on selected entities");
+          Msg::Error("Unknown action on selected entities");
           break;
         }
         List_Reset(List1);
@@ -3364,7 +3366,7 @@ static void _action_point_line_surface_volume(int action, int mode, const char *
   }
   List_Delete(List1);
 
-  Msg(ONSCREEN, "");
+  Msg::Status(3, false, "");
 }
   
 void geometry_elementary_add_translate_cb(CALLBACK_ARGS)
@@ -3681,21 +3683,21 @@ void mesh_1d_cb(CALLBACK_ARGS)
 {
   GModel::current()->mesh(1);
   Draw();
-  Msg(STATUS2N, " ");
+  Msg::Status(2, false, " ");
 }
 
 void mesh_2d_cb(CALLBACK_ARGS)
 {
   GModel::current()->mesh(2);
   Draw();
-  Msg(STATUS2N, " ");
+  Msg::Status(2, false, " ");
 }
 
 void mesh_3d_cb(CALLBACK_ARGS)
 {
   GModel::current()->mesh(3);
   Draw();
-  Msg(STATUS2N, " ");
+  Msg::Status(2, false, " ");
 }
 
 void mesh_delete_cb(CALLBACK_ARGS)
@@ -3741,10 +3743,10 @@ void mesh_delete_parts_cb(CALLBACK_ARGS)
     Draw();
 
     if(ele.size() || ent.size())
-      Msg(ONSCREEN, "Select %s\n"
+      Msg::Status(3, false, "Select %s\n"
           "[Press 'e' to end selection, 'u' to undo last selection or 'q' to abort]", str);
     else
-      Msg(ONSCREEN, "Select %s\n"
+      Msg::Status(3, false, "Select %s\n"
           "[Press 'e' to end selection or 'q' to abort]", str);
 
     char ib = SelectEntity(what, vertices, edges, faces, regions, elements);
@@ -3824,17 +3826,17 @@ void mesh_delete_parts_cb(CALLBACK_ARGS)
   CTX.mesh.changed = ENT_ALL;
   CTX.pick_elements = 0;
   Draw();  
-  Msg(ONSCREEN, "");
+  Msg::Status(3, false, "");
 }
 
 void mesh_update_edges_cb(CALLBACK_ARGS)
 {
-  Msg(GERROR, "Update edges not implemented yet");
+  Msg::Error("Update edges not implemented yet");
 }
 
 void mesh_remesh_cb(CALLBACK_ARGS)
 {
-  Msg(GERROR, "Remesh not implemented yet");
+  Msg::Error("Remesh not implemented yet");
 }
 
 void mesh_inspect_cb(CALLBACK_ARGS)
@@ -3850,29 +3852,29 @@ void mesh_inspect_cb(CALLBACK_ARGS)
   Draw();
 
   while(1) {
-    Msg(ONSCREEN, "Select element\n[Press 'q' to abort]");
+    Msg::Status(3, false, "Select element\n[Press 'q' to abort]");
     char ib = SelectEntity(ENT_ALL, vertices, edges, faces, regions, elements);
     if(ib == 'l') {
       if(elements.size()){
         ZeroHighlight();
         elements[0]->setVisibility(2);
-        Msg(DIRECT, "Element %d:", elements[0]->getNum());
-        Msg(DIRECT, "  Type: %d", elements[0]->getTypeForMSH()); 
-        Msg(DIRECT, "  Dimension: %d", elements[0]->getDim());
-        Msg(DIRECT, "  Order: %d", elements[0]->getPolynomialOrder()); 
-        Msg(DIRECT, "  Partition: %d", elements[0]->getPartition()); 
+        Msg::Direct("Element %d:", elements[0]->getNum());
+        Msg::Direct("  Type: %d", elements[0]->getTypeForMSH()); 
+        Msg::Direct("  Dimension: %d", elements[0]->getDim());
+        Msg::Direct("  Order: %d", elements[0]->getPolynomialOrder()); 
+        Msg::Direct("  Partition: %d", elements[0]->getPartition()); 
         char tmp1[32], tmp2[512];
         sprintf(tmp2, "  Vertices:");
         for(int i = 0; i < elements[0]->getNumVertices(); i++){
           sprintf(tmp1, " %d", elements[0]->getVertex(i)->getNum());
           strcat(tmp2, tmp1);
         }
-        Msg(DIRECT, tmp2);
+        Msg::Direct(tmp2);
         SPoint3 pt = elements[0]->barycenter();
-        Msg(DIRECT, "  Barycenter: (%g,%g,%g)", pt[0], pt[1], pt[2]);
-        Msg(DIRECT, "  Rho: %g", elements[0]->rhoShapeMeasure());
-        Msg(DIRECT, "  Gamma: %g", elements[0]->gammaShapeMeasure());
-        Msg(DIRECT, "  Eta: %g", elements[0]->etaShapeMeasure());
+        Msg::Direct("  Barycenter: (%g,%g,%g)", pt[0], pt[1], pt[2]);
+        Msg::Direct("  Rho: %g", elements[0]->rhoShapeMeasure());
+        Msg::Direct("  Gamma: %g", elements[0]->gammaShapeMeasure());
+        Msg::Direct("  Eta: %g", elements[0]->etaShapeMeasure());
         CTX.mesh.changed = ENT_ALL;
         Draw();
         WID->create_message_window();
@@ -3887,7 +3889,7 @@ void mesh_inspect_cb(CALLBACK_ARGS)
   CTX.pick_elements = 0;
   CTX.mesh.changed = ENT_ALL;
   Draw();
-  Msg(ONSCREEN, "");
+  Msg::Status(3, false, "");
 }
 
 void mesh_degree_cb(CALLBACK_ARGS)
@@ -3899,13 +3901,13 @@ void mesh_degree_cb(CALLBACK_ARGS)
     SetOrder1(GModel::current());
   CTX.mesh.changed |= (ENT_LINE | ENT_SURFACE | ENT_VOLUME);
   Draw();
-  Msg(STATUS2N, " ");
+  Msg::Status(2, false, " ");
 }
 
 void mesh_optimize_cb(CALLBACK_ARGS)
 {
   if(CTX.threads_lock) {
-    Msg(INFO, "I'm busy! Ask me that later...");
+    Msg::Info("I'm busy! Ask me that later...");
     return;
   }
   CTX.threads_lock = 1;
@@ -3913,13 +3915,13 @@ void mesh_optimize_cb(CALLBACK_ARGS)
   CTX.threads_lock = 0;
   CTX.mesh.changed |= (ENT_LINE | ENT_SURFACE | ENT_VOLUME);
   Draw();
-  Msg(STATUS2N, " ");
+  Msg::Status(2, false, " ");
 }
 
 void mesh_optimize_netgen_cb(CALLBACK_ARGS)
 {
   if(CTX.threads_lock) {
-    Msg(INFO, "I'm busy! Ask me that later...");
+    Msg::Info("I'm busy! Ask me that later...");
     return;
   }
   CTX.threads_lock = 1;
@@ -3927,7 +3929,7 @@ void mesh_optimize_netgen_cb(CALLBACK_ARGS)
   CTX.threads_lock = 0;
   CTX.mesh.changed |= (ENT_LINE | ENT_SURFACE | ENT_VOLUME);
   Draw();
-  Msg(STATUS2N, " ");
+  Msg::Status(2, false, " ");
 }
 
 
@@ -3969,19 +3971,19 @@ static void _add_transfinite(int dim)
     switch (dim) {
     case 1:
       if(n == 0)
-        Msg(ONSCREEN, "Select lines\n"
+        Msg::Status(3, false, "Select lines\n"
             "[Press 'e' to end selection or 'q' to abort]");
       else
-        Msg(ONSCREEN, "Select lines\n"
+        Msg::Status(3, false, "Select lines\n"
             "[Press 'e' to end selection, 'u' to undo last selection or 'q' to abort]");
       ib = SelectEntity(ENT_LINE, vertices, edges, faces, regions, elements);
       break;
     case 2:
-      Msg(ONSCREEN, "Select surface\n[Press 'q' to abort]");
+      Msg::Status(3, false, "Select surface\n[Press 'q' to abort]");
       ib = SelectEntity(ENT_SURFACE, vertices, edges, faces, regions, elements);
       break;
     case 3:
-      Msg(ONSCREEN, "Select volume\n[Press 'q' to abort]");
+      Msg::Status(3, false, "Select volume\n[Press 'q' to abort]");
       ib = SelectEntity(ENT_VOLUME, vertices, edges, faces, regions, elements);
       break;
     default:
@@ -4016,7 +4018,7 @@ static void _add_transfinite(int dim)
       break;
     }
     if(ib == 'r') {
-      Msg(WARNING, "Entity de-selection not supported yet during transfinite definition");
+      Msg::Warning("Entity de-selection not supported yet during transfinite definition");
     }
     if(ib == 'l') {
       switch (dim) {
@@ -4041,10 +4043,10 @@ static void _add_transfinite(int dim)
         }
         while(1) {
           if(n == 1)
-            Msg(ONSCREEN, "Select (ordered) boundary points\n"
+            Msg::Status(3, false, "Select (ordered) boundary points\n"
                 "[Press 'e' to end selection or 'q' to abort]");
           else
-            Msg(ONSCREEN, "Select (ordered) boundary points\n"
+            Msg::Status(3, false, "Select (ordered) boundary points\n"
                 "[Press 'e' to end selection, 'u' to undo last selection or 'q' to abort]");
           ib = SelectEntity(ENT_POINT, vertices, edges, faces, regions, elements);
           if(ib == 'l') {
@@ -4060,7 +4062,7 @@ static void _add_transfinite(int dim)
             }
           }
           if(ib == 'r') {
-            Msg(WARNING, "Entity de-selection not supported yet during transfinite definition");
+            Msg::Warning("Entity de-selection not supported yet during transfinite definition");
           }
           if(ib == 'e') {
             switch (dim) {
@@ -4069,13 +4071,13 @@ static void _add_transfinite(int dim)
                 add_trsfsurf(n, p, CTX.filename,
                              WID->context_mesh_choice[1]->text());
               else
-                Msg(GERROR, "Wrong number of points for transfinite surface");
+                Msg::Error("Wrong number of points for transfinite surface");
               break;
             case 3:
               if(n == 6 + 1 || n == 8 + 1)
                 add_trsfvol(n, p, CTX.filename);
               else
-                Msg(GERROR, "Wrong number of points for transfinite volume");
+                Msg::Error("Wrong number of points for transfinite volume");
               break;
             }
             ZeroHighlight();
@@ -4095,7 +4097,7 @@ static void _add_transfinite(int dim)
   }
 
 stopall:
-  Msg(ONSCREEN, "");
+  Msg::Status(3, false, "");
 }
 
 void mesh_define_transfinite_line_cb(CALLBACK_ARGS)
@@ -4219,7 +4221,7 @@ void solver_command_cb(CALLBACK_ARGS)
     for(i = 0; i < idx; i++)
       usedopts += nbs(SINFO[num].button_command[i]);
     if(usedopts > SINFO[num].nboptions) {
-      Msg(GERROR, "Missing options to execute command");
+      Msg::Error("Missing options to execute command");
       return;
     }
     sprintf(command, SINFO[num].button_command[idx],
@@ -4241,7 +4243,7 @@ void solver_kill_cb(CALLBACK_ARGS)
   int num = (int)(long)data;
   if(SINFO[num].pid > 0) {
     if(KillProcess(SINFO[num].pid))
-      Msg(INFO, "Killed %s pid %d", SINFO[num].name, SINFO[num].pid);
+      Msg::Info("Killed %s pid %d", SINFO[num].name, SINFO[num].pid);
   }
   SINFO[num].pid = -1;
 }
@@ -4290,7 +4292,7 @@ static void _view_reload(int index)
     PView *p = PView::list[index];
 
     if(StatFile(p->getData()->getFileName().c_str())){
-      Msg(GERROR, "File '%s' does not exist", p->getData()->getFileName().c_str());
+      Msg::Error("File '%s' does not exist", p->getData()->getFileName().c_str());
       return;
     }
 
@@ -4608,7 +4610,7 @@ void view_field_select_node_cb(CALLBACK_ARGS)
   std::vector<MElement*> elements, elements_old;
   opt_geometry_points(0, GMSH_SET | GMSH_GUI, 1);
   while(1) {
-    Msg(ONSCREEN, "Select %s\n[Press %s'q' to abort]", 
+    Msg::Status(3, false, "Select %s\n[Press %s'q' to abort]", 
         help, mode ? "" : "'u' to undo or ");
     
     char ib = SelectEntity(ENT_POINT, vertices, edges, faces, regions, elements);
@@ -4622,7 +4624,7 @@ void view_field_select_node_cb(CALLBACK_ARGS)
   }
   CTX.mesh.changed = ENT_ALL;
   CTX.pick_elements = 0;
-  Msg(ONSCREEN, "");
+  Msg::Status(3, false, "");
   Draw();  
 }
 
@@ -4738,7 +4740,7 @@ void view_plugin_run_cb(CALLBACK_ARGS)
       catch(GMSH_Plugin * err) {
         char tmp[256];
         p->catchErrorMessage(tmp);
-        Msg(WARNING, "%s", tmp);
+        Msg::Warning("%s", tmp);
       }
     }
   }
diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp
index e769b05dde461c7f419170698dbfe351ab41910d..f7a06db1c45ce1f85e01ed5829f5436451bc6dba 100644
--- a/Fltk/GUI.cpp
+++ b/Fltk/GUI.cpp
@@ -1,4 +1,4 @@
-// $Id: GUI.cpp,v 1.685 2008-04-23 17:36:34 geuzaine Exp $
+// $Id: GUI.cpp,v 1.686 2008-05-04 08:31:12 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -38,6 +38,8 @@
 #include "PluginManager.h"
 #include "Shortcut_Window.h"
 #include "PView.h"
+#include "PViewOptions.h"
+#include "PViewData.h"
 #include "Field.h"
 #include "GModel.h"
 #include "GeoStringInterface.h"
@@ -417,10 +419,10 @@ int GetFontIndex(const char *fontname)
       if(!strcmp(menu_font_names[i].label(), fontname))
         return i;
   }
-  Msg(GERROR, "Unknown font \"%s\" (using \"Helvetica\" instead)", fontname);
-  Msg(INFO, "Available fonts:");
+  Msg::Error("Unknown font \"%s\" (using \"Helvetica\" instead)", fontname);
+  Msg::Info("Available fonts:");
   for(int i = 0; i < NUM_FONTS; i++)
-    Msg(INFO, "  \"%s\"", menu_font_names[i].label());
+    Msg::Info("  \"%s\"", menu_font_names[i].label());
   return 4;
 }
 
@@ -463,17 +465,17 @@ int GetFontAlign(const char *alignstr)
     else if(!strcmp(alignstr, "CenterRight"))
       return 8;
   }
-  Msg(GERROR, "Unknown font alignment \"%s\" (using \"Left\" instead)", alignstr);
-  Msg(INFO, "Available font alignments:");
-  Msg(INFO, "  \"Left\" (or \"BottomLeft\")");
-  Msg(INFO, "  \"Center\" (or \"BottomCenter\")");
-  Msg(INFO, "  \"Right\" (or \"BottomRight\")");
-  Msg(INFO, "  \"TopLeft\"");
-  Msg(INFO, "  \"TopCenter\"");
-  Msg(INFO, "  \"TopRight\"");
-  Msg(INFO, "  \"CenterLeft\"");
-  Msg(INFO, "  \"CenterCenter\"");
-  Msg(INFO, "  \"CenterRight\"");
+  Msg::Error("Unknown font alignment \"%s\" (using \"Left\" instead)", alignstr);
+  Msg::Info("Available font alignments:");
+  Msg::Info("  \"Left\" (or \"BottomLeft\")");
+  Msg::Info("  \"Center\" (or \"BottomCenter\")");
+  Msg::Info("  \"Right\" (or \"BottomRight\")");
+  Msg::Info("  \"TopLeft\"");
+  Msg::Info("  \"TopCenter\"");
+  Msg::Info("  \"TopRight\"");
+  Msg::Info("  \"CenterLeft\"");
+  Msg::Info("  \"CenterCenter\"");
+  Msg::Info("  \"CenterRight\"");
   return 0;
 }
 
@@ -786,9 +788,11 @@ int GUI::global_shortcuts(int event)
   }
   else if(Fl::test_shortcut(FL_ALT + 't')) {
     for(unsigned int i = 0; i < PView::list.size(); i++)
-      if(opt_view_visible(i, GMSH_GET, 0))
-        opt_view_intervals_type(i, GMSH_SET | GMSH_GUI,
-                                opt_view_intervals_type(i, GMSH_GET, 0) + 1);
+      if(opt_view_visible(i, GMSH_GET, 0)){
+	double t = opt_view_intervals_type(i, GMSH_GET, 0) + 1;
+	if(t == 4) t++; // skip numeric
+        opt_view_intervals_type(i, GMSH_SET | GMSH_GUI, t);
+      }
     redraw_opengl();
     return 1;
   }
@@ -1160,11 +1164,11 @@ void GUI::set_context(Context_Item * menu_asked, int flag)
     m_module_butt->value(3);
   }
   else {
-    Msg(WARNING, "Something is wrong in your dynamic context definition");
+    Msg::Warning("Something is wrong in your dynamic context definition");
     return;
   }
 
-  Msg(STATUS1N, menu[0].label + 1);
+  Msg::Status(1, false, menu[0].label + 1);
 
   // Remove all the children (m_push*, m_toggle*, m_pop*). FLTK <=
   // 1.1.4 should be OK with this. FLTK 1.1.5 may crash as it may
@@ -1628,18 +1632,19 @@ void GUI::check_anim_buttons()
 void GUI::set_status(const char *msg, int num)
 {
   if(num == 0 || num == 1){
-    g_status_label[num]->label(msg);
+    static char buff[2][1024];
+    strncpy(buff[num], msg, sizeof(buff[num]) - 1);
+    buff[num][sizeof(buff[num]) - 1] = '\0';
+    g_status_label[num]->label(buff[num]);
     g_status_label[num]->redraw();
   }
-  else if(num == 3){
+  else if(num == 2){
     int n = strlen(msg);
     int i = 0;
-    while(i < n)
-      if(msg[i++] == '\n') break;
-
-    strncpy(onscreen_buffer[0], msg, 255);
+    while(i < n) if(msg[i++] == '\n') break;
+    strncpy(onscreen_buffer[0], msg, sizeof(onscreen_buffer[0]) - 1);
     if(i < n) 
-      strncpy(onscreen_buffer[1], &msg[i], 255);
+      strncpy(onscreen_buffer[1], &msg[i], sizeof(onscreen_buffer[1]) - 1);
     else
       onscreen_buffer[1][0] = '\0';
     onscreen_buffer[0][i-1] = '\0';
@@ -3837,7 +3842,7 @@ void FieldDialogBox::save_values()
 	sstream<<i;
 	if(istream>>a){
 	  if(a!=',')
-	    Msg(GERROR, "Unexpected character \'%c\' while parsing option '%s' of field \'%s\'",a,it->first,f->id);
+	    Msg::Error("Unexpected character \'%c\' while parsing option '%s' of field \'%s\'",a,it->first,f->id);
 	  sstream<<", ";
 	}
       }
@@ -4266,11 +4271,8 @@ void GUI::create_message_window(bool redraw_only)
   msg_window->end();
 }
 
-void GUI::add_message(char *msg)
+void GUI::add_message(const char *msg)
 {
-  for(int i = 0; i < (int)strlen(msg); i++)
-    if(msg[i] == '\n')
-      msg[i] = ' ';
   msg_browser->add(msg, 0);
   msg_browser->bottomline(msg_browser->size());
 }
@@ -4280,11 +4282,11 @@ void GUI::save_message(const char *filename)
   FILE *fp;
 
   if(!(fp = fopen(filename, "w"))) {
-    Msg(GERROR, "Unable to open file '%s'", filename);
+    Msg::Error("Unable to open file '%s'", filename);
     return;
   }
 
-  Msg(STATUS2, "Writing '%s'", filename);
+  Msg::Status(2, true, "Writing '%s'", filename);
   for(int i = 1; i <= msg_browser->size(); i++) {
     const char *c = msg_browser->text(i);
     if(c[0] == '@')
@@ -4292,7 +4294,7 @@ void GUI::save_message(const char *filename)
     else
       fprintf(fp, "%s\n", c);
   }
-  Msg(STATUS2, "Wrote '%s'", filename);
+  Msg::Status(2, true, "Wrote '%s'", filename);
   fclose(fp);
 }
 
diff --git a/Fltk/GUI.h b/Fltk/GUI.h
index a141fa45819905219fff96c0ca4e018a9f9f85bd..de959267c9ad69d3aaaa10555a57b2943ac3fc73 100644
--- a/Fltk/GUI.h
+++ b/Fltk/GUI.h
@@ -333,7 +333,7 @@ public:
   void set_anim_buttons(int mode);
   void check_anim_buttons();
   void set_status(const char *msg, int num);
-  void add_message(char *msg);
+  void add_message(const char *msg);
   void save_message(const char *filename);
   void fatal_error(const char *filename);
   void set_statistics(bool compute_quality);
diff --git a/Fltk/GUI_Classifier.cpp b/Fltk/GUI_Classifier.cpp
index 90bddf0847fdaa964015c370ac2bf2c2421a07fe..5f1ae13a35b7c88d716d153bd7b91e9763612b07 100644
--- a/Fltk/GUI_Classifier.cpp
+++ b/Fltk/GUI_Classifier.cpp
@@ -1,4 +1,4 @@
-// $Id: GUI_Classifier.cpp,v 1.11 2008-04-13 11:07:58 geuzaine Exp $
+// $Id: GUI_Classifier.cpp,v 1.12 2008-05-04 08:31:12 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -264,7 +264,7 @@ void class_color_cb(Fl_Widget* w, void* data)
 
   CTX.mesh.changed = ENT_ALL;
   Draw();  
-  Msg(ONSCREEN, "");
+  Msg::Status(3, false, "");
 
 }
 
@@ -485,7 +485,7 @@ void class_select_cb(Fl_Widget *w, void *data)
     CTX.mesh.changed = ENT_ALL;
     Draw();
 
-    Msg(ONSCREEN, "Select Elements\n"
+    Msg::Status(3, false, "Select Elements\n"
         "[Press 'e' to end selection or 'q' to abort]");
     
     char ib = SelectEntity(ENT_ALL, vertices, edges, faces, regions, elements);
@@ -524,7 +524,7 @@ void class_select_cb(Fl_Widget *w, void *data)
   CTX.mesh.changed = ENT_ALL;
   CTX.pick_elements = 0;
   Draw();  
-  Msg(ONSCREEN, "");
+  Msg::Status(3, false, "");
 }
 
 
@@ -544,7 +544,7 @@ void class_selectgface_cb(Fl_Widget *w, void *data)
     CTX.mesh.changed = ENT_ALL;
     Draw();
 
-    Msg(ONSCREEN, "Select Model Face\n"
+    Msg::Status(3, false, "Select Model Face\n"
         "[Press 'e' to end selection or 'q' to abort]");
     
     char ib = SelectEntity(ENT_SURFACE, vertices, edges, faces, regions, elements);
@@ -570,7 +570,7 @@ void class_selectgface_cb(Fl_Widget *w, void *data)
   } 
   CTX.mesh.changed = ENT_ALL;
   Draw();  
-  Msg(ONSCREEN, "");
+  Msg::Status(3, false, "");
 }
 
 
@@ -590,7 +590,7 @@ void class_deleteedge_cb(Fl_Widget *w, void *data)
     CTX.mesh.changed = ENT_ALL;
     Draw();
 
-    Msg(ONSCREEN, "Select Elements\n"
+    Msg::Status(3, false, "Select Elements\n"
         "[Press 'e' to end selection or 'q' to abort]");
     
     char ib = SelectEntity(ENT_ALL, vertices, edges, faces, regions, elements);
@@ -639,7 +639,7 @@ void class_deleteedge_cb(Fl_Widget *w, void *data)
   CTX.mesh.changed = ENT_ALL;
   CTX.pick_elements = 0;
   Draw();  
-  Msg(ONSCREEN, "");
+  Msg::Status(3, false, "");
 }
 
 
@@ -656,7 +656,7 @@ void class_save_cb(Fl_Widget *w, void *data)
   CTX.pick_elements = 0;
   NoElementsSelectedMode (e);
   Draw();  
-  Msg(ONSCREEN, "");
+  Msg::Status(3, false, "");
 }
 
 void class_clear_cb(Fl_Widget *w, void *data)
@@ -673,7 +673,7 @@ void class_clear_cb(Fl_Widget *w, void *data)
   CTX.pick_elements = 0;
   NoElementsSelectedMode (e);
   Draw();  
-  Msg(ONSCREEN, "");
+  Msg::Status(3, false, "");
 }
 
 void class_ok_cb(Fl_Widget *w, void *data)
@@ -689,7 +689,7 @@ void class_ok_cb(Fl_Widget *w, void *data)
   opt_mesh_surfaces_faces(0, GMSH_SET | GMSH_GUI, e->op[2]);
   opt_mesh_line_width(0, GMSH_SET | GMSH_GUI, e->op[3]);
 
-  Msg(ONSCREEN, "");
+  Msg::Status(3, false, "");
 }
 
 void class_okcolor_cb(Fl_Widget *w, void *data)
@@ -700,7 +700,7 @@ void class_okcolor_cb(Fl_Widget *w, void *data)
   e->face_color->deactivate();
   e->face_color->hide();
   //  class_save_cb(w,data);
-  Msg(ONSCREEN, "");
+  Msg::Status(3, false, "");
 }
 
 
diff --git a/Fltk/GUI_Projection.cpp b/Fltk/GUI_Projection.cpp
index 4f6176d4b60362ebdbc5b4e348f7c95580b89420..9c7b3fb5197fcb1f338488d3bb06e554be2d6c75 100644
--- a/Fltk/GUI_Projection.cpp
+++ b/Fltk/GUI_Projection.cpp
@@ -41,7 +41,7 @@ static fourierProjectionFace *createProjectionFaceFromName(const char *name)
   else if(!strcmp(name, "translatedParabola"))
     f = new fourierProjectionFace(m, tag, new FM::TranslatedParabolaProjectionSurface(tag));
   else
-    Msg(GERROR, "Unknown projection face `%s'", name);
+    Msg::Error("Unknown projection face `%s'", name);
   if(f){
     f->setVisibility(false);
     m->add(f);
@@ -613,7 +613,7 @@ void update_cb(Fl_Widget *w, void *data)
       if(ent[i]->getSelection()){
         GVertex *gv = dynamic_cast<GVertex*>(ent[i]);
         if(!gv)
-          Msg(GERROR, "Problem in point selection processing");
+          Msg::Error("Problem in point selection processing");
         else
           project_point(ps, gv->x(), gv->y(), gv->z(), u, v, dist, f);
       }
@@ -660,11 +660,11 @@ void select_cb(Fl_Widget *w, void *data)
     Draw();
 
     if(ele.size() || ent.size())
-      Msg(ONSCREEN, "Select %s\n"
-          "[Press 'e' to end selection, 'u' to undo last selection or 'q' to abort]", str);
+      Msg::Status(3, false, "Select %s\n[Press 'e' to end selection, 'u' to undo" 
+		  "last selection or 'q' to abort]", str);
     else
-      Msg(ONSCREEN, "Select %s\n"
-          "[Press 'e' to end selection or 'q' to abort]", str);
+      Msg::Status(3, false, "Select %s\n"
+		  "[Press 'e' to end selection or 'q' to abort]", str);
 
     char ib = SelectEntity(what, vertices, edges, faces, regions, elements);
     if(ib == 'l') {
@@ -729,7 +729,7 @@ void select_cb(Fl_Widget *w, void *data)
   CTX.mesh.changed = ENT_ALL;
   CTX.pick_elements = 0;
   Draw();  
-  Msg(ONSCREEN, "");
+  Msg::Status(3, false, "");
 }
 
 void filter_cb(Fl_Widget *w, void *data)
@@ -801,7 +801,7 @@ void save_selection_cb(Fl_Widget *w, void *data)
   if(file_chooser(0, 1, "Save Selection", "*.{geo,msh}")){
     FILE *fp = fopen(file_chooser_get_name(1).c_str(), "w");
     if(!fp){
-      Msg(GERROR, "Unable to open file `%s'", file_chooser_get_name(1).c_str());
+      Msg::Error("Unable to open file `%s'", file_chooser_get_name(1).c_str());
       return;
     }
     std::vector<GEntity*> &ent(e->getEntities());
@@ -841,18 +841,18 @@ void load_projection_cb(Fl_Widget *w, void *data)
   if(file_chooser(0, 0, "Load Projection", "*.pro")){
     FILE *fp = fopen(file_chooser_get_name(1).c_str(), "r");
     if(!fp){
-      Msg(GERROR, "Unable to open file `%s'", file_chooser_get_name(1).c_str());
+      Msg::Error("Unable to open file `%s'", file_chooser_get_name(1).c_str());
       return;
     }
     int num;
     if(!fscanf(fp, "%d", &num)){
-      Msg(GERROR, "Bad projection file format");
+      Msg::Error("Bad projection file format");
       return;
     }
     for(int proj = 0; proj < num; proj++){
       char name[256], tag[256];
       if(!fscanf(fp, "%s", tag) || !fscanf(fp, "%s", name)){
-        Msg(GERROR, "Bad projection file format");
+        Msg::Error("Bad projection file format");
         return;
       }
       fourierProjectionFace *face = createProjectionFaceFromName(name);
@@ -863,7 +863,7 @@ void load_projection_cb(Fl_Widget *w, void *data)
           for(unsigned int i = 0; i < p->parameters.size(); i++){
             double val;
             if(!fscanf(fp, "%lf", &val)){
-              Msg(GERROR, "Missing paramater for projection `%s'", name);
+              Msg::Error("Missing paramater for projection `%s'", name);
               break;
             }
             p->parameters[i]->value(val);
@@ -886,7 +886,7 @@ void save_projection_cb(Fl_Widget *w, void *data)
       std::string name = file_chooser_get_name(1);
       FILE *fp = fopen(name.c_str(), "w");
       if(!fp){
-        Msg(GERROR, "Unable to open file `%s'", name.c_str());
+        Msg::Error("Unable to open file `%s'", name.c_str());
         return;
       }
       char no_ext[256], ext[256], base[256];
@@ -915,7 +915,7 @@ void compute_cb(Fl_Widget *w, void *data)
     int vModes = e->getMode(1);
 
     if((int)f.size() < uModes * vModes){
-      Msg(GERROR, "Number of points < uModes * vModes");
+      Msg::Error("Number of points < uModes * vModes");
       return;
     }
 
@@ -1039,7 +1039,7 @@ void action_cb(Fl_Widget *w, void *data)
         faces.push_back(*it);
   }
   else if(what == "delete_select" || what == "save_select"){
-    Msg(ONSCREEN, "Select Surface\n[Press 'e' to end selection 'q' to abort]");
+    Msg::Status(3, false, "Select Surface\n[Press 'e' to end selection 'q' to abort]");
     std::vector<GVertex*> vertices;
     std::vector<GEdge*> edges;
     std::vector<GFace*> faces;
@@ -1047,7 +1047,7 @@ void action_cb(Fl_Widget *w, void *data)
     std::vector<MElement*> elements;
     char ib = SelectEntity(ENT_SURFACE, vertices, edges, faces, regions, elements);
     if(ib == 'l') faces.insert(faces.end(), faces.begin(), faces.end());
-    Msg(ONSCREEN, "");
+    Msg::Status(3, false, "");
   }
 
   if(what[0] == 'd'){
@@ -1058,7 +1058,7 @@ void action_cb(Fl_Widget *w, void *data)
     if(file_chooser(0, 1, "Save Fourier Model", "*.fm")){
       FILE *fp = fopen(file_chooser_get_name(1).c_str(), "w");
       if(!fp){
-        Msg(GERROR, "Unable to open file `%s'", file_chooser_get_name(1).c_str());
+        Msg::Error("Unable to open file `%s'", file_chooser_get_name(1).c_str());
         return;
       }
       fprintf(fp, "%d\n", (int)faces.size());
@@ -1096,7 +1096,7 @@ void mesh_parameterize_cb(Fl_Widget* w, void* data)
 
 void mesh_parameterize_cb(Fl_Widget* w, void* data)
 {
-  Msg(GERROR, "You must compile FourierModel to reparameterize meshes");
+  Msg::Error("You must compile FourierModel to reparameterize meshes");
 }
 
 #endif
diff --git a/Fltk/Main.cpp b/Fltk/Main.cpp
index 2367aebbfe135d3f3c86d62fb4b326a78bdf9c7e..d1a08008e62bee95450bd640a0566e64195522f4 100644
--- a/Fltk/Main.cpp
+++ b/Fltk/Main.cpp
@@ -1,4 +1,4 @@
-// $Id: Main.cpp,v 1.127 2008-04-13 18:52:51 geuzaine Exp $
+// $Id: Main.cpp,v 1.128 2008-05-04 08:31:12 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -25,8 +25,6 @@
 #include "Gmsh.h"
 #include "GmshUI.h"
 #include "Message.h"
-#include "Generator.h"
-#include "CreateFile.h"
 #include "Draw.h"
 #include "Context.h"
 #include "Options.h"
@@ -40,7 +38,8 @@
 #include "BackgroundMesh.h"
 #include "PView.h"
 
-Context_T CTX;
+extern Context_T CTX;
+
 GUI *WID = 0;
 
 int main(int argc, char *argv[])
@@ -76,32 +75,10 @@ int main(int argc, char *argv[])
 
   // Non-interactive Gmsh
   if(CTX.batch) {
-    Msg(INFO, "'%s' started on %s", cmdline.c_str(), currtime.c_str());
-    OpenProject(CTX.filename);
-    for(unsigned int i = 1; i < CTX.files.size(); i++)
-      MergeFile(CTX.files[i].c_str());
-    if(CTX.post.combine_time)
-      PView::combine(true, 2, CTX.post.combine_remove_orig);
-    if(CTX.bgm_filename) {
-      MergeFile(CTX.bgm_filename);
-      if(PView::list.size())
-	GModel::current()->getFields()->set_background_mesh(PView::list.size() - 1);
-      else
-	Msg(GERROR, "Invalid background mesh (no view)");
-    }
-    if(CTX.batch == 4) {
-      AdaptMesh(GModel::current());
-      CreateOutputFile(CTX.output_filename, CTX.mesh.format);
-    }
-    else if(CTX.batch > 0) {
-      GModel::current()->mesh(CTX.batch);
-      CreateOutputFile(CTX.output_filename, CTX.mesh.format);
-    }
-    else if(CTX.batch == -1)
-      CreateOutputFile(CTX.output_filename, FORMAT_GEO);
-    else if(CTX.batch == -2)
-      GModel::current()->checkMeshCoherence();
-    exit(0);
+    Msg::Info("'%s' started on %s", cmdline.c_str(), currtime.c_str());
+    GmshBatch();
+    GmshFinalize();
+    Msg::Exit(0);
   }
 
   // Interactive Gmsh
@@ -117,21 +94,21 @@ int main(int argc, char *argv[])
   CTX.batch = 0;
 
   // Say welcome!
-  Msg(STATUS1N, "Geometry");
-  Msg(STATUS2N, "Gmsh %s", Get_GmshVersion());
+  Msg::Status(1, false, "Geometry");
+  Msg::Status(2, false, "Gmsh %s", Get_GmshVersion());
 
   // Log the following for bug reports
-  Msg(INFO, "-------------------------------------------------------");
-  Msg(INFO, "Gmsh version   : %s", Get_GmshVersion());
-  Msg(INFO, gmsh_os);
-  Msg(INFO, "%s%s", gmsh_options, Get_BuildOptions());
-  Msg(INFO, gmsh_date);
-  Msg(INFO, gmsh_host);
-  Msg(INFO, gmsh_packager);
-  Msg(INFO, "Home directory : %s", CTX.home_dir);
-  Msg(INFO, "Launch date    : %s", currtime.c_str());
-  Msg(INFO, "Command line   : %s", cmdline.c_str());
-  Msg(INFO, "-------------------------------------------------------");
+  Msg::Info("-------------------------------------------------------");
+  Msg::Info("Gmsh version   : %s", Get_GmshVersion());
+  Msg::Info(gmsh_os);
+  Msg::Info("%s%s", gmsh_options, Get_BuildOptions());
+  Msg::Info(gmsh_date);
+  Msg::Info(gmsh_host);
+  Msg::Info(gmsh_packager);
+  Msg::Info("Home directory : %s", CTX.home_dir);
+  Msg::Info("Launch date    : %s", currtime.c_str());
+  Msg::Info("Command line   : %s", cmdline.c_str());
+  Msg::Info("-------------------------------------------------------");
 
   // Display the GUI immediately to have a quick "a la Windows" launch time
   WID->check();
@@ -165,10 +142,10 @@ int main(int argc, char *argv[])
     if(PView::list.size())
       GModel::current()->getFields()->set_background_mesh(PView::list.size() - 1);
     else
-      Msg(GERROR, "Invalid background mesh (no view)");
+      Msg::Error("Invalid background mesh (no view)");
   }
 
-  // Draw the actual scene
+  // Draw the scene
   Draw();
 
   // Listen to external solvers
diff --git a/Fltk/Makefile b/Fltk/Makefile
index 979ac5defe8d4f1ee56494b569c1c46f48f93916..d293be1884bbe913dd6dcf5325c13fb8c4a45fd0 100644
--- a/Fltk/Makefile
+++ b/Fltk/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.182 2008-04-23 23:17:46 geuzaine Exp $
+# $Id: Makefile,v 1.183 2008-05-04 08:31:12 geuzaine Exp $
 #
 # Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 #
@@ -31,7 +31,6 @@ INC = ${DASH}I../Common ${DASH}I../DataStr ${DASH}I../Graphics\
 CFLAGS = ${OPTIM} ${FLAGS} ${INC} ${SYSINCLUDE}
 
 SRC = Main.cpp \
-      Message.cpp \
       GUI.cpp\
         GUI_Extras.cpp\
         GUI_Projection.cpp\
@@ -80,32 +79,18 @@ Main.o: Main.cpp GUI.h Opengl_Window.h Colorbar_Window.h \
   ../Numeric/Numeric.h ../Numeric/NumericEmbedded.h ../DataStr/List.h \
   ../DataStr/Tree.h ../DataStr/avl.h ../Geo/SPoint2.h \
   ../Geo/ExtrudeParams.h ../Common/SmoothData.h ../Post/PView.h \
-  ../Post/PViewData.h ../Post/PViewOptions.h ../Post/ColorTable.h \
-  ../Common/Gmsh.h ../Common/Message.h ../Mesh/Generator.h \
-  ../Parser/CreateFile.h ../Graphics/Draw.h ../Common/Context.h \
-  ../Common/Options.h ../Parser/Parser.h ../Parser/OpenFile.h \
-  ../Common/CommandLine.h Solvers.h ../Plugin/PluginManager.h \
-  ../Plugin/Plugin.h ../Post/PViewDataList.h ../Post/PViewData.h \
-  ../Common/GmshMatrix.h ../Geo/GModel.h ../Geo/GVertex.h \
-  ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
+  ../Common/Gmsh.h ../Common/Message.h ../Graphics/Draw.h \
+  ../Common/Context.h ../Common/Options.h ../Parser/Parser.h \
+  ../Parser/OpenFile.h ../Common/CommandLine.h Solvers.h \
+  ../Plugin/PluginManager.h ../Plugin/Plugin.h ../Post/PViewDataList.h \
+  ../Post/PViewData.h ../Common/GmshMatrix.h ../Geo/GModel.h \
+  ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
   ../Geo/SBoundingBox3d.h ../Geo/GPoint.h ../Geo/SPoint2.h ../Geo/GEdge.h \
   ../Geo/GEntity.h ../Geo/GVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h \
   ../Geo/SPoint2.h ../Geo/GFace.h ../Geo/GEntity.h ../Geo/GPoint.h \
   ../Geo/GEdgeLoop.h ../Geo/GEdge.h ../Geo/SPoint2.h ../Geo/SVector3.h \
   ../Geo/Pair.h ../Geo/GRegion.h ../Geo/GEntity.h ../Geo/SBoundingBox3d.h \
   ../Mesh/BackgroundMesh.h
-Message.o: Message.cpp ../Common/Message.h ../Common/GmshUI.h \
-  ../Common/Context.h ../Common/Options.h ../Post/ColorTable.h GUI.h \
-  Opengl_Window.h Colorbar_Window.h Popup_Button.h \
-  SpherePosition_Widget.h ../Mesh/Field.h ../Geo/Geo.h \
-  ../Common/GmshDefines.h ../Geo/gmshSurface.h ../Geo/Pair.h \
-  ../Geo/Range.h ../Geo/SPoint2.h ../Geo/SPoint3.h ../Geo/SVector3.h \
-  ../Geo/SPoint3.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \
-  ../Numeric/Numeric.h ../Numeric/NumericEmbedded.h ../DataStr/List.h \
-  ../DataStr/Tree.h ../DataStr/avl.h ../Geo/SPoint2.h \
-  ../Geo/ExtrudeParams.h ../Common/SmoothData.h ../Post/PView.h \
-  ../Post/PViewData.h ../Post/PViewOptions.h ../Post/ColorTable.h \
-  GUI_Extras.h ../Common/OS.h
 GUI.o: GUI.cpp ../Common/GmshUI.h ../Common/GmshDefines.h \
   ../Common/Message.h ../Numeric/Numeric.h ../Numeric/NumericEmbedded.h \
   ../Common/Context.h ../Common/Options.h ../Post/ColorTable.h \
@@ -116,13 +101,13 @@ GUI.o: GUI.cpp ../Common/GmshUI.h ../Common/GmshDefines.h \
   ../Geo/SPoint3.h ../Geo/SVector3.h ../Geo/SPoint3.h \
   ../Geo/SBoundingBox3d.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../Geo/SPoint2.h ../Geo/ExtrudeParams.h \
-  ../Common/SmoothData.h ../Post/PView.h ../Post/PViewData.h \
-  ../Post/PViewOptions.h ../Post/ColorTable.h Callbacks.h Win32Icon.h \
+  ../Common/SmoothData.h ../Post/PView.h Callbacks.h Win32Icon.h \
   ../Parser/OpenFile.h ../Common/CommandLine.h ../Mesh/Generator.h \
   Solvers.h ../Plugin/PluginManager.h ../Plugin/Plugin.h \
   ../Post/PViewDataList.h ../Post/PViewData.h ../Common/GmshMatrix.h \
-  Shortcut_Window.h ../Geo/GModel.h ../Geo/GVertex.h ../Geo/GEntity.h \
-  ../Geo/Range.h ../Geo/SPoint3.h ../Geo/SBoundingBox3d.h ../Geo/GPoint.h \
+  Shortcut_Window.h ../Post/PViewOptions.h ../Post/ColorTable.h \
+  ../Geo/GModel.h ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h \
+  ../Geo/SPoint3.h ../Geo/SBoundingBox3d.h ../Geo/GPoint.h \
   ../Geo/SPoint2.h ../Geo/GEdge.h ../Geo/GEntity.h ../Geo/GVertex.h \
   ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/SPoint2.h ../Geo/GFace.h \
   ../Geo/GEntity.h ../Geo/GPoint.h ../Geo/GEdgeLoop.h ../Geo/GEdge.h \
@@ -138,8 +123,7 @@ GUI_Extras.o: GUI_Extras.cpp ../Common/GmshUI.h ../Common/GmshDefines.h \
   ../Geo/SBoundingBox3d.h ../Numeric/Numeric.h \
   ../Numeric/NumericEmbedded.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../Geo/SPoint2.h ../Geo/ExtrudeParams.h \
-  ../Common/SmoothData.h ../Post/PView.h ../Post/PViewData.h \
-  ../Post/PViewOptions.h ../Post/ColorTable.h Shortcut_Window.h \
+  ../Common/SmoothData.h ../Post/PView.h Shortcut_Window.h \
   ../Geo/GModel.h ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h \
   ../Geo/SPoint3.h ../Geo/SBoundingBox3d.h ../Geo/GPoint.h \
   ../Geo/SPoint2.h ../Geo/GEdge.h ../Geo/GEntity.h ../Geo/GVertex.h \
@@ -168,7 +152,6 @@ GUI_Projection.o: GUI_Projection.cpp ../Geo/GModelIO_Fourier.h \
   ../Numeric/Numeric.h ../Numeric/NumericEmbedded.h ../DataStr/List.h \
   ../DataStr/Tree.h ../DataStr/avl.h ../Geo/SPoint2.h \
   ../Geo/ExtrudeParams.h ../Common/SmoothData.h ../Post/PView.h \
-  ../Post/PViewData.h ../Post/PViewOptions.h ../Post/ColorTable.h \
   Shortcut_Window.h GUI_Extras.h ../Geo/fourierFace.h ../Geo/GFace.h \
   ../Geo/GModel.h ../Geo/Range.h ../Geo/fourierEdge.h ../Geo/GEdge.h \
   ../Geo/GModel.h ../Geo/fourierVertex.h ../Geo/GModel.h ../Geo/GVertex.h \
@@ -191,7 +174,6 @@ GUI_Classifier.o: GUI_Classifier.cpp GUI_Classifier.h ../Common/GmshUI.h \
   ../Numeric/Numeric.h ../Numeric/NumericEmbedded.h ../DataStr/List.h \
   ../DataStr/Tree.h ../DataStr/avl.h ../Geo/SPoint2.h \
   ../Geo/ExtrudeParams.h ../Common/SmoothData.h ../Post/PView.h \
-  ../Post/PViewData.h ../Post/PViewOptions.h ../Post/ColorTable.h \
   Shortcut_Window.h ../Graphics/Draw.h ../Common/Options.h \
   ../Common/Context.h ../Graphics/SelectBuffer.h GUI_Projection.h \
   ../Geo/fourierProjectionFace.h ../Geo/GModel.h ../Geo/Range.h \
@@ -214,8 +196,8 @@ Callbacks.o: Callbacks.cpp ../Common/GmshUI.h ../Common/Message.h \
   ../Geo/MFace.h ../Geo/MVertex.h ../Geo/SVector3.h \
   ../Geo/GeoStringInterface.h ../Geo/findLinks.h ../Mesh/Generator.h \
   ../Mesh/HighOrder.h ../Graphics/Draw.h ../Graphics/SelectBuffer.h \
-  ../Post/PView.h ../Post/PViewData.h ../Post/PViewOptions.h \
-  ../Post/ColorTable.h ../Parser/CreateFile.h ../Parser/OpenFile.h \
+  ../Post/PView.h ../Post/PViewOptions.h ../Post/ColorTable.h \
+  ../Post/PViewData.h ../Parser/CreateFile.h ../Parser/OpenFile.h \
   ../Common/CommandLine.h ../Common/Context.h ../Common/Options.h GUI.h \
   Opengl_Window.h Colorbar_Window.h Popup_Button.h \
   SpherePosition_Widget.h ../Mesh/Field.h ../Geo/Geo.h \
@@ -243,7 +225,6 @@ Opengl.o: Opengl.cpp ../Common/GmshUI.h ../Common/GmshDefines.h \
   ../Geo/SPoint3.h ../Geo/SVector3.h ../Geo/SBoundingBox3d.h \
   ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../Geo/SPoint2.h \
   ../Geo/ExtrudeParams.h ../Common/SmoothData.h ../Post/PView.h \
-  ../Post/PViewData.h ../Post/PViewOptions.h ../Post/ColorTable.h \
   ../Graphics/gl2ps.h
 Opengl_Window.o: Opengl_Window.cpp ../Common/GmshUI.h \
   ../Common/GmshDefines.h ../Common/Message.h ../Numeric/Numeric.h \
@@ -261,7 +242,6 @@ Opengl_Window.o: Opengl_Window.cpp ../Common/GmshUI.h \
   ../Geo/SPoint3.h ../Geo/SVector3.h ../Geo/SBoundingBox3d.h \
   ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../Geo/SPoint2.h \
   ../Geo/ExtrudeParams.h ../Common/SmoothData.h ../Post/PView.h \
-  ../Post/PViewData.h ../Post/PViewOptions.h ../Post/ColorTable.h \
   ../Geo/MElement.h ../Geo/MVertex.h ../Geo/SPoint3.h ../Geo/MEdge.h \
   ../Geo/MVertex.h ../Geo/SVector3.h ../Geo/MFace.h ../Geo/MVertex.h \
   ../Geo/SVector3.h
@@ -274,7 +254,6 @@ Colorbar_Window.o: Colorbar_Window.cpp ../Common/GmshUI.h GUI.h \
   ../Numeric/Numeric.h ../Numeric/NumericEmbedded.h ../DataStr/List.h \
   ../DataStr/Tree.h ../DataStr/avl.h ../Geo/SPoint2.h \
   ../Geo/ExtrudeParams.h ../Common/SmoothData.h ../Post/PView.h \
-  ../Post/PViewData.h ../Post/PViewOptions.h ../Post/ColorTable.h \
   ../Common/Context.h
 Solvers.o: Solvers.cpp ../Common/Message.h Solvers.h GmshServer.h \
   ../Parser/OpenFile.h ../Common/GmshUI.h GUI.h Opengl_Window.h \
@@ -286,5 +265,4 @@ Solvers.o: Solvers.cpp ../Common/Message.h Solvers.h GmshServer.h \
   ../Numeric/Numeric.h ../Numeric/NumericEmbedded.h ../DataStr/List.h \
   ../DataStr/Tree.h ../DataStr/avl.h ../Geo/SPoint2.h \
   ../Geo/ExtrudeParams.h ../Common/SmoothData.h ../Post/PView.h \
-  ../Post/PViewData.h ../Post/PViewOptions.h ../Post/ColorTable.h \
   ../Graphics/Draw.h ../Common/Context.h
diff --git a/Fltk/Message.cpp b/Fltk/Message.cpp
deleted file mode 100644
index 6c0c92dd154bf65e841ba45d68306c156eb4b6ff..0000000000000000000000000000000000000000
--- a/Fltk/Message.cpp
+++ /dev/null
@@ -1,269 +0,0 @@
-// $Id: Message.cpp,v 1.92 2008-04-16 16:05:43 geuzaine Exp $
-//
-// Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-// 
-// Please report all bugs and problems to <gmsh@geuz.org>.
-
-#include <stdlib.h>
-#include <string.h>
-#include "Message.h"
-#include "GmshUI.h"
-#include "Context.h"
-#include "Options.h"
-#include "GUI.h"
-#include "GUI_Extras.h"
-#include "OS.h"
-
-extern GUI *WID;
-extern Context_T CTX;
-
-// General purpose message routine
-
-void Debug()
-{
-  printf("oops!\n");
-}
-
-void Msg(int level, const char *fmt, ...)
-{
-  va_list args;
-  int abort = 0, verb = 0, window = -1, log = 1, color = 0;
-  const char *str = NULL;
-
-  // standard messages in black
-  // errors, wanrnings in red
-  // external and or direct messages in blue
-  
-  switch(level){
-  case DIRECT   : color = 4; verb = 2; break ;
-  case SOLVER   : color = 4; verb = 3; break ;
-  case SOLVERR  : verb = 0; break ;
-
-  case PROGRESS : log = 0; window = 1; break ;
-
-  case STATUS1N : log = 0; //fallthrough
-  case STATUS1  : str = INFO_STR; verb = 1; window = 0; break ;
-  case STATUS2N : log = 0; //fallthrough
-  case STATUS2  : str = INFO_STR; verb = 1; window = 1; break ;
-  case ONSCREEN : log = 0; verb = 1; window = 3; break ;
-
-  case FATAL    : str = FATAL_STR; abort = 1; break ;
-  case FATAL1   : str = FATAL_STR; break ;
-  case FATAL2   : str = WHITE_STR; break ;
-  case FATAL3   : str = WHITE_STR; abort = 1; break ;
-                                                  
-  case GERROR   :                                 
-  case GERROR1  : str = ERROR_STR; break ;
-  case GERROR2  :                    
-  case GERROR3  : str = WHITE_STR; break ;
-                                          
-  case WARNING  :                         
-  case WARNING1 : str = WARNING_STR; verb = 1; break ;
-  case WARNING2 :                         
-  case WARNING3 : str = WHITE_STR; verb = 1; break ;
-                                          
-  case INFO     :                         
-  case INFO1    : str = INFO_STR; verb = 3; break ;
-  case INFO2    :                         
-  case INFO3    : str = WHITE_STR; verb = 3; break ;
-                                          
-  case DEBUG    :                         
-  case DEBUG1   : str = DEBUG_STR; verb = 4; break ;
-  case DEBUG2   :		     	  
-  case DEBUG3   : str = WHITE_STR; verb = 5; break ;
-
-  default : return;
-  }
-
-  if(verb < 2)
-    color = 1;
-
-#define BUFFSIZE 1024
-
-  static char buff1[BUFFSIZE], buff2[BUFFSIZE], buff[5][BUFFSIZE];
-
-  if(CTX.verbosity >= verb) {
-
-    if(!WID){
-      window = -1;
-    }
-    else{
-      // This is pretty costly, but permits to keep the app
-      // responsive. The downside is that it can cause race
-      // conditions: everytime we output a Msg, a pending callback can
-      // be executed! We fix this by encapsulating critical sections
-      // (mai3d(), CreateFile(), etc.) with 'CTX.threads_lock', but
-      // this is far from perfect...
-      if(level != DEBUG &&
-         level != DEBUG1 &&
-         level != DEBUG2 &&
-         level != DEBUG3 &&
-         level != STATUS1N &&
-         level != STATUS2N){
-        WID->check();
-      }
-    }
-
-    va_start(args, fmt);
-
-    if(window >= 0) {
-#if defined(HAVE_NO_VSNPRINTF)
-      vsprintf(buff[window], fmt, args);
-#else
-      vsnprintf(buff[window], BUFFSIZE, fmt, args);
-#endif
-      WID->set_status(buff[window], window);
-      if(log && strlen(buff[window])){
-        strcpy(buff1, str ? str : "");
-        strncat(buff1, buff[window], BUFFSIZE-strlen(buff1));
-        WID->add_message(buff1);
-      }
-    }
-    else if(log) {
-      sprintf(buff1, "@C%d@.", color);
-      if(str)
-        strncat(buff1, str, BUFFSIZE-strlen(buff1));
-
-#if defined(HAVE_NO_VSNPRINTF)
-      vsprintf(buff2, fmt, args);
-#else
-      vsnprintf(buff2, BUFFSIZE, fmt, args);
-#endif
-      strncat(buff1, buff2, BUFFSIZE-strlen(buff1));
-      if(CTX.terminal)
-        fprintf(stderr, "%s\n", &buff1[5]);
-      if(WID) {
-        if(color)
-          WID->add_message(buff1);
-        else
-          WID->add_message(&buff1[5]);
-        if(!verb)
-          WID->create_message_window();
-      }
-    }
-    va_end(args);
-
-    if(CTX.terminal)
-      fflush(stderr);
-  }
-
-  if(abort) {
-    Debug();
-    if(WID) {
-      WID->save_message(CTX.error_filename_fullpath);
-      WID->fatal_error(CTX.error_filename_fullpath);
-    }
-    Exit(1);
-  }
-}
-
-// Clean exit
-
-void Exit(int level)
-{
-  // delete the temp file
-  UnlinkFile(CTX.tmp_filename_fullpath);
-
-  if(level){
-    // abnormal program termination: exit directly (we used to call
-    // abort() to flush open streams, but it behaves in weird ways
-    // e.g. on Mac... so just exit!
-    exit(level);
-  }
-
-  // if we exit cleanly (level==0) and we are in full GUI mode, save
-  // the persistent info to disk
-  if(WID && !CTX.batch) {
-    if(CTX.session_save) {
-      CTX.position[0] = WID->m_window->x();
-      CTX.position[1] = WID->m_window->y();
-      CTX.gl_position[0] = WID->g_window->x();
-      CTX.gl_position[1] = WID->g_window->y();
-      CTX.msg_position[0] = WID->msg_window->x();
-      CTX.msg_position[1] = WID->msg_window->y();
-      CTX.msg_size[0] = WID->msg_window->w();
-      CTX.msg_size[1] = WID->msg_window->h();
-      CTX.opt_position[0] = WID->opt_window->x();
-      CTX.opt_position[1] = WID->opt_window->y();
-      CTX.plugin_position[0] = WID->plugin_window->x();
-      CTX.plugin_position[1] = WID->plugin_window->y();
-      CTX.plugin_size[0] = WID->plugin_window->w();
-      CTX.plugin_size[1] = WID->plugin_window->h();
-      CTX.field_position[0] = WID->field_window->x();
-      CTX.field_position[1] = WID->field_window->y();
-      CTX.field_size[0] = WID->field_window->w();
-      CTX.field_size[1] = WID->field_window->h();
-      CTX.stat_position[0] = WID->stat_window->x();
-      CTX.stat_position[1] = WID->stat_window->y();
-      CTX.vis_position[0] = WID->vis_window->x();
-      CTX.vis_position[1] = WID->vis_window->y();
-      CTX.clip_position[0] = WID->clip_window->x();
-      CTX.clip_position[1] = WID->clip_window->y();
-      CTX.manip_position[0] = WID->manip_window->x();
-      CTX.manip_position[1] = WID->manip_window->y();
-      CTX.ctx_position[0] = WID->context_geometry_window->x();
-      CTX.ctx_position[1] = WID->context_geometry_window->y();
-      CTX.solver_position[0] = WID->solver[0].window->x();
-      CTX.solver_position[1] = WID->solver[0].window->y();
-      file_chooser_get_position(&CTX.file_chooser_position[0],
-                                &CTX.file_chooser_position[1]);
-      Print_Options(0, GMSH_SESSIONRC, 0, 0, CTX.session_filename_fullpath);
-    }
-    if(CTX.options_save)
-      Print_Options(0, GMSH_OPTIONSRC, 1, 0, CTX.options_filename_fullpath);
-  }
-
-  exit(0);
-}
-
-double GetValue(const char *text, double defaultval)
-{
-  if(CTX.nopopup)
-    return defaultval;
-
-  if(WID && !CTX.batch){ // pop up GUI dialog
-    char defaultstr[256];
-    sprintf(defaultstr, "%.16g", defaultval);
-    const char *ret = fl_input(text, defaultstr);
-    if(!ret)
-      return defaultval;
-    else
-      return atof(ret);
-  }
-  else{
-    printf("%s (default=%.16g): ", text, defaultval);
-    char str[256];
-    char *ret = fgets(str, sizeof(str), stdin);
-    if(!ret || !strlen(str) || !strcmp(str, "\n"))
-      return defaultval;
-    else
-      return atof(str);
-  }
-}
-
-bool GetBinaryAnswer(const char *question, const char *yes, const char *no, 
-                     bool defaultval)
-{
-  if(CTX.nopopup || CTX.batch || !WID)
-    return defaultval;
-
-  if(fl_choice(question, no, yes, NULL))
-    return true;
-  else
-    return false;
-}
diff --git a/Fltk/Opengl_Window.cpp b/Fltk/Opengl_Window.cpp
index 894e515298d0edbde753863ae91f3f3d87b62249..c0243452ddc19dec5c401fdbbf27903843abadc0 100644
--- a/Fltk/Opengl_Window.cpp
+++ b/Fltk/Opengl_Window.cpp
@@ -1,4 +1,4 @@
-// $Id: Opengl_Window.cpp,v 1.83 2008-03-20 11:44:03 geuzaine Exp $
+// $Id: Opengl_Window.cpp,v 1.84 2008-05-04 08:31:13 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -89,7 +89,7 @@ void Opengl_Window::draw()
   else
     locked = 1;
 
-  Msg(DEBUG, "Opengl_Window->draw()");
+  Msg::Debug("Opengl_Window->draw()");
 
   if(!valid()) {
     valid(1);
@@ -408,9 +408,9 @@ int Opengl_Window::handle(int event)
         else if(faces.size()) ge = faces[0];
         else if(regions.size()) ge = regions[0];
         MElement *me = elements.size() ? elements[0] : 0;
-        Msg(STATUS2N, "%s %s",
-            ge ? ge->getInfoString().c_str() : "", 
-            me ? me->getInfoString().c_str() : "");
+        Msg::Status(2, false, "%s %s",
+		    ge ? ge->getInfoString().c_str() : "", 
+		    me ? me->getInfoString().c_str() : "");
       }
     }
     prev.set();
diff --git a/Fltk/Solvers.cpp b/Fltk/Solvers.cpp
index 7ae2a0803bc61cf7cd8cf93680b86b45c315610d..7cfc407327a5ec68935fc349a213c5926290ec29 100644
--- a/Fltk/Solvers.cpp
+++ b/Fltk/Solvers.cpp
@@ -1,4 +1,4 @@
-// $Id: Solvers.cpp,v 1.62 2008-03-20 11:44:04 geuzaine Exp $
+// $Id: Solvers.cpp,v 1.63 2008-05-04 08:31:13 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -98,7 +98,7 @@ int Solver(int num, const char *args)
   }
   else{
     if(!CTX.solver.listen){
-      Msg(INFO, "Stopped listening for solver connections");
+      Msg::Info("Stopped listening for solver connections");
       return 0;
     }
     // we don't know who will (maybe) contact us
@@ -133,31 +133,31 @@ int Solver(int num, const char *args)
   if(sock < 0) {
     switch (sock) {
     case -1:
-      Msg(GERROR, "Couldn't create socket '%s'", sockname);
+      Msg::Error("Couldn't create socket '%s'", sockname);
       break;
     case -2:
-      Msg(GERROR, "Couldn't bind socket to name '%s'", sockname);
+      Msg::Error("Couldn't bind socket to name '%s'", sockname);
       break;
     case -3:
-      Msg(GERROR, "Socket listen failed on '%s'", sockname);
+      Msg::Error("Socket listen failed on '%s'", sockname);
       break;
     case -4:
-      Msg(GERROR, "Socket listen timeout on '%s'", sockname);
-      Msg(GERROR, "Is '%s' correctly installed?", prog);
+      Msg::Error("Socket listen timeout on '%s'", sockname);
+      Msg::Error("Is '%s' correctly installed?", prog);
       break;
     case -5:
-      Msg(GERROR, "Socket accept failed on '%s'", sockname);
+      Msg::Error("Socket accept failed on '%s'", sockname);
       break;
     case -6:
-      Msg(INFO, "Stopped listening for solver connections");
+      Msg::Info("Stopped listening for solver connections");
       server.StopClient();
       break;
     case -7:
-      Msg(GERROR, "Unix sockets not available on Windows without Cygwin");
-      Msg(GERROR, "Use TCP/IP sockets instead");
+      Msg::Error("Unix sockets not available on Windows without Cygwin");
+      Msg::Error("Use TCP/IP sockets instead");
       break;
     case -8:
-      Msg(GERROR, "Could not initialize Windows sockets");
+      Msg::Error("Could not initialize Windows sockets");
       break;
     }
     if(num >= 0){
@@ -173,7 +173,7 @@ int Solver(int num, const char *args)
     SINFO[num].pid = 0;
   }
 
-  Msg(STATUS2N, "Running '%s'", prog);
+  Msg::Status(2, false, "Running '%s'", prog);
 
   while(1) {
 
@@ -203,9 +203,9 @@ int Solver(int num, const char *args)
           break;
         case GmshServer::CLIENT_PROGRESS:
           if(num >= 0)
-            Msg(STATUS2N, "%s %s", SINFO[num].name, message);
+            Msg::Status(2, false, "%s %s", SINFO[num].name, message);
           else
-            Msg(STATUS2N, "%s", message);
+            Msg::Status(2, false, "%s", message);
           break;
         case GmshServer::CLIENT_OPTION_1:
           if(num >= 0)
@@ -241,22 +241,24 @@ int Solver(int num, const char *args)
           Draw();
           break;
         case GmshServer::CLIENT_INFO:
-          Msg(SOLVER, "%-8.8s: %s", num >= 0 ? SINFO[num].name : "Client", message);
+          Msg::Direct("%-8.8s: %s", num >= 0 ? SINFO[num].name : "Client", message);
           break;
         case GmshServer::CLIENT_WARNING:
+          Msg::Direct(2, "%-8.8s: %s", num >= 0 ? SINFO[num].name : "Client", message);
+          break;
         case GmshServer::CLIENT_ERROR:
-          Msg(SOLVERR, "%-8.8s: %s", num >= 0 ? SINFO[num].name : "Client", message);
+          Msg::Direct(1, "%-8.8s: %s", num >= 0 ? SINFO[num].name : "Client", message);
           break;
         default:
-          Msg(WARNING, "Unknown type of message received from %s",
+          Msg::Warning("Unknown type of message received from %s",
               num >= 0 ? SINFO[num].name : "client");
-          Msg(SOLVER, "%-8.8s: %s", num >= 0 ? SINFO[num].name : "Client", message);
+	  Msg::Direct("%-8.8s: %s", num >= 0 ? SINFO[num].name : "Client", message);
           break;
         }
         WID->check();
       }
       else{
-        Msg(WARNING, "Failed to receive message body on socket: aborting");
+        Msg::Warning("Failed to receive message body on socket: aborting");
         break;
       }
       delete [] message;
@@ -279,13 +281,13 @@ int Solver(int num, const char *args)
   }
 
   if(server.StopClient() < 0)
-    Msg(WARNING, "Impossible to unlink the socket '%s'", sockname);
+    Msg::Warning("Impossible to unlink the socket '%s'", sockname);
 
   if(num >= 0){
-    Msg(STATUS2N, "");
+    Msg::Status(2, false, "");
   }
   else{
-    Msg(INFO, "Client disconnected: starting new connection");
+    Msg::Info("Client disconnected: starting new connection");
     goto new_connection;
   }
 
diff --git a/Geo/ExtrudeParams.cpp b/Geo/ExtrudeParams.cpp
index 5d3c618b39dd4ef97bd5cbf2b1aafe2a69dce650..13c57a1ea6ab734163bb80304d64a584a3099f5d 100644
--- a/Geo/ExtrudeParams.cpp
+++ b/Geo/ExtrudeParams.cpp
@@ -1,4 +1,4 @@
-// $Id: ExtrudeParams.cpp,v 1.27 2008-02-17 08:47:57 geuzaine Exp $
+// $Id: ExtrudeParams.cpp,v 1.28 2008-05-04 08:31:13 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -118,7 +118,7 @@ void ExtrudeParams::Extrude(double t, double &x, double &y, double &z)
     z += n[2] * t;
     break;
   default:
-    Msg(GERROR, "Unknown extrusion type");
+    Msg::Error("Unknown extrusion type");
     break;
   }
 }
diff --git a/Geo/GEdge.cpp b/Geo/GEdge.cpp
index c697ad7a61039193c28e7ee7321f870d449aed31..2205d6a31b865712033a43d21bc9af9a19e19af2 100644
--- a/Geo/GEdge.cpp
+++ b/Geo/GEdge.cpp
@@ -1,4 +1,4 @@
-// $Id: GEdge.cpp,v 1.48 2008-04-28 10:10:52 geuzaine Exp $
+// $Id: GEdge.cpp,v 1.49 2008-05-04 08:31:13 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -138,7 +138,7 @@ std::string GEdge::getAdditionalInfoString()
 
 GPoint GEdge::closestPoint(const SPoint3 & queryPoint) const
 {
-  Msg(GERROR, "Closet point not implemented for this type of edge");
+  Msg::Error("Closet point not implemented for this type of edge");
   return GPoint(0, 0, 0);
 }
 
diff --git a/Geo/GEdgeLoop.cpp b/Geo/GEdgeLoop.cpp
index a120f82b57f8219db1a870d1f75c4b4324665f05..fa36a661adc99bdd5af6fbbf2f0a005eab411587 100644
--- a/Geo/GEdgeLoop.cpp
+++ b/Geo/GEdgeLoop.cpp
@@ -1,4 +1,4 @@
-// $Id: GEdgeLoop.cpp,v 1.13 2008-03-20 11:44:04 geuzaine Exp $
+// $Id: GEdgeLoop.cpp,v 1.14 2008-05-04 08:31:13 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -30,7 +30,7 @@
 
 void GEdgeSigned::print() const
 {
-  Msg(INFO,"GEdgeSigned : Edge %d sign %d Ordered Vertices %d,%d",
+  Msg::Info("GEdgeSigned : Edge %d sign %d Ordered Vertices %d,%d",
       ge->tag(), _sign, getBeginVertex()->tag(), getEndVertex()->tag());
 }
 
@@ -123,12 +123,12 @@ GEdgeLoop::GEdgeLoop(const std::list<GEdge*> &cwire)
 
   GEdgeSigned *prevOne = 0;
 
-  //  Msg(INFO,"Building a wire");
+  //  Msg::Info("Building a wire");
   GEdgeSigned ges(0,0);
   while(wire.size()){
     ges = nextOne(prevOne, wire);
     if(ges.getSign() == 0){ // oops
-      Msg(WARNING, "Something wrong in edge loop?");
+      Msg::Warning("Something wrong in edge loop?");
       break;
     }
     prevOne = &ges;
diff --git a/Geo/GFace.cpp b/Geo/GFace.cpp
index 43dbb95ad1c812b0ecc8235962626c30148e3aca..1cdcf1cd35e59dc046a4d0de911346b184eeb52b 100644
--- a/Geo/GFace.cpp
+++ b/Geo/GFace.cpp
@@ -1,4 +1,4 @@
-// $Id: GFace.cpp,v 1.61 2008-04-28 10:10:52 geuzaine Exp $
+// $Id: GFace.cpp,v 1.62 2008-05-04 08:31:13 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -116,7 +116,7 @@ surface_params GFace::getSurfaceParams() const
 {
   surface_params p;
   p.radius = p.radius2 = p.height = p.cx = p.cy = p.cz = 0.;
-  Msg(GERROR, "Empty surface parameters for this type of surface");
+  Msg::Error("Empty surface parameters for this type of surface");
   return p;
 }
 
@@ -201,7 +201,7 @@ void GFace::computeMeanPlane()
   }
 
   if(pts.size() < 3){
-    Msg(INFO, "Adding edge points to compute mean plane of face %d", tag());
+    Msg::Info("Adding edge points to compute mean plane of face %d", tag());
     std::list<GEdge*> edg = edges();
     std::list<GEdge*>::const_iterator ite = edg.begin();
     for(; ite != edg.end(); ite++){
@@ -335,7 +335,7 @@ void GFace::computeMeanPlane(const std::vector<SPoint3> &points)
     angplan = myatan2(sinc, cosc);
     angplan = angle_02pi(angplan) * 180. / Pi;
     if((angplan > 70 && angplan < 110) || (angplan > 260 && angplan < 280)) {
-      Msg(INFO, "SVD failed (angle=%g): using rough algo...", angplan);
+      Msg::Info("SVD failed (angle=%g): using rough algo...", angplan);
       res[0] = res2[0];
       res[1] = res2[1];
       res[2] = res2[2];
@@ -384,15 +384,15 @@ end:
     meanPlane.z = meanPlane.d / meanPlane.c;
   }
 
-  Msg(DEBUG1, "Surface: %d", tag());
-  Msg(DEBUG2, "SVD    : %g,%g,%g (min=%d)", svd[0], svd[1], svd[2], min);
-  Msg(DEBUG2, "Plane  : (%g x + %g y + %g z = %g)",
+  Msg::Debug("Surface: %d", tag());
+  Msg::Debug("SVD    : %g,%g,%g (min=%d)", svd[0], svd[1], svd[2], min);
+  Msg::Debug("Plane  : (%g x + %g y + %g z = %g)",
       meanPlane.a, meanPlane.b, meanPlane.c, meanPlane.d);
-  Msg(DEBUG2, "Normal : (%g , %g , %g )",
+  Msg::Debug("Normal : (%g , %g , %g )",
       meanPlane.a, meanPlane.b, meanPlane.c);
-  Msg(DEBUG3, "t1     : (%g , %g , %g )", t1[0], t1[1], t1[2]);
-  Msg(DEBUG3, "t2     : (%g , %g , %g )", t2[0], t2[1], t2[2]);
-  Msg(DEBUG3, "pt     : (%g , %g , %g )",
+  Msg::Debug("t1     : (%g , %g , %g )", t1[0], t1[1], t1[2]);
+  Msg::Debug("t2     : (%g , %g , %g )", t2[0], t2[1], t2[2]);
+  Msg::Debug("pt     : (%g , %g , %g )",
       meanPlane.x, meanPlane.y, meanPlane.z);
 
   //check coherence for plane surfaces
@@ -406,9 +406,9 @@ end:
       double d = meanPlane.a * v->x() + meanPlane.b * v->y() +
         meanPlane.c * v->z() - meanPlane.d;
       if(fabs(d) > lc * 1.e-3) {
-        Msg(GERROR1, "Plane surface %d (%gx+%gy+%gz+%g=0) is not plane!",
+        Msg::Error("Plane surface %d (%gx+%gy+%gz+%g=0) is not plane!",
             tag(), meanPlane.a, meanPlane.b, meanPlane.c, meanPlane.d);
-        Msg(GERROR3, "Control point %d = (%g,%g,%g), val=%g",
+        Msg::Error("Control point %d = (%g,%g,%g), val=%g",
             v->tag(), v->x(), v->y(), v->z(), d);
         return;
       }
@@ -469,14 +469,14 @@ double GFace::curvature(const SPoint2 &param) const
 
   double c = fabs(dot(dndu, du) +  dot(dndv, dv)) / detJ;
 
-  // Msg(INFO, "c = %g detJ %g", c, detJ);
+  // Msg::Info("c = %g detJ %g", c, detJ);
 
   return c;
 }
 
 double GFace::getMetricEigenvalue(const SPoint2 &)
 {
-  Msg(GERROR, "Metric eigenvalue is not implemented for this type of surface");
+  Msg::Error("Metric eigenvalue is not implemented for this type of surface");
   return 0.;
 }
 
@@ -552,7 +552,7 @@ void GFace::XYZtoUV(const double X, const double Y, const double Z,
          Unew <= umax && Vnew <= vmax &&
          Unew >= umin && Vnew >= vmin){
         if (onSurface && err2 > 1.e-4 * CTX.lc)
-          Msg(WARNING, "Converged for i=%d j=%d (err=%g iter=%d) BUT xyz error = %g",
+          Msg::Warning("Converged for i=%d j=%d (err=%g iter=%d) BUT xyz error = %g",
               i, j, err, iter, err2);
         return;
       }
@@ -560,9 +560,9 @@ void GFace::XYZtoUV(const double X, const double Y, const double Z,
   }
 
   if(relax < 1.e-6)
-    Msg(GERROR, "Could not converge: surface mesh will be wrong");
+    Msg::Error("Could not converge: surface mesh will be wrong");
   else {
-    Msg(INFO, "point %g %g %g : Relaxation factor = %g", X, Y, Z, 0.75 * relax);
+    Msg::Info("point %g %g %g : Relaxation factor = %g", X, Y, Z, 0.75 * relax);
     XYZtoUV(X, Y, Z, U, V, 0.75 * relax);
   }
 #endif
@@ -577,7 +577,7 @@ SPoint2 GFace::parFromPoint(const SPoint3 &p) const
 
 GPoint GFace::closestPoint(const SPoint3 & queryPoint) const
 {
-  Msg(GERROR, "Closet point not implemented for this type of surface");
+  Msg::Error("Closet point not implemented for this type of surface");
   return GPoint(0, 0, 0);
 }
 
diff --git a/Geo/GModel.cpp b/Geo/GModel.cpp
index 702f04f79aa61a38352b25ec29cec84c0f52431d..9713b0535fef7125369c65d2391653bbb0a3dbe0 100644
--- a/Geo/GModel.cpp
+++ b/Geo/GModel.cpp
@@ -1,4 +1,4 @@
-// $Id: GModel.cpp,v 1.86 2008-04-22 16:14:34 geuzaine Exp $
+// $Id: GModel.cpp,v 1.87 2008-05-04 08:31:13 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -47,10 +47,10 @@ GModel::GModel(std::string name)
     modelName(name), normals(0)
 {
   list.push_back(this);
-  // at the moment we always create (at least an empty) GEO model
-  _createGEOInternals();
 
 #if !defined(HAVE_GMSH_EMBEDDED)
+  // at the moment we always create (at least an empty) GEO model
+  _createGEOInternals();
   _fields = new FieldManager();
 #endif
 }
@@ -59,12 +59,14 @@ GModel::~GModel()
 {
   std::vector<GModel*>::iterator it = std::find(list.begin(), list.end(), this);
   if(it != list.end()) list.erase(it);
+
+#if !defined(HAVE_GMSH_EMBEDDED)
   _deleteGEOInternals();
   _deleteOCCInternals();
-  destroy();
-#if !defined(HAVE_GMSH_EMBEDDED)
   delete _fields;
 #endif
+
+  destroy();
 }
 
 GModel *GModel::current(int index)
@@ -213,7 +215,7 @@ void GModel::snapVertices()
                       (gp.z() - (*vit)->z()) * (gp.z() - (*vit)->z()));
       if (d > tol){
         (*vit)->setPosition(gp);
-        Msg(WARNING, "Geom Vertex %d Corrupted (%12.5E)... Snap performed",
+        Msg::Warning("Geom Vertex %d Corrupted (%12.5E)... Snap performed",
             (*vit)->tag(), d);
       }
     }
@@ -373,7 +375,7 @@ int GModel::mesh(int dimension)
   GenerateMesh(this, dimension);
   return true;
 #else
-  Msg(GERROR, "Embedded Gmsh cannot do mesh generation");
+  Msg::Error("Embedded Gmsh cannot do mesh generation");
   return false;
 #endif
 }
@@ -431,7 +433,7 @@ static void insertMeshVertices(std::vector<MVertex*> &vertices, T &container)
 MVertex *GModel::getMeshVertexByTag(int n)
 {
   if(_vertexVectorCache.empty() && _vertexMapCache.empty()){
-    Msg(DEBUG, "Rebuilding mesh vertex cache");
+    Msg::Debug("Rebuilding mesh vertex cache");
     _vertexVectorCache.clear();
     _vertexMapCache.clear();
     bool dense = (getNumMeshVertices() == MVertex::getGlobalNumber());
@@ -637,7 +639,7 @@ static int checkVertices(std::vector<MVertex*> &vertices,
       pos.insert(v);
     }
     else{
-      Msg(INFO, "Vertices %d and %d have identical position (%g, %g, %g)",
+      Msg::Info("Vertices %d and %d have identical position (%g, %g, %g)",
           (*it)->getNum(), v->getNum(), v->x(), v->y(), v->z());
       num++;
     }
@@ -673,7 +675,7 @@ static int checkElements(int tag,
       }
       sprintf(temp2, ")");
       strcat(temp, temp2);
-      Msg(INFO, "%s", temp);
+      Msg::Info("%s", temp);
       num++;
     }
   }
@@ -685,7 +687,7 @@ void GModel::checkMeshCoherence()
   int numEle = getNumMeshElements();
   if(!numEle) return;
 
-  Msg(INFO, "Checking mesh coherence (%d elements)", numEle);
+  Msg::Info("Checking mesh coherence (%d elements)", numEle);
 
   SBoundingBox3d bb = bounds();
   double lc = bb.empty() ? 1. : norm(SVector3(bb.max(), bb.min()));
@@ -705,7 +707,7 @@ void GModel::checkMeshCoherence()
       num += checkVertices((*it)->mesh_vertices, pos);
     for(riter it = firstRegion(); it != lastRegion(); ++it)
       num += checkVertices((*it)->mesh_vertices, pos);
-    if(num) Msg(WARNING, "%d duplicate vertices", num);
+    if(num) Msg::Warning("%d duplicate vertices", num);
     MVertexLessThanLexicographic::tolerance = old_tol;
   }
 
@@ -727,7 +729,7 @@ void GModel::checkMeshCoherence()
       num += checkElements((*it)->tag(), (*it)->prisms, pos);
       num += checkElements((*it)->tag(), (*it)->pyramids, pos);
     }
-    if(num) Msg(WARNING, "%d duplicate elements", num);
+    if(num) Msg::Warning("%d duplicate elements", num);
     MElementLessThanLexicographic::tolerance = old_tol;
   }
 }
diff --git a/Geo/GModel.h b/Geo/GModel.h
index de4f1efd1586691bf99a705136ed71803afe21cf..61a0d02c31e37fdca177015cd8685e5da00523ad 100644
--- a/Geo/GModel.h
+++ b/Geo/GModel.h
@@ -44,11 +44,15 @@ class GModel
   std::map<int, MVertex*> _vertexMapCache;
 
   GEO_Internals *_geo_internals;
+#if !defined(HAVE_GMSH_EMBEDDED)
   void _createGEOInternals();
   void _deleteGEOInternals();
+#endif
 
   OCC_Internals *_occ_internals;
+#if !defined(HAVE_GMSH_EMBEDDED)
   void _deleteOCCInternals();
+#endif
 
   // Characteristic Lengths fields
   FieldManager *_fields;
diff --git a/Geo/GModelIO_CGNS.cpp b/Geo/GModelIO_CGNS.cpp
index 26ece440ac873ec0f8cfcf27c33f70c975f7cf69..fd7cb21d6b9a21f92bf1abc9c343bab7a3d91ba7 100644
--- a/Geo/GModelIO_CGNS.cpp
+++ b/Geo/GModelIO_CGNS.cpp
@@ -37,9 +37,9 @@
 
 int cgnsErr(const int cgIndexFile = -1)
 {
-  Msg(GERROR, cg_get_error());
+  Msg::Error(cg_get_error());
   if(cgIndexFile != -1)
-    if(cg_close(cgIndexFile)) Msg(GERROR, "Even unable to close CGNS file");
+    if(cg_close(cgIndexFile)) Msg::Error("Even unable to close CGNS file");
   return 0;
 }
 
@@ -182,7 +182,7 @@ int GModel::writeCGNS(const std::string &name, double scalingFactor)
         if((*it)->triangles.size() + (*it)->quadrangles.size() > 0)
           groups[face][1].push_back(*it);
       if(!groups[face].size()) {
-        Msg(GERROR, "No mesh elements were found");
+        Msg::Error("No mesh elements were found");
         return 0;
       }
     }
@@ -562,13 +562,13 @@ int GModel::writeCGNS(const std::string &name, double scalingFactor)
 
 int GModel::readCGNS(const std::string &name)
 {
-  Msg(GERROR, "This version of Gmsh was compiled without CGNS support");
+  Msg::Error("This version of Gmsh was compiled without CGNS support");
   return 0;
 }
 
 int GModel::writeCGNS(const std::string &name, double scalingFactor)
 {
-  Msg(GERROR, "This version of Gmsh was compiled without CGNS support");
+  Msg::Error("This version of Gmsh was compiled without CGNS support");
   return 0;
 }
 
diff --git a/Geo/GModelIO_Fourier.cpp b/Geo/GModelIO_Fourier.cpp
index 866b2a06dcd36088be971d63b4b39a0e76020f1d..4c100a7ddc56af1f83dc9fbcafffc884f3bc5ae5 100644
--- a/Geo/GModelIO_Fourier.cpp
+++ b/Geo/GModelIO_Fourier.cpp
@@ -90,7 +90,7 @@ int GModel::readFourier(const std::string &filename)
 
 int GModel::readFourier(const std::string &fn)
 {
-  Msg(GERROR, "Gmsh has to be compiled with Fourier Model support to load '%s'",
+  Msg::Error("Gmsh has to be compiled with Fourier Model support to load '%s'",
       fn.c_str());
   return 0;
 }
diff --git a/Geo/GModelIO_Geo.cpp b/Geo/GModelIO_Geo.cpp
index 9ac30c2e24dc1ee0ebd1e46d8bd286dccca7c819..d3e1cb5c9b31c6f78c7b5c517af7ed2d90869507 100644
--- a/Geo/GModelIO_Geo.cpp
+++ b/Geo/GModelIO_Geo.cpp
@@ -1,4 +1,4 @@
-// $Id: GModelIO_Geo.cpp,v 1.20 2008-03-23 21:42:57 geuzaine Exp $
+// $Id: GModelIO_Geo.cpp,v 1.21 2008-05-04 08:31:13 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -140,11 +140,11 @@ int GModel::importGEOInternals()
     }
   }
 
-  Msg(DEBUG, "Gmsh model imported:");
-  Msg(DEBUG, "%d Vertices", vertices.size());
-  Msg(DEBUG, "%d Edges", edges.size());
-  Msg(DEBUG, "%d Faces", faces.size());
-  Msg(DEBUG, "%d Regions", regions.size());
+  Msg::Debug("Gmsh model imported:");
+  Msg::Debug("%d Vertices", vertices.size());
+  Msg::Debug("%d Edges", edges.size());
+  Msg::Debug("%d Faces", faces.size());
+  Msg::Debug("%d Regions", regions.size());
   
   return 1;
 }
@@ -256,7 +256,7 @@ class writeGEdgeGEO {
         fprintf(geo, "Bezier (%d) = ", c->Num);
         break;
       default:
-        Msg(GERROR, "Unknown curve type %d", c->Typ);
+        Msg::Error("Unknown curve type %d", c->Typ);
         return;
       }
       for(int i = 0; i < List_Nbr(c->Control_Points); i++) {
@@ -331,7 +331,7 @@ class writeGFaceGEO {
         fprintf(geo, "Ruled Surface (%d) = {%d};\n", gf->tag(), gf->tag());
       }
       else{
-        Msg(GERROR, "Skipping surface %d in export", gf->tag());
+        Msg::Error("Skipping surface %d in export", gf->tag());
       }
     }
   }
diff --git a/Geo/GModelIO_MED.cpp b/Geo/GModelIO_MED.cpp
index c58d11cad504bfccb5ab16efef877788f75e317f..98742142f4b5c3a881d10e8724748f3e0c68f61b 100644
--- a/Geo/GModelIO_MED.cpp
+++ b/Geo/GModelIO_MED.cpp
@@ -1,4 +1,4 @@
-// $Id: GModelIO_MED.cpp,v 1.33 2008-04-17 18:21:11 geuzaine Exp $
+// $Id: GModelIO_MED.cpp,v 1.34 2008-05-04 08:31:13 geuzaine Exp $
 //
 // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 //
@@ -137,7 +137,7 @@ int med2mshNodeIndex(med_geometrie_element med, int k)
     return map[k];
   }
   default:
-    Msg(GERROR, "Unknown MED element type");
+    Msg::Error("Unknown MED element type");
     return k;
   }
 }
@@ -146,17 +146,17 @@ int GModel::readMED(const std::string &name)
 {
   med_idt fid = MEDouvrir((char*)name.c_str(), MED_LECTURE);
   if(fid < 0) {
-    Msg(GERROR, "Unable to open file '%s'", name.c_str());
+    Msg::Error("Unable to open file '%s'", name.c_str());
     return 0;
   }
 
   med_int v[3], vf[3];
   MEDversionDonner(&v[0], &v[1], &v[2]);
   MEDversionLire(fid, &vf[0], &vf[1], &vf[2]);
-  Msg(INFO, "Reading MED file V%d.%d.%d using MED library V%d.%d.%d", 
+  Msg::Info("Reading MED file V%d.%d.%d using MED library V%d.%d.%d", 
       vf[0], vf[1], vf[2], v[0], v[1], v[2]);
   if(vf[0] < 2 || (vf[0] == 2 && vf[1] < 2)){
-    Msg(GERROR, "Cannot read MED file older than V2.2");
+    Msg::Error("Cannot read MED file older than V2.2");
     return 0;
   }
   
@@ -166,14 +166,14 @@ int GModel::readMED(const std::string &name)
     med_int meshDim;
     med_maillage meshType;
     if(MEDmaaInfo(fid, i + 1, meshName, &meshDim, &meshType, meshDesc) < 0){
-      Msg(GERROR, "Unable to read mesh information");
+      Msg::Error("Unable to read mesh information");
       return 0;
     }
     meshNames.push_back(meshName);
   }
 
   if(MEDfermer(fid) < 0){
-    Msg(GERROR, "Unable to close file '%s'", (char*)name.c_str());
+    Msg::Error("Unable to close file '%s'", (char*)name.c_str());
     return 0;
   }
 
@@ -194,13 +194,13 @@ int GModel::readMED(const std::string &name, int meshIndex)
 {
   med_idt fid = MEDouvrir((char*)name.c_str(), MED_LECTURE);
   if(fid < 0) {
-    Msg(GERROR, "Unable to open file '%s'", name.c_str());
+    Msg::Error("Unable to open file '%s'", name.c_str());
     return 0;
   }
   
   int numMeshes = MEDnMaa(fid);
   if(meshIndex >= numMeshes){
-    Msg(INFO, "Could not find mesh %d in MED file", meshIndex);
+    Msg::Info("Could not find mesh %d in MED file", meshIndex);
     return 0;
   }
 
@@ -209,15 +209,15 @@ int GModel::readMED(const std::string &name, int meshIndex)
   med_int meshDim;
   med_maillage meshType;
   if(MEDmaaInfo(fid, meshIndex + 1, meshName, &meshDim, &meshType, meshDesc) < 0){
-    Msg(GERROR, "Unable to read mesh information");
+    Msg::Error("Unable to read mesh information");
     return 0;
   }
   setName(meshName);
   if(meshType == MED_NON_STRUCTURE){
-    Msg(INFO, "Reading %d-D unstructured mesh <<%s>>", meshDim, meshName);
+    Msg::Info("Reading %d-D unstructured mesh <<%s>>", meshDim, meshName);
   }
   else{
-    Msg(GERROR, "Cannot read structured mesh");
+    Msg::Error("Cannot read structured mesh");
     return 0;
   }
 
@@ -225,11 +225,11 @@ int GModel::readMED(const std::string &name, int meshIndex)
   med_int numNodes = MEDnEntMaa(fid, meshName, MED_COOR, MED_NOEUD, MED_NONE,
 				MED_NOD);
   if(numNodes < 0){
-    Msg(GERROR, "Could not read number of MED nodes");
+    Msg::Error("Could not read number of MED nodes");
     return 0;
   }
   if(numNodes == 0){
-    Msg(GERROR, "No nodes in MED mesh");
+    Msg::Error("No nodes in MED mesh");
     return 0;
   }
   std::vector<MVertex*> verts(numNodes);
@@ -239,7 +239,7 @@ int GModel::readMED(const std::string &name, int meshIndex)
   med_repere rep;
   if(MEDcoordLire(fid, meshName, meshDim, &coord[0], MED_FULL_INTERLACE,
 		  MED_ALL, 0, 0, &rep, &coordName[0], &coordUnit[0]) < 0){
-    Msg(GERROR, "Could not read MED node coordinates");
+    Msg::Error("Could not read MED node coordinates");
     return 0;
   }
   std::vector<med_int> nodeTags(numNodes);
@@ -260,12 +260,12 @@ int GModel::readMED(const std::string &name, int meshIndex)
     std::vector<med_int> conn(numEle * numNodPerEle);
     if(MEDconnLire(fid, meshName, meshDim, &conn[0], MED_FULL_INTERLACE, 0, MED_ALL,
 		   MED_MAILLE, type, MED_NOD) < 0) {
-      Msg(GERROR, "Could not read MED elements");
+      Msg::Error("Could not read MED elements");
       return 0;
     }
     std::vector<med_int> fam(numEle);
     if(MEDfamLire(fid, meshName, &fam[0], numEle, MED_MAILLE, type) < 0) {
-      Msg(GERROR, "Could not read MED families");
+      Msg::Error("Could not read MED families");
       return 0;
     }
     std::vector<med_int> eleTags(numEle);
@@ -306,14 +306,14 @@ int GModel::readMED(const std::string &name, int meshIndex)
   // read family info
   med_int numFamilies = MEDnFam(fid, meshName);
   if(numFamilies < 0) {
-    Msg(GERROR, "Could not read MED families");
+    Msg::Error("Could not read MED families");
     return 0;
   }
   for(int i = 0; i < numFamilies; i++) {
     med_int numAttrib = MEDnAttribut(fid, meshName, i + 1);
     med_int numGroups = MEDnGroupe(fid, meshName, i + 1);
     if(numAttrib < 0 || numGroups < 0){
-      Msg(GERROR, "Could not read MED groups or attributes");
+      Msg::Error("Could not read MED groups or attributes");
       return 0;
     }
     std::vector<med_int> attribId(numAttrib + 1);
@@ -325,7 +325,7 @@ int GModel::readMED(const std::string &name, int meshIndex)
     if(MEDfamInfo(fid, meshName, i + 1, familyName, &familyNum, &attribId[0], 
 		  &attribVal[0], &attribDes[0], &numAttrib, &groupNames[0],
 		  &numGroups) < 0) {
-      Msg(GERROR, "Could not read info for MED family %d", i + 1);
+      Msg::Error("Could not read info for MED family %d", i + 1);
     }
     else{
       elementaryNames[-familyNum] = familyName;
@@ -351,7 +351,7 @@ int GModel::readMED(const std::string &name, int meshIndex)
   bool postpro = (MEDnChamp(fid, 0) > 0) ? true : false;
   
   if(MEDfermer(fid) < 0){
-    Msg(GERROR, "Unable to close file '%s'", (char*)name.c_str());
+    Msg::Error("Unable to close file '%s'", (char*)name.c_str());
     return 0;
   }
   
@@ -378,20 +378,20 @@ static void writeElementsMED(med_idt &fid, char *meshName, std::vector<med_int>
   if(MEDelementsEcr(fid, meshName, (med_int)3, &conn[0], MED_FULL_INTERLACE,
 		    0, MED_FAUX, 0, MED_FAUX, &fam[0], (med_int)fam.size(),
 		    MED_MAILLE, type, MED_NOD) < 0)
-    Msg(GERROR, "Could not write elements");
+    Msg::Error("Could not write elements");
 }
 
 int GModel::writeMED(const std::string &name, bool saveAll, double scalingFactor)
 {
   med_idt fid = MEDouvrir((char*)name.c_str(), MED_CREATION);
   if(fid < 0) {
-    Msg(GERROR, "Unable to open file '%s'", name.c_str());
+    Msg::Error("Unable to open file '%s'", name.c_str());
     return 0;
   }
 
   // write header
   if(MEDfichDesEcr(fid, (char*)"MED file generated by Gmsh") < 0) {
-    Msg(GERROR, "Unable to write MED descriptor");
+    Msg::Error("Unable to write MED descriptor");
     return 0;
   }
 
@@ -399,7 +399,7 @@ int GModel::writeMED(const std::string &name, bool saveAll, double scalingFactor
   
   // Gmsh always writes 3D unstructured meshes
   if(MEDmaaCr(fid, meshName, 3, MED_NON_STRUCTURE, (char*)"gmsh") < 0){
-    Msg(GERROR, "Could not create MED mesh");
+    Msg::Error("Could not create MED mesh");
     return 0;
   }
   
@@ -425,7 +425,7 @@ int GModel::writeMED(const std::string &name, bool saveAll, double scalingFactor
   {
     // always create a "0" family, with no groups or attributes
     if(MEDfamCr(fid, meshName, (char*)"F_0", 0, 0, 0, 0, 0, 0, 0) < 0)
-      Msg(GERROR, "Could not create MED family 0");
+      Msg::Error("Could not create MED family 0");
 
     // create one family per elementary entity, with one group per
     // physical entity and no attributes
@@ -451,7 +451,7 @@ int GModel::writeMED(const std::string &name, bool saveAll, double scalingFactor
 	if(MEDfamCr(fid, meshName, (char*)familyName.c_str(), 
 		    (med_int)num, 0, 0, 0, 0, (char*)groupName.c_str(),
 		    (med_int)entities[i]->physicals.size()) < 0)
-	  Msg(GERROR, "Could not create MED family %d", num);
+	  Msg::Error("Could not create MED family %d", num);
       }
     }
   }
@@ -472,7 +472,7 @@ int GModel::writeMED(const std::string &name, bool saveAll, double scalingFactor
       }
     }
     if(fam.empty()){
-      Msg(GERROR, "No nodes to write in MED mesh");
+      Msg::Error("No nodes to write in MED mesh");
       return 0;
     }
     char coordName[3 * MED_TAILLE_PNOM + 1] = 
@@ -482,7 +482,7 @@ int GModel::writeMED(const std::string &name, bool saveAll, double scalingFactor
     if(MEDnoeudsEcr(fid, meshName, (med_int)3, &coord[0], MED_FULL_INTERLACE, 
 		    MED_CART, coordName, coordUnit, 0, MED_FAUX, 0, MED_FAUX, 
 		    &fam[0], (med_int)fam.size()) < 0)
-      Msg(GERROR, "Could not write nodes");
+      Msg::Error("Could not write nodes");
   }
   
   // write the elements
@@ -550,7 +550,7 @@ int GModel::writeMED(const std::string &name, bool saveAll, double scalingFactor
   }
   
   if(MEDfermer(fid) < 0){
-    Msg(GERROR, "Unable to close file '%s'", (char*)name.c_str());
+    Msg::Error("Unable to close file '%s'", (char*)name.c_str());
     return 0;
   }
   
@@ -561,21 +561,21 @@ int GModel::writeMED(const std::string &name, bool saveAll, double scalingFactor
 
 int GModel::readMED(const std::string &name)
 {
-  Msg(GERROR, "Gmsh has to be compiled with MED support to read '%s'",
+  Msg::Error("Gmsh has to be compiled with MED support to read '%s'",
       name.c_str());
   return 0;
 }
 
 int GModel::readMED(const std::string &name, int meshIndex)
 {
-  Msg(GERROR, "Gmsh has to be compiled with MED support to read '%s'",
+  Msg::Error("Gmsh has to be compiled with MED support to read '%s'",
       name.c_str());
   return 0;
 }
 
 int GModel::writeMED(const std::string &name, bool saveAll, double scalingFactor)
 {
-  Msg(GERROR, "Gmsh has to be compiled with MED support to write '%s'",
+  Msg::Error("Gmsh has to be compiled with MED support to write '%s'",
       name.c_str());
   return 0;
 }
diff --git a/Geo/GModelIO_Mesh.cpp b/Geo/GModelIO_Mesh.cpp
index 46c770ec24cced03ea005efede9e337fb398f2d2..9f48426c1dfec1100ea5a701bbd000b4f7607536 100644
--- a/Geo/GModelIO_Mesh.cpp
+++ b/Geo/GModelIO_Mesh.cpp
@@ -1,4 +1,4 @@
-// $Id: GModelIO_Mesh.cpp,v 1.51 2008-04-22 16:14:34 geuzaine Exp $
+// $Id: GModelIO_Mesh.cpp,v 1.52 2008-05-04 08:31:13 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -93,7 +93,7 @@ static bool getVertices(int num, int *indices, std::map<int, MVertex*> &map,
 {
   for(int i = 0; i < num; i++){
     if(!map.count(indices[i])){
-      Msg(GERROR, "Wrong vertex index %d", indices[i]);
+      Msg::Error("Wrong vertex index %d", indices[i]);
       return false;
     }
     else
@@ -107,7 +107,7 @@ static bool getVertices(int num, int *indices, std::vector<MVertex*> &vec,
 {
   for(int i = 0; i < num; i++){
     if(indices[i] < 0 || indices[i] > (int)(vec.size() - 1)){
-      Msg(GERROR, "Wrong vertex index %d", indices[i]);
+      Msg::Error("Wrong vertex index %d", indices[i]);
       return false;
     }
     else
@@ -148,7 +148,7 @@ static int getNumVerticesForElementTypeMSH(int type)
   case MSH_PYR_13 : return 5 + 8;
   case MSH_PYR_14 : return 5 + 8 + 1;
   default: 
-    Msg(GERROR, "Unknown type of element %d", type);
+    Msg::Error("Unknown type of element %d", type);
     return 0;
   }
 }
@@ -168,7 +168,7 @@ static void createElementMSH(GModel *m, int num, int type, int physical,
     MElementFactory factory;
     MElement *e = factory.create(type, v, num, part);
     if(!e){
-      Msg(GERROR, "Unknown type of element %d", type);
+      Msg::Error("Unknown type of element %d", type);
       return;
     }
     dim = e->getDim();
@@ -181,7 +181,7 @@ static void createElementMSH(GModel *m, int num, int type, int physical,
     case 12 : idx = 4; break;
     case 9 : idx = 5; break;
     case 8 : idx = 6; break;
-    default : Msg(GERROR, "Wrong number of edges in element"); return;
+    default : Msg::Error("Wrong number of edges in element"); return;
     }
     elem[idx][reg].push_back(e);
   }
@@ -196,7 +196,7 @@ int GModel::readMSH(const std::string &name)
 {
   FILE *fp = fopen(name.c_str(), "rb");
   if(!fp){
-    Msg(GERROR, "Unable to open file '%s'", name.c_str());
+    Msg::Error("Unable to open file '%s'", name.c_str());
     return 0;
   }
 
@@ -229,12 +229,12 @@ int GModel::readMSH(const std::string &name)
       if(sscanf(str, "%lf %d %d", &version, &format, &size) != 3) return 0;
       if(format){
         binary = true;
-        Msg(INFO, "Mesh is in binary format");
+        Msg::Info("Mesh is in binary format");
         int one;
         if(fread(&one, sizeof(int), 1, fp) != 1) return 0;
         if(one != 1){
           swap = true;
-          Msg(INFO, "Swapping bytes from binary file");
+          Msg::Info("Swapping bytes from binary file");
         }
       }
 
@@ -258,11 +258,11 @@ int GModel::readMSH(const std::string &name)
       if(!fgets(str, sizeof(str), fp)) return 0;
       int numVertices;
       if(sscanf(str, "%d", &numVertices) != 1) return 0;
-      Msg(INFO, "%d vertices", numVertices);
+      Msg::Info("%d vertices", numVertices);
+      Msg::ResetProgressMeter();
       vertexVector.clear();
       vertexMap.clear();
-      int progress = (numVertices > 100000) ? numVertices / 25 : 0;
-      int minVertex = numVertices + 1, maxVertex = -1;
+          int minVertex = numVertices + 1, maxVertex = -1;
       for(int i = 0; i < numVertices; i++) {
         int num;
         double xyz[3];
@@ -278,19 +278,18 @@ int GModel::readMSH(const std::string &name)
         minVertex = std::min(minVertex, num);
         maxVertex = std::max(maxVertex, num);
         if(vertexMap.count(num))
-          Msg(WARNING, "Skipping duplicate vertex %d", num);
+          Msg::Warning("Skipping duplicate vertex %d", num);
         else
           vertexMap[num] = new MVertex(xyz[0], xyz[1], xyz[2], 0, num);
-        if(progress && (i % progress == progress - 1))
-          Msg(PROGRESS, "Read %d vertices", i + 1);
+	if(numVertices > 100000) 
+	  Msg::ProgressMeter(i + 1, numVertices, "Reading nodes");
       }
-      if(progress) Msg(PROGRESS, "");
       // If the vertex numbering is dense, tranfer the map into a
       // vector to speed up element creation
       if((int)vertexMap.size() == numVertices && 
          ((minVertex == 1 && maxVertex == numVertices) ||
           (minVertex == 0 && maxVertex == numVertices - 1))){
-        Msg(INFO, "Vertex numbering is dense");
+        Msg::Info("Vertex numbering is dense");
         vertexVector.resize(vertexMap.size() + 1);
         if(minVertex == 1) 
           vertexVector[0] = 0;
@@ -308,8 +307,8 @@ int GModel::readMSH(const std::string &name)
       if(!fgets(str, sizeof(str), fp)) return 0;
       int numElements;
       sscanf(str, "%d", &numElements);
-      Msg(INFO, "%d elements", numElements);
-      int progress = (numElements > 100000) ? numElements / 25 : 0;
+      Msg::Info("%d elements", numElements);
+      Msg::ResetProgressMeter();
       if(!binary){
         for(int i = 0; i < numElements; i++) {
           int num, type, physical = 0, elementary = 0, partition = 0, numVertices;
@@ -341,8 +340,8 @@ int GModel::readMSH(const std::string &name)
           }
           createElementMSH(this, num, type, physical, elementary, partition, 
                            vertices, points, elements, physicals);
-          if(progress && (i % progress == progress - 1))
-            Msg(PROGRESS, "Read %d elements", i + 1);
+	  if(numElements > 100000) 
+	    Msg::ProgressMeter(i + 1, numElements, "Reading elements");
         }
       }
       else{
@@ -374,14 +373,14 @@ int GModel::readMSH(const std::string &name)
             }
             createElementMSH(this, num, type, physical, elementary, partition, 
                              vertices, points, elements, physicals);
-            if(progress && ((numElementsPartial + i) % progress == progress - 1))
-              Msg(PROGRESS, "Read %d elements", i + 1);
+	    if(numElements > 100000) 
+	      Msg::ProgressMeter(numElementsPartial + i + 1, numElements, 
+				 "Reading elements");
           }
           delete [] data;
           numElementsPartial += numElms;
         }
       }
-      if(progress) Msg(PROGRESS, "");
 
     }
     else if(!strncmp(&str[1], "NodeData", 8)) {
@@ -511,7 +510,7 @@ int GModel::writeMSH(const std::string &name, double version, bool binary,
 {
   FILE *fp = fopen(name.c_str(), binary ? "wb" : "w");
   if(!fp){
-    Msg(GERROR, "Unable to open file '%s'", name.c_str());
+    Msg::Error("Unable to open file '%s'", name.c_str());
     return 0;
   }
 
@@ -667,7 +666,7 @@ int GModel::writePOS(const std::string &name, bool printElementary,
 {
   FILE *fp = fopen(name.c_str(), "w");
   if(!fp){
-    Msg(GERROR, "Unable to open file '%s'", name.c_str());
+    Msg::Error("Unable to open file '%s'", name.c_str());
     return 0;
   }
 
@@ -749,7 +748,7 @@ int GModel::readSTL(const std::string &name, double tolerance)
 {
   FILE *fp = fopen(name.c_str(), "rb");
   if(!fp){
-    Msg(GERROR, "Unable to open file '%s'", name.c_str());
+    Msg::Error("Unable to open file '%s'", name.c_str());
     return 0;
   }
 
@@ -788,7 +787,7 @@ int GModel::readSTL(const std::string &name, double tolerance)
   }
   else{
     // Binary STL
-    Msg(INFO, "Mesh is in binary format");
+    Msg::Info("Mesh is in binary format");
     rewind(fp);
     char header[80];
     if(fread(header, sizeof(char), 80, fp)){
@@ -796,7 +795,7 @@ int GModel::readSTL(const std::string &name, double tolerance)
       size_t ret = fread(&nfacets, sizeof(unsigned int), 1, fp);
       bool swap = false;
       if(nfacets > 10000000){
-        Msg(INFO, "Swapping bytes from binary file");
+        Msg::Info("Swapping bytes from binary file");
         swap = true;
         swapBytes((char*)&nfacets, sizeof(unsigned int), 1);
       }
@@ -820,16 +819,16 @@ int GModel::readSTL(const std::string &name, double tolerance)
   }
 
   if(!points.size()){
-    Msg(GERROR, "No facets found in STL file");
+    Msg::Error("No facets found in STL file");
     return 0;
   }
   
   if(points.size() % 3){
-    Msg(GERROR, "Wrong number of points in STL file");
+    Msg::Error("Wrong number of points in STL file");
     return 0;
   }
 
-  Msg(INFO, "%d facets", points.size() / 3);
+  Msg::Info("%d facets", points.size() / 3);
 
   // create face
   GFace *face = new discreteFace(this, getNumFaces() + 1);
@@ -866,7 +865,7 @@ int GModel::writeSTL(const std::string &name, bool binary, bool saveAll,
 {
   FILE *fp = fopen(name.c_str(), binary ? "wb" : "w");
   if(!fp){
-    Msg(GERROR, "Unable to open file '%s'", name.c_str());
+    Msg::Error("Unable to open file '%s'", name.c_str());
     return 0;
   }
 
@@ -931,7 +930,7 @@ static int readVerticesVRML(FILE *fp, std::vector<MVertex*> &vertexVector,
     vertexVector.push_back(new MVertex(x, y, z));
   for(unsigned int i = 0; i < vertexVector.size(); i++)
     allVertexVector.push_back(vertexVector[i]);
-  Msg(INFO, "%d vertices", vertexVector.size());
+  Msg::Info("%d vertices", vertexVector.size());
   return 1;
 }
 
@@ -965,7 +964,7 @@ static int readElementsVRML(FILE *fp, std::vector<MVertex*> &vertexVector, int r
       if(!getVertices(idx.size(), &idx[0], vertexVector, vertices)) return 0;
       idx.clear();
       if(vertices.size() < 2){
-        Msg(INFO, "Skipping %d-vertex element", (int)vertices.size());
+        Msg::Info("Skipping %d-vertex element", (int)vertices.size());
       }
       else if(vertices.size() == 2){
         elements[0][region].push_back(new MLine(vertices));
@@ -995,10 +994,10 @@ static int readElementsVRML(FILE *fp, std::vector<MVertex*> &vertexVector, int r
     }
   }
   if(idx.size()){
-    Msg(GERROR, "Prematured end of VRML file");
+    Msg::Error("Prematured end of VRML file");
     return 0;
   }
-  Msg(INFO, "%d elements", elements[0][region].size() + 
+  Msg::Info("%d elements", elements[0][region].size() + 
       elements[1][region].size() + elements[2][region].size());
   return 1;
 }
@@ -1007,7 +1006,7 @@ int GModel::readVRML(const std::string &name)
 {
   FILE *fp = fopen(name.c_str(), "r");
   if(!fp){
-    Msg(GERROR, "Unable to open file '%s'", name.c_str());
+    Msg::Error("Unable to open file '%s'", name.c_str());
     return 0;
   }
 
@@ -1077,7 +1076,7 @@ int GModel::writeVRML(const std::string &name, bool saveAll, double scalingFacto
 {
   FILE *fp = fopen(name.c_str(), "w");
   if(!fp){
-    Msg(GERROR, "Unable to open file '%s'", name.c_str());
+    Msg::Error("Unable to open file '%s'", name.c_str());
     return 0;
   }
 
@@ -1135,7 +1134,7 @@ int GModel::readUNV(const std::string &name)
 {
   FILE *fp = fopen(name.c_str(), "r");
   if(!fp){
-    Msg(GERROR, "Unable to open file '%s'", name.c_str());
+    Msg::Error("Unable to open file '%s'", name.c_str());
     return 0;
   }
 
@@ -1295,7 +1294,7 @@ int GModel::writeUNV(const std::string &name, bool saveAll, bool saveGroupsOfNod
 {
   FILE *fp = fopen(name.c_str(), "w");
   if(!fp){
-    Msg(GERROR, "Unable to open file '%s'", name.c_str());
+    Msg::Error("Unable to open file '%s'", name.c_str());
     return 0;
   }
 
@@ -1383,7 +1382,7 @@ int GModel::readMESH(const std::string &name)
 {
   FILE *fp = fopen(name.c_str(), "r");
   if(!fp){
-    Msg(GERROR, "Unable to open file '%s'", name.c_str());
+    Msg::Error("Unable to open file '%s'", name.c_str());
     return 0;
   }
 
@@ -1395,7 +1394,7 @@ int GModel::readMESH(const std::string &name)
   sscanf(buffer, "%s %d", str, &format);
 
   if(format != 1){
-    Msg(GERROR, "Medit mesh import only available for ASCII files");
+    Msg::Error("Medit mesh import only available for ASCII files");
     return 0;
   }
 
@@ -1413,7 +1412,7 @@ int GModel::readMESH(const std::string &name)
         if(!fgets(buffer, sizeof(buffer), fp)) break;
         int nbv;
         sscanf(buffer, "%d", &nbv);
-        Msg(INFO, "%d vertices", nbv);
+        Msg::Info("%d vertices", nbv);
         vertexVector.resize(nbv);
         for(int i = 0; i < nbv; i++) {
           if(!fgets(buffer, sizeof(buffer), fp)) break;
@@ -1427,7 +1426,7 @@ int GModel::readMESH(const std::string &name)
         if(!fgets(buffer, sizeof(buffer), fp)) break;
         int nbe;
         sscanf(buffer, "%d", &nbe);
-        Msg(INFO, "%d triangles", nbe);
+        Msg::Info("%d triangles", nbe);
         for(int i = 0; i < nbe; i++) {
           if(!fgets(buffer, sizeof(buffer), fp)) break;
           int n[3], cl;
@@ -1442,7 +1441,7 @@ int GModel::readMESH(const std::string &name)
         if(!fgets(buffer, sizeof(buffer), fp)) break;
         int nbe;
         sscanf(buffer, "%d", &nbe);
-        Msg(INFO, "%d quadrangles", nbe);
+        Msg::Info("%d quadrangles", nbe);
         for(int i = 0; i < nbe; i++) {
           if(!fgets(buffer, sizeof(buffer), fp)) break;
           int n[4], cl;
@@ -1457,7 +1456,7 @@ int GModel::readMESH(const std::string &name)
         if(!fgets(buffer, sizeof(buffer), fp)) break;
         int nbe;
         sscanf(buffer, "%d", &nbe);
-        Msg(INFO, "%d tetrahedra", nbe);
+        Msg::Info("%d tetrahedra", nbe);
         for(int i = 0; i < nbe; i++) {
           if(!fgets(buffer, sizeof(buffer), fp)) break;
           int n[4], cl;
@@ -1484,7 +1483,7 @@ int GModel::writeMESH(const std::string &name, bool saveAll, double scalingFacto
 {
   FILE *fp = fopen(name.c_str(), "w");
   if(!fp){
-    Msg(GERROR, "Unable to open file '%s'", name.c_str());
+    Msg::Error("Unable to open file '%s'", name.c_str());
     return 0;
   }
 
@@ -1692,7 +1691,7 @@ static int readElementBDF(FILE *fp, char *buffer, int keySize, int numVertices,
 
   // negative 'numVertices' gives the minimum required number of vertices
   if((int)fields.size() - 2 < abs(numVertices)){
-    Msg(GERROR, "Wrong number of vertices %d for element", fields.size() - 2);
+    Msg::Error("Wrong number of vertices %d for element", fields.size() - 2);
     return 0;
   }
 
@@ -1715,7 +1714,7 @@ int GModel::readBDF(const std::string &name)
 {
   FILE *fp = fopen(name.c_str(), "r");
   if(!fp){
-    Msg(GERROR, "Unable to open file '%s'", name.c_str());
+    Msg::Error("Unable to open file '%s'", name.c_str());
     return 0;
   }
 
@@ -1737,7 +1736,7 @@ int GModel::readBDF(const std::string &name)
       }
     }
   }
-  Msg(INFO, "%d vertices", vertexMap.size());
+  Msg::Info("%d vertices", vertexMap.size());
 
   rewind(fp);
   while(!feof(fp)) {
@@ -1842,7 +1841,7 @@ int GModel::writeBDF(const std::string &name, int format, bool saveAll,
 {
   FILE *fp = fopen(name.c_str(), "w");
   if(!fp){
-    Msg(GERROR, "Unable to open file '%s'", name.c_str());
+    Msg::Error("Unable to open file '%s'", name.c_str());
     return 0;
   }
 
@@ -1902,7 +1901,7 @@ int GModel::readP3D(const std::string &name)
 {
   FILE *fp = fopen(name.c_str(), "r");
   if(!fp){
-    Msg(GERROR, "Unable to open file '%s'", name.c_str());
+    Msg::Error("Unable to open file '%s'", name.c_str());
     return 0;
   }
 
@@ -2001,7 +2000,7 @@ int GModel::writeP3D(const std::string &name, bool saveAll, double scalingFactor
 {
   FILE *fp = fopen(name.c_str(), "w");
   if(!fp){
-    Msg(GERROR, "Unable to open file '%s'", name.c_str());
+    Msg::Error("Unable to open file '%s'", name.c_str());
     return 0;
   }
 
@@ -2021,7 +2020,7 @@ int GModel::writeP3D(const std::string &name, bool saveAll, double scalingFactor
        ((*it)->physicals.size() || saveAll)) regions.push_back(*it);
   
   if(faces.empty() && regions.empty()){
-    Msg(WARNING, "No structured grids to save");
+    Msg::Warning("No structured grids to save");
     fclose(fp);
     return 0;
   }
diff --git a/Geo/GModelIO_OCC.cpp b/Geo/GModelIO_OCC.cpp
index 0fcd376fd811ef2e4901d0edb96cf7dd8fd0ff51..19afa31dd0e896c6415faf9abeda1ac9c54e07e5 100644
--- a/Geo/GModelIO_OCC.cpp
+++ b/Geo/GModelIO_OCC.cpp
@@ -1,4 +1,4 @@
-// $Id: GModelIO_OCC.cpp,v 1.31 2008-03-23 21:42:57 geuzaine Exp $
+// $Id: GModelIO_OCC.cpp,v 1.32 2008-05-04 08:31:13 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -206,10 +206,10 @@ void OCC_Internals::HealGeometry(double tolerance, bool fixsmalledges,
     surfacecont += system.Mass();
   }
 
-  Msg(INFO, "Healing geometry (tolerance=%g)", tolerance);
+  Msg::Info("Healing geometry (tolerance=%g)", tolerance);
 
   if(fixsmalledges){
-    Msg(INFO, "- fixing small edges");
+    Msg::Info("- fixing small edges");
 
     Handle(ShapeFix_Wire) sfw;
     Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
@@ -223,14 +223,14 @@ void OCC_Internals::HealGeometry(double tolerance, bool fixsmalledges,
         sfw->ModifyTopologyMode() = Standard_True;
         
         if(sfw->FixSmall(false, tolerance)){
-          Msg(INFO, "Fixed small edge in wire %d", wmap.FindIndex(oldwire));
+          Msg::Info("Fixed small edge in wire %d", wmap.FindIndex(oldwire));
           TopoDS_Wire newwire = sfw->Wire();
           rebuild->Replace(oldwire, newwire, Standard_False);
         }
         if((sfw->StatusSmall(ShapeExtend_FAIL1)) ||
            (sfw->StatusSmall(ShapeExtend_FAIL2)) ||
            (sfw->StatusSmall(ShapeExtend_FAIL3)))
-          Msg(INFO, "Failed to fix small edge in wire %d",  wmap.FindIndex(oldwire));
+          Msg::Info("Failed to fix small edge in wire %d",  wmap.FindIndex(oldwire));
       }
     }
     shape = rebuild->Apply(shape);
@@ -246,7 +246,7 @@ void OCC_Internals::HealGeometry(double tolerance, bool fixsmalledges,
           GProp_GProps system;
           BRepGProp::LinearProperties(edge, system);
           if(system.Mass() < tolerance){
-            Msg(INFO, "removing degenerated edge %d", emap.FindIndex(edge));
+            Msg::Info("removing degenerated edge %d", emap.FindIndex(edge));
             rebuild->Remove(edge, false);
           }
         }
@@ -259,26 +259,26 @@ void OCC_Internals::HealGeometry(double tolerance, bool fixsmalledges,
     sfwf->Load(shape);
     
     if(sfwf->FixSmallEdges()){
-      Msg(INFO, "- fixing wire frames");
-      if(sfwf->StatusSmallEdges(ShapeExtend_OK)) Msg(INFO, "no small edges found");
-      if(sfwf->StatusSmallEdges(ShapeExtend_DONE1)) Msg(INFO, "some small edges fixed");
-      if(sfwf->StatusSmallEdges(ShapeExtend_FAIL1)) Msg(INFO, "failed to fix some small edges");
+      Msg::Info("- fixing wire frames");
+      if(sfwf->StatusSmallEdges(ShapeExtend_OK)) Msg::Info("no small edges found");
+      if(sfwf->StatusSmallEdges(ShapeExtend_DONE1)) Msg::Info("some small edges fixed");
+      if(sfwf->StatusSmallEdges(ShapeExtend_FAIL1)) Msg::Info("failed to fix some small edges");
     }
   
     if(sfwf->FixWireGaps()){
-      Msg(INFO, "- fixing wire gaps");
-      if(sfwf->StatusWireGaps(ShapeExtend_OK)) Msg(INFO, "no gaps found");
-      if(sfwf->StatusWireGaps(ShapeExtend_DONE1)) Msg(INFO, "some 2D gaps fixed");
-      if(sfwf->StatusWireGaps(ShapeExtend_DONE2)) Msg(INFO, "some 3D gaps fixed");
-      if(sfwf->StatusWireGaps(ShapeExtend_FAIL1)) Msg(INFO, "failed to fix some 2D gaps");
-      if(sfwf->StatusWireGaps(ShapeExtend_FAIL2)) Msg(INFO, "failed to fix some 3D gaps");
+      Msg::Info("- fixing wire gaps");
+      if(sfwf->StatusWireGaps(ShapeExtend_OK)) Msg::Info("no gaps found");
+      if(sfwf->StatusWireGaps(ShapeExtend_DONE1)) Msg::Info("some 2D gaps fixed");
+      if(sfwf->StatusWireGaps(ShapeExtend_DONE2)) Msg::Info("some 3D gaps fixed");
+      if(sfwf->StatusWireGaps(ShapeExtend_FAIL1)) Msg::Info("failed to fix some 2D gaps");
+      if(sfwf->StatusWireGaps(ShapeExtend_FAIL2)) Msg::Info("failed to fix some 3D gaps");
     }
     
     shape = sfwf->Shape();
   }
   
   if(fixspotstripfaces){
-    Msg(INFO, "- fixing spot and strip faces");
+    Msg::Info("- fixing spot and strip faces");
     Handle(ShapeFix_FixSmallFace) sffsm = new ShapeFix_FixSmallFace();
     sffsm->Init(shape);
     sffsm->SetPrecision(tolerance);
@@ -288,7 +288,7 @@ void OCC_Internals::HealGeometry(double tolerance, bool fixsmalledges,
   }
   
   if(sewfaces){
-    Msg(INFO, "- sewing faces");
+    Msg::Info("- sewing faces");
 
     TopExp_Explorer exp0;
     
@@ -304,11 +304,11 @@ void OCC_Internals::HealGeometry(double tolerance, bool fixsmalledges,
     if(!sewedObj.SewedShape().IsNull())
       shape = sewedObj.SewedShape();
     else
-      Msg(INFO, " not possible");
+      Msg::Info(" not possible");
   }
   
   if(makesolids){  
-    Msg(INFO, "- making solids");
+    Msg::Info("- making solids");
     
     TopExp_Explorer exp0;
     
@@ -320,7 +320,7 @@ void OCC_Internals::HealGeometry(double tolerance, bool fixsmalledges,
     }
     
     if(!count){
-      Msg(INFO, " not possible (no shells)");
+      Msg::Info(" not possible (no shells)");
     }
     else{
       BRepCheck_Analyzer ba(ms);
@@ -345,7 +345,7 @@ void OCC_Internals::HealGeometry(double tolerance, bool fixsmalledges,
         }
       }
       else
-        Msg(INFO, " not possible");
+        Msg::Info(" not possible");
     }
   }
   buildLists();
@@ -527,7 +527,7 @@ void OCC_Internals::applyBooleanOperator(TopoDS_Shape tool,  const BooleanOperat
             TopoDS_Shape aValue2 = itSub2.Value();
             BRepAlgoAPI_Common BO (aValue1, aValue2);
             if (!BO.IsDone()) {
-              Msg(GERROR,"Boolean Add Operator can not be performed");
+              Msg::Error("Boolean Add Operator can not be performed");
             }
             if (isCompound) {
               TopoDS_Shape aStepResult = BO.Shape();
@@ -590,21 +590,21 @@ void GModel::_deleteOCCInternals()
 
 int GModel::readOCCSTEP(const std::string &fn)
 {
-  Msg(GERROR, "Gmsh has to be compiled with OpenCascade support to load '%s'",
+  Msg::Error("Gmsh has to be compiled with OpenCascade support to load '%s'",
       fn.c_str());
   return 0;
 }
 
 int GModel::readOCCIGES(const std::string &fn)
 {
-  Msg(GERROR, "Gmsh has to be compiled with OpenCascade support to load '%s'",
+  Msg::Error("Gmsh has to be compiled with OpenCascade support to load '%s'",
       fn.c_str());
   return 0;
 }
 
 int GModel::readOCCBREP(const std::string &fn)
 {
-  Msg(GERROR, "Gmsh has to be compiled with OpenCascade support to load '%s'",
+  Msg::Error("Gmsh has to be compiled with OpenCascade support to load '%s'",
       fn.c_str());
   return 0;
 }
diff --git a/Geo/GVertex.cpp b/Geo/GVertex.cpp
index bab1210652406d81ff8ff95df9965c9538500576..706c38b47e957a38589f4e24e9952f435ced6a16 100644
--- a/Geo/GVertex.cpp
+++ b/Geo/GVertex.cpp
@@ -1,4 +1,4 @@
-// $Id: GVertex.cpp,v 1.21 2008-03-03 22:04:22 geuzaine Exp $
+// $Id: GVertex.cpp,v 1.22 2008-05-04 08:31:13 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -43,7 +43,7 @@ GVertex::~GVertex()
 
 void GVertex::setPosition(GPoint &p)
 {
-  Msg(GERROR, "Cannot set position of this kind of vertex");
+  Msg::Error("Cannot set position of this kind of vertex");
 }
 
 void GVertex::addEdge(GEdge *e)
diff --git a/Geo/Geo.cpp b/Geo/Geo.cpp
index c05e6c2b8d50d4cf78a468c1c0bfa5f956bb4693..559a1d76a816e137676b7985765499b1a0b05bd9 100644
--- a/Geo/Geo.cpp
+++ b/Geo/Geo.cpp
@@ -1,4 +1,4 @@
-// $Id: Geo.cpp,v 1.110 2008-04-24 17:29:47 geuzaine Exp $
+// $Id: Geo.cpp,v 1.111 2008-05-04 08:31:13 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -375,11 +375,11 @@ void End_Curve(Curve *c)
 
     if(!R || !R2){
       // check radius
-      Msg(GERROR, "Zero radius in Circle/Ellipse %d", c->Num);
+      Msg::Error("Zero radius in Circle/Ellipse %d", c->Num);
     }
     else if(!v[3] && fabs((R - R2) / (R + R2)) > 0.1){
       // check cocircular pts (allow 10% error)
-      Msg(GERROR, "Control points of Circle %d are not cocircular %g %g",
+      Msg::Error("Control points of Circle %d are not cocircular %g %g",
           c->Num, R, R2);
     }
 
@@ -404,7 +404,7 @@ void End_Curve(Curve *c)
       rhs[1] = 1;
       sys2x2(sys, rhs, sol);
       if(sol[0] <= 0 || sol[1] <= 0) {
-        Msg(GERROR, "Ellipse %d is wrong", c->Num);
+        Msg::Error("Ellipse %d is wrong", c->Num);
         A1 = A3 = 0.;
         f1 = f2 = R;
       }
@@ -446,10 +446,10 @@ void End_Curve(Curve *c)
       c->Circle.v[i] = v[i];
 
     if(!CTX.expert_mode && c->Num > 0 && A3 - A1 > 1.01 * Pi){
-      Msg(GERROR1, "Circle or ellipse arc %d greater than Pi (angle=%g)", c->Num, A3-A1);
-      Msg(GERROR2, "(If you understand what this implies, you can disable this error");
-      Msg(GERROR2, "message by selecting `Enable expert mode' in the option dialog.");
-      Msg(GERROR3, "Otherwise, please subdivide the arc in smaller pieces.)");
+      Msg::Error("Circle or ellipse arc %d greater than Pi (angle=%g)", c->Num, A3-A1);
+      Msg::Error("(If you understand what this implies, you can disable this error");
+      Msg::Error("message by selecting `Enable expert mode' in the option dialog.");
+      Msg::Error("Otherwise, please subdivide the arc in smaller pieces.)");
     }
 
   }
@@ -552,7 +552,7 @@ Curve *Create_Curve(int Num, int Typ, int Order, List_T *Liste,
       if((v = FindPoint(iPnt)))
         List_Add(pC->Control_Points, &v);
       else{
-        Msg(GERROR, "Unknown control point %d in Curve %d", iPnt, pC->Num);
+        Msg::Error("Unknown control point %d in Curve %d", iPnt, pC->Num);
       }
     }
   }
@@ -570,18 +570,18 @@ Curve *Create_Curve(int Num, int Typ, int Order, List_T *Liste,
   else {
     Vertex *v;
     if((v = FindPoint(p1))) {
-      Msg(INFO, "Curve %d first control point %d ", pC->Num, v->Num);
+      Msg::Info("Curve %d first control point %d ", pC->Num, v->Num);
       pC->beg = v;
     }
     else {
-      Msg(GERROR, "Unknown control point %d in Curve %d", p1, pC->Num);
+      Msg::Error("Unknown control point %d in Curve %d", p1, pC->Num);
     }
     if((v = FindPoint(p2))) {
-      Msg(INFO, "Curve %d first control point %d ", pC->Num, v->Num);
+      Msg::Info("Curve %d first control point %d ", pC->Num, v->Num);
       pC->end = v;
     }
     else {
-      Msg(GERROR, "Unknown control point %d in Curve %d", p2, pC->Num);
+      Msg::Error("Unknown control point %d in Curve %d", p2, pC->Num);
     }
   }
 
@@ -988,7 +988,7 @@ void CopyShape(int Type, int Num, int *New)
   switch (Type) {
   case MSH_POINT:
     if(!(v = FindPoint(Num))) {
-      Msg(GERROR, "Unknown vertex %d", Num);
+      Msg::Error("Unknown vertex %d", Num);
       return;
     }
     newv = DuplicateVertex(v);
@@ -1005,7 +1005,7 @@ void CopyShape(int Type, int Num, int *New)
   case MSH_SEGM_NURBS:
   case MSH_SEGM_PARAMETRIC:
     if(!(c = FindCurve(Num))) {
-      Msg(GERROR, "Unknown curve %d", Num);
+      Msg::Error("Unknown curve %d", Num);
       return;
     }
     newc = DuplicateCurve(c);
@@ -1015,14 +1015,14 @@ void CopyShape(int Type, int Num, int *New)
   case MSH_SURF_REGL:
   case MSH_SURF_PLAN:
     if(!(s = FindSurface(Num))) {
-      Msg(GERROR, "Unknown surface %d", Num);
+      Msg::Error("Unknown surface %d", Num);
       return;
     }
     news = DuplicateSurface(s);
     *New = news->Num;
     break;
   default:
-    Msg(GERROR, "Impossible to copy entity %d (of type %d)", Num, Type);
+    Msg::Error("Impossible to copy entity %d (of type %d)", Num, Type);
     break;
   }
 }
@@ -1138,10 +1138,10 @@ void DeleteShape(int Type, int Num)
   case MSH_SEGM_FROM_GMODEL:
   case MSH_SURF_FROM_GMODEL:
   case MSH_VOLUME_FROM_GMODEL:
-    Msg(GERROR, "Deletion of external CAD entities not implemented yet");
+    Msg::Error("Deletion of external CAD entities not implemented yet");
     break;
   default:
-    Msg(GERROR, "Impossible to delete entity %d (of type %d)", Num, Type);
+    Msg::Error("Impossible to delete entity %d (of type %d)", Num, Type);
     break;
   }
 }
@@ -1218,7 +1218,7 @@ void VisibilityShape(int Type, int Num, int Mode)
     if((v = FindPoint(Num)))
       v->Visible = Mode;
     else
-      Msg(WARNING, "Unknown point %d (use '*' to hide/show all points)", Num);
+      Msg::Warning("Unknown point %d (use '*' to hide/show all points)", Num);
     break;
   case MSH_SEGM_LINE:
   case MSH_SEGM_SPLN:
@@ -1234,7 +1234,7 @@ void VisibilityShape(int Type, int Num, int Mode)
     if((c = FindCurve(Num)))
       c->Visible = Mode;
     else
-      Msg(WARNING, "Unknown line %d (use '*' to hide/show all lines)", Num);
+      Msg::Warning("Unknown line %d (use '*' to hide/show all lines)", Num);
     break;
   case MSH_SURF_TRIC:
   case MSH_SURF_REGL:
@@ -1243,14 +1243,14 @@ void VisibilityShape(int Type, int Num, int Mode)
     if((s = FindSurface(Num)))
       s->Visible = Mode;
     else
-      Msg(WARNING, "Unknown surface %d (use '*' to hide/show all surfaces)", Num);
+      Msg::Warning("Unknown surface %d (use '*' to hide/show all surfaces)", Num);
     break;
   case MSH_VOLUME:
   case MSH_VOLUME_DISCRETE:
     if((V = FindVolume(Num)))
       V->Visible = Mode;
     else
-      Msg(WARNING, "Unknown volume %d (use '*' to hide/show all volumes)", Num);
+      Msg::Warning("Unknown volume %d (use '*' to hide/show all volumes)", Num);
     break;
   default:
     break;
@@ -1553,10 +1553,10 @@ void printCurve(Curve *c)
 {
   Vertex *v;
   int N = List_Nbr(c->Control_Points);
-  Msg(DEBUG, "Curve %d %d cp (%d->%d)", c->Num, N, c->beg->Num, c->end->Num);
+  Msg::Debug("Curve %d %d cp (%d->%d)", c->Num, N, c->beg->Num, c->end->Num);
   for(int i = 0; i < N; i++) {
     List_Read(c->Control_Points, i, &v);
-    Msg(DEBUG, "Vertex %d (%g,%g,%g,%g)", v->Num, v->Pos.X, v->Pos.Y,
+    Msg::Debug("Vertex %d (%g,%g,%g,%g)", v->Num, v->Pos.X, v->Pos.Y,
         v->Pos.Z, v->lc);
   }
 }
@@ -1566,7 +1566,7 @@ void printSurface(Surface *s)
   Curve *c;
   int N = List_Nbr(s->Generatrices);
 
-  Msg(DEBUG, "Surface %d, %d generatrices", s->Num, N);
+  Msg::Debug("Surface %d, %d generatrices", s->Num, N);
   for(int i = 0; i < N; i++) {
     List_Read(s->Generatrices, i, &c);
     printCurve(c);
@@ -1638,7 +1638,7 @@ void ApplyTransformationToCurve(double matrix[4][4], Curve *c)
   Vertex *v;
 
   if(!c->beg || !c->end){
-    Msg(GERROR, "Cannot transform curve with no begin/end points");
+    Msg::Error("Cannot transform curve with no begin/end points");
     return;
   }
 
@@ -1690,7 +1690,7 @@ void ApplicationOnShapes(double matrix[4][4], List_T *shapes)
       if(v)
         ApplyTransformationToPoint(matrix, v, true);
       else
-        Msg(GERROR, "Unknown point %d", O.Num);
+        Msg::Error("Unknown point %d", O.Num);
       break;
     case MSH_SEGM_LINE:
     case MSH_SEGM_SPLN:
@@ -1706,7 +1706,7 @@ void ApplicationOnShapes(double matrix[4][4], List_T *shapes)
       if(c)
         ApplyTransformationToCurve(matrix, c);
       else
-        Msg(GERROR, "Unknown curve %d", O.Num);
+        Msg::Error("Unknown curve %d", O.Num);
       break;
     case MSH_SURF_REGL:
     case MSH_SURF_TRIC:
@@ -1715,10 +1715,10 @@ void ApplicationOnShapes(double matrix[4][4], List_T *shapes)
       if(s)
         ApplyTransformationToSurface(matrix, s);
       else
-        Msg(GERROR, "Unknown surface %d", O.Num);
+        Msg::Error("Unknown surface %d", O.Num);
       break;
     default:
-      Msg(GERROR, "Impossible to transform entity %d (of type %d)", O.Num,
+      Msg::Error("Impossible to transform entity %d (of type %d)", O.Num,
           O.Type);
       break;
     }
@@ -1832,7 +1832,7 @@ void BoundaryShapes(List_T *shapes, List_T *shapesBoundary)
           }
         }
         else
-          Msg(GERROR, "Unknown curve %d", O.Num);
+          Msg::Error("Unknown curve %d", O.Num);
       }
       break;
     case MSH_SURF_PLAN:
@@ -1852,7 +1852,7 @@ void BoundaryShapes(List_T *shapes, List_T *shapesBoundary)
           }
         }
         else
-          Msg(GERROR, "Unknown surface %d", O.Num);
+          Msg::Error("Unknown surface %d", O.Num);
       }
       break;
     case MSH_VOLUME:
@@ -1869,11 +1869,11 @@ void BoundaryShapes(List_T *shapes, List_T *shapesBoundary)
           }
         }
         else
-          Msg(GERROR, "Unknown volume %d", O.Num);
+          Msg::Error("Unknown volume %d", O.Num);
       }
       break;
     default:
-      Msg(GERROR, "Impossible to take boundary of entity %d (of type %d)", O.Num,
+      Msg::Error("Impossible to take boundary of entity %d (of type %d)", O.Num,
           O.Type);
       break;
     }
@@ -1931,7 +1931,7 @@ int Extrude_ProtudePoint(int type, int ip,
   if(!Tree_Query(GModel::current()->getGEOInternals()->Points, &pv))
     return 0;
 
-  Msg(DEBUG, "Extrude Point %d", ip);
+  Msg::Debug("Extrude Point %d", ip);
 
   chapeau = DuplicateVertex(pv);
 
@@ -2059,7 +2059,7 @@ int Extrude_ProtudePoint(int type, int ip,
     c->end = chapeau;
     break;
   default:
-    Msg(GERROR, "Unknown extrusion type");
+    Msg::Error("Unknown extrusion type");
     return pv->Num;
   }
 
@@ -2099,11 +2099,11 @@ int Extrude_ProtudeCurve(int type, int ic,
   }
 
   if(!pc->beg || !pc->end){
-    Msg(GERROR, "Cannot extrude curve with no begin/end points");
+    Msg::Error("Cannot extrude curve with no begin/end points");
     return 0;
   }
 
-  Msg(DEBUG, "Extrude Curve %d", ic);
+  Msg::Debug("Extrude Curve %d", ic);
 
   chapeau = DuplicateCurve(pc);
 
@@ -2176,7 +2176,7 @@ int Extrude_ProtudeCurve(int type, int ic,
     ApplyTransformationToCurve(matrix, chapeau);
     break;
   default:
-    Msg(GERROR, "Unknown extrusion type");
+    Msg::Error("Unknown extrusion type");
     return pc->Num;
   }
 
@@ -2253,7 +2253,7 @@ int Extrude_ProtudeSurface(int type, int is,
   if(!(ps = FindSurface(is)))
     return 0;
 
-  Msg(DEBUG, "Extrude Surface %d", is);
+  Msg::Debug("Extrude Surface %d", is);
 
   chapeau = DuplicateSurface(ps);
 
@@ -2268,7 +2268,7 @@ int Extrude_ProtudeSurface(int type, int is,
     List_Read(chapeau->Generatrices, i, &c);
     if(c->Num < 0)
       if(!(c = FindCurve(-c->Num))) {
-        Msg(GERROR, "Unknown curve %d", -c->Num);
+        Msg::Error("Unknown curve %d", -c->Num);
         return ps->Num;
       }
     c->Extrude = new ExtrudeParams(COPIED_ENTITY);
@@ -2386,7 +2386,7 @@ int Extrude_ProtudeSurface(int type, int is,
     ApplyTransformationToSurface(matrix, chapeau);
     break;
   default:
-    Msg(GERROR, "Unknown extrusion type");
+    Msg::Error("Unknown extrusion type");
     return ps->Num;
   }
 
@@ -2531,7 +2531,7 @@ void ExtrudeShapes(int type, List_T *list_in,
       }
       break;
     default:
-      Msg(GERROR, "Impossible to extrude entity %d (of type %d)",
+      Msg::Error("Impossible to extrude entity %d (of type %d)",
           shape.Num, shape.Type);
       break;
     }
@@ -2675,7 +2675,7 @@ void ReplaceDuplicatePoints()
     return;
   }
 
-  Msg(DEBUG, "Removed %d duplicate points", start - end);
+  Msg::Debug("Removed %d duplicate points", start - end);
 
   if(CTX.geom.old_newreg) {
     GModel::current()->getGEOInternals()->MaxPointNum = 0;
@@ -2688,13 +2688,13 @@ void ReplaceDuplicatePoints()
   for(i = 0; i < List_Nbr(All); i++) {
     List_Read(All, i, &c);
     if(!Tree_Query(allNonDuplicatedPoints, &c->beg))
-      Msg(GERROR, "Weird point %d in Coherence", c->beg->Num);
+      Msg::Error("Weird point %d in Coherence", c->beg->Num);
     if(!Tree_Query(allNonDuplicatedPoints, &c->end))
-      Msg(GERROR, "Weird point %d in Coherence", c->end->Num);
+      Msg::Error("Weird point %d in Coherence", c->end->Num);
     for(j = 0; j < List_Nbr(c->Control_Points); j++) {
       pv = (Vertex **)List_Pointer(c->Control_Points, j);
       if(!(pv2 = (Vertex **)Tree_PQuery(allNonDuplicatedPoints, pv)))
-        Msg(GERROR, "Weird point %d in Coherence", (*pv)->Num);
+        Msg::Error("Weird point %d in Coherence", (*pv)->Num);
       else
         List_Write(c->Control_Points, j, pv2);
     }
@@ -2709,14 +2709,14 @@ void ReplaceDuplicatePoints()
     for(j = 0; j < List_Nbr(s->Control_Points); j++) {
       pv = (Vertex **)List_Pointer(s->Control_Points, j);
       if(!(pv2 = (Vertex **)Tree_PQuery(allNonDuplicatedPoints, pv)))
-        Msg(GERROR, "Weird point %d in Coherence", (*pv)->Num);
+        Msg::Error("Weird point %d in Coherence", (*pv)->Num);
       else
         List_Write(s->Control_Points, j, pv2);
     }
     for(j = 0; j < List_Nbr(s->TrsfPoints); j++){
       pv = (Vertex **)List_Pointer(s->TrsfPoints, j);
       if(!(pv2 = (Vertex **)Tree_PQuery(allNonDuplicatedPoints, pv)))
-        Msg(GERROR, "Weird point %d in Coherence", (*pv)->Num);
+        Msg::Error("Weird point %d in Coherence", (*pv)->Num);
       else
         List_Write(s->TrsfPoints, j, pv2);
     }
@@ -2731,7 +2731,7 @@ void ReplaceDuplicatePoints()
     for(j = 0; j < List_Nbr(vol->TrsfPoints); j++){
       pv = (Vertex **)List_Pointer(vol->TrsfPoints, j);
       if(!(pv2 = (Vertex **)Tree_PQuery(allNonDuplicatedPoints, pv)))
-        Msg(GERROR, "Weird point %d in Coherence", (*pv)->Num);
+        Msg::Error("Weird point %d in Coherence", (*pv)->Num);
       else
         List_Write(vol->TrsfPoints, j, pv2);
     }
@@ -2767,7 +2767,7 @@ void ReplaceDuplicateCurves()
       if(!Tree_Search(allNonDuplicatedCurves, &c)) {
         Tree_Insert(allNonDuplicatedCurves, &c);
         if(!(c2 = FindCurve(-c->Num))) {
-          Msg(GERROR, "Unknown curve %d", -c->Num);
+          Msg::Error("Unknown curve %d", -c->Num);
           List_Delete(All);
           return;
         }
@@ -2776,7 +2776,7 @@ void ReplaceDuplicateCurves()
       else {
         Tree_Suppress(GModel::current()->getGEOInternals()->Curves, &c);
         if(!(c2 = FindCurve(-c->Num))) {
-          Msg(GERROR, "Unknown curve %d", -c->Num);
+          Msg::Error("Unknown curve %d", -c->Num);
           List_Delete(All);
           return;
         }
@@ -2793,7 +2793,7 @@ void ReplaceDuplicateCurves()
     return;
   }
 
-  Msg(DEBUG, "Removed %d duplicate curves", start - end);
+  Msg::Debug("Removed %d duplicate curves", start - end);
 
   if(CTX.geom.old_newreg) {
     GModel::current()->getGEOInternals()->MaxLineNum = 0;
@@ -2808,7 +2808,7 @@ void ReplaceDuplicateCurves()
     for(j = 0; j < List_Nbr(s->Generatrices); j++) {
       pc = (Curve **)List_Pointer(s->Generatrices, j);
       if(!(pc2 = (Curve **)Tree_PQuery(allNonDuplicatedCurves, pc)))
-        Msg(GERROR, "Weird curve %d in Coherence", (*pc)->Num);
+        Msg::Error("Weird curve %d in Coherence", (*pc)->Num);
       else {
         List_Write(s->Generatrices, j, pc2);
         // Arghhh. Revoir compareTwoCurves !
@@ -2855,7 +2855,7 @@ void ReplaceDuplicateSurfaces()
     return;
   }
 
-  Msg(DEBUG, "Removed %d duplicate surfaces", start - end);
+  Msg::Debug("Removed %d duplicate surfaces", start - end);
 
   if(CTX.geom.old_newreg) {
     GModel::current()->getGEOInternals()->MaxSurfaceNum = 0;
@@ -2870,7 +2870,7 @@ void ReplaceDuplicateSurfaces()
     for(j = 0; j < List_Nbr(vol->Surfaces); j++) {
       ps = (Surface **)List_Pointer(vol->Surfaces, j);
       if(!(ps2 = (Surface **)Tree_PQuery(allNonDuplicatedSurfaces, ps)))
-        Msg(GERROR, "Weird surface %d in Coherence", (*ps)->Num);
+        Msg::Error("Weird surface %d in Coherence", (*ps)->Num);
       else
         List_Write(vol->Surfaces, j, ps2);
     }
@@ -2899,7 +2899,7 @@ double min1d(double (*funct) (double), double *xmin)
   // we should think about the tolerance more carefully...
   double ax = 1.e-15, bx = 1.e-12, cx = 1.e-11, fa, fb, fx, tol = 1.e-4;
   mnbrak(&ax, &bx, &cx, &fa, &fx, &fb, funct);
-  //Msg(INFO, "--MIN1D : ax %12.5E bx %12.5E cx %12.5E",ax,bx,cx);  
+  //Msg::Info("--MIN1D : ax %12.5E bx %12.5E cx %12.5E",ax,bx,cx);  
   return (brent(ax, bx, cx, funct, tol, xmin));
 }
 
@@ -3021,7 +3021,7 @@ bool IntersectCurvesWithSurface(List_T *curve_ids, int surface_id, List_T *shape
 {
   Surface *s = FindSurface(surface_id);
   if(!s){
-    Msg(GERROR, "Unknown surface %d", surface_id);
+    Msg::Error("Unknown surface %d", surface_id);
     return false;
   }
   for(int i = 0; i < List_Nbr(curve_ids); i++){
@@ -3041,7 +3041,7 @@ bool IntersectCurvesWithSurface(List_T *curve_ids, int surface_id, List_T *shape
       }
     }
     else{
-      Msg(GERROR, "Uknown curve %d", (int)curve_id);
+      Msg::Error("Uknown curve %d", (int)curve_id);
       return false;
     }
   }
@@ -3066,7 +3066,7 @@ void sortEdgesInLoop(int num, List_T *edges)
     if((c = FindCurve(j)))
       List_Add(temp, &c);
     else
-      Msg(GERROR, "Unknown curve %d in line loop %d", j, num);
+      Msg::Error("Unknown curve %d in line loop %d", j, num);
   }
   List_Reset(edges);
 
@@ -3083,7 +3083,7 @@ void sortEdgesInLoop(int num, List_T *edges)
         c1 = c2;
         if(c2->end == c0->beg) {
           if(List_Nbr(temp)) {
-            Msg(INFO, "Starting subloop %d in Line Loop %d (are you sure about this?)",
+            Msg::Info("Starting subloop %d in Line Loop %d (are you sure about this?)",
                 ++k, num);
             c0 = c1 = *(Curve **)List_Pointer(temp, 0);
             List_Add(edges, &c1->Num);
@@ -3094,7 +3094,7 @@ void sortEdgesInLoop(int num, List_T *edges)
       }
     }
     if(j++ > nbEdges) {
-      Msg(GERROR, "Line Loop %d is wrong", num);
+      Msg::Error("Line Loop %d is wrong", num);
       break;
     }
   }
@@ -3113,7 +3113,7 @@ void setSurfaceEmbeddedPoints(Surface *s, List_T *points)
     if(v)
       List_Add(s->EmbeddedPoints, &v);
     else
-      Msg(GERROR, "Unknown point %d", iPoint);
+      Msg::Error("Unknown point %d", iPoint);
   }
 }
 
@@ -3129,7 +3129,7 @@ void setSurfaceEmbeddedCurves(Surface *s, List_T *curves)
     if(c)
       List_Add(s->EmbeddedCurves, &c);
     else
-      Msg(GERROR, "Unknown curve %d", iCurve);
+      Msg::Error("Unknown curve %d", iCurve);
   }
 }
 
@@ -3142,7 +3142,7 @@ void setSurfaceGeneratrices(Surface *s, List_T *loops)
     List_Read(loops, i, &iLoop);
     EdgeLoop *el;
     if(!(el = FindEdgeLoop(abs(iLoop)))) {
-      Msg(GERROR, "Unknown line loop %d", iLoop);
+      Msg::Error("Unknown line loop %d", iLoop);
       List_Delete(s->Generatrices);
       s->Generatrices = NULL;
       return;
@@ -3157,7 +3157,7 @@ void setSurfaceGeneratrices(Surface *s, List_T *loops)
           ic *= sign(iLoop);
           if(i != 0) ic *= -1; // hole
           if(!(c = FindCurve(ic))) {
-            Msg(GERROR, "Unknown curve %d", ic);
+            Msg::Error("Unknown curve %d", ic);
             List_Delete(s->Generatrices);
             s->Generatrices = NULL;
             return;
@@ -3172,7 +3172,7 @@ void setSurfaceGeneratrices(Surface *s, List_T *loops)
           ic *= sign(iLoop);
           if(i != 0) ic *= -1; // hole
           if(!(c = FindCurve(ic))) {
-            Msg(GERROR, "Unknown curve %d", ic);
+            Msg::Error("Unknown curve %d", ic);
             List_Delete(s->Generatrices);
             s->Generatrices = NULL;
             return;
@@ -3195,7 +3195,7 @@ void setVolumeSurfaces(Volume *v, List_T *loops)
     List_Read(loops, i, &il);
     SurfaceLoop *sl;
     if(!(sl = FindSurfaceLoop(abs(il)))) {
-      Msg(GERROR, "Unknown surface loop %d", il);
+      Msg::Error("Unknown surface loop %d", il);
       return;
     }
     else {
@@ -3218,7 +3218,7 @@ void setVolumeSurfaces(Volume *v, List_T *loops)
             List_Add(v->SurfacesByTag, &is);
           }
           else{
-            Msg(GERROR, "Unknown surface %d", is);
+            Msg::Error("Unknown surface %d", is);
             return;
           }
         }
diff --git a/Geo/GeoInterpolation.cpp b/Geo/GeoInterpolation.cpp
index c4ddf01ebfbc35fdda734ee9ca586f897c296c54..571f300739d8bb368a6d0495ec762f1b4cb9837b 100644
--- a/Geo/GeoInterpolation.cpp
+++ b/Geo/GeoInterpolation.cpp
@@ -1,4 +1,4 @@
-// $Id: GeoInterpolation.cpp,v 1.35 2008-04-24 17:29:47 geuzaine Exp $
+// $Id: GeoInterpolation.cpp,v 1.36 2008-05-04 08:31:13 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -227,7 +227,7 @@ Vertex InterpolateCurve(Curve *c, double u, int derivee)
   if(c->Num < 0) {
     Curve *C0 = FindCurve(-c->Num);
     if(!C0){
-      Msg(GERROR, "Unknown curve %d", -c->Num);
+      Msg::Error("Unknown curve %d", -c->Num);
       return Vertex(0., 0., 0.);
     }
     return InterpolateCurve(C0, C0->ubeg + (C0->uend - C0->ubeg) * (1. - u), derivee);
@@ -377,15 +377,15 @@ Vertex InterpolateCurve(Curve *c, double u, int derivee)
       return InterpolateCubicSpline(v, t, c->mat, 0, t1, t2);
 
   case MSH_SEGM_BND_LAYER:
-    Msg(GERROR, "Cannot interpolate boundary layer curve");
+    Msg::Error("Cannot interpolate boundary layer curve");
     return V;
 
   case MSH_SEGM_DISCRETE:
-    Msg(GERROR, "Cannot interpolate discrete curve");
+    Msg::Error("Cannot interpolate discrete curve");
     return V;
 
   default:
-    Msg(GERROR, "Unknown curve type in interpolation");
+    Msg::Error("Unknown curve type in interpolation");
     return V;
   }
 
@@ -547,7 +547,7 @@ Vertex InterpolateExtrudedSurface(Surface *s, double u, double v)
   }
 
   if(num < 0)
-    Msg(GERROR, "Unknown curve in extruded surface");
+    Msg::Error("Unknown curve in extruded surface");
   
   Vertex T;
 
@@ -633,19 +633,19 @@ Vertex InterpolateSurface(Surface *s, double u, double v, int derivee, int u_v)
     }
   case MSH_SURF_BND_LAYER:
     {
-      Msg(GERROR, "Cannot interpolate boundary layer surface");
+      Msg::Error("Cannot interpolate boundary layer surface");
       Vertex T(0., 0., 0.);
       return T;
     }    
   case MSH_SURF_DISCRETE:
     {
-      Msg(GERROR, "Cannot interpolate discrete surface");
+      Msg::Error("Cannot interpolate discrete surface");
       Vertex T(0., 0., 0.);
       return T;
     }    
   default:
     {
-      Msg(GERROR, "Unknown surface type in interpolation");
+      Msg::Error("Unknown surface type in interpolation");
       Vertex T(0., 0., 0.);
       return T;
     }
diff --git a/Geo/GeoStringInterface.cpp b/Geo/GeoStringInterface.cpp
index fb655fc11afdad26f5d9cab7ecb425de071858cc..2703a19d39a22201aaeb46efdd9aa5908375968d 100644
--- a/Geo/GeoStringInterface.cpp
+++ b/Geo/GeoStringInterface.cpp
@@ -1,4 +1,4 @@
-// $Id: GeoStringInterface.cpp,v 1.20 2008-03-20 11:44:05 geuzaine Exp $
+// $Id: GeoStringInterface.cpp,v 1.21 2008-05-04 08:31:13 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -38,7 +38,8 @@ extern Context_T CTX;
 // Some old systems don't have snprintf... Just call sprintf instead.
 
 #if defined(HAVE_NO_SNPRINTF)
-int snprintf(char *str, size_t size, const char* fmt, ...){
+int snprintf(char *str, size_t size, const char* fmt, ...)
+{
   va_list args;
   va_start(args, fmt);
   int ret = vsprintf(str, fmt, args);
@@ -53,7 +54,7 @@ double evaluate_scalarfunction(const char *var, double val, const char *funct)
   tempf = gmsh_yyin;
 
   if(!(gmsh_yyin = fopen(CTX.tmp_filename_fullpath, "w"))) {
-    Msg(GERROR, "Unable to open temporary file '%s'", CTX.tmp_filename_fullpath);
+    Msg::Error("Unable to open temporary file '%s'", CTX.tmp_filename_fullpath);
     return 0.;
   }
 
@@ -83,12 +84,12 @@ double evaluate_scalarfunction(const char *var, double val, const char *funct)
 void add_infile(const char *text, const char *fich, bool deleted_something)
 {
   if(!(gmsh_yyin = fopen(CTX.tmp_filename_fullpath, "w"))) {
-    Msg(GERROR, "Unable to open temporary file '%s'", CTX.tmp_filename_fullpath);
+    Msg::Error("Unable to open temporary file '%s'", CTX.tmp_filename_fullpath);
     return;
   }
 
   fprintf(gmsh_yyin, "%s\n", text);
-  Msg(STATUS2, "%s", text);
+  Msg::Status(2, true, "%s", text);
   fclose(gmsh_yyin);
   gmsh_yyin = fopen(CTX.tmp_filename_fullpath, "r");
   while(!feof(gmsh_yyin)) {
@@ -106,7 +107,7 @@ void add_infile(const char *text, const char *fich, bool deleted_something)
 
   FILE *file;
   if(!(file = fopen(fich, "a"))) {
-    Msg(GERROR, "Unable to open file '%s'", fich);
+    Msg::Error("Unable to open file '%s'", fich);
     return;
   }
   
@@ -122,7 +123,7 @@ void add_infile(const char *text, const char *fich, bool deleted_something)
               "Merge \"%s\";\n\n"
               "and use that file instead. To disable this warning in the future, select\n"
               "`Enable expert mode' in the option dialog.)", fich);
-      if(!GetBinaryAnswer(question, "Proceed", "Cancel", false)){
+      if(!Msg::GetBinaryAnswer(question, "Proceed", "Cancel", false)){
         fclose(file);
         return;
       }
diff --git a/Geo/MElement.cpp b/Geo/MElement.cpp
index 88c3f44bbc187947640fdbbaf734b2aea5b3ecac..342dde6e8a5512b82f8239dccdbd93ada4e56782 100644
--- a/Geo/MElement.cpp
+++ b/Geo/MElement.cpp
@@ -1,4 +1,4 @@
-// $Id: MElement.cpp,v 1.65 2008-04-23 08:06:21 remacle Exp $
+// $Id: MElement.cpp,v 1.66 2008-05-04 08:31:13 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -809,19 +809,31 @@ extern int getNGQQPts(int order);
 extern IntPt *getGQQPts(int order);
 extern int getNGQHPts(int order);
 extern IntPt *getGQHPts(int order);
-void MTriangle:: getIntegrationPoints ( int pOrder , int *npts, IntPt **pts) const{
+void MTriangle:: getIntegrationPoints ( int pOrder , int *npts, IntPt **pts) const
+{
+#if !defined(HAVE_GMSH_EMBEDDED)
   *npts = getNGQTPts(pOrder);
   *pts  = getGQTPts(pOrder);
+#endif
 }
-void MTetrahedron:: getIntegrationPoints ( int pOrder , int *npts, IntPt **pts) const{
+void MTetrahedron:: getIntegrationPoints ( int pOrder , int *npts, IntPt **pts) const
+{
+#if !defined(HAVE_GMSH_EMBEDDED)
   *npts = getNGQTetPts(pOrder);
   *pts  = getGQTetPts(pOrder);
+#endif
 }
-void MHexahedron:: getIntegrationPoints ( int pOrder , int *npts, IntPt **pts) const{
+void MHexahedron:: getIntegrationPoints ( int pOrder , int *npts, IntPt **pts) const
+{
+#if !defined(HAVE_GMSH_EMBEDDED)
   *npts = getNGQHPts(pOrder);
   *pts  = getGQHPts(pOrder);
+#endif
 }
-void MQuadrangle:: getIntegrationPoints ( int pOrder , int *npts, IntPt **pts) const{
+void MQuadrangle:: getIntegrationPoints ( int pOrder , int *npts, IntPt **pts) const
+{
+#if !defined(HAVE_GMSH_EMBEDDED)
   *npts = getNGQQPts(pOrder);
   *pts  = getGQQPts(pOrder);
+#endif
 }
diff --git a/Geo/Makefile b/Geo/Makefile
index 3ab63da00a8a76b412a24669f8b53eee292512ad..f4b9ab1a06fadc577af1cbad3966ac51ac7efba7 100644
--- a/Geo/Makefile
+++ b/Geo/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.204 2008-04-23 23:00:39 geuzaine Exp $
+# $Id: Makefile,v 1.205 2008-05-04 08:31:13 geuzaine Exp $
 #
 # Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 #
@@ -173,8 +173,7 @@ GModel.o: GModel.cpp GModel.h GVertex.h GEntity.h Range.h SPoint3.h \
   ../DataStr/Tree.h ../DataStr/avl.h ExtrudeParams.h \
   ../Common/SmoothData.h discreteFace.h discreteEdge.h discreteVertex.h \
   ../Common/Message.h ../Mesh/Field.h ../Geo/Geo.h ../Post/PView.h \
-  ../Post/PViewData.h ../Geo/SBoundingBox3d.h ../Post/PViewOptions.h \
-  ../Post/ColorTable.h ../Mesh/Generator.h ../Common/Context.h
+  ../Geo/SPoint3.h ../Mesh/Generator.h ../Common/Context.h
 GModelIO_Geo.o: GModelIO_Geo.cpp GModel.h GVertex.h GEntity.h Range.h \
   SPoint3.h SBoundingBox3d.h GPoint.h SPoint2.h GEdge.h SVector3.h \
   GFace.h GEdgeLoop.h Pair.h GRegion.h Geo.h ../Common/GmshDefines.h \
@@ -183,8 +182,7 @@ GModelIO_Geo.o: GModelIO_Geo.cpp GModel.h GVertex.h GEntity.h Range.h \
   ../Common/SmoothData.h ../Parser/OpenFile.h ../DataStr/Tools.h \
   ../DataStr/List.h ../DataStr/Tree.h ../Common/Message.h gmshVertex.h \
   MVertex.h gmshFace.h gmshEdge.h gmshRegion.h ../Parser/Parser.h \
-  ../Mesh/Field.h ../Geo/Geo.h ../Post/PView.h ../Post/PViewData.h \
-  ../Geo/SBoundingBox3d.h ../Post/PViewOptions.h ../Post/ColorTable.h
+  ../Mesh/Field.h ../Geo/Geo.h ../Post/PView.h ../Geo/SPoint3.h
 GModelIO_Mesh.o: GModelIO_Mesh.cpp GModel.h GVertex.h GEntity.h Range.h \
   SPoint3.h SBoundingBox3d.h GPoint.h SPoint2.h GEdge.h SVector3.h \
   GFace.h GEdgeLoop.h Pair.h GRegion.h ../Common/GmshDefines.h MElement.h \
@@ -223,8 +221,7 @@ Geo.o: Geo.cpp ../Common/Message.h ../Numeric/Numeric.h \
   SPoint3.h SVector3.h SBoundingBox3d.h ExtrudeParams.h \
   ../Common/SmoothData.h GModel.h GVertex.h GEntity.h GPoint.h GEdge.h \
   GFace.h GEdgeLoop.h GRegion.h GeoInterpolation.h ../Parser/Parser.h \
-  ../Mesh/Field.h ../Geo/Geo.h ../Post/PView.h ../Post/PViewData.h \
-  ../Geo/SBoundingBox3d.h ../Post/PViewOptions.h ../Post/ColorTable.h \
+  ../Mesh/Field.h ../Geo/Geo.h ../Post/PView.h ../Geo/SPoint3.h \
   ../Common/Context.h
 GeoStringInterface.o: GeoStringInterface.cpp ../Common/Message.h \
   ../Numeric/Numeric.h ../Numeric/NumericEmbedded.h ../DataStr/Malloc.h \
diff --git a/Geo/OCCEdge.cpp b/Geo/OCCEdge.cpp
index f4be162722a387436a78de22d8c0314196333740..30016b76f1a37779036b7382a261a4c1adb8f30c 100644
--- a/Geo/OCCEdge.cpp
+++ b/Geo/OCCEdge.cpp
@@ -1,4 +1,4 @@
-// $Id: OCCEdge.cpp,v 1.37 2008-03-20 11:44:06 geuzaine Exp $
+// $Id: OCCEdge.cpp,v 1.38 2008-05-04 08:31:13 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -76,7 +76,7 @@ SPoint2 OCCEdge::reparamOnFace(GFace *face, double epar, int dir) const
   }
   
   if(c2d.IsNull()){
-    Msg(FATAL,"Reparam on face failed: curve %d is not on surface %d",
+    Msg::Fatal("Reparam on face failed: curve %d is not on surface %d",
         tag(), face->tag());
   }
 
@@ -92,11 +92,11 @@ SPoint2 OCCEdge::reparamOnFace(GFace *face, double epar, int dir) const
   const double dz = p1.z()-p2.z();
   if(sqrt(dx * dx + dy * dy + dz * dz) > 1.e-4 * CTX.lc){
     // return reparamOnFace(face, epar,-1);      
-    Msg(WARNING, "Reparam on face partially failed for curve %d surface %d at point %g",
+    Msg::Warning("Reparam on face partially failed for curve %d surface %d at point %g",
         tag(), face->tag(), epar);
-    Msg(WARNING, "On the face %d local (%g %g) global (%g %g %g)",
+    Msg::Warning("On the face %d local (%g %g) global (%g %g %g)",
         face->tag(), u, v, p2.x(), p2.y(), p2.z());
-    Msg(WARNING, "On the edge %d local (%g) global (%g %g %g)",
+    Msg::Warning("On the edge %d local (%g) global (%g %g %g)",
         tag(), epar, p1.x(), p1.y(), p1.z());
     // GPoint ppp = face->closestPoint(SPoint3(p1.x(), p1.y(), p1.z()));
     // return SPoint2(ppp.u(), ppp.v());
@@ -129,7 +129,7 @@ GPoint OCCEdge::point(double par) const
     return GPoint(pnt.X(), pnt.Y(), pnt.Z());
   }
   else{
-    Msg(WARNING, "OCC Curve %d is neither a 3D curve not a trimmed curve", tag());
+    Msg::Warning("OCC Curve %d is neither a 3D curve not a trimmed curve", tag());
     return GPoint(0, 0, 0);
   }
 }
diff --git a/Geo/OCCFace.cpp b/Geo/OCCFace.cpp
index 05c14c22175c9915b2d41eac7795d5de58bcb3b5..1ac103afceae00b85a7ac924ce1bfe8ceb47a55e 100644
--- a/Geo/OCCFace.cpp
+++ b/Geo/OCCFace.cpp
@@ -1,4 +1,4 @@
-// $Id: OCCFace.cpp,v 1.39 2008-03-20 11:44:06 geuzaine Exp $
+// $Id: OCCFace.cpp,v 1.40 2008-05-04 08:31:13 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -46,7 +46,7 @@ OCCFace::OCCFace(GModel *m, TopoDS_Face _s, int num, TopTools_IndexedMapOfShape
   TopExp_Explorer exp0, exp01, exp1, exp2, exp3;
   for(exp2.Init(s, TopAbs_WIRE); exp2.More(); exp2.Next()){
     TopoDS_Shape wire = exp2.Current();
-    Msg(DEBUG2,"OCC Face %d - New Wire",num);
+    Msg::Debug("OCC Face %d - New Wire",num);
     std::list<GEdge*> l_wire;
     std::list<int> l_oris;
     for(exp3.Init(wire, TopAbs_EDGE); exp3.More(); exp3.Next()){          
@@ -56,7 +56,7 @@ OCCFace::OCCFace(GModel *m, TopoDS_Face _s, int num, TopTools_IndexedMapOfShape
       if(!e) throw;
       l_wire.push_back(e);
       l_oris.push_back(edge.Orientation());
-      Msg(DEBUG2, "Edge %d ori %d", e->tag(), edge.Orientation());
+      Msg::Debug("Edge %d ori %d", e->tag(), edge.Orientation());
       e->addFace(this);
       if(!e->is3D()){
         OCCEdge *occe = (OCCEdge*)e;
@@ -87,7 +87,7 @@ OCCFace::OCCFace(GModel *m, TopoDS_Face _s, int num, TopTools_IndexedMapOfShape
   _periodic[1] = surface.IsVPeriodic();
 
   ShapeAnalysis::GetFaceUVBounds(_s, umin, umax, vmin, vmax);
-  Msg(DEBUG2, "OCC Face %d with %d edges bounds (%g,%g)(%g,%g)", 
+  Msg::Debug("OCC Face %d with %d edges bounds (%g,%g)(%g,%g)", 
       num, l_edges.size(), umin, umax, vmin, vmax);
   // we do that for the projections to converge on the borders of the
   // surface
@@ -149,17 +149,17 @@ GPoint OCCFace::closestPoint(const SPoint3 & qp) const
   GeomAPI_ProjectPointOnSurf proj(pnt, occface, umin, umax, vmin, vmax);
 
    if(!proj.NbPoints()){
-     Msg(GERROR,"OCC Project Point on Surface FAIL");
+     Msg::Error("OCC Project Point on Surface FAIL");
      return GPoint(0, 0);
    }
    
   double pp[2];
   proj.LowerDistanceParameters(pp[0], pp[1]);
 
-  Msg(INFO,"projection lower distance parameters %g %g",pp[0],pp[1]);
+  Msg::Info("projection lower distance parameters %g %g",pp[0],pp[1]);
 
   if((pp[0] < umin || umax < pp[0]) || (pp[1]<vmin || vmax<pp[1])){
-    Msg(GERROR,"Point projection is out of face bounds");
+    Msg::Error("Point projection is out of face bounds");
     return GPoint(0, 0);
   }
 
@@ -172,7 +172,7 @@ SPoint2 OCCFace::parFromPoint(const SPoint3 &qp) const
   gp_Pnt pnt(qp.x(), qp.y(), qp.z());
   GeomAPI_ProjectPointOnSurf proj(pnt, occface, umin, umax, vmin, vmax);
   if(!proj.NbPoints()){
-    Msg(GERROR,"OCC Project Point on Surface FAIL");
+    Msg::Error("OCC Project Point on Surface FAIL");
     return GFace::parFromPoint(qp);
   }   
   double U, V;
@@ -254,7 +254,7 @@ int OCCFace::containsPoint(const SPoint3 &pt) const
     return false;
   }
   else
-    Msg(GERROR,"Not Done Yet ...");
+    Msg::Error("Not Done Yet ...");
   return false;
 }
 
@@ -305,7 +305,7 @@ bool OCCFace::buildSTLTriangulation()
   aMesher.Add(s);
   Handle(Poly_Triangulation) triangulation = BRep_Tool::Triangulation(s, loc);
   if (triangulation.IsNull()){
-    Msg(WARNING,"OCC STL triangulation failed");
+    Msg::Warning("OCC STL triangulation failed");
     return false;
   }
   
diff --git a/Geo/OCCRegion.cpp b/Geo/OCCRegion.cpp
index a5c164ef9599db5d9c720855d6d55c20a7617977..35db2c91b01a8a73e444d841cfc126d3f631e79b 100644
--- a/Geo/OCCRegion.cpp
+++ b/Geo/OCCRegion.cpp
@@ -1,4 +1,4 @@
-// $Id: OCCRegion.cpp,v 1.11 2008-03-20 11:44:06 geuzaine Exp $
+// $Id: OCCRegion.cpp,v 1.12 2008-05-04 08:31:13 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -34,7 +34,7 @@ OCCRegion::OCCRegion(GModel *m, TopoDS_Solid _s, int num, TopTools_IndexedMapOfS
   TopExp_Explorer exp0, exp01, exp1, exp2, exp3;
   for(exp2.Init(s, TopAbs_SHELL); exp2.More(); exp2.Next()){
     TopoDS_Shape shell = exp2.Current();
-    Msg(INFO,"OCC Region %d - New Shell",num);
+    Msg::Info("OCC Region %d - New Shell",num);
     for(exp3.Init(shell, TopAbs_FACE); exp3.More(); exp3.Next()){         
       TopoDS_Face face = TopoDS::Face(exp3.Current());
       int index = fmap.FindIndex(face);
@@ -44,7 +44,7 @@ OCCRegion::OCCRegion(GModel *m, TopoDS_Solid _s, int num, TopTools_IndexedMapOfS
       f->addRegion(this);
     }      
   }
-  Msg(INFO, "OCC Region %d with %d edges", num, l_faces.size());
+  Msg::Info("OCC Region %d with %d edges", num, l_faces.size());
 }
 
 GEntity::GeomType OCCRegion::geomType() const
diff --git a/Geo/findLinks.cpp b/Geo/findLinks.cpp
index 7f6841ccc7a04c2f8771877366bca4fba8217867..94f5fb445587cb9200f0c17a9d60732cf32d05d4 100644
--- a/Geo/findLinks.cpp
+++ b/Geo/findLinks.cpp
@@ -1,4 +1,4 @@
-// $Id: findLinks.cpp,v 1.7 2008-03-20 11:44:06 geuzaine Exp $
+// $Id: findLinks.cpp,v 1.8 2008-05-04 08:31:14 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -50,7 +50,7 @@ static void recurFindLinkedEdges(int ed, List_T *edges, Tree_T *points,
 {
   GEdge *ge = GModel::current()->getEdgeByTag(ed);
   if(!ge){
-    Msg(GERROR, "Unknown curve %d", ed);
+    Msg::Error("Unknown curve %d", ed);
     return;
   }
 
@@ -87,7 +87,7 @@ static int createEdgeLinks(Tree_T *links)
   for(GModel::eiter it = m->firstEdge(); it != m->lastEdge(); it++) {
     GEdge *ge = *it;;
     if(!ge->getBeginVertex() || !ge->getEndVertex()){
-      Msg(GERROR, "Cannot link curves with no begin or end points");
+      Msg::Error("Cannot link curves with no begin or end points");
       return 0;
     }
     if(ge->tag() > 0) {
@@ -125,7 +125,7 @@ static void orientAndSortEdges(List_T *edges, Tree_T *links)
 
   GEdge *ge0 = GModel::current()->getEdgeByTag(abs(num));
   if(!ge0){
-    Msg(GERROR, "Unknown curve %d", abs(num));
+    Msg::Error("Unknown curve %d", abs(num));
     return;
   }
 
@@ -143,7 +143,7 @@ static void orientAndSortEdges(List_T *edges, Tree_T *links)
       if(ge0->tag() != na.a && List_Search(temp, &na.a, fcmp_absint)){
         GEdge *ge1 = GModel::current()->getEdgeByTag(abs(na.a));
         if(!ge1){
-          Msg(GERROR, "Unknown curve %d", abs(na.a));
+          Msg::Error("Unknown curve %d", abs(na.a));
           return;
         }
         if(lk.n == ge1->getBeginVertex()->tag()){
@@ -178,7 +178,7 @@ int allEdgesLinked(int ed, List_T *edges)
     List_Read(edges, i, &num);
     GEdge *ge = GModel::current()->getEdgeByTag(abs(num));
     if(!ge){
-      Msg(GERROR, "Unknown curve %d", abs(num));
+      Msg::Error("Unknown curve %d", abs(num));
       return 0;
     }
     int ip[2];
@@ -222,7 +222,7 @@ static void recurFindLinkedFaces(int fac, List_T *faces, Tree_T *edges,
 {
   GFace *gf = GModel::current()->getFaceByTag(abs(fac));
   if(!gf){
-    Msg(GERROR, "Unknown surface %d", abs(fac));
+    Msg::Error("Unknown surface %d", abs(fac));
     return;
   }
 
@@ -290,7 +290,7 @@ int allFacesLinked(int fac, List_T *faces)
     List_Read(faces, i, &num);
     GFace *gf = GModel::current()->getFaceByTag(abs(num));
     if(!gf){
-      Msg(GERROR, "Unknown surface %d", abs(num));
+      Msg::Error("Unknown surface %d", abs(num));
       return 0;
     }
     std::list<GEdge*> l = gf->edges();
diff --git a/Geo/gmshEdge.cpp b/Geo/gmshEdge.cpp
index 49f6f6ca041288e263cd3af6adf2ecd8b2871ea5..a91b9605fece7b6333da64e4234ab5dd6bda8110 100644
--- a/Geo/gmshEdge.cpp
+++ b/Geo/gmshEdge.cpp
@@ -1,4 +1,4 @@
-// $Id: gmshEdge.cpp,v 1.48 2008-03-20 11:44:07 geuzaine Exp $
+// $Id: gmshEdge.cpp,v 1.49 2008-05-04 08:31:14 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -255,7 +255,7 @@ SPoint2 gmshEdge::reparamOnFace(GFace *face, double epar,int dir) const
       U = 0;
     }
     else{
-      Msg(INFO, "Reparameterizing edge %d on face %d", c->Num, s->Num);
+      Msg::Info("Reparameterizing edge %d on face %d", c->Num, s->Num);
       return GEdge::reparamOnFace(face, epar, dir);
     }
     return SPoint2(U, V);
@@ -291,7 +291,7 @@ SPoint2 gmshEdge::reparamOnFace(GFace *face, double epar,int dir) const
       V = 1;
     }
     else{
-      Msg(INFO, "Reparameterizing edge %d on face %d", c->Num, s->Num);
+      Msg::Info("Reparameterizing edge %d on face %d", c->Num, s->Num);
       return GEdge::reparamOnFace(face, epar, dir);
     }
     return SPoint2(U, V);
diff --git a/Geo/gmshFace.cpp b/Geo/gmshFace.cpp
index 684b750d87b02cf2c32c59f5a4436798eb68a130..7f669b6750780dae2fc50f751fa237923092deb6 100644
--- a/Geo/gmshFace.cpp
+++ b/Geo/gmshFace.cpp
@@ -1,4 +1,4 @@
-// $Id: gmshFace.cpp,v 1.55 2008-03-20 11:44:07 geuzaine Exp $
+// $Id: gmshFace.cpp,v 1.56 2008-05-04 08:31:14 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -46,7 +46,7 @@ gmshFace::gmshFace(GModel *m, Surface *face)
       }
     }
     else
-      Msg(GERROR, "Unknown curve %d", c->Num);
+      Msg::Error("Unknown curve %d", c->Num);
   }
 
   // always compute and store the mean plane for plane surfaces
@@ -70,7 +70,7 @@ gmshFace::gmshFace(GModel *m, Surface *face)
       if(e)
         embedded_edges.push_back(e);
       else
-        Msg(GERROR, "Unknown curve %d", c->Num);
+        Msg::Error("Unknown curve %d", c->Num);
     }
   }
   if(s->EmbeddedPoints){
@@ -81,7 +81,7 @@ gmshFace::gmshFace(GModel *m, Surface *face)
       if(gv)
         embedded_vertices.push_back(gv);
       else
-        Msg(GERROR, "Unknown point %d", v->Num);
+        Msg::Error("Unknown point %d", v->Num);
     }
   }
 }
@@ -118,7 +118,7 @@ void gmshFace::resetMeshAttributes()
       if(gv)
         meshAttributes.corners.push_back(gv);
       else
-        Msg(GERROR, "Unknown vertex %d in transfinite attributes", corn->Num);
+        Msg::Error("Unknown vertex %d in transfinite attributes", corn->Num);
     }
   }
 }
diff --git a/Geo/gmshRegion.cpp b/Geo/gmshRegion.cpp
index 44dda0ad020324be86b421def1ae5203e152882c..8f830b9c24f87b0aab2ced6a971b17410b038abd 100644
--- a/Geo/gmshRegion.cpp
+++ b/Geo/gmshRegion.cpp
@@ -1,4 +1,4 @@
-// $Id: gmshRegion.cpp,v 1.21 2008-03-20 11:44:07 geuzaine Exp $
+// $Id: gmshRegion.cpp,v 1.22 2008-05-04 08:31:14 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -38,7 +38,7 @@ gmshRegion::gmshRegion(GModel *m, ::Volume *volume)
       l_dirs.push_back(ori);
     }
     else
-      Msg(GERROR, "Unknown surface %d", s->Num);
+      Msg::Error("Unknown surface %d", s->Num);
   }
   for(int i = 0; i < List_Nbr(v->SurfacesByTag); i++){
     int is;
@@ -49,7 +49,7 @@ gmshRegion::gmshRegion(GModel *m, ::Volume *volume)
       l_dirs.push_back(sign(is));
     }
     else
-      Msg(GERROR, "Unknown surface %d", is);
+      Msg::Error("Unknown surface %d", is);
   }
 
   resetMeshAttributes();
@@ -68,7 +68,7 @@ void gmshRegion::resetMeshAttributes()
       if(gv)
         meshAttributes.corners.push_back(gv);
       else
-        Msg(GERROR, "Unknown vertex %d in transfinite attributes", corn->Num);
+        Msg::Error("Unknown vertex %d in transfinite attributes", corn->Num);
     }
   }
 }
diff --git a/Geo/gmshSurface.cpp b/Geo/gmshSurface.cpp
index a05636db3e94c8f09029187f0fa847af5016c9da..e236ae84696d150025d3dfe822cd51bf281a1407 100644
--- a/Geo/gmshSurface.cpp
+++ b/Geo/gmshSurface.cpp
@@ -1,4 +1,4 @@
-// $Id: gmshSurface.cpp,v 1.14 2008-03-21 18:27:38 geuzaine Exp $
+// $Id: gmshSurface.cpp,v 1.15 2008-05-04 08:31:14 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -32,7 +32,7 @@ gmshSurface *gmshSphere::NewSphere(int iSphere, double x, double y, double z, do
   gmshSphere *sph = new gmshSphere(x, y, z, r);
   
   if(allGmshSurfaces.find(iSphere) != allGmshSurfaces.end()){
-    Msg(GERROR,"gmshSurface %d already exists",iSphere);
+    Msg::Error("gmshSurface %d already exists",iSphere);
   }
   
   allGmshSurfaces[iSphere] = sph;
@@ -43,7 +43,7 @@ gmshSurface *gmshSurface::getSurface(int iSurface)
 {
   std::map<int, gmshSurface*>::iterator it = allGmshSurfaces.find(iSurface);
   if(it == allGmshSurfaces.end()){
-    Msg(GERROR,"gmshSurface %d does not exist",iSurface);
+    Msg::Error("gmshSurface %d does not exist",iSurface);
     return 0;
   }
   return it->second;
@@ -65,7 +65,7 @@ gmshSurface *gmshPolarSphere::NewPolarSphere(int iSphere, double x, double y, do
   gmshPolarSphere *sph = new gmshPolarSphere(x, y, z, r);
   
   if(allGmshSurfaces.find(iSphere) != allGmshSurfaces.end()){
-    Msg(GERROR, "gmshSurface %d already exists", iSphere);
+    Msg::Error("gmshSurface %d already exists", iSphere);
   }
 
   allGmshSurfaces[iSphere] = sph;
@@ -90,7 +90,7 @@ gmshSurface *gmshParametricSurface::NewParametricSurface(int iSurf, char *valX,
   gmshParametricSurface *sph = new gmshParametricSurface(valX, valY, valZ);
   
   if(allGmshSurfaces.find(iSurf) != allGmshSurfaces.end()){
-    Msg(GERROR,"gmshSurface %d already exists",iSurf);
+    Msg::Error("gmshSurface %d already exists",iSurf);
   }
   allGmshSurfaces[iSurf] = sph;
   return sph;
@@ -99,7 +99,7 @@ gmshSurface *gmshParametricSurface::NewParametricSurface(int iSurf, char *valX,
 gmshParametricSurface::gmshParametricSurface(char *valX, char *valY, char *valZ)
 {
 #if !defined(HAVE_MATH_EVAL)
-  Msg(GERROR, "MathEval is not compiled in this version of Gmsh");
+  Msg::Error("MathEval is not compiled in this version of Gmsh");
 #else
   evalX = evaluator_create(valX);
   evalY = evaluator_create(valY);
@@ -110,7 +110,7 @@ gmshParametricSurface::gmshParametricSurface(char *valX, char *valY, char *valZ)
 gmshParametricSurface::~gmshParametricSurface()
 {
 #if !defined(HAVE_MATH_EVAL)
-  Msg(GERROR, "MathEval is not compiled in this version of Gmsh");
+  Msg::Error("MathEval is not compiled in this version of Gmsh");
 #else
   evaluator_destroy(evalX);
   evaluator_destroy(evalY);
@@ -121,7 +121,7 @@ gmshParametricSurface::~gmshParametricSurface()
 SPoint3 gmshParametricSurface::point(double par1, double par2) const
 {
 #if !defined(HAVE_MATH_EVAL)
-  Msg(GERROR, "MathEval is not compiled in this version of Gmsh");
+  Msg::Error("MathEval is not compiled in this version of Gmsh");
   return SPoint3(0.,0.,0.);
 #else
   char *names[2] = {"u", "v"};
diff --git a/Geo/gmshVertex.cpp b/Geo/gmshVertex.cpp
index be50cc0db04cf07752f032833cc86c8e86c4870c..95252ffc23680b46c47abed1078cba6446d80763 100644
--- a/Geo/gmshVertex.cpp
+++ b/Geo/gmshVertex.cpp
@@ -1,4 +1,4 @@
-// $Id: gmshVertex.cpp,v 1.10 2008-03-20 11:44:07 geuzaine Exp $
+// $Id: gmshVertex.cpp,v 1.11 2008-05-04 08:31:14 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -75,7 +75,7 @@ SPoint2 gmshVertex::reparamOnFace(GFace *face, int dir) const
       V = 1;
     }
     else{
-      Msg(INFO, "Reparameterizing point %d on face %d", v->Num, s->Num);
+      Msg::Info("Reparameterizing point %d on face %d", v->Num, s->Num);
       return GVertex::reparamOnFace(face, dir);
     }
     return SPoint2(U, V);
diff --git a/Graphics/Draw.cpp b/Graphics/Draw.cpp
index 88ac0da096b49be8b13486a505bca125f899a015..f8d47f52da383bb6f7ce9e37ea8830ca84622028 100644
--- a/Graphics/Draw.cpp
+++ b/Graphics/Draw.cpp
@@ -1,4 +1,4 @@
-// $Id: Draw.cpp,v 1.118 2008-03-20 11:44:07 geuzaine Exp $
+// $Id: Draw.cpp,v 1.119 2008-05-04 08:31:14 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -27,6 +27,7 @@
 #include "Numeric.h"
 #include "GModel.h"
 #include "PView.h"
+#include "PViewOptions.h"
 
 extern Context_T CTX;
 
@@ -366,9 +367,9 @@ void Unproject(double x, double y, double p[3], double d[3])
   // the matrices since unproject can be called in or after Draw2D
   
   if(!gluUnProject(x, y, 0.0, CTX.model, CTX.proj, viewport, &x0, &y0, &z0))
-    Msg(WARNING, "unproject1 failed");
+    Msg::Warning("unproject1 failed");
   if(!gluUnProject(x, y, 1.0, CTX.model, CTX.proj, viewport, &x1, &y1, &z1))
-    Msg(WARNING, "unproject2 failed");
+    Msg::Warning("unproject2 failed");
   
   p[0] = x0;
   p[1] = y0;
diff --git a/Graphics/Graph2D.cpp b/Graphics/Graph2D.cpp
index 17a9447de38e755d9c78985be6d069d7eb4ccfb6..23983faa8654adcf8cedb62e5d624d909395391a 100644
--- a/Graphics/Graph2D.cpp
+++ b/Graphics/Graph2D.cpp
@@ -1,4 +1,4 @@
-// $Id: Graph2D.cpp,v 1.78 2008-03-20 11:44:07 geuzaine Exp $
+// $Id: Graph2D.cpp,v 1.79 2008-05-04 08:31:14 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -22,6 +22,8 @@
 #include "GmshUI.h"
 #include "Draw.h"
 #include "PView.h"
+#include "PViewOptions.h"
+#include "PViewData.h"
 #include "gl2ps.h"
 #include "Context.h"
 #include "Numeric.h"
diff --git a/Graphics/Makefile b/Graphics/Makefile
index 38450e34406bb03a8d1738a6b5119a996e6e3ec6..9aae9d63f26bbd7bbab12e2b7785c2f4186be3b4 100644
--- a/Graphics/Makefile
+++ b/Graphics/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.150 2008-04-23 23:17:46 geuzaine Exp $
+# $Id: Makefile,v 1.151 2008-05-04 08:31:14 geuzaine Exp $
 #
 # Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 #
@@ -83,8 +83,7 @@ Draw.o: Draw.cpp ../Common/GmshUI.h ../Common/GmshDefines.h \
   ../Geo/GFace.h ../Geo/GEntity.h ../Geo/GPoint.h ../Geo/GEdgeLoop.h \
   ../Geo/GEdge.h ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h \
   ../Geo/GRegion.h ../Geo/GEntity.h ../Geo/SBoundingBox3d.h \
-  ../Post/PView.h ../Post/PViewData.h ../DataStr/List.h \
-  ../Post/PViewOptions.h ../Post/ColorTable.h
+  ../Post/PView.h ../Post/PViewOptions.h ../Post/ColorTable.h
 Mesh.o: Mesh.cpp ../Common/Message.h ../Common/GmshUI.h ../Geo/GModel.h \
   ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
   ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Geo/GPoint.h \
@@ -98,8 +97,7 @@ Mesh.o: Mesh.cpp ../Common/Message.h ../Common/GmshUI.h ../Geo/GModel.h \
   ../Geo/MFace.h ../Geo/MVertex.h ../Geo/SVector3.h Draw.h \
   ../Common/Context.h ../Common/OS.h gl2ps.h ../Common/VertexArray.h \
   ../Common/Context.h ../Common/SmoothData.h ../Post/PView.h \
-  ../Post/PViewData.h ../DataStr/List.h ../Post/PViewOptions.h \
-  ../Post/ColorTable.h
+  ../Post/PViewData.h
 Geom.o: Geom.cpp ../Common/GmshUI.h Draw.h ../Geo/SBoundingBox3d.h \
   ../Geo/SPoint3.h ../Common/Context.h gl2ps.h ../Common/VertexArray.h \
   ../Geo/SVector3.h ../Geo/SPoint3.h ../Common/Context.h ../Geo/GModel.h \
@@ -112,9 +110,9 @@ Geom.o: Geom.cpp ../Common/GmshUI.h Draw.h ../Geo/SBoundingBox3d.h \
 Post.o: Post.cpp ../Common/Message.h ../Common/GmshUI.h \
   ../Numeric/Numeric.h ../Numeric/NumericEmbedded.h Draw.h \
   ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h Iso.h ../Post/PView.h \
-  ../Post/PViewData.h ../DataStr/List.h ../Post/PViewOptions.h \
-  ../Post/ColorTable.h ../Common/VertexArray.h ../Geo/SVector3.h \
-  ../Geo/SPoint3.h ../Common/Context.h ../Common/SmoothData.h gl2ps.h
+  ../Post/PViewOptions.h ../Post/ColorTable.h ../Post/PViewData.h \
+  ../Common/VertexArray.h ../Geo/SVector3.h ../Geo/SPoint3.h \
+  ../Common/Context.h ../Common/SmoothData.h gl2ps.h
 SelectBuffer.o: SelectBuffer.cpp ../Common/Message.h ../Common/GmshUI.h \
   ../Common/GmshDefines.h ../Geo/GModel.h ../Geo/GVertex.h \
   ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
@@ -133,15 +131,15 @@ Entity.o: Entity.cpp ../Common/GmshUI.h ../Numeric/Numeric.h \
   ../Numeric/NumericEmbedded.h Draw.h ../Geo/SBoundingBox3d.h \
   ../Geo/SPoint3.h ../Common/Context.h gl2ps.h
 ReadImg.o: ReadImg.cpp ReadImg.h ../Common/Message.h ../Common/GmshUI.h \
-  ../Post/PView.h ../Post/PViewData.h ../DataStr/List.h \
-  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Post/PViewOptions.h \
-  ../Post/ColorTable.h ../Post/PViewDataList.h ../Post/PViewData.h
+  ../Post/PView.h ../Geo/SPoint3.h ../Post/PViewDataList.h \
+  ../Post/PViewData.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \
+  ../DataStr/List.h
 Scale.o: Scale.cpp ../Common/GmshUI.h Draw.h ../Geo/SBoundingBox3d.h \
-  ../Geo/SPoint3.h ../Post/PView.h ../Post/PViewData.h ../DataStr/List.h \
-  ../Post/PViewOptions.h ../Post/ColorTable.h ../Common/Context.h gl2ps.h
+  ../Geo/SPoint3.h ../Post/PView.h ../Post/PViewOptions.h \
+  ../Post/ColorTable.h ../Post/PViewData.h ../Common/Context.h gl2ps.h
 Graph2D.o: Graph2D.cpp ../Common/GmshUI.h Draw.h ../Geo/SBoundingBox3d.h \
-  ../Geo/SPoint3.h ../Post/PView.h ../Post/PViewData.h ../DataStr/List.h \
-  ../Post/PViewOptions.h ../Post/ColorTable.h gl2ps.h ../Common/Context.h \
+  ../Geo/SPoint3.h ../Post/PView.h ../Post/PViewOptions.h \
+  ../Post/ColorTable.h ../Post/PViewData.h gl2ps.h ../Common/Context.h \
   ../Numeric/Numeric.h ../Numeric/NumericEmbedded.h
 gl2ps.o: gl2ps.cpp gl2ps.h
 gl2gif.o: gl2gif.cpp gl2gif.h PixelBuffer.h ../Common/GmshUI.h \
diff --git a/Graphics/Mesh.cpp b/Graphics/Mesh.cpp
index 33ae381c18dee31af95c9754752bb0db1f216cb1..2c8a565a01e93d1d34954e83206acf55e4ec8454 100644
--- a/Graphics/Mesh.cpp
+++ b/Graphics/Mesh.cpp
@@ -1,4 +1,4 @@
-// $Id: Mesh.cpp,v 1.220 2008-04-17 05:58:09 geuzaine Exp $
+// $Id: Mesh.cpp,v 1.221 2008-05-04 08:31:14 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -29,6 +29,8 @@
 #include "gl2ps.h"
 #include "VertexArray.h"
 #include "SmoothData.h"
+#include "PView.h"
+#include "PViewData.h"
 
 extern Context_T CTX;
 
@@ -819,8 +821,6 @@ class drawMeshGRegion {
 
 // Main drawing routine
 
-#include "PView.h"
-
 void Draw_Mesh()
 {
   GModel *m = GModel::current();
@@ -856,7 +856,7 @@ void Draw_Mesh()
     busy = true;
     int status = m->getMeshStatus();
     if(CTX.mesh.changed) {
-      Msg(DEBUG, "Mesh has changed: reinitializing drawing data", CTX.mesh.changed);
+      Msg::Debug("Mesh has changed: reinitializing drawing data", CTX.mesh.changed);
       if(status >= 1 && CTX.mesh.changed & ENT_LINE)
         std::for_each(m->firstEdge(), m->lastEdge(), initMeshGEdge());
       if(status >= 2 && CTX.mesh.changed & ENT_SURFACE){
diff --git a/Graphics/PixelBuffer.h b/Graphics/PixelBuffer.h
index 54abfa412386e85fbec5fbff73caafbea619fcdf..f3f4a667afab0d5213cec752e7e9acc277fa9677 100644
--- a/Graphics/PixelBuffer.h
+++ b/Graphics/PixelBuffer.h
@@ -45,7 +45,7 @@ class PixelBuffer{
       _numComp = 4;
     }
     else{
-      Msg(GERROR, "Unknown pixel format: assuming RGB");
+      Msg::Error("Unknown pixel format: assuming RGB");
       _format = GL_RGB;
       _numComp = 3;
     }
@@ -57,7 +57,7 @@ class PixelBuffer{
       _dataSize = sizeof(float);
     }
     else{
-      Msg(GERROR, "Unknown pixel storage type: assuming unsigned byte");
+      Msg::Error("Unknown pixel storage type: assuming unsigned byte");
       _type = GL_UNSIGNED_BYTE;
       _dataSize = sizeof(unsigned char);
     }
@@ -89,16 +89,16 @@ class PixelBuffer{
     else{
 #if defined(HAVE_OSMESA)
       if(_format != GL_RGB && _type != GL_UNSIGNED_BYTE){
-        Msg(GERROR, "Offscreen rendering only implemented for GL_RGB/GL_UNSIGNED_BYTE");
+	Msg::Error("Offscreen rendering only implemented for GL_RGB/GL_UNSIGNED_BYTE");
         return;
       }
       OSMesaContext ctx = OSMesaCreateContextExt(OSMESA_RGB, 16, 0, 0, NULL);
       if(!ctx){
-        Msg(GERROR, "OSMesaCreateContext failed");
+	Msg::Error("OSMesaCreateContext failed");
         return;
       }
       if(!OSMesaMakeCurrent(ctx, _pixels, GL_UNSIGNED_BYTE, _width, _height)){
-        Msg(GERROR, "OSMesaMakeCurrent failed");
+	Msg::Error("OSMesaMakeCurrent failed");
       }
       ClearOpengl();
       Draw3d();
@@ -106,7 +106,7 @@ class PixelBuffer{
       glFinish();
       OSMesaDestroyContext(ctx);
 #else
-      Msg(WARNING, "Offscreen rendering not available in this version");
+      Msg::Warning("Offscreen rendering not available in this version");
 #endif
     }
   }
diff --git a/Graphics/Post.cpp b/Graphics/Post.cpp
index 9e49d44d0e600a7dc486b5597c1e16de70352b2b..4af48d5049a81fd40fd35984e0bb36cbb9060699 100644
--- a/Graphics/Post.cpp
+++ b/Graphics/Post.cpp
@@ -1,4 +1,4 @@
-// $Id: Post.cpp,v 1.164 2008-04-22 07:37:09 geuzaine Exp $
+// $Id: Post.cpp,v 1.165 2008-05-04 08:31:14 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -26,6 +26,8 @@
 #include "Draw.h"
 #include "Iso.h"
 #include "PView.h"
+#include "PViewOptions.h"
+#include "PViewData.h"
 #include "VertexArray.h"
 #include "SmoothData.h"
 #include "Context.h"
@@ -1147,7 +1149,7 @@ void drawGlyphs(PView *p)
   if(!opt->Normals && !opt->Tangents && opt->IntervalsType != PViewOptions::Numeric)
     return;
 
-  Msg(DEBUG, "drawing extra glyphs (this is slow...)");
+  Msg::Debug("drawing extra glyphs (this is slow...)");
 
   double xyz[NMAX][3], val[NMAX][9];
   for(int ent = 0; ent < data->getNumEntities(opt->TimeStep); ent++){
@@ -1266,7 +1268,7 @@ class initPView {
     p->va_triangles->finalize();
     p->va_vectors->finalize();
 
-    Msg(INFO, "Rendering %d vertices", p->va_points->getNumVertices() + 
+    Msg::Info("Rendering %d vertices", p->va_points->getNumVertices() + 
         p->va_lines->getNumVertices() + p->va_triangles->getNumVertices() + 
         p->va_vectors->getNumVertices());
 
@@ -1328,7 +1330,7 @@ class drawPView {
         // glBlendEquation(GL_FUNC_ADD);
         glEnable(GL_BLEND);
         if(eyeChanged(p)){
-          Msg(DEBUG, "Sorting View[%d] for transparency", p->getIndex());
+          Msg::Debug("Sorting View[%d] for transparency", p->getIndex());
           p->va_triangles->sort(p->getEye().x(), p->getEye().y(), p->getEye().z());
         }
       }
diff --git a/Graphics/ReadImg.cpp b/Graphics/ReadImg.cpp
index f6fe800c714685292e52cffb103ef4b7df109484..f028de6c00f47f54f68344653ded05a089ab01f9 100644
--- a/Graphics/ReadImg.cpp
+++ b/Graphics/ReadImg.cpp
@@ -1,4 +1,4 @@
-// $Id: ReadImg.cpp,v 1.24 2008-03-20 11:44:07 geuzaine Exp $
+// $Id: ReadImg.cpp,v 1.25 2008-05-04 08:31:14 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -51,7 +51,7 @@ static PViewDataList *Img2Data(Fl_RGB_Image &img_init, int quads=1,
   int dim = img->d();
 
   if(dim != 1) {
-    Msg(GERROR, "Unable to obtain one-channel image");
+    Msg::Error("Unable to obtain one-channel image");
     return 0;
   }
 
diff --git a/Graphics/Scale.cpp b/Graphics/Scale.cpp
index c876564511de21263ce525e41fe5d75ff6474b63..7db163372b6f810ba702c31dd56f43201287621c 100644
--- a/Graphics/Scale.cpp
+++ b/Graphics/Scale.cpp
@@ -1,4 +1,4 @@
-// $Id: Scale.cpp,v 1.71 2008-04-22 07:37:09 geuzaine Exp $
+// $Id: Scale.cpp,v 1.72 2008-05-04 08:31:14 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -22,6 +22,8 @@
 #include "GmshUI.h"
 #include "Draw.h"
 #include "PView.h"
+#include "PViewOptions.h"
+#include "PViewData.h"
 #include "Context.h"
 #include "gl2ps.h"
 
diff --git a/Graphics/SelectBuffer.cpp b/Graphics/SelectBuffer.cpp
index 2bb7a873261309fc389a70f1265a7f380e5f272f..9233ba4efdee4e440a2bc961ec8cb80c3b6a8e31 100644
--- a/Graphics/SelectBuffer.cpp
+++ b/Graphics/SelectBuffer.cpp
@@ -1,4 +1,4 @@
-// $Id: SelectBuffer.cpp,v 1.21 2008-03-20 11:44:08 geuzaine Exp $
+// $Id: SelectBuffer.cpp,v 1.22 2008-05-04 08:31:14 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -108,7 +108,7 @@ bool ProcessSelectionBuffer(int entityType,
   }
   else if(numhits < 0){ // overflow
     delete [] selectionBuffer;
-    Msg(WARNING, "Too many entities selected");
+    Msg::Warning("Too many entities selected");
     return false;
   }
 
@@ -173,7 +173,7 @@ bool ProcessSelectionBuffer(int entityType,
         {
           GVertex *v = m->getVertexByTag(hits[i].ient);
           if(!v){
-            Msg(GERROR, "Problem in point selection processing");
+            Msg::Error("Problem in point selection processing");
             return false;
           }
           vertices.push_back(v);
@@ -184,7 +184,7 @@ bool ProcessSelectionBuffer(int entityType,
         {
           GEdge *e = m->getEdgeByTag(hits[i].ient);
           if(!e){
-            Msg(GERROR, "Problem in line selection processing");
+            Msg::Error("Problem in line selection processing");
             return false;
           }
           if(hits[i].type2){
@@ -199,7 +199,7 @@ bool ProcessSelectionBuffer(int entityType,
         {
           GFace *f = m->getFaceByTag(hits[i].ient);
           if(!f){
-            Msg(GERROR, "Problem in surface selection processing");
+            Msg::Error("Problem in surface selection processing");
             return false;
           }
           if(hits[i].type2){
@@ -214,7 +214,7 @@ bool ProcessSelectionBuffer(int entityType,
         {
           GRegion *r = m->getRegionByTag(hits[i].ient);
           if(!r){
-            Msg(GERROR, "Problem in volume selection processing");
+            Msg::Error("Problem in volume selection processing");
             return false;
           }
           if(hits[i].type2){
diff --git a/Graphics/gl2gif.cpp b/Graphics/gl2gif.cpp
index cf0c5d2c646133ab6be31d9158d3c9704f082638..84409e415c9f3e3002db02cdc9e1691dc9c2e7bb 100644
--- a/Graphics/gl2gif.cpp
+++ b/Graphics/gl2gif.cpp
@@ -1,4 +1,4 @@
-// $Id: gl2gif.cpp,v 1.24 2008-02-17 08:48:00 geuzaine Exp $
+// $Id: gl2gif.cpp,v 1.25 2008-05-04 08:31:15 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -191,7 +191,7 @@ colorhash_table ppm_colorhisttocolorhash(const colorhist_vector chv,
     hash = ppm_hashpixel(color);
     for(chl = cht[hash]; chl != (colorhist_list) 0; chl = chl->next)
       if(PPM_EQUAL(chl->ch.color, color))
-        Msg(GERROR, "GIF: same color found twice - %d %d %d", PPM_GETR(color),
+        Msg::Error("GIF: same color found twice - %d %d %d", PPM_GETR(color),
             PPM_GETG(color), PPM_GETB(color));
     chl = (colorhist_list) Malloc(sizeof(struct colorhist_list_item));
     chl->ch.color = color;
@@ -258,7 +258,7 @@ static int colorstobpp(int colors)
   else if(colors <= 256)
     bpp = 8;
   else {
-    Msg(GERROR, "GIF: can't happen: too many colors");
+    Msg::Error("GIF: can't happen: too many colors");
     bpp = 8;
   }
 
@@ -365,7 +365,7 @@ static colorhist_vector mediancut(colorhist_vector chv, int colors,
   colormap =
     (colorhist_vector) malloc(sizeof(struct colorhist_item) * newcolors);
   if(bv == (box_vector) 0 || colormap == (colorhist_vector) 0)
-    Msg(GERROR, "GIF: out of memory");
+    Msg::Error("GIF: out of memory");
   for(i = 0; i < newcolors; ++i)
     PPM_ASSIGN(colormap[i].color, 0, 0, 0);
 
@@ -828,7 +828,7 @@ static void output(code_int code)
     fflush(g_outfile);
 
     if(ferror(g_outfile))
-      Msg(GERROR, "GIF: Error writing output file");
+      Msg::Error("GIF: Error writing output file");
   }
 }
 
@@ -1184,7 +1184,7 @@ void create_gif(FILE * outfile, PixelBuffer *buffer,
   int numcomp = buffer->GetNumComp();
 
   if(numcomp != 3){
-    Msg(GERROR, "GIF only implemented for GL_RGB");
+    Msg::Error("GIF only implemented for GL_RGB");
     return;
   }
 
@@ -1210,20 +1210,20 @@ void create_gif(FILE * outfile, PixelBuffer *buffer,
 
   if(chv == (colorhist_vector) 0) {
 
-    Msg(DEBUG, "GIF: too many colors in image");
+    Msg::Debug("GIF: too many colors in image");
 
     rows = height;
     cols = width;
 
     while(1) {
-      Msg(DEBUG, "GIF: making histogram...");
+      Msg::Debug("GIF: making histogram...");
       chv = ppm_computecolorhist(static_pixels, width, height, MAXCOL2,
                                  &static_nbcolors);
       if(chv != (colorhist_vector) 0)
         break;
-      Msg(DEBUG, "GIF: still too many colors!");
+      Msg::Debug("GIF: still too many colors!");
       newmaxval = maxval / 2;
-      Msg(DEBUG,
+      Msg::Debug(
           "GIF: scaling colors from maxval=%d to maxval=%d to improve clustering...",
           maxval, newmaxval);
       for(row = 0; row < rows; ++row)
@@ -1231,8 +1231,8 @@ void create_gif(FILE * outfile, PixelBuffer *buffer,
           PPM_DEPTH(*pP, *pP, maxval, newmaxval);
       maxval = newmaxval;
     }
-    Msg(DEBUG, "GIF: %d colors found", static_nbcolors);
-    Msg(DEBUG, "GIF: choosing %d colors...", newcolors);
+    Msg::Debug("GIF: %d colors found", static_nbcolors);
+    Msg::Debug("GIF: choosing %d colors...", newcolors);
     colormap =
       mediancut(chv, static_nbcolors, rows * cols, maxval, newcolors);
 
@@ -1241,11 +1241,11 @@ void create_gif(FILE * outfile, PixelBuffer *buffer,
     ppm_freecolorhist(chv);
 
     /* map the colors in the image to their closest match in the new colormap */
-    Msg(DEBUG, "GIF: mapping image to new colors...");
+    Msg::Debug("GIF: mapping image to new colors...");
     usehash = 1;
 
     if(dither) {
-      Msg(DEBUG, "GIF: Floyd-Steinberg dithering is selected...");
+      Msg::Debug("GIF: Floyd-Steinberg dithering is selected...");
       /* Initialize Floyd-Steinberg error vectors. */
       thisrerr = (long *)Malloc((cols + 2) * sizeof(long));
       nextrerr = (long *)Malloc((cols + 2) * sizeof(long));
@@ -1324,8 +1324,7 @@ void create_gif(FILE * outfile, PixelBuffer *buffer,
           }
           if(usehash) {
             if(ppm_addtocolorhash(cht, pP, ind) < 0) {
-              Msg(WARNING,
-                  "GIF: Out of memory adding to hash table, proceeding without it");
+	      Msg::Warning("GIF: Out of memory adding to hash table");
               usehash = 0;
             }
           }
@@ -1424,7 +1423,7 @@ void create_gif(FILE * outfile, PixelBuffer *buffer,
   for(i = 0; i < static_nbcolors; i++)
     static_permi[i] = i;
   if(sort) {
-    Msg(DEBUG, "GIF: sorting colormap");
+    Msg::Debug("GIF: sorting colormap");
     for(i = 0; i < static_nbcolors; i++)
       for(j = i + 1; j < static_nbcolors; j++)
         if(((static_red[i] * MAX_GIFCOLORS) +
diff --git a/Graphics/gl2jpeg.cpp b/Graphics/gl2jpeg.cpp
index c1812dddca0f49f4ce2ab1632d5b1e4ce4cd0827..b6ad21f3cbd3cd188ae9ec87c0da82895bc3b702 100644
--- a/Graphics/gl2jpeg.cpp
+++ b/Graphics/gl2jpeg.cpp
@@ -1,4 +1,4 @@
-// $Id: gl2jpeg.cpp,v 1.29 2008-02-17 08:48:00 geuzaine Exp $
+// $Id: gl2jpeg.cpp,v 1.30 2008-05-04 08:31:15 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -26,7 +26,7 @@
 
 void create_jpeg(FILE *outfile, PixelBuffer *buffer, int quality, int smoothing)
 {
-  Msg(GERROR, "This version of Gmsh was compiled without JPEG support");
+  Msg::Error("This version of Gmsh was compiled without JPEG support");
 }
 
 #else
@@ -53,13 +53,13 @@ void my_output_message(j_common_ptr cinfo)
 
   (*cinfo->err->format_message) (cinfo, buffer);
 
-  Msg(DEBUG, "%s", buffer);
+  Msg::Debug("%s", buffer);
 }
 
 void create_jpeg(FILE *outfile, PixelBuffer *buffer, int quality, int smoothing)
 {
   if(buffer->GetFormat() != GL_RGB || buffer->GetType() != GL_UNSIGNED_BYTE){
-    Msg(GERROR, "JPEG only implemented for GL_RGB and GL_UNSIGNED_BYTE");
+    Msg::Error("JPEG only implemented for GL_RGB and GL_UNSIGNED_BYTE");
     return;
   }
 
diff --git a/Graphics/gl2png.cpp b/Graphics/gl2png.cpp
index f53ddebe6a96936f681a35bbcc5c0ee87ef19a89..613ab698613dffe9807236d3488f36e37384274c 100644
--- a/Graphics/gl2png.cpp
+++ b/Graphics/gl2png.cpp
@@ -1,4 +1,4 @@
-// $Id: gl2png.cpp,v 1.9 2008-03-20 11:44:08 geuzaine Exp $
+// $Id: gl2png.cpp,v 1.10 2008-05-04 08:31:15 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -25,7 +25,7 @@
 
 void create_png(FILE *file, PixelBuffer *buffer, int quality)
 {
-  Msg(GERROR, "This version of Gmsh was compiled without PNG support");
+  Msg::Error("This version of Gmsh was compiled without PNG support");
 }
 
 #else
@@ -40,14 +40,14 @@ void create_png(FILE *file, PixelBuffer *buffer, int quality)
 {
   if((buffer->GetFormat() != GL_RGB && buffer->GetFormat() != GL_RGBA) ||
      buffer->GetType() != GL_UNSIGNED_BYTE){
-    Msg(GERROR, "PNG only implemented for GL_RGB/GL_RGBA and GL_UNSIGNED_BYTE");
+    Msg::Error("PNG only implemented for GL_RGB/GL_RGBA and GL_UNSIGNED_BYTE");
     return;
   }
 
   png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
   
   if(png_ptr == NULL) {
-    Msg(GERROR, "Could not create PNG write struct");
+    Msg::Error("Could not create PNG write struct");
     return;
   }
   
@@ -55,13 +55,13 @@ void create_png(FILE *file, PixelBuffer *buffer, int quality)
 
   if(info_ptr == NULL) {
     png_destroy_write_struct(&png_ptr, NULL);
-    Msg(GERROR, "Could not create PNG info struct");
+    Msg::Error("Could not create PNG info struct");
     return;
   }
   
   if(setjmp(png_jmpbuf(png_ptr))) {
     png_destroy_write_struct(&png_ptr, &info_ptr);
-    Msg(GERROR, "Could not setjmp in PNG");
+    Msg::Error("Could not setjmp in PNG");
     return;
   }
   
diff --git a/Graphics/gl2ppm.cpp b/Graphics/gl2ppm.cpp
index eee9c770a771a42de670743df23247501ab3696e..d352add3bd22c1dc3ba47ce2dc9dcac4775800d8 100644
--- a/Graphics/gl2ppm.cpp
+++ b/Graphics/gl2ppm.cpp
@@ -1,4 +1,4 @@
-// $Id: gl2ppm.cpp,v 1.16 2008-02-17 08:48:00 geuzaine Exp $
+// $Id: gl2ppm.cpp,v 1.17 2008-05-04 08:31:15 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -24,7 +24,7 @@
 void create_ppm(FILE *outfile, PixelBuffer *buffer)
 {
   if(buffer->GetFormat() != GL_RGB || buffer->GetType() != GL_UNSIGNED_BYTE){
-    Msg(GERROR, "PPM only implemented for GL_RGB and GL_UNSIGNED_BYTE");
+    Msg::Error("PPM only implemented for GL_RGB and GL_UNSIGNED_BYTE");
     return;
   }
 
diff --git a/Graphics/gl2yuv.cpp b/Graphics/gl2yuv.cpp
index 3067d34d7a6d6d9986a0ea68306710a1f412b59b..e16291f72fa7153a932ea452d5746259606a549a 100644
--- a/Graphics/gl2yuv.cpp
+++ b/Graphics/gl2yuv.cpp
@@ -1,4 +1,4 @@
-// $Id: gl2yuv.cpp,v 1.14 2008-02-17 08:48:00 geuzaine Exp $
+// $Id: gl2yuv.cpp,v 1.15 2008-05-04 08:31:15 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -51,7 +51,7 @@
 void create_yuv(FILE * outfile, PixelBuffer *buffer)
 {
   if(buffer->GetFormat() != GL_RGB || buffer->GetType() != GL_UNSIGNED_BYTE){
-    Msg(GERROR, "YUV only implemented for GL_RGB and GL_UNSIGNED_BYTE");
+    Msg::Error("YUV only implemented for GL_RGB and GL_UNSIGNED_BYTE");
     return;
   }
 
diff --git a/Makefile b/Makefile
index 959621a4bc905dff0e8ad42cdd28fecf635d3e7f..d495dfe6b9fb3a80ba4266aef5d6e076e0445a2a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.481 2008-04-28 10:10:50 geuzaine Exp $
+# $Id: Makefile,v 1.482 2008-05-04 08:31:10 geuzaine Exp $
 #
 # Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 #
@@ -39,6 +39,7 @@ GMSH_API = Geo/GModel.h\
            Geo/MVertex.h Geo/MEdge.h Geo/MFace.h Geo/MElement.h\
            Geo/SPoint2.h Geo/SPoint3.h Geo/SVector3.h Geo/SBoundingBox3d.h\
            Geo/Pair.h Geo/Range.h\
+           Post/PView.h Post/PViewData.h Post/PViewDataGModel.h\
            Common/Gmsh.h Common/GmshDefines.h Common/GmshVersion.h Common/GmshMatrix.h
 
 GMSH_EMBEDDED = ${GMSH_API} Geo/discrete*.h\
diff --git a/Mesh/BDS.cpp b/Mesh/BDS.cpp
index 6a6ce748784a7a1ad27cb0a8367c45cf2a9df58d..e78ef4b8ba9e1d3a266ff522bc8130ae7489e345 100644
--- a/Mesh/BDS.cpp
+++ b/Mesh/BDS.cpp
@@ -1,4 +1,4 @@
-// $Id: BDS.cpp,v 1.105 2008-03-25 20:25:35 remacle Exp $
+// $Id: BDS.cpp,v 1.106 2008-05-04 08:31:15 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -240,7 +240,7 @@ BDS_Edge *BDS_Mesh::recover_edge(int num1, int num2, std::set<EdgeToRecover> *e2
   
   if(!p1 || !p2) throw;
 
-  Msg(DEBUG2, "edge %d %d has to be recovered", num1, num2);
+  Msg::Debug("edge %d %d has to be recovered", num1, num2);
   
   int ix = 0;
   int ixMax = 300;
@@ -263,7 +263,7 @@ BDS_Edge *BDS_Mesh::recover_edge(int num1, int num2, std::set<EdgeToRecover> *e2
 	      e2r->find(EdgeToRecover(e->p1->iD, e->p2->iD, 0));		    
 	    std::set<EdgeToRecover>::iterator itr2 = 
 	      e2r->find(EdgeToRecover(num1, num2, 0));
-	    Msg(DEBUG2, "edge %d %d on model edge %d cannot be recovered because"
+	    Msg::Debug("edge %d %d on model edge %d cannot be recovered because"
 		" it intersects %d %d on model edge %d", num1, num2, itr2->ge->tag(),
 		e->p1->iD, e->p2->iD, itr1->ge->tag());
 	    // now throw a class that contains the diagnostic
@@ -279,7 +279,7 @@ BDS_Edge *BDS_Mesh::recover_edge(int num1, int num2, std::set<EdgeToRecover> *e2
     if (selfIntersection)return 0;
 
 //   if(ix > 300){
-//     Msg(WARNING, "edge %d %d cannot be recovered after %d iterations, trying again",
+//     Msg::Warning("edge %d %d cannot be recovered after %d iterations, trying again",
 //        num1, num2, ix);      
 //     ix = 0;
 //   }
@@ -290,7 +290,7 @@ BDS_Edge *BDS_Mesh::recover_edge(int num1, int num2, std::set<EdgeToRecover> *e2
       if(!eee){
 	outputScalarField(triangles, "debugp.pos", 1);
 	outputScalarField(triangles, "debugr.pos", 0);
-	Msg(DEBUG2, "edge %d %d cannot be recovered at all, look at debugp.pos "
+	Msg::Debug("edge %d %d cannot be recovered at all, look at debugp.pos "
 	    "and debugr.pos", num1, num2);
 	return 0;
       }
@@ -1439,7 +1439,7 @@ recombine_T::recombine_T(const BDS_Edge *_e)
 
 void BDS_Mesh::recombineIntoQuads(const double angle_limit, GFace *gf)
 {
-  Msg(INFO, "Recombining triangles for surface %d", gf->tag());  
+  Msg::Info("Recombining triangles for surface %d", gf->tag());  
   for(int i = 0; i < 5; i++){
     std::set<recombine_T> pairs;
     for(std::list<BDS_Edge*>::const_iterator it = edges.begin();
diff --git a/Mesh/BackgroundMesh.cpp b/Mesh/BackgroundMesh.cpp
index c1767f337a0e1aa05a50efd0cf42a1a213fa2a20..dba82cc8f44be1b13d70dc359d00f4cf0a7877f2 100644
--- a/Mesh/BackgroundMesh.cpp
+++ b/Mesh/BackgroundMesh.cpp
@@ -1,4 +1,4 @@
-// $Id: BackgroundMesh.cpp,v 1.53 2008-04-23 10:42:51 remacle Exp $
+// $Id: BackgroundMesh.cpp,v 1.54 2008-05-04 08:31:15 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -178,7 +178,7 @@ double BGM_MeshSize(GEntity *ge, double U, double V, double X, double Y, double
   lc = std::min(lc, CTX.mesh.lc_max);
 
   if(lc <= 0.){
-    Msg(GERROR, "Wrong characteristic length lc = %g", lc);
+    Msg::Error("Wrong characteristic length lc = %g", lc);
     lc = l1;
   }
 
diff --git a/Mesh/BoundaryLayers.cpp b/Mesh/BoundaryLayers.cpp
index 049f2354ddfb4224ab6b4b664b03678bbcc892ac..f17fa95d0471af940f31074771c106fce7804a44 100644
--- a/Mesh/BoundaryLayers.cpp
+++ b/Mesh/BoundaryLayers.cpp
@@ -1,4 +1,4 @@
-// $Id: BoundaryLayers.cpp,v 1.1 2008-04-30 05:50:21 geuzaine Exp $
+// $Id: BoundaryLayers.cpp,v 1.2 2008-05-04 08:31:15 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -58,7 +58,7 @@ int Mesh2DWithBoundaryLayers(GModel *m)
       if(ep && ep->mesh.ExtrudeMesh && ep->geo.Mode == COPIED_ENTITY){
         GFace *from = m->getFaceByTag(std::abs(ep->geo.Source));
         if(!from){
-          Msg(GERROR, "Unknown source face %d for boundary layer", ep->geo.Source);
+          Msg::Error("Unknown source face %d for boundary layer", ep->geo.Source);
           return 0;
         }
         sourceFaces.insert(from);
@@ -129,7 +129,7 @@ int Mesh2DWithBoundaryLayers(GModel *m)
   for(GModel::eiter it = m->firstEdge(); it != m->lastEdge(); it++){
     GEdge *ge = *it;
     if(ge->geomType() == GEntity::BoundaryLayerCurve){
-      Msg(INFO, "Meshing curve %d", ge->tag());
+      Msg::Info("Meshing curve %d", ge->tag());
       deMeshGEdge dem;
       dem(ge);
       MeshExtrudedCurve(ge);
@@ -144,7 +144,7 @@ int Mesh2DWithBoundaryLayers(GModel *m)
   for(GModel::fiter it = m->firstFace(); it != m->lastFace(); it++){
     GFace *gf = *it;
     if(gf->geomType() == GEntity::BoundaryLayerSurface){
-      Msg(STATUS2, "Meshing surface %d (%s)", gf->tag(), gf->getTypeString().c_str());
+      Msg::Status(2, true, "Meshing surface %d (%s)", gf->tag(), gf->getTypeString().c_str());
       deMeshGFace dem;
       dem(gf);
       MeshExtrudedSurface(gf);
diff --git a/Mesh/DivideAndConquer.cpp b/Mesh/DivideAndConquer.cpp
index 4fa5da53a4af0c962d7df0aae5537bd39e74956e..44bc0ba7ad8e5bcefb8e25c89cb19ff59b25e6bb 100644
--- a/Mesh/DivideAndConquer.cpp
+++ b/Mesh/DivideAndConquer.cpp
@@ -1,4 +1,4 @@
-// $Id: DivideAndConquer.cpp,v 1.17 2008-03-20 11:44:08 geuzaine Exp $
+// $Id: DivideAndConquer.cpp,v 1.18 2008-05-04 08:31:15 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -177,7 +177,7 @@ Segment UpperCommonTangent(DT vl, DT vr)
 int Qtest(PointNumero h, PointNumero i, PointNumero j, PointNumero k)
 {
   if((h == i) && (h == j) && (h == k)) {
-    Msg(GERROR, "3 identical points in Qtest");
+    Msg::Error("3 identical points in Qtest");
     return 0;
   }
   
diff --git a/Mesh/Field.cpp b/Mesh/Field.cpp
index 88c9448589b84034137534270191c4de6d7c98d3..a2568a7458f95125882d95da75727e97751f2266 100644
--- a/Mesh/Field.cpp
+++ b/Mesh/Field.cpp
@@ -1,4 +1,4 @@
-// $Id: Field.cpp,v 1.35 2008-04-28 10:10:52 geuzaine Exp $
+// $Id: Field.cpp,v 1.36 2008-05-04 08:31:15 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -211,11 +211,11 @@ Field *FieldManager::get(int id)
 Field *FieldManager::new_field(int id, const char *type_name)
 {
   if(find(id) != end()) {
-    Msg(GERROR, "Field id %i is already defined.", id);
+    Msg::Error("Field id %i is already defined.", id);
     return NULL;
   }
   if(map_type_name.find(type_name) == map_type_name.end()) {
-    Msg(GERROR, "Unknown field type \"%s\".", type_name);
+    Msg::Error("Unknown field type \"%s\".", type_name);
     return NULL;
   }
   Field *f = (*map_type_name[type_name]) ();
@@ -251,7 +251,7 @@ void FieldManager::delete_field(int id)
 {
   iterator it = find(id);
   if(it == end()) {
-    Msg(GERROR, "Cannot delete field id %i, it does not exist.", id);
+    Msg::Error("Cannot delete field id %i, it does not exist.", id);
     return;
   }
   delete it->second;
@@ -317,7 +317,7 @@ public:StructuredField()
       }
       catch(...) {
         error_status = true;
-        Msg(GERROR, "Field %i : error reading file %s", this->id,
+        Msg::Error("Field %i : error reading file %s", this->id,
             file_name.c_str());
       }
       update_needed = false;
@@ -574,7 +574,7 @@ public:
          (*field) (x, y, z - delta / 2)) / delta;
       return sqrt(gx * gx + gy * gy + gz * gz);
     default:
-      Msg(GERROR, "Field %i : Unknown kind (%i) of gradient.", this->id,
+      Msg::Error("Field %i : Unknown kind (%i) of gradient.", this->id,
           kind);
       return MAX_LC;
     }
@@ -828,7 +828,7 @@ public:
       else if(sscanf(names[i], "F%i", &id) == 1)
         evaluators_id[i] = id;
       else {
-        Msg(GERROR, "Unknown matheval argument \"%s\"\n", names[i]);
+        Msg::Error("Unknown matheval argument \"%s\"\n", names[i]);
         error_status = true;
         return false;
       }
@@ -864,7 +864,7 @@ public:
   {
     if(update_needed) {
       if(!expr.set_function(f))
-        Msg(GERROR, "Field %i : Invalid matheval expression \"%s\"\n",
+        Msg::Error("Field %i : Invalid matheval expression \"%s\"\n",
             this->id, f.c_str());
       update_needed = false;
     }
@@ -898,7 +898,7 @@ public:
     if(update_needed) {
       for(int i = 0; i < 3; i++) {
         if(!expr[i].set_function(f[i]))
-          Msg(GERROR, "Field %i : Invalid matheval expression \"%s\"\n",
+          Msg::Error("Field %i : Invalid matheval expression \"%s\"\n",
               this->id, f[i].c_str());
       }
       update_needed = false;
diff --git a/Mesh/Generator.cpp b/Mesh/Generator.cpp
index 4429e55f558eacd488238baaf0c59390b9785838..7ee68aff52251ba9cd9f7f864d84d52403a0deb3 100644
--- a/Mesh/Generator.cpp
+++ b/Mesh/Generator.cpp
@@ -1,4 +1,4 @@
-// $Id: Generator.cpp,v 1.142 2008-04-30 05:50:21 geuzaine Exp $
+// $Id: Generator.cpp,v 1.143 2008-05-04 08:31:15 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -35,6 +35,7 @@
 
 #if !defined(HAVE_NO_POST)
 #include "PView.h"
+#include "PViewData.h"
 #endif
 
 extern Context_T CTX;
@@ -164,26 +165,27 @@ static bool TooManyElements(GModel *m, int dim)
     sumAllLc += (*it)->prescribedMeshSizeAtVertex();
   sumAllLc /= (double)m->getNumVertices();
   if(!sumAllLc || pow(CTX.lc / sumAllLc, dim) > 1.e10) 
-    return !GetBinaryAnswer("Your choice of characteristic lengths will likely produce\n"
-                            "a very large mesh. Do you really want to continue?\n\n"
-                            "(To disable this warning in the future, select `Enable\n"
-                            "expert mode' in the option dialog.)",
-                            "Continue", "Cancel");
+    return !Msg::GetBinaryAnswer
+      ("Your choice of characteristic lengths will likely produce\n"
+       "a very large mesh. Do you really want to continue?\n\n"
+       "(To disable this warning in the future, select `Enable\n"
+       "expert mode' in the option dialog.)",
+       "Continue", "Cancel");
   return false;
 }
 
 static void Mesh1D(GModel *m)
 {
   if(TooManyElements(m, 1)) return;
-  Msg(STATUS1, "Meshing 1D...");
+  Msg::Status(1, true, "Meshing 1D...");
   double t1 = Cpu();
 
   std::for_each(m->firstEdge(), m->lastEdge(), meshGEdge());
 
   double t2 = Cpu();
   CTX.mesh_timer[0] = t2 - t1;
-  Msg(INFO, "Mesh 1D complete (%g s)", CTX.mesh_timer[0]);
-  Msg(STATUS1, "Mesh");
+  Msg::Info("Mesh 1D complete (%g s)", CTX.mesh_timer[0]);
+  Msg::Status(1, true, "Mesh");
 }
 
 static void PrintMesh2dStatistics(GModel *m)
@@ -200,7 +202,7 @@ static void PrintMesh2dStatistics(GModel *m)
   int nTotT = 0, nTotE = 0, nTotGoodLength = 0, nTotGoodQuality = 0;
   int nUnmeshed = 0, numFaces = 0;
 
-  Msg(INFO,"2D Mesh Statistics :");
+  Msg::Info("2D Mesh Statistics :");
   for(GModel::fiter it = m->firstFace() ; it != m->lastFace(); ++it){
     worst = std::min((*it)->meshStatistics.worst_element_shape, worst);
     best = std::max((*it)->meshStatistics.best_element_shape, best);
@@ -239,15 +241,16 @@ static void Mesh2D(GModel *m)
 
   if(!CTX.expert_mode && (CTX.mesh.algo2d == ALGO_2D_DELAUNAY ||
 			  CTX.mesh.algo2d == ALGO_2D_FRONTAL)){
-    if(!GetBinaryAnswer("The 2D Delaunay and Frontal algorithms are still experimental\n"
-                        "and produce triangles with random orientations. Do you really\n"
-                        "want to continue?\n\n"
-                        "(To disable this warning in the future, select `Enable expert\n"
-                        "mode' in the option dialog.)",
-                        "Continue", "Cancel")) return;
+    if(!Msg::GetBinaryAnswer
+       ("The 2D Delaunay and Frontal algorithms are still experimental\n"
+	"and produce triangles with random orientations. Do you really\n"
+	"want to continue?\n\n"
+	"(To disable this warning in the future, select `Enable expert\n"
+	"mode' in the option dialog.)",
+	"Continue", "Cancel")) return;
   }
-
-  Msg(STATUS1, "Meshing 2D...");
+  
+  Msg::Status(1, true, "Meshing 2D...");
   double t1 = Cpu();
 
   // boundary layers are special: their generation (including vertices
@@ -274,8 +277,8 @@ static void Mesh2D(GModel *m)
 
   double t2 = Cpu();
   CTX.mesh_timer[1] = t2 - t1;
-  Msg(INFO, "Mesh 2D complete (%g s)", CTX.mesh_timer[1]);
-  Msg(STATUS1, "Mesh");
+  Msg::Info("Mesh 2D complete (%g s)", CTX.mesh_timer[1]);
+  Msg::Status(1, true, "Mesh");
 
   PrintMesh2dStatistics(m);
 }
@@ -290,7 +293,7 @@ static void FindConnectedRegions(std::vector<GRegion*> &delaunay,
 static void Mesh3D(GModel *m)
 {
   if(TooManyElements(m, 3)) return;
-  Msg(STATUS1, "Meshing 3D...");
+  Msg::Status(1, true, "Meshing 3D...");
   double t1 = Cpu();
 
   // mesh the extruded volumes first
@@ -314,41 +317,41 @@ static void Mesh3D(GModel *m)
 
   double t2 = Cpu();
   CTX.mesh_timer[2] = t2 - t1;
-  Msg(INFO, "Mesh 3D complete (%g s)", CTX.mesh_timer[2]);
-  Msg(STATUS1, "Mesh");
+  Msg::Info("Mesh 3D complete (%g s)", CTX.mesh_timer[2]);
+  Msg::Status(1, true, "Mesh");
 }
 
 void OptimizeMeshNetgen(GModel *m)
 {
-  Msg(STATUS1, "Optimizing 3D with Netgen...");
+  Msg::Status(1, true, "Optimizing 3D with Netgen...");
   double t1 = Cpu();
 
   std::for_each(m->firstRegion(), m->lastRegion(), optimizeMeshGRegionNetgen());
 
   double t2 = Cpu();
-  Msg(INFO, "Mesh 3D optimization with Netgen complete (%g s)", t2 - t1);
-  Msg(STATUS1, "Mesh");
+  Msg::Info("Mesh 3D optimization with Netgen complete (%g s)", t2 - t1);
+  Msg::Status(1, true, "Mesh");
 }
 
 void OptimizeMesh(GModel *m)
 {
-  Msg(STATUS1, "Optimizing 3D...");
+  Msg::Status(1, true, "Optimizing 3D...");
   double t1 = Cpu();
 
   std::for_each(m->firstRegion(), m->lastRegion(), optimizeMeshGRegionGmsh());
 
   double t2 = Cpu();
-  Msg(INFO, "Mesh 3D optimization complete (%g s)", t2 - t1);
-  Msg(STATUS1, "Mesh");
+  Msg::Info("Mesh 3D optimization complete (%g s)", t2 - t1);
+  Msg::Status(1, true, "Mesh");
 }
 
 void AdaptMesh(GModel *m)
 {
-  Msg(STATUS1, "Adapting the 3D Mesh...");
+  Msg::Status(1, true, "Adapting the 3D Mesh...");
   double t1 = Cpu();
 
   if(CTX.threads_lock) {
-    Msg(INFO, "I'm busy! Ask me that later...");
+    Msg::Info("I'm busy! Ask me that later...");
     return;
   }
 
@@ -366,18 +369,20 @@ void AdaptMesh(GModel *m)
   std::for_each(m->firstRegion(), m->lastRegion(), adaptMeshGRegion());
 
   double t2 = Cpu();
-  Msg(INFO, "Mesh Adaptation complete (%g s)", t2 - t1);
-  Msg(STATUS1, "Mesh");
+  Msg::Info("Mesh Adaptation complete (%g s)", t2 - t1);
+  Msg::Status(1, true, "Mesh");
 }
 
 void GenerateMesh(GModel *m, int ask)
 {
   if(CTX.threads_lock) {
-    Msg(INFO, "I'm busy! Ask me that later...");
+    Msg::Info("I'm busy! Ask me that later...");
     return;
   }
   CTX.threads_lock = 1;
 
+  Msg::ResetErrorCounter();
+
   int old = m->getMeshStatus(false);
 
   // Initialize pseudo random mesh generator with the same seed
@@ -421,8 +426,10 @@ void GenerateMesh(GModel *m, int ask)
     SetOrderN(m, CTX.mesh.order, CTX.mesh.second_order_linear, 
               CTX.mesh.second_order_incomplete);
 
-  Msg(INFO, "%d vertices %d elements",
-      m->getNumMeshVertices(), m->getNumMeshElements());
+  Msg::Info("%d vertices %d elements",
+	    m->getNumMeshVertices(), m->getNumMeshElements());
+
+  Msg::PrintErrorCounter("Mesh generation error summary");
 
   CTX.threads_lock = 0;
   CTX.mesh.changed = ENT_ALL;
diff --git a/Mesh/HighOrder.cpp b/Mesh/HighOrder.cpp
index 52e7c03a3bd67441539244e0e2f6611a1b78013a..0d1d3cd99cbe98165ddbbdcd84b43b15efd40f92 100644
--- a/Mesh/HighOrder.cpp
+++ b/Mesh/HighOrder.cpp
@@ -1,4 +1,4 @@
-// $Id: HighOrder.cpp,v 1.27 2008-03-20 11:44:08 geuzaine Exp $
+// $Id: HighOrder.cpp,v 1.28 2008-05-04 08:31:15 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -1223,8 +1223,8 @@ void checkHighOrderTriangles(GModel *m)
     minJGlob = std::min(minJGlob,minJ);
     maxJGlob = std::max(maxJGlob,maxJ);
   }
-  if (minJGlob >= 0) Msg(INFO, "Jacobian Range (%12.5E,%12.5E)", minJGlob, maxJGlob);
-  else Msg(WARNING, "Jacobian Range (%12.5E,%12.5E)", minJGlob, maxJGlob);
+  if (minJGlob >= 0) Msg::Info("Jacobian Range (%12.5E,%12.5E)", minJGlob, maxJGlob);
+  else Msg::Warning("Jacobian Range (%12.5E,%12.5E)", minJGlob, maxJGlob);
 }  
 
 void printJacobians(GModel *m, const char *nm)
@@ -1298,7 +1298,7 @@ void SetOrderN(GModel *m, int order, bool linear, bool incomplete)
 
   int nPts = order - 1;
 
-  Msg(STATUS1, "Meshing second order...");
+  Msg::Status(1, true, "Meshing second order...");
   double t1 = Cpu();
 
   // first, make sure to remove any existsing second order vertices/elements
@@ -1319,7 +1319,7 @@ void SetOrderN(GModel *m, int order, bool linear, bool incomplete)
   if(CTX.mesh.smooth_internal_edges){
     checkHighOrderTriangles(m);
     for(GModel::fiter it = m->firstFace(); it != m->lastFace(); ++it){      
-      Msg(INFO, "Smoothing internal Edges in Surface %d",(*it)->tag());
+      Msg::Info("Smoothing internal Edges in Surface %d",(*it)->tag());
       for (int i = 0; i < 10; i++) {
         if (!smoothInternalEdges(*it, edgeVertices))break;
         checkHighOrderTriangles(m);
@@ -1339,6 +1339,6 @@ void SetOrderN(GModel *m, int order, bool linear, bool incomplete)
   checkHighOrderTriangles(m);
 
   double t2 = Cpu();
-  Msg(INFO, "Mesh second order complete (%g s)", t2 - t1);
-  Msg(STATUS1, "Mesh");
+  Msg::Info("Mesh second order complete (%g s)", t2 - t1);
+  Msg::Status(1, true, "Mesh");
 }
diff --git a/Mesh/Makefile b/Mesh/Makefile
index 57904758e233f62fbd2da8c58f3f59a93bbc5b23..440af445288843c39c940562565b31585879ba29 100644
--- a/Mesh/Makefile
+++ b/Mesh/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.218 2008-04-30 05:50:21 geuzaine Exp $
+# $Id: Makefile,v 1.219 2008-05-04 08:31:15 geuzaine Exp $
 #
 # Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 #
@@ -100,8 +100,7 @@ Generator.o: Generator.cpp ../Common/Message.h ../Numeric/Numeric.h \
   ../Geo/SPoint3.h ../Geo/MEdge.h ../Geo/MVertex.h ../Geo/SVector3.h \
   ../Geo/MFace.h ../Geo/MVertex.h ../Geo/SVector3.h meshGEdge.h \
   meshGFace.h meshGFaceBDS.h meshGRegion.h BackgroundMesh.h \
-  BoundaryLayers.h HighOrder.h ../Post/PView.h ../Post/PViewData.h \
-  ../DataStr/List.h ../Post/PViewOptions.h ../Post/ColorTable.h
+  BoundaryLayers.h HighOrder.h ../Post/PView.h ../Post/PViewData.h
 Field.o: Field.cpp ../Common/Context.h Field.h ../Geo/Geo.h \
   ../Common/GmshDefines.h ../Geo/gmshSurface.h ../Geo/Pair.h \
   ../Geo/Range.h ../Geo/SPoint2.h ../Geo/SPoint3.h ../Geo/SVector3.h \
@@ -109,7 +108,6 @@ Field.o: Field.cpp ../Common/Context.h Field.h ../Geo/Geo.h \
   ../Numeric/Numeric.h ../Numeric/NumericEmbedded.h ../DataStr/List.h \
   ../DataStr/Tree.h ../DataStr/avl.h ../Geo/SPoint2.h \
   ../Geo/ExtrudeParams.h ../Common/SmoothData.h ../Post/PView.h \
-  ../Post/PViewData.h ../Post/PViewOptions.h ../Post/ColorTable.h \
   ../Geo/GeoInterpolation.h ../Geo/Geo.h ../Geo/GModel.h ../Geo/GVertex.h \
   ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
   ../Geo/SBoundingBox3d.h ../Geo/GPoint.h ../Geo/SPoint2.h ../Geo/GEdge.h \
@@ -158,11 +156,10 @@ meshGFace.o: meshGFace.cpp meshGFace.h meshGFaceBDS.h \
   ../Geo/GModel.h ../Geo/GVertex.h ../Geo/GEdge.h ../Geo/GFace.h \
   ../Geo/GRegion.h ../Geo/GEntity.h ../Geo/SBoundingBox3d.h \
   ../Common/Context.h ../Common/Message.h ../Numeric/Numeric.h \
-  ../Numeric/NumericEmbedded.h BDS.h ../Post/PView.h ../Post/PViewData.h \
-  ../DataStr/List.h ../Post/PViewOptions.h ../Post/ColorTable.h \
-  qualityMeasures.h Field.h ../Geo/Geo.h ../Geo/gmshSurface.h \
-  ../Geo/Pair.h ../Geo/Range.h ../Geo/SPoint2.h ../Geo/SPoint3.h \
-  ../Geo/SVector3.h ../Geo/SBoundingBox3d.h ../DataStr/Tree.h \
+  ../Numeric/NumericEmbedded.h BDS.h ../Post/PView.h qualityMeasures.h \
+  Field.h ../Geo/Geo.h ../Geo/gmshSurface.h ../Geo/Pair.h ../Geo/Range.h \
+  ../Geo/SPoint2.h ../Geo/SPoint3.h ../Geo/SVector3.h \
+  ../Geo/SBoundingBox3d.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../Geo/SPoint2.h ../Geo/ExtrudeParams.h \
   ../Common/SmoothData.h ../Common/OS.h
 meshGFaceTransfinite.o: meshGFaceTransfinite.cpp meshGFace.h \
@@ -204,27 +201,23 @@ meshGFaceBDS.o: meshGFaceBDS.cpp meshGFace.h meshGFaceOptimize.h \
   ../Geo/GModel.h ../Geo/GVertex.h ../Geo/GEdge.h ../Geo/GFace.h \
   ../Geo/GRegion.h ../Geo/GEntity.h ../Geo/SBoundingBox3d.h \
   ../Common/Message.h ../Numeric/Numeric.h ../Numeric/NumericEmbedded.h \
-  BDS.h ../Post/PView.h ../Post/PViewData.h ../DataStr/List.h \
-  ../Post/PViewOptions.h ../Post/ColorTable.h qualityMeasures.h Field.h \
-  ../Geo/Geo.h ../Geo/gmshSurface.h ../Geo/Pair.h ../Geo/Range.h \
-  ../Geo/SPoint2.h ../Geo/SPoint3.h ../Geo/SVector3.h \
-  ../Geo/SBoundingBox3d.h ../DataStr/Tree.h ../DataStr/avl.h \
-  ../Geo/SPoint2.h ../Geo/ExtrudeParams.h ../Common/SmoothData.h \
-  ../Common/OS.h
+  BDS.h ../Post/PView.h qualityMeasures.h Field.h ../Geo/Geo.h \
+  ../Geo/gmshSurface.h ../Geo/Pair.h ../Geo/Range.h ../Geo/SPoint2.h \
+  ../Geo/SPoint3.h ../Geo/SVector3.h ../Geo/SBoundingBox3d.h \
+  ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../Geo/SPoint2.h \
+  ../Geo/ExtrudeParams.h ../Common/SmoothData.h ../Common/OS.h
 meshGFaceDelaunayInsertion.o: meshGFaceDelaunayInsertion.cpp BDS.h \
   ../Geo/GFace.h ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
   ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Geo/GPoint.h \
   ../Geo/GEdgeLoop.h ../Geo/GEdge.h ../Geo/GEntity.h ../Geo/GVertex.h \
   ../Geo/GEntity.h ../Geo/GPoint.h ../Geo/SPoint2.h ../Geo/SVector3.h \
   ../Geo/SPoint3.h ../Geo/SPoint3.h ../Geo/SPoint2.h ../Geo/SPoint2.h \
-  ../Geo/SVector3.h ../Geo/Pair.h ../Post/PView.h ../Post/PViewData.h \
-  ../DataStr/List.h ../Post/PViewOptions.h ../Post/ColorTable.h \
-  BackgroundMesh.h meshGFaceDelaunayInsertion.h ../Geo/MElement.h \
-  ../Common/GmshDefines.h ../Geo/MVertex.h ../Geo/SPoint3.h \
-  ../Geo/MEdge.h ../Geo/MVertex.h ../Geo/SVector3.h ../Geo/MFace.h \
-  ../Geo/MVertex.h ../Geo/SVector3.h meshGFaceOptimize.h meshGFace.h \
-  ../Numeric/Numeric.h ../Numeric/NumericEmbedded.h ../Common/Message.h \
-  ../Common/Context.h
+  ../Geo/SVector3.h ../Geo/Pair.h ../Post/PView.h BackgroundMesh.h \
+  meshGFaceDelaunayInsertion.h ../Geo/MElement.h ../Common/GmshDefines.h \
+  ../Geo/MVertex.h ../Geo/SPoint3.h ../Geo/MEdge.h ../Geo/MVertex.h \
+  ../Geo/SVector3.h ../Geo/MFace.h ../Geo/MVertex.h ../Geo/SVector3.h \
+  meshGFaceOptimize.h meshGFace.h ../Numeric/Numeric.h \
+  ../Numeric/NumericEmbedded.h ../Common/Message.h ../Common/Context.h
 meshGFaceOptimize.o: meshGFaceOptimize.cpp meshGFaceOptimize.h \
   ../Geo/MElement.h ../Common/GmshDefines.h ../Geo/MVertex.h \
   ../Geo/SPoint3.h ../Geo/MEdge.h ../Geo/MVertex.h ../Geo/SVector3.h \
@@ -254,7 +247,6 @@ meshGRegion.o: meshGRegion.cpp meshGRegion.h \
   ../Geo/SBoundingBox3d.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../Geo/SPoint2.h ../Geo/ExtrudeParams.h \
   ../Common/SmoothData.h ../Geo/GRegion.h BDS.h ../Post/PView.h \
-  ../Post/PViewData.h ../Post/PViewOptions.h ../Post/ColorTable.h \
   ../Common/Message.h ../Common/Context.h
 meshGRegionDelaunayInsertion.o: meshGRegionDelaunayInsertion.cpp \
   ../Common/OS.h BackgroundMesh.h meshGRegion.h meshGRegionLocalMeshMod.h \
@@ -331,20 +323,18 @@ BackgroundMesh.o: BackgroundMesh.cpp ../Common/Message.h BackgroundMesh.h \
   ../Geo/Range.h ../Geo/SPoint2.h ../Geo/SPoint3.h ../Geo/SVector3.h \
   ../Geo/SBoundingBox3d.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../Geo/SPoint2.h ../Geo/ExtrudeParams.h \
-  ../Common/SmoothData.h ../Post/PView.h ../Post/PViewData.h \
-  ../Post/PViewOptions.h ../Post/ColorTable.h
+  ../Common/SmoothData.h ../Post/PView.h
 qualityMeasures.o: qualityMeasures.cpp qualityMeasures.h BDS.h \
   ../Geo/GFace.h ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
   ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Geo/GPoint.h \
   ../Geo/GEdgeLoop.h ../Geo/GEdge.h ../Geo/GEntity.h ../Geo/GVertex.h \
   ../Geo/GEntity.h ../Geo/GPoint.h ../Geo/SPoint2.h ../Geo/SVector3.h \
   ../Geo/SPoint3.h ../Geo/SPoint3.h ../Geo/SPoint2.h ../Geo/SPoint2.h \
-  ../Geo/SVector3.h ../Geo/Pair.h ../Post/PView.h ../Post/PViewData.h \
-  ../DataStr/List.h ../Post/PViewOptions.h ../Post/ColorTable.h \
-  ../Geo/MVertex.h ../Geo/SPoint3.h ../Geo/MElement.h \
-  ../Common/GmshDefines.h ../Geo/MVertex.h ../Geo/MEdge.h \
-  ../Geo/MVertex.h ../Geo/SVector3.h ../Geo/MFace.h ../Geo/MVertex.h \
-  ../Geo/SVector3.h ../Numeric/Numeric.h ../Numeric/NumericEmbedded.h
+  ../Geo/SVector3.h ../Geo/Pair.h ../Post/PView.h ../Geo/MVertex.h \
+  ../Geo/SPoint3.h ../Geo/MElement.h ../Common/GmshDefines.h \
+  ../Geo/MVertex.h ../Geo/MEdge.h ../Geo/MVertex.h ../Geo/SVector3.h \
+  ../Geo/MFace.h ../Geo/MVertex.h ../Geo/SVector3.h ../Numeric/Numeric.h \
+  ../Numeric/NumericEmbedded.h
 BoundaryLayers.o: BoundaryLayers.cpp ../Geo/GModel.h ../Geo/GVertex.h \
   ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
   ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Geo/GPoint.h \
@@ -364,12 +354,11 @@ BDS.o: BDS.cpp ../Numeric/Numeric.h ../Numeric/NumericEmbedded.h BDS.h \
   ../Geo/GEdgeLoop.h ../Geo/GEdge.h ../Geo/GEntity.h ../Geo/GVertex.h \
   ../Geo/GEntity.h ../Geo/GPoint.h ../Geo/SPoint2.h ../Geo/SVector3.h \
   ../Geo/SPoint3.h ../Geo/SPoint3.h ../Geo/SPoint2.h ../Geo/SPoint2.h \
-  ../Geo/SVector3.h ../Geo/Pair.h ../Post/PView.h ../Post/PViewData.h \
-  ../DataStr/List.h ../Post/PViewOptions.h ../Post/ColorTable.h \
-  ../Common/Message.h meshGFaceDelaunayInsertion.h ../Geo/MElement.h \
-  ../Common/GmshDefines.h ../Geo/MVertex.h ../Geo/SPoint3.h \
-  ../Geo/MEdge.h ../Geo/MVertex.h ../Geo/SVector3.h ../Geo/MFace.h \
-  ../Geo/MVertex.h ../Geo/SVector3.h qualityMeasures.h
+  ../Geo/SVector3.h ../Geo/Pair.h ../Post/PView.h ../Common/Message.h \
+  meshGFaceDelaunayInsertion.h ../Geo/MElement.h ../Common/GmshDefines.h \
+  ../Geo/MVertex.h ../Geo/SPoint3.h ../Geo/MEdge.h ../Geo/MVertex.h \
+  ../Geo/SVector3.h ../Geo/MFace.h ../Geo/MVertex.h ../Geo/SVector3.h \
+  qualityMeasures.h
 HighOrder.o: HighOrder.cpp HighOrder.h ../Geo/GModel.h ../Geo/GVertex.h \
   ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
   ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Geo/GPoint.h \
diff --git a/Mesh/meshGEdge.cpp b/Mesh/meshGEdge.cpp
index 090c3afb14d4be5cd725c3b1d8775abd199b49ae..2759804c39f6ff99420e59a6184814658ec51d1e 100644
--- a/Mesh/meshGEdge.cpp
+++ b/Mesh/meshGEdge.cpp
@@ -1,4 +1,4 @@
-// $Id: meshGEdge.cpp,v 1.60 2008-04-17 09:07:01 remacle Exp $
+// $Id: meshGEdge.cpp,v 1.61 2008-05-04 08:31:16 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -190,7 +190,7 @@ double F_Transfinite(GEdge *ge, double t)
       break;
       
     default:
-      Msg(WARNING, "Unknown case in Transfinite Line mesh");
+      Msg::Warning("Unknown case in Transfinite Line mesh");
       val = 1.;
       break;
     }
@@ -286,7 +286,7 @@ void meshGEdge::operator() (GEdge *ge)
 
   if(MeshExtrudedCurve(ge)) return;
 
-  Msg(INFO, "Meshing curve %d (%s)", ge->tag(),ge->getTypeString().c_str());
+  Msg::Info("Meshing curve %d (%s)", ge->tag(),ge->getTypeString().c_str());
 
   // Create a list of integration points
   List_T *Points = List_Create(10, 10, sizeof(IntPoint));
@@ -304,7 +304,7 @@ void meshGEdge::operator() (GEdge *ge)
 
 
   if(length == 0.0)
-    Msg(DEBUG2, "Curve %d has a zero length", ge->tag());
+    Msg::Debug("Curve %d has a zero length", ge->tag());
   
   List_Reset(Points);
 
diff --git a/Mesh/meshGEdgeExtruded.cpp b/Mesh/meshGEdgeExtruded.cpp
index 668e393f6fd4147342b12f6dd337ea7e4f0cd4c3..b1ca6cf0d91fb87c6028157f21d7571083d3e339 100644
--- a/Mesh/meshGEdgeExtruded.cpp
+++ b/Mesh/meshGEdgeExtruded.cpp
@@ -1,4 +1,4 @@
-// $Id: meshGEdgeExtruded.cpp,v 1.12 2008-03-20 11:44:08 geuzaine Exp $
+// $Id: meshGEdgeExtruded.cpp,v 1.13 2008-05-04 08:31:16 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -78,7 +78,7 @@ int MeshExtrudedCurve(GEdge *ge)
     // curve is a copy of another curve (the "top" of the extrusion)
     GEdge *from = ge->model()->getEdgeByTag(std::abs(ep->geo.Source));
     if(!from){
-      Msg(GERROR, "Unknown source curve %d for extrusion", ep->geo.Source);
+      Msg::Error("Unknown source curve %d for extrusion", ep->geo.Source);
       return 0;
     }
     copyMesh(from, ge);
diff --git a/Mesh/meshGFace.cpp b/Mesh/meshGFace.cpp
index c4837450ff6a2d0576a54dd5dc7cffd9be32c8c8..bf0d1fc2120822670255581c2435df3c6a315f0e 100644
--- a/Mesh/meshGFace.cpp
+++ b/Mesh/meshGFace.cpp
@@ -1,4 +1,4 @@
-// $Id: meshGFace.cpp,v 1.132 2008-04-18 16:40:29 geuzaine Exp $
+// $Id: meshGFace.cpp,v 1.133 2008-05-04 08:31:16 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -260,7 +260,7 @@ bool recover_medge(BDS_Mesh *m, GEdge *ge, std::set<EdgeToRecover> *e2r,
       BDS_Edge * e = m->recover_edge(vstart->getNum(), vend->getNum(), e2r, not_recovered);
       if (e) e->g = g;
       else {
-        // Msg(GERROR, "The unrecoverable edge is on model edge %d",ge->tag());
+        // Msg::Error("The unrecoverable edge is on model edge %d", ge->tag());
         return false;
       }
       return true;
@@ -282,7 +282,7 @@ bool recover_medge(BDS_Mesh *m, GEdge *ge, std::set<EdgeToRecover> *e2r,
     e = m->recover_edge(vstart->getNum(), vend->getNum(), e2r, not_recovered);
     if (e) e->g = g;
     else {
-      // Msg(GERROR, "The unrecoverable edge is on model edge %d",ge->tag());
+      // Msg::Error("The unrecoverable edge is on model edge %d", ge->tag());
       // return false;
     }
   }
@@ -295,9 +295,9 @@ bool recover_medge(BDS_Mesh *m, GEdge *ge, std::set<EdgeToRecover> *e2r,
       e = m->recover_edge(vstart->getNum(), vend->getNum(), e2r, not_recovered);
       if (e) e->g = g;
       else {
-        // Msg(GERROR, "Unable to recover an edge %g %g && %g %g (%d/%d)",
-        //     vstart->x(), vstart->y(), vend->x(), vend->y(), i, 
-        //     ge->mesh_vertices.size());
+        // Msg::Error("Unable to recover an edge %g %g && %g %g (%d/%d)",
+        //            vstart->x(), vstart->y(), vend->x(), vend->y(), i, 
+        //            ge->mesh_vertices.size());
         // return false;
       }
     }
@@ -309,9 +309,9 @@ bool recover_medge(BDS_Mesh *m, GEdge *ge, std::set<EdgeToRecover> *e2r,
     e = m->recover_edge(vstart->getNum(), vend->getNum(), e2r, not_recovered);
     if (e)e->g = g;
     else {
-      // Msg(GERROR, "Unable to recover an edge %g %g && %g %g (%d/%d)",
-      //     vstart->x(), vstart->y(), vend->x(), vend->y(), 
-      //     ge->mesh_vertices.size(), ge->mesh_vertices.size());
+      // Msg::Error("Unable to recover an edge %g %g && %g %g (%d/%d)",
+      //            vstart->x(), vstart->y(), vend->x(), vend->y(), 
+      //            ge->mesh_vertices.size(), ge->mesh_vertices.size());
       // return false;
     }
     BDS_Point *pend = m->find_point(vend->getNum());
@@ -364,7 +364,7 @@ bool gmsh2DMeshGenerator(GFace *gf, int RECUR_ITER, bool debug = true)
   }
   
   if (all_vertices.size() < 3){
-    Msg(WARNING, "Cannot triangulate less than 3 vertices");
+    Msg::Warning("Cannot triangulate less than 3 vertices");
     return false;
   }
 
@@ -461,9 +461,9 @@ bool gmsh2DMeshGenerator(GFace *gf, int RECUR_ITER, bool debug = true)
     //   -) It does not necessary recover the boundaries
     //   -) It contains triangles outside the domain (the first edge
     //      loop is the outer one)
-    Msg(DEBUG1, "Meshing of the convex hull (%d points)", all_vertices.size());
+    Msg::Debug("Meshing of the convex hull (%d points)", all_vertices.size());
     doc.MakeMeshWithPoints();
-    Msg(DEBUG1, "Meshing of the convex hull (%d points) done", all_vertices.size());
+    Msg::Debug("Meshing of the convex hull (%d points) done", all_vertices.size());
     
     for(int i = 0; i < doc.numPoints; i++){
       MVertex *here = (MVertex *)doc.points[i].data;
@@ -499,7 +499,7 @@ bool gmsh2DMeshGenerator(GFace *gf, int RECUR_ITER, bool debug = true)
       outputScalarField(m->triangles, name, 1);
     }
     
-    Msg(DEBUG1, "Recovering %d model Edges", edges.size());
+    Msg::Debug("Recovering %d model Edges", edges.size());
     
     // build a structure with all mesh edges that have to be
     // recovered. If two of these edges intersect, then the 1D mesh have
@@ -518,7 +518,7 @@ bool gmsh2DMeshGenerator(GFace *gf, int RECUR_ITER, bool debug = true)
       ++it;
     }
     
-    Msg(DEBUG1, "Recovering %d mesh Edges", edgesToRecover.size());
+    Msg::Debug("Recovering %d mesh Edges", edgesToRecover.size());
     
     // effectively recover the medge
     it = edges.begin();
@@ -530,9 +530,9 @@ bool gmsh2DMeshGenerator(GFace *gf, int RECUR_ITER, bool debug = true)
     }
     
     if (edgesNotRecovered.size()){
-      Msg(WARNING, ":-( There exists %d intersections in the 1d mesh",
+      Msg::Warning(":-( There are %d intersections in the 1d mesh",
 	  edgesNotRecovered.size());
-      Msg(WARNING, "8-| Gmsh splits those edges and tries again");
+      Msg::Warning("8-| Gmsh splits those edges and tries again");
 
       if (debug){
 	char name[245];
@@ -547,7 +547,7 @@ bool gmsh2DMeshGenerator(GFace *gf, int RECUR_ITER, bool debug = true)
 	int p1 = itr->p1;
 	int p2 = itr->p2;
 	int tag = itr->ge->tag();
-	Msg(WARNING, "MEdge %d %d in GEdge %d",p1,p2,tag);
+	Msg::Warning("MEdge %d %d in GEdge %d",p1,p2,tag);
       }
       // delete the mesh
       delete m;
@@ -558,10 +558,10 @@ bool gmsh2DMeshGenerator(GFace *gf, int RECUR_ITER, bool debug = true)
       return false;
     }
     if(RECUR_ITER > 0)
-      Msg(WARNING, ":-) Gmsh was able to recover all edges after %d ITERATIONS",
-	  RECUR_ITER);
+      Msg::Warning(":-) Gmsh was able to recover all edges after %d ITERATIONS",
+		   RECUR_ITER);
     
-    //  Msg(INFO, "Boundary Edges recovered for surface %d",gf->tag());
+    //  Msg::Info("Boundary Edges recovered for surface %d", gf->tag());
     // Look for an edge that is on the boundary for which one of the two
     // neighbors has a negative number node. The other triangle is
     // inside the domain and, because all edges were recovered,
@@ -593,7 +593,7 @@ bool gmsh2DMeshGenerator(GFace *gf, int RECUR_ITER, bool debug = true)
       ++it;
     }
     // compute characteristic lengths at vertices    
-    Msg(DEBUG1, "Computing mesh size field at mesh vertices", edgesToRecover.size());
+    Msg::Debug("Computing mesh size field at mesh vertices", edgesToRecover.size());
     for(int i = 0; i < doc.numPoints; i++){
       MVertex *here = (MVertex *)doc.points[i].data;
       int num = here->getNum();
@@ -655,10 +655,10 @@ bool gmsh2DMeshGenerator(GFace *gf, int RECUR_ITER, bool debug = true)
 
   int nb_swap;
   // outputScalarField(m->triangles, "beforeswop.pos",1);
-  Msg(DEBUG1, "Delaunizing the initial mesh");
+  Msg::Debug("Delaunizing the initial mesh");
   gmshDelaunayizeBDS(gf, *m, nb_swap);
   // outputScalarField(m->triangles, "afterswop.pos",0)
-  Msg(DEBUG1, "Starting to add internal points");
+  Msg::Debug("Starting to add internal points");
 
   // start mesh generation
   if(!AlgoDelaunay2D(gf)){
@@ -847,7 +847,7 @@ bool buildConsecutiveListOfVertices(GFace *gf, GEdgeLoop  &gel,
          if (seam && seam_the_first){
            coords = ((*it)._sign == 1) ? mesh1d_seam : mesh1d_seam_reversed;
            found = (*it);
-           Msg(INFO, "This test case would have failed in Previous Gmsh Version ;-)");
+           Msg::Info("This test case would have failed in Previous Gmsh Version ;-)");
          }
          else{
            coords = ((*it)._sign == 1) ? mesh1d : mesh1d_reversed;
@@ -1025,7 +1025,7 @@ bool gmsh2DMeshGeneratorPeriodic(GFace *gf, bool debug = true)
                                                  recover_map , nbPointsLocal, nbPointsTotal,
                                                  1.e-3 * LC2D)){
                 gf->meshStatistics.status = GFace::FAILED;
-                Msg(GERROR, "The 1D Mesh seems not to be forming a closed loop");
+                Msg::Error("The 1D Mesh seems not to be forming a closed loop");
                 m->scalingU = m->scalingV = 1.0;
                 return false;
               }
@@ -1082,7 +1082,7 @@ bool gmsh2DMeshGeneratorPeriodic(GFace *gf, bool debug = true)
     //   -) It does not necessary recover the boundaries
     //   -) It contains triangles outside the domain (the first edge
     //      loop is the outer one)
-    Msg(DEBUG1, "Meshing of the convex hull (%d points)", nbPointsTotal);
+    Msg::Debug("Meshing of the convex hull (%d points)", nbPointsTotal);
     doc.MakeMeshWithPoints();
     
     for(int i = 0; i < doc.numTriangles; i++){
@@ -1112,7 +1112,7 @@ bool gmsh2DMeshGeneratorPeriodic(GFace *gf, bool debug = true)
       BDS_Edge * e = m->recover_edge(edgeLoop_BDS[j]->iD, 
                                      edgeLoop_BDS[(j + 1) % edgeLoop_BDS.size()]->iD);
       if (!e){
-        Msg(GERROR, "impossible to recover the edge %d %d",
+        Msg::Error("Impossible to recover the edge %d %d",
             edgeLoop_BDS[j]->iD, edgeLoop_BDS[(j + 1) % edgeLoop_BDS.size()]->iD);
         gf->meshStatistics.status = GFace::FAILED;
         return false;
@@ -1121,7 +1121,7 @@ bool gmsh2DMeshGeneratorPeriodic(GFace *gf, bool debug = true)
     }
   }
 
-  // Msg(INFO, "Boundary Edges recovered for surface %d",gf->tag());
+  // Msg::Info("Boundary Edges recovered for surface %d",gf->tag());
   // Look for an edge that is on the boundary for which one of the two
   // neighbors has a negative number node. The other triangle is
   // inside the domain and, because all edges were recovered,
@@ -1317,26 +1317,26 @@ void meshGFace::operator() (GFace *gf)
   else 
     algo = "MeshAdapt+Delaunay";
 
-  Msg(STATUS2, "Meshing surface %d (%s, %s)", 
+  Msg::Status(2, true, "Meshing surface %d (%s, %s)", 
       gf->tag(), gf->getTypeString().c_str(), algo);
 
   // compute loops on the fly (indices indicate start and end points
   // of a loop; loops are not yet oriented)
-  Msg(DEBUG1, "Computing edge loops");
+  Msg::Debug("Computing edge loops");
   std::vector<MVertex*> points;
   std::vector<int> indices;
   computeEdgeLoops(gf, points, indices);
 
-  Msg(DEBUG1, "Generating the mesh");
+  Msg::Debug("Generating the mesh");
   if(noseam(gf) || gf->getNativeType() == GEntity::GmshModel || gf->edgeLoops.empty()){
     gmsh2DMeshGenerator(gf, 0, debugSurface >= 0 || debugSurface == -100);
   }
   else{
     if(!gmsh2DMeshGeneratorPeriodic(gf, debugSurface >= 0 || debugSurface == -100))
-      Msg(GERROR, "Impossible to mesh face %d", gf->tag());
+      Msg::Error("Impossible to mesh face %d", gf->tag());
   }
 
-  Msg(DEBUG1, "type %d %d triangles generated, %d internal vertices",
+  Msg::Debug("Type %d %d triangles generated, %d internal vertices",
       gf->geomType(), gf->triangles.size(), gf->mesh_vertices.size());
 }
 
@@ -1384,7 +1384,7 @@ void orientMeshGFace::operator()(GFace *gf)
   int sign = *ori.begin();
   MEdge ref(sign > 0 ? v1 : v2, sign > 0 ? v2 : v1);
   if(shouldRevert(ref, gf->triangles) || shouldRevert(ref, gf->quadrangles)){
-    Msg(DEBUG1, "Reverting orientation of mesh in face %d", gf->tag());
+    Msg::Debug("Reverting orientation of mesh in face %d", gf->tag());
     for(unsigned int i = 0; i < gf->triangles.size(); i++)
       gf->triangles[i]->revert();
     for(unsigned int i = 0; i < gf->quadrangles.size(); i++)
diff --git a/Mesh/meshGFaceBDS.cpp b/Mesh/meshGFaceBDS.cpp
index 4b235f242165a9b29b04a8ed01599cd5a80ce62f..6dfa3004fd5f64caa97fd52a55fd0b342a00c153 100644
--- a/Mesh/meshGFaceBDS.cpp
+++ b/Mesh/meshGFaceBDS.cpp
@@ -1,4 +1,4 @@
-// $Id: meshGFaceBDS.cpp,v 1.12 2008-04-01 12:47:10 geuzaine Exp $
+// $Id: meshGFaceBDS.cpp,v 1.13 2008-05-04 08:31:16 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -611,7 +611,7 @@ void gmshRefineMeshBDS(GFace *gf, BDS_Mesh &m, const int NIT,
     t_sm  += t6 - t5;
     m.cleanup();        
     IT++;
-    Msg(DEBUG1, " iter %3d minL %8.3f/%8.3f maxL %8.3f/%8.3f : "
+    Msg::Debug(" iter %3d minL %8.3f/%8.3f maxL %8.3f/%8.3f : "
         "%6d splits, %6d swaps, %6d collapses, %6d moves",
         IT, minL, minE, maxL, maxE, nb_split, nb_swap, nb_collaps, nb_smooth);
     if (nb_split == 0 && nb_collaps == 0) break;
@@ -619,16 +619,16 @@ void gmshRefineMeshBDS(GFace *gf, BDS_Mesh &m, const int NIT,
   
   double t_total = t_spl + t_sw + t_col + t_sm;
   if(!t_total) t_total = 1.e-6;
-  Msg(DEBUG1, " ---------------------------------------");
-  Msg(DEBUG1, " CPU Report ");
-  Msg(DEBUG1, " ---------------------------------------");
-  Msg(DEBUG1, " CPU SWAP    %12.5E sec (%3.0f %%)", t_sw,100 * t_sw / t_total);
-  Msg(DEBUG1, " CPU SPLIT   %12.5E sec (%3.0f %%) ", t_spl,100 * t_spl / t_total);
-  Msg(DEBUG1, " CPU COLLAPS %12.5E sec (%3.0f %%) ", t_col,100 * t_col / t_total);
-  Msg(DEBUG1, " CPU SMOOTH  %12.5E sec (%3.0f %%) ", t_sm,100 * t_sm / t_total);
-  Msg(DEBUG1, " ---------------------------------------");
-  Msg(DEBUG1, " CPU TOTAL   %12.5E sec ",t_total);
-  Msg(DEBUG1, " ---------------------------------------");
+  Msg::Debug(" ---------------------------------------");
+  Msg::Debug(" CPU Report ");
+  Msg::Debug(" ---------------------------------------");
+  Msg::Debug(" CPU SWAP    %12.5E sec (%3.0f %%)", t_sw,100 * t_sw / t_total);
+  Msg::Debug(" CPU SPLIT   %12.5E sec (%3.0f %%) ", t_spl,100 * t_spl / t_total);
+  Msg::Debug(" CPU COLLAPS %12.5E sec (%3.0f %%) ", t_col,100 * t_col / t_total);
+  Msg::Debug(" CPU SMOOTH  %12.5E sec (%3.0f %%) ", t_sm,100 * t_sm / t_total);
+  Msg::Debug(" ---------------------------------------");
+  Msg::Debug(" CPU TOTAL   %12.5E sec ",t_total);
+  Msg::Debug(" ---------------------------------------");
 }
 
 void allowAppearanceofEdge (BDS_Point *p1, BDS_Point *p2)
diff --git a/Mesh/meshGFaceDelaunayInsertion.cpp b/Mesh/meshGFaceDelaunayInsertion.cpp
index 2c1bebdeac2c849aa6a355dc4387b4c1f11b38a5..9286f3b2634377b2a12384e9c634dcb07cf03926 100644
--- a/Mesh/meshGFaceDelaunayInsertion.cpp
+++ b/Mesh/meshGFaceDelaunayInsertion.cpp
@@ -1,4 +1,4 @@
-// $Id: meshGFaceDelaunayInsertion.cpp,v 1.25 2008-04-17 09:07:01 remacle Exp $
+// $Id: meshGFaceDelaunayInsertion.cpp,v 1.26 2008-05-04 08:31:16 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -61,7 +61,7 @@ void circumCenterXY(double *p1, double *p2, double *p3, double *res)
 
   d = 2. * (double)(y1 * (x2 - x3) + y2 * (x3 - x1) + y3 * (x1 - x2));
   if(d == 0.0) {
-    Msg(WARNING, "Colinear points in circum circle computation");
+    Msg::Warning("Colinear points in circum circle computation");
     res[0] = res[1] = -99999.;
     return ;
   }
@@ -578,9 +578,9 @@ static void insertAPoint(GFace *gf,
   if (inside) {
     // we use here local coordinates as real coordinates
     // x,y and z will be computed hereafter
-    //	      Msg(INFO,"Point is inside");
+    // Msg::Info("Point is inside");
     GPoint p = gf->point(center[0], center[1]);
-    //    printf("the new point is %g %g\n",p.x(),p.y());
+    // printf("the new point is %g %g\n",p.x(),p.y());
     MVertex *v = new MFaceVertex(p.x(), p.y(), p.z(), gf, center[0], center[1]);
     v->setNum(Us.size());
     double lc1 = ((1. - uv[0] - uv[1]) * vSizes[ptin->tri()->getVertex(0)->getNum()] + 
@@ -595,7 +595,7 @@ static void insertAPoint(GFace *gf,
     
     if (!insertVertex(gf, v, center, worst, AllTris,ActiveTris, vSizes, vSizesBGM, 
 		      Us, Vs, metric)) {
-      Msg(DEBUG2,"2D Delaunay : a cavity is not star shaped");
+      Msg::Debug("2D Delaunay : a cavity is not star shaped");
       AllTris.erase(it);
       worst->forceRadius(-1);
       AllTris.insert(worst);		        
@@ -605,7 +605,7 @@ static void insertAPoint(GFace *gf,
       gf->mesh_vertices.push_back(v);
   }
   else {
-    Msg(DEBUG2,"Point %g %g is outside (%g %g , %g %g , %g %g) (metric %g %g %g)",
+    Msg::Debug("Point %g %g is outside (%g %g , %g %g , %g %g) (metric %g %g %g)",
 	center[0], center[1],
 	Us[base->getVertex(0)->getNum()], 
 	Vs[base->getVertex(0)->getNum()], 
@@ -634,7 +634,7 @@ void gmshBowyerWatson(GFace *gf)
   // _printTris ("before.pos", AllTris, Us,Vs);
   int nbSwaps = edgeSwapPass(gf, AllTris, SWCR_DEL, Us, Vs, vSizes, vSizesBGM);
   // _printTris ("after2.pos", AllTris, Us,Vs);
-  Msg(DEBUG2,"Delaunization of the initial mesh done (%d swaps)", nbSwaps);
+  Msg::Debug("Delaunization of the initial mesh done (%d swaps)", nbSwaps);
 
   int ITER = 0;
   while (1){
@@ -646,7 +646,7 @@ void gmshBowyerWatson(GFace *gf)
     }
     else{
       if(ITER++ % 5000 == 0)
-	Msg(DEBUG1,"%7d points created -- Worst tri radius is %8.3f",
+	Msg::Debug("%7d points created -- Worst tri radius is %8.3f",
 	    vSizes.size(), worst->getRadius());
       double center[2],metric[3],r2;
       if (worst->getRadius() < 0.5 * sqrt(2.0)) break;
@@ -715,7 +715,7 @@ void gmshBowyerWatsonFrontal(GFace *gf){
 
   // delaunise the initial mesh
   int nbSwaps = edgeSwapPass(gf, AllTris, SWCR_DEL, Us, Vs, vSizes, vSizesBGM);
-  Msg(DEBUG2,"Delaunization of the initial mesh done (%d swaps)", nbSwaps);
+  Msg::Debug("Delaunization of the initial mesh done (%d swaps)", nbSwaps);
   
   int ITER = 0, active_edge;
   // compute active triangle
@@ -735,7 +735,7 @@ void gmshBowyerWatsonFrontal(GFace *gf){
 
     if (!worst->isDeleted() && isActive(worst,LIMIT_,active_edge) && worst->getRadius() > LIMIT_){      
       if(ITER++ % 5000 == 0)
-	Msg(DEBUG1,"%7d points created -- Worst tri radius is %8.3f",
+	Msg::Debug("%7d points created -- Worst tri radius is %8.3f",
 	    vSizes.size(), worst->getRadius());
       // compute circum center of that guy
       double center[2],metric[3],r2;
@@ -808,7 +808,7 @@ void gmshBowyerWatsonFrontal(GFace *gf){
 
   // delaunise the initial mesh
   int nbSwaps = edgeSwapPass(gf, AllTris, SWCR_DEL, Us, Vs, vSizes, vSizesBGM);
-  Msg(DEBUG2,"Delaunization of the initial mesh done (%d swaps)", nbSwaps);
+  Msg::Debug("Delaunization of the initial mesh done (%d swaps)", nbSwaps);
   
 
   int ITER = 0, active_edge;
@@ -833,7 +833,7 @@ void gmshBowyerWatsonFrontal(GFace *gf){
       
       if (!worst->isDeleted() && isActive(worst,LIMIT_,active_edge) && worst->getRadius() > LIMIT_){      
 	if(ITER++ % 5000 == 0)
-	  Msg(DEBUG1,"%7d points created -- Worst tri radius is %8.3f",
+	  Msg::Debug("%7d points created -- Worst tri radius is %8.3f",
 	      vSizes.size(), worst->getRadius());
 	// compute circum center of that guy
 	double center[2],uv[2],metric[3],r2;
diff --git a/Mesh/meshGFaceExtruded.cpp b/Mesh/meshGFaceExtruded.cpp
index 846661baa4b2b6b3f3225fd4c88e1f60b66f37f6..4b944a9fd137e85837506ae3b56d7ccbf86c21d0 100644
--- a/Mesh/meshGFaceExtruded.cpp
+++ b/Mesh/meshGFaceExtruded.cpp
@@ -1,4 +1,4 @@
-// $Id: meshGFaceExtruded.cpp,v 1.28 2008-03-20 11:44:08 geuzaine Exp $
+// $Id: meshGFaceExtruded.cpp,v 1.29 2008-05-04 08:31:16 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -38,7 +38,7 @@ void createQuaTri(std::vector<MVertex*> &v, GFace *to,
   else if(v[0] == v[2] || v[2] == v[3])
     to->triangles.push_back(new MTriangle(v[0], v[1], v[3]));
   else if(v[0] == v[3] || v[1] == v[2])
-    Msg(GERROR, "Uncoherent extruded quadrangle in surface %d", to->tag());
+    Msg::Error("Uncoherent extruded quadrangle in surface %d", to->tag());
   else{
     if(ep->mesh.Recombine){
       to->quadrangles.push_back(new MQuadrangle(v[0], v[1], v[3], v[2]));
@@ -106,11 +106,11 @@ void extrudeMesh(GEdge *from, GFace *to,
           MVertex tmp(x[p], y[p], z[p], 0, -1);
           itp = pos.find(&tmp);
           if(itp == pos.end()){ // FIXME: workaround
-            Msg(INFO, "Linear search for (%.16g, %.16g, %.16g)", tmp.x(), tmp.y(), tmp.z());
+            Msg::Info("Linear search for (%.16g, %.16g, %.16g)", tmp.x(), tmp.y(), tmp.z());
             itp = tmp.linearSearch(pos);
           }
           if(itp == pos.end()){
-            Msg(GERROR, "Could not find extruded vertex (%.16g, %.16g, %.16g) in surface %d",
+            Msg::Error("Could not find extruded vertex (%.16g, %.16g, %.16g) in surface %d",
                 tmp.x(), tmp.y(), tmp.z(), to->tag());
             return;
           }
@@ -149,11 +149,11 @@ void copyMesh(GFace *from, GFace *to,
                   tmp.x(), tmp.y(), tmp.z());
       itp = pos.find(&tmp);
       if(itp == pos.end()){ // FIXME: workaround
-        Msg(INFO, "Linear search for (%.16g, %.16g, %.16g)", tmp.x(), tmp.y(), tmp.z());
+        Msg::Info("Linear search for (%.16g, %.16g, %.16g)", tmp.x(), tmp.y(), tmp.z());
         itp = tmp.linearSearch(pos);
       }
       if(itp == pos.end()) {
-        Msg(GERROR, "Could not find extruded vertex (%.16g, %.16g, %.16g) in surface %d",
+        Msg::Error("Could not find extruded vertex (%.16g, %.16g, %.16g) in surface %d",
             tmp.x(), tmp.y(), tmp.z(), to->tag());
         return;
       }
@@ -170,11 +170,11 @@ void copyMesh(GFace *from, GFace *to,
                   tmp.x(), tmp.y(), tmp.z());
       itp = pos.find(&tmp);
       if(itp == pos.end()){ // FIXME: workaround
-        Msg(INFO, "Linear search for (%.16g, %.16g, %.16g)", tmp.x(), tmp.y(), tmp.z());
+        Msg::Info("Linear search for (%.16g, %.16g, %.16g)", tmp.x(), tmp.y(), tmp.z());
         itp = tmp.linearSearch(pos);
       }
       if(itp == pos.end()) {
-        Msg(GERROR, "Could not find extruded vertex (%.16g, %.16g, %.16g) in surface %d", 
+        Msg::Error("Could not find extruded vertex (%.16g, %.16g, %.16g) in surface %d", 
             tmp.x(), tmp.y(), tmp.z(), to->tag());
         return;
       }
@@ -192,7 +192,7 @@ int MeshExtrudedSurface(GFace *gf,
   if(!ep || !ep->mesh.ExtrudeMesh)
     return 0;
 
-  Msg(STATUS2, "Meshing surface %d (extruded)", gf->tag());
+  Msg::Status(2, true, "Meshing surface %d (extruded)", gf->tag());
 
   // build a set with all the vertices on the boundary of the face gf
   double old_tol = MVertexLessThanLexicographic::tolerance; 
@@ -219,7 +219,7 @@ int MeshExtrudedSurface(GFace *gf,
     // surface is extruded from a curve
     GEdge *from = gf->model()->getEdgeByTag(std::abs(ep->geo.Source));
     if(!from){
-      Msg(GERROR, "Unknown source curve %d for extrusion", ep->geo.Source);
+      Msg::Error("Unknown source curve %d for extrusion", ep->geo.Source);
       return 0;
     }
     extrudeMesh(from, gf, pos, constrainedEdges);
@@ -228,7 +228,7 @@ int MeshExtrudedSurface(GFace *gf,
     // surface is a copy of another surface (the "top" of the extrusion)
     GFace *from = gf->model()->getFaceByTag(std::abs(ep->geo.Source));
     if(!from){ 
-      Msg(GERROR, "Unknown source surface %d for extrusion", ep->geo.Source);
+      Msg::Error("Unknown source surface %d for extrusion", ep->geo.Source);
       return 0;
     }
     copyMesh(from, gf, pos);
diff --git a/Mesh/meshGFaceTransfinite.cpp b/Mesh/meshGFaceTransfinite.cpp
index fd6bc01b4a4410d23ae50d4ed094391ad4797a56..7358e05a574f65fa29226461582eb8ded22102ef 100644
--- a/Mesh/meshGFaceTransfinite.cpp
+++ b/Mesh/meshGFaceTransfinite.cpp
@@ -1,4 +1,4 @@
-// $Id: meshGFaceTransfinite.cpp,v 1.26 2008-03-20 11:44:09 geuzaine Exp $
+// $Id: meshGFaceTransfinite.cpp,v 1.27 2008-05-04 08:31:16 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -55,7 +55,7 @@ int MeshTransfiniteSurface(GFace *gf)
 {
   if(gf->meshAttributes.Method != TRANSFINI) return 0;
 
-  Msg(STATUS2, "Meshing surface %d (transfinite)", gf->tag());
+  Msg::Status(2, true, "Meshing surface %d (transfinite)", gf->tag());
 
   std::vector <MVertex *> corners, d_vertices;
   std::vector <int> indices;
@@ -66,12 +66,12 @@ int MeshTransfiniteSurface(GFace *gf)
   computeEdgeLoops(gf, d_vertices, indices);
 
   if(corners.size () != 3 && corners.size () != 4){
-    Msg(GERROR,"Surface %d is transfinite but has %d corners",
+    Msg::Error("Surface %d is transfinite but has %d corners",
         gf->tag(), corners.size());
     return 0;
   }
   if(indices.size () != 2){
-    Msg(GERROR,"Surface %d is transfinite but has %d holes",
+    Msg::Error("Surface %d is transfinite but has %d holes",
         gf->tag(), indices.size() - 2);
     return 0;
   }
@@ -117,7 +117,7 @@ int MeshTransfiniteSurface(GFace *gf)
        (corners.size() == 4 && v == corners[3])){
       N[iCorner++] = i;   
       if(iCorner > 4){
-        Msg(GERROR,"Surface %d transfinite parameters are incoherent", gf->tag());
+        Msg::Error("Surface %d transfinite parameters are incoherent", gf->tag());
         return 0;
       }
     }
@@ -155,7 +155,7 @@ int MeshTransfiniteSurface(GFace *gf)
     int Lb = N4 - N3;
     int Hb = m_vertices.size() - N4;
     if(Lb != L || Hb != H){
-      Msg(GERROR,"Surface %d cannot be meshed using the transfinite algo", 
+      Msg::Error("Surface %d cannot be meshed using the transfinite algo", 
           gf->tag());
       return 0;
     }
@@ -163,7 +163,7 @@ int MeshTransfiniteSurface(GFace *gf)
   else{
     int Lb = m_vertices.size() - N3;      
     if(Lb != L){
-      Msg(GERROR,"Surface %d cannot be meshed using the transfinite algo %d != %d", 
+      Msg::Error("Surface %d cannot be meshed using the transfinite algo %d != %d", 
           gf->tag(), L, Lb);
       return 0;
     }      
diff --git a/Mesh/meshGRegion.cpp b/Mesh/meshGRegion.cpp
index 11646ceb5ec0d60324aa0cf92fe00ce9dd495f90..335240ec207d0bde913426bcec0e3e6dbed67350 100644
--- a/Mesh/meshGRegion.cpp
+++ b/Mesh/meshGRegion.cpp
@@ -1,4 +1,4 @@
-// $Id: meshGRegion.cpp,v 1.45 2008-03-20 11:44:09 geuzaine Exp $
+// $Id: meshGRegion.cpp,v 1.46 2008-05-04 08:31:16 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -125,8 +125,8 @@ void TransferTetgenMesh(GRegion *gr, tetgenio &in, tetgenio &out,
     numberedV.push_back(v);
   }
  
-  Msg(INFO,"%d points %d edges and %d faces in the final mesh",
-      out.numberofpoints, out.numberofedges, out.numberoftrifaces);
+  Msg::Info("%d points %d edges and %d faces in the final mesh",
+	    out.numberofpoints, out.numberofedges, out.numberoftrifaces);
 
   // Tetgen modifies both surface & edge mesh, so we need to re-create
   // everything
@@ -190,11 +190,11 @@ void MeshDelaunayVolume(std::vector<GRegion*> &regions)
   if(regions.empty()) return;
 
 #if !defined(HAVE_TETGEN)
-  Msg(GERROR, "Tetgen is not compiled in this version of Gmsh");
+  Msg::Error("Tetgen is not compiled in this version of Gmsh");
 #else
 
   for(unsigned int i = 0; i < regions.size(); i++)
-    Msg(STATUS2, "Meshing volume %d (Tetgen+Delaunay)", regions[i]->tag());
+    Msg::Status(2, true, "Meshing volume %d (Tetgen+Delaunay)", regions[i]->tag());
 
   // put all the faces in the same model
   GRegion *gr = regions[0];
@@ -217,19 +217,20 @@ void MeshDelaunayVolume(std::vector<GRegion*> &regions)
     std::vector<MVertex*> numberedV;
     char opts[128];
     buildTetgenStructure(gr, in, numberedV);
-    sprintf(opts, "pe%c", (CTX.verbosity < 3) ? 'Q': (CTX.verbosity > 6)? 'V': '\0');
+    sprintf(opts, "pe%c", 
+	    (Msg::GetVerbosity() < 3) ? 'Q': (Msg::GetVerbosity() > 6)? 'V': '\0');
     try{
       tetrahedralize(opts, &in, &out);
     }
     catch (int error){
-      Msg (WARNING, "Self intersecting Surface Mesh, computing intersections "
-           "(this could take a while)");
+      Msg::Error("Self intersecting surface mesh, computing intersections "
+		 "(this could take a while)");
       sprintf(opts, "dV");
       try{
         tetrahedralize(opts, &in, &out);
-        Msg(INFO,"%d faces self-intersect",out.numberoftrifaces);
+        Msg::Info("%d faces self-intersect", out.numberoftrifaces);
         for (int i = 0; i < out.numberoftrifaces; i++){
-          Msg(INFO,"face (%d %d %d) on model face %d",
+          Msg::Info("face (%d %d %d) on model face %d",
               numberedV[out.trifacelist[i * 3 + 0] - 1]->getNum(),
               numberedV[out.trifacelist[i * 3 + 1] - 1]->getNum(),
               numberedV[out.trifacelist[i * 3 + 2] - 1]->getNum(),
@@ -237,7 +238,7 @@ void MeshDelaunayVolume(std::vector<GRegion*> &regions)
         }
       }
       catch (int error2){
-        Msg(GERROR, "Surface Mesh is wrong, cannot do the 3D mesh");      
+        Msg::Error("Surface mesh is wrong, cannot do the 3D mesh");
       }
       gr->set(faces);
       return;
@@ -258,7 +259,7 @@ void MeshDelaunayVolume(std::vector<GRegion*> &regions)
 
   // now do insertion of points
   insertVerticesInRegion(gr);
-  Msg(INFO, "Gmsh 3D Delaunay has generated %d tets", gr->tetrahedra.size());
+  Msg::Info("Gmsh 3D Delaunay has generated %d tets", gr->tetrahedra.size());
 #endif
 }
 
@@ -419,8 +420,6 @@ int intersect_line_triangle(double X[3], double Y[3], double Z[3] ,
   if(!sys3x3_with_tol(mat, b, res, &det))
     return 0;
 
-  // Msg(INFO, "going there %g %g %g", res[0], res[1], res[2]);
-
   if(res[0] >= eps_prec && res[0] <= 1.0 - eps_prec && 
      res[1] >= eps_prec && res[1] <= 1.0 - eps_prec && 
      1 - res[0] - res[1] >= eps_prec && 1 - res[0] - res[1] <= 1.0 - eps_prec){
@@ -491,7 +490,7 @@ void meshNormalsPointOutOfTheRegion(GRegion *gr)
         }
         ++it_b;
       }
-      Msg(INFO,"Region %d Face %d, %d intersect", gr->tag(), gf->tag(), nb_intersect);
+      Msg::Info("Region %d Face %d, %d intersect", gr->tag(), gf->tag(), nb_intersect);
       if(nb_intersect >= 0) break; // negative value means intersection is not "robust"
     }
     
@@ -540,7 +539,7 @@ void meshGRegion::operator() (GRegion *gr)
   // sanity check
   for(std::list<GFace*>::iterator it = faces.begin(); it != faces.end(); it++){
     if((*it)->quadrangles.size()){
-      Msg(GERROR, "Cannot tetrahedralize volume with quadrangles on boundary");
+      Msg::Error("Cannot tetrahedralize volume with quadrangles on boundary");
       return;
     }
   }
@@ -550,9 +549,9 @@ void meshGRegion::operator() (GRegion *gr)
   }
   else if(CTX.mesh.algo3d == ALGO_3D_NETGEN ){
 #if !defined(HAVE_NETGEN)
-    Msg(GERROR, "Netgen is not compiled in this version of Gmsh");
+    Msg::Error("Netgen is not compiled in this version of Gmsh");
 #else
-    Msg(STATUS2, "Meshing volume %d (Netgen)", gr->tag());
+    Msg::Status(2, true, "Meshing volume %d (Netgen)", gr->tag());
     // orient the triangles of with respect to this region
     meshNormalsPointOutOfTheRegion(gr);
     std::vector<MVertex*> numberedV;
@@ -578,9 +577,9 @@ void optimizeMeshGRegionNetgen::operator() (GRegion *gr)
   if(ep && ep->mesh.ExtrudeMesh && ep->geo.Mode == EXTRUDED_ENTITY) return;
   
 #if !defined(HAVE_NETGEN)
-  Msg(GERROR, "Netgen is not compiled in this version of Gmsh");
+  Msg::Error("Netgen is not compiled in this version of Gmsh");
 #else
-  Msg(STATUS2, "Optimizing volume %d", gr->tag());
+  Msg::Status(2, true, "Optimizing volume %d", gr->tag());
   // import mesh into netgen, including volume tets
   std::vector<MVertex*> numberedV;
   Ng_Mesh *ngmesh = buildNetgenStructure(gr, true, numberedV);
@@ -607,10 +606,8 @@ void optimizeMeshGRegionGmsh::operator() (GRegion *gr)
   ExtrudeParams *ep = gr->meshAttributes.extrude;
   if(ep && ep->mesh.ExtrudeMesh && ep->geo.Mode == EXTRUDED_ENTITY) return;
   
-  Msg(STATUS2, "Optimizing volume %d", gr->tag());
-  // import mesh into netgen, including volume tets
-  
-  gmshOptimizeMesh (gr, QMTET_2);  
+  Msg::Status(2, true, "Optimizing volume %d", gr->tag());
+  gmshOptimizeMesh(gr, QMTET_2);  
 }
 
 bool buildFaceSearchStructure(GModel *model, fs_cont &search)
diff --git a/Mesh/meshGRegionCarveHole.cpp b/Mesh/meshGRegionCarveHole.cpp
index cce32c05e39584c799c4069a43a9cd6eb70df163..e8b8051898be75ee8c14bc55525e58dd325104ac 100644
--- a/Mesh/meshGRegionCarveHole.cpp
+++ b/Mesh/meshGRegionCarveHole.cpp
@@ -1,4 +1,4 @@
-// $Id: meshGRegionCarveHole.cpp,v 1.7 2008-03-20 11:44:09 geuzaine Exp $
+// $Id: meshGRegionCarveHole.cpp,v 1.8 2008-05-04 08:31:16 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -28,7 +28,7 @@
 
 void carveHole(GRegion *gr, int num, double distance, std::vector<int> &surfaces)
 {
-  Msg(GERROR, "Gmsh must be compiled with ANN support to carve holes in meshes");
+  Msg::Error("Gmsh must be compiled with ANN support to carve holes in meshes");
 }
 
 #else
@@ -80,7 +80,7 @@ void addFaces(std::vector<T*> &elements, std::set<MFace, Less_Face> &faces)
 
 void carveHole(GRegion *gr, int num, double distance, std::vector<int> &surfaces)
 {
-  Msg(INFO, "Carving hole %d from surface %d at distance %g", num, surfaces[0], distance);
+  Msg::Info("Carving hole %d from surface %d at distance %g", num, surfaces[0], distance);
   GModel *m = gr->model();
 
   // add all points from carving surfaces into kdtree
@@ -88,7 +88,7 @@ void carveHole(GRegion *gr, int num, double distance, std::vector<int> &surfaces
   for(unsigned int i = 0; i < surfaces.size(); i++){
     GFace *gf = m->getFaceByTag(surfaces[i]);
     if(!gf){
-      Msg(GERROR, "Unknown carving surface %d", surfaces[i]);
+      Msg::Error("Unknown carving surface %d", surfaces[i]);
       return;
     }
     numnodes += gf->mesh_vertices.size();
diff --git a/Mesh/meshGRegionDelaunayInsertion.cpp b/Mesh/meshGRegionDelaunayInsertion.cpp
index 0091f290a59119f0955bdd835112a2447670f43b..c54ea14bac9007b4f2559cb62f50d6b4021bb6d6 100644
--- a/Mesh/meshGRegionDelaunayInsertion.cpp
+++ b/Mesh/meshGRegionDelaunayInsertion.cpp
@@ -1,4 +1,4 @@
-// $Id: meshGRegionDelaunayInsertion.cpp,v 1.43 2008-03-20 11:44:09 geuzaine Exp $
+// $Id: meshGRegionDelaunayInsertion.cpp,v 1.44 2008-05-04 08:31:16 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -104,7 +104,7 @@ void recurFindCavity(std::list<faceXtet> & shell,
                      MVertex *v , 
                      MTet4 *t)
 {
-  // Msg(INFO,"tet %d %d %d %d",t->tet()->getVertex(0)->getNum(),
+  // Msg::Info("tet %d %d %d %d",t->tet()->getVertex(0)->getNum(),
   //     t->tet()->getVertex(1)->getNum(),
   //     t->tet()->getVertex(2)->getNum(),
   //     t->tet()->getVertex(3)->getNum());
@@ -144,7 +144,7 @@ bool insertVertex(MVertex *v,
 
   recurFindCavity(shell, cavity, v, t);  
 
-  // Msg(INFO,"%d %d",cavity.size(),NC);
+  // Msg::Info("%d %d",cavity.size(),NC);
   // if (NC != cavity.size())throw;
 
   // check that volume is conserved
@@ -177,7 +177,7 @@ bool insertVertex(MVertex *v,
     }
 //   fprintf(ff2,"};\n");
 //   fclose(ff2);
-//  Msg(INFO,"cavity of size %d volume %g",cavity.size(),oldVolume);
+//  Msg::Info("cavity of size %d volume %g",cavity.size(),oldVolume);
   // create new tetrahedron using faces that are
   // on the border of the cavity
   // add those to a list
@@ -197,7 +197,7 @@ bool insertVertex(MVertex *v,
 
   while (it != shell.end()){
     MTetrahedron *tr = new MTetrahedron(it->v[0], it->v[1], it->v[2], v);
-    //      Msg(INFO,"shell %d %d %d",it->v[0]->getNum(),it->v[1]->getNum(),it->v[2]->getNum());
+    //      Msg::Info("shell %d %d %d",it->v[0]->getNum(),it->v[1]->getNum(),it->v[2]->getNum());
 //            fprintf(ff,"ST(%g,%g,%g,%g,%g,%g,%g,%g,%g) {0,0,0};\n",
 //                 it->v[0]->x(),
 //                 it->v[0]->y(),
@@ -227,7 +227,7 @@ bool insertVertex(MVertex *v,
     }
 //   fprintf(ff,"};\n");
 //   fclose (ff);
-//  Msg(INFO,"new cavity of vol %g (%d boundaries)",newVolume,shell.size());
+//  Msg::Info("new cavity of vol %g (%d boundaries)",newVolume,shell.size());
   // OK, the cavity is star shaped
   if (fabs(oldVolume - newVolume) < 1.e-10 * oldVolume){      
     connectTets(new_cavity.begin(), new_cavity.end());      
@@ -324,7 +324,7 @@ void recur_classify(MTet4 *t, std::list<MTet4*> &theRegion,
                     std::set<GFace*> &faces_bound, GRegion *bidon,
                     GModel *model, const fs_cont &search)
 {
-  if (!t) Msg (GERROR,"a tet is not connected by a boundary face");
+  if (!t) Msg::Error("a tet is not connected by a boundary face");
   if (t->onWhat()) return; // should never return here...
   theRegion.push_back(t);
   t->setOnWhat(bidon);
@@ -398,12 +398,12 @@ void adaptMeshGRegion::operator () (GRegion *gr)
         }                     
       }
     }
-    Msg(INFO,"Adaptation : START with %12.5E QBAD %12.5E QAVG %12.5E",
+    Msg::Info("Adaptation : START with %12.5E QBAD %12.5E QAVG %12.5E",
         totalVolumeb, worst, avg / count);
     for (int i = 0; i < nbRanges; i++){
       double low  = (double)i / nbRanges;
       double high = (double)(i + 1) / nbRanges;
-      Msg(INFO,"Opti : %3.2f < QUAL < %3.2f : %9d elements ",
+      Msg::Info("Opti : %3.2f < QUAL < %3.2f : %9d elements ",
           low, high, quality_ranges[i]);
     }                 
   }    
@@ -506,7 +506,7 @@ void adaptMeshGRegion::operator () (GRegion *gr)
       }
     }
     double t2 = Cpu();
-    Msg(INFO,"Opti : (%d,%d,%d) = %12.5E QBAD %12.5E QAVG %12.5E (%8.3f sec)",
+    Msg::Info("Opti : (%d,%d,%d) = %12.5E QBAD %12.5E QAVG %12.5E (%8.3f sec)",
         nbESwap, nbFSwap, nbReloc, totalVolumeb, worst, avg / count, t2 - t1);
     break;
   }
@@ -516,17 +516,17 @@ void adaptMeshGRegion::operator () (GRegion *gr)
     if(!(illegals[i]->isDeleted())) nbSlivers++;
   
   if (nbSlivers){
-    Msg(INFO,"Opti : %d illegal tets are still in the mesh, trying to remove them",
+    Msg::Info("Opti : %d illegal tets are still in the mesh, trying to remove them",
         nbSlivers);
   }
   else{
-    Msg(INFO,"Opti : no illegal tets in the mesh ;-)", nbSlivers);
+    Msg::Info("Opti : no illegal tets in the mesh ;-)", nbSlivers);
   }
 
   for (int i = 0; i < nbRanges ;i++){
     double low  = (double)i / nbRanges;
     double high = (double)(i + 1) / nbRanges;
-    Msg(INFO,"Opti : %3.2f < QUAL < %3.2f : %9d elements",
+    Msg::Info("Opti : %3.2f < QUAL < %3.2f : %9d elements",
         low, high, quality_ranges[i]);
   }                   
   
@@ -581,12 +581,12 @@ void gmshOptimizeMesh(GRegion *gr, const gmshQualityMeasure4Tet &qm)
         }                     
       }
     }
-    Msg(INFO,"Opti : START with %12.5E QBAD %12.5E QAVG %12.5E",
+    Msg::Info("Opti : START with %12.5E QBAD %12.5E QAVG %12.5E",
         totalVolumeb, worst, avg / count);
     for (int i = 0; i < nbRanges; i++){
       double low  = (double)i / nbRanges;
       double high = (double)(i + 1) / nbRanges;
-      Msg(INFO,"Opti : %3.2f < QUAL < %3.2f : %9d elements",
+      Msg::Info("Opti : %3.2f < QUAL < %3.2f : %9d elements",
           low, high, quality_ranges[i]);
     }                 
   }    
@@ -645,7 +645,7 @@ void gmshOptimizeMesh(GRegion *gr, const gmshQualityMeasure4Tet &qm)
             nbSliversWeCanDoSomething++;
           nbSlivers++;
         }
-      Msg(INFO, "Opti : %d Sliver Removals", nbSliversWeCanDoSomething);
+      Msg::Info("Opti : %d Sliver Removals", nbSliversWeCanDoSomething);
     }
     
     if (!newTets.size()){
@@ -689,21 +689,21 @@ void gmshOptimizeMesh(GRegion *gr, const gmshQualityMeasure4Tet &qm)
       }
     }
     double t2 = Cpu();
-    Msg(INFO, "Opti : (%d,%d,%d) = %12.5E QBAD %12.5E QAVG %12.5E (%8.3f sec)",
+    Msg::Info("Opti : (%d,%d,%d) = %12.5E QBAD %12.5E QAVG %12.5E (%8.3f sec)",
         nbESwap, nbFSwap, nbReloc, totalVolumeb, worst, avg / count, t2 - t1);
   }
   
   if (illegals.size()){
-    Msg(INFO, "Opti : %d illegal tets are still in the mesh", illegals.size());
+    Msg::Info("Opti : %d illegal tets are still in the mesh", illegals.size());
   }
   else{
-    Msg(INFO, "Opti : no illegal tets in the mesh ;-)");
+    Msg::Info("Opti : no illegal tets in the mesh ;-)");
   }
 
   for (int i = 0; i < nbRanges; i++){
     double low  = (double)i / nbRanges;
     double high = (double)(i + 1) / nbRanges;
-    Msg(INFO,"Opti : %3.2f < QUAL < %3.2f : %9d elements",
+    Msg::Info("Opti : %3.2f < QUAL < %3.2f : %9d elements",
         low, high, quality_ranges[i]);
   }                   
 
@@ -749,7 +749,7 @@ void insertVerticesInRegion (GRegion *gr)
   connectTets(allTets.begin(), allTets.end());
 
   // classify the tets on the right region
-  // Msg (INFO,"reclassifying %d tets", allTets.size());
+  // Msg::Info("reclassifying %d tets", allTets.size());
 
   fs_cont search;
   buildFaceSearchStructure(gr->model(), search);
@@ -760,13 +760,13 @@ void insertVerticesInRegion (GRegion *gr)
       std::set<GFace *> faces_bound;
       GRegion *bidon = (GRegion*)123;
       double _t1 = Cpu();
-      Msg(DEBUG2,"start with a non classified tet");      
+      Msg::Debug("start with a non classified tet");      
       recur_classify(*it, theRegion, faces_bound, bidon, gr->model(), search);
       double _t2 = Cpu();
-      Msg(DEBUG2, "found %d tets with %d faces (%g sec for the classification)",
+      Msg::Debug("found %d tets with %d faces (%g sec for the classification)",
           theRegion.size(), faces_bound.size(), _t2 - _t1);
       GRegion *myGRegion = getRegionFromBoundingFaces(gr->model(), faces_bound);
-      // Msg (INFO,"a region is found %p",myGRegion);
+      // Msg::Info("a region is found %p",myGRegion);
       if(myGRegion) // a geometrical region associated to the list of faces has been found
         for(std::list<MTet4*>::iterator it2 = theRegion.begin(); 
             it2 != theRegion.end(); ++it2) (*it2)->setOnWhat(myGRegion);
@@ -784,7 +784,7 @@ void insertVerticesInRegion (GRegion *gr)
     (*it)->setNeigh(3, 0);
   }
   connectTets(allTets.begin(), allTets.end());
-  Msg(DEBUG,"All %d tets were connected", allTets.size());
+  Msg::Debug("All %d tets were connected", allTets.size());
 
   // here the classification should be done
 
@@ -792,7 +792,7 @@ void insertVerticesInRegion (GRegion *gr)
 
   while(1){
     if(allTets.empty()){
-      Msg(GERROR, "No tetrahedra in region %d", gr->tag());
+      Msg::Error("No tetrahedra in region %d", gr->tag());
       break;
     }
       
@@ -801,11 +801,11 @@ void insertVerticesInRegion (GRegion *gr)
     if(worst->isDeleted()){
       myFactory.Free(worst);
       allTets.erase(allTets.begin());
-      // Msg(INFO,"Worst tet is deleted");
+      // Msg::Info("Worst tet is deleted");
     }
     else{
       if(ITER++ %5000 == 0)
-        Msg(INFO, "%d points created -- Worst tet radius is %g",
+        Msg::Info("%d points created -- Worst tet radius is %g",
             vSizes.size(), worst->getRadius());
       if(worst->getRadius() < 1) break;
       double center[3];
@@ -851,7 +851,7 @@ void insertVerticesInRegion (GRegion *gr)
         else
           itd++;
       }
-      Msg(INFO,"cleaning up the memory %d -> %d", n1, allTets.size());
+      Msg::Info("cleaning up the memory %d -> %d", n1, allTets.size());
     }
   }
   
diff --git a/Mesh/meshGRegionExtruded.cpp b/Mesh/meshGRegionExtruded.cpp
index 4c18effc3ed2830b0e2b83e92d813a29c7e7497f..1e651d6f2e175d23ad30e2ede4fbc36a1aedc6eb 100644
--- a/Mesh/meshGRegionExtruded.cpp
+++ b/Mesh/meshGRegionExtruded.cpp
@@ -1,4 +1,4 @@
-// $Id: meshGRegionExtruded.cpp,v 1.24 2008-03-20 11:44:09 geuzaine Exp $
+// $Id: meshGRegionExtruded.cpp,v 1.25 2008-05-04 08:31:16 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -56,7 +56,7 @@ void createPriPyrTet(std::vector<MVertex*> &v, GRegion *to)
   }
   else {
     to->prisms.push_back(new MPrism(v));
-    if(j) Msg(GERROR, "Degenerated prism in extrusion of volume %d", to->tag());
+    if(j) Msg::Error("Degenerated prism in extrusion of volume %d", to->tag());
   }
 }
 
@@ -78,11 +78,11 @@ void createHexPri(std::vector<MVertex*> &v, GRegion *to)
     else if(dup[0] == 0 && dup[1] == 3)
       to->prisms.push_back(new MPrism(v[0], v[1], v[5], v[3], v[2], v[6]));
     else
-      Msg(GERROR, "Uncoherent hexahedron in extrusion of volume %d", to->tag());
+      Msg::Error("Uncoherent hexahedron in extrusion of volume %d", to->tag());
   }
   else {
     to->hexahedra.push_back(new MHexahedron(v));
-    if(j) Msg(GERROR, "Degenerated hexahedron in extrusion of volume %d", to->tag());
+    if(j) Msg::Error("Degenerated hexahedron in extrusion of volume %d", to->tag());
   }
 }
 
@@ -113,11 +113,11 @@ int getExtrudedVertices(MElement *ele, ExtrudeParams *ep, int j, int k,
     MVertex tmp(x[p], y[p], z[p], 0, -1);
     itp = pos.find(&tmp);
     if(itp == pos.end()){ // FIXME: workaround
-      Msg(INFO, "Linear search for (%.16g, %.16g, %.16g)", tmp.x(), tmp.y(), tmp.z());
+      Msg::Info("Linear search for (%.16g, %.16g, %.16g)", tmp.x(), tmp.y(), tmp.z());
       itp = tmp.linearSearch(pos);
     }
     if(itp == pos.end())
-      Msg(GERROR, "Could not find extruded vertex (%.16g, %.16g, %.16g)",
+      Msg::Error("Could not find extruded vertex (%.16g, %.16g, %.16g)",
           tmp.x(), tmp.y(), tmp.z());
     else
       verts.push_back(*itp);
@@ -199,7 +199,7 @@ void meshGRegionExtruded::operator() (GRegion *gr)
 
   if(!ep || !ep->mesh.ExtrudeMesh || ep->geo.Mode != EXTRUDED_ENTITY) return;
 
-  Msg(STATUS2, "Meshing volume %d (extruded)", gr->tag());
+  Msg::Status(2, true, "Meshing volume %d (extruded)", gr->tag());
 
   // destroy the mesh if it exists
   deMeshGRegion dem;
@@ -214,7 +214,7 @@ void meshGRegionExtruded::operator() (GRegion *gr)
   // volume is extruded from a surface
   GFace *from = gr->model()->getFaceByTag(std::abs(ep->geo.Source));
   if(!from){
-    Msg(GERROR, "Unknown source surface %d for extrusion", ep->geo.Source);
+    Msg::Error("Unknown source surface %d for extrusion", ep->geo.Source);
     return;
   }
 
@@ -435,7 +435,7 @@ int SubdivideExtrudedMesh(GModel *m)
 
   if(regions.empty()) return 0;
 
-  Msg(INFO, "Subdividing extruded mesh");
+  Msg::Info("Subdividing extruded mesh");
 
   // create edges on lateral sides of "prisms"
   std::set<std::pair<MVertex*, MVertex*> > edges;
@@ -449,10 +449,10 @@ int SubdivideExtrudedMesh(GModel *m)
     swap = 0;
     for(unsigned int i = 0; i < regions.size(); i++)
       phase2(regions[i], pos, edges, edges_swap, swap);
-    Msg(INFO, "Swapping %d", swap);
+    Msg::Info("Swapping %d", swap);
     if(j && j == swap) {
-      Msg(GERROR, "Unable to subdivide extruded mesh: change surface mesh or");
-      Msg(GERROR, "recombine extrusion instead");
+      Msg::Error("Unable to subdivide extruded mesh: change surface mesh or");
+      Msg::Error("recombine extrusion instead");
       return -1;
     }
     j = swap;
@@ -484,7 +484,7 @@ int SubdivideExtrudedMesh(GModel *m)
     if(ep && ep->mesh.ExtrudeMesh && ep->geo.Mode == EXTRUDED_ENTITY && 
        !ep->mesh.Recombine){
       GFace *gf = *it;
-      Msg(INFO, "Remeshing surface %d", gf->tag());
+      Msg::Info("Remeshing surface %d", gf->tag());
       for(unsigned int i = 0; i < gf->triangles.size(); i++) 
         delete gf->triangles[i];
       gf->triangles.clear();
diff --git a/Mesh/meshGRegionLocalMeshMod.cpp b/Mesh/meshGRegionLocalMeshMod.cpp
index d1c2e819aab46e95b4805a3dd4f403a1e958b39a..431eb6c3c3be2c1e0cb55d10a95ecfff4af95ae5 100644
--- a/Mesh/meshGRegionLocalMeshMod.cpp
+++ b/Mesh/meshGRegionLocalMeshMod.cpp
@@ -1,4 +1,4 @@
-// $Id: meshGRegionLocalMeshMod.cpp,v 1.12 2008-03-20 11:44:09 geuzaine Exp $
+// $Id: meshGRegionLocalMeshMod.cpp,v 1.13 2008-05-04 08:31:16 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -99,7 +99,7 @@ bool gmshBuildEdgeCavity(MTet4 *t,
     else if (faces[iFace2][0] == edges[5-iLocalEdge][K] ||
              faces[iFace2][1] == edges[5-iLocalEdge][K] ||
              faces[iFace2][2] == edges[5-iLocalEdge][K] ) iFace = iFace2;
-    else { Msg(GERROR, "Error of connexion"); throw; }
+    else { Msg::Error("Error of connexion"); throw; }
     t=t->getNeigh(iFace);
     if (!t) return false;
     if (t->isDeleted()) throw;
@@ -116,7 +116,7 @@ bool gmshBuildEdgeCavity(MTet4 *t,
       }
     }  
     if (iLocalEdge == -1){
-      Msg(GERROR, "loc = %d", iLocalEdge);
+      Msg::Error("loc = %d", iLocalEdge);
       throw;
     }
   }
@@ -456,7 +456,7 @@ void gmshBuildVertexCavity_recur(MTet4 *t,
 {
   // if (recur > 20)printf("oufti %d\n",recur);
   if(t->isDeleted()){
-    Msg(FATAL,"a deleted triangle is a neighbor of a non deleted triangle");
+    Msg::Fatal("a deleted triangle is a neighbor of a non deleted triangle");
   }
   int iV = -1;
   for (int i = 0; i < 4; i++){
@@ -466,7 +466,7 @@ void gmshBuildVertexCavity_recur(MTet4 *t,
     }
   }
   if (iV == -1){
-    Msg(FATAL, "trying to build a cavity of tets for a vertex that does not "
+    Msg::Fatal("trying to build a cavity of tets for a vertex that does not "
         "belong to this tet");
   }
   for (int i = 0; i < 3; i++){
diff --git a/Mesh/meshGRegionTransfinite.cpp b/Mesh/meshGRegionTransfinite.cpp
index 44f80f1b9e3f0000d30a44638f83e04e890f6497..69aea648f880d685a4d19961c661499c9986a7ea 100644
--- a/Mesh/meshGRegionTransfinite.cpp
+++ b/Mesh/meshGRegionTransfinite.cpp
@@ -1,4 +1,4 @@
-// $Id: meshGRegionTransfinite.cpp,v 1.9 2008-03-20 11:44:09 geuzaine Exp $
+// $Id: meshGRegionTransfinite.cpp,v 1.10 2008-05-04 08:31:16 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -178,7 +178,7 @@ public:
     if(_LL <= 0) return;
     _HH = gf->transfinite_vertices[0].size() - 1;
     if(_HH <= 0) return;
-    Msg(DEBUG, "Face %d: L = %d  H = %d", gf->tag(), _LL, _HH);
+    Msg::Debug("Face %d: L = %d  H = %d", gf->tag(), _LL, _HH);
 
     // get the corners of the transfinite volume interpolation
     std::vector<MVertex*> s(8);
@@ -233,7 +233,7 @@ public:
         }
       }
     }
-    Msg(DEBUG, "Found face index %d  (permutation = %d)", _index, _permutation);
+    Msg::Debug("Found face index %d  (permutation = %d)", _index, _permutation);
     for(int i = 0; i <= _LL; i++)
       for(int j = 0; j <= _HH; j++)
         _list.push_back(_gf->transfinite_vertices[i][j]);
@@ -268,7 +268,7 @@ public:
     MVertex *v = 0;
     if(index >= 0 && index < (int)_list.size()) v = _list[index];
     if(index < 0 || index >= (int)_list.size() || !v){
-      Msg(GERROR, "Wrong index in transfinite mesh of surface %d: "
+      Msg::Error("Wrong index in transfinite mesh of surface %d: "
           "m=%d n=%d M=%d N=%d perm=%d", _gf->tag(), m, n, M, N, _permutation);
       return _list[0];
     }
@@ -280,11 +280,11 @@ int MeshTransfiniteVolume(GRegion *gr)
 {
   if(gr->meshAttributes.Method != TRANSFINI) return 0;
 
-  Msg(STATUS2, "Meshing volume %d (transfinite)", gr->tag());
+  Msg::Status(2, true, "Meshing volume %d (transfinite)", gr->tag());
 
   std::list<GFace*> faces = gr->faces();
   if(faces.size() != 5 && faces.size() != 6){
-    Msg(GERROR, "Transfinite algorithm only available for 5- and 6-face volumes");
+    Msg::Error("Transfinite algorithm only available for 5- and 6-face volumes");
     return 0;
   }
 
@@ -292,7 +292,7 @@ int MeshTransfiniteVolume(GRegion *gr)
   for(std::list<GFace*>::iterator it = faces.begin(); it != faces.end(); ++it){
     GOrientedTransfiniteFace f(*it, gr->meshAttributes.corners);
     if(f.index() < 0){
-      Msg(GERROR, "Incompatible surface %d in transfinite volume %d", 
+      Msg::Error("Incompatible surface %d in transfinite volume %d", 
           (*it)->tag(), gr->tag());
       return 0;
     }
@@ -474,7 +474,7 @@ int MeshTransfiniteVolume(GRegion *gr)
             gr->tetrahedra.push_back(CREATE_SIM_6);
           }
           else {
-            Msg(GERROR, "Wrong surface recombination in transfinite volume %d", gr->tag());
+            Msg::Error("Wrong surface recombination in transfinite volume %d", gr->tag());
             return 0;
           }
         }
@@ -514,7 +514,7 @@ int MeshTransfiniteVolume(GRegion *gr)
                                                     tab[1    ][j + 1][k    ]));
         }
         else {
-          Msg(GERROR, "Wrong surface recombination in transfinite volume %d", gr->tag());
+          Msg::Error("Wrong surface recombination in transfinite volume %d", gr->tag());
           return 0;
         }
       }
@@ -544,7 +544,7 @@ int MeshTransfiniteVolume(GRegion *gr)
             gr->tetrahedra.push_back(CREATE_SIM_6);
           }
           else {
-            Msg(GERROR, "Wrong surface recombination in transfinite volume %d", gr->tag());
+            Msg::Error("Wrong surface recombination in transfinite volume %d", gr->tag());
             return 0;
           }
         }
diff --git a/Numeric/Numeric.cpp b/Numeric/Numeric.cpp
index 36f115cfb266ac642a9f3c6ecffa2913e5d86a8a..feb975514a37612c890c3e632caa229ca6716dad 100644
--- a/Numeric/Numeric.cpp
+++ b/Numeric/Numeric.cpp
@@ -1,4 +1,4 @@
-// $Id: Numeric.cpp,v 1.40 2008-02-17 08:48:02 geuzaine Exp $
+// $Id: Numeric.cpp,v 1.41 2008-05-04 08:31:16 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -37,7 +37,7 @@
 void new_handler(const char *reason, const char *file, int line,
                  int gsl_errno)
 {
-  Msg(GERROR, "GSL: %s (%s, line %d)", reason, file, line);
+  Msg::Error("GSL: %s (%s, line %d)", reason, file, line);
 }
 
 int check_gsl()
@@ -45,14 +45,14 @@ int check_gsl()
   // check version
   int major, minor;
   if(!sscanf(gsl_version, "%d.%d", &major, &minor)){
-    Msg(FATAL, "Cannot retreive GSL version");
+    Msg::Fatal("Cannot retreive GSL version");
     return 0;
   }
   if(major < 1 || (major == 1 && minor < 2)) {
-    Msg(FATAL1, "Your GSL version (%d.%d.X) has a bug in the singular value",
+    Msg::Error("Your GSL version (%d.%d.X) has a bug in the singular value",
         major, minor);
-    Msg(FATAL2, "decomposition code. Please upgrade to version 1.2 or above.");
-    Msg(FATAL3, "You can download the GSL from http://sources.redhat.com/gsl/");
+    Msg::Error("decomposition code. Please upgrade to version 1.2 or above.");
+    Msg::Fatal("You can download the GSL from http://sources.redhat.com/gsl/");
     return 0;
   }
   // set new error handler
diff --git a/Numeric/NumericEmbedded.cpp b/Numeric/NumericEmbedded.cpp
index aa32eed9fdbc690b0cf57732bf67dbc73b12b21f..d325b35bd8bc55285e687b742a6ebc6f5e0755a3 100644
--- a/Numeric/NumericEmbedded.cpp
+++ b/Numeric/NumericEmbedded.cpp
@@ -1,4 +1,4 @@
-// $Id: NumericEmbedded.cpp,v 1.4 2008-03-20 11:44:09 geuzaine Exp $
+// $Id: NumericEmbedded.cpp,v 1.5 2008-05-04 08:31:16 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -87,7 +87,7 @@ int sys2x2(double mat[2][2], double b[2], double res[2])
   // TOLERANCE ! WARNING WARNING
   if(norm == 0.0 || fabs(det) / norm < 1.e-12) {
     if(norm)
-      Msg(DEBUG, "Assuming 2x2 matrix is singular (det/norm == %.16g)",
+      Msg::Debug("Assuming 2x2 matrix is singular (det/norm == %.16g)",
           fabs(det) / norm);
     res[0] = res[1] = 0.0;
     return 0;
@@ -169,7 +169,7 @@ int sys3x3_with_tol(double mat[3][3], double b[3], double res[3], double *det)
   // TOLERANCE ! WARNING WARNING
   if(norm == 0.0 || fabs(*det) / norm < 1.e-12) {
     if(norm)
-      Msg(DEBUG, "Assuming 3x3 matrix is singular (det/norm == %.16g)",
+      Msg::Debug("Assuming 3x3 matrix is singular (det/norm == %.16g)",
           fabs(*det) / norm);
     res[0] = res[1] = res[2] = 0.0;
     return 0;
@@ -204,7 +204,7 @@ double inv2x2(double mat[2][2], double inv[2][2])
     inv[1][1] =  mat[0][0] * ud;
   }
   else{
-    Msg(GERROR, "Singular matrix");
+    Msg::Error("Singular matrix");
     for(int i = 0; i < 2; i++)
       for(int j = 0; j < 2; j++)
         inv[i][j] = 0.;
@@ -228,7 +228,7 @@ double inv3x3(double mat[3][3], double inv[3][3])
     inv[2][2] =  (mat[0][0] * mat[1][1] - mat[0][1] * mat[1][0]) * ud;
   }
   else{
-    Msg(GERROR, "Singular matrix");
+    Msg::Error("Singular matrix");
     for(int i = 0; i < 3; i++)
       for(int j = 0; j < 3; j++)
         inv[i][j] = 0.;
@@ -401,7 +401,7 @@ void FindCubicRoots(const double coef[4], double real[3], double imag[3])
   double d = coef[0];
 
   if(!a || !d){
-    Msg(GERROR, "Degenerate cubic: use a second degree solver!");
+    Msg::Error("Degenerate cubic: use a second degree solver!");
     return;
   }
 
diff --git a/Numeric/gsl_brent.cpp b/Numeric/gsl_brent.cpp
index fccb5d066666425adc5903674f6c29163129234e..2863f6fd43bfa9b851502600a02631029a398e58 100644
--- a/Numeric/gsl_brent.cpp
+++ b/Numeric/gsl_brent.cpp
@@ -1,4 +1,4 @@
-// $Id: gsl_brent.cpp,v 1.19 2008-03-20 11:44:09 geuzaine Exp $
+// $Id: gsl_brent.cpp,v 1.20 2008-05-04 08:31:16 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -92,7 +92,7 @@ double brent(double ax, double bx, double cx,
   while(status == GSL_CONTINUE && iter < MAXITER);
 
   if(status != GSL_SUCCESS)
-    Msg(GERROR, "MIN1D not converged: f(%g) = %g", b, fn1(b, NULL));
+    Msg::Error("MIN1D not converged: f(%g) = %g", b, fn1(b, NULL));
 
   *xmin = b;
   gsl_min_fminimizer_free(s);
diff --git a/Numeric/gsl_min.cpp b/Numeric/gsl_min.cpp
index 80b6cc703c9d5a0092e5472ec21ee1ce92cb2617..9d434d1585cad460511d5d38bbf346a4a7aa034d 100644
--- a/Numeric/gsl_min.cpp
+++ b/Numeric/gsl_min.cpp
@@ -1,4 +1,4 @@
-// $Id: gsl_min.cpp,v 1.6 2008-03-20 11:44:09 geuzaine Exp $
+// $Id: gsl_min.cpp,v 1.7 2008-05-04 08:31:16 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -258,7 +258,7 @@ void minimize_2 ( double (*f) (double, double, void *data),
                   void *data,int niter,
                   double &U, double &V, double &res)
 {
-  Msg(GERROR, "Gmsh must be compiled with GSL support for minimize_2");
+  Msg::Error("Gmsh must be compiled with GSL support for minimize_2");
 }
 
 void minimize_3 ( double (*f) (double, double, double, void *data), 
@@ -266,7 +266,7 @@ void minimize_3 ( double (*f) (double, double, double, void *data),
                   void *data,int niter,
                   double &U, double &V, double &W, double &res)
 {
-  Msg(GERROR, "Gmsh must be compiled with GSL support for minimize_3");
+  Msg::Error("Gmsh must be compiled with GSL support for minimize_3");
 }
 
 void minimize_N (int N, 
@@ -275,7 +275,7 @@ void minimize_N (int N,
                  void *data,int niter,
                  double *, double &res)
 {
-  Msg(GERROR, "Gmsh must be compiled with GSL support for minimize_N");
+  Msg::Error("Gmsh must be compiled with GSL support for minimize_N");
 }
 
 #endif
diff --git a/Numeric/gsl_newt.cpp b/Numeric/gsl_newt.cpp
index 4285271cdadaa4137455e39a9c46ab706369f60c..b95233f5727f3cd4421ed30f9873f2ffa63b074d 100644
--- a/Numeric/gsl_newt.cpp
+++ b/Numeric/gsl_newt.cpp
@@ -1,4 +1,4 @@
-// $Id: gsl_newt.cpp,v 1.18 2008-02-17 08:48:02 geuzaine Exp $
+// $Id: gsl_newt.cpp,v 1.19 2008-05-04 08:31:16 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -66,7 +66,7 @@ int gslfunc(const gsl_vector * xx, void *params, gsl_vector * f)
 {
   convert_vector_from_gsl(xx, nru);
   (*nrfunc) (nrdim, nru, nrv);
-  // Msg(INFO, "f(%lf,%lf) = %lf %lf\n",nru[1],nru[2],nrv[1],nrv[2]);
+  // Msg::Info("f(%lf,%lf) = %lf %lf\n",nru[1],nru[2],nrv[1],nrv[2]);
   convert_vector_to_gsl(nrv, nrdim, f);
   return GSL_SUCCESS;
 }
@@ -86,7 +86,7 @@ void newt(double x[], int n, int *check,
   gsl_vector *xx = gsl_vector_alloc(n);
 
   if(n > MAX_DIM_NEWT - 1)
-    Msg(FATAL, "Maximum Newton dimension exceeded\n");
+    Msg::Fatal("Maximum Newton dimension exceeded\n");
   nrdim = n;
 
   nrfunc = func;
@@ -99,7 +99,7 @@ void newt(double x[], int n, int *check,
   do {
     iter++;
     status = gsl_multiroot_fsolver_iterate(s);
-    // Msg(INFO, "status %d %d %d %lf %lf\n",
+    // Msg::Info("status %d %d %d %lf %lf\n",
     //     status,n,iter,gsl_vector_get(s->x,0),gsl_vector_get(s->x,1));
     if(status)
       break;    // solver problem
@@ -111,7 +111,7 @@ void newt(double x[], int n, int *check,
     *check = 1; // problem !!!
   }
   else {
-    // Msg(INFO, "status %d %d %d %lf %lf\n",
+    // Msg::Info("status %d %d %d %lf %lf\n",
     //     status,n,iter,gsl_vector_get(s->x,0),gsl_vector_get(s->x,1));
     convert_vector_from_gsl(s->x, x);
     *check = 0; // converged
diff --git a/Parallel/Makefile b/Parallel/Makefile
deleted file mode 100644
index 3a772b10e548824f34ffa1dbdbb3bf921c9b44d1..0000000000000000000000000000000000000000
--- a/Parallel/Makefile
+++ /dev/null
@@ -1,58 +0,0 @@
-# $Id: Makefile,v 1.45 2008-04-23 23:00:39 geuzaine Exp $
-#
-# Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-# 
-# Please report all bugs and problems to <gmsh@geuz.org>.
-
-include ../variables
-
-LIB = ../lib/libGmshParallel${LIBEXT}
-
-INC = ${DASH}I../Common ${DASH}I../DataStr
-
-CFLAGS  = ${OPTIM} ${FLAGS} ${INC} ${SYSINCLUDE}
-
-SRC = ParUtil.cpp
-
-OBJ = ${SRC:.cpp=${OBJEXT}}
-
-.SUFFIXES: ${OBJEXT} .cpp
-
-${LIB}: ${OBJ} 
-	${AR} ${ARFLAGS}${LIB} ${OBJ} 
-	${RANLIB} ${LIB}
-
-cpobj: ${OBJ} 
-	cp -f ${OBJ} ../lib/
-
-.cpp${OBJEXT}:
-	${CXX} ${CFLAGS} ${DASH}c $<
-
-clean:
-	rm -f *.o *.obj
-
-depend:
-	(sed '/^# DO NOT DELETE THIS LINE/q' Makefile && \
-	${CXX} -MM ${CFLAGS} ${SRC} \
-	) >Makefile.new
-	cp Makefile Makefile.bak
-	cp Makefile.new Makefile
-	rm -f Makefile.new
-
-# DO NOT DELETE THIS LINE
-ParUtil.o: ParUtil.cpp ../Common/OS.h ParUtil.h
diff --git a/Parallel/ParUtil.cpp b/Parallel/ParUtil.cpp
deleted file mode 100644
index fa98badb6b990c352aeae647f3e3e0a50826ac04..0000000000000000000000000000000000000000
--- a/Parallel/ParUtil.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-// $Id: ParUtil.cpp,v 1.20 2008-02-17 08:48:02 geuzaine Exp $
-//
-// Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-// 
-// Please report all bugs and problems to <gmsh@geuz.org>.
-
-#include <string.h>
-#include <stdlib.h>
-#include "OS.h"
-#include "ParUtil.h"
-
-#if defined(HAVE_PARALLEL)
-#include "mpi.h"
-#endif
-
-ParUtil *ParUtil::Instance()
-{
-  if(!instance) {
-    instance = new ParUtil;
-  }
-  return instance;
-}
-
-ParUtil::~ParUtil()
-{
-  ;
-}
-
-ParUtil::ParUtil()
-{
-  ;
-}
-
-void ParUtil::init(int &argc, char **&argv)
-{
-#ifdef HAVE_PARALLEL
-  int namelen;
-  char name[1024];
-  MPI_Init(&argc, &argv);
-
-  MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
-  MPI_Comm_size(MPI_COMM_WORLD, &mysize);
-
-  MPI_Errhandler_set(MPI_COMM_WORLD, MPI_ERRORS_RETURN);
-  MPI_Get_processor_name(name, &namelen);
-  procName = new char[namelen + 1];
-  strcpy(procName, name);
-#endif
-}
-
-double ParUtil::wTime() const
-{
-#ifdef HAVE_PARALLEL
-  return MPI_Wtime();
-#else
-  return GetTimeInSeconds();
-#endif
-}
-
-void ParUtil::processorName(char *name) const
-{
-#ifdef HAVE_PARALLEL
-  strcpy(name, procName);
-#else
-  strcpy(name, "localhost");
-#endif
-}
-
-void ParUtil::Abort()
-{
-#ifdef HAVE_PARALLEL
-  MPI_Abort(MPI_COMM_WORLD, 1);
-#else
-  abort();
-#endif
-}
-
-void ParUtil::Exit()
-{
-#ifdef HAVE_PARALLEL
-  MPI_Finalize();
-#else
-  exit(0);
-#endif
-}
-
-void ParUtil::Barrier(int line, const char *fn)
-{
-#ifdef HAVE_PARALLEL
-  MPI_Barrier(MPI_COMM_WORLD);
-#endif
-}
-
-ParUtil *ParUtil::instance = 0;
diff --git a/Parallel/ParUtil.h b/Parallel/ParUtil.h
deleted file mode 100644
index 705c5213b664047bff66d3d05d547f99ac3440c5..0000000000000000000000000000000000000000
--- a/Parallel/ParUtil.h
+++ /dev/null
@@ -1,73 +0,0 @@
-#ifndef _H_ParUtil
-#define _H_ParUtil
-
-// Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-// 
-// Please report all bugs and problems to <gmsh@geuz.org>.
-
-/**
-   ParUtil is a Singleton. It gives some
-   general services for parallel implementation.
-*/
-
-class ParUtil {
-  ParUtil();
-  ~ParUtil();
-public:
-  /// returne the only instance
-  static ParUtil* Instance();
-  /// initialization, needed for mpi and autopack
-  void init(int &argc, char **&argv);
-  /// adds a barrier
-  void Barrier(int, const char*);
-  /// compute wall time
-  void Exit();
-  /// compute wall time
-  double wTime () const;
-  /// gets the processor name
-  void processorName(char *name) const;
-  /// abort a calculation
-  void Abort();
-#ifdef HAVE_PARALLEL
-  inline int rank() { return myrank; }
-  inline int size() { return mysize; }
-  inline int master() { return myrank==0; }
-#else
-  /// gets the processor id
-  inline int rank() { return 0; }
-  /// gets the number of processors
-  inline int size() { return 1; }
-  /// tells if it's processor 0
-  inline int master() { return 1; }
-#endif
-private:
-  static ParUtil *instance;
-  char *procName;
-#ifdef HAVE_PARALLEL
-  int myrank;
-  int mysize;
-#endif
-};
-
-#endif
-
-
-
-
-
-
diff --git a/Parser/CreateFile.cpp b/Parser/CreateFile.cpp
index 0e5e709be91d000b1e3ad657f956b15d68adaca9..ae5e9bc353b10831c9ef9e20a00288b43d20dd1d 100644
--- a/Parser/CreateFile.cpp
+++ b/Parser/CreateFile.cpp
@@ -1,4 +1,4 @@
-// $Id: CreateFile.cpp,v 1.28 2008-03-24 20:51:04 geuzaine Exp $
+// $Id: CreateFile.cpp,v 1.29 2008-05-04 08:31:16 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -136,7 +136,7 @@ void CreateOutputFile(const char *filename, int format)
 #endif
 
   bool printEndMessage = true;
-  if(format != FORMAT_AUTO) Msg(STATUS2, "Writing '%s'", name);
+  if(format != FORMAT_AUTO) Msg::Status(2, true, "Writing '%s'", name);
 
   switch (format) {
 
@@ -208,7 +208,7 @@ void CreateOutputFile(const char *filename, int format)
     {
       FILE *fp;
       if(!(fp = fopen(name, "wb"))) {
-        Msg(GERROR, "Unable to open file '%s'", name);
+        Msg::Error("Unable to open file '%s'", name);
         break;
       }
 
@@ -253,7 +253,7 @@ void CreateOutputFile(const char *filename, int format)
     {
       FILE *fp;
       if(!(fp = fopen(name, "wb"))) {
-        Msg(GERROR, "Unable to open file '%s'", name);
+        Msg::Error("Unable to open file '%s'", name);
         break;
       }
       
@@ -332,7 +332,7 @@ void CreateOutputFile(const char *filename, int format)
     {
       FILE *fp;
       if(!(fp = fopen(name, "w"))) {
-        Msg(GERROR, "Unable to open file '%s'", name);
+        Msg::Error("Unable to open file '%s'", name);
         break;
       }
       GLint buffsize = 0;
@@ -355,12 +355,12 @@ void CreateOutputFile(const char *filename, int format)
 #endif
 
   default:
-    Msg(GERROR, "Unknown output file format");
+    Msg::Error("Unknown output file format");
     printEndMessage = false;
     break;
   }
 
-  if(printEndMessage) Msg(STATUS2, "Wrote '%s'", name);
+  if(printEndMessage) Msg::Status(2, true, "Wrote '%s'", name);
 
   CTX.print.format = oldformat;
   CTX.printing = 0;
diff --git a/Parser/Gmsh.l b/Parser/Gmsh.l
index 8865798d66b2e14459c5c86caba6050d9ef7eece..a29f0a464d11c98451cf857c1cfb0d171503c631 100644
--- a/Parser/Gmsh.l
+++ b/Parser/Gmsh.l
@@ -1,5 +1,5 @@
 %{
-// $Id: Gmsh.l,v 1.102 2008-04-14 18:30:45 geuzaine Exp $
+// $Id: Gmsh.l,v 1.103 2008-05-04 08:31:16 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -50,7 +50,7 @@ void   skipline(void);
 	 yylineno++;							\
        }								\
        if ( c == EOF && ferror( yyin ) )				\
-	 Msg(FATAL, "Input in flex scanner failed");			\
+	 Msg::Fatal("Input in flex scanner failed");			\
        result = n;							\
      }									\
 
@@ -252,7 +252,7 @@ void skipcomments(void)
   while (1) {
     while ((c = yyinput()) != '*'){
       if(feof(yyin)){
-        Msg(GERROR, "End of file in commented region");
+	Msg::Error("End of file in commented region");
         return;
       }
     }
@@ -272,11 +272,11 @@ void parsestring(char endchar)
   int i = 0;
   while ((c = yyinput()) != endchar) {
     if(feof(yyin)){
-      Msg(GERROR, "End of file in string");
+      Msg::Error("End of file in string");
       break;
     }
     else if(i >= (int)sizeof(tmp)-1){
-      Msg(GERROR, "String too long");
+      Msg::Error("String too long");
       break;
     }
     else{
@@ -319,7 +319,7 @@ void skip_until(const char *skip, const char *until)
     while (1){
       chars[0] = yyinput();
       if(feof(yyin)){
-        Msg(GERROR, "Unexpected end of file");
+	Msg::Error("Unexpected end of file");
 	return;
       }
       if(chars[0] == until[0]) break;
@@ -328,7 +328,7 @@ void skip_until(const char *skip, const char *until)
 
     l = MAX(l_skip,l_until);
     if(l >= (int)sizeof(chars)){
-      Msg(GERROR, "Search pattern too long in skip_until");
+      Msg::Error("Search pattern too long in skip_until");
       return;
     }
     for(i=1; i<l; i++){
diff --git a/Parser/Gmsh.tab.cpp b/Parser/Gmsh.tab.cpp
index ffd45a5b5dfe00fba22557e6acd40c15ba5321be..db6f5738bae164d404d38d512ce8a1c42c3d9550 100644
--- a/Parser/Gmsh.tab.cpp
+++ b/Parser/Gmsh.tab.cpp
@@ -324,7 +324,7 @@
 /* Copy the first part of user declarations.  */
 #line 1 "Gmsh.y"
 
-// $Id: Gmsh.tab.cpp,v 1.362 2008-05-01 06:54:05 geuzaine Exp $
+// $Id: Gmsh.tab.cpp,v 1.363 2008-05-04 08:31:16 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -351,7 +351,6 @@
 #include "Message.h"
 #include "Malloc.h"
 #include "Tools.h"
-#include "ParUtil.h"
 #include "Numeric.h"
 #include "Context.h"
 #include "GModel.h"
@@ -399,7 +398,7 @@ static double LoopControlVariablesTab[MAX_RECUR_LOOPS][3];
 static char *LoopControlVariablesNameTab[MAX_RECUR_LOOPS];
 
 void yyerror(char *s);
-void yymsg(int type, const char *fmt, ...);
+void yymsg(int level, const char *fmt, ...);
 void skip_until(const char *skip, const char *until);
 int PrintListOfDouble(char *format, List_T *list, char *buffer);
 
@@ -424,7 +423,7 @@ int PrintListOfDouble(char *format, List_T *list, char *buffer);
 
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
 typedef union YYSTYPE
-#line 82 "Gmsh.y"
+#line 81 "Gmsh.y"
 {
   char *c;
   int i;
@@ -435,7 +434,7 @@ typedef union YYSTYPE
   List_T *l;
 }
 /* Line 193 of yacc.c.  */
-#line 439 "Gmsh.tab.cpp"
+#line 438 "Gmsh.tab.cpp"
 	YYSTYPE;
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
 # define YYSTYPE_IS_DECLARED 1
@@ -448,7 +447,7 @@ typedef union YYSTYPE
 
 
 /* Line 216 of yacc.c.  */
-#line 452 "Gmsh.tab.cpp"
+#line 451 "Gmsh.tab.cpp"
 
 #ifdef short
 # undef short
@@ -983,42 +982,42 @@ static const yytype_int16 yyrhs[] =
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 static const yytype_uint16 yyrline[] =
 {
-       0,   148,   148,   149,   154,   156,   160,   161,   162,   163,
-     164,   165,   166,   167,   168,   169,   170,   171,   172,   173,
-     177,   181,   188,   193,   208,   221,   250,   264,   275,   290,
-     295,   296,   297,   298,   299,   303,   305,   310,   312,   318,
-     464,   317,   482,   489,   500,   499,   518,   525,   536,   535,
-     553,   567,   587,   586,   600,   601,   602,   603,   604,   608,
-     609,   616,   647,   686,   740,   757,   775,   786,   803,   810,
-     825,   843,   869,   896,   910,   927,   942,   960,   980,  1003,
-    1012,  1017,  1036,  1055,  1079,  1091,  1108,  1112,  1122,  1125,
-    1143,  1165,  1181,  1203,  1221,  1239,  1257,  1283,  1301,  1327,
-    1347,  1365,  1383,  1409,  1426,  1445,  1463,  1502,  1508,  1514,
-    1521,  1546,  1571,  1587,  1607,  1625,  1642,  1663,  1668,  1673,
-    1678,  1683,  1694,  1700,  1709,  1710,  1715,  1718,  1722,  1745,
-    1768,  1791,  1819,  1828,  1832,  1847,  1863,  1880,  1894,  1900,
-    1906,  1915,  1929,  1977,  1995,  2010,  2032,  2044,  2068,  2072,
-    2077,  2082,  2094,  2111,  2128,  2155,  2182,  2213,  2221,  2227,
-    2234,  2238,  2247,  2255,  2263,  2272,  2271,  2284,  2283,  2296,
-    2295,  2308,  2307,  2319,  2318,  2334,  2341,  2348,  2355,  2362,
-    2369,  2376,  2383,  2390,  2398,  2397,  2409,  2408,  2420,  2419,
-    2431,  2430,  2442,  2441,  2453,  2452,  2464,  2463,  2475,  2474,
-    2486,  2485,  2500,  2503,  2509,  2518,  2538,  2561,  2565,  2589,
-    2607,  2625,  2643,  2672,  2707,  2712,  2739,  2753,  2766,  2783,
-    2789,  2795,  2798,  2807,  2817,  2818,  2819,  2820,  2821,  2822,
-    2823,  2824,  2825,  2832,  2833,  2834,  2835,  2836,  2837,  2838,
-    2839,  2840,  2841,  2842,  2843,  2844,  2845,  2846,  2847,  2848,
-    2849,  2850,  2851,  2852,  2853,  2854,  2855,  2856,  2857,  2858,
-    2859,  2860,  2861,  2862,  2863,  2865,  2866,  2867,  2868,  2869,
-    2870,  2871,  2872,  2873,  2874,  2875,  2876,  2877,  2878,  2879,
-    2880,  2881,  2882,  2883,  2884,  2885,  2894,  2895,  2896,  2897,
-    2898,  2899,  2900,  2904,  2920,  2935,  2955,  2968,  2981,  3004,
-    3022,  3040,  3058,  3076,  3084,  3088,  3092,  3096,  3100,  3107,
-    3111,  3115,  3119,  3126,  3131,  3139,  3144,  3148,  3153,  3157,
-    3165,  3176,  3184,  3192,  3198,  3209,  3229,  3239,  3249,  3266,
-    3293,  3298,  3302,  3306,  3319,  3323,  3335,  3342,  3363,  3367,
-    3382,  3387,  3394,  3398,  3405,  3409,  3417,  3425,  3439,  3453,
-    3457,  3476,  3499
+       0,   147,   147,   148,   153,   155,   159,   160,   161,   162,
+     163,   164,   165,   166,   167,   168,   169,   170,   171,   172,
+     176,   180,   187,   192,   207,   220,   249,   263,   274,   289,
+     294,   295,   296,   297,   298,   302,   304,   309,   311,   317,
+     463,   316,   481,   488,   499,   498,   517,   524,   535,   534,
+     552,   566,   586,   585,   599,   600,   601,   602,   603,   607,
+     608,   615,   646,   685,   739,   756,   774,   785,   802,   809,
+     824,   842,   868,   895,   909,   926,   941,   959,   979,  1002,
+    1011,  1016,  1035,  1054,  1078,  1090,  1107,  1111,  1121,  1124,
+    1142,  1164,  1180,  1202,  1220,  1238,  1256,  1282,  1300,  1326,
+    1346,  1364,  1382,  1408,  1425,  1444,  1462,  1501,  1507,  1513,
+    1520,  1545,  1570,  1586,  1606,  1624,  1641,  1662,  1667,  1672,
+    1677,  1682,  1693,  1699,  1708,  1709,  1714,  1717,  1721,  1744,
+    1767,  1790,  1818,  1827,  1831,  1846,  1862,  1879,  1893,  1899,
+    1905,  1914,  1928,  1976,  1994,  2009,  2031,  2043,  2067,  2071,
+    2076,  2081,  2093,  2110,  2127,  2154,  2181,  2212,  2220,  2226,
+    2233,  2237,  2246,  2254,  2262,  2271,  2270,  2283,  2282,  2295,
+    2294,  2307,  2306,  2318,  2317,  2333,  2340,  2347,  2354,  2361,
+    2368,  2375,  2382,  2389,  2397,  2396,  2408,  2407,  2419,  2418,
+    2430,  2429,  2441,  2440,  2452,  2451,  2463,  2462,  2474,  2473,
+    2485,  2484,  2499,  2502,  2508,  2517,  2537,  2560,  2564,  2588,
+    2606,  2624,  2642,  2671,  2706,  2711,  2738,  2752,  2765,  2782,
+    2788,  2794,  2797,  2806,  2816,  2817,  2818,  2819,  2820,  2821,
+    2822,  2823,  2824,  2831,  2832,  2833,  2834,  2835,  2836,  2837,
+    2838,  2839,  2840,  2841,  2842,  2843,  2844,  2845,  2846,  2847,
+    2848,  2849,  2850,  2851,  2852,  2853,  2854,  2855,  2856,  2857,
+    2858,  2859,  2860,  2861,  2862,  2864,  2865,  2866,  2867,  2868,
+    2869,  2870,  2871,  2872,  2873,  2874,  2875,  2876,  2877,  2878,
+    2879,  2880,  2881,  2882,  2883,  2884,  2893,  2894,  2895,  2896,
+    2897,  2898,  2899,  2903,  2919,  2934,  2954,  2967,  2980,  3003,
+    3021,  3039,  3057,  3075,  3083,  3087,  3091,  3095,  3099,  3106,
+    3110,  3114,  3118,  3125,  3130,  3138,  3143,  3147,  3152,  3156,
+    3164,  3175,  3183,  3191,  3197,  3208,  3228,  3238,  3248,  3265,
+    3292,  3297,  3301,  3305,  3318,  3322,  3334,  3341,  3362,  3366,
+    3381,  3386,  3393,  3397,  3404,  3408,  3416,  3424,  3438,  3452,
+    3456,  3475,  3498
 };
 #endif
 
@@ -3659,110 +3658,110 @@ yyreduce:
   switch (yyn)
     {
         case 3:
-#line 149 "Gmsh.y"
+#line 148 "Gmsh.y"
     { yyerrok; return 1; ;}
     break;
 
   case 6:
-#line 160 "Gmsh.y"
+#line 159 "Gmsh.y"
     { return 1; ;}
     break;
 
   case 7:
-#line 161 "Gmsh.y"
+#line 160 "Gmsh.y"
     { return 1; ;}
     break;
 
   case 8:
-#line 162 "Gmsh.y"
+#line 161 "Gmsh.y"
     { return 1; ;}
     break;
 
   case 9:
-#line 163 "Gmsh.y"
+#line 162 "Gmsh.y"
     { return 1; ;}
     break;
 
   case 10:
-#line 164 "Gmsh.y"
+#line 163 "Gmsh.y"
     { List_Delete((yyvsp[(1) - (1)].l)); return 1; ;}
     break;
 
   case 11:
-#line 165 "Gmsh.y"
+#line 164 "Gmsh.y"
     { return 1; ;}
     break;
 
   case 12:
-#line 166 "Gmsh.y"
+#line 165 "Gmsh.y"
     { return 1; ;}
     break;
 
   case 13:
-#line 167 "Gmsh.y"
+#line 166 "Gmsh.y"
     { return 1; ;}
     break;
 
   case 14:
-#line 168 "Gmsh.y"
+#line 167 "Gmsh.y"
     { List_Delete((yyvsp[(1) - (1)].l)); return 1; ;}
     break;
 
   case 15:
-#line 169 "Gmsh.y"
+#line 168 "Gmsh.y"
     { return 1; ;}
     break;
 
   case 16:
-#line 170 "Gmsh.y"
+#line 169 "Gmsh.y"
     { return 1; ;}
     break;
 
   case 17:
-#line 171 "Gmsh.y"
+#line 170 "Gmsh.y"
     { return 1; ;}
     break;
 
   case 18:
-#line 172 "Gmsh.y"
+#line 171 "Gmsh.y"
     { return 1; ;}
     break;
 
   case 19:
-#line 173 "Gmsh.y"
+#line 172 "Gmsh.y"
     { return 1; ;}
     break;
 
   case 20:
-#line 178 "Gmsh.y"
+#line 177 "Gmsh.y"
     {
       (yyval.c) = (char*)"w";
     ;}
     break;
 
   case 21:
-#line 182 "Gmsh.y"
+#line 181 "Gmsh.y"
     {
       (yyval.c) = (char*)"a";
     ;}
     break;
 
   case 22:
-#line 189 "Gmsh.y"
+#line 188 "Gmsh.y"
     {
-      Msg(DIRECT, (yyvsp[(3) - (5)].c));
+      Msg::Direct((yyvsp[(3) - (5)].c));
       Free((yyvsp[(3) - (5)].c));
     ;}
     break;
 
   case 23:
-#line 194 "Gmsh.y"
+#line 193 "Gmsh.y"
     {
       char tmpstring[1024];
       FixRelativePath((yyvsp[(6) - (7)].c), tmpstring);
       FILE *fp = fopen(tmpstring, (yyvsp[(5) - (7)].c));
       if(!fp){
-	yymsg(GERROR, "Unable to open file '%s'", tmpstring);
+	yymsg(0, "Unable to open file '%s'", tmpstring);
       }
       else{
 	fprintf(fp, "%s\n", (yyvsp[(3) - (7)].c));
@@ -3774,36 +3773,36 @@ yyreduce:
     break;
 
   case 24:
-#line 209 "Gmsh.y"
+#line 208 "Gmsh.y"
     {
       char tmpstring[1024];
       int i = PrintListOfDouble((yyvsp[(3) - (7)].c), (yyvsp[(5) - (7)].l), tmpstring);
       if(i < 0) 
-	yymsg(GERROR, "Too few arguments in Printf");
+	yymsg(0, "Too few arguments in Printf");
       else if(i > 0)
-	yymsg(GERROR, "%d extra argument%s in Printf", i, (i>1)?"s":"");
+	yymsg(0, "%d extra argument%s in Printf", i, (i>1)?"s":"");
       else
-	Msg(DIRECT, tmpstring);
+	Msg::Direct(tmpstring);
       Free((yyvsp[(3) - (7)].c));
       List_Delete((yyvsp[(5) - (7)].l));
     ;}
     break;
 
   case 25:
-#line 222 "Gmsh.y"
+#line 221 "Gmsh.y"
     {
       char tmpstring[1024];
       int i = PrintListOfDouble((yyvsp[(3) - (9)].c), (yyvsp[(5) - (9)].l), tmpstring);
       if(i < 0) 
-	yymsg(GERROR, "Too few arguments in Printf");
+	yymsg(0, "Too few arguments in Printf");
       else if(i > 0)
-	yymsg(GERROR, "%d extra argument%s in Printf", i, (i>1)?"s":"");
+	yymsg(0, "%d extra argument%s in Printf", i, (i>1)?"s":"");
       else{
 	char tmpstring2[1024];
 	FixRelativePath((yyvsp[(8) - (9)].c), tmpstring2);
 	FILE *fp = fopen(tmpstring2, (yyvsp[(7) - (9)].c));
 	if(!fp){
-	  yymsg(GERROR, "Unable to open file '%s'", tmpstring2);
+	  yymsg(0, "Unable to open file '%s'", tmpstring2);
 	}
 	else{
 	  fprintf(fp, "%s\n", tmpstring);
@@ -3817,7 +3816,7 @@ yyreduce:
     break;
 
   case 26:
-#line 251 "Gmsh.y"
+#line 250 "Gmsh.y"
     { 
 #if !defined(HAVE_NO_POST)
       if(!strcmp((yyvsp[(1) - (6)].c), "View") && ViewData->finalize()){
@@ -3834,7 +3833,7 @@ yyreduce:
     break;
 
   case 27:
-#line 265 "Gmsh.y"
+#line 264 "Gmsh.y"
     {
 #if !defined(HAVE_NO_POST)
       if(!strcmp((yyvsp[(2) - (6)].c), "View")){
@@ -3848,7 +3847,7 @@ yyreduce:
     break;
 
   case 28:
-#line 276 "Gmsh.y"
+#line 275 "Gmsh.y"
     {
 #if !defined(HAVE_NO_POST)
       if(!strcmp((yyvsp[(2) - (6)].c), "View")){
@@ -3862,7 +3861,7 @@ yyreduce:
     break;
 
   case 29:
-#line 290 "Gmsh.y"
+#line 289 "Gmsh.y"
     {
 #if !defined(HAVE_NO_POST)
       ViewData = new PViewDataList(true); 
@@ -3871,27 +3870,27 @@ yyreduce:
     break;
 
   case 35:
-#line 304 "Gmsh.y"
+#line 303 "Gmsh.y"
     { ViewCoord[ViewCoordIdx++] = (yyvsp[(1) - (1)].d); ;}
     break;
 
   case 36:
-#line 306 "Gmsh.y"
+#line 305 "Gmsh.y"
     { ViewCoord[ViewCoordIdx++] = (yyvsp[(3) - (3)].d); ;}
     break;
 
   case 37:
-#line 311 "Gmsh.y"
+#line 310 "Gmsh.y"
     { if(ViewValueList) List_Add(ViewValueList, &(yyvsp[(1) - (1)].d)); ;}
     break;
 
   case 38:
-#line 313 "Gmsh.y"
+#line 312 "Gmsh.y"
     { if(ViewValueList) List_Add(ViewValueList, &(yyvsp[(3) - (3)].d)); ;}
     break;
 
   case 39:
-#line 318 "Gmsh.y"
+#line 317 "Gmsh.y"
     {
 #if !defined(HAVE_NO_POST)
       if(!strcmp((yyvsp[(1) - (1)].c), "SP")){
@@ -4030,7 +4029,7 @@ yyreduce:
 	ViewValueList = ViewData->TY2; ViewNumList = &ViewData->NbTY2;
       }
       else{
-	yymsg(GERROR, "Unknown element type '%s'", (yyvsp[(1) - (1)].c));	
+	yymsg(0, "Unknown element type '%s'", (yyvsp[(1) - (1)].c));	
 	ViewValueList = 0; ViewNumList = 0;
       }
       Free((yyvsp[(1) - (1)].c));
@@ -4040,7 +4039,7 @@ yyreduce:
     break;
 
   case 40:
-#line 464 "Gmsh.y"
+#line 463 "Gmsh.y"
     {
 #if !defined(HAVE_NO_POST)
       if(ViewValueList){
@@ -4053,7 +4052,7 @@ yyreduce:
     break;
 
   case 41:
-#line 474 "Gmsh.y"
+#line 473 "Gmsh.y"
     {
 #if !defined(HAVE_NO_POST)
       if(ViewValueList) (*ViewNumList)++;
@@ -4062,7 +4061,7 @@ yyreduce:
     break;
 
   case 42:
-#line 483 "Gmsh.y"
+#line 482 "Gmsh.y"
     { 
 #if !defined(HAVE_NO_POST)
       for(int i = 0; i < (int)strlen((yyvsp[(1) - (1)].c))+1; i++) List_Add(ViewData->T2C, &(yyvsp[(1) - (1)].c)[i]); 
@@ -4072,7 +4071,7 @@ yyreduce:
     break;
 
   case 43:
-#line 490 "Gmsh.y"
+#line 489 "Gmsh.y"
     { 
 #if !defined(HAVE_NO_POST)
       for(int i = 0; i < (int)strlen((yyvsp[(3) - (3)].c))+1; i++) List_Add(ViewData->T2C, &(yyvsp[(3) - (3)].c)[i]); 
@@ -4082,7 +4081,7 @@ yyreduce:
     break;
 
   case 44:
-#line 500 "Gmsh.y"
+#line 499 "Gmsh.y"
     { 
 #if !defined(HAVE_NO_POST)
       List_Add(ViewData->T2D, &(yyvsp[(3) - (8)].d)); 
@@ -4095,7 +4094,7 @@ yyreduce:
     break;
 
   case 45:
-#line 510 "Gmsh.y"
+#line 509 "Gmsh.y"
     {
 #if !defined(HAVE_NO_POST)
       ViewData->NbT2++;
@@ -4104,7 +4103,7 @@ yyreduce:
     break;
 
   case 46:
-#line 519 "Gmsh.y"
+#line 518 "Gmsh.y"
     { 
 #if !defined(HAVE_NO_POST)
       for(int i = 0; i < (int)strlen((yyvsp[(1) - (1)].c))+1; i++) List_Add(ViewData->T3C, &(yyvsp[(1) - (1)].c)[i]); 
@@ -4114,7 +4113,7 @@ yyreduce:
     break;
 
   case 47:
-#line 526 "Gmsh.y"
+#line 525 "Gmsh.y"
     { 
 #if !defined(HAVE_NO_POST)
       for(int i = 0; i < (int)strlen((yyvsp[(3) - (3)].c))+1; i++) List_Add(ViewData->T3C, &(yyvsp[(3) - (3)].c)[i]); 
@@ -4124,7 +4123,7 @@ yyreduce:
     break;
 
   case 48:
-#line 536 "Gmsh.y"
+#line 535 "Gmsh.y"
     { 
 #if !defined(HAVE_NO_POST)
       List_Add(ViewData->T3D, &(yyvsp[(3) - (10)].d)); List_Add(ViewData->T3D, &(yyvsp[(5) - (10)].d));
@@ -4136,7 +4135,7 @@ yyreduce:
     break;
 
   case 49:
-#line 545 "Gmsh.y"
+#line 544 "Gmsh.y"
     {
 #if !defined(HAVE_NO_POST)
       ViewData->NbT3++;
@@ -4145,7 +4144,7 @@ yyreduce:
     break;
 
   case 50:
-#line 555 "Gmsh.y"
+#line 554 "Gmsh.y"
     {
 #if !defined(HAVE_NO_POST)
       int type = 
@@ -4161,7 +4160,7 @@ yyreduce:
     break;
 
   case 51:
-#line 571 "Gmsh.y"
+#line 570 "Gmsh.y"
     {
 #if !defined(HAVE_NO_POST)
       int type = 
@@ -4177,7 +4176,7 @@ yyreduce:
     break;
 
   case 52:
-#line 587 "Gmsh.y"
+#line 586 "Gmsh.y"
     {
 #if !defined(HAVE_NO_POST)
       ViewValueList = ViewData->Time;
@@ -4186,48 +4185,48 @@ yyreduce:
     break;
 
   case 53:
-#line 593 "Gmsh.y"
+#line 592 "Gmsh.y"
     {
     ;}
     break;
 
   case 54:
-#line 600 "Gmsh.y"
+#line 599 "Gmsh.y"
     { (yyval.i) = 0; ;}
     break;
 
   case 55:
-#line 601 "Gmsh.y"
+#line 600 "Gmsh.y"
     { (yyval.i) = 1; ;}
     break;
 
   case 56:
-#line 602 "Gmsh.y"
+#line 601 "Gmsh.y"
     { (yyval.i) = 2; ;}
     break;
 
   case 57:
-#line 603 "Gmsh.y"
+#line 602 "Gmsh.y"
     { (yyval.i) = 3; ;}
     break;
 
   case 58:
-#line 604 "Gmsh.y"
+#line 603 "Gmsh.y"
     { (yyval.i) = 4; ;}
     break;
 
   case 59:
-#line 608 "Gmsh.y"
+#line 607 "Gmsh.y"
     { (yyval.i) = 1; ;}
     break;
 
   case 60:
-#line 609 "Gmsh.y"
+#line 608 "Gmsh.y"
     { (yyval.i) = -1; ;}
     break;
 
   case 61:
-#line 617 "Gmsh.y"
+#line 616 "Gmsh.y"
     {
       Symbol TheSymbol;
       TheSymbol.Name = (yyvsp[(1) - (4)].c);
@@ -4239,7 +4238,7 @@ yyreduce:
 	  Tree_Add(Symbol_T, &TheSymbol);
 	}
 	else{
-	  yymsg(GERROR, "Unknown variable '%s'", (yyvsp[(1) - (4)].c));
+	  yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (4)].c));
 	  Free((yyvsp[(1) - (4)].c));
 	}
       }
@@ -4252,7 +4251,7 @@ yyreduce:
 	case 3 : *pd *= (yyvsp[(3) - (4)].d); break;
 	case 4 : 
 	  if((yyvsp[(3) - (4)].d)) *pd /= (yyvsp[(3) - (4)].d); 
-	  else yymsg(GERROR, "Division by zero in '%s /= %g'", (yyvsp[(1) - (4)].c), (yyvsp[(3) - (4)].d));
+	  else yymsg(0, "Division by zero in '%s /= %g'", (yyvsp[(1) - (4)].c), (yyvsp[(3) - (4)].d));
 	  break;
 	}
 	Free((yyvsp[(1) - (4)].c));
@@ -4261,7 +4260,7 @@ yyreduce:
     break;
 
   case 62:
-#line 648 "Gmsh.y"
+#line 647 "Gmsh.y"
     {
       Symbol TheSymbol;
       TheSymbol.Name = (yyvsp[(1) - (7)].c);
@@ -4273,7 +4272,7 @@ yyreduce:
 	  Tree_Add(Symbol_T, &TheSymbol);
 	}
 	else{
-	  yymsg(GERROR, "Unknown variable '%s'", (yyvsp[(1) - (7)].c));
+	  yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (7)].c));
 	  Free((yyvsp[(1) - (7)].c));
 	}
       }
@@ -4287,7 +4286,7 @@ yyreduce:
 	  case 3 : *pd *= (yyvsp[(6) - (7)].d); break;
 	  case 4 : 
 	    if((yyvsp[(6) - (7)].d)) *pd /= (yyvsp[(6) - (7)].d); 
-	    else yymsg(GERROR, "Division by zero in '%s[%d] /= %g'", (yyvsp[(1) - (7)].c), (int)(yyvsp[(3) - (7)].d), (yyvsp[(6) - (7)].d));
+	    else yymsg(0, "Division by zero in '%s[%d] /= %g'", (yyvsp[(1) - (7)].c), (int)(yyvsp[(3) - (7)].d), (yyvsp[(6) - (7)].d));
 	    break;
 	  }
 	}
@@ -4295,7 +4294,7 @@ yyreduce:
 	  if(!(yyvsp[(5) - (7)].i))
 	    List_Put(pSymbol->val, (int)(yyvsp[(3) - (7)].d), &(yyvsp[(6) - (7)].d));
 	  else
-	    yymsg(GERROR, "Uninitialized variable '%s[%d]'", (yyvsp[(1) - (7)].c), (int)(yyvsp[(3) - (7)].d));
+	    yymsg(0, "Uninitialized variable '%s[%d]'", (yyvsp[(1) - (7)].c), (int)(yyvsp[(3) - (7)].d));
 	}
 	Free((yyvsp[(1) - (7)].c));
       }
@@ -4303,10 +4302,10 @@ yyreduce:
     break;
 
   case 63:
-#line 687 "Gmsh.y"
+#line 686 "Gmsh.y"
     {
       if(List_Nbr((yyvsp[(4) - (9)].l)) != List_Nbr((yyvsp[(8) - (9)].l))){
-	yymsg(GERROR, "Incompatible array dimensions in affectation");
+	yymsg(0, "Incompatible array dimensions in affectation");
 	Free((yyvsp[(1) - (9)].c));
       }
       else{
@@ -4323,7 +4322,7 @@ yyreduce:
 	    Tree_Add(Symbol_T, &TheSymbol);
 	  }
 	  else{
-	    yymsg(GERROR, "Unknown variable '%s'", (yyvsp[(1) - (9)].c));
+	    yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (9)].c));
 	    Free((yyvsp[(1) - (9)].c));
 	  }
 	}
@@ -4340,7 +4339,7 @@ yyreduce:
 	      case 3 : *pd *= d; break;
 	      case 4 : 
 		if((yyvsp[(8) - (9)].l)) *pd /= d; 
-		else yymsg(GERROR, "Division by zero in '%s[%d] /= %g'", (yyvsp[(1) - (9)].c), j, d);
+		else yymsg(0, "Division by zero in '%s[%d] /= %g'", (yyvsp[(1) - (9)].c), j, d);
 		break;
 	      }
 	    }
@@ -4348,7 +4347,7 @@ yyreduce:
 	      if(!(yyvsp[(7) - (9)].i))
 		List_Put(pSymbol->val, j, &d);
 	      else
-		yymsg(GERROR, "Uninitialized variable '%s[%d]'", (yyvsp[(1) - (9)].c), j);	  
+		yymsg(0, "Uninitialized variable '%s[%d]'", (yyvsp[(1) - (9)].c), j);	  
 	    }
 	  }
 	  Free((yyvsp[(1) - (9)].c));
@@ -4360,7 +4359,7 @@ yyreduce:
     break;
 
   case 64:
-#line 741 "Gmsh.y"
+#line 740 "Gmsh.y"
     {
       Symbol TheSymbol;
       TheSymbol.Name = (yyvsp[(1) - (6)].c);
@@ -4380,7 +4379,7 @@ yyreduce:
     break;
 
   case 65:
-#line 758 "Gmsh.y"
+#line 757 "Gmsh.y"
     {
       // appends to the list
       Symbol TheSymbol;
@@ -4401,13 +4400,13 @@ yyreduce:
     break;
 
   case 66:
-#line 776 "Gmsh.y"
+#line 775 "Gmsh.y"
     {
       Symbol TheSymbol;
       TheSymbol.Name = (yyvsp[(1) - (3)].c);
       Symbol *pSymbol;
       if(!(pSymbol = (Symbol*)Tree_PQuery(Symbol_T, &TheSymbol)))
-	yymsg(GERROR, "Unknown variable '%s'", (yyvsp[(1) - (3)].c)); 
+	yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (3)].c)); 
       else
 	*(double*)List_Pointer_Fast(pSymbol->val, 0) += (yyvsp[(2) - (3)].i);
       Free((yyvsp[(1) - (3)].c));
@@ -4415,42 +4414,42 @@ yyreduce:
     break;
 
   case 67:
-#line 787 "Gmsh.y"
+#line 786 "Gmsh.y"
     {
       Symbol TheSymbol;
       TheSymbol.Name = (yyvsp[(1) - (6)].c);
       Symbol *pSymbol;
       if(!(pSymbol = (Symbol*)Tree_PQuery(Symbol_T, &TheSymbol)))
-	yymsg(GERROR, "Unknown variable '%s'", (yyvsp[(1) - (6)].c)); 
+	yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (6)].c)); 
       else{
 	double *pd;
 	if((pd = (double*)List_Pointer_Test(pSymbol->val, (int)(yyvsp[(3) - (6)].d))))
 	  *pd += (yyvsp[(5) - (6)].i);
 	else
-	  yymsg(GERROR, "Uninitialized variable '%s[%d]'", (yyvsp[(1) - (6)].c), (int)(yyvsp[(3) - (6)].d));
+	  yymsg(0, "Uninitialized variable '%s[%d]'", (yyvsp[(1) - (6)].c), (int)(yyvsp[(3) - (6)].d));
       }
       Free((yyvsp[(1) - (6)].c));
     ;}
     break;
 
   case 68:
-#line 804 "Gmsh.y"
+#line 803 "Gmsh.y"
     { 
-      Msg(WARNING, "Named string expressions not implemented yet");
+      Msg::Warning("Named string expressions not implemented yet");
     ;}
     break;
 
   case 69:
-#line 811 "Gmsh.y"
+#line 810 "Gmsh.y"
     { 
       const char* (*pStrOpt)(int num, int action, const char *value);
       StringXString *pStrCat;
       if(!(pStrCat = Get_StringOptionCategory((yyvsp[(1) - (6)].c))))
-	yymsg(GERROR, "Unknown string option class '%s'", (yyvsp[(1) - (6)].c));
+	yymsg(0, "Unknown string option class '%s'", (yyvsp[(1) - (6)].c));
       else{
 	if(!(pStrOpt = (const char *(*) (int, int, const char *))
 	     Get_StringOption((yyvsp[(3) - (6)].c), pStrCat)))
-	  yymsg(GERROR, "Unknown string option '%s.%s'", (yyvsp[(1) - (6)].c), (yyvsp[(3) - (6)].c));
+	  yymsg(0, "Unknown string option '%s.%s'", (yyvsp[(1) - (6)].c), (yyvsp[(3) - (6)].c));
 	else
 	  pStrOpt(0, GMSH_SET|GMSH_GUI, (yyvsp[(5) - (6)].c));
       }
@@ -4459,16 +4458,16 @@ yyreduce:
     break;
 
   case 70:
-#line 826 "Gmsh.y"
+#line 825 "Gmsh.y"
     { 
       const char* (*pStrOpt)(int num, int action, const char *value);
       StringXString *pStrCat;
       if(!(pStrCat = Get_StringOptionCategory((yyvsp[(1) - (9)].c))))
-	yymsg(GERROR, "Unknown string option class '%s'", (yyvsp[(1) - (9)].c));
+	yymsg(0, "Unknown string option class '%s'", (yyvsp[(1) - (9)].c));
       else{
 	if(!(pStrOpt = (const char *(*) (int, int, const char *))
 	     Get_StringOption((yyvsp[(6) - (9)].c), pStrCat)))
-	  yymsg(GERROR, "Unknown string option '%s[%d].%s'", (yyvsp[(1) - (9)].c), (int)(yyvsp[(3) - (9)].d), (yyvsp[(6) - (9)].c));
+	  yymsg(0, "Unknown string option '%s[%d].%s'", (yyvsp[(1) - (9)].c), (int)(yyvsp[(3) - (9)].d), (yyvsp[(6) - (9)].c));
 	else
 	  pStrOpt((int)(yyvsp[(3) - (9)].d), GMSH_SET|GMSH_GUI, (yyvsp[(8) - (9)].c));
       }
@@ -4477,15 +4476,15 @@ yyreduce:
     break;
 
   case 71:
-#line 844 "Gmsh.y"
+#line 843 "Gmsh.y"
     {
       double (*pNumOpt)(int num, int action, double value);
       StringXNumber *pNumCat;
       if(!(pNumCat = Get_NumberOptionCategory((yyvsp[(1) - (6)].c))))
-	yymsg(GERROR, "Unknown numeric option class '%s'", (yyvsp[(1) - (6)].c));
+	yymsg(0, "Unknown numeric option class '%s'", (yyvsp[(1) - (6)].c));
       else{
 	if(!(pNumOpt = (double (*) (int, int, double))Get_NumberOption((yyvsp[(3) - (6)].c), pNumCat)))
-	  yymsg(GERROR, "Unknown numeric option '%s.%s'", (yyvsp[(1) - (6)].c), (yyvsp[(3) - (6)].c));
+	  yymsg(0, "Unknown numeric option '%s.%s'", (yyvsp[(1) - (6)].c), (yyvsp[(3) - (6)].c));
 	else{
 	  double d = 0;
 	  switch((yyvsp[(4) - (6)].i)){
@@ -4495,7 +4494,7 @@ yyreduce:
 	  case 3 : d = pNumOpt(0, GMSH_GET, 0) * (yyvsp[(5) - (6)].d); break;
 	  case 4 : 
 	    if((yyvsp[(5) - (6)].d)) d = pNumOpt(0, GMSH_GET, 0) / (yyvsp[(5) - (6)].d); 
-	    else yymsg(GERROR, "Division by zero in '%s.%s /= %g'", (yyvsp[(1) - (6)].c), (yyvsp[(3) - (6)].c), (yyvsp[(5) - (6)].d));
+	    else yymsg(0, "Division by zero in '%s.%s /= %g'", (yyvsp[(1) - (6)].c), (yyvsp[(3) - (6)].c), (yyvsp[(5) - (6)].d));
 	    break;
 	  }
 	  pNumOpt(0, GMSH_SET|GMSH_GUI, d);
@@ -4506,15 +4505,15 @@ yyreduce:
     break;
 
   case 72:
-#line 870 "Gmsh.y"
+#line 869 "Gmsh.y"
     {
       double (*pNumOpt)(int num, int action, double value);
       StringXNumber *pNumCat;
       if(!(pNumCat = Get_NumberOptionCategory((yyvsp[(1) - (9)].c))))
-	yymsg(GERROR, "Unknown numeric option class '%s'", (yyvsp[(1) - (9)].c));
+	yymsg(0, "Unknown numeric option class '%s'", (yyvsp[(1) - (9)].c));
       else{
 	if(!(pNumOpt =  (double (*) (int, int, double))Get_NumberOption((yyvsp[(6) - (9)].c), pNumCat)))
-	  yymsg(GERROR, "Unknown numeric option '%s[%d].%s'", (yyvsp[(1) - (9)].c), (int)(yyvsp[(3) - (9)].d), (yyvsp[(6) - (9)].c));
+	  yymsg(0, "Unknown numeric option '%s[%d].%s'", (yyvsp[(1) - (9)].c), (int)(yyvsp[(3) - (9)].d), (yyvsp[(6) - (9)].c));
 	else{
 	  double d = 0;
 	  switch((yyvsp[(7) - (9)].i)){
@@ -4524,7 +4523,7 @@ yyreduce:
 	  case 3 : d = pNumOpt((int)(yyvsp[(3) - (9)].d), GMSH_GET, 0) * (yyvsp[(8) - (9)].d); break;
 	  case 4 : 
 	    if((yyvsp[(8) - (9)].d)) d = pNumOpt((int)(yyvsp[(3) - (9)].d), GMSH_GET, 0) / (yyvsp[(8) - (9)].d);
-	    else yymsg(GERROR, "Division by zero in '%s[%d].%s /= %g'", 
+	    else yymsg(0, "Division by zero in '%s[%d].%s /= %g'", 
 		       (yyvsp[(1) - (9)].c), (int)(yyvsp[(3) - (9)].d), (yyvsp[(6) - (9)].c), (yyvsp[(8) - (9)].d));
 	    break;
 	  }
@@ -4536,15 +4535,15 @@ yyreduce:
     break;
 
   case 73:
-#line 897 "Gmsh.y"
+#line 896 "Gmsh.y"
     {
       double (*pNumOpt)(int num, int action, double value);
       StringXNumber *pNumCat;
       if(!(pNumCat = Get_NumberOptionCategory((yyvsp[(1) - (5)].c))))
-	yymsg(GERROR, "Unknown numeric option class '%s'", (yyvsp[(1) - (5)].c));
+	yymsg(0, "Unknown numeric option class '%s'", (yyvsp[(1) - (5)].c));
       else{
 	if(!(pNumOpt =  (double (*) (int, int, double))Get_NumberOption((yyvsp[(3) - (5)].c), pNumCat)))
-	  yymsg(GERROR, "Unknown numeric option '%s.%s'", (yyvsp[(1) - (5)].c), (yyvsp[(3) - (5)].c));
+	  yymsg(0, "Unknown numeric option '%s.%s'", (yyvsp[(1) - (5)].c), (yyvsp[(3) - (5)].c));
 	else
 	  pNumOpt(0, GMSH_SET|GMSH_GUI, pNumOpt(0, GMSH_GET, 0)+(yyvsp[(4) - (5)].i));
       }
@@ -4553,15 +4552,15 @@ yyreduce:
     break;
 
   case 74:
-#line 911 "Gmsh.y"
+#line 910 "Gmsh.y"
     {
       double (*pNumOpt)(int num, int action, double value);
       StringXNumber *pNumCat;
       if(!(pNumCat = Get_NumberOptionCategory((yyvsp[(1) - (8)].c))))
-	yymsg(GERROR, "Unknown numeric option class '%s'", (yyvsp[(1) - (8)].c));
+	yymsg(0, "Unknown numeric option class '%s'", (yyvsp[(1) - (8)].c));
       else{
 	if(!(pNumOpt =  (double (*) (int, int, double))Get_NumberOption((yyvsp[(6) - (8)].c), pNumCat)))
-	  yymsg(GERROR, "Unknown numeric option '%s[%d].%s'", (yyvsp[(1) - (8)].c), (int)(yyvsp[(3) - (8)].d), (yyvsp[(6) - (8)].c));
+	  yymsg(0, "Unknown numeric option '%s[%d].%s'", (yyvsp[(1) - (8)].c), (int)(yyvsp[(3) - (8)].d), (yyvsp[(6) - (8)].c));
 	else
 	  pNumOpt((int)(yyvsp[(3) - (8)].d), GMSH_SET|GMSH_GUI, pNumOpt((int)(yyvsp[(3) - (8)].d), GMSH_GET, 0)+(yyvsp[(7) - (8)].i));
       }
@@ -4570,16 +4569,16 @@ yyreduce:
     break;
 
   case 75:
-#line 928 "Gmsh.y"
+#line 927 "Gmsh.y"
     {
       unsigned int (*pColOpt)(int num, int action, unsigned int value);
       StringXColor *pColCat;
       if(!(pColCat = Get_ColorOptionCategory((yyvsp[(1) - (8)].c))))
-	yymsg(GERROR, "Unknown color option class '%s'", (yyvsp[(1) - (8)].c));
+	yymsg(0, "Unknown color option class '%s'", (yyvsp[(1) - (8)].c));
       else{
 	if(!(pColOpt = (unsigned int (*) (int, int, unsigned int))
 	     Get_ColorOption((yyvsp[(5) - (8)].c), pColCat)))
-	  yymsg(GERROR, "Unknown color option '%s.Color.%s'", (yyvsp[(1) - (8)].c), (yyvsp[(5) - (8)].c));
+	  yymsg(0, "Unknown color option '%s.Color.%s'", (yyvsp[(1) - (8)].c), (yyvsp[(5) - (8)].c));
 	else
 	  pColOpt(0, GMSH_SET|GMSH_GUI, (yyvsp[(7) - (8)].u));
       }
@@ -4588,16 +4587,16 @@ yyreduce:
     break;
 
   case 76:
-#line 943 "Gmsh.y"
+#line 942 "Gmsh.y"
     {
       unsigned int (*pColOpt)(int num, int action, unsigned int value);
       StringXColor *pColCat;
       if(!(pColCat = Get_ColorOptionCategory((yyvsp[(1) - (11)].c))))
-	yymsg(GERROR, "Unknown color option class '%s'", (yyvsp[(1) - (11)].c));
+	yymsg(0, "Unknown color option class '%s'", (yyvsp[(1) - (11)].c));
       else{
 	if(!(pColOpt =  (unsigned int (*) (int, int, unsigned int))
 	     Get_ColorOption((yyvsp[(8) - (11)].c), pColCat)))
-	  yymsg(GERROR, "Unknown color option '%s[%d].Color.%s'", (yyvsp[(1) - (11)].c), (int)(yyvsp[(3) - (11)].d), (yyvsp[(8) - (11)].c));
+	  yymsg(0, "Unknown color option '%s[%d].Color.%s'", (yyvsp[(1) - (11)].c), (int)(yyvsp[(3) - (11)].d), (yyvsp[(8) - (11)].c));
 	else
 	  pColOpt((int)(yyvsp[(3) - (11)].d), GMSH_SET|GMSH_GUI, (yyvsp[(10) - (11)].u));
       }
@@ -4606,15 +4605,15 @@ yyreduce:
     break;
 
   case 77:
-#line 961 "Gmsh.y"
+#line 960 "Gmsh.y"
     {
       GmshColorTable *ct = Get_ColorTable(0);
       if(!ct)
-	yymsg(GERROR, "View[%d] does not exist", 0);
+	yymsg(0, "View[%d] does not exist", 0);
       else{
 	ct->size = List_Nbr((yyvsp[(5) - (6)].l));
 	if(ct->size > COLORTABLE_NBMAX_COLOR)
-	  yymsg(GERROR, "Too many (%d>%d) colors in View[%d].ColorTable", 
+	  yymsg(0, "Too many (%d>%d) colors in View[%d].ColorTable", 
 		ct->size, COLORTABLE_NBMAX_COLOR, 0);
 	else
 	  for(int i = 0; i < ct->size; i++) List_Read((yyvsp[(5) - (6)].l), i, &ct->table[i]);
@@ -4629,15 +4628,15 @@ yyreduce:
     break;
 
   case 78:
-#line 981 "Gmsh.y"
+#line 980 "Gmsh.y"
     {
       GmshColorTable *ct = Get_ColorTable((int)(yyvsp[(3) - (9)].d));
       if(!ct)
-	yymsg(GERROR, "View[%d] does not exist", (int)(yyvsp[(3) - (9)].d));
+	yymsg(0, "View[%d] does not exist", (int)(yyvsp[(3) - (9)].d));
       else{
 	ct->size = List_Nbr((yyvsp[(8) - (9)].l));
 	if(ct->size > COLORTABLE_NBMAX_COLOR)
-	  yymsg(GERROR, "Too many (%d>%d) colors in View[%d].ColorTable", 
+	  yymsg(0, "Too many (%d>%d) colors in View[%d].ColorTable", 
 		   ct->size, COLORTABLE_NBMAX_COLOR, (int)(yyvsp[(3) - (9)].d));
 	else
 	  for(int i = 0; i < ct->size; i++) List_Read((yyvsp[(8) - (9)].l), i, &ct->table[i]);
@@ -4652,27 +4651,27 @@ yyreduce:
     break;
 
   case 79:
-#line 1004 "Gmsh.y"
+#line 1003 "Gmsh.y"
     {
       if(!strcmp((yyvsp[(1) - (5)].c),"Background")){
 	GModel::current()->getFields()->background_field = (int)(yyvsp[(4) - (5)].d);
       }
       else{
-	yymsg(GERROR, "Unknown command %s Field", (yyvsp[(1) - (5)].c));
+	yymsg(0, "Unknown command %s Field", (yyvsp[(1) - (5)].c));
       }
     ;}
     break;
 
   case 80:
-#line 1013 "Gmsh.y"
+#line 1012 "Gmsh.y"
     {
       if(!GModel::current()->getFields()->new_field((int)(yyvsp[(3) - (7)].d), (yyvsp[(6) - (7)].c)))
-	yymsg(GERROR, "Cannot create field %i of type '%s'", (int)(yyvsp[(3) - (7)].d), (yyvsp[(6) - (7)].c));
+	yymsg(0, "Cannot create field %i of type '%s'", (int)(yyvsp[(3) - (7)].d), (yyvsp[(6) - (7)].c));
     ;}
     break;
 
   case 81:
-#line 1018 "Gmsh.y"
+#line 1017 "Gmsh.y"
     {
       Field *field = GModel::current()->getFields()->get((int)(yyvsp[(3) - (9)].d));
       if(field){
@@ -4680,21 +4679,21 @@ yyreduce:
 	if(option){
 	  try { option->numerical_value((yyvsp[(8) - (9)].d)); }
 	  catch(...){
-	    yymsg(GERROR, "Cannot assign a numerical value to option '%s' "
+	    yymsg(0, "Cannot assign a numerical value to option '%s' "
 		  "in field %i of type '%s'", (yyvsp[(6) - (9)].c), (int)(yyvsp[(3) - (9)].d), field->get_name());
 	  }
 	}
 	else
-	  yymsg(GERROR, "Unknown option '%s' in field %i of type '%s'",
+	  yymsg(0, "Unknown option '%s' in field %i of type '%s'",
 		(yyvsp[(6) - (9)].c), (int)(yyvsp[(3) - (9)].d), field->get_name());
       }
       else
-	yymsg(GERROR, "No field with id %i", (int)(yyvsp[(3) - (9)].d));
+	yymsg(0, "No field with id %i", (int)(yyvsp[(3) - (9)].d));
     ;}
     break;
 
   case 82:
-#line 1037 "Gmsh.y"
+#line 1036 "Gmsh.y"
     {
       Field *field = GModel::current()->getFields()->get((int)(yyvsp[(3) - (9)].d));
       if(field){
@@ -4702,21 +4701,21 @@ yyreduce:
 	if(option){
 	  try { option->string() = (yyvsp[(8) - (9)].c); }
 	  catch (...){
-	    yymsg(GERROR, "Cannot assign a string value to  option '%s' "
+	    yymsg(0, "Cannot assign a string value to  option '%s' "
 		  "in field %i of type '%s'", (yyvsp[(6) - (9)].c), (int)(yyvsp[(3) - (9)].d), field->get_name());
 	  }
 	}
 	else 
-	  yymsg(GERROR, "Unknown option '%s' in field %i of type '%s'", 
+	  yymsg(0, "Unknown option '%s' in field %i of type '%s'", 
 		(yyvsp[(6) - (9)].c), (int)(yyvsp[(3) - (9)].d), field->get_name());
       }
       else 
-	yymsg(GERROR, "No field with id %i", (int)(yyvsp[(3) - (9)].d));
+	yymsg(0, "No field with id %i", (int)(yyvsp[(3) - (9)].d));
     ;}
     break;
 
   case 83:
-#line 1056 "Gmsh.y"
+#line 1055 "Gmsh.y"
     {
       Field *field = GModel::current()->getFields()->get((int)(yyvsp[(3) - (11)].d));
       if(field){
@@ -4731,23 +4730,23 @@ yyreduce:
 	  }
 	}
 	else
-	  yymsg(GERROR, "Unknown option '%s' in field %i of type '%s'",
+	  yymsg(0, "Unknown option '%s' in field %i of type '%s'",
 		(yyvsp[(6) - (11)].c), (int)(yyvsp[(3) - (11)].d), field->get_name());
       }
       else 
-	yymsg(GERROR, "No field with id %i", (int)(yyvsp[(3) - (11)].d));
+	yymsg(0, "No field with id %i", (int)(yyvsp[(3) - (11)].d));
     ;}
     break;
 
   case 84:
-#line 1080 "Gmsh.y"
+#line 1079 "Gmsh.y"
     {
 #if !defined(HAVE_NO_POST)
       try {
 	GMSH_PluginManager::instance()->setPluginOption((yyvsp[(3) - (9)].c), (yyvsp[(6) - (9)].c), (yyvsp[(8) - (9)].d)); 
       }
       catch (...) {
-	yymsg(GERROR, "Unknown option '%s' or plugin '%s'", (yyvsp[(6) - (9)].c), (yyvsp[(3) - (9)].c));
+	yymsg(0, "Unknown option '%s' or plugin '%s'", (yyvsp[(6) - (9)].c), (yyvsp[(3) - (9)].c));
       }
 #endif
       Free((yyvsp[(3) - (9)].c)); Free((yyvsp[(6) - (9)].c));
@@ -4755,14 +4754,14 @@ yyreduce:
     break;
 
   case 85:
-#line 1092 "Gmsh.y"
+#line 1091 "Gmsh.y"
     {
 #if !defined(HAVE_NO_POST)
       try {
 	GMSH_PluginManager::instance()->setPluginOption((yyvsp[(3) - (9)].c), (yyvsp[(6) - (9)].c), (yyvsp[(8) - (9)].c)); 
       }
       catch (...) {
-	yymsg(GERROR, "Unknown option '%s' or plugin '%s'", (yyvsp[(6) - (9)].c), (yyvsp[(3) - (9)].c));
+	yymsg(0, "Unknown option '%s' or plugin '%s'", (yyvsp[(6) - (9)].c), (yyvsp[(3) - (9)].c));
       }
 #endif
       Free((yyvsp[(3) - (9)].c)); Free((yyvsp[(6) - (9)].c)); // FIXME: sometimes leak $8
@@ -4770,14 +4769,14 @@ yyreduce:
     break;
 
   case 86:
-#line 1109 "Gmsh.y"
+#line 1108 "Gmsh.y"
     { 
       (yyval.i) = (int)(yyvsp[(1) - (1)].d); 
     ;}
     break;
 
   case 87:
-#line 1113 "Gmsh.y"
+#line 1112 "Gmsh.y"
     { 
       (yyval.i) = GModel::current()->setPhysicalName
 	(std::string((yyvsp[(1) - (1)].c)), ++GModel::current()->getGEOInternals()->MaxPhysicalNum);
@@ -4786,19 +4785,19 @@ yyreduce:
     break;
 
   case 88:
-#line 1122 "Gmsh.y"
+#line 1121 "Gmsh.y"
     {
       (yyval.l) = 0;
     ;}
     break;
 
   case 89:
-#line 1126 "Gmsh.y"
+#line 1125 "Gmsh.y"
     {
       (yyval.l) = List_Create(4, 4, sizeof(double));
       Vertex *v = FindPoint((int)(yyvsp[(4) - (5)].d));
       if(!v)
-	yymsg(GERROR, "Unknown point %d", (int)(yyvsp[(4) - (5)].d));
+	yymsg(0, "Unknown point %d", (int)(yyvsp[(4) - (5)].d));
       else{
 	List_Add((yyval.l), &v->Pos.X);
 	List_Add((yyval.l), &v->Pos.Y);
@@ -4808,11 +4807,11 @@ yyreduce:
     break;
 
   case 90:
-#line 1144 "Gmsh.y"
+#line 1143 "Gmsh.y"
     {
       int num = (int)(yyvsp[(3) - (7)].d);
       if(FindPoint(num)){
-	yymsg(GERROR, "Point %d already exists", num);
+	yymsg(0, "Point %d already exists", num);
       }
       else{
 	double x = CTX.geom.scaling_factor * (yyvsp[(6) - (7)].v)[0];
@@ -4833,11 +4832,11 @@ yyreduce:
     break;
 
   case 91:
-#line 1166 "Gmsh.y"
+#line 1165 "Gmsh.y"
     {
       int num = (int)(yyvsp[(4) - (8)].i);
       if(FindPhysicalGroup(num, MSH_PHYSICAL_POINT)){
-	yymsg(GERROR, "Physical point %d already exists", num);
+	yymsg(0, "Physical point %d already exists", num);
       }
       else{
 	List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (8)].l));
@@ -4852,7 +4851,7 @@ yyreduce:
     break;
 
   case 92:
-#line 1182 "Gmsh.y"
+#line 1181 "Gmsh.y"
     {      
       for(int i = 0; i < List_Nbr((yyvsp[(3) - (6)].l)); i++){
 	double d;
@@ -4874,11 +4873,11 @@ yyreduce:
     break;
 
   case 93:
-#line 1204 "Gmsh.y"
+#line 1203 "Gmsh.y"
     {
       int num = (int)(yyvsp[(3) - (7)].d);
       if(FindCurve(num)){
-	yymsg(GERROR, "Curve %d already exists", num);
+	yymsg(0, "Curve %d already exists", num);
       }
       else{
 	List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (7)].l));
@@ -4895,11 +4894,11 @@ yyreduce:
     break;
 
   case 94:
-#line 1222 "Gmsh.y"
+#line 1221 "Gmsh.y"
     {
       int num = (int)(yyvsp[(3) - (7)].d);
       if(FindCurve(num)){
-	yymsg(GERROR, "Curve %d already exists", num);
+	yymsg(0, "Curve %d already exists", num);
       }
       else{
 	List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (7)].l));
@@ -4916,11 +4915,11 @@ yyreduce:
     break;
 
   case 95:
-#line 1240 "Gmsh.y"
+#line 1239 "Gmsh.y"
     {
       int num = (int)(yyvsp[(3) - (7)].d);
       if(FindCurve(num)){
-	yymsg(GERROR, "Curve %d already exists", num);
+	yymsg(0, "Curve %d already exists", num);
       }
       else{
 	List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (7)].l));
@@ -4937,11 +4936,11 @@ yyreduce:
     break;
 
   case 96:
-#line 1258 "Gmsh.y"
+#line 1257 "Gmsh.y"
     {
       int num = (int)(yyvsp[(3) - (9)].d);
       if(FindCurve(num)){
-	yymsg(GERROR, "Curve %d already exists", num);
+	yymsg(0, "Curve %d already exists", num);
       }
       else{
 	List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (9)].l));
@@ -4966,11 +4965,11 @@ yyreduce:
     break;
 
   case 97:
-#line 1284 "Gmsh.y"
+#line 1283 "Gmsh.y"
     {
       int num = (int)(yyvsp[(3) - (7)].d);
       if(FindCurve(num)){
-	yymsg(GERROR, "Curve %d already exists", num);
+	yymsg(0, "Curve %d already exists", num);
       }
       else{
 	List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (7)].l));
@@ -4987,11 +4986,11 @@ yyreduce:
     break;
 
   case 98:
-#line 1302 "Gmsh.y"
+#line 1301 "Gmsh.y"
     {
       int num = (int)(yyvsp[(3) - (9)].d);
       if(FindCurve(num)){
-	yymsg(GERROR, "Curve %d already exists", num);
+	yymsg(0, "Curve %d already exists", num);
       }
       else{
 	List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (9)].l));
@@ -5016,11 +5015,11 @@ yyreduce:
     break;
 
   case 99:
-#line 1329 "Gmsh.y"
+#line 1328 "Gmsh.y"
     {
       int num = (int)(yyvsp[(3) - (17)].d);
       if(FindCurve(num)){
-	yymsg(GERROR, "Curve %d already exists", num);
+	yymsg(0, "Curve %d already exists", num);
       }
       else{
 	Curve *c = Create_Curve(num, MSH_SEGM_PARAMETRIC, 2, NULL, NULL,
@@ -5038,11 +5037,11 @@ yyreduce:
     break;
 
   case 100:
-#line 1348 "Gmsh.y"
+#line 1347 "Gmsh.y"
     {
       int num = (int)(yyvsp[(3) - (7)].d);
       if(FindCurve(num)){
-	yymsg(GERROR, "Curve %d already exists", num);
+	yymsg(0, "Curve %d already exists", num);
       }
       else{
 	List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (7)].l));
@@ -5059,11 +5058,11 @@ yyreduce:
     break;
 
   case 101:
-#line 1366 "Gmsh.y"
+#line 1365 "Gmsh.y"
     {
       int num = (int)(yyvsp[(3) - (7)].d);
       if(FindCurve(num)){
-	yymsg(GERROR, "Curve %d already exists", num);
+	yymsg(0, "Curve %d already exists", num);
       }
       else{
 	List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (7)].l));
@@ -5080,17 +5079,17 @@ yyreduce:
     break;
 
   case 102:
-#line 1384 "Gmsh.y"
+#line 1383 "Gmsh.y"
     {
       int num = (int)(yyvsp[(3) - (11)].d);
       if(List_Nbr((yyvsp[(6) - (11)].l)) + (int)(yyvsp[(10) - (11)].d) + 1 != List_Nbr((yyvsp[(8) - (11)].l))){
-	yymsg(GERROR, "Wrong definition of Nurbs Curve %d: "
+	yymsg(0, "Wrong definition of Nurbs Curve %d: "
 	      "got %d knots, need N + D + 1 = %d + %d + 1 = %d",
 	      (int)(yyvsp[(3) - (11)].d), List_Nbr((yyvsp[(8) - (11)].l)), List_Nbr((yyvsp[(6) - (11)].l)), (int)(yyvsp[(10) - (11)].d), List_Nbr((yyvsp[(6) - (11)].l)) + (int)(yyvsp[(10) - (11)].d) + 1);
       }
       else{
 	if(FindCurve(num)){
-	  yymsg(GERROR, "Curve %d already exists", num);
+	  yymsg(0, "Curve %d already exists", num);
 	}
 	else{
 	  List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (11)].l));
@@ -5109,11 +5108,11 @@ yyreduce:
     break;
 
   case 103:
-#line 1410 "Gmsh.y"
+#line 1409 "Gmsh.y"
     {
       int num = (int)(yyvsp[(4) - (8)].d);
       if(FindEdgeLoop(num)){
-	yymsg(GERROR, "Line loop %d already exists", num);
+	yymsg(0, "Line loop %d already exists", num);
       }
       else{
 	List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (8)].l));
@@ -5129,11 +5128,11 @@ yyreduce:
     break;
 
   case 104:
-#line 1427 "Gmsh.y"
+#line 1426 "Gmsh.y"
     {
       int num = (int)(yyvsp[(4) - (8)].i);
       if(FindPhysicalGroup(num, MSH_PHYSICAL_LINE)){
-	yymsg(GERROR, "Physical line %d already exists", num);
+	yymsg(0, "Physical line %d already exists", num);
       }
       else{
 	List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (8)].l));
@@ -5148,11 +5147,11 @@ yyreduce:
     break;
 
   case 105:
-#line 1446 "Gmsh.y"
+#line 1445 "Gmsh.y"
     {
       int num = (int)(yyvsp[(4) - (8)].d);
       if(FindSurface(num)){
-	yymsg(GERROR, "Surface %d already exists", num);
+	yymsg(0, "Surface %d already exists", num);
       }
       else{
 	Surface *s = Create_Surface(num, MSH_SURF_PLAN);
@@ -5169,18 +5168,18 @@ yyreduce:
     break;
 
   case 106:
-#line 1464 "Gmsh.y"
+#line 1463 "Gmsh.y"
     {
       int num = (int)(yyvsp[(4) - (9)].d), type = 0;
       if(FindSurface(num)){
-	yymsg(GERROR, "Surface %d already exists", num);
+	yymsg(0, "Surface %d already exists", num);
       }
       else{
 	double d;
 	List_Read((yyvsp[(7) - (9)].l), 0, &d);
 	EdgeLoop *el = FindEdgeLoop((int)fabs(d));
 	if(!el){
-	  yymsg(GERROR, "Unknown line loop %d", (int)d);
+	  yymsg(0, "Unknown line loop %d", (int)d);
 	}
 	else{
 	  int j = List_Nbr(el->Curves);
@@ -5191,7 +5190,7 @@ yyreduce:
 	    type = MSH_SURF_TRIC;
 	  }
 	  else{
-	    yymsg(GERROR, "Wrong definition of Ruled Surface %d: "
+	    yymsg(0, "Wrong definition of Ruled Surface %d: "
 		  "%d borders instead of 3 or 4", num, j);
 	    type = MSH_SURF_PLAN;
 	  }
@@ -5211,7 +5210,7 @@ yyreduce:
     break;
 
   case 107:
-#line 1503 "Gmsh.y"
+#line 1502 "Gmsh.y"
     {
       myGmshSurface = 0;
       (yyval.s).Type = 0;
@@ -5220,7 +5219,7 @@ yyreduce:
     break;
 
   case 108:
-#line 1509 "Gmsh.y"
+#line 1508 "Gmsh.y"
     {
       myGmshSurface = gmshSurface::getSurface((int)(yyvsp[(3) - (4)].d));
       (yyval.s).Type = 0;
@@ -5229,7 +5228,7 @@ yyreduce:
     break;
 
   case 109:
-#line 1515 "Gmsh.y"
+#line 1514 "Gmsh.y"
     {
       int num = (int)(yyvsp[(4) - (10)].d);
       myGmshSurface = gmshParametricSurface::NewParametricSurface(num, (yyvsp[(7) - (10)].c), (yyvsp[(8) - (10)].c), (yyvsp[(9) - (10)].c));
@@ -5239,11 +5238,11 @@ yyreduce:
     break;
 
   case 110:
-#line 1522 "Gmsh.y"
+#line 1521 "Gmsh.y"
     {
       int num = (int)(yyvsp[(3) - (7)].d);
       if (List_Nbr((yyvsp[(6) - (7)].l)) != 2){
-	yymsg(GERROR, "Sphere %d has to be defined using 2 points (center + "
+	yymsg(0, "Sphere %d has to be defined using 2 points (center + "
 	      "any point) and not %d", num, List_Nbr((yyvsp[(6) - (7)].l)));
       }
       else{
@@ -5252,8 +5251,8 @@ yyreduce:
 	List_Read((yyvsp[(6) - (7)].l), 1, &p2);
 	Vertex *v1 = FindPoint((int)p1);
 	Vertex *v2 = FindPoint((int)p2);
-	if(!v1) yymsg(GERROR, "Sphere %d : unknown point %d", num, (int)p1);
-	if(!v2) yymsg(GERROR, "Sphere %d : unknown point %d", num, (int)p2);
+	if(!v1) yymsg(0, "Sphere %d : unknown point %d", num, (int)p1);
+	if(!v2) yymsg(0, "Sphere %d : unknown point %d", num, (int)p2);
 	if(v1 && v2)
 	  myGmshSurface = gmshSphere::NewSphere
 	    (num, v1->Pos.X, v1->Pos.Y, v1->Pos.Z,
@@ -5267,11 +5266,11 @@ yyreduce:
     break;
 
   case 111:
-#line 1547 "Gmsh.y"
+#line 1546 "Gmsh.y"
     {
       int num = (int)(yyvsp[(3) - (7)].d);
       if (List_Nbr((yyvsp[(6) - (7)].l)) != 2){
-	yymsg(GERROR, "PolarSphere %d has to be defined using 2 points (center + "
+	yymsg(0, "PolarSphere %d has to be defined using 2 points (center + "
 	      "any point) and not %d", num, List_Nbr((yyvsp[(6) - (7)].l)));
       }
       else{
@@ -5280,8 +5279,8 @@ yyreduce:
 	List_Read((yyvsp[(6) - (7)].l), 1, &p2);
 	Vertex *v1 = FindPoint((int)p1);
 	Vertex *v2 = FindPoint((int)p2);
-	if(!v1) yymsg(GERROR, "PolarSphere %d : unknown point %d", num, (int)p1);
-	if(!v2) yymsg(GERROR, "PolarSphere %d : unknown point %d", num, (int)p2);
+	if(!v1) yymsg(0, "PolarSphere %d : unknown point %d", num, (int)p1);
+	if(!v2) yymsg(0, "PolarSphere %d : unknown point %d", num, (int)p2);
 	if(v1 && v2)
 	  myGmshSurface = gmshPolarSphere::NewPolarSphere
 	    (num, v1->Pos.X, v1->Pos.Y, v1->Pos.Z,
@@ -5295,11 +5294,11 @@ yyreduce:
     break;
 
   case 112:
-#line 1572 "Gmsh.y"
+#line 1571 "Gmsh.y"
     {
       int num = (int)(yyvsp[(4) - (8)].d);
       if(FindSurfaceLoop(num)){
-	yymsg(GERROR, "Surface loop %d already exists", num);
+	yymsg(0, "Surface loop %d already exists", num);
       }
       else{
 	List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (8)].l));
@@ -5314,11 +5313,11 @@ yyreduce:
     break;
 
   case 113:
-#line 1588 "Gmsh.y"
+#line 1587 "Gmsh.y"
     {
       int num = (int)(yyvsp[(4) - (8)].i);
       if(FindPhysicalGroup(num, MSH_PHYSICAL_SURFACE)){
-	yymsg(GERROR, "Physical surface %d already exists", num);
+	yymsg(0, "Physical surface %d already exists", num);
       }
       else{
 	List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (8)].l));
@@ -5333,12 +5332,12 @@ yyreduce:
     break;
 
   case 114:
-#line 1608 "Gmsh.y"
+#line 1607 "Gmsh.y"
     {
-      yymsg(GERROR, "'Complex Volume' command is deprecated: use 'Volume' instead");
+      yymsg(0, "'Complex Volume' command is deprecated: use 'Volume' instead");
       int num = (int)(yyvsp[(4) - (8)].d);
       if(FindVolume(num)){
-	yymsg(GERROR, "Volume %d already exists", num);
+	yymsg(0, "Volume %d already exists", num);
       }
       else{
 	Volume *v = Create_Volume(num, MSH_VOLUME);
@@ -5354,11 +5353,11 @@ yyreduce:
     break;
 
   case 115:
-#line 1626 "Gmsh.y"
+#line 1625 "Gmsh.y"
     {
       int num = (int)(yyvsp[(3) - (7)].d);
       if(FindVolume(num)){
-	yymsg(GERROR, "Volume %d already exists", num);
+	yymsg(0, "Volume %d already exists", num);
       }
       else{
 	Volume *v = Create_Volume(num, MSH_VOLUME);
@@ -5374,11 +5373,11 @@ yyreduce:
     break;
 
   case 116:
-#line 1643 "Gmsh.y"
+#line 1642 "Gmsh.y"
     {
       int num = (int)(yyvsp[(4) - (8)].i);
       if(FindPhysicalGroup(num, MSH_PHYSICAL_VOLUME)){
-	yymsg(GERROR, "Physical volume %d already exists", num);
+	yymsg(0, "Physical volume %d already exists", num);
       }
       else{
 	List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (8)].l));
@@ -5393,7 +5392,7 @@ yyreduce:
     break;
 
   case 117:
-#line 1664 "Gmsh.y"
+#line 1663 "Gmsh.y"
     {
       TranslateShapes((yyvsp[(2) - (5)].v)[0], (yyvsp[(2) - (5)].v)[1], (yyvsp[(2) - (5)].v)[2], (yyvsp[(4) - (5)].l));
       (yyval.l) = (yyvsp[(4) - (5)].l);
@@ -5401,7 +5400,7 @@ yyreduce:
     break;
 
   case 118:
-#line 1669 "Gmsh.y"
+#line 1668 "Gmsh.y"
     {
       RotateShapes((yyvsp[(3) - (11)].v)[0], (yyvsp[(3) - (11)].v)[1], (yyvsp[(3) - (11)].v)[2], (yyvsp[(5) - (11)].v)[0], (yyvsp[(5) - (11)].v)[1], (yyvsp[(5) - (11)].v)[2], (yyvsp[(7) - (11)].d), (yyvsp[(10) - (11)].l));
       (yyval.l) = (yyvsp[(10) - (11)].l);
@@ -5409,7 +5408,7 @@ yyreduce:
     break;
 
   case 119:
-#line 1674 "Gmsh.y"
+#line 1673 "Gmsh.y"
     {
       SymmetryShapes((yyvsp[(2) - (5)].v)[0], (yyvsp[(2) - (5)].v)[1], (yyvsp[(2) - (5)].v)[2], (yyvsp[(2) - (5)].v)[3], (yyvsp[(4) - (5)].l));
       (yyval.l) = (yyvsp[(4) - (5)].l);
@@ -5417,7 +5416,7 @@ yyreduce:
     break;
 
   case 120:
-#line 1679 "Gmsh.y"
+#line 1678 "Gmsh.y"
     {
       DilatShapes((yyvsp[(3) - (9)].v)[0], (yyvsp[(3) - (9)].v)[1], (yyvsp[(3) - (9)].v)[2], (yyvsp[(5) - (9)].d), (yyvsp[(8) - (9)].l));
       (yyval.l) = (yyvsp[(8) - (9)].l);
@@ -5425,7 +5424,7 @@ yyreduce:
     break;
 
   case 121:
-#line 1684 "Gmsh.y"
+#line 1683 "Gmsh.y"
     {
       (yyval.l) = List_Create(3, 3, sizeof(Shape));
       for(int i = 0; i < List_Nbr((yyvsp[(3) - (4)].l)); i++){
@@ -5439,7 +5438,7 @@ yyreduce:
     break;
 
   case 122:
-#line 1695 "Gmsh.y"
+#line 1694 "Gmsh.y"
     { 
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       IntersectCurvesWithSurface((yyvsp[(4) - (9)].l), (int)(yyvsp[(8) - (9)].d), (yyval.l));
@@ -5448,7 +5447,7 @@ yyreduce:
     break;
 
   case 123:
-#line 1701 "Gmsh.y"
+#line 1700 "Gmsh.y"
     { 
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       BoundaryShapes((yyvsp[(3) - (4)].l), (yyval.l));
@@ -5457,31 +5456,31 @@ yyreduce:
     break;
 
   case 124:
-#line 1709 "Gmsh.y"
+#line 1708 "Gmsh.y"
     { (yyval.l) = (yyvsp[(1) - (1)].l); ;}
     break;
 
   case 125:
-#line 1710 "Gmsh.y"
+#line 1709 "Gmsh.y"
     { (yyval.l) = (yyvsp[(1) - (1)].l); ;}
     break;
 
   case 126:
-#line 1715 "Gmsh.y"
+#line 1714 "Gmsh.y"
     {
       (yyval.l) = List_Create(3, 3, sizeof(Shape));
     ;}
     break;
 
   case 127:
-#line 1719 "Gmsh.y"
+#line 1718 "Gmsh.y"
     {
       List_Add((yyval.l), &(yyvsp[(2) - (2)].s));
     ;}
     break;
 
   case 128:
-#line 1723 "Gmsh.y"
+#line 1722 "Gmsh.y"
     {
       for(int i = 0; i < List_Nbr((yyvsp[(4) - (6)].l)); i++){
 	double d;
@@ -5500,14 +5499,14 @@ yyreduce:
 	    List_Add((yyval.l), &TheShape);
 	  }
 	  else
-	    yymsg(WARNING, "Unknown point %d", TheShape.Num);
+	    yymsg(1, "Unknown point %d", TheShape.Num);
 	}
       }
     ;}
     break;
 
   case 129:
-#line 1746 "Gmsh.y"
+#line 1745 "Gmsh.y"
     {
       for(int i = 0; i < List_Nbr((yyvsp[(4) - (6)].l)); i++){
 	double d;
@@ -5526,14 +5525,14 @@ yyreduce:
 	    List_Add((yyval.l), &TheShape);
 	  }
 	  else
-	    yymsg(WARNING, "Unknown curve %d", TheShape.Num);
+	    yymsg(1, "Unknown curve %d", TheShape.Num);
 	}
       }
     ;}
     break;
 
   case 130:
-#line 1769 "Gmsh.y"
+#line 1768 "Gmsh.y"
     {
       for(int i = 0; i < List_Nbr((yyvsp[(4) - (6)].l)); i++){
 	double d;
@@ -5552,14 +5551,14 @@ yyreduce:
 	    List_Add((yyval.l), &TheShape);
 	  }
 	  else
-	    yymsg(WARNING, "Unknown surface %d", TheShape.Num);
+	    yymsg(1, "Unknown surface %d", TheShape.Num);
 	}
       }
     ;}
     break;
 
   case 131:
-#line 1792 "Gmsh.y"
+#line 1791 "Gmsh.y"
     {
       for(int i = 0; i < List_Nbr((yyvsp[(4) - (6)].l)); i++){
 	double d;
@@ -5578,14 +5577,14 @@ yyreduce:
 	    List_Add((yyval.l), &TheShape);
 	  }
 	  else
-	    yymsg(WARNING, "Unknown volume %d", TheShape.Num);
+	    yymsg(1, "Unknown volume %d", TheShape.Num);
 	}
       }
     ;}
     break;
 
   case 132:
-#line 1820 "Gmsh.y"
+#line 1819 "Gmsh.y"
     {
       for(int i = 0; i < List_Nbr((yyvsp[(3) - (4)].l)); i++){
 	Shape TheShape;
@@ -5597,14 +5596,14 @@ yyreduce:
     break;
 
   case 133:
-#line 1829 "Gmsh.y"
+#line 1828 "Gmsh.y"
     {
       GModel::current()->getFields()->delete_field((int)(yyvsp[(4) - (6)].d));
     ;}
     break;
 
   case 134:
-#line 1833 "Gmsh.y"
+#line 1832 "Gmsh.y"
     {
 #if !defined(HAVE_NO_POST)
       if(!strcmp((yyvsp[(2) - (6)].c), "View")){
@@ -5612,17 +5611,17 @@ yyreduce:
 	if(index >= 0 && index < (int)PView::list.size())
 	  delete PView::list[index];
 	else
-	  yymsg(GERROR, "Unknown view %d", index);
+	  yymsg(0, "Unknown view %d", index);
       }
       else
-	yymsg(GERROR, "Unknown command 'Delete %s'", (yyvsp[(2) - (6)].c));
+	yymsg(0, "Unknown command 'Delete %s'", (yyvsp[(2) - (6)].c));
 #endif
       Free((yyvsp[(2) - (6)].c));
     ;}
     break;
 
   case 135:
-#line 1848 "Gmsh.y"
+#line 1847 "Gmsh.y"
     {
       if(!strcmp((yyvsp[(2) - (3)].c), "Meshes") || !strcmp((yyvsp[(2) - (3)].c), "All")){
 	GModel::current()->destroy();
@@ -5635,13 +5634,13 @@ yyreduce:
 	GModel::current()->deletePhysicalGroups();
       }
       else
-	yymsg(GERROR, "Unknown command 'Delete %s'", (yyvsp[(2) - (3)].c));
+	yymsg(0, "Unknown command 'Delete %s'", (yyvsp[(2) - (3)].c));
       Free((yyvsp[(2) - (3)].c));
     ;}
     break;
 
   case 136:
-#line 1864 "Gmsh.y"
+#line 1863 "Gmsh.y"
     {
 #if !defined(HAVE_NO_POST)
       if(!strcmp((yyvsp[(2) - (4)].c), "Empty") && !strcmp((yyvsp[(3) - (4)].c), "Views")){
@@ -5649,14 +5648,14 @@ yyreduce:
 	  if(PView::list[i]->getData()->empty()) delete PView::list[i];
       }
       else
-	yymsg(GERROR, "Unknown command 'Delete %s %s'", (yyvsp[(2) - (4)].c), (yyvsp[(3) - (4)].c));
+	yymsg(0, "Unknown command 'Delete %s %s'", (yyvsp[(2) - (4)].c), (yyvsp[(3) - (4)].c));
 #endif
       Free((yyvsp[(2) - (4)].c)); Free((yyvsp[(3) - (4)].c));
     ;}
     break;
 
   case 137:
-#line 1881 "Gmsh.y"
+#line 1880 "Gmsh.y"
     {
       for(int i = 0; i < List_Nbr((yyvsp[(4) - (5)].l)); i++){
 	Shape TheShape;
@@ -5668,7 +5667,7 @@ yyreduce:
     break;
 
   case 138:
-#line 1895 "Gmsh.y"
+#line 1894 "Gmsh.y"
     {
       for(int i = 0; i < 4; i++)
 	VisibilityShape((yyvsp[(2) - (3)].c), i, 1);
@@ -5677,7 +5676,7 @@ yyreduce:
     break;
 
   case 139:
-#line 1901 "Gmsh.y"
+#line 1900 "Gmsh.y"
     {
       for(int i = 0; i < 4; i++)
 	VisibilityShape((yyvsp[(2) - (3)].c), i, 0);
@@ -5686,7 +5685,7 @@ yyreduce:
     break;
 
   case 140:
-#line 1907 "Gmsh.y"
+#line 1906 "Gmsh.y"
     {
       for(int i = 0; i < List_Nbr((yyvsp[(3) - (4)].l)); i++){
 	Shape TheShape;
@@ -5698,7 +5697,7 @@ yyreduce:
     break;
 
   case 141:
-#line 1916 "Gmsh.y"
+#line 1915 "Gmsh.y"
     {
       for(int i = 0; i < List_Nbr((yyvsp[(3) - (4)].l)); i++){
 	Shape TheShape;
@@ -5710,7 +5709,7 @@ yyreduce:
     break;
 
   case 142:
-#line 1930 "Gmsh.y"
+#line 1929 "Gmsh.y"
     {
       if(!strcmp((yyvsp[(1) - (3)].c), "Include")){
 	char tmpstring[1024];
@@ -5722,10 +5721,10 @@ yyreduce:
 	// open simultaneously. The right solution would be of course
 	// to modify FunctionManager to reopen the files instead of
 	// using the FILE pointer, but hey, I'm lazy...
-	Msg(STATUS2, "Reading '%s'", tmpstring);
+	Msg::Status(2, true, "Reading '%s'", tmpstring);
 	ParseFile(tmpstring, 0, 1);
 	SetBoundingBox();
-	Msg(STATUS2, "Read '%s'", tmpstring);
+	Msg::Status(2, true, "Read '%s'", tmpstring);
       }
       else if(!strcmp((yyvsp[(1) - (3)].c), "Print")){
 #if defined(HAVE_FLTK)
@@ -5755,13 +5754,13 @@ yyreduce:
       else if(!strcmp((yyvsp[(1) - (3)].c), "System"))
 	SystemCall((yyvsp[(2) - (3)].c));
       else
-	yymsg(GERROR, "Unknown command '%s'", (yyvsp[(1) - (3)].c));
+	yymsg(0, "Unknown command '%s'", (yyvsp[(1) - (3)].c));
       Free((yyvsp[(1) - (3)].c)); Free((yyvsp[(2) - (3)].c));
     ;}
     break;
 
   case 143:
-#line 1978 "Gmsh.y"
+#line 1977 "Gmsh.y"
     {
 #if !defined(HAVE_NO_POST)
       if(!strcmp((yyvsp[(1) - (7)].c), "Save") && !strcmp((yyvsp[(2) - (7)].c), "View")){
@@ -5772,17 +5771,17 @@ yyreduce:
 	  PView::list[index]->write(tmpstring, CTX.post.file_format);
 	}
 	else
-	  yymsg(GERROR, "Unknown view %d", index);
+	  yymsg(0, "Unknown view %d", index);
       }
       else
-	yymsg(GERROR, "Unknown command '%s'", (yyvsp[(1) - (7)].c));
+	yymsg(0, "Unknown command '%s'", (yyvsp[(1) - (7)].c));
 #endif
       Free((yyvsp[(1) - (7)].c)); Free((yyvsp[(2) - (7)].c)); Free((yyvsp[(6) - (7)].c));
     ;}
     break;
 
   case 144:
-#line 1996 "Gmsh.y"
+#line 1995 "Gmsh.y"
     {
 #if !defined(HAVE_NO_POST)
       if(!strcmp((yyvsp[(1) - (7)].c), "Background") && !strcmp((yyvsp[(2) - (7)].c), "Mesh")  && !strcmp((yyvsp[(3) - (7)].c), "View")){
@@ -5790,23 +5789,23 @@ yyreduce:
 	if(index >= 0 && index < (int)PView::list.size())
 	  GModel::current()->getFields()->set_background_mesh(index);
 	else
-	  yymsg(GERROR, "Unknown view %d", index);
+	  yymsg(0, "Unknown view %d", index);
       }
       else
-	yymsg(GERROR, "Unknown command '%s'", (yyvsp[(1) - (7)].c));
+	yymsg(0, "Unknown command '%s'", (yyvsp[(1) - (7)].c));
 #endif
       Free((yyvsp[(1) - (7)].c)); Free((yyvsp[(2) - (7)].c)); Free((yyvsp[(3) - (7)].c));
     ;}
     break;
 
   case 145:
-#line 2011 "Gmsh.y"
+#line 2010 "Gmsh.y"
     {
       if(!strcmp((yyvsp[(1) - (3)].c), "Sleep")){
 	SleepInSeconds((yyvsp[(2) - (3)].d));
       }
       else if(!strcmp((yyvsp[(1) - (3)].c), "Remesh")){
-	Msg(GERROR, "Surface ReMeshing must be reinterfaced");
+	Msg::Error("Surface ReMeshing must be reinterfaced");
       }
       else if(!strcmp((yyvsp[(1) - (3)].c), "Mesh")){
 	int lock = CTX.threads_lock;
@@ -5816,23 +5815,23 @@ yyreduce:
 	CTX.threads_lock = lock;
       }
       else if(!strcmp((yyvsp[(1) - (3)].c), "Status")){
-	yymsg(GERROR, "Mesh directives are not (yet) allowed in scripts");
+	yymsg(0, "Mesh directives are not (yet) allowed in scripts");
       }
       else
-	yymsg(GERROR, "Unknown command '%s'", (yyvsp[(1) - (3)].c));
+	yymsg(0, "Unknown command '%s'", (yyvsp[(1) - (3)].c));
       Free((yyvsp[(1) - (3)].c));
     ;}
     break;
 
   case 146:
-#line 2033 "Gmsh.y"
+#line 2032 "Gmsh.y"
     {
 #if !defined(HAVE_NO_POST)
        try {
 	 GMSH_PluginManager::instance()->action((yyvsp[(3) - (7)].c), (yyvsp[(6) - (7)].c), 0);
        }
        catch(...) {
-	 yymsg(GERROR, "Unknown action '%s' or plugin '%s'", (yyvsp[(6) - (7)].c), (yyvsp[(3) - (7)].c));
+	 yymsg(0, "Unknown action '%s' or plugin '%s'", (yyvsp[(6) - (7)].c), (yyvsp[(3) - (7)].c));
        }
 #endif
        Free((yyvsp[(3) - (7)].c)); Free((yyvsp[(6) - (7)].c));
@@ -5840,7 +5839,7 @@ yyreduce:
     break;
 
   case 147:
-#line 2045 "Gmsh.y"
+#line 2044 "Gmsh.y"
     {
 #if !defined(HAVE_NO_POST)
       if(!strcmp((yyvsp[(2) - (3)].c), "ElementsFromAllViews"))
@@ -5860,21 +5859,21 @@ yyreduce:
       else if(!strcmp((yyvsp[(2) - (3)].c), "TimeSteps"))
 	PView::combine(true, 2, CTX.post.combine_remove_orig);
       else
-	yymsg(GERROR, "Unknown 'Combine' command");
+	yymsg(0, "Unknown 'Combine' command");
 #endif
       Free((yyvsp[(2) - (3)].c));
     ;}
     break;
 
   case 148:
-#line 2069 "Gmsh.y"
+#line 2068 "Gmsh.y"
     {
       exit(0);
     ;}
     break;
 
   case 149:
-#line 2073 "Gmsh.y"
+#line 2072 "Gmsh.y"
     {
       CTX.forced_bbox = 0;
       SetBoundingBox();
@@ -5882,7 +5881,7 @@ yyreduce:
     break;
 
   case 150:
-#line 2078 "Gmsh.y"
+#line 2077 "Gmsh.y"
     {
       CTX.forced_bbox = 1;
       SetBoundingBox((yyvsp[(3) - (15)].d), (yyvsp[(5) - (15)].d), (yyvsp[(7) - (15)].d), (yyvsp[(9) - (15)].d), (yyvsp[(11) - (15)].d), (yyvsp[(13) - (15)].d));
@@ -5890,7 +5889,7 @@ yyreduce:
     break;
 
   case 151:
-#line 2083 "Gmsh.y"
+#line 2082 "Gmsh.y"
     {
 #if defined(HAVE_FLTK)
       Draw();
@@ -5899,7 +5898,7 @@ yyreduce:
     break;
 
   case 152:
-#line 2095 "Gmsh.y"
+#line 2094 "Gmsh.y"
     {
       LoopControlVariablesTab[ImbricatedLoop][0] = (yyvsp[(3) - (6)].d);
       LoopControlVariablesTab[ImbricatedLoop][1] = (yyvsp[(5) - (6)].d);
@@ -5912,14 +5911,14 @@ yyreduce:
       else
 	ImbricatedLoop++;
       if(ImbricatedLoop > MAX_RECUR_LOOPS-1){
-	yymsg(GERROR, "Reached maximum number of imbricated loops");
+	yymsg(0, "Reached maximum number of imbricated loops");
 	ImbricatedLoop = MAX_RECUR_LOOPS-1;
       }
     ;}
     break;
 
   case 153:
-#line 2112 "Gmsh.y"
+#line 2111 "Gmsh.y"
     {
       LoopControlVariablesTab[ImbricatedLoop][0] = (yyvsp[(3) - (8)].d);
       LoopControlVariablesTab[ImbricatedLoop][1] = (yyvsp[(5) - (8)].d);
@@ -5932,14 +5931,14 @@ yyreduce:
       else
 	ImbricatedLoop++;
       if(ImbricatedLoop > MAX_RECUR_LOOPS-1){
-	yymsg(GERROR, "Reached maximum number of imbricated loops");
+	yymsg(0, "Reached maximum number of imbricated loops");
 	ImbricatedLoop = MAX_RECUR_LOOPS-1;
       }
     ;}
     break;
 
   case 154:
-#line 2129 "Gmsh.y"
+#line 2128 "Gmsh.y"
     {
       LoopControlVariablesTab[ImbricatedLoop][0] = (yyvsp[(5) - (8)].d);
       LoopControlVariablesTab[ImbricatedLoop][1] = (yyvsp[(7) - (8)].d);
@@ -5962,14 +5961,14 @@ yyreduce:
       else
 	ImbricatedLoop++;
       if(ImbricatedLoop > MAX_RECUR_LOOPS-1){
-	yymsg(GERROR, "Reached maximum number of imbricated loops");
+	yymsg(0, "Reached maximum number of imbricated loops");
 	ImbricatedLoop = MAX_RECUR_LOOPS-1;
       }
     ;}
     break;
 
   case 155:
-#line 2156 "Gmsh.y"
+#line 2155 "Gmsh.y"
     {
       LoopControlVariablesTab[ImbricatedLoop][0] = (yyvsp[(5) - (10)].d);
       LoopControlVariablesTab[ImbricatedLoop][1] = (yyvsp[(7) - (10)].d);
@@ -5992,17 +5991,17 @@ yyreduce:
       else
 	ImbricatedLoop++;
       if(ImbricatedLoop > MAX_RECUR_LOOPS-1){
-	yymsg(GERROR, "Reached maximum number of imbricated loops");
+	yymsg(0, "Reached maximum number of imbricated loops");
 	ImbricatedLoop = MAX_RECUR_LOOPS-1;
       }
     ;}
     break;
 
   case 156:
-#line 2183 "Gmsh.y"
+#line 2182 "Gmsh.y"
     {
       if(ImbricatedLoop <= 0){
-	yymsg(GERROR, "Invalid For/EndFor loop");
+	yymsg(0, "Invalid For/EndFor loop");
 	ImbricatedLoop = 0;
       }
       else{
@@ -6018,7 +6017,7 @@ yyreduce:
 	    TheSymbol.Name = LoopControlVariablesNameTab[ImbricatedLoop-1];
 	    Symbol *pSymbol;
 	    if(!(pSymbol = (Symbol*)Tree_PQuery(Symbol_T, &TheSymbol)))
-	      yymsg(GERROR, "Unknown loop variable");
+	      yymsg(0, "Unknown loop variable");
 	    else
 	      *(double*)List_Pointer_Fast(pSymbol->val, 0) += 
 		LoopControlVariablesTab[ImbricatedLoop-1][2];
@@ -6033,50 +6032,50 @@ yyreduce:
     break;
 
   case 157:
-#line 2214 "Gmsh.y"
+#line 2213 "Gmsh.y"
     {
       if(!FunctionManager::Instance()->createFunction((yyvsp[(2) - (2)].c), gmsh_yyin, gmsh_yyname,
 						      gmsh_yylineno))
-	yymsg(GERROR, "Redefinition of function %s", (yyvsp[(2) - (2)].c));
+	yymsg(0, "Redefinition of function %s", (yyvsp[(2) - (2)].c));
       skip_until(NULL, "Return");
       //FIXME: wee leak $2
     ;}
     break;
 
   case 158:
-#line 2222 "Gmsh.y"
+#line 2221 "Gmsh.y"
     {
       if(!FunctionManager::Instance()->leaveFunction(&gmsh_yyin, gmsh_yyname,
 						     gmsh_yylineno))
-	yymsg(GERROR, "Error while exiting function");
+	yymsg(0, "Error while exiting function");
     ;}
     break;
 
   case 159:
-#line 2228 "Gmsh.y"
+#line 2227 "Gmsh.y"
     {
       if(!FunctionManager::Instance()->enterFunction((yyvsp[(2) - (3)].c), &gmsh_yyin, gmsh_yyname,
 						     gmsh_yylineno))
-	yymsg(GERROR, "Unknown function %s", (yyvsp[(2) - (3)].c));
+	yymsg(0, "Unknown function %s", (yyvsp[(2) - (3)].c));
       //FIXME: wee leak $2
     ;}
     break;
 
   case 160:
-#line 2235 "Gmsh.y"
+#line 2234 "Gmsh.y"
     {
       if(!(yyvsp[(3) - (4)].d)) skip_until("If", "EndIf");
     ;}
     break;
 
   case 161:
-#line 2239 "Gmsh.y"
+#line 2238 "Gmsh.y"
     {
     ;}
     break;
 
   case 162:
-#line 2248 "Gmsh.y"
+#line 2247 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShapes(TRANSLATE, (yyvsp[(4) - (5)].l), 
@@ -6087,7 +6086,7 @@ yyreduce:
     break;
 
   case 163:
-#line 2256 "Gmsh.y"
+#line 2255 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShapes(ROTATE, (yyvsp[(10) - (11)].l), 
@@ -6098,7 +6097,7 @@ yyreduce:
     break;
 
   case 164:
-#line 2264 "Gmsh.y"
+#line 2263 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShapes(TRANSLATE_ROTATE, (yyvsp[(12) - (13)].l), 
@@ -6109,14 +6108,14 @@ yyreduce:
     break;
 
   case 165:
-#line 2272 "Gmsh.y"
+#line 2271 "Gmsh.y"
     {
       extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false;
     ;}
     break;
 
   case 166:
-#line 2276 "Gmsh.y"
+#line 2275 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShapes(TRANSLATE, (yyvsp[(4) - (7)].l), 
@@ -6127,14 +6126,14 @@ yyreduce:
     break;
 
   case 167:
-#line 2284 "Gmsh.y"
+#line 2283 "Gmsh.y"
     {
       extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false;
     ;}
     break;
 
   case 168:
-#line 2288 "Gmsh.y"
+#line 2287 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShapes(ROTATE, (yyvsp[(10) - (13)].l), 
@@ -6145,14 +6144,14 @@ yyreduce:
     break;
 
   case 169:
-#line 2296 "Gmsh.y"
+#line 2295 "Gmsh.y"
     {
       extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false;
     ;}
     break;
 
   case 170:
-#line 2300 "Gmsh.y"
+#line 2299 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShapes(TRANSLATE_ROTATE, (yyvsp[(12) - (15)].l), 
@@ -6163,14 +6162,14 @@ yyreduce:
     break;
 
   case 171:
-#line 2308 "Gmsh.y"
+#line 2307 "Gmsh.y"
     {
       extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false;
     ;}
     break;
 
   case 172:
-#line 2312 "Gmsh.y"
+#line 2311 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShapes(BOUNDARY_LAYER, (yyvsp[(3) - (6)].l), 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
@@ -6180,14 +6179,14 @@ yyreduce:
     break;
 
   case 173:
-#line 2319 "Gmsh.y"
+#line 2318 "Gmsh.y"
     {
       extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false;
     ;}
     break;
 
   case 174:
-#line 2323 "Gmsh.y"
+#line 2322 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       extr.mesh.ViewIndex = (int)(yyvsp[(4) - (10)].d);
@@ -6200,7 +6199,7 @@ yyreduce:
     break;
 
   case 175:
-#line 2335 "Gmsh.y"
+#line 2334 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(TRANSLATE, MSH_POINT, (int)(yyvsp[(4) - (8)].d), 
@@ -6210,7 +6209,7 @@ yyreduce:
     break;
 
   case 176:
-#line 2342 "Gmsh.y"
+#line 2341 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(TRANSLATE, MSH_SEGM_LINE, (int)(yyvsp[(4) - (8)].d), 
@@ -6220,7 +6219,7 @@ yyreduce:
     break;
 
   case 177:
-#line 2349 "Gmsh.y"
+#line 2348 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(TRANSLATE, MSH_SURF_PLAN, (int)(yyvsp[(4) - (8)].d), 
@@ -6230,7 +6229,7 @@ yyreduce:
     break;
 
   case 178:
-#line 2356 "Gmsh.y"
+#line 2355 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(ROTATE, MSH_POINT, (int)(yyvsp[(4) - (12)].d), 
@@ -6240,7 +6239,7 @@ yyreduce:
     break;
 
   case 179:
-#line 2363 "Gmsh.y"
+#line 2362 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(ROTATE, MSH_SEGM_LINE, (int)(yyvsp[(4) - (12)].d), 
@@ -6250,7 +6249,7 @@ yyreduce:
     break;
 
   case 180:
-#line 2370 "Gmsh.y"
+#line 2369 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(ROTATE, MSH_SURF_PLAN, (int)(yyvsp[(4) - (12)].d), 
@@ -6260,7 +6259,7 @@ yyreduce:
     break;
 
   case 181:
-#line 2377 "Gmsh.y"
+#line 2376 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(TRANSLATE_ROTATE, MSH_POINT, (int)(yyvsp[(4) - (14)].d), 
@@ -6270,7 +6269,7 @@ yyreduce:
     break;
 
   case 182:
-#line 2384 "Gmsh.y"
+#line 2383 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(TRANSLATE_ROTATE, MSH_SEGM_LINE, (int)(yyvsp[(4) - (14)].d), 
@@ -6280,7 +6279,7 @@ yyreduce:
     break;
 
   case 183:
-#line 2391 "Gmsh.y"
+#line 2390 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(TRANSLATE_ROTATE, MSH_SURF_PLAN, (int)(yyvsp[(4) - (14)].d), 
@@ -6290,14 +6289,14 @@ yyreduce:
     break;
 
   case 184:
-#line 2398 "Gmsh.y"
+#line 2397 "Gmsh.y"
     {
       extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false;
     ;}
     break;
 
   case 185:
-#line 2402 "Gmsh.y"
+#line 2401 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(TRANSLATE, MSH_POINT, (int)(yyvsp[(4) - (12)].d), 
@@ -6307,14 +6306,14 @@ yyreduce:
     break;
 
   case 186:
-#line 2409 "Gmsh.y"
+#line 2408 "Gmsh.y"
     {
       extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false;
     ;}
     break;
 
   case 187:
-#line 2413 "Gmsh.y"
+#line 2412 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(TRANSLATE, MSH_SEGM_LINE, (int)(yyvsp[(4) - (12)].d), 
@@ -6324,14 +6323,14 @@ yyreduce:
     break;
 
   case 188:
-#line 2420 "Gmsh.y"
+#line 2419 "Gmsh.y"
     {
       extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false;
     ;}
     break;
 
   case 189:
-#line 2424 "Gmsh.y"
+#line 2423 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(TRANSLATE, MSH_SURF_PLAN, (int)(yyvsp[(4) - (12)].d), 
@@ -6341,14 +6340,14 @@ yyreduce:
     break;
 
   case 190:
-#line 2431 "Gmsh.y"
+#line 2430 "Gmsh.y"
     {
       extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false;
     ;}
     break;
 
   case 191:
-#line 2435 "Gmsh.y"
+#line 2434 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(ROTATE, MSH_POINT, (int)(yyvsp[(4) - (16)].d), 
@@ -6358,14 +6357,14 @@ yyreduce:
     break;
 
   case 192:
-#line 2442 "Gmsh.y"
+#line 2441 "Gmsh.y"
     {
       extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false;
     ;}
     break;
 
   case 193:
-#line 2446 "Gmsh.y"
+#line 2445 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(ROTATE, MSH_SEGM_LINE, (int)(yyvsp[(4) - (16)].d), 
@@ -6375,14 +6374,14 @@ yyreduce:
     break;
 
   case 194:
-#line 2453 "Gmsh.y"
+#line 2452 "Gmsh.y"
     {
       extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false;
     ;}
     break;
 
   case 195:
-#line 2457 "Gmsh.y"
+#line 2456 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(ROTATE, MSH_SURF_PLAN, (int)(yyvsp[(4) - (16)].d), 
@@ -6392,14 +6391,14 @@ yyreduce:
     break;
 
   case 196:
-#line 2464 "Gmsh.y"
+#line 2463 "Gmsh.y"
     {
       extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false;
     ;}
     break;
 
   case 197:
-#line 2468 "Gmsh.y"
+#line 2467 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(TRANSLATE_ROTATE, MSH_POINT, (int)(yyvsp[(4) - (18)].d), 
@@ -6409,14 +6408,14 @@ yyreduce:
     break;
 
   case 198:
-#line 2475 "Gmsh.y"
+#line 2474 "Gmsh.y"
     {
       extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false;
     ;}
     break;
 
   case 199:
-#line 2479 "Gmsh.y"
+#line 2478 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(TRANSLATE_ROTATE, MSH_SEGM_LINE, (int)(yyvsp[(4) - (18)].d), 
@@ -6426,14 +6425,14 @@ yyreduce:
     break;
 
   case 200:
-#line 2486 "Gmsh.y"
+#line 2485 "Gmsh.y"
     {
       extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false;
     ;}
     break;
 
   case 201:
-#line 2490 "Gmsh.y"
+#line 2489 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(TRANSLATE_ROTATE, MSH_SURF_PLAN, (int)(yyvsp[(4) - (18)].d), 
@@ -6443,19 +6442,19 @@ yyreduce:
     break;
 
   case 202:
-#line 2501 "Gmsh.y"
+#line 2500 "Gmsh.y"
     {
     ;}
     break;
 
   case 203:
-#line 2504 "Gmsh.y"
+#line 2503 "Gmsh.y"
     {
     ;}
     break;
 
   case 204:
-#line 2510 "Gmsh.y"
+#line 2509 "Gmsh.y"
     {
       extr.mesh.ExtrudeMesh = true;
       extr.mesh.NbLayer = 1;
@@ -6467,7 +6466,7 @@ yyreduce:
     break;
 
   case 205:
-#line 2519 "Gmsh.y"
+#line 2518 "Gmsh.y"
     {
       double d;
       extr.mesh.ExtrudeMesh = true;
@@ -6483,16 +6482,16 @@ yyreduce:
 	}
       }
       else
-	yymsg(GERROR, "Wrong layer definition {%d, %d}", List_Nbr((yyvsp[(3) - (7)].l)), List_Nbr((yyvsp[(5) - (7)].l)));
+	yymsg(0, "Wrong layer definition {%d, %d}", List_Nbr((yyvsp[(3) - (7)].l)), List_Nbr((yyvsp[(5) - (7)].l)));
       List_Delete((yyvsp[(3) - (7)].l));
       List_Delete((yyvsp[(5) - (7)].l));
     ;}
     break;
 
   case 206:
-#line 2539 "Gmsh.y"
+#line 2538 "Gmsh.y"
     {
-      yymsg(GERROR, "Explicit region numbers in layers are deprecated");
+      yymsg(0, "Explicit region numbers in layers are deprecated");
       double d;
       extr.mesh.ExtrudeMesh = true;
       extr.mesh.NbLayer = List_Nbr((yyvsp[(3) - (9)].l));
@@ -6507,7 +6506,7 @@ yyreduce:
 	}
       }
       else
-	yymsg(GERROR, "Wrong layer definition {%d, %d, %d}", List_Nbr((yyvsp[(3) - (9)].l)), 
+	yymsg(0, "Wrong layer definition {%d, %d, %d}", List_Nbr((yyvsp[(3) - (9)].l)), 
 	      List_Nbr((yyvsp[(5) - (9)].l)), List_Nbr((yyvsp[(7) - (9)].l)));
       List_Delete((yyvsp[(3) - (9)].l));
       List_Delete((yyvsp[(5) - (9)].l));
@@ -6516,18 +6515,18 @@ yyreduce:
     break;
 
   case 207:
-#line 2562 "Gmsh.y"
+#line 2561 "Gmsh.y"
     {
       extr.mesh.Recombine = true;
     ;}
     break;
 
   case 208:
-#line 2566 "Gmsh.y"
+#line 2565 "Gmsh.y"
     {
       int num = (int)(yyvsp[(3) - (9)].d);
       if(FindSurface(num)){
-	yymsg(GERROR, "Surface %d already exists", num);
+	yymsg(0, "Surface %d already exists", num);
       }
       else{
 	Surface *s = Create_Surface(num, MSH_SURF_DISCRETE);
@@ -6545,7 +6544,7 @@ yyreduce:
     break;
 
   case 209:
-#line 2590 "Gmsh.y"
+#line 2589 "Gmsh.y"
     {
       for(int i = 0; i < List_Nbr((yyvsp[(3) - (6)].l)); i++){
 	double d;
@@ -6553,7 +6552,7 @@ yyreduce:
 	int j = (int)fabs(d);
         Curve *c = FindCurve(j);
 	if(!c)
-	  yymsg(WARNING, "Unknown curve %d", j);
+	  yymsg(1, "Unknown curve %d", j);
 	else{
 	  c->Method = TRANSFINI;
 	  c->nbPointsTransfinite = ((yyvsp[(5) - (6)].d) > 2) ? (int)(yyvsp[(5) - (6)].d) : 2;
@@ -6566,7 +6565,7 @@ yyreduce:
     break;
 
   case 210:
-#line 2608 "Gmsh.y"
+#line 2607 "Gmsh.y"
     {
       for(int i = 0; i < List_Nbr((yyvsp[(3) - (9)].l)); i++){
 	double d;
@@ -6574,7 +6573,7 @@ yyreduce:
 	int j = (int)fabs(d);
         Curve *c = FindCurve(j);
 	if(!c)
-	  yymsg(WARNING, "Unknown curve %d", j);
+	  yymsg(1, "Unknown curve %d", j);
 	else{
 	  c->Method = TRANSFINI;
 	  c->nbPointsTransfinite = ((yyvsp[(5) - (9)].d) > 2) ? (int)(yyvsp[(5) - (9)].d) : 2;
@@ -6587,7 +6586,7 @@ yyreduce:
     break;
 
   case 211:
-#line 2626 "Gmsh.y"
+#line 2625 "Gmsh.y"
     {
       for(int i = 0; i < List_Nbr((yyvsp[(3) - (9)].l)); i++){
 	double d;
@@ -6595,7 +6594,7 @@ yyreduce:
 	int j = (int)fabs(d);
         Curve *c = FindCurve(j);
 	if(!c)
-	  yymsg(WARNING, "Unknown curve %d", j);
+	  yymsg(1, "Unknown curve %d", j);
 	else{
 	  c->Method = TRANSFINI;
 	  c->nbPointsTransfinite = ((yyvsp[(5) - (9)].d) > 2) ? (int)(yyvsp[(5) - (9)].d) : 2;
@@ -6608,17 +6607,17 @@ yyreduce:
     break;
 
   case 212:
-#line 2644 "Gmsh.y"
+#line 2643 "Gmsh.y"
     {
       Surface *s = FindSurface((int)(yyvsp[(4) - (8)].d));
       if(!s)
-	yymsg(WARNING, "Unknown surface %d", (int)(yyvsp[(4) - (8)].d));
+	yymsg(1, "Unknown surface %d", (int)(yyvsp[(4) - (8)].d));
       else{
 	s->Method = TRANSFINI;
 	s->Recombine_Dir = -1;
 	int k = List_Nbr((yyvsp[(7) - (8)].l));
 	if(k != 3 && k != 4){
-	  yymsg(GERROR, "Wrong definition of Transfinite Surface %d: "
+	  yymsg(0, "Wrong definition of Transfinite Surface %d: "
 		"%d points instead of 3 or 4" , (int)(yyvsp[(4) - (8)].d), k);
 	}
 	else{
@@ -6629,7 +6628,7 @@ yyreduce:
 	    int j = (int)fabs(d);
 	    Vertex *v = FindPoint(j);
 	    if(!v)
-	      yymsg(WARNING, "Unknown point %d", j);
+	      yymsg(1, "Unknown point %d", j);
 	    else
 	      List_Add(s->TrsfPoints, &v);
 	  }
@@ -6640,16 +6639,16 @@ yyreduce:
     break;
 
   case 213:
-#line 2673 "Gmsh.y"
+#line 2672 "Gmsh.y"
     {
       Surface *s = FindSurface((int)(yyvsp[(4) - (9)].d));
       if(!s)
-	yymsg(WARNING, "Unknown surface %d", (int)(yyvsp[(4) - (9)].d));
+	yymsg(1, "Unknown surface %d", (int)(yyvsp[(4) - (9)].d));
       else{
 	s->Method = TRANSFINI;
 	int k = List_Nbr((yyvsp[(7) - (9)].l));
 	if(k != 3 && k != 4){
-	  yymsg(GERROR, "Wrong definition of Transfinite Surface %d: "
+	  yymsg(0, "Wrong definition of Transfinite Surface %d: "
 		"%d points instead of 3 or 4" , (int)(yyvsp[(4) - (9)].d), k);
 	}
 	else{
@@ -6666,7 +6665,7 @@ yyreduce:
 	    int j = (int)fabs(d);
 	    Vertex *v = FindPoint(j);
 	    if(!v)
-	      yymsg(WARNING, "Unknown point %d", j);
+	      yymsg(1, "Unknown point %d", j);
 	    else
 	      List_Add(s->TrsfPoints, &v);
 	  }
@@ -6678,24 +6677,24 @@ yyreduce:
     break;
 
   case 214:
-#line 2708 "Gmsh.y"
+#line 2707 "Gmsh.y"
     {
-      yymsg(WARNING, "Elliptic Surface is deprecated: use Transfinite instead (with smoothing)");
+      yymsg(1, "Elliptic Surface is deprecated: use Transfinite instead (with smoothing)");
       List_Delete((yyvsp[(7) - (8)].l));
     ;}
     break;
 
   case 215:
-#line 2713 "Gmsh.y"
+#line 2712 "Gmsh.y"
     {
       Volume *v = FindVolume((int)(yyvsp[(4) - (8)].d));
       if(!v)
-	yymsg(WARNING, "Unknown volume %d", (int)(yyvsp[(4) - (8)].d));
+	yymsg(1, "Unknown volume %d", (int)(yyvsp[(4) - (8)].d));
       else{
 	v->Method = TRANSFINI;
 	int k = List_Nbr((yyvsp[(7) - (8)].l));
 	if(k != 6 && k != 8)
-	  yymsg(GERROR, "Wrong definition of Transfinite Volume %d: "
+	  yymsg(0, "Wrong definition of Transfinite Volume %d: "
 		"%d points instead of 6 or 8" , (int)(yyvsp[(4) - (8)].d), k);
 	else{
 	  List_Reset(v->TrsfPoints);
@@ -6705,7 +6704,7 @@ yyreduce:
 	    int j = (int)fabs(d);
 	    Vertex *vert = FindPoint(j);
 	    if(!vert)
-	      yymsg(WARNING, "Unknown point %d", j);
+	      yymsg(1, "Unknown point %d", j);
 	    else
 	      List_Add(v->TrsfPoints, &vert);
 	  }
@@ -6716,7 +6715,7 @@ yyreduce:
     break;
 
   case 216:
-#line 2740 "Gmsh.y"
+#line 2739 "Gmsh.y"
     {
       for(int i = 0; i < List_Nbr((yyvsp[(3) - (6)].l)); i++){
 	double d;
@@ -6733,7 +6732,7 @@ yyreduce:
     break;
 
   case 217:
-#line 2754 "Gmsh.y"
+#line 2753 "Gmsh.y"
     {
       for(int i = 0; i < List_Nbr((yyvsp[(3) - (4)].l)); i++){
 	double d;
@@ -6749,7 +6748,7 @@ yyreduce:
     break;
 
   case 218:
-#line 2767 "Gmsh.y"
+#line 2766 "Gmsh.y"
     {
       for(int i = 0; i < List_Nbr((yyvsp[(3) - (6)].l)); i++){
 	double d;
@@ -6763,7 +6762,7 @@ yyreduce:
     break;
 
   case 219:
-#line 2784 "Gmsh.y"
+#line 2783 "Gmsh.y"
     { 
       Surface *s = FindSurface((int)(yyvsp[(8) - (10)].d));
       if(s)
@@ -6772,7 +6771,7 @@ yyreduce:
     break;
 
   case 220:
-#line 2790 "Gmsh.y"
+#line 2789 "Gmsh.y"
     {
       Surface *s = FindSurface((int)(yyvsp[(8) - (10)].d));
       if(s)
@@ -6781,382 +6780,382 @@ yyreduce:
     break;
 
   case 221:
-#line 2796 "Gmsh.y"
+#line 2795 "Gmsh.y"
     {
     ;}
     break;
 
   case 222:
-#line 2799 "Gmsh.y"
+#line 2798 "Gmsh.y"
     {
     ;}
     break;
 
   case 223:
-#line 2808 "Gmsh.y"
+#line 2807 "Gmsh.y"
     { 
       ReplaceAllDuplicates();
     ;}
     break;
 
   case 224:
-#line 2817 "Gmsh.y"
+#line 2816 "Gmsh.y"
     { (yyval.d) = (yyvsp[(1) - (1)].d);           ;}
     break;
 
   case 225:
-#line 2818 "Gmsh.y"
+#line 2817 "Gmsh.y"
     { (yyval.d) = (yyvsp[(2) - (3)].d);           ;}
     break;
 
   case 226:
-#line 2819 "Gmsh.y"
+#line 2818 "Gmsh.y"
     { (yyval.d) = -(yyvsp[(2) - (2)].d);          ;}
     break;
 
   case 227:
-#line 2820 "Gmsh.y"
+#line 2819 "Gmsh.y"
     { (yyval.d) = (yyvsp[(2) - (2)].d);           ;}
     break;
 
   case 228:
-#line 2821 "Gmsh.y"
+#line 2820 "Gmsh.y"
     { (yyval.d) = !(yyvsp[(2) - (2)].d);          ;}
     break;
 
   case 229:
-#line 2822 "Gmsh.y"
+#line 2821 "Gmsh.y"
     { (yyval.d) = (yyvsp[(1) - (3)].d) - (yyvsp[(3) - (3)].d);      ;}
     break;
 
   case 230:
-#line 2823 "Gmsh.y"
+#line 2822 "Gmsh.y"
     { (yyval.d) = (yyvsp[(1) - (3)].d) + (yyvsp[(3) - (3)].d);      ;}
     break;
 
   case 231:
-#line 2824 "Gmsh.y"
+#line 2823 "Gmsh.y"
     { (yyval.d) = (yyvsp[(1) - (3)].d) * (yyvsp[(3) - (3)].d);      ;}
     break;
 
   case 232:
-#line 2826 "Gmsh.y"
+#line 2825 "Gmsh.y"
     { 
       if(!(yyvsp[(3) - (3)].d))
-	yymsg(GERROR, "Division by zero in '%g / %g'", (yyvsp[(1) - (3)].d), (yyvsp[(3) - (3)].d));
+	yymsg(0, "Division by zero in '%g / %g'", (yyvsp[(1) - (3)].d), (yyvsp[(3) - (3)].d));
       else
 	(yyval.d) = (yyvsp[(1) - (3)].d) / (yyvsp[(3) - (3)].d);     
     ;}
     break;
 
   case 233:
-#line 2832 "Gmsh.y"
+#line 2831 "Gmsh.y"
     { (yyval.d) = (int)(yyvsp[(1) - (3)].d) % (int)(yyvsp[(3) - (3)].d);  ;}
     break;
 
   case 234:
-#line 2833 "Gmsh.y"
+#line 2832 "Gmsh.y"
     { (yyval.d) = pow((yyvsp[(1) - (3)].d), (yyvsp[(3) - (3)].d));  ;}
     break;
 
   case 235:
-#line 2834 "Gmsh.y"
+#line 2833 "Gmsh.y"
     { (yyval.d) = (yyvsp[(1) - (3)].d) < (yyvsp[(3) - (3)].d);      ;}
     break;
 
   case 236:
-#line 2835 "Gmsh.y"
+#line 2834 "Gmsh.y"
     { (yyval.d) = (yyvsp[(1) - (3)].d) > (yyvsp[(3) - (3)].d);      ;}
     break;
 
   case 237:
-#line 2836 "Gmsh.y"
+#line 2835 "Gmsh.y"
     { (yyval.d) = (yyvsp[(1) - (3)].d) <= (yyvsp[(3) - (3)].d);     ;}
     break;
 
   case 238:
-#line 2837 "Gmsh.y"
+#line 2836 "Gmsh.y"
     { (yyval.d) = (yyvsp[(1) - (3)].d) >= (yyvsp[(3) - (3)].d);     ;}
     break;
 
   case 239:
-#line 2838 "Gmsh.y"
+#line 2837 "Gmsh.y"
     { (yyval.d) = (yyvsp[(1) - (3)].d) == (yyvsp[(3) - (3)].d);     ;}
     break;
 
   case 240:
-#line 2839 "Gmsh.y"
+#line 2838 "Gmsh.y"
     { (yyval.d) = (yyvsp[(1) - (3)].d) != (yyvsp[(3) - (3)].d);     ;}
     break;
 
   case 241:
-#line 2840 "Gmsh.y"
+#line 2839 "Gmsh.y"
     { (yyval.d) = (yyvsp[(1) - (3)].d) && (yyvsp[(3) - (3)].d);     ;}
     break;
 
   case 242:
-#line 2841 "Gmsh.y"
+#line 2840 "Gmsh.y"
     { (yyval.d) = (yyvsp[(1) - (3)].d) || (yyvsp[(3) - (3)].d);     ;}
     break;
 
   case 243:
-#line 2842 "Gmsh.y"
+#line 2841 "Gmsh.y"
     { (yyval.d) = (yyvsp[(1) - (5)].d)? (yyvsp[(3) - (5)].d) : (yyvsp[(5) - (5)].d);  ;}
     break;
 
   case 244:
-#line 2843 "Gmsh.y"
+#line 2842 "Gmsh.y"
     { (yyval.d) = exp((yyvsp[(3) - (4)].d));      ;}
     break;
 
   case 245:
-#line 2844 "Gmsh.y"
+#line 2843 "Gmsh.y"
     { (yyval.d) = log((yyvsp[(3) - (4)].d));      ;}
     break;
 
   case 246:
-#line 2845 "Gmsh.y"
+#line 2844 "Gmsh.y"
     { (yyval.d) = log10((yyvsp[(3) - (4)].d));    ;}
     break;
 
   case 247:
-#line 2846 "Gmsh.y"
+#line 2845 "Gmsh.y"
     { (yyval.d) = sqrt((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 248:
-#line 2847 "Gmsh.y"
+#line 2846 "Gmsh.y"
     { (yyval.d) = sin((yyvsp[(3) - (4)].d));      ;}
     break;
 
   case 249:
-#line 2848 "Gmsh.y"
+#line 2847 "Gmsh.y"
     { (yyval.d) = asin((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 250:
-#line 2849 "Gmsh.y"
+#line 2848 "Gmsh.y"
     { (yyval.d) = cos((yyvsp[(3) - (4)].d));      ;}
     break;
 
   case 251:
-#line 2850 "Gmsh.y"
+#line 2849 "Gmsh.y"
     { (yyval.d) = acos((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 252:
-#line 2851 "Gmsh.y"
+#line 2850 "Gmsh.y"
     { (yyval.d) = tan((yyvsp[(3) - (4)].d));      ;}
     break;
 
   case 253:
-#line 2852 "Gmsh.y"
+#line 2851 "Gmsh.y"
     { (yyval.d) = atan((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 254:
-#line 2853 "Gmsh.y"
+#line 2852 "Gmsh.y"
     { (yyval.d) = atan2((yyvsp[(3) - (6)].d), (yyvsp[(5) - (6)].d));;}
     break;
 
   case 255:
-#line 2854 "Gmsh.y"
+#line 2853 "Gmsh.y"
     { (yyval.d) = sinh((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 256:
-#line 2855 "Gmsh.y"
+#line 2854 "Gmsh.y"
     { (yyval.d) = cosh((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 257:
-#line 2856 "Gmsh.y"
+#line 2855 "Gmsh.y"
     { (yyval.d) = tanh((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 258:
-#line 2857 "Gmsh.y"
+#line 2856 "Gmsh.y"
     { (yyval.d) = fabs((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 259:
-#line 2858 "Gmsh.y"
+#line 2857 "Gmsh.y"
     { (yyval.d) = floor((yyvsp[(3) - (4)].d));    ;}
     break;
 
   case 260:
-#line 2859 "Gmsh.y"
+#line 2858 "Gmsh.y"
     { (yyval.d) = ceil((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 261:
-#line 2860 "Gmsh.y"
+#line 2859 "Gmsh.y"
     { (yyval.d) = fmod((yyvsp[(3) - (6)].d), (yyvsp[(5) - (6)].d)); ;}
     break;
 
   case 262:
-#line 2861 "Gmsh.y"
+#line 2860 "Gmsh.y"
     { (yyval.d) = fmod((yyvsp[(3) - (6)].d), (yyvsp[(5) - (6)].d)); ;}
     break;
 
   case 263:
-#line 2862 "Gmsh.y"
+#line 2861 "Gmsh.y"
     { (yyval.d) = sqrt((yyvsp[(3) - (6)].d)*(yyvsp[(3) - (6)].d)+(yyvsp[(5) - (6)].d)*(yyvsp[(5) - (6)].d)); ;}
     break;
 
   case 264:
-#line 2863 "Gmsh.y"
+#line 2862 "Gmsh.y"
     { (yyval.d) = (yyvsp[(3) - (4)].d)*(double)rand()/(double)RAND_MAX; ;}
     break;
 
   case 265:
-#line 2865 "Gmsh.y"
+#line 2864 "Gmsh.y"
     { (yyval.d) = exp((yyvsp[(3) - (4)].d));      ;}
     break;
 
   case 266:
-#line 2866 "Gmsh.y"
+#line 2865 "Gmsh.y"
     { (yyval.d) = log((yyvsp[(3) - (4)].d));      ;}
     break;
 
   case 267:
-#line 2867 "Gmsh.y"
+#line 2866 "Gmsh.y"
     { (yyval.d) = log10((yyvsp[(3) - (4)].d));    ;}
     break;
 
   case 268:
-#line 2868 "Gmsh.y"
+#line 2867 "Gmsh.y"
     { (yyval.d) = sqrt((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 269:
-#line 2869 "Gmsh.y"
+#line 2868 "Gmsh.y"
     { (yyval.d) = sin((yyvsp[(3) - (4)].d));      ;}
     break;
 
   case 270:
-#line 2870 "Gmsh.y"
+#line 2869 "Gmsh.y"
     { (yyval.d) = asin((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 271:
-#line 2871 "Gmsh.y"
+#line 2870 "Gmsh.y"
     { (yyval.d) = cos((yyvsp[(3) - (4)].d));      ;}
     break;
 
   case 272:
-#line 2872 "Gmsh.y"
+#line 2871 "Gmsh.y"
     { (yyval.d) = acos((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 273:
-#line 2873 "Gmsh.y"
+#line 2872 "Gmsh.y"
     { (yyval.d) = tan((yyvsp[(3) - (4)].d));      ;}
     break;
 
   case 274:
-#line 2874 "Gmsh.y"
+#line 2873 "Gmsh.y"
     { (yyval.d) = atan((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 275:
-#line 2875 "Gmsh.y"
+#line 2874 "Gmsh.y"
     { (yyval.d) = atan2((yyvsp[(3) - (6)].d), (yyvsp[(5) - (6)].d));;}
     break;
 
   case 276:
-#line 2876 "Gmsh.y"
+#line 2875 "Gmsh.y"
     { (yyval.d) = sinh((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 277:
-#line 2877 "Gmsh.y"
+#line 2876 "Gmsh.y"
     { (yyval.d) = cosh((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 278:
-#line 2878 "Gmsh.y"
+#line 2877 "Gmsh.y"
     { (yyval.d) = tanh((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 279:
-#line 2879 "Gmsh.y"
+#line 2878 "Gmsh.y"
     { (yyval.d) = fabs((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 280:
-#line 2880 "Gmsh.y"
+#line 2879 "Gmsh.y"
     { (yyval.d) = floor((yyvsp[(3) - (4)].d));    ;}
     break;
 
   case 281:
-#line 2881 "Gmsh.y"
+#line 2880 "Gmsh.y"
     { (yyval.d) = ceil((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 282:
-#line 2882 "Gmsh.y"
+#line 2881 "Gmsh.y"
     { (yyval.d) = fmod((yyvsp[(3) - (6)].d), (yyvsp[(5) - (6)].d)); ;}
     break;
 
   case 283:
-#line 2883 "Gmsh.y"
+#line 2882 "Gmsh.y"
     { (yyval.d) = fmod((yyvsp[(3) - (6)].d), (yyvsp[(5) - (6)].d)); ;}
     break;
 
   case 284:
-#line 2884 "Gmsh.y"
+#line 2883 "Gmsh.y"
     { (yyval.d) = sqrt((yyvsp[(3) - (6)].d)*(yyvsp[(3) - (6)].d)+(yyvsp[(5) - (6)].d)*(yyvsp[(5) - (6)].d)); ;}
     break;
 
   case 285:
-#line 2885 "Gmsh.y"
+#line 2884 "Gmsh.y"
     { (yyval.d) = (yyvsp[(3) - (4)].d)*(double)rand()/(double)RAND_MAX; ;}
     break;
 
   case 286:
-#line 2894 "Gmsh.y"
+#line 2893 "Gmsh.y"
     { (yyval.d) = (yyvsp[(1) - (1)].d); ;}
     break;
 
   case 287:
-#line 2895 "Gmsh.y"
+#line 2894 "Gmsh.y"
     { (yyval.d) = 3.141592653589793; ;}
     break;
 
   case 288:
-#line 2896 "Gmsh.y"
-    { (yyval.d) = ParUtil::Instance()->rank(); ;}
+#line 2895 "Gmsh.y"
+    { (yyval.d) = Msg::GetCommRank(); ;}
     break;
 
   case 289:
-#line 2897 "Gmsh.y"
-    { (yyval.d) = ParUtil::Instance()->size(); ;}
+#line 2896 "Gmsh.y"
+    { (yyval.d) = Msg::GetCommSize(); ;}
     break;
 
   case 290:
-#line 2898 "Gmsh.y"
+#line 2897 "Gmsh.y"
     { (yyval.d) = Get_GmshMajorVersion(); ;}
     break;
 
   case 291:
-#line 2899 "Gmsh.y"
+#line 2898 "Gmsh.y"
     { (yyval.d) = Get_GmshMinorVersion(); ;}
     break;
 
   case 292:
-#line 2900 "Gmsh.y"
+#line 2899 "Gmsh.y"
     { (yyval.d) = Get_GmshPatchVersion(); ;}
     break;
 
   case 293:
-#line 2905 "Gmsh.y"
+#line 2904 "Gmsh.y"
     {
       Symbol TheSymbol;
       TheSymbol.Name = (yyvsp[(1) - (1)].c);
       Symbol *pSymbol;
       if(!(pSymbol = (Symbol*)Tree_PQuery(Symbol_T, &TheSymbol))) {
-	yymsg(GERROR, "Unknown variable '%s'", (yyvsp[(1) - (1)].c));
+	yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (1)].c));
 	(yyval.d) = 0.;
       }
       else
@@ -7166,7 +7165,7 @@ yyreduce:
     break;
 
   case 294:
-#line 2921 "Gmsh.y"
+#line 2920 "Gmsh.y"
     {
       char tmpstring[1024];
       sprintf(tmpstring, "%s_%d", (yyvsp[(1) - (5)].c), (int)(yyvsp[(4) - (5)].d)) ;
@@ -7174,7 +7173,7 @@ yyreduce:
       TheSymbol.Name = tmpstring;
       Symbol *pSymbol;
       if(!(pSymbol = (Symbol*)Tree_PQuery(Symbol_T, &TheSymbol))) {
-	yymsg(GERROR, "Unknown variable '%s'", tmpstring);
+	yymsg(0, "Unknown variable '%s'", tmpstring);
 	(yyval.d) = 0.;
       }
       else
@@ -7184,13 +7183,13 @@ yyreduce:
     break;
 
   case 295:
-#line 2936 "Gmsh.y"
+#line 2935 "Gmsh.y"
     {
       Symbol TheSymbol;
       TheSymbol.Name = (yyvsp[(1) - (4)].c);
       Symbol *pSymbol;
       if(!(pSymbol = (Symbol*)Tree_PQuery(Symbol_T, &TheSymbol))) {
-	yymsg(GERROR, "Unknown variable '%s'", (yyvsp[(1) - (4)].c));
+	yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (4)].c));
 	(yyval.d) = 0.;
       }
       else{
@@ -7198,7 +7197,7 @@ yyreduce:
 	if((pd = (double*)List_Pointer_Test(pSymbol->val, (int)(yyvsp[(3) - (4)].d))))
 	  (yyval.d) = *pd;
 	else{
-	  yymsg(GERROR, "Uninitialized variable '%s[%d]'", (yyvsp[(1) - (4)].c), (int)(yyvsp[(3) - (4)].d));
+	  yymsg(0, "Uninitialized variable '%s[%d]'", (yyvsp[(1) - (4)].c), (int)(yyvsp[(3) - (4)].d));
 	  (yyval.d) = 0.;
 	}
       }
@@ -7207,13 +7206,13 @@ yyreduce:
     break;
 
   case 296:
-#line 2956 "Gmsh.y"
+#line 2955 "Gmsh.y"
     {
       Symbol TheSymbol;
       TheSymbol.Name = (yyvsp[(2) - (4)].c);
       Symbol *pSymbol;
       if(!(pSymbol = (Symbol*)Tree_PQuery(Symbol_T, &TheSymbol))) {
-	yymsg(GERROR, "Unknown variable '%s'", (yyvsp[(2) - (4)].c));
+	yymsg(0, "Unknown variable '%s'", (yyvsp[(2) - (4)].c));
 	(yyval.d) = 0.;
       }
       else
@@ -7223,13 +7222,13 @@ yyreduce:
     break;
 
   case 297:
-#line 2969 "Gmsh.y"
+#line 2968 "Gmsh.y"
     {
       Symbol TheSymbol;
       TheSymbol.Name = (yyvsp[(1) - (2)].c);
       Symbol *pSymbol;
       if(!(pSymbol = (Symbol*)Tree_PQuery(Symbol_T, &TheSymbol))) {
-	yymsg(GERROR, "Unknown variable '%s'", (yyvsp[(1) - (2)].c));
+	yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (2)].c));
 	(yyval.d) = 0.;
       }
       else
@@ -7239,13 +7238,13 @@ yyreduce:
     break;
 
   case 298:
-#line 2982 "Gmsh.y"
+#line 2981 "Gmsh.y"
     {
       Symbol TheSymbol;
       TheSymbol.Name = (yyvsp[(1) - (5)].c);
       Symbol *pSymbol;
       if(!(pSymbol = (Symbol*)Tree_PQuery(Symbol_T, &TheSymbol))) {
-	yymsg(GERROR, "Unknown variable '%s'", (yyvsp[(1) - (5)].c));
+	yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (5)].c));
 	(yyval.d) = 0.;
       }
       else{
@@ -7253,7 +7252,7 @@ yyreduce:
 	if((pd = (double*)List_Pointer_Test(pSymbol->val, (int)(yyvsp[(3) - (5)].d))))
 	  (yyval.d) = (*pd += (yyvsp[(5) - (5)].i));
 	else{
-	  yymsg(GERROR, "Uninitialized variable '%s[%d]'", (yyvsp[(1) - (5)].c), (int)(yyvsp[(3) - (5)].d));
+	  yymsg(0, "Uninitialized variable '%s[%d]'", (yyvsp[(1) - (5)].c), (int)(yyvsp[(3) - (5)].d));
 	  (yyval.d) = 0.;
 	}
       }
@@ -7262,17 +7261,17 @@ yyreduce:
     break;
 
   case 299:
-#line 3005 "Gmsh.y"
+#line 3004 "Gmsh.y"
     {
       double (*pNumOpt)(int num, int action, double value);
       StringXNumber *pNumCat;
       if(!(pNumCat = Get_NumberOptionCategory((yyvsp[(1) - (3)].c)))){
-	yymsg(GERROR, "Unknown numeric option class '%s'", (yyvsp[(1) - (3)].c));
+	yymsg(0, "Unknown numeric option class '%s'", (yyvsp[(1) - (3)].c));
 	(yyval.d) = 0.;
       }
       else{
 	if(!(pNumOpt =  (double (*) (int, int, double))Get_NumberOption((yyvsp[(3) - (3)].c), pNumCat))){
-	  yymsg(GERROR, "Unknown numeric option '%s.%s'", (yyvsp[(1) - (3)].c), (yyvsp[(3) - (3)].c));
+	  yymsg(0, "Unknown numeric option '%s.%s'", (yyvsp[(1) - (3)].c), (yyvsp[(3) - (3)].c));
 	  (yyval.d) = 0.;
 	}
 	else
@@ -7283,17 +7282,17 @@ yyreduce:
     break;
 
   case 300:
-#line 3023 "Gmsh.y"
+#line 3022 "Gmsh.y"
     {
       double (*pNumOpt)(int num, int action, double value);
       StringXNumber *pNumCat;
       if(!(pNumCat = Get_NumberOptionCategory((yyvsp[(1) - (6)].c)))){
-	yymsg(GERROR, "Unknown numeric option class '%s'", (yyvsp[(1) - (6)].c));
+	yymsg(0, "Unknown numeric option class '%s'", (yyvsp[(1) - (6)].c));
 	(yyval.d) = 0.;
       }
       else{
 	if(!(pNumOpt =  (double (*) (int, int, double))Get_NumberOption((yyvsp[(6) - (6)].c), pNumCat))){
-	  yymsg(GERROR, "Unknown numeric option '%s[%d].%s'", (yyvsp[(1) - (6)].c), (int)(yyvsp[(3) - (6)].d), (yyvsp[(6) - (6)].c));
+	  yymsg(0, "Unknown numeric option '%s[%d].%s'", (yyvsp[(1) - (6)].c), (int)(yyvsp[(3) - (6)].d), (yyvsp[(6) - (6)].c));
 	  (yyval.d) = 0.;
 	}
 	else
@@ -7304,17 +7303,17 @@ yyreduce:
     break;
 
   case 301:
-#line 3041 "Gmsh.y"
+#line 3040 "Gmsh.y"
     {
       double (*pNumOpt)(int num, int action, double value);
       StringXNumber *pNumCat;
       if(!(pNumCat = Get_NumberOptionCategory((yyvsp[(1) - (4)].c)))){
-	yymsg(GERROR, "Unknown numeric option class '%s'", (yyvsp[(1) - (4)].c));
+	yymsg(0, "Unknown numeric option class '%s'", (yyvsp[(1) - (4)].c));
 	(yyval.d) = 0.;
       }
       else{
 	if(!(pNumOpt =  (double (*) (int, int, double))Get_NumberOption((yyvsp[(3) - (4)].c), pNumCat))){
-	  yymsg(GERROR, "Unknown numeric option '%s.%s'", (yyvsp[(1) - (4)].c), (yyvsp[(3) - (4)].c));
+	  yymsg(0, "Unknown numeric option '%s.%s'", (yyvsp[(1) - (4)].c), (yyvsp[(3) - (4)].c));
 	  (yyval.d) = 0.;
 	}
 	else
@@ -7325,17 +7324,17 @@ yyreduce:
     break;
 
   case 302:
-#line 3059 "Gmsh.y"
+#line 3058 "Gmsh.y"
     {
       double (*pNumOpt)(int num, int action, double value);
       StringXNumber *pNumCat;
       if(!(pNumCat = Get_NumberOptionCategory((yyvsp[(1) - (7)].c)))){
-	yymsg(GERROR, "Unknown numeric option class '%s'", (yyvsp[(1) - (7)].c));
+	yymsg(0, "Unknown numeric option class '%s'", (yyvsp[(1) - (7)].c));
 	(yyval.d) = 0.;
       }
       else{
 	if(!(pNumOpt =  (double (*) (int, int, double))Get_NumberOption((yyvsp[(6) - (7)].c), pNumCat))){
-	  yymsg(GERROR, "Unknown numeric option '%s[%d].%s'", (yyvsp[(1) - (7)].c), (int)(yyvsp[(3) - (7)].d), (yyvsp[(6) - (7)].c));
+	  yymsg(0, "Unknown numeric option '%s[%d].%s'", (yyvsp[(1) - (7)].c), (int)(yyvsp[(3) - (7)].d), (yyvsp[(6) - (7)].c));
 	  (yyval.d) = 0.;
 	}
 	else
@@ -7346,78 +7345,78 @@ yyreduce:
     break;
 
   case 303:
-#line 3077 "Gmsh.y"
+#line 3076 "Gmsh.y"
     { 
-      (yyval.d) = GetValue((yyvsp[(3) - (6)].c), (yyvsp[(5) - (6)].d));
+      (yyval.d) = Msg::GetValue((yyvsp[(3) - (6)].c), (yyvsp[(5) - (6)].d));
       Free((yyvsp[(3) - (6)].c));
     ;}
     break;
 
   case 304:
-#line 3085 "Gmsh.y"
+#line 3084 "Gmsh.y"
     {
       memcpy((yyval.v), (yyvsp[(1) - (1)].v), 5*sizeof(double));
     ;}
     break;
 
   case 305:
-#line 3089 "Gmsh.y"
+#line 3088 "Gmsh.y"
     {
       for(int i = 0; i < 5; i++) (yyval.v)[i] = -(yyvsp[(2) - (2)].v)[i];
     ;}
     break;
 
   case 306:
-#line 3093 "Gmsh.y"
+#line 3092 "Gmsh.y"
     { 
       for(int i = 0; i < 5; i++) (yyval.v)[i] = (yyvsp[(2) - (2)].v)[i];
     ;}
     break;
 
   case 307:
-#line 3097 "Gmsh.y"
+#line 3096 "Gmsh.y"
     { 
       for(int i = 0; i < 5; i++) (yyval.v)[i] = (yyvsp[(1) - (3)].v)[i] - (yyvsp[(3) - (3)].v)[i];
     ;}
     break;
 
   case 308:
-#line 3101 "Gmsh.y"
+#line 3100 "Gmsh.y"
     {
       for(int i = 0; i < 5; i++) (yyval.v)[i] = (yyvsp[(1) - (3)].v)[i] + (yyvsp[(3) - (3)].v)[i];
     ;}
     break;
 
   case 309:
-#line 3108 "Gmsh.y"
+#line 3107 "Gmsh.y"
     { 
       (yyval.v)[0] = (yyvsp[(2) - (11)].d);  (yyval.v)[1] = (yyvsp[(4) - (11)].d);  (yyval.v)[2] = (yyvsp[(6) - (11)].d);  (yyval.v)[3] = (yyvsp[(8) - (11)].d); (yyval.v)[4] = (yyvsp[(10) - (11)].d);
     ;}
     break;
 
   case 310:
-#line 3112 "Gmsh.y"
+#line 3111 "Gmsh.y"
     { 
       (yyval.v)[0] = (yyvsp[(2) - (9)].d);  (yyval.v)[1] = (yyvsp[(4) - (9)].d);  (yyval.v)[2] = (yyvsp[(6) - (9)].d);  (yyval.v)[3] = (yyvsp[(8) - (9)].d); (yyval.v)[4] = 1.0;
     ;}
     break;
 
   case 311:
-#line 3116 "Gmsh.y"
+#line 3115 "Gmsh.y"
     {
       (yyval.v)[0] = (yyvsp[(2) - (7)].d);  (yyval.v)[1] = (yyvsp[(4) - (7)].d);  (yyval.v)[2] = (yyvsp[(6) - (7)].d);  (yyval.v)[3] = 0.0; (yyval.v)[4] = 1.0;
     ;}
     break;
 
   case 312:
-#line 3120 "Gmsh.y"
+#line 3119 "Gmsh.y"
     {
       (yyval.v)[0] = (yyvsp[(2) - (7)].d);  (yyval.v)[1] = (yyvsp[(4) - (7)].d);  (yyval.v)[2] = (yyvsp[(6) - (7)].d);  (yyval.v)[3] = 0.0; (yyval.v)[4] = 1.0;
     ;}
     break;
 
   case 313:
-#line 3127 "Gmsh.y"
+#line 3126 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(List_T*));
       List_Add((yyval.l), &((yyvsp[(1) - (1)].l)));
@@ -7425,14 +7424,14 @@ yyreduce:
     break;
 
   case 314:
-#line 3132 "Gmsh.y"
+#line 3131 "Gmsh.y"
     {
       List_Add((yyval.l), &((yyvsp[(3) - (3)].l)));
     ;}
     break;
 
   case 315:
-#line 3140 "Gmsh.y"
+#line 3139 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(double));
       List_Add((yyval.l), &((yyvsp[(1) - (1)].d)));
@@ -7440,14 +7439,14 @@ yyreduce:
     break;
 
   case 316:
-#line 3145 "Gmsh.y"
+#line 3144 "Gmsh.y"
     {
       (yyval.l) = (yyvsp[(1) - (1)].l);
     ;}
     break;
 
   case 317:
-#line 3149 "Gmsh.y"
+#line 3148 "Gmsh.y"
     {
       // creates an empty list
       (yyval.l) = List_Create(2, 1, sizeof(double));
@@ -7455,14 +7454,14 @@ yyreduce:
     break;
 
   case 318:
-#line 3154 "Gmsh.y"
+#line 3153 "Gmsh.y"
     {
       (yyval.l) = (yyvsp[(2) - (3)].l);
     ;}
     break;
 
   case 319:
-#line 3158 "Gmsh.y"
+#line 3157 "Gmsh.y"
     {
       (yyval.l) = (yyvsp[(3) - (4)].l);
       for(int i = 0; i < List_Nbr((yyval.l)); i++){
@@ -7473,7 +7472,7 @@ yyreduce:
     break;
 
   case 320:
-#line 3166 "Gmsh.y"
+#line 3165 "Gmsh.y"
     {
       (yyval.l) = (yyvsp[(4) - (5)].l);
       for(int i = 0; i < List_Nbr((yyval.l)); i++){
@@ -7484,7 +7483,7 @@ yyreduce:
     break;
 
   case 321:
-#line 3177 "Gmsh.y"
+#line 3176 "Gmsh.y"
     {
       (yyval.l) = (yyvsp[(2) - (2)].l);
       for(int i = 0; i < List_Nbr((yyval.l)); i++){
@@ -7495,7 +7494,7 @@ yyreduce:
     break;
 
   case 322:
-#line 3185 "Gmsh.y"
+#line 3184 "Gmsh.y"
     {
       (yyval.l) = (yyvsp[(3) - (3)].l);
       for(int i = 0; i < List_Nbr((yyval.l)); i++){
@@ -7506,7 +7505,7 @@ yyreduce:
     break;
 
   case 323:
-#line 3193 "Gmsh.y"
+#line 3192 "Gmsh.y"
     { 
       (yyval.l) = List_Create(2, 1, sizeof(double)); 
       for(double d = (yyvsp[(1) - (3)].d); ((yyvsp[(1) - (3)].d) < (yyvsp[(3) - (3)].d)) ? (d <= (yyvsp[(3) - (3)].d)) : (d >= (yyvsp[(3) - (3)].d)); ((yyvsp[(1) - (3)].d) < (yyvsp[(3) - (3)].d)) ? (d += 1.) : (d -= 1.)) 
@@ -7515,11 +7514,11 @@ yyreduce:
     break;
 
   case 324:
-#line 3199 "Gmsh.y"
+#line 3198 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(double)); 
       if(!(yyvsp[(5) - (5)].d) || ((yyvsp[(1) - (5)].d) < (yyvsp[(3) - (5)].d) && (yyvsp[(5) - (5)].d) < 0) || ((yyvsp[(1) - (5)].d) > (yyvsp[(3) - (5)].d) && (yyvsp[(5) - (5)].d) > 0)){
-        yymsg(GERROR, "Wrong increment in '%g:%g:%g'", (yyvsp[(1) - (5)].d), (yyvsp[(3) - (5)].d), (yyvsp[(5) - (5)].d));
+        yymsg(0, "Wrong increment in '%g:%g:%g'", (yyvsp[(1) - (5)].d), (yyvsp[(3) - (5)].d), (yyvsp[(5) - (5)].d));
 	List_Add((yyval.l), &((yyvsp[(1) - (5)].d)));
       }
       else
@@ -7529,7 +7528,7 @@ yyreduce:
     break;
 
   case 325:
-#line 3210 "Gmsh.y"
+#line 3209 "Gmsh.y"
     {
       // Returns the coordinates of a point and fills a list with it.
       // This allows to ensure e.g. that relative point positions are
@@ -7537,7 +7536,7 @@ yyreduce:
       Vertex *v = FindPoint((int)(yyvsp[(3) - (4)].d));
       (yyval.l) = List_Create(3, 1, sizeof(double));      
       if(!v) {
-	yymsg(GERROR, "Unknown point '%d'", (int)(yyvsp[(3) - (4)].d));
+	yymsg(0, "Unknown point '%d'", (int)(yyvsp[(3) - (4)].d));
 	double d = 0.0;
 	List_Add((yyval.l), &d);
 	List_Add((yyval.l), &d);
@@ -7552,7 +7551,7 @@ yyreduce:
     break;
 
   case 326:
-#line 3230 "Gmsh.y"
+#line 3229 "Gmsh.y"
     {
       (yyval.l) = List_Create(List_Nbr((yyvsp[(1) - (1)].l)), 1, sizeof(double));
       for(int i = 0; i < List_Nbr((yyvsp[(1) - (1)].l)); i++){
@@ -7565,7 +7564,7 @@ yyreduce:
     break;
 
   case 327:
-#line 3240 "Gmsh.y"
+#line 3239 "Gmsh.y"
     {
       (yyval.l) = List_Create(List_Nbr((yyvsp[(1) - (1)].l)), 1, sizeof(double));
       for(int i = 0; i < List_Nbr((yyvsp[(1) - (1)].l)); i++){
@@ -7578,14 +7577,14 @@ yyreduce:
     break;
 
   case 328:
-#line 3250 "Gmsh.y"
+#line 3249 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(double));
       Symbol TheSymbol;
       TheSymbol.Name = (yyvsp[(1) - (3)].c);
       Symbol *pSymbol;
       if(!(pSymbol = (Symbol*)Tree_PQuery(Symbol_T, &TheSymbol))) {
-	yymsg(GERROR, "Unknown variable '%s'", (yyvsp[(1) - (3)].c));
+	yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (3)].c));
 	double d = 0.0;
 	List_Add((yyval.l), &d);
       }
@@ -7598,14 +7597,14 @@ yyreduce:
     break;
 
   case 329:
-#line 3267 "Gmsh.y"
+#line 3266 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(double));
       Symbol TheSymbol;
       TheSymbol.Name = (yyvsp[(1) - (6)].c);
       Symbol *pSymbol;
       if(!(pSymbol = (Symbol*)Tree_PQuery(Symbol_T, &TheSymbol))) {
-	yymsg(GERROR, "Unknown variable '%s'", (yyvsp[(1) - (6)].c));
+	yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (6)].c));
 	double d = 0.0;
 	List_Add((yyval.l), &d);
       }
@@ -7616,7 +7615,7 @@ yyreduce:
 	  if((pd = (double*)List_Pointer_Test(pSymbol->val, j)))
 	    List_Add((yyval.l), pd);
 	  else
-	    yymsg(GERROR, "Uninitialized variable '%s[%d]'", (yyvsp[(1) - (6)].c), j);	  
+	    yymsg(0, "Uninitialized variable '%s[%d]'", (yyvsp[(1) - (6)].c), j);	  
 	}
       }
       Free((yyvsp[(1) - (6)].c));
@@ -7625,7 +7624,7 @@ yyreduce:
     break;
 
   case 330:
-#line 3294 "Gmsh.y"
+#line 3293 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(double));
       List_Add((yyval.l), &((yyvsp[(1) - (1)].d)));
@@ -7633,21 +7632,21 @@ yyreduce:
     break;
 
   case 331:
-#line 3299 "Gmsh.y"
+#line 3298 "Gmsh.y"
     {
       (yyval.l) = (yyvsp[(1) - (1)].l);
     ;}
     break;
 
   case 332:
-#line 3303 "Gmsh.y"
+#line 3302 "Gmsh.y"
     {
       List_Add((yyval.l), &((yyvsp[(3) - (3)].d)));
     ;}
     break;
 
   case 333:
-#line 3307 "Gmsh.y"
+#line 3306 "Gmsh.y"
     {
       for(int i = 0; i < List_Nbr((yyvsp[(3) - (3)].l)); i++){
 	double d;
@@ -7659,41 +7658,41 @@ yyreduce:
     break;
 
   case 334:
-#line 3320 "Gmsh.y"
+#line 3319 "Gmsh.y"
     {
       (yyval.u) = CTX.PACK_COLOR((int)(yyvsp[(2) - (9)].d), (int)(yyvsp[(4) - (9)].d), (int)(yyvsp[(6) - (9)].d), (int)(yyvsp[(8) - (9)].d));
     ;}
     break;
 
   case 335:
-#line 3324 "Gmsh.y"
+#line 3323 "Gmsh.y"
     {
       (yyval.u) = CTX.PACK_COLOR((int)(yyvsp[(2) - (7)].d), (int)(yyvsp[(4) - (7)].d), (int)(yyvsp[(6) - (7)].d), 255);
     ;}
     break;
 
   case 336:
-#line 3336 "Gmsh.y"
+#line 3335 "Gmsh.y"
     {
       int flag;
       (yyval.u) = Get_ColorForString(ColorString, -1, (yyvsp[(1) - (1)].c), &flag);
-      if(flag) yymsg(GERROR, "Unknown color '%s'", (yyvsp[(1) - (1)].c));
+      if(flag) yymsg(0, "Unknown color '%s'", (yyvsp[(1) - (1)].c));
       Free((yyvsp[(1) - (1)].c));
     ;}
     break;
 
   case 337:
-#line 3343 "Gmsh.y"
+#line 3342 "Gmsh.y"
     {
       unsigned int (*pColOpt)(int num, int action, unsigned int value);
       StringXColor *pColCat;
       if(!(pColCat = Get_ColorOptionCategory((yyvsp[(1) - (5)].c)))){
-	yymsg(GERROR, "Unknown color option class '%s'", (yyvsp[(1) - (5)].c));
+	yymsg(0, "Unknown color option class '%s'", (yyvsp[(1) - (5)].c));
 	(yyval.u) = 0;
       }
       else{
 	if(!(pColOpt =  (unsigned int (*) (int, int, unsigned int))Get_ColorOption((yyvsp[(5) - (5)].c), pColCat))){
-	  yymsg(GERROR, "Unknown color option '%s.Color.%s'", (yyvsp[(1) - (5)].c), (yyvsp[(5) - (5)].c));
+	  yymsg(0, "Unknown color option '%s.Color.%s'", (yyvsp[(1) - (5)].c), (yyvsp[(5) - (5)].c));
 	  (yyval.u) = 0;
 	}
 	else
@@ -7704,19 +7703,19 @@ yyreduce:
     break;
 
   case 338:
-#line 3364 "Gmsh.y"
+#line 3363 "Gmsh.y"
     {
       (yyval.l) = (yyvsp[(2) - (3)].l);
     ;}
     break;
 
   case 339:
-#line 3368 "Gmsh.y"
+#line 3367 "Gmsh.y"
     {
       (yyval.l) = List_Create(256, 10, sizeof(unsigned int));
       GmshColorTable *ct = Get_ColorTable((int)(yyvsp[(3) - (6)].d));
       if(!ct)
-	yymsg(GERROR, "View[%d] does not exist", (int)(yyvsp[(3) - (6)].d));
+	yymsg(0, "View[%d] does not exist", (int)(yyvsp[(3) - (6)].d));
       else{
 	for(int i = 0; i < ct->size; i++) 
 	  List_Add((yyval.l), &ct->table[i]);
@@ -7726,7 +7725,7 @@ yyreduce:
     break;
 
   case 340:
-#line 3383 "Gmsh.y"
+#line 3382 "Gmsh.y"
     {
       (yyval.l) = List_Create(256, 10, sizeof(unsigned int));
       List_Add((yyval.l), &((yyvsp[(1) - (1)].u)));
@@ -7734,35 +7733,35 @@ yyreduce:
     break;
 
   case 341:
-#line 3388 "Gmsh.y"
+#line 3387 "Gmsh.y"
     {
       List_Add((yyval.l), &((yyvsp[(3) - (3)].u)));
     ;}
     break;
 
   case 342:
-#line 3395 "Gmsh.y"
+#line 3394 "Gmsh.y"
     {
       (yyval.c) = (yyvsp[(1) - (1)].c);
     ;}
     break;
 
   case 343:
-#line 3399 "Gmsh.y"
+#line 3398 "Gmsh.y"
     {
-      Msg(WARNING, "Named string expressions not implemented yet");
+      Msg::Warning("Named string expressions not implemented yet");
     ;}
     break;
 
   case 344:
-#line 3406 "Gmsh.y"
+#line 3405 "Gmsh.y"
     {
       (yyval.c) = (yyvsp[(1) - (1)].c);
     ;}
     break;
 
   case 345:
-#line 3410 "Gmsh.y"
+#line 3409 "Gmsh.y"
     {
       (yyval.c) = (char *)Malloc(32*sizeof(char));
       time_t now;
@@ -7773,7 +7772,7 @@ yyreduce:
     break;
 
   case 346:
-#line 3418 "Gmsh.y"
+#line 3417 "Gmsh.y"
     {
       (yyval.c) = (char *)Malloc((strlen((yyvsp[(3) - (6)].c))+strlen((yyvsp[(5) - (6)].c))+1)*sizeof(char));
       strcpy((yyval.c), (yyvsp[(3) - (6)].c));
@@ -7784,7 +7783,7 @@ yyreduce:
     break;
 
   case 347:
-#line 3426 "Gmsh.y"
+#line 3425 "Gmsh.y"
     {
       (yyval.c) = (char *)Malloc((strlen((yyvsp[(3) - (4)].c))+1)*sizeof(char));
       int i;
@@ -7801,7 +7800,7 @@ yyreduce:
     break;
 
   case 348:
-#line 3440 "Gmsh.y"
+#line 3439 "Gmsh.y"
     {
       (yyval.c) = (char *)Malloc((strlen((yyvsp[(3) - (4)].c))+1)*sizeof(char));
       int i;
@@ -7818,23 +7817,23 @@ yyreduce:
     break;
 
   case 349:
-#line 3454 "Gmsh.y"
+#line 3453 "Gmsh.y"
     {
       (yyval.c) = (yyvsp[(3) - (4)].c);
     ;}
     break;
 
   case 350:
-#line 3458 "Gmsh.y"
+#line 3457 "Gmsh.y"
     {
       char tmpstring[1024];
       int i = PrintListOfDouble((yyvsp[(3) - (6)].c), (yyvsp[(5) - (6)].l), tmpstring);
       if(i < 0){
-	yymsg(GERROR, "Too few arguments in Sprintf");
+	yymsg(0, "Too few arguments in Sprintf");
 	(yyval.c) = (yyvsp[(3) - (6)].c);
       }
       else if(i > 0){
-	yymsg(GERROR, "%d extra argument%s in Sprintf", i, (i>1)?"s":"");
+	yymsg(0, "%d extra argument%s in Sprintf", i, (i>1)?"s":"");
 	(yyval.c) = (yyvsp[(3) - (6)].c);
       }
       else{
@@ -7847,19 +7846,19 @@ yyreduce:
     break;
 
   case 351:
-#line 3477 "Gmsh.y"
+#line 3476 "Gmsh.y"
     { 
       const char* (*pStrOpt)(int num, int action, const char *value);
       StringXString *pStrCat;
       if(!(pStrCat = Get_StringOptionCategory((yyvsp[(3) - (6)].c)))){
-	yymsg(GERROR, "Unknown string option class '%s'", (yyvsp[(3) - (6)].c));
+	yymsg(0, "Unknown string option class '%s'", (yyvsp[(3) - (6)].c));
 	(yyval.c) = (char*)Malloc(sizeof(char));
 	(yyval.c)[0] = '\0';
       }
       else{
 	if(!(pStrOpt = (const char *(*) (int, int, const char *))
 	     Get_StringOption((yyvsp[(5) - (6)].c), pStrCat))){
-	  yymsg(GERROR, "Unknown string option '%s.%s'", (yyvsp[(3) - (6)].c), (yyvsp[(5) - (6)].c));
+	  yymsg(0, "Unknown string option '%s.%s'", (yyvsp[(3) - (6)].c), (yyvsp[(5) - (6)].c));
 	  (yyval.c) = (char*)Malloc(sizeof(char));
 	  (yyval.c)[0] = '\0';
 	}
@@ -7873,19 +7872,19 @@ yyreduce:
     break;
 
   case 352:
-#line 3500 "Gmsh.y"
+#line 3499 "Gmsh.y"
     { 
       const char* (*pStrOpt)(int num, int action, const char *value);
       StringXString *pStrCat;
       if(!(pStrCat = Get_StringOptionCategory((yyvsp[(3) - (9)].c)))){
-	yymsg(GERROR, "Unknown string option class '%s'", (yyvsp[(3) - (9)].c));
+	yymsg(0, "Unknown string option class '%s'", (yyvsp[(3) - (9)].c));
 	(yyval.c) = (char*)Malloc(sizeof(char));
 	(yyval.c)[0] = '\0';
       }
       else{
 	if(!(pStrOpt = (const char *(*) (int, int, const char *))
 	     Get_StringOption((yyvsp[(8) - (9)].c), pStrCat))){
-	  yymsg(GERROR, "Unknown string option '%s[%d].%s'", (yyvsp[(3) - (9)].c), (int)(yyvsp[(5) - (9)].d), (yyvsp[(8) - (9)].c));
+	  yymsg(0, "Unknown string option '%s[%d].%s'", (yyvsp[(3) - (9)].c), (int)(yyvsp[(5) - (9)].d), (yyvsp[(8) - (9)].c));
 	  (yyval.c) = (char*)Malloc(sizeof(char));
 	  (yyval.c)[0] = '\0';
 	}
@@ -7900,7 +7899,7 @@ yyreduce:
 
 
 /* Line 1267 of yacc.c.  */
-#line 7904 "Gmsh.tab.cpp"
+#line 7903 "Gmsh.tab.cpp"
       default: break;
     }
   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -8114,7 +8113,7 @@ yyreturn:
 }
 
 
-#line 3524 "Gmsh.y"
+#line 3523 "Gmsh.y"
 
 
 void DeleteSymbol(void *a, void *b)
@@ -8175,21 +8174,24 @@ int PrintListOfDouble(char *format, List_T *list, char *buffer)
 
 void yyerror(char *s)
 {
-  Msg(GERROR, "'%s', line %d : %s (%s)", gmsh_yyname, gmsh_yylineno - 1, s, gmsh_yytext);
+  Msg::Error("'%s', line %d : %s (%s)", gmsh_yyname, gmsh_yylineno - 1, s, gmsh_yytext);
   gmsh_yyerrorstate++;
 }
 
-void yymsg(int type, const char *fmt, ...)
+void yymsg(int level, const char *fmt, ...)
 {
   va_list args;
   char tmp[1024];
 
-  va_start (args, fmt);
-  vsprintf (tmp, fmt, args);
-  va_end (args);
-
-  Msg(type, "'%s', line %d : %s", gmsh_yyname, gmsh_yylineno - 1, tmp);
+  va_start(args, fmt);
+  vsprintf(tmp, fmt, args);
+  va_end(args);
 
-  if(type == GERROR) gmsh_yyerrorstate++;
+  if(level == 0){
+    Msg::Error("'%s', line %d : %s", gmsh_yyname, gmsh_yylineno - 1, tmp);
+    gmsh_yyerrorstate++;
+  }
+  else
+    Msg::Warning("'%s', line %d : %s", gmsh_yyname, gmsh_yylineno - 1, tmp);
 }
 
diff --git a/Parser/Gmsh.tab.hpp b/Parser/Gmsh.tab.hpp
index 7f8f26c5d9d26beceda77a2663a3dcc518f24258..325263363094474c27ef30c9c1e0d6d864c34373 100644
--- a/Parser/Gmsh.tab.hpp
+++ b/Parser/Gmsh.tab.hpp
@@ -288,7 +288,7 @@
 
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
 typedef union YYSTYPE
-#line 82 "Gmsh.y"
+#line 81 "Gmsh.y"
 {
   char *c;
   int i;
diff --git a/Parser/Gmsh.y b/Parser/Gmsh.y
index 9d9ea7700e68d9483931599fb83a52da138b03ae..5056cc65272f0df55fb14e028a3138b65e6e7fa4 100644
--- a/Parser/Gmsh.y
+++ b/Parser/Gmsh.y
@@ -1,5 +1,5 @@
 %{
-// $Id: Gmsh.y,v 1.312 2008-05-01 06:54:09 geuzaine Exp $
+// $Id: Gmsh.y,v 1.313 2008-05-04 08:31:21 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -26,7 +26,6 @@
 #include "Message.h"
 #include "Malloc.h"
 #include "Tools.h"
-#include "ParUtil.h"
 #include "Numeric.h"
 #include "Context.h"
 #include "GModel.h"
@@ -74,7 +73,7 @@ static double LoopControlVariablesTab[MAX_RECUR_LOOPS][3];
 static char *LoopControlVariablesNameTab[MAX_RECUR_LOOPS];
 
 void yyerror(char *s);
-void yymsg(int type, const char *fmt, ...);
+void yymsg(int level, const char *fmt, ...);
 void skip_until(const char *skip, const char *until);
 int PrintListOfDouble(char *format, List_T *list, char *buffer);
 %}
@@ -187,7 +186,7 @@ SendToFile :
 Printf :
     tPrintf '(' tBIGSTR ')' tEND
     {
-      Msg(DIRECT, $3);
+      Msg::Direct($3);
       Free($3);
     }
   | tPrintf '(' tBIGSTR ')' SendToFile StringExprVar tEND
@@ -196,7 +195,7 @@ Printf :
       FixRelativePath($6, tmpstring);
       FILE *fp = fopen(tmpstring, $5);
       if(!fp){
-	yymsg(GERROR, "Unable to open file '%s'", tmpstring);
+	yymsg(0, "Unable to open file '%s'", tmpstring);
       }
       else{
 	fprintf(fp, "%s\n", $3);
@@ -210,11 +209,11 @@ Printf :
       char tmpstring[1024];
       int i = PrintListOfDouble($3, $5, tmpstring);
       if(i < 0) 
-	yymsg(GERROR, "Too few arguments in Printf");
+	yymsg(0, "Too few arguments in Printf");
       else if(i > 0)
-	yymsg(GERROR, "%d extra argument%s in Printf", i, (i>1)?"s":"");
+	yymsg(0, "%d extra argument%s in Printf", i, (i>1)?"s":"");
       else
-	Msg(DIRECT, tmpstring);
+	Msg::Direct(tmpstring);
       Free($3);
       List_Delete($5);
     }
@@ -223,15 +222,15 @@ Printf :
       char tmpstring[1024];
       int i = PrintListOfDouble($3, $5, tmpstring);
       if(i < 0) 
-	yymsg(GERROR, "Too few arguments in Printf");
+	yymsg(0, "Too few arguments in Printf");
       else if(i > 0)
-	yymsg(GERROR, "%d extra argument%s in Printf", i, (i>1)?"s":"");
+	yymsg(0, "%d extra argument%s in Printf", i, (i>1)?"s":"");
       else{
 	char tmpstring2[1024];
 	FixRelativePath($8, tmpstring2);
 	FILE *fp = fopen(tmpstring2, $7);
 	if(!fp){
-	  yymsg(GERROR, "Unable to open file '%s'", tmpstring2);
+	  yymsg(0, "Unable to open file '%s'", tmpstring2);
 	}
 	else{
 	  fprintf(fp, "%s\n", tmpstring);
@@ -453,7 +452,7 @@ Element :
 	ViewValueList = ViewData->TY2; ViewNumList = &ViewData->NbTY2;
       }
       else{
-	yymsg(GERROR, "Unknown element type '%s'", $1);	
+	yymsg(0, "Unknown element type '%s'", $1);	
 	ViewValueList = 0; ViewNumList = 0;
       }
       Free($1);
@@ -625,7 +624,7 @@ Affectation :
 	  Tree_Add(Symbol_T, &TheSymbol);
 	}
 	else{
-	  yymsg(GERROR, "Unknown variable '%s'", $1);
+	  yymsg(0, "Unknown variable '%s'", $1);
 	  Free($1);
 	}
       }
@@ -638,7 +637,7 @@ Affectation :
 	case 3 : *pd *= $3; break;
 	case 4 : 
 	  if($3) *pd /= $3; 
-	  else yymsg(GERROR, "Division by zero in '%s /= %g'", $1, $3);
+	  else yymsg(0, "Division by zero in '%s /= %g'", $1, $3);
 	  break;
 	}
 	Free($1);
@@ -656,7 +655,7 @@ Affectation :
 	  Tree_Add(Symbol_T, &TheSymbol);
 	}
 	else{
-	  yymsg(GERROR, "Unknown variable '%s'", $1);
+	  yymsg(0, "Unknown variable '%s'", $1);
 	  Free($1);
 	}
       }
@@ -670,7 +669,7 @@ Affectation :
 	  case 3 : *pd *= $6; break;
 	  case 4 : 
 	    if($6) *pd /= $6; 
-	    else yymsg(GERROR, "Division by zero in '%s[%d] /= %g'", $1, (int)$3, $6);
+	    else yymsg(0, "Division by zero in '%s[%d] /= %g'", $1, (int)$3, $6);
 	    break;
 	  }
 	}
@@ -678,7 +677,7 @@ Affectation :
 	  if(!$5)
 	    List_Put(pSymbol->val, (int)$3, &$6);
 	  else
-	    yymsg(GERROR, "Uninitialized variable '%s[%d]'", $1, (int)$3);
+	    yymsg(0, "Uninitialized variable '%s[%d]'", $1, (int)$3);
 	}
 	Free($1);
       }
@@ -686,7 +685,7 @@ Affectation :
   | tSTRING '[' '{' RecursiveListOfDouble '}' ']' NumericAffectation ListOfDouble tEND
     {
       if(List_Nbr($4) != List_Nbr($8)){
-	yymsg(GERROR, "Incompatible array dimensions in affectation");
+	yymsg(0, "Incompatible array dimensions in affectation");
 	Free($1);
       }
       else{
@@ -703,7 +702,7 @@ Affectation :
 	    Tree_Add(Symbol_T, &TheSymbol);
 	  }
 	  else{
-	    yymsg(GERROR, "Unknown variable '%s'", $1);
+	    yymsg(0, "Unknown variable '%s'", $1);
 	    Free($1);
 	  }
 	}
@@ -720,7 +719,7 @@ Affectation :
 	      case 3 : *pd *= d; break;
 	      case 4 : 
 		if($8) *pd /= d; 
-		else yymsg(GERROR, "Division by zero in '%s[%d] /= %g'", $1, j, d);
+		else yymsg(0, "Division by zero in '%s[%d] /= %g'", $1, j, d);
 		break;
 	      }
 	    }
@@ -728,7 +727,7 @@ Affectation :
 	      if(!$7)
 		List_Put(pSymbol->val, j, &d);
 	      else
-		yymsg(GERROR, "Uninitialized variable '%s[%d]'", $1, j);	  
+		yymsg(0, "Uninitialized variable '%s[%d]'", $1, j);	  
 	    }
 	  }
 	  Free($1);
@@ -778,7 +777,7 @@ Affectation :
       TheSymbol.Name = $1;
       Symbol *pSymbol;
       if(!(pSymbol = (Symbol*)Tree_PQuery(Symbol_T, &TheSymbol)))
-	yymsg(GERROR, "Unknown variable '%s'", $1); 
+	yymsg(0, "Unknown variable '%s'", $1); 
       else
 	*(double*)List_Pointer_Fast(pSymbol->val, 0) += $2;
       Free($1);
@@ -789,20 +788,20 @@ Affectation :
       TheSymbol.Name = $1;
       Symbol *pSymbol;
       if(!(pSymbol = (Symbol*)Tree_PQuery(Symbol_T, &TheSymbol)))
-	yymsg(GERROR, "Unknown variable '%s'", $1); 
+	yymsg(0, "Unknown variable '%s'", $1); 
       else{
 	double *pd;
 	if((pd = (double*)List_Pointer_Test(pSymbol->val, (int)$3)))
 	  *pd += $5;
 	else
-	  yymsg(GERROR, "Uninitialized variable '%s[%d]'", $1, (int)$3);
+	  yymsg(0, "Uninitialized variable '%s[%d]'", $1, (int)$3);
       }
       Free($1);
     }
 
   | tSTRING tAFFECT StringExpr tEND 
     { 
-      Msg(WARNING, "Named string expressions not implemented yet");
+      Msg::Warning("Named string expressions not implemented yet");
     }
 
   // Option Strings
@@ -812,11 +811,11 @@ Affectation :
       const char* (*pStrOpt)(int num, int action, const char *value);
       StringXString *pStrCat;
       if(!(pStrCat = Get_StringOptionCategory($1)))
-	yymsg(GERROR, "Unknown string option class '%s'", $1);
+	yymsg(0, "Unknown string option class '%s'", $1);
       else{
 	if(!(pStrOpt = (const char *(*) (int, int, const char *))
 	     Get_StringOption($3, pStrCat)))
-	  yymsg(GERROR, "Unknown string option '%s.%s'", $1, $3);
+	  yymsg(0, "Unknown string option '%s.%s'", $1, $3);
 	else
 	  pStrOpt(0, GMSH_SET|GMSH_GUI, $5);
       }
@@ -827,11 +826,11 @@ Affectation :
       const char* (*pStrOpt)(int num, int action, const char *value);
       StringXString *pStrCat;
       if(!(pStrCat = Get_StringOptionCategory($1)))
-	yymsg(GERROR, "Unknown string option class '%s'", $1);
+	yymsg(0, "Unknown string option class '%s'", $1);
       else{
 	if(!(pStrOpt = (const char *(*) (int, int, const char *))
 	     Get_StringOption($6, pStrCat)))
-	  yymsg(GERROR, "Unknown string option '%s[%d].%s'", $1, (int)$3, $6);
+	  yymsg(0, "Unknown string option '%s[%d].%s'", $1, (int)$3, $6);
 	else
 	  pStrOpt((int)$3, GMSH_SET|GMSH_GUI, $8);
       }
@@ -845,10 +844,10 @@ Affectation :
       double (*pNumOpt)(int num, int action, double value);
       StringXNumber *pNumCat;
       if(!(pNumCat = Get_NumberOptionCategory($1)))
-	yymsg(GERROR, "Unknown numeric option class '%s'", $1);
+	yymsg(0, "Unknown numeric option class '%s'", $1);
       else{
 	if(!(pNumOpt = (double (*) (int, int, double))Get_NumberOption($3, pNumCat)))
-	  yymsg(GERROR, "Unknown numeric option '%s.%s'", $1, $3);
+	  yymsg(0, "Unknown numeric option '%s.%s'", $1, $3);
 	else{
 	  double d = 0;
 	  switch($4){
@@ -858,7 +857,7 @@ Affectation :
 	  case 3 : d = pNumOpt(0, GMSH_GET, 0) * $5; break;
 	  case 4 : 
 	    if($5) d = pNumOpt(0, GMSH_GET, 0) / $5; 
-	    else yymsg(GERROR, "Division by zero in '%s.%s /= %g'", $1, $3, $5);
+	    else yymsg(0, "Division by zero in '%s.%s /= %g'", $1, $3, $5);
 	    break;
 	  }
 	  pNumOpt(0, GMSH_SET|GMSH_GUI, d);
@@ -871,10 +870,10 @@ Affectation :
       double (*pNumOpt)(int num, int action, double value);
       StringXNumber *pNumCat;
       if(!(pNumCat = Get_NumberOptionCategory($1)))
-	yymsg(GERROR, "Unknown numeric option class '%s'", $1);
+	yymsg(0, "Unknown numeric option class '%s'", $1);
       else{
 	if(!(pNumOpt =  (double (*) (int, int, double))Get_NumberOption($6, pNumCat)))
-	  yymsg(GERROR, "Unknown numeric option '%s[%d].%s'", $1, (int)$3, $6);
+	  yymsg(0, "Unknown numeric option '%s[%d].%s'", $1, (int)$3, $6);
 	else{
 	  double d = 0;
 	  switch($7){
@@ -884,7 +883,7 @@ Affectation :
 	  case 3 : d = pNumOpt((int)$3, GMSH_GET, 0) * $8; break;
 	  case 4 : 
 	    if($8) d = pNumOpt((int)$3, GMSH_GET, 0) / $8;
-	    else yymsg(GERROR, "Division by zero in '%s[%d].%s /= %g'", 
+	    else yymsg(0, "Division by zero in '%s[%d].%s /= %g'", 
 		       $1, (int)$3, $6, $8);
 	    break;
 	  }
@@ -898,10 +897,10 @@ Affectation :
       double (*pNumOpt)(int num, int action, double value);
       StringXNumber *pNumCat;
       if(!(pNumCat = Get_NumberOptionCategory($1)))
-	yymsg(GERROR, "Unknown numeric option class '%s'", $1);
+	yymsg(0, "Unknown numeric option class '%s'", $1);
       else{
 	if(!(pNumOpt =  (double (*) (int, int, double))Get_NumberOption($3, pNumCat)))
-	  yymsg(GERROR, "Unknown numeric option '%s.%s'", $1, $3);
+	  yymsg(0, "Unknown numeric option '%s.%s'", $1, $3);
 	else
 	  pNumOpt(0, GMSH_SET|GMSH_GUI, pNumOpt(0, GMSH_GET, 0)+$4);
       }
@@ -912,10 +911,10 @@ Affectation :
       double (*pNumOpt)(int num, int action, double value);
       StringXNumber *pNumCat;
       if(!(pNumCat = Get_NumberOptionCategory($1)))
-	yymsg(GERROR, "Unknown numeric option class '%s'", $1);
+	yymsg(0, "Unknown numeric option class '%s'", $1);
       else{
 	if(!(pNumOpt =  (double (*) (int, int, double))Get_NumberOption($6, pNumCat)))
-	  yymsg(GERROR, "Unknown numeric option '%s[%d].%s'", $1, (int)$3, $6);
+	  yymsg(0, "Unknown numeric option '%s[%d].%s'", $1, (int)$3, $6);
 	else
 	  pNumOpt((int)$3, GMSH_SET|GMSH_GUI, pNumOpt((int)$3, GMSH_GET, 0)+$7);
       }
@@ -929,11 +928,11 @@ Affectation :
       unsigned int (*pColOpt)(int num, int action, unsigned int value);
       StringXColor *pColCat;
       if(!(pColCat = Get_ColorOptionCategory($1)))
-	yymsg(GERROR, "Unknown color option class '%s'", $1);
+	yymsg(0, "Unknown color option class '%s'", $1);
       else{
 	if(!(pColOpt = (unsigned int (*) (int, int, unsigned int))
 	     Get_ColorOption($5, pColCat)))
-	  yymsg(GERROR, "Unknown color option '%s.Color.%s'", $1, $5);
+	  yymsg(0, "Unknown color option '%s.Color.%s'", $1, $5);
 	else
 	  pColOpt(0, GMSH_SET|GMSH_GUI, $7);
       }
@@ -944,11 +943,11 @@ Affectation :
       unsigned int (*pColOpt)(int num, int action, unsigned int value);
       StringXColor *pColCat;
       if(!(pColCat = Get_ColorOptionCategory($1)))
-	yymsg(GERROR, "Unknown color option class '%s'", $1);
+	yymsg(0, "Unknown color option class '%s'", $1);
       else{
 	if(!(pColOpt =  (unsigned int (*) (int, int, unsigned int))
 	     Get_ColorOption($8, pColCat)))
-	  yymsg(GERROR, "Unknown color option '%s[%d].Color.%s'", $1, (int)$3, $8);
+	  yymsg(0, "Unknown color option '%s[%d].Color.%s'", $1, (int)$3, $8);
 	else
 	  pColOpt((int)$3, GMSH_SET|GMSH_GUI, $10);
       }
@@ -961,11 +960,11 @@ Affectation :
     {
       GmshColorTable *ct = Get_ColorTable(0);
       if(!ct)
-	yymsg(GERROR, "View[%d] does not exist", 0);
+	yymsg(0, "View[%d] does not exist", 0);
       else{
 	ct->size = List_Nbr($5);
 	if(ct->size > COLORTABLE_NBMAX_COLOR)
-	  yymsg(GERROR, "Too many (%d>%d) colors in View[%d].ColorTable", 
+	  yymsg(0, "Too many (%d>%d) colors in View[%d].ColorTable", 
 		ct->size, COLORTABLE_NBMAX_COLOR, 0);
 	else
 	  for(int i = 0; i < ct->size; i++) List_Read($5, i, &ct->table[i]);
@@ -981,11 +980,11 @@ Affectation :
     {
       GmshColorTable *ct = Get_ColorTable((int)$3);
       if(!ct)
-	yymsg(GERROR, "View[%d] does not exist", (int)$3);
+	yymsg(0, "View[%d] does not exist", (int)$3);
       else{
 	ct->size = List_Nbr($8);
 	if(ct->size > COLORTABLE_NBMAX_COLOR)
-	  yymsg(GERROR, "Too many (%d>%d) colors in View[%d].ColorTable", 
+	  yymsg(0, "Too many (%d>%d) colors in View[%d].ColorTable", 
 		   ct->size, COLORTABLE_NBMAX_COLOR, (int)$3);
 	else
 	  for(int i = 0; i < ct->size; i++) List_Read($8, i, &ct->table[i]);
@@ -1006,13 +1005,13 @@ Affectation :
 	GModel::current()->getFields()->background_field = (int)$4;
       }
       else{
-	yymsg(GERROR, "Unknown command %s Field", $1);
+	yymsg(0, "Unknown command %s Field", $1);
       }
     }
   | tField '[' FExpr ']' tAFFECT tSTRING tEND
     {
       if(!GModel::current()->getFields()->new_field((int)$3, $6))
-	yymsg(GERROR, "Cannot create field %i of type '%s'", (int)$3, $6);
+	yymsg(0, "Cannot create field %i of type '%s'", (int)$3, $6);
     }
   | tField '[' FExpr ']' '.' tSTRING  tAFFECT FExpr tEND
     {
@@ -1022,16 +1021,16 @@ Affectation :
 	if(option){
 	  try { option->numerical_value($8); }
 	  catch(...){
-	    yymsg(GERROR, "Cannot assign a numerical value to option '%s' "
+	    yymsg(0, "Cannot assign a numerical value to option '%s' "
 		  "in field %i of type '%s'", $6, (int)$3, field->get_name());
 	  }
 	}
 	else
-	  yymsg(GERROR, "Unknown option '%s' in field %i of type '%s'",
+	  yymsg(0, "Unknown option '%s' in field %i of type '%s'",
 		$6, (int)$3, field->get_name());
       }
       else
-	yymsg(GERROR, "No field with id %i", (int)$3);
+	yymsg(0, "No field with id %i", (int)$3);
     }
   | tField '[' FExpr ']' '.' tSTRING  tAFFECT StringExpr tEND
     {
@@ -1041,16 +1040,16 @@ Affectation :
 	if(option){
 	  try { option->string() = $8; }
 	  catch (...){
-	    yymsg(GERROR, "Cannot assign a string value to  option '%s' "
+	    yymsg(0, "Cannot assign a string value to  option '%s' "
 		  "in field %i of type '%s'", $6, (int)$3, field->get_name());
 	  }
 	}
 	else 
-	  yymsg(GERROR, "Unknown option '%s' in field %i of type '%s'", 
+	  yymsg(0, "Unknown option '%s' in field %i of type '%s'", 
 		$6, (int)$3, field->get_name());
       }
       else 
-	yymsg(GERROR, "No field with id %i", (int)$3);
+	yymsg(0, "No field with id %i", (int)$3);
     }
   | tField '[' FExpr ']' '.' tSTRING  tAFFECT '{' RecursiveListOfDouble '}' tEND
     {
@@ -1067,11 +1066,11 @@ Affectation :
 	  }
 	}
 	else
-	  yymsg(GERROR, "Unknown option '%s' in field %i of type '%s'",
+	  yymsg(0, "Unknown option '%s' in field %i of type '%s'",
 		$6, (int)$3, field->get_name());
       }
       else 
-	yymsg(GERROR, "No field with id %i", (int)$3);
+	yymsg(0, "No field with id %i", (int)$3);
     }
 
   // Plugins
@@ -1083,7 +1082,7 @@ Affectation :
 	GMSH_PluginManager::instance()->setPluginOption($3, $6, $8); 
       }
       catch (...) {
-	yymsg(GERROR, "Unknown option '%s' or plugin '%s'", $6, $3);
+	yymsg(0, "Unknown option '%s' or plugin '%s'", $6, $3);
       }
 #endif
       Free($3); Free($6);
@@ -1095,7 +1094,7 @@ Affectation :
 	GMSH_PluginManager::instance()->setPluginOption($3, $6, $8); 
       }
       catch (...) {
-	yymsg(GERROR, "Unknown option '%s' or plugin '%s'", $6, $3);
+	yymsg(0, "Unknown option '%s' or plugin '%s'", $6, $3);
       }
 #endif
       Free($3); Free($6); // FIXME: sometimes leak $8
@@ -1127,7 +1126,7 @@ RuledSurfaceOptions :
       $$ = List_Create(4, 4, sizeof(double));
       Vertex *v = FindPoint((int)$4);
       if(!v)
-	yymsg(GERROR, "Unknown point %d", (int)$4);
+	yymsg(0, "Unknown point %d", (int)$4);
       else{
 	List_Add($$, &v->Pos.X);
 	List_Add($$, &v->Pos.Y);
@@ -1144,7 +1143,7 @@ Shape :
     {
       int num = (int)$3;
       if(FindPoint(num)){
-	yymsg(GERROR, "Point %d already exists", num);
+	yymsg(0, "Point %d already exists", num);
       }
       else{
 	double x = CTX.geom.scaling_factor * $6[0];
@@ -1166,7 +1165,7 @@ Shape :
     {
       int num = (int)$4;
       if(FindPhysicalGroup(num, MSH_PHYSICAL_POINT)){
-	yymsg(GERROR, "Physical point %d already exists", num);
+	yymsg(0, "Physical point %d already exists", num);
       }
       else{
 	List_T *temp = ListOfDouble2ListOfInt($7);
@@ -1204,7 +1203,7 @@ Shape :
     {
       int num = (int)$3;
       if(FindCurve(num)){
-	yymsg(GERROR, "Curve %d already exists", num);
+	yymsg(0, "Curve %d already exists", num);
       }
       else{
 	List_T *temp = ListOfDouble2ListOfInt($6);
@@ -1222,7 +1221,7 @@ Shape :
     {
       int num = (int)$3;
       if(FindCurve(num)){
-	yymsg(GERROR, "Curve %d already exists", num);
+	yymsg(0, "Curve %d already exists", num);
       }
       else{
 	List_T *temp = ListOfDouble2ListOfInt($6);
@@ -1240,7 +1239,7 @@ Shape :
     {
       int num = (int)$3;
       if(FindCurve(num)){
-	yymsg(GERROR, "Curve %d already exists", num);
+	yymsg(0, "Curve %d already exists", num);
       }
       else{
 	List_T *temp = ListOfDouble2ListOfInt($6);
@@ -1258,7 +1257,7 @@ Shape :
     {
       int num = (int)$3;
       if(FindCurve(num)){
-	yymsg(GERROR, "Curve %d already exists", num);
+	yymsg(0, "Curve %d already exists", num);
       }
       else{
 	List_T *temp = ListOfDouble2ListOfInt($6);
@@ -1284,7 +1283,7 @@ Shape :
     {
       int num = (int)$3;
       if(FindCurve(num)){
-	yymsg(GERROR, "Curve %d already exists", num);
+	yymsg(0, "Curve %d already exists", num);
       }
       else{
 	List_T *temp = ListOfDouble2ListOfInt($6);
@@ -1302,7 +1301,7 @@ Shape :
     {
       int num = (int)$3;
       if(FindCurve(num)){
-	yymsg(GERROR, "Curve %d already exists", num);
+	yymsg(0, "Curve %d already exists", num);
       }
       else{
 	List_T *temp = ListOfDouble2ListOfInt($6);
@@ -1329,7 +1328,7 @@ Shape :
     {
       int num = (int)$3;
       if(FindCurve(num)){
-	yymsg(GERROR, "Curve %d already exists", num);
+	yymsg(0, "Curve %d already exists", num);
       }
       else{
 	Curve *c = Create_Curve(num, MSH_SEGM_PARAMETRIC, 2, NULL, NULL,
@@ -1348,7 +1347,7 @@ Shape :
     {
       int num = (int)$3;
       if(FindCurve(num)){
-	yymsg(GERROR, "Curve %d already exists", num);
+	yymsg(0, "Curve %d already exists", num);
       }
       else{
 	List_T *temp = ListOfDouble2ListOfInt($6);
@@ -1366,7 +1365,7 @@ Shape :
     {
       int num = (int)$3;
       if(FindCurve(num)){
-	yymsg(GERROR, "Curve %d already exists", num);
+	yymsg(0, "Curve %d already exists", num);
       }
       else{
 	List_T *temp = ListOfDouble2ListOfInt($6);
@@ -1384,13 +1383,13 @@ Shape :
     {
       int num = (int)$3;
       if(List_Nbr($6) + (int)$10 + 1 != List_Nbr($8)){
-	yymsg(GERROR, "Wrong definition of Nurbs Curve %d: "
+	yymsg(0, "Wrong definition of Nurbs Curve %d: "
 	      "got %d knots, need N + D + 1 = %d + %d + 1 = %d",
 	      (int)$3, List_Nbr($8), List_Nbr($6), (int)$10, List_Nbr($6) + (int)$10 + 1);
       }
       else{
 	if(FindCurve(num)){
-	  yymsg(GERROR, "Curve %d already exists", num);
+	  yymsg(0, "Curve %d already exists", num);
 	}
 	else{
 	  List_T *temp = ListOfDouble2ListOfInt($6);
@@ -1410,7 +1409,7 @@ Shape :
     {
       int num = (int)$4;
       if(FindEdgeLoop(num)){
-	yymsg(GERROR, "Line loop %d already exists", num);
+	yymsg(0, "Line loop %d already exists", num);
       }
       else{
 	List_T *temp = ListOfDouble2ListOfInt($7);
@@ -1427,7 +1426,7 @@ Shape :
     {
       int num = (int)$4;
       if(FindPhysicalGroup(num, MSH_PHYSICAL_LINE)){
-	yymsg(GERROR, "Physical line %d already exists", num);
+	yymsg(0, "Physical line %d already exists", num);
       }
       else{
 	List_T *temp = ListOfDouble2ListOfInt($7);
@@ -1446,7 +1445,7 @@ Shape :
     {
       int num = (int)$4;
       if(FindSurface(num)){
-	yymsg(GERROR, "Surface %d already exists", num);
+	yymsg(0, "Surface %d already exists", num);
       }
       else{
 	Surface *s = Create_Surface(num, MSH_SURF_PLAN);
@@ -1464,14 +1463,14 @@ Shape :
     {
       int num = (int)$4, type = 0;
       if(FindSurface(num)){
-	yymsg(GERROR, "Surface %d already exists", num);
+	yymsg(0, "Surface %d already exists", num);
       }
       else{
 	double d;
 	List_Read($7, 0, &d);
 	EdgeLoop *el = FindEdgeLoop((int)fabs(d));
 	if(!el){
-	  yymsg(GERROR, "Unknown line loop %d", (int)d);
+	  yymsg(0, "Unknown line loop %d", (int)d);
 	}
 	else{
 	  int j = List_Nbr(el->Curves);
@@ -1482,7 +1481,7 @@ Shape :
 	    type = MSH_SURF_TRIC;
 	  }
 	  else{
-	    yymsg(GERROR, "Wrong definition of Ruled Surface %d: "
+	    yymsg(0, "Wrong definition of Ruled Surface %d: "
 		  "%d borders instead of 3 or 4", num, j);
 	    type = MSH_SURF_PLAN;
 	  }
@@ -1522,7 +1521,7 @@ Shape :
     {
       int num = (int)$3;
       if (List_Nbr($6) != 2){
-	yymsg(GERROR, "Sphere %d has to be defined using 2 points (center + "
+	yymsg(0, "Sphere %d has to be defined using 2 points (center + "
 	      "any point) and not %d", num, List_Nbr($6));
       }
       else{
@@ -1531,8 +1530,8 @@ Shape :
 	List_Read($6, 1, &p2);
 	Vertex *v1 = FindPoint((int)p1);
 	Vertex *v2 = FindPoint((int)p2);
-	if(!v1) yymsg(GERROR, "Sphere %d : unknown point %d", num, (int)p1);
-	if(!v2) yymsg(GERROR, "Sphere %d : unknown point %d", num, (int)p2);
+	if(!v1) yymsg(0, "Sphere %d : unknown point %d", num, (int)p1);
+	if(!v2) yymsg(0, "Sphere %d : unknown point %d", num, (int)p2);
 	if(v1 && v2)
 	  myGmshSurface = gmshSphere::NewSphere
 	    (num, v1->Pos.X, v1->Pos.Y, v1->Pos.Z,
@@ -1547,7 +1546,7 @@ Shape :
     {
       int num = (int)$3;
       if (List_Nbr($6) != 2){
-	yymsg(GERROR, "PolarSphere %d has to be defined using 2 points (center + "
+	yymsg(0, "PolarSphere %d has to be defined using 2 points (center + "
 	      "any point) and not %d", num, List_Nbr($6));
       }
       else{
@@ -1556,8 +1555,8 @@ Shape :
 	List_Read($6, 1, &p2);
 	Vertex *v1 = FindPoint((int)p1);
 	Vertex *v2 = FindPoint((int)p2);
-	if(!v1) yymsg(GERROR, "PolarSphere %d : unknown point %d", num, (int)p1);
-	if(!v2) yymsg(GERROR, "PolarSphere %d : unknown point %d", num, (int)p2);
+	if(!v1) yymsg(0, "PolarSphere %d : unknown point %d", num, (int)p1);
+	if(!v2) yymsg(0, "PolarSphere %d : unknown point %d", num, (int)p2);
 	if(v1 && v2)
 	  myGmshSurface = gmshPolarSphere::NewPolarSphere
 	    (num, v1->Pos.X, v1->Pos.Y, v1->Pos.Z,
@@ -1572,7 +1571,7 @@ Shape :
     {
       int num = (int)$4;
       if(FindSurfaceLoop(num)){
-	yymsg(GERROR, "Surface loop %d already exists", num);
+	yymsg(0, "Surface loop %d already exists", num);
       }
       else{
 	List_T *temp = ListOfDouble2ListOfInt($7);
@@ -1588,7 +1587,7 @@ Shape :
     {
       int num = (int)$4;
       if(FindPhysicalGroup(num, MSH_PHYSICAL_SURFACE)){
-	yymsg(GERROR, "Physical surface %d already exists", num);
+	yymsg(0, "Physical surface %d already exists", num);
       }
       else{
 	List_T *temp = ListOfDouble2ListOfInt($7);
@@ -1606,10 +1605,10 @@ Shape :
   // for backward compatibility:
   | tComplex tVolume '(' FExpr ')' tAFFECT ListOfDouble tEND
     {
-      yymsg(GERROR, "'Complex Volume' command is deprecated: use 'Volume' instead");
+      yymsg(0, "'Complex Volume' command is deprecated: use 'Volume' instead");
       int num = (int)$4;
       if(FindVolume(num)){
-	yymsg(GERROR, "Volume %d already exists", num);
+	yymsg(0, "Volume %d already exists", num);
       }
       else{
 	Volume *v = Create_Volume(num, MSH_VOLUME);
@@ -1626,7 +1625,7 @@ Shape :
     {
       int num = (int)$3;
       if(FindVolume(num)){
-	yymsg(GERROR, "Volume %d already exists", num);
+	yymsg(0, "Volume %d already exists", num);
       }
       else{
 	Volume *v = Create_Volume(num, MSH_VOLUME);
@@ -1643,7 +1642,7 @@ Shape :
     {
       int num = (int)$4;
       if(FindPhysicalGroup(num, MSH_PHYSICAL_VOLUME)){
-	yymsg(GERROR, "Physical volume %d already exists", num);
+	yymsg(0, "Physical volume %d already exists", num);
       }
       else{
 	List_T *temp = ListOfDouble2ListOfInt($7);
@@ -1738,7 +1737,7 @@ ListOfShapes :
 	    List_Add($$, &TheShape);
 	  }
 	  else
-	    yymsg(WARNING, "Unknown point %d", TheShape.Num);
+	    yymsg(1, "Unknown point %d", TheShape.Num);
 	}
       }
     }
@@ -1761,7 +1760,7 @@ ListOfShapes :
 	    List_Add($$, &TheShape);
 	  }
 	  else
-	    yymsg(WARNING, "Unknown curve %d", TheShape.Num);
+	    yymsg(1, "Unknown curve %d", TheShape.Num);
 	}
       }
     }
@@ -1784,7 +1783,7 @@ ListOfShapes :
 	    List_Add($$, &TheShape);
 	  }
 	  else
-	    yymsg(WARNING, "Unknown surface %d", TheShape.Num);
+	    yymsg(1, "Unknown surface %d", TheShape.Num);
 	}
       }
     }
@@ -1807,7 +1806,7 @@ ListOfShapes :
 	    List_Add($$, &TheShape);
 	  }
 	  else
-	    yymsg(WARNING, "Unknown volume %d", TheShape.Num);
+	    yymsg(1, "Unknown volume %d", TheShape.Num);
 	}
       }
     }
@@ -1837,10 +1836,10 @@ Delete :
 	if(index >= 0 && index < (int)PView::list.size())
 	  delete PView::list[index];
 	else
-	  yymsg(GERROR, "Unknown view %d", index);
+	  yymsg(0, "Unknown view %d", index);
       }
       else
-	yymsg(GERROR, "Unknown command 'Delete %s'", $2);
+	yymsg(0, "Unknown command 'Delete %s'", $2);
 #endif
       Free($2);
     }
@@ -1857,7 +1856,7 @@ Delete :
 	GModel::current()->deletePhysicalGroups();
       }
       else
-	yymsg(GERROR, "Unknown command 'Delete %s'", $2);
+	yymsg(0, "Unknown command 'Delete %s'", $2);
       Free($2);
     }
   | tDelete tSTRING tSTRING tEND
@@ -1868,7 +1867,7 @@ Delete :
 	  if(PView::list[i]->getData()->empty()) delete PView::list[i];
       }
       else
-	yymsg(GERROR, "Unknown command 'Delete %s %s'", $2, $3);
+	yymsg(0, "Unknown command 'Delete %s %s'", $2, $3);
 #endif
       Free($2); Free($3);
     }
@@ -1938,10 +1937,10 @@ Command :
 	// open simultaneously. The right solution would be of course
 	// to modify FunctionManager to reopen the files instead of
 	// using the FILE pointer, but hey, I'm lazy...
-	Msg(STATUS2, "Reading '%s'", tmpstring);
+	Msg::Status(2, true, "Reading '%s'", tmpstring);
 	ParseFile(tmpstring, 0, 1);
 	SetBoundingBox();
-	Msg(STATUS2, "Read '%s'", tmpstring);
+	Msg::Status(2, true, "Read '%s'", tmpstring);
       }
       else if(!strcmp($1, "Print")){
 #if defined(HAVE_FLTK)
@@ -1971,7 +1970,7 @@ Command :
       else if(!strcmp($1, "System"))
 	SystemCall($2);
       else
-	yymsg(GERROR, "Unknown command '%s'", $1);
+	yymsg(0, "Unknown command '%s'", $1);
       Free($1); Free($2);
     } 
   | tSTRING tSTRING '[' FExpr ']' StringExprVar tEND
@@ -1985,10 +1984,10 @@ Command :
 	  PView::list[index]->write(tmpstring, CTX.post.file_format);
 	}
 	else
-	  yymsg(GERROR, "Unknown view %d", index);
+	  yymsg(0, "Unknown view %d", index);
       }
       else
-	yymsg(GERROR, "Unknown command '%s'", $1);
+	yymsg(0, "Unknown command '%s'", $1);
 #endif
       Free($1); Free($2); Free($6);
     }
@@ -2000,10 +1999,10 @@ Command :
 	if(index >= 0 && index < (int)PView::list.size())
 	  GModel::current()->getFields()->set_background_mesh(index);
 	else
-	  yymsg(GERROR, "Unknown view %d", index);
+	  yymsg(0, "Unknown view %d", index);
       }
       else
-	yymsg(GERROR, "Unknown command '%s'", $1);
+	yymsg(0, "Unknown command '%s'", $1);
 #endif
       Free($1); Free($2); Free($3);
     }
@@ -2013,7 +2012,7 @@ Command :
 	SleepInSeconds($2);
       }
       else if(!strcmp($1, "Remesh")){
-	Msg(GERROR, "Surface ReMeshing must be reinterfaced");
+	Msg::Error("Surface ReMeshing must be reinterfaced");
       }
       else if(!strcmp($1, "Mesh")){
 	int lock = CTX.threads_lock;
@@ -2023,10 +2022,10 @@ Command :
 	CTX.threads_lock = lock;
       }
       else if(!strcmp($1, "Status")){
-	yymsg(GERROR, "Mesh directives are not (yet) allowed in scripts");
+	yymsg(0, "Mesh directives are not (yet) allowed in scripts");
       }
       else
-	yymsg(GERROR, "Unknown command '%s'", $1);
+	yymsg(0, "Unknown command '%s'", $1);
       Free($1);
     }
    | tPlugin '(' tSTRING ')' '.' tSTRING tEND
@@ -2036,7 +2035,7 @@ Command :
 	 GMSH_PluginManager::instance()->action($3, $6, 0);
        }
        catch(...) {
-	 yymsg(GERROR, "Unknown action '%s' or plugin '%s'", $6, $3);
+	 yymsg(0, "Unknown action '%s' or plugin '%s'", $6, $3);
        }
 #endif
        Free($3); Free($6);
@@ -2061,7 +2060,7 @@ Command :
       else if(!strcmp($2, "TimeSteps"))
 	PView::combine(true, 2, CTX.post.combine_remove_orig);
       else
-	yymsg(GERROR, "Unknown 'Combine' command");
+	yymsg(0, "Unknown 'Combine' command");
 #endif
       Free($2);
     } 
@@ -2104,7 +2103,7 @@ Loop :
       else
 	ImbricatedLoop++;
       if(ImbricatedLoop > MAX_RECUR_LOOPS-1){
-	yymsg(GERROR, "Reached maximum number of imbricated loops");
+	yymsg(0, "Reached maximum number of imbricated loops");
 	ImbricatedLoop = MAX_RECUR_LOOPS-1;
       }
     }
@@ -2121,7 +2120,7 @@ Loop :
       else
 	ImbricatedLoop++;
       if(ImbricatedLoop > MAX_RECUR_LOOPS-1){
-	yymsg(GERROR, "Reached maximum number of imbricated loops");
+	yymsg(0, "Reached maximum number of imbricated loops");
 	ImbricatedLoop = MAX_RECUR_LOOPS-1;
       }
     }
@@ -2148,7 +2147,7 @@ Loop :
       else
 	ImbricatedLoop++;
       if(ImbricatedLoop > MAX_RECUR_LOOPS-1){
-	yymsg(GERROR, "Reached maximum number of imbricated loops");
+	yymsg(0, "Reached maximum number of imbricated loops");
 	ImbricatedLoop = MAX_RECUR_LOOPS-1;
       }
     }
@@ -2175,14 +2174,14 @@ Loop :
       else
 	ImbricatedLoop++;
       if(ImbricatedLoop > MAX_RECUR_LOOPS-1){
-	yymsg(GERROR, "Reached maximum number of imbricated loops");
+	yymsg(0, "Reached maximum number of imbricated loops");
 	ImbricatedLoop = MAX_RECUR_LOOPS-1;
       }
     }
   | tEndFor 
     {
       if(ImbricatedLoop <= 0){
-	yymsg(GERROR, "Invalid For/EndFor loop");
+	yymsg(0, "Invalid For/EndFor loop");
 	ImbricatedLoop = 0;
       }
       else{
@@ -2198,7 +2197,7 @@ Loop :
 	    TheSymbol.Name = LoopControlVariablesNameTab[ImbricatedLoop-1];
 	    Symbol *pSymbol;
 	    if(!(pSymbol = (Symbol*)Tree_PQuery(Symbol_T, &TheSymbol)))
-	      yymsg(GERROR, "Unknown loop variable");
+	      yymsg(0, "Unknown loop variable");
 	    else
 	      *(double*)List_Pointer_Fast(pSymbol->val, 0) += 
 		LoopControlVariablesTab[ImbricatedLoop-1][2];
@@ -2214,7 +2213,7 @@ Loop :
     {
       if(!FunctionManager::Instance()->createFunction($2, gmsh_yyin, gmsh_yyname,
 						      gmsh_yylineno))
-	yymsg(GERROR, "Redefinition of function %s", $2);
+	yymsg(0, "Redefinition of function %s", $2);
       skip_until(NULL, "Return");
       //FIXME: wee leak $2
     }
@@ -2222,13 +2221,13 @@ Loop :
     {
       if(!FunctionManager::Instance()->leaveFunction(&gmsh_yyin, gmsh_yyname,
 						     gmsh_yylineno))
-	yymsg(GERROR, "Error while exiting function");
+	yymsg(0, "Error while exiting function");
     } 
   | tCall tSTRING tEND
     {
       if(!FunctionManager::Instance()->enterFunction($2, &gmsh_yyin, gmsh_yyname,
 						     gmsh_yylineno))
-	yymsg(GERROR, "Unknown function %s", $2);
+	yymsg(0, "Unknown function %s", $2);
       //FIXME: wee leak $2
     } 
   | tIf '(' FExpr ')'
@@ -2531,13 +2530,13 @@ ExtrudeParameter :
 	}
       }
       else
-	yymsg(GERROR, "Wrong layer definition {%d, %d}", List_Nbr($3), List_Nbr($5));
+	yymsg(0, "Wrong layer definition {%d, %d}", List_Nbr($3), List_Nbr($5));
       List_Delete($3);
       List_Delete($5);
     }
   | tLayers '{' ListOfDouble ',' ListOfDouble ',' ListOfDouble '}' tEND
     {
-      yymsg(GERROR, "Explicit region numbers in layers are deprecated");
+      yymsg(0, "Explicit region numbers in layers are deprecated");
       double d;
       extr.mesh.ExtrudeMesh = true;
       extr.mesh.NbLayer = List_Nbr($3);
@@ -2552,7 +2551,7 @@ ExtrudeParameter :
 	}
       }
       else
-	yymsg(GERROR, "Wrong layer definition {%d, %d, %d}", List_Nbr($3), 
+	yymsg(0, "Wrong layer definition {%d, %d, %d}", List_Nbr($3), 
 	      List_Nbr($5), List_Nbr($7));
       List_Delete($3);
       List_Delete($5);
@@ -2566,7 +2565,7 @@ ExtrudeParameter :
     {
       int num = (int)$3;
       if(FindSurface(num)){
-	yymsg(GERROR, "Surface %d already exists", num);
+	yymsg(0, "Surface %d already exists", num);
       }
       else{
 	Surface *s = Create_Surface(num, MSH_SURF_DISCRETE);
@@ -2594,7 +2593,7 @@ Transfinite :
 	int j = (int)fabs(d);
         Curve *c = FindCurve(j);
 	if(!c)
-	  yymsg(WARNING, "Unknown curve %d", j);
+	  yymsg(1, "Unknown curve %d", j);
 	else{
 	  c->Method = TRANSFINI;
 	  c->nbPointsTransfinite = ($5 > 2) ? (int)$5 : 2;
@@ -2612,7 +2611,7 @@ Transfinite :
 	int j = (int)fabs(d);
         Curve *c = FindCurve(j);
 	if(!c)
-	  yymsg(WARNING, "Unknown curve %d", j);
+	  yymsg(1, "Unknown curve %d", j);
 	else{
 	  c->Method = TRANSFINI;
 	  c->nbPointsTransfinite = ($5 > 2) ? (int)$5 : 2;
@@ -2630,7 +2629,7 @@ Transfinite :
 	int j = (int)fabs(d);
         Curve *c = FindCurve(j);
 	if(!c)
-	  yymsg(WARNING, "Unknown curve %d", j);
+	  yymsg(1, "Unknown curve %d", j);
 	else{
 	  c->Method = TRANSFINI;
 	  c->nbPointsTransfinite = ($5 > 2) ? (int)$5 : 2;
@@ -2644,13 +2643,13 @@ Transfinite :
     {
       Surface *s = FindSurface((int)$4);
       if(!s)
-	yymsg(WARNING, "Unknown surface %d", (int)$4);
+	yymsg(1, "Unknown surface %d", (int)$4);
       else{
 	s->Method = TRANSFINI;
 	s->Recombine_Dir = -1;
 	int k = List_Nbr($7);
 	if(k != 3 && k != 4){
-	  yymsg(GERROR, "Wrong definition of Transfinite Surface %d: "
+	  yymsg(0, "Wrong definition of Transfinite Surface %d: "
 		"%d points instead of 3 or 4" , (int)$4, k);
 	}
 	else{
@@ -2661,7 +2660,7 @@ Transfinite :
 	    int j = (int)fabs(d);
 	    Vertex *v = FindPoint(j);
 	    if(!v)
-	      yymsg(WARNING, "Unknown point %d", j);
+	      yymsg(1, "Unknown point %d", j);
 	    else
 	      List_Add(s->TrsfPoints, &v);
 	  }
@@ -2673,12 +2672,12 @@ Transfinite :
     {
       Surface *s = FindSurface((int)$4);
       if(!s)
-	yymsg(WARNING, "Unknown surface %d", (int)$4);
+	yymsg(1, "Unknown surface %d", (int)$4);
       else{
 	s->Method = TRANSFINI;
 	int k = List_Nbr($7);
 	if(k != 3 && k != 4){
-	  yymsg(GERROR, "Wrong definition of Transfinite Surface %d: "
+	  yymsg(0, "Wrong definition of Transfinite Surface %d: "
 		"%d points instead of 3 or 4" , (int)$4, k);
 	}
 	else{
@@ -2695,7 +2694,7 @@ Transfinite :
 	    int j = (int)fabs(d);
 	    Vertex *v = FindPoint(j);
 	    if(!v)
-	      yymsg(WARNING, "Unknown point %d", j);
+	      yymsg(1, "Unknown point %d", j);
 	    else
 	      List_Add(s->TrsfPoints, &v);
 	  }
@@ -2706,19 +2705,19 @@ Transfinite :
     }
   | tElliptic tSurface '{' FExpr '}' tAFFECT ListOfDouble tEND
     {
-      yymsg(WARNING, "Elliptic Surface is deprecated: use Transfinite instead (with smoothing)");
+      yymsg(1, "Elliptic Surface is deprecated: use Transfinite instead (with smoothing)");
       List_Delete($7);
     }
   | tTransfinite tVolume '{' FExpr '}' tAFFECT ListOfDouble tEND
     {
       Volume *v = FindVolume((int)$4);
       if(!v)
-	yymsg(WARNING, "Unknown volume %d", (int)$4);
+	yymsg(1, "Unknown volume %d", (int)$4);
       else{
 	v->Method = TRANSFINI;
 	int k = List_Nbr($7);
 	if(k != 6 && k != 8)
-	  yymsg(GERROR, "Wrong definition of Transfinite Volume %d: "
+	  yymsg(0, "Wrong definition of Transfinite Volume %d: "
 		"%d points instead of 6 or 8" , (int)$4, k);
 	else{
 	  List_Reset(v->TrsfPoints);
@@ -2728,7 +2727,7 @@ Transfinite :
 	    int j = (int)fabs(d);
 	    Vertex *vert = FindPoint(j);
 	    if(!vert)
-	      yymsg(WARNING, "Unknown point %d", j);
+	      yymsg(1, "Unknown point %d", j);
 	    else
 	      List_Add(v->TrsfPoints, &vert);
 	  }
@@ -2825,7 +2824,7 @@ FExpr :
   | FExpr '/' FExpr
     { 
       if(!$3)
-	yymsg(GERROR, "Division by zero in '%g / %g'", $1, $3);
+	yymsg(0, "Division by zero in '%g / %g'", $1, $3);
       else
 	$$ = $1 / $3;     
     }
@@ -2893,8 +2892,8 @@ FExpr_Single :
 
     tDOUBLE   { $$ = $1; }
   | tPi       { $$ = 3.141592653589793; }
-  | tMPI_Rank { $$ = ParUtil::Instance()->rank(); }
-  | tMPI_Size { $$ = ParUtil::Instance()->size(); }
+  | tMPI_Rank { $$ = Msg::GetCommRank(); }
+  | tMPI_Size { $$ = Msg::GetCommSize(); }
   | tGMSH_MAJOR_VERSION { $$ = Get_GmshMajorVersion(); }
   | tGMSH_MINOR_VERSION { $$ = Get_GmshMinorVersion(); }
   | tGMSH_PATCH_VERSION { $$ = Get_GmshPatchVersion(); }
@@ -2907,7 +2906,7 @@ FExpr_Single :
       TheSymbol.Name = $1;
       Symbol *pSymbol;
       if(!(pSymbol = (Symbol*)Tree_PQuery(Symbol_T, &TheSymbol))) {
-	yymsg(GERROR, "Unknown variable '%s'", $1);
+	yymsg(0, "Unknown variable '%s'", $1);
 	$$ = 0.;
       }
       else
@@ -2925,7 +2924,7 @@ FExpr_Single :
       TheSymbol.Name = tmpstring;
       Symbol *pSymbol;
       if(!(pSymbol = (Symbol*)Tree_PQuery(Symbol_T, &TheSymbol))) {
-	yymsg(GERROR, "Unknown variable '%s'", tmpstring);
+	yymsg(0, "Unknown variable '%s'", tmpstring);
 	$$ = 0.;
       }
       else
@@ -2938,7 +2937,7 @@ FExpr_Single :
       TheSymbol.Name = $1;
       Symbol *pSymbol;
       if(!(pSymbol = (Symbol*)Tree_PQuery(Symbol_T, &TheSymbol))) {
-	yymsg(GERROR, "Unknown variable '%s'", $1);
+	yymsg(0, "Unknown variable '%s'", $1);
 	$$ = 0.;
       }
       else{
@@ -2946,7 +2945,7 @@ FExpr_Single :
 	if((pd = (double*)List_Pointer_Test(pSymbol->val, (int)$3)))
 	  $$ = *pd;
 	else{
-	  yymsg(GERROR, "Uninitialized variable '%s[%d]'", $1, (int)$3);
+	  yymsg(0, "Uninitialized variable '%s[%d]'", $1, (int)$3);
 	  $$ = 0.;
 	}
       }
@@ -2958,7 +2957,7 @@ FExpr_Single :
       TheSymbol.Name = $2;
       Symbol *pSymbol;
       if(!(pSymbol = (Symbol*)Tree_PQuery(Symbol_T, &TheSymbol))) {
-	yymsg(GERROR, "Unknown variable '%s'", $2);
+	yymsg(0, "Unknown variable '%s'", $2);
 	$$ = 0.;
       }
       else
@@ -2971,7 +2970,7 @@ FExpr_Single :
       TheSymbol.Name = $1;
       Symbol *pSymbol;
       if(!(pSymbol = (Symbol*)Tree_PQuery(Symbol_T, &TheSymbol))) {
-	yymsg(GERROR, "Unknown variable '%s'", $1);
+	yymsg(0, "Unknown variable '%s'", $1);
 	$$ = 0.;
       }
       else
@@ -2984,7 +2983,7 @@ FExpr_Single :
       TheSymbol.Name = $1;
       Symbol *pSymbol;
       if(!(pSymbol = (Symbol*)Tree_PQuery(Symbol_T, &TheSymbol))) {
-	yymsg(GERROR, "Unknown variable '%s'", $1);
+	yymsg(0, "Unknown variable '%s'", $1);
 	$$ = 0.;
       }
       else{
@@ -2992,7 +2991,7 @@ FExpr_Single :
 	if((pd = (double*)List_Pointer_Test(pSymbol->val, (int)$3)))
 	  $$ = (*pd += $5);
 	else{
-	  yymsg(GERROR, "Uninitialized variable '%s[%d]'", $1, (int)$3);
+	  yymsg(0, "Uninitialized variable '%s[%d]'", $1, (int)$3);
 	  $$ = 0.;
 	}
       }
@@ -3006,12 +3005,12 @@ FExpr_Single :
       double (*pNumOpt)(int num, int action, double value);
       StringXNumber *pNumCat;
       if(!(pNumCat = Get_NumberOptionCategory($1))){
-	yymsg(GERROR, "Unknown numeric option class '%s'", $1);
+	yymsg(0, "Unknown numeric option class '%s'", $1);
 	$$ = 0.;
       }
       else{
 	if(!(pNumOpt =  (double (*) (int, int, double))Get_NumberOption($3, pNumCat))){
-	  yymsg(GERROR, "Unknown numeric option '%s.%s'", $1, $3);
+	  yymsg(0, "Unknown numeric option '%s.%s'", $1, $3);
 	  $$ = 0.;
 	}
 	else
@@ -3024,12 +3023,12 @@ FExpr_Single :
       double (*pNumOpt)(int num, int action, double value);
       StringXNumber *pNumCat;
       if(!(pNumCat = Get_NumberOptionCategory($1))){
-	yymsg(GERROR, "Unknown numeric option class '%s'", $1);
+	yymsg(0, "Unknown numeric option class '%s'", $1);
 	$$ = 0.;
       }
       else{
 	if(!(pNumOpt =  (double (*) (int, int, double))Get_NumberOption($6, pNumCat))){
-	  yymsg(GERROR, "Unknown numeric option '%s[%d].%s'", $1, (int)$3, $6);
+	  yymsg(0, "Unknown numeric option '%s[%d].%s'", $1, (int)$3, $6);
 	  $$ = 0.;
 	}
 	else
@@ -3042,12 +3041,12 @@ FExpr_Single :
       double (*pNumOpt)(int num, int action, double value);
       StringXNumber *pNumCat;
       if(!(pNumCat = Get_NumberOptionCategory($1))){
-	yymsg(GERROR, "Unknown numeric option class '%s'", $1);
+	yymsg(0, "Unknown numeric option class '%s'", $1);
 	$$ = 0.;
       }
       else{
 	if(!(pNumOpt =  (double (*) (int, int, double))Get_NumberOption($3, pNumCat))){
-	  yymsg(GERROR, "Unknown numeric option '%s.%s'", $1, $3);
+	  yymsg(0, "Unknown numeric option '%s.%s'", $1, $3);
 	  $$ = 0.;
 	}
 	else
@@ -3060,12 +3059,12 @@ FExpr_Single :
       double (*pNumOpt)(int num, int action, double value);
       StringXNumber *pNumCat;
       if(!(pNumCat = Get_NumberOptionCategory($1))){
-	yymsg(GERROR, "Unknown numeric option class '%s'", $1);
+	yymsg(0, "Unknown numeric option class '%s'", $1);
 	$$ = 0.;
       }
       else{
 	if(!(pNumOpt =  (double (*) (int, int, double))Get_NumberOption($6, pNumCat))){
-	  yymsg(GERROR, "Unknown numeric option '%s[%d].%s'", $1, (int)$3, $6);
+	  yymsg(0, "Unknown numeric option '%s[%d].%s'", $1, (int)$3, $6);
 	  $$ = 0.;
 	}
 	else
@@ -3075,7 +3074,7 @@ FExpr_Single :
     }
   | tGetValue '(' tBIGSTR ',' FExpr ')'
     { 
-      $$ = GetValue($3, $5);
+      $$ = Msg::GetValue($3, $5);
       Free($3);
     }
 ;
@@ -3199,7 +3198,7 @@ FExpr_Multi :
     {
       $$ = List_Create(2, 1, sizeof(double)); 
       if(!$5 || ($1 < $3 && $5 < 0) || ($1 > $3 && $5 > 0)){
-        yymsg(GERROR, "Wrong increment in '%g:%g:%g'", $1, $3, $5);
+        yymsg(0, "Wrong increment in '%g:%g:%g'", $1, $3, $5);
 	List_Add($$, &($1));
       }
       else
@@ -3214,7 +3213,7 @@ FExpr_Multi :
       Vertex *v = FindPoint((int)$3);
       $$ = List_Create(3, 1, sizeof(double));      
       if(!v) {
-	yymsg(GERROR, "Unknown point '%d'", (int)$3);
+	yymsg(0, "Unknown point '%d'", (int)$3);
 	double d = 0.0;
 	List_Add($$, &d);
 	List_Add($$, &d);
@@ -3253,7 +3252,7 @@ FExpr_Multi :
       TheSymbol.Name = $1;
       Symbol *pSymbol;
       if(!(pSymbol = (Symbol*)Tree_PQuery(Symbol_T, &TheSymbol))) {
-	yymsg(GERROR, "Unknown variable '%s'", $1);
+	yymsg(0, "Unknown variable '%s'", $1);
 	double d = 0.0;
 	List_Add($$, &d);
       }
@@ -3270,7 +3269,7 @@ FExpr_Multi :
       TheSymbol.Name = $1;
       Symbol *pSymbol;
       if(!(pSymbol = (Symbol*)Tree_PQuery(Symbol_T, &TheSymbol))) {
-	yymsg(GERROR, "Unknown variable '%s'", $1);
+	yymsg(0, "Unknown variable '%s'", $1);
 	double d = 0.0;
 	List_Add($$, &d);
       }
@@ -3281,7 +3280,7 @@ FExpr_Multi :
 	  if((pd = (double*)List_Pointer_Test(pSymbol->val, j)))
 	    List_Add($$, pd);
 	  else
-	    yymsg(GERROR, "Uninitialized variable '%s[%d]'", $1, j);	  
+	    yymsg(0, "Uninitialized variable '%s[%d]'", $1, j);	  
 	}
       }
       Free($1);
@@ -3329,14 +3328,14 @@ ColorExpr :
     {
       int flag;
       $$ = Get_ColorForString(ColorString, (int)$4, $2, &flag);
-      if(flag) yymsg(GERROR, "Unknown color '%s'", $2);
+      if(flag) yymsg(0, "Unknown color '%s'", $2);
     }
 */
   | tSTRING
     {
       int flag;
       $$ = Get_ColorForString(ColorString, -1, $1, &flag);
-      if(flag) yymsg(GERROR, "Unknown color '%s'", $1);
+      if(flag) yymsg(0, "Unknown color '%s'", $1);
       Free($1);
     }
   | tSTRING '.' tColor '.' tSTRING 
@@ -3344,12 +3343,12 @@ ColorExpr :
       unsigned int (*pColOpt)(int num, int action, unsigned int value);
       StringXColor *pColCat;
       if(!(pColCat = Get_ColorOptionCategory($1))){
-	yymsg(GERROR, "Unknown color option class '%s'", $1);
+	yymsg(0, "Unknown color option class '%s'", $1);
 	$$ = 0;
       }
       else{
 	if(!(pColOpt =  (unsigned int (*) (int, int, unsigned int))Get_ColorOption($5, pColCat))){
-	  yymsg(GERROR, "Unknown color option '%s.Color.%s'", $1, $5);
+	  yymsg(0, "Unknown color option '%s.Color.%s'", $1, $5);
 	  $$ = 0;
 	}
 	else
@@ -3369,7 +3368,7 @@ ListOfColor :
       $$ = List_Create(256, 10, sizeof(unsigned int));
       GmshColorTable *ct = Get_ColorTable((int)$3);
       if(!ct)
-	yymsg(GERROR, "View[%d] does not exist", (int)$3);
+	yymsg(0, "View[%d] does not exist", (int)$3);
       else{
 	for(int i = 0; i < ct->size; i++) 
 	  List_Add($$, &ct->table[i]);
@@ -3397,7 +3396,7 @@ StringExprVar :
     }
   | tSTRING
     {
-      Msg(WARNING, "Named string expressions not implemented yet");
+      Msg::Warning("Named string expressions not implemented yet");
     }
 ;
 
@@ -3459,11 +3458,11 @@ StringExpr :
       char tmpstring[1024];
       int i = PrintListOfDouble($3, $5, tmpstring);
       if(i < 0){
-	yymsg(GERROR, "Too few arguments in Sprintf");
+	yymsg(0, "Too few arguments in Sprintf");
 	$$ = $3;
       }
       else if(i > 0){
-	yymsg(GERROR, "%d extra argument%s in Sprintf", i, (i>1)?"s":"");
+	yymsg(0, "%d extra argument%s in Sprintf", i, (i>1)?"s":"");
 	$$ = $3;
       }
       else{
@@ -3478,14 +3477,14 @@ StringExpr :
       const char* (*pStrOpt)(int num, int action, const char *value);
       StringXString *pStrCat;
       if(!(pStrCat = Get_StringOptionCategory($3))){
-	yymsg(GERROR, "Unknown string option class '%s'", $3);
+	yymsg(0, "Unknown string option class '%s'", $3);
 	$$ = (char*)Malloc(sizeof(char));
 	$$[0] = '\0';
       }
       else{
 	if(!(pStrOpt = (const char *(*) (int, int, const char *))
 	     Get_StringOption($5, pStrCat))){
-	  yymsg(GERROR, "Unknown string option '%s.%s'", $3, $5);
+	  yymsg(0, "Unknown string option '%s.%s'", $3, $5);
 	  $$ = (char*)Malloc(sizeof(char));
 	  $$[0] = '\0';
 	}
@@ -3501,14 +3500,14 @@ StringExpr :
       const char* (*pStrOpt)(int num, int action, const char *value);
       StringXString *pStrCat;
       if(!(pStrCat = Get_StringOptionCategory($3))){
-	yymsg(GERROR, "Unknown string option class '%s'", $3);
+	yymsg(0, "Unknown string option class '%s'", $3);
 	$$ = (char*)Malloc(sizeof(char));
 	$$[0] = '\0';
       }
       else{
 	if(!(pStrOpt = (const char *(*) (int, int, const char *))
 	     Get_StringOption($8, pStrCat))){
-	  yymsg(GERROR, "Unknown string option '%s[%d].%s'", $3, (int)$5, $8);
+	  yymsg(0, "Unknown string option '%s[%d].%s'", $3, (int)$5, $8);
 	  $$ = (char*)Malloc(sizeof(char));
 	  $$[0] = '\0';
 	}
@@ -3581,20 +3580,23 @@ int PrintListOfDouble(char *format, List_T *list, char *buffer)
 
 void yyerror(char *s)
 {
-  Msg(GERROR, "'%s', line %d : %s (%s)", gmsh_yyname, gmsh_yylineno - 1, s, gmsh_yytext);
+  Msg::Error("'%s', line %d : %s (%s)", gmsh_yyname, gmsh_yylineno - 1, s, gmsh_yytext);
   gmsh_yyerrorstate++;
 }
 
-void yymsg(int type, const char *fmt, ...)
+void yymsg(int level, const char *fmt, ...)
 {
   va_list args;
   char tmp[1024];
 
-  va_start (args, fmt);
-  vsprintf (tmp, fmt, args);
-  va_end (args);
+  va_start(args, fmt);
+  vsprintf(tmp, fmt, args);
+  va_end(args);
 
-  Msg(type, "'%s', line %d : %s", gmsh_yyname, gmsh_yylineno - 1, tmp);
-
-  if(type == GERROR) gmsh_yyerrorstate++;
+  if(level == 0){
+    Msg::Error("'%s', line %d : %s", gmsh_yyname, gmsh_yylineno - 1, tmp);
+    gmsh_yyerrorstate++;
+  }
+  else
+    Msg::Warning("'%s', line %d : %s", gmsh_yyname, gmsh_yylineno - 1, tmp);
 }
diff --git a/Parser/Gmsh.yy.cpp b/Parser/Gmsh.yy.cpp
index 3331891e7b30d3048f4a80c3991754eb072bd03a..c53d20db2fcfb017be8805b2310c7bbb3c8af134 100644
--- a/Parser/Gmsh.yy.cpp
+++ b/Parser/Gmsh.yy.cpp
@@ -835,7 +835,7 @@ int gmsh_yy_flex_debug = 0;
 char *gmsh_yytext;
 #line 1 "Gmsh.l"
 #line 2 "Gmsh.l"
-// $Id: Gmsh.yy.cpp,v 1.362 2008-05-01 06:54:09 geuzaine Exp $
+// $Id: Gmsh.yy.cpp,v 1.363 2008-05-04 08:31:21 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -886,7 +886,7 @@ void   skipline(void);
 	 gmsh_yylineno++;							\
        }								\
        if ( c == EOF && ferror( gmsh_yyin ) )				\
-	 Msg(FATAL, "Input in flex scanner failed");			\
+	 Msg::Fatal("Input in flex scanner failed");			\
        result = n;							\
      }									\
 
@@ -2852,7 +2852,7 @@ void skipcomments(void)
   while (1) {
     while ((c = yyinput()) != '*'){
       if(feof(gmsh_yyin)){
-        Msg(GERROR, "End of file in commented region");
+	Msg::Error("End of file in commented region");
         return;
       }
     }
@@ -2872,11 +2872,11 @@ void parsestring(char endchar)
   int i = 0;
   while ((c = yyinput()) != endchar) {
     if(feof(gmsh_yyin)){
-      Msg(GERROR, "End of file in string");
+      Msg::Error("End of file in string");
       break;
     }
     else if(i >= (int)sizeof(tmp)-1){
-      Msg(GERROR, "String too long");
+      Msg::Error("String too long");
       break;
     }
     else{
@@ -2919,7 +2919,7 @@ void skip_until(const char *skip, const char *until)
     while (1){
       chars[0] = yyinput();
       if(feof(gmsh_yyin)){
-        Msg(GERROR, "Unexpected end of file");
+	Msg::Error("Unexpected end of file");
 	return;
       }
       if(chars[0] == until[0]) break;
@@ -2928,7 +2928,7 @@ void skip_until(const char *skip, const char *until)
 
     l = MAX(l_skip,l_until);
     if(l >= (int)sizeof(chars)){
-      Msg(GERROR, "Search pattern too long in skip_until");
+      Msg::Error("Search pattern too long in skip_until");
       return;
     }
     for(i=1; i<l; i++){
diff --git a/Parser/Makefile b/Parser/Makefile
index 7860678607231781866d95888567824ef9569e7f..21f64c32d1de02c728f05e82074b0cfd7d94d031 100644
--- a/Parser/Makefile
+++ b/Parser/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.152 2008-04-28 10:11:00 geuzaine Exp $
+# $Id: Makefile,v 1.153 2008-05-04 08:31:23 geuzaine Exp $
 #
 # Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 #
@@ -25,7 +25,7 @@ LIB = ../lib/libGmshParser${LIBEXT}
 
 INC = ${DASH}I../Common ${DASH}I../DataStr ${DASH}I../Geo ${DASH}I../Mesh\
       ${DASH}I../Post ${DASH}I../Graphics ${DASH}I../Numeric ${DASH}I../Fltk\
-      ${DASH}I../Plugin ${DASH}I../Parallel ${DASH}I../contrib/ANN/include 
+      ${DASH}I../Plugin ${DASH}I../contrib/ANN/include 
 
 CFLAGS = ${OPTIM} ${FLAGS} ${INC} ${SYSINCLUDE}
 
@@ -73,24 +73,22 @@ depend:
 # DO NOT DELETE THIS LINE
 Gmsh.tab.o: Gmsh.tab.cpp ../Common/Message.h ../DataStr/Malloc.h \
   ../DataStr/Tools.h ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h \
-  ../Parallel/ParUtil.h ../Numeric/Numeric.h ../Numeric/NumericEmbedded.h \
-  ../Common/Context.h ../Geo/GModel.h ../Geo/GVertex.h ../Geo/GEntity.h \
-  ../Geo/Range.h ../Geo/SPoint3.h ../Geo/SBoundingBox3d.h \
-  ../Geo/SPoint3.h ../Geo/GPoint.h ../Geo/SPoint2.h ../Geo/GEdge.h \
-  ../Geo/GEntity.h ../Geo/GVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h \
-  ../Geo/SPoint3.h ../Geo/SPoint2.h ../Geo/GFace.h ../Geo/GEntity.h \
-  ../Geo/GPoint.h ../Geo/GEdgeLoop.h ../Geo/GEdge.h ../Geo/SPoint2.h \
-  ../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h ../Geo/GEntity.h \
-  ../Geo/SBoundingBox3d.h ../Geo/Geo.h ../Common/GmshDefines.h \
-  ../Geo/gmshSurface.h ../Geo/Pair.h ../Geo/Range.h ../Geo/SPoint2.h \
-  ../Geo/SPoint3.h ../Geo/SVector3.h ../Geo/SBoundingBox3d.h \
-  ../Geo/SPoint2.h ../Geo/ExtrudeParams.h ../Common/SmoothData.h \
-  ../Geo/GeoInterpolation.h ../Geo/Geo.h ../Mesh/Generator.h \
-  ../Graphics/Draw.h ../Common/Options.h ../Post/ColorTable.h \
-  ../Common/Colors.h ../Common/Options.h Parser.h OpenFile.h \
-  ../Common/CommandLine.h FunctionManager.h ../Common/OS.h CreateFile.h \
-  ../Mesh/Field.h ../Post/PView.h ../Post/PViewData.h \
-  ../Post/PViewOptions.h ../Post/ColorTable.h ../Mesh/BackgroundMesh.h \
+  ../Numeric/Numeric.h ../Numeric/NumericEmbedded.h ../Common/Context.h \
+  ../Geo/GModel.h ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h \
+  ../Geo/SPoint3.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \
+  ../Geo/GPoint.h ../Geo/SPoint2.h ../Geo/GEdge.h ../Geo/GEntity.h \
+  ../Geo/GVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/SPoint3.h \
+  ../Geo/SPoint2.h ../Geo/GFace.h ../Geo/GEntity.h ../Geo/GPoint.h \
+  ../Geo/GEdgeLoop.h ../Geo/GEdge.h ../Geo/SPoint2.h ../Geo/SVector3.h \
+  ../Geo/Pair.h ../Geo/GRegion.h ../Geo/GEntity.h ../Geo/SBoundingBox3d.h \
+  ../Geo/Geo.h ../Common/GmshDefines.h ../Geo/gmshSurface.h ../Geo/Pair.h \
+  ../Geo/Range.h ../Geo/SPoint2.h ../Geo/SPoint3.h ../Geo/SVector3.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint2.h ../Geo/ExtrudeParams.h \
+  ../Common/SmoothData.h ../Geo/GeoInterpolation.h ../Geo/Geo.h \
+  ../Mesh/Generator.h ../Graphics/Draw.h ../Common/Options.h \
+  ../Post/ColorTable.h ../Common/Colors.h ../Common/Options.h Parser.h \
+  OpenFile.h ../Common/CommandLine.h FunctionManager.h ../Common/OS.h \
+  CreateFile.h ../Mesh/Field.h ../Post/PView.h ../Mesh/BackgroundMesh.h \
   ../Post/PViewDataList.h ../Post/PViewData.h ../Plugin/PluginManager.h \
   ../Plugin/Plugin.h ../Common/GmshMatrix.h
 Gmsh.yy.o: Gmsh.yy.cpp ../Common/Message.h ../Numeric/Numeric.h \
@@ -115,11 +113,10 @@ OpenFile.o: OpenFile.cpp ../Common/Message.h ../Geo/Geo.h \
   ../Geo/Pair.h ../Geo/GRegion.h ../Geo/GEntity.h ../Geo/SBoundingBox3d.h \
   ../Common/Context.h Parser.h OpenFile.h ../Common/CommandLine.h \
   ../Graphics/ReadImg.h ../Common/OS.h ../Mesh/HighOrder.h \
-  ../Post/PView.h ../Post/PViewData.h ../Post/PViewOptions.h \
-  ../Post/ColorTable.h ../Common/GmshUI.h ../Graphics/Draw.h \
-  ../Graphics/SelectBuffer.h ../Fltk/GUI.h ../Fltk/Opengl_Window.h \
-  ../Fltk/Colorbar_Window.h ../Fltk/Popup_Button.h \
-  ../Fltk/SpherePosition_Widget.h ../Mesh/Field.h
+  ../Post/PView.h ../Post/PViewData.h ../Common/GmshUI.h \
+  ../Graphics/Draw.h ../Graphics/SelectBuffer.h ../Fltk/GUI.h \
+  ../Fltk/Opengl_Window.h ../Fltk/Colorbar_Window.h ../Post/ColorTable.h \
+  ../Fltk/Popup_Button.h ../Fltk/SpherePosition_Widget.h ../Mesh/Field.h
 CreateFile.o: CreateFile.cpp ../Common/Message.h ../Geo/GModel.h \
   ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
   ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Geo/GPoint.h \
diff --git a/Parser/OpenFile.cpp b/Parser/OpenFile.cpp
index 8463f4b9d463da49975435b887eabd71bb766a6a..feed1b65ead0e810cd2d73c8cf8f8146a7dd20d2 100644
--- a/Parser/OpenFile.cpp
+++ b/Parser/OpenFile.cpp
@@ -1,4 +1,4 @@
-// $Id: OpenFile.cpp,v 1.186 2008-04-28 10:11:00 geuzaine Exp $
+// $Id: OpenFile.cpp,v 1.187 2008-05-04 08:31:23 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -38,6 +38,7 @@
 
 #if !defined(HAVE_NO_POST)
 #include "PView.h"
+#include "PViewData.h"
 #endif
 
 #if defined(HAVE_FLTK)
@@ -208,7 +209,7 @@ int ParseFile(const char *f, int close, int warn_if_missing)
   // add 'b' for pure Windows programs: opening in text mode messes up
   // fsetpos/fgetpos (used e.g. for user-defined functions)
   if(!(fp = fopen(f, "rb"))){
-    if(warn_if_missing) Msg(WARNING, "Unable to open file '%s'", f);
+    if(warn_if_missing) Msg::Warning("Unable to open file '%s'", f);
     return 0;
   }
 
@@ -236,7 +237,7 @@ int ParseFile(const char *f, int close, int warn_if_missing)
   while(!feof(gmsh_yyin)){
     gmsh_yyparse();
     if(gmsh_yyerrorstate > 20){
-      Msg(GERROR, "Too many errors: aborting...");
+      Msg::Error("Too many errors: aborting...");
       force_yyflush();
       break;
     }
@@ -294,7 +295,7 @@ int MergeFile(const char *name, int warn_if_missing)
   // contain binary data
   FILE *fp = fopen(name, "rb");
   if(!fp){
-    if(warn_if_missing) Msg(WARNING, "Unable to open file '%s'", name);
+    if(warn_if_missing) Msg::Warning("Unable to open file '%s'", name);
     return 0;
   }
 
@@ -302,7 +303,7 @@ int MergeFile(const char *name, int warn_if_missing)
   fgets(header, sizeof(header), fp);
   fclose(fp);
 
-  Msg(STATUS2, "Reading '%s'", name);
+  Msg::Status(2, true, "Reading '%s'", name);
 
   char no_ext[256], ext[256], base[256];
   SplitFileName(name, no_ext, ext, base);
@@ -317,7 +318,7 @@ int MergeFile(const char *name, int warn_if_missing)
         char tmp[256];
         sprintf(tmp, "gunzip -c %s > %s", name, no_ext);
         if(SystemCall(tmp))
-          Msg(GERROR, "Failed to uncompress `%s': check directory permissions", name);
+          Msg::Error("Failed to uncompress `%s': check directory permissions", name);
         if(!strcmp(CTX.filename, name)) // this is the project file
           SetProjectName(no_ext);
         return MergeFile(no_ext);
@@ -439,14 +440,14 @@ int MergeFile(const char *name, int warn_if_missing)
     WID->update_views();
 #endif
 
-  Msg(STATUS2, "Read '%s'", name);
+  Msg::Status(2, true, "Read '%s'", name);
   return status;
 }
 
 void OpenProject(const char *name)
 {
   if(CTX.threads_lock) {
-    Msg(INFO, "I'm busy! Ask me that later...");
+    Msg::Info("I'm busy! Ask me that later...");
     return;
   }
   CTX.threads_lock = 1;
@@ -494,4 +495,3 @@ void OpenProjectMacFinder(const char *filename)
 #endif
   }
 }
-
diff --git a/Plugin/Curl.cpp b/Plugin/Curl.cpp
index 795fb6fe848be9b33dbf4942c8b03866065fd5d6..7aa7f7a77f69d97c0a8b9c0a97fb051b0029da48 100644
--- a/Plugin/Curl.cpp
+++ b/Plugin/Curl.cpp
@@ -1,4 +1,4 @@
-// $Id: Curl.cpp,v 1.9 2008-04-05 17:49:23 geuzaine Exp $
+// $Id: Curl.cpp,v 1.10 2008-05-04 08:31:23 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -91,7 +91,7 @@ PView *GMSH_CurlPlugin::execute(PView *v)
 
   PViewData *data1 = v1->getData();
   if(data1->hasMultipleMeshes()){
-    Msg(GERROR, "Curl plugin cannot be run on multi-mesh views");
+    Msg::Error("Curl plugin cannot be run on multi-mesh views");
     return v;
   }
 
diff --git a/Plugin/CutParametric.cpp b/Plugin/CutParametric.cpp
index ca4b429e90843cb7097fefc83cada7a01190caf1..6cf29927ac97fa4b0bad933b94598c08ab34240b 100644
--- a/Plugin/CutParametric.cpp
+++ b/Plugin/CutParametric.cpp
@@ -1,4 +1,4 @@
-// $Id: CutParametric.cpp,v 1.28 2008-04-05 17:49:23 geuzaine Exp $
+// $Id: CutParametric.cpp,v 1.29 2008-05-04 08:31:23 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -77,7 +77,7 @@ std::vector<double> GMSH_CutParametricPlugin::z;
 int GMSH_CutParametricPlugin::fillXYZ()
 {
 #if !defined(HAVE_MATH_EVAL)
-  Msg(GERROR, "MathEval is not compiled in this version of Gmsh");
+  Msg::Error("MathEval is not compiled in this version of Gmsh");
   return 0;
 #else
   const char *exprx = CutParametricOptions_String[0].def;
@@ -90,18 +90,18 @@ int GMSH_CutParametricPlugin::fillXYZ()
   z.resize(nbU);
   void *fx = evaluator_create((char*)exprx);
   if(!fx){
-    Msg(GERROR, "Invalid expression '%s'", exprx);
+    Msg::Error("Invalid expression '%s'", exprx);
     return 0;
   }
   void *fy = evaluator_create((char*)expry);
   if(!fy){
     evaluator_destroy(fx);
-    Msg(GERROR, "Invalid expression '%s'", expry);
+    Msg::Error("Invalid expression '%s'", expry);
     return 0;
   }
   void *fz = evaluator_create((char*)exprz);
   if(!fz){
-    Msg(GERROR, "Invalid expression '%s'", exprz);
+    Msg::Error("Invalid expression '%s'", exprz);
     evaluator_destroy(fx);
     evaluator_destroy(fy);
     return 0;
diff --git a/Plugin/Divergence.cpp b/Plugin/Divergence.cpp
index 8dc1c56dcef93361061bda8c155896e986721540..fe357b1ca7cfe49f4d7e6c4a14900640143fd0d9 100644
--- a/Plugin/Divergence.cpp
+++ b/Plugin/Divergence.cpp
@@ -1,4 +1,4 @@
-// $Id: Divergence.cpp,v 1.9 2008-04-05 17:49:23 geuzaine Exp $
+// $Id: Divergence.cpp,v 1.10 2008-05-04 08:31:23 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -91,7 +91,7 @@ PView *GMSH_DivergencePlugin::execute(PView *v)
 
   PViewData *data1 = v1->getData();
   if(data1->hasMultipleMeshes()){
-    Msg(GERROR, "Divergence plugin cannot be run on multi-mesh views");
+    Msg::Error("Divergence plugin cannot be run on multi-mesh views");
     return v;
   }
 
diff --git a/Plugin/Eigenvalues.cpp b/Plugin/Eigenvalues.cpp
index b3529ae35f5e462aedb7c44b9e01552a9f87049c..32431f5ebae763381226ba695af32d3bae951304 100644
--- a/Plugin/Eigenvalues.cpp
+++ b/Plugin/Eigenvalues.cpp
@@ -1,4 +1,4 @@
-// $Id: Eigenvalues.cpp,v 1.9 2008-04-06 07:51:37 geuzaine Exp $
+// $Id: Eigenvalues.cpp,v 1.10 2008-05-04 08:31:23 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -90,7 +90,7 @@ PView *GMSH_EigenvaluesPlugin::execute(PView *v)
 
   PViewData *data1 = v1->getData();
   if(data1->hasMultipleMeshes()){
-    Msg(GERROR, "Eigenvalues plugin cannot be run on multi-mesh views");
+    Msg::Error("Eigenvalues plugin cannot be run on multi-mesh views");
     return v;
   }
 
diff --git a/Plugin/Eigenvectors.cpp b/Plugin/Eigenvectors.cpp
index 389a544abbe67410bc732d497f9b1de0814b8782..cdb348d7d64a7f58d4a474c592b1d1a7f5a4608a 100644
--- a/Plugin/Eigenvectors.cpp
+++ b/Plugin/Eigenvectors.cpp
@@ -1,4 +1,4 @@
-// $Id: Eigenvectors.cpp,v 1.12 2008-04-06 07:51:37 geuzaine Exp $
+// $Id: Eigenvectors.cpp,v 1.13 2008-05-04 08:31:23 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -106,7 +106,7 @@ PView *GMSH_EigenvectorsPlugin::execute(PView *v)
 
   PViewData *data1 = v1->getData();
   if(data1->hasMultipleMeshes()){
-    Msg(GERROR, "Eigenvectors plugin cannot be run on multi-mesh views");
+    Msg::Error("Eigenvectors plugin cannot be run on multi-mesh views");
     return v;
   }
 
@@ -148,7 +148,7 @@ PView *GMSH_EigenvectorsPlugin::execute(PView *v)
 	    data1->getValue(step, ent, ele, nod, comp, val[comp]);
 	  double wr[3], wi[3], B[9];
 	  if(!EigSolve3x3(val, wr, wi, B))
-	    Msg(GERROR, "Eigensolver failed to converge");
+	    Msg::Error("Eigensolver failed to converge");
 	  nbcomplex += nonzero(wi); 
 	  if(!scale) wr[0] = wr[1] = wr[2] = 1.;
 	  for(int i = 0; i < 3; i++){
@@ -165,7 +165,7 @@ PView *GMSH_EigenvectorsPlugin::execute(PView *v)
   }
 
   if(nbcomplex)
-    Msg(GERROR, "%d tensors have complex eigenvalues/eigenvectors", 
+    Msg::Error("%d tensors have complex eigenvalues/eigenvectors", 
 	nbcomplex);
   
   for(int i = 0; i < data1->getNumTimeSteps(); i++){
diff --git a/Plugin/Evaluate.cpp b/Plugin/Evaluate.cpp
index f6891baa3788e355d971c3e48e41f6ec9f280890..7fe0f2d35fb8887d76cf21c878b708b5d5cbf79d 100644
--- a/Plugin/Evaluate.cpp
+++ b/Plugin/Evaluate.cpp
@@ -1,4 +1,4 @@
-// $Id: Evaluate.cpp,v 1.37 2008-04-05 17:49:23 geuzaine Exp $
+// $Id: Evaluate.cpp,v 1.38 2008-05-04 08:31:23 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -136,7 +136,7 @@ void GMSH_EvaluatePlugin::evaluate(PView *v1, List_T *list1, int nbElm1,
 {
 #if !defined(HAVE_MATH_EVAL)
 
-  Msg(GERROR, "MathEval is not compiled in this version of Gmsh");
+  Msg::Error("MathEval is not compiled in this version of Gmsh");
 
 #else
 
@@ -146,12 +146,12 @@ void GMSH_EvaluatePlugin::evaluate(PView *v1, List_T *list1, int nbElm1,
   void *f = evaluator_create((char*)expression);
 
   if(!f){
-    Msg(GERROR, "Invalid expression '%s'", expression);
+    Msg::Error("Invalid expression '%s'", expression);
     return;
   }
 
   if((nbElm1 != nbElm2) && !_octree){
-    Msg(INFO, "External view based on different grid: interpolating...");
+    Msg::Info("External view based on different grid: interpolating...");
     _octree = new OctreePost(v2);
   }
 
@@ -226,7 +226,7 @@ PView *GMSH_EvaluatePlugin::execute(PView *v)
   if(!data1) return v;
 
   if(timeStep > data1->getNumTimeSteps() - 1){
-    Msg(GERROR, "Invalid time step (%d) in View[%d]: using step 0 instead",
+    Msg::Error("Invalid time step (%d) in View[%d]: using step 0 instead",
         timeStep, v1->getIndex());
     timeStep = 0;
   }
@@ -237,18 +237,18 @@ PView *GMSH_EvaluatePlugin::execute(PView *v)
     if(externalView < (int)PView::list.size())
       v2 = PView::list[externalView];
     else
-      Msg(GERROR, "View[%d] does not exist: using self", externalView);
+      Msg::Error("View[%d] does not exist: using self", externalView);
   }
 
   PViewDataList *data2 = getDataList(v2);
   if(!data2) return v;
 
   if(externalTimeStep < 0 && data2->getNumTimeSteps() != data1->getNumTimeSteps()){
-    Msg(GERROR, "Number of time steps don't match: using step 0");
+    Msg::Error("Number of time steps don't match: using step 0");
     externalTimeStep = 0;
   }
   else if(externalTimeStep > data2->getNumTimeSteps() - 1){
-    Msg(GERROR, "Invalid time step (%d) in View[%d]: using step 0 instead",
+    Msg::Error("Invalid time step (%d) in View[%d]: using step 0 instead",
         externalTimeStep, v2->getIndex());
     externalTimeStep = 0;
   }
diff --git a/Plugin/Extract.cpp b/Plugin/Extract.cpp
index 012f21c43766229abe24358a97ac096d1874224f..f595d2c1d6396782ec9ec18f6734c356f2a04540 100644
--- a/Plugin/Extract.cpp
+++ b/Plugin/Extract.cpp
@@ -1,4 +1,4 @@
-// $Id: Extract.cpp,v 1.28 2008-04-05 17:49:23 geuzaine Exp $
+// $Id: Extract.cpp,v 1.29 2008-05-04 08:31:23 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -153,7 +153,7 @@ static void extract(const char *expr[9], List_T *inList, int inNb,
   for(int i = 0; i < outNbComp; i++){
     f[i] = evaluator_create((char*)expr[i]);
     if(!f[i]){
-      Msg(GERROR, "Invalid expression '%s'", expr[i]);
+      Msg::Error("Invalid expression '%s'", expr[i]);
       for(int j = 0; j < i; j++)
         if(f[j]) evaluator_destroy(f[j]);
       return;
@@ -172,7 +172,7 @@ static void extract(const char *expr[9], List_T *inList, int inNb,
     else if(!strcmp(expr[i], "v7")) comp[i] = 7;
     else if(!strcmp(expr[i], "v8")) comp[i] = 8;
     else{
-      Msg(GERROR, "Invalid expression '%s'", expr[i]);
+      Msg::Error("Invalid expression '%s'", expr[i]);
       return;
     }
   }
@@ -246,7 +246,7 @@ PView *GMSH_ExtractPlugin::execute(PView *v)
     step = - data1->getNumTimeSteps();
   }
   else if(step > data1->getNumTimeSteps() - 1){
-    Msg(GERROR, "Invalid time step (%d) in View[%d]: using all steps instead",
+    Msg::Error("Invalid time step (%d) in View[%d]: using all steps instead",
         step, v1->getIndex());
     step = - data1->getNumTimeSteps();
   }
diff --git a/Plugin/ExtractEdges.cpp b/Plugin/ExtractEdges.cpp
index 306ddee0f1027d0e7ab307800cb0cb98d094b6a8..109a3540a84e4abe4aaa6040af62028157b98dfe 100644
--- a/Plugin/ExtractEdges.cpp
+++ b/Plugin/ExtractEdges.cpp
@@ -1,4 +1,4 @@
-// $Id: ExtractEdges.cpp,v 1.9 2008-03-20 11:44:13 geuzaine Exp $
+// $Id: ExtractEdges.cpp,v 1.10 2008-05-04 08:31:23 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -93,7 +93,7 @@ PView *GMSH_ExtractEdgesPlugin::execute(PView *v)
   //bds.import_view(v1, CTX.lc * 1.e-12);
   //bds.classify(angle * M_PI / 180.);
 
-  Msg(GERROR, "BDS->classify(angle, edge_prolongation) must be reinterfaced");
+  Msg::Error("BDS->classify(angle, edge_prolongation) must be reinterfaced");
 
   std::list<BDS_Edge*>::iterator it  = bds.edges.begin();
   std::list<BDS_Edge*>::iterator ite = bds.edges.end();
diff --git a/Plugin/ExtractElements.cpp b/Plugin/ExtractElements.cpp
index c8832ef5af473fb515d5bf61a543eadf2c21105e..908cb97446cd2872bf0c03f33cc297f7064e4cf0 100644
--- a/Plugin/ExtractElements.cpp
+++ b/Plugin/ExtractElements.cpp
@@ -1,4 +1,4 @@
-// $Id: ExtractElements.cpp,v 1.13 2008-04-05 17:49:23 geuzaine Exp $
+// $Id: ExtractElements.cpp,v 1.14 2008-05-04 08:31:23 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -128,7 +128,7 @@ PView *GMSH_ExtractElementsPlugin::execute(PView *v)
   if(!data2) return v;
 
   if(step < 0 || step > data1->getNumTimeSteps() - 1){
-    Msg(GERROR, "Invalid time step (%d) in View[%d]: using first step instead",
+    Msg::Error("Invalid time step (%d) in View[%d]: using first step instead",
         step, v1->getIndex());
     step = 0;
   }
diff --git a/Plugin/FieldView.cpp b/Plugin/FieldView.cpp
index 73e37c35ea8fd65ac67f3a9e5c83b242b341b769..37b8e9105cd57b92118285d389491f12d6b15c47 100644
--- a/Plugin/FieldView.cpp
+++ b/Plugin/FieldView.cpp
@@ -1,4 +1,4 @@
-// $Id: FieldView.cpp,v 1.8 2008-03-20 11:44:13 geuzaine Exp $
+// $Id: FieldView.cpp,v 1.9 2008-05-04 08:31:23 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -73,7 +73,7 @@ PView *GMSH_FieldViewPlugin::execute(PView *v)
   int iField = (int)FieldViewOptions_Number[2].def;
   Field *field = GModel::current()->getFields()->get(iField);
   if(!field){
-    Msg(GERROR, "Field[%d] does not exist", iField);
+    Msg::Error("Field[%d] does not exist", iField);
     return v;
   }
   PView *v1 = getView(iView, v);
diff --git a/Plugin/GSHHS.cpp b/Plugin/GSHHS.cpp
index 6b30186709ad33c2e7984b2647efe7af1d03b917..d70042d48aee18c0addf6c4052fb65fd00f0132c 100644
--- a/Plugin/GSHHS.cpp
+++ b/Plugin/GSHHS.cpp
@@ -273,7 +273,7 @@ class GeoEarthImport
   }
 };
 
-/*      $Id: GSHHS.cpp,v 1.8 2008-04-15 08:29:33 remacle Exp $
+/*      $Id: GSHHS.cpp,v 1.9 2008-05-04 08:31:23 geuzaine Exp $
  *
  * PROGRAM:	gshhs.c
  * AUTHOR:	Paul Wessel (pwessel@hawaii.edu)
@@ -369,7 +369,7 @@ void import_gshhs(FILE * fp, GeoEarthImport & geo_import)
     for(k = 0; k < h.n; k++) {
       if(fread((void *)&p, (size_t) sizeof(struct POINT), (size_t) 1, fp) !=
          1) {
-        Msg(GERROR,
+        Msg::Error(
             "gshhs:  Error reading gshhs file for polygon %d, point %d.\n",
             h.id, k);
         return;
@@ -478,7 +478,7 @@ PView *GMSH_GSHHSPlugin::execute(PView * v)
   else if(coordinate_name == "utm")
     geo_import.set_coordinate_system(&utm);
   else if(coordinate_name != "cartesian"){
-    Msg(GERROR, "gshhs: Unknown coordinate system %s.\n",
+    Msg::Error("gshhs: Unknown coordinate system %s.\n",
       coordinate_name.c_str());
     return NULL;
   }
@@ -486,7 +486,7 @@ PView *GMSH_GSHHSPlugin::execute(PView * v)
   if (iField != -1) {
     field = GModel::current()->getFields()->get(iField);
     if(!field){
-      Msg(GERROR, "Field[%d] does not exist", iField);
+      Msg::Error("Field[%d] does not exist", iField);
       return NULL;
     }else{
       geo_import.set_size_field(field);
@@ -494,7 +494,7 @@ PView *GMSH_GSHHSPlugin::execute(PView * v)
   }
   FILE *fp;
   if ((fp = fopen (filename, "rb")) == NULL ) {
-    Msg(GERROR, "gshhs: Could not find file %s.\n", filename);
+    Msg::Error("gshhs: Could not find file %s.\n", filename);
     return NULL;
   }
   double x,y,z;
@@ -508,7 +508,7 @@ PView *GMSH_GSHHSPlugin::execute(PView * v)
     while(fscanf(fp, "%d %d", &npoints_in_loop,&closed) == 2) {
       for(int i = 0; i < npoints_in_loop; i++) {
         if(fscanf(fp, "%le %le", &x, &y) != 2) {
-          Msg(GERROR, "gshhs:  Error reading loops2 file \'%s\'.\n", filename);
+          Msg::Error("gshhs:  Error reading loops2 file \'%s\'.\n", filename);
           return NULL;
         }
         geo_import.add_point(SPoint3(x,y,0));
diff --git a/Plugin/Gradient.cpp b/Plugin/Gradient.cpp
index 2779dd3b7c0753e1bf5b1ee7a432d49f00ed5657..0014f5be5fc690dd7f87ca66895bcb87854fec13 100644
--- a/Plugin/Gradient.cpp
+++ b/Plugin/Gradient.cpp
@@ -1,4 +1,4 @@
-// $Id: Gradient.cpp,v 1.14 2008-04-05 17:49:23 geuzaine Exp $
+// $Id: Gradient.cpp,v 1.15 2008-05-04 08:31:23 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -91,7 +91,7 @@ PView *GMSH_GradientPlugin::execute(PView *v)
 
   PViewData *data1 = v1->getData();
   if(data1->hasMultipleMeshes()){
-    Msg(GERROR, "Gradient plugin cannot be run on multi-mesh views");
+    Msg::Error("Gradient plugin cannot be run on multi-mesh views");
     return v;
   }
 
diff --git a/Plugin/HarmonicToTime.cpp b/Plugin/HarmonicToTime.cpp
index c374451bfb21f818127d24cc6c18f2280c7d4f58..c6520b628fbcc5cb39255e1340a6f8e75495d6e5 100644
--- a/Plugin/HarmonicToTime.cpp
+++ b/Plugin/HarmonicToTime.cpp
@@ -1,4 +1,4 @@
-// $Id: HarmonicToTime.cpp,v 1.16 2008-03-20 11:44:14 geuzaine Exp $
+// $Id: HarmonicToTime.cpp,v 1.17 2008-05-04 08:31:23 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -122,12 +122,12 @@ PView *GMSH_HarmonicToTimePlugin::execute(PView * v)
 
   if(rIndex < 0 || rIndex >= data1->getNumTimeSteps() ||
      iIndex < 0 || iIndex >= data1->getNumTimeSteps()){
-    Msg(GERROR, "Wrong real or imaginary part index");
+    Msg::Error("Wrong real or imaginary part index");
     return v1;
   }
 
   if(nSteps <= 0){
-    Msg(GERROR, "nSteps should be > 0");
+    Msg::Error("nSteps should be > 0");
     return v1;
   }
 
diff --git a/Plugin/Integrate.cpp b/Plugin/Integrate.cpp
index 4bd71a2ac872dc94421061926dfa3cb1c3382dce..29105393960aee7b8a3ba7db1f0628bcff4e899c 100644
--- a/Plugin/Integrate.cpp
+++ b/Plugin/Integrate.cpp
@@ -1,4 +1,4 @@
-// $Id: Integrate.cpp,v 1.25 2008-04-05 09:21:37 geuzaine Exp $
+// $Id: Integrate.cpp,v 1.26 2008-05-04 08:31:23 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -21,6 +21,7 @@
 
 #include "Integrate.h"
 #include "ShapeFunctions.h"
+#include "PViewOptions.h"
 
 StringXNumber IntegrateOptions_Number[] = {
   {GMSH_FULLRC, "iView", NULL, -1.}
@@ -123,7 +124,7 @@ PView *GMSH_IntegratePlugin::execute(PView * v)
 	delete element;
       }
     }
-    Msg(INFO, "Step %d: integral = %.16g", step, res);
+    Msg::Info("Step %d: integral = %.16g", step, res);
     List_Add(data2->SP, &res);
   }
   data2->NbSP = 1;
diff --git a/Plugin/Lambda2.cpp b/Plugin/Lambda2.cpp
index 5042f0fce88af43438a7a37343c7c76d67cf5562..c4c9f8373633b79c5a4c355ce12a095bc7e5ef4d 100644
--- a/Plugin/Lambda2.cpp
+++ b/Plugin/Lambda2.cpp
@@ -1,4 +1,4 @@
-// $Id: Lambda2.cpp,v 1.14 2008-03-20 11:44:14 geuzaine Exp $
+// $Id: Lambda2.cpp,v 1.15 2008-05-04 08:31:23 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -189,7 +189,7 @@ static void eigen(List_T *inList, int inNb,
           GradPhi_ksi[3][0]=  0;  GradPhi_ksi[3][1]=  0; GradPhi_ksi[3][2]=  1; 
         }
         else{
-          Msg(GERROR, "Lambda2 not ready for this type of element");
+          Msg::Error("Lambda2 not ready for this type of element");
           return;
         }
         for(int k = 0; k < nbNod ; k++){
diff --git a/Plugin/Levelset.cpp b/Plugin/Levelset.cpp
index 3c87c4693fc3cca38e155ce5e4d086a112608724..23d97fdf25a56ee8d6c87649a7c9493e1eba2a93 100644
--- a/Plugin/Levelset.cpp
+++ b/Plugin/Levelset.cpp
@@ -1,4 +1,4 @@
-// $Id: Levelset.cpp,v 1.46 2008-04-22 07:37:16 geuzaine Exp $
+// $Id: Levelset.cpp,v 1.47 2008-05-04 08:31:23 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -419,7 +419,7 @@ PView *GMSH_LevelsetPlugin::execute(PView *v)
     wdata = vdata;
   }
   else if(_valueView > (int)PView::list.size() - 1){
-    Msg(GERROR, "View[%d] does not exist: reverting to View[%d]", 
+    Msg::Error("View[%d] does not exist: reverting to View[%d]", 
         _valueView, v->getIndex());
     wdata = vdata;
   }
@@ -430,11 +430,11 @@ PView *GMSH_LevelsetPlugin::execute(PView *v)
   // sanity checks
   if(vdata->getNumEntities() != wdata->getNumEntities() ||
      vdata->getNumElements() != wdata->getNumElements()){
-    Msg(GERROR, "Incompatible views");
+    Msg::Error("Incompatible views");
     return v;
   }
   if(_valueTimeStep >= wdata->getNumTimeSteps()) {
-    Msg(GERROR, "Wrong time step %d in view", _valueTimeStep);
+    Msg::Error("Wrong time step %d in view", _valueTimeStep);
     return v;
   }
 
diff --git a/Plugin/MakeSimplex.cpp b/Plugin/MakeSimplex.cpp
index e316a0dc3b57cdbdb791073b090c4a9500405553..82525b163ec74794607d9397588d7c06ecce15b0 100644
--- a/Plugin/MakeSimplex.cpp
+++ b/Plugin/MakeSimplex.cpp
@@ -1,4 +1,4 @@
-// $Id: MakeSimplex.cpp,v 1.8 2008-03-20 11:44:14 geuzaine Exp $
+// $Id: MakeSimplex.cpp,v 1.9 2008-05-04 08:31:23 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -202,7 +202,7 @@ void MakeSimplex::decompose(int num,
   int pyraTet[2][4] = {{0,1,3,4}, {1,2,3,4}};
 
   if(num < 0 || num > numSimplices()-1) {
-    Msg(GERROR, "Invalid decomposition");
+    Msg::Error("Invalid decomposition");
     num = 0;
   }
     
diff --git a/Plugin/Makefile b/Plugin/Makefile
index 6dbd96e955691e093afb17d4f8c9b2e82f32c41c..d52fcfea72d7ead6e32219bda11732caaf97a384 100644
--- a/Plugin/Makefile
+++ b/Plugin/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.164 2008-04-23 23:00:40 geuzaine Exp $
+# $Id: Makefile,v 1.165 2008-05-04 08:31:23 geuzaine Exp $
 #
 # Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 #
@@ -77,109 +77,99 @@ depend:
 
 # DO NOT DELETE THIS LINE
 Plugin.o: Plugin.cpp Plugin.h ../Common/Options.h ../Post/ColorTable.h \
-  ../Common/Message.h ../Post/PView.h ../Post/PViewData.h \
-  ../DataStr/List.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \
-  ../Post/PViewOptions.h ../Post/ColorTable.h ../Post/PViewDataList.h \
-  ../Post/PViewData.h ../Common/GmshMatrix.h
+  ../Common/Message.h ../Post/PView.h ../Geo/SPoint3.h \
+  ../Post/PViewDataList.h ../Post/PViewData.h ../Geo/SBoundingBox3d.h \
+  ../Geo/SPoint3.h ../DataStr/List.h ../Common/GmshMatrix.h
 PluginManager.o: PluginManager.cpp Plugin.h ../Common/Options.h \
   ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \
-  ../Post/PViewData.h ../DataStr/List.h ../Geo/SBoundingBox3d.h \
-  ../Geo/SPoint3.h ../Post/PViewOptions.h ../Post/ColorTable.h \
-  ../Post/PViewDataList.h ../Post/PViewData.h ../Common/GmshMatrix.h \
-  PluginManager.h CutMap.h Levelset.h CutGrid.h StreamLines.h CutPlane.h \
-  CutParametric.h CutSphere.h Skin.h ../DataStr/Tree.h ../DataStr/avl.h \
-  Extract.h ExtractElements.h ExtractEdges.h HarmonicToTime.h \
-  ModulusPhase.h Integrate.h Gradient.h Curl.h Divergence.h Annotate.h \
-  Remove.h MakeSimplex.h Smooth.h Transform.h TransformLatLon.h \
-  Triangulate.h Warp.h SphericalRaise.h Eigenvectors.h Eigenvalues.h \
-  Lambda2.h Evaluate.h ../Post/OctreePost.h ../Common/Octree.h \
-  ../Common/OctreeInternals.h Probe.h FieldView.h GSHHS.h \
-  ../Common/Context.h
+  ../Geo/SPoint3.h ../Post/PViewDataList.h ../Post/PViewData.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../DataStr/List.h \
+  ../Common/GmshMatrix.h PluginManager.h CutMap.h Levelset.h CutGrid.h \
+  StreamLines.h CutPlane.h CutParametric.h CutSphere.h Skin.h \
+  ../DataStr/Tree.h ../DataStr/avl.h Extract.h ExtractElements.h \
+  ExtractEdges.h HarmonicToTime.h ModulusPhase.h Integrate.h Gradient.h \
+  Curl.h Divergence.h Annotate.h Remove.h MakeSimplex.h Smooth.h \
+  Transform.h TransformLatLon.h Triangulate.h Warp.h SphericalRaise.h \
+  Eigenvectors.h Eigenvalues.h Lambda2.h Evaluate.h ../Post/OctreePost.h \
+  ../Common/Octree.h ../Common/OctreeInternals.h Probe.h FieldView.h \
+  GSHHS.h ../Common/Context.h
 Levelset.o: Levelset.cpp Levelset.h Plugin.h ../Common/Options.h \
   ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \
-  ../Post/PViewData.h ../DataStr/List.h ../Geo/SBoundingBox3d.h \
-  ../Geo/SPoint3.h ../Post/PViewOptions.h ../Post/ColorTable.h \
-  ../Post/PViewDataList.h ../Post/PViewData.h ../Common/GmshMatrix.h \
-  MakeSimplex.h ../Numeric/Numeric.h ../Numeric/NumericEmbedded.h \
-  ../Post/adaptiveData.h
+  ../Geo/SPoint3.h ../Post/PViewDataList.h ../Post/PViewData.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../DataStr/List.h \
+  ../Common/GmshMatrix.h MakeSimplex.h ../Numeric/Numeric.h \
+  ../Numeric/NumericEmbedded.h ../Post/adaptiveData.h
 CutPlane.o: CutPlane.cpp CutPlane.h Levelset.h Plugin.h \
   ../Common/Options.h ../Post/ColorTable.h ../Common/Message.h \
-  ../Post/PView.h ../Post/PViewData.h ../DataStr/List.h \
-  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Post/PViewOptions.h \
-  ../Post/ColorTable.h ../Post/PViewDataList.h ../Post/PViewData.h \
-  ../Common/GmshMatrix.h ../Common/Context.h ../Common/GmshUI.h \
-  ../Graphics/Draw.h
+  ../Post/PView.h ../Geo/SPoint3.h ../Post/PViewDataList.h \
+  ../Post/PViewData.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \
+  ../DataStr/List.h ../Common/GmshMatrix.h ../Common/Context.h \
+  ../Common/GmshUI.h ../Graphics/Draw.h
 CutSphere.o: CutSphere.cpp CutSphere.h Levelset.h Plugin.h \
   ../Common/Options.h ../Post/ColorTable.h ../Common/Message.h \
-  ../Post/PView.h ../Post/PViewData.h ../DataStr/List.h \
-  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Post/PViewOptions.h \
-  ../Post/ColorTable.h ../Post/PViewDataList.h ../Post/PViewData.h \
-  ../Common/GmshMatrix.h ../Common/Context.h ../Common/GmshUI.h \
-  ../Graphics/Draw.h
+  ../Post/PView.h ../Geo/SPoint3.h ../Post/PViewDataList.h \
+  ../Post/PViewData.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \
+  ../DataStr/List.h ../Common/GmshMatrix.h ../Common/Context.h \
+  ../Common/GmshUI.h ../Graphics/Draw.h
 CutMap.o: CutMap.cpp CutMap.h Levelset.h Plugin.h ../Common/Options.h \
   ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \
-  ../Post/PViewData.h ../DataStr/List.h ../Geo/SBoundingBox3d.h \
-  ../Geo/SPoint3.h ../Post/PViewOptions.h ../Post/ColorTable.h \
-  ../Post/PViewDataList.h ../Post/PViewData.h ../Common/GmshMatrix.h \
-  ../Common/Context.h
+  ../Geo/SPoint3.h ../Post/PViewDataList.h ../Post/PViewData.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../DataStr/List.h \
+  ../Common/GmshMatrix.h ../Common/Context.h
 Smooth.o: Smooth.cpp Smooth.h Plugin.h ../Common/Options.h \
   ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \
-  ../Post/PViewData.h ../DataStr/List.h ../Geo/SBoundingBox3d.h \
-  ../Geo/SPoint3.h ../Post/PViewOptions.h ../Post/ColorTable.h \
-  ../Post/PViewDataList.h ../Post/PViewData.h ../Common/GmshMatrix.h
+  ../Geo/SPoint3.h ../Post/PViewDataList.h ../Post/PViewData.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../DataStr/List.h \
+  ../Common/GmshMatrix.h
 CutParametric.o: CutParametric.cpp ../Post/OctreePost.h \
   ../Common/Octree.h ../Common/OctreeInternals.h CutParametric.h Plugin.h \
   ../Common/Options.h ../Post/ColorTable.h ../Common/Message.h \
-  ../Post/PView.h ../Post/PViewData.h ../DataStr/List.h \
-  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Post/PViewOptions.h \
-  ../Post/ColorTable.h ../Post/PViewDataList.h ../Post/PViewData.h \
-  ../Common/GmshMatrix.h ../Common/Context.h ../Common/GmshUI.h \
-  ../Graphics/Draw.h
+  ../Post/PView.h ../Geo/SPoint3.h ../Post/PViewDataList.h \
+  ../Post/PViewData.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \
+  ../DataStr/List.h ../Common/GmshMatrix.h ../Common/Context.h \
+  ../Common/GmshUI.h ../Graphics/Draw.h
 Lambda2.o: Lambda2.cpp Lambda2.h Plugin.h ../Common/Options.h \
   ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \
-  ../Post/PViewData.h ../DataStr/List.h ../Geo/SBoundingBox3d.h \
-  ../Geo/SPoint3.h ../Post/PViewOptions.h ../Post/ColorTable.h \
-  ../Post/PViewDataList.h ../Post/PViewData.h ../Common/GmshMatrix.h \
-  ../Common/ShapeFunctions.h ../Numeric/Numeric.h \
-  ../Numeric/NumericEmbedded.h
+  ../Geo/SPoint3.h ../Post/PViewDataList.h ../Post/PViewData.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../DataStr/List.h \
+  ../Common/GmshMatrix.h ../Common/ShapeFunctions.h ../Numeric/Numeric.h \
+  ../Numeric/NumericEmbedded.h ../Common/Message.h
 Eigenvectors.o: Eigenvectors.cpp Eigenvectors.h Plugin.h \
   ../Common/Options.h ../Post/ColorTable.h ../Common/Message.h \
-  ../Post/PView.h ../Post/PViewData.h ../DataStr/List.h \
-  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Post/PViewOptions.h \
-  ../Post/ColorTable.h ../Post/PViewDataList.h ../Post/PViewData.h \
-  ../Common/GmshMatrix.h ../Numeric/Numeric.h \
+  ../Post/PView.h ../Geo/SPoint3.h ../Post/PViewDataList.h \
+  ../Post/PViewData.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \
+  ../DataStr/List.h ../Common/GmshMatrix.h ../Numeric/Numeric.h \
   ../Numeric/NumericEmbedded.h ../Numeric/EigSolve.h
 Eigenvalues.o: Eigenvalues.cpp Eigenvalues.h Plugin.h ../Common/Options.h \
   ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \
-  ../Post/PViewData.h ../DataStr/List.h ../Geo/SBoundingBox3d.h \
-  ../Geo/SPoint3.h ../Post/PViewOptions.h ../Post/ColorTable.h \
-  ../Post/PViewDataList.h ../Post/PViewData.h ../Common/GmshMatrix.h \
-  ../Numeric/Numeric.h ../Numeric/NumericEmbedded.h
+  ../Geo/SPoint3.h ../Post/PViewDataList.h ../Post/PViewData.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../DataStr/List.h \
+  ../Common/GmshMatrix.h ../Numeric/Numeric.h \
+  ../Numeric/NumericEmbedded.h
 StreamLines.o: StreamLines.cpp StreamLines.h Plugin.h ../Common/Options.h \
   ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \
-  ../Post/PViewData.h ../DataStr/List.h ../Geo/SBoundingBox3d.h \
-  ../Geo/SPoint3.h ../Post/PViewOptions.h ../Post/ColorTable.h \
-  ../Post/PViewDataList.h ../Post/PViewData.h ../Common/GmshMatrix.h \
-  ../Post/OctreePost.h ../Common/Octree.h ../Common/OctreeInternals.h \
-  ../Common/Context.h ../Common/GmshUI.h ../Graphics/Draw.h
+  ../Geo/SPoint3.h ../Post/PViewDataList.h ../Post/PViewData.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../DataStr/List.h \
+  ../Common/GmshMatrix.h ../Post/OctreePost.h ../Common/Octree.h \
+  ../Common/OctreeInternals.h ../Common/Context.h ../Post/PViewOptions.h \
+  ../Post/ColorTable.h ../Common/GmshUI.h ../Graphics/Draw.h
 CutGrid.o: CutGrid.cpp ../Post/OctreePost.h ../Common/Octree.h \
   ../Common/OctreeInternals.h CutGrid.h Plugin.h ../Common/Options.h \
   ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \
-  ../Post/PViewData.h ../DataStr/List.h ../Geo/SBoundingBox3d.h \
-  ../Geo/SPoint3.h ../Post/PViewOptions.h ../Post/ColorTable.h \
-  ../Post/PViewDataList.h ../Post/PViewData.h ../Common/GmshMatrix.h \
-  ../Common/Context.h ../Common/GmshUI.h ../Graphics/Draw.h
+  ../Geo/SPoint3.h ../Post/PViewDataList.h ../Post/PViewData.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../DataStr/List.h \
+  ../Common/GmshMatrix.h ../Common/Context.h ../Common/GmshUI.h \
+  ../Graphics/Draw.h
 Transform.o: Transform.cpp Transform.h Plugin.h ../Common/Options.h \
   ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \
-  ../Post/PViewData.h ../DataStr/List.h ../Geo/SBoundingBox3d.h \
-  ../Geo/SPoint3.h ../Post/PViewOptions.h ../Post/ColorTable.h \
-  ../Post/PViewDataList.h ../Post/PViewData.h ../Common/GmshMatrix.h
+  ../Geo/SPoint3.h ../Post/PViewDataList.h ../Post/PViewData.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../DataStr/List.h \
+  ../Common/GmshMatrix.h
 TransformLatLon.o: TransformLatLon.cpp TransformLatLon.h Plugin.h \
   ../Common/Options.h ../Post/ColorTable.h ../Common/Message.h \
-  ../Post/PView.h ../Post/PViewData.h ../DataStr/List.h \
-  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Post/PViewOptions.h \
-  ../Post/ColorTable.h ../Post/PViewDataList.h ../Post/PViewData.h \
-  ../Common/GmshMatrix.h
+  ../Post/PView.h ../Geo/SPoint3.h ../Post/PViewDataList.h \
+  ../Post/PViewData.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \
+  ../DataStr/List.h ../Common/GmshMatrix.h
 Triangulate.o: Triangulate.cpp ../Geo/GModel.h ../Geo/GVertex.h \
   ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
   ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Geo/GPoint.h \
@@ -197,37 +187,34 @@ Triangulate.o: Triangulate.cpp ../Geo/GModel.h ../Geo/GVertex.h \
   ../Common/SmoothData.h ../Mesh/DivideAndConquer.h ../Common/Message.h \
   ../Geo/MVertex.h ../Geo/SPoint3.h Triangulate.h Plugin.h \
   ../Common/Options.h ../Post/ColorTable.h ../Post/PView.h \
-  ../Post/PViewData.h ../Post/PViewOptions.h ../Post/ColorTable.h \
   ../Post/PViewDataList.h ../Post/PViewData.h ../Common/GmshMatrix.h \
   ../Common/Context.h
 Warp.o: Warp.cpp Warp.h Plugin.h ../Common/Options.h ../Post/ColorTable.h \
-  ../Common/Message.h ../Post/PView.h ../Post/PViewData.h \
-  ../DataStr/List.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \
-  ../Post/PViewOptions.h ../Post/ColorTable.h ../Post/PViewDataList.h \
-  ../Post/PViewData.h ../Common/GmshMatrix.h ../Common/SmoothData.h \
-  ../Numeric/Numeric.h ../Numeric/NumericEmbedded.h
+  ../Common/Message.h ../Post/PView.h ../Geo/SPoint3.h \
+  ../Post/PViewDataList.h ../Post/PViewData.h ../Geo/SBoundingBox3d.h \
+  ../Geo/SPoint3.h ../DataStr/List.h ../Common/GmshMatrix.h \
+  ../Common/SmoothData.h ../Numeric/Numeric.h \
+  ../Numeric/NumericEmbedded.h
 SphericalRaise.o: SphericalRaise.cpp SphericalRaise.h Plugin.h \
   ../Common/Options.h ../Post/ColorTable.h ../Common/Message.h \
-  ../Post/PView.h ../Post/PViewData.h ../DataStr/List.h \
-  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Post/PViewOptions.h \
-  ../Post/ColorTable.h ../Post/PViewDataList.h ../Post/PViewData.h \
-  ../Common/GmshMatrix.h ../Numeric/Numeric.h \
+  ../Post/PView.h ../Geo/SPoint3.h ../Post/PViewDataList.h \
+  ../Post/PViewData.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \
+  ../DataStr/List.h ../Common/GmshMatrix.h ../Numeric/Numeric.h \
   ../Numeric/NumericEmbedded.h
 Skin.o: Skin.cpp Skin.h Plugin.h ../Common/Options.h ../Post/ColorTable.h \
-  ../Common/Message.h ../Post/PView.h ../Post/PViewData.h \
-  ../DataStr/List.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \
-  ../Post/PViewOptions.h ../Post/ColorTable.h ../Post/PViewDataList.h \
-  ../Post/PViewData.h ../Common/GmshMatrix.h ../DataStr/Tree.h \
-  ../DataStr/avl.h ../DataStr/Malloc.h ../Common/Context.h
+  ../Common/Message.h ../Post/PView.h ../Geo/SPoint3.h \
+  ../Post/PViewDataList.h ../Post/PViewData.h ../Geo/SBoundingBox3d.h \
+  ../Geo/SPoint3.h ../DataStr/List.h ../Common/GmshMatrix.h \
+  ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Malloc.h \
+  ../Common/Context.h
 GSHHS.o: GSHHS.cpp GSHHS.h Plugin.h ../Common/Options.h \
   ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \
-  ../Post/PViewData.h ../DataStr/List.h ../Geo/SBoundingBox3d.h \
-  ../Geo/SPoint3.h ../Post/PViewOptions.h ../Post/ColorTable.h \
-  ../Post/PViewDataList.h ../Post/PViewData.h ../Common/GmshMatrix.h \
-  ../Mesh/Field.h ../Geo/Geo.h ../Common/GmshDefines.h \
-  ../Geo/gmshSurface.h ../Geo/Pair.h ../Geo/Range.h ../Geo/SPoint2.h \
-  ../Geo/SPoint3.h ../Geo/SVector3.h ../Geo/SPoint3.h \
-  ../Geo/SBoundingBox3d.h ../Numeric/Numeric.h \
+  ../Geo/SPoint3.h ../Post/PViewDataList.h ../Post/PViewData.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../DataStr/List.h \
+  ../Common/GmshMatrix.h ../Mesh/Field.h ../Geo/Geo.h \
+  ../Common/GmshDefines.h ../Geo/gmshSurface.h ../Geo/Pair.h \
+  ../Geo/Range.h ../Geo/SPoint2.h ../Geo/SPoint3.h ../Geo/SVector3.h \
+  ../Geo/SPoint3.h ../Geo/SBoundingBox3d.h ../Numeric/Numeric.h \
   ../Numeric/NumericEmbedded.h ../DataStr/Tree.h ../DataStr/avl.h \
   ../Geo/SPoint2.h ../Geo/ExtrudeParams.h ../Common/SmoothData.h \
   ../Geo/GModel.h ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h \
@@ -239,47 +226,45 @@ GSHHS.o: GSHHS.cpp GSHHS.h Plugin.h ../Common/Options.h \
   ../Geo/GEntity.h ../Geo/SBoundingBox3d.h
 Extract.o: Extract.cpp Extract.h Plugin.h ../Common/Options.h \
   ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \
-  ../Post/PViewData.h ../DataStr/List.h ../Geo/SBoundingBox3d.h \
-  ../Geo/SPoint3.h ../Post/PViewOptions.h ../Post/ColorTable.h \
-  ../Post/PViewDataList.h ../Post/PViewData.h ../Common/GmshMatrix.h
+  ../Geo/SPoint3.h ../Post/PViewDataList.h ../Post/PViewData.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../DataStr/List.h \
+  ../Common/GmshMatrix.h
 ExtractElements.o: ExtractElements.cpp ExtractElements.h Plugin.h \
   ../Common/Options.h ../Post/ColorTable.h ../Common/Message.h \
-  ../Post/PView.h ../Post/PViewData.h ../DataStr/List.h \
-  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Post/PViewOptions.h \
-  ../Post/ColorTable.h ../Post/PViewDataList.h ../Post/PViewData.h \
-  ../Common/GmshMatrix.h ../Numeric/Numeric.h \
+  ../Post/PView.h ../Geo/SPoint3.h ../Post/PViewDataList.h \
+  ../Post/PViewData.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \
+  ../DataStr/List.h ../Common/GmshMatrix.h ../Numeric/Numeric.h \
   ../Numeric/NumericEmbedded.h
 ExtractEdges.o: ExtractEdges.cpp ExtractEdges.h Plugin.h \
   ../Common/Options.h ../Post/ColorTable.h ../Common/Message.h \
-  ../Post/PView.h ../Post/PViewData.h ../DataStr/List.h \
-  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Post/PViewOptions.h \
-  ../Post/ColorTable.h ../Post/PViewDataList.h ../Post/PViewData.h \
-  ../Common/GmshMatrix.h ../Mesh/BDS.h ../Geo/GFace.h ../Geo/GEntity.h \
-  ../Geo/Range.h ../Geo/SPoint3.h ../Geo/SBoundingBox3d.h ../Geo/GPoint.h \
-  ../Geo/GEdgeLoop.h ../Geo/GEdge.h ../Geo/GEntity.h ../Geo/GVertex.h \
-  ../Geo/GEntity.h ../Geo/GPoint.h ../Geo/SPoint2.h ../Geo/SVector3.h \
-  ../Geo/SPoint3.h ../Geo/SPoint3.h ../Geo/SPoint2.h ../Geo/SPoint2.h \
-  ../Geo/SVector3.h ../Geo/Pair.h
+  ../Post/PView.h ../Geo/SPoint3.h ../Post/PViewDataList.h \
+  ../Post/PViewData.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \
+  ../DataStr/List.h ../Common/GmshMatrix.h ../Mesh/BDS.h ../Geo/GFace.h \
+  ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
+  ../Geo/SBoundingBox3d.h ../Geo/GPoint.h ../Geo/GEdgeLoop.h \
+  ../Geo/GEdge.h ../Geo/GEntity.h ../Geo/GVertex.h ../Geo/GEntity.h \
+  ../Geo/GPoint.h ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/SPoint3.h \
+  ../Geo/SPoint3.h ../Geo/SPoint2.h ../Geo/SPoint2.h ../Geo/SVector3.h \
+  ../Geo/Pair.h
 MakeSimplex.o: MakeSimplex.cpp MakeSimplex.h Plugin.h ../Common/Options.h \
   ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \
-  ../Post/PViewData.h ../DataStr/List.h ../Geo/SBoundingBox3d.h \
-  ../Geo/SPoint3.h ../Post/PViewOptions.h ../Post/ColorTable.h \
-  ../Post/PViewDataList.h ../Post/PViewData.h ../Common/GmshMatrix.h
+  ../Geo/SPoint3.h ../Post/PViewDataList.h ../Post/PViewData.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../DataStr/List.h \
+  ../Common/GmshMatrix.h
 Evaluate.o: Evaluate.cpp Evaluate.h Plugin.h ../Common/Options.h \
   ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \
-  ../Post/PViewData.h ../DataStr/List.h ../Geo/SBoundingBox3d.h \
-  ../Geo/SPoint3.h ../Post/PViewOptions.h ../Post/ColorTable.h \
-  ../Post/PViewDataList.h ../Post/PViewData.h ../Common/GmshMatrix.h \
-  ../Post/OctreePost.h ../Common/Octree.h ../Common/OctreeInternals.h
+  ../Geo/SPoint3.h ../Post/PViewDataList.h ../Post/PViewData.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../DataStr/List.h \
+  ../Common/GmshMatrix.h ../Post/OctreePost.h ../Common/Octree.h \
+  ../Common/OctreeInternals.h
 FieldView.o: FieldView.cpp FieldView.h Plugin.h ../Common/Options.h \
   ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \
-  ../Post/PViewData.h ../DataStr/List.h ../Geo/SBoundingBox3d.h \
-  ../Geo/SPoint3.h ../Post/PViewOptions.h ../Post/ColorTable.h \
-  ../Post/PViewDataList.h ../Post/PViewData.h ../Common/GmshMatrix.h \
-  ../Mesh/Field.h ../Geo/Geo.h ../Common/GmshDefines.h \
-  ../Geo/gmshSurface.h ../Geo/Pair.h ../Geo/Range.h ../Geo/SPoint2.h \
-  ../Geo/SPoint3.h ../Geo/SVector3.h ../Geo/SPoint3.h \
-  ../Geo/SBoundingBox3d.h ../Numeric/Numeric.h \
+  ../Geo/SPoint3.h ../Post/PViewDataList.h ../Post/PViewData.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../DataStr/List.h \
+  ../Common/GmshMatrix.h ../Mesh/Field.h ../Geo/Geo.h \
+  ../Common/GmshDefines.h ../Geo/gmshSurface.h ../Geo/Pair.h \
+  ../Geo/Range.h ../Geo/SPoint2.h ../Geo/SPoint3.h ../Geo/SVector3.h \
+  ../Geo/SPoint3.h ../Geo/SBoundingBox3d.h ../Numeric/Numeric.h \
   ../Numeric/NumericEmbedded.h ../DataStr/Tree.h ../DataStr/avl.h \
   ../Geo/SPoint2.h ../Geo/ExtrudeParams.h ../Common/SmoothData.h \
   ../Geo/GModel.h ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h \
@@ -291,38 +276,35 @@ FieldView.o: FieldView.cpp FieldView.h Plugin.h ../Common/Options.h \
   ../Geo/GEntity.h ../Geo/SBoundingBox3d.h
 Integrate.o: Integrate.cpp Integrate.h Plugin.h ../Common/Options.h \
   ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \
-  ../Post/PViewData.h ../DataStr/List.h ../Geo/SBoundingBox3d.h \
-  ../Geo/SPoint3.h ../Post/PViewOptions.h ../Post/ColorTable.h \
-  ../Post/PViewDataList.h ../Post/PViewData.h ../Common/GmshMatrix.h \
-  ../Common/ShapeFunctions.h ../Numeric/Numeric.h \
-  ../Numeric/NumericEmbedded.h
+  ../Geo/SPoint3.h ../Post/PViewDataList.h ../Post/PViewData.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../DataStr/List.h \
+  ../Common/GmshMatrix.h ../Common/ShapeFunctions.h ../Numeric/Numeric.h \
+  ../Numeric/NumericEmbedded.h ../Common/Message.h ../Post/PViewOptions.h \
+  ../Post/ColorTable.h
 Gradient.o: Gradient.cpp Gradient.h Plugin.h ../Common/Options.h \
   ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \
-  ../Post/PViewData.h ../DataStr/List.h ../Geo/SBoundingBox3d.h \
-  ../Geo/SPoint3.h ../Post/PViewOptions.h ../Post/ColorTable.h \
-  ../Post/PViewDataList.h ../Post/PViewData.h ../Common/GmshMatrix.h \
-  ../Common/ShapeFunctions.h ../Numeric/Numeric.h \
-  ../Numeric/NumericEmbedded.h
+  ../Geo/SPoint3.h ../Post/PViewDataList.h ../Post/PViewData.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../DataStr/List.h \
+  ../Common/GmshMatrix.h ../Common/ShapeFunctions.h ../Numeric/Numeric.h \
+  ../Numeric/NumericEmbedded.h ../Common/Message.h
 Curl.o: Curl.cpp Curl.h Plugin.h ../Common/Options.h ../Post/ColorTable.h \
-  ../Common/Message.h ../Post/PView.h ../Post/PViewData.h \
-  ../DataStr/List.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \
-  ../Post/PViewOptions.h ../Post/ColorTable.h ../Post/PViewDataList.h \
-  ../Post/PViewData.h ../Common/GmshMatrix.h ../Common/ShapeFunctions.h \
-  ../Numeric/Numeric.h ../Numeric/NumericEmbedded.h
+  ../Common/Message.h ../Post/PView.h ../Geo/SPoint3.h \
+  ../Post/PViewDataList.h ../Post/PViewData.h ../Geo/SBoundingBox3d.h \
+  ../Geo/SPoint3.h ../DataStr/List.h ../Common/GmshMatrix.h \
+  ../Common/ShapeFunctions.h ../Numeric/Numeric.h \
+  ../Numeric/NumericEmbedded.h ../Common/Message.h
 Divergence.o: Divergence.cpp Divergence.h Plugin.h ../Common/Options.h \
   ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \
-  ../Post/PViewData.h ../DataStr/List.h ../Geo/SBoundingBox3d.h \
-  ../Geo/SPoint3.h ../Post/PViewOptions.h ../Post/ColorTable.h \
-  ../Post/PViewDataList.h ../Post/PViewData.h ../Common/GmshMatrix.h \
-  ../Common/ShapeFunctions.h ../Numeric/Numeric.h \
-  ../Numeric/NumericEmbedded.h
+  ../Geo/SPoint3.h ../Post/PViewDataList.h ../Post/PViewData.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../DataStr/List.h \
+  ../Common/GmshMatrix.h ../Common/ShapeFunctions.h ../Numeric/Numeric.h \
+  ../Numeric/NumericEmbedded.h ../Common/Message.h
 Annotate.o: Annotate.cpp Annotate.h Plugin.h ../Common/Options.h \
   ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \
-  ../Post/PViewData.h ../DataStr/List.h ../Geo/SBoundingBox3d.h \
-  ../Geo/SPoint3.h ../Post/PViewOptions.h ../Post/ColorTable.h \
-  ../Post/PViewDataList.h ../Post/PViewData.h ../Common/GmshMatrix.h \
-  ../Common/Context.h ../Common/GmshUI.h ../Fltk/GUI.h \
-  ../Fltk/Opengl_Window.h ../Fltk/Colorbar_Window.h \
+  ../Geo/SPoint3.h ../Post/PViewDataList.h ../Post/PViewData.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../DataStr/List.h \
+  ../Common/GmshMatrix.h ../Common/Context.h ../Common/GmshUI.h \
+  ../Fltk/GUI.h ../Fltk/Opengl_Window.h ../Fltk/Colorbar_Window.h \
   ../Fltk/Popup_Button.h ../Fltk/SpherePosition_Widget.h ../Mesh/Field.h \
   ../Geo/Geo.h ../Common/GmshDefines.h ../Geo/gmshSurface.h ../Geo/Pair.h \
   ../Geo/Range.h ../Geo/SPoint2.h ../Geo/SPoint3.h ../Geo/SVector3.h \
@@ -332,25 +314,23 @@ Annotate.o: Annotate.cpp Annotate.h Plugin.h ../Common/Options.h \
   ../Graphics/Draw.h
 Remove.o: Remove.cpp Remove.h Plugin.h ../Common/Options.h \
   ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \
-  ../Post/PViewData.h ../DataStr/List.h ../Geo/SBoundingBox3d.h \
-  ../Geo/SPoint3.h ../Post/PViewOptions.h ../Post/ColorTable.h \
-  ../Post/PViewDataList.h ../Post/PViewData.h ../Common/GmshMatrix.h
+  ../Geo/SPoint3.h ../Post/PViewDataList.h ../Post/PViewData.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../DataStr/List.h \
+  ../Common/GmshMatrix.h
 Probe.o: Probe.cpp Probe.h Plugin.h ../Common/Options.h \
   ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \
-  ../Post/PViewData.h ../DataStr/List.h ../Geo/SBoundingBox3d.h \
-  ../Geo/SPoint3.h ../Post/PViewOptions.h ../Post/ColorTable.h \
-  ../Post/PViewDataList.h ../Post/PViewData.h ../Common/GmshMatrix.h \
-  ../Common/Context.h ../Post/OctreePost.h ../Common/Octree.h \
-  ../Common/OctreeInternals.h ../Common/GmshUI.h ../Graphics/Draw.h
+  ../Geo/SPoint3.h ../Post/PViewDataList.h ../Post/PViewData.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../DataStr/List.h \
+  ../Common/GmshMatrix.h ../Common/Context.h ../Post/OctreePost.h \
+  ../Common/Octree.h ../Common/OctreeInternals.h ../Common/GmshUI.h \
+  ../Graphics/Draw.h
 HarmonicToTime.o: HarmonicToTime.cpp HarmonicToTime.h Plugin.h \
   ../Common/Options.h ../Post/ColorTable.h ../Common/Message.h \
-  ../Post/PView.h ../Post/PViewData.h ../DataStr/List.h \
-  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Post/PViewOptions.h \
-  ../Post/ColorTable.h ../Post/PViewDataList.h ../Post/PViewData.h \
-  ../Common/GmshMatrix.h
+  ../Post/PView.h ../Geo/SPoint3.h ../Post/PViewDataList.h \
+  ../Post/PViewData.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \
+  ../DataStr/List.h ../Common/GmshMatrix.h
 ModulusPhase.o: ModulusPhase.cpp ModulusPhase.h Plugin.h \
   ../Common/Options.h ../Post/ColorTable.h ../Common/Message.h \
-  ../Post/PView.h ../Post/PViewData.h ../DataStr/List.h \
-  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Post/PViewOptions.h \
-  ../Post/ColorTable.h ../Post/PViewDataList.h ../Post/PViewData.h \
-  ../Common/GmshMatrix.h
+  ../Post/PView.h ../Geo/SPoint3.h ../Post/PViewDataList.h \
+  ../Post/PViewData.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \
+  ../DataStr/List.h ../Common/GmshMatrix.h
diff --git a/Plugin/ModulusPhase.cpp b/Plugin/ModulusPhase.cpp
index e3ec3a6bba500d5dd41e5d1ecb22fd7f1624c293..59519c95f72e38319a296b6d7424222de2b6a518 100644
--- a/Plugin/ModulusPhase.cpp
+++ b/Plugin/ModulusPhase.cpp
@@ -1,4 +1,4 @@
-// $Id: ModulusPhase.cpp,v 1.10 2008-04-06 09:20:17 geuzaine Exp $
+// $Id: ModulusPhase.cpp,v 1.11 2008-05-04 08:31:23 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -82,13 +82,13 @@ PView *GMSH_ModulusPhasePlugin::execute(PView *v)
 
   PViewData *data1 = v1->getData();
   if(data1->hasMultipleMeshes()){
-    Msg(GERROR, "Gradient plugin cannot be run on multi-mesh views");
+    Msg::Error("Gradient plugin cannot be run on multi-mesh views");
     return v;
   }
 
   if(rIndex < 0 || rIndex >= data1->getNumTimeSteps() ||
      iIndex < 0 || iIndex >= data1->getNumTimeSteps()){
-    Msg(GERROR, "Wrong real or imaginary part index");
+    Msg::Error("Wrong real or imaginary part index");
     return v1;
   }
 
diff --git a/Plugin/Plugin.cpp b/Plugin/Plugin.cpp
index 82779ad1adb2f18664ee313631bdcfb6bffe92cf..5784284e97ca0ae77c811807116d583dcd997e31 100644
--- a/Plugin/Plugin.cpp
+++ b/Plugin/Plugin.cpp
@@ -1,4 +1,4 @@
-// $Id: Plugin.cpp,v 1.93 2008-02-17 08:48:07 geuzaine Exp $
+// $Id: Plugin.cpp,v 1.94 2008-05-04 08:31:23 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -30,7 +30,7 @@ PView *GMSH_Post_Plugin::getView(int index, PView *view)
     return PView::list[index];
   }
   else{
-    Msg(GERROR, "View[%d] does not exist", index);
+    Msg::Error("View[%d] does not exist", index);
     return 0;
   }
 }
@@ -45,7 +45,7 @@ PViewDataList *GMSH_Post_Plugin::getDataList(PView *view)
   }
   else{
     // FIXME: do automatic data conversion here
-    Msg(GERROR, "This plugin can only be run on list-based datasets");
+    Msg::Error("This plugin can only be run on list-based datasets");
     return 0;
   }
 }
diff --git a/Plugin/PluginManager.cpp b/Plugin/PluginManager.cpp
index 29d21a11dcbf6f66695666f8f29a6a4b0ac6a205..039529c0a23adc36d87e502aeebc80f1557f0ad6 100644
--- a/Plugin/PluginManager.cpp
+++ b/Plugin/PluginManager.cpp
@@ -1,4 +1,4 @@
-// $Id: PluginManager.cpp,v 1.7 2008-03-20 11:44:14 geuzaine Exp $
+// $Id: PluginManager.cpp,v 1.8 2008-05-04 08:31:23 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -269,7 +269,7 @@ void GMSH_PluginManager::registerDefaultPlugins()
 void GMSH_PluginManager::addPlugin(char *dirName, char *pluginName)
 {
 #if defined(HAVE_NO_DLL) || !defined(HAVE_FLTK)
-  Msg(WARNING, "No dynamic plugin loading on this platform");
+  Msg::Warning("No dynamic plugin loading on this platform");
 #else
   char dynamic_lib[1024];
   char plugin_name[256];
@@ -278,17 +278,17 @@ void GMSH_PluginManager::addPlugin(char *dirName, char *pluginName)
   char plugin_help[1024];
   class GMSH_Plugin *(*registerPlugin) (void);
   sprintf(dynamic_lib, "%s/%s", dirName, pluginName);
-  Msg(INFO, "Opening Plugin '%s'", dynamic_lib);
+  Msg::Info("Opening Plugin '%s'", dynamic_lib);
   void *hlib = dlopen(dynamic_lib, RTLD_NOW);
   const char *err = dlerror();
   if(!hlib){
-    Msg(WARNING, "Error in opening %s (dlerror = %s)", dynamic_lib, err);
+    Msg::Warning("Error in opening %s (dlerror = %s)", dynamic_lib, err);
     return;
   }
   registerPlugin = (class GMSH_Plugin * (*)(void))dlsym(hlib, GMSH_PluginEntry);
   err = dlerror();
   if(err){
-    Msg(WARNING, "Symbol '%s' missing in plugin '%s' (dlerror = %s)",
+    Msg::Warning("Symbol '%s' missing in plugin '%s' (dlerror = %s)",
         GMSH_PluginEntry, pluginName, err);
     return;
   }
@@ -298,10 +298,10 @@ void GMSH_PluginManager::addPlugin(char *dirName, char *pluginName)
   p->getName(plugin_name);
   p->getInfos(plugin_author, plugin_copyright, plugin_help);
   if(allPlugins.find(plugin_name) != allPlugins.end()) {
-    Msg(WARNING, "Plugin '%s' multiply defined", pluginName);
+    Msg::Warning("Plugin '%s' multiply defined", pluginName);
     return;
   }
   allPlugins.insert(std::pair<const char*, GMSH_Plugin*>(plugin_name, p));
-  Msg(INFO, "Loaded Plugin '%s' (%s)", plugin_name, plugin_author);
+  Msg::Info("Loaded Plugin '%s' (%s)", plugin_name, plugin_author);
 #endif
 }
diff --git a/Plugin/SphericalRaise.cpp b/Plugin/SphericalRaise.cpp
index 3a11da23c471e6c5dff1592151d65673a9f77540..22775b942b83a06e9fb4676522f0cfcc47a56163 100644
--- a/Plugin/SphericalRaise.cpp
+++ b/Plugin/SphericalRaise.cpp
@@ -1,4 +1,4 @@
-// $Id: SphericalRaise.cpp,v 1.34 2008-04-06 09:20:17 geuzaine Exp $
+// $Id: SphericalRaise.cpp,v 1.35 2008-05-04 08:31:23 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -101,7 +101,7 @@ PView *GMSH_SphericalRaisePlugin::execute(PView *v)
 
   // sanity checks
   if(timeStep < 0 || timeStep > data1->getNumTimeSteps() - 1){
-    Msg(GERROR, "Invalid TimeStep (%d) in view", timeStep);
+    Msg::Error("Invalid TimeStep (%d) in view", timeStep);
     return v;
   }
 
diff --git a/Plugin/StreamLines.cpp b/Plugin/StreamLines.cpp
index 6d679d7fe0d7c234270c84d18440f7351a55e8e0..595259c1354b88b0798a55c0177124f548cc651b 100644
--- a/Plugin/StreamLines.cpp
+++ b/Plugin/StreamLines.cpp
@@ -1,4 +1,4 @@
-// $Id: StreamLines.cpp,v 1.35 2008-04-06 07:51:37 geuzaine Exp $
+// $Id: StreamLines.cpp,v 1.36 2008-05-04 08:31:23 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -23,6 +23,7 @@
 #include "StreamLines.h"
 #include "OctreePost.h"
 #include "Context.h"
+#include "PViewOptions.h"
 
 #if defined(HAVE_FLTK)
 #include "GmshUI.h"
@@ -246,7 +247,7 @@ PView *GMSH_StreamLinesPlugin::execute(PView *v)
 
   // sanity checks
   if(timeStep > data1->getNumTimeSteps() - 1){
-    Msg(GERROR, "Invalid time step (%d) in view[%d]", v1->getIndex());
+    Msg::Error("Invalid time step (%d) in view[%d]", v1->getIndex());
     return v;
   }
 
diff --git a/Plugin/Warp.cpp b/Plugin/Warp.cpp
index d1bd5d97408a7d199ca56ef1d12cb3832fab5f15..4bb0db8f070c32f6611ea479f8356e0adb607142 100644
--- a/Plugin/Warp.cpp
+++ b/Plugin/Warp.cpp
@@ -1,4 +1,4 @@
-// $Id: Warp.cpp,v 1.15 2008-04-06 09:20:17 geuzaine Exp $
+// $Id: Warp.cpp,v 1.16 2008-05-04 08:31:23 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -99,11 +99,11 @@ PView *GMSH_WarpPlugin::execute(PView *v)
   // sanity checks
   if(data1->getNumEntities() != data2->getNumEntities() ||
      data1->getNumElements() != data2->getNumElements()){
-    Msg(GERROR, "Incompatible views");
+    Msg::Error("Incompatible views");
     return v;
   }
   if(TimeStep < 0 || TimeStep > data2->getNumTimeSteps() - 1){
-    Msg(GERROR, "Invalid TimeStep (%d) in View[%d]", TimeStep, v2->getIndex());
+    Msg::Error("Invalid TimeStep (%d) in View[%d]", TimeStep, v2->getIndex());
     return v;
   }
   
diff --git a/Post/ColorTable.cpp b/Post/ColorTable.cpp
index 5d852f68ef767a8343caff07f1a8aea1bc3573fb..b80f70783e2f4dda1d6aa55865c848d800655344 100644
--- a/Post/ColorTable.cpp
+++ b/Post/ColorTable.cpp
@@ -1,4 +1,4 @@
-// $Id: ColorTable.cpp,v 1.5 2008-03-20 11:44:15 geuzaine Exp $
+// $Id: ColorTable.cpp,v 1.6 2008-05-04 08:31:23 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -398,7 +398,7 @@ void ColorTable_Print(GmshColorTable * ct, FILE * fp)
       if(fp)
         fprintf(fp, "%s\n", tmp1);
       else
-        Msg(DIRECT, tmp1);
+        Msg::Direct(tmp1);
       strcpy(tmp1, "");
     }
     sprintf(tmp2, "{%d, %d, %d, %d}", r, g, b, a);
@@ -409,7 +409,7 @@ void ColorTable_Print(GmshColorTable * ct, FILE * fp)
   if(fp)
     fprintf(fp, "%s\n", tmp1);
   else
-    Msg(DIRECT, tmp1);
+    Msg::Direct(tmp1);
 }
 
 int ColorTable_IsAlpha(GmshColorTable * ct)
diff --git a/Post/Makefile b/Post/Makefile
index 97002961aab26ed0086efd291f683fc63034a5ca..cdf1b6a084c47f00e15bc89b97b18c3d0257a888 100644
--- a/Post/Makefile
+++ b/Post/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.44 2008-04-30 05:50:21 geuzaine Exp $
+# $Id: Makefile,v 1.45 2008-05-04 08:31:23 geuzaine Exp $
 #
 # Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 #
@@ -65,38 +65,50 @@ depend:
 	rm -f Makefile.new
 
 # DO NOT DELETE THIS LINE
-PView.o: PView.cpp PView.h PViewData.h ../DataStr/List.h \
-  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h PViewOptions.h ColorTable.h \
-  PViewDataList.h ../Common/VertexArray.h ../Geo/SVector3.h \
+PView.o: PView.cpp PView.h ../Geo/SPoint3.h PViewOptions.h ColorTable.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h PViewData.h PViewDataList.h \
+  ../DataStr/List.h ../Common/VertexArray.h ../Geo/SVector3.h \
   ../Geo/SPoint3.h ../Common/Context.h ../Common/SmoothData.h \
   adaptiveData.h ../Common/GmshMatrix.h ../Common/Message.h
-PViewIO.o: PViewIO.cpp PView.h PViewData.h ../DataStr/List.h \
-  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h PViewOptions.h ColorTable.h \
-  PViewDataList.h PViewDataGModel.h ../Geo/GModel.h ../Geo/GVertex.h \
-  ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
-  ../Geo/SBoundingBox3d.h ../Geo/GPoint.h ../Geo/SPoint2.h ../Geo/GEdge.h \
-  ../Geo/GEntity.h ../Geo/GVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h \
-  ../Geo/SPoint3.h ../Geo/SPoint2.h ../Geo/GFace.h ../Geo/GEntity.h \
-  ../Geo/GPoint.h ../Geo/GEdgeLoop.h ../Geo/GEdge.h ../Geo/SPoint2.h \
-  ../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h ../Geo/GEntity.h \
-  ../Geo/SBoundingBox3d.h ../Common/StringUtils.h ../Common/Message.h
-PViewData.o: PViewData.cpp PViewData.h ../DataStr/List.h \
-  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h adaptiveData.h \
+PViewIO.o: PViewIO.cpp PView.h ../Geo/SPoint3.h PViewDataList.h \
+  PViewData.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../DataStr/List.h \
+  PViewDataGModel.h ../Geo/GModel.h ../Geo/GVertex.h ../Geo/GEntity.h \
+  ../Geo/Range.h ../Geo/SPoint3.h ../Geo/SBoundingBox3d.h ../Geo/GPoint.h \
+  ../Geo/SPoint2.h ../Geo/GEdge.h ../Geo/GEntity.h ../Geo/GVertex.h \
+  ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/SPoint3.h ../Geo/SPoint2.h \
+  ../Geo/GFace.h ../Geo/GEntity.h ../Geo/GPoint.h ../Geo/GEdgeLoop.h \
+  ../Geo/GEdge.h ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h \
+  ../Geo/GRegion.h ../Geo/GEntity.h ../Geo/SBoundingBox3d.h \
+  ../Common/StringUtils.h ../Common/Message.h
+PViewData.o: PViewData.cpp PViewData.h ../Geo/SBoundingBox3d.h \
+  ../Geo/SPoint3.h ../DataStr/List.h adaptiveData.h \
   ../Common/GmshMatrix.h ../Numeric/Numeric.h \
   ../Numeric/NumericEmbedded.h ../Common/Message.h
 PViewDataIO.o: PViewDataIO.cpp ../Common/Message.h ../Numeric/Numeric.h \
-  ../Numeric/NumericEmbedded.h PViewData.h ../DataStr/List.h \
-  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h
+  ../Numeric/NumericEmbedded.h PViewData.h ../Geo/SBoundingBox3d.h \
+  ../Geo/SPoint3.h
 PViewDataList.o: PViewDataList.cpp PViewDataList.h PViewData.h \
-  ../DataStr/List.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../DataStr/List.h \
   ../Numeric/Numeric.h ../Numeric/NumericEmbedded.h \
   ../Common/SmoothData.h ../Common/Message.h ../Common/Context.h
 PViewDataListIO.o: PViewDataListIO.cpp PViewDataList.h PViewData.h \
-  ../DataStr/List.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../DataStr/List.h \
   ../Numeric/Numeric.h ../Numeric/NumericEmbedded.h ../Common/Message.h \
   ../Common/Context.h
 PViewDataGModel.o: PViewDataGModel.cpp PViewDataGModel.h PViewData.h \
-  ../DataStr/List.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Geo/GModel.h \
+  ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
+  ../Geo/SBoundingBox3d.h ../Geo/GPoint.h ../Geo/SPoint2.h ../Geo/GEdge.h \
+  ../Geo/GEntity.h ../Geo/GVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h \
+  ../Geo/SPoint3.h ../Geo/SPoint2.h ../Geo/GFace.h ../Geo/GEntity.h \
+  ../Geo/GPoint.h ../Geo/GEdgeLoop.h ../Geo/GEdge.h ../Geo/SPoint2.h \
+  ../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h ../Geo/GEntity.h \
+  ../Geo/SBoundingBox3d.h ../Geo/MElement.h ../Common/GmshDefines.h \
+  ../Geo/MVertex.h ../Geo/SPoint3.h ../Geo/MEdge.h ../Geo/MVertex.h \
+  ../Geo/SVector3.h ../Geo/MFace.h ../Geo/MVertex.h ../Geo/SVector3.h \
+  ../Numeric/Numeric.h ../Numeric/NumericEmbedded.h ../Common/Message.h
+PViewDataGModelIO.o: PViewDataGModelIO.cpp ../Common/Message.h \
+  PViewDataGModel.h PViewData.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \
   ../Geo/GModel.h ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h \
   ../Geo/SPoint3.h ../Geo/SBoundingBox3d.h ../Geo/GPoint.h \
   ../Geo/SPoint2.h ../Geo/GEdge.h ../Geo/GEntity.h ../Geo/GVertex.h \
@@ -104,19 +116,6 @@ PViewDataGModel.o: PViewDataGModel.cpp PViewDataGModel.h PViewData.h \
   ../Geo/GFace.h ../Geo/GEntity.h ../Geo/GPoint.h ../Geo/GEdgeLoop.h \
   ../Geo/GEdge.h ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h \
   ../Geo/GRegion.h ../Geo/GEntity.h ../Geo/SBoundingBox3d.h \
-  ../Geo/MElement.h ../Common/GmshDefines.h ../Geo/MVertex.h \
-  ../Geo/SPoint3.h ../Geo/MEdge.h ../Geo/MVertex.h ../Geo/SVector3.h \
-  ../Geo/MFace.h ../Geo/MVertex.h ../Geo/SVector3.h ../Numeric/Numeric.h \
-  ../Numeric/NumericEmbedded.h ../Common/Message.h
-PViewDataGModelIO.o: PViewDataGModelIO.cpp ../Common/Message.h \
-  PViewDataGModel.h PViewData.h ../DataStr/List.h ../Geo/SBoundingBox3d.h \
-  ../Geo/SPoint3.h ../Geo/GModel.h ../Geo/GVertex.h ../Geo/GEntity.h \
-  ../Geo/Range.h ../Geo/SPoint3.h ../Geo/SBoundingBox3d.h ../Geo/GPoint.h \
-  ../Geo/SPoint2.h ../Geo/GEdge.h ../Geo/GEntity.h ../Geo/GVertex.h \
-  ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/SPoint3.h ../Geo/SPoint2.h \
-  ../Geo/GFace.h ../Geo/GEntity.h ../Geo/GPoint.h ../Geo/GEdgeLoop.h \
-  ../Geo/GEdge.h ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h \
-  ../Geo/GRegion.h ../Geo/GEntity.h ../Geo/SBoundingBox3d.h \
   ../Geo/MVertex.h ../Geo/SPoint3.h ../Geo/MElement.h \
   ../Common/GmshDefines.h ../Geo/MVertex.h ../Geo/MEdge.h \
   ../Geo/MVertex.h ../Geo/SVector3.h ../Geo/MFace.h ../Geo/MVertex.h \
@@ -126,15 +125,14 @@ PViewOptions.o: PViewOptions.cpp PViewOptions.h ColorTable.h \
   ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Common/Message.h
 adaptiveData.o: adaptiveData.cpp ../Plugin/Plugin.h ../Common/Options.h \
   ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \
-  ../Post/PViewData.h ../DataStr/List.h ../Geo/SBoundingBox3d.h \
-  ../Geo/SPoint3.h ../Post/PViewOptions.h ../Post/ColorTable.h \
-  ../Post/PViewDataList.h ../Post/PViewData.h ../Common/GmshMatrix.h \
-  adaptiveData.h
+  ../Geo/SPoint3.h ../Post/PViewDataList.h ../Post/PViewData.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../DataStr/List.h \
+  ../Common/GmshMatrix.h adaptiveData.h
 OctreePost.o: OctreePost.cpp ../Common/Octree.h \
   ../Common/OctreeInternals.h OctreePost.h ../DataStr/List.h PView.h \
-  PViewData.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h PViewOptions.h \
-  ColorTable.h PViewDataList.h PViewDataGModel.h ../Geo/GModel.h \
-  ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
+  ../Geo/SPoint3.h PViewDataList.h PViewData.h ../Geo/SBoundingBox3d.h \
+  ../Geo/SPoint3.h PViewDataGModel.h ../Geo/GModel.h ../Geo/GVertex.h \
+  ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
   ../Geo/SBoundingBox3d.h ../Geo/GPoint.h ../Geo/SPoint2.h ../Geo/GEdge.h \
   ../Geo/GEntity.h ../Geo/GVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h \
   ../Geo/SPoint3.h ../Geo/SPoint2.h ../Geo/GFace.h ../Geo/GEntity.h \
@@ -142,8 +140,9 @@ OctreePost.o: OctreePost.cpp ../Common/Octree.h \
   ../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h ../Geo/GEntity.h \
   ../Geo/SBoundingBox3d.h ../Numeric/Numeric.h \
   ../Numeric/NumericEmbedded.h ../Common/Message.h \
-  ../Common/ShapeFunctions.h ../Geo/MElement.h ../Common/GmshDefines.h \
-  ../Geo/MVertex.h ../Geo/SPoint3.h ../Geo/MEdge.h ../Geo/MVertex.h \
-  ../Geo/SVector3.h ../Geo/MFace.h ../Geo/MVertex.h ../Geo/SVector3.h
+  ../Common/ShapeFunctions.h ../Common/Message.h ../Geo/MElement.h \
+  ../Common/GmshDefines.h ../Geo/MVertex.h ../Geo/SPoint3.h \
+  ../Geo/MEdge.h ../Geo/MVertex.h ../Geo/SVector3.h ../Geo/MFace.h \
+  ../Geo/MVertex.h ../Geo/SVector3.h
 ColorTable.o: ColorTable.cpp ../Common/Message.h ColorTable.h \
   ../Common/Context.h ../Numeric/Numeric.h ../Numeric/NumericEmbedded.h
diff --git a/Post/PView.cpp b/Post/PView.cpp
index 91faa1824d19448871686ae8bdc45012ee5584fb..7a3f5f12cca5cc4bc315bbe2374b699a08365ca8 100644
--- a/Post/PView.cpp
+++ b/Post/PView.cpp
@@ -1,4 +1,4 @@
-// $Id: PView.cpp,v 1.27 2008-04-22 07:37:16 geuzaine Exp $
+// $Id: PView.cpp,v 1.28 2008-05-04 08:31:24 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -25,6 +25,8 @@
 #include <string.h>
 #include <algorithm>
 #include "PView.h"
+#include "PViewOptions.h"
+#include "PViewData.h"
 #include "PViewDataList.h"
 #include "VertexArray.h"
 #include "SmoothData.h"
@@ -126,7 +128,7 @@ PView::~PView()
       if(list[i]->getNum() == _aliasOf || list[i]->getAliasOf() == _aliasOf)
         return;
   
-  Msg(DEBUG, "Deleting data in View[%d] (unique num = %d)", _index, _num);
+  Msg::Debug("Deleting data in View[%d] (unique num = %d)", _index, _num);
   delete _data;
 }
 
diff --git a/Post/PView.h b/Post/PView.h
index fa5522ac9b87daf4feabf4fd674a7e57b955685b..b64f1b7cf05b7b6ebc3412f14abc8d197b1fb4b6 100644
--- a/Post/PView.h
+++ b/Post/PView.h
@@ -22,9 +22,10 @@
 
 #include <vector>
 #include <string>
-#include "PViewData.h"
-#include "PViewOptions.h"
+#include "SPoint3.h"
 
+class PViewData;
+class PViewOptions;
 class VertexArray;
 class smooth_normals;
 class GMSH_Post_Plugin;
diff --git a/Post/PViewData.cpp b/Post/PViewData.cpp
index 404b3cc36686ec5ed0db6555b8b42e889d00b1f0..50c3a95b3a85ef9c6aee9ea391d28830b06c0df5 100644
--- a/Post/PViewData.cpp
+++ b/Post/PViewData.cpp
@@ -1,4 +1,4 @@
-// $Id: PViewData.cpp,v 1.20 2008-04-28 10:11:00 geuzaine Exp $
+// $Id: PViewData.cpp,v 1.21 2008-05-04 08:31:24 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -23,6 +23,7 @@
 // 
 
 #include "PViewData.h"
+#include "List.h"
 #include "adaptiveData.h"
 #include "Numeric.h"
 #include "Message.h"
@@ -40,7 +41,7 @@ PViewData::~PViewData()
 bool PViewData::finalize()
 { 
   if(!_adaptive && _interpolation.size()){
-    Msg(INFO, "Initializing adaptive data %p interp size=%d",
+    Msg::Info("Initializing adaptive data %p interp size=%d",
 	this, _interpolation.size());
     _adaptive = new adaptiveData(this);
     _adaptive->initWithLowResolution(0);
@@ -57,26 +58,31 @@ bool PViewData::empty()
 void PViewData::getScalarValue(int step, int ent, int ele, int nod, double &val)
 {
   int numComp = getNumComponents(step, ent, ele);
-  std::vector<double> d(numComp);
-  for(int comp = 0; comp < numComp; comp++)
-    getValue(step, ent, ele, nod, comp, d[comp]);
-  val = ComputeScalarRep(numComp, &d[0]);
+  if(numComp == 1){
+    getValue(step, ent, ele, nod, 0, val);
+  }
+  else{
+    std::vector<double> d(numComp);
+    for(int comp = 0; comp < numComp; comp++)
+      getValue(step, ent, ele, nod, comp, d[comp]);
+    val = ComputeScalarRep(numComp, &d[0]);
+  }
 }
 
 void PViewData::setNode(int step, int ent, int ele, int nod, double x, double y, double z)
 {
-  Msg(GERROR, "Cannot change node coordinates in this view");
+  Msg::Error("Cannot change node coordinates in this view");
 }
 
 void PViewData::setValue(int step, int ent, int ele, int nod, int comp, double val)
 {
-  Msg(GERROR, "Cannot change field value in this view");
+  Msg::Error("Cannot change field value in this view");
 }
 
 void PViewData::setInterpolationScheme(int type, List_T *coef, List_T *pol, 
 				       List_T *coefGeo, List_T *polGeo)
 {
-  Msg(DEBUG, "Storing interpolation scheme %d in view %p", type, this);
+  Msg::Debug("Storing interpolation scheme %d in view %p", type, this);
   if(!type || !_interpolation[type].empty()) return;
   if(coef) _interpolation[type].push_back(coef);
   if(pol) _interpolation[type].push_back(pol);
@@ -95,17 +101,17 @@ int PViewData::getInterpolationScheme(int type, std::vector<List_T*> &p)
 
 void PViewData::smooth()
 {
-  Msg(GERROR, "Smoothing is not implemented for this type of data");
+  Msg::Error("Smoothing is not implemented for this type of data");
 }
 
 bool PViewData::combineTime(nameData &nd)
 { 
-  Msg(GERROR, "Combine time is not implemented for this type of data");
+  Msg::Error("Combine time is not implemented for this type of data");
   return false; 
 }
 
 bool PViewData::combineSpace(nameData &nd)
 { 
-  Msg(GERROR, "Combine space is not implemented for this type of data");
+  Msg::Error("Combine space is not implemented for this type of data");
   return false; 
 }
diff --git a/Post/PViewData.h b/Post/PViewData.h
index a7d4aaf7bc6fb9b853fff9e2c0e2527bde3e1e9a..db1bd9a8d87fff3ae1e07123a47f45b9ddc8b187 100644
--- a/Post/PViewData.h
+++ b/Post/PViewData.h
@@ -23,11 +23,11 @@
 #include <string>
 #include <vector>
 #include <map>
-#include "List.h"
 #include "SBoundingBox3d.h"
 
 #define VAL_INF 1.e200
 
+class List_T;
 class adaptiveData;
 class GModel;
 class nameData;
@@ -112,7 +112,7 @@ class PViewData {
   // Returns a scalar value (same as value for scalars, norm for
   // vectors, etc.) associated with the node-th node from the ele-th
   // element in the ent-th entity
-  virtual void getScalarValue(int step, int ent, int ele, int nod, double &val);
+  void getScalarValue(int step, int ent, int ele, int nod, double &val);
   // Returns the number of edges of the ele-th element in the ent-th
   // entity
   virtual int getNumEdges(int step, int ent, int ele) = 0;
diff --git a/Post/PViewDataGModel.cpp b/Post/PViewDataGModel.cpp
index 212589fa652530b9d3b5c12dc402ff57d9985ae7..b4f154513d9e1a1c049bbfd914e986ef01918174 100644
--- a/Post/PViewDataGModel.cpp
+++ b/Post/PViewDataGModel.cpp
@@ -1,4 +1,4 @@
-// $Id: PViewDataGModel.cpp,v 1.53 2008-04-22 07:37:16 geuzaine Exp $
+// $Id: PViewDataGModel.cpp,v 1.54 2008-05-04 08:31:24 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -44,17 +44,32 @@ bool PViewDataGModel::finalize()
   for(int step = 0; step < getNumTimeSteps(); step++){
     _steps[step]->setMin(VAL_INF);
     _steps[step]->setMax(-VAL_INF);
-    for(int ent = 0; ent < getNumEntities(step); ent++){
-      for(int ele = 0; ele < getNumElements(step, ent); ele++){
-	if(skipElement(step, ent, ele)) continue;
-	for(int nod = 0; nod < getNumNodes(step, ent, ele); nod++){
-	  double val;
-	  getScalarValue(step, ent, ele, nod, val);
+    if(_type == NodeData || _type == ElementData){
+      // treat these 2 special cases separately for maximum efficiency
+      int numComp = _steps[step]->getNumComponents();
+      for(int i = 0; i < _steps[step]->getNumData(); i++){
+	double *d = _steps[step]->getData(i);
+	if(d){
+	  double val = ComputeScalarRep(numComp, d);
 	  _steps[step]->setMin(std::min(_steps[step]->getMin(), val));
 	  _steps[step]->setMax(std::max(_steps[step]->getMax(), val));
 	}
       }
     }
+    else{
+      // general case (slower)
+      for(int ent = 0; ent < getNumEntities(step); ent++){
+	for(int ele = 0; ele < getNumElements(step, ent); ele++){
+	  if(skipElement(step, ent, ele)) continue;
+	  for(int nod = 0; nod < getNumNodes(step, ent, ele); nod++){
+	    double val;
+	    getScalarValue(step, ent, ele, nod, val);
+	    _steps[step]->setMin(std::min(_steps[step]->getMin(), val));
+	    _steps[step]->setMax(std::max(_steps[step]->getMax(), val));
+	  }
+	}
+      }
+    }
     _min = std::min(_min, _steps[step]->getMin());
     _max = std::max(_max, _steps[step]->getMax());
   }
@@ -291,7 +306,7 @@ int PViewDataGModel::getNumValues(int step, int ent, int ele)
     return getNumNodes(step, ent, ele) * getNumComponents(step, ent, ele);
   }
   else{
-    Msg(GERROR, "getNumValues should not be used on this type of view");
+    Msg::Error("getNumValues should not be used on this type of view");
     return 0;
   }
 }
@@ -304,7 +319,7 @@ void PViewDataGModel::getValue(int step, int ent, int ele, int idx, double &val)
     val = sd->getData(e->getNum())[idx];
   }
   else{
-    Msg(GERROR, "getValue(index) should not be used on this type of view");
+    Msg::Error("getValue(index) should not be used on this type of view");
   }
 }
 
diff --git a/Post/PViewDataGModelIO.cpp b/Post/PViewDataGModelIO.cpp
index 9a71fa5b3752f99be87b0125239ff5f22b163408..bbd30fb241167b7e205a88dd22018dcddb58981f 100644
--- a/Post/PViewDataGModelIO.cpp
+++ b/Post/PViewDataGModelIO.cpp
@@ -1,4 +1,4 @@
-// $Id: PViewDataGModelIO.cpp,v 1.44 2008-04-28 10:11:00 geuzaine Exp $
+// $Id: PViewDataGModelIO.cpp,v 1.45 2008-05-04 08:31:24 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -39,7 +39,7 @@ bool PViewDataGModel::addNodalData(int step, double time, int partition,
   
   int numEnt = _steps[step]->getModel()->getNumMeshVertices();
   if(nodalData.size() != numEnt * numComp){
-    Msg(GERROR, "adding nodal data with wrong number of entries (%d != %d)", 
+    Msg::Error("adding nodal data with wrong number of entries (%d != %d)", 
 	nodalData.size(), numEnt);
     return false;
   }
@@ -61,7 +61,7 @@ bool PViewDataGModel::readMSH(std::string fileName, int fileIndex, FILE *fp,
                               bool binary, bool swap, int step, double time, 
                               int partition, int numComp, int numEnt)
 {
-  Msg(INFO, "Reading step %d (time %g) partition %d: %d records", 
+  Msg::Info("Reading step %d (time %g) partition %d: %d records", 
       step, time, partition, numEnt);
 
   while(step >= (int)_steps.size())
@@ -79,6 +79,7 @@ bool PViewDataGModel::readMSH(std::string fileName, int fileIndex, FILE *fp,
 
   _steps[step]->resizeData(numEnt);
 
+  Msg::ResetProgressMeter();
   for(int i = 0; i < numEnt; i++){
     int num;
     if(binary){
@@ -108,6 +109,8 @@ bool PViewDataGModel::readMSH(std::string fileName, int fileIndex, FILE *fp,
       for(int j = 0; j < numComp * mult; j++)
         if(fscanf(fp, "%lf", &d[j]) != 1) return false;
     }
+    if(numEnt > 100000) 
+      Msg::ProgressMeter(i + 1, numEnt, "Reading data");
   }
 
   _partitions.insert(partition);
@@ -121,12 +124,12 @@ bool PViewDataGModel::writeMSH(std::string fileName, bool binary)
   if(_steps.empty()) return true;
 
   if(hasMultipleMeshes()){
-    Msg(GERROR, "Export not done for multi-mesh views");
+    Msg::Error("Export not done for multi-mesh views");
     return false;
   }
 
   if(_type != NodeData){
-    Msg(GERROR, "Can only export node-based datasets for now");
+    Msg::Error("Can only export node-based datasets for now");
     return false;
   }
 
@@ -139,7 +142,7 @@ bool PViewDataGModel::writeMSH(std::string fileName, bool binary)
   // append data
   FILE *fp = fopen(fileName.c_str(), binary ? "ab" : "a");
   if(!fp){
-    Msg(GERROR, "Unable to open file '%s'", fileName.c_str());
+    Msg::Error("Unable to open file '%s'", fileName.c_str());
     return false;
   }
 
@@ -156,7 +159,7 @@ bool PViewDataGModel::writeMSH(std::string fileName, bool binary)
         if(_steps[step]->getData(i)){
 	  MVertex *v = _steps[step]->getModel()->getMeshVertexByTag(i);
 	  if(!v){
-	    Msg(GERROR, "Unknown vertex %d in data", i);
+	    Msg::Error("Unknown vertex %d in data", i);
 	    return false;
 	  }
 	  int num = v->getIndex();
@@ -194,13 +197,13 @@ bool PViewDataGModel::readMED(std::string fileName, int fileIndex)
 {
   med_idt fid = MEDouvrir((char*)fileName.c_str(), MED_LECTURE);
   if(fid < 0) {
-    Msg(GERROR, "Unable to open file '%s'", fileName.c_str());
+    Msg::Error("Unable to open file '%s'", fileName.c_str());
     return false;
   }
   
   med_int numComp = MEDnChamp(fid, fileIndex + 1);
   if(numComp <= 0){
-    Msg(GERROR, "Could not get number of components for MED field");
+    Msg::Error("Could not get number of components for MED field");
     return false;
   }
 
@@ -210,17 +213,17 @@ bool PViewDataGModel::readMED(std::string fileName, int fileIndex)
   med_type_champ type;
   if(MEDchampInfo(fid, fileIndex + 1, name, &type, &compName[0], &compUnit[0], 
 		  numComp) < 0){
-    Msg(GERROR, "Could not get MED field info");
+    Msg::Error("Could not get MED field info");
     return false;
   }
 
-  Msg(INFO, "Reading %d-component field <<%s>>", numComp, name);
+  Msg::Info("Reading %d-component field <<%s>>", numComp, name);
   setName(name);
 
   int numCompMsh = 
     (numComp <= 1) ? 1 : (numComp <= 3) ? 3 : (numComp <= 9) ? 9 : numComp;
 
-  if(numCompMsh > 9) Msg(WARNING, "More than 9 components in field");
+  if(numCompMsh > 9) Msg::Warning("More than 9 components in field");
 
   // the ordering of the elements in the following lists is important:
   // it should match the ordering of the MSH element types (when
@@ -251,7 +254,7 @@ bool PViewDataGModel::readMED(std::string fileName, int fileIndex)
   }    
 
   if(numSteps < 1 || pairs.empty()){
-    Msg(GERROR, "Nothing to import from MED file");
+    Msg::Error("Nothing to import from MED file");
     return false;
   }
   else{
@@ -271,7 +274,7 @@ bool PViewDataGModel::readMED(std::string fileName, int fileIndex)
       med_booleen local;
       if(MEDpasdetempsInfo(fid, name, ent, ele, step + 1, &ngauss, &numdt, &numo,
 			   dtunit, &dt, meshName, &local, &numMeshes) < 0){
-	Msg(GERROR, "Could not read step info");
+	Msg::Error("Could not read step info");
 	return false;
       }
 
@@ -279,7 +282,7 @@ bool PViewDataGModel::readMED(std::string fileName, int fileIndex)
       if(!pair){
 	GModel *m = GModel::findByName(meshName);
 	if(!m){
-	  Msg(GERROR, "Could not find mesh <<%s>>", meshName);
+	  Msg::Error("Could not find mesh <<%s>>", meshName);
 	  return false;
 	}
 	while(step >= (int)_steps.size())
@@ -311,7 +314,7 @@ bool PViewDataGModel::readMED(std::string fileName, int fileIndex)
       if(MEDchampLire(fid, meshName, name, (unsigned char*)&val[0], MED_FULL_INTERLACE,
 		      MED_ALL, locname, profileName, MED_COMPACT, ent, ele, 
 		      numdt, numo) < 0){
-	Msg(GERROR, "Could not read field values");
+	Msg::Error("Could not read field values");
 	return false;
       }
 
@@ -329,7 +332,7 @@ bool PViewDataGModel::readMED(std::string fileName, int fileIndex)
 	  std::vector<med_float> wg(ngauss);
 	  if(MEDgaussLire(fid, &refcoo[0], &gscoo[0], &wg[0], MED_FULL_INTERLACE,
 			  locname) < 0){
-	    Msg(GERROR, "Could not read Gauss points");
+	    Msg::Error("Could not read Gauss points");
 	    return false;
 	  }
 	  // we should check that refcoo corresponds to our internal
@@ -348,7 +351,7 @@ bool PViewDataGModel::readMED(std::string fileName, int fileIndex)
 	if(n > 0){
 	  profile.resize(n);
 	  if(MEDprofilLire(fid, &profile[0], profileName) < 0){
-	    Msg(GERROR, "Could not read profile");
+	    Msg::Error("Could not read profile");
 	    return false;
 	  }
 	}
@@ -390,7 +393,7 @@ bool PViewDataGModel::readMED(std::string fileName, int fileIndex)
 	}
 	else{
 	  if(profile[i] == 0 || profile[i] > (int)tags.size()){
-	    Msg(GERROR, "Wrong index in profile");
+	    Msg::Error("Wrong index in profile");
 	    return false;
 	  }
 	  num = tags[profile[i] - 1];
@@ -409,7 +412,7 @@ bool PViewDataGModel::readMED(std::string fileName, int fileIndex)
   finalize();
 
   if(MEDfermer(fid) < 0){
-    Msg(GERROR, "Unable to close file '%s'", (char*)fileName.c_str());
+    Msg::Error("Unable to close file '%s'", (char*)fileName.c_str());
     return false;
   }
   return true;
@@ -420,12 +423,12 @@ bool PViewDataGModel::writeMED(std::string fileName)
   if(_steps.empty()) return true;
 
   if(hasMultipleMeshes()){
-    Msg(GERROR, "Export not done for multi-mesh views");
+    Msg::Error("Export not done for multi-mesh views");
     return false;
   }
 
   if(_type != NodeData){
-    Msg(GERROR, "Can only export node-based datasets for now");
+    Msg::Error("Can only export node-based datasets for now");
     return false;
   }
 
@@ -439,7 +442,7 @@ bool PViewDataGModel::writeMED(std::string fileName)
 
   med_idt fid = MEDouvrir((char*)fileName.c_str(), MED_LECTURE_AJOUT);
   if(fid < 0) {
-    Msg(GERROR, "Unable to open file '%s'", fileName.c_str());
+    Msg::Error("Unable to open file '%s'", fileName.c_str());
     return false;
   }
 
@@ -450,7 +453,7 @@ bool PViewDataGModel::writeMED(std::string fileName)
     if(_steps[0]->getData(i)){
       MVertex *v = _steps[0]->getModel()->getMeshVertexByTag(i);
       if(!v){
-	Msg(GERROR, "Unknown vertex %d in data", i);
+	Msg::Error("Unknown vertex %d in data", i);
 	return false;
       }
       profile.push_back(v->getIndex());
@@ -459,26 +462,26 @@ bool PViewDataGModel::writeMED(std::string fileName)
   }
 
   if(profile.empty()){
-    Msg(GERROR, "Nothing to save");
+    Msg::Error("Nothing to save");
     return false;
   }
 
   if(MEDprofilEcr(fid, &profile[0], (med_int)profile.size(), profileName) < 0){
-    Msg(GERROR, "Could not create MED profile");
+    Msg::Error("Could not create MED profile");
     return false;
   }
 
   int numComp = _steps[0]->getNumComponents();
   if(MEDchampCr(fid, fieldName, MED_FLOAT64, (char*)"unknown", (char*)"unknown",
 		(med_int)numComp) < 0){
-    Msg(GERROR, "Could not create MED field");
+    Msg::Error("Could not create MED field");
     return false;
   }
 
   med_int numNodes = MEDnEntMaa(fid, meshName, MED_COOR, MED_NOEUD, 
 				MED_NONE, (med_connectivite)0);
   if(numNodes <= 0){
-    Msg(GERROR, "Could not get valid number of nodes in mesh");
+    Msg::Error("Could not get valid number of nodes in mesh");
     return false;
   }
   for(unsigned int step = 0; step < _steps.size(); step++){
@@ -486,7 +489,7 @@ bool PViewDataGModel::writeMED(std::string fileName)
     for(int i = 0; i < _steps[step]->getNumData(); i++)
       if(_steps[step]->getData(i)) n++;
     if(n != profile.size() || numComp != _steps[step]->getNumComponents()){
-      Msg(GERROR, "Skipping incompatible step");
+      Msg::Error("Skipping incompatible step");
       continue;
     }
     double time = _steps[step]->getTime();
@@ -498,13 +501,13 @@ bool PViewDataGModel::writeMED(std::string fileName)
 		   MED_FULL_INTERLACE, numNodes, MED_NOGAUSS, MED_ALL,
 		   profileName, MED_COMPACT, MED_NOEUD, MED_NONE, (med_int)step,
 		   (char*)"unknown", time, MED_NONOR) < 0) {
-      Msg(GERROR, "Could not write MED field");
+      Msg::Error("Could not write MED field");
       return false;
     }
   }
   
   if(MEDfermer(fid) < 0){
-    Msg(GERROR, "Unable to close file '%s'", (char*)fileName.c_str());
+    Msg::Error("Unable to close file '%s'", (char*)fileName.c_str());
     return false;
   }
   return true;
@@ -514,14 +517,14 @@ bool PViewDataGModel::writeMED(std::string fileName)
 
 bool PViewDataGModel::readMED(std::string fileName, int fileIndex)
 {
-  Msg(GERROR, "Gmsh must be compiled with MED support to read '%s'", 
+  Msg::Error("Gmsh must be compiled with MED support to read '%s'", 
       fileName.c_str());
   return false;
 }
 
 bool PViewDataGModel::writeMED(std::string fileName)
 {
-  Msg(GERROR, "Gmsh must be compiled with MED support to write '%s'",
+  Msg::Error("Gmsh must be compiled with MED support to write '%s'",
       fileName.c_str());
   return false;
 }
diff --git a/Post/PViewDataIO.cpp b/Post/PViewDataIO.cpp
index d29ce6d6fa7f6191184558632b9db4b5c61e0fc2..823e2ea73323198f8c364138872770a7dca7045d 100644
--- a/Post/PViewDataIO.cpp
+++ b/Post/PViewDataIO.cpp
@@ -1,4 +1,4 @@
-// $Id: PViewDataIO.cpp,v 1.8 2008-04-02 20:00:38 geuzaine Exp $
+// $Id: PViewDataIO.cpp,v 1.9 2008-05-04 08:31:24 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -31,12 +31,12 @@ bool PViewData::writeSTL(std::string fileName)
 {
   FILE *fp = fopen(fileName.c_str(), "w");
   if(!fp){
-    Msg(GERROR, "Unable to open file '%s'", fileName.c_str());
+    Msg::Error("Unable to open file '%s'", fileName.c_str());
     return false;
   }
 
   if(!getNumTriangles() && !getNumQuadrangles()){
-    Msg(GERROR, "No surface elements to save");
+    Msg::Error("No surface elements to save");
     return false;
   }
 
@@ -89,7 +89,7 @@ bool PViewData::writeTXT(std::string fileName)
 {
   FILE *fp = fopen(fileName.c_str(), "w");
   if(!fp){
-    Msg(GERROR, "Unable to open file '%s'", fileName.c_str());
+    Msg::Error("Unable to open file '%s'", fileName.c_str());
     return false;
   }
 
@@ -119,18 +119,18 @@ bool PViewData::writeTXT(std::string fileName)
 
 bool PViewData::writePOS(std::string fileName, bool binary, bool parsed, bool append)
 { 
-  Msg(GERROR, "POS export not implemented for this view type");
+  Msg::Error("POS export not implemented for this view type");
   return false; 
 }
 
 bool PViewData::writeMSH(std::string fileName, bool binary)
 { 
-  Msg(GERROR, "MSH export not implemented for this view type");
+  Msg::Error("MSH export not implemented for this view type");
   return false; 
 }
 
 bool PViewData::writeMED(std::string fileName)
 {
-  Msg(GERROR, "MED export not implemented for this view type");
+  Msg::Error("MED export not implemented for this view type");
   return false; 
 }
diff --git a/Post/PViewDataList.cpp b/Post/PViewDataList.cpp
index 1f05060922645f862fb622f8241803acd5e494c6..e3f233d0064c956c29b1a5bf01a70d88dc966d5e 100644
--- a/Post/PViewDataList.cpp
+++ b/Post/PViewDataList.cpp
@@ -1,4 +1,4 @@
-// $Id: PViewDataList.cpp,v 1.23 2008-04-22 07:37:16 geuzaine Exp $
+// $Id: PViewDataList.cpp,v 1.24 2008-05-04 08:31:24 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -220,7 +220,7 @@ void PViewDataList::_stat(List_T *list, int nbcomp, int nbelm, int nbnod, int nb
   if(_interpolation.count(nbedg)){
     nbval = List_Nbr(_interpolation[nbedg][0]);
     if(nbval != nbcomp * nbnod)
-      Msg(INFO, "Adaptive view with %d values per element", nbval);
+      Msg::Info("Adaptive view with %d values per element", nbval);
   }
   
   int nb = List_Nbr(list) / nbelm;
@@ -664,7 +664,7 @@ bool PViewDataList::combineSpace(nameData &nd)
   int ts = nd.data[0]->getNumTimeSteps();
   for(unsigned int i = 1; i < nd.data.size(); i++) {
     if(!nd.data[i]->empty() && nd.data[i]->getNumTimeSteps() != ts){
-      Msg(GERROR, "Cannot combine views having different number of time steps");
+      Msg::Error("Cannot combine views having different number of time steps");
       return false;
     }
   }
@@ -672,7 +672,7 @@ bool PViewDataList::combineSpace(nameData &nd)
   for(unsigned int i = 0; i < nd.data.size(); i++) {
     PViewDataList *l = dynamic_cast<PViewDataList*>(nd.data[i]);
     if(!l){
-      Msg(GERROR, "Cannot combine hybrid data");
+      Msg::Error("Cannot combine hybrid data");
       return false;
     }
     // merge elememts
@@ -769,7 +769,7 @@ void PViewDataList::getRawData(int type, List_T **l, int **ne, int *nc, int *nn)
   case 21: *l = SY; *ne = &NbSY; *nc = 1; *nn = 5; break;
   case 22: *l = VY; *ne = &NbVY; *nc = 3; *nn = 5; break;
   case 23: *l = TY; *ne = &NbTY; *nc = 9; *nn = 5; break;
-  default: Msg(GERROR, "Wrong type in PViewDataList"); break;
+  default: Msg::Error("Wrong type in PViewDataList"); break;
   }
 }
 
@@ -781,7 +781,7 @@ bool PViewDataList::combineTime(nameData &nd)
   for(unsigned int i = 0; i < nd.data.size(); i++){
     data[i] = dynamic_cast<PViewDataList*>(nd.data[i]);
     if(!data[i]){
-      Msg(GERROR, "Cannot combine hybrid data");
+      Msg::Error("Cannot combine hybrid data");
       return false;
     }
   }
diff --git a/Post/PViewDataListIO.cpp b/Post/PViewDataListIO.cpp
index 40d7f35d4215f009866f93613f4d62f5e10dc9b8..5e139135589b379dac7af87fe98468de1ae5c27a 100644
--- a/Post/PViewDataListIO.cpp
+++ b/Post/PViewDataListIO.cpp
@@ -1,4 +1,4 @@
-// $Id: PViewDataListIO.cpp,v 1.19 2008-04-06 07:51:37 geuzaine Exp $
+// $Id: PViewDataListIO.cpp,v 1.20 2008-05-04 08:31:24 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -37,39 +37,39 @@ bool PViewDataList::readPOS(FILE *fp, double version, int format, int size)
   int t2l, t3l;
 
   if(version <= 1.0) {
-    Msg(DEBUG, "Detected post-processing view format <= 1.0");
+    Msg::Debug("Detected post-processing view format <= 1.0");
     if(!fscanf(fp, "%s %d %d %d %d %d %d %d %d %d %d %d %d %d\n",
                name, &NbTimeStep, &NbSP, &NbVP, &NbTP, &NbSL, &NbVL, &NbTL,
                &NbST, &NbVT, &NbTT, &NbSS, &NbVS, &NbTS)){
-      Msg(GERROR, "Read error");
+      Msg::Error("Read error");
       return false;
     }
     NbT2 = t2l = NbT3 = t3l = 0;
   }
   else if(version == 1.1) {
-    Msg(DEBUG, "Detected post-processing view format 1.1");
+    Msg::Debug("Detected post-processing view format 1.1");
     if(!fscanf(fp, "%s %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d\n",
                name, &NbTimeStep, &NbSP, &NbVP, &NbTP, &NbSL, &NbVL, &NbTL, 
                &NbST, &NbVT, &NbTT, &NbSS, &NbVS, &NbTS, &NbT2, &t2l, &NbT3,
                &t3l)){
-      Msg(GERROR, "Read error");
+      Msg::Error("Read error");
       return false;
     }
   }
   else if(version == 1.2 || version == 1.3) {
-    Msg(DEBUG, "Detected post-processing view format %g", version);
+    Msg::Debug("Detected post-processing view format %g", version);
     if(!fscanf(fp, "%s %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d "
                "%d %d %d %d %d %d %d %d %d %d %d %d %d\n",
                name, &NbTimeStep, &NbSP, &NbVP, &NbTP, &NbSL, &NbVL, &NbTL,
                &NbST, &NbVT, &NbTT, &NbSQ, &NbVQ, &NbTQ, &NbSS, &NbVS, &NbTS, 
                &NbSH, &NbVH, &NbTH, &NbSI, &NbVI, &NbTI, &NbSY, &NbVY, &NbTY,
                &NbT2, &t2l, &NbT3, &t3l)){
-      Msg(GERROR, "Read error");
+      Msg::Error("Read error");
       return false;
     }
   }
   else if(version == 1.4) {
-    Msg(DEBUG, "Detected post-processing view format 1.4");
+    Msg::Debug("Detected post-processing view format 1.4");
     if(!fscanf(fp, "%s %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d "
                "%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d "
                "%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d\n",
@@ -79,12 +79,12 @@ bool PViewDataList::readPOS(FILE *fp, double version, int format, int size)
                &NbSL2, &NbVL2, &NbTL2, &NbST2, &NbVT2, &NbTT2, &NbSQ2, &NbVQ2, 
                &NbTQ2, &NbSS2, &NbVS2, &NbTS2, &NbSH2, &NbVH2, &NbTH2, &NbSI2, 
                &NbVI2, &NbTI2, &NbSY2, &NbVY2, &NbTY2, &NbT2, &t2l, &NbT3, &t3l)){
-      Msg(GERROR, "Read error");
+      Msg::Error("Read error");
       return false;
     }
   }
   else {
-    Msg(GERROR, "Unknown post-processing file format (version %g)", version);
+    Msg::Error("Unknown post-processing file format (version %g)", version);
     return false;
   }
   
@@ -96,11 +96,11 @@ bool PViewDataList::readPOS(FILE *fp, double version, int format, int size)
   if(format == LIST_FORMAT_BINARY) {
     int testone;
     if(!fread(&testone, sizeof(int), 1, fp)){
-      Msg(GERROR, "Read error");
+      Msg::Error("Read error");
       return false;
     }
     if(testone != 1) {
-      Msg(INFO, "Swapping bytes from binary file");
+      Msg::Info("Swapping bytes from binary file");
       swap = 1;
     }
   }
@@ -207,7 +207,7 @@ bool PViewDataList::readPOS(FILE *fp, double version, int format, int size)
   else
     T3C = List_CreateFromFile(t3l, 100, sizeof(char), fp, format, swap);
   
-  Msg(DEBUG,
+  Msg::Debug(
       "Read View '%s' (%d TimeSteps): "
       "SP(%d/%d) VP(%d/%d) TP(%d/%d) "
       "SL(%d/%d) VL(%d/%d) TL(%d/%d) "
@@ -321,7 +321,7 @@ bool PViewDataList::writePOS(std::string fileName, bool binary, bool parsed, boo
   FILE *fp = fopen(fileName.c_str(), 
                    append ? (binary ? "ab" : "a") : (binary ? "wb" : "w"));
   if(!fp){
-    Msg(GERROR, "Unable to open file '%s'", fileName.c_str());
+    Msg::Error("Unable to open file '%s'", fileName.c_str());
     return false;
   }
 
@@ -351,7 +351,7 @@ bool PViewDataList::writePOS(std::string fileName, bool binary, bool parsed, boo
     if(binary) {
       int one = 1;
       if(!fwrite(&one, sizeof(int), 1, fp)){
-        Msg(GERROR, "Write error");
+        Msg::Error("Write error");
         return false;
       }
     }
@@ -497,7 +497,7 @@ static void writeElementsMSH(FILE *fp, int nbelm, List_T *list,
       pVertex n(x[j], y[j], z[j]);
       std::set<pVertex, pVertexLessThan>::iterator it = nodes->find(n);
       if(it == nodes->end()){
-        Msg(GERROR, "Unknown node in element");
+        Msg::Error("Unknown node in element");
         return;
       }
       else{
@@ -513,11 +513,11 @@ bool PViewDataList::writeMSH(std::string fileName, bool binary)
 {
   FILE *fp = fopen(fileName.c_str(), "w");
   if(!fp){
-    Msg(GERROR, "Unable to open file '%s'", fileName.c_str());
+    Msg::Error("Unable to open file '%s'", fileName.c_str());
     return false;
   }
 
-  if(binary) Msg(WARNING, "Binary write not implemented yet");
+  if(binary) Msg::Warning("Binary write not implemented yet");
 
   std::set<pVertex, pVertexLessThan> nodes;
   int numelm = 0;
diff --git a/Post/PViewIO.cpp b/Post/PViewIO.cpp
index cbe29ce1b09562f63e35b9171d937e247432cf23..00b8ae99d69746e74ae09fe137c78b09e9968a35 100644
--- a/Post/PViewIO.cpp
+++ b/Post/PViewIO.cpp
@@ -1,4 +1,4 @@
-// $Id: PViewIO.cpp,v 1.5 2008-04-06 07:51:37 geuzaine Exp $
+// $Id: PViewIO.cpp,v 1.6 2008-05-04 08:31:24 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -32,7 +32,7 @@ bool PView::readPOS(std::string fileName, int fileIndex)
 {
   FILE *fp = fopen(fileName.c_str(), "rb");
   if(!fp){
-    Msg(GERROR, "Unable to open file '%s'", fileName.c_str());
+    Msg::Error("Unable to open file '%s'", fileName.c_str());
     return false;
   }
 
@@ -53,17 +53,17 @@ bool PView::readPOS(std::string fileName, int fileIndex)
     if(!strncmp(&str[1], "PostFormat", 10)) {
 
       if(!fscanf(fp, "%lf %d %d\n", &version, &format, &size)){
-        Msg(GERROR, "Read error");
+        Msg::Error("Read error");
         return false;
       }
       if(version < 1.0) {
-        Msg(GERROR, "Post-processing file too old (ver. %g < 1.0)", version);
+        Msg::Error("Post-processing file too old (ver. %g < 1.0)", version);
         return false;
       }
       if(size == sizeof(double))
-        Msg(DEBUG, "Data is in double precision format (size==%d)", size);
+        Msg::Debug("Data is in double precision format (size==%d)", size);
       else {
-        Msg(GERROR, "Unknown data size (%d) in post-processing file", size);
+        Msg::Error("Unknown data size (%d) in post-processing file", size);
         return false;
       }
       if(format == 0)
@@ -71,7 +71,7 @@ bool PView::readPOS(std::string fileName, int fileIndex)
       else if(format == 1)
         format = LIST_FORMAT_BINARY;
       else {
-        Msg(GERROR, "Unknown format for view");
+        Msg::Error("Unknown format for view");
         return false;
       }
 
@@ -82,7 +82,7 @@ bool PView::readPOS(std::string fileName, int fileIndex)
       if(fileIndex < 0 || fileIndex == index){
         PViewDataList *d = new PViewDataList(false);
         if(!d->readPOS(fp, version, format, size)){
-          Msg(GERROR, "Could not read data in list format");
+          Msg::Error("Could not read data in list format");
           delete d;
           return false;
         }
@@ -111,7 +111,7 @@ bool PView::readMSH(std::string fileName, int fileIndex)
 {
   FILE *fp = fopen(fileName.c_str(), "rb");
   if(!fp){
-    Msg(GERROR, "Unable to open file '%s'", fileName.c_str());
+    Msg::Error("Unable to open file '%s'", fileName.c_str());
     return false;
   }
 
@@ -136,12 +136,12 @@ bool PView::readMSH(std::string fileName, int fileIndex)
       if(sscanf(str, "%lf %d %d", &version, &format, &size) != 3) return false;
       if(format){
         binary = true;
-        Msg(INFO, "Mesh is in binary format");
+        Msg::Info("Mesh is in binary format");
         int one;
         if(fread(&one, sizeof(int), 1, fp) != 1) return 0;
         if(one != 1){
           swap = true;
-          Msg(INFO, "Swapping bytes from binary file");
+          Msg::Info("Swapping bytes from binary file");
         }
       }
     }
@@ -206,7 +206,7 @@ bool PView::readMSH(std::string fileName, int fileIndex)
 	if(create) d = new PViewDataGModel(type);
         if(!d->readMSH(fileName, fileIndex, fp, binary, swap, timeStep, 
                        time, partition, numComp, numEnt)){
-          Msg(GERROR, "Could not read data in msh file");
+          Msg::Error("Could not read data in msh file");
           if(create) delete d;
           return false;
         }
@@ -239,14 +239,14 @@ bool PView::readMED(std::string fileName, int fileIndex)
 {
   med_idt fid = MEDouvrir((char*)fileName.c_str(), MED_LECTURE);
   if(fid < 0) {
-    Msg(GERROR, "Unable to open file '%s'", fileName.c_str());
+    Msg::Error("Unable to open file '%s'", fileName.c_str());
     return false;
   }
   
   med_int numFields = MEDnChamp(fid, 0);
 
   if(MEDfermer(fid) < 0){
-    Msg(GERROR, "Unable to close file '%s'", (char*)fileName.c_str());
+    Msg::Error("Unable to close file '%s'", (char*)fileName.c_str());
     return false;
   }
 
@@ -254,7 +254,7 @@ bool PView::readMED(std::string fileName, int fileIndex)
     if(fileIndex < 0 || index == fileIndex){
       PViewDataGModel *d = new PViewDataGModel();
       if(!d->readMED(fileName, index)){
-	Msg(GERROR, "Could not read data in MED file");
+	Msg::Error("Could not read data in MED file");
 	delete d;
 	return false;
       }
@@ -273,7 +273,7 @@ bool PView::readMED(std::string fileName, int fileIndex)
 
 bool PView::readMED(std::string fileName, int fileIndex)
 {
-  Msg(GERROR, "Gmsh must be compiled with MED support to read '%s'", 
+  Msg::Error("Gmsh must be compiled with MED support to read '%s'", 
       fileName.c_str());
   return false;
 }
@@ -282,7 +282,7 @@ bool PView::readMED(std::string fileName, int fileIndex)
 
 bool PView::write(std::string fileName, int format, bool append)
 {
-  Msg(STATUS2, "Writing '%s'", fileName.c_str());
+  Msg::Status(2, true, "Writing '%s'", fileName.c_str());
   
   bool ret;
   switch(format){
@@ -293,9 +293,9 @@ bool PView::write(std::string fileName, int format, bool append)
   case 4: ret = _data->writeTXT(fileName); break;
   case 5: ret = _data->writeMSH(fileName); break;
   case 6: ret = _data->writeMED(fileName); break;
-  default: ret = false; Msg(GERROR, "Unknown view format %d", format); break;
+  default: ret = false; Msg::Error("Unknown view format %d", format); break;
   }
   
-  if(ret) Msg(STATUS2, "Wrote '%s'", fileName.c_str());
+  if(ret) Msg::Status(2, true, "Wrote '%s'", fileName.c_str());
   return ret;
 }
diff --git a/Post/PViewOptions.cpp b/Post/PViewOptions.cpp
index a77154b2960a3f8933f118e82e4298cd768633ae..4bc96cf9d55090619f22538048908c667c084a6a 100644
--- a/Post/PViewOptions.cpp
+++ b/Post/PViewOptions.cpp
@@ -1,4 +1,4 @@
-// $Id: PViewOptions.cpp,v 1.20 2008-03-20 11:44:15 geuzaine Exp $
+// $Id: PViewOptions.cpp,v 1.21 2008-05-04 08:31:24 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -124,7 +124,7 @@ void PViewOptions::createGeneralRaise()
   for(int i = 0; i < 3; i++) {
     if(strlen(expr[i])) {
       if(!(GenRaise_f[i] = evaluator_create(expr[i])))
-        Msg(GERROR, "Invalid expression '%s'", expr[i]);
+        Msg::Error("Invalid expression '%s'", expr[i]);
     }
   }
 #else
@@ -139,7 +139,7 @@ void PViewOptions::createGeneralRaise()
     else if(!strcmp(expr[i], "v7")) GenRaise_f[i] = (void*)7;
     else if(!strcmp(expr[i], "v8")) GenRaise_f[i] = (void*)8;
     else if(strlen(expr[i])) {
-      Msg(GERROR, "Invalid expression '%s'", expr[i]);
+      Msg::Error("Invalid expression '%s'", expr[i]);
       return;
     }
   }
diff --git a/Post/adaptiveData.cpp b/Post/adaptiveData.cpp
index 032af26d2a7080e9922f1c37a85c5d1c8ddf87a5..70cda0048e980d91f4b7ca0c874d027d646c4f94 100644
--- a/Post/adaptiveData.cpp
+++ b/Post/adaptiveData.cpp
@@ -854,11 +854,11 @@ void adaptiveElements<T>::initWithLowResolution(PViewData *data, int step)
       if(data->skipElement(step, ent, ele) ||
 	 data->getNumEdges(step, ent, ele) != T::numEdges) continue;
       if(numNodes != data->getNumNodes(step, ent, ele)){
-	Msg(GERROR, "Wrong number of nodes (%d) in element %d", numNodes, ele);
+	Msg::Error("Wrong number of nodes (%d) in element %d", numNodes, ele);
 	continue;
       }
       if(numVal != data->getNumValues(step, ent, ele)){
-	Msg(GERROR, "Wrong number of values (%d) in element %d", numVal, ele);
+	Msg::Error("Wrong number of values (%d) in element %d", numVal, ele);
 	continue;
       }
       for(int nod = 0; nod < numNodes; nod++){
@@ -898,7 +898,7 @@ template <class T>
 void adaptiveElements<T>::changeResolution(int level, double tol, GMSH_Post_Plugin *plug)
 {
   if(!_val){
-    Msg(GERROR, "Trying to change resolution in wrong state");
+    Msg::Error("Trying to change resolution in wrong state");
     return;
   }
 
diff --git a/configure b/configure
index 52fe03bcaca0a06b1dcdb89ebf680d1f4ee26d04..f8fdde7c237d34ef249fe46ceb8c6645cfad9a86 100755
--- a/configure
+++ b/configure
@@ -1267,7 +1267,6 @@ Optional Features:
   --enable-gui            build the graphical user interface (default=yes)
   --enable-post           build the post-processing module (default=yes)
   --enable-cygwin         use the Cygwin library on Windows (default=no)
-  --enable-parallel       enable parallel version (default=no)
   --enable-jpeg           enable JPEG support (default=yes)
   --enable-zlib           enable ZLIB support (default=yes)
   --enable-png            enable PNG support (default=yes)
@@ -1848,11 +1847,6 @@ if test "${enable_cygwin+set}" = set; then
   enableval=$enable_cygwin;
 fi
 
-# Check whether --enable-parallel was given.
-if test "${enable_parallel+set}" = set; then
-  enableval=$enable_parallel;
-fi
-
 # Check whether --enable-jpeg was given.
 if test "${enable_jpeg+set}" = set; then
   enableval=$enable_jpeg;
@@ -3656,10 +3650,10 @@ esac
 
 if test "x$enable_gui" != "xno"; then
 
-  GMSH_DIRS="Common DataStr Geo Mesh Post Numeric Parallel Parser Plugin Graphics Fltk"
+  GMSH_DIRS="Common DataStr Geo Mesh Post Numeric Parser Plugin Graphics Fltk"
   GMSH_LIBS="-Llib -lGmshFltk -lGmshParser -lGmshGraphics -lGmshPlugin"
   GMSH_LIBS="${GMSH_LIBS} -lGmshMesh -lGmshGeo -lGmshPost -lGmshCommon"
-  GMSH_LIBS="${GMSH_LIBS} -lGmshDataStr -lGmshNumeric -lGmshParallel"
+  GMSH_LIBS="${GMSH_LIBS} -lGmshDataStr -lGmshNumeric"
   FLAGS="-DHAVE_FLTK ${FLAGS}"
 
   if test "x${FLTK_PREFIX}" != "x" ; then
@@ -4118,15 +4112,15 @@ fi
 else
 
   if test "x$enable_post" != "xno"; then
-    GMSH_DIRS="Common DataStr Geo Mesh Post Numeric Parallel Parser Plugin Box"
-    GMSH_LIBS="-Llib Box/Main.o -lGmshBox -lGmshParser -lGmshPlugin"
+    GMSH_DIRS="Common DataStr Geo Mesh Post Numeric Parser Plugin"
+    GMSH_LIBS="-Llib Common/Main.o -lGmshParser -lGmshPlugin"
     GMSH_LIBS="${GMSH_LIBS} -lGmshGeo -lGmshMesh -lGmshPost -lGmshCommon"
-    GMSH_LIBS="${GMSH_LIBS} -lGmshDataStr -lGmshNumeric -lGmshParallel"
+    GMSH_LIBS="${GMSH_LIBS} -lGmshDataStr -lGmshNumeric"
   else
-    GMSH_DIRS="Common DataStr Geo Mesh Numeric Parallel Parser Box"
-    GMSH_LIBS="-Llib Box/Main.o -lGmshBox -lGmshParser"
+    GMSH_DIRS="Common DataStr Geo Mesh Numeric Parser"
+    GMSH_LIBS="-Llib Common/Main.o -lGmshParser"
     GMSH_LIBS="${GMSH_LIBS} -lGmshGeo -lGmshMesh -lGmshCommon"
-    GMSH_LIBS="${GMSH_LIBS} -lGmshDataStr -lGmshNumeric -lGmshParallel"
+    GMSH_LIBS="${GMSH_LIBS} -lGmshDataStr -lGmshNumeric"
     FLAGS="-DHAVE_NO_POST ${FLAGS}"
   fi
 
@@ -5796,10 +5790,6 @@ if test "x${ZLIB}" = "xyes"; then
   fi
 fi
 
-if test "x$enable_parallel" = "xyes"; then
-  FLAGS="-DHAVE_PARALLEL ${FLAGS}"
-fi
-
 GMSH_LIBS="${GMSH_LIBS} -lm"
 
 case "$UNAME" in
diff --git a/configure.in b/configure.in
index c3ea5abf621907a6604520f2698989b388e2cc3b..5fb5ae6b68129915a5abe541f23fa216dbd0fe2f 100644
--- a/configure.in
+++ b/configure.in
@@ -1,4 +1,4 @@
-dnl $Id: configure.in,v 1.155 2008-04-29 19:12:38 geuzaine Exp $
+dnl $Id: configure.in,v 1.156 2008-05-04 08:31:10 geuzaine Exp $
 dnl
 dnl Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 dnl
@@ -95,9 +95,6 @@ AC_ARG_ENABLE(post,
 AC_ARG_ENABLE(cygwin,
               AC_HELP_STRING([--enable-cygwin],
                              [use the Cygwin library on Windows (default=no)]))
-AC_ARG_ENABLE(parallel,
-              AC_HELP_STRING([--enable-parallel],
-                             [enable parallel version (default=no)]))
 AC_ARG_ENABLE(jpeg,
               AC_HELP_STRING([--enable-jpeg],
                              [enable JPEG support (default=yes)]))
@@ -223,13 +220,13 @@ case "$UNAME" in
     ;;
 esac
 
-dnl Choose blackbox or GUI version
+dnl Choose to build the GUI or the batch version
 if test "x$enable_gui" != "xno"; then
 
-  GMSH_DIRS="Common DataStr Geo Mesh Post Numeric Parallel Parser Plugin Graphics Fltk"
+  GMSH_DIRS="Common DataStr Geo Mesh Post Numeric Parser Plugin Graphics Fltk"
   GMSH_LIBS="-Llib -lGmshFltk -lGmshParser -lGmshGraphics -lGmshPlugin"
   GMSH_LIBS="${GMSH_LIBS} -lGmshMesh -lGmshGeo -lGmshPost -lGmshCommon"
-  GMSH_LIBS="${GMSH_LIBS} -lGmshDataStr -lGmshNumeric -lGmshParallel"
+  GMSH_LIBS="${GMSH_LIBS} -lGmshDataStr -lGmshNumeric"
   FLAGS="-DHAVE_FLTK ${FLAGS}"
 
   if test "x${FLTK_PREFIX}" != "x" ; then
@@ -356,15 +353,15 @@ if test "x$enable_gui" != "xno"; then
 else
 
   if test "x$enable_post" != "xno"; then
-    GMSH_DIRS="Common DataStr Geo Mesh Post Numeric Parallel Parser Plugin Box"
-    GMSH_LIBS="-Llib Box/Main.o -lGmshBox -lGmshParser -lGmshPlugin"
+    GMSH_DIRS="Common DataStr Geo Mesh Post Numeric Parser Plugin"
+    GMSH_LIBS="-Llib Common/Main.o -lGmshParser -lGmshPlugin"
     GMSH_LIBS="${GMSH_LIBS} -lGmshGeo -lGmshMesh -lGmshPost -lGmshCommon"
-    GMSH_LIBS="${GMSH_LIBS} -lGmshDataStr -lGmshNumeric -lGmshParallel"
+    GMSH_LIBS="${GMSH_LIBS} -lGmshDataStr -lGmshNumeric"
   else
-    GMSH_DIRS="Common DataStr Geo Mesh Numeric Parallel Parser Box"
-    GMSH_LIBS="-Llib Box/Main.o -lGmshBox -lGmshParser"
+    GMSH_DIRS="Common DataStr Geo Mesh Numeric Parser"
+    GMSH_LIBS="-Llib Common/Main.o -lGmshParser"
     GMSH_LIBS="${GMSH_LIBS} -lGmshGeo -lGmshMesh -lGmshCommon"
-    GMSH_LIBS="${GMSH_LIBS} -lGmshDataStr -lGmshNumeric -lGmshParallel"
+    GMSH_LIBS="${GMSH_LIBS} -lGmshDataStr -lGmshNumeric"
     FLAGS="-DHAVE_NO_POST ${FLAGS}"
   fi
 
@@ -736,11 +733,6 @@ if test "x${ZLIB}" = "xyes"; then
   fi
 fi 
 
-dnl Check if we should build the parallel version
-if test "x$enable_parallel" = "xyes"; then
-  FLAGS="-DHAVE_PARALLEL ${FLAGS}"
-fi
-
 dnl Finish link line
 GMSH_LIBS="${GMSH_LIBS} -lm"
 
diff --git a/contrib/NR/nrutil.cpp b/contrib/NR/nrutil.cpp
index 627300c37c60b722d6887fd3b137ee0804abb674..1aad573de9e4e3a73435848633cb6829237da479 100644
--- a/contrib/NR/nrutil.cpp
+++ b/contrib/NR/nrutil.cpp
@@ -12,7 +12,7 @@
 void nrerror(char error_text[])
 /* Numerical Recipes standard error handler */
 {
-  Msg(GERROR, "%s", error_text);
+  Msg::Error("%s", error_text);
   /*
 	fprintf(stderr,"Numerical Recipes run-time error...\n");
 	fprintf(stderr,"%s\n",error_text);
diff --git a/contrib/Netgen/nglib_addon.cpp b/contrib/Netgen/nglib_addon.cpp
index 391e03601280582e3ceff488fe17f543767cf34d..739a02881240dd3032114c18c98d8e352564a1ab 100644
--- a/contrib/Netgen/nglib_addon.cpp
+++ b/contrib/Netgen/nglib_addon.cpp
@@ -31,9 +31,9 @@ class mystreambuf: public streambuf
     }
     else{
       if(!strncmp(txt, "ERROR", 5))
-	Msg(FATAL, txt);
+	Msg::Fatal(txt);
       else
-	Msg(INFO, txt);
+	Msg::Info(txt);
     }
     index = 0; 
     return 0; 
diff --git a/doc/TODO b/doc/TODO
index 31efa1c58225b789376832e54507291db53d2262..16930f38a736bd28778bb02d260cd725f214b125 100644
--- a/doc/TODO
+++ b/doc/TODO
@@ -1,4 +1,34 @@
-$Id: TODO,v 1.70 2008-04-18 16:40:29 geuzaine Exp $
+$Id: TODO,v 1.71 2008-05-04 08:31:24 geuzaine Exp $
+
+********************************************************************
+
+Streamline OpenFile to deal with multiple models: basically, we need 3
+functions: NewModel (create a new model and add it to the model list,
+and make it the current model), Merge(Merge CAD or mesh data in the
+current model, or create post-processing data associated with the
+current model) and Clear(Destroys all models and post-processing
+views).
+
+main() always creates an initial empty model. Thus
+
+"gmsh a b c" == NewModel() Merge(a) Merge(b) Merge(c)
+
+"gmsh a b -new c" == NewModel() Merge(a) Merge(b) NewModel() Merge(c)
+
+File->Open(a) == Clear() NewModel() Merge(a) ?
+
+File->Merge(a) == Merge(a)
+
+Or should we just bite the bullet and follow what all other software
+tools do, i.e., if no input file is given present a File->New or Open
+dialog and refuse to continue until a model is given...
+
+********************************************************************
+
+Decide what to do with global parser variables. Should we clear them
+when we open a new file? +: fixes annoying persistance when changing
+.geo files and reloading them; -: cannot use -string "aa=1;" to change
+global vars from command line.
 
 ********************************************************************
 
@@ -107,14 +137,6 @@ add Mesh>Edit>Change orientation>Lines & Surfaces
 
 ********************************************************************
 
-add option to fl_beep() when mesh is done
-
-********************************************************************
-
-add warning+error counter/buffer (display counter/buffer on Exit())
-
-********************************************************************
-
 implement better algo to determine which axes to draw
 (cf. mathematica)
 
@@ -138,11 +160,6 @@ can draw millions of spheres)
 
 ********************************************************************
 
-add a min_recursion option for adaptive views (to force at least a 
-certain number of subdivisions)
-
-********************************************************************
-
 add option to cutmesh to cap the mesh instead of displaying "whole"
 elements
 
@@ -174,10 +191,6 @@ to display an image in the background
 
 ********************************************************************
 
-Add a way to draw arrows in annotations?
-
-********************************************************************
-
 keep a table (stack) with the N last file positions when add_infile()
 is called; we could then easily implement a simple (but real) UNDO
 strategy
diff --git a/doc/VERSIONS b/doc/VERSIONS
index fec01d1b9312bb26fda4d54c75c69294aaeca3d7..2422c2aeee19a9f741b7c4491a6183cb8b1767af 100644
--- a/doc/VERSIONS
+++ b/doc/VERSIONS
@@ -1,4 +1,6 @@
-$Id: VERSIONS,v 1.406 2008-04-18 20:54:01 geuzaine Exp $
+$Id: VERSIONS,v 1.407 2008-05-04 08:31:24 geuzaine Exp $
+
+2.2.1 (xxx): various small improvements and bug fixes.
 
 2.2.0 (Apr 19, 2008): new model-based post-processing backend; added
 MED I/O for mesh and post-processing; fixed BDF vertex ordering for
diff --git a/doc/texinfo/opt_general.texi b/doc/texinfo/opt_general.texi
index 620a4ad2c5e48bafd79b45f8dce231076d34d573..e2562a8fdd289e9d93e744bc4d4e2b93244eefbe 100644
--- a/doc/texinfo/opt_general.texi
+++ b/doc/texinfo/opt_general.texi
@@ -384,6 +384,26 @@ Draw simplified model while rotating, panning and zooming@*
 Default value: @code{0}@*
 Saved in: @code{General.OptionsFileName}
 
+@item General.FieldPositionX
+Horizontal position (in pixels) of the upper left corner of the field window@*
+Default value: @code{650}@*
+Saved in: @code{General.SessionFileName}
+
+@item General.FieldPositionY
+Vertical position (in pixels) of the upper left corner of the field window@*
+Default value: @code{550}@*
+Saved in: @code{General.SessionFileName}
+
+@item General.FieldHeight
+Height (in pixels) of the field window@*
+Default value: @code{300}@*
+Saved in: @code{General.SessionFileName}
+
+@item General.FieldWidth
+Width (in pixels) of the field window@*
+Default value: @code{300}@*
+Saved in: @code{General.SessionFileName}
+
 @item General.FileChooserPositionX
 Horizontal position (in pixels) of the upper left corner of the file chooser windows@*
 Default value: @code{200}@*
@@ -631,12 +651,12 @@ Saved in: @code{General.SessionFileName}
 
 @item General.MessageHeight
 Height (in pixels) of the message window@*
-Default value: @code{180}@*
+Default value: @code{300}@*
 Saved in: @code{General.SessionFileName}
 
 @item General.MessageWidth
 Width (in pixels) of the message window@*
-Default value: @code{100}@*
+Default value: @code{400}@*
 Saved in: @code{General.SessionFileName}
 
 @item General.MinX
@@ -699,34 +719,14 @@ Vertical position (in pixels) of the upper left corner of the plugin window@*
 Default value: @code{550}@*
 Saved in: @code{General.SessionFileName}
 
-@item General.PluginWidth
-Width (in pixels) of the plugin window@*
-Default value: @code{100}@*
-Saved in: @code{General.SessionFileName}
-
 @item General.PluginHeight
 Height (in pixels) of the plugin window@*
-Default value: @code{100}@*
-Saved in: @code{General.SessionFileName}
-
-@item General.FieldPositionX
-Horizontal position (in pixels) of the upper left corner of the field window@*
-Default value: @code{650}@*
-Saved in: @code{General.SessionFileName}
-
-@item General.FieldPositionY
-Vertical position (in pixels) of the upper left corner of the field window@*
-Default value: @code{550}@*
-Saved in: @code{General.SessionFileName}
-
-@item General.FieldWidth
-Width (in pixels) of the field window@*
-Default value: @code{100}@*
+Default value: @code{300}@*
 Saved in: @code{General.SessionFileName}
 
-@item General.FieldHeight
-Height (in pixels) of the field window@*
-Default value: @code{100}@*
+@item General.PluginWidth
+Width (in pixels) of the plugin window@*
+Default value: @code{300}@*
 Saved in: @code{General.SessionFileName}
 
 @item General.PointSize
diff --git a/utils/embed/GmshEmbedded.cpp b/utils/embed/GmshEmbedded.cpp
index fa3cfa03ec6f4d8895c4e785c196fb40a287068d..e8ce916ef7c84431d45ed2aef4d047f69bfccf5e 100644
--- a/utils/embed/GmshEmbedded.cpp
+++ b/utils/embed/GmshEmbedded.cpp
@@ -3,90 +3,10 @@
 
 Context_T CTX;
 
-void GModel::_createGEOInternals(){}
-void GModel::_deleteGEOInternals(){}
-void GModel::_deleteOCCInternals(){}
-
-void GmshInitialize(int argc, char **argv)
-{
-}
-
-void GmshFinalize(int argc, char **argv)
+int GmshInitialize(int argc, char **argv)
 {
 }
 
-void Msg(int level, const char *fmt, ...)
+int GmshFinalize()
 {
-  va_list args;
-  int abort = 0;
-
-  va_start(args, fmt);
-
-  switch (level) {
-
-  case PROGRESS:
-  case STATUS1N:
-  case STATUS2N:
-    break;
-
-  case DIRECT:
-    if(CTX.verbosity >= 2) {
-      vfprintf(stdout, fmt, args);
-      fprintf(stdout, "\n");
-    }
-    break;
-
-  case FATAL:
-  case FATAL3: abort = 1;
-  case FATAL1:
-  case FATAL2:
-    fprintf(stderr, FATAL_STR);
-    vfprintf(stderr, fmt, args);
-    fprintf(stderr, "\n");
-    break;
-
-  case GERROR:
-  case GERROR1:
-  case GERROR2:
-  case GERROR3:
-    fprintf(stderr, ERROR_STR);
-    vfprintf(stderr, fmt, args);
-    fprintf(stderr, "\n");
-    break;
-
-  case WARNING:
-  case WARNING1:
-  case WARNING2:
-  case WARNING3:
-    if(CTX.verbosity >= 1) {
-      fprintf(stderr, WARNING_STR);
-      vfprintf(stderr, fmt, args);
-      fprintf(stderr, "\n");
-    }
-    break;
-
-  case DEBUG:
-  case DEBUG1:
-  case DEBUG2:
-  case DEBUG3:
-    if(CTX.verbosity >= 4) {
-      fprintf(stderr, DEBUG_STR);
-      vfprintf(stderr, fmt, args);
-      fprintf(stderr, "\n");
-    }
-    break;
-
-  default:
-    if(CTX.verbosity >= 2) {
-      fprintf(stderr, INFO_STR);
-      vfprintf(stderr, fmt, args);
-      fprintf(stderr, "\n");
-    }
-    break;
-  }
-
-  va_end(args);
-
-  if(abort)
-    exit(1);
 }
diff --git a/utils/embed/GmshEmbedded.h b/utils/embed/GmshEmbedded.h
index eacd93745237203b95694ac0fc73384a5c94228e..e6b2185192d0b12a00713af2881220ca92b198f2 100644
--- a/utils/embed/GmshEmbedded.h
+++ b/utils/embed/GmshEmbedded.h
@@ -1,71 +1,20 @@
 #ifndef _GMSH_EMBEDDED_H_
 #define _GMSH_EMBEDDED_H_
 
-#include <stdarg.h>
 #include "NumericEmbedded.h"
-
-#define FATAL          1  // Fatal error (causes Gmsh to exit)
-#define FATAL1         2  // First part of a multiline FATAL message 
-#define FATAL2         3  // Middle part of a multiline FATAL message
-#define FATAL3         4  // Last part of a multiline FATAL message  
-
-#define GERROR         5  // Error (but Gmsh can live with it)
-#define GERROR1        6  // First part of a multiline ERROR message 
-#define GERROR2        7  // Middle part of a multiline ERROR message
-#define GERROR3        8  // Last part of a multiline ERROR message  
-
-#define WARNING        9  // Warning
-#define WARNING1      10  // First part of a multiline WARNING message 
-#define WARNING2      11  // Middle part of a multiline WARNING message
-#define WARNING3      12  // Last part of a multiline WARNING message  
-
-#define INFO          13  // Long informations
-#define INFO1         14  // First part of a multiline INFO message 
-#define INFO2         15  // Middle part of a multiline INFO message
-#define INFO3         16  // Last part of a multiline INFO message  
-
-#define DEBUG         17  // Long debug information
-#define DEBUG1        18  // First part of a multiline DEBUG message 
-#define DEBUG2        19  // Middle part of a multiline DEBUG message
-#define DEBUG3        20  // Last part of a multiline DEBUG message  
-
-#define STATUS1       21  // left status bar
-#define STATUS2       22  // right status bar
-
-#define STATUS1N      24  // Same as STATUS1, but not going into the log file
-#define STATUS2N      25  // Same as STATUS2, but not going into the log file
-
-#define ONSCREEN      27  // Persistent on-screen message
-
-#define DIRECT        30  // Direct message (no special formatting)
-#define SOLVER        31  // Solver message
-#define SOLVERR       32  // Solver errors and warnings
-
-#define PROGRESS      40  // Progress indicator
-
-#define WHITE_STR          "        : "
-#define FATAL_STR          "Fatal   : "
-#define ERROR_STR          "Error   : "
-#define WARNING_STR        "Warning : "
-#define INFO_STR           "Info    : "
-#define DEBUG_STR          "Debug   : "
-#define STATUS_STR         "Info    : "
-
-void   Msg(int level, const char *fmt, ...);
+#include "Message.h"
 
 class Context_T{
 public:
   Context_T()
   {
     lc = 1.;
-    verbosity = 4;
     hide_unselected = 0;
     geom.tolerance = 1.e-6;
     mesh.reverse_all_normals = 1;
     pick_elements = 0;
   }
   double lc;
-  int verbosity;
   int hide_unselected;
   int pick_elements;
   struct{
diff --git a/utils/embed/Makefile b/utils/embed/Makefile
index 98ca20a57456506095883164947c24073dd75e97..33dd8bfbf0e71fad24e45ba18341b9dfeabc0833 100644
--- a/utils/embed/Makefile
+++ b/utils/embed/Makefile
@@ -2,7 +2,7 @@ include ../../variables
 
 LIB = ../../lib/libGmshEmbedded${LIBEXT}
 
-INC = ${DASH}I.
+INC = ${DASH}I. ${DASH}I../../Common
 
 CFLAGS = ${OPTIM} ${FLAGS} ${INC} ${SYSINCLUDE} ${DASH}DHAVE_GMSH_EMBEDDED
 
diff --git a/variables.msvc b/variables.msvc
index ec0a9ace2bf30004171f7d5dfda3ffce86dfbafd..966725cab25d2cbbf3d005ab3a350770085f5297 100644
--- a/variables.msvc
+++ b/variables.msvc
@@ -28,7 +28,7 @@ endif
 LINKER=cl /F16777216
 
 # All compiler flags except optimization flags
-FLAGS=/DWIN32 /D_USE_MATH_DEFINES /DHAVE_NO_DLL /DHAVE_NO_VSNPRINTF /DHAVE_NO_SNPRINTF /DHAVE_NO_SOCKLEN_T /DHAVE_ANN /DHAVE_MATH_EVAL /DHAVE_NETGEN /DHAVE_TETGEN
+FLAGS=/DWIN32 /D_USE_MATH_DEFINES /DHAVE_NO_DLL /DHAVE_NO_VSNPRINTF /DHAVE_NO_SNPRINTF /DHAVE_NO_SOCKLEN_T /DHAVE_ANN /DHAVE_MATH_EVAL /DHAVE_TETGEN
 
 # Additional system includes ($INCLUDE is automatically defined by MSVC when
 # you launch the MSVC command prompt)
@@ -38,10 +38,10 @@ SYSINCLUDE=/I"${INCLUDE}"
 OPTIM=/O2
 
 # Gmsh subdirectories
-GMSH_DIRS=Box Common DataStr Geo Mesh Post Numeric Parallel Parser Plugin contrib/ANN contrib/MathEval contrib/Netgen contrib/NR contrib/Tetgen
+GMSH_DIRS=Common DataStr Geo Mesh Post Numeric Parallel Parser Plugin contrib/ANN contrib/MathEval contrib/NR contrib/Tetgen
 
 # Gmsh libraries
-GMSH_LIBS=Box/Main.obj lib/*.lib
+GMSH_LIBS=Common/Main.obj lib/*.lib
 
 # How you create a static library on this machine
 AR=LIB