From c0d4afb7f7f7f7b68308551a21f199fcccf05ea3 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Sun, 26 Nov 2000 15:46:29 +0000
Subject: [PATCH] *** empty log message ***

---
 Adapt/Adapt.cpp          |  24 +-
 Adapt/Adapt.h            |  14 +-
 Adapt/brent.cpp          | 108 ++---
 Adapt/dsvdcmp.cpp        | 208 +++++-----
 Adapt/fdjac.cpp          |   6 +-
 Adapt/lnsrch.cpp         |  68 +--
 Adapt/lubksb.cpp         |  10 +-
 Adapt/ludcmp.cpp         |  74 ++--
 Adapt/mnbrak.cpp         |  80 ++--
 Adapt/newt.cpp           |  76 ++--
 Adapt/nrutil.cpp         | 286 ++++++-------
 Adapt/nrutil.h           |   6 +-
 Box/Box.cpp              | 193 +++++----
 Common/Const.h           |  16 +-
 Common/Context.cpp       |  13 +-
 Common/Context.h         |  42 +-
 Common/Static.h          |  17 +-
 Common/Views.cpp         | 162 +++++---
 Common/Views.h           |  36 +-
 DataStr/List.cpp         |  26 +-
 DataStr/List.h           |   4 +-
 DataStr/avl.cpp          | 224 +++++-----
 DataStr/avl.h            |  14 +-
 Geo/CAD.cpp              |  21 +-
 Geo/CAD.h                |  14 +-
 Geo/DataBase.cpp         |  48 +--
 Geo/DataBase.h           |  20 +-
 Geo/ExtrudeParams.h      |   6 +-
 Geo/Geo.cpp              |  30 +-
 Geo/Geo.h                |   4 +-
 Geo/MinMax.cpp           |  69 ++--
 Geo/Print_Geo.cpp        |   5 +-
 Geo/StepGeomDatabase.cpp |  14 +-
 Geo/StepGeomDatabase.h   |  12 +-
 Graphics/ColorTable.cpp  | 169 ++++----
 Graphics/ColorTable.h    |  36 +-
 Graphics/Draw.cpp        | 107 ++---
 Graphics/Draw.h          |  26 +-
 Graphics/Entity.cpp      |  74 ++--
 Graphics/Geom.cpp        | 138 +++----
 Graphics/Iso.cpp         |  32 +-
 Graphics/Iso.h           |  26 +-
 Graphics/Mesh.cpp        |  93 +++--
 Graphics/Post.cpp        | 140 +++----
 Graphics/PostSimplex.cpp | 481 +++++++++++----------
 Graphics/Scale.cpp       |  34 +-
 Graphics/gl2gif.cpp      | 748 ++++++++++++++++-----------------
 Graphics/gl2gif.h        | 128 +++---
 Graphics/gl2ps.cpp       | 402 +++++++++---------
 Graphics/gl2ps.h         |   6 +-
 Makefile                 |  58 +--
 Mesh/1D_Mesh.cpp         |  70 ++--
 Mesh/2D_BGMesh.cpp       |   8 +-
 Mesh/2D_Bowyer.cpp       |  74 ++--
 Mesh/2D_Bricks.cpp       |  46 +--
 Mesh/2D_DivAndConq.cpp   |  80 ++--
 Mesh/2D_Elliptic.cpp     | 210 +++++-----
 Mesh/2D_InitMesh.cpp     | 120 +++---
 Mesh/2D_Links.cpp        | 148 +++----
 Mesh/2D_Mesh.cpp         | 308 +++++++-------
 Mesh/2D_Mesh.h           |  28 +-
 Mesh/2D_Mesh_Aniso.cpp   | 137 +++---
 Mesh/2D_Parametric.cpp   |  26 +-
 Mesh/2D_Recombine.cpp    |   4 +-
 Mesh/2D_SMesh.cpp        | 266 ++++++------
 Mesh/2D_Tree.cpp         |  36 +-
 Mesh/2D_Util.cpp         | 128 +++---
 Mesh/3D_BGMesh.cpp       |  68 +--
 Mesh/3D_Bricks.cpp       |  22 +-
 Mesh/3D_Coherence.cpp    | 212 +++++-----
 Mesh/3D_Divide.cpp       | 120 +++---
 Mesh/3D_Extrude.cpp      | 402 +++++++++---------
 Mesh/3D_Mesh.cpp         | 183 ++++----
 Mesh/3D_Mesh.h           |   8 +-
 Mesh/3D_SMesh.cpp        | 515 ++++++++++++-----------
 Mesh/Create.cpp          | 104 ++---
 Mesh/Create.h            |  10 +-
 Mesh/CrossData.cpp       |  12 +-
 Mesh/Edge.cpp            |  46 +--
 Mesh/Generator.cpp       |  25 +-
 Mesh/Interpolation.cpp   | 154 +++----
 Mesh/Interpolation.h     |  14 +-
 Mesh/Matrix.h            |  58 +--
 Mesh/Metric.cpp          |  20 +-
 Mesh/Metric.h            |   4 +-
 Mesh/Numeric.cpp         |  32 +-
 Mesh/Numeric.h           |  10 +-
 Mesh/Nurbs.cpp           |   6 +-
 Mesh/Print_Mesh.cpp      | 521 +++++++++++------------
 Mesh/Read_Mesh.cpp       | 212 +++++-----
 Mesh/STL.cpp             |   6 +-
 Mesh/SecondOrder.cpp     |  46 +--
 Mesh/Simplex.cpp         |  88 ++--
 Mesh/Simplex.h           |   6 +-
 Mesh/Smoothing.cpp       |  54 +--
 Mesh/SwapEdge.cpp        | 112 ++---
 Mesh/Vertex.cpp          |  16 +-
 Parser/Gmsh.tab.cpp      |   2 +-
 Parser/Gmsh.tab.cpp.h    | 278 ++++++-------
 Parser/Gmsh.yy.cpp       |   2 +-
 Unix/CbColorbar.cpp      | 328 +++++++--------
 Unix/CbColorbar.h        |   5 +-
 Unix/CbContext.cpp       |  22 +-
 Unix/CbFile.cpp          |  16 +-
 Unix/CbGeneral.cpp       |  34 +-
 Unix/CbGeom.cpp          | 312 +++++++-------
 Unix/CbInput.cpp         | 477 +++++++++++----------
 Unix/CbMesh.cpp          | 179 ++++----
 Unix/CbMesh.h            |   6 +-
 Unix/CbOptions.cpp       |  53 ++-
 Unix/CbOptions.h         |   6 +-
 Unix/CbPost.cpp          |  86 ++--
 Unix/CbPost.h            |   4 +-
 Unix/Geometry.cpp        | 874 +++++++++++++++++++--------------------
 Unix/Main.cpp            | 466 +++++++++++----------
 Unix/Message.cpp         |  78 ++--
 Unix/Pixmaps.cpp         |  36 +-
 Unix/Register.cpp        |   4 +-
 Unix/Register.h          | 108 ++---
 Unix/Widgets.cpp         |  28 +-
 Unix/XColors.cpp         |  30 +-
 Unix/XContext.h          |   4 +-
 bin/dbx_gmsh             |   8 -
 bin/gdb_gmsh             |   8 -
 bin/gdb_gmshm            |   9 -
 examples/wing.geo        |   2 +-
 utils/untabify           |  14 +
 127 files changed, 6543 insertions(+), 6359 deletions(-)
 delete mode 100644 bin/dbx_gmsh
 delete mode 100644 bin/gdb_gmsh
 delete mode 100644 bin/gdb_gmshm
 create mode 100644 utils/untabify

diff --git a/Adapt/Adapt.cpp b/Adapt/Adapt.cpp
index 42a1fcf34a..d9ffd9852c 100644
--- a/Adapt/Adapt.cpp
+++ b/Adapt/Adapt.cpp
@@ -1,4 +1,4 @@
-/* $Id: Adapt.cpp,v 1.1 2000-11-23 23:21:35 geuzaine Exp $ */
+/* $Id: Adapt.cpp,v 1.2 2000-11-26 15:43:44 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "Adapt.h"
@@ -70,9 +70,9 @@ double fP1 (double l){
 double min1d (int method, double (*funct)(double), double *xmin){
   double xx, fx, fb, fa, bx, ax;
   double brent(double ax, double bx, double cx,
-	      double (*f)(double), double tol, double *xmin);
+              double (*f)(double), double tol, double *xmin);
   void mnbrak(double *ax, double *bx, double *cx, double *fa, double *fb,
-		double *fc, double (*func)(double));
+                double *fc, double (*func)(double));
 
   switch(method){
   case ADAPT_H1: 
@@ -87,12 +87,12 @@ double min1d (int method, double (*funct)(double), double *xmin){
 /* Adapt return the constraint (N0 ou e0) for the optimzed problem */
 
 double AdaptMesh (int N,        /* Number of elements */
-		  int method,   /* ADAPT_H1, ADAPT_H2, ADAPT_P1 or ADAPT_P2 */
-		  int dim,      /* 2 or 3 */
-		  double *err,  /* elementary errors */
-		  double *h,    /* elementary mesh sizes */
-		  double *p,    /* elementary exponents */
-		  double e0     /* prescribed error or number of elements */){
+                  int method,   /* ADAPT_H1, ADAPT_H2, ADAPT_P1 or ADAPT_P2 */
+                  int dim,      /* 2 or 3 */
+                  double *err,  /* elementary errors */
+                  double *h,    /* elementary mesh sizes */
+                  double *p,    /* elementary exponents */
+                  double e0     /* prescribed error or number of elements */){
   int i;
   double contr=0.0, pivrai, lambda, minf, qi, ri, pi, obj, obj2, minri, maxri;
   double errmin, errmax;
@@ -135,7 +135,7 @@ double AdaptMesh (int N,        /* Number of elements */
     contr = fabs(minf);
 
     Msg(INFOS, "H-Refinement 1, Error %g=>%g, Objective %g, Reduction Factor %g->%g",
-	e0, sqrt(obj), -minf, minri, maxri);
+        e0, sqrt(obj), -minf, minri, maxri);
     break;
 
   case ADAPT_H2 :
@@ -154,7 +154,7 @@ double AdaptMesh (int N,        /* Number of elements */
     contr = sqrt(fabs(minf));
 
     Msg(INFOS, "H-Refinement 2, Elements %g=>%g, Objective %g, Reduction Factor %g->%g",
-	e0, obj, 100. * sqrt(fabs(minf)), minri, maxri);
+        e0, obj, 100. * sqrt(fabs(minf)), minri, maxri);
     break;
 
   case ADAPT_P1 :
@@ -176,7 +176,7 @@ double AdaptMesh (int N,        /* Number of elements */
     contr = fabs(minf);
 
     Msg(INFOS, "P-Refinement, Error %g=%g=>%g, Objective %g",
-	e0, sqrt(obj), sqrt(obj2), minf);
+        e0, sqrt(obj), sqrt(obj2), minf);
     break;
 
   case ADAPT_P2 :
diff --git a/Adapt/Adapt.h b/Adapt/Adapt.h
index ca4bd3c830..eda49f6667 100644
--- a/Adapt/Adapt.h
+++ b/Adapt/Adapt.h
@@ -1,4 +1,4 @@
-/* $Id: Adapt.h,v 1.3 2000-11-23 23:20:34 geuzaine Exp $ */
+/* $Id: Adapt.h,v 1.4 2000-11-26 15:43:44 geuzaine Exp $ */
 #ifndef _ADAPT_H_
 #define _ADAPT_H_
 
@@ -8,11 +8,11 @@
 #define ADAPT_H2 4
 
 double AdaptMesh (int N,        /* Number of elements */
-		  int method,   /* ADAPT_H1, ADAPT_H2, ADAPT_P1 or ADAPT_P2 */
-		  int dim,      /* 2 or 3 */
-		  double *err,  /* elementary errors */
-		  double *h,    /* elementary mesh sizes */
-		  double *p,    /* elementary exponents */
-		  double e0     /* prescribed error or number of elements */);
+                  int method,   /* ADAPT_H1, ADAPT_H2, ADAPT_P1 or ADAPT_P2 */
+                  int dim,      /* 2 or 3 */
+                  double *err,  /* elementary errors */
+                  double *h,    /* elementary mesh sizes */
+                  double *p,    /* elementary exponents */
+                  double e0     /* prescribed error or number of elements */);
 
 #endif
diff --git a/Adapt/brent.cpp b/Adapt/brent.cpp
index 57aa9afcbe..f6e8aba188 100644
--- a/Adapt/brent.cpp
+++ b/Adapt/brent.cpp
@@ -1,4 +1,4 @@
-/* $Id: brent.cpp,v 1.2 2000-11-23 14:11:24 geuzaine Exp $ */
+/* $Id: brent.cpp,v 1.3 2000-11-26 15:43:44 geuzaine Exp $ */
 
 
 #include <math.h>
@@ -27,65 +27,65 @@ brent (double ax, double bx, double cx, double (*f) (double), double tol,
       xm = 0.5 * (a + b);
       tol2 = 2.0 * (tol1 = tol * fabs (x) + ZEPS);
       if (fabs (x - xm) <= (tol2 - 0.5 * (b - a)))
-	{
-	  *xmin = x;
-	  return fx;
-	}
+        {
+          *xmin = x;
+          return fx;
+        }
       if (fabs (e) > tol1)
-	{
-	  r = (x - w) * (fx - fv);
-	  q = (x - v) * (fx - fw);
-	  p = (x - v) * q - (x - w) * r;
-	  q = 2.0 * (q - r);
-	  if (q > 0.0)
-	    p = -p;
-	  q = fabs (q);
-	  etemp = e;
-	  e = d;
-	  if (fabs (p) >= fabs (0.5 * q * etemp) || p <= q * (a - x) || p >= q * (b - x))
-	    d = CGOLD * (e = (x >= xm ? a - x : b - x));
-	  else
-	    {
-	      d = p / q;
-	      u = x + d;
-	      if (u - a < tol2 || b - u < tol2)
-		d = SIGN (tol1, xm - x);
-	    }
-	}
+        {
+          r = (x - w) * (fx - fv);
+          q = (x - v) * (fx - fw);
+          p = (x - v) * q - (x - w) * r;
+          q = 2.0 * (q - r);
+          if (q > 0.0)
+            p = -p;
+          q = fabs (q);
+          etemp = e;
+          e = d;
+          if (fabs (p) >= fabs (0.5 * q * etemp) || p <= q * (a - x) || p >= q * (b - x))
+            d = CGOLD * (e = (x >= xm ? a - x : b - x));
+          else
+            {
+              d = p / q;
+              u = x + d;
+              if (u - a < tol2 || b - u < tol2)
+                d = SIGN (tol1, xm - x);
+            }
+        }
       else
-	{
-	  d = CGOLD * (e = (x >= xm ? a - x : b - x));
-	}
+        {
+          d = CGOLD * (e = (x >= xm ? a - x : b - x));
+        }
       u = (fabs (d) >= tol1 ? x + d : x + SIGN (tol1, d));
       fu = (*f) (u);
       if (fu <= fx)
-	{
-	  if (u >= x)
-	    a = x;
-	  else
-	    b = x;
-	  SHFT (v, w, x, u)
-	    SHFT (fv, fw, fx, fu)
-	}
+        {
+          if (u >= x)
+            a = x;
+          else
+            b = x;
+          SHFT (v, w, x, u)
+            SHFT (fv, fw, fx, fu)
+        }
       else
-	{
-	  if (u < x)
-	    a = u;
-	  else
-	    b = u;
-	  if (fu <= fw || w == x)
-	    {
-	      v = w;
-	      w = u;
-	      fv = fw;
-	      fw = fu;
-	    }
-	  else if (fu <= fv || v == x || v == w)
-	    {
-	      v = u;
-	      fv = fu;
-	    }
-	}
+        {
+          if (u < x)
+            a = u;
+          else
+            b = u;
+          if (fu <= fw || w == x)
+            {
+              v = w;
+              w = u;
+              fv = fw;
+              fw = fu;
+            }
+          else if (fu <= fv || v == x || v == w)
+            {
+              v = u;
+              fv = fu;
+            }
+        }
     }
   nrerror ("Too many iterations in brent");
   *xmin = x;
diff --git a/Adapt/dsvdcmp.cpp b/Adapt/dsvdcmp.cpp
index ce98848387..1f02e94575 100644
--- a/Adapt/dsvdcmp.cpp
+++ b/Adapt/dsvdcmp.cpp
@@ -1,4 +1,4 @@
-/* $Id: dsvdcmp.cpp,v 1.2 2000-11-23 14:11:24 geuzaine Exp $ */
+/* $Id: dsvdcmp.cpp,v 1.3 2000-11-26 15:43:44 geuzaine Exp $ */
 #include <math.h>
 
 #include "nrutil.h"
@@ -27,20 +27,20 @@ void dsvdcmp(double **a, int m, int n, double w[], double **v)
     if (i <= m) {
       for (k=i;k<=m;k++) scale += fabs(a[k][i]);
       if (scale) {
-	for (k=i;k<=m;k++) {
-	  a[k][i] /= scale;
-	  s += a[k][i]*a[k][i];
-	}
-	f=a[i][i];
-	g = -SIGN(sqrt(s),f);
-	h=f*g-s;
-	a[i][i]=f-g;
-	for (j=l;j<=n;j++) {
-	  for (s=0.0,k=i;k<=m;k++) s += a[k][i]*a[k][j];
-	  f=s/h;
-	  for (k=i;k<=m;k++) a[k][j] += f*a[k][i];
-	}
-	for (k=i;k<=m;k++) a[k][i] *= scale;
+        for (k=i;k<=m;k++) {
+          a[k][i] /= scale;
+          s += a[k][i]*a[k][i];
+        }
+        f=a[i][i];
+        g = -SIGN(sqrt(s),f);
+        h=f*g-s;
+        a[i][i]=f-g;
+        for (j=l;j<=n;j++) {
+          for (s=0.0,k=i;k<=m;k++) s += a[k][i]*a[k][j];
+          f=s/h;
+          for (k=i;k<=m;k++) a[k][j] += f*a[k][i];
+        }
+        for (k=i;k<=m;k++) a[k][i] *= scale;
       }
     }
     w[i]=scale *g;
@@ -48,20 +48,20 @@ void dsvdcmp(double **a, int m, int n, double w[], double **v)
     if (i <= m && i != n) {
       for (k=l;k<=n;k++) scale += fabs(a[i][k]);
       if (scale) {
-	for (k=l;k<=n;k++) {
-	  a[i][k] /= scale;
-	  s += a[i][k]*a[i][k];
-	}
-	f=a[i][l];
-	g = -SIGN(sqrt(s),f);
-	h=f*g-s;
-	a[i][l]=f-g;
-	for (k=l;k<=n;k++) rv1[k]=a[i][k]/h;
-	for (j=l;j<=m;j++) {
-	  for (s=0.0,k=l;k<=n;k++) s += a[j][k]*a[i][k];
-	  for (k=l;k<=n;k++) a[j][k] += s*rv1[k];
-	}
-	for (k=l;k<=n;k++) a[i][k] *= scale;
+        for (k=l;k<=n;k++) {
+          a[i][k] /= scale;
+          s += a[i][k]*a[i][k];
+        }
+        f=a[i][l];
+        g = -SIGN(sqrt(s),f);
+        h=f*g-s;
+        a[i][l]=f-g;
+        for (k=l;k<=n;k++) rv1[k]=a[i][k]/h;
+        for (j=l;j<=m;j++) {
+          for (s=0.0,k=l;k<=n;k++) s += a[j][k]*a[i][k];
+          for (k=l;k<=n;k++) a[j][k] += s*rv1[k];
+        }
+        for (k=l;k<=n;k++) a[i][k] *= scale;
       }
     }
     anorm=DMAX(anorm,(fabs(w[i])+fabs(rv1[i])));
@@ -69,11 +69,11 @@ void dsvdcmp(double **a, int m, int n, double w[], double **v)
   for (i=n;i>=1;i--) {
     if (i < n) {
       if (g) {
-	for (j=l;j<=n;j++) v[j][i]=(a[i][j]/a[i][l])/g;
-	for (j=l;j<=n;j++) {
-	  for (s=0.0,k=l;k<=n;k++) s += a[i][k]*v[k][j];
-	  for (k=l;k<=n;k++) v[k][j] += s*v[k][i];
-	}
+        for (j=l;j<=n;j++) v[j][i]=(a[i][j]/a[i][l])/g;
+        for (j=l;j<=n;j++) {
+          for (s=0.0,k=l;k<=n;k++) s += a[i][k]*v[k][j];
+          for (k=l;k<=n;k++) v[k][j] += s*v[k][i];
+        }
       }
       for (j=l;j<=n;j++) v[i][j]=v[j][i]=0.0;
     }
@@ -88,9 +88,9 @@ void dsvdcmp(double **a, int m, int n, double w[], double **v)
     if (g) {
       g=1.0/g;
       for (j=l;j<=n;j++) {
-	for (s=0.0,k=l;k<=m;k++) s += a[k][i]*a[k][j];
-	f=(s/a[i][i])*g;
-	for (k=i;k<=m;k++) a[k][j] += f*a[k][i];
+        for (s=0.0,k=l;k<=m;k++) s += a[k][i]*a[k][j];
+        f=(s/a[i][i])*g;
+        for (k=i;k<=m;k++) a[k][j] += f*a[k][i];
       }
       for (j=i;j<=m;j++) a[j][i] *= g;
     } else for (j=i;j<=m;j++) a[j][i]=0.0;
@@ -100,41 +100,41 @@ void dsvdcmp(double **a, int m, int n, double w[], double **v)
     for (its=1;its<=30;its++) {
       flag=1;
       for (l=k;l>=1;l--) {
-	nm=l-1;
-	if ((double)(fabs(rv1[l])+anorm) == anorm) {
-	  flag=0;
-	  break;
-	}
-	if ((double)(fabs(w[nm])+anorm) == anorm) break;
+        nm=l-1;
+        if ((double)(fabs(rv1[l])+anorm) == anorm) {
+          flag=0;
+          break;
+        }
+        if ((double)(fabs(w[nm])+anorm) == anorm) break;
       }
       if (flag) {
-	c=0.0;
-	s=1.0;
-	for (i=l;i<=k;i++) {
-	  f=s*rv1[i];
-	  rv1[i]=c*rv1[i];
-	  if ((double)(fabs(f)+anorm) == anorm) break;
-	  g=w[i];
-	  h=dpythag(f,g);
-	  w[i]=h;
-	  h=1.0/h;
-	  c=g*h;
-	  s = -f*h;
-	  for (j=1;j<=m;j++) {
-	    y=a[j][nm];
-	    z=a[j][i];
-	    a[j][nm]=y*c+z*s;
-	    a[j][i]=z*c-y*s;
-	  }
-	}
+        c=0.0;
+        s=1.0;
+        for (i=l;i<=k;i++) {
+          f=s*rv1[i];
+          rv1[i]=c*rv1[i];
+          if ((double)(fabs(f)+anorm) == anorm) break;
+          g=w[i];
+          h=dpythag(f,g);
+          w[i]=h;
+          h=1.0/h;
+          c=g*h;
+          s = -f*h;
+          for (j=1;j<=m;j++) {
+            y=a[j][nm];
+            z=a[j][i];
+            a[j][nm]=y*c+z*s;
+            a[j][i]=z*c-y*s;
+          }
+        }
       }
       z=w[k];
       if (l == k) {
-	if (z < 0.0) {
-	  w[k] = -z;
-	  for (j=1;j<=n;j++) v[j][k] = -v[j][k];
-	}
-	break;
+        if (z < 0.0) {
+          w[k] = -z;
+          for (j=1;j<=n;j++) v[j][k] = -v[j][k];
+        }
+        break;
       }
       if (its == 30) nrerror("no convergence in 30 dsvdcmp iterations");
       x=w[l];
@@ -147,40 +147,40 @@ void dsvdcmp(double **a, int m, int n, double w[], double **v)
       f=((x-z)*(x+z)+h*((y/(f+SIGN(g,f)))-h))/x;
       c=s=1.0;
       for (j=l;j<=nm;j++) {
-	i=j+1;
-	g=rv1[i];
-	y=w[i];
-	h=s*g;
-	g=c*g;
-	z=dpythag(f,h);
-	rv1[j]=z;
-	c=f/z;
-	s=h/z;
-	f=x*c+g*s;
-	g = g*c-x*s;
-	h=y*s;
-	y *= c;
-	for (jj=1;jj<=n;jj++) {
-	  x=v[jj][j];
-	  z=v[jj][i];
-	  v[jj][j]=x*c+z*s;
-	  v[jj][i]=z*c-x*s;
-	}
-	z=dpythag(f,h);
-	w[j]=z;
-	if (z) {
-	  z=1.0/z;
-	  c=f*z;
-	  s=h*z;
-	}
-	f=c*g+s*y;
-	x=c*y-s*g;
-	for (jj=1;jj<=m;jj++) {
-	  y=a[jj][j];
-	  z=a[jj][i];
-	  a[jj][j]=y*c+z*s;
-	  a[jj][i]=z*c-y*s;
-	}
+        i=j+1;
+        g=rv1[i];
+        y=w[i];
+        h=s*g;
+        g=c*g;
+        z=dpythag(f,h);
+        rv1[j]=z;
+        c=f/z;
+        s=h/z;
+        f=x*c+g*s;
+        g = g*c-x*s;
+        h=y*s;
+        y *= c;
+        for (jj=1;jj<=n;jj++) {
+          x=v[jj][j];
+          z=v[jj][i];
+          v[jj][j]=x*c+z*s;
+          v[jj][i]=z*c-x*s;
+        }
+        z=dpythag(f,h);
+        w[j]=z;
+        if (z) {
+          z=1.0/z;
+          c=f*z;
+          s=h*z;
+        }
+        f=c*g+s*y;
+        x=c*y-s*g;
+        for (jj=1;jj<=m;jj++) {
+          y=a[jj][j];
+          z=a[jj][i];
+          a[jj][j]=y*c+z*s;
+          a[jj][i]=z*c-y*s;
+        }
       }
       rv1[l]=0.0;
       rv1[k]=f;
@@ -215,11 +215,11 @@ void invert_singular_matrix(double **M, int n, double **I){
   for(i=1 ; i<=n ; i++){
     for(j=1 ; j<=n ; j++){
       if(fabs(W[i]) > PREC){
-	T[i][j] += M[j][i] / W[i] ;
+        T[i][j] += M[j][i] / W[i] ;
       }
       /*
       else{
-	T[i][j] += 0.0 ;
+        T[i][j] += 0.0 ;
       }
       */
     }
@@ -227,7 +227,7 @@ void invert_singular_matrix(double **M, int n, double **I){
   for(i=1 ; i<=n ; i++){
     for(j=1 ; j<=n ; j++){
       for(k=1 ; k<=n ; k++){
-	I[i][j] += V[i][k] * T[k][j] ;
+        I[i][j] += V[i][k] * T[k][j] ;
       }
     }
   }
diff --git a/Adapt/fdjac.cpp b/Adapt/fdjac.cpp
index 9478259b01..6e225fc480 100644
--- a/Adapt/fdjac.cpp
+++ b/Adapt/fdjac.cpp
@@ -1,4 +1,4 @@
-/* $Id: fdjac.cpp,v 1.2 2000-11-23 14:11:24 geuzaine Exp $ */
+/* $Id: fdjac.cpp,v 1.3 2000-11-26 15:43:44 geuzaine Exp $ */
 #include <math.h>
 #define NRANSI
 #include "nrutil.h"
@@ -17,13 +17,13 @@ fdjac (int n, float x[], float fvec[], float **df,
       temp = x[j];
       h = EPS * fabs (temp);
       if (h == 0.0)
-	h = EPS;
+        h = EPS;
       x[j] = temp + h;
       h = x[j] - temp;
       (*vecfunc) (n, x, f);
       x[j] = temp;
       for (i = 1; i <= n; i++)
-	df[i][j] = (f[i] - fvec[i]) / h;
+        df[i][j] = (f[i] - fvec[i]) / h;
     }
   free_vector (f, 1, n);
 }
diff --git a/Adapt/lnsrch.cpp b/Adapt/lnsrch.cpp
index 9a054e1100..6151fc9fff 100644
--- a/Adapt/lnsrch.cpp
+++ b/Adapt/lnsrch.cpp
@@ -1,4 +1,4 @@
-/* $Id: lnsrch.cpp,v 1.2 2000-11-23 14:11:24 geuzaine Exp $ */
+/* $Id: lnsrch.cpp,v 1.3 2000-11-26 15:43:44 geuzaine Exp $ */
 #include <math.h>
 #define NRANSI
 #include "nrutil.h"
@@ -7,7 +7,7 @@
 
 void 
 lnsrch (int n, float xold[], float fold, float g[], float p[], float x[],
-	float *f, float stpmax, int *check, float (*func) (float[]))
+        float *f, float stpmax, int *check, float (*func) (float[]))
 {
   int i;
   float a, alam, alam2, alamin, b, disc, f2, fold2, rhs1, rhs2, slope,
@@ -27,48 +27,48 @@ lnsrch (int n, float xold[], float fold, float g[], float p[], float x[],
     {
       temp = fabs (p[i]) / FMAX (fabs (xold[i]), 1.0);
       if (temp > test)
-	test = temp;
+        test = temp;
     }
   alamin = TOLX / test;
   alam = 1.0;
   for (;;)
     {
       for (i = 1; i <= n; i++)
-	x[i] = xold[i] + alam * p[i];
+        x[i] = xold[i] + alam * p[i];
       *f = (*func) (x);
       if (alam < alamin)
-	{
-	  for (i = 1; i <= n; i++)
-	    x[i] = xold[i];
-	  *check = 1;
-	  return;
-	}
+        {
+          for (i = 1; i <= n; i++)
+            x[i] = xold[i];
+          *check = 1;
+          return;
+        }
       else if (*f <= fold + ALF * alam * slope)
-	return;
+        return;
       else
-	{
-	  if (alam == 1.0)
-	    tmplam = -slope / (2.0 * (*f - fold - slope));
-	  else
-	    {
-	      rhs1 = *f - fold - alam * slope;
-	      rhs2 = f2 - fold2 - alam2 * slope;
-	      a = (rhs1 / (alam * alam) - rhs2 / (alam2 * alam2)) / (alam - alam2);
-	      b = (-alam2 * rhs1 / (alam * alam) + alam * rhs2 / (alam2 * alam2)) / (alam - alam2);
-	      if (a == 0.0)
-		tmplam = -slope / (2.0 * b);
-	      else
-		{
-		  disc = b * b - 3.0 * a * slope;
-		  if (disc < 0.0)
-		    nrerror ("Roundoff problem in lnsrch.");
-		  else
-		    tmplam = (-b + sqrt (disc)) / (3.0 * a);
-		}
-	      if (tmplam > 0.5 * alam)
-		tmplam = 0.5 * alam;
-	    }
-	}
+        {
+          if (alam == 1.0)
+            tmplam = -slope / (2.0 * (*f - fold - slope));
+          else
+            {
+              rhs1 = *f - fold - alam * slope;
+              rhs2 = f2 - fold2 - alam2 * slope;
+              a = (rhs1 / (alam * alam) - rhs2 / (alam2 * alam2)) / (alam - alam2);
+              b = (-alam2 * rhs1 / (alam * alam) + alam * rhs2 / (alam2 * alam2)) / (alam - alam2);
+              if (a == 0.0)
+                tmplam = -slope / (2.0 * b);
+              else
+                {
+                  disc = b * b - 3.0 * a * slope;
+                  if (disc < 0.0)
+                    nrerror ("Roundoff problem in lnsrch.");
+                  else
+                    tmplam = (-b + sqrt (disc)) / (3.0 * a);
+                }
+              if (tmplam > 0.5 * alam)
+                tmplam = 0.5 * alam;
+            }
+        }
       alam2 = alam;
       f2 = *f;
       fold2 = fold;
diff --git a/Adapt/lubksb.cpp b/Adapt/lubksb.cpp
index 5562cd3a92..4717929d34 100644
--- a/Adapt/lubksb.cpp
+++ b/Adapt/lubksb.cpp
@@ -1,4 +1,4 @@
-/* $Id: lubksb.cpp,v 1.2 2000-11-23 14:11:24 geuzaine Exp $ */
+/* $Id: lubksb.cpp,v 1.3 2000-11-26 15:43:44 geuzaine Exp $ */
 void 
 lubksb (float **a, int n, int *indx, float b[])
 {
@@ -11,17 +11,17 @@ lubksb (float **a, int n, int *indx, float b[])
       sum = b[ip];
       b[ip] = b[i];
       if (ii)
-	for (j = ii; j <= i - 1; j++)
-	  sum -= a[i][j] * b[j];
+        for (j = ii; j <= i - 1; j++)
+          sum -= a[i][j] * b[j];
       else if (sum)
-	ii = i;
+        ii = i;
       b[i] = sum;
     }
   for (i = n; i >= 1; i--)
     {
       sum = b[i];
       for (j = i + 1; j <= n; j++)
-	sum -= a[i][j] * b[j];
+        sum -= a[i][j] * b[j];
       b[i] = sum / a[i][i];
     }
 }
diff --git a/Adapt/ludcmp.cpp b/Adapt/ludcmp.cpp
index c53a8c0920..f1ac953932 100644
--- a/Adapt/ludcmp.cpp
+++ b/Adapt/ludcmp.cpp
@@ -1,4 +1,4 @@
-/* $Id: ludcmp.cpp,v 1.2 2000-11-23 14:11:24 geuzaine Exp $ */
+/* $Id: ludcmp.cpp,v 1.3 2000-11-26 15:43:44 geuzaine Exp $ */
 #include <math.h>
 #define NRANSI
 #include "nrutil.h"
@@ -17,54 +17,54 @@ ludcmp (float **a, int n, int *indx, float *d)
     {
       big = 0.0;
       for (j = 1; j <= n; j++)
-	if ((temp = fabs (a[i][j])) > big)
-	  big = temp;
+        if ((temp = fabs (a[i][j])) > big)
+          big = temp;
       if (big == 0.0)
-	nrerror ("Singular matrix in routine ludcmp");
+        nrerror ("Singular matrix in routine ludcmp");
       vv[i] = 1.0 / big;
     }
   for (j = 1; j <= n; j++)
     {
       for (i = 1; i < j; i++)
-	{
-	  sum = a[i][j];
-	  for (k = 1; k < i; k++)
-	    sum -= a[i][k] * a[k][j];
-	  a[i][j] = sum;
-	}
+        {
+          sum = a[i][j];
+          for (k = 1; k < i; k++)
+            sum -= a[i][k] * a[k][j];
+          a[i][j] = sum;
+        }
       big = 0.0;
       for (i = j; i <= n; i++)
-	{
-	  sum = a[i][j];
-	  for (k = 1; k < j; k++)
-	    sum -= a[i][k] * a[k][j];
-	  a[i][j] = sum;
-	  if ((dum = vv[i] * fabs (sum)) >= big)
-	    {
-	      big = dum;
-	      imax = i;
-	    }
-	}
+        {
+          sum = a[i][j];
+          for (k = 1; k < j; k++)
+            sum -= a[i][k] * a[k][j];
+          a[i][j] = sum;
+          if ((dum = vv[i] * fabs (sum)) >= big)
+            {
+              big = dum;
+              imax = i;
+            }
+        }
       if (j != imax)
-	{
-	  for (k = 1; k <= n; k++)
-	    {
-	      dum = a[imax][k];
-	      a[imax][k] = a[j][k];
-	      a[j][k] = dum;
-	    }
-	  *d = -(*d);
-	  vv[imax] = vv[j];
-	}
+        {
+          for (k = 1; k <= n; k++)
+            {
+              dum = a[imax][k];
+              a[imax][k] = a[j][k];
+              a[j][k] = dum;
+            }
+          *d = -(*d);
+          vv[imax] = vv[j];
+        }
       indx[j] = imax;
       if (a[j][j] == 0.0)
-	a[j][j] = TINY;
+        a[j][j] = TINY;
       if (j != n)
-	{
-	  dum = 1.0 / (a[j][j]);
-	  for (i = j + 1; i <= n; i++)
-	    a[i][j] *= dum;
-	}
+        {
+          dum = 1.0 / (a[j][j]);
+          for (i = j + 1; i <= n; i++)
+            a[i][j] *= dum;
+        }
     }
   free_vector (vv, 1, n);
 }
diff --git a/Adapt/mnbrak.cpp b/Adapt/mnbrak.cpp
index 365cf02fac..1326e32bac 100644
--- a/Adapt/mnbrak.cpp
+++ b/Adapt/mnbrak.cpp
@@ -1,4 +1,4 @@
-/* $Id: mnbrak.cpp,v 1.2 2000-11-23 14:11:24 geuzaine Exp $ */
+/* $Id: mnbrak.cpp,v 1.3 2000-11-26 15:43:44 geuzaine Exp $ */
 #include <math.h>
 #define NRANSI
 #include "nrutil.h"
@@ -9,7 +9,7 @@
 
 void 
 mnbrak (double *ax, double *bx, double *cx, double *fa, double *fb, double *fc,
-	double (*func) (double))
+        double (*func) (double))
 {
   double ulim, u, r, q, fu, dum;
 
@@ -18,7 +18,7 @@ mnbrak (double *ax, double *bx, double *cx, double *fa, double *fb, double *fc,
   if (*fb > *fa)
     {
       SHFT (dum, *ax, *bx, dum)
-	SHFT (dum, *fb, *fa, dum)
+        SHFT (dum, *fb, *fa, dum)
     }
   *cx = (*bx) + GOLD * (*bx - *ax);
   *fc = (*func) (*cx);
@@ -27,49 +27,49 @@ mnbrak (double *ax, double *bx, double *cx, double *fa, double *fb, double *fc,
       r = (*bx - *ax) * (*fb - *fc);
       q = (*bx - *cx) * (*fb - *fa);
       u = (*bx) - ((*bx - *cx) * q - (*bx - *ax) * r) /
-	(2.0 * SIGN (FMAX (fabs (q - r), TINY), q - r));
+        (2.0 * SIGN (FMAX (fabs (q - r), TINY), q - r));
       ulim = (*bx) + GLIMIT * (*cx - *bx);
       if ((*bx - u) * (u - *cx) > 0.0)
-	{
-	  fu = (*func) (u);
-	  if (fu < *fc)
-	    {
-	      *ax = (*bx);
-	      *bx = u;
-	      *fa = (*fb);
-	      *fb = fu;
-	      return;
-	    }
-	  else if (fu > *fb)
-	    {
-	      *cx = u;
-	      *fc = fu;
-	      return;
-	    }
-	  u = (*cx) + GOLD * (*cx - *bx);
-	  fu = (*func) (u);
-	}
+        {
+          fu = (*func) (u);
+          if (fu < *fc)
+            {
+              *ax = (*bx);
+              *bx = u;
+              *fa = (*fb);
+              *fb = fu;
+              return;
+            }
+          else if (fu > *fb)
+            {
+              *cx = u;
+              *fc = fu;
+              return;
+            }
+          u = (*cx) + GOLD * (*cx - *bx);
+          fu = (*func) (u);
+        }
       else if ((*cx - u) * (u - ulim) > 0.0)
-	{
-	  fu = (*func) (u);
-	  if (fu < *fc)
-	    {
-	      SHFT (*bx, *cx, u, *cx + GOLD * (*cx - *bx))
-		SHFT (*fb, *fc, fu, (*func) (u))
-	    }
-	}
+        {
+          fu = (*func) (u);
+          if (fu < *fc)
+            {
+              SHFT (*bx, *cx, u, *cx + GOLD * (*cx - *bx))
+                SHFT (*fb, *fc, fu, (*func) (u))
+            }
+        }
       else if ((u - ulim) * (ulim - *cx) >= 0.0)
-	{
-	  u = ulim;
-	  fu = (*func) (u);
-	}
+        {
+          u = ulim;
+          fu = (*func) (u);
+        }
       else
-	{
-	  u = (*cx) + GOLD * (*cx - *bx);
-	  fu = (*func) (u);
-	}
+        {
+          u = (*cx) + GOLD * (*cx - *bx);
+          fu = (*func) (u);
+        }
       SHFT (*ax, *bx, *cx, u)
-	SHFT (*fa, *fb, *fc, fu)
+        SHFT (*fa, *fb, *fc, fu)
     }
 }
 #undef GOLD
diff --git a/Adapt/newt.cpp b/Adapt/newt.cpp
index 74cd42e6bf..0b6f13c095 100644
--- a/Adapt/newt.cpp
+++ b/Adapt/newt.cpp
@@ -1,4 +1,4 @@
-/* $Id: newt.cpp,v 1.2 2000-11-23 14:11:24 geuzaine Exp $ */
+/* $Id: newt.cpp,v 1.3 2000-11-26 15:43:44 geuzaine Exp $ */
 #include <math.h>
 #define NRANSI
 #include "nrutil.h"
@@ -12,18 +12,18 @@ int nn;
 float *fvec;
 void (*nrfuncv) (int n, float v[], float f[]);
 #define FREERETURN {free_vector(fvec,1,n);free_vector(xold,1,n);\
-	free_vector(p,1,n);free_vector(g,1,n);free_matrix(fjac,1,n,1,n);\
-	free_ivector(indx,1,n);return;}
+        free_vector(p,1,n);free_vector(g,1,n);free_matrix(fjac,1,n,1,n);\
+        free_ivector(indx,1,n);return;}
 
 void 
 newt (float x[], int n, int *check,
       void (*vecfunc) (int, float[], float[]))
 {
   void fdjac (int n, float x[], float fvec[], float **df,
-	      void (*vecfunc) (int, float[], float[]));
+              void (*vecfunc) (int, float[], float[]));
   float fmin (float x[]);
   void lnsrch (int n, float xold[], float fold, float g[], float p[], float x[],
-	       float *f, float stpmax, int *check, float (*func) (float[]));
+               float *f, float stpmax, int *check, float (*func) (float[]));
   void lubksb (float **a, int n, int *indx, float b[]);
   void ludcmp (float **a, int n, int *indx, float *d);
   int i, its, j, *indx;
@@ -51,52 +51,52 @@ newt (float x[], int n, int *check,
     {
       fdjac (n, x, fvec, fjac, vecfunc);
       for (i = 1; i <= n; i++)
-	{
-	  for (sum = 0.0, j = 1; j <= n; j++)
-	    sum += fjac[j][i] * fvec[j];
-	  g[i] = sum;
-	}
+        {
+          for (sum = 0.0, j = 1; j <= n; j++)
+            sum += fjac[j][i] * fvec[j];
+          g[i] = sum;
+        }
       for (i = 1; i <= n; i++)
-	xold[i] = x[i];
+        xold[i] = x[i];
       fold = f;
       for (i = 1; i <= n; i++)
-	p[i] = -fvec[i];
+        p[i] = -fvec[i];
       ludcmp (fjac, n, indx, &d);
       lubksb (fjac, n, indx, p);
       lnsrch (n, xold, fold, g, p, x, &f, stpmax, check, fmin);
       test = 0.0;
       for (i = 1; i <= n; i++)
-	if (fabs (fvec[i]) > test)
-	  test = fabs (fvec[i]);
+        if (fabs (fvec[i]) > test)
+          test = fabs (fvec[i]);
       if (test < TOLF)
-	{
-	  *check = 0;
-	  FREERETURN
-	}
+        {
+          *check = 0;
+          FREERETURN
+        }
       if (*check)
-	{
-	  test = 0.0;
-	  den = FMAX (f, 0.5 * n);
-	  for (i = 1; i <= n; i++)
-	    {
-	      temp = fabs (g[i]) * FMAX (fabs (x[i]), 1.0) / den;
-	      if (temp > test)
-		test = temp;
-	    }
-	  *check = (test < TOLMIN ? 1 : 0);
-	  FREERETURN
-	}
+        {
+          test = 0.0;
+          den = FMAX (f, 0.5 * n);
+          for (i = 1; i <= n; i++)
+            {
+              temp = fabs (g[i]) * FMAX (fabs (x[i]), 1.0) / den;
+              if (temp > test)
+                test = temp;
+            }
+          *check = (test < TOLMIN ? 1 : 0);
+          FREERETURN
+        }
       test = 0.0;
       for (i = 1; i <= n; i++)
-	{
-	  temp = (fabs (x[i] - xold[i])) / FMAX (fabs (x[i]), 1.0);
-	  if (temp > test)
-	    test = temp;
-	}
+        {
+          temp = (fabs (x[i] - xold[i])) / FMAX (fabs (x[i]), 1.0);
+          if (temp > test)
+            test = temp;
+        }
       if (test < TOLX)
-	FREERETURN
-	}
-	nrerror ("MAXITS exceeded in newt");
+        FREERETURN
+        }
+        nrerror ("MAXITS exceeded in newt");
     }
 #undef MAXITS
 #undef TOLF
diff --git a/Adapt/nrutil.cpp b/Adapt/nrutil.cpp
index 9b6bea8d2a..c2d854ebf0 100644
--- a/Adapt/nrutil.cpp
+++ b/Adapt/nrutil.cpp
@@ -1,4 +1,4 @@
-/* $Id: nrutil.cpp,v 1.2 2000-11-23 14:11:24 geuzaine Exp $ */
+/* $Id: nrutil.cpp,v 1.3 2000-11-26 15:43:44 geuzaine Exp $ */
 #include <stdio.h>
 #include <stddef.h>
 #include <stdlib.h>
@@ -11,153 +11,153 @@
 void nrerror(char error_text[])
 /* Numerical Recipes standard error handler */
 {
-	fprintf(stderr,"Numerical Recipes run-time error...\n");
-	fprintf(stderr,"%s\n",error_text);
-	fprintf(stderr,"...now exiting to system...\n");
-	exit(1);
+        fprintf(stderr,"Numerical Recipes run-time error...\n");
+        fprintf(stderr,"%s\n",error_text);
+        fprintf(stderr,"...now exiting to system...\n");
+        exit(1);
 }
 
 float *vector(long nl, long nh)
 /* allocate a float vector with subscript range v[nl..nh] */
 {
-	float *v;
+        float *v;
 
-	v=(float *)malloc((size_t) ((nh-nl+1+NR_END)*sizeof(float)));
-	if (!v) nrerror("allocation failure in vector()");
-	return v-nl+NR_END;
+        v=(float *)malloc((size_t) ((nh-nl+1+NR_END)*sizeof(float)));
+        if (!v) nrerror("allocation failure in vector()");
+        return v-nl+NR_END;
 }
 
 int *ivector(long nl, long nh)
 /* allocate an int vector with subscript range v[nl..nh] */
 {
-	int *v;
+        int *v;
 
-	v=(int *)malloc((size_t) ((nh-nl+1+NR_END)*sizeof(int)));
-	if (!v) nrerror("allocation failure in ivector()");
-	return v-nl+NR_END;
+        v=(int *)malloc((size_t) ((nh-nl+1+NR_END)*sizeof(int)));
+        if (!v) nrerror("allocation failure in ivector()");
+        return v-nl+NR_END;
 }
 
 unsigned char *cvector(long nl, long nh)
 /* allocate an unsigned char vector with subscript range v[nl..nh] */
 {
-	unsigned char *v;
+        unsigned char *v;
 
-	v=(unsigned char *)malloc((size_t) ((nh-nl+1+NR_END)*sizeof(unsigned char)));
-	if (!v) nrerror("allocation failure in cvector()");
-	return v-nl+NR_END;
+        v=(unsigned char *)malloc((size_t) ((nh-nl+1+NR_END)*sizeof(unsigned char)));
+        if (!v) nrerror("allocation failure in cvector()");
+        return v-nl+NR_END;
 }
 
 unsigned long *lvector(long nl, long nh)
 /* allocate an unsigned long vector with subscript range v[nl..nh] */
 {
-	unsigned long *v;
+        unsigned long *v;
 
-	v=(unsigned long *)malloc((size_t) ((nh-nl+1+NR_END)*sizeof(long)));
-	if (!v) nrerror("allocation failure in lvector()");
-	return v-nl+NR_END;
+        v=(unsigned long *)malloc((size_t) ((nh-nl+1+NR_END)*sizeof(long)));
+        if (!v) nrerror("allocation failure in lvector()");
+        return v-nl+NR_END;
 }
 
 double *dvector(long nl, long nh)
 /* allocate a double vector with subscript range v[nl..nh] */
 {
-	double *v;
+        double *v;
 
-	v=(double *)malloc((size_t) ((nh-nl+1+NR_END)*sizeof(double)));
-	if (!v) nrerror("allocation failure in dvector()");
-	return v-nl+NR_END;
+        v=(double *)malloc((size_t) ((nh-nl+1+NR_END)*sizeof(double)));
+        if (!v) nrerror("allocation failure in dvector()");
+        return v-nl+NR_END;
 }
 
 float **matrix(long nrl, long nrh, long ncl, long nch)
 /* allocate a float matrix with subscript range m[nrl..nrh][ncl..nch] */
 {
-	long i, nrow=nrh-nrl+1,ncol=nch-ncl+1;
-	float **m;
+        long i, nrow=nrh-nrl+1,ncol=nch-ncl+1;
+        float **m;
 
-	/* allocate pointers to rows */
-	m=(float **) malloc((size_t)((nrow+NR_END)*sizeof(float*)));
-	if (!m) nrerror("allocation failure 1 in matrix()");
-	m += NR_END;
-	m -= nrl;
+        /* allocate pointers to rows */
+        m=(float **) malloc((size_t)((nrow+NR_END)*sizeof(float*)));
+        if (!m) nrerror("allocation failure 1 in matrix()");
+        m += NR_END;
+        m -= nrl;
 
-	/* allocate rows and set pointers to them */
-	m[nrl]=(float *) malloc((size_t)((nrow*ncol+NR_END)*sizeof(float)));
-	if (!m[nrl]) nrerror("allocation failure 2 in matrix()");
-	m[nrl] += NR_END;
-	m[nrl] -= ncl;
+        /* allocate rows and set pointers to them */
+        m[nrl]=(float *) malloc((size_t)((nrow*ncol+NR_END)*sizeof(float)));
+        if (!m[nrl]) nrerror("allocation failure 2 in matrix()");
+        m[nrl] += NR_END;
+        m[nrl] -= ncl;
 
-	for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol;
+        for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol;
 
-	/* return pointer to array of pointers to rows */
-	return m;
+        /* return pointer to array of pointers to rows */
+        return m;
 }
 
 double **dmatrix(long nrl, long nrh, long ncl, long nch)
 /* allocate a double matrix with subscript range m[nrl..nrh][ncl..nch] */
 {
-	long i, nrow=nrh-nrl+1,ncol=nch-ncl+1;
-	double **m;
+        long i, nrow=nrh-nrl+1,ncol=nch-ncl+1;
+        double **m;
 
-	/* allocate pointers to rows */
-	m=(double **) malloc((size_t)((nrow+NR_END)*sizeof(double*)));
-	if (!m) nrerror("allocation failure 1 in matrix()");
-	m += NR_END;
-	m -= nrl;
+        /* allocate pointers to rows */
+        m=(double **) malloc((size_t)((nrow+NR_END)*sizeof(double*)));
+        if (!m) nrerror("allocation failure 1 in matrix()");
+        m += NR_END;
+        m -= nrl;
 
-	/* allocate rows and set pointers to them */
-	m[nrl]=(double *) malloc((size_t)((nrow*ncol+NR_END)*sizeof(double)));
-	if (!m[nrl]) nrerror("allocation failure 2 in matrix()");
-	m[nrl] += NR_END;
-	m[nrl] -= ncl;
+        /* allocate rows and set pointers to them */
+        m[nrl]=(double *) malloc((size_t)((nrow*ncol+NR_END)*sizeof(double)));
+        if (!m[nrl]) nrerror("allocation failure 2 in matrix()");
+        m[nrl] += NR_END;
+        m[nrl] -= ncl;
 
-	for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol;
+        for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol;
 
-	/* return pointer to array of pointers to rows */
-	return m;
+        /* return pointer to array of pointers to rows */
+        return m;
 }
 
 int **imatrix(long nrl, long nrh, long ncl, long nch)
 /* allocate a int matrix with subscript range m[nrl..nrh][ncl..nch] */
 {
-	long i, nrow=nrh-nrl+1,ncol=nch-ncl+1;
-	int **m;
+        long i, nrow=nrh-nrl+1,ncol=nch-ncl+1;
+        int **m;
 
-	/* allocate pointers to rows */
-	m=(int **) malloc((size_t)((nrow+NR_END)*sizeof(int*)));
-	if (!m) nrerror("allocation failure 1 in matrix()");
-	m += NR_END;
-	m -= nrl;
+        /* allocate pointers to rows */
+        m=(int **) malloc((size_t)((nrow+NR_END)*sizeof(int*)));
+        if (!m) nrerror("allocation failure 1 in matrix()");
+        m += NR_END;
+        m -= nrl;
 
 
-	/* allocate rows and set pointers to them */
-	m[nrl]=(int *) malloc((size_t)((nrow*ncol+NR_END)*sizeof(int)));
-	if (!m[nrl]) nrerror("allocation failure 2 in matrix()");
-	m[nrl] += NR_END;
-	m[nrl] -= ncl;
+        /* allocate rows and set pointers to them */
+        m[nrl]=(int *) malloc((size_t)((nrow*ncol+NR_END)*sizeof(int)));
+        if (!m[nrl]) nrerror("allocation failure 2 in matrix()");
+        m[nrl] += NR_END;
+        m[nrl] -= ncl;
 
-	for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol;
+        for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol;
 
-	/* return pointer to array of pointers to rows */
-	return m;
+        /* return pointer to array of pointers to rows */
+        return m;
 }
 
 float **submatrix(float **a, long oldrl, long oldrh, long oldcl, long oldch,
-	long newrl, long newcl)
+        long newrl, long newcl)
 /* point a submatrix [newrl..][newcl..] to a[oldrl..oldrh][oldcl..oldch] */
 {
-	long i,j,nrow=oldrh-oldrl+1,ncol=oldcl-newcl;
-	float **m;
+        long i,j,nrow=oldrh-oldrl+1,ncol=oldcl-newcl;
+        float **m;
 
-	/* allocate array of pointers to rows */
-	m=(float **) malloc((size_t) ((nrow+NR_END)*sizeof(float*)));
-	if (!m) nrerror("allocation failure in submatrix()");
-	m += NR_END;
-	m -= newrl;
+        /* allocate array of pointers to rows */
+        m=(float **) malloc((size_t) ((nrow+NR_END)*sizeof(float*)));
+        if (!m) nrerror("allocation failure in submatrix()");
+        m += NR_END;
+        m -= newrl;
 
-	/* set pointers to rows */
-	for(i=oldrl,j=newrl;i<=oldrh;i++,j++) m[j]=a[i]+ncol;
+        /* set pointers to rows */
+        for(i=oldrl,j=newrl;i<=oldrh;i++,j++) m[j]=a[i]+ncol;
 
-	/* return pointer to array of pointers to rows */
-	return m;
+        /* return pointer to array of pointers to rows */
+        return m;
 }
 
 float **convert_matrix(float *a, long nrl, long nrh, long ncl, long nch)
@@ -166,126 +166,126 @@ declared in the standard C manner as a[nrow][ncol], where nrow=nrh-nrl+1
 and ncol=nch-ncl+1. The routine should be called with the address
 &a[0][0] as the first argument. */
 {
-	long i,j,nrow=nrh-nrl+1,ncol=nch-ncl+1;
-	float **m;
-
-	/* allocate pointers to rows */
-	m=(float **) malloc((size_t) ((nrow+NR_END)*sizeof(float*)));
-	if (!m) nrerror("allocation failure in convert_matrix()");
-	m += NR_END;
-	m -= nrl;
-
-	/* set pointers to rows */
-	m[nrl]=a-ncl;
-	for(i=1,j=nrl+1;i<nrow;i++,j++) m[j]=m[j-1]+ncol;
-	/* return pointer to array of pointers to rows */
-	return m;
+        long i,j,nrow=nrh-nrl+1,ncol=nch-ncl+1;
+        float **m;
+
+        /* allocate pointers to rows */
+        m=(float **) malloc((size_t) ((nrow+NR_END)*sizeof(float*)));
+        if (!m) nrerror("allocation failure in convert_matrix()");
+        m += NR_END;
+        m -= nrl;
+
+        /* set pointers to rows */
+        m[nrl]=a-ncl;
+        for(i=1,j=nrl+1;i<nrow;i++,j++) m[j]=m[j-1]+ncol;
+        /* return pointer to array of pointers to rows */
+        return m;
 }
 
 float ***f3tensor(long nrl, long nrh, long ncl, long nch, long ndl, long ndh)
 /* allocate a float 3tensor with range t[nrl..nrh][ncl..nch][ndl..ndh] */
 {
-	long i,j,nrow=nrh-nrl+1,ncol=nch-ncl+1,ndep=ndh-ndl+1;
-	float ***t;
-
-	/* allocate pointers to pointers to rows */
-	t=(float ***) malloc((size_t)((nrow+NR_END)*sizeof(float**)));
-	if (!t) nrerror("allocation failure 1 in f3tensor()");
-	t += NR_END;
-	t -= nrl;
-
-	/* allocate pointers to rows and set pointers to them */
-	t[nrl]=(float **) malloc((size_t)((nrow*ncol+NR_END)*sizeof(float*)));
-	if (!t[nrl]) nrerror("allocation failure 2 in f3tensor()");
-	t[nrl] += NR_END;
-	t[nrl] -= ncl;
-
-	/* allocate rows and set pointers to them */
-	t[nrl][ncl]=(float *) malloc((size_t)((nrow*ncol*ndep+NR_END)*sizeof(float)));
-	if (!t[nrl][ncl]) nrerror("allocation failure 3 in f3tensor()");
-	t[nrl][ncl] += NR_END;
-	t[nrl][ncl] -= ndl;
-
-	for(j=ncl+1;j<=nch;j++) t[nrl][j]=t[nrl][j-1]+ndep;
-	for(i=nrl+1;i<=nrh;i++) {
-		t[i]=t[i-1]+ncol;
-		t[i][ncl]=t[i-1][ncl]+ncol*ndep;
-		for(j=ncl+1;j<=nch;j++) t[i][j]=t[i][j-1]+ndep;
-	}
-
-	/* return pointer to array of pointers to rows */
-	return t;
+        long i,j,nrow=nrh-nrl+1,ncol=nch-ncl+1,ndep=ndh-ndl+1;
+        float ***t;
+
+        /* allocate pointers to pointers to rows */
+        t=(float ***) malloc((size_t)((nrow+NR_END)*sizeof(float**)));
+        if (!t) nrerror("allocation failure 1 in f3tensor()");
+        t += NR_END;
+        t -= nrl;
+
+        /* allocate pointers to rows and set pointers to them */
+        t[nrl]=(float **) malloc((size_t)((nrow*ncol+NR_END)*sizeof(float*)));
+        if (!t[nrl]) nrerror("allocation failure 2 in f3tensor()");
+        t[nrl] += NR_END;
+        t[nrl] -= ncl;
+
+        /* allocate rows and set pointers to them */
+        t[nrl][ncl]=(float *) malloc((size_t)((nrow*ncol*ndep+NR_END)*sizeof(float)));
+        if (!t[nrl][ncl]) nrerror("allocation failure 3 in f3tensor()");
+        t[nrl][ncl] += NR_END;
+        t[nrl][ncl] -= ndl;
+
+        for(j=ncl+1;j<=nch;j++) t[nrl][j]=t[nrl][j-1]+ndep;
+        for(i=nrl+1;i<=nrh;i++) {
+                t[i]=t[i-1]+ncol;
+                t[i][ncl]=t[i-1][ncl]+ncol*ndep;
+                for(j=ncl+1;j<=nch;j++) t[i][j]=t[i][j-1]+ndep;
+        }
+
+        /* return pointer to array of pointers to rows */
+        return t;
 }
 
 void free_vector(float *v, long nl, long nh)
 /* free a float vector allocated with vector() */
 {
-	free((FREE_ARG) (v+nl-NR_END));
+        free((FREE_ARG) (v+nl-NR_END));
 }
 
 void free_ivector(int *v, long nl, long nh)
 /* free an int vector allocated with ivector() */
 {
-	free((FREE_ARG) (v+nl-NR_END));
+        free((FREE_ARG) (v+nl-NR_END));
 }
 
 void free_cvector(unsigned char *v, long nl, long nh)
 /* free an unsigned char vector allocated with cvector() */
 {
-	free((FREE_ARG) (v+nl-NR_END));
+        free((FREE_ARG) (v+nl-NR_END));
 }
 
 void free_lvector(unsigned long *v, long nl, long nh)
 /* free an unsigned long vector allocated with lvector() */
 {
-	free((FREE_ARG) (v+nl-NR_END));
+        free((FREE_ARG) (v+nl-NR_END));
 }
 
 void free_dvector(double *v, long nl, long nh)
 /* free a double vector allocated with dvector() */
 {
-	free((FREE_ARG) (v+nl-NR_END));
+        free((FREE_ARG) (v+nl-NR_END));
 }
 
 void free_matrix(float **m, long nrl, long nrh, long ncl, long nch)
 /* free a float matrix allocated by matrix() */
 {
-	free((FREE_ARG) (m[nrl]+ncl-NR_END));
-	free((FREE_ARG) (m+nrl-NR_END));
+        free((FREE_ARG) (m[nrl]+ncl-NR_END));
+        free((FREE_ARG) (m+nrl-NR_END));
 }
 
 void free_dmatrix(double **m, long nrl, long nrh, long ncl, long nch)
 /* free a double matrix allocated by dmatrix() */
 {
-	free((FREE_ARG) (m[nrl]+ncl-NR_END));
-	free((FREE_ARG) (m+nrl-NR_END));
+        free((FREE_ARG) (m[nrl]+ncl-NR_END));
+        free((FREE_ARG) (m+nrl-NR_END));
 }
 
 void free_imatrix(int **m, long nrl, long nrh, long ncl, long nch)
 /* free an int matrix allocated by imatrix() */
 {
-	free((FREE_ARG) (m[nrl]+ncl-NR_END));
-	free((FREE_ARG) (m+nrl-NR_END));
+        free((FREE_ARG) (m[nrl]+ncl-NR_END));
+        free((FREE_ARG) (m+nrl-NR_END));
 }
 
 void free_submatrix(float **b, long nrl, long nrh, long ncl, long nch)
 /* free a submatrix allocated by submatrix() */
 {
-	free((FREE_ARG) (b+nrl-NR_END));
+        free((FREE_ARG) (b+nrl-NR_END));
 }
 
 void free_convert_matrix(float **b, long nrl, long nrh, long ncl, long nch)
 /* free a matrix allocated by convert_matrix() */
 {
-	free((FREE_ARG) (b+nrl-NR_END));
+        free((FREE_ARG) (b+nrl-NR_END));
 }
 
 void free_f3tensor(float ***t, long nrl, long nrh, long ncl, long nch,
-	long ndl, long ndh)
+        long ndl, long ndh)
 /* free a float f3tensor allocated by f3tensor() */
 {
-	free((FREE_ARG) (t[nrl][ncl]+ndl-NR_END));
-	free((FREE_ARG) (t[nrl]+ncl-NR_END));
-	free((FREE_ARG) (t+nrl-NR_END));
+        free((FREE_ARG) (t[nrl][ncl]+ndl-NR_END));
+        free((FREE_ARG) (t[nrl]+ncl-NR_END));
+        free((FREE_ARG) (t+nrl-NR_END));
 }
 
diff --git a/Adapt/nrutil.h b/Adapt/nrutil.h
index 6b2744317d..080d0fd56b 100644
--- a/Adapt/nrutil.h
+++ b/Adapt/nrutil.h
@@ -1,4 +1,4 @@
-/* $Id: nrutil.h,v 1.2 2000-11-23 14:11:24 geuzaine Exp $ */
+/* $Id: nrutil.h,v 1.3 2000-11-26 15:43:44 geuzaine Exp $ */
 #ifndef _NR_UTILS_H_
 #define _NR_UTILS_H_
 
@@ -16,7 +16,7 @@ float **matrix (long nrl, long nrh, long ncl, long nch);
 double **dmatrix (long nrl, long nrh, long ncl, long nch);
 int **imatrix (long nrl, long nrh, long ncl, long nch);
 float **submatrix (float **a, long oldrl, long oldrh, long oldcl, long oldch,
-		   long newrl, long newcl);
+                   long newrl, long newcl);
 float **convert_matrix (float *a, long nrl, long nrh, long ncl, long nch);
 float ***f3tensor (long nrl, long nrh, long ncl, long nch, long ndl, long ndh);
 void free_vector (float *v, long nl, long nh);
@@ -30,7 +30,7 @@ void free_imatrix (int **m, long nrl, long nrh, long ncl, long nch);
 void free_submatrix (float **b, long nrl, long nrh, long ncl, long nch);
 void free_convert_matrix (float **b, long nrl, long nrh, long ncl, long nch);
 void free_f3tensor (float ***t, long nrl, long nrh, long ncl, long nch,
-		    long ndl, long ndh);
+                    long ndl, long ndh);
 
 
 #endif /* _NR_UTILS_H_ */
diff --git a/Box/Box.cpp b/Box/Box.cpp
index c48e133151..0d2dda4683 100644
--- a/Box/Box.cpp
+++ b/Box/Box.cpp
@@ -1,4 +1,4 @@
-/* $Id: Box.cpp,v 1.8 2000-11-25 15:26:10 geuzaine Exp $ */
+/* $Id: Box.cpp,v 1.9 2000-11-26 15:43:44 geuzaine Exp $ */
 
 #include <signal.h>
 
@@ -15,6 +15,7 @@
 
 #include "Static.h"
 
+extern List_T *Post_ViewList;
 
 char *TheFileNameTab[MAX_OPEN_FILES];
 char *ThePathForIncludes=NULL, *TheBgmFileName=NULL;
@@ -42,7 +43,7 @@ char gmsh_help[]      =
   "  -scale float          set global scaling factor (default: 1.0)\n"
   "  -clscale float        set characteristic length scaling factor (default: 1.0)\n"
   "  -bgm file             load backround mesh from file\n"
-  "Other options:\n"	  
+  "Other options:\n"      
   "  -v                    print debug information\n"
   "  -path string          set path for included files\n"
   "  -version              show version number\n"
@@ -53,10 +54,10 @@ char gmsh_help[]      =
 
 /* dummy defs for link purposes */
 
-void color_table_init_param (int number, ColorTable * ct, int rgb_flag, int alpha_flag){;}
-void color_table_recompute (ColorTable * ct, int rgb_flag, int alpha_flag){;}
+void ColorTable_InitParam (int number, ColorTable * ct, int rgb_flag, int alpha_flag){;}
+void ColorTable_Recompute (ColorTable * ct, int rgb_flag, int alpha_flag){;}
 void ZeroHighlight(Mesh *){;}
-void AddView(int, char *, int){;}
+void AddViewInUI(int, char *, int){;}
 void draw_polygon_2d (double, double, double, int, double *, double *, double *){;}
 
 /* ------------------------------------------------------------------------ */
@@ -160,119 +161,141 @@ void Get_Options (int argc, char *argv[], int *nbfiles) {
     if (argv[i][0] == '-') {
       
       if(!strcmp(argv[i]+1, "0")){ 
-	CTX.interactive = -1; i++;
+        CTX.interactive = -1; i++;
       }
       else if(!strcmp(argv[i]+1, "1")){ 
-	CTX.interactive = 1; i++;
+        CTX.interactive = 1; i++;
       }
       else if(!strcmp(argv[i]+1, "2")){ 
-	CTX.interactive = 2; i++;
+        CTX.interactive = 2; i++;
       }
       else if(!strcmp(argv[i]+1, "3")){ 
-	CTX.interactive = 3; i++;
+        CTX.interactive = 3; i++;
       }
       else if(!strcmp(argv[i]+1, "v")){ 
-	VERBOSE = 1; i++;
+        VERBOSE = 1; i++;
       }
       else if(!strcmp(argv[i]+1, "path")){ 
-	i++;
-	if(argv[i] != NULL) ThePathForIncludes = argv[i++];
+        i++;
+        if(argv[i] != NULL) ThePathForIncludes = argv[i++];
+        else{
+          fprintf(stderr, ERROR_STR "Missing String\n");
+          exit(1);
+        }
       }
       else if(!strcmp(argv[i]+1, "bgm")){ 
-	i++;
-	if(argv[i] != NULL) TheBgmFileName = argv[i++];
+        i++;
+        if(argv[i] != NULL) TheBgmFileName = argv[i++];
+        else{
+          fprintf(stderr, ERROR_STR "Missing File Name\n");
+          exit(1);
+        }
       }
       else if(!strcmp(argv[i]+1, "smooth")){ 
-	i++;
-	CTX.mesh.nb_smoothing = atoi(argv[i]); i++;
+        i++;
+        if(argv[i] != NULL) CTX.mesh.nb_smoothing = atoi(argv[i++]);
+        else{
+          fprintf(stderr, ERROR_STR "Missing Number\n");
+          exit(1);
+        }
       }
       else if(!strcmp(argv[i]+1, "scale")){
-	i++;
-	CTX.mesh.scaling_factor = atof(argv[i]); i++;
+        i++;
+        if(argv[i] != NULL) CTX.mesh.scaling_factor = atof(argv[i++]);
+        else{
+          fprintf(stderr, ERROR_STR "Missing Number\n");
+          exit(1);
+        }
       }
       else if(!strcmp(argv[i]+1, "clscale")){
-	i++;
-	CTX.mesh.lc_factor = atof(argv[i]); i++;
-	if(CTX.mesh.lc_factor <= 0.0){
-	  fprintf(stderr, ERROR_STR 
-		  "Characteristic Length Factor Must be > 0\n");
-	  exit(1);
-	}
+        i++;
+        if(argv[i]!=NULL){
+          CTX.mesh.lc_factor = atof(argv[i++]);
+          if(CTX.mesh.lc_factor <= 0.0){
+            fprintf(stderr, ERROR_STR 
+                    "Characteristic Length Factor Must be > 0\n");
+            exit(1);
+          }
+        }
+        else {    
+          fprintf(stderr, ERROR_STR "Missing Number\n");
+          exit(1);
+        }
       }
       else if(!strcmp(argv[i]+1, "degree")){  
-	i++;
-	if(argv[i]!=NULL){
-	  CTX.mesh.degree = atoi(argv[i]); i++;
-	  if(CTX.mesh.degree != 1 || CTX.mesh.degree != 2){
-	    fprintf(stderr, ERROR_STR "Wrong degree\n");
-	    exit(1);
-	  }
-	}
-	else {	  
-	  fprintf(stderr, ERROR_STR "Missing Number\n");
-	  exit(1);
-	}
+        i++;
+        if(argv[i]!=NULL){
+          CTX.mesh.degree = atoi(argv[i++]);
+          if(CTX.mesh.degree != 1 || CTX.mesh.degree != 2){
+            fprintf(stderr, ERROR_STR "Wrong degree\n");
+            exit(1);
+          }
+        }
+        else {    
+          fprintf(stderr, ERROR_STR "Missing Number\n");
+          exit(1);
+        }
       }
       else if(!strcmp(argv[i]+1, "format")){  
-	i++;
-	if(argv[i]!=NULL){
-	  if(!strcmp(argv[i],"msh"))
-	    CTX.mesh.format = FORMAT_MSH ;
-	  else if(!strcmp(argv[i],"unv"))
-	    CTX.mesh.format = FORMAT_UNV ;
-	  else if(!strcmp(argv[i],"gref"))
-	    CTX.mesh.format = FORMAT_GREF ;
-	  else{
-	    fprintf(stderr, ERROR_STR "Unknown mesh format\n");
-	    exit(1);
-	  }
-	  i++;
-	}
-	else {	  
-	  fprintf(stderr, ERROR_STR "Missing format\n");
-	  exit(1);
-	}
+        i++;
+        if(argv[i]!=NULL){
+          if(!strcmp(argv[i],"msh"))
+            CTX.mesh.format = FORMAT_MSH ;
+          else if(!strcmp(argv[i],"unv"))
+            CTX.mesh.format = FORMAT_UNV ;
+          else if(!strcmp(argv[i],"gref"))
+            CTX.mesh.format = FORMAT_GREF ;
+          else{
+            fprintf(stderr, ERROR_STR "Unknown mesh format\n");
+            exit(1);
+          }
+          i++;
+        }
+        else {    
+          fprintf(stderr, ERROR_STR "Missing format\n");
+          exit(1);
+        }
       }
       else if(!strcmp(argv[i]+1, "algo")){  
-	i++;
-	if(argv[i]!=NULL){
-	  if(!strcmp(argv[i],"iso"))
-	    CTX.mesh.algo = DELAUNAY_OLDALGO ;
-	  else if(!strcmp(argv[i],"aniso"))
-	    CTX.mesh.algo = DELAUNAY_NEWALGO ;
-	  else{
-	    fprintf(stderr, ERROR_STR "Unknown mesh algorithm\n");
-	    exit(1);
-	  }
-	  i++;
-	}
-	else {	  
-	  fprintf(stderr, ERROR_STR "Missing algorithm\n");
-	  exit(1);
-	}
+        i++;
+        if(argv[i]!=NULL){
+          if(!strcmp(argv[i],"iso"))
+            CTX.mesh.algo = DELAUNAY_OLDALGO ;
+          else if(!strcmp(argv[i],"aniso"))
+            CTX.mesh.algo = DELAUNAY_NEWALGO ;
+          else{
+            fprintf(stderr, ERROR_STR "Unknown mesh algorithm\n");
+            exit(1);
+          }
+          i++;
+        }
+        else {    
+          fprintf(stderr, ERROR_STR "Missing algorithm\n");
+          exit(1);
+        }
       }
       else if(!strcmp(argv[i]+1, "info")){
-	Info(2,argv[0]); 
+        Info(2,argv[0]); 
       }
       else if(!strcmp(argv[i]+1, "version")){
-	Info(1,argv[0]); 
+        Info(1,argv[0]); 
       }
       else if(!strcmp(argv[i]+1, "help")){
-	Info(0,argv[0]);
+        Info(0,argv[0]);
       }
       else{
-	fprintf(stderr, WARNING_STR "Unknown option '%s'\n", argv[i]);
-	Info(0,argv[0]);
+        fprintf(stderr, WARNING_STR "Unknown option '%s'\n", argv[i]);
+        Info(0,argv[0]);
       }
     }
 
     else {
       if(*nbfiles < MAX_OPEN_FILES){
-	TheFileNameTab[(*nbfiles)++] = argv[i++]; 
+        TheFileNameTab[(*nbfiles)++] = argv[i++]; 
       }
       else{
-	fprintf(stderr, ERROR_STR "Too many input files\n");
-	exit(1);
+        fprintf(stderr, ERROR_STR "Too many input files\n");
+        exit(1);
       }
     }
 
@@ -305,14 +328,10 @@ int main(int argc, char *argv[]){
     }
     if(TheBgmFileName){
       MergeProblem(TheBgmFileName);
-      if(List_Nbr(Post_ViewList)){
-	BGMWithView((Post_View*)List_Pointer(Post_ViewList, List_Nbr(Post_ViewList)-1));
-	TYPBGMESH = ONFILE; 
-	Create_BgMesh(TYPBGMESH,.2,THEM);
-      }
-      else{
-	fprintf(stderr, ERROR_STR "Invalid BGM (no view)\n"); exit(1);
-      }
+      if(List_Nbr(Post_ViewList))
+        BGMWithView((Post_View*)List_Pointer(Post_ViewList, List_Nbr(Post_ViewList)-1));
+      else
+        fprintf(stderr, ERROR_STR "Invalid BGM (no view)\n"); exit(1);
     }
     if(CTX.interactive > 0){
       mai3d(THEM, CTX.interactive);
diff --git a/Common/Const.h b/Common/Const.h
index 12ba3f3c6b..efe25c694b 100644
--- a/Common/Const.h
+++ b/Common/Const.h
@@ -1,16 +1,18 @@
-/* $Id: Const.h,v 1.3 2000-11-23 16:07:07 geuzaine Exp $ */
+/* $Id: Const.h,v 1.4 2000-11-26 15:43:44 geuzaine Exp $ */
 #ifndef _CONSTS_H_
 #define _CONSTS_H_
 
 #include <stdlib.h>
 
-//#define RAND_LONG    LC * ((rand()%1000)/1.E08)
-//#define RAND_LONG    LC * ((rand()%1000)/1.E08)/10.
+//#define RAND_LONG  LC * ((rand()%1000)/1.E08)
 
-//RAND_LONG in [0, LC/1.e6]
-#define RAND_LONG    (LC/1.e6*rand()/RAND_MAX)
+//RAND_LC in [0, LC]
+#define RAND_LC      (LC*rand()/RAND_MAX)
 
-//EPSILON_LONG in [0, LC/1.e12]
+//RAND_LC_MIN in [0, LC_MIN]
+#define RAND_LC_MIN  (LC_MIN*rand()/RAND_MAX)
+
+//RAND_EPS in [0, LC/1.e12]
 #define EPSILON_LC   (LC/1.e12*rand()/RAND_MAX)
 
 #define TEXT_BUFFER_SIZE       1024
@@ -27,7 +29,7 @@
 
 #define MIN(a,b) (((a)<(b))?(a):(b))
 #define MAX(a,b) (((a)<(b))?(b):(a))
-#define SQR(a)   (((a)==0.0)?0.0:((a)*(a)))
+#define SQR(a)   ((a)*(a))
 
 #define IMIN MIN
 #define LMIN MIN
diff --git a/Common/Context.cpp b/Common/Context.cpp
index 0d9d276dc7..cd2ebbd040 100644
--- a/Common/Context.cpp
+++ b/Common/Context.cpp
@@ -1,4 +1,4 @@
-/* $Id: Context.cpp,v 1.5 2000-11-25 15:26:10 geuzaine Exp $ */
+/* $Id: Context.cpp,v 1.6 2000-11-26 15:43:44 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "Const.h"
@@ -26,8 +26,8 @@ void InitColors(rgbacolors * col, int num){
       col->text             = PACK_COLOR(255, 255, 255, 255) ;
       col->axes             = PACK_COLOR(255, 255, 0,   255) ;
       col->little_axes      = PACK_COLOR(255, 255, 255, 255) ;
-      break;		  
-    case 1 :		  
+      break;              
+    case 1 :              
       col->bg               = PACK_COLOR(255, 255, 255, 255) ;
       col->fg               = PACK_COLOR(0,   0,   0,   255) ;
       col->text             = PACK_COLOR(0,   0,   0,   255) ;
@@ -159,6 +159,10 @@ void InitContext(Context_T *ctx){
   ctx->render_mode    = GMSH_RENDER ;
   ctx->pixel_equiv_x  = 0. ;
   ctx->pixel_equiv_y  = 0. ; 
+  ctx->clip_plane0[0]    = 0. ;
+  ctx->clip_plane0[1]    = 0. ;
+  ctx->clip_plane0[2]    = 0. ;
+  ctx->clip_plane0[3]    = 0. ;
 
   ctx->font_string          = "-*-helvetica-medium-r-*-*-*-*-*-*-*-*-*-*";
   ctx->colorbar_font_string = "fixed";
@@ -181,7 +185,7 @@ void InitContext(Context_T *ctx){
   ctx->fast              = 1 ;
   ctx->display_lists     = 0 ; 
   ctx->command_win       = 0 ;
-  ctx->threads           = 0 ; // bugge avec Open3D sur DEC ...
+  ctx->threads           = 1 ; // effective on Unix only with -D_USETHREADS
   ctx->threads_lock      = 0 ;
 
   ctx->geom.vis_type     = 0 ;
@@ -223,6 +227,7 @@ void InitContext(Context_T *ctx){
   ctx->mesh.degree            = 1 ;
   ctx->mesh.scaling_factor    = 1.0 ;
   ctx->mesh.lc_factor         = 1.0 ;
+  ctx->mesh.rand_factor       = 1.e-5 ;
   ctx->mesh.limit_gamma       = 0.0 ;
   ctx->mesh.limit_eta         = 0.0 ;
   ctx->mesh.limit_rho         = 0.0 ;
diff --git a/Common/Context.h b/Common/Context.h
index f26fe531f5..caf22b65ad 100644
--- a/Common/Context.h
+++ b/Common/Context.h
@@ -1,4 +1,4 @@
-/* $Id: Context.h,v 1.5 2000-11-25 15:26:10 geuzaine Exp $ */
+/* $Id: Context.h,v 1.6 2000-11-26 15:43:44 geuzaine Exp $ */
 #ifndef _CONTEXT_H_
 #define _CONTEXT_H_
 
@@ -8,7 +8,7 @@
 
 /* How RGBA values are packed and unpacked into/from a 4-byte integer */
 
-#  ifdef _LITTLE
+#  ifdef _LITTLE_ENDIAN
 #    define PACK_COLOR(R,G,B,A)   ( (A)<<24 | (B)<<16 | (G)<<8 | (R) )
 #    define UNPACK_RED(X)         ( (X) & 0xff )
 #    define UNPACK_GREEN(X)       ( ( (X) >> 8 ) & 0xff )
@@ -23,7 +23,7 @@
 #  endif
 
 typedef struct{
-  int id;			/* the current rgbacolors id */
+  int id;                       /* the current rgbacolors id */
   
   /* general colors */
   unsigned int bg, fg, text, axes, little_axes;
@@ -50,7 +50,7 @@ typedef struct{
 
 typedef struct {
 
-  int interactive;	      /* 0=full gfx; -1=just parse; 1,2,3=batch mesh */
+  int interactive;            /* 0=full gfx; -1=just parse; 1,2,3=batch mesh */
   int verbosity;              /* 0=silent -> 3=debug */
   int expose;                 /* 1 if everything is ready to expose and draw */
 
@@ -58,18 +58,20 @@ typedef struct {
   int rlock[3], tlock[3], slock[3];
                               /* locks for r, t and s */
   
-  double min[3];	      /* x, y and z min for the current geometry */
+  double min[3];              /* x, y and z min for the current geometry */
   double max[3];              /* x, y and z max for the current geometry */
-  double range[3];	      /* maximum range in the three directions */
+  double range[3];            /* maximum range in the three directions */
+  double lc, lc_middle;       /* characteristic lengths for the whole problem, */
+  double lc_order;            /* and never used in mesh generation (->only for geo/post) */
   
-  int db;		      /* double buffer? */
-  int overlay;	   	      /* overlay graphic window? */
-  int stream;		      /* output stream: TO_SCREEN or TO_FILE */
-  int ortho;		      /* orthogonal projection? */
-  int fast;		      /* inhibit mesh and postpro drawing when changing r,s,t */
-  int command_win;	      /* command window? */
-  int display_lists;	      /* use display lists? */
-  int font_base;	      /* display list indice for the font */
+  int db;                     /* double buffer? */
+  int overlay;                /* overlay graphic window? */
+  int stream;                 /* output stream: TO_SCREEN or TO_FILE */
+  int ortho;                  /* orthogonal projection? */
+  int fast;                   /* inhibit mesh and postpro drawing when changing r,s,t */
+  int command_win;            /* command window? */
+  int display_lists;          /* use display lists? */
+  int font_base;              /* display list indice for the font */
   int axes, little_axes;      /* draw axes? */
   int threads, threads_lock;  /* threads?, lock (should be a mutex...) */
   int alpha;                  /* enable alpha blending */
@@ -83,8 +85,14 @@ typedef struct {
   int viewport[4];
   float light0[4];            /* light source position */
   float shine;                /* specular value */
-  int render_mode;	      /* RENDER, SELECT, FEEDBACK */
-
+  int render_mode;            /* RENDER, SELECT, FEEDBACK */
+  int clip[6];                /* status of clip planes */
+  double clip_plane0[4];      /* clip plane 0 */
+  double clip_plane1[4];      /* clip plane 1 */
+  double clip_plane2[4];      /* clip plane 2 */
+  double clip_plane3[4];      /* clip plane 3 */
+  double clip_plane4[4];      /* clip plane 4 */
+  double clip_plane5[4];      /* clip plane 5 */
   double pixel_equiv_x, pixel_equiv_y ; 
                               /* approximative equivalent model lenght of a pixel */
   
@@ -108,7 +116,7 @@ typedef struct {
     int points, lines, surfaces, volumes;
     int points_num, lines_num, surfaces_num, volumes_num;
     double limit_gamma, limit_eta, limit_rho;
-    double scaling_factor, lc_factor;
+    double scaling_factor, lc_factor, rand_factor;
     int dual, interactive;
     int hidden, shade;
     int format, nb_smoothing, algo, degree;
diff --git a/Common/Static.h b/Common/Static.h
index bfa6cc702b..e0d0af1023 100644
--- a/Common/Static.h
+++ b/Common/Static.h
@@ -1,23 +1,20 @@
-/* $Id: Static.h,v 1.5 2000-11-25 15:26:10 geuzaine Exp $ */
+/* $Id: Static.h,v 1.6 2000-11-26 15:43:44 geuzaine Exp $ */
 #ifndef _STATIC_H_
 #define _STATIC_H_
 
 /* This file defines the static structures for Gmsh. It should be
    included only once, in your 'main' file */
 
-char  TheFileName[NAME_STR_L], TheBaseFileName[NAME_STR_L];
-char  yyname[NAME_STR_L];
-int   yyerrorstate;
+char        TheFileName[NAME_STR_L], TheBaseFileName[NAME_STR_L];
+char        yyname[NAME_STR_L];
+int         yyerrorstate;
+
+int         CurrentNodeNumber, CurrentSimplexNumber;
 
 Context_T   CTX ;
 Mesh        M, *THEM, *LOCAL;
-int         TYPBGMESH=WITHPOINTS,CurrentNodeNumber, CurrentSimplexNumber;
-Tree_T     *EntitesVisibles = NULL;
-
-double      LC, MiddleLC ;
-int         LC_ORDER;
 
+Tree_T     *EntitesVisibles = NULL;
 int         FLAG_OLD_CIRCLE = 0 ; /* Pour David : cercles > Pi */
 
-
 #endif
diff --git a/Common/Views.cpp b/Common/Views.cpp
index 0f23ff6323..d26a2ddae7 100644
--- a/Common/Views.cpp
+++ b/Common/Views.cpp
@@ -1,4 +1,4 @@
-/* $Id: Views.cpp,v 1.4 2000-11-25 23:10:37 geuzaine Exp $ */
+/* $Id: Views.cpp,v 1.5 2000-11-26 15:43:44 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "Views.h"
@@ -9,7 +9,6 @@ List_T  *Post_ViewList = NULL;
 Post_View  *ActualView;
 
 extern Context_T   CTX ;
-extern double      LC;
 
 static int         ActualViewNum=0;
 
@@ -56,10 +55,23 @@ void BeginView(int allocate){
     ActualView->TS = List_Create(100,1000,sizeof(double));
     ActualView->Tetrahedra = List_Create(100,1000,sizeof(Post_Simplex));
   }
+  else{
+    ActualView->Time = NULL;
+    ActualView->SP = NULL; ActualView->VP = NULL; ActualView->TP = NULL;
+    ActualView->Points = NULL;
+    ActualView->SL = NULL; ActualView->VL = NULL; ActualView->TL = NULL;
+    ActualView->Lines = NULL;
+    ActualView->ST = NULL; ActualView->VT = NULL; ActualView->TT = NULL;
+    ActualView->Triangles = NULL;
+    ActualView->SS = NULL; ActualView->VS = NULL; ActualView->TS = NULL;
+    ActualView->Tetrahedra = NULL;
+  }
 
   ActualView->Changed = 1;
   ActualView->Links = 0;
   ActualView->DuplicateOf = 0;
+  ActualView->Min = 1.e200;
+  ActualView->Max = -1.e200;
   ActualView->NbIso = CTX.post.initial_nbiso;
   ActualView->IntervalsType = CTX.post.initial_intervals;
   ActualView->Light = 0;
@@ -78,18 +90,15 @@ void BeginView(int allocate){
   ActualView->Raise[1] = 0.0;
   ActualView->Raise[2] = 0.0;
   ActualView->ScalarOnly = 1;
-  ActualView->Min = 1.e200;
-  ActualView->Max = -1.e200;
   ActualView->NbTimeStep = 0;
-
   ActualView->CT.size = 255;
   ActualView->CT.ipar[COLORTABLE_MODE] = COLORTABLE_RGB;
-  color_table_init_param(1, &ActualView->CT, 1, 1);
-  color_table_recompute(&ActualView->CT, 1, 1);
+  ColorTable_InitParam(1, &ActualView->CT, 1, 1);
+  ColorTable_Recompute(&ActualView->CT, 1, 1);
 }
 
 void EndView(int AddInUI, int Number, char *FileName, char *Name, 
-	     double XOffset, double YOffset, double ZOffset){
+             double XOffset, double YOffset, double ZOffset){
   int i, nb;
   double d;
   extern void AddViewInUI(int , char *, int);
@@ -100,19 +109,19 @@ void EndView(int AddInUI, int Number, char *FileName, char *Name,
     nb = List_Nbr(ActualView->SP) / ActualView->NbSP ;
     for(i = 0 ; i < List_Nbr(ActualView->SP) ; i+=nb)
       AddView_ScalarSimplex(0, (double*)List_Pointer(ActualView->SP,i),
-			    nb-3, (double*)List_Pointer(ActualView->SP,i+3));
+                            nb-3, (double*)List_Pointer(ActualView->SP,i+3));
   }
   if(ActualView->NbVP){
     nb = List_Nbr(ActualView->VP) / ActualView->NbVP ;
     for(i = 0 ; i < List_Nbr(ActualView->VP) ; i+=nb)
       AddView_VectorSimplex(0, (double*)List_Pointer(ActualView->VP,i),
-			    nb-3, (double*)List_Pointer(ActualView->VP,i+3));
+                            nb-3, (double*)List_Pointer(ActualView->VP,i+3));
   }
   if(ActualView->NbTP){
     nb = List_Nbr(ActualView->TP) / ActualView->NbTP ;
     for(i = 0 ; i < List_Nbr(ActualView->TP) ; i+=nb)
       AddView_TensorSimplex(0, (double*)List_Pointer(ActualView->TP,i),
-			    nb-3, (double*)List_Pointer(ActualView->TP,i+3));
+                            nb-3, (double*)List_Pointer(ActualView->TP,i+3));
   }
 
   // Lines
@@ -121,19 +130,19 @@ void EndView(int AddInUI, int Number, char *FileName, char *Name,
     nb = List_Nbr(ActualView->SL) / ActualView->NbSL ;
     for(i = 0 ; i < List_Nbr(ActualView->SL) ; i+=nb)
       AddView_ScalarSimplex(1, (double*)List_Pointer(ActualView->SL,i),
-			    nb-6, (double*)List_Pointer(ActualView->SL,i+6));
+                            nb-6, (double*)List_Pointer(ActualView->SL,i+6));
   }
   if(ActualView->NbVL){
     nb = List_Nbr(ActualView->VL) / ActualView->NbVL ;
     for(i = 0 ; i < List_Nbr(ActualView->VL) ; i+=nb)
       AddView_VectorSimplex(1, (double*)List_Pointer(ActualView->VL,i),
-			    nb-6, (double*)List_Pointer(ActualView->VL,i+6));
+                            nb-6, (double*)List_Pointer(ActualView->VL,i+6));
   }
   if(ActualView->NbTL){
     nb = List_Nbr(ActualView->TL) / ActualView->NbTL ;
     for(i = 0 ; i < List_Nbr(ActualView->TL) ; i+=nb)
       AddView_TensorSimplex(1, (double*)List_Pointer(ActualView->TL,i),
-			    nb-6, (double*)List_Pointer(ActualView->TL,i+6));
+                            nb-6, (double*)List_Pointer(ActualView->TL,i+6));
   }
 
   // Triangles
@@ -142,19 +151,19 @@ void EndView(int AddInUI, int Number, char *FileName, char *Name,
     nb = List_Nbr(ActualView->ST) / ActualView->NbST ;
     for(i = 0 ; i < List_Nbr(ActualView->ST) ; i+=nb)
       AddView_ScalarSimplex(2, (double*)List_Pointer(ActualView->ST,i),
-			    nb-9, (double*)List_Pointer(ActualView->ST,i+9));
+                            nb-9, (double*)List_Pointer(ActualView->ST,i+9));
   }
   if(ActualView->NbVT){
     nb = List_Nbr(ActualView->VT) / ActualView->NbVT ;
     for(i = 0 ; i < List_Nbr(ActualView->VT) ; i+=nb)
       AddView_VectorSimplex(2, (double*)List_Pointer(ActualView->VT,i),
-			    nb-9, (double*)List_Pointer(ActualView->VT,i+9));
+                            nb-9, (double*)List_Pointer(ActualView->VT,i+9));
   }
   if(ActualView->NbTT){
     nb = List_Nbr(ActualView->TT) / ActualView->NbTT ;
     for(i = 0 ; i < List_Nbr(ActualView->TT) ; i+=nb)
       AddView_TensorSimplex(2, (double*)List_Pointer(ActualView->TT,i),
-			    nb-9, (double*)List_Pointer(ActualView->TT,i+9));
+                            nb-9, (double*)List_Pointer(ActualView->TT,i+9));
   }
 
   // Tetrahedra
@@ -163,19 +172,19 @@ void EndView(int AddInUI, int Number, char *FileName, char *Name,
     nb = List_Nbr(ActualView->SS) / ActualView->NbSS ;
     for(i = 0 ; i < List_Nbr(ActualView->SS) ; i+=nb)
       AddView_ScalarSimplex(3, (double*)List_Pointer(ActualView->SS,i),
-			    nb-12, (double*)List_Pointer(ActualView->SS,i+12));
+                            nb-12, (double*)List_Pointer(ActualView->SS,i+12));
   }
   if(ActualView->NbVS){
     nb = List_Nbr(ActualView->VS) / ActualView->NbVS ;
     for(i = 0 ; i < List_Nbr(ActualView->VS) ; i+=nb)
       AddView_VectorSimplex(3, (double*)List_Pointer(ActualView->VS,i),
-			    nb-12, (double*)List_Pointer(ActualView->VS,i+12));
+                            nb-12, (double*)List_Pointer(ActualView->VS,i+12));
   }
   if(ActualView->NbTS){
     nb = List_Nbr(ActualView->TS) / ActualView->NbTS ;
     for(i = 0 ; i < List_Nbr(ActualView->TS) ; i+=nb)
       AddView_TensorSimplex(3, (double*)List_Pointer(ActualView->TS,i),
-			    nb-12, (double*)List_Pointer(ActualView->TS,i+12));
+                            nb-12, (double*)List_Pointer(ActualView->TS,i+12));
   }
 
   // Dummy time values if using old parsed format...
@@ -193,9 +202,9 @@ void EndView(int AddInUI, int Number, char *FileName, char *Name,
     ActualView->Min = ActualView->Max = 0.0 ;
   ActualView->CustomMin = ActualView->Min;
   ActualView->CustomMax = ActualView->Max;
-  ActualView->Offset[0] = XOffset*(CTX.range[0]?CTX.range[0]:LC)*1.e-3;
-  ActualView->Offset[1] = YOffset*(CTX.range[1]?CTX.range[1]:LC)*1.e-3;
-  ActualView->Offset[2] = ZOffset*(CTX.range[2]?CTX.range[2]:LC)*1.e-3;
+  ActualView->Offset[0] = XOffset*(CTX.range[0]?CTX.range[0]:CTX.lc)*1.e-3;
+  ActualView->Offset[1] = YOffset*(CTX.range[1]?CTX.range[1]:CTX.lc)*1.e-3;
+  ActualView->Offset[2] = ZOffset*(CTX.range[2]?CTX.range[2]:CTX.lc)*1.e-3;
 
   /* j'en alloue directement le max pour eviter les problemes de
      reallocation (avec CurrentView) */
@@ -226,11 +235,11 @@ void FreeView(Post_View *v){
     if(!(v2 = (Post_View*)List_PQuery(Post_ViewList, &vv, fcmpPostViewNum))){
       Msg(DEBUG, " ->The Original View is Gone");
       if(!(v2 = (Post_View*)List_PQuery(Post_ViewList, v, fcmpPostViewDuplicateOf))){
-	Msg(DEBUG, " ->There are no other duplicata");
-	free = 1 ;
+        Msg(DEBUG, " ->There are no other duplicata");
+        free = 1 ;
       }
       else{
-	free = 0 ;
+        free = 0 ;
       }
     }
     else{
@@ -263,6 +272,33 @@ void FreeView(Post_View *v){
 
 }
 
+void CopyViewOptions(Post_View *src, Post_View *dest){
+  strcpy(dest->Format, src->Format);
+  dest->CustomMin = src->CustomMin;
+  dest->CustomMax = src->CustomMax;
+  dest->Offset[0] = src->Offset[0];
+  dest->Offset[1] = src->Offset[1];
+  dest->Offset[2] = src->Offset[2];
+  dest->Raise[0] = src->Raise[0];
+  dest->Raise[1] = src->Raise[1];
+  dest->Raise[2] = src->Raise[2];
+  dest->ArrowScale = src->ArrowScale;
+  dest->Visible = src->Visible;
+  dest->IntervalsType = src->IntervalsType;
+  dest->NbIso = src->NbIso;
+  dest->Light = src->Light ;
+  dest->ShowElement = src->ShowElement;
+  dest->ShowTime = src->ShowTime;
+  dest->ShowScale = src->ShowScale;
+  dest->TransparentScale = src->TransparentScale;
+  dest->ScaleType = src->ScaleType;
+  dest->RangeType = src->RangeType;
+  dest->ArrowType = src->ArrowType;
+  dest->ArrowLocation = src->ArrowLocation;
+  dest->TimeStep = src->TimeStep;
+  ColorTable_Copy(&src->CT);
+  ColorTable_Paste(&dest->CT);
+}
 
 /* ------------------------------------------------------------------------ */
 /*  S c a l a r S i m p l e x                                               */
@@ -380,8 +416,8 @@ void Read_View(FILE *file, char *filename){
     if (!strncmp(&str[1], "PostFormat", 10)){
       fscanf(file, "%lf %d\n", &version, &format) ;
       if(version < 0.995){
-	Msg(ERROR, "The Version of this File is too old (<0.995)");
-	return;
+        Msg(ERROR, "The Version of this File is too old (<0.995)");
+        return;
       }
       if(format == 0) format = LIST_FORMAT_ASCII ;
       else if(format == 1) format = LIST_FORMAT_BINARY ;
@@ -395,83 +431,83 @@ void Read_View(FILE *file, char *filename){
       BeginView(0);
 
       fscanf(file, "%s %d %d %d %d %d %d %d %d %d %d %d %d %d\n", 
-	     name, &nbtimestep,
-	     &ActualView->NbSP, &ActualView->NbVP, &ActualView->NbTP, 
-	     &ActualView->NbSL, &ActualView->NbVL, &ActualView->NbTL, 
-	     &ActualView->NbST, &ActualView->NbVT, &ActualView->NbTT, 
-	     &ActualView->NbSS, &ActualView->NbVS, &ActualView->NbTS);
+             name, &nbtimestep,
+             &ActualView->NbSP, &ActualView->NbVP, &ActualView->NbTP, 
+             &ActualView->NbSL, &ActualView->NbVL, &ActualView->NbTL, 
+             &ActualView->NbST, &ActualView->NbVT, &ActualView->NbTT, 
+             &ActualView->NbSS, &ActualView->NbVS, &ActualView->NbTS);
 
       Msg(DEBUG, "View '%s' (%d TimeSteps): %d %d %d %d %d %d %d %d %d %d %d %d",
-	  name, nbtimestep,
-	  ActualView->NbSP, ActualView->NbVP, ActualView->NbTP, 
-	  ActualView->NbSL, ActualView->NbVL, ActualView->NbTL, 
-	  ActualView->NbST, ActualView->NbVT, ActualView->NbTT, 
-	  ActualView->NbSS, ActualView->NbVS, ActualView->NbTS);
+          name, nbtimestep,
+          ActualView->NbSP, ActualView->NbVP, ActualView->NbTP, 
+          ActualView->NbSL, ActualView->NbVL, ActualView->NbTL, 
+          ActualView->NbST, ActualView->NbVT, ActualView->NbTT, 
+          ActualView->NbSS, ActualView->NbVS, ActualView->NbTS);
 
       ActualView->Time = List_CreateFromFile(nbtimestep, sizeof(double), file, format);
 
       if((nb = ActualView->NbSP + ActualView->NbVP + ActualView->NbTP))
-	ActualView->Points = List_Create(nb,1,sizeof(Post_Simplex));
+        ActualView->Points = List_Create(nb,1,sizeof(Post_Simplex));
       else
-	ActualView->Points = NULL ;
+        ActualView->Points = NULL ;
       nb = ActualView->NbSP ? 
-	ActualView->NbSP * nbtimestep     + ActualView->NbSP * 3 : 0 ;
+        ActualView->NbSP * nbtimestep     + ActualView->NbSP * 3 : 0 ;
       ActualView->SP = List_CreateFromFile(nb, sizeof(double), file, format);
       nb = ActualView->NbVP ?
-	ActualView->NbVP * nbtimestep * 3 + ActualView->NbVP * 3 : 0 ;
+        ActualView->NbVP * nbtimestep * 3 + ActualView->NbVP * 3 : 0 ;
       ActualView->VP = List_CreateFromFile(nb, sizeof(double), file, format);
       nb = ActualView->NbTP ? 
-	ActualView->NbTP * nbtimestep * 9 + ActualView->NbTP * 3 : 0 ;
+        ActualView->NbTP * nbtimestep * 9 + ActualView->NbTP * 3 : 0 ;
       ActualView->TP = List_CreateFromFile(nb, sizeof(double), file, format);
 
       if((nb = ActualView->NbSL + ActualView->NbVL + ActualView->NbTL))
-	ActualView->Lines = List_Create(nb,1,sizeof(Post_Simplex));
+        ActualView->Lines = List_Create(nb,1,sizeof(Post_Simplex));
       else
-	ActualView->Lines = NULL ;
+        ActualView->Lines = NULL ;
       nb = ActualView->NbSL ? 
-	ActualView->NbSL * nbtimestep * 2     + ActualView->NbSL * 6 : 0 ;
+        ActualView->NbSL * nbtimestep * 2     + ActualView->NbSL * 6 : 0 ;
       ActualView->SL = List_CreateFromFile(nb, sizeof(double), file, format);
       nb = ActualView->NbVL ?
-	ActualView->NbVL * nbtimestep * 2 * 3 + ActualView->NbVL * 6 : 0 ;
+        ActualView->NbVL * nbtimestep * 2 * 3 + ActualView->NbVL * 6 : 0 ;
       ActualView->VL = List_CreateFromFile(nb, sizeof(double), file, format);
       nb = ActualView->NbTL ?
-	ActualView->NbTL * nbtimestep * 2 * 9 + ActualView->NbTL * 6 : 0 ;
+        ActualView->NbTL * nbtimestep * 2 * 9 + ActualView->NbTL * 6 : 0 ;
       ActualView->TL = List_CreateFromFile(nb, sizeof(double), file, format);
 
       if((nb = ActualView->NbST + ActualView->NbVT + ActualView->NbTT))
-	ActualView->Triangles = List_Create(nb,1,sizeof(Post_Simplex));
+        ActualView->Triangles = List_Create(nb,1,sizeof(Post_Simplex));
       else
-	ActualView->Triangles = NULL ;
+        ActualView->Triangles = NULL ;
       nb = ActualView->NbST ? 
-	ActualView->NbST * nbtimestep * 3     + ActualView->NbST * 9 : 0 ;
+        ActualView->NbST * nbtimestep * 3     + ActualView->NbST * 9 : 0 ;
       ActualView->ST = List_CreateFromFile(nb, sizeof(double), file, format);
       nb = ActualView->NbVT ? 
-	ActualView->NbVT * nbtimestep * 3 * 3 + ActualView->NbVT * 9 : 0 ;
+        ActualView->NbVT * nbtimestep * 3 * 3 + ActualView->NbVT * 9 : 0 ;
       ActualView->VT = List_CreateFromFile(nb, sizeof(double), file, format);
       nb = ActualView->NbTT ? 
-	ActualView->NbTT * nbtimestep * 3 * 9 + ActualView->NbTT * 9 : 0 ;
+        ActualView->NbTT * nbtimestep * 3 * 9 + ActualView->NbTT * 9 : 0 ;
       ActualView->TT = List_CreateFromFile(nb, sizeof(double), file, format);
 
       if((nb = ActualView->NbSS + ActualView->NbVS + ActualView->NbTS))
-	ActualView->Tetrahedra = List_Create(nb,1,sizeof(Post_Simplex));
+        ActualView->Tetrahedra = List_Create(nb,1,sizeof(Post_Simplex));
       else
-	ActualView->Tetrahedra = NULL ;
+        ActualView->Tetrahedra = NULL ;
       nb = ActualView->NbSS ?
-	ActualView->NbSS * nbtimestep * 4     + ActualView->NbSS * 12 : 0 ;
+        ActualView->NbSS * nbtimestep * 4     + ActualView->NbSS * 12 : 0 ;
       ActualView->SS = List_CreateFromFile(nb, sizeof(double), file, format);
       nb = ActualView->NbVS ? 
-	ActualView->NbVS * nbtimestep * 4 * 3 + ActualView->NbVS * 12 : 0 ;
+        ActualView->NbVS * nbtimestep * 4 * 3 + ActualView->NbVS * 12 : 0 ;
       ActualView->VS = List_CreateFromFile(nb, sizeof(double), file, format);
       nb = ActualView->NbTS ?
-	ActualView->NbTS * nbtimestep * 4 * 9 + ActualView->NbTS * 12 : 0 ;
+        ActualView->NbTS * nbtimestep * 4 * 9 + ActualView->NbTS * 12 : 0 ;
       ActualView->TS = List_CreateFromFile(nb, sizeof(double), file, format);
 
       Msg(DEBUG, "Read View '%s' (%d TimeSteps): %d %d %d %d %d %d %d %d %d %d %d %d",
-	  name, nbtimestep,
-	  List_Nbr(ActualView->SP), List_Nbr(ActualView->VP), List_Nbr(ActualView->TP), 
-	  List_Nbr(ActualView->SL), List_Nbr(ActualView->VL), List_Nbr(ActualView->TL), 
-	  List_Nbr(ActualView->ST), List_Nbr(ActualView->VT), List_Nbr(ActualView->TT), 
-	  List_Nbr(ActualView->SS), List_Nbr(ActualView->VS), List_Nbr(ActualView->TS));
+          name, nbtimestep,
+          List_Nbr(ActualView->SP), List_Nbr(ActualView->VP), List_Nbr(ActualView->TP), 
+          List_Nbr(ActualView->SL), List_Nbr(ActualView->VL), List_Nbr(ActualView->TL), 
+          List_Nbr(ActualView->ST), List_Nbr(ActualView->VT), List_Nbr(ActualView->TT), 
+          List_Nbr(ActualView->SS), List_Nbr(ActualView->VS), List_Nbr(ActualView->TS));
 
       EndView(1, Force_ViewNumber, filename, name, 0., 0., 0.); 
     }
diff --git a/Common/Views.h b/Common/Views.h
index aeed59913e..fc249536b9 100644
--- a/Common/Views.h
+++ b/Common/Views.h
@@ -1,4 +1,4 @@
-/* $Id: Views.h,v 1.5 2000-11-25 23:10:37 geuzaine Exp $ */
+/* $Id: Views.h,v 1.6 2000-11-26 15:43:45 geuzaine Exp $ */
 #ifndef _VIEWS_H_
 #define _VIEWS_H_
 
@@ -12,19 +12,12 @@ typedef struct{
 #include "ColorTable.h"
 
 typedef struct{
+  /* intrinsic to a view */
   int Num, Changed, DuplicateOf, Links;
-  char FileName[NAME_STR_L], Name[NAME_STR_L], Format[NAME_STR_L];
-  double Min, Max, CustomMin, CustomMax;
-  double Offset[3], Raise[3], ArrowScale;
-  int Visible, ScalarOnly;
-  int IntervalsType, NbIso, Light, ShowElement, ShowTime;
-  int ShowScale, TransparentScale, ScaleType, RangeType;
-  int ArrowType, ArrowLocation;
-  int TimeStep, NbTimeStep;
-  ColorTable CT;
+  char FileName[NAME_STR_L], Name[NAME_STR_L];
 
+  /* the data */
   List_T *Time;
-
   int NbSP, NbVP, NbTP;
   List_T *SP, *VP, *TP, *Points; // points
   int NbSL, NbVL, NbTL;
@@ -33,7 +26,21 @@ typedef struct{
   List_T *ST, *VT, *TT, *Triangles; // triangles
   int NbSS, NbVS, NbTS;
   List_T *SS, *VS, *TS, *Tetrahedra; // tetrahedra
-  
+  int NbTimeStep, ScalarOnly;
+  double Min, Max;
+
+  /* options */
+  char   Format[NAME_STR_L];
+  double CustomMin, CustomMax;
+  double Offset[3], Raise[3], ArrowScale;
+  int Visible, IntervalsType, NbIso, Light ;
+  int ShowElement, ShowTime, ShowScale;
+  int TransparentScale, ScaleType, RangeType;
+  int ArrowType, ArrowLocation;
+  int TimeStep;
+  ColorTable CT;
+
+  /* dynamic */
   double (*GVFI) (double min, double max, int nb, int index);
   int (*GIFV) (double min, double max, int nb, double value);
 }Post_View;
@@ -76,10 +83,11 @@ int fcmpPostViewDuplicateOf(const void *v1, const void *v2);
 
 void BeginView (int alloc);
 void EndView (int AddInUI, int Number, char *FileName, char *Name, 
-	      double XOffset, double YOffset, double ZOffset);
+              double XOffset, double YOffset, double ZOffset);
 void FreeView(Post_View *v);
 
 void Read_View(FILE *file, char *filename);
+void CopyViewOptions(Post_View *src, Post_View *dest);
 
 void AddView_ScalarSimplex(int dim, double *coord, int N, double *v);
 void AddView_VectorSimplex(int dim, double *coord, int N, double *v);
@@ -87,7 +95,7 @@ void AddView_TensorSimplex(int dim, double *coord, int N, double *v);
 
 int BGMWithView (Post_View *ErrView);
 int CreateBGM(Post_View *ErrView, int OptiMethod, double Degree,
-	      double OptiValue, double *ObjFunct, char *OutFile);
+              double OptiValue, double *ObjFunct, char *OutFile);
 double ErrorInView(Post_View * ErrView, int *n);
 
 #endif
diff --git a/DataStr/List.cpp b/DataStr/List.cpp
index 0c48b35c07..180204c265 100644
--- a/DataStr/List.cpp
+++ b/DataStr/List.cpp
@@ -1,5 +1,5 @@
-/* $Id: List.cpp,v 1.4 2000-11-25 23:10:37 geuzaine Exp $ */
-#define RCSID "$Id: List.cpp,v 1.4 2000-11-25 23:10:37 geuzaine Exp $"
+/* $Id: List.cpp,v 1.5 2000-11-26 15:43:45 geuzaine Exp $ */
+#define RCSID "$Id: List.cpp,v 1.5 2000-11-26 15:43:45 geuzaine Exp $"
 /* Original author: Marc UME */
 
 #include <stdlib.h>
@@ -53,7 +53,7 @@ void List_Realloc(List_T *liste,int n)
     if (n > liste->nmax) {
       liste->nmax = ((n - 1) / liste->incr + 1) * liste->incr;
       liste->array = (char *)Realloc(liste->array,
-			 liste->nmax * liste->size);
+                         liste->nmax * liste->size);
     }
 }
 
@@ -72,14 +72,14 @@ int List_Nbr(List_T *liste)
 }
 
 void List_Insert(List_T *liste, void *data,
-		 int (*fcmp)(const void *a, const void *b))
+                 int (*fcmp)(const void *a, const void *b))
 {
   if (List_Search(liste,data,fcmp) == 0)
     List_Add(liste,data);
 }
 
 int List_Replace(List_T *liste, void *data,
-		 int (*fcmp)(const void *a, const void *b))
+                 int (*fcmp)(const void *a, const void *b))
 {
   void *ptr;
 
@@ -157,7 +157,7 @@ void List_Sort(List_T *liste, int (*fcmp)(const void *a, const void *b))
 }
 
 int List_Search(List_T *liste, void *data,
-		 int (*fcmp)(const void *a, const void *b))
+                 int (*fcmp)(const void *a, const void *b))
 {
   void *ptr;
 
@@ -168,7 +168,7 @@ int List_Search(List_T *liste, void *data,
 }
 
 int List_ISearch(List_T *liste, void *data,
-		 int (*fcmp)(const void *a, const void *b))
+                 int (*fcmp)(const void *a, const void *b))
 {
   void *ptr;
 
@@ -192,7 +192,7 @@ int  List_ISearchSeq(List_T *liste, void * data,
 }
 
 int  List_ISearchSeqPartial(List_T *liste, void * data, int i_Start,
-			    int (*fcmp)(const void *a, const void *b)) {
+                            int (*fcmp)(const void *a, const void *b)) {
   int i ;
 
   if (!liste)  return -1 ;
@@ -204,7 +204,7 @@ int  List_ISearchSeqPartial(List_T *liste, void * data, int i_Start,
 }
 
 int List_Query(List_T *liste, void *data,
-		 int (*fcmp)(const void *a, const void *b))
+                 int (*fcmp)(const void *a, const void *b))
 {
   void *ptr;
 
@@ -218,7 +218,7 @@ int List_Query(List_T *liste, void *data,
 }
 
 void *lolofind(void *data, void *array, int n, int size,
-	       int (*fcmp)(const void *a, const void *b) )
+               int (*fcmp)(const void *a, const void *b) )
 {
   char *ptr;
   int i;
@@ -233,7 +233,7 @@ void *lolofind(void *data, void *array, int n, int size,
 }
 
 int List_LQuery(List_T *liste, void *data,
-		 int (*fcmp)(const void *a, const void *b), int first)
+                 int (*fcmp)(const void *a, const void *b), int first)
 {
   char *ptr;
   
@@ -257,7 +257,7 @@ int List_LQuery(List_T *liste, void *data,
 }
 
 void *List_PQuery(List_T *liste, void *data,
-		 int (*fcmp)(const void *a, const void *b))
+                 int (*fcmp)(const void *a, const void *b))
 {
   void *ptr;
 
@@ -268,7 +268,7 @@ void *List_PQuery(List_T *liste, void *data,
 }
 
 int List_Suppress(List_T *liste, void *data,
-		 int (*fcmp)(const void *a, const void *b))
+                 int (*fcmp)(const void *a, const void *b))
 {
   char *ptr;
   int len;
diff --git a/DataStr/List.h b/DataStr/List.h
index 0773ad36fa..95d1c1d318 100644
--- a/DataStr/List.h
+++ b/DataStr/List.h
@@ -1,4 +1,4 @@
-/* $Id: List.h,v 1.3 2000-11-25 23:10:37 geuzaine Exp $ */
+/* $Id: List.h,v 1.4 2000-11-26 15:43:45 geuzaine Exp $ */
 #ifndef _LIST_H_
 #define _LIST_H_
 
@@ -34,7 +34,7 @@ int     List_Search(List_T *liste, void *data, int (*fcmp)(const void *a, const
 int     List_ISearch(List_T *liste, void *data, int (*fcmp)(const void *a, const void *b));
 int     List_ISearchSeq(List_T *liste, void * data, int (*fcmp)(const void *a, const void *b));
 int     List_ISearchSeqPartial(List_T *liste, void * data, int i_Start,
-			       int (*fcmp)(const void *a, const void *b)) ;
+                               int (*fcmp)(const void *a, const void *b)) ;
 int     List_Query(List_T *liste, void *data, int (*fcmp)(const void *a, const void *b));
 int     List_LQuery(List_T *liste, void *data, int (*fcmp)(const void *a, const void *b), int first);
 void   *List_PQuery(List_T *liste, void *data, int (*fcmp)(const void *a, const void *b));
diff --git a/DataStr/avl.cpp b/DataStr/avl.cpp
index eb9337adc5..8022131558 100644
--- a/DataStr/avl.cpp
+++ b/DataStr/avl.cpp
@@ -1,5 +1,5 @@
-/* $Id: avl.cpp,v 1.2 2000-11-23 14:11:29 geuzaine Exp $ */
-#define RCSID "$Id: avl.cpp,v 1.2 2000-11-23 14:11:29 geuzaine Exp $"
+/* $Id: avl.cpp,v 1.3 2000-11-26 15:43:45 geuzaine Exp $ */
+#define RCSID "$Id: avl.cpp,v 1.3 2000-11-26 15:43:45 geuzaine Exp $"
 
 /*
  * This is a modified version for Gmsh (for c++, 64-bit architectures, etc.)
@@ -42,15 +42,15 @@
 #define HEIGHT(node)         (node == NIL(avl_node) ? -1 : (node)->height)
 #define BALANCE(node)        (HEIGHT((node)->right) - HEIGHT((node)->left))
 
-#define compute_height(node) {				\
-    int x=HEIGHT(node->left), y=HEIGHT(node->right);	\
-    (node)->height = XRNMAX(x,y) + 1;			\
+#define compute_height(node) {                          \
+    int x=HEIGHT(node->left), y=HEIGHT(node->right);    \
+    (node)->height = XRNMAX(x,y) + 1;                   \
 }
 
-#define COMPARE(key, nodekey, compare)	 		\
-    ((compare == avl_numcmp) ? 				\
-	(long int) key - (long int) nodekey : 			\
-	(*compare)(key, nodekey))
+#define COMPARE(key, nodekey, compare)                  \
+    ((compare == avl_numcmp) ?                          \
+        (long int) key - (long int) nodekey :                   \
+        (*compare)(key, nodekey))
 
 static void avl_record_gen_forward(avl_node *node, avl_generator *gen);
 static void avl_record_gen_backward(avl_node *node, avl_generator *gen);
@@ -61,10 +61,10 @@ static void rotate_right(avl_node **node_p);
 static void avl_walk_forward(avl_node *node, void (*func)(void *key, void *value));
 static void avl_walk_backward(avl_node *node, void (*func)(void *key, void *value));
 static void free_entry(avl_node *node, void (*key_free)(void *key), 
-		       void (*value_free)(void *value));
+                       void (*value_free)(void *value));
 static avl_node *new_node(void *key, void *value);
 static int do_check_tree(avl_node *node, int (*compar)(const void *key1, const void *key2),
-			 int *error);
+                         int *error);
 
 
 avl_tree *avl_init_table(int (*compar)(const void *key1, const void *key2))
@@ -85,13 +85,13 @@ int avl_lookup(avl_tree *tree, void *key, void **value_p)
 
     node = tree->root;
     while (node != NIL(avl_node)) {
-	diff = COMPARE(key, node->key, compare);
-	if (diff == 0) {
-	    /* got a match, give the user a 'value' only if non-null */
-	    if (value_p != NIL(void *)) *value_p = node->value;
-	    return 1;
-	}
-	node = (diff < 0) ? node->left : node->right;
+        diff = COMPARE(key, node->key, compare);
+        if (diff == 0) {
+            /* got a match, give the user a 'value' only if non-null */
+            if (value_p != NIL(void *)) *value_p = node->value;
+            return 1;
+        }
+        node = (diff < 0) ? node->left : node->right;
     }
     return 0;
 }
@@ -109,10 +109,10 @@ int avl_insert(avl_tree *tree, void *key, void *value)
     /* walk down the tree (saving the path); stop at insertion point */
     status = 0;
     while ((node = *node_p) != NIL(avl_node)) {
-	stack_nodep[stack_n++] = node_p;
-	diff = COMPARE(key, node->key, compare);
-	if (diff == 0) status = 1;
-	node_p = (diff < 0) ? &node->left : &node->right;
+        stack_nodep[stack_n++] = node_p;
+        diff = COMPARE(key, node->key, compare);
+        if (diff == 0) status = 1;
+        node_p = (diff < 0) ? &node->left : &node->right;
     }
 
     /* insert the item and re-balance the tree */
@@ -135,26 +135,26 @@ int avl_delete(avl_tree *tree, void **key_p, void **value_p)
 
     /* Walk down the tree saving the path; return if not found */
     while ((node = *node_p) != NIL(avl_node)) {
-	diff = COMPARE(key, node->key, compare);
-	if (diff == 0) goto delete_item;
-	stack_nodep[stack_n++] = node_p;
-	node_p = (diff < 0) ? &node->left : &node->right;
+        diff = COMPARE(key, node->key, compare);
+        if (diff == 0) goto delete_item;
+        stack_nodep[stack_n++] = node_p;
+        node_p = (diff < 0) ? &node->left : &node->right;
     }
-    return 0;		/* not found */
+    return 0;           /* not found */
 
     /* prepare to delete node and replace it with rightmost of left tree */
   delete_item:
     *key_p = node->key;
     if (value_p != 0) *value_p = node->value;
     if (node->left == NIL(avl_node)) {
-	*node_p = node->right;
+        *node_p = node->right;
     } else {
-	rightmost = find_rightmost(&node->left);
-	rightmost->left = node->left;
-	rightmost->right = node->right;
-	rightmost->height = -2; 	/* mark bogus height for do_rebal */
-	*node_p = rightmost;
-	stack_nodep[stack_n++] = node_p;
+        rightmost = find_rightmost(&node->left);
+        rightmost->left = node->left;
+        rightmost->right = node->right;
+        rightmost->height = -2;         /* mark bogus height for do_rebal */
+        *node_p = rightmost;
+        stack_nodep[stack_n++] = node_p;
     }
     FREE(node);
 
@@ -168,18 +168,18 @@ int avl_delete(avl_tree *tree, void **key_p, void **value_p)
 static void avl_record_gen_forward(avl_node *node, avl_generator *gen)
 {
     if (node != NIL(avl_node)) {
-	avl_record_gen_forward(node->left, gen);
-	gen->nodelist[gen->count++] = node;
-	avl_record_gen_forward(node->right, gen);
+        avl_record_gen_forward(node->left, gen);
+        gen->nodelist[gen->count++] = node;
+        avl_record_gen_forward(node->right, gen);
     }
 }
 
 static void avl_record_gen_backward(avl_node *node, avl_generator *gen)
 {
     if (node != NIL(avl_node)) {
-	avl_record_gen_backward(node->right, gen);
-	gen->nodelist[gen->count++] = node;
-	avl_record_gen_backward(node->left, gen);
+        avl_record_gen_backward(node->right, gen);
+        gen->nodelist[gen->count++] = node;
+        avl_record_gen_backward(node->left, gen);
     }
 }
 
@@ -193,9 +193,9 @@ avl_generator *avl_init_gen(avl_tree *tree, int dir)
     gen->nodelist = ALLOC(avl_node *, avl_count(tree));
     gen->count = 0;
     if (dir == AVL_FORWARD) {
-	avl_record_gen_forward(tree->root, gen);
+        avl_record_gen_forward(tree->root, gen);
     } else {
-	avl_record_gen_backward(tree->root, gen);
+        avl_record_gen_backward(tree->root, gen);
     }
     gen->count = 0;
 
@@ -209,12 +209,12 @@ int avl_gen(avl_generator *gen, void **key_p, void **value_p)
     avl_node *node;
 
     if (gen->count == gen->tree->num_entries) {
-	return 0;
+        return 0;
     } else {
-	node = gen->nodelist[gen->count++];
-	if (key_p != NIL(void *)) *key_p = node->key;
-	if (value_p != NIL(void *)) *value_p = node->value;
-	return 1;
+        node = gen->nodelist[gen->count++];
+        if (key_p != NIL(void *)) *key_p = node->key;
+        if (value_p != NIL(void *)) *value_p = node->value;
+        return 1;
     }
 }
 
@@ -232,9 +232,9 @@ static avl_node *find_rightmost(avl_node **node_p)
 
     node = *node_p;
     while (node->right != NIL(avl_node)) {
-	stack_nodep[stack_n++] = node_p;
-	node_p = &node->right;
-	node = *node_p;
+        stack_nodep[stack_n++] = node_p;
+        node_p = &node->right;
+        node = *node_p;
     }
     *node_p = node->left;
 
@@ -250,19 +250,19 @@ static void do_rebalance(avl_node ***stack_nodep, int stack_n)
 
     /* work our way back up, re-balancing the tree */
     while (--stack_n >= 0) {
-	node_p = stack_nodep[stack_n];
-	node = *node_p;
-	hl = HEIGHT(node->left);		/* watch for NIL */
-	hr = HEIGHT(node->right);		/* watch for NIL */
-	if ((hr - hl) < -1) {
-	    rotate_right(node_p);
-	} else if ((hr - hl) > 1) {
-	    rotate_left(node_p);
-	} else {
-	    height = XRNMAX(hl, hr) + 1;
-	    if (height == node->height) break;
-	    node->height = height;
-	}
+        node_p = stack_nodep[stack_n];
+        node = *node_p;
+        hl = HEIGHT(node->left);                /* watch for NIL */
+        hr = HEIGHT(node->right);               /* watch for NIL */
+        if ((hr - hl) < -1) {
+            rotate_right(node_p);
+        } else if ((hr - hl) > 1) {
+            rotate_left(node_p);
+        } else {
+            height = XRNMAX(hl, hr) + 1;
+            if (height == node->height) break;
+            node->height = height;
+        }
     }
 }
 
@@ -271,17 +271,17 @@ static void rotate_left(avl_node **node_p)
     register avl_node *old_root = *node_p, *new_root, *new_right;
 
     if (BALANCE(old_root->right) >= 0) {
-	*node_p = new_root = old_root->right;
-	old_root->right = new_root->left;
-	new_root->left = old_root;
+        *node_p = new_root = old_root->right;
+        old_root->right = new_root->left;
+        new_root->left = old_root;
     } else {
-	new_right = old_root->right;
-	*node_p = new_root = new_right->left;
-	old_root->right = new_root->left;
-	new_right->left = new_root->right;
-	new_root->right = new_right;
-	new_root->left = old_root;
-	compute_height(new_right);
+        new_right = old_root->right;
+        *node_p = new_root = new_right->left;
+        old_root->right = new_root->left;
+        new_right->left = new_root->right;
+        new_root->right = new_right;
+        new_root->left = old_root;
+        compute_height(new_right);
     }
     compute_height(old_root);
     compute_height(new_root);
@@ -292,17 +292,17 @@ static void rotate_right(avl_node **node_p)
     register avl_node *old_root = *node_p, *new_root, *new_left;
 
     if (BALANCE(old_root->left) <= 0) {
-	*node_p = new_root = old_root->left;
-	old_root->left = new_root->right;
-	new_root->right = old_root;
+        *node_p = new_root = old_root->left;
+        old_root->left = new_root->right;
+        new_root->right = old_root;
     } else {
-	new_left = old_root->left;
-	*node_p = new_root = new_left->right;
-	old_root->left = new_root->right;
-	new_left->right = new_root->left;
-	new_root->left = new_left;
-	new_root->right = old_root;
-	compute_height(new_left);
+        new_left = old_root->left;
+        *node_p = new_root = new_left->right;
+        old_root->left = new_root->right;
+        new_left->right = new_root->left;
+        new_root->left = new_left;
+        new_root->right = old_root;
+        compute_height(new_left);
     }
     compute_height(old_root);
     compute_height(new_root);
@@ -311,27 +311,27 @@ static void rotate_right(avl_node **node_p)
 static void avl_walk_forward(avl_node *node, void (*func)(void *key, void *value))
 {
     if (node != NIL(avl_node)) {
-	avl_walk_forward(node->left, func);
-	(*func)(node->key, node->value);
-	avl_walk_forward(node->right, func);
+        avl_walk_forward(node->left, func);
+        (*func)(node->key, node->value);
+        avl_walk_forward(node->right, func);
     }
 }
 
 static void avl_walk_backward(avl_node *node, void (*func)(void *key, void *value))
 {
     if (node != NIL(avl_node)) {
-	avl_walk_backward(node->right, func);
-	(*func)(node->key, node->value);
-	avl_walk_backward(node->left, func);
+        avl_walk_backward(node->right, func);
+        (*func)(node->key, node->value);
+        avl_walk_backward(node->left, func);
     }
 }
 
 void avl_foreach(avl_tree *tree, void (*func)(void *key, void *value), int direction)
 {
     if (direction == AVL_FORWARD) {
-	avl_walk_forward(tree->root, func);
+        avl_walk_forward(tree->root, func);
     } else {
-	avl_walk_backward(tree->root, func);
+        avl_walk_backward(tree->root, func);
     }
 }
 
@@ -357,11 +357,11 @@ int avl_extremum(avl_tree *tree, int side, void **value_p)
 static void free_entry(avl_node *node, void (*key_free)(void *key), void (*value_free)(void *value))
 {
     if (node != NIL(avl_node)) {
-	free_entry(node->left, key_free, value_free);
-	free_entry(node->right, key_free, value_free);
-	if (key_free != 0) (*key_free)(node->key);
-	if (value_free != 0) (*value_free)(node->value);
-	FREE(node);
+        free_entry(node->left, key_free, value_free);
+        free_entry(node->right, key_free, value_free);
+        if (key_free != 0) (*key_free)(node->key);
+        if (value_free != 0) (*value_free)(node->value);
+        FREE(node);
     }
 }
     
@@ -400,12 +400,12 @@ int avl_check_tree(avl_tree *tree)
 }
 
 static int do_check_tree(avl_node *node, 
-			 int (*compar)(const void *key1, const void *key2), int *error)
+                         int (*compar)(const void *key1, const void *key2), int *error)
 {
     int l_height, r_height, comp_height, bal;
     
     if (node == NIL(avl_node)) {
-	return -1;
+        return -1;
     }
 
     r_height = do_check_tree(node->right, compar, error);
@@ -415,29 +415,29 @@ static int do_check_tree(avl_node *node,
     bal = r_height - l_height;
     
     if (comp_height != node->height) {
-	(void) printf("Bad height for %p: computed=%d stored=%d\n",
-	    node, comp_height, node->height);
-	++*error;
+        (void) printf("Bad height for %p: computed=%d stored=%d\n",
+            node, comp_height, node->height);
+        ++*error;
     }
 
     if (bal > 1 || bal < -1) {
-	(void) printf("Out of balance at node %p, balance = %d\n", 
-	    node, bal);
-	++*error;
+        (void) printf("Out of balance at node %p, balance = %d\n", 
+            node, bal);
+        ++*error;
     }
 
     if (node->left != NIL(avl_node) && 
-		    (*compar)(node->left->key, node->key) > 0) {
-	(void) printf("Bad ordering between %p and %p", 
-	    node, node->left);
-	++*error;
+                    (*compar)(node->left->key, node->key) > 0) {
+        (void) printf("Bad ordering between %p and %p", 
+            node, node->left);
+        ++*error;
     }
     
     if (node->right != NIL(avl_node) && 
-		    (*compar)(node->key, node->right->key) > 0) {
-	(void) printf("Bad ordering between %p and %p", 
-	    node, node->right);
-	++*error;
+                    (*compar)(node->key, node->right->key) > 0) {
+        (void) printf("Bad ordering between %p and %p", 
+            node, node->right);
+        ++*error;
     }
 
     return comp_height;
diff --git a/DataStr/avl.h b/DataStr/avl.h
index b28eda5dd4..1c04354d70 100644
--- a/DataStr/avl.h
+++ b/DataStr/avl.h
@@ -1,5 +1,5 @@
-/* $Id: avl.h,v 1.2 2000-11-23 14:11:29 geuzaine Exp $ */
-/* $Id: avl.h,v 1.2 2000-11-23 14:11:29 geuzaine Exp $ */
+/* $Id: avl.h,v 1.3 2000-11-26 15:43:45 geuzaine Exp $ */
+/* $Id: avl.h,v 1.3 2000-11-26 15:43:45 geuzaine Exp $ */
 #ifndef _AVL_H_
 #define _AVL_H_
 
@@ -54,17 +54,17 @@ struct avl_generator_struct {
 };
 
 
-#define AVL_FORWARD 	0
-#define AVL_BACKWARD 	1
+#define AVL_FORWARD     0
+#define AVL_BACKWARD    1
 
 #define AVL_MOST_LEFT   0
 #define AVL_MOST_RIGHT  1
 
 #define avl_is_member(tree, key)   avl_lookup(tree, key, (void **) 0)
 
-#define avl_foreach_item(table, gen, dir, key_p, value_p)		\
-    for(gen = avl_init_gen(table, dir);					\
-	    avl_gen(gen, key_p, value_p) || (avl_free_gen(gen),0);)
+#define avl_foreach_item(table, gen, dir, key_p, value_p)               \
+    for(gen = avl_init_gen(table, dir);                                 \
+            avl_gen(gen, key_p, value_p) || (avl_free_gen(gen),0);)
 
 
 avl_tree *avl_init_table(int (*compar)(const void *key1, const void *key2));
diff --git a/Geo/CAD.cpp b/Geo/CAD.cpp
index b35b82811e..6301186e25 100644
--- a/Geo/CAD.cpp
+++ b/Geo/CAD.cpp
@@ -1,4 +1,4 @@
-/* $Id: CAD.cpp,v 1.7 2000-11-24 10:58:02 geuzaine Exp $ */
+/* $Id: CAD.cpp,v 1.8 2000-11-26 15:43:45 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "Geo.h"
@@ -9,10 +9,11 @@
 #include "Const.h"
 #include "Create.h"
 #include "CAD.h"
+#include "Context.h"
                                     
-extern Mesh    *THEM;
-extern int      CurrentNodeNumber;
-extern double   LC ;
+extern Mesh      *THEM;
+extern Context_T  CTX;
+extern int        CurrentNodeNumber;
 
 static int      MAXREG,MAXPOINT;
 static List_T  *ListOfTransformedPoints;
@@ -1029,7 +1030,7 @@ void Extrude_ProtudeSurface(int ep, int is,
     List_Read(chapeau->s.Generatrices,i,&c);
     if(c->Num<0)
       if(!(c = FindCurve(-c->Num,THEM)))
-	 Msg(FATAL, "Unknown Curve %d", -c->Num);
+         Msg(FATAL, "Unknown Curve %d", -c->Num);
     c->Extrude = new ExtrudeParams(COPIED_ENTITY);
     c->Extrude->fill(ep,A,B,C,X,Y,Z,alpha);
     c->Extrude->geo.Source = abs(c2->Num);
@@ -1114,7 +1115,7 @@ bool IntersectCurves (Curve *c1, Curve *c2,
   if(x[1] >= c1->uend)return false;
   if(x[2] <= c2->ubeg)return false;
   if(x[2] >= c2->uend)return false;
-  if(fabs(v1.Pos.Z - v2.Pos.Z) > 1.e-06 * LC )return false;
+  if(fabs(v1.Pos.Z - v2.Pos.Z) > 1.e-06 * CTX.lc)return false;
   pv = &V;
   pv->Num = MAXPOINT++;
   Cdbpts101(pv->Num,v1.Pos.X,v1.Pos.Y,v1.Pos.Z,v1.lc,x[1]);
@@ -1281,13 +1282,13 @@ void ReplaceAllDuplicates ( Mesh *m ){
       if(!Tree_Search(allNonDulpicatedCurves,&c)){
         Tree_Insert(allNonDulpicatedCurves,&c);
         if(!(c2 = FindCurve(-c->Num,m)))
-	  Msg(FATAL, "Unknown Curve %d", -c->Num);
+          Msg(FATAL, "Unknown Curve %d", -c->Num);
         Tree_Insert(allNonDulpicatedCurves,&c2);
       }
       else{
         Tree_Suppress(m->Curves,&c);
         if(!(c2 = FindCurve(-c->Num,m)))
-	  Msg(FATAL, "Unknown Curve %d", -c->Num);
+          Msg(FATAL, "Unknown Curve %d", -c->Num);
         Tree_Suppress(m->Curves,&c2);
       }
     }
@@ -1394,7 +1395,7 @@ void ApplicationOnShapes(double matrix[4][4], List_T *ListShapes){
       break;
     default:
       Msg(ERROR, "Impossible to Translate Entity %d (of Type %d)", 
-	  O.Num, O.Type);
+          O.Num, O.Type);
       break;
     }
   }
@@ -1435,7 +1436,7 @@ void RotateShapes (double Ax,double Ay,double Az,
 }
 
 void SymmetryShapes (double A,double B,double C,
-		     double D, List_T *ListShapes, int x){
+                     double D, List_T *ListShapes, int x){
   double matrix[4][4];
   SetSymmetryMatrix(matrix,A,B,C,D);
   ApplicationOnShapes(matrix,ListShapes);
diff --git a/Geo/CAD.h b/Geo/CAD.h
index 1102d6df06..ba3629effe 100644
--- a/Geo/CAD.h
+++ b/Geo/CAD.h
@@ -1,4 +1,4 @@
-/* $Id: CAD.h,v 1.3 2000-11-24 10:21:21 geuzaine Exp $ */
+/* $Id: CAD.h,v 1.4 2000-11-26 15:43:45 geuzaine Exp $ */
 #ifndef _CAD_H_
 #define _CAD_H_
 
@@ -23,11 +23,11 @@ void Extrude_ProtudePoint(int ep, int ip, double A, double B, double C,
                           Curve **pc, Curve **prc, ExtrudeParams *e);
 Surface *Extrude_ProtudeCurve(int ep, int ic,
                               double A, double B, double C,
-			      double X, double Y, double Z,
+                              double X, double Y, double Z,
                               double alpha, ExtrudeParams *e);
 void Extrude_ProtudeSurface(int ep, int is,
                             double A, double B, double C,
-			    double X, double Y, double Z,
+                            double X, double Y, double Z,
                             double alpha,
                             int NewVolume, ExtrudeParams *e);
 void ProtudeXYZ ( double &x, double &y, double &z, ExtrudeParams *e);
@@ -36,14 +36,14 @@ void Coherence_PS(void);
 
 void ModifyLcPoint(int ip, double lc);
 void TranslateShapes(double X,double Y,double Z,
-		     List_T *ListShapes, int isFinal);
+                     List_T *ListShapes, int isFinal);
 void DilatShapes(double X,double Y,double Z, double A,
-		 List_T *ListShapes, int isFinal);
+                 List_T *ListShapes, int isFinal);
 void RotateShapes (double Ax,double Ay,double Az,
-		   double Px,double Py, double Pz,
+                   double Px,double Py, double Pz,
                    double alpha, List_T *ListShapes);
 void SymmetryShapes (double A,double B,double C,
-		     double D, List_T *ListShapes, int x);
+                     double D, List_T *ListShapes, int x);
 void CopyShape(int Type, int Num, int *New);
 
 void DeletePoint(int ip);
diff --git a/Geo/DataBase.cpp b/Geo/DataBase.cpp
index 945a985709..07555ef326 100644
--- a/Geo/DataBase.cpp
+++ b/Geo/DataBase.cpp
@@ -1,4 +1,4 @@
-/* $Id: DataBase.cpp,v 1.3 2000-11-23 23:20:34 geuzaine Exp $ */
+/* $Id: DataBase.cpp,v 1.4 2000-11-26 15:43:45 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "Const.h"
@@ -117,11 +117,11 @@ void AddQuadricSurfaceInDataBase (int Typ, int NumQuadric, double zaxis[3],
       Msg(FATAL, "Unknown Loop %d", iLoop);
     else{
       for(j=0;j<List_Nbr(el->Curves);j++){
-	List_Read(el->Curves,j,&ic);
-	if(!(c = FindCurve(ic,THEM)))
-	  Msg(FATAL, "Unknown Curve %d", ic);
-	else
-	  List_Add (s->s.Generatrices, &c);
+        List_Read(el->Curves,j,&ic);
+        if(!(c = FindCurve(ic,THEM)))
+          Msg(FATAL, "Unknown Curve %d", ic);
+        else
+          List_Add (s->s.Generatrices, &c);
       }
     }
   }
@@ -151,11 +151,11 @@ void CreateSurfaceFromOldCrappyDatabase (int izon, int typzon, int o1, int o2,
       Msg(FATAL, "Unknown Line Loop %d", iLoop);
     else{
       for(j=0;j<List_Nbr(el->Curves);j++){
-	List_Read(el->Curves,j,&ic);
-	if(!(c = FindCurve(ic,THEM)))
-	  Msg(FATAL, "Unknown Curve %d", ic);
-	else
-	  List_Add (s->s.Generatrices, &c);
+        List_Read(el->Curves,j,&ic);
+        if(!(c = FindCurve(ic,THEM)))
+          Msg(FATAL, "Unknown Curve %d", ic);
+        else
+          List_Add (s->s.Generatrices, &c);
       }
     }
   }
@@ -199,11 +199,11 @@ void CreateVolumeFromOldCrappyDatabase (int izon, List_T *loops, Mesh *M){
       Msg(FATAL, "Unknown Surface Loop %d", iLoop);
     else{
       for(j=0;j<List_Nbr(sl->Surfaces);j++){
-	List_Read(sl->Surfaces,j,&is);
-	if(!(s = FindSurface(abs(is),THEM)))
-	  Msg(FATAL, "Unknown Surface %d", is);
-	else
-	  List_Add (v->Surfaces, &s);
+        List_Read(sl->Surfaces,j,&is);
+        if(!(s = FindSurface(abs(is),THEM)))
+          Msg(FATAL, "Unknown Surface %d", is);
+        else
+          List_Add (v->Surfaces, &s);
       }
     }
   }
@@ -352,8 +352,8 @@ void CreateNurbsSurface (int Num , int Order1 , int Order2 , List_T *List,
     else{
       cc->k = (float*)malloc(4*List_Nbr(ku)*sizeof(float));
       for(i=0;i<List_Nbr(ku);i++){
-	List_Read(ku,i,&d);
-	cc->k[i] = (float)d/*((d-kumin)/(kumax-kumin))*/;
+        List_Read(ku,i,&d);
+        cc->k[i] = (float)d/*((d-kumin)/(kumax-kumin))*/;
       }
     }
   }
@@ -375,8 +375,8 @@ void CreateNurbsSurface (int Num , int Order1 , int Order2 , List_T *List,
     else{
       cc->k = (float*)malloc(4*List_Nbr(ku)*sizeof(float));
       for(i=0;i<List_Nbr(ku);i++){
-	List_Read(ku,i,&d);
-	cc->k[i] = (float)d/*((d-kumin)/(kumax-kumin))*/;
+        List_Read(ku,i,&d);
+        cc->k[i] = (float)d/*((d-kumin)/(kumax-kumin))*/;
       }
     }
   }
@@ -406,8 +406,8 @@ void CreateNurbsSurface (int Num , int Order1 , int Order2 , List_T *List,
     else{
       cc->k = (float*)malloc(4*List_Nbr(kv) * sizeof(float));
       for(i=0;i<List_Nbr(kv);i++){
-	List_Read(kv,i,&d);
-	cc->k[i] = (float)d/*((d-kvmin)/(kvmax-kvmin))*/;
+        List_Read(kv,i,&d);
+        cc->k[i] = (float)d/*((d-kvmin)/(kvmax-kvmin))*/;
       }
     }
   }
@@ -428,8 +428,8 @@ void CreateNurbsSurface (int Num , int Order1 , int Order2 , List_T *List,
     else{
       cc->k = (float*)malloc(4*List_Nbr(kv)*sizeof(float));
       for(i=0;i<List_Nbr(kv);i++){
-	List_Read(kv,i,&d);
-	cc->k[i] = (float)d/*((d-kvmin)/(kvmax-kvmin))*/;
+        List_Read(kv,i,&d);
+        cc->k[i] = (float)d/*((d-kvmin)/(kvmax-kvmin))*/;
       }
     }
   }
diff --git a/Geo/DataBase.h b/Geo/DataBase.h
index 04b3a653e9..13ebd80206 100644
--- a/Geo/DataBase.h
+++ b/Geo/DataBase.h
@@ -1,4 +1,4 @@
-/* $Id: DataBase.h,v 1.2 2000-11-23 14:11:30 geuzaine Exp $ */
+/* $Id: DataBase.h,v 1.3 2000-11-26 15:43:45 geuzaine Exp $ */
 #ifndef _DATABASE_H_
 #define _DATABASE_H_
 
@@ -7,28 +7,28 @@ void Cdbpts105 (int ip, double x, double y, double z, double l, double w);
 void Cdbseg102 (int iseg, int ip, int newp);
 void Cdbz102 (int izon, int ip, int newp, int oldp);
 void Cdbseg101 (int iseg, int typseg, int degre, List_T * liste, List_T * listint,
-		int, int, double, double, char *, char *, char *);
+                int, int, double, double, char *, char *, char *);
 void Cdbpts201 (int ip);
 void Cdbseg201 (int ip);
 void Cdbz201 (int ip);
 void Cdbz101 (int izon, int typzon, int o1, int o2, int nbu, int nbv,
-	      int support, List_T * ListCP, List_T * liste, List_T * intlist);
+              int support, List_T * ListCP, List_T * liste, List_T * intlist);
 void CreateNurbsSurface (int Num, int Order1, int Order2, List_T *, List_T *, List_T *);
 void CreateNurbsSurfaceSupport (int Num, int Order2, int Order1, 
-				List_T * List, List_T *, List_T *);
+                                List_T * List, List_T *, List_T *);
 void Cdbseg301 (int ip);
 void Cdbz301 (int ip);
 void Cdbn101 (int in, double X, double Y, double Z);
 void Cdbe101 (int nElm, int iEnt, int nnoe[4]);
 
 void AddCurveInDataBase (int NumCurve, int TypCurve, int Order, List_T * ControlPoints,
-			 List_T * Knots, int VertexBeg, int VertexEnd, double uBeg,
-			 double uEnd);
+                         List_T * Knots, int VertexBeg, int VertexEnd, double uBeg,
+                         double uEnd);
 void AddCircleInDataBase (int NumCurve, int TypCurve, List_T * ControlPoints,
-			  double n[3]);
+                          double n[3]);
 void AddQuadricSurfaceInDataBase (int Typ, int NumCyl, double zaxis[3], 
-				  double xaxis[3], double center[3],
-				  double radius1, double radius2,
-				  List_T * loops);
+                                  double xaxis[3], double center[3],
+                                  double radius1, double radius2,
+                                  List_T * loops);
 
 #endif
diff --git a/Geo/ExtrudeParams.h b/Geo/ExtrudeParams.h
index 5c93334426..5ad56228a0 100644
--- a/Geo/ExtrudeParams.h
+++ b/Geo/ExtrudeParams.h
@@ -1,4 +1,4 @@
-/* $Id: ExtrudeParams.h,v 1.3 2000-11-23 14:11:30 geuzaine Exp $ */
+/* $Id: ExtrudeParams.h,v 1.4 2000-11-26 15:43:45 geuzaine Exp $ */
 #ifndef _EXTRUDE_PARAMS_H_
 #define _EXTRUDE_PARAMS_H_
 
@@ -12,9 +12,9 @@ class ExtrudeParams{
 public :
   ExtrudeParams(int Mode = EXTRUDED_ENTITY);
   void fill (int ep,double A, double B, double C,
-	     double X, double Y, double Z, double angle);
+             double X, double Y, double Z, double angle);
   void Extrude (  int iLayer, int iElemLayer,
-		  double &dx, double &dy, double &dz);
+                  double &dx, double &dy, double &dz);
   void Extrude (double t, double &x, double &y, double &z);
   void Rotate(double matr[3][3]);
   struct{
diff --git a/Geo/Geo.cpp b/Geo/Geo.cpp
index 74ba3b12b0..d94d9da03e 100644
--- a/Geo/Geo.cpp
+++ b/Geo/Geo.cpp
@@ -1,4 +1,4 @@
-/* $Id: Geo.cpp,v 1.3 2000-11-23 23:20:34 geuzaine Exp $ */
+/* $Id: Geo.cpp,v 1.4 2000-11-26 15:43:45 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "Const.h"
@@ -192,15 +192,15 @@ void add_attractor(char *fich, int ip, int typ){
   char text[BUFFSIZE];
   if(typ == 0) {
     sprintf(text,"Attractor Point (%s,%s,%s) = {%d};",
-	    attrx_text,attry_text,attrdec_text,ip);
+            attrx_text,attry_text,attrdec_text,ip);
   }
   else if(typ == 1){
     sprintf(text,"Attractor Line (%s,%s,%s) = {%d};",
-	    attrx_text,attry_text,attrdec_text,ip);
+            attrx_text,attry_text,attrdec_text,ip);
   }
   else if(typ == 2) {
     sprintf(text,"Attractor Surface (%s,%s,%s) = {%d};",
-	    attrx_text,attry_text,attrdec_text,ip);
+            attrx_text,attry_text,attrdec_text,ip);
   }
   add_infile(text,fich);
 }
@@ -463,10 +463,10 @@ void translate_seg(int add, int s, char *fich){
 
   if(add)
     sprintf(text,"Translate({%s,%s,%s}) {\n  Duplicata { Line(%d); }\n}",
-	    tx_text,ty_text,tz_text,s);
+            tx_text,ty_text,tz_text,s);
   else
     sprintf(text,"Translate({%s,%s,%s}) {\n  Line(%d);\n}",
-	    tx_text,ty_text,tz_text,s);
+            tx_text,ty_text,tz_text,s);
   add_infile(text,fich);
   add_infile("Coherence;",fich);
 }
@@ -477,10 +477,10 @@ void translate_surf(int add, int s, char *fich){
 
   if(add)
     sprintf(text,"Translate({%s,%s,%s}) {\n  Duplicata { Surface(%d); }\n}",
-	    tx_text,ty_text,tz_text,s);
+            tx_text,ty_text,tz_text,s);
   else
     sprintf(text,"Translate({%s,%s,%s}) {\n  Surface(%d);\n}",
-	    tx_text,ty_text,tz_text,s);
+            tx_text,ty_text,tz_text,s);
   add_infile(text,fich);
   add_infile("Coherence;",fich);
 }
@@ -490,10 +490,10 @@ void translate_pt(int add, int s, char *fich){
 
   if(add)
     sprintf(text,"Translate({%s,%s,%s}) {\n  Duplicata { Point(%d); }\n}",
-	    tx_text,ty_text,tz_text,s);
+            tx_text,ty_text,tz_text,s);
   else
     sprintf(text,"Translate({%s,%s,%s}) {\n  Point(%d);\n}",
-	    tx_text,ty_text,tz_text,s);
+            tx_text,ty_text,tz_text,s);
   add_infile(text,fich);
   add_infile("Coherence;",fich);
 }
@@ -503,10 +503,10 @@ void rotate(int add, int s, char *fich, char *quoi){
 
   if(add)
     sprintf(text,"Rotate({%s,%s,%s},{%s,%s,%s},%s) {\n  Duplicata { %s(%d); }\n}",
-	    ax_text,ay_text,az_text,px_text,py_text,pz_text,angle_text, quoi,s);
+            ax_text,ay_text,az_text,px_text,py_text,pz_text,angle_text, quoi,s);
   else
     sprintf(text,"Rotate({%s,%s,%s},{%s,%s,%s},%s) {\n   %s(%d);\n  }",
-	    ax_text,ay_text,az_text,px_text,py_text,pz_text,angle_text, quoi,s);
+            ax_text,ay_text,az_text,px_text,py_text,pz_text,angle_text, quoi,s);
   add_infile(text,fich);
   add_infile("Coherence;",fich);
 }
@@ -516,10 +516,10 @@ void dilate(int add, int s, char *fich, char *quoi){
 
   if(add)
     sprintf(text,"Dilate({%s,%s,%s},%s) {\n  Duplicata { %s(%d); }\n}",
-	    dx_text,dy_text,dz_text,df_text, quoi,s);
+            dx_text,dy_text,dz_text,df_text, quoi,s);
   else
     sprintf(text,"Dilate({%s,%s,%s},%s) {\n   %s(%d);\n  }",
-	    dx_text,dy_text,dz_text,df_text, quoi,s);
+            dx_text,dy_text,dz_text,df_text, quoi,s);
   add_infile(text,fich);
   add_infile("Coherence;",fich);
 }
@@ -529,7 +529,7 @@ void protude(int s, char *fich, char *what){
   char text[BUFFSIZE];
 
   sprintf(text,"Extrude %s(%d, {%s,%s,%s}, {%s,%s,%s}, %s);",what,s,ax_text,ay_text,
-	  az_text,px_text,py_text,pz_text,angle_text);
+          az_text,px_text,py_text,pz_text,angle_text);
   add_infile(text,fich);
   add_infile("Coherence;",fich);
 }
diff --git a/Geo/Geo.h b/Geo/Geo.h
index 5688c4af60..36d97bd7b0 100644
--- a/Geo/Geo.h
+++ b/Geo/Geo.h
@@ -1,4 +1,4 @@
-/* $Id: Geo.h,v 1.3 2000-11-24 12:49:59 geuzaine Exp $ */
+/* $Id: Geo.h,v 1.4 2000-11-26 15:43:45 geuzaine Exp $ */
 #ifndef _GEO_H_
 #define _GEO_H_
 
@@ -47,7 +47,7 @@
 #define MSH_SURF_TRIMMED     1599
 #define MSH_SURF_STL         1599
 
-#define MSH_VOLUME		     14
+#define MSH_VOLUME                   14
 #define MSH_SEGM_BSPLN       15
 #define MSH_SEGM_URBS        16
 #define MSH_SEGM_NURBS       17
diff --git a/Geo/MinMax.cpp b/Geo/MinMax.cpp
index 724b62b2e4..1b62918c35 100644
--- a/Geo/MinMax.cpp
+++ b/Geo/MinMax.cpp
@@ -1,4 +1,4 @@
-/* $Id: MinMax.cpp,v 1.2 2000-11-23 14:11:30 geuzaine Exp $ */
+/* $Id: MinMax.cpp,v 1.3 2000-11-26 15:43:45 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "Const.h"
@@ -7,9 +7,6 @@
 
 extern Context_T    CTX ;
 
-extern double       LC, MiddleLC;
-extern int          LC_ORDER;
-
 /* ------------------------------------------------------------------------ */
 /*  m i n m a x                                                             */
 /* ------------------------------------------------------------------------ */
@@ -34,7 +31,7 @@ void CalculateMinMax (Tree_T *t){
     CTX.min[0] = CTX.min[1] = CTX.min[2] = -1.;
     CTX.max[0] = CTX.max[1] = CTX.max[2] =  1.;
     CTX.range[0] = CTX.range[1] = CTX.range[2] = 0.;
-    LC = MiddleLC = 1.;
+    CTX.lc = CTX.lc_middle = 1.;
     return;
   }
 
@@ -53,57 +50,57 @@ void CalculateMinMax (Tree_T *t){
     CTX.min[1] -= 1. ; 
     CTX.max[0] += 1. ; 
     CTX.max[1] += 1. ;
-    LC = 1.;
-    MiddleLC = 0.;
+    CTX.lc = 1.;
+    CTX.lc_middle = 0.;
   }
   else if(CTX.range[0] == 0. && CTX.range[1] == 0.){
-    LC = MiddleLC = CTX.range[2];
-    CTX.min[0] -= LC; 
-    CTX.min[1] -= LC; 
-    CTX.max[0] += LC; 
-    CTX.max[1] += LC;
+    CTX.lc = CTX.lc_middle = CTX.range[2];
+    CTX.min[0] -= CTX.lc; 
+    CTX.min[1] -= CTX.lc; 
+    CTX.max[0] += CTX.lc; 
+    CTX.max[1] += CTX.lc;
   }
   else if(CTX.range[0] == 0. && CTX.range[2] == 0.){
-    LC = MiddleLC = CTX.range[1];
-    CTX.min[0] -= LC; 
-    CTX.max[0] += LC;   
+    CTX.lc = CTX.lc_middle = CTX.range[1];
+    CTX.min[0] -= CTX.lc; 
+    CTX.max[0] += CTX.lc;   
   }
   else if(CTX.range[1] == 0. && CTX.range[2] == 0.){
-    LC = MiddleLC = CTX.range[0];
-    CTX.min[1] -= LC; 
-    CTX.max[1] += LC;   
+    CTX.lc = CTX.lc_middle = CTX.range[0];
+    CTX.min[1] -= CTX.lc; 
+    CTX.max[1] += CTX.lc;   
   }
   else if(CTX.range[0] == 0.){ 
-    LC = sqrt(DSQR(CTX.range[1])+DSQR(CTX.range[2]));
-    MiddleLC = DMIN(CTX.range[1], CTX.range[2]);
-    CTX.min[0] -= LC; 
-    CTX.max[0] += LC;
+    CTX.lc = sqrt(DSQR(CTX.range[1])+DSQR(CTX.range[2]));
+    CTX.lc_middle = DMIN(CTX.range[1], CTX.range[2]);
+    CTX.min[0] -= CTX.lc; 
+    CTX.max[0] += CTX.lc;
   }
   else if(CTX.range[1] == 0.){ 
-    LC = sqrt(DSQR(CTX.range[0])+DSQR(CTX.range[2]));
-    MiddleLC = DMIN(CTX.range[0], CTX.range[2]);
-    CTX.min[1] -= LC; 
-    CTX.max[1] += LC;
+    CTX.lc = sqrt(DSQR(CTX.range[0])+DSQR(CTX.range[2]));
+    CTX.lc_middle = DMIN(CTX.range[0], CTX.range[2]);
+    CTX.min[1] -= CTX.lc; 
+    CTX.max[1] += CTX.lc;
   }
   else if(CTX.range[2] == 0.){ 
-    LC = sqrt(DSQR(CTX.range[0])+DSQR(CTX.range[1]));
-    MiddleLC = DMIN(CTX.range[0], CTX.range[1]);
+    CTX.lc = sqrt(DSQR(CTX.range[0])+DSQR(CTX.range[1]));
+    CTX.lc_middle = DMIN(CTX.range[0], CTX.range[1]);
   }
   else{
-    LC = sqrt(DSQR(CTX.range[0])+DSQR(CTX.range[1])+DSQR(CTX.range[2]));
+    CTX.lc = sqrt(DSQR(CTX.range[0])+DSQR(CTX.range[1])+DSQR(CTX.range[2]));
     if((CTX.range[1] <= CTX.range[0] && CTX.range[0] <= CTX.range[2]) || 
        (CTX.range[2] <= CTX.range[0] && CTX.range[0] <= CTX.range[1])) 
-      MiddleLC = CTX.range[0];
+      CTX.lc_middle = CTX.range[0];
     else if((CTX.range[0] <= CTX.range[1] && CTX.range[1] <= CTX.range[2]) || 
-	    (CTX.range[2] <= CTX.range[1] && CTX.range[1] <= CTX.range[0])) 
-      MiddleLC = CTX.range[1];
+            (CTX.range[2] <= CTX.range[1] && CTX.range[1] <= CTX.range[0])) 
+      CTX.lc_middle = CTX.range[1];
     else
-      MiddleLC = CTX.range[2];
+      CTX.lc_middle = CTX.range[2];
   }
 
-  /* LC_ORDER : LC == f * 10^LC_ORDER with -1<f<1  */
+  /* CTX.lc_order : CTX.lc == f * 10^CTX.lc_order with -1<f<1  */
 
-  frac = frexp(LC, &exp);     
-  LC_ORDER = (int)floor(log10(ldexp(frac,exp)));
+  frac = frexp(CTX.lc, &exp);     
+  CTX.lc_order = (int)floor(log10(ldexp(frac,exp)));
 }
 
diff --git a/Geo/Print_Geo.cpp b/Geo/Print_Geo.cpp
index 0378ef2d55..2589f9b750 100644
--- a/Geo/Print_Geo.cpp
+++ b/Geo/Print_Geo.cpp
@@ -1,4 +1,4 @@
-/* $Id: Print_Geo.cpp,v 1.5 2000-11-25 15:26:10 geuzaine Exp $ */
+/* $Id: Print_Geo.cpp,v 1.6 2000-11-26 15:43:45 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "Geo.h"
@@ -177,7 +177,8 @@ void Print_Geo(Mesh *M, char *filename){
   Tree_Action(M->Surfaces,Print_Surface);
 
   if(filename){
-    Msg (INFOS, "Wrote File '%s'", filename);
+    Msg (INFOS, "Geo Output Complete '%s'", filename);
+    Msg (INFO, "Wrote File '%s'", filename);
     fclose(FOUT);
   }
 
diff --git a/Geo/StepGeomDatabase.cpp b/Geo/StepGeomDatabase.cpp
index b2fc72cbe3..09be0a87ee 100644
--- a/Geo/StepGeomDatabase.cpp
+++ b/Geo/StepGeomDatabase.cpp
@@ -1,18 +1,17 @@
-/* $Id: StepGeomDatabase.cpp,v 1.3 2000-11-23 17:16:38 geuzaine Exp $ */
+/* $Id: StepGeomDatabase.cpp,v 1.4 2000-11-26 15:43:45 geuzaine Exp $ */
 
 #include "Gmsh.h"
+#include "Const.h"
 #include "Geo.h"
 #include "StepGeomDatabase.h"
 #include "DataBase.h"
+#include "Context.h"
 
-#define MAX(A,B) ((A)<(B))?(B):(A);
-#define MIN(A,B) ((A)<(B))?(A):(B);
-#define SQR(A) (A)*(A)
-
-extern double LC ;
+extern Context_T CTX;
 
 static Step_Solid_BRep_t *BREP=NULL;
 
+
 Step_Solid_BRep_t *Create_Step_Solid_BRep(void){
   Step_Solid_BRep_t *NEWBREP;
   NEWBREP                       = (Step_Solid_BRep_t *)Malloc(sizeof(Step_Solid_BRep_t));
@@ -501,8 +500,7 @@ void Resolve_BREP (void){
     YMIN = MIN(cp.Pos.Y,YMIN);
     ZMIN = MIN(cp.Pos.Z,ZMIN);
   }
-  L = sqrt(SQR(XMIN-XMAX) + SQR(YMIN-YMAX) + SQR(ZMIN-ZMAX));
-  LC = L;
+  CTX.lc = L = sqrt(SQR(XMIN-XMAX) + SQR(YMIN-YMAX) + SQR(ZMIN-ZMAX));
 
   /* resolving cartesian_points */
   for(i=0;i<List_Nbr(BREP->AllCartesian_Points);i++){
diff --git a/Geo/StepGeomDatabase.h b/Geo/StepGeomDatabase.h
index 725da93c54..6d673b44fe 100644
--- a/Geo/StepGeomDatabase.h
+++ b/Geo/StepGeomDatabase.h
@@ -1,4 +1,4 @@
-/* $Id: StepGeomDatabase.h,v 1.2 2000-11-23 14:11:31 geuzaine Exp $ */
+/* $Id: StepGeomDatabase.h,v 1.3 2000-11-26 15:43:45 geuzaine Exp $ */
 #ifndef _STEP_GEOM_DATABASE_H_
 #define _STEP_GEOM_DATABASE_H_
 
@@ -189,15 +189,15 @@ void Add_Face_Outer_Bound (int Num, char *name, int el, bool dir, bool outer);
 void Add_Advanced_Face (int Num, char *name, List_T * lfob, int surf, bool dir);
 void Add_Closed_Shell (int Num, char *name, List_T * laf);
 void Add_BSpline_Curve_With_Knots (int Num, char *name, int Order, List_T * lcp,
-				   List_T * lm, List_T * lk, double udeb, double uend);
+                                   List_T * lm, List_T * lk, double udeb, double uend);
 void Add_Plane (int Num, char *name, int axis);
 void Add_Axis2_Placement3D (int Num, int cp, int dir1, int dir2);
 void Add_Closed_Shell (int Num, char *name, List_T * list);
 void Resolve_BREP (void);
 void Add_BSpline_Surface_With_Knots (int Num,char *name,int OrderU,int OrderV,
-				     List_T * lcp, List_T * lmu, List_T * lmv,
-				     List_T * lku,List_T * lkv,
-				     double udeb,double uend,
-				     double vdeb,double vend);
+                                     List_T * lcp, List_T * lmu, List_T * lmv,
+                                     List_T * lku,List_T * lkv,
+                                     double udeb,double uend,
+                                     double vdeb,double vend);
 
 #endif
diff --git a/Graphics/ColorTable.cpp b/Graphics/ColorTable.cpp
index fcfcd9e342..f1dcd0fac5 100644
--- a/Graphics/ColorTable.cpp
+++ b/Graphics/ColorTable.cpp
@@ -1,4 +1,4 @@
-/* $Id: ColorTable.cpp,v 1.2 2000-11-23 14:11:32 geuzaine Exp $ */
+/* $Id: ColorTable.cpp,v 1.3 2000-11-26 15:43:46 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "ColorTable.h"
@@ -6,7 +6,8 @@
 
 extern Context_T CTX ;
 
-void color_table_init_param(int number, ColorTable *ct, int rgb_flag, int alpha_flag){
+void ColorTable_InitParam(int number, ColorTable *ct, 
+                          int rgb_flag, int alpha_flag){
 
   ct->ipar[COLORTABLE_NUMBER] = number;
 
@@ -26,7 +27,7 @@ void color_table_init_param(int number, ColorTable *ct, int rgb_flag, int alpha_
 
 }
 
-void color_table_recompute(ColorTable *ct, int rgb_flag, int alpha_flag){
+void ColorTable_Recompute(ColorTable *ct, int rgb_flag, int alpha_flag){
   float curve, bias;
   double gamma;
   int i,r,g,b,a,rotate;
@@ -53,90 +54,90 @@ void color_table_recompute(ColorTable *ct, int rgb_flag, int alpha_flag){
 
       switch(ct->ipar[COLORTABLE_NUMBER]){
       case 1 : /* vis5d */
-	t = (curve+1.4) * (s - (1.+bias)/2.);
-	r = (int)( 128.0 + 127.0 * atan( 7.0*t ) / 1.57  );
-	g = (int)( 128.0 + 127.0 * (2 * exp(-7*t*t) - 1) );
-	b = (int)( 128.0 + 127.0 * atan( -7.0*t ) / 1.57 );
-	break;
+        t = (curve+1.4) * (s - (1.+bias)/2.);
+        r = (int)( 128.0 + 127.0 * atan( 7.0*t ) / 1.57  );
+        g = (int)( 128.0 + 127.0 * (2 * exp(-7*t*t) - 1) );
+        b = (int)( 128.0 + 127.0 * atan( -7.0*t ) / 1.57 );
+        break;
       case 2: /* samcef */
-	if (s-bias<=0.00){ 
-	  r = 0 ; g = 0 ; b = 255 ;
-	}
-	else if(s-bias<=0.40){
-	  r = 0 ; g = (int)((s-bias)*637.5) ; b = (int)(255.-(s-bias)*637.5) ;
-	}
-	else if(s-bias<=0.60){ 
-	  r = (int)(1275.*(s-bias-0.4)) ; g = 255 ; b = 0 ;
-	}
-	else if(s-bias<=1.00){ 
-	  r = 255 ; g = (int)(255.-637.5*(s-bias-0.6)) ; b = 0 ;
-	}
-	else {
-	  r = 255 ; g = 0 ; b = 0 ;
-	}
-	break;
+        if (s-bias<=0.00){ 
+          r = 0 ; g = 0 ; b = 255 ;
+        }
+        else if(s-bias<=0.40){
+          r = 0 ; g = (int)((s-bias)*637.5) ; b = (int)(255.-(s-bias)*637.5) ;
+        }
+        else if(s-bias<=0.60){ 
+          r = (int)(1275.*(s-bias-0.4)) ; g = 255 ; b = 0 ;
+        }
+        else if(s-bias<=1.00){ 
+          r = 255 ; g = (int)(255.-637.5*(s-bias-0.6)) ; b = 0 ;
+        }
+        else {
+          r = 255 ; g = 0 ; b = 0 ;
+        }
+        break;
       case 3: /* rainbow */
-	if (s-bias<=0.00) {
-	  r = 0 ; g = 0 ; b = 255 ; 
-	}
-	else if(s-bias<=0.25+curve){ 
-	  r = 0 ; g = (int)((s-bias)*(255./(0.25+curve))) ; b = 255 ; 
-	}
-	else if(s-bias<=0.50) { 
-	  r = 0 ; g = 255 ; b = (int)(255.-(255./(0.25-curve))*(s-bias-0.25-curve)); 
-	}
-	else if(s-bias<=0.75-curve){ 
-	  r = (int)((s-bias-0.5)*(255./(0.25-curve))); g = 255 ; b = 0 ; 
-	}
-	else if(s-bias<=1.00) { 
-	  r = 255; g = (int)(255.-(255./(0.25+curve))*(s-bias-0.75+curve)) ; b = 0 ;
-	}
-	else { 
-	  r = 255 ; g = 0 ; b = 0 ; 
-	}
-	break;
+        if (s-bias<=0.00) {
+          r = 0 ; g = 0 ; b = 255 ; 
+        }
+        else if(s-bias<=0.25+curve){ 
+          r = 0 ; g = (int)((s-bias)*(255./(0.25+curve))) ; b = 255 ; 
+        }
+        else if(s-bias<=0.50) { 
+          r = 0 ; g = 255 ; b = (int)(255.-(255./(0.25-curve))*(s-bias-0.25-curve)); 
+        }
+        else if(s-bias<=0.75-curve){ 
+          r = (int)((s-bias-0.5)*(255./(0.25-curve))); g = 255 ; b = 0 ; 
+        }
+        else if(s-bias<=1.00) { 
+          r = 255; g = (int)(255.-(255./(0.25+curve))*(s-bias-0.75+curve)) ; b = 0 ;
+        }
+        else { 
+          r = 255 ; g = 0 ; b = 0 ; 
+        }
+        break;
       case 4: /* blue-yellow-white */
 #define myfct(a,b,c,d) ((a)+\
-			(b)*(s-bias)+\
-			(c)*(s-bias)*(s-bias)+\
-			(d)*(s-bias)*(s-bias)*(s-bias))
+                        (b)*(s-bias)+\
+                        (c)*(s-bias)*(s-bias)+\
+                        (d)*(s-bias)*(s-bias)*(s-bias))
 #define clamp(x) x = (x)<0?0:((x)>255?255:(x))
-	r = (int)(255. * myfct(-0.0506169, 2.81633, -1.87033, 0.0524573) ); 
-	g = (int)(255. * myfct(0.0485868,  -1.26109, 6.3074, -4.12498)   );
-	b = (int)(255. * myfct(0.364662,   1.50814, -7.36756, 6.51847 )  );	
-	clamp(r); clamp(g); clamp(b);
+        r = (int)(255. * myfct(-0.0506169, 2.81633, -1.87033, 0.0524573) ); 
+        g = (int)(255. * myfct(0.0485868,  -1.26109, 6.3074, -4.12498)   );
+        b = (int)(255. * myfct(0.364662,   1.50814, -7.36756, 6.51847 )  );     
+        clamp(r); clamp(g); clamp(b);
 #undef myfct
 #undef clamp
-	break;
+        break;
       case 5: /* grayscale */
-	if      (s-bias<=0.00){ r = g = b = 0 ; }
-	else if (s-bias<=1.00){ r = g = b = (int)(255*(s-bias)); }
-	else                  { r = g = b = 255 ; }
-	break;
+        if      (s-bias<=0.00){ r = g = b = 0 ; }
+        else if (s-bias<=1.00){ r = g = b = (int)(255*(s-bias)); }
+        else                  { r = g = b = 255 ; }
+        break;
       case 6: /* monochrome */
-	r = g = b = 0 ;
-	break;
+        r = g = b = 0 ;
+        break;
       default: /* grayscale without white */
-	if      (s-bias<=0.00){ r = g = b = 0 ; }
-	else if (s-bias<=1.00){ r = g = b = (int)(220*(s-bias)); }
-	else                  { r = g = b = 220 ; }
-	break;
+        if      (s-bias<=0.00){ r = g = b = 0 ; }
+        else if (s-bias<=1.00){ r = g = b = (int)(220*(s-bias)); }
+        else                  { r = g = b = 220 ; }
+        break;
       }
 
       if(ct->fpar[COLORTABLE_BETA]){
-	if(ct->fpar[COLORTABLE_BETA] > 0.0)
-	  gamma = 1. - ct->fpar[COLORTABLE_BETA];
-	else
-	  gamma = 1./(1.001 + ct->fpar[COLORTABLE_BETA]);
-	r = (int)( 255. * pow((double)r/255.,gamma) );
-	g = (int)( 255. * pow((double)g/255.,gamma) );
-	b = (int)( 255. * pow((double)b/255.,gamma) );
+        if(ct->fpar[COLORTABLE_BETA] > 0.0)
+          gamma = 1. - ct->fpar[COLORTABLE_BETA];
+        else
+          gamma = 1./(1.001 + ct->fpar[COLORTABLE_BETA]);
+        r = (int)( 255. * pow((double)r/255.,gamma) );
+        g = (int)( 255. * pow((double)g/255.,gamma) );
+        b = (int)( 255. * pow((double)b/255.,gamma) );
       }
 
       if(ct->ipar[COLORTABLE_INVERT]){
-	r = 255-r ;
-	g = 255-g ;
-	b = 255-b ;
+        r = 255-r ;
+        g = 255-g ;
+        b = 255-b ;
       }
 
     }
@@ -148,10 +149,10 @@ void color_table_recompute(ColorTable *ct, int rgb_flag, int alpha_flag){
     
     if (alpha_flag) {
       if (ct->fpar[COLORTABLE_ALPHAVAL]<0) {
-	a = (int)( 255.0 * pow( s, ct->fpar[COLORTABLE_ALPHAPOW] ) );
+        a = (int)( 255.0 * pow( s, ct->fpar[COLORTABLE_ALPHAPOW] ) );
       }
       else {
-	a = (int)( ct->fpar[COLORTABLE_ALPHAVAL] );
+        a = (int)( ct->fpar[COLORTABLE_ALPHAVAL] );
       }
     }
     else {
@@ -163,6 +164,22 @@ void color_table_recompute(ColorTable *ct, int rgb_flag, int alpha_flag){
   
 }
 
+static ColorTable clip;
+
+void ColorTable_Copy(ColorTable *ct){
+  clip.size = ct->size;
+  memcpy(clip.table, ct->table, ct->size * sizeof(unsigned int));
+  memcpy(clip.ipar,  ct->ipar,  COLORTABLE_NBMAX_PARAM * sizeof(int));
+  memcpy(clip.fpar,  ct->fpar,  COLORTABLE_NBMAX_PARAM * sizeof(float));
+}
+
+void ColorTable_Paste(ColorTable *ct){
+  ct->size = clip.size;
+  memcpy(ct->table, clip.table, clip.size * sizeof(unsigned int));
+  memcpy(ct->ipar,  clip.ipar,  COLORTABLE_NBMAX_PARAM * sizeof(int));
+  memcpy(ct->fpar,  clip.fpar,  COLORTABLE_NBMAX_PARAM * sizeof(float));
+}
+
 
 /*
  * File format is ASCII:
@@ -172,7 +189,7 @@ void color_table_recompute(ColorTable *ct, int rgb_flag, int alpha_flag){
  *    .....
  *    <r> <g> <b> <a>
  */
-void save_color_table(FILE *fp, ColorTable *ct){
+void ColorTable_Save(FILE *fp, ColorTable *ct){
   int i, r, g, b, a;  
 
   fprintf(fp, "$COL\n");
@@ -186,7 +203,7 @@ void save_color_table(FILE *fp, ColorTable *ct){
   }
 }
 
-void load_color_table(FILE *fp, ColorTable *ct){
+void ColorTable_Load(FILE *fp, ColorTable *ct){
   int i, r, g, b, a;
   
   fscanf(fp, "$COL\n");
@@ -194,7 +211,7 @@ void load_color_table(FILE *fp, ColorTable *ct){
 
   if(ct->size>COLORTABLE_NBMAX_COLOR){
     Msg(ERROR, "Too many colors in ColorTable (%d > %d)", 
-	ct->size, COLORTABLE_NBMAX_COLOR);
+        ct->size, COLORTABLE_NBMAX_COLOR);
     return;
   }
 
diff --git a/Graphics/ColorTable.h b/Graphics/ColorTable.h
index b20591b434..f14cb064d0 100644
--- a/Graphics/ColorTable.h
+++ b/Graphics/ColorTable.h
@@ -1,4 +1,4 @@
-/* $Id: ColorTable.h,v 1.2 2000-11-23 14:11:32 geuzaine Exp $ */
+/* $Id: ColorTable.h,v 1.3 2000-11-26 15:43:46 geuzaine Exp $ */
 #ifndef _COLORTABLE_H_
 #define _COLORTABLE_H_
 
@@ -21,24 +21,26 @@ typedef struct{
 
 /* integrer parameters indices */
 
-#define COLORTABLE_NUMBER    0	/* predefined curve index */
-#define COLORTABLE_CHANGED   1	/* did the colortable change ? */
-#define COLORTABLE_INVERT    2	/* invert (rbg<->255-rgb) */
-#define COLORTABLE_SWAP      3	/* swap (min<->max) */
-#define COLORTABLE_ROTATE    4	/* rotate */
-#define COLORTABLE_MODE      5	/* mode (rgb, hsv) */
+#define COLORTABLE_NUMBER    0  /* predefined curve index */
+#define COLORTABLE_CHANGED   1  /* did the colortable change ? */
+#define COLORTABLE_INVERT    2  /* invert (rbg<->255-rgb) */
+#define COLORTABLE_SWAP      3  /* swap (min<->max) */
+#define COLORTABLE_ROTATE    4  /* rotate */
+#define COLORTABLE_MODE      5  /* mode (rgb, hsv) */
 
 /* float parameters indices */
 
-#define COLORTABLE_CURVE     0	/* curvature */
-#define COLORTABLE_BIAS      1	/* offset */
-#define COLORTABLE_ALPHAPOW  2	/* alpha channel power */
-#define COLORTABLE_ALPHAVAL  3	/* alpha channel value */
-#define COLORTABLE_BETA      4	/* beta coeff for brighten */
-
-void color_table_init_param (int number, ColorTable * ct, int rgb_flag, int alpha_flag);
-void color_table_recompute (ColorTable * ct, int rgb_flag, int alpha_flag);
-void load_color_table(FILE *fp, ColorTable *ct);
-void save_color_table(FILE *fp, ColorTable *ct) ;
+#define COLORTABLE_CURVE     0  /* curvature */
+#define COLORTABLE_BIAS      1  /* offset */
+#define COLORTABLE_ALPHAPOW  2  /* alpha channel power */
+#define COLORTABLE_ALPHAVAL  3  /* alpha channel value */
+#define COLORTABLE_BETA      4  /* beta coeff for brighten */
+
+void ColorTable_InitParam (int number, ColorTable * ct, int rgb_flag, int alpha_flag);
+void ColorTable_Recompute (ColorTable * ct, int rgb_flag, int alpha_flag);
+void ColorTable_Copy(ColorTable *ct);
+void ColorTable_Paste(ColorTable *ct);
+void ColorTable_Load(FILE *fp, ColorTable *ct);
+void ColorTable_Save(FILE *fp, ColorTable *ct) ;
 
 #endif
diff --git a/Graphics/Draw.cpp b/Graphics/Draw.cpp
index 61ddfaf8d5..4e510465cc 100644
--- a/Graphics/Draw.cpp
+++ b/Graphics/Draw.cpp
@@ -1,4 +1,4 @@
-/* $Id: Draw.cpp,v 1.4 2000-11-25 15:26:10 geuzaine Exp $ */
+/* $Id: Draw.cpp,v 1.5 2000-11-26 15:43:46 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -20,7 +20,6 @@ extern Widgets_T    WID ;
 extern Context_T    CTX ;
 extern GLdouble     vxmin, vxmax, vymin, vymax;
 extern Mesh         M;
-extern double       LC;
 extern List_T      *Post_ViewList;
 
 /* ------------------------------------------------------------------------ */
@@ -38,7 +37,13 @@ void Draw3d(void){
     glDisable(GL_ALPHA);
   }
   glPolygonOffset(1.0, 1);
-  glEnable(GL_CLIP_PLANE0);
+
+  if(CTX.clip[0]) glEnable(GL_CLIP_PLANE0);
+  if(CTX.clip[1]) glEnable(GL_CLIP_PLANE1);
+  if(CTX.clip[2]) glEnable(GL_CLIP_PLANE2);
+  if(CTX.clip[3]) glEnable(GL_CLIP_PLANE3);
+  if(CTX.clip[4]) glEnable(GL_CLIP_PLANE4);
+  if(CTX.clip[5]) glEnable(GL_CLIP_PLANE5);
 
   /* This is sufficient, since we NEVER give different normals to nodes of one polygon */
   glShadeModel(GL_FLAT);   //glShadeModel(GL_SMOOTH);
@@ -53,7 +58,13 @@ void Draw3d(void){
 }
 
 void Draw2d(void){
-  glDisable(GL_CLIP_PLANE0);
+  glEnable(GL_CLIP_PLANE0);
+  glEnable(GL_CLIP_PLANE1);
+  glEnable(GL_CLIP_PLANE2);
+  glEnable(GL_CLIP_PLANE3);
+  glEnable(GL_CLIP_PLANE4);
+  glEnable(GL_CLIP_PLANE5);
+
   glDisable(GL_DEPTH_TEST);
   glDisable(GL_LIGHTING);
   glShadeModel(GL_FLAT);
@@ -62,9 +73,9 @@ void Draw2d(void){
   glLoadIdentity();
   /* to draw directly in screen coords */
   glOrtho((double)CTX.viewport[0],
-	  (double)CTX.viewport[2],
-	  (double)CTX.viewport[1],
-	  (double)CTX.viewport[3],-1.,1.);
+          (double)CTX.viewport[2],
+          (double)CTX.viewport[1],
+          (double)CTX.viewport[3],-1.,1.);
   glMatrixMode(GL_MODELVIEW);
   glLoadIdentity();
 
@@ -77,9 +88,9 @@ void Draw2d(void){
 #ifdef _UNIX
 void Draw(void){
   glClearColor(UNPACK_RED(CTX.color.bg)/255.,
-	       UNPACK_GREEN(CTX.color.bg)/255.,
-	       UNPACK_BLUE(CTX.color.bg)/255.,
-	       0.);
+               UNPACK_GREEN(CTX.color.bg)/255.,
+               UNPACK_BLUE(CTX.color.bg)/255.,
+               0.);
   glClear(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT);
   if(CTX.db) glDrawBuffer(GL_BACK);    
   Draw3d();
@@ -91,9 +102,9 @@ void Draw(void){
 void Draw(void){
   if(CTX.db) glDrawBuffer(GL_BACK);
   glClearColor(UNPACK_RED(CTX.color.bg)/255.,
-	       UNPACK_GREEN(CTX.color.bg)/255.,
-	       UNPACK_BLUE(CTX.color.bg)/255.,
-	       0.);
+               UNPACK_GREEN(CTX.color.bg)/255.,
+               UNPACK_BLUE(CTX.color.bg)/255.,
+               0.);
   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);  
   Draw3d();
   Draw2d();
@@ -115,10 +126,10 @@ void Orthogonalize(int x, int y){
 
   if(CTX.render_mode == GMSH_SELECT)
     gluPickMatrix ((GLdouble)x, 
-		   (GLdouble)(CTX.viewport[3]-y),
-		   5.0,
-		   5.0,
-		   CTX.viewport);
+                   (GLdouble)(CTX.viewport[3]-y),
+                   5.0,
+                   5.0,
+                   CTX.viewport);
 
   Va = (GLdouble)(CTX.viewport[3]-CTX.viewport[1]) / 
        (GLdouble)(CTX.viewport[2]-CTX.viewport[0]) ;
@@ -144,16 +155,16 @@ void Orthogonalize(int x, int y){
   CTX.pixel_equiv_y = (vymax-vymin)/(CTX.viewport[3]-CTX.viewport[1]);
   
   if(CTX.ortho) {
-    glOrtho(vxmin,vxmax,vymin,vymax,0,100*LC);
+    glOrtho(vxmin,vxmax,vymin,vymax,0,100*CTX.lc);
     glMatrixMode(GL_MODELVIEW);
     glLoadIdentity();    
-    glTranslated(0.0, 0.0, -50*LC);
+    glTranslated(0.0, 0.0, -50*CTX.lc);
   }
   else{
-    glFrustum(vxmin,vxmax,vymin,vymax,LC,100*LC);
+    glFrustum(vxmin,vxmax,vymin,vymax,CTX.lc,100*CTX.lc);
     glMatrixMode(GL_MODELVIEW);
     glLoadIdentity();    
-    glTranslated(0.0, 0.0, -10*LC);
+    glTranslated(0.0, 0.0, -10*CTX.lc);
     glScaled(10.,10.,10.);
   }
 
@@ -263,7 +274,7 @@ void Process_SelectionBuffer(int x, int y, int *n, GLuint *ii, GLuint *jj){
     names = *ptr;
     ptr++; ptr++; ptr++;
     for(j=0; j<names; j++){
-      if (j==0)	ii[i] = *ptr;
+      if (j==0) ii[i] = *ptr;
       else if (j==1) jj[i] = *ptr;
       ptr++;
     }
@@ -272,7 +283,7 @@ void Process_SelectionBuffer(int x, int y, int *n, GLuint *ii, GLuint *jj){
 }
 
 void Filter_SelectionBuffer(int n, GLuint *typ, GLuint *ient, Vertex **thev,
-			    Curve **thec, Surface **thes, Mesh *m){
+                            Curve **thec, Surface **thes, Mesh *m){
 
   Vertex   *v=NULL, V;
   Curve    *c=NULL, C;
@@ -290,20 +301,20 @@ void Filter_SelectionBuffer(int n, GLuint *typ, GLuint *ient, Vertex **thev,
     if(typ[i] == typmin){
       switch(typ[i]){
       case 0: 
-	v = &V; 
-	v->Num = ient[i];
-	if(Tree_Query(m->Points,&v)) *thev = v;
-	break;
+        v = &V; 
+        v->Num = ient[i];
+        if(Tree_Query(m->Points,&v)) *thev = v;
+        break;
       case 1:
-	c = &C;
-	c->Num = ient[i];
-	if(Tree_Query(m->Curves,&c)) *thec = c;
-	break;
+        c = &C;
+        c->Num = ient[i];
+        if(Tree_Query(m->Curves,&c)) *thec = c;
+        break;
       case 2:
-	s = &S;
-	s->Num = ient[i];
-	if(Tree_Query(m->Surfaces,&s)) *thes = s;
-	break;
+        s = &S;
+        s->Num = ient[i];
+        if(Tree_Query(m->Surfaces,&s)) *thes = s;
+        break;
       }
     }
   }
@@ -314,8 +325,8 @@ void Filter_SelectionBuffer(int n, GLuint *typ, GLuint *ient, Vertex **thev,
 
 int check_type(int type, Vertex *v, Curve *c, Surface *s){
   return ( (type==ENT_POINT   && v) ||
-	   (type==ENT_LINE    && c) ||
-	   (type==ENT_SURFACE && s) ) ;
+           (type==ENT_LINE    && c) ||
+           (type==ENT_SURFACE && s) ) ;
 }
 
 int SelectEntity(int type, Vertex **v, Curve **c, Surface **s){
@@ -343,10 +354,10 @@ int SelectEntity(int type, Vertex **v, Curve **c, Surface **s){
       Process_SelectionBuffer(event.xbutton.x, event.xbutton.y, &hits, ii, jj);
       Filter_SelectionBuffer(hits,ii,jj,v,c,s,&M);
       if(check_type(type,*v,*c,*s)){
-	BeginHighlight();
-	HighlightEntity(*v,*c,*s,1);
-	EndHighlight(1);
-	return(event.xbutton.button);
+        BeginHighlight();
+        HighlightEntity(*v,*c,*s,1);
+        EndHighlight(1);
+        return(event.xbutton.button);
       }
     }
   }
@@ -378,7 +389,7 @@ int SelectEntity(int x, int y, Vertex **v, Curve **c, Surface **s){
 
 
 void myZoom(GLdouble X1, GLdouble X2, GLdouble Y1, GLdouble Y2,
-	    GLdouble Xc1, GLdouble Xc2, GLdouble Yc1, GLdouble Yc2){
+            GLdouble Xc1, GLdouble Xc2, GLdouble Yc1, GLdouble Yc2){
   GLdouble  xscale1, yscale1;
 
   xscale1 = CTX.s[0];
@@ -406,9 +417,9 @@ void InitCb(Widget w, XtPointer client_data, GLwDrawingAreaCallbackStruct *cb){
   CTX.viewport[2] = cb->width ;
   CTX.viewport[3] = cb->height ;
   glViewport(CTX.viewport[0],
-	     CTX.viewport[1],
-	     CTX.viewport[2],
-	     CTX.viewport[3]);
+             CTX.viewport[1],
+             CTX.viewport[2],
+             CTX.viewport[3]);
 }
 
 void ResizeCb(Widget w,XtPointer client_data, GLwDrawingAreaCallbackStruct *cb){
@@ -417,9 +428,9 @@ void ResizeCb(Widget w,XtPointer client_data, GLwDrawingAreaCallbackStruct *cb){
   CTX.viewport[2] = cb->width ;
   CTX.viewport[3] = cb->height ;
   glViewport(CTX.viewport[0],
-	     CTX.viewport[1],
-	     CTX.viewport[2],
-	     CTX.viewport[3]);
+             CTX.viewport[1],
+             CTX.viewport[2],
+             CTX.viewport[3]);
   Init();
   Draw();
   if(CTX.overlay) InitOv();
diff --git a/Graphics/Draw.h b/Graphics/Draw.h
index ffd7a212ec..d5577e4944 100644
--- a/Graphics/Draw.h
+++ b/Graphics/Draw.h
@@ -1,4 +1,4 @@
-/* $Id: Draw.h,v 1.5 2000-11-25 15:26:10 geuzaine Exp $ */
+/* $Id: Draw.h,v 1.6 2000-11-26 15:43:46 geuzaine Exp $ */
 #ifndef _DRAW_H_
 #define _DRAW_H_
 
@@ -49,19 +49,19 @@ void Draw_Scales(void);
 void Draw_Axes (double s);
 void Draw_SmallAxes(void);
 void Draw_Point(double *x, double *y, double *z,
-		double *Offset, double Raise[3][5]);
+                double *Offset, double Raise[3][5]);
 void Draw_Line (double *x, double *y, double *z,
-		double *Offset, double Raise[3][5]);
+                double *Offset, double Raise[3][5]);
 void Draw_Triangle (double *x, double *y, double *z,
-		    double *Offset, double Raise[3][5], int shade);
+                    double *Offset, double Raise[3][5], int shade);
 void Draw_Quadrangle (double *x, double *y, double *z,
-		      double *Offset, double Raise[3][5], int shade);
+                      double *Offset, double Raise[3][5], int shade);
 void Draw_Polygon (int n, double *x, double *y, double *z,
-		   double *Offset, double Raise[3][5]);
+                   double *Offset, double Raise[3][5]);
 void Draw_Vector (int Type, int Fill,
-		  double x, double y, double z,
-		  double d, double dx, double dy, double dz,
-		  double *Offset, double Raise[3][5]);
+                  double x, double y, double z,
+                  double d, double dx, double dy, double dz,
+                  double *Offset, double Raise[3][5]);
 void Draw_Mesh_Volumes(void *a, void *b);
 void Draw_Mesh_Surfaces(void *a, void *b);
 void Draw_Mesh_Curves(void *a, void *b);
@@ -74,12 +74,12 @@ void Draw_Hexahedron_Volume (void *a, void *b);
 void Draw_Prism_Volume (void *a, void *b);
 
 void Draw_Post_Tetrahedron (Post_View * View, Post_Simplex * s,
-			    double ValMin, double ValMax, double Raise[3][5]);
+                            double ValMin, double ValMax, double Raise[3][5]);
 void Draw_Post_Triangle (Post_View * View, Post_Simplex * t,
-			 double ValMin, double ValMax, double Raise[3][5]);
+                         double ValMin, double ValMax, double Raise[3][5]);
 void Draw_Post_Line (Post_View * View, Post_Simplex * l,
-		     double ValMin, double ValMax, double Raise[3][5]);
+                     double ValMin, double ValMax, double Raise[3][5]);
 void Draw_Post_Point (Post_View * View, Post_Simplex * p,
-		      double ValMin, double ValMax, double Raise[3][5]);
+                      double ValMin, double ValMax, double Raise[3][5]);
 
 #endif
diff --git a/Graphics/Entity.cpp b/Graphics/Entity.cpp
index 46394b1287..1fa0d959be 100644
--- a/Graphics/Entity.cpp
+++ b/Graphics/Entity.cpp
@@ -1,4 +1,4 @@
-/* $Id: Entity.cpp,v 1.2 2000-11-23 14:11:32 geuzaine Exp $ */
+/* $Id: Entity.cpp,v 1.3 2000-11-26 15:43:46 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -13,11 +13,11 @@ extern Context_T   CTX;
 /* ------------------------------------------------------------------------ */
 
 void Draw_Point (double *x, double *y, double *z,
-		 double *Offset, double Raise[3][5]){
+                 double *Offset, double Raise[3][5]){
   glBegin(GL_POINTS);
   glVertex3d(x[0]+Offset[0]+Raise[0][0],
-	     y[0]+Offset[1]+Raise[1][0],
-	     z[0]+Offset[2]+Raise[2][0]);
+             y[0]+Offset[1]+Raise[1][0],
+             z[0]+Offset[2]+Raise[2][0]);
   glEnd();
 }
 
@@ -26,14 +26,14 @@ void Draw_Point (double *x, double *y, double *z,
 /* ------------------------------------------------------------------------ */
 
 void Draw_Line (double *x, double *y, double *z,
-		double *Offset, double Raise[3][5]){
+                double *Offset, double Raise[3][5]){
   glBegin(GL_LINES);
   glVertex3d(x[0]+Offset[0]+Raise[0][0],
-	     y[0]+Offset[1]+Raise[1][0],
-	     z[0]+Offset[2]+Raise[2][0]);
+             y[0]+Offset[1]+Raise[1][0],
+             z[0]+Offset[2]+Raise[2][0]);
   glVertex3d(x[1]+Offset[0]+Raise[0][1],
-	     y[1]+Offset[1]+Raise[1][1],
-	     z[1]+Offset[2]+Raise[2][1]);
+             y[1]+Offset[1]+Raise[1][1],
+             z[1]+Offset[2]+Raise[2][1]);
   glEnd();
 }
 
@@ -42,7 +42,7 @@ void Draw_Line (double *x, double *y, double *z,
 /* ------------------------------------------------------------------------ */
 
 void Draw_Triangle (double *x, double *y, double *z,
-		    double *Offset, double Raise[3][5], int shade){
+                    double *Offset, double Raise[3][5], int shade){
 
   double x1x0, y1y0, z1z0, x2x0, y2y0, z2z0, nn[3];
 
@@ -68,14 +68,14 @@ void Draw_Triangle (double *x, double *y, double *z,
 
   glBegin(GL_TRIANGLES);
   glVertex3d(x[0]+Offset[0]+Raise[0][0],
-	     y[0]+Offset[1]+Raise[1][0],
-	     z[0]+Offset[2]+Raise[2][0]);
+             y[0]+Offset[1]+Raise[1][0],
+             z[0]+Offset[2]+Raise[2][0]);
   glVertex3d(x[1]+Offset[0]+Raise[0][1],
-	     y[1]+Offset[1]+Raise[1][1],
-	     z[1]+Offset[2]+Raise[2][1]);
+             y[1]+Offset[1]+Raise[1][1],
+             z[1]+Offset[2]+Raise[2][1]);
   glVertex3d(x[2]+Offset[0]+Raise[0][2],
-	     y[2]+Offset[1]+Raise[1][2],
-	     z[2]+Offset[2]+Raise[2][2]);
+             y[2]+Offset[1]+Raise[1][2],
+             z[2]+Offset[2]+Raise[2][2]);
   glEnd();
 
 }
@@ -85,7 +85,7 @@ void Draw_Triangle (double *x, double *y, double *z,
 /* ------------------------------------------------------------------------ */
 
 void Draw_Quadrangle (double *x, double *y, double *z,
-		      double *Offset, double Raise[3][5], int shade){
+                      double *Offset, double Raise[3][5], int shade){
 
   double x1x0, y1y0, z1z0, x2x0, y2y0, z2z0, nn[3];
 
@@ -112,20 +112,20 @@ void Draw_Quadrangle (double *x, double *y, double *z,
 
   glBegin(GL_TRIANGLE_FAN);
   glVertex3d(x[0]+Offset[0]+Raise[0][0],
-	     y[0]+Offset[1]+Raise[1][0],
-	     z[0]+Offset[2]+Raise[2][0]);
+             y[0]+Offset[1]+Raise[1][0],
+             z[0]+Offset[2]+Raise[2][0]);
   glVertex3d(x[1]+Offset[0]+Raise[0][1],
-	     y[1]+Offset[1]+Raise[1][1],
-	     z[1]+Offset[2]+Raise[2][1]);
+             y[1]+Offset[1]+Raise[1][1],
+             z[1]+Offset[2]+Raise[2][1]);
   glVertex3d(x[2]+Offset[0]+Raise[0][2],
-	     y[2]+Offset[1]+Raise[1][2],
-	     z[2]+Offset[2]+Raise[2][2]);
+             y[2]+Offset[1]+Raise[1][2],
+             z[2]+Offset[2]+Raise[2][2]);
   glVertex3d(x[3]+Offset[0]+Raise[0][3],
-	     y[3]+Offset[1]+Raise[1][3],
-	     z[3]+Offset[2]+Raise[2][3]);
+             y[3]+Offset[1]+Raise[1][3],
+             z[3]+Offset[2]+Raise[2][3]);
   glVertex3d(x[1]+Offset[0]+Raise[0][1],
-	     y[1]+Offset[1]+Raise[1][1],
-	     z[1]+Offset[2]+Raise[2][1]);
+             y[1]+Offset[1]+Raise[1][1],
+             z[1]+Offset[2]+Raise[2][1]);
   glEnd();  
 }
 
@@ -134,13 +134,13 @@ void Draw_Quadrangle (double *x, double *y, double *z,
 /* ------------------------------------------------------------------------ */
 
 void Draw_Polygon (int n, double *x, double *y, double *z,
-		   double *Offset, double Raise[3][5]){
+                   double *Offset, double Raise[3][5]){
   int i;
   
   glBegin(GL_POLYGON);
   for(i=0;i<n;i++) glVertex3d(x[i]+Offset[0]+Raise[0][i],
-			      y[i]+Offset[1]+Raise[1][i],
-			      z[i]+Offset[2]+Raise[2][i]);
+                              y[i]+Offset[1]+Raise[1][i],
+                              z[i]+Offset[2]+Raise[2][i]);
   glEnd();
 }
 
@@ -149,9 +149,9 @@ void Draw_Polygon (int n, double *x, double *y, double *z,
 /* ------------------------------------------------------------------------ */
 
 void Draw_Vector (int Type, int Fill, 
-		  double x, double y, double z, 
-		  double d, double dx, double dy, double dz,
-		  double *Offset, double Raise[3][5]){
+                  double x, double y, double z, 
+                  double d, double dx, double dy, double dz,
+                  double *Offset, double Raise[3][5]){
 
   double  n[3],t[3],u[3];
   double  l,b,c, f1, f2;
@@ -247,8 +247,7 @@ void Draw_Vector (int Type, int Fill,
     break ;
     
   case DRAW_POST_ARROW_HEAD :
-
-
+    Msg(ERROR, "Arrow Head not done");
     break ;
 
   case DRAW_POST_PYRAMID :
@@ -379,9 +378,8 @@ void Draw_Vector (int Type, int Fill,
     break ;
 
   default :
-    //gprintf("Unknown Type of Vector Field Type : %d", Type); 
-    exit(1);
-    
+    Msg(ERROR, "Unknown Type of Vector to Draw");
+    break;
   }
   
 }
diff --git a/Graphics/Geom.cpp b/Graphics/Geom.cpp
index 76c968bc60..9b099f8e42 100644
--- a/Graphics/Geom.cpp
+++ b/Graphics/Geom.cpp
@@ -1,4 +1,4 @@
-/* $Id: Geom.cpp,v 1.4 2000-11-25 15:26:10 geuzaine Exp $ */
+/* $Id: Geom.cpp,v 1.5 2000-11-26 15:43:46 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -11,9 +11,7 @@
 #include "Numeric.h"
 
 extern Context_T  CTX;
-
 extern Mesh      *THEM;
-extern double     LC;
 
 /* ------------------------------------------------------------------------ */
 /*  D r a w _ P o i n t                                                     */
@@ -54,8 +52,8 @@ void Draw_Point (void *a, void *b){
   if(CTX.geom.points_num){
     sprintf(Num,"%d",(*v)->Num);
     glRasterPos3d((*v)->Pos.X+3*CTX.pixel_equiv_x/CTX.s[0],
-		  (*v)->Pos.Y+3*CTX.pixel_equiv_x/CTX.s[1], 
-		  (*v)->Pos.Z+3*CTX.pixel_equiv_x/CTX.s[2]);
+                  (*v)->Pos.Y+3*CTX.pixel_equiv_x/CTX.s[1], 
+                  (*v)->Pos.Z+3*CTX.pixel_equiv_x/CTX.s[2]);
     Draw_String(Num);
   }
 
@@ -119,8 +117,8 @@ void Draw_Curve (void *a, void *b){
     v = InterpolateCurve(c,0.5,0);
     sprintf(Num,"%d",c->Num);
     glRasterPos3d(v.Pos.X+3*CTX.pixel_equiv_x/CTX.s[0],
-		  v.Pos.Y+3*CTX.pixel_equiv_x/CTX.s[1], 
-		  v.Pos.Z+3*CTX.pixel_equiv_x/CTX.s[2]);
+                  v.Pos.Y+3*CTX.pixel_equiv_x/CTX.s[1], 
+                  v.Pos.Z+3*CTX.pixel_equiv_x/CTX.s[2]);
     Draw_String(Num);
   }
   
@@ -134,7 +132,7 @@ void Draw_Curve (void *a, void *b){
     dd = sqrt(dv.Pos.X*dv.Pos.X+dv.Pos.Y*dv.Pos.Y+dv.Pos.Z*dv.Pos.Z);
     glColor4ubv((GLubyte*)&CTX.color.geom.tangents);
     Draw_Vector(DRAW_POST_ARROW, 0, v.Pos.X,v.Pos.Y,v.Pos.Z,
-		dd, dv.Pos.X,dv.Pos.Y,dv.Pos.Z, NULL,NULL);
+                dd, dv.Pos.X,dv.Pos.Y,dv.Pos.Z, NULL,NULL);
   }
 
   if(CTX.render_mode == GMSH_SELECT){
@@ -220,7 +218,7 @@ void Plan_SurfPlane (void *data,void *dum){
     for(i=0;i<List_Nbr(s->s.Generatrices);i++){
       List_Read(s->s.Generatrices,i,&pC);
       for(j=0;j<List_Nbr(pC->Control_Points);j++){
-	     List_Add(points,List_Pointer(pC->Control_Points,j));
+             List_Add(points,List_Pointer(pC->Control_Points,j));
       }
     }
   }
@@ -320,27 +318,27 @@ void Plan_SurfPlane (void *data,void *dum){
       b[0]      = -sys[0][1];
       b[1]      = -sys[1][2];
       if(sys2x2(s2s,b,r2)){
-	res[0] = r2[0];
-	res[1] = 1.;
-	res[2] = r2[1];
+        res[0] = r2[0];
+        res[1] = 1.;
+        res[2] = r2[1];
       }      
       /* ax + by = -z */
       else {
-	s->d = 1.0;
-	s2s[0][0] = sys[0][0];
-	s2s[0][1] = sys[0][1];
-	s2s[1][0] = sys[0][1];
-	s2s[1][1] = sys[1][1];
-	b[0]      = -sys[0][2];
-	b[1]      = -sys[1][2];
-	if(sys2x2(s2s,b,r2)){
-	  res[0] = r2[0];
-	  res[1] = r2[1];
-	  res[2] = 1.;
-	}
-	else {
-	  Msg(ERROR, "Draw Geometry (Plan_SurfPlane)");
-	}
+        s->d = 1.0;
+        s2s[0][0] = sys[0][0];
+        s2s[0][1] = sys[0][1];
+        s2s[1][0] = sys[0][1];
+        s2s[1][1] = sys[1][1];
+        b[0]      = -sys[0][2];
+        b[1]      = -sys[1][2];
+        if(sys2x2(s2s,b,r2)){
+          res[0] = r2[0];
+          res[1] = r2[1];
+          res[2] = 1.;
+        }
+        else {
+          Msg(ERROR, "Draw Geometry (Plan_SurfPlane)");
+        }
       }
     }
   }
@@ -410,9 +408,9 @@ void Draw_Plane_Surface (Surface *s){
       Projette(&P3,s->plan);
 
       if(!k){
-	k = 1;
-	minx = maxx = P1.Pos.X;
-	miny = maxy = P1.Pos.Y;
+        k = 1;
+        minx = maxx = P1.Pos.X;
+        miny = maxy = P1.Pos.Y;
       }
       minx = DMIN(DMIN(DMIN(minx,P1.Pos.X),P2.Pos.X),P3.Pos.X);      
       miny = DMIN(DMIN(DMIN(miny,P1.Pos.Y),P2.Pos.Y),P3.Pos.Y);      
@@ -444,22 +442,22 @@ void Draw_Plane_Surface (Surface *s){
     for(i=0;i<100;i++){
       t = (double)i/(double)(100);
       vv.Pos.X = t * 0.5 * (V[0].Pos.X + V[1].Pos.X) + (1.-t) * 
-	0.5 * (V[2].Pos.X + V[3].Pos.X); 
+        0.5 * (V[2].Pos.X + V[3].Pos.X); 
       vv.Pos.Y = t * 0.5 * (V[0].Pos.Y + V[1].Pos.Y) + (1.-t) * 
-	0.5 * (V[2].Pos.Y + V[3].Pos.Y); 
+        0.5 * (V[2].Pos.Y + V[3].Pos.Y); 
       vv.Pos.Z = t * 0.5 * (V[0].Pos.Z + V[1].Pos.Z) + (1.-t) * 
-	0.5 * (V[2].Pos.Z + V[3].Pos.Z); 
+        0.5 * (V[2].Pos.Z + V[3].Pos.Z); 
       if(isPointOnPlanarSurface(s,vv.Pos.X,vv.Pos.Y,vv.Pos.Z,n)){
-	if(!k){
-	  List_Add(s->Orientations,&vv);
-	  k = 1;
-	}
+        if(!k){
+          List_Add(s->Orientations,&vv);
+          k = 1;
+        }
       }
       else{
-	if(k){
-	  List_Add(s->Orientations,&vv);
-	  k = 0;
-	}    
+        if(k){
+          List_Add(s->Orientations,&vv);
+          k = 0;
+        }    
       }
     }
     if(k) List_Add(s->Orientations,&vv);
@@ -472,16 +470,16 @@ void Draw_Plane_Surface (Surface *s){
       vv.Pos.Y = t*.5*(V[0].Pos.Y+V[3].Pos.Y)+(1.-t)*.5*(V[2].Pos.Y+V[1].Pos.Y);
       vv.Pos.Z = t*.5*(V[0].Pos.Z+V[3].Pos.Z)+(1.-t)*.5*(V[2].Pos.Z+V[1].Pos.Z); 
       if(isPointOnPlanarSurface(s,vv.Pos.X,vv.Pos.Y,vv.Pos.Z,n)){
-	if(!k){
-	  List_Add(s->Orientations,&vv);
-	  k = 1;
-	}
+        if(!k){
+          List_Add(s->Orientations,&vv);
+          k = 1;
+        }
       }
       else{
-	if(k){
-	  List_Add(s->Orientations,&vv);
-	  k = 0;
-	}    
+        if(k){
+          List_Add(s->Orientations,&vv);
+          k = 0;
+        }    
       }
     }
     if(k)List_Add(s->Orientations,&vv);
@@ -504,8 +502,8 @@ void Draw_Plane_Surface (Surface *s){
     List_Read(s->Orientations,1,&vv2);
     sprintf(Num,"%d",s->Num);
     glRasterPos3d((vv2.Pos.X+vv1.Pos.X)/2. + 3*CTX.pixel_equiv_x/CTX.s[0],
-		  (vv2.Pos.Y+vv1.Pos.Y)/2. + 3*CTX.pixel_equiv_x/CTX.s[1], 
-		  (vv2.Pos.Z+vv1.Pos.Z)/2. + 3*CTX.pixel_equiv_x/CTX.s[2]);
+                  (vv2.Pos.Y+vv1.Pos.Y)/2. + 3*CTX.pixel_equiv_x/CTX.s[1], 
+                  (vv2.Pos.Z+vv1.Pos.Z)/2. + 3*CTX.pixel_equiv_x/CTX.s[2]);
     Draw_String(Num);
   }
 
@@ -522,7 +520,7 @@ void Draw_Plane_Surface (Surface *s){
     nn = sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);
     glColor4ubv((GLubyte*)&CTX.color.geom.normals);
     Draw_Vector(DRAW_POST_ARROW, 0, (vv2.Pos.X+vv1.Pos.X)/2., (vv2.Pos.Y+vv1.Pos.Y)/2., 
-		(vv2.Pos.Z+vv1.Pos.Z)/2., nn, n[0],n[1],n[2],NULL,NULL);
+                (vv2.Pos.Z+vv1.Pos.Z)/2., nn, n[0],n[1],n[2],NULL,NULL);
   }
 
 }
@@ -558,8 +556,8 @@ void Draw_NonPlane_Surface (Surface *s){
       gluNurbsProperty(nurb,(GLenum)GLU_DISPLAY_MODE,GLU_FILL );
       gluBeginSurface(nurb);
       gluNurbsSurface(nurb, s->Nu+s->OrderU+1,s->ku, s->Nv+s->OrderV+1,s->kv,
-		      4, 4*s->Nu, s->cp, s->OrderU+1,s->OrderV+1,
-		      GL_MAP2_VERTEX_4);
+                      4, 4*s->Nu, s->cp, s->OrderU+1,s->OrderV+1,
+                      GL_MAP2_VERTEX_4);
       gluEndSurface(nurb);
       gluDeleteNurbsRenderer(nurb);
       return;
@@ -578,9 +576,9 @@ void Draw_NonPlane_Surface (Surface *s){
       N = 50;
       glBegin(GL_LINE_STRIP);
       for(i=0;i<N+1;i++){
-    	u = u0 + (un-u0)*(double)i/(double)N;
-    	v = InterpolateSurface(s,u,tics[kk],0,0);
-    	glVertex3d(v.Pos.X,v.Pos.Y,v.Pos.Z);
+        u = u0 + (un-u0)*(double)i/(double)N;
+        v = InterpolateSurface(s,u,tics[kk],0,0);
+        glVertex3d(v.Pos.X,v.Pos.Y,v.Pos.Z);
       }
       glEnd();
     }
@@ -596,9 +594,9 @@ void Draw_NonPlane_Surface (Surface *s){
     for( kk = 0;kk<NbTics;kk++){
       glBegin(GL_LINE_STRIP);
       for(i=0;i<N+1;i++){
-    	u = v0 + (vn-v0)*(double)i/(double)N;
-    	v = InterpolateSurface(s,tics[kk],u,0,0);
-    	glVertex3d(v.Pos.X,v.Pos.Y,v.Pos.Z);
+        u = v0 + (vn-v0)*(double)i/(double)N;
+        v = InterpolateSurface(s,tics[kk],u,0,0);
+        glVertex3d(v.Pos.X,v.Pos.Y,v.Pos.Z);
       }
       glEnd();
     }
@@ -612,8 +610,8 @@ void Draw_NonPlane_Surface (Surface *s){
     v = InterpolateSurface(s,0.5,0.5,0,0);
     sprintf(Num,"%d",s->Num);
     glRasterPos3d(v.Pos.X+3*CTX.pixel_equiv_x/CTX.s[0],
-		  v.Pos.Y+3*CTX.pixel_equiv_x/CTX.s[1], 
-		  v.Pos.Z+3*CTX.pixel_equiv_x/CTX.s[2]);
+                  v.Pos.Y+3*CTX.pixel_equiv_x/CTX.s[1], 
+                  v.Pos.Z+3*CTX.pixel_equiv_x/CTX.s[2]);
     Draw_String(Num);
   }
 
@@ -636,20 +634,18 @@ void Draw_NonPlane_Surface (Surface *s){
     nn = sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);
     glColor4ubv((GLubyte*)&CTX.color.geom.normals);
     Draw_Vector(DRAW_POST_ARROW, 0, n1.Pos.X, n1.Pos.Y, n1.Pos.Z,
-		nn, n[0],n[1],n[2],NULL,NULL);
+                nn, n[0],n[1],n[2],NULL,NULL);
     glEnable(GL_LINE_STIPPLE);
   }
 
 }
 
-void Draw_Simplex_Surfaces (void *a, void *b);
-
 void Draw_Surface (void *a, void *b){
   Surface *s;
 
   s = *(Surface**)a;
 
-  //  if(!s->Support)return;
+  if(!s->Support)return;
 
   if(!EntiteEstElleVisible(s->Num)) return;
 
@@ -757,6 +753,8 @@ void Draw_Axes (double s) {
   
   if(s == 0.) return;
 
+  if(!CTX.range[0] && !CTX.range[1] && !CTX.range[2]) return ;
+
   f = 0.666 * s;
   g = 1.233 * s;
   b = .1 * s;
@@ -903,10 +901,10 @@ void HighlightEntity(Vertex *v,Curve *c, Surface *s, int permanent){
 
     if(nbg < 10){
       for(i=0;i<nbg;i++){
-	List_Read(s->s.Generatrices,i,&cc);
-	if(!i)sprintf(temp,"%d",cc->Num);
-	else sprintf(temp,",%d",cc->Num);
-	strcat(Message,temp);
+        List_Read(s->s.Generatrices,i,&cc);
+        if(!i)sprintf(temp,"%d",cc->Num);
+        else sprintf(temp,",%d",cc->Num);
+        strcat(Message,temp);
       }
     }
     else{
diff --git a/Graphics/Iso.cpp b/Graphics/Iso.cpp
index db163db07c..1de8a0d56b 100644
--- a/Graphics/Iso.cpp
+++ b/Graphics/Iso.cpp
@@ -1,4 +1,4 @@
-/* $Id: Iso.cpp,v 1.2 2000-11-23 14:11:32 geuzaine Exp $ */
+/* $Id: Iso.cpp,v 1.3 2000-11-26 15:43:46 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "Mesh.h"
@@ -11,8 +11,8 @@ void RaiseFill(int i, double Val, double ValMin, double Raise[3][5]);
 /* ------------------------------------------------------------------------ */
 
 void Interpolate(double *X, double *Y, double *Z, 
-		 double *Val, double V, int I1, int I2, 
-		 double *XI, double *YI ,double *ZI){
+                 double *Val, double V, int I1, int I2, 
+                 double *XI, double *YI ,double *ZI){
   
   if(Val[I1] == Val[I2]){
     *XI = X[I1]; 
@@ -31,8 +31,8 @@ void Interpolate(double *X, double *Y, double *Z,
 /* ------------------------------------------------------------------------ */
 
 void IsoSimplex(double *X, double *Y, double *Z, double *Val, 
-		double V, double Vmin, double Vmax, 
-		double *Offset, double Raise[3][5], int shade){
+                double V, double Vmin, double Vmax, 
+                double *Offset, double Raise[3][5], int shade){
   int    nb;
   double Xp[6],Yp[6],Zp[6];
 
@@ -91,8 +91,8 @@ void IsoSimplex(double *X, double *Y, double *Z, double *Val,
 /* ------------------------------------------------------------------------ */
 
 void CutTriangle1D(double *X, double *Y, double *Z, double *Val, 
-		   double V, double Vmin, double Vmax,
-		   double *Xp, double *Yp, double *Zp, int *nb){
+                   double V, double Vmin, double Vmax,
+                   double *Xp, double *Yp, double *Zp, int *nb){
   
   if(V != Vmax){
     *nb = 0;
@@ -122,8 +122,8 @@ void CutTriangle1D(double *X, double *Y, double *Z, double *Val,
 }
 
 void CutTriangle2D(double *X, double *Y, double *Z, double *Val, 
-		   double V1, double V2, double Vmin, double Vmax,
-		   double *Xp2, double *Yp2, double *Zp2, int *Np2, double *Vp2){
+                   double V1, double V2, double Vmin, double Vmax,
+                   double *Xp2, double *Yp2, double *Zp2, int *Np2, double *Vp2){
 
   int     i, io[3],j,iot,Np,Fl;
   double  Xp[5],Yp[5],Zp[5],Vp[5];
@@ -135,9 +135,9 @@ void CutTriangle2D(double *X, double *Y, double *Z, double *Val,
   for(i=0;i<2;i++){
     for(j=i+1;j<3;j++){
       if(Val[io[i]]>Val[io[j]]){
-	iot = io[i];
-	io[i] = io[j];
-	io[j] = iot;
+        iot = io[i];
+        io[i] = io[j];
+        io[j] = iot;
       }
     }
   }
@@ -241,8 +241,8 @@ void CutTriangle2D(double *X, double *Y, double *Z, double *Val,
 /* ------------------------------------------------------------------------ */
 
 void CutLine0D(double *X, double *Y, double *Z, double *Val, 
-	       double V, double Vmin, double Vmax,
-	       double *Xp, double *Yp, double *Zp, int *nb){
+               double V, double Vmin, double Vmax,
+               double *Xp, double *Yp, double *Zp, int *nb){
   
   *nb = 0;
 
@@ -259,8 +259,8 @@ void CutLine0D(double *X, double *Y, double *Z, double *Val,
 }
 
 void CutLine1D(double *X, double *Y, double *Z, double *Val, 
-	       double V1, double V2, double Vmin, double Vmax,
-	       double *Xp2, double *Yp2, double *Zp2, int *Np2, double *Vp2){
+               double V1, double V2, double Vmin, double Vmax,
+               double *Xp2, double *Yp2, double *Zp2, int *Np2, double *Vp2){
 
   int io[2];
 
diff --git a/Graphics/Iso.h b/Graphics/Iso.h
index d773d80e7a..df774f421f 100644
--- a/Graphics/Iso.h
+++ b/Graphics/Iso.h
@@ -1,27 +1,27 @@
-/* $Id: Iso.h,v 1.2 2000-11-23 14:11:32 geuzaine Exp $ */
+/* $Id: Iso.h,v 1.3 2000-11-26 15:43:46 geuzaine Exp $ */
 #ifndef _ISO_H_
 #define _ISO_H_
 
 void IsoSimplex (double *X, double *Y, double *Z, double *Val,
-		 double V, double Vmin, double Vmax,
-		 double *Offset, double Raise[3][5], int shade);
+                 double V, double Vmin, double Vmax,
+                 double *Offset, double Raise[3][5], int shade);
 
 void CutTriangle1D (double *X, double *Y, double *Z, double *Val,
-		    double V, double Vmin, double Vmax,
-		    double *Xp, double *Yp, double *Zp, int *nb);
+                    double V, double Vmin, double Vmax,
+                    double *Xp, double *Yp, double *Zp, int *nb);
 
 void CutTriangle2D (double *X, double *Y, double *Z, double *Val,
-		    double V1, double V2, double Vmin, double Vmax,
-		    double *Xp, double *Yp, double *Zp, int *nb,
-		    double *value);
+                    double V1, double V2, double Vmin, double Vmax,
+                    double *Xp, double *Yp, double *Zp, int *nb,
+                    double *value);
 
 void CutLine0D (double *X, double *Y, double *Z, double *Val,
-		double V, double Vmin, double Vmax,
-		double *Xp, double *Yp, double *Zp, int *nb);
+                double V, double Vmin, double Vmax,
+                double *Xp, double *Yp, double *Zp, int *nb);
 
 void CutLine1D (double *X, double *Y, double *Z, double *Val,
-		double V1, double V2, double Vmin, double Vmax,
-		double *Xp, double *Yp, double *Zp, int *nb,
-		double *value);
+                double V1, double V2, double Vmin, double Vmax,
+                double *Xp, double *Yp, double *Zp, int *nb,
+                double *value);
 
 #endif
diff --git a/Graphics/Mesh.cpp b/Graphics/Mesh.cpp
index c344fc9ba3..3f13a0339e 100644
--- a/Graphics/Mesh.cpp
+++ b/Graphics/Mesh.cpp
@@ -1,4 +1,4 @@
-/* $Id: Mesh.cpp,v 1.5 2000-11-23 16:51:29 geuzaine Exp $ */
+/* $Id: Mesh.cpp,v 1.6 2000-11-26 15:43:46 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -11,13 +11,9 @@
 #include "Verif.h"
 #include "Numeric.h"
 
-extern Mesh *THEM;
+extern Mesh      *THEM;
 extern Context_T  CTX;
 
-extern double     MiddleLC;
-extern double     ClipPlane[4];
-extern double     LC;
-
 static int        iVolume;
 
 /* ------------------------------------------------------------------------ */
@@ -26,7 +22,7 @@ static int        iVolume;
 
 
 void draw_polygon_2d (double r, double g, double b, int n, 
-		      double *x, double *y, double *z){
+                      double *x, double *y, double *z){
   int i ;
 
   CalculateMinMax(THEM->Points);
@@ -63,7 +59,14 @@ void Draw_Mesh (Mesh *M) {
   else{ 
     InitNoShading();
   }
-  glClipPlane(GL_CLIP_PLANE0, ClipPlane);
+
+  if(CTX.clip[0]) glClipPlane(GL_CLIP_PLANE0, CTX.clip_plane0);
+  if(CTX.clip[1]) glClipPlane(GL_CLIP_PLANE1, CTX.clip_plane1);
+  if(CTX.clip[2]) glClipPlane(GL_CLIP_PLANE2, CTX.clip_plane2);
+  if(CTX.clip[3]) glClipPlane(GL_CLIP_PLANE3, CTX.clip_plane3);
+  if(CTX.clip[4]) glClipPlane(GL_CLIP_PLANE4, CTX.clip_plane4);
+  if(CTX.clip[5]) glClipPlane(GL_CLIP_PLANE5, CTX.clip_plane5);
+
   glPointSize(2);
   glLineWidth(1);
 
@@ -107,7 +110,7 @@ void Draw_Mesh (Mesh *M) {
 
   if(CTX.render_mode != GMSH_SELECT){
     if(CTX.axes) 
-      Draw_Axes(MiddleLC/4.);
+      Draw_Axes(CTX.lc_middle/4.);
     if(CTX.post.draw) /* les init de shading se font par view */
       Draw_Post();
   }
@@ -166,8 +169,8 @@ void Draw_Mesh_Points (void *a, void *b){
   if(CTX.mesh.points_num){
     sprintf(Num,"%d",(*v)->Num);
     glRasterPos3d((*v)->Pos.X+3*CTX.pixel_equiv_x/CTX.s[0],
-		  (*v)->Pos.Y+3*CTX.pixel_equiv_x/CTX.s[1], 
-		  (*v)->Pos.Z+3*CTX.pixel_equiv_x/CTX.s[2]);
+                  (*v)->Pos.Y+3*CTX.pixel_equiv_x/CTX.s[1], 
+                  (*v)->Pos.Z+3*CTX.pixel_equiv_x/CTX.s[2]);
     Draw_String(Num);
   }
   
@@ -203,9 +206,12 @@ void Draw_Simplex_Volume (void *a, void *b){
 
   ColorSwitch((*s)->iEnt+1);
 
-  double Xc = .25 * ((*s)->V[0]->Pos.X + (*s)->V[1]->Pos.X + (*s)->V[2]->Pos.X + (*s)->V[3]->Pos.X);
-  double Yc = .25 * ((*s)->V[0]->Pos.Y + (*s)->V[1]->Pos.Y + (*s)->V[2]->Pos.Y + (*s)->V[3]->Pos.Y);
-  double Zc = .25 * ((*s)->V[0]->Pos.Z + (*s)->V[1]->Pos.Z + (*s)->V[2]->Pos.Z + (*s)->V[3]->Pos.Z);
+  double Xc = .25 * ((*s)->V[0]->Pos.X + (*s)->V[1]->Pos.X + 
+                     (*s)->V[2]->Pos.X + (*s)->V[3]->Pos.X);
+  double Yc = .25 * ((*s)->V[0]->Pos.Y + (*s)->V[1]->Pos.Y + 
+                     (*s)->V[2]->Pos.Y + (*s)->V[3]->Pos.Y);
+  double Zc = .25 * ((*s)->V[0]->Pos.Z + (*s)->V[1]->Pos.Z + 
+                     (*s)->V[2]->Pos.Z + (*s)->V[3]->Pos.Z);
 
   for (int i=0 ; i<4 ; i++) {
      X[i] = Xc + CTX.mesh.explode * ((*s)->V[i]->Pos.X - Xc);
@@ -356,9 +362,12 @@ void Draw_Simplex_Surfaces (void *a, void *b){
 
   if ((*s)->V[3]) {
     K = 4;
-    Xc = .25 * ((*s)->V[0]->Pos.X + (*s)->V[1]->Pos.X + (*s)->V[2]->Pos.X + (*s)->V[3]->Pos.X);
-    Yc = .25 * ((*s)->V[0]->Pos.Y + (*s)->V[1]->Pos.Y + (*s)->V[2]->Pos.Y + (*s)->V[3]->Pos.Y);
-    Zc = .25 * ((*s)->V[0]->Pos.Z + (*s)->V[1]->Pos.Z + (*s)->V[2]->Pos.Z + (*s)->V[3]->Pos.Z);
+    Xc = .25 * ((*s)->V[0]->Pos.X + (*s)->V[1]->Pos.X + 
+                (*s)->V[2]->Pos.X + (*s)->V[3]->Pos.X);
+    Yc = .25 * ((*s)->V[0]->Pos.Y + (*s)->V[1]->Pos.Y + 
+                (*s)->V[2]->Pos.Y + (*s)->V[3]->Pos.Y);
+    Zc = .25 * ((*s)->V[0]->Pos.Z + (*s)->V[1]->Pos.Z + 
+                (*s)->V[2]->Pos.Z + (*s)->V[3]->Pos.Z);
   }
   else {
     K = 3;
@@ -450,7 +459,7 @@ void Draw_Simplex_Surfaces (void *a, void *b){
       glColor4ubv((GLubyte*)&CTX.color.mesh.line);
       glBegin(GL_LINE_LOOP);
       for(i=0 ; i<K*(1+L) ; i++){
-	glVertex3d(pX[i],pY[i],pZ[i]);
+        glVertex3d(pX[i],pY[i],pZ[i]);
       }
       glEnd();    
     }
@@ -494,8 +503,8 @@ void Draw_Simplex_Points(void *a,void *b){
     glColor4ubv((GLubyte*)&CTX.color.mesh.line);
     sprintf(Num,"%d",s->Num);
     glRasterPos3d(0.5*(s->V[0]->Pos.X+s->V[1]->Pos.X) + 3*CTX.pixel_equiv_x/CTX.s[0],
-		  0.5*(s->V[0]->Pos.Y+s->V[1]->Pos.Y) + 3*CTX.pixel_equiv_x/CTX.s[1], 
-		  0.5*(s->V[0]->Pos.Z+s->V[1]->Pos.Z) + 3*CTX.pixel_equiv_x/CTX.s[2]);
+                  0.5*(s->V[0]->Pos.Y+s->V[1]->Pos.Y) + 3*CTX.pixel_equiv_x/CTX.s[1], 
+                  0.5*(s->V[0]->Pos.Z+s->V[1]->Pos.Z) + 3*CTX.pixel_equiv_x/CTX.s[2]);
     Draw_String(Num);
   }
 
@@ -562,33 +571,33 @@ void Draw_Hexahedron_Volume (void *a, void *b){
     glVertex3d(Xc,   Yc,    Zc);  
     glVertex3d
       ( ((*h)->V[0]->Pos.X+(*h)->V[1]->Pos.X+(*h)->V[5]->Pos.X+(*h)->V[4]->Pos.X)/4.,
-	((*h)->V[0]->Pos.Y+(*h)->V[1]->Pos.Y+(*h)->V[5]->Pos.Y+(*h)->V[4]->Pos.Y)/4.,
-	((*h)->V[0]->Pos.Z+(*h)->V[1]->Pos.Z+(*h)->V[5]->Pos.Z+(*h)->V[4]->Pos.Z)/4. );
+        ((*h)->V[0]->Pos.Y+(*h)->V[1]->Pos.Y+(*h)->V[5]->Pos.Y+(*h)->V[4]->Pos.Y)/4.,
+        ((*h)->V[0]->Pos.Z+(*h)->V[1]->Pos.Z+(*h)->V[5]->Pos.Z+(*h)->V[4]->Pos.Z)/4. );
     glVertex3d(Xc,   Yc,    Zc);  
     glVertex3d
       ( ((*h)->V[0]->Pos.X+(*h)->V[3]->Pos.X+(*h)->V[2]->Pos.X+(*h)->V[1]->Pos.X)/4.,
-	((*h)->V[0]->Pos.Y+(*h)->V[3]->Pos.Y+(*h)->V[2]->Pos.Y+(*h)->V[1]->Pos.Y)/4.,
-	((*h)->V[0]->Pos.Z+(*h)->V[3]->Pos.Z+(*h)->V[2]->Pos.Z+(*h)->V[1]->Pos.Z)/4. );
+        ((*h)->V[0]->Pos.Y+(*h)->V[3]->Pos.Y+(*h)->V[2]->Pos.Y+(*h)->V[1]->Pos.Y)/4.,
+        ((*h)->V[0]->Pos.Z+(*h)->V[3]->Pos.Z+(*h)->V[2]->Pos.Z+(*h)->V[1]->Pos.Z)/4. );
     glVertex3d(Xc,   Yc,    Zc);  
     glVertex3d
       ( ((*h)->V[0]->Pos.X+(*h)->V[4]->Pos.X+(*h)->V[7]->Pos.X+(*h)->V[3]->Pos.X)/4.,
-	((*h)->V[0]->Pos.Y+(*h)->V[4]->Pos.Y+(*h)->V[7]->Pos.Y+(*h)->V[3]->Pos.Y)/4.,
-	((*h)->V[0]->Pos.Z+(*h)->V[4]->Pos.Z+(*h)->V[7]->Pos.Z+(*h)->V[3]->Pos.Z)/4. );
+        ((*h)->V[0]->Pos.Y+(*h)->V[4]->Pos.Y+(*h)->V[7]->Pos.Y+(*h)->V[3]->Pos.Y)/4.,
+        ((*h)->V[0]->Pos.Z+(*h)->V[4]->Pos.Z+(*h)->V[7]->Pos.Z+(*h)->V[3]->Pos.Z)/4. );
     glVertex3d(Xc,   Yc,    Zc);  
     glVertex3d
       ( ((*h)->V[1]->Pos.X+(*h)->V[2]->Pos.X+(*h)->V[6]->Pos.X+(*h)->V[5]->Pos.X)/4.,
-	((*h)->V[1]->Pos.Y+(*h)->V[2]->Pos.Y+(*h)->V[6]->Pos.Y+(*h)->V[5]->Pos.Y)/4.,
-	((*h)->V[1]->Pos.Z+(*h)->V[2]->Pos.Z+(*h)->V[6]->Pos.Z+(*h)->V[5]->Pos.Z)/4. );
+        ((*h)->V[1]->Pos.Y+(*h)->V[2]->Pos.Y+(*h)->V[6]->Pos.Y+(*h)->V[5]->Pos.Y)/4.,
+        ((*h)->V[1]->Pos.Z+(*h)->V[2]->Pos.Z+(*h)->V[6]->Pos.Z+(*h)->V[5]->Pos.Z)/4. );
     glVertex3d(Xc,   Yc,    Zc);  
     glVertex3d
       ( ((*h)->V[2]->Pos.X+(*h)->V[3]->Pos.X+(*h)->V[7]->Pos.X+(*h)->V[6]->Pos.X)/4.,
-	((*h)->V[2]->Pos.Y+(*h)->V[3]->Pos.Y+(*h)->V[7]->Pos.Y+(*h)->V[6]->Pos.Y)/4.,
-	((*h)->V[2]->Pos.Z+(*h)->V[3]->Pos.Z+(*h)->V[7]->Pos.Z+(*h)->V[6]->Pos.Z)/4. );
+        ((*h)->V[2]->Pos.Y+(*h)->V[3]->Pos.Y+(*h)->V[7]->Pos.Y+(*h)->V[6]->Pos.Y)/4.,
+        ((*h)->V[2]->Pos.Z+(*h)->V[3]->Pos.Z+(*h)->V[7]->Pos.Z+(*h)->V[6]->Pos.Z)/4. );
     glVertex3d(Xc,   Yc,    Zc);  
     glVertex3d
       ( ((*h)->V[4]->Pos.X+(*h)->V[5]->Pos.X+(*h)->V[6]->Pos.X+(*h)->V[7]->Pos.X)/4.,
-	((*h)->V[4]->Pos.Y+(*h)->V[5]->Pos.Y+(*h)->V[6]->Pos.Y+(*h)->V[7]->Pos.Y)/4.,
-	((*h)->V[4]->Pos.Z+(*h)->V[5]->Pos.Z+(*h)->V[6]->Pos.Z+(*h)->V[7]->Pos.Z)/4. );
+        ((*h)->V[4]->Pos.Y+(*h)->V[5]->Pos.Y+(*h)->V[6]->Pos.Y+(*h)->V[7]->Pos.Y)/4.,
+        ((*h)->V[4]->Pos.Z+(*h)->V[5]->Pos.Z+(*h)->V[6]->Pos.Z+(*h)->V[7]->Pos.Z)/4. );
     glEnd();
     glDisable(GL_LINE_STIPPLE);
     gl2psDisable(GL2PS_LINE_STIPPLE);
@@ -651,28 +660,28 @@ void Draw_Prism_Volume (void *a, void *b){
     glVertex3d(Xc,   Yc,    Zc);  
     glVertex3d
       ( ((*p)->V[0]->Pos.X+(*p)->V[2]->Pos.X+(*p)->V[1]->Pos.X)/3.,
-	((*p)->V[0]->Pos.Y+(*p)->V[2]->Pos.Y+(*p)->V[1]->Pos.Y)/3.,
-	((*p)->V[0]->Pos.Z+(*p)->V[2]->Pos.Z+(*p)->V[1]->Pos.Z)/3. );
+        ((*p)->V[0]->Pos.Y+(*p)->V[2]->Pos.Y+(*p)->V[1]->Pos.Y)/3.,
+        ((*p)->V[0]->Pos.Z+(*p)->V[2]->Pos.Z+(*p)->V[1]->Pos.Z)/3. );
     glVertex3d(Xc,   Yc,    Zc);  
     glVertex3d
       ( ((*p)->V[3]->Pos.X+(*p)->V[4]->Pos.X+(*p)->V[5]->Pos.X)/3.,
-	((*p)->V[3]->Pos.Y+(*p)->V[4]->Pos.Y+(*p)->V[5]->Pos.Y)/3.,
-	((*p)->V[3]->Pos.Z+(*p)->V[4]->Pos.Z+(*p)->V[5]->Pos.Z)/3. );
+        ((*p)->V[3]->Pos.Y+(*p)->V[4]->Pos.Y+(*p)->V[5]->Pos.Y)/3.,
+        ((*p)->V[3]->Pos.Z+(*p)->V[4]->Pos.Z+(*p)->V[5]->Pos.Z)/3. );
     glVertex3d(Xc,   Yc,    Zc);  
     glVertex3d
       ( ((*p)->V[0]->Pos.X+(*p)->V[1]->Pos.X+(*p)->V[4]->Pos.X+(*p)->V[3]->Pos.X)/4.,
-	((*p)->V[0]->Pos.Y+(*p)->V[1]->Pos.Y+(*p)->V[4]->Pos.Y+(*p)->V[3]->Pos.Y)/4.,
-	((*p)->V[0]->Pos.Z+(*p)->V[1]->Pos.Z+(*p)->V[4]->Pos.Z+(*p)->V[3]->Pos.Z)/4. );
+        ((*p)->V[0]->Pos.Y+(*p)->V[1]->Pos.Y+(*p)->V[4]->Pos.Y+(*p)->V[3]->Pos.Y)/4.,
+        ((*p)->V[0]->Pos.Z+(*p)->V[1]->Pos.Z+(*p)->V[4]->Pos.Z+(*p)->V[3]->Pos.Z)/4. );
     glVertex3d(Xc,   Yc,    Zc);  
     glVertex3d
       ( ((*p)->V[0]->Pos.X+(*p)->V[3]->Pos.X+(*p)->V[5]->Pos.X+(*p)->V[2]->Pos.X)/4.,
-	((*p)->V[0]->Pos.Y+(*p)->V[3]->Pos.Y+(*p)->V[5]->Pos.Y+(*p)->V[2]->Pos.Y)/4.,
-	((*p)->V[0]->Pos.Z+(*p)->V[3]->Pos.Z+(*p)->V[5]->Pos.Z+(*p)->V[2]->Pos.Z)/4. );
+        ((*p)->V[0]->Pos.Y+(*p)->V[3]->Pos.Y+(*p)->V[5]->Pos.Y+(*p)->V[2]->Pos.Y)/4.,
+        ((*p)->V[0]->Pos.Z+(*p)->V[3]->Pos.Z+(*p)->V[5]->Pos.Z+(*p)->V[2]->Pos.Z)/4. );
     glVertex3d(Xc,   Yc,    Zc);  
     glVertex3d
       ( ((*p)->V[1]->Pos.X+(*p)->V[2]->Pos.X+(*p)->V[5]->Pos.X+(*p)->V[4]->Pos.X)/4.,
-	((*p)->V[1]->Pos.Y+(*p)->V[2]->Pos.Y+(*p)->V[5]->Pos.Y+(*p)->V[4]->Pos.Y)/4.,
-	((*p)->V[1]->Pos.Z+(*p)->V[2]->Pos.Z+(*p)->V[5]->Pos.Z+(*p)->V[4]->Pos.Z)/4. );
+        ((*p)->V[1]->Pos.Y+(*p)->V[2]->Pos.Y+(*p)->V[5]->Pos.Y+(*p)->V[4]->Pos.Y)/4.,
+        ((*p)->V[1]->Pos.Z+(*p)->V[2]->Pos.Z+(*p)->V[5]->Pos.Z+(*p)->V[4]->Pos.Z)/4. );
     glEnd();
     glDisable(GL_LINE_STIPPLE);
     gl2psDisable(GL2PS_LINE_STIPPLE);
diff --git a/Graphics/Post.cpp b/Graphics/Post.cpp
index 69d028b1d9..f24283ebd6 100644
--- a/Graphics/Post.cpp
+++ b/Graphics/Post.cpp
@@ -1,4 +1,4 @@
-/* $Id: Post.cpp,v 1.4 2000-11-25 15:26:10 geuzaine Exp $ */
+/* $Id: Post.cpp,v 1.5 2000-11-26 15:43:46 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -93,79 +93,79 @@ void Draw_Post (void) {
 
       if(CTX.display_lists && !v->Changed && glIsList(v->Num)){
 
-	glCallList(v->Num);
+        glCallList(v->Num);
 
       }
       else{
 
-	if(CTX.display_lists){
-	  if(glIsList(v->Num)) glDeleteLists(v->Num,1);
-	  //Msg(INFO, "New Display List");
-	  glNewList(v->Num, GL_COMPILE_AND_EXECUTE);
-	}
-
-	if(v->Light && v->IntervalsType != DRAW_POST_ISO){
-	  InitShading();
-	}
-	else{
-	  InitNoShading();
-	}
-	
-	/* force this */
-	if(v->IntervalsType == DRAW_POST_CONTINUOUS)
-	  glShadeModel(GL_SMOOTH); 
-	
-	switch(v->RangeType){
-	case DRAW_POST_DEFAULT : ValMin = v->Min ; ValMax = v->Max ; break;
-	case DRAW_POST_CUSTOM  : ValMin = v->CustomMin ; ValMax = v->CustomMax ; break;
-	}
-	
-	switch(v->ScaleType){
-	case DRAW_POST_LINEAR : 
-	  v->GIFV = GiveIndexFromValue_Lin ;
-	  v->GVFI = GiveValueFromIndex_Lin ;
-	  break;
-	case DRAW_POST_LOGARITHMIC : 
-	  v->GIFV = GiveIndexFromValue_Log ;
-	  v->GVFI = GiveValueFromIndex_Log ;
-	  break;
-	}
-	
-	AbsMax = DMAX(fabs(ValMin),fabs(ValMax));
-	AbsMax = (AbsMax==0.) ? 1. : AbsMax;
-	
-	for(j=0;j<3;j++){
-	  RaiseFactor[j] = v->Raise[j] / AbsMax ;
-	  for(k=0;k<5;k++) Raise[j][k] = 0. ;
-	}
-	
-	if((n = List_Nbr(v->Tetrahedra)))
-	  for(j=0 ; j<n ; j++)
-	    Draw_Post_Tetrahedron(v, (Post_Simplex*)List_Pointer(v->Tetrahedra,j), 
-				  ValMin, ValMax, Raise);
-	
-	//if(there is alpha)List_Sort(v->Triangles, fcmpTriangle);
-
-	if((n = List_Nbr(v->Triangles)))
-	  for(j=0 ; j<n ; j++)
-	    Draw_Post_Triangle(v, (Post_Simplex*)List_Pointer(v->Triangles,j), 
-			       ValMin, ValMax, Raise);
-
-	if((n = List_Nbr(v->Lines)))
-	  for(j=0 ; j<n ; j++)
-	    Draw_Post_Line(v, (Post_Simplex*)List_Pointer(v->Lines,j), 
-			   ValMin, ValMax, Raise);
-	
-	if((n = List_Nbr(v->Points)))
-	  for(j=0 ; j<n ; j++)
-	    Draw_Post_Point(v, (Post_Simplex*)List_Pointer(v->Points,j), 
-			    ValMin, ValMax, Raise);
-	
-	if(CTX.display_lists){
-	  glEndList();
-	  v->Changed=0;
-	}
-	
+        if(CTX.display_lists){
+          if(glIsList(v->Num)) glDeleteLists(v->Num,1);
+          //Msg(INFO, "New Display List");
+          glNewList(v->Num, GL_COMPILE_AND_EXECUTE);
+        }
+
+        if(v->Light && v->IntervalsType != DRAW_POST_ISO){
+          InitShading();
+        }
+        else{
+          InitNoShading();
+        }
+        
+        /* force this */
+        if(v->IntervalsType == DRAW_POST_CONTINUOUS)
+          glShadeModel(GL_SMOOTH); 
+        
+        switch(v->RangeType){
+        case DRAW_POST_DEFAULT : ValMin = v->Min ; ValMax = v->Max ; break;
+        case DRAW_POST_CUSTOM  : ValMin = v->CustomMin ; ValMax = v->CustomMax ; break;
+        }
+        
+        switch(v->ScaleType){
+        case DRAW_POST_LINEAR : 
+          v->GIFV = GiveIndexFromValue_Lin ;
+          v->GVFI = GiveValueFromIndex_Lin ;
+          break;
+        case DRAW_POST_LOGARITHMIC : 
+          v->GIFV = GiveIndexFromValue_Log ;
+          v->GVFI = GiveValueFromIndex_Log ;
+          break;
+        }
+        
+        AbsMax = DMAX(fabs(ValMin),fabs(ValMax));
+        AbsMax = (AbsMax==0.) ? 1. : AbsMax;
+        
+        for(j=0;j<3;j++){
+          RaiseFactor[j] = v->Raise[j] / AbsMax ;
+          for(k=0;k<5;k++) Raise[j][k] = 0. ;
+        }
+        
+        if((n = List_Nbr(v->Tetrahedra)))
+          for(j=0 ; j<n ; j++)
+            Draw_Post_Tetrahedron(v, (Post_Simplex*)List_Pointer(v->Tetrahedra,j), 
+                                  ValMin, ValMax, Raise);
+        
+        //if(there is alpha)List_Sort(v->Triangles, fcmpTriangle);
+
+        if((n = List_Nbr(v->Triangles)))
+          for(j=0 ; j<n ; j++)
+            Draw_Post_Triangle(v, (Post_Simplex*)List_Pointer(v->Triangles,j), 
+                               ValMin, ValMax, Raise);
+
+        if((n = List_Nbr(v->Lines)))
+          for(j=0 ; j<n ; j++)
+            Draw_Post_Line(v, (Post_Simplex*)List_Pointer(v->Lines,j), 
+                           ValMin, ValMax, Raise);
+        
+        if((n = List_Nbr(v->Points)))
+          for(j=0 ; j<n ; j++)
+            Draw_Post_Point(v, (Post_Simplex*)List_Pointer(v->Points,j), 
+                            ValMin, ValMax, Raise);
+        
+        if(CTX.display_lists){
+          glEndList();
+          v->Changed=0;
+        }
+        
       }
       
     }
diff --git a/Graphics/PostSimplex.cpp b/Graphics/PostSimplex.cpp
index 8d62f22410..577c4d8246 100644
--- a/Graphics/PostSimplex.cpp
+++ b/Graphics/PostSimplex.cpp
@@ -1,4 +1,4 @@
-/* $Id: PostSimplex.cpp,v 1.3 2000-11-25 15:26:10 geuzaine Exp $ */
+/* $Id: PostSimplex.cpp,v 1.4 2000-11-26 15:43:46 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -9,20 +9,19 @@
 #include "Context.h"
 
 extern Context_T   CTX;
-extern double      LC;
 
 /* ------------------------------------------------------------------------ */
 /*  P o i n t s                                                             */
 /* ------------------------------------------------------------------------ */
 
 void Draw_Post_Point(Post_View *View, Post_Simplex *PP, 
-		     double ValMin, double ValMax, double Raise[3][5]){      
+                     double ValMin, double ValMax, double Raise[3][5]){      
   int      i;
   double   d,dx,dy,dz,fact;
-	  
-  switch(PP->Type){	    
+          
+  switch(PP->Type){         
 
-  case DRAW_POST_SCALAR:	    	    
+  case DRAW_POST_SCALAR:                    
     d = PP->V[View->TimeStep];  
     if(d>=ValMin && d<=ValMax){      
       Palette(View,View->NbIso,View->GIFV(ValMin,ValMax,View->NbIso,d));
@@ -32,23 +31,23 @@ void Draw_Post_Point(Post_View *View, Post_Simplex *PP,
     }
     break;
     
-  case DRAW_POST_VECTOR:	    
+  case DRAW_POST_VECTOR:            
 
     if(View->ArrowType == DRAW_POST_DISPLACEMENT){
       fact = View->ArrowScale/100. ;
       glColor4ubv((GLubyte*)&CTX.color.fg);
       glBegin(GL_POINTS);
       glVertex3d(fact*PP->V[3*View->TimeStep],
-		 fact*PP->V[3*View->TimeStep+1],
-		 fact*PP->V[3*View->TimeStep+2]);
+                 fact*PP->V[3*View->TimeStep+1],
+                 fact*PP->V[3*View->TimeStep+2]);
       glEnd();
       if(View->TimeStep){
-	glBegin(GL_LINE_STRIP);
-	for(i=0 ; i<View->TimeStep+1 ; i++)
-	  glVertex3d(fact*PP->V[3*(View->TimeStep-i)],
-		     fact*PP->V[3*(View->TimeStep-i)+1],
-		     fact*PP->V[3*(View->TimeStep-i)+2]);
-	glEnd();
+        glBegin(GL_LINE_STRIP);
+        for(i=0 ; i<View->TimeStep+1 ; i++)
+          glVertex3d(fact*PP->V[3*(View->TimeStep-i)],
+                     fact*PP->V[3*(View->TimeStep-i)+1],
+                     fact*PP->V[3*(View->TimeStep-i)+2]);
+        glEnd();
       }
       break;
     }
@@ -62,20 +61,20 @@ void Draw_Post_Point(Post_View *View, Post_Simplex *PP,
       
       Palette(View,View->NbIso,View->GIFV(ValMin,ValMax,View->NbIso,d));
 
-      fact = 2.e-4 * LC * View->ArrowScale/View->Max ;
+      fact = 2.e-4 * CTX.lc * View->ArrowScale/View->Max ;
       
       if(View->ScaleType == DRAW_POST_LOGARITHMIC && ValMin>0){
-	dx /= d ; dy /= d ; dz /= d ;
-	d = log10(d/ValMin) ; 
-	dx *= d ; dy *= d ; dz *= d ;
+        dx /= d ; dy /= d ; dz /= d ;
+        d = log10(d/ValMin) ; 
+        dx *= d ; dy *= d ; dz *= d ;
       }
 
       RaiseFill(0, d, ValMin, Raise);
 
       Draw_Vector(View->ArrowType, View->IntervalsType!=DRAW_POST_ISO, 
-		  PP->X[0], PP->Y[0], PP->Z[0],
-		  fact*d, fact*dx, fact*dy, fact*dz,
-		  View->Offset, Raise);
+                  PP->X[0], PP->Y[0], PP->Z[0],
+                  fact*d, fact*dx, fact*dy, fact*dz,
+                  View->Offset, Raise);
     }
     break;
     
@@ -90,25 +89,25 @@ void Draw_Post_Point(Post_View *View, Post_Simplex *PP,
 /* ------------------------------------------------------------------------ */
 
 void Draw_Post_Line(Post_View *View, Post_Simplex *PL, 
-		    double ValMin, double ValMax, double Raise[3][5]){
+                    double ValMin, double ValMax, double Raise[3][5]){
 
   int     i,k,nb=0;
   double  d,dx,dy,dz,fact;
   double  Xp[5],Yp[5],Zp[5],value[5],thev;
   char    Num[100] ;
 
-  switch(PL->Type){	    
-  case DRAW_POST_SCALAR:	    
+  switch(PL->Type){         
+  case DRAW_POST_SCALAR:            
 
     if(View->IntervalsType==DRAW_POST_NUMERIC){
       d = (PL->V[2*View->TimeStep]+PL->V[2*View->TimeStep+1]) / 2.;
       if(d >= ValMin && d <= ValMax){
-	sprintf(Num, "%g", d);
-	glColor4ubv((GLubyte*)&CTX.color.fg);
-	glRasterPos3d((PL->X[0] + PL->X[1])/2.,
-		      (PL->Y[0] + PL->Y[1])/2.,
-		      (PL->Z[0] + PL->Z[1])/2.);
-	Draw_String(Num);
+        sprintf(Num, "%g", d);
+        glColor4ubv((GLubyte*)&CTX.color.fg);
+        glRasterPos3d((PL->X[0] + PL->X[1])/2.,
+                      (PL->Y[0] + PL->Y[1])/2.,
+                      (PL->Z[0] + PL->Z[1])/2.);
+        Draw_String(Num);
       }
       break ;
     }
@@ -120,85 +119,85 @@ void Draw_Post_Line(Post_View *View, Post_Simplex *PL,
       glBegin(GL_LINES);
       Palette2(View,ValMin,ValMax,PL->V[2*View->TimeStep]);
       glVertex3d(PL->X[0]+View->Offset[0]+Raise[0][0],
-		 PL->Y[0]+View->Offset[1]+Raise[1][0],
-		 PL->Z[0]+View->Offset[2]+Raise[2][0]);
+                 PL->Y[0]+View->Offset[1]+Raise[1][0],
+                 PL->Z[0]+View->Offset[2]+Raise[2][0]);
       Palette2(View,ValMin,ValMax,PL->V[2*View->TimeStep+1]);
       glVertex3d(PL->X[1]+View->Offset[0]+Raise[0][1],
-		 PL->Y[1]+View->Offset[1]+Raise[1][1],
-		 PL->Z[1]+View->Offset[2]+Raise[2][1]);
+                 PL->Y[1]+View->Offset[1]+Raise[1][1],
+                 PL->Z[1]+View->Offset[2]+Raise[2][1]);
       glEnd();
     }
     else{
       for(k=0 ; k<View->NbIso ; k++){
-	Palette(View,View->NbIso,k);
-	if(View->IntervalsType==DRAW_POST_DISCRETE){
-	  CutLine1D(PL->X,PL->Y,PL->Z,&PL->V[2*View->TimeStep],
-		    View->GVFI(ValMin,ValMax,View->NbIso+1,k),
-		    View->GVFI(ValMin,ValMax,View->NbIso+1,k+1),
-		    ValMin,ValMax,Xp,Yp,Zp,&nb,value);	  
-	  if(nb == 2){
-	    for(i=0;i<2;i++) RaiseFill(i,value[i],ValMin,Raise);    
-	    Draw_Line(Xp,Yp,Zp,View->Offset,Raise);  
-	  }
-	}
-	else{
-	  thev = View->GVFI(ValMin,ValMax,View->NbIso,k);
-	  CutLine0D(PL->X,PL->Y,PL->Z,&PL->V[2*View->TimeStep],
-		    thev, ValMin,ValMax,Xp,Yp,Zp,&nb);	  
-	  if(nb){
-	    RaiseFill(0,thev,ValMin,Raise);
-	    Draw_Point(Xp,Yp,Zp,View->Offset,Raise);    
-	  }
-	}
+        Palette(View,View->NbIso,k);
+        if(View->IntervalsType==DRAW_POST_DISCRETE){
+          CutLine1D(PL->X,PL->Y,PL->Z,&PL->V[2*View->TimeStep],
+                    View->GVFI(ValMin,ValMax,View->NbIso+1,k),
+                    View->GVFI(ValMin,ValMax,View->NbIso+1,k+1),
+                    ValMin,ValMax,Xp,Yp,Zp,&nb,value);    
+          if(nb == 2){
+            for(i=0;i<2;i++) RaiseFill(i,value[i],ValMin,Raise);    
+            Draw_Line(Xp,Yp,Zp,View->Offset,Raise);  
+          }
+        }
+        else{
+          thev = View->GVFI(ValMin,ValMax,View->NbIso,k);
+          CutLine0D(PL->X,PL->Y,PL->Z,&PL->V[2*View->TimeStep],
+                    thev, ValMin,ValMax,Xp,Yp,Zp,&nb);    
+          if(nb){
+            RaiseFill(0,thev,ValMin,Raise);
+            Draw_Point(Xp,Yp,Zp,View->Offset,Raise);    
+          }
+        }
       }
 
     }
     break;
     
-  case DRAW_POST_VECTOR:	    
+  case DRAW_POST_VECTOR:            
     if(View->ArrowLocation == DRAW_POST_LOCATE_COG){
       dx = 0.5 * (PL->V[6*View->TimeStep]  +PL->V[6*View->TimeStep+3]);
       dy = 0.5 * (PL->V[6*View->TimeStep+1]+PL->V[6*View->TimeStep+4]);
       dz = 0.5 * (PL->V[6*View->TimeStep+2]+PL->V[6*View->TimeStep+5]);
-      d = sqrt(dx*dx+dy*dy+dz*dz);	    
-      if(d!=0.0 && d>=ValMin && d<=ValMax){	      
-	Palette(View,View->NbIso,View->GIFV(ValMin,ValMax,View->NbIso,d));	      
-	fact = 2.e-4 * LC * View->ArrowScale/View->Max ;		
-	if(View->ScaleType == DRAW_POST_LOGARITHMIC && ValMin>0){
-	  dx /= d ; dy /= d ; dz /= d ;
-	  d = log10(d/ValMin) ; 
-	  dx *= d ; dy *= d ; dz *= d ;
-	}
-	RaiseFill(0, d, ValMin, Raise);		
-	Draw_Vector(View->ArrowType, View->IntervalsType!=DRAW_POST_ISO,
-		    0.5 * (PL->X[0] + PL->X[1]),
-		    0.5 * (PL->Y[0] + PL->Y[1]),
-		    0.5 * (PL->Z[0] + PL->Z[1]),
-		    fact*d, fact*dx, fact*dy, fact*dz,
-		    View->Offset, Raise);
+      d = sqrt(dx*dx+dy*dy+dz*dz);          
+      if(d!=0.0 && d>=ValMin && d<=ValMax){           
+        Palette(View,View->NbIso,View->GIFV(ValMin,ValMax,View->NbIso,d));            
+        fact = 2.e-4 * CTX.lc * View->ArrowScale/View->Max ;            
+        if(View->ScaleType == DRAW_POST_LOGARITHMIC && ValMin>0){
+          dx /= d ; dy /= d ; dz /= d ;
+          d = log10(d/ValMin) ; 
+          dx *= d ; dy *= d ; dz *= d ;
+        }
+        RaiseFill(0, d, ValMin, Raise);         
+        Draw_Vector(View->ArrowType, View->IntervalsType!=DRAW_POST_ISO,
+                    0.5 * (PL->X[0] + PL->X[1]),
+                    0.5 * (PL->Y[0] + PL->Y[1]),
+                    0.5 * (PL->Z[0] + PL->Z[1]),
+                    fact*d, fact*dx, fact*dy, fact*dz,
+                    View->Offset, Raise);
       }
     }
     else{
       for(k=0 ; k<2 ; k++){
-	dx = PL->V[6*View->TimeStep  +3*k] ;
-	dy = PL->V[6*View->TimeStep+1+3*k] ;
-	dz = PL->V[6*View->TimeStep+2+3*k] ;		  
-	d = sqrt(dx*dx+dy*dy+dz*dz);		
-	if(d!=0.0 && d>=ValMin && d<=ValMax){		
-	  Palette(View,View->NbIso,View->GIFV(ValMin,ValMax,View->NbIso,d));
-	  fact = 2.e-4 * LC * View->ArrowScale/View->Max ;		
-	  if(View->ScaleType == DRAW_POST_LOGARITHMIC && ValMin>0){
-	    dx /= d ; dy /= d ; dz /= d ;
-	    d = log10(d/ValMin) ; 
-	    dx *= d ; dy *= d ; dz *= d ;
-	  }
-	  RaiseFill(0, d, ValMin, Raise);		
-	  Draw_Vector(View->ArrowType, View->IntervalsType!=DRAW_POST_ISO,
-		      PL->X[k], PL->Y[k], PL->Z[k],
-		      fact*d, fact*dx, fact*dy, fact*dz,
-		      View->Offset, Raise);
-	}		
-      }	      
+        dx = PL->V[6*View->TimeStep  +3*k] ;
+        dy = PL->V[6*View->TimeStep+1+3*k] ;
+        dz = PL->V[6*View->TimeStep+2+3*k] ;              
+        d = sqrt(dx*dx+dy*dy+dz*dz);            
+        if(d!=0.0 && d>=ValMin && d<=ValMax){           
+          Palette(View,View->NbIso,View->GIFV(ValMin,ValMax,View->NbIso,d));
+          fact = 2.e-4 * CTX.lc * View->ArrowScale/View->Max ;          
+          if(View->ScaleType == DRAW_POST_LOGARITHMIC && ValMin>0){
+            dx /= d ; dy /= d ; dz /= d ;
+            d = log10(d/ValMin) ; 
+            dx *= d ; dy *= d ; dz *= d ;
+          }
+          RaiseFill(0, d, ValMin, Raise);               
+          Draw_Vector(View->ArrowType, View->IntervalsType!=DRAW_POST_ISO,
+                      PL->X[k], PL->Y[k], PL->Z[k],
+                      fact*d, fact*dx, fact*dy, fact*dz,
+                      View->Offset, Raise);
+        }               
+      }       
     }
     break;
     
@@ -214,7 +213,7 @@ void Draw_Post_Line(Post_View *View, Post_Simplex *PL,
 /* ------------------------------------------------------------------------ */
 
 void Draw_Post_Triangle(Post_View *View, Post_Simplex *PT, 
-			double ValMin, double ValMax, double Raise[3][5]){
+                        double ValMin, double ValMax, double Raise[3][5]){
 
   int     i, k, m, nb=0;
   double  d,dx,dy,dz,fact;
@@ -226,19 +225,19 @@ void Draw_Post_Triangle(Post_View *View, Post_Simplex *PT,
   if(View->ShowElement)
     glEnable(GL_POLYGON_OFFSET_FILL);
 
-  switch(PT->Type){	    
+  switch(PT->Type){         
     
   case DRAW_POST_SCALAR:
 
     if(View->IntervalsType==DRAW_POST_NUMERIC){
       d = (PT->V[3*View->TimeStep]+PT->V[3*View->TimeStep+1]+PT->V[3*View->TimeStep+2]) / 3.;
       if(d >= ValMin && d <= ValMax){
-	sprintf(Num, "%g", d);
-	glColor4ubv((GLubyte*)&CTX.color.fg);
-	glRasterPos3d((PT->X[0] + PT->X[1] + PT->X[2])/3.,
-		      (PT->Y[0] + PT->Y[1] + PT->Y[2])/3.,
-		      (PT->Z[0] + PT->Z[1] + PT->Z[2])/3.);
-	Draw_String(Num);
+        sprintf(Num, "%g", d);
+        glColor4ubv((GLubyte*)&CTX.color.fg);
+        glRasterPos3d((PT->X[0] + PT->X[1] + PT->X[2])/3.,
+                      (PT->Y[0] + PT->Y[1] + PT->Y[2])/3.,
+                      (PT->Z[0] + PT->Z[1] + PT->Z[2])/3.);
+        Draw_String(Num);
       }
       break ;
     }
@@ -259,9 +258,9 @@ void Draw_Post_Triangle(Post_View *View, Post_Simplex *PT,
       //norme(nn); unnecessary with   glEnable(GL_NORMALIZE);
       /* BOF BOF BOF 
       if(nn[2] < -0.1){
-	nn[0] = -nn[0];
-	nn[1] = -nn[1];
-	nn[2] = -nn[2];
+        nn[0] = -nn[0];
+        nn[1] = -nn[1];
+        nn[2] = -nn[2];
       }
       */
       glNormal3dv(nn);
@@ -269,65 +268,65 @@ void Draw_Post_Triangle(Post_View *View, Post_Simplex *PT,
 
     if(View->IntervalsType==DRAW_POST_CONTINUOUS){
       if(PT->V[3*View->TimeStep]  >=ValMin && PT->V[3*View->TimeStep]  <=ValMax &&
-	 PT->V[3*View->TimeStep+1]>=ValMin && PT->V[3*View->TimeStep+1]<=ValMax &&
-	 PT->V[3*View->TimeStep+2]>=ValMin && PT->V[3*View->TimeStep+2]<=ValMax){
-	glBegin(GL_TRIANGLES);
-	Palette2(View,ValMin,ValMax,PT->V[3*View->TimeStep]);
-	glVertex3d(PT->X[0]+View->Offset[0]+Raise[0][0],
-		   PT->Y[0]+View->Offset[1]+Raise[1][0],
-		   PT->Z[0]+View->Offset[2]+Raise[2][0]);
-	Palette2(View,ValMin,ValMax,PT->V[3*View->TimeStep+1]);
-	glVertex3d(PT->X[1]+View->Offset[0]+Raise[0][1],
-		   PT->Y[1]+View->Offset[1]+Raise[1][1],
-		   PT->Z[1]+View->Offset[2]+Raise[2][1]);
-	Palette2(View,ValMin,ValMax,PT->V[3*View->TimeStep+2]);
-	glVertex3d(PT->X[2]+View->Offset[0]+Raise[0][2],
-		   PT->Y[2]+View->Offset[1]+Raise[1][2],
-		   PT->Z[2]+View->Offset[2]+Raise[2][2]);
-	glEnd();
+         PT->V[3*View->TimeStep+1]>=ValMin && PT->V[3*View->TimeStep+1]<=ValMax &&
+         PT->V[3*View->TimeStep+2]>=ValMin && PT->V[3*View->TimeStep+2]<=ValMax){
+        glBegin(GL_TRIANGLES);
+        Palette2(View,ValMin,ValMax,PT->V[3*View->TimeStep]);
+        glVertex3d(PT->X[0]+View->Offset[0]+Raise[0][0],
+                   PT->Y[0]+View->Offset[1]+Raise[1][0],
+                   PT->Z[0]+View->Offset[2]+Raise[2][0]);
+        Palette2(View,ValMin,ValMax,PT->V[3*View->TimeStep+1]);
+        glVertex3d(PT->X[1]+View->Offset[0]+Raise[0][1],
+                   PT->Y[1]+View->Offset[1]+Raise[1][1],
+                   PT->Z[1]+View->Offset[2]+Raise[2][1]);
+        Palette2(View,ValMin,ValMax,PT->V[3*View->TimeStep+2]);
+        glVertex3d(PT->X[2]+View->Offset[0]+Raise[0][2],
+                   PT->Y[2]+View->Offset[1]+Raise[1][2],
+                   PT->Z[2]+View->Offset[2]+Raise[2][2]);
+        glEnd();
       }
       else{
-	CutTriangle2D(PT->X,PT->Y,PT->Z,&PT->V[3*View->TimeStep],
-		      ValMin,ValMax,ValMin,ValMax,
-		      Xp,Yp,Zp,&nb,value);
-	if(nb >= 3){	  
-	  glBegin(GL_POLYGON);
-	  for(i=0;i<nb;i++){
-	    Palette2(View,ValMin,ValMax,value[i]);
-	    RaiseFill(i,value[i],ValMin,Raise);
-	    glVertex3d(Xp[i]+View->Offset[0]+Raise[0][i],
-		       Yp[i]+View->Offset[1]+Raise[1][i],
-		       Zp[i]+View->Offset[2]+Raise[2][i]);
-	  }
-	  glEnd();
-	}
+        CutTriangle2D(PT->X,PT->Y,PT->Z,&PT->V[3*View->TimeStep],
+                      ValMin,ValMax,ValMin,ValMax,
+                      Xp,Yp,Zp,&nb,value);
+        if(nb >= 3){      
+          glBegin(GL_POLYGON);
+          for(i=0;i<nb;i++){
+            Palette2(View,ValMin,ValMax,value[i]);
+            RaiseFill(i,value[i],ValMin,Raise);
+            glVertex3d(Xp[i]+View->Offset[0]+Raise[0][i],
+                       Yp[i]+View->Offset[1]+Raise[1][i],
+                       Zp[i]+View->Offset[2]+Raise[2][i]);
+          }
+          glEnd();
+        }
       }
     }
     else{
       for(k=0 ; k<View->NbIso ; k++){
-	if(View->IntervalsType==DRAW_POST_DISCRETE){
-	  Palette(View,View->NbIso,k);
-	  CutTriangle2D(PT->X,PT->Y,PT->Z,&PT->V[3*View->TimeStep],
-			View->GVFI(ValMin,ValMax,View->NbIso+1,k),
-			View->GVFI(ValMin,ValMax,View->NbIso+1,k+1),
-			ValMin,ValMax,
-			Xp,Yp,Zp,&nb,value);	  
-	  if(nb >= 3){
-	    for(i=0;i<nb;i++) RaiseFill(i,value[i],ValMin,Raise);    
-	    Draw_Polygon(nb,Xp,Yp,Zp,View->Offset,Raise);  
-	  }
-	}
-	else{
-	  Palette(View,View->NbIso,k);
-
-	  thev = View->GVFI(ValMin,ValMax,View->NbIso,k);
-	  CutTriangle1D(PT->X,PT->Y,PT->Z,&PT->V[3*View->TimeStep],
-			thev, ValMin,ValMax,Xp,Yp,Zp,&nb);	  
-	  if(nb == 2){
-	    for(i=0;i<2;i++) RaiseFill(i,thev,ValMin,Raise);
-	    Draw_Line(Xp,Yp,Zp,View->Offset,Raise);    
-	  }
-	}
+        if(View->IntervalsType==DRAW_POST_DISCRETE){
+          Palette(View,View->NbIso,k);
+          CutTriangle2D(PT->X,PT->Y,PT->Z,&PT->V[3*View->TimeStep],
+                        View->GVFI(ValMin,ValMax,View->NbIso+1,k),
+                        View->GVFI(ValMin,ValMax,View->NbIso+1,k+1),
+                        ValMin,ValMax,
+                        Xp,Yp,Zp,&nb,value);      
+          if(nb >= 3){
+            for(i=0;i<nb;i++) RaiseFill(i,value[i],ValMin,Raise);    
+            Draw_Polygon(nb,Xp,Yp,Zp,View->Offset,Raise);  
+          }
+        }
+        else{
+          Palette(View,View->NbIso,k);
+
+          thev = View->GVFI(ValMin,ValMax,View->NbIso,k);
+          CutTriangle1D(PT->X,PT->Y,PT->Z,&PT->V[3*View->TimeStep],
+                        thev, ValMin,ValMax,Xp,Yp,Zp,&nb);        
+          if(nb == 2){
+            for(i=0;i<2;i++) RaiseFill(i,thev,ValMin,Raise);
+            Draw_Line(Xp,Yp,Zp,View->Offset,Raise);    
+          }
+        }
       }
     }
     break;
@@ -337,14 +336,14 @@ void Draw_Post_Triangle(Post_View *View, Post_Simplex *PT,
     if(View->ArrowType == DRAW_POST_DISPLACEMENT){
       fact = View->ArrowScale/100. ;
       for(m=0;m<3;m++){
-	xx[m] = PT->X[m] + fact * PT->V[9*View->TimeStep + 3 * m ];
-	yy[m] = PT->Y[m] + fact * PT->V[9*View->TimeStep + 3 * m + 1];
-	zz[m] = PT->Z[m] + fact * PT->V[9*View->TimeStep + 3 * m + 2];
+        xx[m] = PT->X[m] + fact * PT->V[9*View->TimeStep + 3 * m ];
+        yy[m] = PT->Y[m] + fact * PT->V[9*View->TimeStep + 3 * m + 1];
+        zz[m] = PT->Z[m] + fact * PT->V[9*View->TimeStep + 3 * m + 2];
       }
       glEnable(GL_POLYGON_OFFSET_FILL);
       glColor4ubv((GLubyte*)&CTX.color.bg);
       if(View->IntervalsType!=DRAW_POST_ISO)
-	Draw_Polygon (3, xx, yy, zz, View->Offset, Raise);
+        Draw_Polygon (3, xx, yy, zz, View->Offset, Raise);
       glColor4ubv((GLubyte*)&CTX.color.fg);
       glBegin(GL_LINE_LOOP);
       for(m=0 ; m<3 ; m++) glVertex3d(xx[m], yy[m], zz[m]);
@@ -358,46 +357,46 @@ void Draw_Post_Triangle(Post_View *View, Post_Simplex *PT,
       dy = (PT->V[9*View->TimeStep+1]+PT->V[9*View->TimeStep+4]+PT->V[9*View->TimeStep+7])/3.;
       dz = (PT->V[9*View->TimeStep+2]+PT->V[9*View->TimeStep+5]+PT->V[9*View->TimeStep+8])/3.;
       d = sqrt(dx*dx+dy*dy+dz*dz);
-      if(d!=0.0 && d>=ValMin && d<=ValMax){		
-	Palette(View,View->NbIso,View->GIFV(ValMin,ValMax,View->NbIso,d));	      
-	fact = 2.e-4 * LC * View->ArrowScale/View->Max ;		
-	if(View->ScaleType == DRAW_POST_LOGARITHMIC && ValMin>0){
-	  dx /= d ; dy /= d ; dz /= d ;
-	  d = log10(d/ValMin) ; 
-	  dx *= d ; dy *= d ; dz *= d ;
-	}
-	RaiseFill(0, d, ValMin, Raise);		
-	Draw_Vector(View->ArrowType, View->IntervalsType!=DRAW_POST_ISO,
-		    (PT->X[0] + PT->X[1] + PT->X[2])/3.,
-		    (PT->Y[0] + PT->Y[1] + PT->Y[2])/3.,
-		    (PT->Z[0] + PT->Z[1] + PT->Z[2])/3.,
-		    fact*d, fact*dx, fact*dy, fact*dz,
-		    View->Offset, Raise);
+      if(d!=0.0 && d>=ValMin && d<=ValMax){             
+        Palette(View,View->NbIso,View->GIFV(ValMin,ValMax,View->NbIso,d));            
+        fact = 2.e-4 * CTX.lc * View->ArrowScale/View->Max ;            
+        if(View->ScaleType == DRAW_POST_LOGARITHMIC && ValMin>0){
+          dx /= d ; dy /= d ; dz /= d ;
+          d = log10(d/ValMin) ; 
+          dx *= d ; dy *= d ; dz *= d ;
+        }
+        RaiseFill(0, d, ValMin, Raise);         
+        Draw_Vector(View->ArrowType, View->IntervalsType!=DRAW_POST_ISO,
+                    (PT->X[0] + PT->X[1] + PT->X[2])/3.,
+                    (PT->Y[0] + PT->Y[1] + PT->Y[2])/3.,
+                    (PT->Z[0] + PT->Z[1] + PT->Z[2])/3.,
+                    fact*d, fact*dx, fact*dy, fact*dz,
+                    View->Offset, Raise);
       }
     }
     else{
       for(k=0 ; k<3 ; k++){
-	dx = PT->V[9*View->TimeStep  +3*k] ;
-	dy = PT->V[9*View->TimeStep+1+3*k] ;
-	dz = PT->V[9*View->TimeStep+2+3*k] ;		  
-	d = sqrt(dx*dx+dy*dy+dz*dz);
-	
-	if(d!=0.0 && d>=ValMin && d<=ValMax){		
-	  Palette(View,View->NbIso,View->GIFV(ValMin,ValMax,View->NbIso,d));
-	  fact = 2.e-4 * LC * View->ArrowScale/View->Max ;		
-	  if(View->ScaleType == DRAW_POST_LOGARITHMIC && ValMin>0){
-	    dx /= d ; dy /= d ; dz /= d ;
-	    d = log10(d/ValMin) ; 
-	    dx *= d ; dy *= d ; dz *= d ;
-	  }
-	  RaiseFill(0, d, ValMin, Raise);				  
-	  Draw_Vector(View->ArrowType, View->IntervalsType!=DRAW_POST_ISO,
-		      PT->X[k], PT->Y[k], PT->Z[k],
-		      fact*d, fact*dx, fact*dy, fact*dz,
-		      View->Offset, Raise);
-	  
-	}		
-      }	      
+        dx = PT->V[9*View->TimeStep  +3*k] ;
+        dy = PT->V[9*View->TimeStep+1+3*k] ;
+        dz = PT->V[9*View->TimeStep+2+3*k] ;              
+        d = sqrt(dx*dx+dy*dy+dz*dz);
+        
+        if(d!=0.0 && d>=ValMin && d<=ValMax){           
+          Palette(View,View->NbIso,View->GIFV(ValMin,ValMax,View->NbIso,d));
+          fact = 2.e-4 * CTX.lc * View->ArrowScale/View->Max ;          
+          if(View->ScaleType == DRAW_POST_LOGARITHMIC && ValMin>0){
+            dx /= d ; dy /= d ; dz /= d ;
+            d = log10(d/ValMin) ; 
+            dx *= d ; dy *= d ; dz *= d ;
+          }
+          RaiseFill(0, d, ValMin, Raise);                                 
+          Draw_Vector(View->ArrowType, View->IntervalsType!=DRAW_POST_ISO,
+                      PT->X[k], PT->Y[k], PT->Z[k],
+                      fact*d, fact*dx, fact*dy, fact*dz,
+                      View->Offset, Raise);
+          
+        }               
+      }       
     }
     break;
     
@@ -412,8 +411,8 @@ void Draw_Post_Triangle(Post_View *View, Post_Simplex *PT,
     glBegin(GL_LINE_LOOP);
     for(i=0 ; i<3 ; i++) 
       glVertex3d(PT->X[i]+View->Offset[0]+Raise[0][i],
-		 PT->Y[i]+View->Offset[1]+Raise[1][i],
-		 PT->Z[i]+View->Offset[2]+Raise[2][i]);
+                 PT->Y[i]+View->Offset[1]+Raise[1][i],
+                 PT->Z[i]+View->Offset[2]+Raise[2][i]);
     glEnd();
   }
 
@@ -427,75 +426,75 @@ void Draw_Post_Triangle(Post_View *View, Post_Simplex *PT,
 /* ------------------------------------------------------------------------ */
 
 void Draw_Post_Tetrahedron(Post_View *View, Post_Simplex *PS, 
-			   double ValMin, double ValMax, double Raise[3][5]){
+                           double ValMin, double ValMax, double Raise[3][5]){
 
   int     k;
   double  d,dx,dy,dz,fact;
 
   switch(PS->Type){
-  case DRAW_POST_SCALAR:	    
+  case DRAW_POST_SCALAR:            
     for(k=0 ; k<View->NbIso ; k++){
       Palette(View,View->NbIso,k);
       IsoSimplex(PS->X, PS->Y, PS->Z, &PS->V[4*View->TimeStep],
-		 View->GVFI(ValMin,ValMax,View->NbIso,k), 
-		 ValMin, ValMax, View->Offset, Raise, View->Light);
+                 View->GVFI(ValMin,ValMax,View->NbIso,k), 
+                 ValMin, ValMax, View->Offset, Raise, View->Light);
     }
     break;
     
     /* 
-       la plus grande fleche (d=ValMax) est de taille LC/50
+       la plus grande fleche (d=ValMax) est de taille CTX.lc/50
        (View->ArrowScale == 100 par defaut)
        */
     
-  case DRAW_POST_VECTOR:	    
+  case DRAW_POST_VECTOR:            
     if(View->ArrowLocation == DRAW_POST_LOCATE_COG){
       dx = 0.25 * (PS->V[12*View->TimeStep]  +PS->V[12*View->TimeStep+3]+
-		   PS->V[12*View->TimeStep+6]+PS->V[12*View->TimeStep+9] );
+                   PS->V[12*View->TimeStep+6]+PS->V[12*View->TimeStep+9] );
       dy = 0.25 * (PS->V[12*View->TimeStep+1]+PS->V[12*View->TimeStep+4]+
-		   PS->V[12*View->TimeStep+7]+PS->V[12*View->TimeStep+10] );
+                   PS->V[12*View->TimeStep+7]+PS->V[12*View->TimeStep+10] );
       dz = 0.25 * (PS->V[12*View->TimeStep+2]+PS->V[12*View->TimeStep+5]+
-		   PS->V[12*View->TimeStep+8]+PS->V[12*View->TimeStep+11] );
+                   PS->V[12*View->TimeStep+8]+PS->V[12*View->TimeStep+11] );
       d = sqrt(dx*dx+dy*dy+dz*dz);
       
-      if(d!=0.0 && d>=ValMin && d<=ValMax){		
-	Palette(View,View->NbIso,View->GIFV(ValMin,ValMax,View->NbIso,d));
-	fact = 2.e-4 * LC * View->ArrowScale/View->Max ;		
-	if(View->ScaleType == DRAW_POST_LOGARITHMIC && ValMin>0){
-	  dx /= d ; dy /= d ; dz /= d ;
-	  d = log10(d/ValMin) ; 
-	  dx *= d ; dy *= d ; dz *= d ;
-	}
-	RaiseFill(0, d, ValMin, Raise);		
-	Draw_Vector(View->ArrowType, View->IntervalsType!=DRAW_POST_ISO,
-		    0.25 * (PS->X[0] + PS->X[1] + PS->X[2] + PS->X[3]),
-		    0.25 * (PS->Y[0] + PS->Y[1] + PS->Y[2] + PS->Y[3]),
-		    0.25 * (PS->Z[0] + PS->Z[1] + PS->Z[2] + PS->Z[3]),
-		    fact*d, fact*dx, fact*dy, fact*dz,
-		    View->Offset, Raise);
+      if(d!=0.0 && d>=ValMin && d<=ValMax){             
+        Palette(View,View->NbIso,View->GIFV(ValMin,ValMax,View->NbIso,d));
+        fact = 2.e-4 * CTX.lc * View->ArrowScale/View->Max ;            
+        if(View->ScaleType == DRAW_POST_LOGARITHMIC && ValMin>0){
+          dx /= d ; dy /= d ; dz /= d ;
+          d = log10(d/ValMin) ; 
+          dx *= d ; dy *= d ; dz *= d ;
+        }
+        RaiseFill(0, d, ValMin, Raise);         
+        Draw_Vector(View->ArrowType, View->IntervalsType!=DRAW_POST_ISO,
+                    0.25 * (PS->X[0] + PS->X[1] + PS->X[2] + PS->X[3]),
+                    0.25 * (PS->Y[0] + PS->Y[1] + PS->Y[2] + PS->Y[3]),
+                    0.25 * (PS->Z[0] + PS->Z[1] + PS->Z[2] + PS->Z[3]),
+                    fact*d, fact*dx, fact*dy, fact*dz,
+                    View->Offset, Raise);
       }
     }
     else{
       for(k=0 ; k<4 ; k++){
-	dx = PS->V[12*View->TimeStep  +3*k] ;
-	dy = PS->V[12*View->TimeStep+1+3*k] ;
-	dz = PS->V[12*View->TimeStep+2+3*k] ;		  
-	d = sqrt(dx*dx+dy*dy+dz*dz);
-	
-	if(d!=0.0 && d>=ValMin && d<=ValMax){	  
-	  Palette(View,View->NbIso,View->GIFV(ValMin,ValMax,View->NbIso,d));
-	  fact = 2.e-4 * LC * View->ArrowScale/View->Max ;		
-	  if(View->ScaleType == DRAW_POST_LOGARITHMIC && ValMin>0){
-	    dx /= d ; dy /= d ; dz /= d ;
-	    d = log10(d/ValMin) ; 
-	    dx *= d ; dy *= d ; dz *= d ;
-	  }
-	  RaiseFill(0, d, ValMin, Raise);		
-	  Draw_Vector(View->ArrowType, View->IntervalsType!=DRAW_POST_ISO,
-		      PS->X[k], PS->Y[k], PS->Z[k],
-		      fact*d, fact*dx, fact*dy, fact*dz,
-		      View->Offset, Raise);
-	}		
-      }	      
+        dx = PS->V[12*View->TimeStep  +3*k] ;
+        dy = PS->V[12*View->TimeStep+1+3*k] ;
+        dz = PS->V[12*View->TimeStep+2+3*k] ;             
+        d = sqrt(dx*dx+dy*dy+dz*dz);
+        
+        if(d!=0.0 && d>=ValMin && d<=ValMax){     
+          Palette(View,View->NbIso,View->GIFV(ValMin,ValMax,View->NbIso,d));
+          fact = 2.e-4 * CTX.lc * View->ArrowScale/View->Max ;          
+          if(View->ScaleType == DRAW_POST_LOGARITHMIC && ValMin>0){
+            dx /= d ; dy /= d ; dz /= d ;
+            d = log10(d/ValMin) ; 
+            dx *= d ; dy *= d ; dz *= d ;
+          }
+          RaiseFill(0, d, ValMin, Raise);               
+          Draw_Vector(View->ArrowType, View->IntervalsType!=DRAW_POST_ISO,
+                      PS->X[k], PS->Y[k], PS->Z[k],
+                      fact*d, fact*dx, fact*dy, fact*dz,
+                      View->Offset, Raise);
+        }               
+      }       
     }
     break;
     
diff --git a/Graphics/Scale.cpp b/Graphics/Scale.cpp
index 692ca5609c..8f61a8dab5 100644
--- a/Graphics/Scale.cpp
+++ b/Graphics/Scale.cpp
@@ -1,4 +1,4 @@
-/* $Id: Scale.cpp,v 1.4 2000-11-25 23:10:37 geuzaine Exp $ */
+/* $Id: Scale.cpp,v 1.5 2000-11-26 15:43:46 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -47,11 +47,11 @@ void Draw_String(char *s){
 #ifdef _UNIX
 static int          dir,ascent, descent;
 static XCharStruct  overall;
-#define CHECK_W										\
-  XTextExtents(XCTX.xfont.helve, label, strlen(label), &dir,&ascent,&descent,&overall);	\
+#define CHECK_W                                                                         \
+  XTextExtents(XCTX.xfont.helve, label, strlen(label), &dir,&ascent,&descent,&overall); \
   if(overall.width > cv_w) cv_w=overall.width
 #else
-#define CHECK_W	 cv_w=200
+#define CHECK_W  cv_w=200
 #endif
 
 
@@ -146,7 +146,7 @@ void draw_scale(Post_View *v, double xmin, double ymin, double *width, double he
       Palette2(v,ValMin,ValMax,ValMin+(i+1)*(ValMax-ValMin)/v->NbIso);
       glVertex2d(cs_xmin+cs_w, cs_ymin+(i+1)*cs_bh);
       glVertex2d(cs_xmin,      cs_ymin+(i+1)*cs_bh);
-      glEnd();	
+      glEnd();  
     }
     else{
       Palette(v,v->NbIso,i);
@@ -190,18 +190,18 @@ void draw_scale(Post_View *v, double xmin, double ymin, double *width, double he
   else {
     if(v->IntervalsType!=DRAW_POST_ISO){
       for(i=0 ; i<nbv+1 ; i++){
-	Val = v->GVFI(ValMin,ValMax,nbv+1,i); 
-	sprintf(label, v->Format, Val);
-	glRasterPos2d(cv_xmin,cv_ymin+i*cv_bh-font_a/3.);
-	Draw_String(label); CHECK_W;
+        Val = v->GVFI(ValMin,ValMax,nbv+1,i); 
+        sprintf(label, v->Format, Val);
+        glRasterPos2d(cv_xmin,cv_ymin+i*cv_bh-font_a/3.);
+        Draw_String(label); CHECK_W;
       }
     }
     else {
       for(i=0 ; i<nbv ; i++){
-	Val = v->GVFI(ValMin,ValMax,nbv,i); 
-	sprintf(label, v->Format, Val);
-	glRasterPos2d(cv_xmin,cv_ymin+(2*i+1)*(cv_bh/2)-font_a/3.);
-	Draw_String(label); CHECK_W;
+        Val = v->GVFI(ValMin,ValMax,nbv,i); 
+        sprintf(label, v->Format, Val);
+        glRasterPos2d(cv_xmin,cv_ymin+(2*i+1)*(cv_bh/2)-font_a/3.);
+        Draw_String(label); CHECK_W;
       }
     }
   }
@@ -271,10 +271,10 @@ void Draw_Scales(void){
       v = *(Post_View**)List_Pointer(todraw,i);
       oldwidth = width;
       draw_scale(v,
-		 xmin+totalwidth+(i/2)*xsep,
-		 ymin+(1-i%2)*(height+ysep),
-		 &width,
-		 height);      
+                 xmin+totalwidth+(i/2)*xsep,
+                 ymin+(1-i%2)*(height+ysep),
+                 &width,
+                 height);      
       if(i%2) totalwidth += DMAX(width,oldwidth);
     }
   }
diff --git a/Graphics/gl2gif.cpp b/Graphics/gl2gif.cpp
index 294d718486..f7c26abf9c 100644
--- a/Graphics/gl2gif.cpp
+++ b/Graphics/gl2gif.cpp
@@ -1,4 +1,4 @@
-/* $Id: gl2gif.cpp,v 1.2 2000-11-23 14:11:33 geuzaine Exp $ */
+/* $Id: gl2gif.cpp,v 1.3 2000-11-26 15:43:46 geuzaine Exp $ */
 /*
   This file is a big hack from
 
@@ -24,15 +24,15 @@ static int ExpNumOfColors = 8, ColorMapSize = 256;
 
 
 /******************************************************************************
-* Initialize HashTable - allocate the memory needed and clear it.	      *
+* Initialize HashTable - allocate the memory needed and clear it.             *
 ******************************************************************************/
 GifHashTableType *_InitHashTable(void)
 {
     GifHashTableType *HashTable;
 
     if ((HashTable = (GifHashTableType *) malloc(sizeof(GifHashTableType)))
-	== NULL)
-	return NULL;
+        == NULL)
+        return NULL;
 
     _ClearHashTable(HashTable);
 
@@ -40,7 +40,7 @@ GifHashTableType *_InitHashTable(void)
 }
 
 /******************************************************************************
-* Routine to clear the HashTable to an empty state.			      *
+* Routine to clear the HashTable to an empty state.                           *
 * This part is a little machine depended. Use the commented part otherwise.   *
 ******************************************************************************/
 void _ClearHashTable(GifHashTableType *HashTable)
@@ -54,7 +54,7 @@ void _ClearHashTable(GifHashTableType *HashTable)
 /******************************************************************************
 * Routine to generate an HKey for the hashtable out of the given unique key.  *
 * The given Key is assumed to be 20 bits as follows: lower 8 bits are the     *
-* new postfix character, while the upper 12 bits are the prefix code.	      *
+* new postfix character, while the upper 12 bits are the prefix code.         *
 * Because the average hit ratio is only 2 (2 hash references per entry),      *
 * evaluating more complex keys (such as twin prime keys) does not worth it!   *
 ******************************************************************************/
@@ -65,7 +65,7 @@ static int KeyItem(unsigned long Item)
 
 /******************************************************************************
 * Routine to insert a new Item into the HashTable. The data is assumed to be  *
-* new one.								      *
+* new one.                                                                    *
 ******************************************************************************/
 void _InsertHashTable(GifHashTableType *HashTable, unsigned long Key, int Code)
 {
@@ -73,14 +73,14 @@ void _InsertHashTable(GifHashTableType *HashTable, unsigned long Key, int Code)
     unsigned long *HTable = HashTable -> HTable;
 
     while (HT_GET_KEY(HTable[HKey]) != 0xFFFFFL) {
-	HKey = (HKey + 1) & HT_KEY_MASK;
+        HKey = (HKey + 1) & HT_KEY_MASK;
     }
     HTable[HKey] = HT_PUT_KEY(Key) | HT_PUT_CODE(Code);
 }
 
 /******************************************************************************
 * Routine to test if given Key exists in HashTable and if so returns its code *
-* Returns the Code if key was found, -1 if not.				      *
+* Returns the Code if key was found, -1 if not.                               *
 ******************************************************************************/
 int _ExistsHashTable(GifHashTableType *HashTable, unsigned long Key)
 {
@@ -88,15 +88,15 @@ int _ExistsHashTable(GifHashTableType *HashTable, unsigned long Key)
     unsigned long *HTable = HashTable -> HTable, HTKey;
 
     while ((HTKey = HT_GET_KEY(HTable[HKey])) != 0xFFFFFL) {
-	if (Key == HTKey) return HT_GET_CODE(HTable[HKey]);
-	HKey = (HKey + 1) & HT_KEY_MASK;
+        if (Key == HTKey) return HT_GET_CODE(HTable[HKey]);
+        HKey = (HKey + 1) & HT_KEY_MASK;
     }
 
     return -1;
 }
 
 /******************************************************************************
-* Miscellaneous utility functions					      *
+* Miscellaneous utility functions                                             *
 ******************************************************************************/
 
 int BitSize(int n)
@@ -105,14 +105,14 @@ int BitSize(int n)
     register int i;
 
     for (i = 1; i <= 8; i++)
-	if ((1 << i) >= n)
-	    break;
+        if ((1 << i) >= n)
+            break;
     return(i);
 }
 
 
 /******************************************************************************
-* Color map object functions						      *
+* Color map object functions                                                  *
 ******************************************************************************/
 
 ColorMapObject *MakeMapObject(int ColorCount, GifColorType *ColorMap)
@@ -126,18 +126,18 @@ ColorMapObject *MakeMapObject(int ColorCount, GifColorType *ColorMap)
 
     Object = (ColorMapObject *)malloc(sizeof(ColorMapObject));
     if (Object == (ColorMapObject *)NULL)
-	return((ColorMapObject *)NULL);
+        return((ColorMapObject *)NULL);
 
     Object->Colors = (GifColorType *)calloc(ColorCount, sizeof(GifColorType));
     if (Object->Colors == (GifColorType *)NULL)
-	return((ColorMapObject *)NULL);
+        return((ColorMapObject *)NULL);
 
     Object->ColorCount = ColorCount;
     Object->BitsPerPixel = BitSize(ColorCount);
 
     if (ColorMap)
-	memcpy((char *)Object->Colors,
-	       (char *)ColorMap, ColorCount * sizeof(GifColorType));
+        memcpy((char *)Object->Colors,
+               (char *)ColorMap, ColorCount * sizeof(GifColorType));
 
     return(Object);
 }
@@ -149,54 +149,54 @@ void FreeMapObject(ColorMapObject *Object)
 }
 
 /*****************************************************************************
-* Print the last GIF error to stderr.					     *
+* Print the last GIF error to stderr.                                        *
 *****************************************************************************/
 void PrintGifError(void)
 {
     char *Err;
 
     switch(_GifError) {
-	case E_GIF_ERR_OPEN_FAILED:
-	    Err = "Failed to open given file";
-	    break;
-	case E_GIF_ERR_WRITE_FAILED:
-	    Err = "Failed to Write to given file";
-	    break;
-	case E_GIF_ERR_HAS_SCRN_DSCR:
-	    Err = "Screen Descriptor already been set";
-	    break;
-	case E_GIF_ERR_HAS_IMAG_DSCR:
-	    Err = "Image Descriptor is still active";
-	    break;
-	case E_GIF_ERR_NO_COLOR_MAP:
-	    Err = "Neither Global Nor Local color map";
-	    break;
-	case E_GIF_ERR_DATA_TOO_BIG:
-	    Err = "#Pixels bigger than Width * Height";
-	    break;
-	case E_GIF_ERR_NOT_ENOUGH_MEM:
-	    Err = "Fail to allocate required memory";
-	    break;
-	case E_GIF_ERR_DISK_IS_FULL:
-	    Err = "Write failed (disk full?)";
-	    break;
-	case E_GIF_ERR_CLOSE_FAILED:
-	    Err = "Failed to close given file";
-	    break;
-	case E_GIF_ERR_NOT_WRITEABLE:
-	    Err = "Given file was not opened for write";
-	    break;
-	default:
-	    Err = NULL;
-	    break;
+        case E_GIF_ERR_OPEN_FAILED:
+            Err = "Failed to open given file";
+            break;
+        case E_GIF_ERR_WRITE_FAILED:
+            Err = "Failed to Write to given file";
+            break;
+        case E_GIF_ERR_HAS_SCRN_DSCR:
+            Err = "Screen Descriptor already been set";
+            break;
+        case E_GIF_ERR_HAS_IMAG_DSCR:
+            Err = "Image Descriptor is still active";
+            break;
+        case E_GIF_ERR_NO_COLOR_MAP:
+            Err = "Neither Global Nor Local color map";
+            break;
+        case E_GIF_ERR_DATA_TOO_BIG:
+            Err = "#Pixels bigger than Width * Height";
+            break;
+        case E_GIF_ERR_NOT_ENOUGH_MEM:
+            Err = "Fail to allocate required memory";
+            break;
+        case E_GIF_ERR_DISK_IS_FULL:
+            Err = "Write failed (disk full?)";
+            break;
+        case E_GIF_ERR_CLOSE_FAILED:
+            Err = "Failed to close given file";
+            break;
+        case E_GIF_ERR_NOT_WRITEABLE:
+            Err = "Given file was not opened for write";
+            break;
+        default:
+            Err = NULL;
+            break;
     }
     if (Err != NULL)
-	fprintf(stderr, "Error: %s\n", Err);
+        fprintf(stderr, "Error: %s\n", Err);
     else
-	fprintf(stderr, "Error: GIF undefined error %d\n", _GifError);
+        fprintf(stderr, "Error: GIF undefined error %d\n", _GifError);
 }
 
-#define ABS(x)	((x) > 0 ? (x) : (-(x)))
+#define ABS(x)  ((x) > 0 ? (x) : (-(x)))
 
 #define COLOR_ARRAY_SIZE 32768
 #define BITS_PER_PRIM_COLOR 5
@@ -219,25 +219,25 @@ typedef struct NewColorMapType {
 } NewColorMapType;
 
 static int SubdivColorMap(NewColorMapType *NewColorSubdiv,
-			  int ColorMapSize,
-			  int *NewColorMapSize);
+                          int ColorMapSize,
+                          int *NewColorMapSize);
 static int SortCmpRtn(const VoidPtr Entry1, const VoidPtr Entry2);
 
 /******************************************************************************
 * Quantize high resolution image into lower one. Input image consists of a    *
 * 2D array for each of the RGB colors with size Width by Height. There is no  *
 * Color map for the input. Output is a quantized image with 2D array of       *
-* indexes into the output color map.					      *
+* indexes into the output color map.                                          *
 *   Note input image can be 24 bits at the most (8 for red/green/blue) and    *
 * the output has 256 colors at the most (256 entries in the color map.).      *
 * ColorMapSize specifies size of color map up to 256 and will be updated to   *
-* real size before returning.						      *
-*   Also non of the parameter are allocated by this routine.		      *
-*   This function returns GIF_OK if succesfull, GIF_ERROR otherwise.	      *
+* real size before returning.                                                 *
+*   Also non of the parameter are allocated by this routine.                  *
+*   This function returns GIF_OK if succesfull, GIF_ERROR otherwise.          *
 ******************************************************************************/
 int QuantizeBuffer(int Width, int Height, int *ColorMapSize,
-	GifByteType *RedInput, GifByteType *GreenInput, GifByteType *BlueInput,
-	GifByteType *OutputBuffer, GifColorType *OutputColorMap)
+        GifByteType *RedInput, GifByteType *GreenInput, GifByteType *BlueInput,
+        GifByteType *OutputBuffer, GifColorType *OutputColorMap)
 {
     int Index, NumOfEntries;
     int i, j, MaxRGBError[3];
@@ -247,107 +247,107 @@ int QuantizeBuffer(int Width, int Height, int *ColorMapSize,
     QuantizedColorType *ColorArrayEntries, *QuantizedColor;
 
     if ((ColorArrayEntries = (QuantizedColorType *)
-	    malloc(sizeof(QuantizedColorType) * COLOR_ARRAY_SIZE)) == NULL) {
-	_GifError = E_GIF_ERR_NOT_ENOUGH_MEM;
-	return GIF_ERROR;
+            malloc(sizeof(QuantizedColorType) * COLOR_ARRAY_SIZE)) == NULL) {
+        _GifError = E_GIF_ERR_NOT_ENOUGH_MEM;
+        return GIF_ERROR;
     }
 
     for (i = 0; i < COLOR_ARRAY_SIZE; i++) {
-	ColorArrayEntries[i].RGB[0]= i >> (2 * BITS_PER_PRIM_COLOR);
-	ColorArrayEntries[i].RGB[1] = (i >> BITS_PER_PRIM_COLOR) &
-	    						MAX_PRIM_COLOR;
-	ColorArrayEntries[i].RGB[2] = i & MAX_PRIM_COLOR;
-	ColorArrayEntries[i].Count = 0;
+        ColorArrayEntries[i].RGB[0]= i >> (2 * BITS_PER_PRIM_COLOR);
+        ColorArrayEntries[i].RGB[1] = (i >> BITS_PER_PRIM_COLOR) &
+                                                        MAX_PRIM_COLOR;
+        ColorArrayEntries[i].RGB[2] = i & MAX_PRIM_COLOR;
+        ColorArrayEntries[i].Count = 0;
     }
 
     /* Sample the colors and their distribution: */
     for (i = 0; i < (int)(Width * Height); i++) {
-	Index = ((RedInput[i] >> (8 - BITS_PER_PRIM_COLOR))
-		    << (2 * BITS_PER_PRIM_COLOR)) +
-		((GreenInput[i] >> (8 - BITS_PER_PRIM_COLOR))
-		    << BITS_PER_PRIM_COLOR) +
-		(BlueInput[i] >> (8 - BITS_PER_PRIM_COLOR));
-	ColorArrayEntries[Index].Count++;
+        Index = ((RedInput[i] >> (8 - BITS_PER_PRIM_COLOR))
+                    << (2 * BITS_PER_PRIM_COLOR)) +
+                ((GreenInput[i] >> (8 - BITS_PER_PRIM_COLOR))
+                    << BITS_PER_PRIM_COLOR) +
+                (BlueInput[i] >> (8 - BITS_PER_PRIM_COLOR));
+        ColorArrayEntries[Index].Count++;
     }
 
     /* Put all the colors in the first entry of the color map, and call the  */
-    /* recursive subdivision process.					     */
+    /* recursive subdivision process.                                        */
     for (i = 0; i < 256; i++) {
-	NewColorSubdiv[i].QuantizedColors = NULL;
-	NewColorSubdiv[i].Count = NewColorSubdiv[i].NumEntries = 0;
-	for (j = 0; j < 3; j++) {
-	    NewColorSubdiv[i].RGBMin[j] = 0;
-	    NewColorSubdiv[i].RGBWidth[j] = 255;
-	}
+        NewColorSubdiv[i].QuantizedColors = NULL;
+        NewColorSubdiv[i].Count = NewColorSubdiv[i].NumEntries = 0;
+        for (j = 0; j < 3; j++) {
+            NewColorSubdiv[i].RGBMin[j] = 0;
+            NewColorSubdiv[i].RGBWidth[j] = 255;
+        }
     }
 
     /* Find the non empty entries in the color table and chain them: */
     for (i = 0; i < COLOR_ARRAY_SIZE; i++)
-	if (ColorArrayEntries[i].Count > 0) break;
+        if (ColorArrayEntries[i].Count > 0) break;
     QuantizedColor = NewColorSubdiv[0].QuantizedColors = &ColorArrayEntries[i];
     NumOfEntries = 1;
     while (++i < COLOR_ARRAY_SIZE)
-	if (ColorArrayEntries[i].Count > 0) {
-	    QuantizedColor -> Pnext = &ColorArrayEntries[i];
-	    QuantizedColor = &ColorArrayEntries[i];
-	    NumOfEntries++;
-	}
+        if (ColorArrayEntries[i].Count > 0) {
+            QuantizedColor -> Pnext = &ColorArrayEntries[i];
+            QuantizedColor = &ColorArrayEntries[i];
+            NumOfEntries++;
+        }
     QuantizedColor -> Pnext = NULL;
 
     NewColorSubdiv[0].NumEntries = NumOfEntries;/* Different sampled colors. */
     NewColorSubdiv[0].Count = ((long) Width) * Height;            /* Pixels. */
     NewColorMapSize = 1;
     if (SubdivColorMap(NewColorSubdiv, *ColorMapSize, &NewColorMapSize) !=
-								     GIF_OK) {
-	free((char *) ColorArrayEntries);
-	return GIF_ERROR;
+                                                                     GIF_OK) {
+        free((char *) ColorArrayEntries);
+        return GIF_ERROR;
     }
     if (NewColorMapSize < *ColorMapSize) {
-	/* And clear rest of color map: */
-	for (i = NewColorMapSize; i < *ColorMapSize; i++)
-	    OutputColorMap[i].Red =
-	    OutputColorMap[i].Green =
-	    OutputColorMap[i].Blue = 0;
+        /* And clear rest of color map: */
+        for (i = NewColorMapSize; i < *ColorMapSize; i++)
+            OutputColorMap[i].Red =
+            OutputColorMap[i].Green =
+            OutputColorMap[i].Blue = 0;
     }
 
     /* Average the colors in each entry to be the color to be used in the    */
     /* output color map, and plug it into the output color map itself.       */
     for (i = 0; i < NewColorMapSize; i++) {
-	if ((j = NewColorSubdiv[i].NumEntries) > 0) {
-	    QuantizedColor = NewColorSubdiv[i].QuantizedColors;
-	    Red = Green = Blue = 0;
-	    while (QuantizedColor) {
-		QuantizedColor -> NewColorIndex = i;
-		Red += QuantizedColor -> RGB[0];
-		Green += QuantizedColor -> RGB[1];
-		Blue += QuantizedColor -> RGB[2];
-		QuantizedColor = QuantizedColor -> Pnext;
-	    }
-	    OutputColorMap[i].Red = (Red << (8 - BITS_PER_PRIM_COLOR)) / j;
-	    OutputColorMap[i].Green = (Green << (8 - BITS_PER_PRIM_COLOR)) / j;
-	    OutputColorMap[i].Blue= (Blue << (8 - BITS_PER_PRIM_COLOR)) / j;
-	}
-	else
-	    fprintf(stderr, "Warning, Null entry in quantized color map - that's weird\n");
+        if ((j = NewColorSubdiv[i].NumEntries) > 0) {
+            QuantizedColor = NewColorSubdiv[i].QuantizedColors;
+            Red = Green = Blue = 0;
+            while (QuantizedColor) {
+                QuantizedColor -> NewColorIndex = i;
+                Red += QuantizedColor -> RGB[0];
+                Green += QuantizedColor -> RGB[1];
+                Blue += QuantizedColor -> RGB[2];
+                QuantizedColor = QuantizedColor -> Pnext;
+            }
+            OutputColorMap[i].Red = (Red << (8 - BITS_PER_PRIM_COLOR)) / j;
+            OutputColorMap[i].Green = (Green << (8 - BITS_PER_PRIM_COLOR)) / j;
+            OutputColorMap[i].Blue= (Blue << (8 - BITS_PER_PRIM_COLOR)) / j;
+        }
+        else
+            fprintf(stderr, "Warning, Null entry in quantized color map - that's weird\n");
     }
 
     /* Finally scan the input buffer again and put the mapped index in the   */
-    /* output buffer.							     */
+    /* output buffer.                                                        */
     MaxRGBError[0] = MaxRGBError[1] = MaxRGBError[2] = 0;
     for (i = 0; i < (int)(Width * Height); i++) {
-	Index = ((RedInput[i] >> (8 - BITS_PER_PRIM_COLOR))
-		    << (2 * BITS_PER_PRIM_COLOR)) +
-		((GreenInput[i] >> (8 - BITS_PER_PRIM_COLOR))
-		    << BITS_PER_PRIM_COLOR) +
-		(BlueInput[i] >> (8 - BITS_PER_PRIM_COLOR));
-	Index = ColorArrayEntries[Index].NewColorIndex;
-	OutputBuffer[i] = Index;
-	if (MaxRGBError[0] < ABS(OutputColorMap[Index].Red - RedInput[i]))
-	    MaxRGBError[0] = ABS(OutputColorMap[Index].Red - RedInput[i]);
-	if (MaxRGBError[1] < ABS(OutputColorMap[Index].Green - GreenInput[i]))
-	    MaxRGBError[1] = ABS(OutputColorMap[Index].Green - GreenInput[i]);
-	if (MaxRGBError[2] < ABS(OutputColorMap[Index].Blue - BlueInput[i]))
-	    MaxRGBError[2] = ABS(OutputColorMap[Index].Blue - BlueInput[i]);
+        Index = ((RedInput[i] >> (8 - BITS_PER_PRIM_COLOR))
+                    << (2 * BITS_PER_PRIM_COLOR)) +
+                ((GreenInput[i] >> (8 - BITS_PER_PRIM_COLOR))
+                    << BITS_PER_PRIM_COLOR) +
+                (BlueInput[i] >> (8 - BITS_PER_PRIM_COLOR));
+        Index = ColorArrayEntries[Index].NewColorIndex;
+        OutputBuffer[i] = Index;
+        if (MaxRGBError[0] < ABS(OutputColorMap[Index].Red - RedInput[i]))
+            MaxRGBError[0] = ABS(OutputColorMap[Index].Red - RedInput[i]);
+        if (MaxRGBError[1] < ABS(OutputColorMap[Index].Green - GreenInput[i]))
+            MaxRGBError[1] = ABS(OutputColorMap[Index].Green - GreenInput[i]);
+        if (MaxRGBError[2] < ABS(OutputColorMap[Index].Blue - BlueInput[i]))
+            MaxRGBError[2] = ABS(OutputColorMap[Index].Blue - BlueInput[i]);
     }
 
     free((char *) ColorArrayEntries);
@@ -359,13 +359,13 @@ int QuantizeBuffer(int Width, int Height, int *ColorMapSize,
 
 /******************************************************************************
 * Routine to subdivide the RGB space recursively using median cut in each     *
-* axes alternatingly until ColorMapSize different cubes exists.		      *
+* axes alternatingly until ColorMapSize different cubes exists.               *
 * The biggest cube in one dimension is subdivide unless it has only one entry.*
-* Returns GIF_ERROR if failed, otherwise GIF_OK.			      *
+* Returns GIF_ERROR if failed, otherwise GIF_OK.                              *
 ******************************************************************************/
 static int SubdivColorMap(NewColorMapType *NewColorSubdiv,
-			  int ColorMapSize,
-			  int *NewColorMapSize)
+                          int ColorMapSize,
+                          int *NewColorMapSize)
 {
     int MaxSize;
     int i, j, Index = 0, NumEntries, MinColor, MaxColor;
@@ -373,105 +373,105 @@ static int SubdivColorMap(NewColorMapType *NewColorSubdiv,
     QuantizedColorType *QuantizedColor, **SortArray;
 
     while (ColorMapSize > *NewColorMapSize) {
-	/* Find candidate for subdivision: */
-	MaxSize = -1;
-	for (i = 0; i < *NewColorMapSize; i++) {
-	    for (j = 0; j < 3; j++) {
-		if (((int) NewColorSubdiv[i].RGBWidth[j]) > MaxSize &&
-		    NewColorSubdiv[i].NumEntries > 1) {
-		    MaxSize = NewColorSubdiv[i].RGBWidth[j];
-		    Index = i;
-		    SortRGBAxis = j;
-		}
-	    }
-	}
-
-	if (MaxSize == -1)
-	    return GIF_OK;
-
-	/* Split the entry Index into two along the axis SortRGBAxis: */
-
-	/* Sort all elements in that entry along the given axis and split at */
-	/* the median.							     */
-	if ((SortArray = (QuantizedColorType **)
-	    malloc(sizeof(QuantizedColorType *) *
-		   NewColorSubdiv[Index].NumEntries)) == NULL)
-    	    return GIF_ERROR;
-	for (j = 0, QuantizedColor = NewColorSubdiv[Index].QuantizedColors;
-	     j < NewColorSubdiv[Index].NumEntries && QuantizedColor != NULL;
-	     j++, QuantizedColor = QuantizedColor -> Pnext)
-	    SortArray[j] = QuantizedColor;
-	qsort(SortArray, NewColorSubdiv[Index].NumEntries,
-	      sizeof(QuantizedColorType *), SortCmpRtn);
-
-	/* Relink the sorted list into one: */
-	for (j = 0; j < NewColorSubdiv[Index].NumEntries - 1; j++)
-	    SortArray[j] -> Pnext = SortArray[j + 1];
-	SortArray[NewColorSubdiv[Index].NumEntries - 1] -> Pnext = NULL;
-	NewColorSubdiv[Index].QuantizedColors = QuantizedColor = SortArray[0];
-	free((char *) SortArray);
-
-	/* Now simply add the Counts until we have half of the Count: */
-	Sum = NewColorSubdiv[Index].Count / 2 - QuantizedColor -> Count;
-	NumEntries = 1;
-	Count = QuantizedColor -> Count;
-	while ((Sum -= QuantizedColor -> Pnext -> Count) >= 0 &&
-	       QuantizedColor -> Pnext != NULL &&
-	       QuantizedColor -> Pnext -> Pnext != NULL) {
-	    QuantizedColor = QuantizedColor -> Pnext;
-	    NumEntries++;
-	    Count += QuantizedColor -> Count;
-	}
-	/* Save the values of the last color of the first half, and first    */
-	/* of the second half so we can update the Bounding Boxes later.     */
-	/* Also as the colors are quantized and the BBoxes are full 0..255,  */
-	/* they need to be rescaled.					     */
-	MaxColor = QuantizedColor -> RGB[SortRGBAxis];/* Max. of first half. */
-	MinColor = QuantizedColor -> Pnext -> RGB[SortRGBAxis];/* of second. */
-	MaxColor <<= (8 - BITS_PER_PRIM_COLOR);
-	MinColor <<= (8 - BITS_PER_PRIM_COLOR);
-
-	/* Partition right here: */
-	NewColorSubdiv[*NewColorMapSize].QuantizedColors =
-	    QuantizedColor -> Pnext;
-	QuantizedColor -> Pnext = NULL;
-	NewColorSubdiv[*NewColorMapSize].Count = Count;
-	NewColorSubdiv[Index].Count -= Count;
-	NewColorSubdiv[*NewColorMapSize].NumEntries =
-	    NewColorSubdiv[Index].NumEntries - NumEntries;
-	NewColorSubdiv[Index].NumEntries = NumEntries;
-	for (j = 0; j < 3; j++) {
-	    NewColorSubdiv[*NewColorMapSize].RGBMin[j] =
-		NewColorSubdiv[Index].RGBMin[j];
-	    NewColorSubdiv[*NewColorMapSize].RGBWidth[j] =
-		NewColorSubdiv[Index].RGBWidth[j];
-	}
-	NewColorSubdiv[*NewColorMapSize].RGBWidth[SortRGBAxis] =
-	    NewColorSubdiv[*NewColorMapSize].RGBMin[SortRGBAxis] +
-	    NewColorSubdiv[*NewColorMapSize].RGBWidth[SortRGBAxis] -
-	    MinColor;
-	NewColorSubdiv[*NewColorMapSize].RGBMin[SortRGBAxis] = MinColor;
-
-	NewColorSubdiv[Index].RGBWidth[SortRGBAxis] =
-	    MaxColor - NewColorSubdiv[Index].RGBMin[SortRGBAxis];
-
-	(*NewColorMapSize)++;
+        /* Find candidate for subdivision: */
+        MaxSize = -1;
+        for (i = 0; i < *NewColorMapSize; i++) {
+            for (j = 0; j < 3; j++) {
+                if (((int) NewColorSubdiv[i].RGBWidth[j]) > MaxSize &&
+                    NewColorSubdiv[i].NumEntries > 1) {
+                    MaxSize = NewColorSubdiv[i].RGBWidth[j];
+                    Index = i;
+                    SortRGBAxis = j;
+                }
+            }
+        }
+
+        if (MaxSize == -1)
+            return GIF_OK;
+
+        /* Split the entry Index into two along the axis SortRGBAxis: */
+
+        /* Sort all elements in that entry along the given axis and split at */
+        /* the median.                                                       */
+        if ((SortArray = (QuantizedColorType **)
+            malloc(sizeof(QuantizedColorType *) *
+                   NewColorSubdiv[Index].NumEntries)) == NULL)
+            return GIF_ERROR;
+        for (j = 0, QuantizedColor = NewColorSubdiv[Index].QuantizedColors;
+             j < NewColorSubdiv[Index].NumEntries && QuantizedColor != NULL;
+             j++, QuantizedColor = QuantizedColor -> Pnext)
+            SortArray[j] = QuantizedColor;
+        qsort(SortArray, NewColorSubdiv[Index].NumEntries,
+              sizeof(QuantizedColorType *), SortCmpRtn);
+
+        /* Relink the sorted list into one: */
+        for (j = 0; j < NewColorSubdiv[Index].NumEntries - 1; j++)
+            SortArray[j] -> Pnext = SortArray[j + 1];
+        SortArray[NewColorSubdiv[Index].NumEntries - 1] -> Pnext = NULL;
+        NewColorSubdiv[Index].QuantizedColors = QuantizedColor = SortArray[0];
+        free((char *) SortArray);
+
+        /* Now simply add the Counts until we have half of the Count: */
+        Sum = NewColorSubdiv[Index].Count / 2 - QuantizedColor -> Count;
+        NumEntries = 1;
+        Count = QuantizedColor -> Count;
+        while ((Sum -= QuantizedColor -> Pnext -> Count) >= 0 &&
+               QuantizedColor -> Pnext != NULL &&
+               QuantizedColor -> Pnext -> Pnext != NULL) {
+            QuantizedColor = QuantizedColor -> Pnext;
+            NumEntries++;
+            Count += QuantizedColor -> Count;
+        }
+        /* Save the values of the last color of the first half, and first    */
+        /* of the second half so we can update the Bounding Boxes later.     */
+        /* Also as the colors are quantized and the BBoxes are full 0..255,  */
+        /* they need to be rescaled.                                         */
+        MaxColor = QuantizedColor -> RGB[SortRGBAxis];/* Max. of first half. */
+        MinColor = QuantizedColor -> Pnext -> RGB[SortRGBAxis];/* of second. */
+        MaxColor <<= (8 - BITS_PER_PRIM_COLOR);
+        MinColor <<= (8 - BITS_PER_PRIM_COLOR);
+
+        /* Partition right here: */
+        NewColorSubdiv[*NewColorMapSize].QuantizedColors =
+            QuantizedColor -> Pnext;
+        QuantizedColor -> Pnext = NULL;
+        NewColorSubdiv[*NewColorMapSize].Count = Count;
+        NewColorSubdiv[Index].Count -= Count;
+        NewColorSubdiv[*NewColorMapSize].NumEntries =
+            NewColorSubdiv[Index].NumEntries - NumEntries;
+        NewColorSubdiv[Index].NumEntries = NumEntries;
+        for (j = 0; j < 3; j++) {
+            NewColorSubdiv[*NewColorMapSize].RGBMin[j] =
+                NewColorSubdiv[Index].RGBMin[j];
+            NewColorSubdiv[*NewColorMapSize].RGBWidth[j] =
+                NewColorSubdiv[Index].RGBWidth[j];
+        }
+        NewColorSubdiv[*NewColorMapSize].RGBWidth[SortRGBAxis] =
+            NewColorSubdiv[*NewColorMapSize].RGBMin[SortRGBAxis] +
+            NewColorSubdiv[*NewColorMapSize].RGBWidth[SortRGBAxis] -
+            MinColor;
+        NewColorSubdiv[*NewColorMapSize].RGBMin[SortRGBAxis] = MinColor;
+
+        NewColorSubdiv[Index].RGBWidth[SortRGBAxis] =
+            MaxColor - NewColorSubdiv[Index].RGBMin[SortRGBAxis];
+
+        (*NewColorMapSize)++;
     }
 
     return GIF_OK;
 }
 
 /******************************************************************************
-* Routine called by qsort to compare to entries.			      *
+* Routine called by qsort to compare to entries.                              *
 ******************************************************************************/
 static int SortCmpRtn(const VoidPtr Entry1, const VoidPtr Entry2)
 {
     return (* ((QuantizedColorType **) Entry1)) -> RGB[SortRGBAxis] -
-	   (* ((QuantizedColorType **) Entry2)) -> RGB[SortRGBAxis];
+           (* ((QuantizedColorType **) Entry2)) -> RGB[SortRGBAxis];
 }
 
-#define GIF87_STAMP	"GIF87a"         /* First chars in file - GIF stamp. */
-#define GIF89_STAMP	"GIF89a"         /* First chars in file - GIF stamp. */
+#define GIF87_STAMP     "GIF87a"         /* First chars in file - GIF stamp. */
+#define GIF89_STAMP     "GIF89a"         /* First chars in file - GIF stamp. */
 
 /* Masks given codes to BitsPerPixel, to make sure all codes are in range: */
 static GifPixelType CodeMask[] = {
@@ -486,15 +486,15 @@ static char *GifVersionPrefix = GIF87_STAMP;
 static int EGifPutWord(int Word, GifFileType *GifFile);
 static int EGifSetupCompress(GifFileType *GifFile);
 static int EGifCompressLine(GifFileType *GifFile, GifPixelType *Line,
-								int LineLen);
+                                                                int LineLen);
 static int EGifCompressOutput(GifFileType *GifFile, int Code);
 static int EGifBufferedOutput(GifFileType *GifFile, GifByteType *Buf, int c);
 
 /******************************************************************************
 *   Update a new gif file, given its file handle, which must be opened for    *
-* write in binary mode.							      *
+* write in binary mode.                                                       *
 *   Returns GifFileType pointer dynamically allocated which serves as the gif *
-* info record. _GifError is cleared if succesfull.			      *
+* info record. _GifError is cleared if succesfull.                            *
 ******************************************************************************/
 GifFileType *EGifOpenFileHandle(FILE *f, int FileHandle)
 {
@@ -543,31 +543,31 @@ void EGifSetGifVersion(char *Version)
 
 /******************************************************************************
 *   This routine should be called before any other EGif calls, immediately    *
-* follows the GIF file openning.					      *
+* follows the GIF file openning.                                              *
 ******************************************************************************/
 int EGifPutScreenDesc(GifFileType *GifFile,
-	int Width, int Height, int ColorRes, int BackGround,
-	ColorMapObject *ColorMap)
+        int Width, int Height, int ColorRes, int BackGround,
+        ColorMapObject *ColorMap)
 {
     int i;
     GifByteType Buf[3];
     GifFilePrivateType *Private = (GifFilePrivateType *) GifFile->Private;
 
     if (Private->FileState & FILE_STATE_SCREEN) {
-	/* If already has screen descriptor - something is wrong! */
-	_GifError = E_GIF_ERR_HAS_SCRN_DSCR;
-	return GIF_ERROR;
+        /* If already has screen descriptor - something is wrong! */
+        _GifError = E_GIF_ERR_HAS_SCRN_DSCR;
+        return GIF_ERROR;
     }
     if (!IS_WRITEABLE(Private)) {
-	/* This file was NOT open for writing: */
-	_GifError = E_GIF_ERR_NOT_WRITEABLE;
-	return GIF_ERROR;
+        /* This file was NOT open for writing: */
+        _GifError = E_GIF_ERR_NOT_WRITEABLE;
+        return GIF_ERROR;
     }
 
     /* First write the version prefix into the file. */
     if (WRITE(GifFile, GifVersionPrefix, strlen(GifVersionPrefix)) != strlen(GifVersionPrefix)) {
-	_GifError = E_GIF_ERR_WRITE_FAILED;
-	return GIF_ERROR;
+        _GifError = E_GIF_ERR_WRITE_FAILED;
+        return GIF_ERROR;
     }
 
     GifFile->SWidth = Width;
@@ -583,24 +583,24 @@ int EGifPutScreenDesc(GifFileType *GifFile,
     EGifPutWord(Width, GifFile);
     EGifPutWord(Height, GifFile);
     Buf[0] = (ColorMap ? 0x80 : 0x00) |
-	     ((ColorRes - 1) << 4) |
-	     (ColorMap->BitsPerPixel - 1);
+             ((ColorRes - 1) << 4) |
+             (ColorMap->BitsPerPixel - 1);
     Buf[1] = BackGround;
     Buf[2] = 0;
     WRITE(GifFile, Buf, 3);
 
     /* If we have Global color map - dump it also: */
     if (ColorMap != NULL)
-	for (i = 0; i < ColorMap->ColorCount; i++) {
-	    /* Put the ColorMap out also: */
-	    Buf[0] = ColorMap->Colors[i].Red;
-	    Buf[1] = ColorMap->Colors[i].Green;
-	    Buf[2] = ColorMap->Colors[i].Blue;
-	    if (WRITE(GifFile, Buf, 3) != 3) {
-	        _GifError = E_GIF_ERR_WRITE_FAILED;
-		return GIF_ERROR;
-	    }
-	}
+        for (i = 0; i < ColorMap->ColorCount; i++) {
+            /* Put the ColorMap out also: */
+            Buf[0] = ColorMap->Colors[i].Red;
+            Buf[1] = ColorMap->Colors[i].Green;
+            Buf[2] = ColorMap->Colors[i].Blue;
+            if (WRITE(GifFile, Buf, 3) != 3) {
+                _GifError = E_GIF_ERR_WRITE_FAILED;
+                return GIF_ERROR;
+            }
+        }
 
     /* Mark this file as has screen descriptor, and no pixel written yet: */
     Private->FileState |= FILE_STATE_SCREEN;
@@ -610,11 +610,11 @@ int EGifPutScreenDesc(GifFileType *GifFile,
 
 /******************************************************************************
 *   This routine should be called before any attemp to dump an image - any    *
-* call to any of the pixel dump routines.				      *
+* call to any of the pixel dump routines.                                     *
 ******************************************************************************/
 int EGifPutImageDesc(GifFileType *GifFile,
-	int Left, int Top, int Width, int Height, int Interlace,
-	ColorMapObject *ColorMap)
+        int Left, int Top, int Width, int Height, int Interlace,
+        ColorMapObject *ColorMap)
 {
     int i;
     GifByteType Buf[3];
@@ -622,18 +622,18 @@ int EGifPutImageDesc(GifFileType *GifFile,
 
     if (Private->FileState & FILE_STATE_IMAGE &&
 #if defined(__GNUC__)
-	Private->PixelCount > 0xffff0000UL) {
+        Private->PixelCount > 0xffff0000UL) {
 #else
-	Private->PixelCount > 0xffff0000) {
+        Private->PixelCount > 0xffff0000) {
 #endif
-	/* If already has active image descriptor - something is wrong! */
-	_GifError = E_GIF_ERR_HAS_IMAG_DSCR;
-	return GIF_ERROR;
+        /* If already has active image descriptor - something is wrong! */
+        _GifError = E_GIF_ERR_HAS_IMAG_DSCR;
+        return GIF_ERROR;
     }
     if (!IS_WRITEABLE(Private)) {
-	/* This file was NOT open for writing: */
-	_GifError = E_GIF_ERR_NOT_WRITEABLE;
-	return GIF_ERROR;
+        /* This file was NOT open for writing: */
+        _GifError = E_GIF_ERR_NOT_WRITEABLE;
+        return GIF_ERROR;
     }
     GifFile->Image.Left = Left;
     GifFile->Image.Top = Top;
@@ -646,33 +646,33 @@ int EGifPutImageDesc(GifFileType *GifFile,
       GifFile->Image.ColorMap = NULL;
 
     /* Put the image descriptor into the file: */
-    Buf[0] = ',';			       /* Image seperator character. */
+    Buf[0] = ',';                              /* Image seperator character. */
     WRITE(GifFile, Buf, 1);
     EGifPutWord(Left, GifFile);
     EGifPutWord(Top, GifFile);
     EGifPutWord(Width, GifFile);
     EGifPutWord(Height, GifFile);
     Buf[0] = (ColorMap ? 0x80 : 0x00) |
-	  (Interlace ? 0x40 : 0x00) |
-	  (ColorMap ? ColorMap->BitsPerPixel - 1 : 0);
+          (Interlace ? 0x40 : 0x00) |
+          (ColorMap ? ColorMap->BitsPerPixel - 1 : 0);
     WRITE(GifFile, Buf, 1);
 
     /* If we have Global color map - dump it also: */
     if (ColorMap != NULL)
-	for (i = 0; i < ColorMap->ColorCount; i++) {
-	    /* Put the ColorMap out also: */
-	    Buf[0] = ColorMap->Colors[i].Red;
-	    Buf[1] = ColorMap->Colors[i].Green;
-	    Buf[2] = ColorMap->Colors[i].Blue;
-	    if (WRITE(GifFile, Buf, 3) != 3) {
-	        _GifError = E_GIF_ERR_WRITE_FAILED;
-		return GIF_ERROR;
-	    }
-	}
+        for (i = 0; i < ColorMap->ColorCount; i++) {
+            /* Put the ColorMap out also: */
+            Buf[0] = ColorMap->Colors[i].Red;
+            Buf[1] = ColorMap->Colors[i].Green;
+            Buf[2] = ColorMap->Colors[i].Blue;
+            if (WRITE(GifFile, Buf, 3) != 3) {
+                _GifError = E_GIF_ERR_WRITE_FAILED;
+                return GIF_ERROR;
+            }
+        }
     if (GifFile->SColorMap == NULL && GifFile->Image.ColorMap == NULL)
     {
-	_GifError = E_GIF_ERR_NO_COLOR_MAP;
-	return GIF_ERROR;
+        _GifError = E_GIF_ERR_NO_COLOR_MAP;
+        return GIF_ERROR;
     }
 
     /* Mark this file as has screen descriptor: */
@@ -685,7 +685,7 @@ int EGifPutImageDesc(GifFileType *GifFile,
 }
 
 /******************************************************************************
-*  Put one full scanned line (Line) of length LineLen into GIF file.	      *
+*  Put one full scanned line (Line) of length LineLen into GIF file.          *
 ******************************************************************************/
 int EGifPutLine(GifFileType *GifFile, GifPixelType *Line, int LineLen)
 {
@@ -694,16 +694,16 @@ int EGifPutLine(GifFileType *GifFile, GifPixelType *Line, int LineLen)
     GifFilePrivateType *Private = (GifFilePrivateType *) GifFile->Private;
 
     if (!IS_WRITEABLE(Private)) {
-	/* This file was NOT open for writing: */
-	_GifError = E_GIF_ERR_NOT_WRITEABLE;
-	return GIF_ERROR;
+        /* This file was NOT open for writing: */
+        _GifError = E_GIF_ERR_NOT_WRITEABLE;
+        return GIF_ERROR;
     }
 
     if (!LineLen)
       LineLen = GifFile->Image.Width;
     if (Private->PixelCount < (unsigned)LineLen) {
-	_GifError = E_GIF_ERR_DATA_TOO_BIG;
-	return GIF_ERROR;
+        _GifError = E_GIF_ERR_DATA_TOO_BIG;
+        return GIF_ERROR;
     }
     Private->PixelCount -= LineLen;
 
@@ -716,7 +716,7 @@ int EGifPutLine(GifFileType *GifFile, GifPixelType *Line, int LineLen)
 }
 
 /******************************************************************************
-*   This routine should be called last, to close GIF file.		      *
+*   This routine should be called last, to close GIF file.                    *
 ******************************************************************************/
 int EGifCloseFile(GifFileType *GifFile)
 {
@@ -727,28 +727,28 @@ int EGifCloseFile(GifFileType *GifFile)
 
     Private = (GifFilePrivateType *) GifFile->Private;
     if (!IS_WRITEABLE(Private)) {
-	/* This file was NOT open for writing: */
-	_GifError = E_GIF_ERR_NOT_WRITEABLE;
-	return GIF_ERROR;
+        /* This file was NOT open for writing: */
+        _GifError = E_GIF_ERR_NOT_WRITEABLE;
+        return GIF_ERROR;
     }
 
     Buf = ';';
     WRITE(GifFile, &Buf, 1);
 
     if (GifFile->Image.ColorMap)
-	FreeMapObject(GifFile->Image.ColorMap);
+        FreeMapObject(GifFile->Image.ColorMap);
     if (GifFile->SColorMap)
-	FreeMapObject(GifFile->SColorMap);
+        FreeMapObject(GifFile->SColorMap);
     if (Private) {
         if (Private->HashTable) free((char *) Private->HashTable);
-	    free((char *) Private);
+            free((char *) Private);
     }
     free(GifFile);
     return GIF_OK;
 }
 
 /******************************************************************************
-*   Put 2 bytes (word) into the given file:				      *
+*   Put 2 bytes (word) into the given file:                                   *
 ******************************************************************************/
 static int EGifPutWord(int Word, GifFileType *GifFile)
 {
@@ -757,13 +757,13 @@ static int EGifPutWord(int Word, GifFileType *GifFile)
     c[0] = Word & 0xff;
     c[1] = (Word >> 8) & 0xff;
     if (WRITE(GifFile, c, 2) == 2)
-	return GIF_OK;
+        return GIF_OK;
     else
-	return GIF_ERROR;
+        return GIF_ERROR;
 }
 
 /******************************************************************************
-*   Setup the LZ compression for this image:				      *
+*   Setup the LZ compression for this image:                                  *
 ******************************************************************************/
 static int EGifSetupCompress(GifFileType *GifFile)
 {
@@ -773,25 +773,25 @@ static int EGifSetupCompress(GifFileType *GifFile)
 
     /* Test and see what color map to use, and from it # bits per pixel: */
     if (GifFile->Image.ColorMap)
-	BitsPerPixel = GifFile->Image.ColorMap->BitsPerPixel;
+        BitsPerPixel = GifFile->Image.ColorMap->BitsPerPixel;
     else if (GifFile->SColorMap)
-	BitsPerPixel = GifFile->SColorMap->BitsPerPixel;
+        BitsPerPixel = GifFile->SColorMap->BitsPerPixel;
     else {
-	_GifError = E_GIF_ERR_NO_COLOR_MAP;
-	return GIF_ERROR;
+        _GifError = E_GIF_ERR_NO_COLOR_MAP;
+        return GIF_ERROR;
     }
 
     Buf = BitsPerPixel = (BitsPerPixel < 2 ? 2 : BitsPerPixel);
     WRITE(GifFile, &Buf, 1);     /* Write the Code size to file. */
 
-    Private->Buf[0] = 0;			  /* Nothing was output yet. */
+    Private->Buf[0] = 0;                          /* Nothing was output yet. */
     Private->BitsPerPixel = BitsPerPixel;
     Private->ClearCode = (1 << BitsPerPixel);
     Private->EOFCode = Private->ClearCode + 1;
     Private->RunningCode = Private->EOFCode + 1;
-    Private->RunningBits = BitsPerPixel + 1;	 /* Number of bits per code. */
-    Private->MaxCode1 = 1 << Private->RunningBits;	   /* Max. code + 1. */
-    Private->CrntCode = FIRST_CODE;	   /* Signal that this is first one! */
+    Private->RunningBits = BitsPerPixel + 1;     /* Number of bits per code. */
+    Private->MaxCode1 = 1 << Private->RunningBits;         /* Max. code + 1. */
+    Private->CrntCode = FIRST_CODE;        /* Signal that this is first one! */
     Private->CrntShiftState = 0;      /* No information in CrntShiftDWord. */
     Private->CrntShiftDWord = 0;
 
@@ -799,20 +799,20 @@ static int EGifSetupCompress(GifFileType *GifFile)
     _ClearHashTable(Private->HashTable);
 
     if (EGifCompressOutput(GifFile, Private->ClearCode) == GIF_ERROR) {
-	_GifError = E_GIF_ERR_DISK_IS_FULL;
-	return GIF_ERROR;
+        _GifError = E_GIF_ERR_DISK_IS_FULL;
+        return GIF_ERROR;
     }
     return GIF_OK;
 }
 
 /******************************************************************************
-*   The LZ compression routine:						      *
-*   This version compress the given buffer Line of length LineLen.	      *
+*   The LZ compression routine:                                               *
+*   This version compress the given buffer Line of length LineLen.            *
 *   This routine can be called few times (one per scan line, for example), in *
-* order the complete the whole image.					      *
+* order the complete the whole image.                                         *
 ******************************************************************************/
 static int EGifCompressLine(GifFileType *GifFile, GifPixelType *Line,
-								int LineLen)
+                                                                int LineLen)
 {
     int i = 0, CrntCode, NewCode;
     unsigned long NewKey;
@@ -822,13 +822,13 @@ static int EGifCompressLine(GifFileType *GifFile, GifPixelType *Line,
 
     HashTable = Private->HashTable;
 
-    if (Private->CrntCode == FIRST_CODE)		  /* Its first time! */
-	CrntCode = Line[i++];
+    if (Private->CrntCode == FIRST_CODE)                  /* Its first time! */
+        CrntCode = Line[i++];
     else
         CrntCode = Private->CrntCode;     /* Get last code in compression. */
 
-    while (i < LineLen) {			    /* Decode LineLen items. */
-	Pixel = Line[i++];		      /* Get next pixel from stream. */
+    while (i < LineLen) {                           /* Decode LineLen items. */
+        Pixel = Line[i++];                    /* Get next pixel from stream. */
        /* Form a new unique key to search hash table for the code combines  */
        /* CrntCode as Prefix string with Pixel as postfix char.             */
        NewKey = (((unsigned long) CrntCode) << 8) + Pixel;
@@ -874,21 +874,21 @@ static int EGifCompressLine(GifFileType *GifFile, GifPixelType *Line,
 
     if (Private->PixelCount == 0)
     {
-	/* We are done - output last Code and flush output buffers: */
-	if (EGifCompressOutput(GifFile, CrntCode)
-	    == GIF_ERROR) {
-	    _GifError = E_GIF_ERR_DISK_IS_FULL;
-	    return GIF_ERROR;
-	}
-	if (EGifCompressOutput(GifFile, Private->EOFCode)
-	    == GIF_ERROR) {
-	    _GifError = E_GIF_ERR_DISK_IS_FULL;
-	    return GIF_ERROR;
-	}
-	if (EGifCompressOutput(GifFile, FLUSH_OUTPUT) == GIF_ERROR) {
-	    _GifError = E_GIF_ERR_DISK_IS_FULL;
-	    return GIF_ERROR;
-	}
+        /* We are done - output last Code and flush output buffers: */
+        if (EGifCompressOutput(GifFile, CrntCode)
+            == GIF_ERROR) {
+            _GifError = E_GIF_ERR_DISK_IS_FULL;
+            return GIF_ERROR;
+        }
+        if (EGifCompressOutput(GifFile, Private->EOFCode)
+            == GIF_ERROR) {
+            _GifError = E_GIF_ERR_DISK_IS_FULL;
+            return GIF_ERROR;
+        }
+        if (EGifCompressOutput(GifFile, FLUSH_OUTPUT) == GIF_ERROR) {
+            _GifError = E_GIF_ERR_DISK_IS_FULL;
+            return GIF_ERROR;
+        }
     }
 
     return GIF_OK;
@@ -906,30 +906,30 @@ static int EGifCompressOutput(GifFileType *GifFile, int Code)
     int retval = GIF_OK;
 
     if (Code == FLUSH_OUTPUT) {
-	while (Private->CrntShiftState > 0) {
-	    /* Get Rid of what is left in DWord, and flush it. */
-	    if (EGifBufferedOutput(GifFile, Private->Buf,
-		Private->CrntShiftDWord & 0xff) == GIF_ERROR)
-		    retval = GIF_ERROR;
-	    Private->CrntShiftDWord >>= 8;
-	    Private->CrntShiftState -= 8;
-	}
-	Private->CrntShiftState = 0;			   /* For next time. */
-	if (EGifBufferedOutput(GifFile, Private->Buf,
-	    FLUSH_OUTPUT) == GIF_ERROR)
-    	        retval = GIF_ERROR;
+        while (Private->CrntShiftState > 0) {
+            /* Get Rid of what is left in DWord, and flush it. */
+            if (EGifBufferedOutput(GifFile, Private->Buf,
+                Private->CrntShiftDWord & 0xff) == GIF_ERROR)
+                    retval = GIF_ERROR;
+            Private->CrntShiftDWord >>= 8;
+            Private->CrntShiftState -= 8;
+        }
+        Private->CrntShiftState = 0;                       /* For next time. */
+        if (EGifBufferedOutput(GifFile, Private->Buf,
+            FLUSH_OUTPUT) == GIF_ERROR)
+                retval = GIF_ERROR;
     }
     else {
-	Private->CrntShiftDWord |= ((long) Code) << Private->CrntShiftState;
-	Private->CrntShiftState += Private->RunningBits;
-	while (Private->CrntShiftState >= 8) {
-	    /* Dump out full bytes: */
-	    if (EGifBufferedOutput(GifFile, Private->Buf,
-		Private->CrntShiftDWord & 0xff) == GIF_ERROR)
-		    retval = GIF_ERROR;
-	    Private->CrntShiftDWord >>= 8;
-	    Private->CrntShiftState -= 8;
-	}
+        Private->CrntShiftDWord |= ((long) Code) << Private->CrntShiftState;
+        Private->CrntShiftState += Private->RunningBits;
+        while (Private->CrntShiftState >= 8) {
+            /* Dump out full bytes: */
+            if (EGifBufferedOutput(GifFile, Private->Buf,
+                Private->CrntShiftDWord & 0xff) == GIF_ERROR)
+                    retval = GIF_ERROR;
+            Private->CrntShiftDWord >>= 8;
+            Private->CrntShiftState -= 8;
+        }
     }
 
     /* If code cannt fit into RunningBits bits, must raise its size. Note */
@@ -943,38 +943,38 @@ static int EGifCompressOutput(GifFileType *GifFile, int Code)
 
 /******************************************************************************
 *   This routines buffers the given characters until 255 characters are ready *
-* to be output. If Code is equal to -1 the buffer is flushed (EOF).	      *
+* to be output. If Code is equal to -1 the buffer is flushed (EOF).           *
 *   The buffer is Dumped with first byte as its size, as GIF format requires. *
-*   Returns GIF_OK if written succesfully.				      *
+*   Returns GIF_OK if written succesfully.                                    *
 ******************************************************************************/
 static int EGifBufferedOutput(GifFileType *GifFile, GifByteType *Buf, int c)
 {
     if (c == FLUSH_OUTPUT) {
-	/* Flush everything out. */
-	if (Buf[0] != 0 && WRITE(GifFile, Buf, Buf[0]+1) != (unsigned)(Buf[0] + 1))
-	{
-	    _GifError = E_GIF_ERR_WRITE_FAILED;
-	    return GIF_ERROR;
-	}
-	/* Mark end of compressed data, by an empty block (see GIF doc): */
-	Buf[0] = 0;
-	if (WRITE(GifFile, Buf, 1) != 1)
-	{
-	    _GifError = E_GIF_ERR_WRITE_FAILED;
-	    return GIF_ERROR;
-	}
+        /* Flush everything out. */
+        if (Buf[0] != 0 && WRITE(GifFile, Buf, Buf[0]+1) != (unsigned)(Buf[0] + 1))
+        {
+            _GifError = E_GIF_ERR_WRITE_FAILED;
+            return GIF_ERROR;
+        }
+        /* Mark end of compressed data, by an empty block (see GIF doc): */
+        Buf[0] = 0;
+        if (WRITE(GifFile, Buf, 1) != 1)
+        {
+            _GifError = E_GIF_ERR_WRITE_FAILED;
+            return GIF_ERROR;
+        }
     }
     else {
-	if (Buf[0] == 255) {
-	    /* Dump out this buffer - it is full: */
-	    if (WRITE(GifFile, Buf, Buf[0] + 1) != (unsigned)(Buf[0] + 1))
-	    {
-		_GifError = E_GIF_ERR_WRITE_FAILED;
-		return GIF_ERROR;
-	    }
-	    Buf[0] = 0;
-	}
-	Buf[++Buf[0]] = c;
+        if (Buf[0] == 255) {
+            /* Dump out this buffer - it is full: */
+            if (WRITE(GifFile, Buf, Buf[0] + 1) != (unsigned)(Buf[0] + 1))
+            {
+                _GifError = E_GIF_ERR_WRITE_FAILED;
+                return GIF_ERROR;
+            }
+            Buf[0] = 0;
+        }
+        Buf[++Buf[0]] = c;
     }
 
     return GIF_OK;
@@ -987,9 +987,9 @@ static void QuitGifError(GifFileType *GifFile)
 }
 
 static void SaveGif(FILE *fp,
-		    GifByteType *OutputBuffer,
-		    ColorMapObject *OutputColorMap,
-		    int ExpColorMapSize, int Width, int Height){
+                    GifByteType *OutputBuffer,
+                    ColorMapObject *OutputColorMap,
+                    int ExpColorMapSize, int Width, int Height){
   int i;
   GifFileType *GifFile;
   GifByteType *Ptr;
@@ -1054,8 +1054,8 @@ void create_gif(FILE *fp, int width, int height){
   }
 
   if (QuantizeBuffer(width, height, &ColorMapSize,
-		     RedBuffer, GreenBuffer, BlueBuffer,
-		     OutputBuffer, OutputColorMap->Colors) == GIF_ERROR)
+                     RedBuffer, GreenBuffer, BlueBuffer,
+                     OutputBuffer, OutputColorMap->Colors) == GIF_ERROR)
     fprintf(stderr, "Warning: Quantize Buffer Failed\n");
 
   free(RedBuffer);
diff --git a/Graphics/gl2gif.h b/Graphics/gl2gif.h
index b727e93dd6..882fab9092 100644
--- a/Graphics/gl2gif.h
+++ b/Graphics/gl2gif.h
@@ -1,77 +1,77 @@
-/* $Id: gl2gif.h,v 1.2 2000-11-23 14:11:33 geuzaine Exp $ */
+/* $Id: gl2gif.h,v 1.3 2000-11-26 15:43:46 geuzaine Exp $ */
 #ifndef _GL2GIF_H_
 #define _GL2GIF_H_
 
-#define	GIF_ERROR	0
-#define GIF_OK		1
+#define GIF_ERROR       0
+#define GIF_OK          1
 
 #ifndef TRUE
-#define TRUE		1
-#define FALSE		0
+#define TRUE            1
+#define FALSE           0
 #endif
 
 #define VoidPtr void *
 
-typedef	unsigned char	GifPixelType;
-typedef unsigned char	GifByteType;
+typedef unsigned char   GifPixelType;
+typedef unsigned char   GifByteType;
 
 typedef struct GifColorType {
   GifByteType Red, Green, Blue;
 } GifColorType;
 
 typedef struct ColorMapObject{
-  int	ColorCount;
+  int   ColorCount;
   int BitsPerPixel;
-  GifColorType *Colors;	 /* on malloc(3) heap */
+  GifColorType *Colors;  /* on malloc(3) heap */
 } ColorMapObject;
 
 typedef struct GifImageDesc {
   int Left, Top, Width, Height ; /* Current image dimensions. */
-  int Interlace;		 /* Sequential/Interlaced lines. */
-  ColorMapObject *ColorMap;	 /* The local color map */
+  int Interlace;                 /* Sequential/Interlaced lines. */
+  ColorMapObject *ColorMap;      /* The local color map */
 } GifImageDesc;
 
 typedef struct GifFileType {
-  int SWidth, SHeight;		  /* Screen dimensions. */
-  int SColorResolution; 	  /* How many colors can we generate? */
-  int SBackGroundColor;		  /* I hope you understand this one... */
-  ColorMapObject *SColorMap;	  /* NULL if not exists. */
-  int ImageCount;		  /* Number of current image */
-  GifImageDesc Image;		  /* Block describing current image */
-  VoidPtr Private;	  	  /* Don't mess with this! */
+  int SWidth, SHeight;            /* Screen dimensions. */
+  int SColorResolution;           /* How many colors can we generate? */
+  int SBackGroundColor;           /* I hope you understand this one... */
+  ColorMapObject *SColorMap;      /* NULL if not exists. */
+  int ImageCount;                 /* Number of current image */
+  GifImageDesc Image;             /* Block describing current image */
+  VoidPtr Private;                /* Don't mess with this! */
 } GifFileType;
 
 typedef enum {
   UNDEFINED_RECORD_TYPE,
   SCREEN_DESC_RECORD_TYPE,
-  IMAGE_DESC_RECORD_TYPE,	/* Begin with ',' */
-  TERMINATE_RECORD_TYPE		/* Begin with ';' */
+  IMAGE_DESC_RECORD_TYPE,       /* Begin with ',' */
+  TERMINATE_RECORD_TYPE         /* Begin with ';' */
 } GifRecordType;
 
-#define HT_SIZE			8192	   /* 12bits = 4096 or twice as big! */
-#define HT_KEY_MASK		0x1FFF			      /* 13bits keys */
-#define HT_KEY_NUM_BITS		13			      /* 13bits keys */
-#define HT_MAX_KEY		8191	/* 13bits - 1, maximal code possible */
-#define HT_MAX_CODE		4095	/* Biggest code possible in 12 bits. */
+#define HT_SIZE                 8192       /* 12bits = 4096 or twice as big! */
+#define HT_KEY_MASK             0x1FFF                        /* 13bits keys */
+#define HT_KEY_NUM_BITS         13                            /* 13bits keys */
+#define HT_MAX_KEY              8191    /* 13bits - 1, maximal code possible */
+#define HT_MAX_CODE             4095    /* Biggest code possible in 12 bits. */
 
 /* The 32 bits of the long are divided into two parts for the key & code:   */
 /* 1. The code is 12 bits as our compression algorithm is limited to 12bits */
-/* 2. The key is 12 bits Prefix code + 8 bit new char or 20 bits.	    */
-#define HT_GET_KEY(l)	(l >> 12)
-#define HT_GET_CODE(l)	(l & 0x0FFF)
-#define HT_PUT_KEY(l)	(l << 12)
-#define HT_PUT_CODE(l)	(l & 0x0FFF)
+/* 2. The key is 12 bits Prefix code + 8 bit new char or 20 bits.           */
+#define HT_GET_KEY(l)   (l >> 12)
+#define HT_GET_CODE(l)  (l & 0x0FFF)
+#define HT_PUT_KEY(l)   (l << 12)
+#define HT_PUT_CODE(l)  (l & 0x0FFF)
 
 typedef struct GifHashTableType {
   unsigned long HTable[HT_SIZE];
 } GifHashTableType;
 
-#define LZ_MAX_CODE	4095		/* Biggest code possible in 12 bits. */
-#define LZ_BITS		12
+#define LZ_MAX_CODE     4095            /* Biggest code possible in 12 bits. */
+#define LZ_BITS         12
 
-#define FLUSH_OUTPUT		4096    /* Impossible code, to signal flush. */
-#define FIRST_CODE		4097    /* Impossible code, to signal first. */
-#define NO_SUCH_CODE		4098    /* Impossible code, to signal empty. */
+#define FLUSH_OUTPUT            4096    /* Impossible code, to signal flush. */
+#define FIRST_CODE              4097    /* Impossible code, to signal first. */
+#define NO_SUCH_CODE            4098    /* Impossible code, to signal empty. */
 
 #define FILE_STATE_WRITE    0x01
 #define FILE_STATE_SCREEN   0x02
@@ -83,38 +83,38 @@ typedef struct GifHashTableType {
 
 typedef struct GifFilePrivateType {
   int FileState;
-  int   FileHandle;			     /* Where all this data goes to! */
-  int   BitsPerPixel;	    /* Bits per pixel (Codes uses at least this + 1). */
-  int   ClearCode;				       /* The CLEAR LZ code. */
-  int   EOFCode;				         /* The EOF LZ code. */
-  int   RunningCode;		    /* The next code algorithm can generate. */
+  int   FileHandle;                          /* Where all this data goes to! */
+  int   BitsPerPixel;       /* Bits per pixel (Codes uses at least this + 1). */
+  int   ClearCode;                                     /* The CLEAR LZ code. */
+  int   EOFCode;                                         /* The EOF LZ code. */
+  int   RunningCode;                /* The next code algorithm can generate. */
   int   RunningBits;/* The number of bits required to represent RunningCode. */
   int   MaxCode1;  /* 1 bigger than max. possible code, in RunningBits bits. */
-  int   LastCode;		        /* The code before the current code. */
-  int   CrntCode;				  /* Current algorithm code. */
-  int   StackPtr;		         /* For character stack (see below). */
-  int   CrntShiftState;		        /* Number of bits in CrntShiftDWord. */
+  int   LastCode;                       /* The code before the current code. */
+  int   CrntCode;                                 /* Current algorithm code. */
+  int   StackPtr;                        /* For character stack (see below). */
+  int   CrntShiftState;                 /* Number of bits in CrntShiftDWord. */
   unsigned long CrntShiftDWord;     /* For bytes decomposition into codes. */
-  unsigned long PixelCount;		       /* Number of pixels in image. */
-  FILE *File;						  /* File as stream. */
-  GifByteType Buf[256];	       /* Compressed input is buffered here. */
-  GifByteType Stack[LZ_MAX_CODE];	 /* Decoded pixels are stacked here. */
-  GifByteType Suffix[LZ_MAX_CODE+1];	       /* So we can trace the codes. */
+  unsigned long PixelCount;                    /* Number of pixels in image. */
+  FILE *File;                                             /* File as stream. */
+  GifByteType Buf[256];        /* Compressed input is buffered here. */
+  GifByteType Stack[LZ_MAX_CODE];        /* Decoded pixels are stacked here. */
+  GifByteType Suffix[LZ_MAX_CODE+1];           /* So we can trace the codes. */
   int Prefix[LZ_MAX_CODE+1];
   GifHashTableType *HashTable;
 } GifFilePrivateType;
 
 
-#define	E_GIF_ERR_OPEN_FAILED	1		/* And EGif possible errors. */
-#define	E_GIF_ERR_WRITE_FAILED	2
-#define E_GIF_ERR_HAS_SCRN_DSCR	3
-#define E_GIF_ERR_HAS_IMAG_DSCR	4
-#define E_GIF_ERR_NO_COLOR_MAP	5
-#define E_GIF_ERR_DATA_TOO_BIG	6
+#define E_GIF_ERR_OPEN_FAILED   1               /* And EGif possible errors. */
+#define E_GIF_ERR_WRITE_FAILED  2
+#define E_GIF_ERR_HAS_SCRN_DSCR 3
+#define E_GIF_ERR_HAS_IMAG_DSCR 4
+#define E_GIF_ERR_NO_COLOR_MAP  5
+#define E_GIF_ERR_DATA_TOO_BIG  6
 #define E_GIF_ERR_NOT_ENOUGH_MEM 7
-#define E_GIF_ERR_DISK_IS_FULL	8
-#define E_GIF_ERR_CLOSE_FAILED	9
-#define E_GIF_ERR_NOT_WRITEABLE	10
+#define E_GIF_ERR_DISK_IS_FULL  8
+#define E_GIF_ERR_CLOSE_FAILED  9
+#define E_GIF_ERR_NOT_WRITEABLE 10
 
 /* Provate functions */
 
@@ -126,17 +126,17 @@ int _ExistsHashTable(GifHashTableType *HashTable, unsigned long Key);
 GifFileType *EGifOpenFileHandle(int GifFileHandle);
 void EGifSetGifVersion(char *Version);
 int EGifPutScreenDesc(GifFileType *GifFile,
-		      int GifWidth, int GifHeight, int GifColorRes, int GifBackGround,
-		      ColorMapObject *GifColorMap);
+                      int GifWidth, int GifHeight, int GifColorRes, int GifBackGround,
+                      ColorMapObject *GifColorMap);
 int EGifPutImageDesc(GifFileType *GifFile,
-		     int GifLeft, int GifTop, int Width, int GifHeight, int GifInterlace,
-		     ColorMapObject *GifColorMap);
+                     int GifLeft, int GifTop, int Width, int GifHeight, int GifInterlace,
+                     ColorMapObject *GifColorMap);
 int EGifPutLine(GifFileType *GifFile, GifPixelType *GifLine, int GifLineLen);
 int EGifCloseFile(GifFileType *GifFile);
 
 int QuantizeBuffer(int Width, int Height, int *ColorMapSize,
-		   GifByteType *RedInput, GifByteType *GreenInput, GifByteType *BlueInput,
-		   GifByteType *OutputBuffer, GifColorType *OutputColorMap);
+                   GifByteType *RedInput, GifByteType *GreenInput, GifByteType *BlueInput,
+                   GifByteType *OutputBuffer, GifColorType *OutputColorMap);
 
 extern void PrintGifError(void);
 extern int GifLastError(void);
diff --git a/Graphics/gl2ps.cpp b/Graphics/gl2ps.cpp
index 8ff08ef04b..a60d9c9dc7 100644
--- a/Graphics/gl2ps.cpp
+++ b/Graphics/gl2ps.cpp
@@ -1,4 +1,4 @@
-/* $Id: gl2ps.cpp,v 1.2 2000-11-23 14:11:33 geuzaine Exp $ */
+/* $Id: gl2ps.cpp,v 1.3 2000-11-26 15:43:46 geuzaine Exp $ */
 /*
  * GL2PS, an OpenGL to Postscript Printing Library, version 0.31
  * Copyright (C) 1999-2000  Christophe Geuzaine 
@@ -83,7 +83,7 @@ GLvoid gl2psListRealloc(GL2PSlist *list, GLint n){
     if(n > list->nmax){
       list->nmax = ((n - 1) / list->incr + 1) * list->incr;
       list->array = (char *)gl2psRealloc(list->array,
-					 list->nmax * list->size);
+                                         list->nmax * list->size);
     }
 }
 
@@ -124,12 +124,12 @@ GLvoid *gl2psListPointer(GL2PSlist *list, GLint index){
 }
 
 GLvoid gl2psListSort(GL2PSlist *list,
-		     GLint (*fcmp)(const GLvoid *a, const GLvoid *b)){
+                     GLint (*fcmp)(const GLvoid *a, const GLvoid *b)){
   qsort(list->array, list->n, list->size, fcmp);
 }
 
 GLvoid gl2psListAction(GL2PSlist *list, 
-		       GLvoid (*action)(GLvoid *data, GLvoid *dummy)){
+                       GLvoid (*action)(GLvoid *data, GLvoid *dummy)){
   GLint i, dummy;
 
   for(i=0 ; i<gl2psListNbr(list) ; i++)
@@ -137,7 +137,7 @@ GLvoid gl2psListAction(GL2PSlist *list,
 }
 
 GLvoid gl2psListActionInverse(GL2PSlist *list, 
-			      GLvoid (*action)(GLvoid *data, GLvoid *dummy)){
+                              GLvoid (*action)(GLvoid *data, GLvoid *dummy)){
   GLint i, dummy;
 
   for(i=gl2psListNbr(list) ; i>0 ; i--)
@@ -146,9 +146,9 @@ GLvoid gl2psListActionInverse(GL2PSlist *list,
 
 GLfloat gl2psComparePointPlane(GL2PSxyz point, GL2PSplane plane){
   return(plane[0] * point[0] + 
-	 plane[1] * point[1] + 
-	 plane[2] * point[2] + 
-	 plane[3]);
+         plane[1] * point[1] + 
+         plane[2] * point[2] + 
+         plane[3]);
 }
 
 GLfloat gl2psPsca(GLfloat *a, GLfloat *b){
@@ -197,9 +197,9 @@ GLvoid gl2psGetPlane(GL2PSprimitive *prim, GL2PSplane plane){
     else{
       gl2psGetNormal(v, w, plane);
       plane[3] = 
-	- plane[0] * prim->verts[0].xyz[0] 
-	- plane[1] * prim->verts[0].xyz[1] 
-	- plane[2] * prim->verts[0].xyz[2];
+        - plane[0] * prim->verts[0].xyz[0] 
+        - plane[1] * prim->verts[0].xyz[1] 
+        - plane[2] * prim->verts[0].xyz[2];
     }
     break;
   case GL2PS_LINE :
@@ -217,9 +217,9 @@ GLvoid gl2psGetPlane(GL2PSprimitive *prim, GL2PSplane plane){
       else           w[2] = 1.;
       gl2psGetNormal(v, w, plane);
       plane[3] = 
-	- plane[0] * prim->verts[0].xyz[0] 
-	- plane[1] * prim->verts[0].xyz[1] 
-	- plane[2] * prim->verts[0].xyz[2];
+        - plane[0] * prim->verts[0].xyz[0] 
+        - plane[1] * prim->verts[0].xyz[1] 
+        - plane[2] * prim->verts[0].xyz[2];
     }
     break;
   case GL2PS_POINT :
@@ -234,7 +234,7 @@ GLvoid gl2psGetPlane(GL2PSprimitive *prim, GL2PSplane plane){
 }
 
 GLvoid gl2psCutEdge(GL2PSvertex a, GL2PSvertex b, GL2PSplane plane, 
-		    GL2PSvertex *c){
+                    GL2PSvertex *c){
   GL2PSxyz v;
   GLfloat  sect;
 
@@ -266,8 +266,8 @@ GLvoid gl2psFreePrimitive(GLvoid *a, GLvoid *b){
 }
 
 GLvoid gl2psCreateSplittedPrimitive(GL2PSprimitive *parent, GL2PSplane plane,
-				    GL2PSprimitive **child, GLshort numverts,
-				    GLshort *index0, GLshort *index1){
+                                    GL2PSprimitive **child, GLshort numverts,
+                                    GLshort *index0, GLshort *index1){
   GLshort i;
 
   if(numverts > 4){
@@ -291,12 +291,12 @@ GLvoid gl2psCreateSplittedPrimitive(GL2PSprimitive *parent, GL2PSplane plane,
       (*child)->verts[i] = parent->verts[index0[i]];
     else
       gl2psCutEdge(parent->verts[index0[i]], parent->verts[index1[i]], 
-		   plane, &(*child)->verts[i]);
+                   plane, &(*child)->verts[i]);
   }
 }
 
 GLvoid gl2psAddIndex(GLshort *index0, GLshort *index1, GLshort *nb, 
-		     GLshort i, GLshort j){
+                     GLshort i, GLshort j){
   GLint k;
 
   for(k=0 ; k<*nb ; k++)
@@ -327,14 +327,14 @@ GLint gl2psTestSplitPrimitive(GL2PSprimitive *prim, GL2PSplane plane){
     for(i = 0 ; i < prim->numverts ; i++){
       j = gl2psGetIndex(i, prim->numverts);
       if(d[j] > GL2PS_EPSILON){
-	if(type == GL2PS_COINCIDENT)      type = GL2PS_IN_BACK_OF;
-	else if(type != GL2PS_IN_BACK_OF) return 1; 
-	if(d[i] < -GL2PS_EPSILON)	  return 1;
+        if(type == GL2PS_COINCIDENT)      type = GL2PS_IN_BACK_OF;
+        else if(type != GL2PS_IN_BACK_OF) return 1; 
+        if(d[i] < -GL2PS_EPSILON)         return 1;
       }
       else if(d[j] < -GL2PS_EPSILON){
-	if(type == GL2PS_COINCIDENT)       type = GL2PS_IN_FRONT_OF;   
-	else if(type != GL2PS_IN_FRONT_OF) return 1;
-	if(d[i] > GL2PS_EPSILON)           return 1;
+        if(type == GL2PS_COINCIDENT)       type = GL2PS_IN_FRONT_OF;   
+        else if(type != GL2PS_IN_FRONT_OF) return 1;
+        if(d[i] > GL2PS_EPSILON)           return 1;
       }
     }
   }
@@ -342,7 +342,7 @@ GLint gl2psTestSplitPrimitive(GL2PSprimitive *prim, GL2PSplane plane){
 }
 
 GLint gl2psSplitPrimitive(GL2PSprimitive *prim, GL2PSplane plane, 
-			  GL2PSprimitive **front, GL2PSprimitive **back){
+                          GL2PSprimitive **front, GL2PSprimitive **back){
   GLshort  i, j, in=0, out=0, in0[5], in1[5], out0[5], out1[5];
   GLint    type;
   GLfloat  d[5]; 
@@ -363,28 +363,28 @@ GLint gl2psSplitPrimitive(GL2PSprimitive *prim, GL2PSplane plane,
     for(i = 0 ; i < prim->numverts ; i++){
       j = gl2psGetIndex(i, prim->numverts);
       if(d[j] > GL2PS_EPSILON){
-	if(type == GL2PS_COINCIDENT)      type = GL2PS_IN_BACK_OF;
-	else if(type != GL2PS_IN_BACK_OF) type = GL2PS_SPANNING; 
-	if(d[i] < -GL2PS_EPSILON){
-	  gl2psAddIndex(in0, in1, &in, i, j);
-	  gl2psAddIndex(out0, out1, &out, i, j);
-	  type = GL2PS_SPANNING;
-	}
-	gl2psAddIndex(out0, out1, &out, j, -1);
+        if(type == GL2PS_COINCIDENT)      type = GL2PS_IN_BACK_OF;
+        else if(type != GL2PS_IN_BACK_OF) type = GL2PS_SPANNING; 
+        if(d[i] < -GL2PS_EPSILON){
+          gl2psAddIndex(in0, in1, &in, i, j);
+          gl2psAddIndex(out0, out1, &out, i, j);
+          type = GL2PS_SPANNING;
+        }
+        gl2psAddIndex(out0, out1, &out, j, -1);
       }
       else if(d[j] < -GL2PS_EPSILON){
-	if(type == GL2PS_COINCIDENT)       type = GL2PS_IN_FRONT_OF;   
-	else if(type != GL2PS_IN_FRONT_OF) type = GL2PS_SPANNING;
-	if(d[i] > GL2PS_EPSILON){
-	  gl2psAddIndex(in0, in1, &in, i, j);
-	  gl2psAddIndex(out0, out1, &out, i, j);
-	  type = GL2PS_SPANNING;
-	}
-	gl2psAddIndex(in0, in1, &in, j, -1);
+        if(type == GL2PS_COINCIDENT)       type = GL2PS_IN_FRONT_OF;   
+        else if(type != GL2PS_IN_FRONT_OF) type = GL2PS_SPANNING;
+        if(d[i] > GL2PS_EPSILON){
+          gl2psAddIndex(in0, in1, &in, i, j);
+          gl2psAddIndex(out0, out1, &out, i, j);
+          type = GL2PS_SPANNING;
+        }
+        gl2psAddIndex(in0, in1, &in, j, -1);
       }
       else{
-	gl2psAddIndex(in0, in1, &in, j, -1);
-	gl2psAddIndex(out0, out1, &out, j, -1);
+        gl2psAddIndex(in0, in1, &in, j, -1);
+        gl2psAddIndex(out0, out1, &out, j, -1);
       }
     }
     break;
@@ -401,7 +401,7 @@ GLint gl2psSplitPrimitive(GL2PSprimitive *prim, GL2PSplane plane,
 }
 
 GLvoid gl2psDivideQuad(GL2PSprimitive *quad, 
-		       GL2PSprimitive **t1, GL2PSprimitive **t2){
+                       GL2PSprimitive **t1, GL2PSprimitive **t2){
   *t1 = (GL2PSprimitive*)gl2psMalloc(sizeof(GL2PSprimitive));
   *t2 = (GL2PSprimitive*)gl2psMalloc(sizeof(GL2PSprimitive));
   (*t1)->type = (*t2)->type = GL2PS_TRIANGLE;
@@ -455,17 +455,17 @@ GLint gl2psFindRoot(GL2PSlist *primitives, GL2PSprimitive **root){
       gl2psGetPlane(prim1, plane);
       count=0;
       for(j=0 ; j<gl2psListNbr(primitives) ; j++){
-	if(j != i){
-	  prim2 = *(GL2PSprimitive**)gl2psListPointer(primitives, j);
-	  count += gl2psTestSplitPrimitive(prim2, plane); 
-	}
-	if(count > best) break;
+        if(j != i){
+          prim2 = *(GL2PSprimitive**)gl2psListPointer(primitives, j);
+          count += gl2psTestSplitPrimitive(prim2, plane); 
+        }
+        if(count > best) break;
       }
       if(count < best){
-	best = count;
-	index = i;
-	*root = prim1;
-	if(!count) return index;
+        best = count;
+        index = i;
+        *root = prim1;
+        if(!count) return index;
       }
     }
     if(index) printf("GL2PS_BEST_ROOT was worth it: %d\n", index);
@@ -513,19 +513,19 @@ GLvoid gl2psBuildBspTree(GL2PSbsptree *tree, GL2PSlist *primitives){
       prim = *(GL2PSprimitive**)gl2psListPointer(primitives,i);
       switch(gl2psSplitPrimitive(prim,tree->plane,&frontprim,&backprim)){
       case GL2PS_COINCIDENT:
-	gl2psAddPrimitiveInList(prim, tree->primitives);
-	break;
+        gl2psAddPrimitiveInList(prim, tree->primitives);
+        break;
       case GL2PS_IN_BACK_OF:
-	gl2psAddPrimitiveInList(prim, backlist);
-	break;
+        gl2psAddPrimitiveInList(prim, backlist);
+        break;
       case GL2PS_IN_FRONT_OF:
-	gl2psAddPrimitiveInList(prim, frontlist);
-	break;
+        gl2psAddPrimitiveInList(prim, frontlist);
+        break;
       case GL2PS_SPANNING:
-	gl2psAddPrimitiveInList(backprim, backlist);
-	gl2psAddPrimitiveInList(frontprim, frontlist);
-	gl2psFreePrimitive(&prim, NULL);
-	break;
+        gl2psAddPrimitiveInList(backprim, backlist);
+        gl2psAddPrimitiveInList(frontprim, frontlist);
+        gl2psFreePrimitive(&prim, NULL);
+        break;
       }
     }
   }
@@ -547,8 +547,8 @@ GLvoid gl2psBuildBspTree(GL2PSbsptree *tree, GL2PSlist *primitives){
 }
 
 GLvoid  gl2psTraverseBspTree(GL2PSbsptree *tree, GL2PSxyz eye, GLfloat epsilon,
-			     GLboolean (*compare)(GLfloat f1, GLfloat f2),
-			     GLvoid (*action)(GLvoid *data, GLvoid *dummy)){
+                             GLboolean (*compare)(GLfloat f1, GLfloat f2),
+                             GLvoid (*action)(GLvoid *data, GLvoid *dummy)){
   GLfloat result;
 
   if(!tree) return;
@@ -640,7 +640,7 @@ GLvoid  gl2psReset(GL2PSbsptree2d *tree){
 static GL2PSbsptree2d *image=NULL;
 
 GLvoid gl2psAddInImageTree(GL2PSprimitive *prim, 
-			   GL2PSxyz a, GL2PSxyz b, GL2PSbsptree2d **tree){
+                           GL2PSxyz a, GL2PSxyz b, GL2PSbsptree2d **tree){
   GLint res;
 
   if(*tree == NULL){
@@ -694,7 +694,7 @@ GLvoid gl2psAddInImage(void *a, void *b){
     for(i=0 ; i<prim->numverts ; i++){
       count++;
       gl2psAddInImageTree(prim, prim->verts[i].xyz, 
-			  prim->verts[gl2psGetIndex(i,prim->numverts)].xyz, &image);
+                          prim->verts[gl2psGetIndex(i,prim->numverts)].xyz, &image);
     }
   }
 
@@ -794,33 +794,33 @@ GLvoid gl2psPrintPrimitive(GLvoid *a, GLvoid *b){
   switch(prim->type){
   case GL2PS_TEXT :
     fprintf(gl2ps.stream, "(%s) %g %g %g %g %g %d /%s S\n",
-	    prim->text->str, prim->verts[0].xyz[0], prim->verts[0].xyz[1],
-	    prim->verts[0].rgba[0], prim->verts[0].rgba[1], 
-	    prim->verts[0].rgba[2], prim->text->fontsize, 
-	    prim->text->fontname);
+            prim->text->str, prim->verts[0].xyz[0], prim->verts[0].xyz[1],
+            prim->verts[0].rgba[0], prim->verts[0].rgba[1], 
+            prim->verts[0].rgba[2], prim->text->fontsize, 
+            prim->text->fontname);
     break;
   case GL2PS_POINT :
     fprintf(gl2ps.stream, "%g %g %g %g %g P\n", prim->verts[0].xyz[0],
-	    prim->verts[0].xyz[1], prim->verts[0].rgba[0],
-	    prim->verts[0].rgba[1], prim->verts[0].rgba[2]);
+            prim->verts[0].xyz[1], prim->verts[0].rgba[0],
+            prim->verts[0].rgba[1], prim->verts[0].rgba[2]);
     break;
   case GL2PS_LINE :
     if(prim->dash)
       fprintf(gl2ps.stream, "[%d] 0 setdash\n", prim->dash);
     if(gl2ps.shade){
       fprintf(gl2ps.stream, "%g %g %g %g %g %g %g %g %g %g SL\n",
-	      prim->verts[1].xyz[0], prim->verts[1].xyz[1],
-	      prim->verts[1].rgba[0], prim->verts[1].rgba[1],
-	      prim->verts[1].rgba[2], prim->verts[0].xyz[0],
-	      prim->verts[0].xyz[1], prim->verts[0].rgba[0],
-	      prim->verts[0].rgba[1], prim->verts[0].rgba[2]);
+              prim->verts[1].xyz[0], prim->verts[1].xyz[1],
+              prim->verts[1].rgba[0], prim->verts[1].rgba[1],
+              prim->verts[1].rgba[2], prim->verts[0].xyz[0],
+              prim->verts[0].xyz[1], prim->verts[0].rgba[0],
+              prim->verts[0].rgba[1], prim->verts[0].rgba[2]);
     }
     else{
       fprintf(gl2ps.stream, "%g %g %g %g %g %g %g L\n",
-	      prim->verts[1].xyz[0], prim->verts[1].xyz[1],
-	      prim->verts[0].xyz[0], prim->verts[0].xyz[1],
-	      prim->verts[0].rgba[0], prim->verts[0].rgba[1],
-	      prim->verts[0].rgba[2]);
+              prim->verts[1].xyz[0], prim->verts[1].xyz[1],
+              prim->verts[0].xyz[0], prim->verts[0].xyz[1],
+              prim->verts[0].rgba[0], prim->verts[0].rgba[1],
+              prim->verts[0].rgba[2]);
     }
     if(prim->dash)
       fprintf(gl2ps.stream, "[] 0 setdash\n");
@@ -828,22 +828,22 @@ GLvoid gl2psPrintPrimitive(GLvoid *a, GLvoid *b){
   case GL2PS_TRIANGLE :
     if(gl2ps.shade){
       fprintf(gl2ps.stream, "%g %g %g %g %g %g %g %g %g %g %g %g %g %g %g ST\n",
-	      prim->verts[2].xyz[0], prim->verts[2].xyz[1],
-	      prim->verts[2].rgba[0], prim->verts[2].rgba[1],
-	      prim->verts[2].rgba[2], prim->verts[1].xyz[0],
-	      prim->verts[1].xyz[1], prim->verts[1].rgba[0],
-	      prim->verts[1].rgba[1], prim->verts[1].rgba[2],
-	      prim->verts[0].xyz[0], prim->verts[0].xyz[1],
-	      prim->verts[0].rgba[0], prim->verts[0].rgba[1],
-	      prim->verts[0].rgba[2]);
+              prim->verts[2].xyz[0], prim->verts[2].xyz[1],
+              prim->verts[2].rgba[0], prim->verts[2].rgba[1],
+              prim->verts[2].rgba[2], prim->verts[1].xyz[0],
+              prim->verts[1].xyz[1], prim->verts[1].rgba[0],
+              prim->verts[1].rgba[1], prim->verts[1].rgba[2],
+              prim->verts[0].xyz[0], prim->verts[0].xyz[1],
+              prim->verts[0].rgba[0], prim->verts[0].rgba[1],
+              prim->verts[0].rgba[2]);
     }
     else{
       fprintf(gl2ps.stream, "%g %g %g %g %g %g %g %g %g T\n",
-	      prim->verts[2].xyz[0], prim->verts[2].xyz[1],
-	      prim->verts[1].xyz[0], prim->verts[1].xyz[1],
-	      prim->verts[0].xyz[0], prim->verts[0].xyz[1],
-	      prim->verts[0].rgba[0], prim->verts[0].rgba[1],
-	      prim->verts[0].rgba[2]);
+              prim->verts[2].xyz[0], prim->verts[2].xyz[1],
+              prim->verts[1].xyz[0], prim->verts[1].xyz[1],
+              prim->verts[0].xyz[0], prim->verts[0].xyz[1],
+              prim->verts[0].rgba[0], prim->verts[0].rgba[1],
+              prim->verts[0].rgba[2]);
     }
     break;
   case GL2PS_QUADRANGLE :
@@ -857,8 +857,8 @@ GLvoid gl2psPrintPrimitive(GLvoid *a, GLvoid *b){
 
 
 GLvoid gl2psAddPolyPrimitive(GLshort type, GLshort numverts, 
-			     GL2PSvertex *verts, GLint offset, GLint dash,
-			     GLshort boundary){
+                             GL2PSvertex *verts, GLint offset, GLint dash,
+                             GLshort boundary){
   GLshort         i;
   GLfloat         factor, units, area, dZ, dZdX, dZdY, maxdZ;
   GL2PSprimitive *prim;
@@ -873,12 +873,12 @@ GLvoid gl2psAddPolyPrimitive(GLshort type, GLshort numverts,
   if(gl2ps.options & GL2PS_SIMPLE_LINE_OFFSET){
     if(type == GL2PS_LINE){
       if(gl2ps.sort == GL2PS_SIMPLE_SORT){
-	prim->verts[0].xyz[2] -= 1.;
-	prim->verts[1].xyz[2] -= 1.;
+        prim->verts[0].xyz[2] -= 1.;
+        prim->verts[1].xyz[2] -= 1.;
       }
       else{
-	prim->verts[0].xyz[2] -= 0.1;
-	prim->verts[1].xyz[2] -= 0.1;
+        prim->verts[0].xyz[2] -= 0.1;
+        prim->verts[1].xyz[2] -= 0.1;
       }
     }
   }
@@ -1008,26 +1008,26 @@ GLint gl2psParseFeedbackBuffer(GLvoid){
       used -= 2;
       v = vtot = 0;
       while(count > 0 && used > 0){
-	i = gl2psGetVertex(&vertices[v], current);
-	current += i;
-	used    -= i;
-	count --;
-	vtot++;
-	if(v == 2){
-	  if(boundary){
-	    if(!count && vtot==2) flag = 1|2|4;
-	    else if(!count) flag = 2|4;
-	    else if(vtot==2) flag = 1|2;
-	    else flag = 2;
-	  }
-	  else
-	    flag = 0;
-	  gl2psAddPolyPrimitive(GL2PS_TRIANGLE, 3, vertices, 
-				offset, dash, flag);
-	  vertices[1] = vertices[2];
-	}
-	else
-	  v ++;
+        i = gl2psGetVertex(&vertices[v], current);
+        current += i;
+        used    -= i;
+        count --;
+        vtot++;
+        if(v == 2){
+          if(boundary){
+            if(!count && vtot==2) flag = 1|2|4;
+            else if(!count) flag = 2|4;
+            else if(vtot==2) flag = 1|2;
+            else flag = 2;
+          }
+          else
+            flag = 0;
+          gl2psAddPolyPrimitive(GL2PS_TRIANGLE, 3, vertices, 
+                                offset, dash, flag);
+          vertices[1] = vertices[2];
+        }
+        else
+          v ++;
       }
       break;      
     case GL_BITMAP_TOKEN :
@@ -1084,67 +1084,67 @@ GLvoid gl2psPrintPostscriptHeader(GLvoid){
   */
 
   fprintf(gl2ps.stream, 
-	  "%%!PS-Adobe-3.0\n"
-	  "%%%%Title: %s\n"
-	  "%%%%Creator: GL2PS, an OpenGL to Postscript Printing Library, V. 0.3\n"
-	  "%%%%For: %s\n"
-	  "%%%%CreationDate: %s"
-	  "%%%%LanguageLevel: 2\n"
-	  "%%%%Pages: 1\n"
-	  "%%%%DocumentData: Clean7Bit\n"
-	  "%%%%PageOrder: Ascend\n"
-	  "%%%%Orientation: Portrait\n"
-	  "%%%%DocumentMedia: Default %d %d 0 () ()\n"
-	  "%%%%BoundingBox: %d %d %d %d\n"
-	  "%%%%Copyright: GNU LGPL (C) 1999-2000 Christophe.Geuzaine@AdValvas.be\n"
-	  "%%%%EndComments\n"
-	  "%%%%BeginProlog\n"
-	  "/gl2psdict 64 dict def gl2psdict begin\n"
-	  "1 setlinecap 1 setlinejoin 0.2 setlinewidth /bd {bind def} bind def\n"
-	  "/G { 0.082 mul exch 0.6094 mul add exch 0.3086 mul add neg 1.0 add\n"
-	  "setgray } bd /C { setrgbcolor } bd /FC { findfont exch scalefont\n"
-	  "setfont } bd /S { FC C moveto show } bd /P { C newpath 0.5 0.0 360.0\n"
-	  "arc closepath fill } bd /L { C newpath moveto lineto stroke } bd\n"
-	  "/T { C newpath moveto lineto lineto closepath fill } bd /SL { /b1\n"
-	  "exch def /g1 exch def /r1 exch def /y1 exch def /x1 exch def\n"
-	  "/b2 exch def /g2 exch def /r2 exch def /y2 exch def /x2 exch def\n"
-	  "b2 b1 sub abs 0.01 gt g2 g1 sub abs 0.005 gt r2 r1 sub abs 0.008 gt\n"
-	  "or or { /bm b1 b2 add 0.5 mul def /gm g1 g2 add 0.5 mul def\n"
-	  "/rm r1 r2 add 0.5 mul def /ym y1 y2 add 0.5 mul def /xm x1 x2 add\n"
-	  "0.5 mul def x1 y1 r1 g1 b1 xm ym rm gm bm SL xm ym rm gm bm x2 y2 r2\n"
-	  "g2 b2 SL } { x1 y1 x2 y2 r1 g1 b1 L } ifelse } bd /ST {/b1 exch\n"
-	  "def /g1 exch def /r1 exch def /y1 exch def /x1 exch def\n"
-	  "/b2 exch def /g2 exch def /r2 exch def /y2 exch def /x2 exch def\n"
-	  "/b3 exch def /g3 exch def /r3 exch def /y3 exch def /x3 exch def\n"
-	  "b2 b1 sub abs 0.05 gt g2 g1 sub abs 0.017 gt r2 r1 sub abs 0.032 gt\n"
-	  "b3 b1 sub abs 0.05 gt g3 g1 sub abs 0.017 gt r3 r1 sub abs 0.032 gt\n"
-	  "b2 b3 sub abs 0.05 gt g2 g3 sub abs 0.017 gt r2 r3 sub abs 0.032 gt\n"
-	  "or or or or or or or or { /b12 b1 b2 add 0.5 mul def /g12 g1 g2 add\n"
-	  "0.5 mul def /r12 r1 r2 add 0.5 mul def /y12 y1 y2 add 0.5 mul def\n"
-	  "/x12 x1 x2 add 0.5 mul def /b13 b1 b3 add 0.5 mul def /g13 g1 g3\n"
-	  "add 0.5 mul def /r13 r1 r3 add 0.5 mul def /y13 y1 y3 add 0.5 mul\n"
-	  "def /x13 x1 x3 add 0.5 mul def /b32 b3 b2 add 0.5 mul def\n"
-	  "/g32 g3 g2 add 0.5 mul def /r32 r3 r2 add 0.5 mul def /y32 y3 y2\n"
-	  "add 0.5 mul def /x32 x3 x2 add 0.5 mul def x1 y1 r1 g1 b1 x12 y12\n"
-	  "r12 g12 b12 x13 y13 r13 g13 b13 x2 y2 r2 g2 b2 x12 y12 r12 g12 b12\n"
-	  "x32 y32 r32 g32 b32 x3 y3 r3 g3 b3 x32 y32 r32 g32 b32 x13 y13 r13\n"
-	  "g13 b13 x32 y32 r32 g32 b32 x12 y12 r12 g12 b12 x13 y13 r13 g13 b13\n"
-	  "ST ST ST ST } { x1 y1 x2 y2 x3 y3 r1 g1 b1 T } ifelse } bd\n"
-	  "end\n"
-	  "%%%%EndProlog\n"
-	  "%%%%BeginSetup\n"
-	  "/DeviceRGB setcolorspace\n"
-	  "gl2psdict begin\n"
-	  "%%%%EndSetup\n"
-	  "%%%%Page: 1 1\n"
-	  "%%%%BeginPageSetup\n"
-	  "%%%%EndPageSetup\n"
-	  "mark\n"
-	  "gsave\n"
-	  "1.0 1.0 scale\n",
-	  gl2ps.title, gl2ps.producer, ctime(&now), viewport[2], viewport[3], 
-	  viewport[0], viewport[1], viewport[2], viewport[3]);
-	  
+          "%%!PS-Adobe-3.0\n"
+          "%%%%Title: %s\n"
+          "%%%%Creator: GL2PS, an OpenGL to Postscript Printing Library, V. 0.3\n"
+          "%%%%For: %s\n"
+          "%%%%CreationDate: %s"
+          "%%%%LanguageLevel: 2\n"
+          "%%%%Pages: 1\n"
+          "%%%%DocumentData: Clean7Bit\n"
+          "%%%%PageOrder: Ascend\n"
+          "%%%%Orientation: Portrait\n"
+          "%%%%DocumentMedia: Default %d %d 0 () ()\n"
+          "%%%%BoundingBox: %d %d %d %d\n"
+          "%%%%Copyright: GNU LGPL (C) 1999-2000 Christophe.Geuzaine@AdValvas.be\n"
+          "%%%%EndComments\n"
+          "%%%%BeginProlog\n"
+          "/gl2psdict 64 dict def gl2psdict begin\n"
+          "1 setlinecap 1 setlinejoin 0.2 setlinewidth /bd {bind def} bind def\n"
+          "/G { 0.082 mul exch 0.6094 mul add exch 0.3086 mul add neg 1.0 add\n"
+          "setgray } bd /C { setrgbcolor } bd /FC { findfont exch scalefont\n"
+          "setfont } bd /S { FC C moveto show } bd /P { C newpath 0.5 0.0 360.0\n"
+          "arc closepath fill } bd /L { C newpath moveto lineto stroke } bd\n"
+          "/T { C newpath moveto lineto lineto closepath fill } bd /SL { /b1\n"
+          "exch def /g1 exch def /r1 exch def /y1 exch def /x1 exch def\n"
+          "/b2 exch def /g2 exch def /r2 exch def /y2 exch def /x2 exch def\n"
+          "b2 b1 sub abs 0.01 gt g2 g1 sub abs 0.005 gt r2 r1 sub abs 0.008 gt\n"
+          "or or { /bm b1 b2 add 0.5 mul def /gm g1 g2 add 0.5 mul def\n"
+          "/rm r1 r2 add 0.5 mul def /ym y1 y2 add 0.5 mul def /xm x1 x2 add\n"
+          "0.5 mul def x1 y1 r1 g1 b1 xm ym rm gm bm SL xm ym rm gm bm x2 y2 r2\n"
+          "g2 b2 SL } { x1 y1 x2 y2 r1 g1 b1 L } ifelse } bd /ST {/b1 exch\n"
+          "def /g1 exch def /r1 exch def /y1 exch def /x1 exch def\n"
+          "/b2 exch def /g2 exch def /r2 exch def /y2 exch def /x2 exch def\n"
+          "/b3 exch def /g3 exch def /r3 exch def /y3 exch def /x3 exch def\n"
+          "b2 b1 sub abs 0.05 gt g2 g1 sub abs 0.017 gt r2 r1 sub abs 0.032 gt\n"
+          "b3 b1 sub abs 0.05 gt g3 g1 sub abs 0.017 gt r3 r1 sub abs 0.032 gt\n"
+          "b2 b3 sub abs 0.05 gt g2 g3 sub abs 0.017 gt r2 r3 sub abs 0.032 gt\n"
+          "or or or or or or or or { /b12 b1 b2 add 0.5 mul def /g12 g1 g2 add\n"
+          "0.5 mul def /r12 r1 r2 add 0.5 mul def /y12 y1 y2 add 0.5 mul def\n"
+          "/x12 x1 x2 add 0.5 mul def /b13 b1 b3 add 0.5 mul def /g13 g1 g3\n"
+          "add 0.5 mul def /r13 r1 r3 add 0.5 mul def /y13 y1 y3 add 0.5 mul\n"
+          "def /x13 x1 x3 add 0.5 mul def /b32 b3 b2 add 0.5 mul def\n"
+          "/g32 g3 g2 add 0.5 mul def /r32 r3 r2 add 0.5 mul def /y32 y3 y2\n"
+          "add 0.5 mul def /x32 x3 x2 add 0.5 mul def x1 y1 r1 g1 b1 x12 y12\n"
+          "r12 g12 b12 x13 y13 r13 g13 b13 x2 y2 r2 g2 b2 x12 y12 r12 g12 b12\n"
+          "x32 y32 r32 g32 b32 x3 y3 r3 g3 b3 x32 y32 r32 g32 b32 x13 y13 r13\n"
+          "g13 b13 x32 y32 r32 g32 b32 x12 y12 r12 g12 b12 x13 y13 r13 g13 b13\n"
+          "ST ST ST ST } { x1 y1 x2 y2 x3 y3 r1 g1 b1 T } ifelse } bd\n"
+          "end\n"
+          "%%%%EndProlog\n"
+          "%%%%BeginSetup\n"
+          "/DeviceRGB setcolorspace\n"
+          "gl2psdict begin\n"
+          "%%%%EndSetup\n"
+          "%%%%Page: 1 1\n"
+          "%%%%BeginPageSetup\n"
+          "%%%%EndPageSetup\n"
+          "mark\n"
+          "gsave\n"
+          "1.0 1.0 scale\n",
+          gl2ps.title, gl2ps.producer, ctime(&now), viewport[2], viewport[3], 
+          viewport[0], viewport[1], viewport[2], viewport[3]);
+          
   if(gl2ps.options & GL2PS_DRAW_BACKGROUND){
     if(gl2ps.colormode == GL_RGBA || gl2ps.colorsize == 0)
       glGetFloatv(GL_COLOR_CLEAR_VALUE, rgba);
@@ -1156,12 +1156,12 @@ GLvoid gl2psPrintPostscriptHeader(GLvoid){
       rgba[3] = 0.;
     }
     fprintf(gl2ps.stream,
-	    "%g %g %g C\n"
-	    "newpath %d %d moveto %d %d lineto %d %d lineto %d %d lineto\n"
-	    "closepath fill\n",
-	    rgba[0], rgba[1], rgba[2], 
-	    viewport[0], viewport[1], viewport[2], viewport[1], 
-	    viewport[2], viewport[3], viewport[0], viewport[3]);
+            "%g %g %g C\n"
+            "newpath %d %d moveto %d %d lineto %d %d lineto %d %d lineto\n"
+            "closepath fill\n",
+            rgba[0], rgba[1], rgba[2], 
+            viewport[0], viewport[1], viewport[2], viewport[1], 
+            viewport[2], viewport[3], viewport[0], viewport[3]);
   }
 }
 
@@ -1191,8 +1191,8 @@ GLboolean gl2psLess(GLfloat f1, GLfloat f2){
 }
 
 GLvoid gl2psBeginPage(char *title, char *producer, GLint sort, GLint options, 
-		      GLint colormode, GLint colorsize, GL2PSrgba *colormap,
-		      GLint buffersize, FILE *stream){
+                      GLint colormode, GLint colorsize, GL2PSrgba *colormap,
+                      GLint buffersize, FILE *stream){
 
   gl2ps.title = title;
   gl2ps.producer = producer;
@@ -1262,11 +1262,11 @@ GLint gl2psEndPage(GLvoid){
       gl2psListDelete(gl2ps.primitives);
       if(gl2ps.boundary) gl2psBuildPolygonBoundary(root);
       if(gl2ps.options & GL2PS_OCCLUSION_CULL){
-	gl2psTraverseBspTree(root, eye, -GL2PS_EPSILON, gl2psLess,
-			     gl2psAddInImage);
+        gl2psTraverseBspTree(root, eye, -GL2PS_EPSILON, gl2psLess,
+                             gl2psAddInImage);
       }
       gl2psTraverseBspTree(root, eye, GL2PS_EPSILON, gl2psGreater, 
-			   gl2psPrintPrimitive);
+                           gl2psPrintPrimitive);
       gl2psFreeBspTree(root);
       res = GL2PS_SUCCESS;
       break;
@@ -1274,13 +1274,13 @@ GLint gl2psEndPage(GLvoid){
       gl2psMsg(GL2PS_ERROR, "Unknown Sorting Algorithm");
     }
     fprintf(gl2ps.stream,
-	    "grestore\n"
-	    "showpage\n"
-	    "cleartomark\n"
-	    "%%%%PageTrailer\n"
-	    "%%%%Trailer\n"
-	    "end\n"
-	    "%%%%EOF\n");
+            "grestore\n"
+            "showpage\n"
+            "cleartomark\n"
+            "%%%%PageTrailer\n"
+            "%%%%Trailer\n"
+            "end\n"
+            "%%%%EOF\n");
     fflush(gl2ps.stream);
   }
 
diff --git a/Graphics/gl2ps.h b/Graphics/gl2ps.h
index b9689fc4e5..9edf33585b 100644
--- a/Graphics/gl2ps.h
+++ b/Graphics/gl2ps.h
@@ -1,4 +1,4 @@
-/* $Id: gl2ps.h,v 1.2 2000-11-23 14:11:33 geuzaine Exp $ */
+/* $Id: gl2ps.h,v 1.3 2000-11-26 15:43:46 geuzaine Exp $ */
 /*
  * GL2PS, an OpenGL to Postscript Printing Library, version 0.31
  * Copyright (C) 1999-2000  Christophe Geuzaine
@@ -151,8 +151,8 @@ typedef struct {
 /* public functions */
 
 GLvoid gl2psBeginPage(char *title, char *producer, GLint sort, GLint options, 
-		      GLint colormode, GLint colorsize, GL2PSrgba *colormap, 
-		      GLint buffersize, FILE * stream);
+                      GLint colormode, GLint colorsize, GL2PSrgba *colormap, 
+                      GLint buffersize, FILE * stream);
 GLint  gl2psEndPage(GLvoid);
 GLvoid gl2psText(char *str, char *fontname, GLint size);
 GLvoid gl2psEnable(GLint mode);
diff --git a/Makefile b/Makefile
index 0f36a04414..48e9600b75 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.5 2000-11-25 15:26:10 geuzaine Exp $
+# $Id: Makefile,v 1.6 2000-11-26 15:43:44 geuzaine Exp $
 # ----------------------------------------------------------------------
 #  Makefile for Gmsh  
 # ----------------------------------------------------------------------
@@ -47,11 +47,21 @@ GMSH_ARCHIVE_DIR = archives
       GMSH_UNAME = `uname`
 
 default: initialtag
+	@for i in $(GMSH_DIR); do (cd $$i && $(MAKE) \
+           "CC=$(CC)" \
+           "C_FLAGS=-D_REENTRANT $(FLAGS)" \
+           "OS_FLAGS=-D_UNIX -D_LITTLE_ENDIAN" \
+           "VERSION_FLAGS=-D_USETHREADS" \
+           "GL_INCLUDE=$(OPENGL_INC)" \
+           "MOTIF_INCLUDE=$(MOTIF_INC)" \
+        ); done
+
+nothreads: initialtag
 	@for i in $(GMSH_DIR); do (cd $$i && $(MAKE) \
            "CC=$(CC)" \
            "C_FLAGS=$(FLAGS)" \
-           "OS_FLAGS=-D_UNIX -D_LITTLE" \
-           "VERSION_FLAGS=-D_NOTHREADS" \
+           "OS_FLAGS=-D_UNIX -D_LITTLE_ENDIAN" \
+           "VERSION_FLAGS=" \
            "GL_INCLUDE=$(OPENGL_INC)" \
            "MOTIF_INCLUDE=$(MOTIF_INC)" \
         ); done
@@ -60,8 +70,8 @@ profile: initialtag
 	@for i in $(GMSH_DIR); do (cd $$i && $(MAKE) \
            "CC=$(CC)" \
            "C_FLAGS=-O3 -pg" \
-           "OS_FLAGS=-D_UNIX -D_LITTLE" \
-           "VERSION_FLAGS=-D_NOTHREADS" \
+           "OS_FLAGS=-D_UNIX -D_LITTLE_ENDIAN" \
+           "VERSION_FLAGS=" \
            "GL_INCLUDE=$(OPENGL_INC)" \
            "MOTIF_INCLUDE=$(MOTIF_INC)" \
         ); done
@@ -182,7 +192,7 @@ sgi: tag
            "C_FLAGS=-O2 -o32" \
            "RANLIB=true"\
            "OS_FLAGS=-D_UNIX" \
-           "VERSION_FLAGS=-D_NOTHREADS" \
+           "VERSION_FLAGS=" \
            "GL_INCLUDE=$(OPENGL_INC)" \
            "MOTIF_INCLUDE=$(MOTIF_INC)" \
         ); done
@@ -191,7 +201,7 @@ sgi: tag
            "C_FLAGS=-O1 -o32" \
            "RANLIB=true"\
            "OS_FLAGS=-D_UNIX" \
-           "VERSION_FLAGS=-D_NOTHREADS" \
+           "VERSION_FLAGS=" \
            "GL_INCLUDE=$(OPENGL_INC)" \
            "MOTIF_INCLUDE=$(MOTIF_INC)" \
         ); done
@@ -203,18 +213,18 @@ little_endian: tag
 	@for i in $(GMSH_DISTRIB_DIR); do (cd $$i && $(MAKE) \
            "CC=g++" \
            "C_FLAGS=-O3" \
-           "OS_FLAGS=-D_UNIX -D_LITTLE" \
-           "VERSION_FLAGS=-D_NOTHREADS" \
+           "OS_FLAGS=-D_UNIX -D_LITTLE_ENDIAN" \
+           "VERSION_FLAGS=" \
            "GL_INCLUDE=$(OPENGL_INC)" \
            "MOTIF_INCLUDE=$(MOTIF_INC)" \
         ); done
 
-little_endian_compat: tag
+little_endian_threads: tag
 	@for i in $(GMSH_DISTRIB_DIR); do (cd $$i && $(MAKE) \
-           "CC=i386-glibc21-linux-g++" \
-           "C_FLAGS=-O3" \
-           "OS_FLAGS=-D_UNIX -D_LITTLE" \
-           "VERSION_FLAGS=-D_NOTHREADS" \
+           "CC=g++" \
+           "C_FLAGS=-D_REENTRANT -O3" \
+           "OS_FLAGS=-D_UNIX -D_LITTLE_ENDIAN" \
+           "VERSION_FLAGS=-D_USETHREADS" \
            "GL_INCLUDE=$(OPENGL_INC)" \
            "MOTIF_INCLUDE=$(MOTIF_INC)" \
         ); done
@@ -224,29 +234,30 @@ big_endian: tag
            "CC=g++" \
            "C_FLAGS=-O3" \
            "OS_FLAGS=-D_UNIX" \
-           "VERSION_FLAGS=-D_NOTHREADS" \
+           "VERSION_FLAGS=" \
            "GL_INCLUDE=$(OPENGL_INC)" \
            "MOTIF_INCLUDE=$(MOTIF_INC)" \
         ); done
 
 
 ogl:
-	g++ -o $(GMSH_BIN_DIR)/gmsh-$(GMSH_UNAME) $(GMSH_LIB) $(OPENGL_LIB) $(MOTIF_LIB) $(X_LIB) -lm
+	g++ -o $(GMSH_BIN_DIR)/gmsh-$(GMSH_UNAME) $(GMSH_LIB)\
+               $(OPENGL_LIB) $(MOTIF_LIB) $(X_LIB) -lm
 	strip $(GMSH_BIN_DIR)/gmsh-$(GMSH_UNAME)
 
 mesa:
-	g++ -o $(GMSH_BIN_DIR)/gmsh-$(GMSH_UNAME) $(GMSH_LIB) $(MESA_LIB) $(MOTIF_LIB) $(X_LIB) -lm
+	g++ -o $(GMSH_BIN_DIR)/gmsh-$(GMSH_UNAME) $(GMSH_LIB)\
+               $(MESA_LIB) $(MOTIF_LIB) $(X_LIB) -lm
 	strip $(GMSH_BIN_DIR)/gmsh-$(GMSH_UNAME)
 
-mesa_compat:
-	i386-glibc21-linux-g++ -o $(GMSH_BIN_DIR)/gmsh-$(GMSH_UNAME) $(GMSH_LIB) $(MESA_LIB) $(MOTIF_LIB) $(X_LIB) -lm
+mesa_threads:
+	g++ -o $(GMSH_BIN_DIR)/gmsh-$(GMSH_UNAME) $(GMSH_LIB)\
+               $(MESA_LIB) $(MOTIF_LIB) $(X_LIB) $(THREAD_LIB) -lm
 	strip $(GMSH_BIN_DIR)/gmsh-$(GMSH_UNAME)
 
 dec: little_endian ogl
 
-linux: little_endian mesa
-
-linux-compat: little_endian_compat mesa_compat
+linux: little_endian_threads mesa_threads
 
 ibm: big_endian mesa
 
@@ -254,7 +265,8 @@ sun: big_endian mesa
 
 # HP : special linker option is necessary (+s) + set the SHLIB_PATH variable.
 hp: big_endian
-	g++ -Wl,+s -o $(GMSH_BIN_DIR)/gmsh-$(GMSH_UNAME) $(GMSH_LIB) $(MESA_LIB) $(MOTIF_LIB) $(X_LIB) -lm
+	g++ -Wl,+s -o $(GMSH_BIN_DIR)/gmsh-$(GMSH_UNAME) $(GMSH_LIB)\
+                      $(MESA_LIB) $(MOTIF_LIB) $(X_LIB) -lm
 	strip $(GMSH_BIN_DIR)/gmsh-$(GMSH_UNAME)
 
 comp:
diff --git a/Mesh/1D_Mesh.cpp b/Mesh/1D_Mesh.cpp
index 3426d58972..4e7c1973ad 100644
--- a/Mesh/1D_Mesh.cpp
+++ b/Mesh/1D_Mesh.cpp
@@ -1,4 +1,4 @@
-/* $Id: 1D_Mesh.cpp,v 1.5 2000-11-25 15:26:11 geuzaine Exp $ */
+/* $Id: 1D_Mesh.cpp,v 1.6 2000-11-26 15:43:46 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "Const.h"
@@ -28,7 +28,7 @@ double F_Transfini (double t){
 
   der = InterpolateCurve (THEC, t, 1);
   d = sqrt (der.Pos.X * der.Pos.X + der.Pos.Y * der.Pos.Y +
-	    der.Pos.Z * der.Pos.Z);
+            der.Pos.Z * der.Pos.Z);
 
   if (THEC->dpar[0] == 0.0 || THEC->dpar[0] == 1.0){
     val = d * (double) THEC->ipar[0] / THEC->l ;
@@ -38,9 +38,9 @@ double F_Transfini (double t){
 
     case 2:
       if (sign (THEC->ipar[1]) == -1)
-	ZePauwer = 1. / THEC->dpar[0];
+        ZePauwer = 1. / THEC->dpar[0];
       else
-	ZePauwer = THEC->dpar[0];
+        ZePauwer = THEC->dpar[0];
       b = log (1. / ZePauwer) / THEC->l;
       a = (1. - exp (-b * THEC->l)) / (b * (double) THEC->ipar[0]);
       val =d / (a * exp (b * (t * THEC->l))) ;
@@ -48,15 +48,15 @@ double F_Transfini (double t){
 
     case 1:
       if (THEC->dpar[0] > 1.0){
-	a = -4. * sqrt (THEC->dpar[0] - 1.) * 
-	  atan2 (1., sqrt (THEC->dpar[0] - 1.)) / 
-	  ((double) THEC->ipar[0] * THEC->l);
+        a = -4. * sqrt (THEC->dpar[0] - 1.) * 
+          atan2 (1., sqrt (THEC->dpar[0] - 1.)) / 
+          ((double) THEC->ipar[0] * THEC->l);
       }
       else{
-	a = 2. * sqrt (1. - THEC->dpar[0]) * 
-	  log (fabs ((1. + 1. / sqrt (1. - THEC->dpar[0])) 
-		     / (1. - 1. / sqrt (1. - THEC->dpar[0]))))
-	  / ((double) THEC->ipar[0] * THEC->l);
+        a = 2. * sqrt (1. - THEC->dpar[0]) * 
+          log (fabs ((1. + 1. / sqrt (1. - THEC->dpar[0])) 
+                     / (1. - 1. / sqrt (1. - THEC->dpar[0]))))
+          / ((double) THEC->ipar[0] * THEC->l);
       }
       b = -a * THEC->l * THEC->l / (4. * (THEC->dpar[0] - 1.)) ;
       val = d / (-a * DSQR (t * THEC->l - (THEC->l) * 0.5) + b) ;
@@ -94,7 +94,7 @@ void Maillage_Curve (void *data, void *dummy){
   if (c->Num < 0)
     return;
 
-  Msg(INFO, "Meshing Curve %d", c->Num);
+  Msg(STATUS, "Meshing Curve %d", c->Num);
 
   if (c->Method != TRANSFINI && Extrude_Mesh (c)){
     Points = List_Create (10, 10, sizeof (IntPoint));
@@ -116,14 +116,14 @@ void Maillage_Curve (void *data, void *dummy){
       a = Integration (c->ubeg, c->uend, F_Lc, Points, 1.e-5);
       N = IMAX (2, (int) (a + 1.));
       if (c->Typ == MSH_SEGM_CIRC ||
-	  c->Typ == MSH_SEGM_CIRC_INV ||
-	  c->Typ == MSH_SEGM_ELLI ||
-	  c->Typ == MSH_SEGM_ELLI_INV){
-	N = IMAX (N, (int) (fabs (c->Circle.t1 - c->Circle.t2) *
-			    CIRC_GRAN / Pi));
+          c->Typ == MSH_SEGM_CIRC_INV ||
+          c->Typ == MSH_SEGM_ELLI ||
+          c->Typ == MSH_SEGM_ELLI_INV){
+        N = IMAX (N, (int) (fabs (c->Circle.t1 - c->Circle.t2) *
+                            CIRC_GRAN / Pi));
       }
       else if (c->Typ == MSH_SEGM_NURBS){
-	N = IMAX (N, 2);
+        N = IMAX (N, 2);
       }
     }
     b = a / (double) (N - 1);
@@ -134,12 +134,12 @@ void Maillage_Curve (void *data, void *dummy){
       (*vexist)->u = c->ubeg;
       Tree_Insert (THEM->Vertices, vexist);
       if ((*vexist)->ListCurves)
-	List_Add ((*vexist)->ListCurves, &c);
+        List_Add ((*vexist)->ListCurves, &c);
       List_Add (c->Vertices, vexist);
     }
     else{
       pV = Create_Vertex ((*v)->Num, (*v)->Pos.X, (*v)->Pos.Y,
-			  (*v)->Pos.Z, (*v)->lc, 0.0);
+                          (*v)->Pos.Z, (*v)->lc, 0.0);
       pV->ListCurves = List_Create (1, 1, sizeof (Curve *));
       List_Add (pV->ListCurves, &c);
       Tree_Insert (THEM->Vertices, &pV);
@@ -152,21 +152,21 @@ void Maillage_Curve (void *data, void *dummy){
       List_Read (Points, count, &P2);
       d = (double) NUMP *b;
       if ((fabs (P2.p) >= fabs (d)) && (fabs (P1.p) < fabs (d))){
-	dt = P2.t - P1.t;
-	dp = P2.p - P1.p;
-	t = P1.t + dt / dp * (d - P1.p);
-	V = InterpolateCurve (c, t, 0);
-	pV = Create_Vertex (++CurrentNodeNumber, 
-			    V.Pos.X, V.Pos.Y, V.Pos.Z, V.lc, t);
-	pV->w = V.w;
-	pV->ListCurves = List_Create (1, 1, sizeof (Curve *));
-	List_Add (pV->ListCurves, &c);
-	Tree_Insert (THEM->Vertices, &pV);
-	List_Add (c->Vertices, &pV);
-	NUMP++;
+        dt = P2.t - P1.t;
+        dp = P2.p - P1.p;
+        t = P1.t + dt / dp * (d - P1.p);
+        V = InterpolateCurve (c, t, 0);
+        pV = Create_Vertex (++CurrentNodeNumber, 
+                            V.Pos.X, V.Pos.Y, V.Pos.Z, V.lc, t);
+        pV->w = V.w;
+        pV->ListCurves = List_Create (1, 1, sizeof (Curve *));
+        List_Add (pV->ListCurves, &c);
+        Tree_Insert (THEM->Vertices, &pV);
+        List_Add (c->Vertices, &pV);
+        NUMP++;
       }
       else{
-	count++;
+        count++;
       }
     }
 
@@ -175,12 +175,12 @@ void Maillage_Curve (void *data, void *dummy){
       (*vexist)->u = c->uend;
       Tree_Insert (THEM->Vertices, vexist);
       if ((*vexist)->ListCurves)
-	List_Add ((*vexist)->ListCurves, &c);
+        List_Add ((*vexist)->ListCurves, &c);
       List_Add (c->Vertices, vexist);
     }
     else{
       pV = Create_Vertex ((*v)->Num, (*v)->Pos.X, (*v)->Pos.Y, 
-			  (*v)->Pos.Z, (*v)->lc, 0.0);
+                          (*v)->Pos.Z, (*v)->lc, 0.0);
       pV->ListCurves = List_Create (1, 1, sizeof (Curve *));
       List_Add (pV->ListCurves, &c);
       Tree_Insert (THEM->Vertices, &pV);
diff --git a/Mesh/2D_BGMesh.cpp b/Mesh/2D_BGMesh.cpp
index 467a4aa981..f1570b9d81 100644
--- a/Mesh/2D_BGMesh.cpp
+++ b/Mesh/2D_BGMesh.cpp
@@ -1,4 +1,4 @@
-/* $Id: 2D_BGMesh.cpp,v 1.3 2000-11-23 23:20:35 geuzaine Exp $ */
+/* $Id: 2D_BGMesh.cpp,v 1.4 2000-11-26 15:43:46 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "Const.h"
@@ -52,7 +52,7 @@ double find_quality (MPoint center, DocRecord * BGMESH){
     v = ((X[2] - X[0]) * (Yp - Y[0]) - (Y[2] - Y[0]) * (Xp - X[0])) / det;
   }
   else{
-    Msg(WARNING, "Degenerated Triangle (det=%g)\n", det);
+    Msg(WARNING, "Degenerated Triangle (det=%g)", det);
     u = v = 0.0;
   }
   
@@ -65,10 +65,10 @@ double find_quality (MPoint center, DocRecord * BGMESH){
     deno = nume = 0.0;
     for (i = 0; i < BGMESH->numPoints; i++){
       r = sqrt (DSQR (center.h - pPointArray[i].where.h) +
-		DSQR (center.v - pPointArray[i].where.v));
+                DSQR (center.v - pPointArray[i].where.v));
       r = pow (r, Exp);
       if (r < 1.e-10)
-	return (pPointArray[i].quality);
+        return (pPointArray[i].quality);
       nume += pPointArray[i].quality / r;
       deno += 1. / r;
     }
diff --git a/Mesh/2D_Bowyer.cpp b/Mesh/2D_Bowyer.cpp
index 770ff930a8..3fc8e0b56b 100644
--- a/Mesh/2D_Bowyer.cpp
+++ b/Mesh/2D_Bowyer.cpp
@@ -1,4 +1,4 @@
-/* $Id: 2D_Bowyer.cpp,v 1.3 2000-11-23 23:20:35 geuzaine Exp $ */
+/* $Id: 2D_Bowyer.cpp,v 1.4 2000-11-26 15:43:46 geuzaine Exp $ */
 /*
 
    A L G O R I T H M E       D E      B O W Y E R  -  W A T S O N
@@ -48,8 +48,8 @@ int Is_pt_in_CircCircle (Delaunay * del, MPoint pt){
 }
 
 int PE_Del_Triangle (Delaunay *del , MPoint pt, DListPeek *ListEdges ,
-		     List_T *listkill, List_T *listDelforlink,
-		     int *numlink, int *numdel){
+                     List_T *listkill, List_T *listDelforlink,
+                     int *numlink, int *numdel){
   int rslt;
   PointNumero a,b,c;
   int count,order[3],same;
@@ -87,7 +87,7 @@ int PE_Del_Triangle (Delaunay *del , MPoint pt, DListPeek *ListEdges ,
       rslt &= DListInsert(ListEdges,pt,b);
       rslt &= DListInsert(ListEdges,pt,c);
       if(!rslt)
-	Msg(ERROR, "List Insert Failed in Boyer Watson"); 
+        Msg(ERROR, "List Insert Failed in Boyer Watson"); 
       
     }
     else { 
@@ -97,43 +97,43 @@ int PE_Del_Triangle (Delaunay *del , MPoint pt, DListPeek *ListEdges ,
       order[0] = order[1] = order[2] = 0;
       same = 0;
       
-      do { 	
-	if (p->point_num == a ) {
-	  same = same + 1;
-	  order[count]=a;
-	  count++ ;
-	}
-	if (p->point_num == b ) {
-	  same = same + 10;
-	  order[count]=b;
-	  count++ ;
-	}
-	if (p->point_num == c ) {
-	  same = same + 100;
-	  order[count]=c;
-	  count++ ;
-	}
-	p = Pred(p);
+      do {      
+        if (p->point_num == a ) {
+          same = same + 1;
+          order[count]=a;
+          count++ ;
+        }
+        if (p->point_num == b ) {
+          same = same + 10;
+          order[count]=b;
+          count++ ;
+        }
+        if (p->point_num == c ) {
+          same = same + 100;
+          order[count]=c;
+          count++ ;
+        }
+        p = Pred(p);
       }while ( p != *ListEdges );
       if (count == 1) {
-	return(0);
+        return(0);
       }
       else if (count == 2) {
-	if (same == 11 ) {
-	  rslt = DListInsert(ListEdges,pt,c);
-	}
-	if (same == 101 ) {
-	  rslt = DListInsert(ListEdges,pt,b);
-	}
-	if (same == 110 ) {
-	  rslt = DListInsert(ListEdges,pt,a);
-	}
+        if (same == 11 ) {
+          rslt = DListInsert(ListEdges,pt,c);
+        }
+        if (same == 101 ) {
+          rslt = DListInsert(ListEdges,pt,b);
+        }
+        if (same == 110 ) {
+          rslt = DListInsert(ListEdges,pt,a);
+        }
       }
       else if (count == 3) {
-	rslt = DListDelete(ListEdges,order[1]);	
+        rslt = DListDelete(ListEdges,order[1]); 
       }
       else {
-	return(0);
+        return(0);
       }
     }
     
@@ -144,24 +144,24 @@ int PE_Del_Triangle (Delaunay *del , MPoint pt, DListPeek *ListEdges ,
     
     if(de1 != NULL){
       if (de1->v.voisin1 == del )de1->v.voisin1 = NULL;
-	else if (de1->v.voisin2 == del )de1->v.voisin2 = NULL;
+        else if (de1->v.voisin2 == del )de1->v.voisin2 = NULL;
       else if (de1->v.voisin3 == del )de1->v.voisin3 = NULL;
       else
-	Msg(ERROR, "Bad Link in Boyer Watson"); 
+        Msg(ERROR, "Bad Link in Boyer Watson"); 
     }
     if(de2 != NULL){
       if (de2->v.voisin1 == del )de2->v.voisin1 = NULL;
       else if (de2->v.voisin2 == del )de2->v.voisin2 = NULL;
       else if (de2->v.voisin3 == del )de2->v.voisin3 = NULL;
       else
-	Msg(ERROR, "Bad Link in Boyer Watson"); 
+        Msg(ERROR, "Bad Link in Boyer Watson"); 
     }      
     if(de3 != NULL){
       if (de3->v.voisin1 == del )de3->v.voisin1 = NULL;
       else if (de3->v.voisin2 == del )de3->v.voisin2 = NULL;
       else if (de3->v.voisin3 == del )de3->v.voisin3 = NULL;
       else
-	Msg(ERROR, "Bad Link in Boyer Watson");
+        Msg(ERROR, "Bad Link in Boyer Watson");
     }      
     
     del->v.voisin1 = NULL ;
diff --git a/Mesh/2D_Bricks.cpp b/Mesh/2D_Bricks.cpp
index 4ebcb12f88..2ddee7a347 100644
--- a/Mesh/2D_Bricks.cpp
+++ b/Mesh/2D_Bricks.cpp
@@ -1,4 +1,4 @@
-/* $Id: 2D_Bricks.cpp,v 1.2 2000-11-23 14:11:34 geuzaine Exp $ */
+/* $Id: 2D_Bricks.cpp,v 1.3 2000-11-26 15:43:46 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "Const.h"
@@ -56,8 +56,8 @@ void Invert_MappingLists (List_T * List1, List_T * List2) {
     for(j=0 ; j<List_Nbr(TmpMap1.List) ; j++){
       List_Read(TmpMap1.List, j, &Entity);
       TmpMap2.Num = Entity;
-      if ((TmpMap = (struct Map*)List_PQuery(List2, &TmpMap2, fcmp_Map)) != NULL) {	
-	List_Add(TmpMap->List, &TmpMap1.Num);
+      if ((TmpMap = (struct Map*)List_PQuery(List2, &TmpMap2, fcmp_Map)) != NULL) {     
+        List_Add(TmpMap->List, &TmpMap1.Num);
       }
     }
   }
@@ -82,7 +82,7 @@ int InWhichBrick (double X, double Y, double Z) {
   Iz = (Iz< Nz)? Iz : Nz-1;
   return(1 + Ix + Iy*Nx + Iz*Nx*Ny);
 }
-								    
+                                                                    
 List_T *AllBricksForABox (void){  
 
   List_T *List;
@@ -107,8 +107,8 @@ List_T *AllBricksForABox (void){
   for(i=Ix1;i<=Ix2;i++){
     for(j=Iy1;j<=Iy2;j++){
       for(k=Iz1;k<=Iz2;k++){
-	Num = 1 + i + j*Nx + k*Nx*Ny ;
-	List_Add(List, &Num);
+        Num = 1 + i + j*Nx + k*Nx*Ny ;
+        List_Add(List, &Num);
       }
     }
   }
@@ -211,26 +211,26 @@ Delaunay * Find_Triangle (MPoint pt, DocRecord *MESH, int typ) {
     KeyBrick = InWhichBrick(pt.h,pt.v,0.0);
     if((pBrick = (struct Map *)List_PQuery(GridList, &KeyBrick, fcmp_Map)) == NULL){
       if(typ == A_TOUT_PRIX){
-	gPointArray = ptr;
-	return(NULL);
+        gPointArray = ptr;
+        return(NULL);
       }
     }
     else{
       for(i=0;i<List_Nbr(pBrick->List);i++){
-	j = *(int *)List_Pointer(pBrick->List,i);
-	a = MESH->delaunay[j].t.a;
-	b = MESH->delaunay[j].t.b;
-	c = MESH->delaunay[j].t.c;
-	if(MESH->delaunay[j].t.position != EXTERN  || typ == BOF){
-	  if(PtInTriangle(pt,a,b,c)){
-	    gPointArray = ptr;
-	    return(&MESH->delaunay[j]);
-	  }
-	}
+        j = *(int *)List_Pointer(pBrick->List,i);
+        a = MESH->delaunay[j].t.a;
+        b = MESH->delaunay[j].t.b;
+        c = MESH->delaunay[j].t.c;
+        if(MESH->delaunay[j].t.position != EXTERN  || typ == BOF){
+          if(PtInTriangle(pt,a,b,c)){
+            gPointArray = ptr;
+            return(&MESH->delaunay[j]);
+          }
+        }
       }
       if(typ == A_TOUT_PRIX) {
-	gPointArray = ptr;
-	return NULL;
+        gPointArray = ptr;
+        return NULL;
       }
     }
   }
@@ -239,10 +239,10 @@ Delaunay * Find_Triangle (MPoint pt, DocRecord *MESH, int typ) {
     found = 0;
     while (!found && i<MESH->numTriangles) {  
       if( (!PtInTriangle(pt,MESH->delaunay[i].t.a,MESH->delaunay[i].t.b,
-			 MESH->delaunay[i].t.c)) ||
-	 (MESH->delaunay[i].t.position == EXTERN  && typ != BOF ))i++; 
+                         MESH->delaunay[i].t.c)) ||
+         (MESH->delaunay[i].t.position == EXTERN  && typ != BOF ))i++; 
       else
-	found = 1;
+        found = 1;
     };
     
     if(found == 1){
diff --git a/Mesh/2D_DivAndConq.cpp b/Mesh/2D_DivAndConq.cpp
index bd9b0c0114..1f961c4bdf 100644
--- a/Mesh/2D_DivAndConq.cpp
+++ b/Mesh/2D_DivAndConq.cpp
@@ -1,4 +1,4 @@
-/* $Id: 2D_DivAndConq.cpp,v 1.4 2000-11-25 15:26:11 geuzaine Exp $ */
+/* $Id: 2D_DivAndConq.cpp,v 1.5 2000-11-26 15:43:46 geuzaine Exp $ */
 /*
 
    A L G O R I T H M E    D I V I D E    A N D     C O N Q U E R   
@@ -24,9 +24,7 @@
 #include "Mesh.h"
 #include "2D_Mesh.h"
 
-#define EPSILON 1.e-15
-
-extern double LC;
+extern double LC2D;
 
 PointRecord *pPointArray;
 DocPeek      gDocTemp;
@@ -167,12 +165,12 @@ int Qtest(PointNumero h,PointNumero i,PointNumero j,PointNumero k){
     return(0);  /* returning 1 will cause looping for ever */
   }
   if (CircumCircle( (double) pPointArray[h].where.h,
-		    (double) pPointArray[h].where.v,
-		    (double) pPointArray[i].where.h,
-		    (double) pPointArray[i].where.v,
-		    (double) pPointArray[j].where.h,
-		    (double) pPointArray[j].where.v,
-		    &xc, &yc )){
+                    (double) pPointArray[h].where.v,
+                    (double) pPointArray[i].where.h,
+                    (double) pPointArray[i].where.v,
+                    (double) pPointArray[j].where.h,
+                    (double) pPointArray[j].where.v,
+                    &xc, &yc )){
     rcarre = square(xc - (double) pPointArray[i].where.h) +
       square(yc - (double) pPointArray[i].where.v);
     
@@ -206,17 +204,17 @@ int merge(DT vl,DT vr){
     else{
       out = 0;
       while (!out){
-	r2 = Predecessor(r,r1);
-	if (r2 == -1) return(0);
-	if (r2 < vr.begin)
-	  out = 1;
-	else if (Qtest(l,r,r1,r2))
-	  out = 1;
-	else{
-	  if (!Delete(r,r1)) return(0);
-	  r1 = r2;
-	  if (Is_right_of(l,r,r1)) out = a = 1;
-	}
+        r2 = Predecessor(r,r1);
+        if (r2 == -1) return(0);
+        if (r2 < vr.begin)
+          out = 1;
+        else if (Qtest(l,r,r1,r2))
+          out = 1;
+        else{
+          if (!Delete(r,r1)) return(0);
+          r1 = r2;
+          if (Is_right_of(l,r,r1)) out = a = 1;
+        }
       }
     }
       
@@ -227,17 +225,17 @@ int merge(DT vl,DT vr){
     else{
       out = 0;
       while (!out){
-	l2 = Successor(l,l1);
-	if (l2 == -1) return(0);
-	if (l2 > vl.end)
-	  out = 1;
-	else if (Qtest(r,l,l1,l2))
-	  out = 1;
-	else{
-	  if (!Delete(l,l1)) return(0);
-	  l1 = l2;
-	  if (Is_left_of(r,l,l1)) out = b = 1;
-	}     
+        l2 = Successor(l,l1);
+        if (l2 == -1) return(0);
+        if (l2 > vl.end)
+          out = 1;
+        else if (Qtest(r,l,l1,l2))
+          out = 1;
+        else{
+          if (!Delete(l,l1)) return(0);
+          l1 = l2;
+          if (Is_left_of(r,l,l1)) out = b = 1;
+        }     
       }
     }
     
@@ -247,9 +245,9 @@ int merge(DT vl,DT vr){
       r = r1;
     else{
       if (Qtest(l,r,r1,l1))
-	r = r1;
+        r = r1;
       else
-	l = l1;
+        l = l1;
     }
   }
   if (!Insert(l,r)) return(0);
@@ -337,7 +335,7 @@ int DelaunayAndVoronoi(DocPeek doc){
    of the circumcircle of triangle (x1,y1),(x2,y2),(x3,y3)  */
   
 int CircumCircle(double x1,double y1,double x2,double y2,double x3,double y3,
-		     double *xc,double *yc){
+                     double *xc,double *yc){
   double d,a1,a2,a3;
   
   
@@ -354,7 +352,7 @@ int CircumCircle(double x1,double y1,double x2,double y2,double x3,double y3,
   *xc = (double) ((a1*(y3-y2) + a2*(y1-y3) + a3*(y2-y1)) / d);
   *yc = (double) ((a1*(x2-x3) + a2*(x3-x1) + a3*(x1-x2)) / d);
   
-  if(fabs(d) < EPSILON_LC)
+  if(fabs(d) < 1.e-12 * LC2D)
     Msg(WARNING, "Points Almost Colinear in CircumCircle (d = %g)", d); 
 
   return(1);
@@ -425,7 +423,7 @@ int DListInsert(DListRecord **dlist, MPoint center, PointNumero newPoint){
     yy = (double) (pPointArray[Succ(p)->point_num].where.v - center.v);
     xx = (double) (pPointArray[Succ(p)->point_num].where.h - center.h);
     alpha = atan2(yy,xx) - alpha1;
-    if (alpha <= EPSILON) alpha += Deux_Pi;
+    if (alpha <= 1.e-15) alpha += Deux_Pi;
     if (alpha >= beta){
       Succ(newp) = Succ(p);
       Succ(p) = newp;
@@ -474,7 +472,7 @@ int DListDelete(DListPeek *dlist,PointNumero oldPoint){
       Succ(Pred(p)) = Succ(p);
       Pred(Succ(p)) = Pred(p);
       if (p == *dlist){
-	*dlist = Succ(p);
+        *dlist = Succ(p);
       }
       Free(p);
       return(1);
@@ -508,9 +506,9 @@ void remove_all_dlist(int n, PointRecord *pPointArray){
     if (pPointArray[i].adjacent != NULL){
       p = pPointArray[i].adjacent;
       do{
-	temp = p;
-	p = Pred(p);
-	Free(temp);          
+        temp = p;
+        p = Pred(p);
+        Free(temp);          
       } while (p != pPointArray[i].adjacent);
       pPointArray[i].adjacent = NULL;     
     }
diff --git a/Mesh/2D_Elliptic.cpp b/Mesh/2D_Elliptic.cpp
index ee5578ce5e..e07f01c6b6 100644
--- a/Mesh/2D_Elliptic.cpp
+++ b/Mesh/2D_Elliptic.cpp
@@ -1,4 +1,4 @@
-/* $Id: 2D_Elliptic.cpp,v 1.2 2000-11-23 14:11:34 geuzaine Exp $ */
+/* $Id: 2D_Elliptic.cpp,v 1.3 2000-11-26 15:43:46 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "Const.h"
@@ -45,13 +45,13 @@ int MeshEllipticSurface (Surface * sur){
     if (!compareVertex (&GG[i]->beg, &S[0])){
       j = i;
       do{
-	if (!List_Nbr (l1))
-	  List_Add (l1, List_Pointer (GG[j]->Vertices, 0));
-	for (k = 1; k < List_Nbr (GG[j]->Vertices); k++)
-	  List_Add (l1, List_Pointer (GG[j]->Vertices, k));
-	j = (j + 1 < nb) ? j + 1 : 0;
-	if (j == i)
-	  return 0;
+        if (!List_Nbr (l1))
+          List_Add (l1, List_Pointer (GG[j]->Vertices, 0));
+        for (k = 1; k < List_Nbr (GG[j]->Vertices); k++)
+          List_Add (l1, List_Pointer (GG[j]->Vertices, k));
+        j = (j + 1 < nb) ? j + 1 : 0;
+        if (j == i)
+          return 0;
       }
       while (compareVertex (&GG[j]->beg, &S[1]));
     }
@@ -62,13 +62,13 @@ int MeshEllipticSurface (Surface * sur){
     if (!compareVertex (&GG[i]->beg, &S[1])){
       j = i;
       do{
-	if (!List_Nbr (l2))
-	  List_Add (l2, List_Pointer (GG[j]->Vertices, 0));
-	for (k = 1; k < List_Nbr (GG[j]->Vertices); k++)
-	  List_Add (l2, List_Pointer (GG[j]->Vertices, k));
-	j = (j + 1 < nb) ? j + 1 : 0;
-	if (j == i)
-	  return 0;
+        if (!List_Nbr (l2))
+          List_Add (l2, List_Pointer (GG[j]->Vertices, 0));
+        for (k = 1; k < List_Nbr (GG[j]->Vertices); k++)
+          List_Add (l2, List_Pointer (GG[j]->Vertices, k));
+        j = (j + 1 < nb) ? j + 1 : 0;
+        if (j == i)
+          return 0;
       }
       while (compareVertex (&GG[j]->beg, &S[2]));
     }
@@ -79,13 +79,13 @@ int MeshEllipticSurface (Surface * sur){
     if (!compareVertex (&GG[i]->beg, &S[2])){
       j = i;
       do{
-	if (!List_Nbr (l3))
-	  List_Add (l3, List_Pointer (GG[j]->Vertices, 0));
-	for (k = 1; k < List_Nbr (GG[j]->Vertices); k++)
-	  List_Add (l3, List_Pointer (GG[j]->Vertices, k));
-	j = (j + 1 < nb) ? j + 1 : 0;
-	if (j == i)
-	  return 0;
+        if (!List_Nbr (l3))
+          List_Add (l3, List_Pointer (GG[j]->Vertices, 0));
+        for (k = 1; k < List_Nbr (GG[j]->Vertices); k++)
+          List_Add (l3, List_Pointer (GG[j]->Vertices, k));
+        j = (j + 1 < nb) ? j + 1 : 0;
+        if (j == i)
+          return 0;
       }
       while (compareVertex (&GG[j]->beg, &S[3]));
     }
@@ -96,13 +96,13 @@ int MeshEllipticSurface (Surface * sur){
     if (!compareVertex (&GG[i]->beg, &S[3])){
       j = i;
       do{
-	if (!List_Nbr (l4))
-	  List_Add (l4, List_Pointer (GG[j]->Vertices, 0));
-	for (k = 1; k < List_Nbr (GG[j]->Vertices); k++)
-	  List_Add (l4, List_Pointer (GG[j]->Vertices, k));
-	j = (j + 1 < nb) ? j + 1 : 0;
-	if (j == i)
-	  return 0;
+        if (!List_Nbr (l4))
+          List_Add (l4, List_Pointer (GG[j]->Vertices, 0));
+        for (k = 1; k < List_Nbr (GG[j]->Vertices); k++)
+          List_Add (l4, List_Pointer (GG[j]->Vertices, k));
+        j = (j + 1 < nb) ? j + 1 : 0;
+        if (j == i)
+          return 0;
       }
       while (compareVertex (&GG[j]->beg, &S[0]));
     }
@@ -127,38 +127,38 @@ int MeshEllipticSurface (Surface * sur){
   for (i = 0; i < N1; i++){
     for (j = 0; j < N2; j++){
       if (i == 0){
-	List_Read (l4, N2 - j - 1, &list[i + N1 * j]);
+        List_Read (l4, N2 - j - 1, &list[i + N1 * j]);
       }
       else if (i == N1 - 1){
-	List_Read (l2, j, &list[i + N1 * j]);
+        List_Read (l2, j, &list[i + N1 * j]);
       }
       else if (j == 0){
-	List_Read (l1, i, &list[i + N1 * j]);
+        List_Read (l1, i, &list[i + N1 * j]);
       }
       else if (j == N2 - 1){
-	List_Read (l3, N1 - i - 1, &list[i + N1 * j]);
+        List_Read (l3, N1 - i - 1, &list[i + N1 * j]);
       }
       else{
-	u = 1. - 2. * (double) i / double (N1 - 1);
-	v = 1. - 2. * (double) j / double (N2 - 1);
-	x = 0.25 * ((S[0]->Pos.X * (1 + u) * (1. + v)) +
-		    (S[1]->Pos.X * (1 - u) * (1. + v)) +
-		    (S[2]->Pos.X * (1 - u) * (1. - v)) +
-		    (S[3]->Pos.X * (1 + u) * (1. - v)));
-	y = 0.25 * ((S[0]->Pos.Y * (1 + u) * (1. + v)) +
-		    (S[1]->Pos.Y * (1 - u) * (1. + v)) +
-		    (S[2]->Pos.Y * (1 - u) * (1. - v)) +
-		    (S[3]->Pos.Y * (1 + u) * (1. - v)));
-	z = 0.25 * ((S[0]->Pos.Z * (1 + u) * (1. + v)) +
-		    (S[1]->Pos.Z * (1 - u) * (1. + v)) +
-		    (S[2]->Pos.Z * (1 - u) * (1. - v)) +
-		    (S[3]->Pos.Z * (1 + u) * (1. - v)));
-	lc = 0.25 * ((S[0]->lc * (1 + u) * (1. + v)) +
-		     (S[1]->lc * (1 - u) * (1. + v)) +
-		     (S[2]->lc * (1 - u) * (1. - v)) +
-		     (S[3]->lc * (1 + u) * (1. - v)));
-	
-	list[i + N1 * j] = Create_Vertex (++CurrentNodeNumber, x, y, z, lc, 0.0);
+        u = 1. - 2. * (double) i / double (N1 - 1);
+        v = 1. - 2. * (double) j / double (N2 - 1);
+        x = 0.25 * ((S[0]->Pos.X * (1 + u) * (1. + v)) +
+                    (S[1]->Pos.X * (1 - u) * (1. + v)) +
+                    (S[2]->Pos.X * (1 - u) * (1. - v)) +
+                    (S[3]->Pos.X * (1 + u) * (1. - v)));
+        y = 0.25 * ((S[0]->Pos.Y * (1 + u) * (1. + v)) +
+                    (S[1]->Pos.Y * (1 - u) * (1. + v)) +
+                    (S[2]->Pos.Y * (1 - u) * (1. - v)) +
+                    (S[3]->Pos.Y * (1 + u) * (1. - v)));
+        z = 0.25 * ((S[0]->Pos.Z * (1 + u) * (1. + v)) +
+                    (S[1]->Pos.Z * (1 - u) * (1. + v)) +
+                    (S[2]->Pos.Z * (1 - u) * (1. - v)) +
+                    (S[3]->Pos.Z * (1 + u) * (1. - v)));
+        lc = 0.25 * ((S[0]->lc * (1 + u) * (1. + v)) +
+                     (S[1]->lc * (1 - u) * (1. + v)) +
+                     (S[2]->lc * (1 - u) * (1. - v)) +
+                     (S[3]->lc * (1 + u) * (1. - v)));
+        
+        list[i + N1 * j] = Create_Vertex (++CurrentNodeNumber, x, y, z, lc, 0.0);
       }
     }
   }
@@ -171,38 +171,38 @@ int MeshEllipticSurface (Surface * sur){
       break;
     for (i = 1; i < N1 - 1; i++){
       for (j = 1; j < N2 - 1; j++){
-	v11 = list[i - 1 + N1 * (j - 1)];
-	v12 = list[i + N1 * (j - 1)];
-	v13 = list[i + 1 + N1 * (j - 1)];
-	v21 = list[i - 1 + N1 * (j)];
-	v22 = list[i + N1 * (j)];
-	v23 = list[i + 1 + N1 * (j)];
-	v31 = list[i - 1 + N1 * (j + 1)];
-	v32 = list[i + N1 * (j + 1)];
-	v33 = list[i + 1 + N1 * (j + 1)];
-	
-	alpha = 0.25 * (DSQR (v23->Pos.X - v21->Pos.X) +
-			DSQR (v23->Pos.Y - v21->Pos.Y));
-	gamma = 0.25 * (DSQR (v32->Pos.X - v12->Pos.X) +
-			DSQR (v32->Pos.Y - v12->Pos.Y));
-	beta = 0.0625 * ((v32->Pos.X - v12->Pos.X) *
-			 (v23->Pos.X - v21->Pos.X) +
-			 (v32->Pos.Y - v12->Pos.Y) *
-			 (v23->Pos.Y - v21->Pos.Y));
-	
-	v22->Pos.X = 0.5 * (alpha * (v32->Pos.X + v12->Pos.X) +
-			    gamma * (v23->Pos.X + v21->Pos.X) -
-			    2. * beta * (v33->Pos.X - v13->Pos.X - v31->Pos.X + v11->Pos.X))
-	  / (alpha + gamma);
-	v22->Pos.Y = 0.5 * (alpha * (v32->Pos.Y + v12->Pos.Y) +
-			    gamma * (v23->Pos.Y + v21->Pos.Y) -
-			    2. * beta * (v33->Pos.Y - v13->Pos.Y - v31->Pos.Y + v11->Pos.Y))
-	  / (alpha + gamma);
-	v22->Pos.Z = 0.5 * (alpha * (v32->Pos.Z + v12->Pos.Z) +
-			    gamma * (v23->Pos.Z + v21->Pos.Z) -
-			    2. * beta * (v33->Pos.Z - v13->Pos.Z - v31->Pos.Z + v11->Pos.Z))
-	  / (alpha + gamma);
-	
+        v11 = list[i - 1 + N1 * (j - 1)];
+        v12 = list[i + N1 * (j - 1)];
+        v13 = list[i + 1 + N1 * (j - 1)];
+        v21 = list[i - 1 + N1 * (j)];
+        v22 = list[i + N1 * (j)];
+        v23 = list[i + 1 + N1 * (j)];
+        v31 = list[i - 1 + N1 * (j + 1)];
+        v32 = list[i + N1 * (j + 1)];
+        v33 = list[i + 1 + N1 * (j + 1)];
+        
+        alpha = 0.25 * (DSQR (v23->Pos.X - v21->Pos.X) +
+                        DSQR (v23->Pos.Y - v21->Pos.Y));
+        gamma = 0.25 * (DSQR (v32->Pos.X - v12->Pos.X) +
+                        DSQR (v32->Pos.Y - v12->Pos.Y));
+        beta = 0.0625 * ((v32->Pos.X - v12->Pos.X) *
+                         (v23->Pos.X - v21->Pos.X) +
+                         (v32->Pos.Y - v12->Pos.Y) *
+                         (v23->Pos.Y - v21->Pos.Y));
+        
+        v22->Pos.X = 0.5 * (alpha * (v32->Pos.X + v12->Pos.X) +
+                            gamma * (v23->Pos.X + v21->Pos.X) -
+                            2. * beta * (v33->Pos.X - v13->Pos.X - v31->Pos.X + v11->Pos.X))
+          / (alpha + gamma);
+        v22->Pos.Y = 0.5 * (alpha * (v32->Pos.Y + v12->Pos.Y) +
+                            gamma * (v23->Pos.Y + v21->Pos.Y) -
+                            2. * beta * (v33->Pos.Y - v13->Pos.Y - v31->Pos.Y + v11->Pos.Y))
+          / (alpha + gamma);
+        v22->Pos.Z = 0.5 * (alpha * (v32->Pos.Z + v12->Pos.Z) +
+                            gamma * (v23->Pos.Z + v21->Pos.Z) -
+                            2. * beta * (v33->Pos.Z - v13->Pos.Z - v31->Pos.Z + v11->Pos.Z))
+          / (alpha + gamma);
+        
       }
     }
     
@@ -210,27 +210,33 @@ int MeshEllipticSurface (Surface * sur){
   for (i = 0; i < N1 - 1; i++){
     for (j = 0; j < N2 - 1; j++){
       if (sur->Recombine){
-	simp = Create_Simplex (list[(i) + N1 * (j)], list[(i + 1) + N1 * (j)],
-			       list[(i + 1) + N1 * (j + 1)], NULL);
-	simp->iEnt = sur->Num;
-	simp->V[3] = list[i + N1 * (j + 1)];
-	Tree_Add (sur->Simplexes, &simp);
-	List_Add (sur->TrsfSimplexes, &simp);
+        simp = Create_Quadrangle
+	  (list[(i) + N1 * (j)], list[(i + 1) + N1 * (j)],
+	   list[(i + 1) + N1 * (j + 1)], list[i + N1 * (j + 1)]);
+        simp->iEnt = sur->Num;
+        Tree_Add (sur->Simplexes, &simp);
+        List_Add (sur->TrsfSimplexes, &simp);
       }
       else{
-	simp = Create_Simplex (list[(i) + N1 * (j)], list[(i + 1) + N1 * (j)],
-			       list[(i) + N1 * (j + 1)], NULL);
-	simp->iEnt = sur->Num;
-	Tree_Add (sur->Simplexes, &simp);
-	List_Add (sur->TrsfSimplexes, &simp);
-	
-	simp = Create_Simplex (list[(i + 1) + N1 * (j + 1)], list[(i) + N1 * (j + 1)],
-			       list[(i + 1) + N1 * (j)], NULL);
-	simp->iEnt = sur->Num;
-	Tree_Add (sur->Simplexes, &simp);
-	List_Add (sur->TrsfSimplexes, &simp);
+        simp = Create_Simplex (list[(i) + N1 * (j)], list[(i + 1) + N1 * (j)],
+                               list[(i) + N1 * (j + 1)], NULL);
+        simp->iEnt = sur->Num;
+        Tree_Add (sur->Simplexes, &simp);
+        List_Add (sur->TrsfSimplexes, &simp);
+        
+        simp = Create_Simplex (list[(i + 1) + N1 * (j + 1)], list[(i) + N1 * (j + 1)],
+                               list[(i + 1) + N1 * (j)], NULL);
+        simp->iEnt = sur->Num;
+        Tree_Add (sur->Simplexes, &simp);
+        List_Add (sur->TrsfSimplexes, &simp);
       }
     }
   }
+
+  // We count this here, to be able to distinguish very quickly
+  // between triangles and quadrangles later
+  if (sur->Recombine)
+    THEM->Statistics[8] += List_Nbr(sur->TrsfSimplexes);
+
   return 1;
 }
diff --git a/Mesh/2D_InitMesh.cpp b/Mesh/2D_InitMesh.cpp
index 529d2ee7ae..167a8b1fa6 100644
--- a/Mesh/2D_InitMesh.cpp
+++ b/Mesh/2D_InitMesh.cpp
@@ -1,4 +1,4 @@
-/* $Id: 2D_InitMesh.cpp,v 1.3 2000-11-23 23:20:35 geuzaine Exp $ */
+/* $Id: 2D_InitMesh.cpp,v 1.4 2000-11-26 15:43:46 geuzaine Exp $ */
 /*
  
    Generation du maillage initial 2D
@@ -14,33 +14,33 @@
        On procede comme suit :
        trouve le triangle, on procede de la facon suivante :
           - on trie les aretes de tous les triangles ;
-	  - Pour chaque contour on prend chaque arete orientee ;
-	  - Si cette arete n'existe pas (bsearch return false) alors on cherche
-	  les 2 triangles reliant cette arete et on les modifie
-	  - Si cette arete possede 2 triangles adjacents, on declare externe 
-	  le triangle dont le troisieme noeud se trouve a gauche de l'arete.
+          - Pour chaque contour on prend chaque arete orientee ;
+          - Si cette arete n'existe pas (bsearch return false) alors on cherche
+          les 2 triangles reliant cette arete et on les modifie
+          - Si cette arete possede 2 triangles adjacents, on declare externe 
+          le triangle dont le troisieme noeud se trouve a gauche de l'arete.
 
-	  illustration
+          illustration
           ------------
 
-	  probleme 1) + = point du contour
-	  
+          probleme 1) + = point du contour
+          
 
                                         3
                         - -  + --------+     +
                    + - -     1 \      /                +
                                 \    /                       +
                                  \  /                                   +
-	     +                     +
+             +                     +
                                    2       3 a gauche de 1-2 -> tr externe
 
 
-	   probleme 2) arete inexistante 1-2
-	   
-	               +,*,@ contours
-	   
-	             +1       	             +            
-	            / \                     /|\
+           probleme 2) arete inexistante 1-2
+           
+                       +,*,@ contours
+           
+                     +1                      +            
+                    / \                     /|\
                    /   \                   / | \
                   /     \                 /  |  \
                  /       \               /   |   \
@@ -252,25 +252,25 @@ int verifie_cas_scabreux (int pa, int pb, ContourRecord **ListContours, int Nc){
     contour = ListContours[k];
     for ( i = -1 ; i < (contour->numpoints - 1) ; i++) {      
       if(i == -1){
-	a = permut [ contour->oriented_points[0].permu ];
-	b = permut [ contour->oriented_points[contour->numpoints - 1].permu ];
+        a = permut [ contour->oriented_points[0].permu ];
+        b = permut [ contour->oriented_points[contour->numpoints - 1].permu ];
       }
       else{
-	a = permut [ contour->oriented_points[i].permu ];
-	b = permut [ contour->oriented_points[i+1].permu ];
+        a = permut [ contour->oriented_points[i].permu ];
+        b = permut [ contour->oriented_points[i+1].permu ];
       }
       
       pointA = IMAX(a,b);
       pointB = IMIN(a,b);
       if(a != pa && b != pa && a != pb && b != pb)
-	if(crossED(&Edge)) return (1);
+        if(crossED(&Edge)) return (1);
     }
   }  
   return (0);
 }
 
 void verify_edges (List_T *ListDelaunay, ContourRecord **ListContour, 
-		   int NumContours , int NumDelaunay){
+                   int NumContours , int NumDelaunay){
 
   ED   *pEdge;
   ED   Edge; 
@@ -294,33 +294,33 @@ void verify_edges (List_T *ListDelaunay, ContourRecord **ListContour,
       Edge.NbOccur = 1;
 
       if((pEdge = (ED*)Tree_PQuery(ETree,&Edge))){ 
-	pEdge->Liste[1] = del_P;
+        pEdge->Liste[1] = del_P;
       }
       else {
-	Edge.Liste[0] = del_P;
-	Tree_Add (ETree,&Edge);
+        Edge.Liste[0] = del_P;
+        Tree_Add (ETree,&Edge);
       }
       
       Edge.from = IMAX ( del_P->t.a, del_P->t.c );
       Edge.to   = IMIN ( del_P->t.a, del_P->t.c );
       
       if((pEdge = (ED*)Tree_PQuery(ETree,&Edge))){ 
-	pEdge->Liste[1] = del_P;
+        pEdge->Liste[1] = del_P;
       }
       else {
-	Edge.Liste[0] = del_P;
-	Tree_Add (ETree,&Edge);
+        Edge.Liste[0] = del_P;
+        Tree_Add (ETree,&Edge);
       }
       
       Edge.from = IMAX ( del_P->t.c, del_P->t.b );
       Edge.to   = IMIN ( del_P->t.c, del_P->t.b );
       
       if((pEdge = (ED*)Tree_PQuery(ETree,&Edge))){ 
-	pEdge->Liste[1] = del_P;
+        pEdge->Liste[1] = del_P;
       }
       else {
-	Edge.Liste[0] = del_P;
-	Tree_Add (ETree,&Edge);
+        Edge.Liste[0] = del_P;
+        Tree_Add (ETree,&Edge);
       }
     }
     
@@ -328,20 +328,20 @@ void verify_edges (List_T *ListDelaunay, ContourRecord **ListContour,
     for(k=0;k<NumContours;k++){
       contour = ListContour[k];
       for ( i = -1 ; i < contour->numpoints - 1 ; i++){      
-	
-	if(i == -1){
-	  a   = permut [ contour->oriented_points[0].permu ];
-	  b   = permut [ contour->oriented_points[contour->numpoints - 1].permu ];
-	}
-	else{
-	  a   = permut [ contour->oriented_points[i].permu ];
-	  b   = permut [ contour->oriented_points[i+1].permu ];
-	}
-	
-	Edge.from = IMAX(a,b);
-	Edge.to   = IMIN(a,b);
-	
-	if(!Tree_Search( ETree , &Edge ))ok++;; 
+        
+        if(i == -1){
+          a   = permut [ contour->oriented_points[0].permu ];
+          b   = permut [ contour->oriented_points[contour->numpoints - 1].permu ];
+        }
+        else{
+          a   = permut [ contour->oriented_points[i].permu ];
+          b   = permut [ contour->oriented_points[i+1].permu ];
+        }
+        
+        Edge.from = IMAX(a,b);
+        Edge.to   = IMIN(a,b);
+        
+        if(!Tree_Search( ETree , &Edge ))ok++;; 
       }
     }
 
@@ -356,21 +356,21 @@ void verify_edges (List_T *ListDelaunay, ContourRecord **ListContour,
     for(k=0;k<NumContours;k++){
       contour = ListContour[k];
       for ( i = -1 ; i < contour->numpoints - 1 ; i++){      
-	
-	if(i == -1){
-	  a   = permut [ contour->oriented_points[0].permu ];
-	  b   = permut [ contour->oriented_points[contour->numpoints - 1].permu ];
-	}
-	else{
-	  a   = permut [ contour->oriented_points[i].permu ];
-	  b   = permut [ contour->oriented_points[i+1].permu ];
-	}
-	
-	pointA = IMAX(a,b);
-	pointB = IMIN(a,b);
-	
-	Tree_Action ( ETree , DoWeSwapED ); 
-	
+        
+        if(i == -1){
+          a   = permut [ contour->oriented_points[0].permu ];
+          b   = permut [ contour->oriented_points[contour->numpoints - 1].permu ];
+        }
+        else{
+          a   = permut [ contour->oriented_points[i].permu ];
+          b   = permut [ contour->oriented_points[i+1].permu ];
+        }
+        
+        pointA = IMAX(a,b);
+        pointB = IMIN(a,b);
+        
+        Tree_Action ( ETree , DoWeSwapED ); 
+        
       }
     }
     Msg(INFOS, "Elimination (%d Swaps)", Tree_Nbr(EDToSwap)); 
diff --git a/Mesh/2D_Links.cpp b/Mesh/2D_Links.cpp
index bc70258737..71f36ef2ce 100644
--- a/Mesh/2D_Links.cpp
+++ b/Mesh/2D_Links.cpp
@@ -1,4 +1,4 @@
-/* $Id: 2D_Links.cpp,v 1.3 2000-11-23 23:20:35 geuzaine Exp $ */
+/* $Id: 2D_Links.cpp,v 1.4 2000-11-26 15:43:46 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "Const.h"
@@ -32,14 +32,14 @@ int CountPointsOnHull(int n, PointRecord *pPointArray){
 
 
 PointNumero *ConvertDlistToArray(DListPeek *dlist,int *n){
-  DListPeek		p,temp;
-  int		        i,max = 0;
-  PointNumero		*ptr;
-	
+  DListPeek             p,temp;
+  int                   i,max = 0;
+  PointNumero           *ptr;
+        
   p = *dlist;
   do{
     max++;
-    p = Pred(p);	
+    p = Pred(p);        
   } while (p != *dlist);
   ptr = (PointNumero *) Malloc((int) ((max+1) * sizeof(PointNumero)));
   if (ptr == NULL) return NULL;
@@ -61,7 +61,7 @@ PointNumero *ConvertDlistToArray(DListPeek *dlist,int *n){
 
 int Conversion(DocPeek doc ){
 
-  /* on suppose que n >= 3	gPointArray est suppose OK. */
+  /* on suppose que n >= 3      gPointArray est suppose OK. */
 
   Striangle *striangle;
   int n,i,j;
@@ -71,14 +71,14 @@ int Conversion(DocPeek doc ){
 
   ptemp = gPointArray;
   gPointArray = doc->points;  
-		
+                
   n = doc->numPoints;
   striangle = (Striangle *) Malloc((int) (n * sizeof(Striangle)));
   count2 = (int) CountPointsOnHull(n,doc->points);
 
   /* nombre de triangles que l'on doit obtenir */
-  count2 = 2 * (n - 1) - count2;	
-	
+  count2 = 2 * (n - 1) - count2;        
+        
   doc->delaunay = (Delaunay *) Malloc(2*count2 * sizeof(Delaunay));
 
   for (i=0;i<n;i++){
@@ -93,13 +93,13 @@ int Conversion(DocPeek doc ){
   for (i=0;i<n;i++){
     for (j=0;j<striangle[i].t_length;j++){
       if ( ( striangle[i].t[j] > i) && ( striangle[i].t[j+1] > i) && 
-	   (Is_right_of(i,striangle[i].t[j],striangle[i].t[j+1])) ) {
-	aa = i;
-	bb = striangle[i].t[j];
-	cc = striangle[i].t[j+1];
-	filldel(&doc->delaunay[count],aa,bb,cc,gPointArray,NULL);
-	count++;	      
-      }	  
+           (Is_right_of(i,striangle[i].t[j],striangle[i].t[j+1])) ) {
+        aa = i;
+        bb = striangle[i].t[j];
+        cc = striangle[i].t[j+1];
+        filldel(&doc->delaunay[count],aa,bb,cc,gPointArray,NULL);
+        count++;              
+      }   
     }
   }
   for (i=0;i<n;i++) Free(striangle[i].t);
@@ -121,7 +121,7 @@ int compareEdge(const void *e1, const void *e2){
    triangles c.a.d determine les voisins de chaque triangle                  */
 
 int CreateLinks(List_T * ListDelaunay , int NumDelaunay, 
-		ContourRecord **ListContours , int Nc){
+                ContourRecord **ListContours , int Nc){
   int i;
   edge *ListEdges;
   MPoint pt;
@@ -136,36 +136,36 @@ int CreateLinks(List_T * ListDelaunay , int NumDelaunay,
     del_Pi = *(Delaunay**)List_Pointer(ListDelaunay, i);
 
     /* arete a b */
-    if (del_Pi->t.a  > del_Pi->t.b ){	
+    if (del_Pi->t.a  > del_Pi->t.b ){   
       ListEdges[3*i].from = del_Pi->t.a;
       ListEdges[3*i].to   = del_Pi->t.b;
-      ListEdges[3*i].num  = i;	
+      ListEdges[3*i].num  = i;  
     }
-    else {	
+    else {      
       ListEdges[3*i].from = del_Pi->t.b;
       ListEdges[3*i].to   = del_Pi->t.a;
       ListEdges[3*i].num  = i;
     }
     
     /* arete  b c */      
-    if (del_Pi->t.b  > del_Pi->t.c ){	
+    if (del_Pi->t.b  > del_Pi->t.c ){   
       ListEdges[3*i+1].from = del_Pi->t.b;
       ListEdges[3*i+1].to   = del_Pi->t.c;
-      ListEdges[3*i+1].num  = i;	
+      ListEdges[3*i+1].num  = i;        
     }
-    else {	
+    else {      
       ListEdges[3*i+1].from = del_Pi->t.c;
       ListEdges[3*i+1].to   = del_Pi->t.b;
       ListEdges[3*i+1].num  = i;
     }
     
     /* arete   c a */
-    if (del_Pi->t.c  > del_Pi->t.a ){	
+    if (del_Pi->t.c  > del_Pi->t.a ){   
       ListEdges[3*i+2].from = del_Pi->t.c;
       ListEdges[3*i+2].to   = del_Pi->t.a;
-      ListEdges[3*i+2].num  = i;	
+      ListEdges[3*i+2].num  = i;        
     }
-    else {	
+    else {      
       ListEdges[3*i+2].from = del_Pi->t.a;
       ListEdges[3*i+2].to   = del_Pi->t.c;
       ListEdges[3*i+2].num  = i;
@@ -180,33 +180,33 @@ int CreateLinks(List_T * ListDelaunay , int NumDelaunay,
   do {
 
     if ( (ListEdges[i].from == ListEdges[i+1].from) &&
-	 (ListEdges[i].to   == ListEdges[i+1].to)){   /* create link */
+         (ListEdges[i].to   == ListEdges[i+1].to)){   /* create link */
 
       del_Pi = *(Delaunay**)List_Pointer(ListDelaunay, ListEdges[i].num);
       del_Pj = *(Delaunay**)List_Pointer(ListDelaunay, ListEdges[i+1].num);
 
       if ( ( del_Pi->t.position != EXTERN ) &&
-	   ( del_Pj->t.position != EXTERN ) &&
-	  ( (del_Pj->t.info == TOLINK ) ||
-	    (del_Pi->t.info == TOLINK ) ) ) {
-
-	if (del_Pi->v.voisin1 == NULL)
-	  del_Pi->v.voisin1 = del_Pj;
-	else if (del_Pi->v.voisin2 == NULL)
-	  del_Pi->v.voisin2 = del_Pj;
-	else if (del_Pi->v.voisin3 == NULL)
-	  del_Pi->v.voisin3 = del_Pj;
-	else
-	  Msg(ERROR, "Bad Link in CreateLinks"); 
-
-	if (del_Pj->v.voisin1 == NULL)
-	  del_Pj->v.voisin1 = del_Pi;
-	else if (del_Pj->v.voisin2 == NULL)
-	  del_Pj->v.voisin2 = del_Pi;
-	else if (del_Pj->v.voisin3 == NULL)
-	  del_Pj->v.voisin3 = del_Pi;
-	else
-	  Msg(ERROR, "Bad Link in CreateLinks"); 
+           ( del_Pj->t.position != EXTERN ) &&
+          ( (del_Pj->t.info == TOLINK ) ||
+            (del_Pi->t.info == TOLINK ) ) ) {
+
+        if (del_Pi->v.voisin1 == NULL)
+          del_Pi->v.voisin1 = del_Pj;
+        else if (del_Pi->v.voisin2 == NULL)
+          del_Pi->v.voisin2 = del_Pj;
+        else if (del_Pi->v.voisin3 == NULL)
+          del_Pi->v.voisin3 = del_Pj;
+        else
+          Msg(ERROR, "Bad Link in CreateLinks"); 
+
+        if (del_Pj->v.voisin1 == NULL)
+          del_Pj->v.voisin1 = del_Pi;
+        else if (del_Pj->v.voisin2 == NULL)
+          del_Pj->v.voisin2 = del_Pi;
+        else if (del_Pj->v.voisin3 == NULL)
+          del_Pj->v.voisin3 = del_Pi;
+        else
+          Msg(ERROR, "Bad Link in CreateLinks"); 
       }
       i+=2;
     }
@@ -224,13 +224,13 @@ int CreateLinks(List_T * ListDelaunay , int NumDelaunay,
       pt.v = del_Pi->t.yc;
 
       if(!PtInTriangle(pt, del_Pi->t.a, del_Pi->t.b,
-		       del_Pi->t.c)){
-	if(!Find_Triangle(pt,FGMESH,A_TOUT_PRIX)){
-	  if(LocalNewPoint == VORONOI_INSERT) {
-	    del_Pi->t.position = ACCEPTED;
-	  }
-	  del_Pi->t.quality_value /= 1000.;
-	}
+                       del_Pi->t.c)){
+        if(!Find_Triangle(pt,FGMESH,A_TOUT_PRIX)){
+          if(LocalNewPoint == VORONOI_INSERT) {
+            del_Pi->t.position = ACCEPTED;
+          }
+          del_Pi->t.quality_value /= 1000.;
+        }
       }
     }
   }
@@ -239,25 +239,25 @@ int CreateLinks(List_T * ListDelaunay , int NumDelaunay,
     for(i=0 ; i<NumDelaunay ;i++){
       del_Pi = *(Delaunay**)List_Pointer(ListDelaunay, i);
       if( ((del_Pi->t.position == NONACCEPTED ) || (del_Pi->t.position == INTERN ))  &&
-	 (del_Pi->t.info == TOLINK )){
+         (del_Pi->t.info == TOLINK )){
         if ((del_Pi->v.voisin1 == NULL) || 
-	    (del_Pi->v.voisin2 == NULL) || 
-	    (del_Pi->v.voisin3 == NULL)){
-	  del_Pi->t.position = ACTIF;
-	}
-	else if ((del_Pi->v.voisin1->t.position == ACCEPTED) && 
-		 (del_Pi->v.voisin2->t.position == ACCEPTED) && 
-		 (del_Pi->v.voisin3->t.position == ACCEPTED)){
-	  del_Pi->t.position = ACCEPTED;
-	}
-	else if ((del_Pi->v.voisin1->t.position == ACCEPTED) || 
-		 (del_Pi->v.voisin2->t.position == ACCEPTED) || 
-		 (del_Pi->v.voisin3->t.position == ACCEPTED)){
-	  del_Pi->t.position = ACTIF;
-	}
-	else {
-	  del_Pi->t.position = WAITING;
-	}
+            (del_Pi->v.voisin2 == NULL) || 
+            (del_Pi->v.voisin3 == NULL)){
+          del_Pi->t.position = ACTIF;
+        }
+        else if ((del_Pi->v.voisin1->t.position == ACCEPTED) && 
+                 (del_Pi->v.voisin2->t.position == ACCEPTED) && 
+                 (del_Pi->v.voisin3->t.position == ACCEPTED)){
+          del_Pi->t.position = ACCEPTED;
+        }
+        else if ((del_Pi->v.voisin1->t.position == ACCEPTED) || 
+                 (del_Pi->v.voisin2->t.position == ACCEPTED) || 
+                 (del_Pi->v.voisin3->t.position == ACCEPTED)){
+          del_Pi->t.position = ACTIF;
+        }
+        else {
+          del_Pi->t.position = WAITING;
+        }
       }
     }
   }
diff --git a/Mesh/2D_Mesh.cpp b/Mesh/2D_Mesh.cpp
index bbcc66611c..5b2bf9a6ef 100644
--- a/Mesh/2D_Mesh.cpp
+++ b/Mesh/2D_Mesh.cpp
@@ -1,4 +1,4 @@
-/* $Id: 2D_Mesh.cpp,v 1.6 2000-11-25 15:26:11 geuzaine Exp $ */
+/* $Id: 2D_Mesh.cpp,v 1.7 2000-11-26 15:43:46 geuzaine Exp $ */
 /*
    Maillage Delaunay d'une surface (Point insertion Technique)
 
@@ -27,7 +27,6 @@
 extern Mesh       *THEM;
 extern Context_T   CTX;
 extern int         CurrentNodeNumber;
-extern double      LC;
 
 int LocalNewPoint;
 
@@ -35,6 +34,7 @@ PointRecord   *gPointArray;
 DocRecord     *BGMESH, *FGMESH;
 double         qual, newqual, L;
 int            is_3D = 0, UseBGMesh;
+double         LC2D ;
 
 static Surface  *THESURFACE, *THESUPPORT;
 
@@ -83,9 +83,9 @@ void Plan_Moyen (void *data, void *dum){
     for (i = 0; i < List_Nbr (s->s.Generatrices); i++){
       List_Read (s->s.Generatrices, i, &pC);
       for (j = 0; j < List_Nbr (pC->Vertices); j++){
-	List_Read (pC->Vertices, j, &v);
-	List_Add (points, &v);
-	Tree_Insert (s->Vertices, List_Pointer (pC->Vertices, j));
+        List_Read (pC->Vertices, j, &v);
+        List_Add (points, &v);
+        Tree_Insert (s->Vertices, List_Pointer (pC->Vertices, j));
       }
     }
     break;
@@ -114,11 +114,11 @@ void Plan_Moyen (void *data, void *dum){
     }
     else{
       if (X != v->Pos.X)
-	ix = 1;
+        ix = 1;
       if (Y != v->Pos.Y)
-	iy = 1;
+        iy = 1;
       if (Z != v->Pos.Z)
-	iz = 1;
+        iz = 1;
     }
     
     sys[0][0] += v->Pos.X * v->Pos.X;
@@ -191,31 +191,31 @@ void Plan_Moyen (void *data, void *dum){
       b[0] = -sys[0][1];
       b[1] = -sys[1][2];
       if (sys2x2 (s2s, b, r2)){
-	res[0] = r2[0];
-	res[1] = 1.;
-	res[2] = r2[1];
-	Msg(DEBUG, "Plan Type ax + cz = -y");
+        res[0] = r2[0];
+        res[1] = 1.;
+        res[2] = r2[1];
+        Msg(DEBUG, "Plan Type ax + cz = -y");
       }
       
       /* ax + by = -z */
       
       else{
-	s->d = 1.0;
-	s2s[0][0] = sys[0][0];
-	s2s[0][1] = sys[0][1];
-	s2s[1][0] = sys[0][1];
-	s2s[1][1] = sys[1][1];
-	b[0] = -sys[0][2];
-	b[1] = -sys[1][2];
-	if (sys2x2 (s2s, b, r2)){
-	  res[0] = r2[0];
-	  res[1] = r2[1];
-	  res[2] = 1.;
-	  Msg(DEBUG, "Plan Type ax + by = -z");
-	}
-	else{
-	  Msg(ERROR, "Mean Plane");
-	}
+        s->d = 1.0;
+        s2s[0][0] = sys[0][0];
+        s2s[0][1] = sys[0][1];
+        s2s[1][0] = sys[0][1];
+        s2s[1][1] = sys[1][1];
+        b[0] = -sys[0][2];
+        b[1] = -sys[1][2];
+        if (sys2x2 (s2s, b, r2)){
+          res[0] = r2[0];
+          res[1] = r2[1];
+          res[2] = 1.;
+          Msg(DEBUG, "Plan Type ax + by = -z");
+        }
+        else{
+          Msg(ERROR, "Mean Plane");
+        }
       }
     }
   }
@@ -270,15 +270,15 @@ void Plan_Moyen (void *data, void *dum){
   if (!iz){
     for (i = 0; i < 3; i++){
       for (j = 0; j < 3; j++){
-	s->invplan[i][j] = (i == j) ? 1. : 0.;
-	s->plan[i][j] = (i == j) ? 1. : 0.;
+        s->invplan[i][j] = (i == j) ? 1. : 0.;
+        s->plan[i][j] = (i == j) ? 1. : 0.;
       }
     }
   }
   else{
     for (i = 0; i < 3; i++){
       for (j = 0; j < 3; j++){
-	s->invplan[i][j] = s->plan[j][i];
+        s->invplan[i][j] = s->plan[j][i];
       }
     }
   }
@@ -303,24 +303,24 @@ int Calcule_Contours (Surface * s){
       List_Read (c->Vertices, j, &v);
       List_Add (l, &v);
       if (j == List_Nbr (c->Vertices) - 1){
-	last = v;
+        last = v;
       }
     }
     if (!compareVertex (&last, &first)){
       ori = Oriente (l, n);
 
       /* Le premier contour est oriente aire a droite
-	 Les autes sont des trous orientes aire a gauche */
+         Les autes sont des trous orientes aire a gauche */
       
       if (!List_Nbr (s->Contours))
-	ORI = ori;
+        ORI = ori;
 
       if ((!List_Nbr (s->Contours) && !ori) ||
-	  (List_Nbr (s->Contours) && ori)){
-	linv = List_Create (10, 10, sizeof (Vertex *));
-	List_Invert (l, linv);
-	List_Delete (l);
-	l = linv;
+          (List_Nbr (s->Contours) && ori)){
+        linv = List_Create (10, 10, sizeof (Vertex *));
+        List_Invert (l, linv);
+        List_Delete (l);
+        l = linv;
       }
       List_Add (s->Contours, &l);
       l = List_Create (10, 10, sizeof (Vertex *));
@@ -419,11 +419,11 @@ Delaunay * testconv (avlptr * root, int *conv, DocRecord * ptr){
     case CENTER_CIRCCIRC:
     case BARYCENTER:
       if (qual < CONV_VALUE)
-	*conv = 1;
+        *conv = 1;
       break;
     case VORONOI_INSERT:
       if ((*root) == NULL)
-	*conv = 1;
+        *conv = 1;
       break;
     }
   }
@@ -432,8 +432,8 @@ Delaunay * testconv (avlptr * root, int *conv, DocRecord * ptr){
 
 
 int mesh_domain (ContourPeek * ListContours, int numcontours,
-		 maillage * mai, int *numpoints, DocRecord * BGMesh,
-		 int OnlyTheInitialMesh){
+                 maillage * mai, int *numpoints, DocRecord * BGMesh,
+                 int OnlyTheInitialMesh){
   List_T *kill_L, *del_L ;
   MPoint pt;
   DocRecord docm, *doc;
@@ -474,15 +474,15 @@ int mesh_domain (ContourPeek * ListContours, int numcontours,
   for (i = 0; i < numcontours; i++){
     for (j = 0; j < ListContours[i]->numpoints; j++){
       doc->points[numact + j].where.h =
-	ListContours[i]->oriented_points[j].where.h
-	+ ListContours[i]->perturbations[j].h;
+        ListContours[i]->oriented_points[j].where.h
+        + ListContours[i]->perturbations[j].h;
       doc->points[numact + j].where.v =
-	ListContours[i]->oriented_points[j].where.v
-	+ ListContours[i]->perturbations[j].v;
+        ListContours[i]->oriented_points[j].where.v
+        + ListContours[i]->perturbations[j].v;
       doc->points[numact + j].quality =
-	ListContours[i]->oriented_points[j].quality;
+        ListContours[i]->oriented_points[j].quality;
       doc->points[numact + j].initial =
-	ListContours[i]->oriented_points[j].initial;
+        ListContours[i]->oriented_points[j].initial;
       ListContours[i]->oriented_points[j].permu = numact + j;
       doc->points[numact + j].permu = numact + j;
       doc->points[numact + j].numcontour = ListContours[i]->numerocontour;
@@ -535,21 +535,21 @@ int mesh_domain (ContourPeek * ListContours, int numcontours,
       switch (LocalNewPoint){
       case CENTER_CIRCCIRC:
       case BARYCENTER:
-	Insert_Triangle (root, del);
-	break;
+        Insert_Triangle (root, del);
+        break;
       case VORONOI_INSERT:
-	switch (del->t.position){
-	case ACTIF:
-	case INTERN:
-	  Insert_Triangle (root, del);
-	  break;
-	case WAITING:
-	  Insert_Triangle (root_w, del);
-	  break;
-	case ACCEPTED:
-	  Insert_Triangle (root_acc, del);
-	  break;
-	}
+        switch (del->t.position){
+        case ACTIF:
+        case INTERN:
+          Insert_Triangle (root, del);
+          break;
+        case WAITING:
+          Insert_Triangle (root_w, del);
+          break;
+        case ACCEPTED:
+          Insert_Triangle (root_acc, del);
+          break;
+        }
       }
     }
   }
@@ -588,23 +588,23 @@ int mesh_domain (ContourPeek * ListContours, int numcontours,
       switch (LocalNewPoint){
       case CENTER_CIRCCIRC:
       case BARYCENTER:
-	Insert_Triangle (root, del);
-	break;
+        Insert_Triangle (root, del);
+        break;
       case VORONOI_INSERT:
-	del->t.position = ACCEPTED;
-	Insert_Triangle (root_acc, del);
-	break;
+        del->t.position = ACCEPTED;
+        Insert_Triangle (root_acc, del);
+        break;
       }
       
       numlink = numkil = 0;
       if (list != NULL){
-	p = list;
-	do{
-	  q = p;
-	  p = Pred (p);
-	  Free (q);
-	}
-	while (p != list);
+        p = list;
+        do{
+          q = p;
+          p = Pred (p);
+          Free (q);
+        }
+        while (p != list);
       }
       list = NULL;
       del = testconv (root, &conv, doc);
@@ -621,9 +621,9 @@ int mesh_domain (ContourPeek * ListContours, int numcontours,
       bb = p->point_num;
       cc = q->point_num;
       volume_new += fabs ((doc->points[bb].where.h - pt.h) *
-			  (doc->points[cc].where.v - doc->points[bb].where.v) -
-			  (doc->points[cc].where.h - doc->points[bb].where.h) *
-			  (doc->points[bb].where.v - pt.v));
+                          (doc->points[cc].where.v - doc->points[bb].where.v) -
+                          (doc->points[cc].where.h - doc->points[bb].where.h) *
+                          (doc->points[bb].where.v - pt.v));
       p = q;
     } while (p != list);
 
@@ -634,9 +634,9 @@ int mesh_domain (ContourPeek * ListContours, int numcontours,
       bb = del_P->t.b;
       cc = del_P->t.c;
       volume_old += fabs ((doc->points[bb].where.h - doc->points[aa].where.h) *
-			  (doc->points[cc].where.v - doc->points[bb].where.v) -
-			  (doc->points[cc].where.h - doc->points[bb].where.h) *
-			  (doc->points[bb].where.v - doc->points[aa].where.v));
+                          (doc->points[cc].where.v - doc->points[bb].where.v) -
+                          (doc->points[cc].where.h - doc->points[bb].where.h) *
+                          (doc->points[bb].where.v - doc->points[aa].where.v));
     }
     
     if ((volume_old - volume_new) / (volume_old + volume_new) > 1.e-6){
@@ -647,22 +647,22 @@ int mesh_domain (ContourPeek * ListContours, int numcontours,
       switch (LocalNewPoint){
       case CENTER_CIRCCIRC:
       case BARYCENTER:
-	Insert_Triangle (root, del);
-	break;
+        Insert_Triangle (root, del);
+        break;
       case VORONOI_INSERT:
-	del->t.position = ACCEPTED;
-	Insert_Triangle (root_acc, del);
-	break;
+        del->t.position = ACCEPTED;
+        Insert_Triangle (root_acc, del);
+        break;
       }
 
       numlink = numkil = 0;
       if (list != NULL){
-	p = list;
-	do{
-	  q = p;
-	  p = Pred (p);
-	  Free (q);
-	} while (p != list);
+        p = list;
+        do{
+          q = p;
+          p = Pred (p);
+          Free (q);
+        } while (p != list);
       }
       list = NULL;
       del = testconv (root, &conv, doc);
@@ -677,21 +677,21 @@ int mesh_domain (ContourPeek * ListContours, int numcontours,
       switch (LocalNewPoint){
       case CENTER_CIRCCIRC:
       case BARYCENTER:
-	Delete_Triangle (root, del_P);
-	break;
+        Delete_Triangle (root, del_P);
+        break;
       case VORONOI_INSERT:
-	switch (del_P->t.position){
-	case WAITING:
-	  Delete_Triangle (root_w, del_P);
-	  break;
-	case ACTIF:
-	case INTERN:
-	  Delete_Triangle (root, del_P);
-	  break;
-	case ACCEPTED:
-	  Delete_Triangle (root_acc, del_P);
-	  break;
-	}
+        switch (del_P->t.position){
+        case WAITING:
+          Delete_Triangle (root_w, del_P);
+          break;
+        case ACTIF:
+        case INTERN:
+          Delete_Triangle (root, del_P);
+          break;
+        case ACCEPTED:
+          Delete_Triangle (root_acc, del_P);
+          break;
+        }
       }
     }
 
@@ -735,21 +735,21 @@ int mesh_domain (ContourPeek * ListContours, int numcontours,
       switch (LocalNewPoint) {
       case CENTER_CIRCCIRC:
       case BARYCENTER:
-	Insert_Triangle (root, del_P);
-	break;
+        Insert_Triangle (root, del_P);
+        break;
       case VORONOI_INSERT:
-	switch (del_P->t.position){
-	case ACTIF:
-	case INTERN:
-	  Insert_Triangle (root, del_P);
-	  break;
-	case WAITING:
-	  Insert_Triangle (root_w, del_P);
-	  break;
-	case ACCEPTED:
-	  Insert_Triangle (root_acc, del_P);
-	  break;
-	}
+        switch (del_P->t.position){
+        case ACTIF:
+        case INTERN:
+          Insert_Triangle (root, del_P);
+          break;
+        case WAITING:
+          Insert_Triangle (root_w, del_P);
+          break;
+        case ACCEPTED:
+          Insert_Triangle (root_acc, del_P);
+          break;
+        }
       }
     }
     
@@ -808,9 +808,9 @@ int mesh_domain (ContourPeek * ListContours, int numcontours,
 
     mai->listdel[i]->v.voisin1 = NULL;
     if (((doc->points[b].where.h - doc->points[a].where.h) *
-	 (doc->points[c].where.v - doc->points[b].where.v) -
-	 (doc->points[c].where.h - doc->points[b].where.h) *
-	 (doc->points[b].where.v - doc->points[a].where.v)) > 0.0){
+         (doc->points[c].where.v - doc->points[b].where.v) -
+         (doc->points[c].where.h - doc->points[b].where.h) *
+         (doc->points[b].where.v - doc->points[a].where.v)) > 0.0){
       mai->listdel[i]->t.a = b;
       mai->listdel[i]->t.b = a;
     }
@@ -825,6 +825,8 @@ void Maillage_Automatique_VieuxCode (Surface * pS, Mesh * m, int ori){
   maillage M;
   int err, i, j, k, N, a, b, d;
   Simplex *s;
+  double Xmin, Xmax, Ymin, Ymax;
+
 
   if (m->BGM.Typ == WITHPOINTS){
     is_3D = 0;
@@ -844,13 +846,33 @@ void Maillage_Automatique_VieuxCode (Surface * pS, Mesh * m, int ori){
     cp->oriented_points = (PointRecord *) Malloc (List_Nbr (c) * sizeof (PointRecord));
     cp->perturbations = (MPoint *) Malloc (List_Nbr (c) * sizeof (MPoint));
     cp->numerocontour = i;
+
+    for (j = 0; j < List_Nbr (c); j++){
+      List_Read (c, j, &v);
+      if(!j){
+        Xmin = Xmax = v->Pos.X ;
+        Ymin = Ymax = v->Pos.Y ;
+      }
+      else{
+        Xmin = DMIN(Xmin, v->Pos.X) ;
+        Xmax = DMAX(Xmax, v->Pos.X) ;
+        Ymin = DMIN(Ymin, v->Pos.Y) ;
+        Ymax = DMAX(Ymax, v->Pos.Y) ;
+      }
+    }
+
+    LC2D = sqrt(DSQR(Xmax-Xmin)+DSQR(Ymax-Ymin));
+
     for (j = 0; j < List_Nbr (c); j++){
       List_Read (c, j, &v);
       cp->oriented_points[j].where.h = v->Pos.X;
       cp->oriented_points[j].where.v = v->Pos.Y;
 
-      cp->perturbations[j].h = 10*RAND_LONG;
-      cp->perturbations[j].v = 10*RAND_LONG;
+      cp->perturbations[j].h = CTX.mesh.rand_factor * LC2D * rand()/RAND_MAX;
+      cp->perturbations[j].v = CTX.mesh.rand_factor * LC2D * rand()/RAND_MAX;
+      //cp->perturbations[j].h = RAND_LONG;
+      //cp->perturbations[j].v = RAND_LONG;
+
       cp->oriented_points[j].numcontour = i;
       cp->oriented_points[j].quality = v->lc;
       cp->oriented_points[j].permu = k++;
@@ -867,9 +889,9 @@ void Maillage_Automatique_VieuxCode (Surface * pS, Mesh * m, int ori){
     if (gPointArray[i].initial < 0){
       gPointArray[i].initial = ++CurrentNodeNumber;
       v = Create_Vertex (gPointArray[i].initial, gPointArray[i].where.h,
-			 gPointArray[i].where.v, 0.0, gPointArray[i].quality, 0.0);
+                         gPointArray[i].where.v, 0.0, gPointArray[i].quality, 0.0);
       if (!Tree_Search (pS->Vertices, &v))
-	Tree_Add (pS->Vertices, &v);
+        Tree_Add (pS->Vertices, &v);
     }
   }
   for (i = 0; i < 3; i++)
@@ -889,8 +911,8 @@ void Maillage_Automatique_VieuxCode (Surface * pS, Mesh * m, int ori){
       if ((pp[j] = (Vertex **) Tree_PQuery (pS->Vertices, &ver[j]))){
       }
       else{
-	err = 1;
-	Msg(ERROR, "Unknown Vertex %d", ver[j]->Num);
+        err = 1;
+        Msg(ERROR, "Unknown Vertex %d", ver[j]->Num);
       }
     }
     if (ori && !err)
@@ -916,7 +938,7 @@ void Make_Mesh_With_Points (DocRecord * ptr, PointRecord * Liste, int Numpoints)
 }
 
 void filldel (Delaunay * deladd, int aa, int bb, int cc,
-	      PointRecord * points, DocRecord * mesh){
+              PointRecord * points, DocRecord * mesh){
 
   double newqual, L;
   MPoint pt2, pt4;
@@ -932,13 +954,13 @@ void filldel (Delaunay * deladd, int aa, int bb, int cc,
   deladd->v.voisin3 = NULL;
 
   CircumCircle (points[aa].where.h,
-		points[aa].where.v,
-		points[bb].where.h,
-		points[bb].where.v,
-		points[cc].where.h,
-		points[cc].where.v,
-		&deladd->t.xc,
-		&deladd->t.yc);
+                points[aa].where.v,
+                points[bb].where.h,
+                points[bb].where.v,
+                points[cc].where.h,
+                points[cc].where.v,
+                &deladd->t.xc,
+                &deladd->t.yc);
 
   pt2.h = deladd->t.xc;
   pt2.v = deladd->t.yc;
@@ -967,8 +989,8 @@ void filldel (Delaunay * deladd, int aa, int bb, int cc,
   case BARYCENTER:
     deladd->t.quality_value =
       sqrt ((deladd->t.xc - points[cc].where.h) * (deladd->t.xc - points[cc].where.h) +
-	    (deladd->t.yc - points[cc].where.v) * (deladd->t.yc - points[cc].where.v)
-	    ) / newqual;
+            (deladd->t.yc - points[cc].where.v) * (deladd->t.yc - points[cc].where.v)
+            ) / newqual;
     deladd->t.position = INTERN;
     break;
     
@@ -1030,8 +1052,8 @@ void Maillage_Surface (void *data, void *dum){
     Tree_Action (s->Vertices, Add_In_Mesh);
     if (CTX.mesh.degree == 2)
       Degre2 (THEM->Vertices, s->Vertices, s->Simplexes, NULL, s);
-    THEM->Statistics[5] += Tree_Nbr (THESURFACE->Vertices);
-    THEM->Statistics[7] += Tree_Nbr (THESURFACE->Simplexes);
+    THEM->Statistics[5] += Tree_Nbr(THESURFACE->Vertices);
+    THEM->Statistics[7] += Tree_Nbr(THESURFACE->Simplexes);
 
     /* void TRIE_MON_GARS(void *a, void *b);
        Tree_Action (THES->Simplexes, TRIE_MON_GARS);
@@ -1102,7 +1124,7 @@ void Maillage_Surface (void *data, void *dum){
   if (CTX.mesh.degree == 2)
     Degre2 (THEM->Vertices, THEM->VertexEdges, s->Simplexes, NULL, THESUPPORT);
 
-  THEM->Statistics[5] += Tree_Nbr (THESURFACE->Vertices);
-  THEM->Statistics[7] += Tree_Nbr (THESURFACE->Simplexes);
+  THEM->Statistics[5] += Tree_Nbr(THESURFACE->Vertices);
+  THEM->Statistics[7] += Tree_Nbr(THESURFACE->Simplexes);
 
 }
diff --git a/Mesh/2D_Mesh.h b/Mesh/2D_Mesh.h
index dccc974d97..2713dedb86 100644
--- a/Mesh/2D_Mesh.h
+++ b/Mesh/2D_Mesh.h
@@ -1,4 +1,4 @@
-/* $Id: 2D_Mesh.h,v 1.3 2000-11-23 15:05:59 geuzaine Exp $ */
+/* $Id: 2D_Mesh.h,v 1.4 2000-11-26 15:43:46 geuzaine Exp $ */
 #ifndef _2D_MESH_H_
 #define _2D_MESH_H_
 
@@ -13,18 +13,18 @@ typedef avlstruct *avlptr;
 
 int  remove_tree (avlstruct ** root);
 int  insert_avltree (avlstruct ** root, void *item, 
-		     int (*fcmp)(void *a, void *b));
+                     int (*fcmp)(void *a, void *b));
 int  delete_avltree (avlstruct ** root, void *item, 
-		     int (*fcmp)(void *a, void *b));
+                     int (*fcmp)(void *a, void *b));
 int  avltree_remove (avlstruct **root);
 void avltree_count (avlptr root, int *numtri);
 void avltree_print (avlptr root, Delaunay **listdel, int *numtri);
 int  avltree_insert (avlstruct **root, void *item, 
-		     int (*fcmp)(void *a, void *b));
+                     int (*fcmp)(void *a, void *b));
 int  avltree_delete (avlstruct **root, void *item, 
-		     int (*fcmp)(void *a, void *b));
+                     int (*fcmp)(void *a, void *b));
 void findtree(avlptr root, double *qualm, 
-	      Delaunay **delf, DocRecord *MESH);
+              Delaunay **delf, DocRecord *MESH);
 Delaunay *findrightest(avlptr root, DocRecord *MESH);
 
 
@@ -34,7 +34,7 @@ Delaunay * Find_Triangle (MPoint pt, DocRecord *MESH, int typ);
 int Insert_Triangle (avlstruct **root, Delaunay * del);
 int Delete_Triangle ( avlstruct **root, Delaunay * del );
 int Insert_Point (MPoint pt, int *numpoints, int *numalloc, 
-		  DocRecord *doc, DocRecord *BGM, int is3d);
+                  DocRecord *doc, DocRecord *BGM, int is3d);
 MPoint Localize (Delaunay * del , DocRecord *MESH);
 void alloue_Mai_Pts(maillage *mai , int Nballoc , int incrAlloc);
 void alloue_Mai_Del(maillage *mai , int Nballoc , int incrAlloc);
@@ -45,28 +45,28 @@ int DelaunayAndVoronoi(DocPeek doc);
 
 int Conversion(DocPeek doc );
 int CreateLinks(List_T * ListDelaunay , int NumDelaunay, 
-		ContourRecord **ListContours , int Nc);
+                ContourRecord **ListContours , int Nc);
 
 void makepermut (int numpoints);
 void verify_edges (List_T *ListDelaunay, ContourRecord **ListContour, 
-		   int NumContours , int NumDelaunay);
+                   int NumContours , int NumDelaunay);
 void verify_inside (Delaunay * ListDelaunay ,  int NumDelaunay );
 
 void PushgPointArray(PointRecord *ptr);
 void remove_all_dlist(int n, PointRecord *pPointArray);
 
 int PE_Del_Triangle (Delaunay *del , MPoint pt, DListPeek *ListEdges ,
-		     List_T *listkill, List_T *listDelforlink,
-		     int *numlink, int *numdel);
+                     List_T *listkill, List_T *listDelforlink,
+                     int *numlink, int *numdel);
 
 void filldel (Delaunay * deladd, int aa, int bb, int cc,
-	      PointRecord * points, DocRecord * mesh);
+              PointRecord * points, DocRecord * mesh);
 
 int CircumCircle(double x1,double y1,double x2,double y2,double x3,double y3,
-		 double *xc,double *yc);
+                 double *xc,double *yc);
 double find_quality (MPoint center, DocRecord * BGMESH);
 void create_NXE (Tree_T * TreeAllNod, Tree_T * TreeAllElg,
-		 Tree_T * TreeAllNXE);
+                 Tree_T * TreeAllNXE);
 
 int Is_left_of(PointNumero x,PointNumero y,PointNumero check);
 int Is_right_of(PointNumero x,PointNumero y,PointNumero check);
diff --git a/Mesh/2D_Mesh_Aniso.cpp b/Mesh/2D_Mesh_Aniso.cpp
index 5bcc6ea6b7..9e1dc03308 100644
--- a/Mesh/2D_Mesh_Aniso.cpp
+++ b/Mesh/2D_Mesh_Aniso.cpp
@@ -1,4 +1,4 @@
-/* $Id: 2D_Mesh_Aniso.cpp,v 1.7 2000-11-25 15:26:11 geuzaine Exp $ */
+/* $Id: 2D_Mesh_Aniso.cpp,v 1.8 2000-11-26 15:43:46 geuzaine Exp $ */
 /*
    Jean-Francois Remacle
 
@@ -17,9 +17,10 @@
 #include "Numeric.h"
 
 extern Context_T CTX ;
+extern double LC2D ;
 
 void draw_polygon_2d (double r, double g, double b, int n, 
-		      double *x, double *y, double *z);
+                      double *x, double *y, double *z);
 
 MeshParameters:: MeshParameters ():
   NbSmoothing (3),
@@ -34,7 +35,7 @@ MeshParameters:: MeshParameters ():
 extern Simplex MyNewBoundary;
 extern Mesh *THEM;
 extern int CurrentNodeNumber;
-extern double MAXIMUM_LC_FOR_SURFACE, LC;
+extern double MAXIMUM_LC_FOR_SURFACE;
 extern int Alerte_Point_Scabreux;
 extern PointRecord *gPointArray;
 extern Surface *PARAMETRIC;
@@ -95,7 +96,7 @@ void matXmat (int n, double mat1[3][3], double mat2[3][3], double Res[3][3]){
     for (int j = 0; j < n; j++){
       Res[i][j] = 0.0;
       for (int k = 0; k < n; k++)
-	Res[i][j] += mat1[i][k] * mat2[k][j];
+        Res[i][j] += mat1[i][k] * mat2[k][j];
     }
   }
 }
@@ -105,7 +106,7 @@ void TmatXmat (int n, double mat1[3][3], double mat2[3][3], double Res[3][3]){
     for (int j = 0; j < n; j++){
       Res[i][j] = 0.0;
       for (int k = 0; k < n; k++)
-	Res[i][j] += mat1[k][i] * mat2[k][j];
+        Res[i][j] += mat1[k][i] * mat2[k][j];
     }
   }
 }
@@ -127,9 +128,9 @@ Simplex * Create_Simplex_For2dmesh (Vertex * v1, Vertex * v2, Vertex * v3, Verte
       prosca (v2->us, v3->us, &p23);
       p23 = fabs (p23);
       if (s->Quality < CONV_VALUE && 
-	  (p12 < THEM->Metric->min_cos || p13 < THEM->Metric->min_cos ||
-	   p23 < THEM->Metric->min_cos))
-	s->Quality = 1.0;
+          (p12 < THEM->Metric->min_cos || p13 < THEM->Metric->min_cos ||
+           p23 < THEM->Metric->min_cos))
+        s->Quality = 1.0;
     }
   }
   return s;
@@ -151,11 +152,11 @@ void Box_2_Triangles (List_T * P, Surface * s){
 
   int i, j;
   static int pts[4][2] = { {0, 0},
-			   {1, 0},
-			   {1, 1},
-			   {0, 1} };
+                           {1, 0},
+                           {1, 1},
+                           {0, 1} };
   static int tri[2][3] =  { {1, 4, 2},
-			    {2, 4, 3} };
+                            {2, 4, 3} };
   double Xm, Ym, XM, YM, Xc, Yc;
   Simplex *S, *ps;
   Vertex *V, *v, *pv;
@@ -198,7 +199,7 @@ void Box_2_Triangles (List_T * P, Surface * s){
 
   /* Longueur Caracteristique */
 
-  LC = sqrt (Xc * Xc + Yc * Yc);
+  LC2D = sqrt (Xc * Xc + Yc * Yc);
 
   for (i = 0; i < 4; i++){
     if (pts[i][0])
@@ -224,7 +225,7 @@ void Box_2_Triangles (List_T * P, Surface * s){
 
   for (i = 0; i < 2; i++){
     S = Create_Simplex_For2dmesh (&V[tri[i][0] - 1], &V[tri[i][1] - 1], 
-				  &V[tri[i][2] - 1], NULL);
+                                  &V[tri[i][2] - 1], NULL);
     List_Add (smp, &S);
     S->iEnt = s->Num;
   }
@@ -234,7 +235,7 @@ void Box_2_Triangles (List_T * P, Surface * s){
     List_Read (smp, i, &ps);
     for (j = 0; j < 3; j++)
       if (ps->S[j] == NULL)
-	ps->S[j] = &MyNewBoundary;
+        ps->S[j] = &MyNewBoundary;
     Tree_Replace (s->Simplexes, &ps);
   }
 }
@@ -374,8 +375,8 @@ void missing_edges_2d (Surface * s){
       e.V[0] = v1;
       e.V[1] = v2;
       if (!EdgesOnSurface.Search (v1, v2)) {
-	Msg(INFOS, "Missing Edge %d->%d", v1->Num, v2->Num);
-	Recover_Edge (s, &e, EdgesOnSurface);
+        Msg(INFOS, "Missing Edge %d->%d", v1->Num, v2->Num);
+        Recover_Edge (s, &e, EdgesOnSurface);
       }
     }
   }
@@ -475,19 +476,19 @@ void NewSimplexes_2D (Surface * s, List_T * Sim, List_T * news){
       ZONEELIMINEE = S->iEnt;
     else{
       if (S->iEnt != ZONEELIMINEE){
-	Msg(WARNING, "Huh! The Elimination Failed %d %d",
-	    S->iEnt, ZONEELIMINEE);
+        Msg(WARNING, "Huh! The Elimination Failed %d %d",
+            S->iEnt, ZONEELIMINEE);
       }
     }
     for (j = 0; j < 3; j++){
       SXF.F = S->F[j];
       
       if ((pSXF = (SxF *) Tree_PQuery (SimXFac, &SXF))) {
-	(pSXF->NumFaceSimpl)++;
+        (pSXF->NumFaceSimpl)++;
       }
       else {
-	SXF.NumFaceSimpl = 1;
-	Tree_Add (SimXFac, &SXF);
+        SXF.NumFaceSimpl = 1;
+        Tree_Add (SimXFac, &SXF);
       }
     }
   }
@@ -506,13 +507,13 @@ int recur_bowyer_2D (Simplex * s){
   for (i = 0; i < 3; i++){
     if (s->S[i] && s->S[i] != &MyNewBoundary && !Tree_Query (Tsd, &s->S[i])){
       if (s->S[i]->Pt_In_Ellipsis (THEV, THEM->Metric->m) && (s->iEnt == s->S[i]->iEnt)){
-	recur_bowyer_2D (s->S[i]);
+        recur_bowyer_2D (s->S[i]);
       }
       else{
-	if (s->iEnt != s->S[i]->iEnt){
-	  Alerte_Point_Scabreux = 1;
-	}
-	Tree_Insert (Sim_Sur_Le_Bord, &s->S[i]);
+        if (s->iEnt != s->S[i]->iEnt){
+          Alerte_Point_Scabreux = 1;
+        }
+        Tree_Insert (Sim_Sur_Le_Bord, &s->S[i]);
       }
     }
   }
@@ -632,7 +633,7 @@ bool Bowyer_Watson_2D (Surface * sur, Vertex * v, Simplex * S, int force){
       List_Read (Simplexes_Destroyed, i, &s);
       draw_simplex2d (sur, s, 0);
       if (!Tree_Suppress (sur->Simplexes, &s)){
-	Msg(WARNING, "Failed to Suppress Simplex %d", s->Num);
+        Msg(WARNING, "Failed to Suppress Simplex %d", s->Num);
       }
       Free (s);
     }
@@ -660,7 +661,7 @@ void Convex_Hull_Mesh_2D (List_T * Points, Surface * s){
 
   N = List_Nbr (Points);
 
-  Msg(STATUS, "Meshing 2D... (Initial)");
+  Msg(INFO, "Mesh 2D... (Initial)");
 
   Box_2_Triangles (Points, s);
   for (i = 0; i < N; i++){
@@ -676,16 +677,16 @@ void Convex_Hull_Mesh_2D (List_T * Points, Surface * s){
     */
     if (!THES){
       Msg(ERROR, "Vertex (%g,%g,%g) in no Simplex",
-	  THEV->Pos.X, THEV->Pos.Y, THEV->Pos.Z);
-      THEV->Pos.X += 10 * RAND_LONG;
-      THEV->Pos.Y += 10 * RAND_LONG;
-      THEV->Pos.Z += 10 * RAND_LONG;
+          THEV->Pos.X, THEV->Pos.Y, THEV->Pos.Z);
+      THEV->Pos.X += CTX.mesh.rand_factor * LC2D * rand()/RAND_MAX;
+      THEV->Pos.Y += CTX.mesh.rand_factor * LC2D * rand()/RAND_MAX;
+      THEV->Pos.Z += CTX.mesh.rand_factor * LC2D * rand()/RAND_MAX;
       Tree_Action (s->Simplexes, Action_First_Simplexes_2D);
     }
     bool  ca_marche = Bowyer_Watson_2D (s, THEV, THES, 1);
     while(!ca_marche){
-      double dx = RAND_LONG;
-      double dy = RAND_LONG;
+      double dx = CTX.mesh.rand_factor * LC2D * rand()/RAND_MAX;
+      double dy = CTX.mesh.rand_factor * LC2D * rand()/RAND_MAX;
       THEV->Pos.X += dx;
       THEV->Pos.Y += dy;
       ca_marche = Bowyer_Watson_2D (s, THEV, THES, 1);
@@ -847,8 +848,8 @@ void Restore_Surface (Surface * s){
     
     N = Tree_Nbr (keep);
     Msg (INFOS, "Initial Mesh of Surface %d: %d Simplices, %d/%d Curves, %d Faces",
-	 iSurface, N, List_Nbr (ListCurves), List_Nbr (ListAllCurves),
-	 Tree_Nbr (FacesTree));
+         iSurface, N, List_Nbr (ListCurves), List_Nbr (ListAllCurves),
+         Tree_Nbr (FacesTree));
 
     Tree_Action (keep, attribueSurface);
     Tree_Delete (keep);
@@ -894,8 +895,8 @@ Vertex * NewVertex_2D (Simplex * s){
       v = Create_Vertex (++CurrentNodeNumber, s->Center.X, s->Center.Y, 0.0, lc, 0.0);
     else
       v = Create_Vertex (++CurrentNodeNumber,
-			 f * vv[0]->Pos.X + (1. - f) * vv[1]->Pos.X,
-			 f * vv[0]->Pos.Y + (1. - f) * vv[1]->Pos.Y, 0.0, lc, 0.0);
+                         f * vv[0]->Pos.X + (1. - f) * vv[1]->Pos.X,
+                         f * vv[0]->Pos.Y + (1. - f) * vv[1]->Pos.Y, 0.0, lc, 0.0);
   }
 
   v->lc = Interpole_lcTriangle (s, v);
@@ -949,15 +950,15 @@ void IntelligentSwapEdges (Surface * s, GMSHMetric * m){
     j = rand () % 3;
     if (t->ExtractOppositeEdges (j, p, q)){
       double qp = 2. * m->EdgeLengthOnSurface (s, p, 1) 
-	/ (RacineDeTrois * (p[0]->lc + p[1]->lc));
+        / (RacineDeTrois * (p[0]->lc + p[1]->lc));
       double qq = 2. * m->EdgeLengthOnSurface (s, q, 1)
-	/ (RacineDeTrois * (q[0]->lc + q[1]->lc));
+        / (RacineDeTrois * (q[0]->lc + q[1]->lc));
       if (fabs (qp) > fabs (qq)){
-	if (draw_simplex2d (s, t, false))
-	  draw_simplex2d (s, t->S[j], false);
-	t->SwapEdge (j);
-	if (draw_simplex2d (s, t, true))
-	  draw_simplex2d (s, t->S[j], true);
+        if (draw_simplex2d (s, t, false))
+          draw_simplex2d (s, t->S[j], false);
+        t->SwapEdge (j);
+        if (draw_simplex2d (s, t, true))
+          draw_simplex2d (s, t->S[j], true);
       }
     }
   }
@@ -1047,32 +1048,32 @@ int AlgorithmeMaillage2DAnisotropeModeJF (Surface * s){
     while ( simp->Quality > CONV_VALUE){
       newv = NewVertex_2D (simp);
       while (!simp->Pt_In_Simplex_2D (newv) &&
-	     (simp->S[0] == &MyNewBoundary || !simp->S[0]->Pt_In_Simplex_2D (newv)) &&
-	     (simp->S[1] == &MyNewBoundary || !simp->S[1]->Pt_In_Simplex_2D (newv)) &&
-	     (simp->S[2] == &MyNewBoundary || !simp->S[2]->Pt_In_Simplex_2D (newv))){
-	/*
-	  Msg(INFO,"pt : %12.5E %12.5E",newv->Pos.X,newv->Pos.Y);
-	  Msg(INFO,"not in : (%12.5E %12.5E) (%12.5E %12.5E) (%12.5E %12.5E)",
-	  simp->V[0]->Pos.X,simp->V[0]->Pos.Y,simp->V[1]->Pos.X,
-	  simp->V[1]->Pos.Y,simp->V[2]->Pos.X,simp->V[2]->Pos.Y);
-	*/
-	Tree_Suppress (s->Simplexes, &simp);
-	simp->Quality /= 2.;
-	Tree_Insert (s->Simplexes, &simp);
-	Tree_Right (s->Simplexes, &simp);
-	if (simp->Quality < CONV_VALUE)
-	  break;
-	newv = NewVertex_2D (simp);
+             (simp->S[0] == &MyNewBoundary || !simp->S[0]->Pt_In_Simplex_2D (newv)) &&
+             (simp->S[1] == &MyNewBoundary || !simp->S[1]->Pt_In_Simplex_2D (newv)) &&
+             (simp->S[2] == &MyNewBoundary || !simp->S[2]->Pt_In_Simplex_2D (newv))){
+        /*
+          Msg(INFO,"pt : %12.5E %12.5E",newv->Pos.X,newv->Pos.Y);
+          Msg(INFO,"not in : (%12.5E %12.5E) (%12.5E %12.5E) (%12.5E %12.5E)",
+          simp->V[0]->Pos.X,simp->V[0]->Pos.Y,simp->V[1]->Pos.X,
+          simp->V[1]->Pos.Y,simp->V[2]->Pos.X,simp->V[2]->Pos.Y);
+        */
+        Tree_Suppress (s->Simplexes, &simp);
+        simp->Quality /= 2.;
+        Tree_Insert (s->Simplexes, &simp);
+        Tree_Right (s->Simplexes, &simp);
+        if (simp->Quality < CONV_VALUE)
+          break;
+        newv = NewVertex_2D (simp);
       }
       if (simp->Quality < CONV_VALUE)
-	break;
+        break;
       i++;
       if (i % n == n - 1){
-	volume = 0.0;
-	Tree_Action (s->Simplexes, VSIM_2D);
-	Msg(STATUS, "Nod=%d Elm=%d",
-	    Tree_Nbr (s->Vertices), Tree_Nbr (s->Simplexes));
-	Msg(SELECT, "Vol(%g) Conv(%g->%g)", volume, simp->Quality, CONV_VALUE);
+        volume = 0.0;
+        Tree_Action (s->Simplexes, VSIM_2D);
+        Msg(STATUS, "Nod=%d Elm=%d",
+            Tree_Nbr (s->Vertices), Tree_Nbr (s->Simplexes));
+        Msg(SELECT, "Vol(%g) Conv(%g->%g)", volume, simp->Quality, CONV_VALUE);
       }
       Bowyer_Watson_2D (s, newv, simp, 0);
       Tree_Right (s->Simplexes, &simp);
diff --git a/Mesh/2D_Parametric.cpp b/Mesh/2D_Parametric.cpp
index 92acfa1dcc..8cdbe17c48 100644
--- a/Mesh/2D_Parametric.cpp
+++ b/Mesh/2D_Parametric.cpp
@@ -1,4 +1,4 @@
-/* $Id: 2D_Parametric.cpp,v 1.2 2000-11-23 14:11:34 geuzaine Exp $ */
+/* $Id: 2D_Parametric.cpp,v 1.3 2000-11-26 15:43:46 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "Const.h"
@@ -53,20 +53,20 @@ void printMetric (Mesh * m, Surface * s, char *name){
       * (double) i / (double) (N - 1);
     for (j = 0; j < M; j++){
       v = (s->kv[0]) + (s->kv[s->Nv + s->OrderV] - s->kv[0]) 
-	* (double) j / (double) (M - 1);
+        * (double) j / (double) (M - 1);
       m->Metric->setMetric (u, v, s);
       fprintf (f, "VT (%f,%f,0,%f,%f,0,%f,%f,0)"
-	       "{%g,%g,%g,%g,%g,%g,%g,%g,%g};\n",
-	       u, v, u, v, u, v, 
-	       m->Metric->m[0][0], m->Metric->m[0][1], 0.0,
-	       m->Metric->m[0][0], m->Metric->m[0][1], 0.0, 
-	       m->Metric->m[0][0], m->Metric->m[0][1], 0.0);
-	  fprintf (f, "VT (%f,%f,0,%f,%f,0,%f,%f,0)"
-		   "{%g,%g,%g,%g,%g,%g,%g,%g,%g};\n",
-		   u, v, u, v, u, v, 
-		   m->Metric->m[1][0], m->Metric->m[1][1], 0.0,
-		   m->Metric->m[1][0], m->Metric->m[1][1], 0.0,
-		   m->Metric->m[1][0], m->Metric->m[1][1], 0.0);
+               "{%g,%g,%g,%g,%g,%g,%g,%g,%g};\n",
+               u, v, u, v, u, v, 
+               m->Metric->m[0][0], m->Metric->m[0][1], 0.0,
+               m->Metric->m[0][0], m->Metric->m[0][1], 0.0, 
+               m->Metric->m[0][0], m->Metric->m[0][1], 0.0);
+          fprintf (f, "VT (%f,%f,0,%f,%f,0,%f,%f,0)"
+                   "{%g,%g,%g,%g,%g,%g,%g,%g,%g};\n",
+                   u, v, u, v, u, v, 
+                   m->Metric->m[1][0], m->Metric->m[1][1], 0.0,
+                   m->Metric->m[1][0], m->Metric->m[1][1], 0.0,
+                   m->Metric->m[1][0], m->Metric->m[1][1], 0.0);
     }
   }
   fprintf (f, "};\n");
diff --git a/Mesh/2D_Recombine.cpp b/Mesh/2D_Recombine.cpp
index cbfd03218d..722a2a834b 100644
--- a/Mesh/2D_Recombine.cpp
+++ b/Mesh/2D_Recombine.cpp
@@ -1,4 +1,4 @@
-/* $Id: 2D_Recombine.cpp,v 1.2 2000-11-23 14:11:34 geuzaine Exp $ */
+/* $Id: 2D_Recombine.cpp,v 1.3 2000-11-26 15:43:46 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "Const.h"
@@ -109,7 +109,7 @@ void Recombine (Tree_T *TreeAllVert, Tree_T *TreeAllElg, double a){
     if(!RECNUM)break;
   }
 
-  Msg(INFO, "Recombining: %d quadrangles",ntot); 
+  Msg(INFO, "Recombined %d Quadrangles",ntot); 
 
   THEM->Statistics[7] -= ntot/2; 
   THEM->Statistics[8] += ntot; 
diff --git a/Mesh/2D_SMesh.cpp b/Mesh/2D_SMesh.cpp
index 4d0e1c26ef..08985f6d32 100644
--- a/Mesh/2D_SMesh.cpp
+++ b/Mesh/2D_SMesh.cpp
@@ -1,4 +1,4 @@
-/* $Id: 2D_SMesh.cpp,v 1.3 2000-11-23 23:20:35 geuzaine Exp $ */
+/* $Id: 2D_SMesh.cpp,v 1.4 2000-11-26 15:43:46 geuzaine Exp $ */
 /*  
   Maillage transfini surfacique                                                 
                                             *s2
@@ -68,12 +68,12 @@ int MeshTransfiniteSurface (Surface *sur) {
       V.Num = sur->ipar[i];
       pV = &V;
       if((vexist = (Vertex**)Tree_PQuery(THEM->Vertices,&pV)) == NULL) {
-	Msg(WARNING, "Unknown Control Point %d in Transfinite Surface %d",
-	    V.Num,sur->Num); 
-	return(0);
+        Msg(WARNING, "Unknown Control Point %d in Transfinite Surface %d",
+            V.Num,sur->Num); 
+        return(0);
       }
       else{
-	S[i]=*vexist;
+        S[i]=*vexist;
       }
     }       
 
@@ -84,30 +84,30 @@ int MeshTransfiniteSurface (Surface *sur) {
       List_Read(GG[i]->Control_Points,List_Nbr(GG[i]->Control_Points)-1,&CP[1]);
 
       for(flag=0;flag<2;flag++){
-	for(k=0;k<nb;k++){
-	  if(nb == 4){
-	    if(S[tab1qua[2*k  ]]->Num == CP[tab2[2*flag  ]]->Num && 
-	       S[tab1qua[2*k+1]]->Num == CP[tab2[2*flag+1]]->Num){ 
-	      G[k]=GG[i];
-	      C_flag[k]=flag;
-	    }
-	  }
-	  else{
-	    if(S[tab1tri[2*k  ]]->Num == CP[tab2[2*flag  ]]->Num && 
-	       S[tab1tri[2*k+1]]->Num == CP[tab2[2*flag+1]]->Num){ 
-	      G[k]=GG[i];
-	      C_flag[k]=flag;
-	    }
-	  }
-	}	
+        for(k=0;k<nb;k++){
+          if(nb == 4){
+            if(S[tab1qua[2*k  ]]->Num == CP[tab2[2*flag  ]]->Num && 
+               S[tab1qua[2*k+1]]->Num == CP[tab2[2*flag+1]]->Num){ 
+              G[k]=GG[i];
+              C_flag[k]=flag;
+            }
+          }
+          else{
+            if(S[tab1tri[2*k  ]]->Num == CP[tab2[2*flag  ]]->Num && 
+               S[tab1tri[2*k+1]]->Num == CP[tab2[2*flag+1]]->Num){ 
+              G[k]=GG[i];
+              C_flag[k]=flag;
+            }
+          }
+        }       
       }
     }
 
     for(i=0;i<nb;i++)
       if(G[i] == NULL) {
-	Msg(WARNING, "Wrong definition of Transfinite Surface %d", 
-	    sur->Num); 
-	return(0);
+        Msg(WARNING, "Wrong definition of Transfinite Surface %d", 
+            sur->Num); 
+        return(0);
       }
 
     if(nb == 4) {
@@ -126,148 +126,148 @@ int MeshTransfiniteSurface (Surface *sur) {
     issphere = 1;
     for(i=0;i<nb;i++){
       if(G[i]->Typ != MSH_SEGM_CIRC && G[i]->Typ != MSH_SEGM_CIRC_INV){
-	issphere = 0;
+        issphere = 0;
       }
       else if (issphere){
-	if(!i){
-	  List_Read(G[i]->Control_Points, 1, &c1);
-	}
-	else{
-	  List_Read(G[i]->Control_Points, 1, &c2);
-	  if(compareVertex(&c1,&c2))issphere = 0;
-	}
+        if(!i){
+          List_Read(G[i]->Control_Points, 1, &c1);
+        }
+        else{
+          List_Read(G[i]->Control_Points, 1, &c2);
+          if(compareVertex(&c1,&c2))issphere = 0;
+        }
       }
     }
     
     for(i=0;i<N1;i++){
       List_Read(G[0]->Vertices, index1d(C_flag[0],N1,i), &C[0]);
-      List_Read(G[2]->Vertices, index1d(C_flag[2],N1,i), &C[2]);	
+      List_Read(G[2]->Vertices, index1d(C_flag[2],N1,i), &C[2]);        
 
       if( (G[0]->Num>0 && C_flag[0]) || (G[0]->Num<0 && !C_flag[0]) ) 
-	u = 1.-C[0]->u; 
+        u = 1.-C[0]->u; 
       else
-	u = C[0]->u;
+        u = C[0]->u;
 
       for(j=0;j<N2;j++){
-	List_Read(G[1]->Vertices, index1d(C_flag[1],N2,j), &C[1]);
-	if(nb == 4) 
-	  List_Read(G[3]->Vertices, index1d(C_flag[3],N2,j), &C[3]);
-
-	if( (G[1]->Num>0 && C_flag[1]) || (G[1]->Num<0 && !C_flag[1]) ) 
-	  v = 1.-C[1]->u;
-	else
-	  v = C[1]->u;
-
-	if(i && j && i != N1-1 && j != N2-1){
-	  if (sur->Typ == MSH_SURF_NURBS)
-	    V = InterpolateSurface (sur, u, v, 0, 0);
-	  else if(nb == 4) 
-	    V = TransfiniteQua(*C[0],*C[1],*C[2],*C[3],*S[0],*S[1],*S[2],*S[3],u,v);
-	  else
-	    V = TransfiniteTri(*C[0],*C[1],*C[2],*S[0],*S[1],*S[2],u,v);
-	  if(issphere) 
-	    TransfiniteSph(*C[0],*c1,&V);
-	  list[i+N1*j] = Create_Vertex(++CurrentNodeNumber,V.Pos.X,V.Pos.Y,V.Pos.Z,V.lc,0.0);
-	}
-	else if(!i) 
-	  list[i+N1*j] = (nb == 4)?C[3]:C[2];
-	else if(!j) 
-	  list[i+N1*j] = C[0];
-	else if(i == N1-1) 
-	  list[i+N1*j] = C[1];
-	else if(j == N2-1) 
-	  list[i+N1*j] = C[2];
-	
-	list[i + N1 * j]->us[0] = u;
-	list[i + N1 * j]->us[1] = v;
+        List_Read(G[1]->Vertices, index1d(C_flag[1],N2,j), &C[1]);
+        if(nb == 4) 
+          List_Read(G[3]->Vertices, index1d(C_flag[3],N2,j), &C[3]);
+
+        if( (G[1]->Num>0 && C_flag[1]) || (G[1]->Num<0 && !C_flag[1]) ) 
+          v = 1.-C[1]->u;
+        else
+          v = C[1]->u;
+
+        if(i && j && i != N1-1 && j != N2-1){
+          if (sur->Typ == MSH_SURF_NURBS)
+            V = InterpolateSurface (sur, u, v, 0, 0);
+          else if(nb == 4) 
+            V = TransfiniteQua(*C[0],*C[1],*C[2],*C[3],*S[0],*S[1],*S[2],*S[3],u,v);
+          else
+            V = TransfiniteTri(*C[0],*C[1],*C[2],*S[0],*S[1],*S[2],u,v);
+          if(issphere) 
+            TransfiniteSph(*C[0],*c1,&V);
+          list[i+N1*j] = Create_Vertex(++CurrentNodeNumber,V.Pos.X,V.Pos.Y,V.Pos.Z,V.lc,0.0);
+        }
+        else if(!i) 
+          list[i+N1*j] = (nb == 4)?C[3]:C[2];
+        else if(!j) 
+          list[i+N1*j] = C[0];
+        else if(i == N1-1) 
+          list[i+N1*j] = C[1];
+        else if(j == N2-1) 
+          list[i+N1*j] = C[2];
+        
+        list[i + N1 * j]->us[0] = u;
+        list[i + N1 * j]->us[1] = v;
       }
     }
 
 
     for(i=0;i<N1;i++){
       for(j=0;j<N2;j++){
-	List_Add(sur->TrsfVertices,&list[i+N1*j]);
+        List_Add(sur->TrsfVertices,&list[i+N1*j]);
       }
     }
 
     if(nb == 4){      
       for(i=0;i<N1;i++){
-	for(j=0;j<N2;j++){
-	  Tree_Replace(sur->Vertices,&list[i+N1*j]);
-	}
+        for(j=0;j<N2;j++){
+          Tree_Replace(sur->Vertices,&list[i+N1*j]);
+        }
       }      
       for(i=0;i<N1-1;i++){
-	for(j=0;j<N2-1;j++){
-	  if(sur->Recombine){
-	    simp = Create_Quadrangle(list[(i) + N1*(j)], list[(i+1)+ N1*(j)],
-				     list[(i+1)+ N1*(j+1)], list[(i)+ N1*(j+1)]);
-	    simp->iEnt = sur->Num;
-	    Tree_Add(sur->Simplexes,&simp);
-	    List_Add(sur->TrsfSimplexes,&simp);
-
-	    nbquad++;
-	  }
-	  else{
-	    simp = Create_Simplex(list[(i) + N1*(j)], list[(i+1) + N1*(j)], 
-				  list[(i) + N1*(j+1)], NULL);
-	    simp->iEnt = sur->Num;
-	    Tree_Add(sur->Simplexes,&simp);
-	    List_Add(sur->TrsfSimplexes,&simp);
-
-	    simp = Create_Simplex(list[(i+1) + N1*(j+1)], list[(i) + N1*(j+1)],
-				  list[(i+1) + N1*(j)], NULL);
-	    simp->iEnt = sur->Num;
-	    Tree_Add(sur->Simplexes,&simp);
-	    List_Add(sur->TrsfSimplexes,&simp);
-
-	    nbtri += 2;
-	  }
-	}
+        for(j=0;j<N2-1;j++){
+          if(sur->Recombine){
+            simp = Create_Quadrangle(list[(i) + N1*(j)], list[(i+1)+ N1*(j)],
+                                     list[(i+1)+ N1*(j+1)], list[(i)+ N1*(j+1)]);
+            simp->iEnt = sur->Num;
+            Tree_Add(sur->Simplexes,&simp);
+            List_Add(sur->TrsfSimplexes,&simp);
+
+            nbquad++;
+          }
+          else{
+            simp = Create_Simplex(list[(i) + N1*(j)], list[(i+1) + N1*(j)], 
+                                  list[(i) + N1*(j+1)], NULL);
+            simp->iEnt = sur->Num;
+            Tree_Add(sur->Simplexes,&simp);
+            List_Add(sur->TrsfSimplexes,&simp);
+
+            simp = Create_Simplex(list[(i+1) + N1*(j+1)], list[(i) + N1*(j+1)],
+                                  list[(i+1) + N1*(j)], NULL);
+            simp->iEnt = sur->Num;
+            Tree_Add(sur->Simplexes,&simp);
+            List_Add(sur->TrsfSimplexes,&simp);
+
+            nbtri += 2;
+          }
+        }
       }                  
     }
     else if(nb == 3) {
       Tree_Replace(sur->Vertices,&list[0]);
       for(i=1;i<N1;i++){
-	for(j=0;j<N2;j++){
-	  Tree_Replace(sur->Vertices,&list[i+N1*j]);
-	}
+        for(j=0;j<N2;j++){
+          Tree_Replace(sur->Vertices,&list[i+N1*j]);
+        }
       }      
       for(j=0;j<N2-1;j++){
-	simp = Create_Simplex(list[1 + N1*(j+1)], list[N1*(j+1)],list[1 + N1*(j)],NULL);
-	simp->iEnt = sur->Num;
-	Tree_Add(sur->Simplexes,&simp);
-	List_Add(sur->TrsfSimplexes,&simp);
+        simp = Create_Simplex(list[1 + N1*(j+1)], list[N1*(j+1)],list[1 + N1*(j)],NULL);
+        simp->iEnt = sur->Num;
+        Tree_Add(sur->Simplexes,&simp);
+        List_Add(sur->TrsfSimplexes,&simp);
 
-	nbtri++;
+        nbtri++;
       }      
       for(i=1;i<N1-1;i++){
-	for(j=0;j<N2-1;j++){
-	  if(sur->Recombine){
-	    simp = Create_Quadrangle(list[(i) + N1*(j)],list[(i+1) + N1*(j)],
-				     list[(i+1) + N1*(j+1)],list[i+N1*(j+1)]);
-	    simp->iEnt = sur->Num;
-	    Tree_Add(sur->Simplexes,&simp);
-	    List_Add(sur->TrsfSimplexes,&simp);
-
-	    nbquad++;
-	  }
-	  else{
-	    simp = Create_Simplex(list[(i) + N1*(j)], list[(i+1) + N1*(j)], 
-				  list[(i) + N1*(j+1)],NULL);
-	    simp->iEnt = sur->Num;
-	    Tree_Add(sur->Simplexes,&simp);
-	    List_Add(sur->TrsfSimplexes,&simp);
-
-	    simp = Create_Simplex(list[(i+1) + N1*(j+1)], list[(i) + N1*(j+1)],
-				  list[(i+1) + N1*(j)], NULL);
-	    simp->iEnt = sur->Num;
-	    Tree_Add(sur->Simplexes,&simp);
-	    List_Add(sur->TrsfSimplexes,&simp);
-
-	    nbtri += 2;
-	  }
-	}
-      }              		
+        for(j=0;j<N2-1;j++){
+          if(sur->Recombine){
+            simp = Create_Quadrangle(list[(i) + N1*(j)],list[(i+1) + N1*(j)],
+                                     list[(i+1) + N1*(j+1)],list[i+N1*(j+1)]);
+            simp->iEnt = sur->Num;
+            Tree_Add(sur->Simplexes,&simp);
+            List_Add(sur->TrsfSimplexes,&simp);
+
+            nbquad++;
+          }
+          else{
+            simp = Create_Simplex(list[(i) + N1*(j)], list[(i+1) + N1*(j)], 
+                                  list[(i) + N1*(j+1)],NULL);
+            simp->iEnt = sur->Num;
+            Tree_Add(sur->Simplexes,&simp);
+            List_Add(sur->TrsfSimplexes,&simp);
+
+            simp = Create_Simplex(list[(i+1) + N1*(j+1)], list[(i) + N1*(j+1)],
+                                  list[(i+1) + N1*(j)], NULL);
+            simp->iEnt = sur->Num;
+            Tree_Add(sur->Simplexes,&simp);
+            List_Add(sur->TrsfSimplexes,&simp);
+
+            nbtri += 2;
+          }
+        }
+      }                         
       
     }
     break;
@@ -278,8 +278,8 @@ int MeshTransfiniteSurface (Surface *sur) {
 
   free(list);
 
-  THEM->Statistics[5] += Tree_Nbr(sur->Vertices);
-  THEM->Statistics[7] += nbtri;
+  // We count this here, to be able to distinguish very quickly
+  // between triangles and quadrangles later
   THEM->Statistics[8] += nbquad;
 
   return(1);
diff --git a/Mesh/2D_Tree.cpp b/Mesh/2D_Tree.cpp
index 5229dfaf4f..4fc0c86a73 100644
--- a/Mesh/2D_Tree.cpp
+++ b/Mesh/2D_Tree.cpp
@@ -1,4 +1,4 @@
-/* $Id: 2D_Tree.cpp,v 1.2 2000-11-23 14:11:34 geuzaine Exp $ */
+/* $Id: 2D_Tree.cpp,v 1.3 2000-11-26 15:43:46 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "Mesh.h"
@@ -16,19 +16,19 @@ int avltree_remove (avlstruct **root){
   else
     {
       if ((*root)->left == NULL)
-	if (avltree_remove(&(*root)->left))
-	  {
-	    Free((*root)->left);
-	    (*root)->left = NULL;			
-	  }	
+        if (avltree_remove(&(*root)->left))
+          {
+            Free((*root)->left);
+            (*root)->left = NULL;                       
+          }     
       if ((*root)->right == NULL)
-	if (avltree_remove(&(*root)->right))
-	  {
-	    Free((*root)->right);
-	    (*root)->right = NULL;
-	  }
+        if (avltree_remove(&(*root)->right))
+          {
+            Free((*root)->right);
+            (*root)->right = NULL;
+          }
       if (((*root)->left == NULL) && ((*root)->right == NULL))
-	delete_this_node = 1;
+        delete_this_node = 1;
     }
   return delete_this_node;
 }
@@ -37,7 +37,7 @@ int avltree_remove (avlstruct **root){
 /* INSERE UN NOEUD */
 
 int avltree_insert (avlstruct **root, void *item, 
-		    int (*fcmp)(void *a, void *b)){
+                    int (*fcmp)(void *a, void *b)){
   int cmpresult;
 
   if(*root != NULL)
@@ -53,7 +53,7 @@ int avltree_insert (avlstruct **root, void *item,
       avltree_insert(&(*root)->left,item,fcmp);
   else
       avltree_insert(&(*root)->right,item,fcmp);
-  return(1);	
+  return(1);    
 }
 
 
@@ -61,10 +61,10 @@ int avltree_insert (avlstruct **root, void *item,
 /* EFFACE UN NOEUD */
 
 int avltree_delete (avlstruct **root, void *item, 
-		    int (*fcmp)(void *a, void *b)){
+                    int (*fcmp)(void *a, void *b)){
 
-  avlstruct	*t1,*t12;
-  int		cmpresult;
+  avlstruct     *t1,*t12;
+  int           cmpresult;
 
   if(*root != NULL)    
     cmpresult = fcmp(item , (*root)->treedata);
@@ -98,7 +98,7 @@ int avltree_delete (avlstruct **root, void *item,
     else{
       t1 = t12 = (*root)->right;
       while(t12->left != NULL)
-	t12 = t12->left;
+        t12 = t12->left;
       t12->left = (*root)->left;
       Free(*root);
       *root = t1;
diff --git a/Mesh/2D_Util.cpp b/Mesh/2D_Util.cpp
index a8d9ed1efd..56b9764709 100644
--- a/Mesh/2D_Util.cpp
+++ b/Mesh/2D_Util.cpp
@@ -1,4 +1,4 @@
-/* $Id: 2D_Util.cpp,v 1.5 2000-11-24 09:43:53 geuzaine Exp $ */
+/* $Id: 2D_Util.cpp,v 1.6 2000-11-26 15:43:46 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "Const.h"
@@ -54,12 +54,12 @@ int Delete_Triangle ( avlstruct **root, Delaunay * del ){
 }
 
 int Insert_Point (MPoint pt, int *numpoints, int *numalloc, 
-		  DocRecord *doc, DocRecord *BGM, int is3d){
+                  DocRecord *doc, DocRecord *BGM, int is3d){
   Vertex *v,*dum;
 
   if ( *numpoints >= *numalloc ) {
     gPointArray = (PointRecord *) Realloc(gPointArray, 
-					  (*numalloc + 1000) * sizeof(PointRecord));
+                                          (*numalloc + 1000) * sizeof(PointRecord));
     *numalloc += 1000;
     doc->points = gPointArray;
   }
@@ -175,9 +175,9 @@ MPoint Localize (Delaunay * del , DocRecord *MESH) {
   case (BARYCENTER) :
 
     pt.h = ( gPointArray[del->t.a].where.h + gPointArray[del->t.b].where.h 
-	    + gPointArray[del->t.c].where.h ) /3.;
+            + gPointArray[del->t.c].where.h ) /3.;
     pt.v = ( gPointArray[del->t.a].where.v + gPointArray[del->t.b].where.v 
-	    + gPointArray[del->t.c].where.v ) /3.;
+            + gPointArray[del->t.c].where.v ) /3.;
 
     return(pt);
 
@@ -214,59 +214,59 @@ MPoint Localize (Delaunay * del , DocRecord *MESH) {
     if (v1 == NULL){
       
       if((v2 != NULL) && (v3 != NULL) ) {
-	
-	if ( ((del->t.a == v2->t.a) || (del->t.a == v2->t.b) || (del->t.a == v2->t.c)) &&
-	     ((del->t.a == v3->t.a) || (del->t.a == v3->t.b) || (del->t.a == v3->t.c))){
-	  a = del->t.b;
-	  b = del->t.c;
-	}
-	else if ( ((del->t.b == v2->t.a) || (del->t.b == v2->t.b) || (del->t.b == v2->t.c)) &&
-		  ((del->t.b == v3->t.a) || (del->t.b == v3->t.b) || (del->t.b == v3->t.c))){  
-	  a = del->t.a;
-	  b = del->t.c;
-	}
-	else if ( ((del->t.c == v2->t.a) || (del->t.c == v2->t.b) || (del->t.c == v2->t.c)) &&
-		  ((del->t.c == v3->t.a) || (del->t.c == v3->t.b) || (del->t.c == v3->t.c))){  
-	  a = del->t.a;
-	  b = del->t.b;
-	}
-	else{
-	  Msg(ERROR, "Voronoi Insert 1"); 
-	}
+        
+        if ( ((del->t.a == v2->t.a) || (del->t.a == v2->t.b) || (del->t.a == v2->t.c)) &&
+             ((del->t.a == v3->t.a) || (del->t.a == v3->t.b) || (del->t.a == v3->t.c))){
+          a = del->t.b;
+          b = del->t.c;
+        }
+        else if ( ((del->t.b == v2->t.a) || (del->t.b == v2->t.b) || (del->t.b == v2->t.c)) &&
+                  ((del->t.b == v3->t.a) || (del->t.b == v3->t.b) || (del->t.b == v3->t.c))){  
+          a = del->t.a;
+          b = del->t.c;
+        }
+        else if ( ((del->t.c == v2->t.a) || (del->t.c == v2->t.b) || (del->t.c == v2->t.c)) &&
+                  ((del->t.c == v3->t.a) || (del->t.c == v3->t.b) || (del->t.c == v3->t.c))){  
+          a = del->t.a;
+          b = del->t.b;
+        }
+        else{
+          Msg(ERROR, "Voronoi Insert 1"); 
+        }
       }      
-      else if(v2 != NULL) {	
-	if((del->t.a != v2->t.c) && (del->t.a != v2->t.c) && (del->t.a != v2->t.c)){	  
-	  a = del->t.a;
-	  b = del->t.b;
-	}
-	else if((del->t.b != v2->t.c) && (del->t.b != v2->t.c) && (del->t.b != v2->t.c)){   
-	  a = del->t.b;
-	  b = del->t.c;
-	}
-	else if((del->t.c != v2->t.c) && (del->t.c != v2->t.c) && (del->t.c != v2->t.c)){   
-	  a = del->t.a;
-	  b = del->t.c;
-	}
-	else {
-	  Msg(ERROR,"Voronoi Insert 2"); 
-	}
+      else if(v2 != NULL) {     
+        if((del->t.a != v2->t.c) && (del->t.a != v2->t.c) && (del->t.a != v2->t.c)){      
+          a = del->t.a;
+          b = del->t.b;
+        }
+        else if((del->t.b != v2->t.c) && (del->t.b != v2->t.c) && (del->t.b != v2->t.c)){   
+          a = del->t.b;
+          b = del->t.c;
+        }
+        else if((del->t.c != v2->t.c) && (del->t.c != v2->t.c) && (del->t.c != v2->t.c)){   
+          a = del->t.a;
+          b = del->t.c;
+        }
+        else {
+          Msg(ERROR,"Voronoi Insert 2"); 
+        }
       }      
-      else if(v3 != NULL) {	
-	if((del->t.a != v3->t.c) && (del->t.a != v3->t.c) && (del->t.a != v3->t.c)){ 
-	  a = del->t.a;
-	  b = del->t.b;
-	}
-	else if((del->t.b != v3->t.c) && (del->t.b != v3->t.c) && (del->t.b != v3->t.c)){   
-	  a = del->t.b;
-	  b = del->t.c;
-	}
-	else if((del->t.c != v3->t.c) && (del->t.c != v3->t.c) && (del->t.c != v3->t.c)){  
-	  a = del->t.a;
-	  b = del->t.c;
-	}
-	else {
-	  Msg(ERROR, "Voronoi Insert 3"); 
-	}
+      else if(v3 != NULL) {     
+        if((del->t.a != v3->t.c) && (del->t.a != v3->t.c) && (del->t.a != v3->t.c)){ 
+          a = del->t.a;
+          b = del->t.b;
+        }
+        else if((del->t.b != v3->t.c) && (del->t.b != v3->t.c) && (del->t.b != v3->t.c)){   
+          a = del->t.b;
+          b = del->t.c;
+        }
+        else if((del->t.c != v3->t.c) && (del->t.c != v3->t.c) && (del->t.c != v3->t.c)){  
+          a = del->t.a;
+          b = del->t.c;
+        }
+        else {
+          Msg(ERROR, "Voronoi Insert 3"); 
+        }
       }
     }    
     else {
@@ -274,23 +274,23 @@ MPoint Localize (Delaunay * del , DocRecord *MESH) {
       else if( v2->t.position == ACCEPTED )del2 = v2;
       else if( v3->t.position == ACCEPTED )del2 = v3;
       else {
-	Msg(ERROR,"Coherence in Localize"); 
+        Msg(ERROR,"Coherence in Localize"); 
       }
  
       if((del->t.a != del2->t.a) && (del->t.a != del2->t.b) && (del->t.a != del2->t.c)){
-	a = del->t.b;
-	b = del->t.c;
+        a = del->t.b;
+        b = del->t.c;
       }
       else if((del->t.b != del2->t.a) && (del->t.b != del2->t.b) && (del->t.b != del2->t.c)){
-	a = del->t.a;
-	b = del->t.c;
+        a = del->t.a;
+        b = del->t.c;
       }
       else if((del->t.c != del2->t.a) && (del->t.c != del2->t.b) && (del->t.c != del2->t.c)){
-	a = del->t.a;
-	b = del->t.b;
+        a = del->t.a;
+        b = del->t.b;
       }
       else{
-	Msg(ERROR,"Voronoi Insert"); 
+        Msg(ERROR,"Voronoi Insert"); 
       }
     }
 
diff --git a/Mesh/3D_BGMesh.cpp b/Mesh/3D_BGMesh.cpp
index 0364922a55..25611a513d 100644
--- a/Mesh/3D_BGMesh.cpp
+++ b/Mesh/3D_BGMesh.cpp
@@ -1,4 +1,4 @@
-/* $Id: 3D_BGMesh.cpp,v 1.8 2000-11-25 15:26:11 geuzaine Exp $ */
+/* $Id: 3D_BGMesh.cpp,v 1.9 2000-11-26 15:43:46 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "Mesh.h"
@@ -8,6 +8,8 @@
 #include "Views.h"
 #include "Numeric.h"
 
+extern Mesh *THEM;
+
 static Mesh m;
 static double XX, YY, ZZ, D, LL;
 
@@ -123,8 +125,6 @@ static void AIG (void *a, void *b){
 int BGMWithView (Post_View * ErrView){
 
   static Vertex *VertexUp, *v, V, *ver[4];
-  extern int TYPBGMESH;
-  extern Mesh *THEM;
   int i, j, k;
   Post_Simplex s, t;
   Simplex *si;
@@ -132,11 +132,11 @@ int BGMWithView (Post_View * ErrView){
   VertexUp = Create_Vertex (-1, 0., 0., 1., 1., -1.0);
   Pts = Tree_Create (sizeof (Vertex *), comparePosition);
 
-  m.BGM.Typ = TYPBGMESH = ONFILE;
+  m.BGM.Typ = ONFILE;
 
   m.Vertices = Tree_Create (sizeof (Vertex *), compareVertex);
   m.Simplexes = Tree_Create (sizeof (Simplex *), compareSimplex);
-  Create_BgMesh (TYPBGMESH, .2, THEM);
+  Create_BgMesh (ONFILE, .2, THEM);
 
   k = 1;
   for (i = 0; i < List_Nbr (ErrView->Triangles); i++){
@@ -147,14 +147,14 @@ int BGMWithView (Post_View * ErrView){
       v->Pos.Y = t.Y[j];
       v->Pos.Z = t.Z[j];
       if (0 /*Tree_Query(Pts,&v) */ ){
-	/* Corriger la Lc pour lissage */
-	//ver[j] = v;
+        /* Corriger la Lc pour lissage */
+        //ver[j] = v;
       }
       else{
-	v = Create_Vertex (k++, t.X[j], t.Y[j], t.Z[j], t.V[j], -1.0);
-	ver[j] = v;
-	Tree_Add (m.Vertices, &v);
-	Tree_Add (Pts, &v);
+        v = Create_Vertex (k++, t.X[j], t.Y[j], t.Z[j], t.V[j], -1.0);
+        ver[j] = v;
+        Tree_Add (m.Vertices, &v);
+        Tree_Add (Pts, &v);
       }
     }
     si = Create_Simplex (ver[0], ver[1], ver[2], VertexUp);
@@ -169,13 +169,13 @@ int BGMWithView (Post_View * ErrView){
       v->Pos.Y = s.Y[j];
       v->Pos.Z = s.Z[j];
       if (Tree_Query (Pts, &v)){
-	ver[j] = v;
+        ver[j] = v;
       }
       else{
-	v = Create_Vertex (k++, s.X[k], s.Y[j], s.Z[j], s.V[0], -1.0);
-	ver[j] = v;
-	Tree_Add (m.Vertices, &v);
-	Tree_Add (Pts, &v);
+        v = Create_Vertex (k++, s.X[k], s.Y[j], s.Z[j], s.V[0], -1.0);
+        ver[j] = v;
+        Tree_Add (m.Vertices, &v);
+        Tree_Add (Pts, &v);
       }
     }
     si = Create_Simplex (ver[0], ver[1], ver[2], ver[3]);
@@ -188,14 +188,14 @@ int BGMWithView (Post_View * ErrView){
   m.Grid.Nz = 10;
   Tree_Action (m.Vertices, findminmax);
   getminmax (&m.Grid.min.X, &m.Grid.min.Y, &m.Grid.min.Z,
-	     &m.Grid.max.X, &m.Grid.max.Y, &m.Grid.max.Z);
+             &m.Grid.max.X, &m.Grid.max.Y, &m.Grid.max.Z);
 
   if (m.Grid.max.Z == m.Grid.min.Z){
     m.Grid.Nz = 1;
     Tree_Add (m.Vertices, &VertexUp);
     Tree_Action (m.Vertices, findminmax);
     getminmax (&m.Grid.min.X, &m.Grid.min.Y, &m.Grid.min.Z,
-	       &m.Grid.max.X, &m.Grid.max.Y, &m.Grid.max.Z);
+               &m.Grid.max.X, &m.Grid.max.Y, &m.Grid.max.Z);
   }
 
   Tree_Action (m.Simplexes, AIG);
@@ -242,7 +242,7 @@ double ErrorInView (Post_View * ErrView, int *n){
 /* ------------------------------------------------------------------------ */
 
 int CreateBGM (Post_View * ErrView, int OptiMethod, double Degree,
-	       double OptiValue, double *ObjFunct, char *OutFile){
+               double OptiValue, double *ObjFunct, char *OutFile){
 
   Post_Simplex s, t;
   double *h, *p, *e, xc, yc, zc, c[3];
@@ -273,11 +273,11 @@ int CreateBGM (Post_View * ErrView, int OptiMethod, double Degree,
       3d ou utiliser une autre mesure de taille.
     */
     CircumCircle (t.X[0], t.Y[0],
-		  t.X[1], t.Y[1],
-		  t.X[2], t.Y[2],
-		  &xc, &yc);
+                  t.X[1], t.Y[1],
+                  t.X[2], t.Y[2],
+                  &xc, &yc);
     h[j + 1] = sqrt ((xc - t.X[0]) * (xc - t.X[0]) +
-		     (yc - t.Y[0]) * (yc - t.Y[0]));
+                     (yc - t.Y[0]) * (yc - t.Y[0]));
     p[j + 1] = Degree;
     e[j + 1] = (t.V[0] + t.V[1] + t.V[2]) / 3. ;
     j++;
@@ -293,8 +293,8 @@ int CreateBGM (Post_View * ErrView, int OptiMethod, double Degree,
     zc = c[2];
     
     h[j + 1] = sqrt ((xc - t.X[0]) * (xc - t.X[0]) +
-		     (yc - t.X[0]) * (yc - t.X[0]) +
-		     (zc - t.Y[0]) * (zc - t.Y[0]));
+                     (yc - t.X[0]) * (yc - t.X[0]) +
+                     (zc - t.Y[0]) * (zc - t.Y[0]));
     p[j + 1] = Degree;
     e[j + 1] = (t.V[0] + t.V[1] + t.V[2] + t.V[3]) * 0.25;
     j++;
@@ -309,20 +309,20 @@ int CreateBGM (Post_View * ErrView, int OptiMethod, double Degree,
   for (i = 0; i < List_Nbr (ErrView->Triangles); i++){
     List_Read (ErrView->Triangles, i, &t);
     fprintf (f, "ST(%g,%g,%g,%g,%g,%g,%g,%g,%g){%g,%g,%g};\n",
-	     t.X[0], t.Y[0], t.Z[0],
-	     t.X[1], t.Y[1], t.Z[1],
-	     t.X[2], t.Y[2], t.Z[2],
-	     h[j], h[j], h[j]);
+             t.X[0], t.Y[0], t.Z[0],
+             t.X[1], t.Y[1], t.Z[1],
+             t.X[2], t.Y[2], t.Z[2],
+             h[j], h[j], h[j]);
     j++;
   }
   for (i = 0; i < List_Nbr (ErrView->Tetrahedra); i++){
     List_Read (ErrView->Tetrahedra, i, &s);
     fprintf (f, "SS(%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g){%g,%g,%g,%g};\n",
-	     s.X[0], s.Y[0], s.Z[0],
-	     s.X[1], s.Y[1], s.Z[1],
-	     s.X[2], s.Y[2], s.Z[2],
-	     s.X[3], s.Y[3], s.Z[3],
-	     h[j], h[j], h[j], h[j]);
+             s.X[0], s.Y[0], s.Z[0],
+             s.X[1], s.Y[1], s.Z[1],
+             s.X[2], s.Y[2], s.Z[2],
+             s.X[3], s.Y[3], s.Z[3],
+             h[j], h[j], h[j], h[j]);
     j++;
   }
   fprintf (f, "};\n");
diff --git a/Mesh/3D_Bricks.cpp b/Mesh/3D_Bricks.cpp
index 64c2fe3653..fae53f02a0 100644
--- a/Mesh/3D_Bricks.cpp
+++ b/Mesh/3D_Bricks.cpp
@@ -1,4 +1,4 @@
-/* $Id: 3D_Bricks.cpp,v 1.4 2000-11-24 09:43:53 geuzaine Exp $ */
+/* $Id: 3D_Bricks.cpp,v 1.5 2000-11-26 15:43:46 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "Const.h"
@@ -39,7 +39,7 @@ int DEBUT = 0;
 Coord MINIM, MAXIM;
 
 void getminmax (double *xmin, double *ymin, double *zmin,
-		double *xmax, double *ymax, double *zmax){
+                double *xmax, double *ymax, double *zmax){
 
   double dx, dy, dz, f;
 
@@ -122,17 +122,17 @@ void AddSimplexInGrid (Mesh * m, Simplex * s, int boule_boite){
   
 
   Ix1 = (int) ((double) m->Grid.Nx * (XminBox - m->Grid.min.X) /
-	       (m->Grid.max.X - m->Grid.min.X));
+               (m->Grid.max.X - m->Grid.min.X));
   Ix2 = (int) ((double) m->Grid.Nx * (XmaxBox - m->Grid.min.X) /
-	       (m->Grid.max.X - m->Grid.min.X));
+               (m->Grid.max.X - m->Grid.min.X));
   Iy1 = (int) ((double) m->Grid.Ny * (YminBox - m->Grid.min.Y) /
-	       (m->Grid.max.Y - m->Grid.min.Y));
+               (m->Grid.max.Y - m->Grid.min.Y));
   Iy2 = (int) ((double) m->Grid.Ny * (YmaxBox - m->Grid.min.Y) /
-	       (m->Grid.max.Y - m->Grid.min.Y));
+               (m->Grid.max.Y - m->Grid.min.Y));
   Iz1 = (int) ((double) m->Grid.Nz * (ZminBox - m->Grid.min.Z) /
-	       (m->Grid.max.Z - m->Grid.min.Z));
+               (m->Grid.max.Z - m->Grid.min.Z));
   Iz2 = (int) ((double) m->Grid.Nz * (ZmaxBox - m->Grid.min.Z) /
-	       (m->Grid.max.Z - m->Grid.min.Z));
+               (m->Grid.max.Z - m->Grid.min.Z));
 
   Ix1 = IMAX (Ix1, 0);
   Ix2 = IMIN (Ix2, m->Grid.Nx - 1);
@@ -144,9 +144,9 @@ void AddSimplexInGrid (Mesh * m, Simplex * s, int boule_boite){
   for (i = Ix1; i <= Ix2; i++){
     for (j = Iy1; j <= Iy2; j++){
       for (k = Iz1; k <= Iz2; k++){
-	index = i + j * m->Grid.Nx + k * m->Grid.Nx * m->Grid.Ny;
-	pBrick = (Brick *) List_Pointer (m->Grid.Bricks, index);
-	List_Add (pBrick->pT, &s);
+        index = i + j * m->Grid.Nx + k * m->Grid.Nx * m->Grid.Ny;
+        pBrick = (Brick *) List_Pointer (m->Grid.Bricks, index);
+        List_Add (pBrick->pT, &s);
       }
     }
   }
diff --git a/Mesh/3D_Coherence.cpp b/Mesh/3D_Coherence.cpp
index bf833d2820..8f9bd47e6a 100644
--- a/Mesh/3D_Coherence.cpp
+++ b/Mesh/3D_Coherence.cpp
@@ -1,4 +1,4 @@
-/* $Id: 3D_Coherence.cpp,v 1.6 2000-11-24 08:04:14 geuzaine Exp $ */
+/* $Id: 3D_Coherence.cpp,v 1.7 2000-11-26 15:43:46 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "Const.h"
@@ -21,21 +21,21 @@ List_T *Missing, *MissingF, *MissingS;
 Tree_T *EdgesTree, *FacesTree, *swaps;
 
 int edges_quad[4][2] = { {0, 1},
-			 {1, 2},
-			 {2, 3},
-			 {3, 0} };
+                         {1, 2},
+                         {2, 3},
+                         {3, 0} };
 int edges_tetra[6][2] = { {0, 1},
-			  {1, 2},
-			  {2, 0},
-			  {3, 0},
-			  {3, 2},
-			  {3, 1} };
+                          {1, 2},
+                          {2, 0},
+                          {3, 0},
+                          {3, 2},
+                          {3, 1} };
 int edges_non[3] = {2, 0, 1};
 int NbQ;
 int EdgesInVolume = 1;
 
 int memesens (Vertex * v1, Vertex * v2, Vertex * v3,
-	      Vertex * c1, Vertex * c2, Vertex * c3){
+              Vertex * c1, Vertex * c2, Vertex * c3){
   double v12[3], v13[3], n1[3], n2[3], p;
 
   v12[0] = c1->Pos.X - c2->Pos.X;
@@ -76,8 +76,8 @@ static void pedge (void *a, void *b){
   Edge *e;
   e = (Edge *) a;
   printf ("arete %d (%12.5E,%12.5E,%12.5E) -> %d (%12.5E,%12.5E,%12.5E)\n",
-	  e->V[0]->Num, e->V[0]->Pos.X, e->V[0]->Pos.Y, e->V[0]->Pos.Z,
-	  e->V[1]->Num, e->V[1]->Pos.X, e->V[1]->Pos.Y, e->V[1]->Pos.Z);
+          e->V[0]->Num, e->V[0]->Pos.X, e->V[0]->Pos.Y, e->V[0]->Pos.Z,
+          e->V[1]->Num, e->V[1]->Pos.X, e->V[1]->Pos.Y, e->V[1]->Pos.Z);
   */
 }
 
@@ -249,26 +249,26 @@ void create_Edge (void *a, void *b){
   if (s->V[3] && EdgesInVolume){
     N = 6;
     for (i = 0; i < N; i++)
-	for (j = 0; j < 2; j++)
-	  edges[i][j] = edges_tetra[i][j];
+        for (j = 0; j < 2; j++)
+          edges[i][j] = edges_tetra[i][j];
   }
   else if (s->V[3]){
     N = 4;
     for (i = 0; i < N; i++)
       for (j = 0; j < 2; j++)
-	edges[i][j] = edges_quad[i][j];
+        edges[i][j] = edges_quad[i][j];
   }
   else if (s->V[2]){
     N = 3;
     for (i = 0; i < N; i++)
       for (j = 0; j < 2; j++)
-	edges[i][j] = edges_tetra[i][j];
+        edges[i][j] = edges_tetra[i][j];
   }
   else{
     N = 1;
     for (i = 0; i < N; i++)
       for (j = 0; j < 2; j++)
-	edges[i][j] = edges_tetra[i][j];
+        edges[i][j] = edges_tetra[i][j];
   }
 
   for (i = 0; i < N; i++){
@@ -277,14 +277,14 @@ void create_Edge (void *a, void *b){
     if ((pE = (Edge *) Tree_PQuery (EdgesTree, &E))){
       List_Add (pE->Simplexes, ps);
       if (N == 3)
-	pE->O[1] = s->V[edges_non[i]];
+        pE->O[1] = s->V[edges_non[i]];
     }
     else{
       E.Simplexes = List_Create (2, 1, sizeof (Simplex *));
       if (N == 3)
-	E.O[0] = s->V[edges_non[i]];
+        E.O[0] = s->V[edges_non[i]];
       if (N == 3)
-	E.O[1] = NULL;
+        E.O[1] = NULL;
       List_Add (E.Simplexes, &s);
       E.newv = NULL;
       Tree_Replace (EdgesTree, &E);
@@ -473,7 +473,7 @@ int Edge_Node (Edge * e, Vertex * v){
     return 1;
 
   lc = myhypot (myhypot (e->V[0]->Pos.X - e->V[1]->Pos.X, e->V[0]->Pos.Y - e->V[1]->Pos.Y),
-		e->V[0]->Pos.Z - e->V[1]->Pos.Z);
+                e->V[0]->Pos.Z - e->V[1]->Pos.Z);
   
   if (e->V[0]->Pos.X != e->V[1]->Pos.X){
     u = (v->Pos.X - e->V[0]->Pos.X) / (e->V[1]->Pos.X - e->V[0]->Pos.X);
@@ -573,23 +573,23 @@ Vertex *Edge_Face (Edge * e, Face * f){
   if (res[0] == 1.0 || res[2] == 0.0 || res[0] == 0.0 ||
       res[1] == 1. - res[0] || res[1] == 0.0 || res[0] == 1.0)
     Msg(DEBUG, "Face p1  %g %g %g\n"
-	DEBUG_NIL "facette p2  %g %g %g\n"
-	DEBUG_NIL "facette p3  %g %g %g\n"
-	DEBUG_NIL "edge    e2  %g %g %g\n"
-	DEBUG_NIL "edge    e3  %g %g %g\n"
-	DEBUG_NIL "%g %g %g",
-	f->V[0]->Pos.X, f->V[0]->Pos.Y, f->V[0]->Pos.Z,
-	f->V[1]->Pos.X, f->V[1]->Pos.Y, f->V[1]->Pos.Z,
-	f->V[2]->Pos.X, f->V[2]->Pos.Y, f->V[2]->Pos.Z,
-	e->V[0]->Pos.X, e->V[0]->Pos.Y, e->V[0]->Pos.Z,
-	e->V[1]->Pos.X, e->V[1]->Pos.Y, e->V[1]->Pos.Z,
-	res[0], res[1], res[2]);
+        DEBUG_NIL "facette p2  %g %g %g\n"
+        DEBUG_NIL "facette p3  %g %g %g\n"
+        DEBUG_NIL "edge    e2  %g %g %g\n"
+        DEBUG_NIL "edge    e3  %g %g %g\n"
+        DEBUG_NIL "%g %g %g",
+        f->V[0]->Pos.X, f->V[0]->Pos.Y, f->V[0]->Pos.Z,
+        f->V[1]->Pos.X, f->V[1]->Pos.Y, f->V[1]->Pos.Z,
+        f->V[2]->Pos.X, f->V[2]->Pos.Y, f->V[2]->Pos.Z,
+        e->V[0]->Pos.X, e->V[0]->Pos.Y, e->V[0]->Pos.Z,
+        e->V[1]->Pos.X, e->V[1]->Pos.Y, e->V[1]->Pos.Z,
+        res[0], res[1], res[2]);
 
   v = Create_Vertex (++CurrentNodeNumber,
-		     (1. - res[2]) * e->V[0]->Pos.X + res[2] * e->V[1]->Pos.X,
-		     (1. - res[2]) * e->V[0]->Pos.Y + res[2] * e->V[1]->Pos.Y,
-		     (1. - res[2]) * e->V[0]->Pos.Z + res[2] * e->V[1]->Pos.Z,
-		     (1. - res[2]) * e->V[0]->lc + res[2] * e->V[1]->lc, 0.0);
+                     (1. - res[2]) * e->V[0]->Pos.X + res[2] * e->V[1]->Pos.X,
+                     (1. - res[2]) * e->V[0]->Pos.Y + res[2] * e->V[1]->Pos.Y,
+                     (1. - res[2]) * e->V[0]->Pos.Z + res[2] * e->V[1]->Pos.Z,
+                     (1. - res[2]) * e->V[0]->lc + res[2] * e->V[1]->lc, 0.0);
   v->ListSurf = List_Create (1, 1, sizeof (Surface *));
 
   return v;
@@ -723,22 +723,22 @@ Vertex *Edge_Edge (Edge * e, Vertex * v1, Vertex * v2){
       mat[0][1] = v1->Pos.Y - v2->Pos.Y;
       b[0] = -e->V[0]->Pos.Y + v1->Pos.Y;
       if (!sys2x2 (mat, b, res)){
-	/* SEGMENTS PARALLELES */
-	/* printf("systeme singulier\n");
-	   printf("arete %d -> %d\n",v1->Num,v2->Num);
-	   printf("arete %g %g %g --> %g %g %g\n",
-	          v1->Pos.X,v1->Pos.Y,v1->Pos.Z,v2->Pos.X,v2->Pos.Y,v2->Pos.Z);
-	   printf("arete %g %g %g --> %g %g %g\n",
-	          e->V[0]->Pos.X,e->V[0]->Pos.Y,e->V[0]->Pos.Z,
-		  e->V[1]->Pos.X,e->V[1]->Pos.Y,e->V[1]->Pos.Z);
-	   printf("%g %g\n",mat[0][0],mat[0][1]);
-	   printf("%g %g\n",mat[1][0],mat[1][1]);
-	   getchar();
-	*/
-	return NULL;
+        /* SEGMENTS PARALLELES */
+        /* printf("systeme singulier\n");
+           printf("arete %d -> %d\n",v1->Num,v2->Num);
+           printf("arete %g %g %g --> %g %g %g\n",
+                  v1->Pos.X,v1->Pos.Y,v1->Pos.Z,v2->Pos.X,v2->Pos.Y,v2->Pos.Z);
+           printf("arete %g %g %g --> %g %g %g\n",
+                  e->V[0]->Pos.X,e->V[0]->Pos.Y,e->V[0]->Pos.Z,
+                  e->V[1]->Pos.X,e->V[1]->Pos.Y,e->V[1]->Pos.Z);
+           printf("%g %g\n",mat[0][0],mat[0][1]);
+           printf("%g %g\n",mat[1][0],mat[1][1]);
+           getchar();
+        */
+        return NULL;
       }
       else{
-	dir = 1;
+        dir = 1;
       }
     }
     else{
@@ -771,10 +771,10 @@ Vertex *Edge_Edge (Edge * e, Vertex * v1, Vertex * v2){
   if (fabs (val / lc) > 1.e-08 /*08 */ )
     return NULL;
   v = Create_Vertex (++CurrentNodeNumber,
-		     (1. - res[0]) * e->V[0]->Pos.X + res[0] * e->V[1]->Pos.X,
-		     (1. - res[0]) * e->V[0]->Pos.Y + res[0] * e->V[1]->Pos.Y,
-		     (1. - res[0]) * e->V[0]->Pos.Z + res[0] * e->V[1]->Pos.Z,
-		     (1. - res[0]) * e->V[0]->lc + res[0] * e->V[1]->lc, 0.0);
+                     (1. - res[0]) * e->V[0]->Pos.X + res[0] * e->V[1]->Pos.X,
+                     (1. - res[0]) * e->V[0]->Pos.Y + res[0] * e->V[1]->Pos.Y,
+                     (1. - res[0]) * e->V[0]->Pos.Z + res[0] * e->V[1]->Pos.Z,
+                     (1. - res[0]) * e->V[0]->lc + res[0] * e->V[1]->lc, 0.0);
   
   v->ListSurf = List_Create (1, 1, sizeof (Surface *));
   return v;
@@ -782,11 +782,11 @@ Vertex *Edge_Edge (Edge * e, Vertex * v1, Vertex * v2){
 }
 
 int intersection_2_aretes (double Xa, double Ya, double Za,
-			   double Xb, double Yb, double Zb,
-			   double Xc, double Yc, double Zc,
-			   double Xd, double Yd, double Zd,
-			   int p1, int p2, int p3, int p4,
-			   double *X, double *Y, double *Z){
+                           double Xb, double Yb, double Zb,
+                           double Xc, double Yc, double Zc,
+                           double Xd, double Yd, double Zd,
+                           int p1, int p2, int p3, int p4,
+                           double *X, double *Y, double *Z){
   Vertex *v1, *v2, *v3, *v4, *v;
   Edge e;
   v1 = Create_Vertex (p1, Xa, Ya, Za, 0.0, 0.0);
@@ -896,10 +896,10 @@ void Intersect_Edge_Simplexe (Edge * e, Simplex * s, Intersection * I){
       I->iV[I->NbVertex++] = i;
       (I->NbIntersect)++;
       if (j == 2){
-	List_Replace (NewPoints, &s->V[i], compareVertex);
-	/*      printf("l'arete intersecte un noeud\n"); */
-	pvertex (s->V[i], s->V[i]);
-	pedge (e, e);
+        List_Replace (NewPoints, &s->V[i], compareVertex);
+        /*      printf("l'arete intersecte un noeud\n"); */
+        pvertex (s->V[i], s->V[i]);
+        pedge (e, e);
       }
     }
   }
@@ -919,7 +919,7 @@ void Intersect_Edge_Simplexe (Edge * e, Simplex * s, Intersection * I){
       (I->NbIntersect)++;
     }
     else if ((v = Edge_Edge (e, s->V[edges_tetra[i][0]],
-			     s->V[edges_tetra[i][1]]))) {
+                             s->V[edges_tetra[i][1]]))) {
       List_Add (NewPoints, &v);
       I->E[I->NbEdge] = i;
       I->VE[(I->NbEdge)++] = v;
@@ -1110,9 +1110,9 @@ void findFaces (void *a, void *b){
     */
     for (i = 0; i < 4; i++){
       if (List_Search (NewPoints, &s->F[i].V[0], compareVertex) &&
-	  List_Search (NewPoints, &s->F[i].V[1], compareVertex) &&
-	  List_Search (NewPoints, &s->F[i].V[2], compareVertex))
-	List_Replace (ListFaces, &s->F[i], compareFace);
+          List_Search (NewPoints, &s->F[i].V[1], compareVertex) &&
+          List_Search (NewPoints, &s->F[i].V[2], compareVertex))
+        List_Replace (ListFaces, &s->F[i], compareFace);
     }
 }
 
@@ -1206,12 +1206,12 @@ int Coherence (Volume * v, Mesh * m){
       }
     */
     Msg(INFOS, "Edge %d->%d => %d Division(s)", 
-	pE1->V[0]->Num, pE1->V[1]->Num, List_Nbr(NewPoints));
+        pE1->V[0]->Num, pE1->V[1]->Num, List_Nbr(NewPoints));
 
     if (!List_Nbr (NewPoints))
       Msg(ERROR, "Missing Edge Without Any Intersection (%g,%g,%g) (%g,%g,%g)",
-	  pE1->V[0]->Pos.X, pE1->V[0]->Pos.Y, pE1->V[0]->Pos.Z,
-	  pE1->V[1]->Pos.X, pE1->V[1]->Pos.Y, pE1->V[1]->Pos.Z);
+          pE1->V[0]->Pos.X, pE1->V[0]->Pos.Y, pE1->V[0]->Pos.Z,
+          pE1->V[1]->Pos.X, pE1->V[1]->Pos.Y, pE1->V[1]->Pos.Z);
     
   }
 
@@ -1231,7 +1231,7 @@ int Coherence (Volume * v, Mesh * m){
     List_Read (MissingS, i, &simp);
     TheFace = &simp->F[0];
     Msg(INFOS, "Face %d %d %d", simp->F[0].V[0]->Num, 
-	simp->F[0].V[1]->Num, simp->F[0].V[2]->Num);
+        simp->F[0].V[1]->Num, simp->F[0].V[2]->Num);
     E.V[0] = simp->F[0].V[0];
     E.V[1] = simp->F[0].V[1];
     pE1 = (Edge *) List_PQuery (Missing, &E, compareedge);
@@ -1248,15 +1248,15 @@ int Coherence (Volume * v, Mesh * m){
     List_Add (NewPoints, &simp->F[0].V[0]);
     if (pE1)
       for (j = 0; j < List_Nbr (pE1->Liste); j++)
-	List_Add (NewPoints, List_Pointer (pE1->Liste, j));
+        List_Add (NewPoints, List_Pointer (pE1->Liste, j));
     List_Add (NewPoints, &simp->F[0].V[1]);
     if (pE2)
       for (j = 0; j < List_Nbr (pE2->Liste); j++)
-	List_Add (NewPoints, List_Pointer (pE2->Liste, j));
+        List_Add (NewPoints, List_Pointer (pE2->Liste, j));
     List_Add (NewPoints, &simp->F[0].V[2]);
     if (pE3)
       for (j = 0; j < List_Nbr (pE3->Liste); j++)
-	List_Add (NewPoints, List_Pointer (pE3->Liste, j));
+        List_Add (NewPoints, List_Pointer (pE3->Liste, j));
     ListFaces = List_Create (2, 2, sizeof (Face));
     Tree_Action (v->Simplexes, findFaces);
     
@@ -1266,17 +1266,17 @@ int Coherence (Volume * v, Mesh * m){
     
     if (List_Nbr (ListFaces) != Nh - 2){
       /*
-	printf("Recherche des intersections\n");
-	printf("La face initiale comprend %d faces existantes\n",List_Nbr(ListFaces));
-	printf("La face est divisee en %d points\n",List_Nbr(NewPoints));
+        printf("Recherche des intersections\n");
+        printf("La face initiale comprend %d faces existantes\n",List_Nbr(ListFaces));
+        printf("La face est divisee en %d points\n",List_Nbr(NewPoints));
       */
       TreexNewv = Tree_Create (sizeof (xNewv), compxNewv);
       TetAdd = Tree_Create (sizeof (Simplex *), compareSimplex);
       TetDel = Tree_Create (sizeof (Simplex *), compareSimplex);
       Tree_Action (v->Simplexes, Recover_Face);
       /*
-	printf("La face est divisee en %d points %d %d \n",
-	       List_Nbr(NewPoints),Tree_Nbr(TetAdd),Tree_Nbr(TetDel));
+        printf("La face est divisee en %d points %d %d \n",
+               List_Nbr(NewPoints),Tree_Nbr(TetAdd),Tree_Nbr(TetDel));
       */
       Actual_Tree = v->Simplexes;
       Tree_Action (TetAdd, _Add);
@@ -1290,32 +1290,32 @@ int Coherence (Volume * v, Mesh * m){
     if (1 || List_Nbr (ListFaces) == 2 * (Np - 1) - Nh){
       
       Msg(INFOS, "Recoverable Face (%d <--> %d=2*(%d-1)-%d)",
-	  List_Nbr (ListFaces), 2 * (Np - 1) - Nh, Np, Nh);
+          List_Nbr (ListFaces), 2 * (Np - 1) - Nh, Np, Nh);
       
       for (j = 0; j < List_Nbr (v->Surfaces); j++){
-	List_Read (v->Surfaces, j, &s);
-	if (Tree_Search (s->Simplexes, &simp)){
-	  for (k = 0; k < List_Nbr (ListFaces); k++){
-	    List_Read (ListFaces, k, &Face);
-	    simp1 = Create_Simplex_MemeSens (simp, Face.V[0], Face.V[1], Face.V[2]);
-	    Tree_Add (s->Simplexes, &simp1);
-	    Tree_Replace (s->Vertices, &Face.V[0]);
-	    Tree_Replace (s->Vertices, &Face.V[1]);
-	    Tree_Replace (s->Vertices, &Face.V[2]);
-	    Tree_Replace (v->Vertices, &Face.V[0]);
-	    Tree_Replace (v->Vertices, &Face.V[1]);
-	    Tree_Replace (v->Vertices, &Face.V[2]);
-	  }
-	  Tree_Suppress (s->Simplexes, &simp);
-	}
+        List_Read (v->Surfaces, j, &s);
+        if (Tree_Search (s->Simplexes, &simp)){
+          for (k = 0; k < List_Nbr (ListFaces); k++){
+            List_Read (ListFaces, k, &Face);
+            simp1 = Create_Simplex_MemeSens (simp, Face.V[0], Face.V[1], Face.V[2]);
+            Tree_Add (s->Simplexes, &simp1);
+            Tree_Replace (s->Vertices, &Face.V[0]);
+            Tree_Replace (s->Vertices, &Face.V[1]);
+            Tree_Replace (s->Vertices, &Face.V[2]);
+            Tree_Replace (v->Vertices, &Face.V[0]);
+            Tree_Replace (v->Vertices, &Face.V[1]);
+            Tree_Replace (v->Vertices, &Face.V[2]);
+          }
+          Tree_Suppress (s->Simplexes, &simp);
+        }
       }
     }
     else{
       Msg(ERROR, "*Unrecoverable* Face (%d <--> %d=2*(%d-1)-%d)",
-	  List_Nbr (ListFaces), 2 * (Np - 1) - Nh, Np, Nh);
+          List_Nbr (ListFaces), 2 * (Np - 1) - Nh, Np, Nh);
       for (k = 0; k < List_Nbr (ListFaces); k++){
-	List_Read (ListFaces, k, &Face);
-	Msg(INFO, "Face %d %d %d", Face.V[0]->Num, Face.V[1]->Num, Face.V[2]->Num);
+        List_Read (ListFaces, k, &Face);
+        Msg(INFO, "Face %d %d %d", Face.V[0]->Num, Face.V[1]->Num, Face.V[2]->Num);
       }
       Tree_Action (v->Simplexes, findEdges);
     }
@@ -1406,16 +1406,16 @@ int isListaVolume (List_T * ListSurf, Mesh * M){
     NN = 0;
     if (v->Typ == MSH_VOLUME){
       for (j = 0; j < List_Nbr (v->Surfaces); j++){
-	List_Read (v->Surfaces, j, &Surf);
-	srf = abs (Surf->Num);
-	if (!List_Search (ListSurf, &srf, fcmp_int)){
-	  found = false;
-	}
-	else
-	  NN++;
+        List_Read (v->Surfaces, j, &Surf);
+        srf = abs (Surf->Num);
+        if (!List_Search (ListSurf, &srf, fcmp_int)){
+          found = false;
+        }
+        else
+          NN++;
       }
       if (found && NN == List_Nbr (ListSurf))
-	return v->Num;
+        return v->Num;
     }
   }
   return 0;
diff --git a/Mesh/3D_Divide.cpp b/Mesh/3D_Divide.cpp
index 4f153e7297..6bf113227f 100644
--- a/Mesh/3D_Divide.cpp
+++ b/Mesh/3D_Divide.cpp
@@ -1,4 +1,4 @@
-/* $Id: 3D_Divide.cpp,v 1.4 2000-11-24 08:04:14 geuzaine Exp $ */
+/* $Id: 3D_Divide.cpp,v 1.5 2000-11-26 15:43:46 geuzaine Exp $ */
 /* Routine de division des elements tetraedriques
    ou triangulaires
 
@@ -65,8 +65,8 @@ void Impression_Resultats (void){
 int PARLE = 0;
 
 void cut_prism (Vertex * v1, Vertex * v2, Vertex * v3,
-		Vertex * v4, Vertex * v5, Vertex * v6,
-		Tree_T * newpoints, Tree_T * AddedTet){
+                Vertex * v4, Vertex * v5, Vertex * v6,
+                Tree_T * newpoints, Tree_T * AddedTet){
 
   Simplex *news;
   Vertex *e1;
@@ -111,7 +111,7 @@ void cut_prism (Vertex * v1, Vertex * v2, Vertex * v3,
      }
      }
    */
-  if (!are_exists (v1, v5) &&	//OK
+  if (!are_exists (v1, v5) &&   //OK
       !are_exists (v6, v2) &&
       !are_exists (v6, v1)){
     news = Create_Simplex (v1, v2, v3, v4);
@@ -127,9 +127,9 @@ void cut_prism (Vertex * v1, Vertex * v2, Vertex * v3,
     are_add (v5, v3);
     are_add (v4, v3);
   }
-  else if (!are_exists (v1, v5) &&	//OK
-	   !are_exists (v3, v5) &&
-	   !are_exists (v1, v6)){
+  else if (!are_exists (v1, v5) &&      //OK
+           !are_exists (v3, v5) &&
+           !are_exists (v1, v6)){
     news = Create_Simplex (v1, v2, v3, v4);
     news->iEnt = IENT;
     Tree_Add (AddedTet, &news);
@@ -143,9 +143,9 @@ void cut_prism (Vertex * v1, Vertex * v2, Vertex * v3,
     are_add (v2, v6);
     are_add (v4, v3);
   }
-  else if (!are_exists (v1, v5) &&	//OK
-	   !are_exists (v3, v5) &&
-	   !are_exists (v4, v3)){
+  else if (!are_exists (v1, v5) &&      //OK
+           !are_exists (v3, v5) &&
+           !are_exists (v4, v3)){
     news = Create_Simplex (v1, v2, v3, v6);
     news->iEnt = IENT;
     Tree_Add (AddedTet, &news);
@@ -159,9 +159,9 @@ void cut_prism (Vertex * v1, Vertex * v2, Vertex * v3,
     are_add (v2, v6);
     are_add (v6, v1);
   }
-  else if (!are_exists (v4, v2) &&	//OK
-	   !are_exists (v6, v2) &&
-	   !are_exists (v6, v1)){
+  else if (!are_exists (v4, v2) &&      //OK
+           !are_exists (v6, v2) &&
+           !are_exists (v6, v1)){
     news = Create_Simplex (v1, v2, v3, v5);
     news->iEnt = IENT;
     Tree_Add (AddedTet, &news);
@@ -175,9 +175,9 @@ void cut_prism (Vertex * v1, Vertex * v2, Vertex * v3,
     are_add (v5, v3);
     are_add (v4, v3);
   }
-  else if (!are_exists (v4, v2) &&	//OK
-	   !are_exists (v6, v2) &&
-	   !are_exists (v4, v3)){
+  else if (!are_exists (v4, v2) &&      //OK
+           !are_exists (v6, v2) &&
+           !are_exists (v4, v3)){
     news = Create_Simplex (v1, v2, v3, v5);
     news->iEnt = IENT;
     Tree_Add (AddedTet, &news);
@@ -191,9 +191,9 @@ void cut_prism (Vertex * v1, Vertex * v2, Vertex * v3,
     are_add (v5, v3);
     are_add (v6, v1);
   }
-  else if (!are_exists (v4, v2) &&	//OK
-	   !are_exists (v3, v5) &&
-	   !are_exists (v4, v3)){
+  else if (!are_exists (v4, v2) &&      //OK
+           !are_exists (v3, v5) &&
+           !are_exists (v4, v3)){
     news = Create_Simplex (v1, v2, v3, v6);
     news->iEnt = IENT;
     Tree_Add (AddedTet, &news);
@@ -209,8 +209,8 @@ void cut_prism (Vertex * v1, Vertex * v2, Vertex * v3,
   }
 
   else if (are_exists (v6, v1) &&
-	   are_exists (v5, v3) &&
-	   are_exists (v4, v2)) {
+           are_exists (v5, v3) &&
+           are_exists (v4, v2)) {
     Msg(INFOS, "Found Steiner Prism 1!");
     
     e1 = Create_Vertex 
@@ -242,8 +242,8 @@ void cut_prism (Vertex * v1, Vertex * v2, Vertex * v3,
   }
 
   else if (are_exists (v4, v3) &&
-	   are_exists (v6, v2) &&
-	   are_exists (v5, v1)){
+           are_exists (v6, v2) &&
+           are_exists (v5, v1)){
     Msg(INFOS, "Found Steiner Prism 2!");
 
     e1 = Create_Vertex 
@@ -281,7 +281,7 @@ void cut_prism (Vertex * v1, Vertex * v2, Vertex * v3,
 
 
 void cut_tetraedre (Intersection * pI, Tree_T * AddedTet, Tree_T * TetDel,
-		    Tree_T * newpoints){
+                    Tree_T * newpoints){
   int i;
   nxn nx;
   Simplex *s;
@@ -309,10 +309,10 @@ void cut_tetraedre (Intersection * pI, Tree_T * AddedTet, Tree_T * TetDel,
       s->iEnt = IENT;
       Tree_Add (AddedTet, &s);
       if (PARLE)
-	printf ("ajout %d %d %d %d\n", s->V[0]->Num, s->V[1]->Num, s->V[2]->Num, s->V[3]->Num);
+        printf ("ajout %d %d %d %d\n", s->V[0]->Num, s->V[1]->Num, s->V[2]->Num, s->V[3]->Num);
       s = Create_Simplex (pI->s->V[1], pI->s->V[3], pI->s->V[2], pI->VE[0]);
       if (PARLE)
-	printf ("ajout %d %d %d %d\n", s->V[0]->Num, s->V[1]->Num, s->V[2]->Num, s->V[3]->Num);
+        printf ("ajout %d %d %d %d\n", s->V[0]->Num, s->V[1]->Num, s->V[2]->Num, s->V[3]->Num);
       s->iEnt = IENT;
       Tree_Add (AddedTet, &s);
     }
@@ -320,12 +320,12 @@ void cut_tetraedre (Intersection * pI, Tree_T * AddedTet, Tree_T * TetDel,
       /* Verifie */
       s = Create_Simplex (pI->s->V[0], pI->s->V[3], pI->s->V[2], pI->VE[0]);
       if (PARLE)
-	printf ("ajout %d %d %d %d\n", s->V[0]->Num, s->V[1]->Num, s->V[2]->Num, s->V[3]->Num);
+        printf ("ajout %d %d %d %d\n", s->V[0]->Num, s->V[1]->Num, s->V[2]->Num, s->V[3]->Num);
       s->iEnt = IENT;
       Tree_Add (AddedTet, &s);
       s = Create_Simplex (pI->s->V[3], pI->s->V[1], pI->s->V[0], pI->VE[0]);
       if (PARLE)
-	printf ("ajout %d %d %d %d\n", s->V[0]->Num, s->V[1]->Num, s->V[2]->Num, s->V[3]->Num);
+        printf ("ajout %d %d %d %d\n", s->V[0]->Num, s->V[1]->Num, s->V[2]->Num, s->V[3]->Num);
       s->iEnt = IENT;
       Tree_Add (AddedTet, &s);
     }
@@ -333,12 +333,12 @@ void cut_tetraedre (Intersection * pI, Tree_T * AddedTet, Tree_T * TetDel,
       /* Verifie */
       s = Create_Simplex (pI->s->V[0], pI->s->V[1], pI->s->V[3], pI->VE[0]);
       if (PARLE)
-	printf ("ajout %d %d %d %d\n", s->V[0]->Num, s->V[1]->Num, s->V[2]->Num, s->V[3]->Num);
+        printf ("ajout %d %d %d %d\n", s->V[0]->Num, s->V[1]->Num, s->V[2]->Num, s->V[3]->Num);
       s->iEnt = IENT;
       Tree_Add (AddedTet, &s);
       s = Create_Simplex (pI->s->V[1], pI->s->V[3], pI->s->V[2], pI->VE[0]);
       if (PARLE)
-	printf ("ajout %d %d %d %d\n", s->V[0]->Num, s->V[1]->Num, s->V[2]->Num, s->V[3]->Num);
+        printf ("ajout %d %d %d %d\n", s->V[0]->Num, s->V[1]->Num, s->V[2]->Num, s->V[3]->Num);
       s->iEnt = IENT;
       Tree_Add (AddedTet, &s);
     }
@@ -346,12 +346,12 @@ void cut_tetraedre (Intersection * pI, Tree_T * AddedTet, Tree_T * TetDel,
       /* Verifie */
       s = Create_Simplex (pI->s->V[0], pI->s->V[1], pI->s->V[2], pI->VE[0]);
       if (PARLE)
-	printf ("ajout %d %d %d %d\n", s->V[0]->Num, s->V[1]->Num, s->V[2]->Num, s->V[3]->Num);
+        printf ("ajout %d %d %d %d\n", s->V[0]->Num, s->V[1]->Num, s->V[2]->Num, s->V[3]->Num);
       s->iEnt = IENT;
       Tree_Add (AddedTet, &s);
       s = Create_Simplex (pI->s->V[1], pI->s->V[2], pI->s->V[3], pI->VE[0]);
       if (PARLE)
-	printf ("ajout %d %d %d %d\n", s->V[0]->Num, s->V[1]->Num, s->V[2]->Num, s->V[3]->Num);
+        printf ("ajout %d %d %d %d\n", s->V[0]->Num, s->V[1]->Num, s->V[2]->Num, s->V[3]->Num);
       s->iEnt = IENT;
       Tree_Add (AddedTet, &s);
     }
@@ -359,12 +359,12 @@ void cut_tetraedre (Intersection * pI, Tree_T * AddedTet, Tree_T * TetDel,
       /* Verifie */
       s = Create_Simplex (pI->s->V[2], pI->s->V[0], pI->s->V[1], pI->VE[0]);
       if (PARLE)
-	printf ("ajout %d %d %d %d\n", s->V[0]->Num, s->V[1]->Num, s->V[2]->Num, s->V[3]->Num);
+        printf ("ajout %d %d %d %d\n", s->V[0]->Num, s->V[1]->Num, s->V[2]->Num, s->V[3]->Num);
       s->iEnt = IENT;
       Tree_Add (AddedTet, &s);
       s = Create_Simplex (pI->s->V[1], pI->s->V[3], pI->s->V[0], pI->VE[0]);
       if (PARLE)
-	printf ("ajout %d %d %d %d\n", s->V[0]->Num, s->V[1]->Num, s->V[2]->Num, s->V[3]->Num);
+        printf ("ajout %d %d %d %d\n", s->V[0]->Num, s->V[1]->Num, s->V[2]->Num, s->V[3]->Num);
       s->iEnt = IENT;
       Tree_Add (AddedTet, &s);
     }
@@ -372,12 +372,12 @@ void cut_tetraedre (Intersection * pI, Tree_T * AddedTet, Tree_T * TetDel,
       /* Verifie */
       s = Create_Simplex (pI->s->V[0], pI->s->V[3], pI->s->V[2], pI->VE[0]);
       if (PARLE)
-	printf ("ajout %d %d %d %d\n", s->V[0]->Num, s->V[1]->Num, s->V[2]->Num, s->V[3]->Num);
+        printf ("ajout %d %d %d %d\n", s->V[0]->Num, s->V[1]->Num, s->V[2]->Num, s->V[3]->Num);
       s->iEnt = IENT;
       Tree_Add (AddedTet, &s);
       s = Create_Simplex (pI->s->V[0], pI->s->V[1], pI->s->V[2], pI->VE[0]);
       if (PARLE)
-	printf ("ajout %d %d %d %d\n", s->V[0]->Num, s->V[1]->Num, s->V[2]->Num, s->V[3]->Num);
+        printf ("ajout %d %d %d %d\n", s->V[0]->Num, s->V[1]->Num, s->V[2]->Num, s->V[3]->Num);
       s->iEnt = IENT;
       Tree_Add (AddedTet, &s);
     }
@@ -462,17 +462,17 @@ void cut_tetraedre (Intersection * pI, Tree_T * AddedTet, Tree_T * TetDel,
     }
     for (i = 0; i < 4; i++){
       if (compareVertex (&pI->F[0]->V[0], &pI->s->V[i]) &&
-	  compareVertex (&pI->F[0]->V[1], &pI->s->V[i]) &&
-	  compareVertex (&pI->F[0]->V[2], &pI->s->V[i]))
-	point1 = pI->s->V[i];
+          compareVertex (&pI->F[0]->V[1], &pI->s->V[i]) &&
+          compareVertex (&pI->F[0]->V[2], &pI->s->V[i]))
+        point1 = pI->s->V[i];
       else if (compareVertex (&pI->F[1]->V[0], &pI->s->V[i]) &&
-	       compareVertex (&pI->F[1]->V[1], &pI->s->V[i]) &&
-	       compareVertex (&pI->F[1]->V[2], &pI->s->V[i]))
-	point2 = pI->s->V[i];
+               compareVertex (&pI->F[1]->V[1], &pI->s->V[i]) &&
+               compareVertex (&pI->F[1]->V[2], &pI->s->V[i]))
+        point2 = pI->s->V[i];
       else if (point3)
-	point4 = pI->s->V[i];
+        point4 = pI->s->V[i];
       else
-	point3 = pI->s->V[i];
+        point3 = pI->s->V[i];
     }
     s = Create_Simplex (point3, point4, pI->VF[0], pI->VF[1]);
     s->iEnt = IENT;
@@ -577,9 +577,9 @@ void cut_tetraedre (Intersection * pI, Tree_T * AddedTet, Tree_T * TetDel,
     
     for (i = 0; i < 4; i++){
       if (compareVertex (&pI->s->V[i], &common) &&
-	  compareVertex (&pI->s->V[i], &other1) &&
-	  compareVertex (&pI->s->V[i], &other2))
-	lonely = pI->s->V[i];
+          compareVertex (&pI->s->V[i], &other1) &&
+          compareVertex (&pI->s->V[i], &other2))
+        lonely = pI->s->V[i];
     }
     
     nx.i = IMAX (e1->Num, other2->Num);
@@ -617,24 +617,24 @@ void cut_tetraedre (Intersection * pI, Tree_T * AddedTet, Tree_T * TetDel,
     Tree_Add (TetDel, &pI->s);
     for (i = 0; i < 4; i++)
       if (compareVertex (&pI->s->V[i], &pI->F[0]->V[0]) &&
-	  compareVertex (&pI->s->V[i], &pI->F[0]->V[1]) &&
-	  compareVertex (&pI->s->V[i], &pI->F[0]->V[2]))
-	v1 = pI->s->V[i];
+          compareVertex (&pI->s->V[i], &pI->F[0]->V[1]) &&
+          compareVertex (&pI->s->V[i], &pI->F[0]->V[2]))
+        v1 = pI->s->V[i];
     v2 = NULL;
     v3 = NULL;
     
     for (i = 0; i < 4; i++){
       if (compareVertex (&pI->s->V[i], &v1)){
-	if (compareVertex (&pI->s->V[i], &pI->s->V[edges_tetra[pI->E[0]][0]]) &&
-	    compareVertex (&pI->s->V[i], &pI->s->V[edges_tetra[pI->E[0]][1]])){
-	  if (v2)
-	    v3 = pI->s->V[i];
-	  else
-	    v2 = pI->s->V[i];
-	}
-	else{
-	  v4 = pI->s->V[i];
-	}
+        if (compareVertex (&pI->s->V[i], &pI->s->V[edges_tetra[pI->E[0]][0]]) &&
+            compareVertex (&pI->s->V[i], &pI->s->V[edges_tetra[pI->E[0]][1]])){
+          if (v2)
+            v3 = pI->s->V[i];
+          else
+            v2 = pI->s->V[i];
+        }
+        else{
+          v4 = pI->s->V[i];
+        }
       }
     }
     
diff --git a/Mesh/3D_Extrude.cpp b/Mesh/3D_Extrude.cpp
index 13df32e40e..e061cff603 100644
--- a/Mesh/3D_Extrude.cpp
+++ b/Mesh/3D_Extrude.cpp
@@ -1,4 +1,4 @@
-/* $Id: 3D_Extrude.cpp,v 1.4 2000-11-23 17:16:38 geuzaine Exp $ */
+/* $Id: 3D_Extrude.cpp,v 1.5 2000-11-26 15:43:46 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "Const.h"
@@ -83,13 +83,13 @@ void Extrude_Simplex_Phase1 (void *data, void *dum){
       List_Read (s->V[1]->Extruded_Points, k + 1, &v5);
       List_Read (s->V[2]->Extruded_Points, k + 1, &v6);
       if (ep->mesh.Simplexes){
-	k++;
-	if (!are_exist (v1, v5, Tree_Ares))
-	  are_cree (v2, v4, Tree_Ares);
-	if (!are_exist (v5, v3, Tree_Ares))
-	  are_cree (v2, v6, Tree_Ares);
-	if (!are_exist (v4, v3, Tree_Ares))
-	  are_cree (v1, v6, Tree_Ares);
+        k++;
+        if (!are_exist (v1, v5, Tree_Ares))
+          are_cree (v2, v4, Tree_Ares);
+        if (!are_exist (v5, v3, Tree_Ares))
+          are_cree (v2, v6, Tree_Ares);
+        if (!are_exist (v4, v3, Tree_Ares))
+          are_cree (v1, v6, Tree_Ares);
       }
       else if (!s->V[3]){
       }
@@ -119,120 +119,120 @@ void Extrude_Simplex_Phase3 (void *data, void *dum){
     for (j = 0; j < ep->mesh.NbElmLayer[i]; j++){
 
       if(s->V[3]){
-	List_Read(s->V[0]->Extruded_Points,k,&v1);
-	List_Read(s->V[1]->Extruded_Points,k,&v2);
-	List_Read(s->V[2]->Extruded_Points,k,&v3);
-	List_Read(s->V[3]->Extruded_Points,k,&v4);
-	List_Read(s->V[0]->Extruded_Points,k+1,&v5);
-	List_Read(s->V[1]->Extruded_Points,k+1,&v6);
-	List_Read(s->V[2]->Extruded_Points,k+1,&v7);
-	List_Read(s->V[3]->Extruded_Points,k+1,&v8);
+        List_Read(s->V[0]->Extruded_Points,k,&v1);
+        List_Read(s->V[1]->Extruded_Points,k,&v2);
+        List_Read(s->V[2]->Extruded_Points,k,&v3);
+        List_Read(s->V[3]->Extruded_Points,k,&v4);
+        List_Read(s->V[0]->Extruded_Points,k+1,&v5);
+        List_Read(s->V[1]->Extruded_Points,k+1,&v6);
+        List_Read(s->V[2]->Extruded_Points,k+1,&v7);
+        List_Read(s->V[3]->Extruded_Points,k+1,&v8);
       }
       else{
-	List_Read (s->V[0]->Extruded_Points, k, &v1);
-	List_Read (s->V[1]->Extruded_Points, k, &v2);
-	List_Read (s->V[2]->Extruded_Points, k, &v3);
-	List_Read (s->V[0]->Extruded_Points, k + 1, &v4);
-	List_Read (s->V[1]->Extruded_Points, k + 1, &v5);
-	List_Read (s->V[2]->Extruded_Points, k + 1, &v6);
+        List_Read (s->V[0]->Extruded_Points, k, &v1);
+        List_Read (s->V[1]->Extruded_Points, k, &v2);
+        List_Read (s->V[2]->Extruded_Points, k, &v3);
+        List_Read (s->V[0]->Extruded_Points, k + 1, &v4);
+        List_Read (s->V[1]->Extruded_Points, k + 1, &v5);
+        List_Read (s->V[2]->Extruded_Points, k + 1, &v6);
       }
 
       k++;
       if (ep->mesh.ZonLayer[i]){
 
-	if(ep->mesh.Recombine){
-	  if(s->V[3]){
-	    newh = Create_Hexahedron(v1,v2,v3,v4,v5,v6,v7,v8);
-	    newh->iEnt = ep->mesh.ZonLayer[i];
-	    Tree_Add(THEV->Hexahedra,&newh);
-	  }
-	  else{
-	    newp = Create_Prism(v1,v2,v3,v4,v5,v6);
-	    newp->iEnt = ep->mesh.ZonLayer[i];
-	    Tree_Add(THEV->Prisms,&newp);
-	  }
-	}
-	else{
-	  
-	  if (are_exist (v4, v2, Tree_Ares) &&
-	      are_exist (v5, v3, Tree_Ares) &&
-	      are_exist (v4, v3, Tree_Ares)){
-	    news = Create_Simplex (v1, v2, v3, v4);
-	    news->iEnt = ep->mesh.ZonLayer[i];
-	    Tree_Add (THEV->Simplexes, &news);
-	    news = Create_Simplex (v4, v5, v6, v3);
-	    news->iEnt = ep->mesh.ZonLayer[i];
-	    Tree_Add (THEV->Simplexes, &news);
-	    news = Create_Simplex (v2, v4, v5, v3);
-	    news->iEnt = ep->mesh.ZonLayer[i];
-	    Tree_Add (THEV->Simplexes, &news);
-	  }
-	  if (are_exist (v4, v2, Tree_Ares) &&
-	      are_exist (v2, v6, Tree_Ares) &&
-	      are_exist (v4, v3, Tree_Ares)){
-	    news = Create_Simplex (v1, v2, v3, v4);
-	    news->iEnt = ep->mesh.ZonLayer[i];
-	    Tree_Add (THEV->Simplexes, &news);
-	    news = Create_Simplex (v4, v5, v6, v2);
-	    news->iEnt = ep->mesh.ZonLayer[i];
-	    Tree_Add (THEV->Simplexes, &news);
-	    news = Create_Simplex (v4, v2, v6, v3);
-	    news->iEnt = ep->mesh.ZonLayer[i];
-	    Tree_Add (THEV->Simplexes, &news);
-	  }
-	  if (are_exist (v4, v2, Tree_Ares) &&
-	      are_exist (v2, v6, Tree_Ares) &&
-	      are_exist (v6, v1, Tree_Ares)){
-	    news = Create_Simplex (v1, v2, v3, v6);
-	    news->iEnt = ep->mesh.ZonLayer[i];
-	    Tree_Add (THEV->Simplexes, &news);
-	    news = Create_Simplex (v4, v5, v6, v2);
-	    news->iEnt = ep->mesh.ZonLayer[i];
-	    Tree_Add (THEV->Simplexes, &news);
-	    news = Create_Simplex (v2, v4, v6, v1);
-	    news->iEnt = ep->mesh.ZonLayer[i];
-	    Tree_Add (THEV->Simplexes, &news);
-	  }
-	  if (are_exist (v5, v1, Tree_Ares) &&
-	      are_exist (v5, v3, Tree_Ares) &&
-	      are_exist (v4, v3, Tree_Ares)){
-	    news = Create_Simplex (v1, v2, v3, v5);
-	    news->iEnt = ep->mesh.ZonLayer[i];
-	    Tree_Add (THEV->Simplexes, &news);
-	    news = Create_Simplex (v4, v5, v6, v3);
-	    news->iEnt = ep->mesh.ZonLayer[i];
-	    Tree_Add (THEV->Simplexes, &news);
-	    news = Create_Simplex (v1, v4, v5, v3);
-	    news->iEnt = ep->mesh.ZonLayer[i];
-	    Tree_Add (THEV->Simplexes, &news);
-	  }
-	  if (are_exist (v5, v1, Tree_Ares) &&
-	      are_exist (v5, v3, Tree_Ares) &&
-	      are_exist (v6, v1, Tree_Ares)){
-	    news = Create_Simplex (v1, v2, v3, v5);
-	    news->iEnt = ep->mesh.ZonLayer[i];
-	    Tree_Add (THEV->Simplexes, &news);
-	    news = Create_Simplex (v4, v5, v6, v1);
-	    news->iEnt = ep->mesh.ZonLayer[i];
-	    Tree_Add (THEV->Simplexes, &news);
-	    news = Create_Simplex (v1, v3, v5, v6);
-	    news->iEnt = ep->mesh.ZonLayer[i];
-	    Tree_Add (THEV->Simplexes, &news);
-	  }
-	  if (are_exist (v5, v1, Tree_Ares) &&
-	      are_exist (v2, v6, Tree_Ares) &&
-	      are_exist (v6, v1, Tree_Ares)){
-	    news = Create_Simplex (v1, v2, v3, v6);
-	    news->iEnt = ep->mesh.ZonLayer[i];
-	    Tree_Add (THEV->Simplexes, &news);
-	    news = Create_Simplex (v4, v5, v6, v1);
-	    news->iEnt = ep->mesh.ZonLayer[i];
-	    Tree_Add (THEV->Simplexes, &news);
-	    news = Create_Simplex (v1, v2, v5, v6);
-	    news->iEnt = ep->mesh.ZonLayer[i];
-	    Tree_Add (THEV->Simplexes, &news);
-	  }
-	}
+        if(ep->mesh.Recombine){
+          if(s->V[3]){
+            newh = Create_Hexahedron(v1,v2,v3,v4,v5,v6,v7,v8);
+            newh->iEnt = ep->mesh.ZonLayer[i];
+            Tree_Add(THEV->Hexahedra,&newh);
+          }
+          else{
+            newp = Create_Prism(v1,v2,v3,v4,v5,v6);
+            newp->iEnt = ep->mesh.ZonLayer[i];
+            Tree_Add(THEV->Prisms,&newp);
+          }
+        }
+        else{
+          
+          if (are_exist (v4, v2, Tree_Ares) &&
+              are_exist (v5, v3, Tree_Ares) &&
+              are_exist (v4, v3, Tree_Ares)){
+            news = Create_Simplex (v1, v2, v3, v4);
+            news->iEnt = ep->mesh.ZonLayer[i];
+            Tree_Add (THEV->Simplexes, &news);
+            news = Create_Simplex (v4, v5, v6, v3);
+            news->iEnt = ep->mesh.ZonLayer[i];
+            Tree_Add (THEV->Simplexes, &news);
+            news = Create_Simplex (v2, v4, v5, v3);
+            news->iEnt = ep->mesh.ZonLayer[i];
+            Tree_Add (THEV->Simplexes, &news);
+          }
+          if (are_exist (v4, v2, Tree_Ares) &&
+              are_exist (v2, v6, Tree_Ares) &&
+              are_exist (v4, v3, Tree_Ares)){
+            news = Create_Simplex (v1, v2, v3, v4);
+            news->iEnt = ep->mesh.ZonLayer[i];
+            Tree_Add (THEV->Simplexes, &news);
+            news = Create_Simplex (v4, v5, v6, v2);
+            news->iEnt = ep->mesh.ZonLayer[i];
+            Tree_Add (THEV->Simplexes, &news);
+            news = Create_Simplex (v4, v2, v6, v3);
+            news->iEnt = ep->mesh.ZonLayer[i];
+            Tree_Add (THEV->Simplexes, &news);
+          }
+          if (are_exist (v4, v2, Tree_Ares) &&
+              are_exist (v2, v6, Tree_Ares) &&
+              are_exist (v6, v1, Tree_Ares)){
+            news = Create_Simplex (v1, v2, v3, v6);
+            news->iEnt = ep->mesh.ZonLayer[i];
+            Tree_Add (THEV->Simplexes, &news);
+            news = Create_Simplex (v4, v5, v6, v2);
+            news->iEnt = ep->mesh.ZonLayer[i];
+            Tree_Add (THEV->Simplexes, &news);
+            news = Create_Simplex (v2, v4, v6, v1);
+            news->iEnt = ep->mesh.ZonLayer[i];
+            Tree_Add (THEV->Simplexes, &news);
+          }
+          if (are_exist (v5, v1, Tree_Ares) &&
+              are_exist (v5, v3, Tree_Ares) &&
+              are_exist (v4, v3, Tree_Ares)){
+            news = Create_Simplex (v1, v2, v3, v5);
+            news->iEnt = ep->mesh.ZonLayer[i];
+            Tree_Add (THEV->Simplexes, &news);
+            news = Create_Simplex (v4, v5, v6, v3);
+            news->iEnt = ep->mesh.ZonLayer[i];
+            Tree_Add (THEV->Simplexes, &news);
+            news = Create_Simplex (v1, v4, v5, v3);
+            news->iEnt = ep->mesh.ZonLayer[i];
+            Tree_Add (THEV->Simplexes, &news);
+          }
+          if (are_exist (v5, v1, Tree_Ares) &&
+              are_exist (v5, v3, Tree_Ares) &&
+              are_exist (v6, v1, Tree_Ares)){
+            news = Create_Simplex (v1, v2, v3, v5);
+            news->iEnt = ep->mesh.ZonLayer[i];
+            Tree_Add (THEV->Simplexes, &news);
+            news = Create_Simplex (v4, v5, v6, v1);
+            news->iEnt = ep->mesh.ZonLayer[i];
+            Tree_Add (THEV->Simplexes, &news);
+            news = Create_Simplex (v1, v3, v5, v6);
+            news->iEnt = ep->mesh.ZonLayer[i];
+            Tree_Add (THEV->Simplexes, &news);
+          }
+          if (are_exist (v5, v1, Tree_Ares) &&
+              are_exist (v2, v6, Tree_Ares) &&
+              are_exist (v6, v1, Tree_Ares)){
+            news = Create_Simplex (v1, v2, v3, v6);
+            news->iEnt = ep->mesh.ZonLayer[i];
+            Tree_Add (THEV->Simplexes, &news);
+            news = Create_Simplex (v4, v5, v6, v1);
+            news->iEnt = ep->mesh.ZonLayer[i];
+            Tree_Add (THEV->Simplexes, &news);
+            news = Create_Simplex (v1, v2, v5, v6);
+            news->iEnt = ep->mesh.ZonLayer[i];
+            Tree_Add (THEV->Simplexes, &news);
+          }
+        }
       }
     }
   }
@@ -258,50 +258,50 @@ void Extrude_Simplex_Phase2 (void *data, void *dum){
       List_Read (s->V[2]->Extruded_Points, k + 1, &v6);
       k++;
       if (are_exist (v4, v2, Tree_Ares) &&
-	  are_exist (v5, v3, Tree_Ares) &&
-	  are_exist (v1, v6, Tree_Ares)){
-	TEST_IS_ALL_OK++;
-	if (!are_exist (v4, v2, Tree_Swaps)){
-	  are_del (v4, v2, Tree_Ares);
-	  are_cree (v1, v5, Tree_Ares);
-	  are_cree (v1, v5, Tree_Swaps);
-	  are_cree (v4, v2, Tree_Swaps);
-	}
-	else if (!are_exist (v5, v3, Tree_Swaps)){
-	  are_del (v5, v3, Tree_Ares);
-	  are_cree (v2, v6, Tree_Ares);
-	  are_cree (v5, v3, Tree_Swaps);
-	  are_cree (v2, v6, Tree_Swaps);
-	}
-	else if (!are_exist (v1, v6, Tree_Swaps)){
-	  are_del (v1, v6, Tree_Ares);
-	  are_cree (v4, v3, Tree_Ares);
-	  are_cree (v1, v6, Tree_Swaps);
-	  are_cree (v4, v3, Tree_Swaps);
-	}
+          are_exist (v5, v3, Tree_Ares) &&
+          are_exist (v1, v6, Tree_Ares)){
+        TEST_IS_ALL_OK++;
+        if (!are_exist (v4, v2, Tree_Swaps)){
+          are_del (v4, v2, Tree_Ares);
+          are_cree (v1, v5, Tree_Ares);
+          are_cree (v1, v5, Tree_Swaps);
+          are_cree (v4, v2, Tree_Swaps);
+        }
+        else if (!are_exist (v5, v3, Tree_Swaps)){
+          are_del (v5, v3, Tree_Ares);
+          are_cree (v2, v6, Tree_Ares);
+          are_cree (v5, v3, Tree_Swaps);
+          are_cree (v2, v6, Tree_Swaps);
+        }
+        else if (!are_exist (v1, v6, Tree_Swaps)){
+          are_del (v1, v6, Tree_Ares);
+          are_cree (v4, v3, Tree_Ares);
+          are_cree (v1, v6, Tree_Swaps);
+          are_cree (v4, v3, Tree_Swaps);
+        }
       }
       else if (are_exist (v1, v5, Tree_Ares) && 
-	       are_exist (v2, v6, Tree_Ares) && 
-	       are_exist (v4, v3, Tree_Ares)){
-	TEST_IS_ALL_OK++;
-	if (!are_exist (v1, v5, Tree_Swaps)){
-	  are_del (v1, v5, Tree_Ares);
-	  are_cree (v4, v2, Tree_Ares);
-	  are_cree (v1, v5, Tree_Swaps);
-	  are_cree (v4, v2, Tree_Swaps);
-	}
-	else if (!are_exist (v2, v6, Tree_Swaps)){
-	  are_del (v2, v6, Tree_Ares);
-	  are_cree (v5, v3, Tree_Ares);
-	  are_cree (v5, v3, Tree_Swaps);
-	  are_cree (v2, v6, Tree_Swaps);
-	}
-	else if (!are_exist (v4, v3, Tree_Swaps)){
-	  are_del (v4, v3, Tree_Ares);
-	  are_cree (v1, v6, Tree_Ares);
-	  are_cree (v1, v6, Tree_Swaps);
-	  are_cree (v4, v3, Tree_Swaps);
-	}
+               are_exist (v2, v6, Tree_Ares) && 
+               are_exist (v4, v3, Tree_Ares)){
+        TEST_IS_ALL_OK++;
+        if (!are_exist (v1, v5, Tree_Swaps)){
+          are_del (v1, v5, Tree_Ares);
+          are_cree (v4, v2, Tree_Ares);
+          are_cree (v1, v5, Tree_Swaps);
+          are_cree (v4, v2, Tree_Swaps);
+        }
+        else if (!are_exist (v2, v6, Tree_Swaps)){
+          are_del (v2, v6, Tree_Ares);
+          are_cree (v5, v3, Tree_Ares);
+          are_cree (v5, v3, Tree_Swaps);
+          are_cree (v2, v6, Tree_Swaps);
+        }
+        else if (!are_exist (v4, v3, Tree_Swaps)){
+          are_del (v4, v3, Tree_Ares);
+          are_cree (v1, v6, Tree_Ares);
+          are_cree (v1, v6, Tree_Swaps);
+          are_cree (v4, v3, Tree_Swaps);
+        }
       }
     }
   }
@@ -324,19 +324,19 @@ void Extrude_Vertex (void *data, void *dum){
   for (i = 0; i < ep->mesh.NbLayer; i++){
     for (j = 0; j < ep->mesh.NbElmLayer[i]; j++){
       newv = Create_Vertex (++CurrentNodeNumber, v->Pos.X,
-			    v->Pos.Y, v->Pos.Z, v->lc, v->u);
+                            v->Pos.Y, v->Pos.Z, v->lc, v->u);
       ep->Extrude (i, j + 1, newv->Pos.X, newv->Pos.Y, newv->Pos.Z);
 
       if (Vertex_Bound && (pV = (Vertex **) Tree_PQuery (Vertex_Bound, &newv))){
-	List_Add (v->Extruded_Points, pV);
-	if (ToAdd)
-	  Tree_Insert (ToAdd, pV);
+        List_Add (v->Extruded_Points, pV);
+        if (ToAdd)
+          Tree_Insert (ToAdd, pV);
       }
       else{
-	List_Add (v->Extruded_Points, &newv);
-	Tree_Insert (THEM->Vertices, &newv);
-	if (ToAdd)
-	  Tree_Insert (ToAdd, &newv);
+        List_Add (v->Extruded_Points, &newv);
+        Tree_Insert (THEM->Vertices, &newv);
+        if (ToAdd)
+          Tree_Insert (ToAdd, &newv);
       }
     }
   }
@@ -373,27 +373,27 @@ void Extrude_Seg (Vertex * V1, Vertex * V2){
       List_Read (V1->Extruded_Points, k + 1, &v3);
       List_Read (V2->Extruded_Points, k + 1, &v4);
       if(ep->mesh.Recombine){
-	s = Create_Quadrangle(v1,v2,v4,v3);
-	s->iEnt = THES->Num;
-	Tree_Add(THES->Simplexes,&s);
+        s = Create_Quadrangle(v1,v2,v4,v3);
+        s->iEnt = THES->Num;
+        Tree_Add(THES->Simplexes,&s);
       }
       else{
-	if (are_exist (v3, v2, Tree_Ares)){
-	  s = Create_Simplex (v3, v2, v1, NULL);
-	  s->iEnt = THES->Num;
-	  Tree_Add (THES->Simplexes, &s);
-	  s = Create_Simplex (v3, v4, v2, NULL);
-	  s->iEnt = THES->Num;
-	  Tree_Add (THES->Simplexes, &s);
-	}
-	else{
-	  s = Create_Simplex (v3, v4, v1, NULL);
-	  s->iEnt = THES->Num;
-	  Tree_Add (THES->Simplexes, &s);
-	  s = Create_Simplex (v1, v4, v2, NULL);
-	  s->iEnt = THES->Num;
-	  Tree_Add (THES->Simplexes, &s);
-	}
+        if (are_exist (v3, v2, Tree_Ares)){
+          s = Create_Simplex (v3, v2, v1, NULL);
+          s->iEnt = THES->Num;
+          Tree_Add (THES->Simplexes, &s);
+          s = Create_Simplex (v3, v4, v2, NULL);
+          s->iEnt = THES->Num;
+          Tree_Add (THES->Simplexes, &s);
+        }
+        else{
+          s = Create_Simplex (v3, v4, v1, NULL);
+          s->iEnt = THES->Num;
+          Tree_Add (THES->Simplexes, &s);
+          s = Create_Simplex (v1, v4, v2, NULL);
+          s->iEnt = THES->Num;
+          Tree_Add (THES->Simplexes, &s);
+        }
       }
       k++;
     }
@@ -434,13 +434,13 @@ int Extrude_Mesh (Curve * c){
   if (ep->geo.Mode == EXTRUDED_ENTITY){
     Extrude_Vertex (&c->beg, NULL);
     c->Vertices = List_Create (List_Nbr (c->beg->Extruded_Points),
-			       2, sizeof (Vertex *));
+                               2, sizeof (Vertex *));
     v = &c->beg;
     if ((vexist = (Vertex **) Tree_PQuery (THEM->Vertices, v))){
       (*vexist)->u = c->ubeg;
       Tree_Insert (THEM->Vertices, vexist);
       if ((*vexist)->ListCurves)
-	List_Add ((*vexist)->ListCurves, &c);
+        List_Add ((*vexist)->ListCurves, &c);
       List_Add (c->Vertices, vexist);
     }
     else{
@@ -454,7 +454,7 @@ int Extrude_Mesh (Curve * c){
     for (i = 1; i < List_Nbr (c->beg->Extruded_Points) - 1; i++){
       List_Read (c->beg->Extruded_Points, i, &v1);
       if (!v1->ListCurves)
-	v1->ListCurves = List_Create (1, 1, sizeof (Curve *));
+        v1->ListCurves = List_Create (1, 1, sizeof (Curve *));
       List_Add (v1->ListCurves, &c);
       Tree_Insert (THEM->Vertices, &v1);
       v1->u = (double) i / (double) List_Nbr (c->beg->Extruded_Points);
@@ -465,7 +465,7 @@ int Extrude_Mesh (Curve * c){
       (*vexist)->u = c->ubeg;
       Tree_Insert (THEM->Vertices, vexist);
       if ((*vexist)->ListCurves)
-	List_Add ((*vexist)->ListCurves, &c);
+        List_Add ((*vexist)->ListCurves, &c);
       List_Add (c->Vertices, vexist);
     }
     else{
@@ -491,9 +491,9 @@ void copy_mesh (Surface * from, Surface * to){
     List_Read (list, i, &s);
     v = s->V[0];
     v1 = Create_Vertex (++CurrentNodeNumber, v->Pos.X,
-			v->Pos.Y, v->Pos.Z, v->lc, v->u);
+                        v->Pos.Y, v->Pos.Z, v->lc, v->u);
     ep->Extrude (ep->mesh.NbLayer - 1, ep->mesh.NbElmLayer[ep->mesh.NbLayer - 1],
-		 v1->Pos.X, v1->Pos.Y, v1->Pos.Z);
+                 v1->Pos.X, v1->Pos.Y, v1->Pos.Z);
     
     if (Vertex_Bound && (pV = (Vertex **) Tree_PQuery (Vertex_Bound, &v1)))
       v1 = *pV;
@@ -506,9 +506,9 @@ void copy_mesh (Surface * from, Surface * to){
     
     v = s->V[1];
     v2 = Create_Vertex (++CurrentNodeNumber, v->Pos.X,
-			v->Pos.Y, v->Pos.Z, v->lc, v->u);
+                        v->Pos.Y, v->Pos.Z, v->lc, v->u);
     ep->Extrude (ep->mesh.NbLayer - 1, ep->mesh.NbElmLayer[ep->mesh.NbLayer - 1],
-		 v2->Pos.X, v2->Pos.Y, v2->Pos.Z);
+                 v2->Pos.X, v2->Pos.Y, v2->Pos.Z);
     
     if (Vertex_Bound && (pV = (Vertex **) Tree_PQuery (Vertex_Bound, &v2)))
       v2 = *pV;
@@ -521,9 +521,9 @@ void copy_mesh (Surface * from, Surface * to){
     
     v = s->V[2];
     v3 = Create_Vertex (++CurrentNodeNumber, v->Pos.X,
-			v->Pos.Y, v->Pos.Z, v->lc, v->u);
+                        v->Pos.Y, v->Pos.Z, v->lc, v->u);
     ep->Extrude (ep->mesh.NbLayer - 1, ep->mesh.NbElmLayer[ep->mesh.NbLayer - 1],
-		 v3->Pos.X, v3->Pos.Y, v3->Pos.Z);
+                 v3->Pos.X, v3->Pos.Y, v3->Pos.Z);
     
     if (Vertex_Bound && (pV = (Vertex **) Tree_PQuery (Vertex_Bound, &v3)))
       v3 = *pV;
@@ -611,8 +611,8 @@ int Extrude_Mesh (Volume * v){
       List_Read (v->Surfaces, i, &ss);
       list = Tree2List (ss->Vertices);
       for (int j = 0; j < List_Nbr (list); j++){
-	List_Read (list, j, &v1);
-	Tree_Add (Vertex_Bound, &v1);
+        List_Read (list, j, &v1);
+        Tree_Add (Vertex_Bound, &v1);
       }
       List_Delete (list);
     }
@@ -627,11 +627,11 @@ int Extrude_Mesh (Volume * v){
     if(!ep->mesh.Recombine){
       j = TEST_IS_ALL_OK;
       do{
-	TEST_IS_ALL_OK = 0;
-	Extrude_Surface2 (s);
-	if (TEST_IS_ALL_OK == j)
-	  break;
-	j = TEST_IS_ALL_OK;
+        TEST_IS_ALL_OK = 0;
+        Extrude_Surface2 (s);
+        if (TEST_IS_ALL_OK == j)
+          break;
+        j = TEST_IS_ALL_OK;
       }
       while (TEST_IS_ALL_OK);
     }
diff --git a/Mesh/3D_Mesh.cpp b/Mesh/3D_Mesh.cpp
index 461917ad7f..e52d942bd7 100644
--- a/Mesh/3D_Mesh.cpp
+++ b/Mesh/3D_Mesh.cpp
@@ -1,4 +1,4 @@
-/* $Id: 3D_Mesh.cpp,v 1.6 2000-11-25 15:26:11 geuzaine Exp $ */
+/* $Id: 3D_Mesh.cpp,v 1.7 2000-11-26 15:43:46 geuzaine Exp $ */
 /*
  
   J-F Remacle 1995
@@ -25,8 +25,7 @@
 
 extern Mesh       *THEM, *LOCAL;
 extern Context_T   CTX;
-extern int         TYPBGMESH, CurrentNodeNumber, FACE_DIMENSION;
-extern double      LC;
+extern int         CurrentNodeNumber, FACE_DIMENSION;
 
 static Tree_T *Tsd, *Sim_Sur_Le_Bord, *POINTS_TREE;
 static List_T *Simplexes_Destroyed, *Simplexes_New, *Suppress;
@@ -34,7 +33,7 @@ static List_T *LLL, *POINTS;
 static Simplex *THES;
 static Vertex *THEV;
 static Tree_T *SimXFac;
-static double volume;
+static double volume, LC3D;
 static int ZONEELIMINEE, Methode = 0;
 
 Simplex  MyNewBoundary;
@@ -44,15 +43,15 @@ void DebugSimplexe (Simplex * s){
   int i;
 
   fprintf (stderr, "Simplexe %p = %d %d %d %d \n",
-	   s, s->V[0]->Num, s->V[1]->Num, s->V[2]->Num, s->V[3]->Num);
+           s, s->V[0]->Num, s->V[1]->Num, s->V[2]->Num, s->V[3]->Num);
 
   for (i = 0; i < 4; i++){
     if (s->S[i] != &MyNewBoundary)
       printf (" face : %d %d %d -> Simplexe %p\n",
-	      s->F[i].V[0]->Num, s->F[i].V[1]->Num, s->F[i].V[2]->Num, s->S[i]);
+              s->F[i].V[0]->Num, s->F[i].V[1]->Num, s->F[i].V[2]->Num, s->S[i]);
     else
       printf (" face : %d %d %d -> Simplexe Boundary\n",
-	      s->F[i].V[0]->Num, s->F[i].V[1]->Num, s->F[i].V[2]->Num);
+              s->F[i].V[0]->Num, s->F[i].V[1]->Num, s->F[i].V[2]->Num);
   }
 }
 
@@ -96,9 +95,9 @@ double Interpole_lcTetraedre (Simplex * s, Vertex * v){
   }
 
   return (s->V[0]->lc * (1. - sol[0] - sol[1] - sol[2]) +
-	  sol[0] * s->V[1]->lc +
-	  sol[1] * s->V[2]->lc +
-	  sol[2] * s->V[3]->lc);
+          sol[0] * s->V[1]->lc +
+          sol[1] * s->V[2]->lc +
+          sol[2] * s->V[3]->lc);
 }
 
 Vertex *NewVertex (Simplex * s){
@@ -111,7 +110,7 @@ Vertex *NewVertex (Simplex * s){
 }
 
 int Pt_In_Volume (double X, double Y, double Z, Mesh * m,
-		  double *l, double tol){
+                  double *l, double tol){
   int i;
   Vertex V;
   double uvw[3];
@@ -136,9 +135,9 @@ int Pt_In_Volume (double X, double Y, double Z, Mesh * m,
     List_Read (B.pT, i, &s);
     if (s->Pt_In_Simplexe (&V, uvw, tol)){
       *l = (1. - uvw[0] - uvw[1] - uvw[2]) * s->V[0]->lc
-	+ uvw[0] * s->V[1]->lc
-	+ uvw[1] * s->V[2]->lc
-	+ uvw[2] * s->V[3]->lc;
+        + uvw[0] * s->V[1]->lc
+        + uvw[1] * s->V[2]->lc
+        + uvw[2] * s->V[3]->lc;
       return (1);
     }
   }
@@ -153,8 +152,8 @@ int Pt_In_Circum (Simplex * s, Vertex * v){
 
   d1 = s->Radius;
   d2 = sqrt (DSQR (v->Pos.X - s->Center.X) +
-	     DSQR (v->Pos.Y - s->Center.Y) +
-	     DSQR (v->Pos.Z - s->Center.Z));
+             DSQR (v->Pos.Y - s->Center.Y) +
+             DSQR (v->Pos.Z - s->Center.Z));
 
   eps = fabs (d1 - d2) / (d1 + d2);
   
@@ -248,19 +247,19 @@ void Box_6_Tetraedron (List_T * P, Mesh * m){
 
   int i, j;
   static int pts[8][3] = { {0, 0, 0},
-			   {1, 0, 0},
-			   {1, 1, 0},
-			   {0, 1, 0},
-			   {0, 0, 1},
-			   {1, 0, 1},
-			   {1, 1, 1},
-			   {0, 1, 1}};
+                           {1, 0, 0},
+                           {1, 1, 0},
+                           {0, 1, 0},
+                           {0, 0, 1},
+                           {1, 0, 1},
+                           {1, 1, 1},
+                           {0, 1, 1}};
   static int tet[6][4] = { {1, 5, 2, 4},
-			   {2, 5, 6, 4},
-			   {4, 5, 6, 8},
-			   {6, 4, 8, 7},
-			   {6, 4, 7, 3},
-			   {2, 3, 4, 6}};
+                           {2, 5, 6, 4},
+                           {4, 5, 6, 8},
+                           {6, 4, 8, 7},
+                           {6, 4, 7, 3},
+                           {2, 3, 4, 6}};
   double Xm, Ym, Zm, XM, YM, ZM, Xc, Yc, Zc;
   Simplex *S, *ps;
   Vertex *V, *v, *pv;
@@ -311,9 +310,7 @@ void Box_6_Tetraedron (List_T * P, Mesh * m){
 
   /* Longueur Caracteristique */
 
-  /* GEUZ SUPPRIME
-  LC = sqrt (Xc * Xc + Yc * Yc + Zc * Zc);
-  */
+  LC3D = sqrt (Xc * Xc + Yc * Yc + Zc * Zc);
 
   /* Points de la boite de 1 a 8 
 
@@ -358,7 +355,7 @@ void Box_6_Tetraedron (List_T * P, Mesh * m){
 
   for (i = 0; i < 6; i++){
     S = Create_Simplex (&V[tet[i][0] - 1], &V[tet[i][1] - 1], 
-			&V[tet[i][2] - 1], &V[tet[i][3] - 1]);
+                        &V[tet[i][2] - 1], &V[tet[i][3] - 1]);
     List_Add (smp, &S);
   }
   
@@ -367,7 +364,7 @@ void Box_6_Tetraedron (List_T * P, Mesh * m){
     List_Read (smp, i, &ps);
     for (j = 0; j < 4; j++)
       if (ps->S[j] == NULL)
-	ps->S[j] = &MyNewBoundary;
+        ps->S[j] = &MyNewBoundary;
     Tree_Replace (m->Simplexes, &ps);
   }
   
@@ -419,18 +416,18 @@ void NewSimplexes (Mesh * m, List_T * Sim, List_T * news){
       ZONEELIMINEE = S->iEnt;
     else {
       if (S->iEnt != ZONEELIMINEE){
-	Msg(WARNING, "Huh! The Elimination Failed %d %d",
-	    S->iEnt, ZONEELIMINEE);
+        Msg(WARNING, "Huh! The Elimination Failed %d %d",
+            S->iEnt, ZONEELIMINEE);
       }
     }
     for (j = 0; j < 4; j++){
       SXF.F = S->F[j];
       if ((pSXF = (SxF *) Tree_PQuery (SimXFac, &SXF))){
-	(pSXF->NumFaceSimpl)++;
+        (pSXF->NumFaceSimpl)++;
       }
       else{
-	SXF.NumFaceSimpl = 1;
-	Tree_Add (SimXFac, &SXF);
+        SXF.NumFaceSimpl = 1;
+        Tree_Add (SimXFac, &SXF);
       }
     }
   }
@@ -455,13 +452,13 @@ int recur_bowyer (Simplex * s){
   for (i = 0; i < 4; i++){
     if (s->S[i] && s->S[i] != &MyNewBoundary && !Tree_Query (Tsd, &s->S[i])){
       if (Pt_In_Circum (s->S[i], THEV) && (s->iEnt == s->S[i]->iEnt)){
-	recur_bowyer (s->S[i]);
+        recur_bowyer (s->S[i]);
       }
       else{
-	if (s->iEnt != s->S[i]->iEnt){
-	  Alerte_Point_Scabreux = 1;
-	}
-	Tree_Insert (Sim_Sur_Le_Bord, &s->S[i]);
+        if (s->iEnt != s->S[i]->iEnt){
+          Alerte_Point_Scabreux = 1;
+        }
+        Tree_Insert (Sim_Sur_Le_Bord, &s->S[i]);
       }
     }
   }
@@ -552,7 +549,7 @@ bool Bowyer_Watson (Mesh * m, Vertex * v, Simplex * S, int force){
     for (i = 0; i < List_Nbr (Simplexes_Destroyed); i++){
       List_Read (Simplexes_Destroyed, i, &s);
       if (!Tree_Suppress (m->Simplexes, &s))
-	Msg(ERROR, "Impossible to Delete Simplex");
+        Msg(ERROR, "Impossible to Delete Simplex");
       Free (s);
     }
     
@@ -578,7 +575,7 @@ void Convex_Hull_Mesh (List_T * Points, Mesh * m){
   N = List_Nbr (Points);
   n = IMAX (N / 20, 1);
 
-  Msg(INFO, "Meshing 3D... (Initial)");
+  Msg(INFO, "Mesh 3D... (Initial)");
 
   Box_6_Tetraedron (Points, m);
   // List_Sort (Points, comparePosition);
@@ -589,7 +586,7 @@ void Convex_Hull_Mesh (List_T * Points, Mesh * m){
 
     if (Simplexes_New)
       for (j = 0; j < List_Nbr (Simplexes_New); j++){
-	Action_First_Simplexes (List_Pointer (Simplexes_New, j), NULL);
+        Action_First_Simplexes (List_Pointer (Simplexes_New, j), NULL);
       }
     
     if (!THES){
@@ -602,24 +599,24 @@ void Convex_Hull_Mesh (List_T * Points, Mesh * m){
     if (i % n == n - 1){
       volume = 0.0;
       Tree_Action (m->Simplexes, VSIM);
-      Msg(INFO, "Nod=%d/%d Elm=%d", i+1,N,Tree_Nbr(m->Simplexes)); 
-      Msg(STATUS, "Vol=%g",volume); 
+      Msg(STATUS, "Nod=%d/%d Elm=%d", i+1,N,Tree_Nbr(m->Simplexes)); 
+      Msg(SELECT, "Vol=%g",volume); 
     }
     if (!THES){
       Msg(WARNING, "Vertex (%g,%g,%g) in no Simplex",
-	  THEV->Pos.X,THEV->Pos.Y,THEV->Pos.Z); 
-      THEV->Pos.X += 10 * RAND_LONG;
-      THEV->Pos.Y += 10 * RAND_LONG;
-      THEV->Pos.Z += 10 * RAND_LONG;
+          THEV->Pos.X,THEV->Pos.Y,THEV->Pos.Z); 
+      THEV->Pos.X += CTX.mesh.rand_factor * LC3D * rand()/RAND_MAX;
+      THEV->Pos.Y += CTX.mesh.rand_factor * LC3D * rand()/RAND_MAX;
+      THEV->Pos.Z += CTX.mesh.rand_factor * LC3D * rand()/RAND_MAX;
       Tree_Action (m->Simplexes, Action_First_Simplexes);
     }
     bool  ca_marche = Bowyer_Watson (m, THEV, THES, 1);
     int count = 0;
     while(!ca_marche){
       count ++;
-      double dx = rand_sign() * 10.*RAND_LONG;
-      double dy = rand_sign() * 10.*RAND_LONG;
-      double dz = rand_sign() * 10.*RAND_LONG;
+      double dx = rand_sign() * CTX.mesh.rand_factor * LC3D * rand()/RAND_MAX;
+      double dy = rand_sign() * CTX.mesh.rand_factor * LC3D * rand()/RAND_MAX;
+      double dz = rand_sign() * CTX.mesh.rand_factor * LC3D * rand()/RAND_MAX;
       THEV->Pos.X += dx;
       THEV->Pos.Y += dy;
       THEV->Pos.Z += dz;
@@ -628,13 +625,13 @@ void Convex_Hull_Mesh (List_T * Points, Mesh * m){
       ca_marche = Bowyer_Watson (m, THEV, THES, 1);
       THEV->Pos.X -= dx;
       THEV->Pos.Y -= dy;
-      THEV->Pos.Z -= dz;	  
+      THEV->Pos.Z -= dz;          
       if(count > 5){
-	N++;
-	List_Add(POINTS,&THEV);
-	Msg(WARNING, "Unable to Add Point %d (Will do it Later)",
-	    THEV->Num);
-	break;
+        N++;
+        List_Add(POINTS,&THEV);
+        Msg(WARNING, "Unable to Add Point %d (Will do it Later)",
+            THEV->Num);
+        break;
       }
     }
   }
@@ -711,8 +708,6 @@ void Maillage_Volume (void *data, void *dum){
 
   FACE_DIMENSION = 2;
 
-  Msg(INFO, "Nod=0 Elm=0"); 
-
   pv = (Volume **) data;
   v = *pv;
 
@@ -723,9 +718,11 @@ void Maillage_Volume (void *data, void *dum){
     MeshTransfiniteVolume (v);
   }
   else if (v->Typ == 99999){
+    Msg(STATUS, "Nod=0 Elm=0"); 
+
     LOCAL = &M;
+    Create_BgMesh (THEM->BGM.Typ, .2, LOCAL);
     s = &S;
-    Create_BgMesh (TYPBGMESH, .2, LOCAL);
     
     POINTS_TREE = Tree_Create (sizeof (Vertex *), comparePosition);
     POINTS = List_Create (100, 100, sizeof (Vertex *));
@@ -784,7 +781,7 @@ void Maillage_Volume (void *data, void *dum){
     Bgm_With_Points (THEM, LOCAL);
     POINTS_TREE = THEM->Simplexes;
     
-    Msg(INFO, "Meshing 3D... (Final)");
+    Msg(INFO, "Mesh 3D... (Final)");
 
     Tree_Right (LOCAL->Simplexes, &simp);
     i = 0;
@@ -794,34 +791,34 @@ void Maillage_Volume (void *data, void *dum){
       //double l;
       //while(!Pt_In_Volume(newv->Pos.X,newv->Pos.Y,newv->Pos.Z,LOCAL,&l,0.0)){
       
-      while (!simp->Pt_In_Simplexe (newv, uvw, 1.e-5) &&		 
-	     (simp->S[0] == &MyNewBoundary ||
-	      !simp->S[0]->Pt_In_Simplexe (newv, uvw, 1.e-5)) &&
-	     (simp->S[1] == &MyNewBoundary ||
-	      !simp->S[1]->Pt_In_Simplexe (newv, uvw, 1.e-5)) &&
-	     (simp->S[2] == &MyNewBoundary ||
-	      !simp->S[2]->Pt_In_Simplexe (newv, uvw, 1.e-5)) &&
-	     (simp->S[3] == &MyNewBoundary ||
-	      !simp->S[3]->Pt_In_Simplexe (newv, uvw, 1.e-5))) {
-	Tree_Suppress (LOCAL->Simplexes, &simp);
-	simp->Quality = 0.1;
-	Tree_Insert (LOCAL->Simplexes, &simp);
-	Tree_Right (LOCAL->Simplexes, &simp);
-	if (simp->Quality < CONV_VALUE)
-	  break;
-	newv = NewVertex (simp);
+      while (!simp->Pt_In_Simplexe (newv, uvw, 1.e-5) &&                 
+             (simp->S[0] == &MyNewBoundary ||
+              !simp->S[0]->Pt_In_Simplexe (newv, uvw, 1.e-5)) &&
+             (simp->S[1] == &MyNewBoundary ||
+              !simp->S[1]->Pt_In_Simplexe (newv, uvw, 1.e-5)) &&
+             (simp->S[2] == &MyNewBoundary ||
+              !simp->S[2]->Pt_In_Simplexe (newv, uvw, 1.e-5)) &&
+             (simp->S[3] == &MyNewBoundary ||
+              !simp->S[3]->Pt_In_Simplexe (newv, uvw, 1.e-5))) {
+        Tree_Suppress (LOCAL->Simplexes, &simp);
+        simp->Quality = 0.1;
+        Tree_Insert (LOCAL->Simplexes, &simp);
+        Tree_Right (LOCAL->Simplexes, &simp);
+        if (simp->Quality < CONV_VALUE)
+          break;
+        newv = NewVertex (simp);
       }
       if (simp->Quality < CONV_VALUE)
-	break;
+        break;
       i++;
       if (i % n == n - 1){
-	volume = 0.0;
-	Tree_Action (LOCAL->Simplexes, VSIM);
-	Msg(STATUS, "Nod=%d Elm=%d",
-	    Tree_Nbr (LOCAL->Vertices), Tree_Nbr (LOCAL->Simplexes));
-	Msg(SELECT, "Vol(%g) Conv(%g->%g)", volume, simp->Quality, CONV_VALUE);
-	double adv = 100. * (CONV_VALUE / simp->Quality);
-	Progress ((int) adv);
+        volume = 0.0;
+        Tree_Action (LOCAL->Simplexes, VSIM);
+        Msg(STATUS, "Nod=%d Elm=%d",
+            Tree_Nbr (LOCAL->Vertices), Tree_Nbr (LOCAL->Simplexes));
+        Msg(SELECT, "Vol(%g) Conv(%g->%g)", volume, simp->Quality, CONV_VALUE);
+        double adv = 100. * (CONV_VALUE / simp->Quality);
+        Progress ((int) adv);
       }
       Bowyer_Watson (LOCAL, newv, simp, 0);
       Tree_Right (LOCAL->Simplexes, &simp);
@@ -844,7 +841,7 @@ void Maillage_Volume (void *data, void *dum){
       tnxe = Tree_Create (sizeof (NXE), compareNXE);
       create_NXE (v->Vertices, v->Simplexes, tnxe);
       for (int i = 0; i < CTX.mesh.nb_smoothing; i++)
-	Tree_Action (tnxe, ActionLiss);
+        Tree_Action (tnxe, ActionLiss);
       Tree_Delete (tnxe);
       Msg(STATUS, "Swapping Edges (last pass)");
       SwapEdges3D (THEM, v, 0.5, true);
@@ -855,8 +852,10 @@ void Maillage_Volume (void *data, void *dum){
       Degre2 (THEM->Vertices, THEM->VertexEdges, v->Simplexes, NULL, NULL);
   }
 
-  THEM->Statistics[6] += Tree_Nbr (v->Vertices);
-  THEM->Statistics[9] += Tree_Nbr (v->Simplexes);
+  THEM->Statistics[6] += Tree_Nbr(v->Vertices);
+  THEM->Statistics[9] += Tree_Nbr(v->Simplexes);
+  THEM->Statistics[10] += Tree_Nbr(v->Hexahedra);
+  THEM->Statistics[11] += Tree_Nbr(v->Prisms);
 
   Gamma_Maillage (v, &THEM->Statistics[17], &THEM->Statistics[18], &THEM->Statistics[19]);
   Eta_Maillage (v, &THEM->Statistics[20], &THEM->Statistics[21], &THEM->Statistics[22]);
diff --git a/Mesh/3D_Mesh.h b/Mesh/3D_Mesh.h
index 821750c896..72c08559b8 100644
--- a/Mesh/3D_Mesh.h
+++ b/Mesh/3D_Mesh.h
@@ -1,4 +1,4 @@
-/* $Id: 3D_Mesh.h,v 1.2 2000-11-23 14:11:35 geuzaine Exp $ */
+/* $Id: 3D_Mesh.h,v 1.3 2000-11-26 15:43:46 geuzaine Exp $ */
 #ifndef _3D_MESH_H_
 #define _3D_MESH_H_
 
@@ -9,12 +9,12 @@ void Gamma_Maillage (Volume * v, double *gamma, double *gammamax, double *gammam
 void Eta_Maillage (Volume * v, double *gamma, double *gammamax, double *gammamin);
 void R_Maillage (Volume * v, double *gamma, double *gammamax, double *gammamin);
 int Pt_In_Volume (double X, double Y, double Z, Mesh * m,
-		  double *l, double tol);
+                  double *l, double tol);
 void findminmax (void *a, void *b);
 void getminmax (double *xmin, double *ymin, double *zmin,
-		double *xmax, double *ymax, double *zmax);
+                double *xmax, double *ymax, double *zmax);
 void cut_tetraedre (Intersection * pI, Tree_T * AddedTet, Tree_T * TetDel,
-		    Tree_T * newpoints);
+                    Tree_T * newpoints);
 void Impression_Resultats (void);
 void Restore_Volume (Volume * v);
 void Remise_A_Zero (void);
diff --git a/Mesh/3D_SMesh.cpp b/Mesh/3D_SMesh.cpp
index aa84b62b50..c37de00148 100644
--- a/Mesh/3D_SMesh.cpp
+++ b/Mesh/3D_SMesh.cpp
@@ -1,4 +1,4 @@
-/* $Id: 3D_SMesh.cpp,v 1.4 2000-11-24 08:04:14 geuzaine Exp $ */
+/* $Id: 3D_SMesh.cpp,v 1.5 2000-11-26 15:43:46 geuzaine Exp $ */
 /*  
   Maillage transfini volumique
 
@@ -14,7 +14,7 @@
  v w  s0       s1    a9   s1 s5                           *-------*     
   \|                 a10  s2 s6                  v w    s3/s0     s1    
    *--u              a11  s3 s7                   \|                 
-					           *--u              
+                                                   *--u              
 
 
   Remarque : La definition d'un volume prismatique doit se faire dans l'ordre
@@ -58,27 +58,27 @@ void index_uv (int flag, Vertex * ver, double *u, double *v){
 }
 
 #define CREATE_HEX Create_Hexahedron(list[(i)   + N1*(j)   + N1*N2*(k)],   \
-				     list[(i+1) + N1*(j)   + N1*N2*(k)],   \
-				     list[(i+1) + N1*(j+1) + N1*N2*(k)],   \
-				     list[(i)   + N1*(j+1) + N1*N2*(k)],   \
-				     list[(i)   + N1*(j)   + N1*N2*(k+1)], \
-				     list[(i+1) + N1*(j)   + N1*N2*(k+1)], \
-				     list[(i+1) + N1*(j+1) + N1*N2*(k+1)], \
-				     list[(i)   + N1*(j+1) + N1*N2*(k+1)])
+                                     list[(i+1) + N1*(j)   + N1*N2*(k)],   \
+                                     list[(i+1) + N1*(j+1) + N1*N2*(k)],   \
+                                     list[(i)   + N1*(j+1) + N1*N2*(k)],   \
+                                     list[(i)   + N1*(j)   + N1*N2*(k+1)], \
+                                     list[(i+1) + N1*(j)   + N1*N2*(k+1)], \
+                                     list[(i+1) + N1*(j+1) + N1*N2*(k+1)], \
+                                     list[(i)   + N1*(j+1) + N1*N2*(k+1)])
 
 #define CREATE_PRISM_1 Create_Prism(list[(i)   + N1*(j)   + N1*N2*(k)],   \
-				    list[(i+1) + N1*(j)   + N1*N2*(k)],   \
-				    list[(i)   + N1*(j+1) + N1*N2*(k)],   \
-				    list[(i)   + N1*(j)   + N1*N2*(k+1)], \
-				    list[(i+1) + N1*(j)   + N1*N2*(k+1)], \
-				    list[(i)   + N1*(j+1) + N1*N2*(k+1)])
+                                    list[(i+1) + N1*(j)   + N1*N2*(k)],   \
+                                    list[(i)   + N1*(j+1) + N1*N2*(k)],   \
+                                    list[(i)   + N1*(j)   + N1*N2*(k+1)], \
+                                    list[(i+1) + N1*(j)   + N1*N2*(k+1)], \
+                                    list[(i)   + N1*(j+1) + N1*N2*(k+1)])
 
 #define CREATE_PRISM_2 Create_Prism(list[(i+1) + N1*(j+1) + N1*N2*(k)],   \
-				    list[(i)   + N1*(j+1) + N1*N2*(k)],   \
-				    list[(i+1) + N1*(j)   + N1*N2*(k)],   \
-				    list[(i+1) + N1*(j+1) + N1*N2*(k+1)], \
-				    list[(i)   + N1*(j+1) + N1*N2*(k+1)], \
-				    list[(i+1) + N1*(j)   + N1*N2*(k+1)])
+                                    list[(i)   + N1*(j+1) + N1*N2*(k)],   \
+                                    list[(i+1) + N1*(j)   + N1*N2*(k)],   \
+                                    list[(i+1) + N1*(j+1) + N1*N2*(k+1)], \
+                                    list[(i)   + N1*(j+1) + N1*N2*(k+1)], \
+                                    list[(i+1) + N1*(j)   + N1*N2*(k+1)])
 
 #define CREATE_SIM_1 Create_Simplex(list[(i)   + N1*(j)   + N1*N2*(k)],   \
                                     list[(i+1) + N1*(j)   + N1*N2*(k)],   \
@@ -126,7 +126,7 @@ int MeshTransfiniteVolume (Volume *vol) {
 
   static int tab1hex[] = {0,1,5,4, 1,2,6,5, 3,2,6,7, 0,3,7,4, 0,1,2,3, 4,5,6,7};
   static int tab2[] = {0,1,2,3, 1,2,3,0, 2,3,0,1, 3,0,1,2, 
-		       3,2,1,0, 2,1,0,3, 1,0,3,2, 0,3,2,1};
+                       3,2,1,0, 2,1,0,3, 1,0,3,2, 0,3,2,1};
 
   if (vol->Method != TRANSFINI) return(0);
   
@@ -143,7 +143,7 @@ int MeshTransfiniteVolume (Volume *vol) {
     pV = &V;
     if((vexist = (Vertex**)Tree_PQuery(THEM->Vertices,&pV)) == NULL) {
       Msg(WARNING, "Unknown Control Point %d in Transfinite Volume %d",
-	  V.Num,vol->Num); 
+          V.Num,vol->Num); 
       return(0);
     }
     else{
@@ -176,12 +176,12 @@ int MeshTransfiniteVolume (Volume *vol) {
       V.Num = GG[i]->ipar[j];
       pV = &V;
       if((vexist = (Vertex**)Tree_PQuery(THEM->Vertices,&pV)) == NULL) {
-	Msg(WARNING, "Unknown Control Point %d in Transfinite Surface %d",
-	    V.Num,GG[i]->Num); 
-	return(0);
+        Msg(WARNING, "Unknown Control Point %d in Transfinite Surface %d",
+            V.Num,GG[i]->Num); 
+        return(0);
       }
       else{
-	CP[j]=*vexist;
+        CP[j]=*vexist;
       }
     }       
 
@@ -189,57 +189,57 @@ int MeshTransfiniteVolume (Volume *vol) {
 
     for(flag=0;flag<8;flag++){
       for(k=0;k<6;k++){
-	if(S[tab1hex[4*k  ]]->Num == CP[tab2[4*flag  ]]->Num && 
-	   S[tab1hex[4*k+1]]->Num == CP[tab2[4*flag+1]]->Num &&
-	   S[tab1hex[4*k+2]]->Num == CP[tab2[4*flag+2]]->Num &&
-	   S[tab1hex[4*k+3]]->Num == CP[tab2[4*flag+3]]->Num ){
-	  G[k]=GG[i];
-	  F_flag[k]=flag;
-	  NbFacesFound++;
-	  /*
-	  printf("TR3D: (k=%d) face trouvee %d (flag = %d) : nodes %d %d %d %d \n", 
-		 k,GG[i]->Num, flag, 
-		 S[tab1hex[4*k  ]]->Num, 
-		 S[tab1hex[4*k+1]]->Num,
-		 S[tab1hex[4*k+2]]->Num,
-		 S[tab1hex[4*k+3]]->Num);
-	  */
-	}
+        if(S[tab1hex[4*k  ]]->Num == CP[tab2[4*flag  ]]->Num && 
+           S[tab1hex[4*k+1]]->Num == CP[tab2[4*flag+1]]->Num &&
+           S[tab1hex[4*k+2]]->Num == CP[tab2[4*flag+2]]->Num &&
+           S[tab1hex[4*k+3]]->Num == CP[tab2[4*flag+3]]->Num ){
+          G[k]=GG[i];
+          F_flag[k]=flag;
+          NbFacesFound++;
+          /*
+          printf("TR3D: (k=%d) face trouvee %d (flag = %d) : nodes %d %d %d %d \n", 
+                 k,GG[i]->Num, flag, 
+                 S[tab1hex[4*k  ]]->Num, 
+                 S[tab1hex[4*k+1]]->Num,
+                 S[tab1hex[4*k+2]]->Num,
+                 S[tab1hex[4*k+3]]->Num);
+          */
+        }
       }
     }
   }
 
   if(nbs == 6 && NbFacesFound != 6) {
     Msg(WARNING, "Wrong Definition of Hexahedric Transfinite Volume %d", 
-	vol->Num); 
+        vol->Num); 
     return(0);
   }
 
   if(nbs == 5 && NbFacesFound != 5) {
     Msg(WARNING,  "Wrong Definition of Prismatic Transfinite Volume %d\n"
-	WARNING_NIL "Possibly because the first and fourth points are not the\n"
-	WARNING_NIL "degenerated ones", vol->Num); 
+        WARNING_NIL "Possibly because the first and fourth points are not the\n"
+        WARNING_NIL "degenerated ones", vol->Num); 
     return(0);
   }
 
   if(nbs == 6){
     for(i=0;i<6;i++){
       if(G[i] == NULL) {
-	Msg(WARNING, "Wrong Definition of Hexahedric Transfinite Volume %d",
-	    vol->Num); 
-	return(0);
+        Msg(WARNING, "Wrong Definition of Hexahedric Transfinite Volume %d",
+            vol->Num); 
+        return(0);
       }
     }
   }
   else if(nbs == 5){
     for(i=0;i<6;i++){
       if(i != 3) {
-	if(G[i] == NULL) {
-	  Msg(WARNING,  "Wrong Definition of Prismatic Transfinite Volume %d\n"
-	      WARNING_NIL "Possibly because the first and fourth points are not the\n"
-	      WARNING_NIL "degenerated ones", vol->Num); 
-	  return(0);
-	}
+        if(G[i] == NULL) {
+          Msg(WARNING,  "Wrong Definition of Prismatic Transfinite Volume %d\n"
+              WARNING_NIL "Possibly because the first and fourth points are not the\n"
+              WARNING_NIL "degenerated ones", vol->Num); 
+          return(0);
+        }
       }
     }
   }
@@ -275,54 +275,54 @@ int MeshTransfiniteVolume (Volume *vol) {
 
       for(k=0;k<N3;k++){
 
-	List_Read(G[0]->TrsfVertices, index2d(F_flag[0],N1,N3, 0,    k), &C[8]);
-	List_Read(G[0]->TrsfVertices, index2d(F_flag[0],N1,N3, N1-1, k), &C[9]);
-	List_Read(G[2]->TrsfVertices, index2d(F_flag[2],N1,N3, N1-1, k), &C[10]);
-	List_Read(G[2]->TrsfVertices, index2d(F_flag[2],N1,N3, 0,    k), &C[11]);
-
-	List_Read(G[0]->TrsfVertices, index2d(F_flag[0],N1,N3, i, k), &F[0]);
-	List_Read(G[1]->TrsfVertices, index2d(F_flag[1],N2,N3, j, k), &F[1]);
-	List_Read(G[2]->TrsfVertices, index2d(F_flag[2],N1,N3, i, k), &F[2]);
-	if(nbs==6)
-	  List_Read(G[3]->TrsfVertices, index2d(F_flag[3],N2,N3, j, k), &F[3]);
-	else if(nbs == 5)
-	  F[3]=C[8];
-
-	index_uv(F_flag[0],F[0],&dum,&w);
-	
-	if(i && j && k && i != N1-1 && j != N2-1 && k != N3-1){	
-	  V = TransfiniteHex(*F[0],*F[1],*F[2],*F[3],*F[4],*F[5],
-			     *C[0],*C[1],*C[2],*C[3],*C[4],*C[5],
-			     *C[6],*C[7],*C[8],*C[9],*C[10],*C[11],
-			     *S[0],*S[1],*S[2],*S[3],*S[4],*S[5],*S[6],*S[7],
-			     u,v,w);
-	  list[i+N1*j+N1*N2*k] = Create_Vertex(++CurrentNodeNumber,
-					       V.Pos.X,V.Pos.Y,V.Pos.Z,V.lc,0.0);
-	  /*
-	    printf(" NEW node : %f %f %f\n", list[i+N1*j+N1*N2*k]->Pos.X, 
-		   list[i+N1*j+N1*N2*k]->Pos.Y, list[i+N1*j+N1*N2*k]->Pos.Z);
-	  */
-	}
-
-	else if(!i){
-	  list[i+N1*j+N1*N2*k] = F[3];
-	}
-	else if(!j){
-	  list[i+N1*j+N1*N2*k] = F[0];
-	}
-	else if(!k){
-	  list[i+N1*j+N1*N2*k] = F[4];
-	}
-	else if(i == N1-1){
-	  list[i+N1*j+N1*N2*k] = F[1];
-	}
-	else if(j == N2-1){
-	  list[i+N1*j+N1*N2*k] = F[2];
-	}
-	else if(k == N3-1){
-	  list[i+N1*j+N1*N2*k] = F[5];
-	}
-	
+        List_Read(G[0]->TrsfVertices, index2d(F_flag[0],N1,N3, 0,    k), &C[8]);
+        List_Read(G[0]->TrsfVertices, index2d(F_flag[0],N1,N3, N1-1, k), &C[9]);
+        List_Read(G[2]->TrsfVertices, index2d(F_flag[2],N1,N3, N1-1, k), &C[10]);
+        List_Read(G[2]->TrsfVertices, index2d(F_flag[2],N1,N3, 0,    k), &C[11]);
+
+        List_Read(G[0]->TrsfVertices, index2d(F_flag[0],N1,N3, i, k), &F[0]);
+        List_Read(G[1]->TrsfVertices, index2d(F_flag[1],N2,N3, j, k), &F[1]);
+        List_Read(G[2]->TrsfVertices, index2d(F_flag[2],N1,N3, i, k), &F[2]);
+        if(nbs==6)
+          List_Read(G[3]->TrsfVertices, index2d(F_flag[3],N2,N3, j, k), &F[3]);
+        else if(nbs == 5)
+          F[3]=C[8];
+
+        index_uv(F_flag[0],F[0],&dum,&w);
+        
+        if(i && j && k && i != N1-1 && j != N2-1 && k != N3-1){ 
+          V = TransfiniteHex(*F[0],*F[1],*F[2],*F[3],*F[4],*F[5],
+                             *C[0],*C[1],*C[2],*C[3],*C[4],*C[5],
+                             *C[6],*C[7],*C[8],*C[9],*C[10],*C[11],
+                             *S[0],*S[1],*S[2],*S[3],*S[4],*S[5],*S[6],*S[7],
+                             u,v,w);
+          list[i+N1*j+N1*N2*k] = Create_Vertex(++CurrentNodeNumber,
+                                               V.Pos.X,V.Pos.Y,V.Pos.Z,V.lc,0.0);
+          /*
+            printf(" NEW node : %f %f %f\n", list[i+N1*j+N1*N2*k]->Pos.X, 
+                   list[i+N1*j+N1*N2*k]->Pos.Y, list[i+N1*j+N1*N2*k]->Pos.Z);
+          */
+        }
+
+        else if(!i){
+          list[i+N1*j+N1*N2*k] = F[3];
+        }
+        else if(!j){
+          list[i+N1*j+N1*N2*k] = F[0];
+        }
+        else if(!k){
+          list[i+N1*j+N1*N2*k] = F[4];
+        }
+        else if(i == N1-1){
+          list[i+N1*j+N1*N2*k] = F[1];
+        }
+        else if(j == N2-1){
+          list[i+N1*j+N1*N2*k] = F[2];
+        }
+        else if(k == N3-1){
+          list[i+N1*j+N1*N2*k] = F[5];
+        }
+        
       }
     }
   }
@@ -330,8 +330,8 @@ int MeshTransfiniteVolume (Volume *vol) {
   for(i=0;i<N1;i++){
     for(j=0;j<N2;j++){
       for(k=0;k<N3;k++){
-	Tree_Replace(THEM->Vertices,&list[i+N1*j+N1*N2*k]);
-	Tree_Replace(vol->Vertices,&list[i+N1*j+N1*N2*k]);
+        Tree_Replace(THEM->Vertices,&list[i+N1*j+N1*N2*k]);
+        Tree_Replace(vol->Vertices,&list[i+N1*j+N1*N2*k]);
       }
     }
   }      
@@ -339,176 +339,171 @@ int MeshTransfiniteVolume (Volume *vol) {
   if(nbs == 6){      
     for(i=0;i<N1-1;i++){
       for(j=0;j<N2-1;j++){
-	for(k=0;k<N3-1;k++){
-	  if(G[0]->Recombine && G[1]->Recombine && G[2]->Recombine && 
-	     G[3]->Recombine && G[4]->Recombine && G[5]->Recombine) {
-	    hexa = CREATE_HEX; hexa->iEnt = vol->Num; Tree_Replace(vol->Hexahedra,&hexa);
-
-	    nbhex++;
-	  }
-	  else if (!G[0]->Recombine && G[1]->Recombine && !G[2]->Recombine && 
-		   G[3]->Recombine && G[4]->Recombine && G[5]->Recombine) {
-	    prism = Create_Prism(list[(i)   + N1*(j)   + N1*N2*(k)],
-				 list[(i+1) + N1*(j)   + N1*N2*(k)],
-				 list[(i)   + N1*(j)   + N1*N2*(k+1)],
-				 list[(i)   + N1*(j+1) + N1*N2*(k)],
-				 list[(i+1) + N1*(j+1) + N1*N2*(k)],
-				 list[(i)   + N1*(j+1) + N1*N2*(k+1)]);
-	    prism->iEnt = vol->Num;
-	    Tree_Replace(vol->Prisms,&prism);
-
-	    prism = Create_Prism(list[(i+1) + N1*(j)   + N1*N2*(k+1)],
-				 list[(i)   + N1*(j)   + N1*N2*(k+1)],
-				 list[(i+1) + N1*(j)   + N1*N2*(k)],
-				 list[(i+1) + N1*(j+1) + N1*N2*(k+1)],
-				 list[(i)   + N1*(j+1) + N1*N2*(k+1)],
-				 list[(i+1) + N1*(j+1) + N1*N2*(k)]);
-	    prism->iEnt = vol->Num;
-	    Tree_Replace(vol->Prisms,&prism);
-
-	    nbpri +=2 ;
-	  }
-	  else if (G[0]->Recombine && !G[1]->Recombine && G[2]->Recombine && 
-		   !G[3]->Recombine && G[4]->Recombine && G[5]->Recombine) {
-	    prism = Create_Prism(list[(i+1) + N1*(j)   + N1*N2*(k)],
-				 list[(i+1) + N1*(j+1) + N1*N2*(k)],
-				 list[(i+1) + N1*(j)   + N1*N2*(k+1)],
-				 list[(i)   + N1*(j)   + N1*N2*(k)],
-				 list[(i)   + N1*(j+1) + N1*N2*(k)],
-				 list[(i)   + N1*(j)   + N1*N2*(k+1)]);
-	    prism->iEnt = vol->Num;
-	    Tree_Replace(vol->Prisms,&prism);
-
-	    prism = Create_Prism(list[(i+1) + N1*(j+1) + N1*N2*(k+1)],
-				 list[(i+1) + N1*(j)   + N1*N2*(k+1)],
-				 list[(i+1) + N1*(j+1) + N1*N2*(k)],
-				 list[(i)   + N1*(j+1) + N1*N2*(k+1)],
-				 list[(i)   + N1*(j)   + N1*N2*(k+1)],
-				 list[(i)   + N1*(j+1) + N1*N2*(k)]);
-	    prism->iEnt = vol->Num;
-	    Tree_Replace(vol->Prisms,&prism);
-
-	    nbpri += 2 ;
-	  }
-	  else if (G[0]->Recombine && G[1]->Recombine && G[2]->Recombine && 
-		   G[3]->Recombine && !G[4]->Recombine && !G[5]->Recombine) {
-	    prism = CREATE_PRISM_1; prism->iEnt = vol->Num; Tree_Replace(vol->Prisms,&prism);
-	    prism = CREATE_PRISM_2; prism->iEnt = vol->Num; Tree_Replace(vol->Prisms,&prism);
-
-	    nbpri += 2;
-	  }
-	  else if (!G[0]->Recombine && !G[1]->Recombine && !G[2]->Recombine && 
-		   !G[3]->Recombine && !G[4]->Recombine && !G[5]->Recombine) {
-	    simp = CREATE_SIM_1; simp->iEnt = vol->Num; Tree_Replace(vol->Simplexes,&simp);
-	    simp = CREATE_SIM_2; simp->iEnt = vol->Num; Tree_Replace(vol->Simplexes,&simp);
-	    simp = CREATE_SIM_3; simp->iEnt = vol->Num; Tree_Replace(vol->Simplexes,&simp);
-	    simp = CREATE_SIM_4; simp->iEnt = vol->Num; Tree_Replace(vol->Simplexes,&simp);
-	    simp = CREATE_SIM_5; simp->iEnt = vol->Num; Tree_Replace(vol->Simplexes,&simp);
-	    simp = CREATE_SIM_6; simp->iEnt = vol->Num; Tree_Replace(vol->Simplexes,&simp);
-
-	    nbtet += 6;
-	  }
-	  else{
-	    Msg(WARNING, "Wrong Surface Recombining in Transfinite Volume %d", 
-		vol->Num); 
-	    return(0);
-	  }
-	}
+        for(k=0;k<N3-1;k++){
+          if(G[0]->Recombine && G[1]->Recombine && G[2]->Recombine && 
+             G[3]->Recombine && G[4]->Recombine && G[5]->Recombine) {
+            hexa = CREATE_HEX; hexa->iEnt = vol->Num; Tree_Replace(vol->Hexahedra,&hexa);
+
+            nbhex++;
+          }
+          else if (!G[0]->Recombine && G[1]->Recombine && !G[2]->Recombine && 
+                   G[3]->Recombine && G[4]->Recombine && G[5]->Recombine) {
+            prism = Create_Prism(list[(i)   + N1*(j)   + N1*N2*(k)],
+                                 list[(i+1) + N1*(j)   + N1*N2*(k)],
+                                 list[(i)   + N1*(j)   + N1*N2*(k+1)],
+                                 list[(i)   + N1*(j+1) + N1*N2*(k)],
+                                 list[(i+1) + N1*(j+1) + N1*N2*(k)],
+                                 list[(i)   + N1*(j+1) + N1*N2*(k+1)]);
+            prism->iEnt = vol->Num;
+            Tree_Replace(vol->Prisms,&prism);
+
+            prism = Create_Prism(list[(i+1) + N1*(j)   + N1*N2*(k+1)],
+                                 list[(i)   + N1*(j)   + N1*N2*(k+1)],
+                                 list[(i+1) + N1*(j)   + N1*N2*(k)],
+                                 list[(i+1) + N1*(j+1) + N1*N2*(k+1)],
+                                 list[(i)   + N1*(j+1) + N1*N2*(k+1)],
+                                 list[(i+1) + N1*(j+1) + N1*N2*(k)]);
+            prism->iEnt = vol->Num;
+            Tree_Replace(vol->Prisms,&prism);
+
+            nbpri +=2 ;
+          }
+          else if (G[0]->Recombine && !G[1]->Recombine && G[2]->Recombine && 
+                   !G[3]->Recombine && G[4]->Recombine && G[5]->Recombine) {
+            prism = Create_Prism(list[(i+1) + N1*(j)   + N1*N2*(k)],
+                                 list[(i+1) + N1*(j+1) + N1*N2*(k)],
+                                 list[(i+1) + N1*(j)   + N1*N2*(k+1)],
+                                 list[(i)   + N1*(j)   + N1*N2*(k)],
+                                 list[(i)   + N1*(j+1) + N1*N2*(k)],
+                                 list[(i)   + N1*(j)   + N1*N2*(k+1)]);
+            prism->iEnt = vol->Num;
+            Tree_Replace(vol->Prisms,&prism);
+
+            prism = Create_Prism(list[(i+1) + N1*(j+1) + N1*N2*(k+1)],
+                                 list[(i+1) + N1*(j)   + N1*N2*(k+1)],
+                                 list[(i+1) + N1*(j+1) + N1*N2*(k)],
+                                 list[(i)   + N1*(j+1) + N1*N2*(k+1)],
+                                 list[(i)   + N1*(j)   + N1*N2*(k+1)],
+                                 list[(i)   + N1*(j+1) + N1*N2*(k)]);
+            prism->iEnt = vol->Num;
+            Tree_Replace(vol->Prisms,&prism);
+
+            nbpri += 2 ;
+          }
+          else if (G[0]->Recombine && G[1]->Recombine && G[2]->Recombine && 
+                   G[3]->Recombine && !G[4]->Recombine && !G[5]->Recombine) {
+            prism = CREATE_PRISM_1; prism->iEnt = vol->Num; Tree_Replace(vol->Prisms,&prism);
+            prism = CREATE_PRISM_2; prism->iEnt = vol->Num; Tree_Replace(vol->Prisms,&prism);
+
+            nbpri += 2;
+          }
+          else if (!G[0]->Recombine && !G[1]->Recombine && !G[2]->Recombine && 
+                   !G[3]->Recombine && !G[4]->Recombine && !G[5]->Recombine) {
+            simp = CREATE_SIM_1; simp->iEnt = vol->Num; Tree_Replace(vol->Simplexes,&simp);
+            simp = CREATE_SIM_2; simp->iEnt = vol->Num; Tree_Replace(vol->Simplexes,&simp);
+            simp = CREATE_SIM_3; simp->iEnt = vol->Num; Tree_Replace(vol->Simplexes,&simp);
+            simp = CREATE_SIM_4; simp->iEnt = vol->Num; Tree_Replace(vol->Simplexes,&simp);
+            simp = CREATE_SIM_5; simp->iEnt = vol->Num; Tree_Replace(vol->Simplexes,&simp);
+            simp = CREATE_SIM_6; simp->iEnt = vol->Num; Tree_Replace(vol->Simplexes,&simp);
+
+            nbtet += 6;
+          }
+          else{
+            Msg(WARNING, "Wrong Surface Recombining in Transfinite Volume %d", 
+                vol->Num); 
+            return(0);
+          }
+        }
       }
     }                  
   }
   else if (nbs == 5){
     for(j=0;j<N2-1;j++){
-      for(k=0;k<N3-1;k++){	
-	if( ( G[0]->Recombine && G[1]->Recombine && G[2]->Recombine &&
-	      G[4]->Recombine && G[5]->Recombine) ||
-	    ( G[0]->Recombine && G[1]->Recombine && G[2]->Recombine &&
-	      !G[4]->Recombine && !G[5]->Recombine) ){	  
-	  prism = Create_Prism(list[    N1*(j)   + N1*N2*(k)],
-			       list[1 + N1*(j)   + N1*N2*(k)],
-			       list[1 + N1*(j+1) + N1*N2*(k)],
-			       list[    N1*(j)   + N1*N2*(k+1)],
-			       list[1 + N1*(j)   + N1*N2*(k+1)],
-			       list[1 + N1*(j+1) + N1*N2*(k+1)]);
-	  prism->iEnt = vol->Num;
-	  Tree_Replace(vol->Prisms,&prism);
-	  
-	  nbpri++;
-	}
-	else if(!G[0]->Recombine && !G[1]->Recombine && !G[2]->Recombine &&
-		!G[4]->Recombine && !G[5]->Recombine){
-	  simp = Create_Simplex(list[  + N1*(j)   + N1*N2*(k)],
-				list[1 + N1*(j)   + N1*N2*(k)],
-				list[1 + N1*(j+1) + N1*N2*(k)],
-				list[  + N1*(j)   + N1*N2*(k+1)]);
-	  simp->iEnt = vol->Num;
-	  Tree_Replace(vol->Simplexes,&simp);
-	  
-	  simp = Create_Simplex(list[1 + N1*(j)   + N1*N2*(k)],
-				list[1 + N1*(j+1) + N1*N2*(k)],
-				list[  + N1*(j)   + N1*N2*(k+1)],
-				list[1 + N1*(j)   + N1*N2*(k+1)]);
-	  simp->iEnt = vol->Num;
-	  Tree_Replace(vol->Simplexes,&simp);
-	  
-	  simp = Create_Simplex(list[  + N1*(j)   + N1*N2*(k+1)],
-				list[1 + N1*(j+1) + N1*N2*(k+1)],
-				list[1 + N1*(j)   + N1*N2*(k+1)],
-				list[1 + N1*(j+1) + N1*N2*(k)]);
-	  simp->iEnt = vol->Num;
-	  Tree_Replace(vol->Simplexes,&simp);
-	  
-	  nbtet += 2;
-	}
-	else{
-	  Msg(WARNING, "Wrong Surface Recombining in Transfinite Volume %d", 
-	      vol->Num); 
-	  return(0);	  	  
-	}
+      for(k=0;k<N3-1;k++){      
+        if( ( G[0]->Recombine && G[1]->Recombine && G[2]->Recombine &&
+              G[4]->Recombine && G[5]->Recombine) ||
+            ( G[0]->Recombine && G[1]->Recombine && G[2]->Recombine &&
+              !G[4]->Recombine && !G[5]->Recombine) ){    
+          prism = Create_Prism(list[    N1*(j)   + N1*N2*(k)],
+                               list[1 + N1*(j)   + N1*N2*(k)],
+                               list[1 + N1*(j+1) + N1*N2*(k)],
+                               list[    N1*(j)   + N1*N2*(k+1)],
+                               list[1 + N1*(j)   + N1*N2*(k+1)],
+                               list[1 + N1*(j+1) + N1*N2*(k+1)]);
+          prism->iEnt = vol->Num;
+          Tree_Replace(vol->Prisms,&prism);
+          
+          nbpri++;
+        }
+        else if(!G[0]->Recombine && !G[1]->Recombine && !G[2]->Recombine &&
+                !G[4]->Recombine && !G[5]->Recombine){
+          simp = Create_Simplex(list[  + N1*(j)   + N1*N2*(k)],
+                                list[1 + N1*(j)   + N1*N2*(k)],
+                                list[1 + N1*(j+1) + N1*N2*(k)],
+                                list[  + N1*(j)   + N1*N2*(k+1)]);
+          simp->iEnt = vol->Num;
+          Tree_Replace(vol->Simplexes,&simp);
+          
+          simp = Create_Simplex(list[1 + N1*(j)   + N1*N2*(k)],
+                                list[1 + N1*(j+1) + N1*N2*(k)],
+                                list[  + N1*(j)   + N1*N2*(k+1)],
+                                list[1 + N1*(j)   + N1*N2*(k+1)]);
+          simp->iEnt = vol->Num;
+          Tree_Replace(vol->Simplexes,&simp);
+          
+          simp = Create_Simplex(list[  + N1*(j)   + N1*N2*(k+1)],
+                                list[1 + N1*(j+1) + N1*N2*(k+1)],
+                                list[1 + N1*(j)   + N1*N2*(k+1)],
+                                list[1 + N1*(j+1) + N1*N2*(k)]);
+          simp->iEnt = vol->Num;
+          Tree_Replace(vol->Simplexes,&simp);
+          
+          nbtet += 2;
+        }
+        else{
+          Msg(WARNING, "Wrong Surface Recombining in Transfinite Volume %d", 
+              vol->Num); 
+          return(0);              
+        }
       }
     }
     for(i=1;i<N1-1;i++){
       for(j=0;j<N2-1;j++){
-	for(k=0;k<N3-1;k++){
-	  if(G[0]->Recombine && G[1]->Recombine && G[2]->Recombine &&
-	     G[4]->Recombine && G[5]->Recombine){
-	    hexa = CREATE_HEX; hexa->iEnt = vol->Num; Tree_Replace(vol->Hexahedra,&hexa);
-
-	    nbhex ++;
-	  }
-	  else if(G[0]->Recombine && G[1]->Recombine && G[2]->Recombine &&
-		  !G[4]->Recombine && !G[5]->Recombine){
-	    prism = CREATE_PRISM_1; prism->iEnt = vol->Num; Tree_Replace(vol->Prisms,&prism);
-	    prism = CREATE_PRISM_2; prism->iEnt = vol->Num; Tree_Replace(vol->Prisms,&prism);
-
-	    nbpri += 2;
-	  }
-	  else if(!G[0]->Recombine && !G[1]->Recombine && !G[2]->Recombine &&
-		  !G[4]->Recombine && !G[5]->Recombine){
-	    simp = CREATE_SIM_1; simp->iEnt = vol->Num; Tree_Replace(vol->Simplexes,&simp);
-	    simp = CREATE_SIM_2; simp->iEnt = vol->Num; Tree_Replace(vol->Simplexes,&simp);
-	    simp = CREATE_SIM_3; simp->iEnt = vol->Num; Tree_Replace(vol->Simplexes,&simp);
-	    simp = CREATE_SIM_4; simp->iEnt = vol->Num; Tree_Replace(vol->Simplexes,&simp);
-	    simp = CREATE_SIM_5; simp->iEnt = vol->Num; Tree_Replace(vol->Simplexes,&simp);
-	    simp = CREATE_SIM_6; simp->iEnt = vol->Num; Tree_Replace(vol->Simplexes,&simp);
-
-	    nbtet += 6;
-	  }
-	  else{
-	    Msg(WARNING, "Wrong Surface Recombining in Transfinite Volume %d", 
-		vol->Num); 
-	    return(0);
-	  }
-	}
+        for(k=0;k<N3-1;k++){
+          if(G[0]->Recombine && G[1]->Recombine && G[2]->Recombine &&
+             G[4]->Recombine && G[5]->Recombine){
+            hexa = CREATE_HEX; hexa->iEnt = vol->Num; Tree_Replace(vol->Hexahedra,&hexa);
+
+            nbhex ++;
+          }
+          else if(G[0]->Recombine && G[1]->Recombine && G[2]->Recombine &&
+                  !G[4]->Recombine && !G[5]->Recombine){
+            prism = CREATE_PRISM_1; prism->iEnt = vol->Num; Tree_Replace(vol->Prisms,&prism);
+            prism = CREATE_PRISM_2; prism->iEnt = vol->Num; Tree_Replace(vol->Prisms,&prism);
+
+            nbpri += 2;
+          }
+          else if(!G[0]->Recombine && !G[1]->Recombine && !G[2]->Recombine &&
+                  !G[4]->Recombine && !G[5]->Recombine){
+            simp = CREATE_SIM_1; simp->iEnt = vol->Num; Tree_Replace(vol->Simplexes,&simp);
+            simp = CREATE_SIM_2; simp->iEnt = vol->Num; Tree_Replace(vol->Simplexes,&simp);
+            simp = CREATE_SIM_3; simp->iEnt = vol->Num; Tree_Replace(vol->Simplexes,&simp);
+            simp = CREATE_SIM_4; simp->iEnt = vol->Num; Tree_Replace(vol->Simplexes,&simp);
+            simp = CREATE_SIM_5; simp->iEnt = vol->Num; Tree_Replace(vol->Simplexes,&simp);
+            simp = CREATE_SIM_6; simp->iEnt = vol->Num; Tree_Replace(vol->Simplexes,&simp);
+
+            nbtet += 6;
+          }
+          else{
+            Msg(WARNING, "Wrong Surface Recombining in Transfinite Volume %d", 
+                vol->Num); 
+            return(0);
+          }
+        }
       }
     }
   }
 
-  THEM->Statistics[6] += Tree_Nbr(vol->Vertices);
-  THEM->Statistics[9] += nbtet;
-  THEM->Statistics[10] += nbhex;
-  THEM->Statistics[11] += nbpri;
-
   return(1);
 
 }
diff --git a/Mesh/Create.cpp b/Mesh/Create.cpp
index 5b1219755a..3abd94c805 100644
--- a/Mesh/Create.cpp
+++ b/Mesh/Create.cpp
@@ -1,4 +1,4 @@
-/* $Id: Create.cpp,v 1.5 2000-11-23 23:20:35 geuzaine Exp $ */
+/* $Id: Create.cpp,v 1.6 2000-11-26 15:43:47 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "Const.h"
@@ -116,7 +116,7 @@ int compareSxF (const void *a, const void *b){
 }
 
 Attractor * Create_Attractor (int Num, double lc1, double lc2, double Radius,
-			      Vertex * v, Curve * c, Surface * s){
+                              Vertex * v, Curve * c, Surface * s){
   Attractor *pA;
 
   pA = (Attractor *) Malloc (sizeof (Attractor));
@@ -190,21 +190,21 @@ void End_Curve (Curve * c){
       v[4] = NULL;
     
     if (Curve->Typ == MSH_SEGM_CIRC_INV ||
-	Curve->Typ == MSH_SEGM_ELLI_INV){
+        Curve->Typ == MSH_SEGM_ELLI_INV){
       List_Read (Curve->Control_Points, 0, &v[3]);
       List_Read (Curve->Control_Points, 1, &v[2]);
       if (!v[4])
-	List_Read (Curve->Control_Points, 2, &v[1]);
+        List_Read (Curve->Control_Points, 2, &v[1]);
       else
-	List_Read (Curve->Control_Points, 3, &v[1]);
+        List_Read (Curve->Control_Points, 3, &v[1]);
     }
     else{
       List_Read (Curve->Control_Points, 0, &v[1]);
       List_Read (Curve->Control_Points, 1, &v[2]);
       if (!v[4])
-	List_Read (Curve->Control_Points, 2, &v[3]);
+        List_Read (Curve->Control_Points, 2, &v[3]);
       else
-	List_Read (Curve->Control_Points, 3, &v[3]);
+        List_Read (Curve->Control_Points, 3, &v[3]);
     }
     
     direction (v[2], v[3], dir32);
@@ -264,15 +264,15 @@ void End_Curve (Curve * c){
     
     if(FLAG_OLD_CIRCLE){
       if(n[0] == 0.0 && n[1] == 0.0){
-	mat[2][0] = Curve->Circle.invmat[0][2] = 0;
-	mat[2][1] = Curve->Circle.invmat[1][2] = 0;
-	mat[2][2] = Curve->Circle.invmat[2][2] = 1;
-	mat[1][0] = Curve->Circle.invmat[0][1] = 0;
-	mat[1][1] = Curve->Circle.invmat[1][1] = 1;
-	mat[1][2] = Curve->Circle.invmat[2][1] = 0;
-	mat[0][0] = Curve->Circle.invmat[0][0] = 1;
-	mat[0][1] = Curve->Circle.invmat[1][0] = 0;
-	mat[0][2] = Curve->Circle.invmat[2][0] = 0;
+        mat[2][0] = Curve->Circle.invmat[0][2] = 0;
+        mat[2][1] = Curve->Circle.invmat[1][2] = 0;
+        mat[2][2] = Curve->Circle.invmat[2][2] = 1;
+        mat[1][0] = Curve->Circle.invmat[0][1] = 0;
+        mat[1][1] = Curve->Circle.invmat[1][1] = 1;
+        mat[1][2] = Curve->Circle.invmat[2][1] = 0;
+        mat[0][0] = Curve->Circle.invmat[0][0] = 1;
+        mat[0][1] = Curve->Circle.invmat[1][0] = 0;
+        mat[0][2] = Curve->Circle.invmat[2][0] = 0;
       }
     }
 
@@ -311,23 +311,23 @@ void End_Curve (Curve * c){
       rhs[1] = v1.Pos.Y;
       det = sys[0][0] * sys[1][1] - sys[1][0] * sys[0][1];
       if (det < 1.e-12){
-	AX = (A3 - A4);
-	sys[0][0] = cos (AX) * cos (A4);
-	sys[0][1] = -sin (AX) * sin (A4);
-	sys[1][0] = cos (AX) * sin (A4);
-	sys[1][1] = sin (AX) * cos (A4);
-	rhs[0] = v3.Pos.X;
-	rhs[1] = v3.Pos.Y;
-	det = sys[0][0] * sys[1][1] - sys[1][0] * sys[0][1];
+        AX = (A3 - A4);
+        sys[0][0] = cos (AX) * cos (A4);
+        sys[0][1] = -sin (AX) * sin (A4);
+        sys[1][0] = cos (AX) * sin (A4);
+        sys[1][1] = sin (AX) * cos (A4);
+        rhs[0] = v3.Pos.X;
+        rhs[1] = v3.Pos.Y;
+        det = sys[0][0] * sys[1][1] - sys[1][0] * sys[0][1];
       }
       if (det < 1.e-12){
-	f1 = DMAX (R, R2);
-	f2 = DMIN (R, R2);
+        f1 = DMAX (R, R2);
+        f2 = DMIN (R, R2);
       }
       else{
-	sys2x2 (sys, rhs, sol);
-	f1 = sol[0];
-	f2 = sol[1];
+        sys2x2 (sys, rhs, sol);
+        f1 = sol[0];
+        f2 = sol[1];
       }
     }
     else{
@@ -347,12 +347,12 @@ void End_Curve (Curve * c){
     if (!c->Circle.done){
       float proj[4][4];
       for (i = 0; i < 4; i++){
-	for (int j = 0; j < 4; j++){
-	  if (i != 3 && j != 3)
-	    proj[i][j] = Curve->Circle.f1 * Curve->Circle.invmat[i][j];
-	  else
-	    proj[i][j] = 0.0;
-	}
+        for (int j = 0; j < 4; j++){
+          if (i != 3 && j != 3)
+            proj[i][j] = Curve->Circle.f1 * Curve->Circle.invmat[i][j];
+          else
+            proj[i][j] = 0.0;
+        }
       }
       proj[0][3] = Curve->Circle.v[2]->Pos.X;
       proj[1][3] = Curve->Circle.v[2]->Pos.Y;
@@ -399,23 +399,23 @@ void End_Surface (Surface * s){
 
 
 Curve *Create_Curve (int Num, int Typ, int Order, List_T * Liste,
-		     List_T * Knots, int p1, int p2, double u1, double u2){
+                     List_T * Knots, int p1, int p2, double u1, double u2){
   Curve *pC;
   Vertex *v;
   int i, j, iPnt;
   double d;
   double matcr[4][4] = { {-0.5, 1.5, -1.5, 0.5},
-			 {1.0, -2.5, 2.0, -0.5},
-			 {-0.5, 0.0, 0.5, 0.0},
-			 {0.0, 1.0, 0.0, 0.0} };
+                         {1.0, -2.5, 2.0, -0.5},
+                         {-0.5, 0.0, 0.5, 0.0},
+                         {0.0, 1.0, 0.0, 0.0} };
   double matbs[4][4] = { {-1.0, 3, -3, 1},
-			 {3, -6, 3.0, 0},
-			 {-3, 0.0, 3, 0.0},
-			 {1, 4, 1, 0.0} };
+                         {3, -6, 3.0, 0},
+                         {-3, 0.0, 3, 0.0},
+                         {1, 4, 1, 0.0} };
   double matbez[4][4] = { {-1.0, 3, -3, 1},
-			  {3, -6, 3.0, 0},
-			  {-3, 3.0, 0, 0.0},
-			  {1, 0, 0, 0.0} };
+                          {3, -6, 3.0, 0},
+                          {-3, 3.0, 0, 0.0},
+                          {1, 0, 0, 0.0} };
 
   pC = (Curve *) Malloc (sizeof (Curve));
   pC->Vertices = NULL;
@@ -433,18 +433,18 @@ Curve *Create_Curve (int Num, int Typ, int Order, List_T * Liste,
   if (Typ == MSH_SEGM_SPLN){
     for (i = 0; i < 4; i++)
       for (j = 0; j < 4; j++)
-	pC->mat[i][j] = matcr[i][j];
+        pC->mat[i][j] = matcr[i][j];
     
   }
   else if (Typ == MSH_SEGM_BSPLN){
     for (i = 0; i < 4; i++)
       for (j = 0; j < 4; j++)
-	pC->mat[i][j] = matbs[i][j] / 6.0;
+        pC->mat[i][j] = matbs[i][j] / 6.0;
   }
   else if (Typ == MSH_SEGM_BEZIER){
     for (i = 0; i < 4; i++)
       for (j = 0; j < 4; j++)
-	pC->mat[i][j] = matbez[i][j];
+        pC->mat[i][j] = matbez[i][j];
   }
 
   pC->ubeg = u1;
@@ -470,9 +470,9 @@ Curve *Create_Curve (int Num, int Typ, int Order, List_T * Liste,
     for (j = 0; j < List_Nbr (Liste); j++){
       List_Read (Liste, j, &iPnt);
       if ((v = FindVertex (iPnt, THEM)))
-	List_Add (pC->Control_Points, &v);
+        List_Add (pC->Control_Points, &v);
       else
-	Msg(FATAL, "Unknown Control Point %d in Curve %d", iPnt, pC->Num);
+        Msg(FATAL, "Unknown Control Point %d in Curve %d", iPnt, pC->Num);
     }
   }
   else {
@@ -549,7 +549,7 @@ Volume * Create_Volume (int Num, int Typ, int Mat){
 
 
 Hexahedron * Create_Hexahedron (Vertex * v1, Vertex * v2, Vertex * v3, Vertex * v4,
-				Vertex * v5, Vertex * v6, Vertex * v7, Vertex * v8){
+                                Vertex * v5, Vertex * v6, Vertex * v7, Vertex * v8){
   Hexahedron *h;
 
   h = (Hexahedron *) Malloc (sizeof (Hexahedron));
@@ -569,7 +569,7 @@ Hexahedron * Create_Hexahedron (Vertex * v1, Vertex * v2, Vertex * v3, Vertex *
 }
 
 Prism * Create_Prism (Vertex * v1, Vertex * v2, Vertex * v3,
-		      Vertex * v4, Vertex * v5, Vertex * v6){
+                      Vertex * v4, Vertex * v5, Vertex * v6){
   Prism *p;
 
   p = (Prism *) Malloc (sizeof (Prism));
diff --git a/Mesh/Create.h b/Mesh/Create.h
index 6ad23b5738..4b2f87c6ab 100644
--- a/Mesh/Create.h
+++ b/Mesh/Create.h
@@ -1,4 +1,4 @@
-/* $Id: Create.h,v 1.2 2000-11-23 14:11:35 geuzaine Exp $ */
+/* $Id: Create.h,v 1.3 2000-11-26 15:43:47 geuzaine Exp $ */
 #ifndef _CREATE_H_
 #define _CREATE_H_
 
@@ -16,7 +16,7 @@ int compareVolume (const void *a, const void *b);
 int compareSxF (const void *a, const void *b);
 
 Attractor * Create_Attractor (int Num, double lc1, double lc2, double Radius,
-			      Vertex * v, Curve * c, Surface * s);
+                              Vertex * v, Curve * c, Surface * s);
 void Add_SurfaceLoop (int Num, List_T * intlist, Mesh * M);
 void Add_PhysicalGroup (int Num, int typ, List_T * intlist, Mesh * M);
 void Add_EdgeLoop (int Num, List_T * intlist, Mesh * M);
@@ -25,12 +25,12 @@ void End_Curve (Curve * c);
 void End_Surface (Surface * s);
 
 Curve *Create_Curve (int Num, int Typ, int Order, List_T * Liste,
-		     List_T * Knots, int p1, int p2, double u1, double u2);
+                     List_T * Knots, int p1, int p2, double u1, double u2);
 Surface * Create_Surface (int Num, int Typ, int Mat);
 Volume * Create_Volume (int Num, int Typ, int Mat);
 Hexahedron * Create_Hexahedron (Vertex * v1, Vertex * v2, Vertex * v3, Vertex * v4,
-			      Vertex * v5, Vertex * v6, Vertex * v7, Vertex * v8);
+                              Vertex * v5, Vertex * v6, Vertex * v7, Vertex * v8);
 Prism * Create_Prism (Vertex * v1, Vertex * v2, Vertex * v3,
-		      Vertex * v4, Vertex * v5, Vertex * v6);
+                      Vertex * v4, Vertex * v5, Vertex * v6);
 
 #endif
diff --git a/Mesh/CrossData.cpp b/Mesh/CrossData.cpp
index dd1f104380..f831c73c2e 100644
--- a/Mesh/CrossData.cpp
+++ b/Mesh/CrossData.cpp
@@ -1,4 +1,4 @@
-/* $Id: CrossData.cpp,v 1.2 2000-11-23 14:11:35 geuzaine Exp $ */
+/* $Id: CrossData.cpp,v 1.3 2000-11-26 15:43:47 geuzaine Exp $ */
 
 
 #include "Gmsh.h"
@@ -17,19 +17,19 @@ void AddTable (void *data, void *dummy){
     if (s->V[i]){
       nxe.v = s->V[i];
       if ((pnxe = (NXE *) Tree_PQuery (TreeTemp, &nxe))){
-	List_Add (pnxe->Liste, &s);
+        List_Add (pnxe->Liste, &s);
       }
       else{
-	nxe.Liste = List_Create (1, 1, sizeof (Simplex *));
-	List_Add (nxe.Liste, &s);
-	Tree_Add (TreeTemp, &nxe);
+        nxe.Liste = List_Create (1, 1, sizeof (Simplex *));
+        List_Add (nxe.Liste, &s);
+        Tree_Add (TreeTemp, &nxe);
       }
     }
   }
 }
 
 void create_NXE (Tree_T * TreeAllNod, Tree_T * TreeAllElg,
-		 Tree_T * TreeAllNXE){
+                 Tree_T * TreeAllNXE){
   TreeTemp = TreeAllNXE;
   Tree_Action (TreeAllElg, AddTable);
 }
diff --git a/Mesh/Edge.cpp b/Mesh/Edge.cpp
index c5165f367d..d845da889f 100644
--- a/Mesh/Edge.cpp
+++ b/Mesh/Edge.cpp
@@ -1,4 +1,4 @@
-/* $Id: Edge.cpp,v 1.2 2000-11-23 14:11:35 geuzaine Exp $ */
+/* $Id: Edge.cpp,v 1.3 2000-11-26 15:43:47 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "Mesh.h"
@@ -7,15 +7,15 @@
 #include "Tools.h"
 
 static int edges_quad[4][2] = { {0, 1},
-				{1, 2},
-				{2, 3},
-				{3, 0} };
+                                {1, 2},
+                                {2, 3},
+                                {3, 0} };
 static int edges_tetra[6][2] = { {0, 1},
-				 {1, 2},
-				 {2, 0},
-				 {3, 0},
-				 {3, 2},
-				 {3, 1} };
+                                 {1, 2},
+                                 {2, 0},
+                                 {3, 0},
+                                 {3, 2},
+                                 {3, 1} };
 static int edges_non[3] = {2, 0, 1};
 
 int compareedge (const void *a, const void *b){
@@ -59,25 +59,25 @@ void EdgesContainer::AddEdges (Simplex * s, bool EdgesInVolume){
     N = 6;
     for (i = 0; i < N; i++)
       for (j = 0; j < 2; j++)
-	edges[i][j] = edges_tetra[i][j];
+        edges[i][j] = edges_tetra[i][j];
   }
   else if (s->V[3]){
     N = 4;
     for (i = 0; i < N; i++)
       for (j = 0; j < 2; j++)
-	edges[i][j] = edges_quad[i][j];
+        edges[i][j] = edges_quad[i][j];
   }
   else if (s->V[2]){
     N = 3;
     for (i = 0; i < N; i++)
       for (j = 0; j < 2; j++)
-	edges[i][j] = edges_tetra[i][j];
+        edges[i][j] = edges_tetra[i][j];
   }
   else{
     N = 1;
     for (i = 0; i < N; i++)
       for (j = 0; j < 2; j++)
-	edges[i][j] = edges_tetra[i][j];
+        edges[i][j] = edges_tetra[i][j];
   }
 
   for (i = 0; i < N; i++){
@@ -86,14 +86,14 @@ void EdgesContainer::AddEdges (Simplex * s, bool EdgesInVolume){
     if ((pE = (Edge *) Tree_PQuery (AllEdges, &E))){
       List_Add (pE->Simplexes, &s);
       if (N == 3)
-	pE->O[1] = s->V[edges_non[i]];
+        pE->O[1] = s->V[edges_non[i]];
     }
     else{
       E.Simplexes = List_Create (2, 1, sizeof (Simplex *));
       if (N == 3)
-	E.O[0] = s->V[edges_non[i]];
+        E.O[0] = s->V[edges_non[i]];
       if (N == 3)
-	E.O[1] = NULL;
+        E.O[1] = NULL;
       List_Add (E.Simplexes, &s);
       E.newv = NULL;
       Tree_Replace (AllEdges, &E);
@@ -157,7 +157,7 @@ void EdgesContainer::SwapEdge (Vertex * V[2]){
     if (s1->S[i] == s2){
       s1->ExtractOppositeEdges (i, p, q);
       if (!s1->SwapEdge (i))
-	return;
+        return;
       Tree_Suppress (AllEdges, &E);
       E.V[0] = q[0];
       E.V[1] = q[1];
@@ -167,18 +167,18 @@ void EdgesContainer::SwapEdge (Vertex * V[2]){
       E.V[1] = p[0];
       e = (Edge *) Tree_PQuery (AllEdges, &E);
       for (j = 0; j < 2; j++){
-	List_Read (e->Simplexes, j, &s);
-	if (s == s2)
-	  List_Write (e->Simplexes, j, &s1);
+        List_Read (e->Simplexes, j, &s);
+        if (s == s2)
+          List_Write (e->Simplexes, j, &s1);
       }
       
       E.V[0] = q[1];
       E.V[1] = p[1];
       e = (Edge *) Tree_PQuery (AllEdges, &E);
       for (j = 0; j < 2; j++){
-	List_Read (e->Simplexes, j, &s);
-	if (s == s1)
-	  List_Write (e->Simplexes, j, &s2);
+        List_Read (e->Simplexes, j, &s);
+        if (s == s1)
+          List_Write (e->Simplexes, j, &s2);
       }
       V[0] = q[0];
       V[1] = q[1];
diff --git a/Mesh/Generator.cpp b/Mesh/Generator.cpp
index 3240b7b71d..822a9f527c 100644
--- a/Mesh/Generator.cpp
+++ b/Mesh/Generator.cpp
@@ -1,4 +1,4 @@
-/* $Id: Generator.cpp,v 1.6 2000-11-25 15:26:11 geuzaine Exp $ */
+/* $Id: Generator.cpp,v 1.7 2000-11-26 15:43:47 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "Const.h"
@@ -9,8 +9,7 @@
 
 extern Mesh     *THEM;
 extern Context_T CTX;
-extern int TYPBGMESH;
-extern int CurrentNodeNumber, CurrentSimplexNumber;
+extern int       CurrentNodeNumber, CurrentSimplexNumber;
 
 static List_T *Curves;
 
@@ -27,7 +26,7 @@ void ApplyLcFactor_Point(void *a, void *b){
   Vertex *v = *(Vertex**)a;
   if(v->lc <= 0.0)
     Msg(FATAL, "Wrong characteristic Length (%g <= 0) for Point %d",
-	v->lc, v->Num);
+        v->lc, v->Num);
   v->lc *= CTX.mesh.lc_factor;
 }
 void ApplyLcFactor_Attractor(void *a, void *b){
@@ -42,9 +41,13 @@ void ApplyLcFactor(Mesh *M){
 
 void Maillage_Dimension_0 (Mesh * M){
   for (int i = 0; i < 20; i++) M->Statistics[i] = 0.0;
-  Create_BgMesh (TYPBGMESH, .2, M);
+  // This is the default type of BGM (lc associated with 
+  // points of the geometry). It can be changed to
+  // - ONFILE by loading a view containing a bgmesh
+  // - CONSTANT
+  // - FUNCTION
+  Create_BgMesh (WITHPOINTS, .2, M);
 }
-
 void Maillage_Dimension_1 (Mesh * M){
   double t1, t2;
   t1 = Cpu();
@@ -56,7 +59,7 @@ void Maillage_Dimension_1 (Mesh * M){
 void Maillage_Dimension_2 (Mesh * M){
   int i;
   Curve *c, *neew, C;
-  double t1, t2;
+  double t1, t2, shortest=1.e300;
 
   t1 = Cpu();
 
@@ -66,6 +69,7 @@ void Maillage_Dimension_2 (Mesh * M){
   for (i = 0; i < List_Nbr (Curves); i++){
     List_Read (Curves, i, &c);
     if (c->Num > 0){
+      if(c->l < shortest) shortest = c->l ;
       neew = &C;
       neew->Num = -c->Num;
       Tree_Query (M->Curves, &neew);
@@ -75,6 +79,8 @@ void Maillage_Dimension_2 (Mesh * M){
   }
   List_Delete (Curves);
 
+  Msg(DEBUG, "Shortest Curve has Length %g", shortest);
+
   Tree_Action (M->Surfaces, Maillage_Surface);
 
   t2 = Cpu();
@@ -95,9 +101,9 @@ void Maillage_Dimension_3 (Mesh * M){
   for (int i = 0; i < List_Nbr (list); i++){
     List_Read (list, i, &vol);
     if ((!vol->Extrude || !vol->Extrude->mesh.ExtrudeMesh) &&
-	(vol->Method != TRANSFINI)){
+        (vol->Method != TRANSFINI)){
       for (int j = 0; j < List_Nbr (vol->Surfaces); j++){
-	List_Replace (v->Surfaces, List_Pointer (vol->Surfaces, j), compareSurface);
+        List_Replace (v->Surfaces, List_Pointer (vol->Surfaces, j), compareSurface);
       }
     }
   }
@@ -189,7 +195,6 @@ void mai3d (Mesh * M, int Asked){
 
   if ((Asked > oldstatus && Asked >= 0 && oldstatus < 0) ||
       (Asked < oldstatus)){
-    printf("ON PASSE ICI\n");
     OpenProblem (TheFileName);
     M->status = 0;
   }
diff --git a/Mesh/Interpolation.cpp b/Mesh/Interpolation.cpp
index 38349eb5c7..365f7e4017 100644
--- a/Mesh/Interpolation.cpp
+++ b/Mesh/Interpolation.cpp
@@ -1,4 +1,4 @@
-/* $Id: Interpolation.cpp,v 1.3 2000-11-23 23:20:35 geuzaine Exp $ */
+/* $Id: Interpolation.cpp,v 1.4 2000-11-26 15:43:47 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "Const.h"
@@ -71,7 +71,7 @@ Vertex InterpolateCurve (Curve * Curve, double u, int derivee){
   case MSH_SEGM_ELLI_INV:
     
     if (Curve->Typ == MSH_SEGM_CIRC_INV ||
-	Curve->Typ == MSH_SEGM_ELLI_INV){
+        Curve->Typ == MSH_SEGM_ELLI_INV){
       V.u = 1. - u;
       u = V.u;
     }
@@ -179,8 +179,8 @@ Vertex InterpolateCurve (Curve * Curve, double u, int derivee){
     /* X */
     for (i = 0; i < 4; i++){
       for (j = 0; j < 4; j++){
-	  vec[i] += Curve->mat[i][j] * v[j]->Pos.X;
-	}
+          vec[i] += Curve->mat[i][j] * v[j]->Pos.X;
+        }
     }
 
     for (j = 0; j < 4; j++){
@@ -191,7 +191,7 @@ Vertex InterpolateCurve (Curve * Curve, double u, int derivee){
     /* Y */
     for (i = 0; i < 4; i++){
       for (j = 0; j < 4; j++){
-	vec[i] += Curve->mat[i][j] * v[j]->Pos.Y;
+        vec[i] += Curve->mat[i][j] * v[j]->Pos.Y;
       }
     }
 
@@ -203,7 +203,7 @@ Vertex InterpolateCurve (Curve * Curve, double u, int derivee){
     /* Z */
     for (i = 0; i < 4; i++){
       for (j = 0; j < 4; j++){
-	vec[i] += Curve->mat[i][j] * v[j]->Pos.Z;
+        vec[i] += Curve->mat[i][j] * v[j]->Pos.Z;
       }
     }
     for (j = 0; j < 4; j++){
@@ -214,7 +214,7 @@ Vertex InterpolateCurve (Curve * Curve, double u, int derivee){
     /* W */
     for (i = 0; i < 4; i++){
       for (j = 0; j < 4; j++){
-	vec[i] += Curve->mat[i][j] * v[j]->lc;
+        vec[i] += Curve->mat[i][j] * v[j]->lc;
       }
     }
     for (j = 0; j < 4; j++){
@@ -252,20 +252,20 @@ Vertex InterpolateCurve (Curve * Curve, double u, int derivee){
    (1.-u)*c4+u*c2+(1.-v)*c1+v*c3-((1.-u)*(1.-v)*s1+u*(1.-v)*s2+u*v*s3+(1.-u)*v*s4)
 
 Vertex TransfiniteQua (Vertex c1, Vertex c2, Vertex c3, Vertex c4,
-		       Vertex s1, Vertex s2, Vertex s3, Vertex s4,
-		       double u, double v){
+                       Vertex s1, Vertex s2, Vertex s3, Vertex s4,
+                       double u, double v){
   Vertex V;
 
   V.lc = TRAN_QUA (c1.lc, c2.lc, c3.lc, c4.lc, 
-		   s1.lc, s2.lc, s3.lc, s4.lc, u, v);
+                   s1.lc, s2.lc, s3.lc, s4.lc, u, v);
   V.w = TRAN_QUA (c1.w, c2.w, c3.w, c4.w, 
-		  s1.w, s2.w, s3.w, s4.w, u, v);
+                  s1.w, s2.w, s3.w, s4.w, u, v);
   V.Pos.X = TRAN_QUA (c1.Pos.X, c2.Pos.X, c3.Pos.X, c4.Pos.X, 
-		      s1.Pos.X, s2.Pos.X, s3.Pos.X, s4.Pos.X, u, v);
+                      s1.Pos.X, s2.Pos.X, s3.Pos.X, s4.Pos.X, u, v);
   V.Pos.Y = TRAN_QUA (c1.Pos.Y, c2.Pos.Y, c3.Pos.Y, c4.Pos.Y, 
-		      s1.Pos.Y, s2.Pos.Y, s3.Pos.Y, s4.Pos.Y, u, v);
+                      s1.Pos.Y, s2.Pos.Y, s3.Pos.Y, s4.Pos.Y, u, v);
   V.Pos.Z = TRAN_QUA (c1.Pos.Z, c2.Pos.Z, c3.Pos.Z, c4.Pos.Z, 
-		      s1.Pos.Z, s2.Pos.Z, s3.Pos.Z, s4.Pos.Z, u, v);
+                      s1.Pos.Z, s2.Pos.Z, s3.Pos.Z, s4.Pos.Z, u, v);
   return (V);
 }
 
@@ -275,18 +275,18 @@ Vertex TransfiniteQua (Vertex c1, Vertex c2, Vertex c3, Vertex c4,
 #define TRAN_TRI(c1,c2,c3,s1,s2,s3,u,v) u*c2+(1.-v)*c1+v*c3-(u*(1.-v)*s2+u*v*s3);
 
 Vertex TransfiniteTri (Vertex c1, Vertex c2, Vertex c3,
-		       Vertex s1, Vertex s2, Vertex s3,
-		       double u, double v){
+                       Vertex s1, Vertex s2, Vertex s3,
+                       double u, double v){
   Vertex V;
 
   V.lc = TRAN_TRI (c1.lc, c2.lc, c3.lc, s1.lc, s2.lc, s3.lc, u, v);
   V.w = TRAN_TRI (c1.w, c2.w, c3.w, s1.w, s2.w, s3.w, u, v);
   V.Pos.X = TRAN_TRI (c1.Pos.X, c2.Pos.X, c3.Pos.X, 
-		      s1.Pos.X, s2.Pos.X, s3.Pos.X, u, v);
+                      s1.Pos.X, s2.Pos.X, s3.Pos.X, u, v);
   V.Pos.Y = TRAN_TRI (c1.Pos.Y, c2.Pos.Y, c3.Pos.Y, 
-		      s1.Pos.Y, s2.Pos.Y, s3.Pos.Y, u, v);
+                      s1.Pos.Y, s2.Pos.Y, s3.Pos.Y, u, v);
   V.Pos.Z = TRAN_TRI (c1.Pos.Z, c2.Pos.Z, c3.Pos.Z, 
-		      s1.Pos.Z, s2.Pos.Z, s3.Pos.Z, u, v);
+                      s1.Pos.Z, s2.Pos.Z, s3.Pos.Z, u, v);
   return (V);
 }
 
@@ -294,10 +294,10 @@ void TransfiniteSph (Vertex S, Vertex center, Vertex * T){
   double r, s, dirx, diry, dirz;
 
   r = sqrt (DSQR (S.Pos.X - center.Pos.X) + DSQR (S.Pos.Y - center.Pos.Y)
-	    + DSQR (S.Pos.Z - center.Pos.Z));
+            + DSQR (S.Pos.Z - center.Pos.Z));
 
   s = sqrt (DSQR (T->Pos.X - center.Pos.X) + DSQR (T->Pos.Y - center.Pos.Y)
-	    + DSQR (T->Pos.Z - center.Pos.Z));
+            + DSQR (T->Pos.Z - center.Pos.Z));
 
   dirx = (T->Pos.X - center.Pos.X) / s;
   diry = (T->Pos.Y - center.Pos.Y) / s;
@@ -309,7 +309,7 @@ void TransfiniteSph (Vertex S, Vertex center, Vertex * T){
 }
 
 Vertex InterpolateSurface (Surface * s, double u, double v, 
-			   int derivee, int u_v){
+                           int derivee, int u_v){
   Vertex *c1, *c2, T, D[4], V[4], *S[4];
   Curve *C[4];
   int i, issphere;
@@ -318,22 +318,22 @@ Vertex InterpolateSurface (Surface * s, double u, double v,
   if (derivee){
     if (u_v == 1){
       if (u - eps < 0.0){
-	D[0] = InterpolateSurface (s, u, v, 0, 0);
-	D[1] = InterpolateSurface (s, u + eps, v, 0, 0);
+        D[0] = InterpolateSurface (s, u, v, 0, 0);
+        D[1] = InterpolateSurface (s, u + eps, v, 0, 0);
       }
       else{
-	D[0] = InterpolateSurface (s, u - eps, v, 0, 0);
-	D[1] = InterpolateSurface (s, u, v, 0, 0);
+        D[0] = InterpolateSurface (s, u - eps, v, 0, 0);
+        D[1] = InterpolateSurface (s, u, v, 0, 0);
       }
     }
     else if (u_v == 2){
       if (v - eps < 0.0){
-	D[0] = InterpolateSurface (s, u, v, 0, 0);
-	D[1] = InterpolateSurface (s, u, v + eps, 0, 0);
+        D[0] = InterpolateSurface (s, u, v, 0, 0);
+        D[1] = InterpolateSurface (s, u, v + eps, 0, 0);
       }
       else{
-	D[0] = InterpolateSurface (s, u, v - eps, 0, 0);
-	D[1] = InterpolateSurface (s, u, v, 0, 0);
+        D[0] = InterpolateSurface (s, u, v - eps, 0, 0);
+        D[1] = InterpolateSurface (s, u, v, 0, 0);
       }
     }
     else{
@@ -342,20 +342,20 @@ Vertex InterpolateSurface (Surface * s, double u, double v,
       double epsc = eps * cos (t);
       double epss = eps * sin (t);
       if (v - epss < 0.0 && u - epsc < 0.0){
-	D[0] = InterpolateSurface (s, u, v, 0, 0);
-	D[1] = InterpolateSurface (s, u + epsc, v + epss, 0, 0);
+        D[0] = InterpolateSurface (s, u, v, 0, 0);
+        D[1] = InterpolateSurface (s, u + epsc, v + epss, 0, 0);
       }
       else if (v - epss < 0.0){
-	D[0] = InterpolateSurface (s, u - epsc, v, 0, 0);
-	D[1] = InterpolateSurface (s, u, v + epss, 0, 0);
+        D[0] = InterpolateSurface (s, u - epsc, v, 0, 0);
+        D[1] = InterpolateSurface (s, u, v + epss, 0, 0);
       }
       else if (u - epsc < 0.0){
-	D[0] = InterpolateSurface (s, u, v - epss, 0, 0);
-	D[1] = InterpolateSurface (s, u + epsc, v, 0, 0);
+        D[0] = InterpolateSurface (s, u, v - epss, 0, 0);
+        D[1] = InterpolateSurface (s, u + epsc, v, 0, 0);
       }
       else{
-	D[0] = InterpolateSurface (s, u - epsc, v - epss, 0, 0);
-	D[1] = InterpolateSurface (s, u, v, 0, 0);
+        D[0] = InterpolateSurface (s, u - epsc, v - epss, 0, 0);
+        D[1] = InterpolateSurface (s, u, v, 0, 0);
       }
       */
     }
@@ -389,17 +389,17 @@ Vertex InterpolateSurface (Surface * s, double u, double v,
     for (i = 0; i < 4; i++){
       List_Read (s->s.Generatrices, i, &C[i]);
       if (C[i]->Typ != MSH_SEGM_CIRC && C[i]->Typ != MSH_SEGM_CIRC_INV){
-	issphere = 0;
+        issphere = 0;
       }
       else if (issphere){
-	if (!i){
-	  List_Read (C[i]->Control_Points, 1, &c1);
-	}
-	else{
-	  List_Read (C[i]->Control_Points, 1, &c2);
-	  if (compareVertex (&c1, &c2))
-	    issphere = 0;
-	}
+        if (!i){
+          List_Read (C[i]->Control_Points, 1, &c1);
+        }
+        else{
+          List_Read (C[i]->Control_Points, 1, &c2);
+          if (compareVertex (&c1, &c2))
+            issphere = 0;
+        }
       }
     }
     
@@ -433,17 +433,17 @@ Vertex InterpolateSurface (Surface * s, double u, double v,
     for (i = 0; i < 3; i++){
       List_Read (s->s.Generatrices, i, &C[i]);
       if (C[i]->Typ != MSH_SEGM_CIRC && C[i]->Typ != MSH_SEGM_CIRC_INV){
-	issphere = 0;
+        issphere = 0;
       }
       else if (issphere){
-	if (!i){
-	  List_Read (C[i]->Control_Points, 1, &c1);
-	}
-	else{
-	  List_Read (C[i]->Control_Points, 1, &c2);
-	  if (compareVertex (&c1, &c2))
-	    issphere = 0;
-	}
+        if (!i){
+          List_Read (C[i]->Control_Points, 1, &c1);
+        }
+        else{
+          List_Read (C[i]->Control_Points, 1, &c2);
+          if (compareVertex (&c1, &c2))
+            issphere = 0;
+        }
       }
     }
     
@@ -488,37 +488,37 @@ Vertex InterpolateSurface (Surface * s, double u, double v,
 
 Vertex 
 TransfiniteHex (Vertex f1, Vertex f2, Vertex f3, Vertex f4, Vertex f5, Vertex f6,
-		Vertex c1, Vertex c2, Vertex c3, Vertex c4, Vertex c5, Vertex c6,
-		Vertex c7, Vertex c8, Vertex c9, Vertex c10, Vertex c11, Vertex c12,
-		Vertex s1, Vertex s2, Vertex s3, Vertex s4,
-		Vertex s5, Vertex s6, Vertex s7, Vertex s8,
-		double u, double v, double w)
+                Vertex c1, Vertex c2, Vertex c3, Vertex c4, Vertex c5, Vertex c6,
+                Vertex c7, Vertex c8, Vertex c9, Vertex c10, Vertex c11, Vertex c12,
+                Vertex s1, Vertex s2, Vertex s3, Vertex s4,
+                Vertex s5, Vertex s6, Vertex s7, Vertex s8,
+                double u, double v, double w)
 {
   Vertex V;
 
   V.lc = TRAN_HEX (f1.lc, f2.lc, f3.lc, f4.lc, f5.lc, f6.lc,
-		   c1.lc, c2.lc, c3.lc, c4.lc, c5.lc, c6.lc,
-		   c7.lc, c8.lc, c9.lc, c10.lc, c11.lc, c12.lc,
-		   s1.lc, s2.lc, s3.lc, s4.lc, s5.lc, s6.lc, s7.lc, s8.lc,
-		   u, v, w);
+                   c1.lc, c2.lc, c3.lc, c4.lc, c5.lc, c6.lc,
+                   c7.lc, c8.lc, c9.lc, c10.lc, c11.lc, c12.lc,
+                   s1.lc, s2.lc, s3.lc, s4.lc, s5.lc, s6.lc, s7.lc, s8.lc,
+                   u, v, w);
 
   V.Pos.X = TRAN_HEX (f1.Pos.X, f2.Pos.X, f3.Pos.X, f4.Pos.X, f5.Pos.X, f6.Pos.X,
-		 c1.Pos.X, c2.Pos.X, c3.Pos.X, c4.Pos.X, c5.Pos.X, c6.Pos.X,
-	      c7.Pos.X, c8.Pos.X, c9.Pos.X, c10.Pos.X, c11.Pos.X, c12.Pos.X,
-		      s1.Pos.X, s2.Pos.X, s3.Pos.X, s4.Pos.X, s5.Pos.X, s6.Pos.X, s7.Pos.X, s8.Pos.X,
-		      u, v, w);
+                 c1.Pos.X, c2.Pos.X, c3.Pos.X, c4.Pos.X, c5.Pos.X, c6.Pos.X,
+              c7.Pos.X, c8.Pos.X, c9.Pos.X, c10.Pos.X, c11.Pos.X, c12.Pos.X,
+                      s1.Pos.X, s2.Pos.X, s3.Pos.X, s4.Pos.X, s5.Pos.X, s6.Pos.X, s7.Pos.X, s8.Pos.X,
+                      u, v, w);
 
   V.Pos.Y = TRAN_HEX (f1.Pos.Y, f2.Pos.Y, f3.Pos.Y, f4.Pos.Y, f5.Pos.Y, f6.Pos.Y,
-		 c1.Pos.Y, c2.Pos.Y, c3.Pos.Y, c4.Pos.Y, c5.Pos.Y, c6.Pos.Y,
-	      c7.Pos.Y, c8.Pos.Y, c9.Pos.Y, c10.Pos.Y, c11.Pos.Y, c12.Pos.Y,
-		      s1.Pos.Y, s2.Pos.Y, s3.Pos.Y, s4.Pos.Y, s5.Pos.Y, s6.Pos.Y, s7.Pos.Y, s8.Pos.Y,
-		      u, v, w);
+                 c1.Pos.Y, c2.Pos.Y, c3.Pos.Y, c4.Pos.Y, c5.Pos.Y, c6.Pos.Y,
+              c7.Pos.Y, c8.Pos.Y, c9.Pos.Y, c10.Pos.Y, c11.Pos.Y, c12.Pos.Y,
+                      s1.Pos.Y, s2.Pos.Y, s3.Pos.Y, s4.Pos.Y, s5.Pos.Y, s6.Pos.Y, s7.Pos.Y, s8.Pos.Y,
+                      u, v, w);
 
   V.Pos.Z = TRAN_HEX (f1.Pos.Z, f2.Pos.Z, f3.Pos.Z, f4.Pos.Z, f5.Pos.Z, f6.Pos.Z,
-		 c1.Pos.Z, c2.Pos.Z, c3.Pos.Z, c4.Pos.Z, c5.Pos.Z, c6.Pos.Z,
-	      c7.Pos.Z, c8.Pos.Z, c9.Pos.Z, c10.Pos.Z, c11.Pos.Z, c12.Pos.Z,
-		      s1.Pos.Z, s2.Pos.Z, s3.Pos.Z, s4.Pos.Z, s5.Pos.Z, s6.Pos.Z, s7.Pos.Z, s8.Pos.Z,
-		      u, v, w);
+                 c1.Pos.Z, c2.Pos.Z, c3.Pos.Z, c4.Pos.Z, c5.Pos.Z, c6.Pos.Z,
+              c7.Pos.Z, c8.Pos.Z, c9.Pos.Z, c10.Pos.Z, c11.Pos.Z, c12.Pos.Z,
+                      s1.Pos.Z, s2.Pos.Z, s3.Pos.Z, s4.Pos.Z, s5.Pos.Z, s6.Pos.Z, s7.Pos.Z, s8.Pos.Z,
+                      u, v, w);
 
   return (V);
 }
diff --git a/Mesh/Interpolation.h b/Mesh/Interpolation.h
index 7e35d7857a..1a15e7d841 100644
--- a/Mesh/Interpolation.h
+++ b/Mesh/Interpolation.h
@@ -1,19 +1,19 @@
-/* $Id: Interpolation.h,v 1.2 2000-11-23 14:11:35 geuzaine Exp $ */
+/* $Id: Interpolation.h,v 1.3 2000-11-26 15:43:47 geuzaine Exp $ */
 #ifndef _INTERPOLATION_H_
 #define _INTERPOLATION_H_
 
 Vertex InterpolateCurve (Curve * Curve, double u, int derivee);
 
 Vertex InterpolateSurface (Surface * s, double u, double v, 
-			   int derivee, int u_v);
+                           int derivee, int u_v);
 
 Vertex TransfiniteQua (Vertex c1, Vertex c2, Vertex c3, Vertex c4,
-		       Vertex s1, Vertex s2, Vertex s3, Vertex s4,
-		       double u, double v);
+                       Vertex s1, Vertex s2, Vertex s3, Vertex s4,
+                       double u, double v);
 
 Vertex TransfiniteTri (Vertex c1, Vertex c2, Vertex c3,
-		       Vertex s1, Vertex s2, Vertex s3,
-		       double u, double v);
+                       Vertex s1, Vertex s2, Vertex s3,
+                       double u, double v);
 
 Vertex TransfiniteHex 
   (Vertex f1, Vertex f2, Vertex f3, Vertex f4, Vertex f5, Vertex f6,
@@ -28,7 +28,7 @@ void TransfiniteSph (Vertex S, Vertex center, Vertex * T);
 void Normal2Surface (Surface * s, double u, double v, double n[3]);
 
 Vertex InterpolateCubicSpline (Vertex * v[4], double t, double mat[4][4],
-			       int derivee, double t1, double t2);
+                               int derivee, double t1, double t2);
 Vertex InterpolateUBS (Curve * Curve, double u, int derivee);
   
 Vertex InterpolateNurbs (Curve * Curve, double u, int derivee);
diff --git a/Mesh/Matrix.h b/Mesh/Matrix.h
index ed0f8c1224..c3a70187a7 100644
--- a/Mesh/Matrix.h
+++ b/Mesh/Matrix.h
@@ -1,4 +1,4 @@
-/* $Id: Matrix.h,v 1.2 2000-11-23 14:11:35 geuzaine Exp $ */
+/* $Id: Matrix.h,v 1.3 2000-11-26 15:43:47 geuzaine Exp $ */
 #ifndef _MATRIX_H_
 #define _MATRIX_H_
 
@@ -14,20 +14,20 @@ public:
     zero = init;
     for(int i=0;i<_TAILLE_;i++)
       for(int j=0;j<_TAILLE_;j++)
-	mat[i][j] = zero;
+        mat[i][j] = zero;
   }
 
   Matrix2x2 (const T& init, T z[3][3]){
     zero = init;
     for(int i=0;i<_TAILLE_;i++)
       for(int j=0;j<_TAILLE_;j++)
-	mat[i][j] = z[i][j];
+        mat[i][j] = z[i][j];
   }
 
   Matrix2x2<T>& operator = (const Matrix2x2<T> &autre){
     for(int i=0;i<_TAILLE_;i++)
       for(int j=0;j<_TAILLE_;j++)
-	mat[i][j] = autre.mat[i][j];
+        mat[i][j] = autre.mat[i][j];
     return *this;
   }
 
@@ -35,7 +35,7 @@ public:
     Matrix2x2<T> m(0.);
     for(int i=0;i<_TAILLE_;i++)
       for(int j=0;j<_TAILLE_;j++)
-	m.mat[i][j] = mat[i][j] + autre.mat[i][j];
+        m.mat[i][j] = mat[i][j] + autre.mat[i][j];
     return m;
   }
 
@@ -43,7 +43,7 @@ public:
     Matrix2x2<T> m(0.);
     for(int i=0;i<_TAILLE_;i++)
       for(int j=0;j<_TAILLE_;j++)
-	m.mat[i][j] = mat[i][j] - autre.mat[i][j];
+        m.mat[i][j] = mat[i][j] - autre.mat[i][j];
     return m;
   }
 
@@ -59,16 +59,16 @@ public:
   Matrix2x2 copy(T m[3][3]){
     for(int i=0;i<_TAILLE_;i++)
       for(int j=0;j<_TAILLE_;j++)
-	m[i][j] = mat[i][j];
+        m[i][j] = mat[i][j];
   }
   
   Matrix2x2 operator * (const Matrix2x2<T> &autre){
     Matrix2x2 m(0.);
     for(int i=0;i<_TAILLE_;i++)
       for(int j=0;j<_TAILLE_;j++){
-	m.mat[i][j] = zero;
-	for(int k=0;k<_TAILLE_;k++)
-	  m.mat[i][j] += mat[i][k] * autre.mat[k][j];
+        m.mat[i][j] = zero;
+        for(int k=0;k<_TAILLE_;k++)
+          m.mat[i][j] += mat[i][k] * autre.mat[k][j];
       }
     return m;
   }
@@ -86,11 +86,11 @@ public:
     T temp;
     for(int i=0;i<_TAILLE_;i++)
       for(int j=0;j<_TAILLE_;j++){
-	if(i!=j){
-	  temp = mat[i][j];
-	  mat[i][j] = mat[j][i];
-	  mat[j][i] = temp;
-	}
+        if(i!=j){
+          temp = mat[i][j];
+          mat[i][j] = mat[j][i];
+          mat[j][i] = temp;
+        }
       }
   }
 };
@@ -108,20 +108,20 @@ public:
     zero = init;
     for(int i=0;i<_TAILLE_;i++)
       for(int j=0;j<_TAILLE_;j++)
-	mat[i][j] = zero;
+        mat[i][j] = zero;
   }
 
   Matrix3x3 (const T& init, T z[3][3]){
     zero = init;
     for(int i=0;i<_TAILLE_;i++)
       for(int j=0;j<_TAILLE_;j++)
-	mat[i][j] = z[i][j];
+        mat[i][j] = z[i][j];
   }
 
   Matrix3x3<T>& operator = (const Matrix3x3<T> &autre){
     for(int i=0;i<_TAILLE_;i++)
       for(int j=0;j<_TAILLE_;j++)
-	mat[i][j] = autre.mat[i][j];
+        mat[i][j] = autre.mat[i][j];
     return *this;
   }
 
@@ -129,7 +129,7 @@ public:
     Matrix3x3<T> m(0.);
     for(int i=0;i<_TAILLE_;i++)
       for(int j=0;j<_TAILLE_;j++)
-	m.mat[i][j] = mat[i][j] + autre.mat[i][j];
+        m.mat[i][j] = mat[i][j] + autre.mat[i][j];
     return m;
   }
 
@@ -137,7 +137,7 @@ public:
     Matrix2x2<T> m(0.);
     for(int i=0;i<_TAILLE_;i++)
       for(int j=0;j<_TAILLE_;j++)
-	m.mat[i][j] = mat[i][j] - autre.mat[i][j];
+        m.mat[i][j] = mat[i][j] - autre.mat[i][j];
     return m;
   }
 
@@ -153,16 +153,16 @@ public:
   void copy(T m[3][3]){
     for(int i=0;i<_TAILLE_;i++)
       for(int j=0;j<_TAILLE_;j++)
-	m[i][j] = mat[i][j];
+        m[i][j] = mat[i][j];
   }
   
   Matrix3x3 operator * (const Matrix3x3<T> &autre){
     Matrix3x3 m(0.);
     for(int i=0;i<_TAILLE_;i++)
       for(int j=0;j<_TAILLE_;j++){
-	m.mat[i][j] = zero;
-	for(int k=0;k<_TAILLE_;k++)
-	  m.mat[i][j] += mat[i][k] * autre.mat[k][j];
+        m.mat[i][j] = zero;
+        for(int k=0;k<_TAILLE_;k++)
+          m.mat[i][j] += mat[i][k] * autre.mat[k][j];
       }
     return m;
   }
@@ -182,11 +182,11 @@ public:
     T temp;
     for(int i=0;i<_TAILLE_;i++)
       for(int j=0;j<i;j++){
-	if(i!=j){
-	  temp = mat[i][j];
-	  mat[i][j] = mat[j][i];
-	  mat[j][i] = temp;
-	}
+        if(i!=j){
+          temp = mat[i][j];
+          mat[i][j] = mat[j][i];
+          mat[j][i] = temp;
+        }
       }
   }
 };
diff --git a/Mesh/Metric.cpp b/Mesh/Metric.cpp
index ad888a92ad..6a65510b2c 100644
--- a/Mesh/Metric.cpp
+++ b/Mesh/Metric.cpp
@@ -1,4 +1,4 @@
-/* $Id: Metric.cpp,v 1.2 2000-11-23 14:11:35 geuzaine Exp $ */
+/* $Id: Metric.cpp,v 1.3 2000-11-26 15:43:47 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "Const.h"
@@ -20,7 +20,7 @@ GMSHMetric::GMSHMetric (){
 }
 
 double GMSHMetric:: Local_Metric_Of_Attractors (double X, double Y, double Z,
-						double metric[3][3]){
+                                                double metric[3][3]){
   int i;
   Attractor *a, *amin;
   double u, x1, x2, d, dmin;
@@ -33,14 +33,14 @@ double GMSHMetric:: Local_Metric_Of_Attractors (double X, double Y, double Z,
     List_Read (Attractors, i, &a);
     if (a->v){
       d = sqrt ((X - a->v->Pos.X) * (X - a->v->Pos.X) +
-		(Y - a->v->Pos.Y) * (Y - a->v->Pos.Y) +
-		(Z - a->v->Pos.Z) * (Z - a->v->Pos.Z));
+                (Y - a->v->Pos.Y) * (Y - a->v->Pos.Y) +
+                (Z - a->v->Pos.Z) * (Z - a->v->Pos.Z));
     }
     if (a->c){
       ProjectPointOnCurve (a->c, &v1, &v2, &der);
       d = sqrt ((X - v2.Pos.X) * (X - v2.Pos.X) +
-		(Y - v2.Pos.Y) * (Y - v2.Pos.Y) +
-		(Z - v2.Pos.Z) * (Z - v2.Pos.Z));
+                (Y - v2.Pos.Y) * (Y - v2.Pos.Y) +
+                (Z - v2.Pos.Z) * (Z - v2.Pos.Z));
       
     }
     /*
@@ -125,8 +125,8 @@ double GMSHMetric:: Local_Metric_Of_Attractors (double X, double Y, double Z,
 
 
 void GMSHMetric:: setMetric (double u,double v, Surface * s){
-  double a, b, c;		// ellipsis axx+byy+cxy=1
-  double l1, l2;		// 2 eigenvalues
+  double a, b, c;               // ellipsis axx+byy+cxy=1
+  double l1, l2;                // 2 eigenvalues
 
   Identity ();
   Vertex p = InterpolateSurface (s, u, v, 0, 0);
@@ -319,8 +319,8 @@ double GMSHMetric::getLc (double u, Curve * c){
 
 double GMSHMetric::LengthVector (Vertex * v){
   Vertex mult (v->Pos.X * m[0][0] + v->Pos.Y * m[0][1] + v->Pos.Z * m[0][2],
-	       v->Pos.X * m[1][0] + v->Pos.Y * m[1][1] + v->Pos.Z * m[1][2],
-	       v->Pos.X * m[2][0] + v->Pos.Y * m[2][1] + v->Pos.Z * m[2][2]);
+               v->Pos.X * m[1][0] + v->Pos.Y * m[1][1] + v->Pos.Z * m[1][2],
+               v->Pos.X * m[2][0] + v->Pos.Y * m[2][1] + v->Pos.Z * m[2][2]);
   return sqrt (mult * (*v));
 }
 
diff --git a/Mesh/Metric.h b/Mesh/Metric.h
index 49c51c6341..280d65f65c 100644
--- a/Mesh/Metric.h
+++ b/Mesh/Metric.h
@@ -1,4 +1,4 @@
-/* $Id: Metric.h,v 1.3 2000-11-23 15:05:59 geuzaine Exp $ */
+/* $Id: Metric.h,v 1.4 2000-11-26 15:43:47 geuzaine Exp $ */
 #ifndef _METRIC_H_
 #define _METRIC_H_
 
@@ -27,7 +27,7 @@ public:
   double operator () (int i,int j);
   double * operator [] (int i);
   double Local_Metric_Of_Attractors (double X, double Y, double Z,
-				     double metric[3][3]);
+                                     double metric[3][3]);
   double getWorstEdge (Simplex *s, Surface *surf, Vertex *v[2]);
 
 } ;
diff --git a/Mesh/Numeric.cpp b/Mesh/Numeric.cpp
index 9bc3a2bd5c..2bb99f5cd1 100644
--- a/Mesh/Numeric.cpp
+++ b/Mesh/Numeric.cpp
@@ -1,4 +1,4 @@
-/* $Id: Numeric.cpp,v 1.5 2000-11-23 23:20:35 geuzaine Exp $ */
+/* $Id: Numeric.cpp,v 1.6 2000-11-26 15:43:47 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "Const.h"
@@ -151,7 +151,7 @@ int inv3x3 (double mat[3][3], double inv[3][3], double *det){
 #define  MaxIter 20
 
 void find_bestuv (Surface * s, double X, double Y,
-		  double *U, double *V, double *Z, int N){
+                  double *U, double *V, double *Z, int N){
   double d, mina, min, minu, minv, Unew, Vnew;
   static int i, j;
   Vertex P;
@@ -164,18 +164,18 @@ void find_bestuv (Surface * s, double X, double Y,
       Vnew = ((double) j) * d;
       P = InterpolateSurface (s, Unew, Vnew, 0, 0);
       if (!i && !j){
-	min = myhypot (X - P.Pos.X, Y - P.Pos.Y);
-	minu = Unew;
-	minv = Vnew;
-	*Z = P.Pos.Z;
+        min = myhypot (X - P.Pos.X, Y - P.Pos.Y);
+        minu = Unew;
+        minv = Vnew;
+        *Z = P.Pos.Z;
       }
       else{
-	if ((mina = myhypot (X - P.Pos.X, Y - P.Pos.Y)) < min){
-	  min = mina;
-	  minu = Unew;
-	  minv = Vnew;
-	  *Z = P.Pos.Z;
-	}
+        if ((mina = myhypot (X - P.Pos.X, Y - P.Pos.Y)) < min){
+          min = mina;
+          minu = Unew;
+          minv = Vnew;
+          *Z = P.Pos.Z;
+        }
       }
     }
   }
@@ -234,7 +234,7 @@ void XYZtoUV (Surface *s, double X, double Y, double Z, double *U, double *V) {
 }
 
 void XYtoUV (Surface * s, double *X, double *Y,
-	     double *U, double *V, double *Z){
+             double *U, double *V, double *Z){
 
   double det, Unew, Vnew, err, mat[2][2], jac[2][2];
   int iter;
@@ -424,7 +424,7 @@ double angle_3pts (Vertex * a, Vertex * b, Vertex * c){
     myhypot ((b->Pos.X - c->Pos.X), (b->Pos.Y - c->Pos.Y));
 
   prosca = ((a->Pos.X - b->Pos.X) * (c->Pos.X - b->Pos.X) +
-	    (a->Pos.Y - b->Pos.Y) * (c->Pos.Y - b->Pos.Y)) / L;
+            (a->Pos.Y - b->Pos.Y) * (c->Pos.Y - b->Pos.Y)) / L;
 
   angle = acos (prosca) * 180. / Pi ;
   return (angle);
@@ -436,7 +436,7 @@ double trapeze (IntPoint * P1, IntPoint * P2){
 
 
 void RecursiveIntegration (IntPoint * from, IntPoint * to, double (*f) (double X),
-			   List_T * pPoints, double Prec, int *depth){
+                           List_T * pPoints, double Prec, int *depth){
   IntPoint P, p1;
   double err, val1, val2, val3;
 
@@ -468,7 +468,7 @@ void RecursiveIntegration (IntPoint * from, IntPoint * to, double (*f) (double X
 }
 
 double Integration (double t1, double t2, double (*f) (double X),
-		    List_T * pPoints, double Prec){
+                    List_T * pPoints, double Prec){
   int depth, i;
   IntPoint from, to;
 
diff --git a/Mesh/Numeric.h b/Mesh/Numeric.h
index bd298041ae..e788964a5c 100644
--- a/Mesh/Numeric.h
+++ b/Mesh/Numeric.h
@@ -1,4 +1,4 @@
-/* $Id: Numeric.h,v 1.2 2000-11-23 14:11:35 geuzaine Exp $ */
+/* $Id: Numeric.h,v 1.3 2000-11-26 15:43:47 geuzaine Exp $ */
 #ifndef _NUMERIC_H_
 #define _NUMERIC_H_
 
@@ -14,9 +14,9 @@ int sys3x3 (double mat[3][3], double b[3], double res[3], double *det);
 int det3x3 (double mat[3][3], double *det);
 int inv3x3 (double mat[3][3], double inv[3][3], double *det);
 void find_bestuv (Surface * s, double X, double Y,
-		  double *U, double *V, double *Z, int N);
+                  double *U, double *V, double *Z, int N);
 void XYtoUV (Surface * s, double *X, double *Y,
-	     double *U, double *V, double *Z);
+             double *U, double *V, double *Z);
 void XYZtoUV (Surface *s, double X, double Y, double Z, double *U, double *V);
 int Oriente (List_T * cu, double n[3]);
 double angle_02pi (double A3);
@@ -25,8 +25,8 @@ double angle_plan (Vertex * V, Vertex * P1, Vertex * P2, double n[3]);
 double angle_3pts (Vertex * a, Vertex * b, Vertex * c);
 double trapeze (IntPoint * P1, IntPoint * P2);
 void RecursiveIntegration (IntPoint * from, IntPoint * to, double (*f) (double X),
-			   List_T * pPoints, double Prec, int *depth);
+                           List_T * pPoints, double Prec, int *depth);
 double Integration (double t1, double t2, double (*f) (double X),
-		    List_T * pPoints, double Prec);
+                    List_T * pPoints, double Prec);
 
 #endif
diff --git a/Mesh/Nurbs.cpp b/Mesh/Nurbs.cpp
index 23f0c18246..da0e23230e 100644
--- a/Mesh/Nurbs.cpp
+++ b/Mesh/Nurbs.cpp
@@ -1,10 +1,10 @@
-/* $Id: Nurbs.cpp,v 1.3 2000-11-23 17:16:38 geuzaine Exp $ */
+/* $Id: Nurbs.cpp,v 1.4 2000-11-26 15:43:47 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "Mesh.h"
 
 Vertex InterpolateCubicSpline (Vertex * v[4], double t, double mat[4][4],
-			       int derivee, double t1, double t2){
+                               int derivee, double t1, double t2){
   Vertex V;
   int i, j;
   double vec[4], T[4];
@@ -32,7 +32,7 @@ Vertex InterpolateCubicSpline (Vertex * v[4], double t, double mat[4][4],
   /* X */
   for (i = 0; i < 4; i++){
       for (j = 0; j < 4; j++){
-	vec[i] += mat[i][j] * v[j]->Pos.X;
+        vec[i] += mat[i][j] * v[j]->Pos.X;
       }
   }
 
diff --git a/Mesh/Print_Mesh.cpp b/Mesh/Print_Mesh.cpp
index 609f162b02..e07acd147d 100644
--- a/Mesh/Print_Mesh.cpp
+++ b/Mesh/Print_Mesh.cpp
@@ -1,4 +1,4 @@
-/* $Id: Print_Mesh.cpp,v 1.7 2000-11-25 15:26:11 geuzaine Exp $ */
+/* $Id: Print_Mesh.cpp,v 1.8 2000-11-26 15:43:47 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "Const.h"
@@ -41,10 +41,10 @@ void print_msh_node (void *a, void *b){
   V = (Vertex **) a;
 
   fprintf (mshfile, "%d %.16g %.16g %.16g\n",
-	   (*V)->Num, 
-	   (*V)->Pos.X * CTX.mesh.scaling_factor, 
-	   (*V)->Pos.Y * CTX.mesh.scaling_factor, 
-	   (*V)->Pos.Z * CTX.mesh.scaling_factor);
+           (*V)->Num, 
+           (*V)->Pos.X * CTX.mesh.scaling_factor, 
+           (*V)->Pos.Y * CTX.mesh.scaling_factor, 
+           (*V)->Pos.Z * CTX.mesh.scaling_factor);
 }
 
 void process_msh_nodes (Mesh * M){
@@ -93,11 +93,11 @@ void add_msh_simplex (void *a, void *b){
     nbn = 4;
     if (!MSH_VOL_NUM){
       if ((*S)->VSUP){
-	type = QUADRANGLE_2;
-	nbs = 5;
+        type = QUADRANGLE_2;
+        nbs = 5;
       }
       else
-	type = QUADRANGLE;
+        type = QUADRANGLE;
     }
     else if ((*S)->VSUP){
       type = TETRAHEDRON_2;
@@ -108,7 +108,7 @@ void add_msh_simplex (void *a, void *b){
   }
   
   fprintf (mshfile, "%d %d %d %d %d",
-	   MSH_ELEMENT_NUM++, type,MSH_PHYSICAL_NUM,(*S)->iEnt, nbn + nbs);
+           MSH_ELEMENT_NUM++, type,MSH_PHYSICAL_NUM,(*S)->iEnt, nbn + nbs);
 
   if (MSH_PHYSICAL_ORI > 0){
     for (i = 0; i < nbn; i++)
@@ -149,7 +149,7 @@ void add_msh_hexahedron (void *a, void *b){
     type = HEXAHEDRON;
 
   fprintf (mshfile, "%d %d %d %d %d",
-	   MSH_ELEMENT_NUM++, type, MSH_PHYSICAL_NUM, (*H)->iEnt, nbn + nbs);
+           MSH_ELEMENT_NUM++, type, MSH_PHYSICAL_NUM, (*H)->iEnt, nbn + nbs);
 
   for (i = 0; i < nbn; i++)
     fprintf (mshfile, " %d", (*H)->V[i]->Num);
@@ -183,7 +183,7 @@ void add_msh_prism (void *a, void *b){
   }
 
   fprintf (mshfile, "%d %d %d %d %d",
-	   MSH_ELEMENT_NUM++, type, MSH_PHYSICAL_NUM, (*P)->iEnt, nbn + nbs);
+           MSH_ELEMENT_NUM++, type, MSH_PHYSICAL_NUM, (*P)->iEnt, nbn + nbs);
 
   for (i = 0; i < nbn; i++)
     fprintf (mshfile, " %d", (*P)->V[i]->Num);
@@ -201,7 +201,7 @@ void add_msh_point (Vertex * V){
   }
 
   fprintf (mshfile, "%d %d %d %d 1 %d\n",
-	   MSH_ELEMENT_NUM++, POINT, MSH_PHYSICAL_NUM, V->Num, V->Num);
+           MSH_ELEMENT_NUM++, POINT, MSH_PHYSICAL_NUM, V->Num, V->Num);
 }
 
 void add_msh_elements (Mesh * M){
@@ -223,48 +223,48 @@ void add_msh_elements (Mesh * M){
 
     case MSH_PHYSICAL_VOLUME:
       for (k = 0; k < List_Nbr (ListVolumes); k++){
-	List_Read (ListVolumes, k, &pV);
-	for (j = 0; j < List_Nbr (p->Entities); j++){
-	  List_Read (p->Entities, j, &Num);
-	  MSH_VOL_NUM = abs (Num);
-	  MSH_PHYSICAL_ORI = sign (Num);
-	  Tree_Action (pV->Simplexes, add_msh_simplex);
-	  Tree_Action (pV->Hexahedra, add_msh_hexahedron);
-	  Tree_Action (pV->Prisms, add_msh_prism);
-	}
+        List_Read (ListVolumes, k, &pV);
+        for (j = 0; j < List_Nbr (p->Entities); j++){
+          List_Read (p->Entities, j, &Num);
+          MSH_VOL_NUM = abs (Num);
+          MSH_PHYSICAL_ORI = sign (Num);
+          Tree_Action (pV->Simplexes, add_msh_simplex);
+          Tree_Action (pV->Hexahedra, add_msh_hexahedron);
+          Tree_Action (pV->Prisms, add_msh_prism);
+        }
       }
       break;
 
     case MSH_PHYSICAL_SURFACE:
       for (j = 0; j < List_Nbr (p->Entities); j++){
-	ps = &s;
-	List_Read (p->Entities, j, &Num);
-	ps->Num = abs (Num);
-	MSH_PHYSICAL_ORI = sign (Num);
-	if (Tree_Query (M->Surfaces, &ps))
-	  Tree_Action (ps->Simplexes, add_msh_simplex);
+        ps = &s;
+        List_Read (p->Entities, j, &Num);
+        ps->Num = abs (Num);
+        MSH_PHYSICAL_ORI = sign (Num);
+        if (Tree_Query (M->Surfaces, &ps))
+          Tree_Action (ps->Simplexes, add_msh_simplex);
       }
       break;
       
     case MSH_PHYSICAL_LINE:
       for (j = 0; j < List_Nbr (p->Entities); j++){
-	pc = &c;
-	List_Read (p->Entities, j, &Num);
-	pc->Num = abs (Num);
-	MSH_PHYSICAL_ORI = sign (Num);
-	if (Tree_Query (M->Curves, &pc))
-	  Tree_Action (pc->Simplexes, add_msh_simplex);
+        pc = &c;
+        List_Read (p->Entities, j, &Num);
+        pc->Num = abs (Num);
+        MSH_PHYSICAL_ORI = sign (Num);
+        if (Tree_Query (M->Curves, &pc))
+          Tree_Action (pc->Simplexes, add_msh_simplex);
       }
       break;
       
     case MSH_PHYSICAL_POINT:
       for (j = 0; j < List_Nbr (p->Entities); j++){
-	pv = &v;
-	List_Read (p->Entities, j, &Num);
-	pv->Num = abs (Num);
-	MSH_PHYSICAL_ORI = sign (Num);
-	if (Tree_Query (M->Vertices, &pv))
-	  add_msh_point (pv);
+        pv = &v;
+        List_Read (p->Entities, j, &Num);
+        pv->Num = abs (Num);
+        MSH_PHYSICAL_ORI = sign (Num);
+        if (Tree_Query (M->Vertices, &pv))
+          add_msh_point (pv);
       }
       break;
       
@@ -280,7 +280,7 @@ void process_msh_elements (Mesh * M){
   fprintf (mshfile, "%d\n", MSH_ELEMENT_NUM - 1);
 
   if (MSH_ELEMENT_NUM == 1)
-    Msg (WARNING, "No Elements to Save (Did You Forget to Define Physical Entities?)");
+    Msg (WARNING, "No Elements (Did You Forget to Define Physical Entities?)");
 
   MSH_ADD = 1;
   MSH_ELEMENT_NUM = 1;
@@ -309,7 +309,7 @@ void process_msh_elements (Mesh * M){
 #define THINSHLL     91
 #define THINSHLL2    92
 #define QUAD         94
-#define QUAD2        95		/* Ca c'est une impro !!! */
+#define QUAD2        95         /* Ca c'est une impro !!! */
 #define SOLIDFEM     111
 #define WEDGE        112
 #define BRICK        115
@@ -371,7 +371,7 @@ int process_2D_elements (FILE * funv, Mesh * m){
     for (j = 0; j < List_Nbr (vol->Surfaces); j++){
       List_Read (vol->Surfaces, j, &s);
       if (Tree_Nbr (s->Simplexes))
-	List_Add (AllSurfaces, &s);
+        List_Add (AllSurfaces, &s);
     }
   }
 
@@ -380,49 +380,49 @@ int process_2D_elements (FILE * funv, Mesh * m){
     if (!List_Search (AllSurfaces, &s, compareSurface)){
       Elements = Tree2List (s->Simplexes);
       for (j = 0; j < List_Nbr (Elements); j++){
-	List_Read (Elements, j, &sx);
-	if (sx->V[3]){
-	  if (sx->VSUP){
-	    fetyp = QUAD;
-	    n = 4;
-	    nsup = 4;
-	  }
-	  else{
-	    fetyp = QUAD;
-	    n = 4;
-	    nsup = 0;
-	  }
-	}
-	else{
-	  if (sx->VSUP){
-	    fetyp = THINSHLL;
-	    n = 3;
-	    nsup = 3;
-	  }
-	  else{
-	    fetyp = THINSHLL;
-	    nsup = 0;
-	    n = 3;
-	  }
-	}
-	geo = s->Num;
-	fprintf (funv, "%10d%10d%10d%10d%10d%10d\n", 
-		 /*ELEMENT_ID++ */ sx->Num, fetyp, geo, geo, 7, n + nsup);
-	ntot = 0;
-	for (k = 0; k < n; k++){
-	  fprintf (funv, "%10d", sx->V[k]->Num);
-	  if (ntot % 8 == 7)
-	    fprintf (funv, "\n");
-	  ntot++;
-	}
-	for (k = 0; k < nsup; k++){
-	  fprintf (funv, "%10d", sx->VSUP[k]->Num);
-	  if (ntot % 8 == 7)
-	    fprintf (funv, "\n");
-	  ntot++;
-	}
-	if (ntot - 1 % 8 != 7)
-	  fprintf (funv, "\n");
+        List_Read (Elements, j, &sx);
+        if (sx->V[3]){
+          if (sx->VSUP){
+            fetyp = QUAD;
+            n = 4;
+            nsup = 4;
+          }
+          else{
+            fetyp = QUAD;
+            n = 4;
+            nsup = 0;
+          }
+        }
+        else{
+          if (sx->VSUP){
+            fetyp = THINSHLL;
+            n = 3;
+            nsup = 3;
+          }
+          else{
+            fetyp = THINSHLL;
+            nsup = 0;
+            n = 3;
+          }
+        }
+        geo = s->Num;
+        fprintf (funv, "%10d%10d%10d%10d%10d%10d\n", 
+                 /*ELEMENT_ID++ */ sx->Num, fetyp, geo, geo, 7, n + nsup);
+        ntot = 0;
+        for (k = 0; k < n; k++){
+          fprintf (funv, "%10d", sx->V[k]->Num);
+          if (ntot % 8 == 7)
+            fprintf (funv, "\n");
+          ntot++;
+        }
+        for (k = 0; k < nsup; k++){
+          fprintf (funv, "%10d", sx->VSUP[k]->Num);
+          if (ntot % 8 == 7)
+            fprintf (funv, "\n");
+          ntot++;
+        }
+        if (ntot - 1 % 8 != 7)
+          fprintf (funv, "\n");
       }
       List_Delete (Elements);
       nbtri += Tree_Nbr (s->Simplexes);
@@ -449,10 +449,10 @@ int process_1D_elements (FILE * funv, Mesh * m){
     for (j = 0; j < List_Nbr (surf->s.Generatrices); j++){
       List_Read (surf->s.Generatrices, j, &c);
       if (Tree_Nbr (c->Simplexes))
-	List_Add (AllCurves, &c);
+        List_Add (AllCurves, &c);
       c = FindCurve (-c->Num, m);
       if (Tree_Nbr (c->Simplexes))
-	List_Add (AllCurves, &c);
+        List_Add (AllCurves, &c);
     }
   }
 
@@ -461,37 +461,37 @@ int process_1D_elements (FILE * funv, Mesh * m){
     if (!List_Search (AllCurves, &c, compareCurve)){
       Elements = Tree2List (c->Simplexes);
       for (j = 0; j < List_Nbr (Elements); j++){
-	nblig++;
-	List_Read (Elements, j, &sx);
-	if (sx->VSUP){
-	  fetyp = BEAM2;
-	  n = 2;
-	  nsup = 2;
-	}
-	else{
-	  fetyp = BEAM;
-	  n = 2;
-	  nsup = 0;
-	}
-	geo = c->Num;
-	fprintf (funv, "%10d%10d%10d%10d%10d%10d\n", 
-		 /*ELEMENT_ID++ */ sx->Num, fetyp, geo, geo, 7, n + nsup);
-	ntot = 0;
-	fprintf (funv, "%10d%10d%10d\n", 0, 0, 0);
-	for (k = 0; k < n; k++){
-	  fprintf (funv, "%10d", sx->V[k]->Num);
-	  if (ntot % 8 == 7)
-	    fprintf (funv, "\n");
-	  ntot++;
-	}
-	for (k = 0; k < nsup; k++){
-	  fprintf (funv, "%10d", sx->VSUP[k]->Num);
-	  if (ntot % 8 == 7)
-	    fprintf (funv, "\n");
-	  ntot++;
-	}
-	if (ntot - 1 % 8 != 7)
-	  fprintf (funv, "\n");
+        nblig++;
+        List_Read (Elements, j, &sx);
+        if (sx->VSUP){
+          fetyp = BEAM2;
+          n = 2;
+          nsup = 2;
+        }
+        else{
+          fetyp = BEAM;
+          n = 2;
+          nsup = 0;
+        }
+        geo = c->Num;
+        fprintf (funv, "%10d%10d%10d%10d%10d%10d\n", 
+                 /*ELEMENT_ID++ */ sx->Num, fetyp, geo, geo, 7, n + nsup);
+        ntot = 0;
+        fprintf (funv, "%10d%10d%10d\n", 0, 0, 0);
+        for (k = 0; k < n; k++){
+          fprintf (funv, "%10d", sx->V[k]->Num);
+          if (ntot % 8 == 7)
+            fprintf (funv, "\n");
+          ntot++;
+        }
+        for (k = 0; k < nsup; k++){
+          fprintf (funv, "%10d", sx->VSUP[k]->Num);
+          if (ntot % 8 == 7)
+            fprintf (funv, "\n");
+          ntot++;
+        }
+        if (ntot - 1 % 8 != 7)
+          fprintf (funv, "\n");
       }
       
       List_Delete (Elements);
@@ -519,41 +519,41 @@ int process_3D_elements (FILE * funv, Mesh * m){
     for (j = 0; j < List_Nbr (Elements); j++){
       List_Read (Elements, j, &sx);
       if (sx->VSUP){
-	fetyp = SOLIDFEM;
-	n = 4;
-	nsup = 6;
+        fetyp = SOLIDFEM;
+        n = 4;
+        nsup = 6;
       }
       else{
-	fetyp = SOLIDFEM;
-	nsup = 0;
-	n = 4;
+        fetyp = SOLIDFEM;
+        nsup = 0;
+        n = 4;
       }
       if (sx->Volume_Simplexe () < 0){
-	Vertex *temp;
-	temp = sx->V[0];
-	sx->V[0] = sx->V[1];
-	sx->V[1] = temp;
-	if (sx->Volume_Simplexe () < 0)
-	  Msg(WARNING, "Negative Volume for Simplex %d", sx->Num);
+        Vertex *temp;
+        temp = sx->V[0];
+        sx->V[0] = sx->V[1];
+        sx->V[1] = temp;
+        if (sx->Volume_Simplexe () < 0)
+          Msg(WARNING, "Negative Volume for Simplex %d", sx->Num);
       }
       geo = v->Num;
       fprintf (funv, "%10d%10d%10d%10d%10d%10d\n",
-	       ELEMENT_ID++, fetyp, geo, geo, 7, n + nsup);
+               ELEMENT_ID++, fetyp, geo, geo, 7, n + nsup);
       ntot = 0;
       for (k = 0; k < n; k++){
-	fprintf (funv, "%10d", sx->V[k]->Num);
-	if (ntot % 8 == 7)
-	  fprintf (funv, "\n");
-	ntot++;
+        fprintf (funv, "%10d", sx->V[k]->Num);
+        if (ntot % 8 == 7)
+          fprintf (funv, "\n");
+        ntot++;
       }
       for (k = 0; k < nsup; k++){
-	fprintf (funv, "%10d", sx->VSUP[k]->Num);
-	if (ntot % 8 == 7)
-	  fprintf (funv, "\n");
-	ntot++;
+        fprintf (funv, "%10d", sx->VSUP[k]->Num);
+        if (ntot % 8 == 7)
+          fprintf (funv, "\n");
+        ntot++;
       }
       if (ntot - 1 % 8 != 7)
-	fprintf (funv, "\n");
+        fprintf (funv, "\n");
     }
     List_Delete (Elements);
     nb += Tree_Nbr (v->Simplexes);
@@ -563,34 +563,34 @@ int process_3D_elements (FILE * funv, Mesh * m){
     for (j = 0; j < List_Nbr (Elements); j++){
       List_Read (Elements, j, &px);
       if (px->VSUP){
-	fetyp = WEDGE;
-	n = 6;
-	nsup = 9;
+        fetyp = WEDGE;
+        n = 6;
+        nsup = 9;
       }
       else{
-	fetyp = WEDGE;
-	nsup = 0;
-	n = 6;
+        fetyp = WEDGE;
+        nsup = 0;
+        n = 6;
       }
       
       geo = v->Num;
       fprintf (funv, "%10d%10d%10d%10d%10d%10d\n", 
-	       ELEMENT_ID++, fetyp, geo, geo, 7, n + nsup);
+               ELEMENT_ID++, fetyp, geo, geo, 7, n + nsup);
       ntot = 0;
       for (k = 0; k < n; k++){
-	fprintf (funv, "%10d", px->V[k]->Num);
-	if (ntot % 8 == 7)
-	  fprintf (funv, "\n");
-	ntot++;
+        fprintf (funv, "%10d", px->V[k]->Num);
+        if (ntot % 8 == 7)
+          fprintf (funv, "\n");
+        ntot++;
       }
       for (k = 0; k < nsup; k++){
-	fprintf (funv, "%10d", px->VSUP[k]->Num);
-	if (ntot % 8 == 7)
-	  fprintf (funv, "\n");
-	ntot++;
+        fprintf (funv, "%10d", px->VSUP[k]->Num);
+        if (ntot % 8 == 7)
+          fprintf (funv, "\n");
+        ntot++;
       }
       if (ntot - 1 % 8 != 7)
-	fprintf (funv, "\n");
+        fprintf (funv, "\n");
     }
     List_Delete (Elements);
     nb += Tree_Nbr (v->Prisms);
@@ -600,34 +600,34 @@ int process_3D_elements (FILE * funv, Mesh * m){
     for (j = 0; j < List_Nbr (Elements); j++){
       List_Read (Elements, j, &hx);
       if (hx->VSUP){
-	fetyp = BRICK;
-	n = 8;
-	nsup = 12;
+        fetyp = BRICK;
+        n = 8;
+        nsup = 12;
       }
       else{
-	fetyp = BRICK;
-	nsup = 0;
-	n = 8;
+        fetyp = BRICK;
+        nsup = 0;
+        n = 8;
       }
       
       geo = v->Num;
       fprintf (funv, "%10d%10d%10d%10d%10d%10d\n", 
-	       ELEMENT_ID++, fetyp, geo, geo, 7, n + nsup);
+               ELEMENT_ID++, fetyp, geo, geo, 7, n + nsup);
       ntot = 0;
       for (k = 0; k < n; k++){
-	fprintf (funv, "%10d", hx->V[k]->Num);
-	if (ntot % 8 == 7)
-	  fprintf (funv, "\n");
-	ntot++;
+        fprintf (funv, "%10d", hx->V[k]->Num);
+        if (ntot % 8 == 7)
+          fprintf (funv, "\n");
+        ntot++;
       }
       for (k = 0; k < nsup; k++){
-	fprintf (funv, "%10d", hx->VSUP[k]->Num);
-	if (ntot % 8 == 7)
-	  fprintf (funv, "\n");
-	ntot++;
+        fprintf (funv, "%10d", hx->VSUP[k]->Num);
+        if (ntot % 8 == 7)
+          fprintf (funv, "\n");
+        ntot++;
       }
       if (ntot - 1 % 8 != 7)
-	fprintf (funv, "\n");
+        fprintf (funv, "\n");
     }
     List_Delete (Elements);
     nb += Tree_Nbr (v->Hexahedra);
@@ -669,10 +669,10 @@ void PrintGroups (Mesh * m){
       fprintf (unvfile, "LOAD SET %2d\n", 1);
       nb = List_Nbr (p->Entities);
       for (j = 0; j < nb; j++){
-	ps = &s;
-	List_Read (p->Entities, j, &ps->Num);
-	if (Tree_Query (m->Surfaces, &ps))
-	  Tree_Action (ps->Vertices, AddVertex);
+        ps = &s;
+        List_Read (p->Entities, j, &ps->Num);
+        if (Tree_Query (m->Surfaces, &ps))
+          Tree_Action (ps->Vertices, AddVertex);
       }
       fprintf (unvfile, "%6d\n", -1);
       //Tree_Delete(tree);
@@ -686,11 +686,11 @@ void PrintGroups (Mesh * m){
       fprintf (unvfile, "LOAD SET %2d\n", 1);
       nb = List_Nbr (p->Entities);
       for (j = 0; j < nb; j++){
-	pc = &c;
-	List_Read (p->Entities, j, &pc->Num);
-	if (Tree_Query (m->Curves, &pc))
-	  for (k = 0; k < List_Nbr (pc->Vertices); k++)
-	    AddVertex (List_Pointer (pc->Vertices, k), NULL);
+        pc = &c;
+        List_Read (p->Entities, j, &pc->Num);
+        if (Tree_Query (m->Curves, &pc))
+          for (k = 0; k < List_Nbr (pc->Vertices); k++)
+            AddVertex (List_Pointer (pc->Vertices, k), NULL);
       }
       fprintf (unvfile, "%6d\n", -1);
       //Tree_Delete(tree);
@@ -703,10 +703,10 @@ void PrintGroups (Mesh * m){
       fprintf (unvfile, "LOAD SET %2d\n", 1);
       nb = List_Nbr (p->Entities);
       for (j = 0; j < nb; j++){
-	pv = &v;
-	List_Read (p->Entities, j, &pv->Num);
-	if (Tree_Query (m->Vertices, &pv))
-	  AddVertex (&pv, NULL);
+        pv = &v;
+        List_Read (p->Entities, j, &pv->Num);
+        if (Tree_Query (m->Vertices, &pv))
+          AddVertex (&pv, NULL);
       }
       fprintf (unvfile, "%6d\n", -1);
       //Tree_Delete(tree);
@@ -728,7 +728,7 @@ static int compareFrozen (const void *a, const void *b){
 }
 
 int process_Gref_nodes (FILE * fGref, Mesh * M,
-			Tree_T * ConsecutiveNTree, Tree_T * ConsecutiveETree){
+                        Tree_T * ConsecutiveNTree, Tree_T * ConsecutiveETree){
   int i, nbtri;
   Vertex *v;
   Surface *s;
@@ -754,7 +754,7 @@ int process_Gref_nodes (FILE * fGref, Mesh * M,
   ConsecutiveNodes (M, ConsecutiveNTree, ConsecutiveETree);
 
   fprintf (fGref, "%d %d %d\n", nbtri, Tree_Nbr (ConsecutiveNTree),
-	   Tree_Nbr (ConsecutiveNTree) + Tree_Nbr (ConsecutiveETree));
+           Tree_Nbr (ConsecutiveNTree) + Tree_Nbr (ConsecutiveETree));
 
   Nodes = Tree2List (ConsecutiveNTree);
   for (i = 0; i < List_Nbr (Nodes); i++){
@@ -786,30 +786,29 @@ int find_physicalentity (Vertex * v, Mesh * m){
     List_Read (m->PhysicalGroups, i, &p);
     if (p->Typ == MSH_PHYSICAL_POINT){
       if (List_Search (p->Entities, &v->Num, fcmp_absint)){
-	return p->Num;
+        return p->Num;
       }
     }
   }
   
   if (v->ListCurves){
-
-      for (i = 0; i < List_Nbr (m->PhysicalGroups); i++){
-	List_Read (m->PhysicalGroups, i, &p);
-	if (p->Typ == MSH_PHYSICAL_LINE){
-	  for (j = 0; j < List_Nbr (v->ListCurves); j++){
-	    List_Read (v->ListCurves, j, &c);
-	    if (List_Search (p->Entities, &c->Num, fcmp_absint)){
-	      return p->Num;
-	    }
-	  }
-	}
+    for (i = 0; i < List_Nbr (m->PhysicalGroups); i++){
+      List_Read (m->PhysicalGroups, i, &p);
+      if (p->Typ == MSH_PHYSICAL_LINE){
+        for (j = 0; j < List_Nbr (v->ListCurves); j++){
+          List_Read (v->ListCurves, j, &c);
+          if (List_Search (p->Entities, &c->Num, fcmp_absint)){
+            return p->Num;
+          }
+        }
       }
+    }
   }
   return 0;
 }
 
 void process_Gref_poundarybonditions (FILE * fGref, Mesh * M,
-				      Tree_T * TRN, Tree_T * TRE){
+                                      Tree_T * TRN, Tree_T * TRE){
   int i, ent;
   Vertex *v;
 
@@ -852,12 +851,13 @@ void process_Gref_elements (FILE * fGref, Mesh * M, int nn){
     for (j = 0; j < List_Nbr (Triangles); j++){
       List_Read (Triangles, j, &sx);
       if (!sx->V[3])
-	fprintf (fGref, "%d %d %d\n", -sx->V[0]->Frozen, -sx->V[1]->Frozen, -sx->V[2]->Frozen);
+        fprintf (fGref, "%d %d %d\n", -sx->V[0]->Frozen, 
+                 -sx->V[1]->Frozen, -sx->V[2]->Frozen);
       else
-	fprintf (fGref, "%d %d %d %d\n", -sx->V[0]->Frozen,
-		 -sx->V[1]->Frozen,
-		 -sx->V[2]->Frozen,
-		 -sx->V[3]->Frozen);
+        fprintf (fGref, "%d %d %d %d\n", -sx->V[0]->Frozen,
+                 -sx->V[1]->Frozen,
+                 -sx->V[2]->Frozen,
+                 -sx->V[3]->Frozen);
       
     }
     List_Delete (Triangles);
@@ -869,14 +869,14 @@ void process_Gref_elements (FILE * fGref, Mesh * M, int nn){
     for (j = 0; j < List_Nbr (Triangles); j++){
       List_Read (Triangles, j, &sx);
       if (!sx->V[3])
-	fprintf (fGref, "%d %d %d\n", -sx->VSUP[0]->Frozen - nn,
-		 -sx->VSUP[1]->Frozen - nn,
-		 -sx->VSUP[2]->Frozen - nn);
+        fprintf (fGref, "%d %d %d\n", -sx->VSUP[0]->Frozen - nn,
+                 -sx->VSUP[1]->Frozen - nn,
+                 -sx->VSUP[2]->Frozen - nn);
       else
-	fprintf (fGref, "%d %d %d %d\n", -sx->VSUP[0]->Frozen - nn,
-		 -sx->VSUP[1]->Frozen - nn,
-		 -sx->VSUP[2]->Frozen - nn,
-		 -sx->VSUP[3]->Frozen - nn);
+        fprintf (fGref, "%d %d %d %d\n", -sx->VSUP[0]->Frozen - nn,
+                 -sx->VSUP[1]->Frozen - nn,
+                 -sx->VSUP[2]->Frozen - nn,
+                 -sx->VSUP[3]->Frozen - nn);
     }
     List_Delete (Triangles);
   }
@@ -887,37 +887,37 @@ void process_Gref_elements (FILE * fGref, Mesh * M, int nn){
     for (j = 0; j < List_Nbr (Triangles); j++){
       List_Read (Triangles, j, &sx);
       if (!sx->V[3])
-	fprintf (fGref, "%d %d %d %d %d %d %d %d %d %d %d %d\n",
-		 -2 * sx->V[0]->Frozen - 1,
-		 -2 * sx->V[0]->Frozen,
-		 -2 * sx->VSUP[0]->Frozen - 1,
-		 -2 * sx->VSUP[0]->Frozen,
-		 -2 * sx->V[1]->Frozen - 1,
-		 -2 * sx->V[1]->Frozen,
-		 -2 * sx->VSUP[1]->Frozen - 1,
-		 -2 * sx->VSUP[1]->Frozen,
-		 -2 * sx->V[2]->Frozen - 1,
-		 -2 * sx->V[2]->Frozen,
-		 -2 * sx->VSUP[2]->Frozen - 1,
-		 -2 * sx->VSUP[2]->Frozen);
+        fprintf (fGref, "%d %d %d %d %d %d %d %d %d %d %d %d\n",
+                 -2 * sx->V[0]->Frozen - 1,
+                 -2 * sx->V[0]->Frozen,
+                 -2 * sx->VSUP[0]->Frozen - 1,
+                 -2 * sx->VSUP[0]->Frozen,
+                 -2 * sx->V[1]->Frozen - 1,
+                 -2 * sx->V[1]->Frozen,
+                 -2 * sx->VSUP[1]->Frozen - 1,
+                 -2 * sx->VSUP[1]->Frozen,
+                 -2 * sx->V[2]->Frozen - 1,
+                 -2 * sx->V[2]->Frozen,
+                 -2 * sx->VSUP[2]->Frozen - 1,
+                 -2 * sx->VSUP[2]->Frozen);
       else
-	fprintf (fGref, "%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d\n",
-		 -2 * sx->V[0]->Frozen - 1,
-		 -2 * sx->V[0]->Frozen,
-		 -2 * sx->VSUP[0]->Frozen - 1,
-		 -2 * sx->VSUP[0]->Frozen,
-		 -2 * sx->V[1]->Frozen - 1,
-		 -2 * sx->V[1]->Frozen,
-		 -2 * sx->VSUP[1]->Frozen - 1,
-		 -2 * sx->VSUP[1]->Frozen,
-		 -2 * sx->V[2]->Frozen - 1,
-		 -2 * sx->V[2]->Frozen,
-		 -2 * sx->VSUP[2]->Frozen - 1,
-		 -2 * sx->VSUP[2]->Frozen,
-		 -2 * sx->V[3]->Frozen - 1,
-		 -2 * sx->V[3]->Frozen,
-		 -2 * sx->VSUP[3]->Frozen - 1,
-		 -2 * sx->VSUP[3]->Frozen);
+        fprintf (fGref, "%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d\n",
+                 -2 * sx->V[0]->Frozen - 1,
+                 -2 * sx->V[0]->Frozen,
+                 -2 * sx->VSUP[0]->Frozen - 1,
+                 -2 * sx->VSUP[0]->Frozen,
+                 -2 * sx->V[1]->Frozen - 1,
+                 -2 * sx->V[1]->Frozen,
+                 -2 * sx->VSUP[1]->Frozen - 1,
+                 -2 * sx->VSUP[1]->Frozen,
+                 -2 * sx->V[2]->Frozen - 1,
+                 -2 * sx->V[2]->Frozen,
+                 -2 * sx->VSUP[2]->Frozen - 1,
+                 -2 * sx->VSUP[2]->Frozen,
+                 -2 * sx->V[3]->Frozen - 1,
+                 -2 * sx->V[3]->Frozen,
+                 -2 * sx->VSUP[3]->Frozen - 1,
+                 -2 * sx->VSUP[3]->Frozen);
     }
     List_Delete (Triangles);
   }
@@ -943,14 +943,14 @@ void ConsecutiveNodes (Mesh * M, Tree_T * ConsecutiveNTree, Tree_T * Consecutive
     for (j = 0; j < List_Nbr (Triangles); j++){
       List_Read (Triangles, j, &sx);
       if (!sx->V[3])
-	N = 3;
+        N = 3;
       else
-	N = 4;
+        N = 4;
       for (k = 0; k < N; k++){
-	if (sx->V[k]->Frozen >= 0){
-	  sx->V[k]->Frozen = --newnum;
-	  Tree_Insert (ConsecutiveNTree, &(sx->V[k]));
-	}
+        if (sx->V[k]->Frozen >= 0){
+          sx->V[k]->Frozen = --newnum;
+          Tree_Insert (ConsecutiveNTree, &(sx->V[k]));
+        }
       }
     }
     List_Delete (Triangles);
@@ -963,14 +963,14 @@ void ConsecutiveNodes (Mesh * M, Tree_T * ConsecutiveNTree, Tree_T * Consecutive
     for (j = 0; j < List_Nbr (Triangles); j++){
       List_Read (Triangles, j, &sx);
       if (!sx->V[3])
-	N = 3;
+        N = 3;
       else
-	N = 4;
+        N = 4;
       for (k = 0; k < N; k++){
-	if (sx->VSUP[k]->Frozen >= 0){
-	  sx->VSUP[k]->Frozen = --newnum;
-	  Tree_Insert (ConsecutiveETree, &(sx->VSUP[k]));
-	}
+        if (sx->VSUP[k]->Frozen >= 0){
+          sx->VSUP[k]->Frozen = --newnum;
+          Tree_Insert (ConsecutiveETree, &(sx->VSUP[k]));
+        }
       }
     }
     List_Delete (Triangles);
@@ -995,13 +995,13 @@ void EndConsecutiveNodes (Mesh * M){
     for (j = 0; j < List_Nbr (Triangles); j++){
       List_Read (Triangles, j, &sx);
       if (!sx->V[3])
-	N = 3;
+        N = 3;
       else
-	N = 4;
+        N = 4;
       for (k = 0; k < N; k++)
-	sx->V[k]->Frozen = 0;
+        sx->V[k]->Frozen = 0;
       for (k = 0; k < N; k++)
-	sx->VSUP[k]->Frozen = 0;
+        sx->VSUP[k]->Frozen = 0;
     }
     List_Delete (Triangles);
   }
@@ -1026,7 +1026,8 @@ void Print_Mesh (Mesh * M, char *c, int Type){
     Msg (INFOS, "Writing File '%s'", name);
     process_msh_nodes (M);
     process_msh_elements (M);
-    Msg (INFOS, "Wrote %d Nodes, %d Elements", MSH_NODE_NUM, MSH_ELEMENT_NUM - 1);
+    Msg (INFOS, "Msh Ouput Complete '%s' (%d Nodes, %d Elements)",
+         name, MSH_NODE_NUM, MSH_ELEMENT_NUM - 1);
     Msg (INFO, "Wrote File '%s'", name);
     fclose (mshfile);
   }
@@ -1048,6 +1049,7 @@ void Print_Mesh (Mesh * M, char *c, int Type){
     fprintf (unvfile, "%6d\n", -1);
     PrintGroups (M);
     fclose (unvfile);
+    Msg (INFOS, "Unv Ouput Complete '%s'", name);
     Msg (INFO, "Wrote File '%s'", name);
   }
   else if (Type == FORMAT_GREF){
@@ -1067,6 +1069,7 @@ void Print_Mesh (Mesh * M, char *c, int Type){
     Tree_Delete (TRN);
     Tree_Delete (TRE);
     EndConsecutiveNodes (M);
+    Msg (INFOS, "Gref Ouput Complete '%s'", name);
     Msg (INFO, "Wrote File '%s'", name);
   }
 }
diff --git a/Mesh/Read_Mesh.cpp b/Mesh/Read_Mesh.cpp
index edc2fd716e..2346ea766a 100644
--- a/Mesh/Read_Mesh.cpp
+++ b/Mesh/Read_Mesh.cpp
@@ -1,4 +1,4 @@
-/* $Id: Read_Mesh.cpp,v 1.2 2000-11-23 14:11:35 geuzaine Exp $ */
+/* $Id: Read_Mesh.cpp,v 1.3 2000-11-26 15:43:47 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "Geo.h"
@@ -60,9 +60,9 @@ void Read_Mesh_MSH (Mesh *M, FILE *File_GEO){
       Msg(INFOS, "%d Points", Nbr_Nodes);
 
       for (i_Node = 0 ; i_Node < Nbr_Nodes ; i_Node++) {
-	fscanf(File_GEO, "%d %lf %lf %lf %lf %lf", &Num, &x, &y, &z, &lc1, &lc2) ;
-	vert = Create_Vertex (Num, x, y, z, lc1 , lc2);
-	Tree_Replace(M->Points, &vert) ;
+        fscanf(File_GEO, "%d %lf %lf %lf %lf %lf", &Num, &x, &y, &z, &lc1, &lc2) ;
+        vert = Create_Vertex (Num, x, y, z, lc1 , lc2);
+        Tree_Replace(M->Points, &vert) ;
       }
     }
 
@@ -74,9 +74,9 @@ void Read_Mesh_MSH (Mesh *M, FILE *File_GEO){
       Msg(INFOS, "%d Nodes", Nbr_Nodes);
 
       for (i_Node = 0 ; i_Node < Nbr_Nodes ; i_Node++) {
-	fscanf(File_GEO, "%d %lf %lf %lf", &Num, &x, &y, &z) ;
-	vert = Create_Vertex (Num, x, y, z, 1.0 ,0.0);
-	Tree_Replace(M->Vertices, &vert) ;
+        fscanf(File_GEO, "%d %lf %lf %lf", &Num, &x, &y, &z) ;
+        vert = Create_Vertex (Num, x, y, z, 1.0 ,0.0);
+        Tree_Replace(M->Vertices, &vert) ;
       }
     }
 
@@ -88,105 +88,105 @@ void Read_Mesh_MSH (Mesh *M, FILE *File_GEO){
       Msg(INFOS, "%d Elements", Nbr_Elements);
 
       for (i_Element = 0 ; i_Element < Nbr_Elements ; i_Element++) {
-	
-	fscanf(File_GEO, "%d %d %d %d %d", 
-	       &Num, &Type, &Physical, &Elementary, &Nbr_Nodes) ;
-	
-	for (j = 0 ; j < Nbr_Nodes ; j++)
-	  fscanf(File_GEO, "%d", &verts[j].Num) ;
-	
-	switch(Type){
-	case LGN1: case LGN2:
-	  c = &C; c->Num = Elementary;
-	  if(!(cc = (Curve**)Tree_PQuery(M->Curves, &c))){
-	    c = Create_Curve(Elementary, MSH_SEGM_LINE, 0, NULL,
-			     NULL, 0, 1, 0., 1.);
-	    Tree_Add(M->Curves, &c);
-	  }
-	  else
-	    c = *cc;
-	  break;
-	case TRI1: case QUA1: case TRI2: case QUA2:
-	  s = &S; s->Num = Elementary;
-	  if(!(ss = (Surface**)Tree_PQuery(M->Surfaces, &s))){
-	    s = Create_Surface(Elementary, MSH_SURF_PLAN, Elementary);
-	    Tree_Add(M->Surfaces, &s);
-	  }
-	  else
-	    s = *ss;
-	  break;
-	case TET1: case HEX1: case PRI1: case TET2: case HEX2: case PRI2: 
-	  v = &V; v->Num = Elementary;
-	  if(!(vv = (Volume**)Tree_PQuery(M->Volumes, &v))){
-	    v = Create_Volume(Elementary, MSH_VOLUME, Elementary);
-	    Tree_Add(M->Volumes, &v);
-	  }
-	  else
-	    v = *vv;
-	  break;
-	default :
-	  break;
-	}
-
-	for(i=0 ; i<Nbr_Nodes ; i++) {
-	  vertsp[i] = &verts[i];
-	  if(!(vertspp = (Vertex**)Tree_PQuery(M->Vertices, &vertsp[i])))
-	    Msg(ERROR, "Unknown Vertex %d in Element %d", verts[i].Num, Num);
-	  else
-	    vertsp[i] = *vertspp;
-	}
-
-	switch(Type){
-	case LGN1:
-	  simp = Create_Simplex(vertsp[0], vertsp[1], NULL , NULL);
-	  simp->Num = Num ;
-	  simp->iEnt = Elementary ;
-	  Tree_Insert(c->Simplexes, &simp) ;
-	  Tree_Insert(M->Simplexes, &simp) ; 
-	  break;
-	case TRI1:
-	  simp = Create_Simplex(vertsp[0], vertsp[1], vertsp[2], NULL);
-	  simp->Num = Num ;
-	  simp->iEnt = Elementary ;
-	  Tree_Insert(s->Simplexes, &simp) ;
-	  Tree_Insert(M->Simplexes, &simp) ;
-	  break;
-	case QUA1:
-	  /* ! Fuck, fuck, fuck */
-	  simp = Create_Simplex(vertsp[0], vertsp[1], vertsp[2], NULL);
-	  simp->V[3] = vertsp[3];
-	  simp->Num = Num ;
-	  simp->iEnt = Elementary ;
-	  Tree_Insert(s->Simplexes, &simp) ;
-	  Tree_Insert(M->Simplexes, &simp) ;
-	  break;
-	case TET1:
-	  simp = Create_Simplex(vertsp[0], vertsp[1], vertsp[2], vertsp[3]);
-	  simp->Num = Num ;
-	  simp->iEnt = Elementary ;
-	  Tree_Insert(v->Simplexes, &simp) ;
-	  Tree_Insert(M->Simplexes, &simp) ;
-	  break;
-	case HEX1:
-	  hex = Create_Hexahedron(vertsp[0], vertsp[1], vertsp[2], vertsp[3],
-				  vertsp[4], vertsp[5], vertsp[6], vertsp[7]);
-	  hex->Num = Num ;
-	  hex->iEnt = Elementary ;
-	  Tree_Insert(v->Hexahedra, &hex) ;
-	  break;
-	case PRI1:
-	  pri = Create_Prism(vertsp[0], vertsp[1], vertsp[2], 
-			     vertsp[3], vertsp[4], vertsp[5]);
-	  pri->Num = Num ;
-	  pri->iEnt = Elementary ;
-	  Tree_Insert(v->Prisms, &pri) ;
-	  break;
-	case PNT:
-	  break;
-	default :
-	  Msg(WARNING, "Unknown Type of Element in Read_Mesh");
-	  break;
-	}
+        
+        fscanf(File_GEO, "%d %d %d %d %d", 
+               &Num, &Type, &Physical, &Elementary, &Nbr_Nodes) ;
+        
+        for (j = 0 ; j < Nbr_Nodes ; j++)
+          fscanf(File_GEO, "%d", &verts[j].Num) ;
+        
+        switch(Type){
+        case LGN1: case LGN2:
+          c = &C; c->Num = Elementary;
+          if(!(cc = (Curve**)Tree_PQuery(M->Curves, &c))){
+            c = Create_Curve(Elementary, MSH_SEGM_LINE, 0, NULL,
+                             NULL, 0, 1, 0., 1.);
+            Tree_Add(M->Curves, &c);
+          }
+          else
+            c = *cc;
+          break;
+        case TRI1: case QUA1: case TRI2: case QUA2:
+          s = &S; s->Num = Elementary;
+          if(!(ss = (Surface**)Tree_PQuery(M->Surfaces, &s))){
+            s = Create_Surface(Elementary, MSH_SURF_PLAN, Elementary);
+            Tree_Add(M->Surfaces, &s);
+          }
+          else
+            s = *ss;
+          break;
+        case TET1: case HEX1: case PRI1: case TET2: case HEX2: case PRI2: 
+          v = &V; v->Num = Elementary;
+          if(!(vv = (Volume**)Tree_PQuery(M->Volumes, &v))){
+            v = Create_Volume(Elementary, MSH_VOLUME, Elementary);
+            Tree_Add(M->Volumes, &v);
+          }
+          else
+            v = *vv;
+          break;
+        default :
+          break;
+        }
+
+        for(i=0 ; i<Nbr_Nodes ; i++) {
+          vertsp[i] = &verts[i];
+          if(!(vertspp = (Vertex**)Tree_PQuery(M->Vertices, &vertsp[i])))
+            Msg(ERROR, "Unknown Vertex %d in Element %d", verts[i].Num, Num);
+          else
+            vertsp[i] = *vertspp;
+        }
+
+        switch(Type){
+        case LGN1:
+          simp = Create_Simplex(vertsp[0], vertsp[1], NULL , NULL);
+          simp->Num = Num ;
+          simp->iEnt = Elementary ;
+          Tree_Insert(c->Simplexes, &simp) ;
+          Tree_Insert(M->Simplexes, &simp) ; 
+          break;
+        case TRI1:
+          simp = Create_Simplex(vertsp[0], vertsp[1], vertsp[2], NULL);
+          simp->Num = Num ;
+          simp->iEnt = Elementary ;
+          Tree_Insert(s->Simplexes, &simp) ;
+          Tree_Insert(M->Simplexes, &simp) ;
+          break;
+        case QUA1:
+          /* ! Fuck, fuck, fuck */
+          simp = Create_Simplex(vertsp[0], vertsp[1], vertsp[2], NULL);
+          simp->V[3] = vertsp[3];
+          simp->Num = Num ;
+          simp->iEnt = Elementary ;
+          Tree_Insert(s->Simplexes, &simp) ;
+          Tree_Insert(M->Simplexes, &simp) ;
+          break;
+        case TET1:
+          simp = Create_Simplex(vertsp[0], vertsp[1], vertsp[2], vertsp[3]);
+          simp->Num = Num ;
+          simp->iEnt = Elementary ;
+          Tree_Insert(v->Simplexes, &simp) ;
+          Tree_Insert(M->Simplexes, &simp) ;
+          break;
+        case HEX1:
+          hex = Create_Hexahedron(vertsp[0], vertsp[1], vertsp[2], vertsp[3],
+                                  vertsp[4], vertsp[5], vertsp[6], vertsp[7]);
+          hex->Num = Num ;
+          hex->iEnt = Elementary ;
+          Tree_Insert(v->Hexahedra, &hex) ;
+          break;
+        case PRI1:
+          pri = Create_Prism(vertsp[0], vertsp[1], vertsp[2], 
+                             vertsp[3], vertsp[4], vertsp[5]);
+          pri->Num = Num ;
+          pri->iEnt = Elementary ;
+          Tree_Insert(v->Prisms, &pri) ;
+          break;
+        case PNT:
+          break;
+        default :
+          Msg(WARNING, "Unknown Type of Element in Read_Mesh");
+          break;
+        }
       }
 
     }
diff --git a/Mesh/STL.cpp b/Mesh/STL.cpp
index 9c796d3e87..f64b1cc0d4 100644
--- a/Mesh/STL.cpp
+++ b/Mesh/STL.cpp
@@ -1,4 +1,4 @@
-/* $Id: STL.cpp,v 1.2 2000-11-23 14:11:35 geuzaine Exp $ */
+/* $Id: STL.cpp,v 1.3 2000-11-26 15:43:47 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "Mesh.h"
@@ -16,8 +16,8 @@ STL_Data::~STL_Data (){
 }
 
 void STL_Data::Add_Facet (double x1, double y1, double z1,
-			  double x2, double y2, double z2,
-			  double x3, double y3, double z3){
+                          double x2, double y2, double z2,
+                          double x3, double y3, double z3){
   Vertex **ppv;
   Vertex *v1 = Create_Vertex (Tree_Nbr (Vertices) + 1, x1, y1, z1, 1, 0);
 
diff --git a/Mesh/SecondOrder.cpp b/Mesh/SecondOrder.cpp
index ce2a4a181f..7e2c58fd41 100644
--- a/Mesh/SecondOrder.cpp
+++ b/Mesh/SecondOrder.cpp
@@ -1,4 +1,4 @@
-/* $Id: SecondOrder.cpp,v 1.3 2000-11-23 17:16:38 geuzaine Exp $ */
+/* $Id: SecondOrder.cpp,v 1.4 2000-11-26 15:43:47 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "Geo.h"
@@ -74,61 +74,61 @@ void PutMiddlePoint (void *a, void *b){
   else if ((v = middleface (ed->V[0], ed->V[1])));
   else
     v = Create_Vertex (++CurrentNodeNumber,
-		       0.5 * (ed->V[0]->Pos.X + ed->V[1]->Pos.X),
-		       0.5 * (ed->V[0]->Pos.Y + ed->V[1]->Pos.Y),
-		       0.5 * (ed->V[0]->Pos.Z + ed->V[1]->Pos.Z),
-		       0.5 * (ed->V[0]->lc + ed->V[1]->lc),
-		       0.5 * (ed->V[0]->u + ed->V[1]->u));
+                       0.5 * (ed->V[0]->Pos.X + ed->V[1]->Pos.X),
+                       0.5 * (ed->V[0]->Pos.Y + ed->V[1]->Pos.Y),
+                       0.5 * (ed->V[0]->Pos.Z + ed->V[1]->Pos.Z),
+                       0.5 * (ed->V[0]->lc + ed->V[1]->lc),
+                       0.5 * (ed->V[0]->u + ed->V[1]->u));
   ed->newv = v;
   Tree_Insert (THET, &v);
   for (i = 0; i < List_Nbr (ed->Simplexes); i++){
     List_Read (ed->Simplexes, i, &s);
     if (s->V[3] && EdgesInVolume){
       if (!s->VSUP)
-	s->VSUP = (Vertex **) Malloc (6 * sizeof (Vertex *));
+        s->VSUP = (Vertex **) Malloc (6 * sizeof (Vertex *));
       N = 6;
       for (k = 0; k < N; k++)
-	for (j = 0; j < 2; j++)
-	  edges[k][j] = edges_tetra[k][j];
+        for (j = 0; j < 2; j++)
+          edges[k][j] = edges_tetra[k][j];
     }
     else if (s->V[3]){
       if (!s->VSUP)
-	s->VSUP = (Vertex **) Malloc (4 * sizeof (Vertex *));
+        s->VSUP = (Vertex **) Malloc (4 * sizeof (Vertex *));
       N = 4;
       for (k = 0; k < N; k++)
-	for (j = 0; j < 2; j++)
-	  edges[k][j] = edges_quad[k][j];
+        for (j = 0; j < 2; j++)
+          edges[k][j] = edges_quad[k][j];
     }
     else if (s->V[2]){
       if (!s->VSUP)
-	s->VSUP = (Vertex **) Malloc (3 * sizeof (Vertex *));
+        s->VSUP = (Vertex **) Malloc (3 * sizeof (Vertex *));
       N = 3;
       for (k = 0; k < N; k++)
-	for (j = 0; j < 2; j++)
-	  edges[k][j] = edges_tetra[k][j];
+        for (j = 0; j < 2; j++)
+          edges[k][j] = edges_tetra[k][j];
     }
     else{
       if (!s->VSUP)
-	s->VSUP = (Vertex **) Malloc (sizeof (Vertex *));
+        s->VSUP = (Vertex **) Malloc (sizeof (Vertex *));
       N = 1;
       for (k = 0; k < N; k++)
-	for (j = 0; j < 2; j++)
-	  edges[k][j] = edges_tetra[k][j];
+        for (j = 0; j < 2; j++)
+          edges[k][j] = edges_tetra[k][j];
     }
 
     for (j = 0; j < N; j++){
       if ((!compareVertex (&s->V[edges[j][0]], &ed->V[0]) &&
-	   !compareVertex (&s->V[edges[j][1]], &ed->V[1])) ||
-	  (!compareVertex (&s->V[edges[j][0]], &ed->V[1]) &&
-	   !compareVertex (&s->V[edges[j][1]], &ed->V[0]))){
-	s->VSUP[j] = v;
+           !compareVertex (&s->V[edges[j][1]], &ed->V[1])) ||
+          (!compareVertex (&s->V[edges[j][0]], &ed->V[1]) &&
+           !compareVertex (&s->V[edges[j][1]], &ed->V[0]))){
+        s->VSUP[j] = v;
       }
     }
   }
 }
 
 void Degre2 (Tree_T * AllNodes, Tree_T * TreeNodes, Tree_T * TreeElm,
-	     Curve * c, Surface * s){
+             Curve * c, Surface * s){
   static Tree_T *TreeEdges = NULL;
 
   THES = s;
diff --git a/Mesh/Simplex.cpp b/Mesh/Simplex.cpp
index 88da186837..75b88e87c4 100644
--- a/Mesh/Simplex.cpp
+++ b/Mesh/Simplex.cpp
@@ -1,4 +1,4 @@
-/* $Id: Simplex.cpp,v 1.6 2000-11-25 15:26:11 geuzaine Exp $ */
+/* $Id: Simplex.cpp,v 1.7 2000-11-26 15:43:47 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "Const.h"
@@ -41,9 +41,9 @@ Simplex::~Simplex (){
 }
 
 int Simplex:: CircumCircle (double x1, double y1, 
-			    double x2, double y2, 
-			    double x3, double y3,
-			    double *xc, double *yc){
+                            double x2, double y2, 
+                            double x3, double y3,
+                            double *xc, double *yc){
   double d, a1, a2, a3;
 
   d = 2. * (double) (y1 * (x2 - x3) + y2 * (x3 - x1) + y3 * (x1 - x2));
@@ -81,16 +81,16 @@ void Simplex::Center_Circum (){
 
   if (N == 3){
     CircumCircle (V[0]->Pos.X, V[0]->Pos.Y,
-		  V[1]->Pos.X, V[1]->Pos.Y,
-		  V[2]->Pos.X, V[2]->Pos.Y,
-		  &Center.X, &Center.Y);
+                  V[1]->Pos.X, V[1]->Pos.Y,
+                  V[2]->Pos.X, V[2]->Pos.Y,
+                  &Center.X, &Center.Y);
     Center.Z = 0.0;
     if (fabs (Center.X) > 1.e10)
       Center.X = 1.e10;
     if (fabs (Center.Y) > 1.e10)
       Center.Y = 1.e10;
     Radius = sqrt ((X[0] - Center.X) * (X[0] - Center.X) +
-		   (Y[0] - Center.Y) * (Y[0] - Center.Y));
+                   (Y[0] - Center.Y) * (Y[0] - Center.Y));
   }
   else{
     center_tet (X, Y, Z, res);
@@ -99,8 +99,8 @@ void Simplex::Center_Circum (){
     Center.Y = res[1];
     Center.Z = res[2];
     Radius = sqrt ((X[0] - Center.X) * (X[0] - Center.X) +
-		   (Y[0] - Center.Y) * (Y[0] - Center.Y) +
-		   (Z[0] - Center.Z) * (Z[0] - Center.Z));
+                   (Y[0] - Center.Y) * (Y[0] - Center.Y) +
+                   (Z[0] - Center.Z) * (Z[0] - Center.Z));
   }
 }
 
@@ -114,8 +114,8 @@ int Simplex::Pt_In_Ellipsis (Vertex * v, double Metric[3][3]){
 
   d1 = Radius;
   d2 = sqrt (x[0] * x[0] * Metric[0][0]
-	     + x[1] * x[1] * Metric[1][1]
-	     + 2. * x[0] * x[1] * Metric[0][1]);
+             + x[1] * x[1] * Metric[1][1]
+             + 2. * x[0] * x[1] * Metric[0][1]);
 
   eps = fabs (d1 - d2) / (d1 + d2);
   if (eps < 1.e-12)
@@ -130,9 +130,9 @@ int Simplex::Pt_In_Ellipsis (Vertex * v, double Metric[3][3]){
 
 double Simplex::Volume_Simplexe2D (){
   return ((V[1]->Pos.X - V[0]->Pos.X) *
-	  (V[2]->Pos.Y - V[1]->Pos.Y) -
-	  (V[2]->Pos.X - V[1]->Pos.X) *
-	  (V[1]->Pos.Y - V[0]->Pos.Y));
+          (V[2]->Pos.Y - V[1]->Pos.Y) -
+          (V[2]->Pos.X - V[1]->Pos.X) *
+          (V[1]->Pos.Y - V[0]->Pos.Y));
 }
 
 void Simplex::center_tet (double X[4], double Y[4], double Z[4], double res[3]){
@@ -179,8 +179,8 @@ double Simplex::matsimpl (double mat[3][3]){
   mat[2][1] = V[2]->Pos.Z - V[0]->Pos.Z;
   mat[2][2] = V[3]->Pos.Z - V[0]->Pos.Z;
   return (mat[0][0] * (mat[1][1] * mat[2][2] - mat[1][2] * mat[2][1]) -
-	  mat[1][0] * (mat[0][1] * mat[2][2] - mat[2][1] * mat[0][2]) +
-	  mat[2][0] * (mat[0][1] * mat[1][2] - mat[1][1] * mat[0][2]));
+          mat[1][0] * (mat[0][1] * mat[2][2] - mat[2][1] * mat[0][2]) +
+          mat[2][0] * (mat[0][1] * mat[1][2] - mat[1][1] * mat[0][2]));
 }
 
 double Simplex::rhoin (){
@@ -199,8 +199,8 @@ double Simplex::rhoin (){
 
 double Simplex::lij (int i, int j){
   return sqrt (DSQR (V[i]->Pos.X - V[j]->Pos.X) +
-	       DSQR (V[i]->Pos.Y - V[j]->Pos.Y) +
-	       DSQR (V[i]->Pos.Z - V[j]->Pos.Z));
+               DSQR (V[i]->Pos.Y - V[j]->Pos.Y) +
+               DSQR (V[i]->Pos.Z - V[j]->Pos.Z));
 }
 
 double Simplex::Volume_Simplexe (){
@@ -229,8 +229,8 @@ double Simplex::RhoShapeMeasure (){
   for (i = 0; i <= 3; i++){
     for (j = i + 1; j <= 3; j++){
       if (i != j){
-	minlij = DMIN (minlij, fabs (lij (i, j)));
-	maxlij = DMAX (maxlij, fabs (lij (i, j)));
+        minlij = DMIN (minlij, fabs (lij (i, j)));
+        maxlij = DMAX (maxlij, fabs (lij (i, j)));
       }
     }
   }
@@ -249,7 +249,7 @@ double Simplex::GammaShapeMeasure (){
   for (i = 0; i <= N - 1; i++){
     for (j = i + 1; j <= N - 1; j++){
       if (i != j)
-	maxlij = DMAX (maxlij, lij (i, j));
+        maxlij = DMAX (maxlij, lij (i, j));
     }
   }
   return 12. * rhoin () / (sqrt (6.) * maxlij);
@@ -307,7 +307,7 @@ void Simplex::Fourre_Simplexe (Vertex * v1, Vertex * v2, Vertex * v3, Vertex * v
       //qsort(F[0].V,3,sizeof(Vertex*),compareVertex);
       Center_Circum ();
       Quality = (double) N *Radius / (V[0]->lc + V[1]->lc + V[2]->lc
-				      + ((V[3]) ? V[3]->lc : 0.0));
+                                      + ((V[3]) ? V[3]->lc : 0.0));
     }
     else{
       qsort (F[0].V, 3, sizeof (Vertex *), compareVertex);
@@ -321,7 +321,7 @@ void Simplex::Fourre_Simplexe (Vertex * v1, Vertex * v2, Vertex * v3, Vertex * v
   Center_Circum ();
 
   Quality = (double) N *Radius / (V[0]->lc + V[1]->lc + V[2]->lc
-				  + ((V[3]) ? V[3]->lc : 0.0));
+                                  + ((V[3]) ? V[3]->lc : 0.0));
 
   /*
      if(LOCAL != NULL){
@@ -422,8 +422,8 @@ void Simplex::Center_Ellipsum_2D (double m[3][3]){
   Center.Y = x[1];
 
   Radius = sqrt ((x[0] - x1) * (x[0] - x1) * a
-		 + (x[1] - y1) * (x[1] - y1) * d
-		 + 2. * (x[0] - x1) * (x[1] - y1) * b);
+                 + (x[1] - y1) * (x[1] - y1) * d
+                 + 2. * (x[0] - x1) * (x[1] - y1) * b);
 }
 
 void Simplex::Center_Ellipsum_3D (double m[3][3]){
@@ -482,12 +482,12 @@ void Simplex::Center_Ellipsum_3D (double m[3][3]){
   Center.Z = x[2];
 
   Radius = sqrt ((x[0] - x1) * (x[0] - x1) * m[0][0]
-		 + (x[1] - y1) * (x[1] - y1) * m[1][1]
-		 + (x[2] - z1) * (x[2] - z1) * m[2][2]
-		 + 2. * (x[0] - x1) * (x[1] - y1) * m[0][1]
-		 + 2. * (x[0] - x1) * (x[2] - z1) * m[0][2]
-		 + 2. * (x[1] - y1) * (x[2] - z1) * m[1][2]
-		 );
+                 + (x[1] - y1) * (x[1] - y1) * m[1][1]
+                 + (x[2] - z1) * (x[2] - z1) * m[2][2]
+                 + 2. * (x[0] - x1) * (x[1] - y1) * m[0][1]
+                 + 2. * (x[0] - x1) * (x[2] - z1) * m[0][2]
+                 + 2. * (x[1] - y1) * (x[2] - z1) * m[1][2]
+                 );
 }
 
 
@@ -533,18 +533,18 @@ int Simplex::Pt_In_Simplex_2D (Vertex * v){
 void Simplex::ExportLcField (FILE * f){
   if (!V[3]){
     fprintf (f, "ST(%f,%f,%f,%f,%f,%f,%f,%f,%f){%12.5E,%12.5E,%12.5E};\n"
-	     ,V[0]->Pos.X, V[0]->Pos.Y, V[0]->Pos.Z
-	     ,V[1]->Pos.X, V[1]->Pos.Y, V[1]->Pos.Z
-	     ,V[2]->Pos.X, V[2]->Pos.Y, V[2]->Pos.Z
-	     ,V[0]->lc, V[1]->lc, V[2]->lc);
+             ,V[0]->Pos.X, V[0]->Pos.Y, V[0]->Pos.Z
+             ,V[1]->Pos.X, V[1]->Pos.Y, V[1]->Pos.Z
+             ,V[2]->Pos.X, V[2]->Pos.Y, V[2]->Pos.Z
+             ,V[0]->lc, V[1]->lc, V[2]->lc);
   }
   else{
     fprintf (f, "SS(%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f){%12.5E,%12.5E,%12.5E,%12.5E};\n"
-	     ,V[0]->Pos.X, V[0]->Pos.Y, V[0]->Pos.Z
-	     ,V[1]->Pos.X, V[1]->Pos.Y, V[1]->Pos.Z
-	     ,V[2]->Pos.X, V[2]->Pos.Y, V[2]->Pos.Z
-	     ,V[3]->Pos.X, V[3]->Pos.Y, V[3]->Pos.Z
-	     ,V[0]->lc, V[1]->lc, V[2]->lc, V[3]->lc);
+             ,V[0]->Pos.X, V[0]->Pos.Y, V[0]->Pos.Z
+             ,V[1]->Pos.X, V[1]->Pos.Y, V[1]->Pos.Z
+             ,V[2]->Pos.X, V[2]->Pos.Y, V[2]->Pos.Z
+             ,V[3]->Pos.X, V[3]->Pos.Y, V[3]->Pos.Z
+             ,V[0]->lc, V[1]->lc, V[2]->lc, V[3]->lc);
   }
   
 }
@@ -591,7 +591,7 @@ bool Simplex::EdgeIn (Vertex * v1, Vertex * v2, Vertex * v[2]){
     if (compareVertex (&V[i], &v1) && compareVertex (&V[i], &v2)){
       v[n++] = V[i];
       if (n > 2)
-	return false;
+        return false;
     }
   }
   return true;
@@ -693,11 +693,11 @@ bool Simplex::SwapEdge (int iFac){
   if (s21 != &MyNewBoundary && s21 && s21->iEnt)
     for (i = 0; i < 3; i++)
       if (s21->S[i] == s2)
-	s21->S[i] = s1;
+        s21->S[i] = s1;
   if (s11 != &MyNewBoundary && s11 && s11->iEnt)
     for (i = 0; i < 3; i++)
       if (s11->S[i] == s1)
-	s11->S[i] = s2;
+        s11->S[i] = s2;
   return true;
 }
 
diff --git a/Mesh/Simplex.h b/Mesh/Simplex.h
index e19f2899fc..d5737e06ca 100644
--- a/Mesh/Simplex.h
+++ b/Mesh/Simplex.h
@@ -1,4 +1,4 @@
-/* $Id: Simplex.h,v 1.4 2000-11-25 15:26:11 geuzaine Exp $ */
+/* $Id: Simplex.h,v 1.5 2000-11-26 15:43:47 geuzaine Exp $ */
 #ifndef _SIMPLEX_H_
 #define _SIMPLEX_H_
 
@@ -19,7 +19,7 @@ public:
   double  Quality;       /* Qualite du simplexe                          */
   Coord   Center;        /* centre du CC                                 */
   double  Radius;        /* Rayon du CC                                  */
-  Simplex *S[4];    	 /* 4 Voisins                                    */
+  Simplex *S[4];         /* 4 Voisins                                    */
   static  int TotalNumber;
   static  int TotalAllocated;
   Simplex();
@@ -35,7 +35,7 @@ public:
   double AireFace (Vertex *V[3]);
   double surfsimpl();
   int CircumCircle(double x1,double y1,double x2,double y2,double x3,double y3,
-		   double *xc,double *yc);
+                   double *xc,double *yc);
   double Volume_Simplexe2D();
   void Center_Ellipsum_2D (double m[3][3]);
   int Pt_In_Ellipsis (Vertex *v,double m[3][3]);
diff --git a/Mesh/Smoothing.cpp b/Mesh/Smoothing.cpp
index 35d6fd81c2..ab9713c22c 100644
--- a/Mesh/Smoothing.cpp
+++ b/Mesh/Smoothing.cpp
@@ -1,4 +1,4 @@
-/* $Id: Smoothing.cpp,v 1.2 2000-11-23 14:11:36 geuzaine Exp $ */
+/* $Id: Smoothing.cpp,v 1.3 2000-11-26 15:43:47 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "Const.h"
@@ -19,27 +19,27 @@ void AmelioreSurface_EliminationTripet (Surface * surf, Mesh * m, Tree_T * tnxe)
     if (List_Nbr (nxe.Liste) == 3){
       ok = true;
       if (nxe.v->ListCurves)
-	ok = false;
+        ok = false;
       else{
-	for (j = 0; j < 3; j++){
-	  List_Read (nxe.Liste, j, &s[j]);
-	  if (!Tree_Search (surf->Simplexes, &s[j]))
-	    ok = false;
-	  for (k = 0; k < 3; k++)
-	    if (compareVertex (&nxe.v, &s[j]->V[k]))
-	      List_Insert (ListNoeuds, &s[j]->V[k], compareVertex);
-	}
+        for (j = 0; j < 3; j++){
+          List_Read (nxe.Liste, j, &s[j]);
+          if (!Tree_Search (surf->Simplexes, &s[j]))
+            ok = false;
+          for (k = 0; k < 3; k++)
+            if (compareVertex (&nxe.v, &s[j]->V[k]))
+              List_Insert (ListNoeuds, &s[j]->V[k], compareVertex);
+        }
       }
       if (ok){
-	List_Read (ListNoeuds, 0, &v1);
-	List_Read (ListNoeuds, 1, &v2);
-	List_Read (ListNoeuds, 2, &v3);
-	news = Create_Simplex (v1, v2, v3, 0);
-	Tree_Suppress (surf->Simplexes, &s[0]);
-	Tree_Suppress (surf->Simplexes, &s[1]);
-	Tree_Suppress (surf->Simplexes, &s[2]);
-	Tree_Suppress (m->Vertices, &nxe.v);
-	Tree_Add (surf->Simplexes, &news);
+        List_Read (ListNoeuds, 0, &v1);
+        List_Read (ListNoeuds, 1, &v2);
+        List_Read (ListNoeuds, 2, &v3);
+        news = Create_Simplex (v1, v2, v3, 0);
+        Tree_Suppress (surf->Simplexes, &s[0]);
+        Tree_Suppress (surf->Simplexes, &s[1]);
+        Tree_Suppress (surf->Simplexes, &s[2]);
+        Tree_Suppress (m->Vertices, &nxe.v);
+        Tree_Add (surf->Simplexes, &news);
       }
       List_Reset (ListNoeuds);
     }
@@ -81,10 +81,10 @@ void ActionLiss (void *data, void *dummy){
       return;
     for (j = 0; j < 4; j++){
       if (s->V[j] && compareVertex (&pnxe->v, &s->V[j])){
-	Sum += 0.5;
-	X += s->V[j]->Pos.X * 0.5;
-	Y += s->V[j]->Pos.Y * 0.5;
-	Z += s->V[j]->Pos.Z * 0.5;
+        Sum += 0.5;
+        X += s->V[j]->Pos.X * 0.5;
+        Y += s->V[j]->Pos.Y * 0.5;
+        Z += s->V[j]->Pos.Z * 0.5;
       }
     }
   }
@@ -144,10 +144,10 @@ void ActionLissSurf (void *data, void *dummy){
     */
     for (j = 0; j < 4; j++){
       if (s->V[j] && compareVertex (&pnxe->v, &s->V[j])){
-	Sum += 0.5;
-	X += s->V[j]->Pos.X * 0.5;
-	Y += s->V[j]->Pos.Y * 0.5;
-	Z += s->V[j]->Pos.Z * 0.5;
+        Sum += 0.5;
+        X += s->V[j]->Pos.X * 0.5;
+        Y += s->V[j]->Pos.Y * 0.5;
+        Z += s->V[j]->Pos.Z * 0.5;
       }
     }
   }
diff --git a/Mesh/SwapEdge.cpp b/Mesh/SwapEdge.cpp
index 2122f7a39c..3513a8754a 100644
--- a/Mesh/SwapEdge.cpp
+++ b/Mesh/SwapEdge.cpp
@@ -1,4 +1,4 @@
-/* $Id: SwapEdge.cpp,v 1.3 2000-11-23 23:20:35 geuzaine Exp $ */
+/* $Id: SwapEdge.cpp,v 1.4 2000-11-26 15:43:47 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "Const.h"
@@ -10,8 +10,8 @@ extern int edges_tetra[6][2];
 
 
 int TrouveCoquille (Simplex * s, Vertex * Ed[2],
-		    List_T * Coquille, Tree_T * TreeSimpl,
-		    Vertex * Contour[100]){
+                    List_T * Coquille, Tree_T * TreeSimpl,
+                    Vertex * Contour[100]){
   Simplex *stack[256], *actual;
   Vertex *other[2];
   int K, i, N = 0;
@@ -25,18 +25,18 @@ int TrouveCoquille (Simplex * s, Vertex * Ed[2],
     if (!Tree_Search (TreeSimpl, &actual)){
       Tree_Add (TreeSimpl, &actual);
       if (actual->EdgeIn (Ed[0], Ed[1], other)){
-	List_Add (Coquille, &actual);
-	if (actual != s)
-	  actual->Radius = -1.;
-	E.V[0] = other[0];
-	E.V[1] = other[1];
-	List_Add (Edges, &E);
-	for (i = 0; i < 4; i++){
-	  if (actual->S[i] && actual->S[i] != &MyNewBoundary)
-	    stack[N++] = actual->S[i];
-	  else
-	    return 0;
-	}
+        List_Add (Coquille, &actual);
+        if (actual != s)
+          actual->Radius = -1.;
+        E.V[0] = other[0];
+        E.V[1] = other[1];
+        List_Add (Edges, &E);
+        for (i = 0; i < 4; i++){
+          if (actual->S[i] && actual->S[i] != &MyNewBoundary)
+            stack[N++] = actual->S[i];
+          else
+            return 0;
+        }
       }
     }
   }
@@ -54,16 +54,16 @@ int TrouveCoquille (Simplex * s, Vertex * Ed[2],
     for (i = 0; i < List_Nbr (Edges); i++){
       List_Read (Edges, i, &E);
       if (!compareVertex (&Contour[N - 1], &E.V[0]) &&
-	  compareVertex (&Contour[N - 2], &E.V[1])){
-	Contour[N++] = E.V[1];
-	List_Suppress (Edges, &E, compareedge);
-	break;
+          compareVertex (&Contour[N - 2], &E.V[1])){
+        Contour[N++] = E.V[1];
+        List_Suppress (Edges, &E, compareedge);
+        break;
       }
       if (!compareVertex (&Contour[N - 1], &E.V[1]) &&
-	  compareVertex (&Contour[N - 2], &E.V[0])){
-	Contour[N++] = E.V[0];
-	List_Suppress (Edges, &E, compareedge);
-	break;
+          compareVertex (&Contour[N - 2], &E.V[0])){
+        Contour[N++] = E.V[0];
+        List_Suppress (Edges, &E, compareedge);
+        break;
       }
     }
     
@@ -74,7 +74,7 @@ int TrouveCoquille (Simplex * s, Vertex * Ed[2],
 }
 
 bool FindBestPattern (int N, Vertex * Contour[100], Vertex * Ed[2],
-		      List_T * Coquille, List_T * Pattern){
+                      List_T * Coquille, List_T * Pattern){
   int i, j, k, kk, tri[3];
   Simplex *s, *Pat[100];
   double old_volume, new_volume;
@@ -138,42 +138,42 @@ bool FindBestPattern (int N, Vertex * Contour[100], Vertex * Ed[2],
       worst_tet_new = 1.;
       kk = 0;
       for (k = 0; k < sp->GetNbTriangles (); k++){
-	sp->GetTriangle (i, k, tri);
-	s = Create_Simplex (Contour[tri[0]],
-			    Contour[tri[1]],
-			    Contour[tri[2]],
-			    Ed[0]);
-	s->iEnt = IENT;
-	Pat[kk++] = s;
-	new_volume += fabs (s->Volume_Simplexe ());
-	worst_tet_new = DMIN (worst_tet_new, s->GammaShapeMeasure ());
-	s = Create_Simplex (Contour[tri[0]],
-			    Contour[tri[1]],
-			    Contour[tri[2]],
-			    Ed[1]);
-	s->iEnt = IENT;
-	Pat[kk++] = s;
-	new_volume += fabs (s->Volume_Simplexe ());
-	worst_tet_new = DMIN (worst_tet_new, s->GammaShapeMeasure ());
+        sp->GetTriangle (i, k, tri);
+        s = Create_Simplex (Contour[tri[0]],
+                            Contour[tri[1]],
+                            Contour[tri[2]],
+                            Ed[0]);
+        s->iEnt = IENT;
+        Pat[kk++] = s;
+        new_volume += fabs (s->Volume_Simplexe ());
+        worst_tet_new = DMIN (worst_tet_new, s->GammaShapeMeasure ());
+        s = Create_Simplex (Contour[tri[0]],
+                            Contour[tri[1]],
+                            Contour[tri[2]],
+                            Ed[1]);
+        s->iEnt = IENT;
+        Pat[kk++] = s;
+        new_volume += fabs (s->Volume_Simplexe ());
+        worst_tet_new = DMIN (worst_tet_new, s->GammaShapeMeasure ());
       }
       if (fabs (new_volume - old_volume) > 1.e-5 * fabs (new_volume + old_volume))
-	Msg(WARNING, "Edge Swapping Failed");
+        Msg(WARNING, "Edge Swapping Failed");
       if (fabs (new_volume - old_volume) > 1.e-5 * fabs (new_volume + old_volume)
-	  || worst_tet_new < worst_tet_old){
-	for (k = 0; k < 2 * sp->GetNbTriangles (); k++){
-	  delete Pat[k];
-	}
+          || worst_tet_new < worst_tet_old){
+        for (k = 0; k < 2 * sp->GetNbTriangles (); k++){
+          delete Pat[k];
+        }
       }
       else{
-	for (k = 0; k < List_Nbr (Pattern); k++){
-	  List_Read (Pattern, k, &s);
-	  delete s;
-	}
-	List_Reset (Pattern);
-	for (k = 0; k < 2 * sp->GetNbTriangles (); k++){
-	  List_Add (Pattern, &Pat[k]);
-	}
-	worst_tet_old = worst_tet_new;
+        for (k = 0; k < List_Nbr (Pattern); k++){
+          List_Read (Pattern, k, &s);
+          delete s;
+        }
+        List_Reset (Pattern);
+        for (k = 0; k < 2 * sp->GetNbTriangles (); k++){
+          List_Add (Pattern, &Pat[k]);
+        }
+        worst_tet_old = worst_tet_new;
       }
     }
   }
@@ -295,7 +295,7 @@ void SwapEdges3D (Mesh * M, Volume * v, double GammaPrescribed, bool order){
     if (s->GammaShapeMeasure () < GammaPrescribed){
       int iEdge = GetWorstEdge (s, ec, order);
       if (iEdge >= 0)
-	SwapEdge (M, v, s, iEdge);
+        SwapEdge (M, v, s, iEdge);
     }
   }
   Progress (-1);
diff --git a/Mesh/Vertex.cpp b/Mesh/Vertex.cpp
index fec5e0473a..88b46c6fd4 100644
--- a/Mesh/Vertex.cpp
+++ b/Mesh/Vertex.cpp
@@ -1,7 +1,10 @@
-/* $Id: Vertex.cpp,v 1.3 2000-11-25 15:26:11 geuzaine Exp $ */
+/* $Id: Vertex.cpp,v 1.4 2000-11-26 15:43:47 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "Vertex.h"
+#include "Context.h"
+
+extern Context_T CTX ;
 
 Vertex::Vertex (){
   Frozen = 0;
@@ -36,12 +39,12 @@ void Vertex::norme (){
 
 Vertex Vertex::operator + (const Vertex & other){
   return Vertex (Pos.X + other.Pos.X, Pos.Y + 
-		 other.Pos.Y, Pos.Z + other.Pos.Z, lc, w);
+                 other.Pos.Y, Pos.Z + other.Pos.Z, lc, w);
 }
 
 Vertex Vertex::operator - (const Vertex & other){
   return Vertex (Pos.X - other.Pos.X, Pos.Y - 
-		 other.Pos.Y, Pos.Z - other.Pos.Z, lc, w);
+                 other.Pos.Y, Pos.Z - other.Pos.Z, lc, w);
 }
 
 Vertex Vertex::operator / (double d){
@@ -53,8 +56,8 @@ Vertex Vertex::operator * (double d){
 
 Vertex Vertex::operator % (Vertex & autre){ // cross product
   return Vertex (Pos.Y * autre.Pos.Z - Pos.Z * autre.Pos.Y,
-		 -(Pos.X * autre.Pos.Z - Pos.Z * autre.Pos.X),
-		 Pos.X * autre.Pos.Y - Pos.Y * autre.Pos.X, lc, w);
+                 -(Pos.X * autre.Pos.Z - Pos.Z * autre.Pos.X),
+                 Pos.X * autre.Pos.Y - Pos.Y * autre.Pos.X, lc, w);
 }
 
 double Vertex::operator * (const Vertex & other){
@@ -92,8 +95,7 @@ int compareVertex (const void *a, const void *b){
 int comparePosition (const void *a, const void *b){
   int i, j;
   Vertex **q, **w;
-  extern double LC;
-  double eps = 1.e-6 * LC;
+  double eps = 1.e-6 * CTX.lc;
 
   q = (Vertex **) a;
   w = (Vertex **) b;
diff --git a/Parser/Gmsh.tab.cpp b/Parser/Gmsh.tab.cpp
index 673f11c6f2..36f89cb040 100644
--- a/Parser/Gmsh.tab.cpp
+++ b/Parser/Gmsh.tab.cpp
@@ -145,7 +145,7 @@
 #define	UMINUS	395
 
 #line 1 "Gmsh.y"
- /* $Id: Gmsh.tab.cpp,v 1.8 2000-11-25 15:26:11 geuzaine Exp $ */
+ /* $Id: Gmsh.tab.cpp,v 1.9 2000-11-26 15:43:47 geuzaine Exp $ */
 
 #include <stdarg.h>
 
diff --git a/Parser/Gmsh.tab.cpp.h b/Parser/Gmsh.tab.cpp.h
index 6856532645..45866542ab 100644
--- a/Parser/Gmsh.tab.cpp.h
+++ b/Parser/Gmsh.tab.cpp.h
@@ -6,145 +6,145 @@ typedef union {
   Shape    s;
   List_T  *l;
 } YYSTYPE;
-#define	tDOUBLE	257
-#define	tSTRING	258
-#define	tBIGSTR	259
-#define	tEND	260
-#define	tAFFECT	261
-#define	tDOTS	262
-#define	tPi	263
-#define	tExp	264
-#define	tLog	265
-#define	tLog10	266
-#define	tSqrt	267
-#define	tSin	268
-#define	tAsin	269
-#define	tCos	270
-#define	tAcos	271
-#define	tTan	272
-#define	tAtan	273
-#define	tAtan2	274
-#define	tSinh	275
-#define	tCosh	276
-#define	tTanh	277
-#define	tFabs	278
-#define	tFloor	279
-#define	tCeil	280
-#define	tFmod	281
-#define	tModulo	282
-#define	tHypot	283
-#define	tPoint	284
-#define	tCircle	285
-#define	tEllipsis	286
-#define	tLine	287
-#define	tSurface	288
-#define	tSpline	289
-#define	tVolume	290
-#define	tCharacteristic	291
-#define	tLength	292
-#define	tParametric	293
-#define	tElliptic	294
-#define	tPlane	295
-#define	tRuled	296
-#define	tTransfinite	297
-#define	tComplex	298
-#define	tPhysical	299
-#define	tUsing	300
-#define	tPower	301
-#define	tBump	302
-#define	tProgression	303
-#define	tAssociation	304
-#define	tRotate	305
-#define	tTranslate	306
-#define	tSymmetry	307
-#define	tDilate	308
-#define	tExtrude	309
-#define	tDuplicata	310
-#define	tLoop	311
-#define	tInclude	312
-#define	tRecombine	313
-#define	tDelete	314
-#define	tCoherence	315
-#define	tView	316
-#define	tOffset	317
-#define	tAttractor	318
-#define	tLayers	319
-#define	tScalarTetrahedron	320
-#define	tVectorTetrahedron	321
-#define	tTensorTetrahedron	322
-#define	tScalarTriangle	323
-#define	tVectorTriangle	324
-#define	tTensorTriangle	325
-#define	tScalarLine	326
-#define	tVectorLine	327
-#define	tTensorLine	328
-#define	tScalarPoint	329
-#define	tVectorPoint	330
-#define	tTensorPoint	331
-#define	tBSpline	332
-#define	tNurbs	333
-#define	tOrder	334
-#define	tWith	335
-#define	tBounds	336
-#define	tKnots	337
-#define	tColor	338
-#define	tGeneral	339
-#define	tGeometry	340
-#define	tMesh	341
-#define	tB_SPLINE_SURFACE_WITH_KNOTS	342
-#define	tB_SPLINE_CURVE_WITH_KNOTS	343
-#define	tCARTESIAN_POINT	344
-#define	tTRUE	345
-#define	tFALSE	346
-#define	tUNSPECIFIED	347
-#define	tU	348
-#define	tV	349
-#define	tEDGE_CURVE	350
-#define	tVERTEX_POINT	351
-#define	tORIENTED_EDGE	352
-#define	tPLANE	353
-#define	tFACE_OUTER_BOUND	354
-#define	tEDGE_LOOP	355
-#define	tADVANCED_FACE	356
-#define	tVECTOR	357
-#define	tDIRECTION	358
-#define	tAXIS2_PLACEMENT_3D	359
-#define	tISO	360
-#define	tENDISO	361
-#define	tENDSEC	362
-#define	tDATA	363
-#define	tHEADER	364
-#define	tFILE_DESCRIPTION	365
-#define	tFILE_SCHEMA	366
-#define	tFILE_NAME	367
-#define	tMANIFOLD_SOLID_BREP	368
-#define	tCLOSED_SHELL	369
-#define	tADVANCED_BREP_SHAPE_REPRESENTATION	370
-#define	tFACE_BOUND	371
-#define	tCYLINDRICAL_SURFACE	372
-#define	tCONICAL_SURFACE	373
-#define	tCIRCLE	374
-#define	tTRIMMED_CURVE	375
-#define	tGEOMETRIC_SET	376
-#define	tCOMPOSITE_CURVE_SEGMENT	377
-#define	tCONTINUOUS	378
-#define	tCOMPOSITE_CURVE	379
-#define	tTOROIDAL_SURFACE	380
-#define	tPRODUCT_DEFINITION	381
-#define	tPRODUCT_DEFINITION_SHAPE	382
-#define	tSHAPE_DEFINITION_REPRESENTATION	383
-#define	tELLIPSE	384
-#define	tTrimmed	385
-#define	tSolid	386
-#define	tEndSolid	387
-#define	tVertex	388
-#define	tFacet	389
-#define	tNormal	390
-#define	tOuter	391
-#define	tLoopSTL	392
-#define	tEndLoop	393
-#define	tEndFacet	394
-#define	UMINUS	395
+#define tDOUBLE 257
+#define tSTRING 258
+#define tBIGSTR 259
+#define tEND    260
+#define tAFFECT 261
+#define tDOTS   262
+#define tPi     263
+#define tExp    264
+#define tLog    265
+#define tLog10  266
+#define tSqrt   267
+#define tSin    268
+#define tAsin   269
+#define tCos    270
+#define tAcos   271
+#define tTan    272
+#define tAtan   273
+#define tAtan2  274
+#define tSinh   275
+#define tCosh   276
+#define tTanh   277
+#define tFabs   278
+#define tFloor  279
+#define tCeil   280
+#define tFmod   281
+#define tModulo 282
+#define tHypot  283
+#define tPoint  284
+#define tCircle 285
+#define tEllipsis       286
+#define tLine   287
+#define tSurface        288
+#define tSpline 289
+#define tVolume 290
+#define tCharacteristic 291
+#define tLength 292
+#define tParametric     293
+#define tElliptic       294
+#define tPlane  295
+#define tRuled  296
+#define tTransfinite    297
+#define tComplex        298
+#define tPhysical       299
+#define tUsing  300
+#define tPower  301
+#define tBump   302
+#define tProgression    303
+#define tAssociation    304
+#define tRotate 305
+#define tTranslate      306
+#define tSymmetry       307
+#define tDilate 308
+#define tExtrude        309
+#define tDuplicata      310
+#define tLoop   311
+#define tInclude        312
+#define tRecombine      313
+#define tDelete 314
+#define tCoherence      315
+#define tView   316
+#define tOffset 317
+#define tAttractor      318
+#define tLayers 319
+#define tScalarTetrahedron      320
+#define tVectorTetrahedron      321
+#define tTensorTetrahedron      322
+#define tScalarTriangle 323
+#define tVectorTriangle 324
+#define tTensorTriangle 325
+#define tScalarLine     326
+#define tVectorLine     327
+#define tTensorLine     328
+#define tScalarPoint    329
+#define tVectorPoint    330
+#define tTensorPoint    331
+#define tBSpline        332
+#define tNurbs  333
+#define tOrder  334
+#define tWith   335
+#define tBounds 336
+#define tKnots  337
+#define tColor  338
+#define tGeneral        339
+#define tGeometry       340
+#define tMesh   341
+#define tB_SPLINE_SURFACE_WITH_KNOTS    342
+#define tB_SPLINE_CURVE_WITH_KNOTS      343
+#define tCARTESIAN_POINT        344
+#define tTRUE   345
+#define tFALSE  346
+#define tUNSPECIFIED    347
+#define tU      348
+#define tV      349
+#define tEDGE_CURVE     350
+#define tVERTEX_POINT   351
+#define tORIENTED_EDGE  352
+#define tPLANE  353
+#define tFACE_OUTER_BOUND       354
+#define tEDGE_LOOP      355
+#define tADVANCED_FACE  356
+#define tVECTOR 357
+#define tDIRECTION      358
+#define tAXIS2_PLACEMENT_3D     359
+#define tISO    360
+#define tENDISO 361
+#define tENDSEC 362
+#define tDATA   363
+#define tHEADER 364
+#define tFILE_DESCRIPTION       365
+#define tFILE_SCHEMA    366
+#define tFILE_NAME      367
+#define tMANIFOLD_SOLID_BREP    368
+#define tCLOSED_SHELL   369
+#define tADVANCED_BREP_SHAPE_REPRESENTATION     370
+#define tFACE_BOUND     371
+#define tCYLINDRICAL_SURFACE    372
+#define tCONICAL_SURFACE        373
+#define tCIRCLE 374
+#define tTRIMMED_CURVE  375
+#define tGEOMETRIC_SET  376
+#define tCOMPOSITE_CURVE_SEGMENT        377
+#define tCONTINUOUS     378
+#define tCOMPOSITE_CURVE        379
+#define tTOROIDAL_SURFACE       380
+#define tPRODUCT_DEFINITION     381
+#define tPRODUCT_DEFINITION_SHAPE       382
+#define tSHAPE_DEFINITION_REPRESENTATION        383
+#define tELLIPSE        384
+#define tTrimmed        385
+#define tSolid  386
+#define tEndSolid       387
+#define tVertex 388
+#define tFacet  389
+#define tNormal 390
+#define tOuter  391
+#define tLoopSTL        392
+#define tEndLoop        393
+#define tEndFacet       394
+#define UMINUS  395
 
 
 extern YYSTYPE yylval;
diff --git a/Parser/Gmsh.yy.cpp b/Parser/Gmsh.yy.cpp
index 19c88baae5..210f08032a 100644
--- a/Parser/Gmsh.yy.cpp
+++ b/Parser/Gmsh.yy.cpp
@@ -2,7 +2,7 @@
 /* A lexical scanner generated by flex */
 
 /* Scanner skeleton version:
- * $Header: /cvsroot/gmsh/Parser/Gmsh.yy.cpp,v 1.8 2000-11-25 15:26:11 geuzaine Exp $
+ * $Header: /cvsroot/gmsh/Parser/Gmsh.yy.cpp,v 1.9 2000-11-26 15:43:47 geuzaine Exp $
  */
 
 #define FLEX_SCANNER
diff --git a/Unix/CbColorbar.cpp b/Unix/CbColorbar.cpp
index 884bc8fca5..8cc38ae898 100644
--- a/Unix/CbColorbar.cpp
+++ b/Unix/CbColorbar.cpp
@@ -1,4 +1,4 @@
-/* $Id: CbColorbar.cpp,v 1.2 2000-11-23 14:11:40 geuzaine Exp $ */
+/* $Id: CbColorbar.cpp,v 1.3 2000-11-26 15:43:47 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -25,9 +25,9 @@ extern Widgets_T   WID;
 
 /* rgb on [0, 1], sv returned on [0, 1] and h on [0, 6]. 
    Exception: h is returned UNDEFINED if S==0. */
-									     
+                                                                             
 void RGB_to_HSV(double  R, double  G, double  B,
-		double *H, double *S, double *V) { 
+                double *H, double *S, double *V) { 
   double v, x, f;   
   int i; 
    
@@ -43,7 +43,7 @@ void RGB_to_HSV(double  R, double  G, double  B,
    rgb each returned on [0, 1]. */
 
 void HSV_to_RGB(double  H, double  S, double  V,
-		double *R, double *G, double *B) {     
+                double *R, double *G, double *B) {     
   double m, n, f;   
   int i; 
       
@@ -59,7 +59,7 @@ void HSV_to_RGB(double  H, double  S, double  V,
   case 0: RETURN_RGB(V, n, m);        
   case 1: RETURN_RGB(n, V, m);         
   case 2: RETURN_RGB(m, V, n);        
-  case 3: RETURN_RGB(m, n, V); 	      	      
+  case 3: RETURN_RGB(m, n, V);                
   case 4: RETURN_RGB(n, m, V);         
   case 5: RETURN_RGB(V, m, n);     
   } 
@@ -162,14 +162,14 @@ static void redraw_range(ColorBar *cb, int a, int b){
       x = index_to_x( cb, i );
 
       if(cb->ct->ipar[COLORTABLE_MODE]==COLORTABLE_RGB){
-	intensity = UNPACK_RED(cb->ct->table[i]);
+        intensity = UNPACK_RED(cb->ct->table[i]);
       }
       else if(cb->ct->ipar[COLORTABLE_MODE]==COLORTABLE_HSV){
-	RGB_to_HSV(UNPACK_RED  (cb->ct->table[i])/255., 
-		   UNPACK_GREEN(cb->ct->table[i])/255.,
-		   UNPACK_BLUE (cb->ct->table[i])/255.,
-		   &H,&S,&V);
-	intensity = (int) (H/6.*255.+EPS);
+        RGB_to_HSV(UNPACK_RED  (cb->ct->table[i])/255., 
+                   UNPACK_GREEN(cb->ct->table[i])/255.,
+                   UNPACK_BLUE (cb->ct->table[i])/255.,
+                   &H,&S,&V);
+        intensity = (int) (H/6.*255.+EPS);
       }
 
       y = intensity_to_y( cb, intensity );
@@ -183,14 +183,14 @@ static void redraw_range(ColorBar *cb, int a, int b){
       x = index_to_x( cb, i );
 
       if(cb->ct->ipar[COLORTABLE_MODE]==COLORTABLE_RGB){
-	intensity = UNPACK_GREEN(cb->ct->table[i]);
+        intensity = UNPACK_GREEN(cb->ct->table[i]);
       }
       else if(cb->ct->ipar[COLORTABLE_MODE]==COLORTABLE_HSV){
-	RGB_to_HSV(UNPACK_RED  (cb->ct->table[i])/255., 
-		   UNPACK_GREEN(cb->ct->table[i])/255.,
-		   UNPACK_BLUE (cb->ct->table[i])/255.,
-		   &H,&S,&V);
-	intensity = (int) (S*255.);
+        RGB_to_HSV(UNPACK_RED  (cb->ct->table[i])/255., 
+                   UNPACK_GREEN(cb->ct->table[i])/255.,
+                   UNPACK_BLUE (cb->ct->table[i])/255.,
+                   &H,&S,&V);
+        intensity = (int) (S*255.);
       }
 
       y = intensity_to_y( cb, intensity);
@@ -204,14 +204,14 @@ static void redraw_range(ColorBar *cb, int a, int b){
       x = index_to_x( cb, i );
 
       if(cb->ct->ipar[COLORTABLE_MODE]==COLORTABLE_RGB){
-	intensity = UNPACK_BLUE(cb->ct->table[i]);
+        intensity = UNPACK_BLUE(cb->ct->table[i]);
       }
       else if(cb->ct->ipar[COLORTABLE_MODE]==COLORTABLE_HSV){
-	RGB_to_HSV(UNPACK_RED  (cb->ct->table[i])/255., 
-		   UNPACK_GREEN(cb->ct->table[i])/255.,
-		   UNPACK_BLUE (cb->ct->table[i])/255.,
-		   &H,&S,&V);
-	intensity = (int) (V*255.);
+        RGB_to_HSV(UNPACK_RED  (cb->ct->table[i])/255., 
+                   UNPACK_GREEN(cb->ct->table[i])/255.,
+                   UNPACK_BLUE (cb->ct->table[i])/255.,
+                   &H,&S,&V);
+        intensity = (int) (V*255.);
       }
 
       y = intensity_to_y( cb, intensity );
@@ -248,19 +248,19 @@ static void redraw_range(ColorBar *cb, int a, int b){
    if (cb->helpflag) {
      for (i=0;i<HELP_LINES;i++) {
        XDrawString( XCTX.display, win, XCTX.xgc.white,
-		    10,10+(i+1)*XCTX.xfont.fixed_h,
-		    help_str[i], strlen(help_str[i]) );
+                    10,10+(i+1)*XCTX.xfont.fixed_h,
+                    help_str[i], strlen(help_str[i]) );
      }
    }
    else{
      if(cb->ct->ipar[COLORTABLE_MODE]==COLORTABLE_RGB)
        XDrawString( XCTX.display, win, XCTX.xgc.white,
-		    10, 10+XCTX.xfont.fixed_h, 
-		    rgb_str, strlen(rgb_str) );
+                    10, 10+XCTX.xfont.fixed_h, 
+                    rgb_str, strlen(rgb_str) );
      else if(cb->ct->ipar[COLORTABLE_MODE]==COLORTABLE_HSV)
        XDrawString( XCTX.display, win, XCTX.xgc.white,
-		    10, 10+XCTX.xfont.fixed_h, 
-		    hsv_str, strlen(hsv_str) );
+                    10, 10+XCTX.xfont.fixed_h, 
+                    hsv_str, strlen(hsv_str) );
    }
 }
 
@@ -330,19 +330,6 @@ static void set_size(ColorBar *cb, int width, int height){
 /* creation, manipulation and callbacks functions */
 
 static ColorBar *TheCB=NULL ;
-static ColorTable clip;
-
-void ColorBarCopy(ColorTable *ct){
-  memcpy(clip.table, ct->table, ct->size * sizeof(unsigned int));
-  memcpy(clip.ipar,  ct->ipar,  COLORTABLE_NBMAX_PARAM * sizeof(int));
-  memcpy(clip.fpar,  ct->fpar,  COLORTABLE_NBMAX_PARAM * sizeof(float));
-}
-
-void ColorBarPaste(ColorTable *ct){
-  memcpy(ct->table, clip.table, ct->size * sizeof(unsigned int));
-  memcpy(ct->ipar,  clip.ipar,  COLORTABLE_NBMAX_PARAM * sizeof(int));
-  memcpy(ct->fpar,  clip.fpar,  COLORTABLE_NBMAX_PARAM * sizeof(float));
-}
 
 void ColorBarCreate(Window win, int width, int height){
   static int first=1 ;
@@ -380,28 +367,31 @@ void ColorBarChange(char *label, float min, float max, ColorTable *ct, int rgb){
   redraw_marker(TheCB);
 }
 
-void ColorBarResizeCb(Widget w, XtPointer client_data, XmDrawingAreaCallbackStruct *call_data){
+void ColorBarResizeCb(Widget w, XtPointer client_data, 
+                      XmDrawingAreaCallbackStruct *call_data){
   Dimension w1,h1;
 
   if(!TheCB) return;
   
   XtVaGetValues(WID.PD.colorDrawingArea, 
-		XmNwidth, &w1, 
-		XmNheight, &h1, 
-		NULL);    
+                XmNwidth, &w1, 
+                XmNheight, &h1, 
+                NULL);    
 
   set_size(TheCB, (int)w1, (int)h1);
   XResizeWindow(XCTX.display, TheCB->window, (int)w1, (int)h1);
   ColorBarRedraw();
 }
 
-void ColorBarExposeCb(Widget w,XtPointer client_data, XmDrawingAreaCallbackStruct *call_data){
+void ColorBarExposeCb(Widget w,XtPointer client_data, 
+                      XmDrawingAreaCallbackStruct *call_data){
   ColorBarRedraw();
 }
 
 #define ANY_MODIFIER (ShiftMask|ControlMask|Mod1Mask)
 
-void ColorBarInputCb (Widget w, XtPointer client_data, XmDrawingAreaCallbackStruct *call_data){
+void ColorBarInputCb (Widget w, XtPointer client_data, 
+                      XmDrawingAreaCallbackStruct *call_data){
 
   XEvent         *event;
   static int      p1=0, p2=0, p3=0, p4=0; /* red, green, blue, alpha */
@@ -421,106 +411,109 @@ void ColorBarInputCb (Widget w, XtPointer client_data, XmDrawingAreaCallbackStru
     XLookupString(&event->xkey, keybuf, 50, &key, &compose);
 
     switch(key){
-    case XK_1 : color_table_init_param(1, TheCB->ct, 1, 1); compute=1; break;
-    case XK_2 : color_table_init_param(2, TheCB->ct, 1, 1); compute=1; break;
-    case XK_3 : color_table_init_param(3, TheCB->ct, 1, 1); compute=1; break;
-    case XK_4 : color_table_init_param(4, TheCB->ct, 1, 1); compute=1; break;
-    case XK_5 : color_table_init_param(5, TheCB->ct, 1, 1); compute=1; break;
-    case XK_6 : color_table_init_param(6, TheCB->ct, 1, 1); compute=1; break;
-    case XK_7 : color_table_init_param(7, TheCB->ct, 1, 1); compute=1; break;
-    case XK_8 : color_table_init_param(8, TheCB->ct, 1, 1); compute=1; break;
-    case XK_9 : color_table_init_param(9, TheCB->ct, 1, 1); compute=1; break;
-    case XK_0 : color_table_init_param(0, TheCB->ct, 1, 1); compute=1; break;
-
-    case XK_c : case XK_C : ColorBarCopy(TheCB->ct); break;
-    case XK_p : case XK_P : ColorBarPaste(TheCB->ct); ColorBarRedraw(); break;
+    case XK_1 : ColorTable_InitParam(1, TheCB->ct, 1, 1); compute=1; break;
+    case XK_2 : ColorTable_InitParam(2, TheCB->ct, 1, 1); compute=1; break;
+    case XK_3 : ColorTable_InitParam(3, TheCB->ct, 1, 1); compute=1; break;
+    case XK_4 : ColorTable_InitParam(4, TheCB->ct, 1, 1); compute=1; break;
+    case XK_5 : ColorTable_InitParam(5, TheCB->ct, 1, 1); compute=1; break;
+    case XK_6 : ColorTable_InitParam(6, TheCB->ct, 1, 1); compute=1; break;
+    case XK_7 : ColorTable_InitParam(7, TheCB->ct, 1, 1); compute=1; break;
+    case XK_8 : ColorTable_InitParam(8, TheCB->ct, 1, 1); compute=1; break;
+    case XK_9 : ColorTable_InitParam(9, TheCB->ct, 1, 1); compute=1; break;
+    case XK_0 : ColorTable_InitParam(0, TheCB->ct, 1, 1); compute=1; break;
+
+    case XK_c : case XK_C : ColorTable_Copy(TheCB->ct); break;
+    case XK_p : case XK_P : ColorTable_Paste(TheCB->ct); ColorBarRedraw(); break;
     case XK_s : case XK_S : ManageCb(NULL, (XtPointer)WID.FD.saveDialog, NULL); break;
     case XK_l : case XK_L : ManageCb(NULL, (XtPointer)WID.FD.mergeDialog, NULL); return ;
     case XK_h : case XK_H : TheCB->helpflag = !TheCB->helpflag; ColorBarRedraw(); break;
 
     case XK_r : 
     case XK_R : 
-      color_table_init_param(TheCB->ct->ipar[COLORTABLE_NUMBER], 
-			     TheCB->ct, 1, 1); 
-      compute=1; break;
+      ColorTable_InitParam(TheCB->ct->ipar[COLORTABLE_NUMBER], 
+                           TheCB->ct, 1, 1); 
+      compute=1; 
+      break;
 
     case XK_m : 
     case XK_M : 
       if(TheCB->ct->ipar[COLORTABLE_MODE]==COLORTABLE_RGB)
-	TheCB->ct->ipar[COLORTABLE_MODE] = COLORTABLE_HSV;
+        TheCB->ct->ipar[COLORTABLE_MODE] = COLORTABLE_HSV;
       else
-	TheCB->ct->ipar[COLORTABLE_MODE] = COLORTABLE_RGB;
+        TheCB->ct->ipar[COLORTABLE_MODE] = COLORTABLE_RGB;
       ColorBarRedraw(); 
       break;
 
     case XK_i : 
     case XK_I : 
-      if (event->xkey.state&ANY_MODIFIER) {
-	TheCB->ct->ipar[COLORTABLE_INVERT] = !TheCB->ct->ipar[COLORTABLE_INVERT]; 
-      }
-      else{
-	TheCB->ct->ipar[COLORTABLE_SWAP] = !TheCB->ct->ipar[COLORTABLE_SWAP]; 	
-      }
-      compute=1; break;
+      if (event->xkey.state&ANY_MODIFIER)
+        TheCB->ct->ipar[COLORTABLE_INVERT] = !TheCB->ct->ipar[COLORTABLE_INVERT]; 
+      else
+        TheCB->ct->ipar[COLORTABLE_SWAP] = !TheCB->ct->ipar[COLORTABLE_SWAP];   
+      compute=1;
+      break;
 
     case XK_b :
     case XK_B :
       if (event->xkey.state&ANY_MODIFIER) {
-	TheCB->ct->fpar[COLORTABLE_BETA] -= 0.05;
-	if(TheCB->ct->fpar[COLORTABLE_BETA]<-1.0) 
-	  TheCB->ct->fpar[COLORTABLE_BETA] = -1.0;
+        TheCB->ct->fpar[COLORTABLE_BETA] -= 0.05;
+        if(TheCB->ct->fpar[COLORTABLE_BETA]<-1.0) 
+          TheCB->ct->fpar[COLORTABLE_BETA] = -1.0;
       }
       else{
-	TheCB->ct->fpar[COLORTABLE_BETA] += 0.05;
-	if(TheCB->ct->fpar[COLORTABLE_BETA]>1.0) 
-	  TheCB->ct->fpar[COLORTABLE_BETA] = 1.0;
+        TheCB->ct->fpar[COLORTABLE_BETA] += 0.05;
+        if(TheCB->ct->fpar[COLORTABLE_BETA]>1.0) 
+          TheCB->ct->fpar[COLORTABLE_BETA] = 1.0;
       }
-      compute = 1; break;
+      compute = 1;
+      break;
 
     case XK_Left  : 
       if (event->xkey.state&ANY_MODIFIER) {
-	TheCB->ct->ipar[COLORTABLE_ROTATE] += 5;
-	if(TheCB->ct->ipar[COLORTABLE_ROTATE] > TheCB->ct->size-1) 
-	  TheCB->ct->ipar[COLORTABLE_ROTATE] -= TheCB->ct->size-1;
-      }
-      else {
-	TheCB->ct->fpar[COLORTABLE_BIAS] -= 0.05; 
+        TheCB->ct->ipar[COLORTABLE_ROTATE] += 5;
+        if(TheCB->ct->ipar[COLORTABLE_ROTATE] > TheCB->ct->size-1) 
+          TheCB->ct->ipar[COLORTABLE_ROTATE] -= TheCB->ct->size-1;
       }
-      compute = 1; break;
+      else
+        TheCB->ct->fpar[COLORTABLE_BIAS] -= 0.05; 
+      compute = 1; 
+      break;
 
     case XK_Right : 
       if (event->xkey.state&ANY_MODIFIER) {
-	TheCB->ct->ipar[COLORTABLE_ROTATE] -= 5;
-	if(TheCB->ct->ipar[COLORTABLE_ROTATE]<-(TheCB->ct->size-1)) 
-	  TheCB->ct->ipar[COLORTABLE_ROTATE] += TheCB->ct->size-1;
+        TheCB->ct->ipar[COLORTABLE_ROTATE] -= 5;
+        if(TheCB->ct->ipar[COLORTABLE_ROTATE]<-(TheCB->ct->size-1)) 
+          TheCB->ct->ipar[COLORTABLE_ROTATE] += TheCB->ct->size-1;
       }
       else{
-	TheCB->ct->fpar[COLORTABLE_BIAS] += 0.05; 
+        TheCB->ct->fpar[COLORTABLE_BIAS] += 0.05; 
       }
-      compute = 1; break;
+      compute = 1;
+      break;
 
     case XK_Up :
       if (event->xkey.state&ANY_MODIFIER) {
-	TheCB->ct->fpar[COLORTABLE_ALPHAPOW] -= 0.05;
-	if (TheCB->ct->fpar[COLORTABLE_ALPHAPOW]<0.0)
-	  TheCB->ct->fpar[COLORTABLE_ALPHAPOW] = 0.0;
+        TheCB->ct->fpar[COLORTABLE_ALPHAPOW] -= 0.05;
+        if (TheCB->ct->fpar[COLORTABLE_ALPHAPOW]<0.0)
+          TheCB->ct->fpar[COLORTABLE_ALPHAPOW] = 0.0;
       }
-      else {
-	TheCB->ct->fpar[COLORTABLE_CURVE] -= 0.05;
-      }
-      compute = 1; break;
+      else
+        TheCB->ct->fpar[COLORTABLE_CURVE] -= 0.05;
+      compute = 1; 
+      break;
 
     case XK_Down :
       if (event->xkey.state&ANY_MODIFIER)
-	TheCB->ct->fpar[COLORTABLE_ALPHAPOW] += 0.05;
+        TheCB->ct->fpar[COLORTABLE_ALPHAPOW] += 0.05;
       else
-	TheCB->ct->fpar[COLORTABLE_CURVE] += 0.05;
-      compute = 1; break;      
+        TheCB->ct->fpar[COLORTABLE_CURVE] += 0.05;
+      compute = 1; 
+      break;
 
     }
 
     if(compute){
-      color_table_recompute(TheCB->ct, 1, 1);
+      ColorTable_Recompute(TheCB->ct, 1, 1);
       ColorBarRedraw();
     }
 
@@ -573,7 +566,7 @@ void ColorBarInputCb (Widget w, XtPointer client_data, XmDrawingAreaCallbackStru
       XEvent next;
       XPeekEvent(XCTX.display, &next);
       if (next.type!=MotionNotify)
-	break;
+        break;
       XNextEvent(XCTX.display, event);
     }
     modify = 1;
@@ -582,72 +575,71 @@ void ColorBarInputCb (Widget w, XtPointer client_data, XmDrawingAreaCallbackStru
   /* Modify one or more of the color curves */
   
    if (modify && (p1 || p2 || p3 || p4)) {
-      /* calculate which entry in color table to change */
-      entry = x_to_index(TheCB, event->xbutton.x);
-      /* update */
-      if (move_marker) {
-         /* changing marker position */
-         TheCB->markerpos = entry;
-         redraw_marker(TheCB);
-      }
-      else {
-         /* changing color graph */
-         int a, b, value;
-
-         value = y_to_intensity(TheCB, event->xbutton.y);
-
-         if (pentry<=entry) {
-            a = pentry;
-            b = entry;
-         }
-         else {
-            a = entry;
-            b = pentry;
+     /* calculate which entry in color table to change */
+     entry = x_to_index(TheCB, event->xbutton.x);
+     /* update */
+     if (move_marker) {
+       /* changing marker position */
+       TheCB->markerpos = entry;
+       redraw_marker(TheCB);
+     }
+     else {
+       /* changing color graph */
+       int a, b, value;
+       
+       value = y_to_intensity(TheCB, event->xbutton.y);
+
+       if (pentry<=entry) {
+         a = pentry;
+         b = entry;
+       }
+       else {
+         a = entry;
+         b = pentry;
+       }
+       
+       /* update entries from 'pentry' to 'entry' */
+       for (i=a; i<=b; i++) {
+         int red, green, blue, alpha;
+         double R,G,B,H,S,V;
+         
+         red   = UNPACK_RED  (TheCB->ct->table[i]);
+         green = UNPACK_GREEN(TheCB->ct->table[i]);
+         blue  = UNPACK_BLUE (TheCB->ct->table[i]);
+         alpha = UNPACK_ALPHA(TheCB->ct->table[i]);
+         
+         if(TheCB->ct->ipar[COLORTABLE_MODE]==COLORTABLE_RGB){
+           if (p1) { red = value; }
+           if (p2) { green = value; }
+           if (p3) { blue = value; }
+           if (p4) { alpha = value; }
+         }         
+         else if(TheCB->ct->ipar[COLORTABLE_MODE]==COLORTABLE_HSV){
+           RGB_to_HSV((double)red/255.,(double)green/255.,(double)blue/255.,
+                      &H,&S,&V);
+           if (p1) { H = 6.*(double)value/255.+EPS ; }
+           if (p2) { S = (double)value/255.; }
+           if (p3) { V = (double)value/255.; }
+           if (p4) { alpha = value; }         
+           HSV_to_RGB(H, S, V, &R,&G,&B);
+           red   = (int)(255 * R);
+           green = (int)(255 * G);
+           blue  = (int)(255 * B);
          }
-
-         /* update entries from 'pentry' to 'entry' */
-         for (i=a; i<=b; i++) {
-            int red, green, blue, alpha;
-	    double R,G,B,H,S,V;
-
-	    red   = UNPACK_RED  (TheCB->ct->table[i]);
-	    green = UNPACK_GREEN(TheCB->ct->table[i]);
-	    blue  = UNPACK_BLUE (TheCB->ct->table[i]);
-	    alpha = UNPACK_ALPHA(TheCB->ct->table[i]);
-	    
-	    if(TheCB->ct->ipar[COLORTABLE_MODE]==COLORTABLE_RGB){
-	      if (p1) { red = value; }
-	      if (p2) { green = value; }
-	      if (p3) { blue = value; }
-	      if (p4) { alpha = value; }
-	    }	   
-	    else if(TheCB->ct->ipar[COLORTABLE_MODE]==COLORTABLE_HSV){
-	      RGB_to_HSV((double)red/255.,(double)green/255.,(double)blue/255.,
-			 &H,&S,&V);
-	      if (p1) { H = 6.*(double)value/255.+EPS ; }
-	      if (p2) { S = (double)value/255.; }
-	      if (p3) { V = (double)value/255.; }
-	      if (p4) { alpha = value; }	      
-	      HSV_to_RGB(H, S, V, &R,&G,&B);
-	      red   = (int)(255 * R);
-	      green = (int)(255 * G);
-	      blue  = (int)(255 * B);
-	    }
-
-            TheCB->ct->table[i] = PACK_COLOR(red,green,blue,alpha);
-         } 
-
-         /* redraw the color curves */
-         if (pentry<entry)
-           redraw_range(TheCB, pentry-1, entry+1);
-         else
-           redraw_range(TheCB, entry-1, pentry+1);
-
-         pentry = entry;
-	 
-      }
+         
+         TheCB->ct->table[i] = PACK_COLOR(red,green,blue,alpha);
+       } 
+       
+       /* redraw the color curves */
+       if (pentry<entry)
+         redraw_range(TheCB, pentry-1, entry+1);
+       else
+         redraw_range(TheCB, entry-1, pentry+1);
+       
+       pentry = entry;
+       
+     }
    }
    
-   
 }
 
diff --git a/Unix/CbColorbar.h b/Unix/CbColorbar.h
index 91941c562e..91c439e508 100644
--- a/Unix/CbColorbar.h
+++ b/Unix/CbColorbar.h
@@ -1,4 +1,4 @@
-/* $Id: CbColorbar.h,v 1.2 2000-11-23 14:11:40 geuzaine Exp $ */
+/* $Id: CbColorbar.h,v 1.3 2000-11-26 15:43:47 geuzaine Exp $ */
 #ifndef _COLORBAR_H
 #define _COLORBAR_H
 
@@ -23,7 +23,8 @@ void ColorBarShow(void);
 void ColorBarChange(char *label, float min, float max, ColorTable *ct, int rgb);
 void ColorBarCopy(ColorTable *ct);
 void ColorBarPaste(ColorTable *ct);
-void ColorBarResizeCb(Widget w, XtPointer client_data, XmDrawingAreaCallbackStruct *call_data);
+void ColorBarResizeCb(Widget w, XtPointer client_data, 
+                      XmDrawingAreaCallbackStruct *call_data);
 void ColorBarRedraw(void);
 
 #endif
diff --git a/Unix/CbContext.cpp b/Unix/CbContext.cpp
index 8216a300e7..064bf1bc01 100644
--- a/Unix/CbContext.cpp
+++ b/Unix/CbContext.cpp
@@ -1,4 +1,4 @@
-/* $Id: CbContext.cpp,v 1.5 2000-11-25 23:10:37 geuzaine Exp $ */
+/* $Id: CbContext.cpp,v 1.6 2000-11-26 15:43:47 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -78,9 +78,9 @@ void UpdatePostButtons(void){
 
       /* toggleButt[i] */
       XtVaSetValues(WID.M.toggleButt[i],
-		    XmNlabelString, XmStringCreateSimple(txt_post[i]),
-		    XmNset, v->Visible?True:False,
-		    NULL);      
+                    XmNlabelString, XmStringCreateSimple(txt_post[i]),
+                    XmNset, v->Visible?True:False,
+                    NULL);      
       XtManageChild(WID.M.toggleButt[i]);
 
       /* timeStepButt[i] */
@@ -284,7 +284,8 @@ void ActualizeContextCb (Widget w, XtPointer client_data, XtPointer call_data){
 
   case CONTEXT_MESH :
     actual_global_context = CONTEXT_MESH;
-    XtVaSetValues(WID.M.modButt, XmNlabelString, XmStringCreateSimple("Mesh"), NULL); 
+    XtVaSetValues(WID.M.modButt, XmNlabelString, 
+                  XmStringCreateSimple("Mesh"), NULL); 
     Msg(INFO,"");
     ButtonText = txt_mesh;
     break;
@@ -297,7 +298,8 @@ void ActualizeContextCb (Widget w, XtPointer client_data, XtPointer call_data){
 
   case CONTEXT_POST :
     actual_global_context = CONTEXT_POST;
-    XtVaSetValues(WID.M.modButt, XmNlabelString, XmStringCreateSimple("Post Processing"), NULL);
+    XtVaSetValues(WID.M.modButt, XmNlabelString, 
+                  XmStringCreateSimple("Post Processing"), NULL);
     Msg(INFO,"");
     UpdatePostButtons();
     return;    
@@ -317,8 +319,8 @@ void ActualizeContextCb (Widget w, XtPointer client_data, XtPointer call_data){
     if(!last && ButtonText[i] != NULL){
       if(XtIsManaged(WID.M.toggleButt[i])) XtUnmanageChild(WID.M.toggleButt[i]);
       XtVaSetValues(WID.M.pushButt[i], 
-		    XmNlabelString,XmStringCreateSimple(ButtonText[i]),
-		    NULL);
+                    XmNlabelString,XmStringCreateSimple(ButtonText[i]),
+                    NULL);
       XtManageChild(WID.M.pushButt[i]);
     }
     else {
@@ -588,16 +590,12 @@ void NextContextCb (Widget w, XtPointer client_data, XtPointer call_data){
 
 
 int AddViewInUI(int i, char *Name, int Num){
-  //char tmp[20];
 
   if(i > NB_BUTT_MAX -1) return 1;
 
   txt_post[i-1] = (char*)Malloc(NAME_STR_L*sizeof(char));
   strncpy(txt_post[i-1],Name,NAME_STR_L);
 
-  //sprintf(tmp, " (%d)", Num);
-  //strncat(txt_post[i-1],tmp,NAME_STR_L);
-
   if(actual_global_context == CONTEXT_POST)
     ActualizeContextCb(NULL,(XtPointer)actual_global_context,NULL);
 
diff --git a/Unix/CbFile.cpp b/Unix/CbFile.cpp
index 68967c9297..6f8e52f38c 100644
--- a/Unix/CbFile.cpp
+++ b/Unix/CbFile.cpp
@@ -1,4 +1,4 @@
-/* $Id: CbFile.cpp,v 1.6 2000-11-24 12:50:06 geuzaine Exp $ */
+/* $Id: CbFile.cpp,v 1.7 2000-11-26 15:43:47 geuzaine Exp $ */
 
 #include <unistd.h>
 
@@ -32,7 +32,7 @@ static char KeepFileName[256];
 /* ------------------------------------------------------------------------ */
 
 void SaveToDisk (char *FileName, Widget warning, 
-		 void (*function)(FILE *file)){
+                 void (*function)(FILE *file)){
   FILE    *fp ;
 
   if(!WARNING_OVERRIDE){
@@ -87,12 +87,14 @@ void CreateImage (FILE *fp) {
       break;
     }
     Msg(INFOS, "X Image Dump Complete '%s'", KeepFileName);
+    Msg (INFO, "Wrote File '%s'", KeepFileName);
     break ;
 
   case PRINT_GL2GIF :
     create_gif(fp, CTX.viewport[2]-CTX.viewport[0],
-	       CTX.viewport[3]-CTX.viewport[1]);
+               CTX.viewport[3]-CTX.viewport[1]);
     Msg(INFOS, "GIF Dump Complete '%s'", KeepFileName);
+    Msg (INFO, "Wrote File '%s'", KeepFileName);
     break;
 
   case PRINT_GL2PS_SIMPLE :
@@ -102,9 +104,10 @@ void CreateImage (FILE *fp) {
     while(res == GL2PS_OVERFLOW){
       size3d += 1024*1024 ;
       gl2psBeginPage(TheBaseFileName, "Gmsh", 
-		     (CTX.print.type == PRINT_GL2PS_SIMPLE ? GL2PS_SIMPLE_SORT : GL2PS_BSP_SORT),
-		     GL2PS_SIMPLE_LINE_OFFSET | GL2PS_DRAW_BACKGROUND,
-		     GL_RGBA, 0, NULL, size3d, fp);
+                     (CTX.print.type == PRINT_GL2PS_SIMPLE ? 
+                      GL2PS_SIMPLE_SORT : GL2PS_BSP_SORT),
+                     GL2PS_SIMPLE_LINE_OFFSET | GL2PS_DRAW_BACKGROUND,
+                     GL_RGBA, 0, NULL, size3d, fp);
       CTX.stream = TO_FILE ;
       Init();
       Draw();
@@ -112,6 +115,7 @@ void CreateImage (FILE *fp) {
       res = gl2psEndPage();
     }
     Msg(INFOS, "GL2PS Output Complete '%s'", KeepFileName);
+    Msg (INFO, "Wrote File '%s'", KeepFileName);
     break;
 
   default :
diff --git a/Unix/CbGeneral.cpp b/Unix/CbGeneral.cpp
index ffd61fc653..9bfd030a18 100644
--- a/Unix/CbGeneral.cpp
+++ b/Unix/CbGeneral.cpp
@@ -1,4 +1,4 @@
-/* $Id: CbGeneral.cpp,v 1.3 2000-11-25 15:26:12 geuzaine Exp $ */
+/* $Id: CbGeneral.cpp,v 1.4 2000-11-26 15:43:47 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -45,7 +45,7 @@ void ManageCb (Widget w, XtPointer client_data, XtPointer call_data){
 void PopupHandler (Widget w, Widget pw, XEvent *event, Boolean *ctd ){
   if(((XButtonEvent *)event)->button != Button3) return;
 
-  /* force the pointer to be slightly over the remove button */
+  /* force the pointer to be slightly over the first button */
   ((XButtonEvent *)event)->x_root -= 7 ;
   ((XButtonEvent *)event)->y_root -= 7 ;
 
@@ -75,19 +75,21 @@ void CurrentInfoCb (Widget w, XtPointer client_data, XtPointer call_data){
 
     /* info geom */
     sprintf(label, "%g", s[0]);   XtVaSetValues(VLAB(0));
-    sprintf(label, "%g", s[1]/2); XtVaSetValues(VLAB(1));
+    sprintf(label, "%g", s[1]);   XtVaSetValues(VLAB(1));
     sprintf(label, "%g", s[2]);   XtVaSetValues(VLAB(2));
     sprintf(label, "%g", s[3]);   XtVaSetValues(VLAB(3));
-						
-    /* info mesh */				
+                                                
+    /* info mesh */                             
     sprintf(label, "%g", s[4]);   XtVaSetValues(VLAB(4));
     sprintf(label, "%g", s[5]);   XtVaSetValues(VLAB(5));
     sprintf(label, "%g", s[6]);   XtVaSetValues(VLAB(6));
-    sprintf(label, "%g", s[7]);   XtVaSetValues(VLAB(7));
+
+    sprintf(label, "%g", s[7]-s[8]);   XtVaSetValues(VLAB(7));
     sprintf(label, "%g", s[8]);   XtVaSetValues(VLAB(8));
     sprintf(label, "%g", s[9]);   XtVaSetValues(VLAB(9));
     sprintf(label, "%g", s[10]);  XtVaSetValues(VLAB(10));
     sprintf(label, "%g", s[11]);  XtVaSetValues(VLAB(11));
+
     sprintf(label, "%g", s[12]);  XtVaSetValues(VLAB(12));
     sprintf(label, "%g", s[13]);  XtVaSetValues(VLAB(13));
     sprintf(label, "%g", s[14]);  XtVaSetValues(VLAB(14));
@@ -98,19 +100,17 @@ void CurrentInfoCb (Widget w, XtPointer client_data, XtPointer call_data){
 
     /* info post */
 
-    s[15] = Post_ViewList ? List_Nbr(Post_ViewList) : 0 ;
-    sprintf(label, "%g", s[15]); XtVaSetValues(VLAB(18));
+    s[15] = List_Nbr(Post_ViewList) ;
+    sprintf(label, "%g", s[15]);  XtVaSetValues(VLAB(18));
 
     s[16] = s[17] = s[18] = s[19] = 0 ;
-    if(Post_ViewList){
-      for(i=0 ; i<List_Nbr(Post_ViewList) ; i++){
-	v = (Post_View*)List_Pointer(Post_ViewList, i);
-	if(v->Visible){
-	  s[16] += List_Nbr(v->Points);
-	  s[17] += List_Nbr(v->Lines);
-	  s[18] += List_Nbr(v->Triangles);
-	  s[19] += List_Nbr(v->Tetrahedra);
-	}
+    for(i=0 ; i<List_Nbr(Post_ViewList) ; i++){
+      v = (Post_View*)List_Pointer(Post_ViewList, i);
+      if(v->Visible){
+	s[16] += List_Nbr(v->Points);
+	s[17] += List_Nbr(v->Lines);
+	s[18] += List_Nbr(v->Triangles);
+	s[19] += List_Nbr(v->Tetrahedra);
       }
     }
     sprintf(label, "%g", s[16]); XtVaSetValues(VLAB(19));
diff --git a/Unix/CbGeom.cpp b/Unix/CbGeom.cpp
index a44f331783..4a6f7a4960 100644
--- a/Unix/CbGeom.cpp
+++ b/Unix/CbGeom.cpp
@@ -1,4 +1,4 @@
-/* $Id: CbGeom.cpp,v 1.4 2000-11-25 15:26:12 geuzaine Exp $ */
+/* $Id: CbGeom.cpp,v 1.5 2000-11-26 15:43:47 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -100,26 +100,26 @@ void geom_event_handler (int event) {
       Msg(STATUS,"Select Point ('e'=end, 'q'=quit)");
       ib = SelectEntity(ENT_POINT, &v,&c,&s);
       if(ib == 1){ /* left mouse butt */
-	p[n++] = v->Num; 
+        p[n++] = v->Num; 
       }
       if (ib == -1){ /* 'e' */
-	if(n >= 2) {
-	  switch(event){
-	  case GEOM_ELEM_ADD_NEW_LINE   : add_multline(n,p,TheFileName); break;
-	  case GEOM_ELEM_ADD_NEW_SPLINE : add_spline  (n,p,TheFileName); break;
-	  case GEOM_ELEM_ADD_NEW_BEZIER : add_bezier  (n,p,TheFileName); break;
-	  case GEOM_ELEM_ADD_NEW_BSPLINE: add_bspline (n,p,TheFileName); break;
-	  }
-	}
-	n=0;
-	ZeroHighlight(&M);
-	Replot();
+        if(n >= 2) {
+          switch(event){
+          case GEOM_ELEM_ADD_NEW_LINE   : add_multline(n,p,TheFileName); break;
+          case GEOM_ELEM_ADD_NEW_SPLINE : add_spline  (n,p,TheFileName); break;
+          case GEOM_ELEM_ADD_NEW_BEZIER : add_bezier  (n,p,TheFileName); break;
+          case GEOM_ELEM_ADD_NEW_BSPLINE: add_bspline (n,p,TheFileName); break;
+          }
+        }
+        n=0;
+        ZeroHighlight(&M);
+        Replot();
       }
       if(ib == 0){ /* 'q' */
-	n=0 ;
-	ZeroHighlight(&M);
-	Replot();
-	break;
+        n=0 ;
+        ZeroHighlight(&M);
+        Replot();
+        break;
       }
     }
     break;
@@ -132,19 +132,19 @@ void geom_event_handler (int event) {
       if(n == 2) Msg(STATUS,"Select Ending Point ('q'=quit)");
       ib = SelectEntity(ENT_POINT, &v,&c,&s);
       if(ib == 1) { /* left mouse butt */
-	p[n++] = v->Num; 
+        p[n++] = v->Num; 
       }
       if(ib == 0) { /* 'q' */
-	n=0 ;
-	ZeroHighlight(&M);
-	Replot();
-	break;
+        n=0 ;
+        ZeroHighlight(&M);
+        Replot();
+        break;
       }
       if(n == 3){
-	add_circ(p[1],p[0],p[2],TheFileName); /* begin, center, end */
-	ZeroHighlight(&M);
-	Replot();
-	n=0;
+        add_circ(p[1],p[0],p[2],TheFileName); /* begin, center, end */
+        ZeroHighlight(&M);
+        Replot();
+        n=0;
       }
     }
     break;
@@ -158,19 +158,19 @@ void geom_event_handler (int event) {
       if(n == 3) Msg(STATUS,"Select Ending Point ('q'=quit)");
       ib = SelectEntity(ENT_POINT, &v,&c,&s);
       if(ib == 1) { /* left mouse butt */
-	p[n++] = v->Num; 
+        p[n++] = v->Num; 
       }
       if(ib == 0){ /* 'q' */
-	n=0 ;
-	ZeroHighlight(&M);
-	Replot();
-	break;
+        n=0 ;
+        ZeroHighlight(&M);
+        Replot();
+        break;
       }
       if(n == 4){
-	add_ell(p[3],p[2],p[0],p[1],TheFileName);
-	ZeroHighlight(&M);
-	Replot();
-	n=0;
+        add_ell(p[3],p[2],p[0],p[1],TheFileName);
+        ZeroHighlight(&M);
+        Replot();
+        n=0;
       }
     }
     break;
@@ -190,50 +190,50 @@ void geom_event_handler (int event) {
       List_Reset(Liste1);
       List_Reset(Liste2);
       
-      while(1) {	
-	Msg(STATUS,"Select Boundary ('q'=quit)");
-	ib = SelectEntity(type, &v,&c,&s);
-	if(ib <= 0){
-	  ZeroHighlight(&M);
-	  Replot();
-	  goto stopall;
-	}  	
-	if(SelectContour (type, (type==ENT_LINE)?c->Num:s->Num, Liste1)){
-	  if(type==ENT_LINE) 
-	    add_loop(Liste1,TheFileName,&zone);
-	  else
-	    add_vol(Liste1,TheFileName,&zone);
-	  List_Reset(Liste1);
-	  List_Add(Liste2,&zone);
-	  while(1){
-	    Msg(STATUS,"Select Holes ('q'=quit)");
-	    ib = SelectEntity(type, &v,&c,&s); 
-	    if(ib <= 0){
-	      ZeroHighlight(&M);
-	      Replot();
-	      break;
-	    }
-	    List_Reset(Liste1);
-	    if(SelectContour (type, (type==ENT_LINE)?c->Num:s->Num, Liste1)){
-	      if(type==ENT_LINE) 
-		add_loop(Liste1,TheFileName,&zone);
-	      else
-		add_vol(Liste1,TheFileName,&zone);
-	      List_Reset(Liste1);
-	      List_Add(Liste2,&zone);
-	    }
-	  }
-	  if(List_Nbr(Liste2)){
-	    switch(event){
-	    case GEOM_ELEM_ADD_NEW_RULED_SURF : add_surf(Liste2,TheFileName,0,1); break;
-	    case GEOM_ELEM_ADD_NEW_PLANE_SURF : add_surf(Liste2,TheFileName,0,2); break;
-	    case GEOM_ELEM_ADD_NEW_VOLUME :  add_multvol(Liste2,TheFileName); break;
-	    }
-	    ZeroHighlight(&M);
-	    Replot();
-	    break;
-	  }
-	}
+      while(1) {        
+        Msg(STATUS,"Select Boundary ('q'=quit)");
+        ib = SelectEntity(type, &v,&c,&s);
+        if(ib <= 0){
+          ZeroHighlight(&M);
+          Replot();
+          goto stopall;
+        }       
+        if(SelectContour (type, (type==ENT_LINE)?c->Num:s->Num, Liste1)){
+          if(type==ENT_LINE) 
+            add_loop(Liste1,TheFileName,&zone);
+          else
+            add_vol(Liste1,TheFileName,&zone);
+          List_Reset(Liste1);
+          List_Add(Liste2,&zone);
+          while(1){
+            Msg(STATUS,"Select Holes ('q'=quit)");
+            ib = SelectEntity(type, &v,&c,&s); 
+            if(ib <= 0){
+              ZeroHighlight(&M);
+              Replot();
+              break;
+            }
+            List_Reset(Liste1);
+            if(SelectContour (type, (type==ENT_LINE)?c->Num:s->Num, Liste1)){
+              if(type==ENT_LINE) 
+                add_loop(Liste1,TheFileName,&zone);
+              else
+                add_vol(Liste1,TheFileName,&zone);
+              List_Reset(Liste1);
+              List_Add(Liste2,&zone);
+            }
+          }
+          if(List_Nbr(Liste2)){
+            switch(event){
+            case GEOM_ELEM_ADD_NEW_RULED_SURF : add_surf(Liste2,TheFileName,0,1); break;
+            case GEOM_ELEM_ADD_NEW_PLANE_SURF : add_surf(Liste2,TheFileName,0,2); break;
+            case GEOM_ELEM_ADD_NEW_VOLUME :  add_multvol(Liste2,TheFileName); break;
+            }
+            ZeroHighlight(&M);
+            Replot();
+            break;
+          }
+        }
       }
     }
     stopall : ;
@@ -247,9 +247,9 @@ void geom_event_handler (int event) {
     while(1){
       Msg(STATUS,"Select Point ('q'=quit)");
       if(!SelectEntity(ENT_POINT, &v,&c,&s)){
-	ZeroHighlight(&M);
-	Replot();
-	break;
+        ZeroHighlight(&M);
+        Replot();
+        break;
       }
       translate_pt(event==GEOM_ELEM_ADD_TRANSLATE_POINT?1:0,v->Num,TheFileName);
       ZeroHighlight(&M);
@@ -261,9 +261,9 @@ void geom_event_handler (int event) {
     while(1){
       Msg(STATUS,"Select Line ('q'=quit)");
       if(!SelectEntity(ENT_LINE, &v,&c,&s)){
-	ZeroHighlight(&M);
-	Replot();
-	break;
+        ZeroHighlight(&M);
+        Replot();
+        break;
       }
       translate_seg(event==GEOM_ELEM_ADD_TRANSLATE_LINE?1:0,c->Num,TheFileName);
       ZeroHighlight(&M);
@@ -275,9 +275,9 @@ void geom_event_handler (int event) {
     while(1){
       Msg(STATUS,"Select Surface ('q'=quit)");
       if(!SelectEntity(ENT_SURFACE, &v,&c,&s)){
-	ZeroHighlight(&M);
-	Replot();
-	break;
+        ZeroHighlight(&M);
+        Replot();
+        break;
       }
       translate_surf(event==GEOM_ELEM_ADD_TRANSLATE_SURF?1:0,s->Num,TheFileName);
       ZeroHighlight(&M);
@@ -291,9 +291,9 @@ void geom_event_handler (int event) {
     while(1){
       Msg(STATUS,"Select Point ('q'=quit)");
       if(!SelectEntity(ENT_POINT, &v,&c,&s)){
-	ZeroHighlight(&M);
-	Replot();
-	break;
+        ZeroHighlight(&M);
+        Replot();
+        break;
       }
       rotate(event==GEOM_ELEM_ADD_ROTATE_POINT?1:0,v->Num,TheFileName,"Point");
       ZeroHighlight(&M);
@@ -305,9 +305,9 @@ void geom_event_handler (int event) {
     while(1){
       Msg(STATUS,"Select Line ('q'=quit)");
       if(!SelectEntity(ENT_LINE, &v,&c,&s)){
-	ZeroHighlight(&M);
-	Replot();
-	break;
+        ZeroHighlight(&M);
+        Replot();
+        break;
       }
       rotate(event==GEOM_ELEM_ADD_ROTATE_LINE?1:0,c->Num,TheFileName,"Line");
       ZeroHighlight(&M);
@@ -319,9 +319,9 @@ void geom_event_handler (int event) {
     while(1){
       Msg(STATUS,"Select Surface ('q'=quit)");
       if(!SelectEntity(ENT_SURFACE, &v,&c,&s)){
-	ZeroHighlight(&M);
-	Replot();
-	break;
+        ZeroHighlight(&M);
+        Replot();
+        break;
       }
       rotate(event==GEOM_ELEM_ADD_ROTATE_SURF?1:0,s->Num,TheFileName,"Surface");
       ZeroHighlight(&M);
@@ -336,13 +336,13 @@ void geom_event_handler (int event) {
     while(1){
       Msg(STATUS,"Select Point ('q'=quit)");
       if(!SelectEntity(ENT_POINT, &v,&c,&s)){
-	ZeroHighlight(&M);
-	Replot(); 
-	break;
+        ZeroHighlight(&M);
+        Replot(); 
+        break;
       }
       event==GEOM_ELEM_EXTRUDE_TRANSLATE_POINT ? 
-	extrude(v->Num,TheFileName, "Point") :
-	protude(v->Num,TheFileName, "Point") ;
+        extrude(v->Num,TheFileName, "Point") :
+        protude(v->Num,TheFileName, "Point") ;
       ZeroHighlight(&M);
       Replot();
     }
@@ -352,13 +352,13 @@ void geom_event_handler (int event) {
     while(1){
       Msg(STATUS,"Select Line ('q'=quit)");
       if(!SelectEntity(ENT_LINE, &v,&c,&s)){
-	ZeroHighlight(&M);
-	Replot();
-	break;
+        ZeroHighlight(&M);
+        Replot();
+        break;
       }
       event==GEOM_ELEM_EXTRUDE_TRANSLATE_LINE ? 
-	extrude(c->Num,TheFileName, "Line") :
-	protude(c->Num,TheFileName, "Line") ;
+        extrude(c->Num,TheFileName, "Line") :
+        protude(c->Num,TheFileName, "Line") ;
       ZeroHighlight(&M);
       Replot();
     }
@@ -368,13 +368,13 @@ void geom_event_handler (int event) {
     while(1){
       Msg(STATUS,"Select Surface ('q'=quit)");
       if(!SelectEntity(ENT_SURFACE, &v,&c,&s)){
-	ZeroHighlight(&M);
-	Replot();
-	break;
+        ZeroHighlight(&M);
+        Replot();
+        break;
       }
       event==GEOM_ELEM_EXTRUDE_TRANSLATE_SURF ? 
-	extrude(s->Num,TheFileName, "Surface") :
-	protude(s->Num,TheFileName, "Surface") ;
+        extrude(s->Num,TheFileName, "Surface") :
+        protude(s->Num,TheFileName, "Surface") ;
       ZeroHighlight(&M);
       Replot();
     }
@@ -386,9 +386,9 @@ void geom_event_handler (int event) {
     while(1){
       Msg(STATUS,"Select Point ('q'=quit)");
       if(!SelectEntity(ENT_POINT, &v,&c,&s)){
-	ZeroHighlight(&M);
-	Replot();
-	break;
+        ZeroHighlight(&M);
+        Replot();
+        break;
       }
       dilate(event==GEOM_ELEM_ADD_DILATE_POINT?1:0,v->Num,TheFileName,"Point");
       ZeroHighlight(&M);
@@ -400,9 +400,9 @@ void geom_event_handler (int event) {
     while(1){
       Msg(STATUS,"Select Line ('q'=quit)");
       if(!SelectEntity(ENT_LINE, &v,&c,&s)){
-	ZeroHighlight(&M);
-	Replot();
-	break;
+        ZeroHighlight(&M);
+        Replot();
+        break;
       }
       dilate(event==GEOM_ELEM_ADD_DILATE_LINE?1:0,c->Num,TheFileName,"Line");
       ZeroHighlight(&M);
@@ -414,9 +414,9 @@ void geom_event_handler (int event) {
     while(1){
       Msg(STATUS,"Select Surface ('q'=quit)");
       if(!SelectEntity(ENT_SURFACE, &v,&c,&s)){
-	ZeroHighlight(&M);
-	Replot();
-	break;
+        ZeroHighlight(&M);
+        Replot();
+        break;
       }
       dilate(event==GEOM_ELEM_ADD_DILATE_SURF?1:0,s->Num,TheFileName,"Surface");
       ZeroHighlight(&M);
@@ -431,9 +431,9 @@ void geom_event_handler (int event) {
     while(1){
       Msg(STATUS,"Select Point ('q'=quit)");
       if(!SelectEntity(ENT_POINT, &v,&c,&s)){
-	ZeroHighlight(&M);
-	Replot();
-	break;
+        ZeroHighlight(&M);
+        Replot();
+        break;
       }
       del_pnt(v->Num,TheFileName);
       ZeroHighlight(&M);
@@ -444,9 +444,9 @@ void geom_event_handler (int event) {
     while(1){
       Msg(STATUS,"Select Line ('q'=quit)");
       if(!SelectEntity(ENT_LINE, &v,&c,&s)){
-	ZeroHighlight(&M);
-	Replot();
-	break;
+        ZeroHighlight(&M);
+        Replot();
+        break;
       }
       del_seg(c->Num,TheFileName);
       ZeroHighlight(&M);
@@ -457,9 +457,9 @@ void geom_event_handler (int event) {
     while(1){
       Msg(STATUS,"Select Point ('q'=quit)");
       if(!SelectEntity(ENT_SURFACE, &v,&c,&s)){
-	ZeroHighlight(&M);
-	Replot();
-	break;
+        ZeroHighlight(&M);
+        Replot();
+        break;
       }
       del_srf(s->Num,TheFileName);
       ZeroHighlight(&M);
@@ -481,39 +481,39 @@ void geom_event_handler (int event) {
     Liste1 = List_Create(5,5,sizeof(int));
     while(1){
       switch(event){
-	case GEOM_PHYS_ADD_POINT:
-	  Msg(STATUS,"Select Point ('e'=end, 'q'=quit)"); 
-	  type = 0;
-	  break;
-	case GEOM_PHYS_ADD_LINE:
-	  Msg(STATUS,"Select Line ('e'=end, 'q'=quit)"); 
-	  type = 1;
-	  break;
-	case GEOM_PHYS_ADD_SURF:
-	  Msg(STATUS,"Select Surface ('e'=end, 'q'=quit)"); 
-	  type = 2;
-	  break;
+        case GEOM_PHYS_ADD_POINT:
+          Msg(STATUS,"Select Point ('e'=end, 'q'=quit)"); 
+          type = 0;
+          break;
+        case GEOM_PHYS_ADD_LINE:
+          Msg(STATUS,"Select Line ('e'=end, 'q'=quit)"); 
+          type = 1;
+          break;
+        case GEOM_PHYS_ADD_SURF:
+          Msg(STATUS,"Select Surface ('e'=end, 'q'=quit)"); 
+          type = 2;
+          break;
       }
       ib = SelectEntity(type, &v,&c,&s);
       if(ib == 1){ /* left mouse */
-	switch(event){
-	case GEOM_PHYS_ADD_POINT: List_Add(Liste1, &v->Num); break;
-	case GEOM_PHYS_ADD_LINE:  List_Add(Liste1, &c->Num); break;
-	case GEOM_PHYS_ADD_SURF:  List_Add(Liste1, &s->Num); break;
-	}
+        switch(event){
+        case GEOM_PHYS_ADD_POINT: List_Add(Liste1, &v->Num); break;
+        case GEOM_PHYS_ADD_LINE:  List_Add(Liste1, &c->Num); break;
+        case GEOM_PHYS_ADD_SURF:  List_Add(Liste1, &s->Num); break;
+        }
       }
       if(ib == -1){ /* end */
-	if(List_Nbr(Liste1)){
-	  add_physical_entity(Liste1,TheFileName,type,&zone);
-	  List_Reset(Liste1);
-	  ZeroHighlight(&M);
-	  Replot();
-	}
+        if(List_Nbr(Liste1)){
+          add_physical_entity(Liste1,TheFileName,type,&zone);
+          List_Reset(Liste1);
+          ZeroHighlight(&M);
+          Replot();
+        }
       }
       if(ib == 0){
-	ZeroHighlight(&M);
-	Replot();
-	break;
+        ZeroHighlight(&M);
+        Replot();
+        break;
       }
     }
     break;
diff --git a/Unix/CbInput.cpp b/Unix/CbInput.cpp
index 7116d97219..3939c42f2a 100644
--- a/Unix/CbInput.cpp
+++ b/Unix/CbInput.cpp
@@ -1,4 +1,4 @@
-/* $Id: CbInput.cpp,v 1.5 2000-11-25 23:10:37 geuzaine Exp $ */
+/* $Id: CbInput.cpp,v 1.6 2000-11-26 15:43:48 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -18,11 +18,8 @@
 extern Context_T   CTX ;
 extern XContext_T  XCTX ;
 extern Widgets_T   WID ;
-
-extern GLdouble   vxmin, vxmax, vymin, vymax;
-extern Mesh       M;
-extern double     LC, MiddleLC;
-extern double     ClipPlane[4];
+extern Mesh        M;
+extern GLdouble    vxmin, vxmax, vymin, vymax;
 
 static int        Modifier=0;
 
@@ -56,13 +53,13 @@ void KeyboardAccel(XEvent *event){
 
       /*
     case XK_Up :
-      ClipPlane[2] = 1. ;
-      if(fabs(ClipPlane[3]-LC/20 <1.)) ClipPlane[3] -= LC/20. ;
+      CTX.clip_plane0[2] = 1. ;
+      if(fabs(CTX.clip_plane0[3]-CTX.lc/20. <1.)) CTX.clip_plane0[3] -= CTX.lc/20. ;
       Init(); Draw();
       break;
     case XK_Down :
-      ClipPlane[2] = 1. ;
-      if(fabs(ClipPlane[3]+LC/20 <1.)) ClipPlane[3] += LC/20. ;
+      CTX.clip_plane0[2] = 1. ;
+      if(fabs(CTX.clip_plane0[3]+CTX.lc/20 <1.)) CTX.clip_plane0[3] += CTX.lc/20. ;
       Init(); Draw();
       break;
       */
@@ -212,7 +209,7 @@ void KeyboardAccel(XEvent *event){
     case XK_h : case XK_H :
       CTX.geom.highlight = !CTX.geom.highlight;
       CTX.geom.highlight ? Msg(INFOS, "Highlight Enabled") : 
-	Msg(INFOS, "Highlight Disabled");
+        Msg(INFOS, "Highlight Disabled");
       break;
     case XK_c : case XK_C :
       if(CTX.color.id==0) InitColors(&CTX.color,1);
@@ -224,11 +221,11 @@ void KeyboardAccel(XEvent *event){
       break;
     case XK_d : case XK_D :
       if(!CTX.mesh.hidden && !CTX.mesh.shade)
-	CTX.mesh.hidden = 1;
+        CTX.mesh.hidden = 1;
       else if(CTX.mesh.hidden && !CTX.mesh.shade)  
-	CTX.mesh.shade = 1;
+        CTX.mesh.shade = 1;
       else{
-	CTX.mesh.hidden = 0; CTX.mesh.shade = 0; 
+        CTX.mesh.hidden = 0; CTX.mesh.shade = 0; 
       }
       XtVaSetValues(WID.OD.meshAspectButt[2],XmNset,CTX.mesh.hidden&&CTX.mesh.shade, NULL);
       XtVaSetValues(WID.OD.meshAspectButt[1],XmNset,CTX.mesh.hidden&&!CTX.mesh.shade, NULL);
@@ -260,64 +257,64 @@ void KeyboardAccel(XEvent *event){
     case XK_p :
       CTX.geom.points = !CTX.geom.points;
       if(!CTX.geom.vis_type){
-	XtVaSetValues(WID.OD.geomVisibleButt[0], XmNset, CTX.geom.points, NULL);
-	XmUpdateDisplay(WID.OD.geomVisibleButt[0]); 
+        XtVaSetValues(WID.OD.geomVisibleButt[0], XmNset, CTX.geom.points, NULL);
+        XmUpdateDisplay(WID.OD.geomVisibleButt[0]); 
       }
       Init(); Draw();
       break;
     case XK_P :
       CTX.mesh.points = !CTX.mesh.points;
       if(!CTX.mesh.vis_type){
-	XtVaSetValues(WID.OD.meshVisibleButt[0], XmNset, CTX.mesh.points, NULL);
-	XmUpdateDisplay(WID.OD.meshVisibleButt[0]); 
+        XtVaSetValues(WID.OD.meshVisibleButt[0], XmNset, CTX.mesh.points, NULL);
+        XmUpdateDisplay(WID.OD.meshVisibleButt[0]); 
       }
       Init(); Draw();
       break;
     case XK_l :
       CTX.geom.lines = !CTX.geom.lines;
       if(!CTX.geom.vis_type){
-	XtVaSetValues(WID.OD.geomVisibleButt[1], XmNset, CTX.geom.lines, NULL);
-	XmUpdateDisplay(WID.OD.geomVisibleButt[1]); 
+        XtVaSetValues(WID.OD.geomVisibleButt[1], XmNset, CTX.geom.lines, NULL);
+        XmUpdateDisplay(WID.OD.geomVisibleButt[1]); 
       }
       Init(); Draw();
       break;
     case XK_L :
       CTX.mesh.lines = !CTX.mesh.lines;
       if(!CTX.mesh.vis_type){
-	XtVaSetValues(WID.OD.meshVisibleButt[1], XmNset, CTX.mesh.lines, NULL);
-	XmUpdateDisplay(WID.OD.meshVisibleButt[1]); 
+        XtVaSetValues(WID.OD.meshVisibleButt[1], XmNset, CTX.mesh.lines, NULL);
+        XmUpdateDisplay(WID.OD.meshVisibleButt[1]); 
       }
       Init(); Draw();
       break;
     case XK_s :
       CTX.geom.surfaces = !CTX.geom.surfaces;
       if(!CTX.geom.vis_type){
-	XtVaSetValues(WID.OD.geomVisibleButt[2], XmNset, CTX.geom.surfaces, NULL);
-	XmUpdateDisplay(WID.OD.geomVisibleButt[2]); 
+        XtVaSetValues(WID.OD.geomVisibleButt[2], XmNset, CTX.geom.surfaces, NULL);
+        XmUpdateDisplay(WID.OD.geomVisibleButt[2]); 
       }
       Init(); Draw();
       break;
     case XK_S :
       CTX.mesh.surfaces = !CTX.mesh.surfaces;
       if(!CTX.mesh.vis_type){
-	XtVaSetValues(WID.OD.meshVisibleButt[2], XmNset, CTX.mesh.surfaces, NULL);
-	XmUpdateDisplay(WID.OD.meshVisibleButt[2]); 
+        XtVaSetValues(WID.OD.meshVisibleButt[2], XmNset, CTX.mesh.surfaces, NULL);
+        XmUpdateDisplay(WID.OD.meshVisibleButt[2]); 
       }
       Init(); Draw();
       break;
     case XK_v :
       CTX.geom.volumes = !CTX.geom.volumes;
       if(!CTX.geom.vis_type){
-	XtVaSetValues(WID.OD.geomVisibleButt[3], XmNset, CTX.geom.volumes, NULL);
-	XmUpdateDisplay(WID.OD.geomVisibleButt[3]); 
+        XtVaSetValues(WID.OD.geomVisibleButt[3], XmNset, CTX.geom.volumes, NULL);
+        XmUpdateDisplay(WID.OD.geomVisibleButt[3]); 
       }
       Init(); Draw();
       break;
     case XK_V :
       CTX.mesh.volumes = !CTX.mesh.volumes;
       if(!CTX.mesh.vis_type){
-	XtVaSetValues(WID.OD.meshVisibleButt[3], XmNset, CTX.mesh.volumes, NULL);
-	XmUpdateDisplay(WID.OD.meshVisibleButt[3]); 
+        XtVaSetValues(WID.OD.meshVisibleButt[3], XmNset, CTX.mesh.volumes, NULL);
+        XmUpdateDisplay(WID.OD.meshVisibleButt[3]); 
       }
       Init(); Draw();
       break;
@@ -351,9 +348,9 @@ void KeyboardAccel(XEvent *event){
 
 void Process_SelectionBuffer(int x, int y, int *n, GLuint *ii, GLuint *jj);
 void Filter_SelectionBuffer(int n, GLuint *typ, GLuint *ient, Vertex **thev,
-			    Curve **thec, Surface **thes, Mesh *m);
+                            Curve **thec, Surface **thes, Mesh *m);
 void myZoom(GLdouble X1, GLdouble X2, GLdouble Y1, GLdouble Y2,
-	    GLdouble Xc1, GLdouble Xc2, GLdouble Yc1, GLdouble Yc2);
+            GLdouble Xc1, GLdouble Xc2, GLdouble Yc1, GLdouble Yc2);
 
 void InputCb (Widget w, XtPointer client_data, GLwDrawingAreaCallbackStruct *cb){
   XEvent         *event;
@@ -414,65 +411,65 @@ void InputCb (Widget w, XtPointer client_data, GLwDrawingAreaCallbackStruct *cb)
     switch(ibut){
     case 1:
       if(!ZoomClick && Modifier){
-	xb = vxmin + ((GLdouble) x / width) * (vxmax - vxmin);
-	yb = vymax - ((GLdouble) y / height) * (vymax - vymin);
-	xc1 = xb/CTX.s[0] - CTX.t[0];
-	yc1 = yb/CTX.s[1] - CTX.t[1];
-	ZoomClick=1;
-	movzx = movzy = 0;
-	Modifier = 0;
+        xb = vxmin + ((GLdouble) x / width) * (vxmax - vxmin);
+        yb = vymax - ((GLdouble) y / height) * (vymax - vymin);
+        xc1 = xb/CTX.s[0] - CTX.t[0];
+        yc1 = yb/CTX.s[1] - CTX.t[1];
+        ZoomClick=1;
+        movzx = movzy = 0;
+        Modifier = 0;
       }
       else if(ZoomClick){
-	xe = vxmin + ((GLdouble) x / width) * (vxmax - vxmin);
-	ye = vymax - ((GLdouble) y / height) * (vymax - vymin);
-	xc2 = xe/CTX.s[0] - CTX.t[0];
-	yc2 = ye/CTX.s[1] - CTX.t[1];	  
-	ZoomClick=0;
-	if(CTX.overlay){
-	  glXMakeCurrent(XtDisplay(WID.G.glo), XtWindow(WID.G.glo), XCTX.glo.context);
-	  glClearIndex(0);
-	  glClear(GL_COLOR_BUFFER_BIT);  
-	  glXMakeCurrent(XtDisplay(WID.G.glw), XtWindow(WID.G.glw), XCTX.glw.context);
-	}
-	if(xb!=xe && yb!=ye)
-	  myZoom(xb,xe,yb,ye,xc1,xc2,yc1,yc2);
+        xe = vxmin + ((GLdouble) x / width) * (vxmax - vxmin);
+        ye = vymax - ((GLdouble) y / height) * (vymax - vymin);
+        xc2 = xe/CTX.s[0] - CTX.t[0];
+        yc2 = ye/CTX.s[1] - CTX.t[1];     
+        ZoomClick=0;
+        if(CTX.overlay){
+          glXMakeCurrent(XtDisplay(WID.G.glo), XtWindow(WID.G.glo), XCTX.glo.context);
+          glClearIndex(0);
+          glClear(GL_COLOR_BUFFER_BIT);  
+          glXMakeCurrent(XtDisplay(WID.G.glw), XtWindow(WID.G.glw), XCTX.glw.context);
+        }
+        if(xb!=xe && yb!=ye)
+          myZoom(xb,xe,yb,ye,xc1,xc2,yc1,yc2);
       } 
       break;
     case 2:
       if(Modifier && !ZoomClick){
-	Modifier = 0;
-	set_s(1, CTX.s[0]);
-	set_s(2, CTX.s[0]);
-	Init();
-	Draw();
+        Modifier = 0;
+        set_s(1, CTX.s[0]);
+        set_s(2, CTX.s[0]);
+        Init();
+        Draw();
       }
       else{
-	ZoomClick=0;
-	if(CTX.overlay){
-	  glXMakeCurrent(XtDisplay(WID.G.glo), XtWindow(WID.G.glo), XCTX.glo.context);
-	  glClearIndex(0);
-	  glClear(GL_COLOR_BUFFER_BIT);  
-	  glXMakeCurrent(XtDisplay(WID.G.glw), XtWindow(WID.G.glw), XCTX.glw.context);
-	}
+        ZoomClick=0;
+        if(CTX.overlay){
+          glXMakeCurrent(XtDisplay(WID.G.glo), XtWindow(WID.G.glo), XCTX.glo.context);
+          glClearIndex(0);
+          glClear(GL_COLOR_BUFFER_BIT);  
+          glXMakeCurrent(XtDisplay(WID.G.glw), XtWindow(WID.G.glw), XCTX.glw.context);
+        }
       }
       break;      
     case 3:
       if(Modifier && !ZoomClick){
-	Modifier = 0;
-	set_r(0,0.); set_r(1,0.); set_r(2,0.); 
-	set_t(0,0.); set_t(1,0.); set_t(2,0.);
-	set_s(0,1.); set_s(1,1.); set_s(2,1.);
-	Init();
-	Draw();
+        Modifier = 0;
+        set_r(0,0.); set_r(1,0.); set_r(2,0.); 
+        set_t(0,0.); set_t(1,0.); set_t(2,0.);
+        set_s(0,1.); set_s(1,1.); set_s(2,1.);
+        Init();
+        Draw();
       }
       else{
-	ZoomClick=0;
-	if(CTX.overlay){
-	  glXMakeCurrent(XtDisplay(WID.G.glo), XtWindow(WID.G.glo), XCTX.glo.context);
-	  glClearIndex(0);
-	  glClear(GL_COLOR_BUFFER_BIT);  
-	  glXMakeCurrent(XtDisplay(WID.G.glw), XtWindow(WID.G.glw), XCTX.glw.context);
-	}
+        ZoomClick=0;
+        if(CTX.overlay){
+          glXMakeCurrent(XtDisplay(WID.G.glo), XtWindow(WID.G.glo), XCTX.glo.context);
+          glClearIndex(0);
+          glClear(GL_COLOR_BUFFER_BIT);  
+          glXMakeCurrent(XtDisplay(WID.G.glw), XtWindow(WID.G.glw), XCTX.glw.context);
+        }
       }
       break;
     }
@@ -494,7 +491,7 @@ void InputCb (Widget w, XtPointer client_data, GLwDrawingAreaCallbackStruct *cb)
       previous_mesh_draw = CTX.mesh.draw ;
       previous_post_draw = CTX.post.draw ;
       if(ButtonPressed>0){
-	if(CTX.fast) CTX.mesh.draw = CTX.post.draw = 0;
+        if(CTX.fast) CTX.mesh.draw = CTX.post.draw = 0;
       }
       Draw();
       CTX.mesh.draw = previous_mesh_draw ;
@@ -525,178 +522,178 @@ void InputCb (Widget w, XtPointer client_data, GLwDrawingAreaCallbackStruct *cb)
       xz = vxmin + ((GLdouble) event->xbutton.x / width) * (vxmax - vxmin);
       yz = vymax - ((GLdouble) event->xbutton.y / height) * (vymax - vymin) ;
       if(CTX.overlay) {
-	movzx = xz - xb; movzy = yz - yb;
-	InitOv();
-	glLineWidth(1.);
-	glClearIndex(0);
-	glClear(GL_COLOR_BUFFER_BIT);  
-	glIndexi((CTX.color.bg<CTX.color.fg)?XCTX.xcolor.ovwhite:XCTX.xcolor.ovblack);
-	glBegin(GL_LINE_STRIP);
-	glVertex2d(xb,yb);
-	glVertex2d(xb+movzx,yb);
-	glVertex2d(xb+movzx,yb+movzy);
-	glVertex2d(xb,yb+movzy);
-	glVertex2d(xb,yb);
-	glEnd();
-
-	/* Dessine le plus gd rectangle possible si ortho */
-
-	/*
-	if(fabs((double)movzx/(double)movzy) > ((double)width/(double)height)){
-	  constry = movzy;
-	  constrx = sign(movzx)*fabs(movzy)*((double)width/(double)height);
-	}
-	else{
-	  constrx = movzx;
-	  constry = sign(movzy)*fabs(movzx)*((double)height/(double)width);
-	}
-	glIndexi(theRed);
-	glBegin(GL_LINE_STRIP);
-	glVertex2d(xb+constrx,yb);
-	glVertex2d(xb+constrx,yb+constry);
-	glVertex2d(xb,yb+constry);
-	glEnd();
-	*/
-
-	glXMakeCurrent(XtDisplay(WID.G.glw), XtWindow(WID.G.glw), XCTX.glw.context);
+        movzx = xz - xb; movzy = yz - yb;
+        InitOv();
+        glLineWidth(1.);
+        glClearIndex(0);
+        glClear(GL_COLOR_BUFFER_BIT);  
+        glIndexi((CTX.color.bg<CTX.color.fg)?XCTX.xcolor.ovwhite:XCTX.xcolor.ovblack);
+        glBegin(GL_LINE_STRIP);
+        glVertex2d(xb,yb);
+        glVertex2d(xb+movzx,yb);
+        glVertex2d(xb+movzx,yb+movzy);
+        glVertex2d(xb,yb+movzy);
+        glVertex2d(xb,yb);
+        glEnd();
+
+        /* Dessine le plus gd rectangle possible si ortho */
+
+        /*
+        if(fabs((double)movzx/(double)movzy) > ((double)width/(double)height)){
+          constry = movzy;
+          constrx = sign(movzx)*fabs(movzy)*((double)width/(double)height);
+        }
+        else{
+          constrx = movzx;
+          constry = sign(movzy)*fabs(movzx)*((double)height/(double)width);
+        }
+        glIndexi(theRed);
+        glBegin(GL_LINE_STRIP);
+        glVertex2d(xb+constrx,yb);
+        glVertex2d(xb+constrx,yb+constry);
+        glVertex2d(xb,yb+constry);
+        glEnd();
+        */
+
+        glXMakeCurrent(XtDisplay(WID.G.glw), XtWindow(WID.G.glw), XCTX.glw.context);
       }
       else {
-	glPopMatrix();
-	glDisable(GL_DEPTH_TEST);
-	glDisable(GL_LIGHTING);
-	glMatrixMode(GL_PROJECTION);
-	glPushMatrix();
-	glLoadIdentity();
-	gluOrtho2D(vxmin, vxmax, vymin, vymax);
-	glMatrixMode(GL_MODELVIEW);
-	glPushMatrix();
-	glLoadIdentity();
-	
-	if(CTX.db) glDrawBuffer(GL_BACK);
-	
-	glDisable(GL_DEPTH_TEST);
-	/* c'est une maniere de contourner l'absence de XOR, mais ca ne marche 
-	   evidemment qu'avec un background tout noir ou tout blanc !*/
-	glColor3f(1.,1.,1.);
-	glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ZERO);
-	glEnable(GL_BLEND);
-
-	glBegin(GL_LINE_STRIP);
-	glVertex2d(xb,yb);
-	glVertex2d(xb+movzx,yb);
-	glVertex2d(xb+movzx,yb+movzy);
-	glVertex2d(xb,yb+movzy);
-	glVertex2d(xb,yb);
-	glEnd();
-	movzx = xz - xb; movzy = yz - yb;
-	
-	glBegin(GL_LINE_STRIP);
-	glVertex2d(xb,yb);
-	glVertex2d(xb+movzx,yb);
-	glVertex2d(xb+movzx,yb+movzy);
-	glVertex2d(xb,yb+movzy);
-	glVertex2d(xb,yb);
-	glEnd();
-
-	glDisable(GL_BLEND);
-	glEnable(GL_DEPTH_TEST);
-	glPopMatrix();
-	glMatrixMode(GL_PROJECTION);
-	glPopMatrix();
-	glMatrixMode(GL_MODELVIEW);
-	
-	if(CTX.db)
-	  glXSwapBuffers(XCTX.display,XtWindow(WID.G.glw));
-	else
-	  glFlush();
+        glPopMatrix();
+        glDisable(GL_DEPTH_TEST);
+        glDisable(GL_LIGHTING);
+        glMatrixMode(GL_PROJECTION);
+        glPushMatrix();
+        glLoadIdentity();
+        gluOrtho2D(vxmin, vxmax, vymin, vymax);
+        glMatrixMode(GL_MODELVIEW);
+        glPushMatrix();
+        glLoadIdentity();
+        
+        if(CTX.db) glDrawBuffer(GL_BACK);
+        
+        glDisable(GL_DEPTH_TEST);
+        /* c'est une maniere de contourner l'absence de XOR, mais ca ne marche 
+           evidemment qu'avec un background tout noir ou tout blanc !*/
+        glColor3f(1.,1.,1.);
+        glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ZERO);
+        glEnable(GL_BLEND);
+
+        glBegin(GL_LINE_STRIP);
+        glVertex2d(xb,yb);
+        glVertex2d(xb+movzx,yb);
+        glVertex2d(xb+movzx,yb+movzy);
+        glVertex2d(xb,yb+movzy);
+        glVertex2d(xb,yb);
+        glEnd();
+        movzx = xz - xb; movzy = yz - yb;
+        
+        glBegin(GL_LINE_STRIP);
+        glVertex2d(xb,yb);
+        glVertex2d(xb+movzx,yb);
+        glVertex2d(xb+movzx,yb+movzy);
+        glVertex2d(xb,yb+movzy);
+        glVertex2d(xb,yb);
+        glEnd();
+
+        glDisable(GL_BLEND);
+        glEnable(GL_DEPTH_TEST);
+        glPopMatrix();
+        glMatrixMode(GL_PROJECTION);
+        glPopMatrix();
+        glMatrixMode(GL_MODELVIEW);
+        
+        if(CTX.db)
+          glXSwapBuffers(XCTX.display,XtWindow(WID.G.glw));
+        else
+          glFlush();
 
       }
     }
     else {
       if(ButtonPressed){
 
-	if(CTX.overlay){
-	  glXMakeCurrent(XtDisplay(WID.G.glo), XtWindow(WID.G.glo), XCTX.glo.context);
-	  glClearIndex(0);
-	  glClear(GL_COLOR_BUFFER_BIT);  
-	  glXMakeCurrent(XtDisplay(WID.G.glw), XtWindow(WID.G.glw), XCTX.glw.context);
-	}
-
-	if(FirstClick){
-	  xc1 = ( ((GLdouble) x / width) * (vxmax - vxmin) + vxmin )/CTX.s[0] - CTX.t[0];
-	  yc1 = ( vymax - ((GLdouble) y / height) * (vymax - vymin))/CTX.s[1] - CTX.t[1];
-	  xt1 = CTX.t[0];
-	  yt1 = CTX.t[1];
-	  xscale1 = CTX.s[0];
-	  yscale1 = CTX.s[1];
-	  FirstClick=0;
-	}
-
-	switch(ibut){
-	case 1:
-	  set_r(1, CTX.r[1] + ((abs(movx) > abs(movy))?180*(float)movx/(float)width:0));
-	  set_r(0, CTX.r[0] + ((abs(movx) > abs(movy))?0:180*(float)movy/(float)height));
-	  break;
-	case 2:
-	  set_r(2, CTX.r[2] + ((abs(movy) > abs(movx))?0:-180*(float)movx/(float)width));	  
-
-	  set_s(0, CTX.s[0] * ( (abs(movy) > abs(movx)) ?
-				( (movy>0) ? (float)(1.04*(abs(movy)+height))/(float)height
-				  : (float)(height)/(float)(1.04*(abs(movy)+height)) )
-				: 1.) );		    
-	  set_s(1, CTX.s[0]);
-	  set_s(2, CTX.s[0]);
-
-	  if(abs(movy) > abs(movx)){
-	    set_t(0, xt1*(xscale1/CTX.s[0])-xc1*(1.-(xscale1/CTX.s[0])));
-	    set_t(1, yt1*(yscale1/CTX.s[1])-yc1*(1.-(yscale1/CTX.s[1])));
-	  }
-	  break;
-	case 3:
-	  xc = ( ((GLdouble) x / width) * (vxmax - vxmin) + vxmin ) / CTX.s[0];
-	  yc = ( vymax - ((GLdouble) y / height) * (vymax - vymin)) / CTX.s[1];
-	  set_t(0, xc-xc1);
-	  set_t(1, yc-yc1);
-	  set_t(2, 0.);
-	  break;
-	}
-	Init();
-	previous_mesh_draw = CTX.mesh.draw ;
-	previous_post_draw = CTX.post.draw ;
-	if(CTX.fast) CTX.mesh.draw = CTX.post.draw = 0;
-	Draw();
-	CTX.mesh.draw = previous_mesh_draw ;
-	CTX.post.draw = previous_post_draw ;
+        if(CTX.overlay){
+          glXMakeCurrent(XtDisplay(WID.G.glo), XtWindow(WID.G.glo), XCTX.glo.context);
+          glClearIndex(0);
+          glClear(GL_COLOR_BUFFER_BIT);  
+          glXMakeCurrent(XtDisplay(WID.G.glw), XtWindow(WID.G.glw), XCTX.glw.context);
+        }
+
+        if(FirstClick){
+          xc1 = ( ((GLdouble) x / width) * (vxmax - vxmin) + vxmin )/CTX.s[0] - CTX.t[0];
+          yc1 = ( vymax - ((GLdouble) y / height) * (vymax - vymin))/CTX.s[1] - CTX.t[1];
+          xt1 = CTX.t[0];
+          yt1 = CTX.t[1];
+          xscale1 = CTX.s[0];
+          yscale1 = CTX.s[1];
+          FirstClick=0;
+        }
+
+        switch(ibut){
+        case 1:
+          set_r(1, CTX.r[1] + ((abs(movx) > abs(movy))?180*(float)movx/(float)width:0));
+          set_r(0, CTX.r[0] + ((abs(movx) > abs(movy))?0:180*(float)movy/(float)height));
+          break;
+        case 2:
+          set_r(2, CTX.r[2] + ((abs(movy) > abs(movx))?0:-180*(float)movx/(float)width));         
+
+          set_s(0, CTX.s[0] * ( (abs(movy) > abs(movx)) ?
+                                ( (movy>0) ? (float)(1.04*(abs(movy)+height))/(float)height
+                                  : (float)(height)/(float)(1.04*(abs(movy)+height)) )
+                                : 1.) );                    
+          set_s(1, CTX.s[0]);
+          set_s(2, CTX.s[0]);
+
+          if(abs(movy) > abs(movx)){
+            set_t(0, xt1*(xscale1/CTX.s[0])-xc1*(1.-(xscale1/CTX.s[0])));
+            set_t(1, yt1*(yscale1/CTX.s[1])-yc1*(1.-(yscale1/CTX.s[1])));
+          }
+          break;
+        case 3:
+          xc = ( ((GLdouble) x / width) * (vxmax - vxmin) + vxmin ) / CTX.s[0];
+          yc = ( vymax - ((GLdouble) y / height) * (vymax - vymin)) / CTX.s[1];
+          set_t(0, xc-xc1);
+          set_t(1, yc-yc1);
+          set_t(2, 0.);
+          break;
+        }
+        Init();
+        previous_mesh_draw = CTX.mesh.draw ;
+        previous_post_draw = CTX.post.draw ;
+        if(CTX.fast) CTX.mesh.draw = CTX.post.draw = 0;
+        Draw();
+        CTX.mesh.draw = previous_mesh_draw ;
+        CTX.post.draw = previous_post_draw ;
       }
       else{
-	Process_SelectionBuffer(event->xbutton.x, event->xbutton.y, &hits, ii, jj);
-	ov = v; oc = c; os = s;	
-	v = NULL; c = NULL; s = NULL;
-	Filter_SelectionBuffer(hits,ii,jj,&v,&c,&s,&M);
-
-	if(CTX.overlay){
-	  glXMakeCurrent(XtDisplay(WID.G.glo), XtWindow(WID.G.glo), XCTX.glo.context);
-	  if(ov != v || oc != c || os != s) { 
-	    glClearIndex(0);
-	    glClear(GL_COLOR_BUFFER_BIT);  
-	    glIndexi((CTX.color.bg<CTX.color.fg)?XCTX.xcolor.ovwhite:XCTX.xcolor.ovblack);
-	    BeginHighlight();
-	    HighlightEntity(v,c,s,0);
-	    EndHighlight(0);
-	  }
-	  glXMakeCurrent(XtDisplay(WID.G.glw), XtWindow(WID.G.glw), XCTX.glw.context);
-	}
-	else{
-	  if(ov != v || oc != c || os != s) { 
-	    if(CTX.geom.highlight){
-	      Init();
-	      Draw();
-	    }
-	    BeginHighlight();
-	    HighlightEntity(v,c,s,0);
-	    EndHighlight(0);
-	  }
-	}
+        Process_SelectionBuffer(event->xbutton.x, event->xbutton.y, &hits, ii, jj);
+        ov = v; oc = c; os = s; 
+        v = NULL; c = NULL; s = NULL;
+        Filter_SelectionBuffer(hits,ii,jj,&v,&c,&s,&M);
+
+        if(CTX.overlay){
+          glXMakeCurrent(XtDisplay(WID.G.glo), XtWindow(WID.G.glo), XCTX.glo.context);
+          if(ov != v || oc != c || os != s) { 
+            glClearIndex(0);
+            glClear(GL_COLOR_BUFFER_BIT);  
+            glIndexi((CTX.color.bg<CTX.color.fg)?XCTX.xcolor.ovwhite:XCTX.xcolor.ovblack);
+            BeginHighlight();
+            HighlightEntity(v,c,s,0);
+            EndHighlight(0);
+          }
+          glXMakeCurrent(XtDisplay(WID.G.glw), XtWindow(WID.G.glw), XCTX.glw.context);
+        }
+        else{
+          if(ov != v || oc != c || os != s) { 
+            if(CTX.geom.highlight){
+              Init();
+              Draw();
+            }
+            BeginHighlight();
+            HighlightEntity(v,c,s,0);
+            EndHighlight(0);
+          }
+        }
       }
       x += movx; 
       y += movy; 
diff --git a/Unix/CbMesh.cpp b/Unix/CbMesh.cpp
index 3d8e18c98b..490e6a0fcc 100644
--- a/Unix/CbMesh.cpp
+++ b/Unix/CbMesh.cpp
@@ -1,4 +1,4 @@
-/* $Id: CbMesh.cpp,v 1.4 2000-11-23 23:20:35 geuzaine Exp $ */
+/* $Id: CbMesh.cpp,v 1.5 2000-11-26 15:43:48 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -22,7 +22,8 @@ extern char   attrx_text[100], attry_text[100], attrz_text[100], attrdec_text[10
 /*  m e s h _ e v e n t _ h a n d l e r                                     */
 /* ------------------------------------------------------------------------ */
 
-#ifndef _NOTHREADS
+#ifdef _USETHREADS
+
 #include <pthread.h>
 
 int               MeshDim ;
@@ -38,7 +39,7 @@ void* StartMeshThread(void * data){
   Msg(STATUS,"Ready");
   CTX.mesh.draw = 1;
   CTX.threads_lock = 0;
-  XtSetSensitive(WID.G.Butt[5], 0);
+  XtSetSensitive(WID.G.Butt[6], 0);
   Init();
   Draw();
   pthread_exit(NULL);
@@ -54,7 +55,7 @@ void CancelMeshThread(void){
     pthread_cancel(MeshThread);
     CTX.mesh.draw = 1;
     CTX.threads_lock = 0;
-    XtSetSensitive(WID.G.Butt[5], 0);    
+    XtSetSensitive(WID.G.Butt[6], 0);    
     Msg(INFO,"Mesh Aborted");
     mesh_event_handler(MESH_DELETE);
     Msg(STATUS,"Ready");
@@ -89,9 +90,9 @@ void mesh_event_handler (int event) {
     break;
     
   case MESH_1D : 
-#ifndef _NOTHREADS
+#ifdef _USETHREADS
     if(CTX.threads){
-      XtSetSensitive(WID.G.Butt[5], 1);
+      XtSetSensitive(WID.G.Butt[6], 1);
       CTX.mesh.draw = 0; CTX.threads_lock = 1 ; MeshDim = 1 ; 
       //      pthread_mutex_init(&MeshMutex,NULL);
       //      pthread_mutex_lock(&MeshMutex);
@@ -103,9 +104,9 @@ void mesh_event_handler (int event) {
     break;
     
   case MESH_2D : 
-#ifndef _NOTHREADS
+#ifdef _USETHREADS
     if(CTX.threads){
-      XtSetSensitive(WID.G.Butt[5], 1);
+      XtSetSensitive(WID.G.Butt[6], 1);
       CTX.mesh.draw = 0; CTX.threads_lock = 1 ; MeshDim = 2 ; 
       //      pthread_mutex_init(&MeshMutex,NULL);
       //      pthread_mutex_lock(&MeshMutex);
@@ -117,9 +118,9 @@ void mesh_event_handler (int event) {
     break;    
 
   case MESH_3D : 
-#ifndef _NOTHREADS
+#ifdef _USETHREADS
     if(CTX.threads){
-      XtSetSensitive(WID.G.Butt[5], 1);
+      XtSetSensitive(WID.G.Butt[6], 1);
       CTX.mesh.draw = 0; CTX.threads_lock = 1 ; MeshDim = 3 ; 
       //      pthread_mutex_init(&MeshMutex,NULL);
       //      pthread_mutex_lock(&MeshMutex);
@@ -137,21 +138,21 @@ void mesh_event_handler (int event) {
       Msg(STATUS,"Select Point ('e'=end, 'q'=quit)");
       ib = SelectEntity(ENT_POINT, &v,&c,&s);
       if(ib == 1){ /* left mouse butt */
-	p[n++] = v->Num; 
+        p[n++] = v->Num; 
       }
       if (ib == -1){ /* 'e' */
-	if(n >= 1) {
-	  add_charlength(n,p,TheFileName); break;
-	}
-	n=0;
-	ZeroHighlight(&M);
-	Replot();
+        if(n >= 1) {
+          add_charlength(n,p,TheFileName); break;
+        }
+        n=0;
+        ZeroHighlight(&M);
+        Replot();
       }
       if(ib == 0){ /* 'q' */
-	n=0 ;
-	ZeroHighlight(&M);
-	Replot();
-	break;
+        n=0 ;
+        ZeroHighlight(&M);
+        Replot();
+        break;
       }
     }
     break ;
@@ -162,21 +163,21 @@ void mesh_event_handler (int event) {
       Msg(STATUS,"Select Surface ('e'=end, 'q'=quit)");
       ib = SelectEntity(ENT_SURFACE, &v,&c,&s);
       if(ib == 1){ /* left mouse butt */
-	p[n++] = s->Num; 
+        p[n++] = s->Num; 
       }
       if (ib == -1){ /* 'e' */
-	if(n >= 1) {
-	  add_recosurf(n,p,TheFileName); break;
-	}
-	n=0;
-	ZeroHighlight(&M);
-	Replot();
+        if(n >= 1) {
+          add_recosurf(n,p,TheFileName); break;
+        }
+        n=0;
+        ZeroHighlight(&M);
+        Replot();
       }
       if(ib == 0){ /* 'q' */
-	n=0 ;
-	ZeroHighlight(&M);
-	Replot();
-	break;
+        n=0 ;
+        ZeroHighlight(&M);
+        Replot();
+        break;
       }
     }
     break ;
@@ -188,71 +189,71 @@ void mesh_event_handler (int event) {
     while(1){
       switch (event) {    
       case MESH_DEFINE_TRSF_LINE :
-	Msg(STATUS,"Select Line ('e'=end, 'q'=quit)");
-	ib = SelectEntity(ENT_LINE, &v,&c,&s);
-	break ;
+        Msg(STATUS,"Select Line ('e'=end, 'q'=quit)");
+        ib = SelectEntity(ENT_LINE, &v,&c,&s);
+        break ;
       case MESH_DEFINE_TRSF_SURFACE :
-	Msg(STATUS,"Select Surface ('e'=end, 'q'=quit)");
-	ib = SelectEntity(ENT_SURFACE, &v,&c,&s);
-	break;
+        Msg(STATUS,"Select Surface ('e'=end, 'q'=quit)");
+        ib = SelectEntity(ENT_SURFACE, &v,&c,&s);
+        break;
       case MESH_DEFINE_TRSF_VOLUME :
-	ib = 1;
-	break;
+        ib = 1;
+        break;
       }
       if(ib == 1){ /* left mouse butt */
-	switch (event) {    
-	case MESH_DEFINE_TRSF_LINE : p[n++] = c->Num ; break ;
-	case MESH_DEFINE_TRSF_SURFACE : p[n++] = s->Num;
-	case MESH_DEFINE_TRSF_VOLUME :
-	  while(1){
-	    Msg(STATUS,"Select Point ('e'=end, 'q'=quit)");
-	    ib = SelectEntity(ENT_POINT, &v,&c,&s);
-	    if(ib == 1){ /* left mouse butt */
-	      p[n++] = v->Num ;
-	    }
-	    if (ib == -1){ /* 'e' */
-	      switch (event) {    
-	      case MESH_DEFINE_TRSF_SURFACE :
-		if(n == 3+1 || n == 4+1)
-		  add_trsfsurf(n,p,TheFileName); 
-		else
-		  Msg(INFO, "Wrong Number of Points for Transfinite Surface");
-		break;
-	      case MESH_DEFINE_TRSF_VOLUME :
-		if(n == 6 || n == 8)
-		  add_trsfvol(n,p,TheFileName);
-		else
-		  Msg(INFO, "Wrong Number of Points for Transfinite Volume");
-		break;
-	      }
-	      n=0;
-	      ZeroHighlight(&M);
-	      Replot();
-	      break;
-	    }
-	    if(ib == 0){ /* 'q' */
-	      n=0 ;
-	      ZeroHighlight(&M);
-	      Replot();
-	      break;
-	    }
-	  }
-	  break ;
-	}
+        switch (event) {    
+        case MESH_DEFINE_TRSF_LINE : p[n++] = c->Num ; break ;
+        case MESH_DEFINE_TRSF_SURFACE : p[n++] = s->Num;
+        case MESH_DEFINE_TRSF_VOLUME :
+          while(1){
+            Msg(STATUS,"Select Point ('e'=end, 'q'=quit)");
+            ib = SelectEntity(ENT_POINT, &v,&c,&s);
+            if(ib == 1){ /* left mouse butt */
+              p[n++] = v->Num ;
+            }
+            if (ib == -1){ /* 'e' */
+              switch (event) {    
+              case MESH_DEFINE_TRSF_SURFACE :
+                if(n == 3+1 || n == 4+1)
+                  add_trsfsurf(n,p,TheFileName); 
+                else
+                  Msg(INFO, "Wrong Number of Points for Transfinite Surface");
+                break;
+              case MESH_DEFINE_TRSF_VOLUME :
+                if(n == 6 || n == 8)
+                  add_trsfvol(n,p,TheFileName);
+                else
+                  Msg(INFO, "Wrong Number of Points for Transfinite Volume");
+                break;
+              }
+              n=0;
+              ZeroHighlight(&M);
+              Replot();
+              break;
+            }
+            if(ib == 0){ /* 'q' */
+              n=0 ;
+              ZeroHighlight(&M);
+              Replot();
+              break;
+            }
+          }
+          break ;
+        }
       }
       if (ib == -1){ /* 'e' */
-	if (event == MESH_DEFINE_TRSF_LINE){ 
-	  if(n >= 1) add_trsfline(n,p,TheFileName);
-	}
-	n=0;
-	ZeroHighlight(&M);
-	Replot();
+        if (event == MESH_DEFINE_TRSF_LINE){ 
+          if(n >= 1) add_trsfline(n,p,TheFileName);
+        }
+        n=0;
+        ZeroHighlight(&M);
+        Replot();
       }
       if(ib == 0){ /* 'q' */
-	n=0 ;
-	ZeroHighlight(&M);
-	Replot();
-	break;
+        n=0 ;
+        ZeroHighlight(&M);
+        Replot();
+        break;
       }
     }
     break ;
diff --git a/Unix/CbMesh.h b/Unix/CbMesh.h
index cc527be6b8..bd1fe0ce86 100644
--- a/Unix/CbMesh.h
+++ b/Unix/CbMesh.h
@@ -1,9 +1,9 @@
-/* $Id: CbMesh.h,v 1.2 2000-11-23 14:11:41 geuzaine Exp $ */
+/* $Id: CbMesh.h,v 1.3 2000-11-26 15:43:48 geuzaine Exp $ */
 #ifndef _CB_MESH_H_
 #define _CB_MESH_H_
 
 /* mesh event handler */
-					     
+                                             
 #define  MESH_DELETE                         1
 #define  MESH_1D                             2
 #define  MESH_2D                             3 
@@ -29,5 +29,5 @@
 
 void CancelMeshThread(void);
 void mesh_event_handler (int event);
-					     
+                                             
 #endif
diff --git a/Unix/CbOptions.cpp b/Unix/CbOptions.cpp
index 7511f1f6f8..2cf2c6a0dc 100644
--- a/Unix/CbOptions.cpp
+++ b/Unix/CbOptions.cpp
@@ -1,4 +1,4 @@
-/* $Id: CbOptions.cpp,v 1.6 2000-11-24 12:50:06 geuzaine Exp $ */
+/* $Id: CbOptions.cpp,v 1.7 2000-11-26 15:43:48 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -27,7 +27,6 @@ extern Widgets_T  WID;
 extern Pixmaps_T  PIX;
 extern Mesh       M;
 extern Tree_T    *EntitesVisibles;
-extern double   LC;
 
 int SHOW_ALL_ENTITIES, SELECT_BY_NUMBER=OPTIONS_MESH_SELECT_ENTITY ;
 
@@ -104,10 +103,10 @@ void OptionsCb (Widget w, XtPointer client_data, XtPointer call_data){
   case OPTIONS_PVIEW :
     XGetWindowAttributes(XtDisplay(WID.G.shell),XtWindow(WID.G.shell),&xattrib);
     fprintf(stderr, "-geometry %dx%d -viewport %g %g %g %g %g %g %g %g %g\n",
-	    xattrib.width, xattrib.height,
-	    CTX.r[0],CTX.r[1],CTX.r[2],
-	    CTX.t[0],CTX.t[1],CTX.t[2],
-	    CTX.s[0],CTX.s[1],CTX.s[2]);
+            xattrib.width, xattrib.height,
+            CTX.r[0],CTX.r[1],CTX.r[2],
+            CTX.t[0],CTX.t[1],CTX.t[2],
+            CTX.s[0],CTX.s[1],CTX.s[2]);
     break ;
 
     /* print */
@@ -164,7 +163,7 @@ void OptionsCb (Widget w, XtPointer client_data, XtPointer call_data){
   case OPTIONS_GEOM_NORMALS_TEXT : 
     CTX.geom.normals = atof(XmTextGetString(w));
     XtVaSetValues(WID.OD.geomNormalsScale, XmNvalue, 
-		  THRESHOLD((int)CTX.geom.normals,0,100), NULL);
+                  THRESHOLD((int)CTX.geom.normals,0,100), NULL);
     XmUpdateDisplay(WID.OD.geomNormalsScale); break;
   case OPTIONS_GEOM_TANGENTS_SCALE : 
     XmScaleGetValue(WID.OD.geomTangentsScale, &e); CTX.geom.tangents = e ;  
@@ -174,7 +173,7 @@ void OptionsCb (Widget w, XtPointer client_data, XtPointer call_data){
   case OPTIONS_GEOM_TANGENTS_TEXT : 
     CTX.geom.tangents = atof(XmTextGetString(w));
     XtVaSetValues(WID.OD.geomTangentsScale, XmNvalue,
-		  THRESHOLD((int)CTX.geom.tangents,0,100), NULL);
+                  THRESHOLD((int)CTX.geom.tangents,0,100), NULL);
     XmUpdateDisplay(WID.OD.geomTangentsScale); break;
     
 
@@ -219,7 +218,7 @@ void OptionsCb (Widget w, XtPointer client_data, XtPointer call_data){
   case OPTIONS_MESH_ANISOTROPIC  : 
     (CTX.mesh.algo==DELAUNAY_OLDALGO) ?
       CTX.mesh.algo=DELAUNAY_NEWALGO :
-	CTX.mesh.algo=DELAUNAY_OLDALGO; break ;
+        CTX.mesh.algo=DELAUNAY_OLDALGO; break ;
   case OPTIONS_MESH_INTERACTIVE : 
     CTX.mesh.interactive = !CTX.mesh.interactive; break ;
   case OPTIONS_MESH_SMOOTHING_SCALE : 
@@ -230,7 +229,7 @@ void OptionsCb (Widget w, XtPointer client_data, XtPointer call_data){
   case OPTIONS_MESH_SMOOTHING_TEXT : 
     CTX.mesh.nb_smoothing = atoi(XmTextGetString(w));
     XtVaSetValues(WID.OD.meshSmoothingScale, XmNvalue, 
-		  THRESHOLD(CTX.mesh.nb_smoothing,0,100), NULL);
+                  THRESHOLD(CTX.mesh.nb_smoothing,0,100), NULL);
     XmUpdateDisplay(WID.OD.meshSmoothingScale); break;
   case OPTIONS_MESH_EXPLODE_SCALE : 
     XmScaleGetValue(WID.OD.meshExplodeScale, &e); CTX.mesh.explode = 0.01*e ;  
@@ -240,7 +239,7 @@ void OptionsCb (Widget w, XtPointer client_data, XtPointer call_data){
   case OPTIONS_MESH_EXPLODE_TEXT : 
     CTX.mesh.explode = atof(XmTextGetString(w));
     XtVaSetValues(WID.OD.meshExplodeScale, XmNvalue,
-		  THRESHOLD((int)(100*CTX.mesh.explode),0,100), NULL);
+                  THRESHOLD((int)(100*CTX.mesh.explode),0,100), NULL);
     XmUpdateDisplay(WID.OD.meshExplodeScale); break;
   case OPTIONS_MESH_NORMALS_SCALE : 
     XmScaleGetValue(WID.OD.meshNormalsScale, &e); CTX.mesh.normals = e ;  
@@ -250,7 +249,7 @@ void OptionsCb (Widget w, XtPointer client_data, XtPointer call_data){
   case OPTIONS_MESH_NORMALS_TEXT : 
     CTX.mesh.normals = atof(XmTextGetString(w));
     XtVaSetValues(WID.OD.meshNormalsScale, XmNvalue,
-		  THRESHOLD((int)CTX.mesh.normals,0,100), NULL);
+                  THRESHOLD((int)CTX.mesh.normals,0,100), NULL);
     XmUpdateDisplay(WID.OD.meshNormalsScale); break;
   case OPTIONS_MESH_ABORT : 
     CancelMeshThread();
@@ -270,16 +269,16 @@ void OptionsCb (Widget w, XtPointer client_data, XtPointer call_data){
     anim_time = Get_AnimTime();
     while(1){
       if(XtAppPending(XCTX.AppContext)){
-	XtAppNextEvent(XCTX.AppContext,&event);
-	XtDispatchEvent(&event);
-	if(stop_anim) break ;
+        XtAppNextEvent(XCTX.AppContext,&event);
+        XtDispatchEvent(&event);
+        if(stop_anim) break ;
       }
       else{
-	if(Get_AnimTime() - anim_time > CTX.post.anim_delay){
-	  anim_time = Get_AnimTime();
-	  MarkAllViewsChanged(2);
-	  Init(); Draw();
-	}
+        if(Get_AnimTime() - anim_time > CTX.post.anim_delay){
+          anim_time = Get_AnimTime();
+          MarkAllViewsChanged(2);
+          Init(); Draw();
+        }
       }
     }
     break ;
@@ -301,20 +300,20 @@ void OptionsCb (Widget w, XtPointer client_data, XtPointer call_data){
     c = XmTextGetString(w); 
     if(SELECT_BY_NUMBER == OPTIONS_MESH_SELECT_ENTITY){
       if (!strcmp(c,"all") || !strcmp(c,"*")){
-	if(SHOW_ALL_ENTITIES){ RemplirEntitesVisibles(0); SHOW_ALL_ENTITIES = 0; }
-	else { RemplirEntitesVisibles(1); SHOW_ALL_ENTITIES = 1; }
+        if(SHOW_ALL_ENTITIES){ RemplirEntitesVisibles(0); SHOW_ALL_ENTITIES = 0; }
+        else { RemplirEntitesVisibles(1); SHOW_ALL_ENTITIES = 1; }
       }
       else{ 
-	i = atoi(c);
-	if(EntiteEstElleVisible(i)) ToutesLesEntitesRelatives(i,EntitesVisibles,0);
-	else ToutesLesEntitesRelatives(i,EntitesVisibles,1);
+        i = atoi(c);
+        if(EntiteEstElleVisible(i)) ToutesLesEntitesRelatives(i,EntitesVisibles,0);
+        else ToutesLesEntitesRelatives(i,EntitesVisibles,1);
       }
     }
     else{
       if (!strcmp(c,"all") || !strcmp(c,"*"))
-	CTX.mesh.limit_gamma = 0.0 ;
+        CTX.mesh.limit_gamma = 0.0 ;
       else
-	CTX.mesh.limit_gamma = atof(c);
+        CTX.mesh.limit_gamma = atof(c);
     }
     break;
 
diff --git a/Unix/CbOptions.h b/Unix/CbOptions.h
index 30ee0a8bdd..b2cdca4e62 100644
--- a/Unix/CbOptions.h
+++ b/Unix/CbOptions.h
@@ -1,9 +1,9 @@
-/* $Id: CbOptions.h,v 1.6 2000-11-24 12:50:06 geuzaine Exp $ */
+/* $Id: CbOptions.h,v 1.7 2000-11-26 15:43:48 geuzaine Exp $ */
 #ifndef _CB_OPTIONS_H_
 #define _CB_OPTIONS_H_
 
 /* options globales */
-					     
+                                             
 #define  OPTIONS_REPLOT                         1
 #define  OPTIONS_AXES                           2
 #define  OPTIONS_LITTLE_AXES                    3
@@ -103,5 +103,5 @@
 #define  OPTIONS_PRINT_GL2PS_IMAGE              403
 #define  OPTIONS_PRINT_GL2GIF                   404
 #define  OPTIONS_PRINT_GEO                      405
-					     
+                                             
 #endif
diff --git a/Unix/CbPost.cpp b/Unix/CbPost.cpp
index 24eb84ef39..c88ae5caeb 100644
--- a/Unix/CbPost.cpp
+++ b/Unix/CbPost.cpp
@@ -1,4 +1,4 @@
-/* $Id: CbPost.cpp,v 1.5 2000-11-25 23:10:37 geuzaine Exp $ */
+/* $Id: CbPost.cpp,v 1.6 2000-11-26 15:43:48 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -21,8 +21,6 @@ extern Widgets_T  WID ;
 extern Context_T  CTX ;
 extern XContext_T XCTX ;
 extern Mesh       *THEM;
-extern int         TYPBGMESH;
-extern int         LC_ORDER;
 extern List_T     *Post_ViewList;
 extern int         Force_ViewNumber;
 
@@ -43,17 +41,17 @@ void MarkAllViewsChanged (int action){
     switch(action){
     case 1: // toggle drawing mode
       if(v->IntervalsType == DRAW_POST_ISO) 
-	v->IntervalsType = DRAW_POST_DISCRETE ;
+        v->IntervalsType = DRAW_POST_DISCRETE ;
       else if(v->IntervalsType == DRAW_POST_DISCRETE) 
-	v->IntervalsType = DRAW_POST_CONTINUOUS ;
+        v->IntervalsType = DRAW_POST_CONTINUOUS ;
       else 
-	v->IntervalsType = DRAW_POST_ISO ;
+        v->IntervalsType = DRAW_POST_ISO ;
       break;
     case 2: // time step++
       if(v->TimeStep < v->NbTimeStep-1)
-	v->TimeStep++ ;
+        v->TimeStep++ ;
       else
-	v->TimeStep = 0 ;
+        v->TimeStep = 0 ;
       sprintf(label, "%d", v->TimeStep);
       XtVaSetValues(WID.PD.timeStepScale, XmNvalue, v->TimeStep, NULL);
       XmUpdateDisplay(WID.PD.timeStepScale);
@@ -62,9 +60,9 @@ void MarkAllViewsChanged (int action){
       break;
     case 3: // time step--
       if(v->TimeStep > 0)
-	v->TimeStep-- ;
+        v->TimeStep-- ;
       else
-	v->TimeStep = v->NbTimeStep-1 ;
+        v->TimeStep = v->NbTimeStep-1 ;
       sprintf(label, "%d", v->TimeStep);
       XtVaSetValues(WID.PD.timeStepScale, XmNvalue, v->TimeStep, NULL);
       XmUpdateDisplay(WID.PD.timeStepScale);
@@ -140,6 +138,8 @@ void DuplicateViewCb (Widget w, XtPointer client_data, XtPointer call_data){
   v2->Max         = v1->Max;      
   v2->NbTimeStep  = v1->NbTimeStep;
 
+  CopyViewOptions(v1, v2);
+
   AddViewInUI(List_Nbr(Post_ViewList), v2->Name, v2->Num);
   Init();
   Draw();
@@ -148,17 +148,23 @@ void DuplicateViewCb (Widget w, XtPointer client_data, XtPointer call_data){
 static int All = 0;
 
 void ReloadViewCb (Widget w, XtPointer client_data, XtPointer call_data){
-  Post_View  *v ;
+  Post_View  *v, tmp ;
   char filename[NAME_STR_L];
 
   if(!Post_ViewList) return;
 
   v = (Post_View*)List_Pointer(Post_ViewList,(long int)client_data-1);
   strcpy(filename, v->FileName);
+  CopyViewOptions(v, &tmp);
+
   Force_ViewNumber = v->Num ;
   FreeView(v);
   MergeProblem(filename);
   Force_ViewNumber = 0 ;
+  
+  v = (Post_View*)List_Pointer(Post_ViewList,(long int)client_data-1);
+  CopyViewOptions(&tmp, v);
+
   if(!All){
     Init();
     Draw();
@@ -182,7 +188,7 @@ void SaveColorTable(FILE *fp){
     Msg(WARNING, "No View to get Color Information From"); 
   }
   else{
-    save_color_table(fp, &CurrentView->CT);
+    ColorTable_Save(fp, &CurrentView->CT);
   }
 }
 
@@ -203,8 +209,8 @@ void PostDialogCb (Widget w, XtPointer client_data, XtPointer call_data){
 
   v = CurrentView ;
 
-  /* le slider (gradue en interne de -100 a 100) va de -LC a +LC  */
-  sfact = pow(10.,2.-LC_ORDER); 
+  /* le slider (gradue en interne de -100 a 100) va de -CTX.lc a +CTX.lc  */
+  sfact = pow(10.,2.-CTX.lc_order); 
 
   sprintf(label, "\"%s\" (%ld)", v->Name, CurrentViewNumber);
 
@@ -277,13 +283,13 @@ void PostDialogCb (Widget w, XtPointer client_data, XtPointer call_data){
     XtVaSetValues(WID.PD.scaleTypeButt[1], XmNset,(v->ScaleType==DRAW_POST_LOGARITHMIC)?True:False, NULL);
 
     XtVaSetValues(WID.PD.scaleIntervalsButt[0], XmNset,
-		  (v->IntervalsType==DRAW_POST_ISO)?True:False, NULL);
+                  (v->IntervalsType==DRAW_POST_ISO)?True:False, NULL);
     XtVaSetValues(WID.PD.scaleIntervalsButt[1], XmNset,
-		  (v->IntervalsType==DRAW_POST_DISCRETE)?True:False, NULL);
+                  (v->IntervalsType==DRAW_POST_DISCRETE)?True:False, NULL);
     XtVaSetValues(WID.PD.scaleIntervalsButt[2], XmNset,
-		  (v->IntervalsType==DRAW_POST_CONTINUOUS)?True:False, NULL);
+                  (v->IntervalsType==DRAW_POST_CONTINUOUS)?True:False, NULL);
     XtVaSetValues(WID.PD.scaleIntervalsButt[3], XmNset,
-		  (v->IntervalsType==DRAW_POST_NUMERIC)?True:False, NULL);
+                  (v->IntervalsType==DRAW_POST_NUMERIC)?True:False, NULL);
     XtVaSetValues(WID.PD.scaleIntervalsScale, XmNvalue, THRESHOLD((int)v->NbIso,1,100), NULL);
 
     sprintf(label, "%d", v->NbIso);
@@ -301,9 +307,9 @@ void PostDialogCb (Widget w, XtPointer client_data, XtPointer call_data){
     XSelectInput(XCTX.display, XtWindow(WID.PD.colorDrawingArea), EV_MASK);
     ColorBarCreate(XtWindow(WID.PD.colorDrawingArea),255,200);
     ColorBarChange(v->Name, 
-		   (v->RangeType==DRAW_POST_CUSTOM)?v->CustomMin:v->Min, 
-		   (v->RangeType==DRAW_POST_CUSTOM)?v->CustomMax:v->Max, 
-		   &v->CT, 1);
+                   (v->RangeType==DRAW_POST_CUSTOM)?v->CustomMin:v->Min, 
+                   (v->RangeType==DRAW_POST_CUSTOM)?v->CustomMax:v->Max, 
+                   &v->CT, 1);
     ColorBarResizeCb((Widget)NULL, NULL, NULL); // Force resize
     ColorBarShow();
     break;
@@ -317,14 +323,14 @@ void PostDialogCb (Widget w, XtPointer client_data, XtPointer call_data){
     XtVaSetValues(WID.PD.vectorTypeButt[2], XmNset, (v->ArrowType == DRAW_POST_PYRAMID)?True:False, NULL);
     XtVaSetValues(WID.PD.vectorTypeButt[3], XmNset, (v->ArrowType == DRAW_POST_CONE)?True:False, NULL);  
     XtVaSetValues(WID.PD.vectorTypeButt[4], XmNset, 
-		  (v->ArrowType == DRAW_POST_DISPLACEMENT)?True:False, NULL);
+                  (v->ArrowType == DRAW_POST_DISPLACEMENT)?True:False, NULL);
     sprintf(label, "%g", v->ArrowScale);
     XtVaSetValues(WID.PD.vectorScaleText, XmNvalue, label, NULL);
     XtVaSetValues(WID.PD.vectorScaleScale, XmNvalue, THRESHOLD((int)v->ArrowScale,0,200), NULL);
     XtVaSetValues(WID.PD.vectorLocationButt[0], XmNset, 
-		  (v->ArrowLocation == DRAW_POST_LOCATE_COG)?True:False, NULL);
+                  (v->ArrowLocation == DRAW_POST_LOCATE_COG)?True:False, NULL);
     XtVaSetValues(WID.PD.vectorLocationButt[1], XmNset, 
-		  (v->ArrowLocation == DRAW_POST_LOCATE_VERTEX)?True:False, NULL);
+                  (v->ArrowLocation == DRAW_POST_LOCATE_VERTEX)?True:False, NULL);
     XtSetSensitive(WID.PD.vectorLocationCheck, v->ArrowType==DRAW_POST_DISPLACEMENT?False:True);
     XtManageChild(WID.PD.vectorDialog);
     break;
@@ -345,8 +351,6 @@ void PostDialogCb (Widget w, XtPointer client_data, XtPointer call_data){
   case POST_APPLY_BGM  : 
     ViewForDialog[POST_APPLY_BGM] = v;
     BGMWithView(v); 
-    TYPBGMESH = ONFILE; 
-    Create_BgMesh(TYPBGMESH,.2,THEM); 
     break;
 
   default:
@@ -393,21 +397,21 @@ void PostCb (Widget w, XtPointer client_data, XtPointer call_data){
   case POST_COLOR_REPLOT : 
     v = ViewForDialog[POST_COLOR];
     ColorBarChange(v->Name, 
-		   (v->RangeType==DRAW_POST_CUSTOM)?v->CustomMin:v->Min, 
-		   (v->RangeType==DRAW_POST_CUSTOM)?v->CustomMax:v->Max, 
-		   &v->CT, 0);
+                   (v->RangeType==DRAW_POST_CUSTOM)?v->CustomMin:v->Min, 
+                   (v->RangeType==DRAW_POST_CUSTOM)?v->CustomMax:v->Max, 
+                   &v->CT, 0);
     ColorBarShow();
     if(v->CT.ipar[COLORTABLE_CHANGED]){
       v->Changed = 1;
       if(CTX.post.link){
-	ColorBarCopy(&v->CT);
-	for(j=0 ; j< List_Nbr(Post_ViewList) ; j++){
-	  v = (Post_View*)List_Pointer(Post_ViewList, j);
-	  if(v->Visible || CTX.post.link>1){
-	    ColorBarPaste(&v->CT);
-	    v->Changed=1;
-	  }
-	}
+        ColorTable_Copy(&v->CT);
+        for(j=0 ; j< List_Nbr(Post_ViewList) ; j++){
+          v = (Post_View*)List_Pointer(Post_ViewList, j);
+          if(v->Visible || CTX.post.link>1){
+            ColorTable_Paste(&v->CT);
+            v->Changed=1;
+          }
+        }
       }
     }
     Init();
@@ -489,8 +493,8 @@ void ChangeViewParam (Post_View *v, XtPointer client_data, XtPointer call_data){
   char        *c, label[256];
   int          i;
 
-  /* le slider (gradue en interne de -100 a 100) va de -LC a +LC  */
-  sfact = pow(10.,2.-LC_ORDER); 
+  /* le slider (gradue en interne de -100 a 100) va de -CTX.lc a +CTX.lc  */
+  sfact = pow(10.,2.-CTX.lc_order); 
 
   switch((long int)client_data){
 
@@ -501,7 +505,7 @@ void ChangeViewParam (Post_View *v, XtPointer client_data, XtPointer call_data){
       sprintf(label, "%g", v->Offset[i]);
       XtVaSetValues(WID.PD.offsetText[i], XmNvalue, label, NULL);
       XtVaSetValues(WID.PD.offsetScale[i], XmNvalue, 
-		    THRESHOLD((int)(sfact*v->Offset[i]),-100,100), NULL);    
+                    THRESHOLD((int)(sfact*v->Offset[i]),-100,100), NULL);    
       XmUpdateDisplay(WID.PD.offsetText[i]);
       XmUpdateDisplay(WID.PD.offsetScale[i]);
     }
@@ -512,7 +516,7 @@ void ChangeViewParam (Post_View *v, XtPointer client_data, XtPointer call_data){
       sprintf(label, "%g", v->Raise[i]);
       XtVaSetValues(WID.PD.offsetText[i], XmNvalue, label, NULL);
       XtVaSetValues(WID.PD.offsetScale[i], XmNvalue, 
-		    THRESHOLD((int)(sfact*v->Raise[i]),-100,100), NULL);    
+                    THRESHOLD((int)(sfact*v->Raise[i]),-100,100), NULL);    
       XmUpdateDisplay(WID.PD.offsetText[i]);
       XmUpdateDisplay(WID.PD.offsetScale[i]);
     }
diff --git a/Unix/CbPost.h b/Unix/CbPost.h
index 0c50f59f7c..6784a97ef3 100644
--- a/Unix/CbPost.h
+++ b/Unix/CbPost.h
@@ -1,4 +1,4 @@
-/* $Id: CbPost.h,v 1.3 2000-11-25 23:10:37 geuzaine Exp $ */
+/* $Id: CbPost.h,v 1.4 2000-11-26 15:43:48 geuzaine Exp $ */
 #ifndef _CB_POST_H_
 #define _CB_POST_H_
 
@@ -53,7 +53,7 @@
 #define  POST_VECTOR_SCALE_SCALE                   456
 #define  POST_VECTOR_LOCATION_COG                  457
 #define  POST_VECTOR_LOCATION_VERTEX               458
-						    
+                                                    
 #define  POST_EXPORT_BGM_METHOD_H_ERROR            461
 #define  POST_EXPORT_BGM_METHOD_H_ELEMENTS         462
 #define  POST_EXPORT_BGM_METHOD_P_ERROR            463
diff --git a/Unix/Geometry.cpp b/Unix/Geometry.cpp
index de6ace0c9a..c6bc892d7c 100644
--- a/Unix/Geometry.cpp
+++ b/Unix/Geometry.cpp
@@ -1,4 +1,4 @@
-/* $Id: Geometry.cpp,v 1.2 2000-11-23 14:11:41 geuzaine Exp $ */
+/* $Id: Geometry.cpp,v 1.3 2000-11-26 15:43:48 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -35,90 +35,90 @@ void ForceGeometry_M (Widgets_T *w){
   int     n;
 
   XtVaSetValues(w->M.containerWin,
-		XmNmenuBar, w->M.menuBar,
-  		NULL);
+                XmNmenuBar, w->M.menuBar,
+                NULL);
 
   XtVaSetValues(w->M.menuBar,
-		XmNmenuHelpWidget, w->M.helpCascade, 
-		NULL);
+                XmNmenuHelpWidget, w->M.helpCascade, 
+                NULL);
 
   XtVaSetValues(w->M.menuFrame,
-		XmNshadowType, XmSHADOW_OUT,
-		XmNshadowThickness, WINDOW_SHADOW,
-		NULL);
+                XmNshadowType, XmSHADOW_OUT,
+                XmNshadowThickness, WINDOW_SHADOW,
+                NULL);
 
   XtVaSetValues(w->M.menuForm,
-		XmNfractionBase, 100,
-		XmNmarginWidth, 3,
-		XmNmarginHeight, 3,
-		NULL);
+                XmNfractionBase, 100,
+                XmNmarginWidth, 3,
+                XmNmarginHeight, 3,
+                NULL);
 
   XtVaSetValues(w->M.modButt,
-		XmNmarginHeight, 5,
-		XmNmarginWidth, 2,
-		XmNtopAttachment, XmATTACH_FORM,
-		XmNleftAttachment, XmATTACH_WIDGET,
-		XmNleftWidget, w->M.navigButt[0],
-		XmNrightAttachment, XmATTACH_WIDGET,
-		XmNrightWidget, w->M.navigButt[1],
-		NULL);
+                XmNmarginHeight, 5,
+                XmNmarginWidth, 2,
+                XmNtopAttachment, XmATTACH_FORM,
+                XmNleftAttachment, XmATTACH_WIDGET,
+                XmNleftWidget, w->M.navigButt[0],
+                XmNrightAttachment, XmATTACH_WIDGET,
+                XmNrightWidget, w->M.navigButt[1],
+                NULL);
 
   XtVaSetValues(w->M.navigButt[0],
-		XmNshadowThickness, 0,
-		XmNwidth, 20,
-		XmNleftAttachment, XmATTACH_FORM,
-		NULL);
+                XmNshadowThickness, 0,
+                XmNwidth, 20,
+                XmNleftAttachment, XmATTACH_FORM,
+                NULL);
 
   XtVaSetValues(w->M.navigButt[1],
-		XmNshadowThickness, 0,
-		XmNwidth, 20,
-		XmNrightAttachment, XmATTACH_FORM,
-		NULL);
+                XmNshadowThickness, 0,
+                XmNwidth, 20,
+                XmNrightAttachment, XmATTACH_FORM,
+                NULL);
 
   XtVaSetValues(w->M.defaultButt,
-		XmNmarginHeight, 5,
-		XmNtopAttachment, XmATTACH_WIDGET,
-		XmNtopWidget, w->M.modButt,
-		XmNleftAttachment, XmATTACH_FORM,
-		XmNrightAttachment, XmATTACH_FORM,
-		NULL);
+                XmNmarginHeight, 5,
+                XmNtopAttachment, XmATTACH_WIDGET,
+                XmNtopWidget, w->M.modButt,
+                XmNleftAttachment, XmATTACH_FORM,
+                XmNrightAttachment, XmATTACH_FORM,
+                NULL);
 
   XtVaSetValues(w->M.pushButt[0],
-		XmNshadowThickness, SHADOW,
-		XmNmarginHeight, 5,
-		XmNtopAttachment, XmATTACH_WIDGET,
-		XmNtopWidget, w->M.modButt,
-		XmNleftAttachment, XmATTACH_FORM,
-		XmNrightAttachment, XmATTACH_FORM,
-		NULL);
+                XmNshadowThickness, SHADOW,
+                XmNmarginHeight, 5,
+                XmNtopAttachment, XmATTACH_WIDGET,
+                XmNtopWidget, w->M.modButt,
+                XmNleftAttachment, XmATTACH_FORM,
+                XmNrightAttachment, XmATTACH_FORM,
+                NULL);
   
   XtVaSetValues(w->M.toggleButt[0],
-		XmNshadowThickness, SHADOW,
-		XmNmarginHeight, 3,
-		XmNtopAttachment, XmATTACH_WIDGET,
-		XmNtopWidget, w->M.modButt,
-		XmNleftAttachment, XmATTACH_FORM,
-		XmNrightAttachment, XmATTACH_FORM,
-		NULL);
+                XmNshadowThickness, SHADOW,
+                XmNmarginHeight, 3,
+                XmNtopAttachment, XmATTACH_WIDGET,
+                XmNtopWidget, w->M.modButt,
+                XmNleftAttachment, XmATTACH_FORM,
+                XmNrightAttachment, XmATTACH_FORM,
+                NULL);
 
   for(n=1 ; n<NB_BUTT_MAX ; n++){
     XtVaSetValues(w->M.pushButt[n],
-		  XmNtopAttachment, XmATTACH_WIDGET,
-		  XmNtopWidget, w->M.pushButt[n-1],
-		  XmNleftAttachment, XmATTACH_FORM,
-		  XmNrightAttachment, XmATTACH_FORM,
-		  XmNshadowThickness, SHADOW,
-		  XmNmarginHeight, 5,
-		  NULL);
+                  XmNtopAttachment, XmATTACH_WIDGET,
+                  XmNtopWidget, w->M.pushButt[n-1],
+                  XmNleftAttachment, XmATTACH_FORM,
+                  XmNrightAttachment, XmATTACH_FORM,
+                  XmNshadowThickness, SHADOW,
+                  XmNmarginHeight, 5,
+                  NULL);
 
     XtVaSetValues(w->M.toggleButt[n],
-		  XmNtopAttachment, XmATTACH_WIDGET,
-		  XmNtopWidget, w->M.toggleButt[n-1],
-		  XmNleftAttachment, XmATTACH_FORM,
-		  XmNrightAttachment, XmATTACH_FORM,
-		  XmNshadowThickness, SHADOW,
-		  XmNmarginHeight, 3,
-		  NULL);
+                  XmNtopAttachment, XmATTACH_WIDGET,
+                  XmNtopWidget, w->M.toggleButt[n-1],
+                  XmNleftAttachment, XmATTACH_FORM,
+                  XmNrightAttachment, XmATTACH_FORM,
+                  XmNshadowThickness, SHADOW,
+                  XmNmarginHeight, 3,
+                  NULL);
   }
 
 }
@@ -131,88 +131,88 @@ void ForceGeometry_G (Widgets_T *w){
   int  i;
 
   XtVaSetValues(w->G.glw,
-		XmNtopAttachment, XmATTACH_FORM,
-		XmNleftAttachment, XmATTACH_FORM,
-		XmNrightAttachment, XmATTACH_FORM,
-		XmNbottomAttachment, XmATTACH_WIDGET,
-		XmNbottomWidget, w->G.bottomForm,
-		NULL);
+                XmNtopAttachment, XmATTACH_FORM,
+                XmNleftAttachment, XmATTACH_FORM,
+                XmNrightAttachment, XmATTACH_FORM,
+                XmNbottomAttachment, XmATTACH_WIDGET,
+                XmNbottomWidget, w->G.bottomForm,
+                NULL);
 
   if(CTX.overlay)
     XtVaSetValues(w->G.glo,
-		  XmNtopAttachment, XmATTACH_FORM,
-		  XmNleftAttachment, XmATTACH_FORM,
-		  XmNrightAttachment, XmATTACH_FORM,
-		  XmNbottomAttachment, XmATTACH_WIDGET,
-		  XmNbottomWidget, w->G.bottomForm,
-		  NULL);
+                  XmNtopAttachment, XmATTACH_FORM,
+                  XmNleftAttachment, XmATTACH_FORM,
+                  XmNrightAttachment, XmATTACH_FORM,
+                  XmNbottomAttachment, XmATTACH_WIDGET,
+                  XmNbottomWidget, w->G.bottomForm,
+                  NULL);
 
   XtVaSetValues(w->G.bottomForm,
-		XmNleftAttachment, XmATTACH_FORM,
-		XmNrightAttachment, XmATTACH_FORM,
-		XmNbottomAttachment, XmATTACH_FORM,
-		XmNmarginHeight, 2,
-		XmNmarginWidth, 1,
-		XmNshadowThickness, WINDOW_SHADOW,
-		XmNfractionBase, 100,
-		NULL);
+                XmNleftAttachment, XmATTACH_FORM,
+                XmNrightAttachment, XmATTACH_FORM,
+                XmNbottomAttachment, XmATTACH_FORM,
+                XmNmarginHeight, 2,
+                XmNmarginWidth, 1,
+                XmNshadowThickness, WINDOW_SHADOW,
+                XmNfractionBase, 100,
+                NULL);
 
   XtVaSetValues(w->G.Butt[0],
-		XmNtopAttachment, XmATTACH_FORM,
-		XmNbottomAttachment, XmATTACH_FORM,
-		XmNleftAttachment, XmATTACH_FORM,
+                XmNtopAttachment, XmATTACH_FORM,
+                XmNbottomAttachment, XmATTACH_FORM,
+                XmNleftAttachment, XmATTACH_FORM,
                 XmNshadowThickness, 0,
-		XmNmarginHeight, 1,
+                XmNmarginHeight, 1,
                 NULL);
 
   for(i=1 ; i<7 ; i++) {
     XtVaSetValues(w->G.Butt[i],
-		  XmNtopAttachment, XmATTACH_FORM,
-		  XmNbottomAttachment, XmATTACH_FORM,
-		  XmNleftAttachment, XmATTACH_WIDGET,
-		  XmNleftWidget, w->G.Butt[i-1],
-		  XmNshadowThickness, 0,
-		  XmNmarginHeight, 1,
-		  NULL);
+                  XmNtopAttachment, XmATTACH_FORM,
+                  XmNbottomAttachment, XmATTACH_FORM,
+                  XmNleftAttachment, XmATTACH_WIDGET,
+                  XmNleftWidget, w->G.Butt[i-1],
+                  XmNshadowThickness, 0,
+                  XmNmarginHeight, 1,
+                  NULL);
   }
 
   XtVaSetValues(w->G.textForm,
-		XmNbottomAttachment, XmATTACH_FORM,
-		XmNtopAttachment, XmATTACH_FORM,
-		XmNleftAttachment, XmATTACH_WIDGET,
-		XmNleftWidget, w->G.Butt[6],
-		XmNrightAttachment, XmATTACH_FORM,
-		XmNfractionBase, 300,
-		NULL);
+                XmNbottomAttachment, XmATTACH_FORM,
+                XmNtopAttachment, XmATTACH_FORM,
+                XmNleftAttachment, XmATTACH_WIDGET,
+                XmNleftWidget, w->G.Butt[6],
+                XmNrightAttachment, XmATTACH_FORM,
+                XmNfractionBase, 300,
+                NULL);
 
   XtVaSetValues(w->G.selectLabel,
-		XmNtopAttachment, XmATTACH_FORM,
-		XmNbottomAttachment, XmATTACH_FORM,
-		XmNleftAttachment, XmATTACH_POSITION,
+                XmNtopAttachment, XmATTACH_FORM,
+                XmNbottomAttachment, XmATTACH_FORM,
+                XmNleftAttachment, XmATTACH_POSITION,
                 XmNleftPosition, 2,
-		XmNrightAttachment, XmATTACH_POSITION,
+                XmNrightAttachment, XmATTACH_POSITION,
                 XmNrightPosition, 90,
-		XmNmarginHeight, 0,
+                XmNmarginHeight, 0,
                 NULL);
 
   XtVaSetValues(w->G.infoLabel,
-		XmNtopAttachment, XmATTACH_FORM,
-		XmNbottomAttachment, XmATTACH_FORM,
-		XmNleftAttachment, XmATTACH_POSITION,
+                XmNtopAttachment, XmATTACH_FORM,
+                XmNbottomAttachment, XmATTACH_FORM,
+                XmNleftAttachment, XmATTACH_POSITION,
                 XmNleftPosition, 92,
-		XmNrightAttachment, XmATTACH_POSITION,
+                XmNrightAttachment, XmATTACH_POSITION,
                 XmNrightPosition, 180,
-		XmNmarginHeight, 0,
+                XmNmarginHeight, 0,
                 NULL);
 
   XtVaSetValues(w->G.statusLabel,
-		XmNtopAttachment, XmATTACH_FORM,
-		XmNbottomAttachment, XmATTACH_FORM,
-		XmNleftAttachment, XmATTACH_POSITION,
+                XmNtopAttachment, XmATTACH_FORM,
+                XmNbottomAttachment, XmATTACH_FORM,
+                XmNleftAttachment, XmATTACH_POSITION,
                 XmNleftPosition, 182,
-		XmNrightAttachment, XmATTACH_POSITION,
+                XmNrightAttachment, XmATTACH_POSITION,
                 XmNrightPosition, 298,
-		XmNmarginHeight, 0,
+                XmNmarginHeight, 0,
                 NULL);
 
 
@@ -225,21 +225,21 @@ void ForceGeometry_G (Widgets_T *w){
 void ForceGeometry_C (Widgets_T *w){
   
   XtVaSetValues(w->C.command,
-		XmNshadowThickness, WINDOW_SHADOW,
-		XmNshadowType, XmSHADOW_OUT,
-		XmNmarginHeight, 2,
-		XmNmarginWidth, 2,
-		NULL);
+                XmNshadowThickness, WINDOW_SHADOW,
+                XmNshadowType, XmSHADOW_OUT,
+                XmNmarginHeight, 2,
+                XmNmarginWidth, 2,
+                NULL);
 
   XtVaSetValues(w->C.commandList,
-		XmNshadowThickness, SHADOW,
-		XmNmarginHeight, 0,
-		NULL);
+                XmNshadowThickness, SHADOW,
+                XmNmarginHeight, 0,
+                NULL);
 
   XtVaSetValues(w->C.commandText,
-		XmNshadowThickness, SHADOW,
-		XmNmarginHeight, 4,
-		NULL);
+                XmNshadowThickness, SHADOW,
+                XmNmarginHeight, 4,
+                NULL);
 }
 
 /* ------------------------------------------------------------------------ 
@@ -252,57 +252,57 @@ void ForceGeometry_ED (Widgets_T *w){
 void ForceGeometry_FD (Widgets_T *w){
 
   XtVaSetValues(w->FD.openDialog,
-		XmNmarginHeight, DIALOG_H,
-		XmNmarginWidth, DIALOG_W,
-		NULL);
+                XmNmarginHeight, DIALOG_H,
+                XmNmarginWidth, DIALOG_W,
+                NULL);
 
   XtVaSetValues(w->FD.mergeDialog,
-		XmNmarginHeight, DIALOG_H,
-		XmNmarginWidth, DIALOG_W,
-		NULL);
+                XmNmarginHeight, DIALOG_H,
+                XmNmarginWidth, DIALOG_W,
+                NULL);
 
   XtVaSetValues(w->FD.saveDialog,
-		XmNmarginHeight, DIALOG_H,
-		XmNmarginWidth, DIALOG_W,
-		NULL);
+                XmNmarginHeight, DIALOG_H,
+                XmNmarginWidth, DIALOG_W,
+                NULL);
 
   XtVaSetValues(w->FD.saveAsDialog,
-		XmNmarginHeight, DIALOG_H,
-		XmNmarginWidth, DIALOG_W,
-		NULL);
+                XmNmarginHeight, DIALOG_H,
+                XmNmarginWidth, DIALOG_W,
+                NULL);
 
   XtVaSetValues(w->FD.saveAsFrame[0],
-		XmNshadowType, IN_FRAME_TYPE,
-		XmNshadowThickness, IN_FRAME_SHADOW,
-		NULL);
+                XmNshadowType, IN_FRAME_TYPE,
+                XmNshadowThickness, IN_FRAME_SHADOW,
+                NULL);
 
   XtVaSetValues(w->FD.saveAsFrame[1],
-		XmNchildHorizontalSpacing, TITLE_SPACE,
-		XmNchildVerticalAlignment, TITLE_ALIGN,
-		NULL);
+                XmNchildHorizontalSpacing, TITLE_SPACE,
+                XmNchildVerticalAlignment, TITLE_ALIGN,
+                NULL);
 
   XtVaSetValues(w->FD.saveAsRowCol,
-		XmNmarginWidth, 0,
-		NULL);
+                XmNmarginWidth, 0,
+                NULL);
 
   XtVaSetValues(w->FD.printDialog,
-		XmNmarginHeight, DIALOG_H,
-		XmNmarginWidth, DIALOG_W,
-		NULL);
+                XmNmarginHeight, DIALOG_H,
+                XmNmarginWidth, DIALOG_W,
+                NULL);
 
   XtVaSetValues(w->FD.printFrame[0],
-		XmNshadowType, IN_FRAME_TYPE,
-		XmNshadowThickness, IN_FRAME_SHADOW,
-		NULL);
+                XmNshadowType, IN_FRAME_TYPE,
+                XmNshadowThickness, IN_FRAME_SHADOW,
+                NULL);
 
   XtVaSetValues(w->FD.printFrame[1],
-		XmNchildHorizontalSpacing, TITLE_SPACE,
-		XmNchildVerticalAlignment, TITLE_ALIGN,
-		NULL);
+                XmNchildHorizontalSpacing, TITLE_SPACE,
+                XmNchildVerticalAlignment, TITLE_ALIGN,
+                NULL);
 
   XtVaSetValues(w->FD.printRowCol,
-		XmNmarginWidth, 0,
-		NULL);
+                XmNmarginWidth, 0,
+                NULL);
 
 }
 
@@ -310,243 +310,243 @@ void ForceGeometry_OD (Widgets_T *w){
   int  i,j;
 
   XtVaSetValues(w->OD.geomDialog,
-		XmNmarginHeight, DIALOG_H,
-		XmNmarginWidth, DIALOG_W,
-		NULL);
+                XmNmarginHeight, DIALOG_H,
+                XmNmarginWidth, DIALOG_W,
+                NULL);
 
   XtVaSetValues(w->OD.geomVisibleFrame[0],
-		XmNshadowType, IN_FRAME_TYPE,
-		XmNshadowThickness, IN_FRAME_SHADOW,
-		NULL);
+                XmNshadowType, IN_FRAME_TYPE,
+                XmNshadowThickness, IN_FRAME_SHADOW,
+                NULL);
 
   XtVaSetValues(w->OD.geomVisibleFrame[1],
-		XmNchildHorizontalSpacing, TITLE_SPACE,
-		XmNchildVerticalAlignment, TITLE_ALIGN,
-		NULL);
+                XmNchildHorizontalSpacing, TITLE_SPACE,
+                XmNchildVerticalAlignment, TITLE_ALIGN,
+                NULL);
 
   XtVaSetValues(w->OD.geomVisibleByNumFrame[0],
-		XmNshadowType, IN_FRAME_TYPE,
-		XmNshadowThickness, IN_FRAME_SHADOW,
-		NULL);
+                XmNshadowType, IN_FRAME_TYPE,
+                XmNshadowThickness, IN_FRAME_SHADOW,
+                NULL);
 
   XtVaSetValues(w->OD.geomVisibleByNumFrame[1],
-		XmNchildHorizontalSpacing, TITLE_SPACE,
-		XmNchildVerticalAlignment, TITLE_ALIGN,
-		NULL);
+                XmNchildHorizontalSpacing, TITLE_SPACE,
+                XmNchildVerticalAlignment, TITLE_ALIGN,
+                NULL);
 
   XtVaSetValues(w->OD.geomNormalsFrame[0],
-		XmNshadowType, IN_FRAME_TYPE,
-		XmNshadowThickness, IN_FRAME_SHADOW,
-		NULL);
+                XmNshadowType, IN_FRAME_TYPE,
+                XmNshadowThickness, IN_FRAME_SHADOW,
+                NULL);
 
   XtVaSetValues(w->OD.geomNormalsFrame[1],
-		XmNchildHorizontalSpacing, TITLE_SPACE,
-		XmNchildVerticalAlignment, TITLE_ALIGN,
-		NULL);
+                XmNchildHorizontalSpacing, TITLE_SPACE,
+                XmNchildVerticalAlignment, TITLE_ALIGN,
+                NULL);
 
   XtVaSetValues(w->OD.geomTangentsFrame[0],
-		XmNshadowType, IN_FRAME_TYPE,
-		XmNshadowThickness, IN_FRAME_SHADOW,
-		NULL);
+                XmNshadowType, IN_FRAME_TYPE,
+                XmNshadowThickness, IN_FRAME_SHADOW,
+                NULL);
 
   XtVaSetValues(w->OD.geomTangentsFrame[1],
-		XmNchildHorizontalSpacing, TITLE_SPACE,
-		XmNchildVerticalAlignment, TITLE_ALIGN,
-		NULL);
+                XmNchildHorizontalSpacing, TITLE_SPACE,
+                XmNchildVerticalAlignment, TITLE_ALIGN,
+                NULL);
 
   XtVaSetValues(w->OD.meshDialog,
-		XmNmarginHeight, DIALOG_H,
-		XmNmarginWidth, DIALOG_W,
-		NULL);
+                XmNmarginHeight, DIALOG_H,
+                XmNmarginWidth, DIALOG_W,
+                NULL);
 
   XtVaSetValues(w->OD.meshAlgoFrame[0],
-		XmNshadowType, IN_FRAME_TYPE,
-		XmNshadowThickness, IN_FRAME_SHADOW,
-		NULL);
+                XmNshadowType, IN_FRAME_TYPE,
+                XmNshadowThickness, IN_FRAME_SHADOW,
+                NULL);
 
   XtVaSetValues(w->OD.meshAlgoFrame[1],
-		XmNchildHorizontalSpacing, TITLE_SPACE,
-		XmNchildVerticalAlignment, TITLE_ALIGN,
-		NULL);
+                XmNchildHorizontalSpacing, TITLE_SPACE,
+                XmNchildVerticalAlignment, TITLE_ALIGN,
+                NULL);
   
   XtVaSetValues(w->OD.meshSmoothingFrame[0],
-		XmNshadowType, IN_FRAME_TYPE,
-		XmNshadowThickness, IN_FRAME_SHADOW,
-		NULL);
+                XmNshadowType, IN_FRAME_TYPE,
+                XmNshadowThickness, IN_FRAME_SHADOW,
+                NULL);
 
   XtVaSetValues(w->OD.meshSmoothingFrame[1],
-		XmNchildHorizontalSpacing, TITLE_SPACE,
-		XmNchildVerticalAlignment, TITLE_ALIGN,
-		NULL);
+                XmNchildHorizontalSpacing, TITLE_SPACE,
+                XmNchildVerticalAlignment, TITLE_ALIGN,
+                NULL);
 
   XtVaSetValues(w->OD.meshVisibleFrame[0],
-		XmNshadowType, IN_FRAME_TYPE,
-		XmNshadowThickness, IN_FRAME_SHADOW,
-		NULL);
+                XmNshadowType, IN_FRAME_TYPE,
+                XmNshadowThickness, IN_FRAME_SHADOW,
+                NULL);
 
   XtVaSetValues(w->OD.meshVisibleFrame[1],
-		XmNchildHorizontalSpacing, TITLE_SPACE,
-		XmNchildVerticalAlignment, TITLE_ALIGN,
-		NULL);
+                XmNchildHorizontalSpacing, TITLE_SPACE,
+                XmNchildVerticalAlignment, TITLE_ALIGN,
+                NULL);
 
   XtVaSetValues(w->OD.meshVisibleByNumFrame[0],
-		XmNshadowType, IN_FRAME_TYPE,
-		XmNshadowThickness, IN_FRAME_SHADOW,
-		NULL);
+                XmNshadowType, IN_FRAME_TYPE,
+                XmNshadowThickness, IN_FRAME_SHADOW,
+                NULL);
 
   XtVaSetValues(w->OD.meshVisibleByNumFrame[1],
-		XmNchildHorizontalSpacing, TITLE_SPACE,
-		XmNchildVerticalAlignment, TITLE_ALIGN,
-		NULL);
+                XmNchildHorizontalSpacing, TITLE_SPACE,
+                XmNchildVerticalAlignment, TITLE_ALIGN,
+                NULL);
 
   XtVaSetValues(w->OD.meshAspectFrame[0],
-		XmNshadowType, IN_FRAME_TYPE,
-		XmNshadowThickness, IN_FRAME_SHADOW,
-		NULL);
+                XmNshadowType, IN_FRAME_TYPE,
+                XmNshadowThickness, IN_FRAME_SHADOW,
+                NULL);
 
   XtVaSetValues(w->OD.meshAspectFrame[1],
-		XmNchildHorizontalSpacing, TITLE_SPACE,
-		XmNchildVerticalAlignment, TITLE_ALIGN,
-		NULL);
+                XmNchildHorizontalSpacing, TITLE_SPACE,
+                XmNchildVerticalAlignment, TITLE_ALIGN,
+                NULL);
 
   XtVaSetValues(w->OD.meshExplodeFrame[0],
-		XmNshadowType, IN_FRAME_TYPE,
-		XmNshadowThickness, IN_FRAME_SHADOW,
-		NULL);
+                XmNshadowType, IN_FRAME_TYPE,
+                XmNshadowThickness, IN_FRAME_SHADOW,
+                NULL);
 
   XtVaSetValues(w->OD.meshExplodeFrame[1],
-		XmNchildHorizontalSpacing, TITLE_SPACE,
-		XmNchildVerticalAlignment, TITLE_ALIGN,
-		NULL);
+                XmNchildHorizontalSpacing, TITLE_SPACE,
+                XmNchildVerticalAlignment, TITLE_ALIGN,
+                NULL);
 
   XtVaSetValues(w->OD.meshNormalsFrame[0],
-		XmNshadowType, IN_FRAME_TYPE,
-		XmNshadowThickness, IN_FRAME_SHADOW,
-		NULL);
+                XmNshadowType, IN_FRAME_TYPE,
+                XmNshadowThickness, IN_FRAME_SHADOW,
+                NULL);
 
   XtVaSetValues(w->OD.meshNormalsFrame[1],
-		XmNchildHorizontalSpacing, TITLE_SPACE,
-		XmNchildVerticalAlignment, TITLE_ALIGN,
-		NULL);
+                XmNchildHorizontalSpacing, TITLE_SPACE,
+                XmNchildVerticalAlignment, TITLE_ALIGN,
+                NULL);
 
   XtVaSetValues(w->OD.postDialog,
-		XmNmarginHeight, DIALOG_H,
-		XmNmarginWidth, DIALOG_W,
-		NULL);
+                XmNmarginHeight, DIALOG_H,
+                XmNmarginWidth, DIALOG_W,
+                NULL);
 
   XtVaSetValues(w->OD.postLinkFrame[0],
-		XmNshadowType, IN_FRAME_TYPE,
-		XmNshadowThickness, IN_FRAME_SHADOW,
-		NULL);
+                XmNshadowType, IN_FRAME_TYPE,
+                XmNshadowThickness, IN_FRAME_SHADOW,
+                NULL);
 
   XtVaSetValues(w->OD.postLinkFrame[1],
-		XmNchildHorizontalSpacing, TITLE_SPACE,
-		XmNchildVerticalAlignment, TITLE_ALIGN,
-		NULL);
+                XmNchildHorizontalSpacing, TITLE_SPACE,
+                XmNchildVerticalAlignment, TITLE_ALIGN,
+                NULL);
 
   XtVaSetValues(w->OD.postAnimFrame[0],
-		XmNshadowType, IN_FRAME_TYPE,
-		XmNshadowThickness, IN_FRAME_SHADOW,
-		NULL);
+                XmNshadowType, IN_FRAME_TYPE,
+                XmNshadowThickness, IN_FRAME_SHADOW,
+                NULL);
 
   XtVaSetValues(w->OD.postAnimFrame[1],
-		XmNchildHorizontalSpacing, TITLE_SPACE,
-		XmNchildVerticalAlignment, TITLE_ALIGN,
-		NULL);
+                XmNchildHorizontalSpacing, TITLE_SPACE,
+                XmNchildVerticalAlignment, TITLE_ALIGN,
+                NULL);
 
   XtVaSetValues(w->OD.miscDialog,
-		XmNmarginHeight, DIALOG_H,
-		XmNmarginWidth, DIALOG_W,
-		NULL);
+                XmNmarginHeight, DIALOG_H,
+                XmNmarginWidth, DIALOG_W,
+                NULL);
 
   XtVaSetValues(w->OD.miscMiscFrame[0],
-		XmNshadowType, IN_FRAME_TYPE,
-		XmNshadowThickness, IN_FRAME_SHADOW,
-		NULL);
+                XmNshadowType, IN_FRAME_TYPE,
+                XmNshadowThickness, IN_FRAME_SHADOW,
+                NULL);
 
   XtVaSetValues(w->OD.miscMiscFrame[1],
-		XmNchildHorizontalSpacing, TITLE_SPACE,
-		XmNchildVerticalAlignment, TITLE_ALIGN,
-		NULL);
+                XmNchildHorizontalSpacing, TITLE_SPACE,
+                XmNchildVerticalAlignment, TITLE_ALIGN,
+                NULL);
 
   XtVaSetValues(w->OD.miscColorSchemeFrame[0],
-		XmNshadowType, IN_FRAME_TYPE,
-		XmNshadowThickness, IN_FRAME_SHADOW,
-		NULL);
+                XmNshadowType, IN_FRAME_TYPE,
+                XmNshadowThickness, IN_FRAME_SHADOW,
+                NULL);
 
   XtVaSetValues(w->OD.miscColorSchemeFrame[1],
-		XmNchildHorizontalSpacing, TITLE_SPACE,
-		XmNchildVerticalAlignment, TITLE_ALIGN,
-		NULL);
+                XmNchildHorizontalSpacing, TITLE_SPACE,
+                XmNchildVerticalAlignment, TITLE_ALIGN,
+                NULL);
   
   XtVaSetValues(w->OD.miscProjFrame[0],
-		XmNshadowType, IN_FRAME_TYPE,
-		XmNshadowThickness, IN_FRAME_SHADOW,
-		NULL);
+                XmNshadowType, IN_FRAME_TYPE,
+                XmNshadowThickness, IN_FRAME_SHADOW,
+                NULL);
 
   XtVaSetValues(w->OD.miscProjFrame[1],
-		XmNchildHorizontalSpacing, TITLE_SPACE,
-		XmNchildVerticalAlignment, TITLE_ALIGN,
-		NULL);
+                XmNchildHorizontalSpacing, TITLE_SPACE,
+                XmNchildVerticalAlignment, TITLE_ALIGN,
+                NULL);
 
   XtVaSetValues(w->OD.miscLightFrame[0],
-		XmNshadowType, IN_FRAME_TYPE,
-		XmNshadowThickness, IN_FRAME_SHADOW,
-		NULL);
+                XmNshadowType, IN_FRAME_TYPE,
+                XmNshadowThickness, IN_FRAME_SHADOW,
+                NULL);
 
   XtVaSetValues(w->OD.miscLightFrame[1],
-		XmNchildHorizontalSpacing, TITLE_SPACE,
-		XmNchildVerticalAlignment, TITLE_ALIGN,
-		NULL);
+                XmNchildHorizontalSpacing, TITLE_SPACE,
+                XmNchildVerticalAlignment, TITLE_ALIGN,
+                NULL);
 
   XtVaSetValues(w->OD.miscShineFrame[0],
-		XmNshadowType, IN_FRAME_TYPE,
-		XmNshadowThickness, IN_FRAME_SHADOW,
-		NULL);
+                XmNshadowType, IN_FRAME_TYPE,
+                XmNshadowThickness, IN_FRAME_SHADOW,
+                NULL);
 
   XtVaSetValues(w->OD.miscShineFrame[1],
-		XmNchildHorizontalSpacing, TITLE_SPACE,
-		XmNchildVerticalAlignment, TITLE_ALIGN,
-		NULL);
+                XmNchildHorizontalSpacing, TITLE_SPACE,
+                XmNchildVerticalAlignment, TITLE_ALIGN,
+                NULL);
 
   XtVaSetValues(w->OD.viewportDialog,
-		XmNmarginHeight, DIALOG_H,
-		XmNmarginWidth, DIALOG_W,
-		NULL);
+                XmNmarginHeight, DIALOG_H,
+                XmNmarginWidth, DIALOG_W,
+                NULL);
   
   for(i=0 ; i<3 ; i++){
     XtVaSetValues(w->OD.viewportFrame[0][i],    
-		  XmNshadowType, IN_FRAME_TYPE,
-		  XmNshadowThickness, IN_FRAME_SHADOW,
-		  NULL);
-		  
+                  XmNshadowType, IN_FRAME_TYPE,
+                  XmNshadowThickness, IN_FRAME_SHADOW,
+                  NULL);
+                  
     XtVaSetValues(w->OD.viewportFrame[1][i],
-		  XmNchildHorizontalSpacing, TITLE_SPACE,
-		  XmNchildVerticalAlignment, TITLE_ALIGN,
-		  NULL);
+                  XmNchildHorizontalSpacing, TITLE_SPACE,
+                  XmNchildVerticalAlignment, TITLE_ALIGN,
+                  NULL);
 
     for(j=0 ; j<3 ; j++){
       XtVaSetValues(w->OD.viewportLockButt[j][i],
-		    XmNmarginHeight, 0,
-		    NULL);
+                    XmNmarginHeight, 0,
+                    NULL);
     }
   }
 
   XtVaSetValues(w->OD.infoDialog,
-		XmNmarginHeight, DIALOG_H,
-		XmNmarginWidth, DIALOG_W,
-		NULL);
+                XmNmarginHeight, DIALOG_H,
+                XmNmarginWidth, DIALOG_W,
+                NULL);
 
   for(i=0 ; i<3 ; i++){
     XtVaSetValues(w->OD.infoFrame[0][i],    
-		  XmNshadowType, IN_FRAME_TYPE,
-		  XmNshadowThickness, IN_FRAME_SHADOW,
-		  NULL);
-		  
+                  XmNshadowType, IN_FRAME_TYPE,
+                  XmNshadowThickness, IN_FRAME_SHADOW,
+                  NULL);
+                  
     XtVaSetValues(w->OD.infoFrame[1][i],
-		  XmNchildHorizontalSpacing, TITLE_SPACE,
-		  XmNchildVerticalAlignment, TITLE_ALIGN,
-		  NULL);
+                  XmNchildHorizontalSpacing, TITLE_SPACE,
+                  XmNchildVerticalAlignment, TITLE_ALIGN,
+                  NULL);
   }
 
 }
@@ -554,96 +554,96 @@ void ForceGeometry_OD (Widgets_T *w){
 void ForceGeometry_HD (Widgets_T *w){
 
   XtVaSetValues(w->HD.keysDialog,
-		XmNmarginHeight, DIALOG_H,
-		XmNmarginWidth, DIALOG_W,
-		NULL);
+                XmNmarginHeight, DIALOG_H,
+                XmNmarginWidth, DIALOG_W,
+                NULL);
 }
 
 void ForceGeometry_GD (Widgets_T *w){
   int  i;
 
   XtVaSetValues(w->GD.paramDialog,
-		XmNmarginHeight, DIALOG_H,
-		XmNmarginWidth, DIALOG_W,
-		NULL);
+                XmNmarginHeight, DIALOG_H,
+                XmNmarginWidth, DIALOG_W,
+                NULL);
 
   for(i=0 ; i<2 ; i++){
     XtVaSetValues(w->GD.paramFrame[0][i],
-		  XmNshadowType, IN_FRAME_TYPE,
-		  XmNshadowThickness, IN_FRAME_SHADOW,
-		  NULL);
+                  XmNshadowType, IN_FRAME_TYPE,
+                  XmNshadowThickness, IN_FRAME_SHADOW,
+                  NULL);
 
     XtVaSetValues(w->GD.paramFrame[1][i],
-		  XmNchildHorizontalSpacing, TITLE_SPACE,
-		  XmNchildVerticalAlignment, TITLE_ALIGN,
-		  NULL);
+                  XmNchildHorizontalSpacing, TITLE_SPACE,
+                  XmNchildVerticalAlignment, TITLE_ALIGN,
+                  NULL);
   }
 
 
   XtVaSetValues(w->GD.pointDialog,
-		XmNmarginHeight, DIALOG_H,
-		XmNmarginWidth, DIALOG_W,
-		NULL);
+                XmNmarginHeight, DIALOG_H,
+                XmNmarginWidth, DIALOG_W,
+                NULL);
 
   for(i=0 ; i<2 ; i++){
     XtVaSetValues(w->GD.pointFrame[0][i],
-		  XmNshadowType, IN_FRAME_TYPE,
-		  XmNshadowThickness, IN_FRAME_SHADOW,
-		  NULL);
+                  XmNshadowType, IN_FRAME_TYPE,
+                  XmNshadowThickness, IN_FRAME_SHADOW,
+                  NULL);
 
     XtVaSetValues(w->GD.pointFrame[1][i],
-		  XmNchildHorizontalSpacing, TITLE_SPACE,
-		  XmNchildVerticalAlignment, TITLE_ALIGN,
-		  NULL);
+                  XmNchildHorizontalSpacing, TITLE_SPACE,
+                  XmNchildVerticalAlignment, TITLE_ALIGN,
+                  NULL);
   }
 
   XtVaSetValues(w->GD.rotDialog,
-		XmNmarginHeight, DIALOG_H,
-		XmNmarginWidth, DIALOG_W,
-		NULL);
+                XmNmarginHeight, DIALOG_H,
+                XmNmarginWidth, DIALOG_W,
+                NULL);
 
   for(i=0 ; i<3 ; i++){
     XtVaSetValues(w->GD.rotFrame[0][i],
-		  XmNshadowType, IN_FRAME_TYPE,
-		  XmNshadowThickness, IN_FRAME_SHADOW,
-		  NULL);
+                  XmNshadowType, IN_FRAME_TYPE,
+                  XmNshadowThickness, IN_FRAME_SHADOW,
+                  NULL);
 
     XtVaSetValues(w->GD.rotFrame[1][i],
-		  XmNchildHorizontalSpacing, TITLE_SPACE,
-		  XmNchildVerticalAlignment, TITLE_ALIGN,
-		  NULL);
+                  XmNchildHorizontalSpacing, TITLE_SPACE,
+                  XmNchildVerticalAlignment, TITLE_ALIGN,
+                  NULL);
   }
 
   XtVaSetValues(w->GD.tranDialog,
-		XmNmarginHeight, DIALOG_H,
-		XmNmarginWidth, DIALOG_W,
-		NULL);
+                XmNmarginHeight, DIALOG_H,
+                XmNmarginWidth, DIALOG_W,
+                NULL);
 
   XtVaSetValues(w->GD.tranFrame[0],
-		XmNshadowType, IN_FRAME_TYPE,
-		XmNshadowThickness, IN_FRAME_SHADOW,
-		NULL);
+                XmNshadowType, IN_FRAME_TYPE,
+                XmNshadowThickness, IN_FRAME_SHADOW,
+                NULL);
 
   XtVaSetValues(w->GD.tranFrame[1],
-		XmNchildHorizontalSpacing, TITLE_SPACE,
-		XmNchildVerticalAlignment, TITLE_ALIGN,
-		NULL);
+                XmNchildHorizontalSpacing, TITLE_SPACE,
+                XmNchildVerticalAlignment, TITLE_ALIGN,
+                NULL);
 
   XtVaSetValues(w->GD.dilatDialog,
-		XmNmarginHeight, DIALOG_H,
-		XmNmarginWidth, DIALOG_W,
-		NULL);
+                XmNmarginHeight, DIALOG_H,
+                XmNmarginWidth, DIALOG_W,
+                NULL);
 
   for(i=0 ; i<2 ; i++){
     XtVaSetValues(w->GD.dilatFrame[0][i],
-		  XmNshadowType, IN_FRAME_TYPE,
-		  XmNshadowThickness, IN_FRAME_SHADOW,
-		  NULL);
+                  XmNshadowType, IN_FRAME_TYPE,
+                  XmNshadowThickness, IN_FRAME_SHADOW,
+                  NULL);
 
     XtVaSetValues(w->GD.dilatFrame[1][i],
-		  XmNchildHorizontalSpacing, TITLE_SPACE,
-		  XmNchildVerticalAlignment, TITLE_ALIGN,
-		  NULL);
+                  XmNchildHorizontalSpacing, TITLE_SPACE,
+                  XmNchildVerticalAlignment, TITLE_ALIGN,
+                  NULL);
   }
 
 }
@@ -652,50 +652,50 @@ void ForceGeometry_MD (Widgets_T *w){
   int  i;
 
   XtVaSetValues(w->MD.charLengthDialog,
-		XmNmarginHeight, DIALOG_H,
-		XmNmarginWidth, DIALOG_W,
-		NULL);
+                XmNmarginHeight, DIALOG_H,
+                XmNmarginWidth, DIALOG_W,
+                NULL);
 
   XtVaSetValues(w->MD.charLengthFrame[0],
-		XmNshadowType, IN_FRAME_TYPE,
-		XmNshadowThickness, IN_FRAME_SHADOW,
-		NULL);
+                XmNshadowType, IN_FRAME_TYPE,
+                XmNshadowThickness, IN_FRAME_SHADOW,
+                NULL);
 
   XtVaSetValues(w->MD.charLengthFrame[1],
-		XmNchildHorizontalSpacing, TITLE_SPACE,
-		XmNchildVerticalAlignment, TITLE_ALIGN,
-		NULL);
+                XmNchildHorizontalSpacing, TITLE_SPACE,
+                XmNchildVerticalAlignment, TITLE_ALIGN,
+                NULL);
 
   XtVaSetValues(w->MD.trsfLineDialog,
-		XmNmarginHeight, DIALOG_H,
-		XmNmarginWidth, DIALOG_W,
-		NULL);
+                XmNmarginHeight, DIALOG_H,
+                XmNmarginWidth, DIALOG_W,
+                NULL);
 
   for(i=0 ; i<2 ; i++){
     XtVaSetValues(w->MD.trsfLineFrame[0][i],
-		  XmNshadowType, IN_FRAME_TYPE,
-		  XmNshadowThickness, IN_FRAME_SHADOW,
-		  NULL);
+                  XmNshadowType, IN_FRAME_TYPE,
+                  XmNshadowThickness, IN_FRAME_SHADOW,
+                  NULL);
     XtVaSetValues(w->MD.trsfLineFrame[1][i],
-		  XmNchildHorizontalSpacing, TITLE_SPACE,
-		  XmNchildVerticalAlignment, TITLE_ALIGN,
-		  NULL);
+                  XmNchildHorizontalSpacing, TITLE_SPACE,
+                  XmNchildVerticalAlignment, TITLE_ALIGN,
+                  NULL);
   }
   
   XtVaSetValues(w->MD.trsfVolumeDialog,
-		XmNmarginHeight, DIALOG_H,
-		XmNmarginWidth, DIALOG_W,
-		NULL);
+                XmNmarginHeight, DIALOG_H,
+                XmNmarginWidth, DIALOG_W,
+                NULL);
 
   XtVaSetValues(w->MD.trsfVolumeFrame[0],
-		XmNshadowType, IN_FRAME_TYPE,
-		XmNshadowThickness, IN_FRAME_SHADOW,
-		NULL);
+                XmNshadowType, IN_FRAME_TYPE,
+                XmNshadowThickness, IN_FRAME_SHADOW,
+                NULL);
 
   XtVaSetValues(w->MD.trsfVolumeFrame[1],
-		XmNchildHorizontalSpacing, TITLE_SPACE,
-		XmNchildVerticalAlignment, TITLE_ALIGN,
-		NULL);
+                XmNchildHorizontalSpacing, TITLE_SPACE,
+                XmNchildVerticalAlignment, TITLE_ALIGN,
+                NULL);
 
 }
 
@@ -704,108 +704,108 @@ void ForceGeometry_PD (Widgets_T *w){
   
 
   XtVaSetValues(w->PD.offsetDialog,
-		XmNmarginHeight, DIALOG_H,
-		XmNmarginWidth, DIALOG_W,
-		NULL);
+                XmNmarginHeight, DIALOG_H,
+                XmNmarginWidth, DIALOG_W,
+                NULL);
 
   for(i=0 ; i<4 ; i++){
     XtVaSetValues(w->PD.offsetFrame[0][i],
-		  XmNshadowType, IN_FRAME_TYPE,
-		  XmNshadowThickness, IN_FRAME_SHADOW,
-		  NULL);
+                  XmNshadowType, IN_FRAME_TYPE,
+                  XmNshadowThickness, IN_FRAME_SHADOW,
+                  NULL);
     XtVaSetValues(w->PD.offsetFrame[1][i],
-		  XmNchildHorizontalSpacing, TITLE_SPACE,
-		  XmNchildVerticalAlignment, TITLE_ALIGN,
-		  NULL);
+                  XmNchildHorizontalSpacing, TITLE_SPACE,
+                  XmNchildVerticalAlignment, TITLE_ALIGN,
+                  NULL);
   }
   
   XtVaSetValues(w->PD.timeStepDialog,
-		XmNmarginHeight, DIALOG_H,
-		XmNmarginWidth, DIALOG_W,
-		NULL);
+                XmNmarginHeight, DIALOG_H,
+                XmNmarginWidth, DIALOG_W,
+                NULL);
 
   XtVaSetValues(w->PD.timeStepFrame[0],
-		XmNshadowType, IN_FRAME_TYPE,
-		XmNshadowThickness, IN_FRAME_SHADOW,
-		NULL);
+                XmNshadowType, IN_FRAME_TYPE,
+                XmNshadowThickness, IN_FRAME_SHADOW,
+                NULL);
   XtVaSetValues(w->PD.timeStepFrame[1],
-		XmNchildHorizontalSpacing, TITLE_SPACE,
-		XmNchildVerticalAlignment, TITLE_ALIGN,
-		NULL);
+                XmNchildHorizontalSpacing, TITLE_SPACE,
+                XmNchildVerticalAlignment, TITLE_ALIGN,
+                NULL);
 
   XtVaSetValues(w->PD.scaleDialog,
-		XmNmarginHeight, DIALOG_H,
-		XmNmarginWidth, DIALOG_W,
-		NULL);
+                XmNmarginHeight, DIALOG_H,
+                XmNmarginWidth, DIALOG_W,
+                NULL);
 
   for(i=0 ; i<3 ; i++){
     XtVaSetValues(w->PD.scaleFrame[0][i],
-		  XmNshadowType, IN_FRAME_TYPE,
-		  XmNshadowThickness, IN_FRAME_SHADOW,
-		  NULL);
+                  XmNshadowType, IN_FRAME_TYPE,
+                  XmNshadowThickness, IN_FRAME_SHADOW,
+                  NULL);
     XtVaSetValues(w->PD.scaleFrame[1][i],
-		  XmNchildHorizontalSpacing, TITLE_SPACE,
-		  XmNchildVerticalAlignment, TITLE_ALIGN,
-		  NULL);
+                  XmNchildHorizontalSpacing, TITLE_SPACE,
+                  XmNchildVerticalAlignment, TITLE_ALIGN,
+                  NULL);
   }
 
 
   XtVaSetValues(w->PD.colorDialog,
-		XmNmarginHeight, DIALOG_H,
-		XmNmarginWidth, DIALOG_W,
-		NULL);
+                XmNmarginHeight, DIALOG_H,
+                XmNmarginWidth, DIALOG_W,
+                NULL);
   XtVaSetValues(w->PD.colorFrame[0][0],
-		XmNshadowType, IN_FRAME_TYPE,
-		XmNshadowThickness, IN_FRAME_SHADOW,
-		NULL);
+                XmNshadowType, IN_FRAME_TYPE,
+                XmNshadowThickness, IN_FRAME_SHADOW,
+                NULL);
   XtVaSetValues(w->PD.colorFrame[1][0],
-		XmNchildHorizontalSpacing, TITLE_SPACE,
-		XmNchildVerticalAlignment, TITLE_ALIGN,
-		NULL);
+                XmNchildHorizontalSpacing, TITLE_SPACE,
+                XmNchildVerticalAlignment, TITLE_ALIGN,
+                NULL);
   XtVaSetValues(w->PD.colorDrawingArea,
-		XmNtopAttachment, XmATTACH_FORM,
-		XmNleftAttachment, XmATTACH_FORM,
-		XmNrightAttachment, XmATTACH_FORM,
-		XmNbottomAttachment, XmATTACH_FORM,
-		XmNwidth, 255,
-		XmNheight, 200,
-		NULL);
+                XmNtopAttachment, XmATTACH_FORM,
+                XmNleftAttachment, XmATTACH_FORM,
+                XmNrightAttachment, XmATTACH_FORM,
+                XmNbottomAttachment, XmATTACH_FORM,
+                XmNwidth, 255,
+                XmNheight, 200,
+                NULL);
 
 
   XtVaSetValues(w->PD.vectorDialog,
-		XmNmarginHeight, DIALOG_H,
-		XmNmarginWidth, DIALOG_W,
-		NULL);
+                XmNmarginHeight, DIALOG_H,
+                XmNmarginWidth, DIALOG_W,
+                NULL);
 
   for(i=0 ; i<3 ; i++){
     XtVaSetValues(w->PD.vectorFrame[0][i],
-		  XmNshadowType, IN_FRAME_TYPE,
-		  XmNshadowThickness, IN_FRAME_SHADOW,
-		  NULL);
+                  XmNshadowType, IN_FRAME_TYPE,
+                  XmNshadowThickness, IN_FRAME_SHADOW,
+                  NULL);
     XtVaSetValues(w->PD.vectorFrame[1][i],
-		  XmNchildHorizontalSpacing, TITLE_SPACE,
-		  XmNchildVerticalAlignment, TITLE_ALIGN,
-		  NULL);
+                  XmNchildHorizontalSpacing, TITLE_SPACE,
+                  XmNchildVerticalAlignment, TITLE_ALIGN,
+                  NULL);
   }
 
   XtVaSetValues(w->PD.exportBGMDialog,
-		XmNmarginHeight, DIALOG_H,
-		XmNmarginWidth, DIALOG_W,
-		NULL);
+                XmNmarginHeight, DIALOG_H,
+                XmNmarginWidth, DIALOG_W,
+                NULL);
 
   XtVaSetValues(w->PD.exportBGMFrame[0],
-		XmNshadowType, IN_FRAME_TYPE,
-		XmNshadowThickness, IN_FRAME_SHADOW,
-		NULL);
+                XmNshadowType, IN_FRAME_TYPE,
+                XmNshadowThickness, IN_FRAME_SHADOW,
+                NULL);
 
   XtVaSetValues(w->PD.exportBGMFrame[1],
-		XmNchildHorizontalSpacing, TITLE_SPACE,
-		XmNchildVerticalAlignment, TITLE_ALIGN,
-		NULL);
+                XmNchildHorizontalSpacing, TITLE_SPACE,
+                XmNchildVerticalAlignment, TITLE_ALIGN,
+                NULL);
 
   XtVaSetValues(w->PD.exportBGMText,
-		XmNmarginHeight, 2,
-		NULL);
+                XmNmarginHeight, 2,
+                NULL);
 
 }
 
diff --git a/Unix/Main.cpp b/Unix/Main.cpp
index 45438d7077..94b8201f8a 100644
--- a/Unix/Main.cpp
+++ b/Unix/Main.cpp
@@ -1,4 +1,4 @@
-/* $Id: Main.cpp,v 1.13 2000-11-25 23:10:37 geuzaine Exp $ */
+/* $Id: Main.cpp,v 1.14 2000-11-26 15:43:48 geuzaine Exp $ */
 
 #include <signal.h>
 
@@ -57,7 +57,7 @@ char gmsh_help[]      =
   "  -dl                   enable display lists\n"
   "  -noview               hide all views at startup\n"
   "  -link                 link all views at startup\n"
-  "Display options:\n"	  
+  "Display options:\n"    
   "  -nodb                 disable double buffering\n"
   "  -noov                 disable overlay visual\n"
   "  -alpha                enable alpha blending\n"
@@ -67,9 +67,9 @@ char gmsh_help[]      =
   "  -perspective          set projection mode to perspective\n"
   "  -flash                allow colormap flashing\n"
   "  -samevisual           force same visual for graphics and UI\n"
-  "Other options:\n"	  
+  "Other options:\n"      
   "  -v int                set verbosity level (default: 2)\n"
-  "  -threads              enable threads\n"
+  "  -nothreads            disable threads\n"
   "  -path string          set path for included files\n"
   "  -version              show version number\n"
   "  -info                 show detailed version information\n"
@@ -110,14 +110,14 @@ void ParseFile(char *f){
   else if(!strncmp(String, "$COL", 4)){
     if(List_Nbr(Post_ViewList)){
       v = (Post_View*)List_Pointer(Post_ViewList, List_Nbr(Post_ViewList)-1);
-      load_color_table(yyin, &v->CT);
+      ColorTable_Load(yyin, &v->CT);
     }
     else{
       Msg(WARNING, "No Post-Processing View Available to set Colors From");
     }
   }
   else if(!strncmp(String, "$PostFormat", 11) ||
-	  !strncmp(String, "$View", 5)){
+          !strncmp(String, "$View", 5)){
     Read_View(yyin, yyname);
   }
   else{
@@ -164,9 +164,9 @@ void OpenProblem(char *name){
 
   if(!CTX.interactive)
     XtVaSetValues(WID.G.shell,
-		  XmNtitle, TheFileName,
-		  XmNiconName, TheBaseFileName,
-		  NULL);
+                  XmNtitle, TheFileName,
+                  XmNiconName, TheBaseFileName,
+                  NULL);
 
   Msg(INFOS, "Opening '%s'", TheFileName); 
 
@@ -201,247 +201,304 @@ void Get_Options (int argc, char *argv[], int *nbfiles) {
     if (argv[i][0] == '-') {
       
       if(!strcmp(argv[i]+1, "0")){ 
-	CTX.interactive = -1; i++;
+        CTX.interactive = -1; i++;
       }
       else if(!strcmp(argv[i]+1, "1")){ 
-	CTX.interactive = 1; i++;
+        CTX.interactive = 1; i++;
       }
       else if(!strcmp(argv[i]+1, "2")){ 
-	CTX.interactive = 2; i++;
+        CTX.interactive = 2; i++;
       }
       else if(!strcmp(argv[i]+1, "3")){ 
-	CTX.interactive = 3; i++;
+        CTX.interactive = 3; i++;
       }
       else if(!strcmp(argv[i]+1, "path")){ 
-	i++;
-	/* we need to make a copy because of bison */
-	if(argv[i] != NULL) 
-	  strncpy(ThePathForIncludes, argv[i++], NAME_STR_L) ;
+        i++;
+        /* we need to make a copy because of bison */
+        if(argv[i] != NULL) 
+          strncpy(ThePathForIncludes, argv[i++], NAME_STR_L) ;
+        else {    
+          fprintf(stderr, ERROR_STR "Missing String\n");
+          exit(1);
+        }
       }
       else if(!strcmp(argv[i]+1, "bgm")){ 
-	i++;
-	if(argv[i] != NULL) TheBgmFileName = argv[i++];
+        i++;
+        if(argv[i] != NULL) TheBgmFileName = argv[i++];
+        else {    
+          fprintf(stderr, ERROR_STR "Missing File Name\n");
+          exit(1);
+        }
       }
       else if(!strcmp(argv[i]+1, "alpha")){ 
-	CTX.alpha = 1; i++;
+        CTX.alpha = 1; i++;
       }
       else if(!strcmp(argv[i]+1, "flash")){ 
-	CTX.flash = 1; i++;
+        CTX.flash = 1; i++;
       }
       else if(!strcmp(argv[i]+1, "old")){ 
-	FLAG_OLD_CIRCLE = 1; i++;
+        FLAG_OLD_CIRCLE = 1; i++;
       }
       else if(!strcmp(argv[i]+1, "dual")){ 
-	CTX.mesh.dual = 1; i++;
+        CTX.mesh.dual = 1; i++;
       }
       else if(!strcmp(argv[i]+1, "samevisual")){ 
-	CTX.same_visual = 1; i++;
+        CTX.same_visual = 1; i++;
       }
       else if(!strcmp(argv[i]+1, "interactive")){ 
-	CTX.mesh.interactive = 1; i++;
+        CTX.mesh.interactive = 1; i++;
       }
       else if(!strcmp(argv[i]+1, "scale")){
-	i++;
-	CTX.mesh.scaling_factor = atof(argv[i]); i++;
+        i++;
+        if(argv[i]!=NULL) CTX.mesh.scaling_factor = atof(argv[i++]);
+        else {    
+          fprintf(stderr, ERROR_STR "Missing Number\n");
+          exit(1);
+        }
+      }
+      else if(!strcmp(argv[i]+1, "rand")){
+        i++;
+        if(argv[i]!=NULL) CTX.mesh.rand_factor = atof(argv[i++]);
+        else {    
+          fprintf(stderr, ERROR_STR "Missing Number\n");
+          exit(1);
+        }
       }
       else if(!strcmp(argv[i]+1, "clscale")){
-	i++;
-	CTX.mesh.lc_factor = atof(argv[i]); i++;
-	if(CTX.mesh.lc_factor <= 0.0){
-	  fprintf(stderr, ERROR_STR 
-		  "Characteristic Length Factor Must be > 0\n");
-	  exit(1);
-	}
-      }
-      else if(!strcmp(argv[i]+1, "raw")){ 
-	CTX.mesh.nb_smoothing = 0; i++;
+        i++;
+        if(argv[i]!=NULL){
+          CTX.mesh.lc_factor = atof(argv[i++]);
+          if(CTX.mesh.lc_factor <= 0.0){
+            fprintf(stderr, ERROR_STR 
+                    "Characteristic Length Factor Must be > 0\n");
+            exit(1);
+          }
+        }
+        else {    
+          fprintf(stderr, ERROR_STR "Missing Number\n");
+          exit(1);
+        }
       }
       else if(!strcmp(argv[i]+1, "smooth")){ 
-	i++;
-	CTX.mesh.nb_smoothing = atoi(argv[i]); i++;
+        i++;
+        if(argv[i]!=NULL) CTX.mesh.nb_smoothing = atoi(argv[i++]);
+        else{
+          fprintf(stderr, ERROR_STR "Missing Number\n");
+          exit(1);
+        }
       }
       else if(!strcmp(argv[i]+1, "degree")){  
-	i++;
-	if(argv[i]!=NULL){
-	  CTX.mesh.degree = atoi(argv[i]); i++;
-	  if(CTX.mesh.degree != 1 || CTX.mesh.degree != 2){
-	    fprintf(stderr, ERROR_STR "Wrong Degree\n");
-	    exit(1);
-	  }
-	}
-	else {	  
-	  fprintf(stderr, ERROR_STR "Missing Number\n");
-	  exit(1);
-	}
+        i++;
+        if(argv[i]!=NULL){
+          CTX.mesh.degree = atoi(argv[i++]);
+          if(CTX.mesh.degree != 1 || CTX.mesh.degree != 2){
+            fprintf(stderr, ERROR_STR "Wrong Degree\n");
+            exit(1);
+          }
+        }
+        else {    
+          fprintf(stderr, ERROR_STR "Missing Number\n");
+          exit(1);
+        }
       }
       else if(!strcmp(argv[i]+1, "format") ||  
-	      !strcmp(argv[i]+1, "f")){  
-	i++;
-	if(argv[i]!=NULL){
-	  if(!strcmp(argv[i],"msh") || 
-	     !strcmp(argv[i],"MSH") || 
-	     !strcmp(argv[i],"gmsh")){
-	    CTX.mesh.format = FORMAT_MSH ;
-	  }
-	  else if(!strcmp(argv[i],"unv") ||
-		  !strcmp(argv[i],"UNV") || 
-		  !strcmp(argv[i],"ideas")){
-	    CTX.mesh.format = FORMAT_UNV ;
-	  }
-	  else if(!strcmp(argv[i],"gref") ||
-		  !strcmp(argv[i],"GREF") || 
-		  !strcmp(argv[i],"Gref")){
-	    CTX.mesh.format = FORMAT_GREF ;
-	  }
-	  else{
-	    fprintf(stderr, ERROR_STR "Unknown Mesh Format\n");
-	    exit(1);
-	  }
-	  i++;
-	}
-	else {	  
-	  fprintf(stderr, ERROR_STR "Missing Format\n");
-	  exit(1);
-	}
+              !strcmp(argv[i]+1, "f")){  
+        i++;
+        if(argv[i]!=NULL){
+          if(!strcmp(argv[i],"msh") || 
+             !strcmp(argv[i],"MSH") || 
+             !strcmp(argv[i],"gmsh")){
+            CTX.mesh.format = FORMAT_MSH ;
+          }
+          else if(!strcmp(argv[i],"unv") ||
+                  !strcmp(argv[i],"UNV") || 
+                  !strcmp(argv[i],"ideas")){
+            CTX.mesh.format = FORMAT_UNV ;
+          }
+          else if(!strcmp(argv[i],"gref") ||
+                  !strcmp(argv[i],"GREF") || 
+                  !strcmp(argv[i],"Gref")){
+            CTX.mesh.format = FORMAT_GREF ;
+          }
+          else{
+            fprintf(stderr, ERROR_STR "Unknown Mesh Format\n");
+            exit(1);
+          }
+          i++;
+        }
+        else {    
+          fprintf(stderr, ERROR_STR "Missing Format\n");
+          exit(1);
+        }
       }
       else if(!strcmp(argv[i]+1, "algo")){  
-	i++;
-	if(argv[i]!=NULL){
-	  if(!strcmp(argv[i],"iso"))
-	    CTX.mesh.algo = DELAUNAY_OLDALGO ;
-	  else if(!strcmp(argv[i],"aniso"))
-	    CTX.mesh.algo = DELAUNAY_NEWALGO ;
-	  else{
-	    fprintf(stderr, ERROR_STR "Unknown Mesh Algorithm\n");
-	    exit(1);
-	  }
-	  i++;
-	}
-	else {	  
-	  fprintf(stderr, ERROR_STR "Missing Algorithm\n");
-	  exit(1);
-	}
+        i++;
+        if(argv[i]!=NULL){
+          if(!strcmp(argv[i],"iso"))
+            CTX.mesh.algo = DELAUNAY_OLDALGO ;
+          else if(!strcmp(argv[i],"aniso"))
+            CTX.mesh.algo = DELAUNAY_NEWALGO ;
+          else{
+            fprintf(stderr, ERROR_STR "Unknown Mesh Algorithm\n");
+            exit(1);
+          }
+          i++;
+        }
+        else {    
+          fprintf(stderr, ERROR_STR "Missing Algorithm\n");
+          exit(1);
+        }
       }
       else if(!strcmp(argv[i]+1, "noview")){ 
-	CTX.post.initial_visibility = 0 ; i++;
+        CTX.post.initial_visibility = 0 ; i++;
       }
       else if(!strcmp(argv[i]+1, "link")){ 
-	CTX.post.link = 2 ; i++;
+        CTX.post.link = 2 ; i++;
       }
       else if(!strcmp(argv[i]+1, "fill")){ 
-	CTX.post.initial_intervals = DRAW_POST_DISCRETE ; i++;
+        CTX.post.initial_intervals = DRAW_POST_DISCRETE ; i++;
       }
       else if(!strcmp(argv[i]+1, "nbiso")){ 
-	i++ ;
-	CTX.post.initial_nbiso = atoi(argv[i]) ; i++ ;
+        i++ ;
+        if(argv[i]!=NULL) CTX.post.initial_nbiso = atoi(argv[i++]);
+        else{
+          fprintf(stderr, ERROR_STR "Missing Number\n");
+          exit(1);
+        }
       }
       else if(!strcmp(argv[i]+1, "command") || 
-	      !strcmp(argv[i]+1, "c")){ 
-	CTX.command_win = 1; i++;
+              !strcmp(argv[i]+1, "c")){ 
+        CTX.command_win = 1; i++;
       }
       else if(!strcmp(argv[i]+1, "nocommand") ||
-	      !strcmp(argv[i]+1, "noc")){ 
-	CTX.command_win = 0; i++;
+              !strcmp(argv[i]+1, "noc")){ 
+        CTX.command_win = 0; i++;
       }
       else if(!strcmp(argv[i]+1, "overlay") ||
-	      !strcmp(argv[i]+1, "ov")){ 
-	CTX.overlay = 1; i++;
+              !strcmp(argv[i]+1, "ov")){ 
+        CTX.overlay = 1; i++;
       }
       else if(!strcmp(argv[i]+1, "nooverlay") ||
-	      !strcmp(argv[i]+1, "noov")){ 
-	CTX.overlay = CTX.geom.highlight = 0; i++;
+              !strcmp(argv[i]+1, "noov")){ 
+        CTX.overlay = CTX.geom.highlight = 0; i++;
       }
       else if(!strcmp(argv[i]+1, "perspective") ||
-	      !strcmp(argv[i]+1, "p")){ 
-	CTX.ortho = 0; i++;
+              !strcmp(argv[i]+1, "p")){ 
+        CTX.ortho = 0; i++;
       }
       else if(!strcmp(argv[i]+1, "ortho") ||
-	      !strcmp(argv[i]+1, "o")){ 
-	CTX.ortho = 0; i++;
+              !strcmp(argv[i]+1, "o")){ 
+        CTX.ortho = 0; i++;
       }
       else if(!strcmp(argv[i]+1, "threads")){
-	CTX.threads = 1; i++;
+        CTX.threads = 1; i++;
       }
       else if(!strcmp(argv[i]+1, "nothreads")){
-	CTX.threads = 0; i++;
+        CTX.threads = 0; i++;
       }
       else if(!strcmp(argv[i]+1, "viewport")){ 
-	i++ ;
-	CTX.r[0] = atof(argv[i]) ; i++ ;
-	CTX.r[1] = atof(argv[i]) ; i++ ;
-	CTX.r[2] = atof(argv[i]) ; i++ ;
-	CTX.t[0] = atof(argv[i]) ; i++ ;
-	CTX.t[1] = atof(argv[i]) ; i++ ;
-	CTX.t[2] = atof(argv[i]) ; i++ ;
-	CTX.s[0] = atof(argv[i]) ; i++ ;
-	CTX.s[1] = atof(argv[i]) ; i++ ;
-	CTX.s[2] = atof(argv[i]) ; i++ ;
+        i++ ;
+        if(argv[i]!=NULL){
+          CTX.r[0] = atof(argv[i]) ; i++ ;
+        }
+        if(argv[i]!=NULL){
+          CTX.r[1] = atof(argv[i]) ; i++ ;
+        }
+        if(argv[i]!=NULL){
+          CTX.r[2] = atof(argv[i]) ; i++ ;
+        }
+        if(argv[i]!=NULL){
+          CTX.t[0] = atof(argv[i]) ; i++ ;
+        }
+        if(argv[i]!=NULL){
+          CTX.t[1] = atof(argv[i]) ; i++ ;
+        }
+        if(argv[i]!=NULL){
+          CTX.t[2] = atof(argv[i]) ; i++ ;
+        }
+        if(argv[i]!=NULL){
+          CTX.s[0] = atof(argv[i]) ; i++ ;
+        }
+        if(argv[i]!=NULL){
+          CTX.s[1] = atof(argv[i]) ; i++ ;
+        }
+        if(argv[i]!=NULL){
+          CTX.s[2] = atof(argv[i]) ; i++ ;
+        }
+        else{
+          fprintf(stderr, ERROR_STR "Missing Number\n");
+          exit(1);
+        }
       }
       else if(!strcmp(argv[i]+1, "db")){ 
-	CTX.db = 1; i++;
+        CTX.db = 1; i++;
       }
       else if(!strcmp(argv[i]+1, "nodb")){ 
-	CTX.db = 0; CTX.geom.highlight = 0; i++;
+        CTX.db = 0; CTX.geom.highlight = 0; i++;
       }
       else if(!strcmp(argv[i]+1, "dl")){ 
-	CTX.display_lists = 1; i++;
+        CTX.display_lists = 1; i++;
       }
       else if(!strcmp(argv[i]+1, "nodl")){ 
-	CTX.display_lists = 0; i++;
+        CTX.display_lists = 0; i++;
       }
       else if(!strcmp(argv[i]+1, "geometry") ||
-	      !strcmp(argv[i]+1, "iconic")   ||
-	      !strcmp(argv[i]+1, "display")  ||
-	      !strcmp(argv[i]+1, "fg")       ||
-	      !strcmp(argv[i]+1, "bg")){
-	i+=2;
+              !strcmp(argv[i]+1, "iconic")   ||
+              !strcmp(argv[i]+1, "display")  ||
+              !strcmp(argv[i]+1, "fg")       ||
+              !strcmp(argv[i]+1, "bg")){
+        i++;
+        if(argv[i]!=NULL)
+          i++;
+        else {    
+          fprintf(stderr, ERROR_STR "Missing Argument\n");
+          exit(1);
+        }
       }
       else if(!strcmp(argv[i]+1, "v")){  
-	i++;
-	if(argv[i]!=NULL){
-	  CTX.verbosity = atoi(argv[i]); i++;
-	}
-	else {	  
-	  fprintf(stderr, ERROR_STR "Missing Number\n");
-	  exit(1);
-	}
+        i++;
+        if(argv[i]!=NULL) CTX.verbosity = atoi(argv[i++]);
+        else {    
+          fprintf(stderr, ERROR_STR "Missing Number\n");
+          exit(1);
+        }
       }
       else if(!strcmp(argv[i]+1, "version") || 
-	      !strcmp(argv[i]+1, "-version")){
-	fprintf(stderr, "%g\n", GMSH_VERSION);
-	exit(1);
+              !strcmp(argv[i]+1, "-version")){
+        fprintf(stderr, "%g\n", GMSH_VERSION);
+        exit(1);
       }
       else if(!strcmp(argv[i]+1, "info") || 
-	      !strcmp(argv[i]+1, "-info")){
-	fprintf(stderr, "%s%g\n", gmsh_version, GMSH_VERSION);
-	fprintf(stderr, "%s\n", gmsh_os);
-	fprintf(stderr, "%s\n", gmsh_date);
-	fprintf(stderr, "%s\n", gmsh_host);
-	fprintf(stderr, "%s\n", gmsh_packager);
-	fprintf(stderr, "%s\n", gmsh_email);
-	fprintf(stderr, "%s\n", gmsh_url);
-	exit(1) ; 
+              !strcmp(argv[i]+1, "-info")){
+        fprintf(stderr, "%s%g\n", gmsh_version, GMSH_VERSION);
+        fprintf(stderr, "%s\n", gmsh_os);
+        fprintf(stderr, "%s\n", gmsh_date);
+        fprintf(stderr, "%s\n", gmsh_host);
+        fprintf(stderr, "%s\n", gmsh_packager);
+        fprintf(stderr, "%s\n", gmsh_email);
+        fprintf(stderr, "%s\n", gmsh_url);
+        exit(1) ; 
       }
       else if(!strcmp(argv[i]+1, "help") || 
-	      !strcmp(argv[i]+1, "-help")){
-	fprintf(stderr, "%s\n", gmsh_progname);
-	fprintf(stderr, "%s\n", gmsh_copyright);
-	fprintf(stderr, gmsh_help, argv[0]);
-	exit(1);
+              !strcmp(argv[i]+1, "-help")){
+        fprintf(stderr, "%s\n", gmsh_progname);
+        fprintf(stderr, "%s\n", gmsh_copyright);
+        fprintf(stderr, gmsh_help, argv[0]);
+        exit(1);
       }
       else{
-	fprintf(stderr, "Unknown Option '%s'\n", argv[i]);
-	fprintf(stderr, gmsh_help, argv[0]);
-	exit(1);
+        fprintf(stderr, "Unknown Option '%s'\n", argv[i]);
+        fprintf(stderr, gmsh_help, argv[0]);
+        exit(1);
       }
     }
 
     else {
       if(*nbfiles < MAX_OPEN_FILES)
-	TheFileNameTab[(*nbfiles)++] = argv[i++]; 
+        TheFileNameTab[(*nbfiles)++] = argv[i++]; 
       else{
-	fprintf(stderr, ERROR_STR "Too Many Input Files\n");
-	exit(1);
+        fprintf(stderr, ERROR_STR "Too Many Input Files\n");
+        exit(1);
       }
     }
 
@@ -509,25 +566,21 @@ int main(int argc, char *argv[]){
       exit(1);
     else{
       if(nbf > 1){
-	for(i=1;i<nbf;i++) MergeProblem(TheFileNameTab[i]);
+        for(i=1;i<nbf;i++) MergeProblem(TheFileNameTab[i]);
       }
       if(TheBgmFileName){
-	MergeProblem(TheBgmFileName);
-	if(List_Nbr(Post_ViewList)){
-	  BGMWithView((Post_View*)List_Pointer(Post_ViewList, List_Nbr(Post_ViewList)-1));
-	  TYPBGMESH = ONFILE; 
-	  Create_BgMesh(TYPBGMESH,.2,THEM);
-	}
-	else{
-	  Msg(ERROR, "Invalid Background Mesh (no View)");
-	}
+        MergeProblem(TheBgmFileName);
+        if(List_Nbr(Post_ViewList))
+          BGMWithView((Post_View*)List_Pointer(Post_ViewList, List_Nbr(Post_ViewList)-1));
+        else
+          Msg(ERROR, "Invalid Background Mesh (no View)");
       }
       if(CTX.interactive > 0){
-	mai3d(THEM, CTX.interactive);
-	Print_Mesh(THEM,NULL,CTX.mesh.format);
+        mai3d(THEM, CTX.interactive);
+        Print_Mesh(THEM,NULL,CTX.mesh.format);
       }
       else{
-	Print_Geo(THEM, NULL);
+        Print_Geo(THEM, NULL);
       }
       exit(1);
     }    
@@ -541,14 +594,14 @@ int main(int argc, char *argv[]){
   /* Text for about window */
 
   sprintf(TextAbout, "%s\n \n%s%g\n%s\n%s\n%s\n%s\n%s\n%s\n \n%s\n \n"
-	  "Type 'gmsh -help' for command line options",
-	  gmsh_progname, gmsh_version, GMSH_VERSION, 
-	  gmsh_os, gmsh_date, gmsh_host, gmsh_packager, 
-	  gmsh_email, gmsh_url, gmsh_copyright);
+          "Type 'gmsh -help' for command line options",
+          gmsh_progname, gmsh_version, GMSH_VERSION, 
+          gmsh_os, gmsh_date, gmsh_host, gmsh_packager, 
+          gmsh_email, gmsh_url, gmsh_copyright);
   
   /* Xlib Threads init */
   
-#ifndef _NOTHREADS  
+#ifdef _USETHREADS  
   if(CTX.threads){
     if(!XInitThreads()){
       Msg(WARNING, "Xlib is not Thread Safe (Reverting to '-nothreads')");
@@ -563,7 +616,7 @@ int main(int argc, char *argv[]){
   
   XtToolkitInitialize();
   
-#ifndef _NOTHREADS  
+#ifdef _USETHREADS  
   if(CTX.threads){
     if(!XtToolkitThreadInitialize()){
       Msg(WARNING, "Xtoolkit is not Thread Safe (Reverting to '-nothreads')");
@@ -581,18 +634,18 @@ int main(int argc, char *argv[]){
   /* Open display */
 
   XCTX.display = XtOpenDisplay(XCTX.AppContext, NULL, "gmshGW", ".gmshrc", 
-			       NULL, 0, &argc, argv);
+                               NULL, 0, &argc, argv);
 
   if(!XCTX.display)
     Msg(FATAL, "Unable to open the specified display. Set the `DISPLAY'\n"
-   	FATAL_NIL "environment variable properly or use the `xhost' command\n"
-	FATAL_NIL "to authorize access to the display");
+        FATAL_NIL "environment variable properly or use the `xhost' command\n"
+        FATAL_NIL "to authorize access to the display");
 
   /* Check for GLX extension; for Mesa, this is always OK */
   
   if(!glXQueryExtension(XCTX.display,NULL,NULL))
     Msg(FATAL, "The specified display does not support the OpenGL extension (GLX).\n"
-	FATAL_NIL "You may consider using Mesa instead");
+        FATAL_NIL "You may consider using Mesa instead");
   
   /* Init with default screen num and default depth */
   
@@ -607,7 +660,7 @@ int main(int argc, char *argv[]){
   
   if(CTX.db){
     if(!(XCTX.glw.visinfo = 
-	 glXChooseVisual(XCTX.display,XCTX.scrnum, glw_attrib_db))){
+         glXChooseVisual(XCTX.display,XCTX.scrnum, glw_attrib_db))){
       Msg(WARNING,"GBA Double Buffured Visual not Available");
       CTX.db = 0;
     }
@@ -615,7 +668,7 @@ int main(int argc, char *argv[]){
   
   if(!CTX.db){
     if(!(XCTX.glw.visinfo = 
-	 glXChooseVisual(XCTX.display,XCTX.scrnum, glw_attrib_sb)))
+         glXChooseVisual(XCTX.display,XCTX.scrnum, glw_attrib_sb)))
       Msg(FATAL, "RGBA Single Buffured Visual not Available");
   }
   
@@ -646,14 +699,14 @@ int main(int argc, char *argv[]){
 
   if(CTX.overlay){
     Msg(DEBUG,"Overlay Visual id=%lx depth=%d screen=%d bits/rgb=%d class=%s",
-	XCTX.glo.visinfo->visualid, XCTX.glo.visinfo->depth, 
-	XCTX.glo.visinfo->screen, XCTX.glo.visinfo->bits_per_rgb, 
+        XCTX.glo.visinfo->visualid, XCTX.glo.visinfo->depth, 
+        XCTX.glo.visinfo->screen, XCTX.glo.visinfo->bits_per_rgb, 
 #if defined(__cplusplus) || defined(c_plusplus)
-	ShowVisualClass(XCTX.glo.visinfo->c_class)
+        ShowVisualClass(XCTX.glo.visinfo->c_class)
 #else
-	ShowVisualClass(XCTX.glo.visinfo->class)
+        ShowVisualClass(XCTX.glo.visinfo->class)
 #endif
-	);
+        );
   }
 
 
@@ -674,7 +727,7 @@ int main(int argc, char *argv[]){
   if(!CTX.flash && (XCTX.glw.visinfo->visual != XCTX.gui.visual)){
     Msg(DEBUG, "Making Another Colormap for Graphic Window");
     XCTX.glw.colormap = XCreateColormap(XCTX.display, RootWindow(XCTX.display,XCTX.scrnum),
-					XCTX.glw.visinfo->visual, AllocNone);
+                                        XCTX.glw.visinfo->visual, AllocNone);
     if(!XCTX.glw.colormap)
       Msg(FATAL, "Unable to Create Colormap for Graphic Window (Try Option '-flash')");
   }
@@ -683,10 +736,10 @@ int main(int argc, char *argv[]){
     if(!CTX.flash && (XCTX.glo.visinfo->visual != XCTX.gui.visual)){
       Msg(DEBUG, "Making Another Colormap for Overlay Window");
       XCTX.glo.colormap = XCreateColormap(XCTX.display, RootWindow(XCTX.display,XCTX.scrnum),
-					  XCTX.glo.visinfo->visual, AllocNone);
+                                          XCTX.glo.visinfo->visual, AllocNone);
       if(!XCTX.glo.colormap)
-	Msg(FATAL, "Unable to Create Private Colormap for Overlay Window\n"
-	    FATAL_NIL "(Try '-noov' and/or '-flash' Options)");
+        Msg(FATAL, "Unable to Create Private Colormap for Overlay Window\n"
+            FATAL_NIL "(Try '-noov' and/or '-flash' Options)");
     }
   }
   
@@ -710,10 +763,10 @@ int main(int argc, char *argv[]){
 
   if(CTX.overlay){
     XCTX.glo.context = glXCreateContext(XtDisplay(WID.G.glo),
-					XCTX.glo.visinfo,NULL,GL_TRUE);  
+                                        XCTX.glo.visinfo,NULL,GL_TRUE);  
 
     if (!XAllocNamedColor(XCTX.display, XCTX.glo.colormap, 
-			  "white", &ov_color_def, &ov_color_exact)) {
+                          "white", &ov_color_def, &ov_color_exact)) {
       Msg(WARNING, "Couldn't Allocate White for Overlay window (Reverting to '-noov')");
       CTX.overlay = 0;
     }
@@ -723,7 +776,7 @@ int main(int argc, char *argv[]){
 
   if(CTX.overlay){
     if (!XAllocNamedColor(XCTX.display, XCTX.glo.colormap, 
-			  "black", &ov_color_def, &ov_color_exact)) {
+                          "black", &ov_color_def, &ov_color_exact)) {
       Msg(WARNING, "Couldn't Allocate Black for Overlay Window (Reverting to '-noov')");
       CTX.overlay = 0;
     }
@@ -790,9 +843,9 @@ int main(int argc, char *argv[]){
     Msg(FATAL, "Font out of OpenGL Display Lists");
 
   glXUseXFont(XCTX.xfont.helve->fid, 
-	      XCTX.xfont.helve->min_char_or_byte2, 
-	      XCTX.xfont.helve->max_char_or_byte2-XCTX.xfont.helve->min_char_or_byte2+1, 
-	      CTX.font_base+XCTX.xfont.helve->min_char_or_byte2);
+              XCTX.xfont.helve->min_char_or_byte2, 
+              XCTX.xfont.helve->max_char_or_byte2-XCTX.xfont.helve->min_char_or_byte2+1, 
+              CTX.font_base+XCTX.xfont.helve->min_char_or_byte2);
 
   /* The GUI is ready */
   CTX.interactive = 0 ; 
@@ -821,11 +874,8 @@ int main(int argc, char *argv[]){
 
   if(TheBgmFileName){
     MergeProblem(TheBgmFileName);
-    if(List_Nbr(Post_ViewList)){
+    if(List_Nbr(Post_ViewList))
       BGMWithView((Post_View*)List_Pointer(Post_ViewList, List_Nbr(Post_ViewList)-1));
-      TYPBGMESH = ONFILE; 
-      Create_BgMesh(TYPBGMESH,.2,THEM);
-    }
     else
       Msg(ERROR, "Invalid Background Mesh (no View)");
   }
diff --git a/Unix/Message.cpp b/Unix/Message.cpp
index 0333872ac2..2a2384822a 100644
--- a/Unix/Message.cpp
+++ b/Unix/Message.cpp
@@ -1,4 +1,4 @@
-/* $Id: Message.cpp,v 1.5 2000-11-23 23:20:35 geuzaine Exp $ */
+/* $Id: Message.cpp,v 1.6 2000-11-26 15:43:48 geuzaine Exp $ */
 
 #include <signal.h>
 #include <sys/resource.h>
@@ -21,10 +21,10 @@ void Signal (int sig_num){
   switch (sig_num){
   case SIGSEGV : 
     Msg(FATAL, "Segmentation Violation (Invalid Memory Reference)\n"
-	"------------------------------------------------------\n"
-	"You have discovered a bug in Gmsh. You may e-mail the\n"
-	"context in which it occurred to one of the authors:\n"
-	"type 'gmsh -info' to get feedback information"); 
+        "------------------------------------------------------\n"
+        "You have discovered a bug in Gmsh. You may e-mail the\n"
+        "context in which it occurred to one of the authors:\n"
+        "type 'gmsh -info' to get feedback information"); 
     break;
   case SIGFPE : 
     Msg(FATAL, "Floating Point Exception (Division by Zero?)"); 
@@ -45,13 +45,13 @@ void Signal (int sig_num){
 
 char *TextBuffer;
 
-#define PUT_IN_COMMAND_WIN						\
-  vsprintf(TextBuffer, fmt, args);					\
-  XmListAddItem(WID.C.commandList,XmStringCreateSimple(TextBuffer),0);	\
-  XtSetArg(arg[0], XmNitemCount, &nb);					\
-  XtSetArg(arg[1], XmNvisibleItemCount, &nbvis);			\
-  XtGetValues(WID.C.commandList, arg, 2);				\
-  XmListSetPos(WID.C.commandList,(nb>nbvis)?nb-nbvis+1:0);		\
+#define PUT_IN_COMMAND_WIN                                              \
+  vsprintf(TextBuffer, fmt, args);                                      \
+  XmListAddItem(WID.C.commandList,XmStringCreateSimple(TextBuffer),0);  \
+  XtSetArg(arg[0], XmNitemCount, &nb);                                  \
+  XtSetArg(arg[1], XmNvisibleItemCount, &nbvis);                        \
+  XtGetValues(WID.C.commandList, arg, 2);                               \
+  XmListSetPos(WID.C.commandList,(nb>nbvis)?nb-nbvis+1:0);              \
   XmUpdateDisplay(WID.C.commandList);
 
 void Msg(int level, char *fmt, ...){
@@ -86,9 +86,9 @@ void Msg(int level, char *fmt, ...){
   case WARNING :
     if(CTX.interactive || !CTX.command_win){
       if(CTX.verbosity > 0){
-	fprintf(stderr, WARNING_STR);
-	vfprintf(stderr, fmt, args); 
-	fprintf(stderr, "\n");
+        fprintf(stderr, WARNING_STR);
+        vfprintf(stderr, fmt, args); 
+        fprintf(stderr, "\n");
       }
     }
     else{
@@ -98,9 +98,9 @@ void Msg(int level, char *fmt, ...){
   case INFOS :
     if(CTX.interactive || !CTX.command_win){
       if(CTX.verbosity > 1){
-	fprintf(stderr, INFOS_STR);
-	vfprintf(stderr, fmt, args); 
-	fprintf(stderr, "\n");
+        fprintf(stderr, INFOS_STR);
+        vfprintf(stderr, fmt, args); 
+        fprintf(stderr, "\n");
       }
     }
     else{
@@ -110,54 +110,54 @@ void Msg(int level, char *fmt, ...){
   case INFO :
     if(CTX.interactive){
       if(CTX.verbosity > 1){
-	fprintf(stderr, INFO_STR);
-	vfprintf(stderr, fmt, args);
-	fprintf(stderr, "\n");
+        fprintf(stderr, INFO_STR);
+        vfprintf(stderr, fmt, args);
+        fprintf(stderr, "\n");
       }
     }
     else{
       vsprintf(TextBuffer, fmt, args);
       XtVaSetValues(WID.G.infoLabel, XmNlabelString,
-		    XmStringCreateSimple(TextBuffer), NULL);
+                    XmStringCreateSimple(TextBuffer), NULL);
       XmUpdateDisplay(WID.G.infoLabel);
     }
     break;
   case SELECT :
     if(CTX.interactive){
       if(CTX.verbosity > 1){
-	fprintf(stderr, SELECT_STR);
-	vfprintf(stderr, fmt, args); 
-	fprintf(stderr, "\n");
+        fprintf(stderr, SELECT_STR);
+        vfprintf(stderr, fmt, args); 
+        fprintf(stderr, "\n");
       }
     }
     else{
       vsprintf(TextBuffer, fmt, args);
       XtVaSetValues(WID.G.selectLabel, XmNlabelString, 
-		    XmStringCreateSimple(TextBuffer), NULL);
+                    XmStringCreateSimple(TextBuffer), NULL);
       XmUpdateDisplay(WID.G.selectLabel);
     }
     break;
   case STATUS :
     if(CTX.interactive){
       if(CTX.verbosity > 1){
-	fprintf(stderr, STATUS_STR);
-	vfprintf(stderr, fmt, args);
-	fprintf(stderr, "\n");
+        fprintf(stderr, STATUS_STR);
+        vfprintf(stderr, fmt, args);
+        fprintf(stderr, "\n");
       }
     }
     else{
       vsprintf(TextBuffer, fmt, args);
       XtVaSetValues(WID.G.statusLabel, XmNlabelString,
-		    XmStringCreateSimple(TextBuffer), NULL);
+                    XmStringCreateSimple(TextBuffer), NULL);
       XmUpdateDisplay(WID.G.statusLabel);
     }
     break;
   case PARSER_ERROR :
     if(CTX.interactive || !CTX.command_win){
       if(CTX.verbosity > 0){
-	fprintf(stderr, PARSER_ERROR_STR);
-	vfprintf(stderr, fmt, args); 
-	fprintf(stderr, "\n");
+        fprintf(stderr, PARSER_ERROR_STR);
+        vfprintf(stderr, fmt, args); 
+        fprintf(stderr, "\n");
       }
     }
     else{
@@ -167,9 +167,9 @@ void Msg(int level, char *fmt, ...){
   case PARSER_INFO :
     if(CTX.interactive || !CTX.command_win){
       if(CTX.verbosity > 1){
-	fprintf(stderr, PARSER_INFO_STR);
-	vfprintf(stderr, fmt, args); 
-	fprintf(stderr, "\n");
+        fprintf(stderr, PARSER_INFO_STR);
+        vfprintf(stderr, fmt, args); 
+        fprintf(stderr, "\n");
       }
     }
     else{
@@ -179,9 +179,9 @@ void Msg(int level, char *fmt, ...){
   case DEBUG :
     if(CTX.interactive || !CTX.command_win){
       if(CTX.verbosity > 2){
-	fprintf(stderr, DEBUG_STR);
-	vfprintf(stderr, fmt, args); 
-	fprintf(stderr, "\n");
+        fprintf(stderr, DEBUG_STR);
+        vfprintf(stderr, fmt, args); 
+        fprintf(stderr, "\n");
       }
     }
     else{
diff --git a/Unix/Pixmaps.cpp b/Unix/Pixmaps.cpp
index 7e395cf6f3..9fb4844322 100644
--- a/Unix/Pixmaps.cpp
+++ b/Unix/Pixmaps.cpp
@@ -1,4 +1,4 @@
-/* $Id: Pixmaps.cpp,v 1.2 2000-11-23 14:11:41 geuzaine Exp $ */
+/* $Id: Pixmaps.cpp,v 1.3 2000-11-26 15:43:48 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -83,45 +83,45 @@ void CreatePixmaps(Widgets_T *w, Pixmaps_T *p, int depth){
   /* Icons for 3 main windows */
 
   XtVaSetValues(w->M.shell, 
-		XmNiconPixmap, 
-		XCreateBitmapFromData(XtDisplay(w->M.shell),XtScreen(w->M.shell)->root,
-				      (char*)g1_bits, g1_width, g1_height), 
-		NULL);
+                XmNiconPixmap, 
+                XCreateBitmapFromData(XtDisplay(w->M.shell),XtScreen(w->M.shell)->root,
+                                      (char*)g1_bits, g1_width, g1_height), 
+                NULL);
 
 
   XtVaSetValues(w->G.shell, 
-		XmNiconPixmap, 
-		XCreateBitmapFromData(XtDisplay(w->G.shell), XtScreen(w->G.shell)->root,
-				      (char*)g2_bits, g2_width, g2_height),
-		NULL);
+                XmNiconPixmap, 
+                XCreateBitmapFromData(XtDisplay(w->G.shell), XtScreen(w->G.shell)->root,
+                                      (char*)g2_bits, g2_width, g2_height),
+                NULL);
 
   if(CTX.command_win)
     XtVaSetValues(w->C.shell, 
-		  XmNiconPixmap, 
-		  XCreateBitmapFromData(XtDisplay(w->C.shell), XtScreen(w->C.shell)->root,
-					(char*)g3_bits, g3_width, g3_height),
-		  NULL);
+                  XmNiconPixmap, 
+                  XCreateBitmapFromData(XtDisplay(w->C.shell), XtScreen(w->C.shell)->root,
+                                        (char*)g3_bits, g3_width, g3_height),
+                  NULL);
 
   /* Graphic window */
 
   p->G.abort = bm_to_px(w->G.Butt[6], abort_bits, 
-			abort_width, abort_height, depth, BM_PX_RED);
+                        abort_width, abort_height, depth, BM_PX_RED);
   XtVaSetValues(w->G.Butt[6], XmNlabelPixmap, p->G.abort, NULL);
 
   p->G.abort_insens = bm_to_px(w->G.Butt[6], abort_bits, 
-			       abort_width, abort_height, depth, BM_PX_NORMAL);
+                               abort_width, abort_height, depth, BM_PX_NORMAL);
   XtVaSetValues(w->G.Butt[6], XmNlabelInsensitivePixmap, p->G.abort_insens, NULL);
 
   p->G.start = bm_to_px(w->G.Butt[5], start_bits, 
-			start_width, start_height, depth, BM_PX_NORMAL);
+                        start_width, start_height, depth, BM_PX_NORMAL);
   p->G.stop = bm_to_px(w->G.Butt[5], stop_bits, 
-		       stop_width, stop_height, depth, BM_PX_NORMAL);
+                       stop_width, stop_height, depth, BM_PX_NORMAL);
   Set_AnimPixmap(w, p, 1);
 
   /* About window  */
 
   p->HD.about = bm_to_px(w->HD.aboutDialog, about_bits, 
-			 about_width, about_height, depth, BM_PX_NORMAL);
+                         about_width, about_height, depth, BM_PX_NORMAL);
   XtVaSetValues(w->HD.aboutDialog, XmNsymbolPixmap, p->HD.about, NULL);
 
 
diff --git a/Unix/Register.cpp b/Unix/Register.cpp
index 9ebf11a058..466cab389a 100644
--- a/Unix/Register.cpp
+++ b/Unix/Register.cpp
@@ -1,4 +1,4 @@
-/* $Id: Register.cpp,v 1.8 2000-11-25 23:10:37 geuzaine Exp $ */
+/* $Id: Register.cpp,v 1.9 2000-11-26 15:43:48 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -47,7 +47,7 @@ void RegisterCallbacks_M(Widgets_T *w){
   register_activate_cb (w->M.geomButt,      ActualizeContextCb, CONTEXT_GEOM);
   register_activate_cb (w->M.meshButt,      ActualizeContextCb, CONTEXT_MESH);
   register_activate_cb (w->M.postButt,      ActualizeContextCb, CONTEXT_POST);
-								
+                                                                
   register_activate_cb (w->M.navigButt[0],  PreviousContextCb,  CONTEXT_BACKWARD);
   register_activate_cb (w->M.navigButt[1],  PreviousContextCb,  CONTEXT_FORWARD);
 
diff --git a/Unix/Register.h b/Unix/Register.h
index f49cc97972..1803ac7729 100644
--- a/Unix/Register.h
+++ b/Unix/Register.h
@@ -1,4 +1,4 @@
-/* $Id: Register.h,v 1.4 2000-11-25 23:10:37 geuzaine Exp $ */
+/* $Id: Register.h,v 1.5 2000-11-26 15:43:48 geuzaine Exp $ */
 #ifndef _REGISTER_H_
 #define _REGISTER_H_
 
@@ -47,97 +47,97 @@ void PopupHandler       (Widget w, Widget pw, XEvent *event, Boolean *ctd);
 
 /* special GL callback registering */
 
-#define register_GLexpose_cb(w, func, arg)			\
-        XtAddCallback((w), GLwNexposeCallback,			\
-                (XtCallbackProc) (func),			\
+#define register_GLexpose_cb(w, func, arg)                      \
+        XtAddCallback((w), GLwNexposeCallback,                  \
+                (XtCallbackProc) (func),                        \
                 (XtPointer) (arg))                      
                                                         
-#define register_GLresize_cb(w, func, arg)			\
-        XtAddCallback((w), GLwNresizeCallback,			\
-                (XtCallbackProc) (func),			\
+#define register_GLresize_cb(w, func, arg)                      \
+        XtAddCallback((w), GLwNresizeCallback,                  \
+                (XtCallbackProc) (func),                        \
                 (XtPointer) (arg))                      
 
-#define register_GLinput_cb(w, func, arg)			\
-        XtAddCallback((w), GLwNinputCallback,			\
-                (XtCallbackProc) (func),			\
+#define register_GLinput_cb(w, func, arg)                       \
+        XtAddCallback((w), GLwNinputCallback,                   \
+                (XtCallbackProc) (func),                        \
                 (XtPointer) (arg))                      
                                                         
-#define register_GLinit_cb(w, func, arg)			\
-        XtAddCallback((w), GLwNginitCallback,			\
-                (XtCallbackProc) (func),			\
+#define register_GLinit_cb(w, func, arg)                        \
+        XtAddCallback((w), GLwNginitCallback,                   \
+                (XtCallbackProc) (func),                        \
                 (XtPointer) (arg))                      
                                                         
 /* classic motif callback registering */
                                                         
-#define register_help_cb(w, func, arg)	            		\
-        XtAddCallback((w), XmNhelpCallback,			\
-                (XtCallbackProc) (func),			\
+#define register_help_cb(w, func, arg)                          \
+        XtAddCallback((w), XmNhelpCallback,                     \
+                (XtCallbackProc) (func),                        \
                 (XtPointer) (arg))                      
 
-#define register_expose_cb(w, func, arg)			\
-        XtAddCallback((w), XmNexposeCallback,			\
-                (XtCallbackProc) (func),			\
+#define register_expose_cb(w, func, arg)                        \
+        XtAddCallback((w), XmNexposeCallback,                   \
+                (XtCallbackProc) (func),                        \
                 (XtPointer) (arg))                      
                                                         
-#define register_resize_cb(w, func, arg)			\
-        XtAddCallback((w), XmNresizeCallback,			\
-                (XtCallbackProc) (func),			\
+#define register_resize_cb(w, func, arg)                        \
+        XtAddCallback((w), XmNresizeCallback,                   \
+                (XtCallbackProc) (func),                        \
                 (XtPointer) (arg))                      
 
-#define register_input_cb(w, func, arg)				\
-        XtAddCallback((w), XmNinputCallback,			\
-                (XtCallbackProc) (func),			\
+#define register_input_cb(w, func, arg)                         \
+        XtAddCallback((w), XmNinputCallback,                    \
+                (XtCallbackProc) (func),                        \
                 (XtPointer) (arg))                      
                                                         
-#define register_activate_cb(w, func, arg)			\
-        XtAddCallback((w), XmNactivateCallback,			\
-                (XtCallbackProc) (func),			\
+#define register_activate_cb(w, func, arg)                      \
+        XtAddCallback((w), XmNactivateCallback,                 \
+                (XtCallbackProc) (func),                        \
                 (XtPointer) (arg))                      
 
-#define register_remove_cb(w, func, arg)			\
-        XtRemoveCallback((w), XmNactivateCallback,	        \
-                (XtCallbackProc) (func),			\
+#define register_remove_cb(w, func, arg)                        \
+        XtRemoveCallback((w), XmNactivateCallback,              \
+                (XtCallbackProc) (func),                        \
                 (XtPointer) (arg))                      
 
-#define register_activate_cb_list(w, list)		\
-        XtAddCallbacks((w), XmNactivateCallback,	\
+#define register_activate_cb_list(w, list)              \
+        XtAddCallbacks((w), XmNactivateCallback,        \
                 (XtCallbackList)(list))
 
-#define register_valchg_cb(w, func, arg)		\
-        XtAddCallback((w), XmNvalueChangedCallback,	\
-                (XtCallbackProc) (func),		\
+#define register_valchg_cb(w, func, arg)                \
+        XtAddCallback((w), XmNvalueChangedCallback,     \
+                (XtCallbackProc) (func),                \
                 (XtPointer) (arg))
 
-#define register_valchg_cb_list(w, list)		\
-        XtAddCallbacks((w), XmNvalueChangedCallback,	\
+#define register_valchg_cb_list(w, list)                \
+        XtAddCallbacks((w), XmNvalueChangedCallback,    \
                 (XtCallbackList)(list))
 
-#define register_ok_cb(w, func, arg)		\
-        XtAddCallback((w), XmNokCallback,	\
-                (XtCallbackProc) (func),	\
+#define register_ok_cb(w, func, arg)            \
+        XtAddCallback((w), XmNokCallback,       \
+                (XtCallbackProc) (func),        \
                 (XtPointer) (arg))
 
-#define register_cancel_cb(w, func, arg)	\
-        XtAddCallback((w), XmNcancelCallback,	\
-                (XtCallbackProc) (func),	\
+#define register_cancel_cb(w, func, arg)        \
+        XtAddCallback((w), XmNcancelCallback,   \
+                (XtCallbackProc) (func),        \
                 (XtPointer) (arg))
 
-#define register_apply_cb(w, func, arg)	\
-        XtAddCallback((w), XmNapplyCallback,	\
-                (XtCallbackProc) (func),	\
+#define register_apply_cb(w, func, arg) \
+        XtAddCallback((w), XmNapplyCallback,    \
+                (XtCallbackProc) (func),        \
                 (XtPointer) (arg))
 
-#define register_drag_cb(w, func, arg)		\
-        XtAddCallback((w), XmNdragCallback,	\
-                (XtCallbackProc) (func),	\
+#define register_drag_cb(w, func, arg)          \
+        XtAddCallback((w), XmNdragCallback,     \
+                (XtCallbackProc) (func),        \
                 (XtPointer) (arg))
 
 /* event loop  */
 
-#define register_popup_ev(parent, w)				\
-        XtAddEventHandler((parent), ButtonPressMask,		\
-                          False,				\
-                          (XtEventHandler)PopupHandler,	\
+#define register_popup_ev(parent, w)                            \
+        XtAddEventHandler((parent), ButtonPressMask,            \
+                          False,                                \
+                          (XtEventHandler)PopupHandler, \
                           (XtPointer)(w))
 
 #endif
diff --git a/Unix/Widgets.cpp b/Unix/Widgets.cpp
index b769daf436..59e2f01809 100644
--- a/Unix/Widgets.cpp
+++ b/Unix/Widgets.cpp
@@ -1,4 +1,4 @@
-/* $Id: Widgets.cpp,v 1.10 2000-11-25 23:10:37 geuzaine Exp $ */
+/* $Id: Widgets.cpp,v 1.11 2000-11-26 15:43:48 geuzaine Exp $ */
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -43,9 +43,9 @@ void CreateWidgets_M(Widgets_T *w){
   /* menu shell */
   w->M.shell = 
     XtVaAppCreateShell("Gmsh", "gmshMW", applicationShellWidgetClass, XCTX.display, 
-		       XmNvisual, XCTX.gui.visual,
-		       XmNcolormap, XCTX.gui.colormap,
-		       NULL);
+                       XmNvisual, XCTX.gui.visual,
+                       XmNcolormap, XCTX.gui.colormap,
+                       NULL);
   
   /* menu main window */
   i=0;
@@ -60,7 +60,7 @@ void CreateWidgets_M(Widgets_T *w){
   /* file menu */
   i=0;
   w->M.filePane = XmCreatePulldownMenu(w->M.menuBar, "MfilePane", arg, i);
-					
+                                        
   i=0;
   XtSetArg(arg[i], XmNlabelString, XmStringCreateSimple("Open")); i++;
   XtSetArg(arg[i], XmNacceleratorText, XmStringCreateSimple("(C-o)")); i++;
@@ -137,7 +137,7 @@ void CreateWidgets_M(Widgets_T *w){
   /* module menu */
   i=0;
   w->M.modulePane = XmCreatePulldownMenu(w->M.menuBar, "MmodulePane", arg, i);
-					
+                                        
   i=0;
   XtSetArg(arg[i], XmNlabelString, XmStringCreateSimple("Geometry")); i++;
   XtSetArg(arg[i], XmNacceleratorText, XmStringCreateSimple("(g)")); i++;
@@ -168,7 +168,7 @@ void CreateWidgets_M(Widgets_T *w){
   /* option menu */
   i=0;
   w->M.optionPane = XmCreatePulldownMenu(w->M.menuBar, "MoptionPane", arg, i);
-					
+                                        
   i=0;
   XtSetArg(arg[i], XmNlabelString, XmStringCreateSimple("Geometry Options")); i++;
   XtSetArg(arg[i], XmNacceleratorText, XmStringCreateSimple("(S-g)")); i++;
@@ -229,7 +229,7 @@ void CreateWidgets_M(Widgets_T *w){
   /* help menu */
   i=0;
   w->M.helpPane = XmCreatePulldownMenu(w->M.menuBar, "MhelpPane", arg, i);
-					
+                                        
   i=0;
   XtSetArg(arg[i], XmNlabelString, XmStringCreateSimple("Short Help")); i++;
   w->M.helpButt[0] = XmCreatePushButton(w->M.helpPane, "MhelpButt0", arg, i);
@@ -412,9 +412,9 @@ void CreateWidgets_G(Widgets_T *w){
   /* graphic shell */
   w->G.shell = 
     XtVaAppCreateShell("Gmsh graphics", "gmshGW", applicationShellWidgetClass, XCTX.display, 
-		       XmNvisual,XCTX.gui.visual,
-		       XmNcolormap,XCTX.gui.colormap,
-		       NULL);
+                       XmNvisual,XCTX.gui.visual,
+                       XmNcolormap,XCTX.gui.colormap,
+                       NULL);
   
   /* container form */
   i=0;
@@ -533,9 +533,9 @@ void CreateWidgets_C(Widgets_T *w){
 
   w->C.shell =
     XtVaAppCreateShell("Gmsh commands", "gmshCW", applicationShellWidgetClass, XCTX.display,
-		       XmNvisual,XCTX.gui.visual,
-		       XmNcolormap,XCTX.gui.colormap,
-		       NULL);
+                       XmNvisual,XCTX.gui.visual,
+                       XmNcolormap,XCTX.gui.colormap,
+                       NULL);
 
   i=0;
   XtSetArg(arg[i], XmNpromptString, XmStringCreateSimple("")); i++;
diff --git a/Unix/XColors.cpp b/Unix/XColors.cpp
index 955a7da3bc..cdc9c70400 100644
--- a/Unix/XColors.cpp
+++ b/Unix/XColors.cpp
@@ -1,4 +1,4 @@
-/* $Id: XColors.cpp,v 1.3 2000-11-23 23:20:35 geuzaine Exp $ */
+/* $Id: XColors.cpp,v 1.4 2000-11-26 15:43:48 geuzaine Exp $ */
 /*
   Attention. Toutes les couleurs sont crees a partir de la colormap de
   l'interface : XCTX.gui.colormap
@@ -115,7 +115,7 @@ unsigned long AllocateColorInt( int r, int g, int b )
 unsigned long AllocateColor( float red, float green, float blue )
 {
    return AllocateColorInt( (int) (red*255.0), (int) (green*255.0),
-			    (int) (blue*255.0) );
+                            (int) (blue*255.0) );
 }
 
 
@@ -173,15 +173,15 @@ void XColorInitialize(void) {
     int r, g, b;
     for (r=0;r<5;r++) {
       for (g=0;g<9;g++) {
-	for (b=0;b<5;b++) {
-	  XColor xcol;
-	  xcol.red   = r * 65535 / 4;
-	  xcol.green = g * 65535 / 8;
-	  xcol.blue  = b * 65535 / 4;
-	  New_XAllocColor( XCTX.display, XCTX.gui.colormap,
-			   XCTX.gui.visual->map_entries, &xcol );
-	  ctable8[r][g][b] = xcol.pixel;
-	}
+        for (b=0;b<5;b++) {
+          XColor xcol;
+          xcol.red   = r * 65535 / 4;
+          xcol.green = g * 65535 / 8;
+          xcol.blue  = b * 65535 / 4;
+          New_XAllocColor( XCTX.display, XCTX.gui.colormap,
+                           XCTX.gui.visual->map_entries, &xcol );
+          ctable8[r][g][b] = xcol.pixel;
+        }
       }
     }
     pixelformat = PF_8BIT;
@@ -202,10 +202,10 @@ void XColorInitialize(void) {
   attr.background_pixel = 255;
   attr.colormap = XCTX.gui.colormap;
   DummyWindow = XCreateWindow( XCTX.display, DefaultRootWindow(XCTX.display),
-			       0, 0, 10, 10, 1,
-			       XCTX.depth, InputOutput, XCTX.gui.visual,
-			       CWBorderPixel | CWBackPixel | CWColormap,
-			       &attr );
+                               0, 0, 10, 10, 1,
+                               XCTX.depth, InputOutput, XCTX.gui.visual,
+                               CWBorderPixel | CWBackPixel | CWColormap,
+                               &attr );
   
   /*** The basic GC ***/
   gc_mask        = GCForeground | GCBackground | GCFont | GCArcMode;
diff --git a/Unix/XContext.h b/Unix/XContext.h
index 9720ba51bf..4f43666d21 100644
--- a/Unix/XContext.h
+++ b/Unix/XContext.h
@@ -1,4 +1,4 @@
-/* $Id: XContext.h,v 1.2 2000-11-23 14:11:41 geuzaine Exp $ */
+/* $Id: XContext.h,v 1.3 2000-11-26 15:43:48 geuzaine Exp $ */
 #ifndef _XCONTEXT_H_
 #define _XCONTEXT_H_
 
@@ -48,7 +48,7 @@ typedef struct {
 
 } XContext_T ;
 
-#define	EV_MASK  KeyPressMask|KeyReleaseMask|\
+#define EV_MASK  KeyPressMask|KeyReleaseMask|\
                  ButtonPressMask|ButtonReleaseMask|ButtonMotionMask|\
                  PointerMotionMask|ExposureMask|ResizeRedirectMask|\
                  EnterWindowMask|LeaveWindowMask|ShiftMask|ControlMask|Mod1Mask
diff --git a/bin/dbx_gmsh b/bin/dbx_gmsh
deleted file mode 100644
index e8918b33bc..0000000000
--- a/bin/dbx_gmsh
+++ /dev/null
@@ -1,8 +0,0 @@
-dbx /usr/users53/geuzaine/SOURCES/gmsh-nl/bin/gmsh \
-  -I/usr/users53/geuzaine/SOURCES/gmsh-nl/GmshUnix \
-  -I/usr/users53/geuzaine/SOURCES/gmsh-nl/GmshMesh \
-  -I/usr/users53/geuzaine/SOURCES/gmsh-nl/GmshGeo \
-  -I/usr/users53/geuzaine/SOURCES/gmsh-nl/GmshDataStr \
-  -I/usr/users53/geuzaine/SOURCES/gmsh-nl/GmshAdapt \
-  -I/usr/users53/geuzaine/SOURCES/gmsh-nl/GmshParser \
-  -I/usr/users53/geuzaine/SOURCES/gmsh-nl/GmshGL
diff --git a/bin/gdb_gmsh b/bin/gdb_gmsh
deleted file mode 100644
index bc2d1bd56a..0000000000
--- a/bin/gdb_gmsh
+++ /dev/null
@@ -1,8 +0,0 @@
-gdb  /usr/users53/geuzaine/SOURCES/gmsh-nl/bin/gmsh \
-  -d /usr/users53/geuzaine/SOURCES/gmsh-nl/GmshUnix \
-  -d /usr/users53/geuzaine/SOURCES/gmsh-nl/GmshMesh \
-  -d /usr/users53/geuzaine/SOURCES/gmsh-nl/GmshGeo \
-  -d /usr/users53/geuzaine/SOURCES/gmsh-nl/GmshDataStr \
-  -d /usr/users53/geuzaine/SOURCES/gmsh-nl/GmshAdapt \
-  -d /usr/users53/geuzaine/SOURCES/gmsh-nl/GmshParser \
-  -d /usr/users53/geuzaine/SOURCES/gmsh-nl/GmshGL
diff --git a/bin/gdb_gmshm b/bin/gdb_gmshm
deleted file mode 100644
index f971c6781f..0000000000
--- a/bin/gdb_gmshm
+++ /dev/null
@@ -1,9 +0,0 @@
-
-gdb /home/geuzaine/SOURCES/gmsh-nl/bin/gmshm \
-  --directory /home/geuzaine/SOURCES/gmsh-nl/GmshUnix \
-  --directory /home/geuzaine/SOURCES/gmsh-nl/GmshMesh \
-  --directory /home/geuzaine/SOURCES/gmsh-nl/GmshGeo \
-  --directory /home/geuzaine/SOURCES/gmsh-nl/GmshDataStr \
-  --directory /home/geuzaine/SOURCES/gmsh-nl/GmshAdapt \
-  --directory /home/geuzaine/SOURCES/gmsh-nl/GmshParser \
-  --directory /home/geuzaine/SOURCES/gmsh-nl/GmshGL
diff --git a/examples/wing.geo b/examples/wing.geo
index 08a58cb403..a255c66945 100644
--- a/examples/wing.geo
+++ b/examples/wing.geo
@@ -1,4 +1,4 @@
-scale = 100 ;
+scale = 1 ;
 
 lc1 = 5.e-3 *scale ;
 lc2 = 1.e-2 *scale ;
diff --git a/utils/untabify b/utils/untabify
new file mode 100644
index 0000000000..906951801a
--- /dev/null
+++ b/utils/untabify
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+if [ $# -lt 1 ] ; then
+  echo "Usage: untabify files" 1>&2
+  exit 1
+else 
+  for file in $@; do
+    echo Modifying $file
+    mv $file $file~
+    expand $file~ > $file
+  done
+fi
+
+
-- 
GitLab