diff --git a/Common/ColorTable.cpp b/Common/ColorTable.cpp
index 482b36dcbd827537a66491d3bb3397c2ad43dc52..8bc3d9831f26cc6af6848911b2a0a53b0467a300 100644
--- a/Common/ColorTable.cpp
+++ b/Common/ColorTable.cpp
@@ -1,4 +1,4 @@
-// $Id: ColorTable.cpp,v 1.29 2005-02-02 18:47:55 geuzaine Exp $
+// $Id: ColorTable.cpp,v 1.30 2005-12-22 20:42:41 geuzaine Exp $
 //
 // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
 //
@@ -351,7 +351,7 @@ void ColorTable_Recompute(GmshColorTable * ct)
     b = b < 0 ? 0 : (b > 255 ? 255 : b);
     a = a < 0 ? 0 : (a > 255 ? 255 : a);
     
-    ct->table[i] = PACK_COLOR(r, g, b, a);
+    ct->table[i] = CTX.PACK_COLOR(r, g, b, a);
   }
 
 }
@@ -389,10 +389,10 @@ void ColorTable_Print(GmshColorTable * ct, FILE * fp)
 
   strcpy(tmp1, "");
   for(i = 0; i < ct->size; i++) {
-    r = UNPACK_RED(ct->table[i]);
-    g = UNPACK_GREEN(ct->table[i]);
-    b = UNPACK_BLUE(ct->table[i]);
-    a = UNPACK_ALPHA(ct->table[i]);
+    r = CTX.UNPACK_RED(ct->table[i]);
+    g = CTX.UNPACK_GREEN(ct->table[i]);
+    b = CTX.UNPACK_BLUE(ct->table[i]);
+    a = CTX.UNPACK_ALPHA(ct->table[i]);
     if(i && !(i % 4)) {
       if(fp)
         fprintf(fp, "%s\n", tmp1);
@@ -415,7 +415,7 @@ int ColorTable_IsAlpha(GmshColorTable * ct)
 {
   int i, a;
   for(i = 0; i < ct->size; i++) {
-    a = UNPACK_ALPHA(ct->table[i]);
+    a = CTX.UNPACK_ALPHA(ct->table[i]);
     if(a < 255)
       return 1;
   }
diff --git a/Common/Context.h b/Common/Context.h
index 54dfcdfcf895553e32bd6e0baf5ce1c657a884f1..a040095a6e652f4704e4e2e36cee6e742dd5d099 100644
--- a/Common/Context.h
+++ b/Common/Context.h
@@ -22,28 +22,12 @@
 
 #include "List.h"
 
-// How RGBA values are packed and unpacked into/from a 4-byte
-// integer:
-
-#if defined(__BIG_ENDIAN__)
-#  define PACK_COLOR(R,G,B,A)   ( (unsigned int)((R)<<24 | (G)<<16 | (B)<<8 | (A)) )
-#  define UNPACK_RED(X)         ( ( (X) >> 24 ) & 0xff )
-#  define UNPACK_GREEN(X)       ( ( (X) >> 16 ) & 0xff )
-#  define UNPACK_BLUE(X)        ( ( (X) >> 8 ) & 0xff )
-#  define UNPACK_ALPHA(X)       ( (X) & 0xff )
-#else
-#  define PACK_COLOR(R,G,B,A)   ( (unsigned int)((A)<<24 | (B)<<16 | (G)<<8 | (R)) )
-#  define UNPACK_RED(X)         ( (X) & 0xff )
-#  define UNPACK_GREEN(X)       ( ( (X) >> 8 ) & 0xff )
-#  define UNPACK_BLUE(X)        ( ( (X) >> 16 ) & 0xff )
-#  define UNPACK_ALPHA(X)       ( ( (X) >> 24 ) & 0xff )
-#endif
-
 // Interface-independent context 
 
 class Context_T {
 
 public :
+  int big_endian;             // is the machine big-endian?
 
   // general options
   char filename[256];         // the name of the currently opened file
@@ -258,6 +242,30 @@ public :
   void addQuaternionFromAxisAndAngle(double axis[3], double angle);
   void setQuaternionFromEulerAngles(void);
   void setEulerAnglesFromRotationMatrix(void);
+
+  // how RGBA values are packed and unpacked into/from an unsigned
+  // integer to be fed to glColor4ubv (depends on machine byte
+  // ordering!):
+  inline unsigned int PACK_COLOR(int R, int G, int B, int A){
+    if(big_endian) return ( (unsigned int)((R)<<24 | (G)<<16 | (B)<<8 | (A)) );
+    else           return ( (unsigned int)((A)<<24 | (B)<<16 | (G)<<8 | (R)) );
+  }
+  inline int UNPACK_RED(unsigned int X){
+    if(big_endian) return ( ( (X) >> 24 ) & 0xff );
+    else           return ( (X) & 0xff );
+  }
+  inline int UNPACK_GREEN(unsigned int X){
+    if(big_endian) return ( ( (X) >> 16 ) & 0xff );
+    else           return ( ( (X) >> 8 ) & 0xff );
+  }
+  inline int UNPACK_BLUE(unsigned int X){
+    if(big_endian) return ( ( (X) >> 8 ) & 0xff );
+    else           return ( ( (X) >> 16 ) & 0xff );
+  }
+  inline int UNPACK_ALPHA(unsigned int X){
+    if(big_endian) return ( (X) & 0xff );
+    else           return ( ( (X) >> 24 ) & 0xff );
+  }
 };
 
 #endif
diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h
index 76dbb9511e5379a67e09855a021a20645449859d..761146b26a91e5450d57097fe913f083f8e03626 100644
--- a/Common/DefaultOptions.h
+++ b/Common/DefaultOptions.h
@@ -1355,216 +1355,174 @@ StringXNumber PrintOptions_Number[] = {
 
 StringXColor GeneralOptions_Color[] = {
   { F|O, "Background" , opt_general_color_background ,
-    PACK_COLOR(0,   0,   0,   255), 
-    PACK_COLOR(255, 255, 255, 255), 
-    PACK_COLOR(255, 255, 255, 255), 
+    {0, 0, 0, 255}, {255, 255, 255, 255}, {255, 255, 255, 255}, 
     "Background color" },
   { F|O, "BackgroundGradient" , opt_general_color_background_gradient ,
-    PACK_COLOR(0,   0, 125, 255), 
-    PACK_COLOR(0,   0, 125, 255), 
-    PACK_COLOR(125, 125, 125, 255), 
+    {0, 0, 125, 255}, {0, 0, 125, 255}, {125, 125, 125, 255}, 
     "Background gradient color" },
   { F|O, "Foreground" , opt_general_color_foreground ,
-    PACK_COLOR(255, 255, 255, 255),
-    PACK_COLOR(0,   0,   0,   255),
-    PACK_COLOR(0,   0,   0,   255),
+    {255, 255, 255, 255}, {0, 0, 0, 255}, {0, 0, 0, 255},
     "Foreground color" },
   { F|O, "Text" , opt_general_color_text ,
-    PACK_COLOR(255, 255, 255, 255),
-    PACK_COLOR(0,   0,   0,   255),
-    PACK_COLOR(0,   0,   0,   255),
+    {255, 255, 255, 255}, {0, 0, 0, 255}, {0, 0, 0, 255},
     "Text color" },
   { F|O, "Axes" , opt_general_color_axes ,
-    PACK_COLOR(255, 255, 255, 255),
-    PACK_COLOR(128, 128, 128, 255),
-    PACK_COLOR(0,   0,   0,   255),
+    {255, 255, 255, 255}, {128, 128, 128, 255}, {0, 0, 0, 255},
     "Axes color" },
   { F|O, "SmallAxes" , opt_general_color_small_axes ,
-    PACK_COLOR(255, 255, 255, 255),
-    PACK_COLOR(0,   0,   0,   255),
-    PACK_COLOR(0,   0,   0,   255),
+    {255, 255, 255, 255}, {0, 0, 0, 255}, {0, 0, 0, 255},
     "Small axes color" },
   { F|O, "AmbientLight" , opt_general_color_ambient_light,
-    PACK_COLOR(25, 25, 25, 255),
-    PACK_COLOR(25, 25, 25, 255),
-    PACK_COLOR(25, 25, 25, 255),
+    {25, 25, 25, 255}, {25, 25, 25, 255}, {25, 25, 25, 255},
     "Ambient light color" },
   { F|O, "DiffuseLight" , opt_general_color_diffuse_light,
-    PACK_COLOR(255, 255, 255, 255),
-    PACK_COLOR(255, 255, 255, 255),
-    PACK_COLOR(255, 255, 255, 255),
+    {255, 255, 255, 255}, {255, 255, 255, 255}, {255, 255, 255, 255},
     "Diffuse light color" },
   { F|O, "SpecularLight" , opt_general_color_specular_light,
-    PACK_COLOR(255, 255, 255, 255),
-    PACK_COLOR(255, 255, 255, 255),
-    PACK_COLOR(255, 255, 255, 255),
+    {255, 255, 255, 255}, {255, 255, 255, 255}, {255, 255, 255, 255},
     "Specular light color" },
-  { 0, NULL , NULL ,  0, 0, 0 , NULL }
+  { 0, NULL , NULL ,  {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0} , NULL }
 } ;
 
 StringXColor GeometryOptions_Color[] = {
   { F|O, "Points" , opt_geometry_color_points , 
-    PACK_COLOR(178, 182, 129, 255) ,
-    PACK_COLOR(178, 182, 129, 255) ,
-    PACK_COLOR(0,   0,   0,   255), 
+    {178, 182, 129, 255}, {178, 182, 129, 255}, {0, 0, 0, 255}, 
     "Normal geometry point color" },
   { F|O, "Lines" , opt_geometry_color_lines ,
-    PACK_COLOR(0,   0,   255, 255),
-    PACK_COLOR(0,   0,   255, 255),
-    PACK_COLOR(0,   0,   0,   255),
+    {0, 0, 255, 255}, {0, 0, 255, 255}, {0, 0, 0, 255},
     "Normal geometry curve color" },
   { F|O, "Surfaces" , opt_geometry_color_surfaces ,
-    PACK_COLOR(128, 128, 128, 255),
-    PACK_COLOR(128, 128, 128, 255),
-    PACK_COLOR(0,   0,   0,   255),
+    {128, 128, 128, 255}, {128, 128, 128, 255}, {0, 0, 0, 255},
     "Normal geometry surface color" },
   { F|O, "Volumes" , opt_geometry_color_volumes ,
-    PACK_COLOR(128, 128, 128, 255),
-    PACK_COLOR(128, 128, 128, 255),
-    PACK_COLOR(0,   0,   0,   255),
+    {128, 128, 128, 255}, {128, 128, 128, 255}, {0, 0, 0, 255},
     "Normal geometry volume color" },
   { F|O, "PointsSelect" , opt_geometry_color_points_select ,
-    PACK_COLOR(255, 0,   0,   255),
-    PACK_COLOR(255, 0,   0,   255),
-    PACK_COLOR(0,   0,   0,   255),
+    {255, 0, 0, 255}, {255, 0, 0, 255}, {0, 0, 0, 255},
     "Selected geometry point color" },
   { F|O, "LinesSelect" , opt_geometry_color_lines_select ,
-    PACK_COLOR(255, 0,   0,   255),
-    PACK_COLOR(255, 0,   0,   255),
-    PACK_COLOR(0,   0,   0,   255),
-    "Selected geometry curve color"  },
+    {255, 0, 0, 255}, {255, 0, 0, 255}, {0, 0, 0, 255},
+    "Selected geometry curve color" },
   { F|O, "SurfacesSelect" , opt_geometry_color_surfaces_select ,
-    PACK_COLOR(255, 0,   0,   255),
-    PACK_COLOR(255, 0,   0,   255),
-    PACK_COLOR(0,   0,   0,   255),
+    {255, 0, 0, 255}, {255, 0, 0, 255}, {0, 0, 0, 255},
     "Selected geometry surface color" },
   { F|O, "VolumesSelect" , opt_geometry_color_volumes_select ,
-    PACK_COLOR(255, 0,   0,   255),
-    PACK_COLOR(255, 0,   0,   255),
-    PACK_COLOR(0,   0,   0,   255),
+    {255, 0, 0, 255}, {255, 0, 0, 255}, {0, 0, 0, 255},
     "Selected geometry volume color" },
   { F|O, "Tangents" , opt_geometry_color_tangents ,
-    PACK_COLOR(255, 255, 0,   255),
-    PACK_COLOR(255, 255, 0,   255),
-    PACK_COLOR(0,   0,   0,   255),
+    {255, 255, 0, 255}, {255, 255, 0, 255}, {0, 0, 0, 255},
     "Tangent geometry vectors color" },
   { F|O, "Normals" , opt_geometry_color_normals ,
-    PACK_COLOR(255, 0,   0,   255),
-    PACK_COLOR(255, 0,   0,   255),
-    PACK_COLOR(0,   0,   0,   255),
+    {255, 0, 0, 255}, {255, 0, 0, 255}, {0, 0, 0, 255},
     "Normal geometry vectors color" },
-  { 0, NULL , NULL , 0, 0, 0 , NULL }
+  { 0, NULL , NULL , {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0} , NULL }
 } ;
 
-#define COLW  PACK_COLOR( 210, 210, 210, 255 )
-#define COLT  PACK_COLOR( 160, 150, 255, 255 )
-#define COLQ  PACK_COLOR( 130, 120, 225, 255 )
-#define COLP  PACK_COLOR( 232, 210, 23, 255 )
-#define COLY  PACK_COLOR( 217, 113, 38, 255 )
+#define COLW  {210, 210, 210, 255}
+#define COLT  {160, 150, 255, 255}
+#define COLQ  {130, 120, 225, 255}
+#define COLP  {232, 210, 23, 255}
+#define COLY  {217, 113, 38, 255}
 
 // dark blue to yellow:
-#define COL0   PACK_COLOR( 9, 3, 103, 255 )
-#define COL1   PACK_COLOR( 35, 0, 111, 255 )
-#define COL2   PACK_COLOR( 60, 0, 114, 255 )
-#define COL3   PACK_COLOR( 83, 0, 114, 255 )
-#define COL4   PACK_COLOR( 105, 1, 109, 255 )
-#define COL5   PACK_COLOR( 126, 10, 102, 255 )
-#define COL6   PACK_COLOR( 145, 21, 93, 255 )
-#define COL7   PACK_COLOR( 163, 34, 82, 255 )
-#define COL8   PACK_COLOR( 179, 50, 69, 255 )
-#define COL9   PACK_COLOR( 193, 67, 57, 255 )
-#define COL10  PACK_COLOR( 207, 85, 44, 255 )
-#define COL11  PACK_COLOR( 219, 104, 32, 255 )
-#define COL12  PACK_COLOR( 229, 124, 22, 255 )
-#define COL13  PACK_COLOR( 238, 143, 13, 255 )
-#define COL14  PACK_COLOR( 246, 162, 8, 255 )
-#define COL15  PACK_COLOR( 252, 181, 5, 255 )
-#define COL16  PACK_COLOR( 255, 198, 6, 255 )
-#define COL17  PACK_COLOR( 255, 214, 11, 255 )
-#define COL18  PACK_COLOR( 255, 228, 22, 255 )
-#define COL19  PACK_COLOR( 255, 240, 38, 255 )
+#define COL0  {9, 3, 103, 255}
+#define COL1  {35, 0, 111, 255}
+#define COL2  {60, 0, 114, 255}
+#define COL3  {83, 0, 114, 255}
+#define COL4  {105, 1, 109, 255}
+#define COL5  {126, 10, 102, 255}
+#define COL6  {145, 21, 93, 255}
+#define COL7  {163, 34, 82, 255}
+#define COL8  {179, 50, 69, 255}
+#define COL9  {193, 67, 57, 255}
+#define COL10 {207, 85, 44, 255}
+#define COL11 {219, 104, 32, 255}
+#define COL12 {229, 124, 22, 255}
+#define COL13 {238, 143, 13, 255}
+#define COL14 {246, 162, 8, 255}
+#define COL15 {252, 181, 5, 255}
+#define COL16 {255, 198, 6, 255}
+#define COL17 {255, 214, 11, 255}
+#define COL18 {255, 228, 22, 255}
+#define COL19 {255, 240, 38, 255}
 
 // jet:
-// #define COL0   PACK_COLOR( 0, 0, 143, 255)
-// #define COL1   PACK_COLOR( 0, 0, 197, 255)
-// #define COL2   PACK_COLOR( 0, 0, 250, 255)
-// #define COL3   PACK_COLOR( 0, 49, 255, 255)
-// #define COL4   PACK_COLOR( 0, 103, 255, 255)
-// #define COL5   PACK_COLOR( 0, 156, 255, 255)
-// #define COL6   PACK_COLOR( 0, 210, 255, 255)
-// #define COL7   PACK_COLOR( 9, 255, 253, 255)
-// #define COL8   PACK_COLOR( 62, 255, 200, 255)
-// #define COL9   PACK_COLOR( 116, 255, 146, 255)
-// #define COL10  PACK_COLOR( 170, 255, 92, 255)
-// #define COL11  PACK_COLOR( 223, 255, 39, 255)
-// #define COL12  PACK_COLOR( 255, 240, 0, 255)
-// #define COL13  PACK_COLOR( 255, 186, 0, 255)
-// #define COL14  PACK_COLOR( 255, 132, 0, 255)
-// #define COL15  PACK_COLOR( 255, 79, 0, 255)
-// #define COL16  PACK_COLOR( 255, 25, 0, 255)
-// #define COL17  PACK_COLOR( 226, 0, 0, 255)
-// #define COL18  PACK_COLOR( 173, 0, 0, 255)
-// #define COL19  PACK_COLOR( 119, 0, 0, 255)
+// #define COL0  {0, 0, 143, 255}
+// #define COL1  {0, 0, 197, 255}
+// #define COL2  {0, 0, 250, 255}
+// #define COL3  {0, 49, 255, 255}
+// #define COL4  {0, 103, 255, 255}
+// #define COL5  {0, 156, 255, 255}
+// #define COL6  {0, 210, 255, 255}
+// #define COL7  {9, 255, 253, 255}
+// #define COL8  {62, 255, 200, 255}
+// #define COL9  {116, 255, 146, 255}
+// #define COL10 {170, 255, 92, 255}
+// #define COL11 {223, 255, 39, 255}
+// #define COL12 {255, 240, 0, 255}
+// #define COL13 {255, 186, 0, 255}
+// #define COL14 {255, 132, 0, 255}
+// #define COL15 {255, 79, 0, 255}
+// #define COL16 {255, 25, 0, 255}
+// #define COL17 {226, 0, 0, 255}
+// #define COL18 {173, 0, 0, 255}
+// #define COL19 {119, 0, 0, 255}
 
 // truncated hsv:
-// #define COL0  PACK_COLOR(  255, 0, 0, 255)
-// #define COL1  PACK_COLOR(  255, 67, 0, 255)
-// #define COL2  PACK_COLOR(  255, 134, 0, 255)
-// #define COL3  PACK_COLOR(  255, 201, 0, 255)
-// #define COL4  PACK_COLOR(  241, 255, 0, 255)
-// #define COL5  PACK_COLOR(  174, 255, 0, 255)
-// #define COL6  PACK_COLOR(  107, 255, 0, 255)
-// #define COL7  PACK_COLOR(  40, 255, 0, 255)
-// #define COL8  PACK_COLOR(  0, 255, 26, 255)
-// #define COL9  PACK_COLOR(  0, 255, 93, 255)
-// #define COL10  PACK_COLOR( 0, 255, 161, 255)
-// #define COL11  PACK_COLOR( 0, 255, 228, 255)
-// #define COL12  PACK_COLOR( 0, 214, 255, 255)
-// #define COL13  PACK_COLOR( 0, 147, 255, 255)
-// #define COL14  PACK_COLOR( 0, 80, 255, 255)
-// #define COL15  PACK_COLOR( 0, 13, 255, 255)
-// #define COL16  PACK_COLOR( 53, 0, 255, 255)
-// #define COL17  PACK_COLOR( 120, 0, 255, 255)
-// #define COL18  PACK_COLOR( 187, 0, 255, 255)
-// #define COL19  PACK_COLOR( 255, 0, 254, 255)
+// #define COL0  {255, 0, 0, 255}
+// #define COL1  {255, 67, 0, 255}
+// #define COL2  {255, 134, 0, 255}
+// #define COL3  {255, 201, 0, 255}
+// #define COL4  {241, 255, 0, 255}
+// #define COL5  {174, 255, 0, 255}
+// #define COL6  {107, 255, 0, 255}
+// #define COL7  {40, 255, 0, 255}
+// #define COL8  {0, 255, 26, 255}
+// #define COL9  {0, 255, 93, 255}
+// #define COL10 {0, 255, 161, 255}
+// #define COL11 {0, 255, 228, 255}
+// #define COL12 {0, 214, 255, 255}
+// #define COL13 {0, 147, 255, 255}
+// #define COL14 {0, 80, 255, 255}
+// #define COL15 {0, 13, 255, 255}
+// #define COL16 {53, 0, 255, 255}
+// #define COL17 {120, 0, 255, 255}
+// #define COL18 {187, 0, 255, 255}
+// #define COL19 {255, 0, 254, 255}
 
 StringXColor MeshOptions_Color[] = {
   { F|O, "Points" , opt_mesh_color_points , 
-    PACK_COLOR(0  , 255, 0 , 255),
-    PACK_COLOR(0  , 255, 0 , 255),
-    PACK_COLOR(0,   0,   0,   255),
+    {0, 255, 0, 255}, {0, 255, 0, 255}, {0, 0, 0, 255},
     "Mesh node color" },
   { F|O, "PointsSup" , opt_mesh_color_points_deg2 , 
-    PACK_COLOR(255, 0,  255 , 255),
-    PACK_COLOR(255, 0,  255 , 255),
-    PACK_COLOR(0,   0,  0,   255),
+    {255, 0, 255, 255}, {255, 0, 255, 255}, {0, 0, 0, 255},
     "Second order mesh node color" },
   { F|O, "Lines" , opt_mesh_color_lines , 
-    PACK_COLOR(0,   255, 0,   255),
-    PACK_COLOR(0,   255, 0,   255),
-    PACK_COLOR(0,   0,   0,   255),
+    {0, 255, 0, 255}, {0, 255, 0, 255}, {0, 0, 0, 255},
     "Mesh line color" },
   { F|O, "Triangles" , opt_mesh_color_triangles , 
-    COLT, COLT, COLW, "Mesh triangle color (if Mesh.ColorCarousel=0)" },
+    COLT, COLT, COLW, 
+    "Mesh triangle color (if Mesh.ColorCarousel=0)" },
   { F|O, "Quadrangles" , opt_mesh_color_quadrangles ,
-    COLQ, COLQ, COLW, "Mesh quadrangle color (if Mesh.ColorCarousel=0)" },
+    COLQ, COLQ, COLW, 
+    "Mesh quadrangle color (if Mesh.ColorCarousel=0)" },
   { F|O, "Tetrahedra" , opt_mesh_color_tetrahedra ,
-    COLT, COLT, COLW, "Mesh tetrahedron color (if Mesh.ColorCarousel=0)" },
+    COLT, COLT, COLW,
+     "Mesh tetrahedron color (if Mesh.ColorCarousel=0)" },
   { F|O, "Hexahedra" , opt_mesh_color_hexahedra ,
-    COLQ, COLQ, COLW, "Mesh hexahedron color (if Mesh.ColorCarousel=0)" },
+    COLQ, COLQ, COLW, 
+    "Mesh hexahedron color (if Mesh.ColorCarousel=0)" },
   { F|O, "Prisms" , opt_mesh_color_prisms ,
-    COLP, COLP, COLW, "Mesh prism color (if Mesh.ColorCarousel=0)" },
+    COLP, COLP, COLW,
+     "Mesh prism color (if Mesh.ColorCarousel=0)" },
   { F|O, "Pyramids" , opt_mesh_color_pyramid ,
-    COLY, COLY, COLW, "Mesh pyramid color (if Mesh.ColorCarousel=0)" },
+    COLY, COLY, COLW,
+     "Mesh pyramid color (if Mesh.ColorCarousel=0)" },
   { F|O, "Tangents" , opt_mesh_color_tangents ,
-    PACK_COLOR(255, 255, 0, 255),
-    PACK_COLOR(255, 255, 0, 255),
-    PACK_COLOR(0,   0,   0, 255),
+    {255, 255, 0, 255}, {255, 255, 0, 255}, {0, 0, 0, 255},
     "Tangent mesh vector color" },
   { F|O, "Normals" , opt_mesh_color_normals ,
-    PACK_COLOR(255, 0, 0, 255),
-    PACK_COLOR(255, 0, 0, 255),
-    PACK_COLOR(0,   0, 0, 255),
+    {255, 0, 0, 255}, {255, 0, 0, 255}, {0, 0, 0, 255},
     "Normal mesh vector color" },
   { F|O, "Zero"     , opt_mesh_color_0 , COL0, COL0, COLW, "Color 0 in color carousel" },
   { F|O, "One"      , opt_mesh_color_1 , COL1, COL1, COLW, "Color 1 in color carousel" },
@@ -1586,18 +1544,18 @@ StringXColor MeshOptions_Color[] = {
   { F|O, "Seventeen", opt_mesh_color_17, COL17, COL17, COLW, "Color 17 in color carousel" },
   { F|O, "Eighteen" , opt_mesh_color_18, COL18, COL18, COLW, "Color 18 in color carousel" },
   { F|O, "Nineteen" , opt_mesh_color_19, COL19, COL19, COLW, "Color 19 in color carousel" },
-  { 0, NULL , NULL , 0, 0, 0 , NULL }
+  { 0, NULL , NULL , {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0} , NULL }
 } ;
 
 StringXColor SolverOptions_Color[] = {
-  { 0, NULL , NULL , 0, 0, 0 , NULL }
+  { 0, NULL , NULL , {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0} , NULL }
 } ;
 
 StringXColor PostProcessingOptions_Color[] = {
-  { 0, NULL , NULL , 0, 0, 0 , NULL }
+  { 0, NULL , NULL , {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0} , NULL }
 } ;
 
-#define ELECOL  PACK_COLOR(255,255,255,255), PACK_COLOR(0,0,0,255), PACK_COLOR(0,0,0,255)
+#define ELECOL  {255, 255, 255, 255}, {0, 0, 0, 255}, {0, 0, 0, 255}
 
 StringXColor ViewOptions_Color[] = {
   { F|O, "Points" , opt_view_color_points , ELECOL, "Point color" },
@@ -1609,23 +1567,19 @@ StringXColor ViewOptions_Color[] = {
   { F|O, "Prisms" , opt_view_color_prisms , ELECOL, "Prism color" },
   { F|O, "Pyramids" , opt_view_color_pyramids , ELECOL, "Pyramid color" },
   { F|O, "Tangents" , opt_view_color_tangents ,
-    PACK_COLOR(255, 255, 0, 255),
-    PACK_COLOR(255, 255, 0, 255),
-    PACK_COLOR(0,   0,   0, 255),
+    {255, 255, 0, 255}, {255, 255, 0, 255}, {0, 0, 0, 255},
     "Tangent vector color" },
   { F|O, "Normals" , opt_view_color_normals ,
-    PACK_COLOR(255, 0, 0, 255),
-    PACK_COLOR(255, 0, 0, 255),
-    PACK_COLOR(0,   0, 0, 255),
+    {255, 0, 0, 255}, {255, 0, 0, 255}, {0, 0, 0, 255},
     "Normal vector color" },
   { F|O, "Text2D" , opt_view_color_text2d , ELECOL, "2D text color" },
   { F|O, "Text3D" , opt_view_color_text3d , ELECOL, "3D text color" },
   { F|O, "Axes" , opt_view_color_axes , ELECOL, "Axes color" },
-  { 0, NULL , NULL , 0, 0, 0 , NULL }
+  { 0, NULL , NULL , {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0} , NULL }
 } ;
 
 StringXColor PrintOptions_Color[] = {
-  { 0, NULL , NULL , 0, 0, 0 , NULL }
+  { 0, NULL , NULL , {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0} , NULL }
 } ;
 
 #undef S
diff --git a/Common/Options.cpp b/Common/Options.cpp
index 74952095b897a9fc686ad529f521754c2ab3bb2e..8bf4d3b4e643881aee5adbee7f1a2155659c6c24 100644
--- a/Common/Options.cpp
+++ b/Common/Options.cpp
@@ -1,4 +1,4 @@
-// $Id: Options.cpp,v 1.268 2005-12-21 02:01:26 geuzaine Exp $
+// $Id: Options.cpp,v 1.269 2005-12-22 20:42:41 geuzaine Exp $
 //
 // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
 //
@@ -93,9 +93,13 @@ char *gmsh_getenv(char *var)
 
 void Init_Options(int num)
 {
-  char *tmp;
+  // Is machine big- or little-endian?
+  short int word = 0x0001;
+  char *byte = (char *) &word;
+  CTX.big_endian = (byte[0] ? 0 : 1);
 
   // Home directory
+  char *tmp;
   if((tmp = gmsh_getenv("GMSH_HOME")))
     strcpy(CTX.home_dir, tmp);
   else if((tmp = gmsh_getenv("HOME")))
@@ -695,19 +699,22 @@ void Set_DefaultColorOptions(int num, StringXColor s[])
   switch (CTX.color_scheme) {
   case 1:
     while(s[i].str) {
-      s[i].function(num, GMSH_SET, s[i].def2);
+      s[i].function(num, GMSH_SET, CTX.PACK_COLOR(s[i].def2[0], s[i].def2[1],
+						  s[i].def2[2], s[i].def2[3]));
       i++;
     }
     break;
   case 2:
     while(s[i].str) {
-      s[i].function(num, GMSH_SET, s[i].def3);
+      s[i].function(num, GMSH_SET, CTX.PACK_COLOR(s[i].def3[0], s[i].def3[1],
+						  s[i].def3[2], s[i].def3[3]));
       i++;
     }
     break;
   default:
     while(s[i].str) {
-      s[i].function(num, GMSH_SET, s[i].def1);
+      s[i].function(num, GMSH_SET, CTX.PACK_COLOR(s[i].def1[0], s[i].def1[1],
+						  s[i].def1[2], s[i].def1[3]));
       i++;
     }
     break;
@@ -743,16 +750,25 @@ void Print_ColorOptions(int num, int level, int diff, StringXColor s[],
     if(s[i].level & level) {
       unsigned int def;
       switch (CTX.color_scheme) {
-      case 1: def = s[i].def2; break;
-      case 2: def = s[i].def3; break;
-      default: def = s[i].def1; break;
+      case 1: 
+	def = CTX.PACK_COLOR(s[i].def2[0], s[i].def2[1],
+			     s[i].def2[2], s[i].def2[3]);
+	break;
+      case 2: 
+	def = CTX.PACK_COLOR(s[i].def3[0], s[i].def3[1], 
+			     s[i].def3[2], s[i].def3[3]);
+	break;
+      default: 
+	def = CTX.PACK_COLOR(s[i].def1[0], s[i].def1[1], 
+			     s[i].def1[2], s[i].def1[3]);
+	break;
       }
       if(!diff || (s[i].function(num, GMSH_GET, 0) != def)){
 	sprintf(tmp, "%sColor.%s = {%d,%d,%d}; // %s",
 		prefix, s[i].str,
-		UNPACK_RED(s[i].function(num, GMSH_GET, 0)),
-		UNPACK_GREEN(s[i].function(num, GMSH_GET, 0)),
-		UNPACK_BLUE(s[i].function(num, GMSH_GET, 0)), s[i].help);
+		CTX.UNPACK_RED(s[i].function(num, GMSH_GET, 0)),
+		CTX.UNPACK_GREEN(s[i].function(num, GMSH_GET, 0)),
+		CTX.UNPACK_BLUE(s[i].function(num, GMSH_GET, 0)), s[i].help);
 	if(file)
 	  fprintf(file, "%s\n", tmp);
 	else
@@ -770,9 +786,9 @@ void Print_ColorOptionsDoc(StringXColor s[], char *prefix, FILE * file)
     fprintf(file, "@item %sColor.%s\n", prefix, s[i].str);
     fprintf(file, "%s@*\n", s[i].help);
     fprintf(file, "Default value: @code{@{%d,%d,%d@}}@*\n",
-	    UNPACK_RED(s[i].function(0, GMSH_GET, 0)),
-	    UNPACK_GREEN(s[i].function(0, GMSH_GET, 0)),
-	    UNPACK_BLUE(s[i].function(0, GMSH_GET, 0)));
+	    CTX.UNPACK_RED(s[i].function(0, GMSH_GET, 0)),
+	    CTX.UNPACK_GREEN(s[i].function(0, GMSH_GET, 0)),
+	    CTX.UNPACK_BLUE(s[i].function(0, GMSH_GET, 0)));
     fprintf(file, "Saved in: @code{%s}\n\n", Get_OptionSaveLevel(s[i].level));
     i++;
   }
@@ -786,9 +802,9 @@ int Get_ColorForString(StringX4Int SX4I[], int alpha,
     i++;
   *FlagError = (SX4I[i].str == NULL) ? 1 : 0;
   if(alpha > 0)
-    return PACK_COLOR(SX4I[i].int1, SX4I[i].int2, SX4I[i].int3, alpha);
+    return CTX.PACK_COLOR(SX4I[i].int1, SX4I[i].int2, SX4I[i].int3, alpha);
   else
-    return PACK_COLOR(SX4I[i].int1, SX4I[i].int2, SX4I[i].int3, SX4I[i].int4);
+    return CTX.PACK_COLOR(SX4I[i].int1, SX4I[i].int2, SX4I[i].int3, SX4I[i].int4);
 }
 
 
@@ -6708,9 +6724,9 @@ double opt_print_gif_transparent(OPT_ARGS_NUM)
 
 #define CCC(col,but)							\
   if(WID && (action & GMSH_GUI)){					\
-    Fl_Color c = fl_color_cube(UNPACK_RED(col)*FL_NUM_RED/256, 		\
-			       UNPACK_GREEN(col)*FL_NUM_GREEN/256,	\
-			       UNPACK_BLUE(col)*FL_NUM_BLUE/256);	\
+    Fl_Color c = fl_color_cube(CTX.UNPACK_RED(col)*FL_NUM_RED/256, 	\
+			       CTX.UNPACK_GREEN(col)*FL_NUM_GREEN/256,	\
+			       CTX.UNPACK_BLUE(col)*FL_NUM_BLUE/256);	\
     (but)->color(c);							\
     (but)->labelcolor(fl_contrast(FL_BLACK,c));				\
     (but)->redraw();							\
diff --git a/Common/Options.h b/Common/Options.h
index fb51fa38cc79a047d78179418954b578bf5ff5f5..9c482a1287903d46c0f9f16cbd227259cc34cd58 100644
--- a/Common/Options.h
+++ b/Common/Options.h
@@ -718,7 +718,10 @@ typedef struct {
   int level;
   char *str ; 
   unsigned int (*function)(int num, int action, unsigned int val) ;
-  unsigned int def1, def2, def3 ;
+  // the defaults are stored in individual bytes so that we can initialize
+  // them statically independently of the machine endianness. They will be
+  // packed into unsigned ints at runtime
+  unsigned char def1[4], def2[4], def3[4] ;
   char *help ;
 } StringXColor ;
 
diff --git a/Common/VertexArray.cpp b/Common/VertexArray.cpp
index 064903560804021623bcc66b60b1b79644deec21..7fd207970739644768eb6ba1170b6ac1349db751 100644
--- a/Common/VertexArray.cpp
+++ b/Common/VertexArray.cpp
@@ -1,4 +1,4 @@
-// $Id: VertexArray.cpp,v 1.8 2005-10-09 17:45:37 geuzaine Exp $
+// $Id: VertexArray.cpp,v 1.9 2005-12-22 20:42:41 geuzaine Exp $
 //
 // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
 //
@@ -24,6 +24,8 @@
 #include "Context.h"
 #include "Numeric.h"
 
+extern Context_T CTX;
+
 VertexArray::VertexArray(int numNodesPerElement, int numElements) 
 {
   type = numNodesPerElement;
@@ -50,10 +52,10 @@ VertexArray::~VertexArray()
 void VertexArray::add(float x, float y, float z, 
 		      float n0, float n1, float n2, unsigned int col)
 {
-  unsigned char r = UNPACK_RED(col);
-  unsigned char g = UNPACK_GREEN(col);
-  unsigned char b = UNPACK_BLUE(col);
-  unsigned char a = UNPACK_ALPHA(col);
+  unsigned char r = CTX.UNPACK_RED(col);
+  unsigned char g = CTX.UNPACK_GREEN(col);
+  unsigned char b = CTX.UNPACK_BLUE(col);
+  unsigned char a = CTX.UNPACK_ALPHA(col);
   List_Add(vertices, &x);
   List_Add(vertices, &y);
   List_Add(vertices, &z);
@@ -68,10 +70,10 @@ void VertexArray::add(float x, float y, float z,
 
 void VertexArray::add(float x, float y, float z, unsigned int col)
 {
-  unsigned char r = UNPACK_RED(col);
-  unsigned char g = UNPACK_GREEN(col);
-  unsigned char b = UNPACK_BLUE(col);
-  unsigned char a = UNPACK_ALPHA(col);
+  unsigned char r = CTX.UNPACK_RED(col);
+  unsigned char g = CTX.UNPACK_GREEN(col);
+  unsigned char b = CTX.UNPACK_BLUE(col);
+  unsigned char a = CTX.UNPACK_ALPHA(col);
   List_Add(vertices, &x);
   List_Add(vertices, &y);
   List_Add(vertices, &z);
diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp
index 9f7b189fb92128d62717dcb6d57f24ea51d68b17..e67b477e0e9089dd8d8959df4bfd46a61b05442d 100644
--- a/Fltk/Callbacks.cpp
+++ b/Fltk/Callbacks.cpp
@@ -1,4 +1,4 @@
-// $Id: Callbacks.cpp,v 1.388 2005-12-18 22:13:26 geuzaine Exp $
+// $Id: Callbacks.cpp,v 1.389 2005-12-22 20:42:41 geuzaine Exp $
 //
 // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
 //
@@ -113,11 +113,11 @@ void color_cb(CALLBACK_ARGS)
 {
   unsigned int (*fct) (int, int, unsigned int);
   fct = (unsigned int (*)(int, int, unsigned int))data;
-  uchar r = UNPACK_RED(fct(0, GMSH_GET, 0));
-  uchar g = UNPACK_GREEN(fct(0, GMSH_GET, 0));
-  uchar b = UNPACK_BLUE(fct(0, GMSH_GET, 0));
+  uchar r = CTX.UNPACK_RED(fct(0, GMSH_GET, 0));
+  uchar g = CTX.UNPACK_GREEN(fct(0, GMSH_GET, 0));
+  uchar b = CTX.UNPACK_BLUE(fct(0, GMSH_GET, 0));
   if(fl_color_chooser("Color Chooser", r, g, b))
-    fct(0, GMSH_SET | GMSH_GUI, PACK_COLOR(r, g, b, 255));
+    fct(0, GMSH_SET | GMSH_GUI, CTX.PACK_COLOR(r, g, b, 255));
   Draw();
 }
 
@@ -125,11 +125,11 @@ void view_color_cb(CALLBACK_ARGS)
 {
   unsigned int (*fct) (int, int, unsigned int);
   fct = (unsigned int (*)(int, int, unsigned int))data;
-  uchar r = UNPACK_RED(fct(WID->view_number, GMSH_GET, 0));
-  uchar g = UNPACK_GREEN(fct(WID->view_number, GMSH_GET, 0));
-  uchar b = UNPACK_BLUE(fct(WID->view_number, GMSH_GET, 0));
+  uchar r = CTX.UNPACK_RED(fct(WID->view_number, GMSH_GET, 0));
+  uchar g = CTX.UNPACK_GREEN(fct(WID->view_number, GMSH_GET, 0));
+  uchar b = CTX.UNPACK_BLUE(fct(WID->view_number, GMSH_GET, 0));
   if(fl_color_chooser("Color Chooser", r, g, b))
-    fct(WID->view_number, GMSH_SET | GMSH_GUI, PACK_COLOR(r, g, b, 255));
+    fct(WID->view_number, GMSH_SET | GMSH_GUI, CTX.PACK_COLOR(r, g, b, 255));
   Draw();
 }
 
diff --git a/Fltk/Colorbar_Window.cpp b/Fltk/Colorbar_Window.cpp
index 99585a2b36dfa7aedcb322650489c07942022467..d377dac8c558a5609842f1fa632207433a16705a 100644
--- a/Fltk/Colorbar_Window.cpp
+++ b/Fltk/Colorbar_Window.cpp
@@ -1,4 +1,4 @@
-// $Id: Colorbar_Window.cpp,v 1.48 2005-01-01 19:35:27 geuzaine Exp $
+// $Id: Colorbar_Window.cpp,v 1.49 2005-12-22 20:42:41 geuzaine Exp $
 //
 // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
 //
@@ -139,11 +139,11 @@ void Colorbar_Window::redraw_range(int a, int b)
   for(i = a; i <= b; i++) {
     x = index_to_x(i);
     if(ct->ipar[COLORTABLE_MODE] == COLORTABLE_RGB)
-      intensity = UNPACK_RED(ct->table[i]);
+      intensity = CTX.UNPACK_RED(ct->table[i]);
     else if(ct->ipar[COLORTABLE_MODE] == COLORTABLE_HSV) {
-      RGB_to_HSV(UNPACK_RED(ct->table[i]) / 255.,
-                 UNPACK_GREEN(ct->table[i]) / 255.,
-                 UNPACK_BLUE(ct->table[i]) / 255., &H, &S, &V);
+      RGB_to_HSV(CTX.UNPACK_RED(ct->table[i]) / 255.,
+                 CTX.UNPACK_GREEN(ct->table[i]) / 255.,
+                 CTX.UNPACK_BLUE(ct->table[i]) / 255., &H, &S, &V);
       intensity = (int)(H / 6. * 255. + EPS);
     }
     y = intensity_to_y(intensity);
@@ -159,11 +159,11 @@ void Colorbar_Window::redraw_range(int a, int b)
   for(i = a; i <= b; i++) {
     x = index_to_x(i);
     if(ct->ipar[COLORTABLE_MODE] == COLORTABLE_RGB)
-      intensity = UNPACK_GREEN(ct->table[i]);
+      intensity = CTX.UNPACK_GREEN(ct->table[i]);
     else if(ct->ipar[COLORTABLE_MODE] == COLORTABLE_HSV) {
-      RGB_to_HSV(UNPACK_RED(ct->table[i]) / 255.,
-                 UNPACK_GREEN(ct->table[i]) / 255.,
-                 UNPACK_BLUE(ct->table[i]) / 255., &H, &S, &V);
+      RGB_to_HSV(CTX.UNPACK_RED(ct->table[i]) / 255.,
+                 CTX.UNPACK_GREEN(ct->table[i]) / 255.,
+                 CTX.UNPACK_BLUE(ct->table[i]) / 255., &H, &S, &V);
       intensity = (int)(S * 255.);
     }
     y = intensity_to_y(intensity);
@@ -179,11 +179,11 @@ void Colorbar_Window::redraw_range(int a, int b)
   for(i = a; i <= b; i++) {
     x = index_to_x(i);
     if(ct->ipar[COLORTABLE_MODE] == COLORTABLE_RGB)
-      intensity = UNPACK_BLUE(ct->table[i]);
+      intensity = CTX.UNPACK_BLUE(ct->table[i]);
     else if(ct->ipar[COLORTABLE_MODE] == COLORTABLE_HSV) {
-      RGB_to_HSV(UNPACK_RED(ct->table[i]) / 255.,
-                 UNPACK_GREEN(ct->table[i]) / 255.,
-                 UNPACK_BLUE(ct->table[i]) / 255., &H, &S, &V);
+      RGB_to_HSV(CTX.UNPACK_RED(ct->table[i]) / 255.,
+                 CTX.UNPACK_GREEN(ct->table[i]) / 255.,
+                 CTX.UNPACK_BLUE(ct->table[i]) / 255., &H, &S, &V);
       intensity = (int)(V * 255.);
     }
     y = intensity_to_y(intensity);
@@ -198,7 +198,7 @@ void Colorbar_Window::redraw_range(int a, int b)
   // draw alpha levels
   for(i = a; i <= b; i++) {
     x = index_to_x(i);
-    y = intensity_to_y(UNPACK_ALPHA(ct->table[i]));
+    y = intensity_to_y(CTX.UNPACK_ALPHA(ct->table[i]));
     if(i != a) {
       fl_color(fl_contrast(FL_BLACK, color_bg));
       fl_line(px, py, x, y);
@@ -213,9 +213,9 @@ void Colorbar_Window::redraw_range(int a, int b)
     unsigned int color;
     i = x_to_index(x);
     color = ct->table[i];
-    r = UNPACK_RED(color);
-    g = UNPACK_GREEN(color);
-    b = UNPACK_BLUE(color);
+    r = CTX.UNPACK_RED(color);
+    g = CTX.UNPACK_GREEN(color);
+    b = CTX.UNPACK_BLUE(color);
     fl_color(r, g, b);
     fl_line(x, wedge_y, x, wedge_y + wedge_height - 1);
   }
@@ -318,9 +318,9 @@ void Colorbar_Window::draw()
     label_y = h() - 5;
     marker_y = label_y - marker_height - font_height;
     wedge_y = marker_y - wedge_height;
-    color_bg = fl_color_cube(UNPACK_RED(CTX.color.bg) * FL_NUM_RED / 256,
-                             UNPACK_GREEN(CTX.color.bg) * FL_NUM_GREEN / 256,
-                             UNPACK_BLUE(CTX.color.bg) * FL_NUM_BLUE / 256);
+    color_bg = fl_color_cube(CTX.UNPACK_RED(CTX.color.bg) * FL_NUM_RED / 256,
+                             CTX.UNPACK_GREEN(CTX.color.bg) * FL_NUM_GREEN / 256,
+                             CTX.UNPACK_BLUE(CTX.color.bg) * FL_NUM_BLUE / 256);
     redraw_range(0, ct->size - 1);
     redraw_marker();
   }
@@ -633,10 +633,10 @@ int Colorbar_Window::handle(int event)
         int red, green, blue, alpha;
         double R, G, B, H, S, V;
 
-        red = UNPACK_RED(ct->table[i]);
-        green = UNPACK_GREEN(ct->table[i]);
-        blue = UNPACK_BLUE(ct->table[i]);
-        alpha = UNPACK_ALPHA(ct->table[i]);
+        red = CTX.UNPACK_RED(ct->table[i]);
+        green = CTX.UNPACK_GREEN(ct->table[i]);
+        blue = CTX.UNPACK_BLUE(ct->table[i]);
+        alpha = CTX.UNPACK_ALPHA(ct->table[i]);
 
         if(ct->ipar[COLORTABLE_MODE] == COLORTABLE_RGB) {
           if(p1) {
@@ -673,7 +673,7 @@ int Colorbar_Window::handle(int event)
           blue = (int)(255 * B);
         }
 
-        ct->table[i] = PACK_COLOR(red, green, blue, alpha);
+        ct->table[i] = CTX.PACK_COLOR(red, green, blue, alpha);
       }
 
       // redraw the color curves
diff --git a/Graphics/CreateFile.cpp b/Graphics/CreateFile.cpp
index 499a44dfff09a9cc883d190b654f276c70a8b62c..0acba96fb6b4d6f5e12038d04c66047429b79221 100644
--- a/Graphics/CreateFile.cpp
+++ b/Graphics/CreateFile.cpp
@@ -1,4 +1,4 @@
-// $Id: CreateFile.cpp,v 1.74 2005-12-16 20:29:15 geuzaine Exp $
+// $Id: CreateFile.cpp,v 1.75 2005-12-22 20:42:42 geuzaine Exp $
 //
 // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
 //
@@ -184,8 +184,9 @@ void CreateOutputFile(char *name, int format)
 		 CTX.print.gif_sort,
 		 CTX.print.gif_interlace,
 		 CTX.print.gif_transparent,
-		 UNPACK_RED(CTX.color.bg),
-		 UNPACK_GREEN(CTX.color.bg), UNPACK_BLUE(CTX.color.bg));
+		 CTX.UNPACK_RED(CTX.color.bg),
+		 CTX.UNPACK_GREEN(CTX.color.bg), 
+		 CTX.UNPACK_BLUE(CTX.color.bg));
       Msg(INFO, "Wrote GIF file '%s'", name);
     }
     Msg(STATUS2N, "Wrote '%s'", name);
diff --git a/Graphics/Draw.cpp b/Graphics/Draw.cpp
index 79ab3b05f6b26807e91b68b635dc81eae79cdcbf..d2ddec8235f4fe0851bad7e6ebf466bf7e8c38b7 100644
--- a/Graphics/Draw.cpp
+++ b/Graphics/Draw.cpp
@@ -1,4 +1,4 @@
-// $Id: Draw.cpp,v 1.91 2005-12-21 23:09:52 geuzaine Exp $
+// $Id: Draw.cpp,v 1.92 2005-12-22 20:42:42 geuzaine Exp $
 //
 // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
 //
@@ -125,9 +125,9 @@ void DrawPlugin(void (*draw)(void))
 
 void ClearOpengl(void)
 {
-  glClearColor(UNPACK_RED(CTX.color.bg) / 255.,
-               UNPACK_GREEN(CTX.color.bg) / 255.,
-               UNPACK_BLUE(CTX.color.bg) / 255., 0.);
+  glClearColor(CTX.UNPACK_RED(CTX.color.bg) / 255.,
+               CTX.UNPACK_GREEN(CTX.color.bg) / 255.,
+               CTX.UNPACK_BLUE(CTX.color.bg) / 255., 0.);
   glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
 }
 
@@ -269,21 +269,21 @@ void InitRenderModel(void)
 			     (GLfloat)CTX.light_position[i][3]};
       glLightfv((GLenum)(GL_LIGHT0 + i), GL_POSITION, position);
 
-      r = UNPACK_RED(CTX.color.ambient_light[i])/255.;
-      g = UNPACK_GREEN(CTX.color.ambient_light[i])/255.;
-      b = UNPACK_BLUE(CTX.color.ambient_light[i])/255.;
+      r = CTX.UNPACK_RED(CTX.color.ambient_light[i])/255.;
+      g = CTX.UNPACK_GREEN(CTX.color.ambient_light[i])/255.;
+      b = CTX.UNPACK_BLUE(CTX.color.ambient_light[i])/255.;
       GLfloat ambient[4] = {r, g, b, 1.0};
       glLightfv((GLenum)(GL_LIGHT0 + i), GL_AMBIENT, ambient);
 
-      r = UNPACK_RED(CTX.color.diffuse_light[i])/255.;
-      g = UNPACK_GREEN(CTX.color.diffuse_light[i])/255.;
-      b = UNPACK_BLUE(CTX.color.diffuse_light[i])/255.;
+      r = CTX.UNPACK_RED(CTX.color.diffuse_light[i])/255.;
+      g = CTX.UNPACK_GREEN(CTX.color.diffuse_light[i])/255.;
+      b = CTX.UNPACK_BLUE(CTX.color.diffuse_light[i])/255.;
       GLfloat diffuse[4] = {r, g, b, 1.0};
       glLightfv((GLenum)(GL_LIGHT0 + i), GL_DIFFUSE, diffuse);
 
-      r = UNPACK_RED(CTX.color.specular_light[i])/255.;
-      g = UNPACK_GREEN(CTX.color.specular_light[i])/255.;
-      b = UNPACK_BLUE(CTX.color.specular_light[i])/255.;
+      r = CTX.UNPACK_RED(CTX.color.specular_light[i])/255.;
+      g = CTX.UNPACK_GREEN(CTX.color.specular_light[i])/255.;
+      b = CTX.UNPACK_BLUE(CTX.color.specular_light[i])/255.;
       GLfloat specular[4] = {r, g, b, 1.0};
       glLightfv((GLenum)(GL_LIGHT0 + i), GL_SPECULAR, specular);
 
diff --git a/Parser/Gmsh.tab.cpp b/Parser/Gmsh.tab.cpp
index 2dc394cd377ad19b8188195bd59c0a1f84112fa3..314e7d0857906cd76f5f6ffd208b53e505817a73 100644
--- a/Parser/Gmsh.tab.cpp
+++ b/Parser/Gmsh.tab.cpp
@@ -168,7 +168,7 @@
 
 #line 1 "Gmsh.y"
 
-// $Id: Gmsh.tab.cpp,v 1.245 2005-11-28 19:13:49 geuzaine Exp $
+// $Id: Gmsh.tab.cpp,v 1.246 2005-12-22 20:42:42 geuzaine Exp $
 //
 // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
 //
@@ -6703,13 +6703,13 @@ case 350:
 case 351:
 #line 3487 "Gmsh.y"
 {
-      yyval.u = PACK_COLOR((int)yyvsp[-7].d, (int)yyvsp[-5].d, (int)yyvsp[-3].d, (int)yyvsp[-1].d);
+      yyval.u = CTX.PACK_COLOR((int)yyvsp[-7].d, (int)yyvsp[-5].d, (int)yyvsp[-3].d, (int)yyvsp[-1].d);
     ;
     break;}
 case 352:
 #line 3491 "Gmsh.y"
 {
-      yyval.u = PACK_COLOR((int)yyvsp[-5].d, (int)yyvsp[-3].d, (int)yyvsp[-1].d, 255);
+      yyval.u = CTX.PACK_COLOR((int)yyvsp[-5].d, (int)yyvsp[-3].d, (int)yyvsp[-1].d, 255);
     ;
     break;}
 case 353:
diff --git a/Parser/Gmsh.y b/Parser/Gmsh.y
index b1f3d164e4e37075367e15c45120616a64e6e659..dc02828c8fc05afc7dfb42ea1c2c65f063a57d45 100644
--- a/Parser/Gmsh.y
+++ b/Parser/Gmsh.y
@@ -1,5 +1,5 @@
 %{
-// $Id: Gmsh.y,v 1.213 2005-11-28 19:13:50 geuzaine Exp $
+// $Id: Gmsh.y,v 1.214 2005-12-22 20:42:45 geuzaine Exp $
 //
 // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
 //
@@ -3485,11 +3485,11 @@ RecursiveListOfDouble :
 ColorExpr :
     '{' FExpr ',' FExpr ',' FExpr ',' FExpr '}'
     {
-      $$ = PACK_COLOR((int)$2, (int)$4, (int)$6, (int)$8);
+      $$ = CTX.PACK_COLOR((int)$2, (int)$4, (int)$6, (int)$8);
     }
   | '{' FExpr ',' FExpr ',' FExpr '}'
     {
-      $$ = PACK_COLOR((int)$2, (int)$4, (int)$6, 255);
+      $$ = CTX.PACK_COLOR((int)$2, (int)$4, (int)$6, 255);
     }
 /* shift/reduce conflict
   | '{' tSTRING ',' FExpr '}'
diff --git a/Parser/Gmsh.yy.cpp b/Parser/Gmsh.yy.cpp
index 599860550bc790f71d3a7488f17db497839cb10d..78640ed96aec03fa7ab50a1b5e18bd7912f177e2 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.244 2005-11-28 19:13:51 geuzaine Exp $
+ * $Header: /cvsroot/gmsh/Parser/Gmsh.yy.cpp,v 1.245 2005-12-22 20:42:45 geuzaine Exp $
  */
 
 #define FLEX_SCANNER
@@ -1026,7 +1026,7 @@ char *yytext;
 #line 1 "Gmsh.l"
 #define INITIAL 0
 #line 2 "Gmsh.l"
-// $Id: Gmsh.yy.cpp,v 1.244 2005-11-28 19:13:51 geuzaine Exp $
+// $Id: Gmsh.yy.cpp,v 1.245 2005-12-22 20:42:45 geuzaine Exp $
 //
 // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
 //
diff --git a/configure b/configure
index 998c97afe425bac63a8340e70256f97085ace5c8..bb1f617334290d86ef8635b90ecf5d04b9929a24 100755
--- a/configure
+++ b/configure
@@ -4240,237 +4240,6 @@ if test "x$enable_parallel" = "xyes"; then
   FLAGS="-DHAVE_PARALLEL ${FLAGS}"
 fi
 
-if test "x$UNAME" = "xDarwin"; then
-      echo "detected Darwin... no need to check byte ordering"
-else
-  echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5
-echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6
-if test "${ac_cv_c_bigendian+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  # See if sys/param.h defines the BYTE_ORDER macro.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/types.h>
-#include <sys/param.h>
-
-int
-main ()
-{
-#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
- bogus endian macros
-#endif
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  # It does; now see whether it defined to BIG_ENDIAN or not.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/types.h>
-#include <sys/param.h>
-
-int
-main ()
-{
-#if BYTE_ORDER != BIG_ENDIAN
- not big endian
-#endif
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_c_bigendian=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_c_bigendian=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-# It does not; compile a test program.
-if test "$cross_compiling" = yes; then
-  # try to guess the endianness by grepping values into an object file
-  ac_cv_c_bigendian=unknown
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
-short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
-void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; }
-short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
-short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
-void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; }
-int
-main ()
-{
- _ascii (); _ebcdic ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then
-  ac_cv_c_bigendian=yes
-fi
-if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
-  if test "$ac_cv_c_bigendian" = unknown; then
-    ac_cv_c_bigendian=no
-  else
-    # finding both strings is unlikely to happen, but who knows?
-    ac_cv_c_bigendian=unknown
-  fi
-fi
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-int
-main ()
-{
-  /* Are we little or big endian?  From Harbison&Steele.  */
-  union
-  {
-    long l;
-    char c[sizeof (long)];
-  } u;
-  u.l = 1;
-  exit (u.c[sizeof (long) - 1] == 1);
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_c_bigendian=no
-else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-ac_cv_c_bigendian=yes
-fi
-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5
-echo "${ECHO_T}$ac_cv_c_bigendian" >&6
-case $ac_cv_c_bigendian in
-  yes)
-    FLAGS="-D__BIG_ENDIAN__ ${FLAGS}" ;;
-  no)
-     ;;
-  *)
-    { { echo "$as_me:$LINENO: error: unknown endianness
-presetting ac_cv_c_bigendian=no (or yes) will help" >&5
-echo "$as_me: error: unknown endianness
-presetting ac_cv_c_bigendian=no (or yes) will help" >&2;}
-   { (exit 1); exit 1; }; } ;;
-esac
-
-fi
-
 LINKER="${CXX}"
 POSTBUILD=""
 
diff --git a/configure.in b/configure.in
index 4ab0cb243074c22c31f39f7a634d142ee7ec199e..ce89980e64d15a3a1c183cbae3da3b76083e1990 100644
--- a/configure.in
+++ b/configure.in
@@ -1,4 +1,4 @@
-dnl $Id: configure.in,v 1.83 2005-11-26 16:01:10 geuzaine Exp $
+dnl $Id: configure.in,v 1.84 2005-12-22 20:42:41 geuzaine Exp $
 dnl
 dnl Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
 dnl
@@ -444,15 +444,6 @@ if test "x$enable_parallel" = "xyes"; then
   FLAGS="-DHAVE_PARALLEL ${FLAGS}"
 fi
 
-dnl Check if the machine is big or little endian
-if test "x$UNAME" = "xDarwin"; then
-  dnl Apple guarantees that its compilers will define the macro: forcing
-  dnl the definition here would prevent building "universal" binaries
-  echo "detected Darwin... no need to check byte ordering"
-else
-  AC_C_BIGENDIAN(FLAGS="-D__BIG_ENDIAN__ ${FLAGS}")
-fi
-
 dnl Set default linker and post build action
 LINKER="${CXX}"
 POSTBUILD=""