Index: trunk/SophyaLib/BaseTools/datatype.cc
===================================================================
--- trunk/SophyaLib/BaseTools/datatype.cc	(revision 3741)
+++ trunk/SophyaLib/BaseTools/datatype.cc	(revision 3750)
@@ -31,4 +31,8 @@
   else if (typeid(T) == typeid(complex<r_4>)) return(" complex<r_4> ");
   else if (typeid(T) == typeid(complex<r_8>)) return(" complex<r_8> ");
+#ifdef SO_LDBLE128
+  else if (typeid(T) == typeid(r_16)) return("r_16");
+  else if (typeid(T) == typeid(complex<r_16>)) return(" complex<r_16> ");
+#endif
   else return("???unknowntype???");
 }
@@ -48,4 +52,8 @@
   else if (typeid(T) == typeid(complex<r_4>)) return(11);
   else if (typeid(T) == typeid(complex<r_8>)) return(12);
+#ifdef SO_LDBLE128
+  else if (typeid(T) == typeid(r_16)) return(13);
+  else if (typeid(T) == typeid(complex<r_16>)) return(14);
+#endif
   else return(0);
 }
@@ -78,5 +86,10 @@
 DECL_TEMP_SPEC
 string DataTypeInfo< complex<r_8> >::getTypeName() { return(" complex<r_8> "); }
-
+#ifdef SO_LDBLE128
+DECL_TEMP_SPEC
+string DataTypeInfo<r_16>::getTypeName() { return("r_16"); }
+DECL_TEMP_SPEC
+string DataTypeInfo< complex<r_16> >::getTypeName() { return(" complex<r_16> "); }
+#endif
 /*! 
   \ brief Return an identifier associated to T 
@@ -114,4 +127,11 @@
 DECL_TEMP_SPEC
 int DataTypeInfo< complex<r_8> >::getTypeId() { return(12); }
+#ifdef SO_LDBLE128
+DECL_TEMP_SPEC
+int DataTypeInfo<r_16>::getTypeId() { return(13); }
+DECL_TEMP_SPEC
+int DataTypeInfo< complex<r_16> >::getTypeId() { return(14); }
+#endif
+
 #endif
 
@@ -185,4 +205,9 @@
 #pragma define_template DataTypeInfo< complex<r_4> >
 #pragma define_template DataTypeInfo< complex<r_8> >
+#ifdef SO_LDBLE128
+#pragma define_template DataTypeInfo<r_16>
+#pragma define_template DataTypeInfo< complex<r_16> >
+#endif
+
 #endif
 
@@ -200,4 +225,9 @@
 template class DataTypeInfo< complex<r_4> >;
 template class DataTypeInfo< complex<r_8> >;
+#ifdef SO_LDBLE128
+template class DataTypeInfo<r_16>;
+template class DataTypeInfo< complex<r_16> >;
+#endif
+
 #endif
 
Index: trunk/SophyaLib/BaseTools/fiondblock.cc
===================================================================
--- trunk/SophyaLib/BaseTools/fiondblock.cc	(revision 3741)
+++ trunk/SophyaLib/BaseTools/fiondblock.cc	(revision 3750)
@@ -139,4 +139,11 @@
 inline void PIOSReadArray(PInPersist & is, complex<double> * arr, size_t n)
 { r_8 * pr = (r_8 *)arr; is.Get(pr, n*2); }
+#ifdef SO_LDBLE128
+// ces fonctions ne devraient jamais etre appelees ( pas de r_16 en V_PPF <= 3 ) 
+inline void PIOSReadArray(PInPersist & is, r_16 * arr, size_t n)  
+{ is.Get(arr, n); }  
+inline void PIOSReadArray(PInPersist & is, complex<long double> * arr, size_t n)
+{ r_16 * pr = (r_16 *)arr; is.Get(pr, n*2); }
+#endif
 //---------------------------------------------------------------------------
 
@@ -196,4 +203,9 @@
 #pragma define_template FIO_NDataBlock< complex<r_4> >
 #pragma define_template FIO_NDataBlock< complex<r_8> >
+#ifdef SO_LDBLE128
+#pragma define_template FIO_NDataBlock<r_16>
+#pragma define_template FIO_NDataBlock< complex<r_16> >
+#endif
+
 #endif
 
@@ -213,4 +225,8 @@
 template class FIO_NDataBlock< complex<r_4> >;
 template class FIO_NDataBlock< complex<r_8> >;
-}
-#endif
+#ifdef SO_LDBLE128
+template class FIO_NDataBlock<r_16>;
+template class FIO_NDataBlock< complex<r_16> >;
+#endif
+}
+#endif
Index: trunk/SophyaLib/BaseTools/machdefs_mkmf.h
===================================================================
--- trunk/SophyaLib/BaseTools/machdefs_mkmf.h	(revision 3741)
+++ trunk/SophyaLib/BaseTools/machdefs_mkmf.h	(revision 3750)
@@ -6,4 +6,5 @@
   - SO_NOFPIC  : disable fPIC flag (Position Independent Code) default fPIC enabled 
   - SO_SASIZET64 : select 64 bits size for array indices (default 32 bits)
+  - SO_LDBLE128  : enable support for 128 bits floating point numbers (default NO 128 bits floats)
   - SO_BOUNDCHECKING : activate bound checking (in accessing array elements)
   - SOPHYA_DEBUG : debug flag ( --> if set, SO_BOUNDCHECKING is also set)
@@ -83,4 +84,8 @@
 typedef float r_4;
 typedef double r_8;
+#ifdef SO_LDBLE128
+/* 128 bits floating point numbers */
+typedef long double r_16;
+#endif
 
 /* --------------------------------------------------------------- */
Index: trunk/SophyaLib/BaseTools/mutyv.h
===================================================================
--- trunk/SophyaLib/BaseTools/mutyv.h	(revision 3741)
+++ trunk/SophyaLib/BaseTools/mutyv.h	(revision 3750)
@@ -64,11 +64,16 @@
   inline MuTyV & operator= (r_4 v)  { typ = MTVFloat; dv = (r_8)v; iv = (int_8)v;  dv_im = 0.;  return(*this); }
   inline MuTyV & operator= (r_8 v) { typ = MTVFloat; dv = v; iv = (int_8)v;  dv_im = 0.;  return(*this); }
-  inline MuTyV & operator= (complex<r_4> const& v) { typ = MTVComplex; dv = (r_8)v.real();  dv_im = v.imag();
+  inline MuTyV & operator= (complex<r_4> const& v) { typ = MTVComplex; dv = (r_8)v.real();  dv_im = (r_8)v.imag();
                                                     iv = (int_8)dv;  return(*this); }
   inline MuTyV & operator= (complex<r_8> const& v) { typ = MTVComplex; dv = (r_8)v.real();  dv_im = v.imag();
                                                     iv = (int_8)dv;  return(*this); }
-         const char*  operator= (const char* s);
-         string const& operator= (string const & s);
-         TimeStamp const& operator= (TimeStamp const & s);
+#ifdef SO_LDBLE128
+  inline MuTyV & operator= (r_16 v) { typ = MTVFloat; dv = (r_8)v; iv = (int_8)v;  dv_im = 0.;  return(*this); }
+  inline MuTyV & operator= (complex<r_16> const& v) { typ = MTVComplex; dv = (r_8)v.real();  dv_im = (r_8)v.imag();
+                                                    iv = (int_8)dv;  return(*this); }
+#endif
+  const char*  operator= (const char* s);
+  string const& operator= (string const & s);
+  TimeStamp const& operator= (TimeStamp const & s);
 
   inline operator uint_1() const { return((uint_1)iv); }
@@ -84,7 +89,11 @@
   inline operator complex<r_4>() const { return(complex<r_4>((r_4)dv, (r_4)dv_im)); }
   inline operator complex<r_8>() const { return(complex<r_8>(dv, dv_im)); }
+#ifdef SO_LDBLE128
+  inline operator r_16() const  { return((r_16)dv); }
+  inline operator complex<r_16>() const { return(complex<r_16>((r_16)dv, (r_16)dv_im)); }
+#endif
 
-         operator string() const ; 
-         operator TimeStamp() const ; 
+  operator string() const ; 
+  operator TimeStamp() const ; 
 
   inline uint_1 Convert(uint_1& x) const { x = (uint_1)iv; return x; }
@@ -102,5 +111,9 @@
   inline complex<r_8> Convert(complex<r_8> & x) const 
     { x = complex< r_8 > (dv, dv_im); return x; }
-  
+#ifdef SO_LDBLE128
+  inline r_16 Convert(r_16& x) const { x = (r_16)dv; return x; }
+  inline complex<r_16> Convert(complex<r_16> & x) const 
+    { x = complex< r_16 > ((r_16)dv, (r_16)dv_im); return x; }
+#endif  
   string&  Convert(string& x) const ; 
   TimeStamp& Convert(TimeStamp& x) const ; 
Index: trunk/SophyaLib/BaseTools/ndatablock.cc
===================================================================
--- trunk/SophyaLib/BaseTools/ndatablock.cc	(revision 3741)
+++ trunk/SophyaLib/BaseTools/ndatablock.cc	(revision 3750)
@@ -822,4 +822,9 @@
 #pragma define_template NDataBlock< complex<r_4> >
 #pragma define_template NDataBlock< complex<r_8> >
+#ifdef SO_LDBLE128
+#pragma define_template NDataBlock<r_16>
+#pragma define_template NDataBlock< complex<r_16> >
+#endif
+
 #endif
 
@@ -838,4 +843,8 @@
 template class NDataBlock< complex<r_4> >;
 template class NDataBlock< complex<r_8> >;
-}
+#ifdef SO_LDBLE128
+template class NDataBlock<r_16>;
+template class NDataBlock< complex<r_16> >;
 #endif
+}
+#endif
Index: trunk/SophyaLib/BaseTools/ppfbinstream.cc
===================================================================
--- trunk/SophyaLib/BaseTools/ppfbinstream.cc	(revision 3741)
+++ trunk/SophyaLib/BaseTools/ppfbinstream.cc	(revision 3750)
@@ -21,4 +21,27 @@
 
 
+static inline void bswap16(void* p)
+{
+  uint_8* p8 = (uint_8*)p;
+  uint_8 tmp1 = *(p8);
+  uint_8 tmp = *(p8+1);
+  *(p8)   = ((tmp >> (7*8)) & 0x000000FF) | 
+            ((tmp >> (5*8)) & 0x0000FF00) |
+            ((tmp >> (3*8)) & 0x00FF0000) |
+            ((tmp >> (1*8)) & 0xFF000000) |
+            ((tmp & 0xFF000000) << (1*8))  |
+            ((tmp & 0x00FF0000) << (3*8))  |
+            ((tmp & 0x0000FF00) << (5*8))  |
+            ((tmp & 0x000000FF) << (7*8));
+  *(p8+1) = ((tmp1 >> (7*8)) & 0x000000FF) | 
+            ((tmp1 >> (5*8)) & 0x0000FF00) |
+            ((tmp1 >> (3*8)) & 0x00FF0000) |
+            ((tmp1 >> (1*8)) & 0xFF000000) |
+            ((tmp1 & 0xFF000000) << (1*8))  |
+            ((tmp1 & 0x00FF0000) << (3*8))  |
+            ((tmp1 & 0x0000FF00) << (5*8))  |
+            ((tmp1 & 0x000000FF) << (7*8));
+}
+
 static inline void bswap8(void* p)
 {
@@ -48,4 +71,27 @@
   *(uint_2*)p = ((tmp >> 8) & 0x00FF) | 
                 ((tmp & 0x00FF) << 8);
+}
+
+// Convertit la taille de donnees (2 (int_2), 4 (int_4, r_4), 8 (r_8) ...) en taille codee dans le tag
+static inline unsigned char datasize2tagsize( unsigned char sz) 
+{
+  // Taille permises 1,2,4,8,16 
+  // Pour les tailles <= 8, c'est directement la taille
+  if (sz<=8) return sz;
+  else {
+    if (sz==16) return 10;
+    else return 0;  // signale une erreur 
+  }
+}
+// Convertit la taille codee dans le tag en taille de donnees (2 (int_2), 4 (int_4, r_4), 8 (r_8) ...) en 
+static inline unsigned char tagsize2datasize( unsigned char sz) 
+{
+  // Taille permises 1,2,4,8,16 
+  // Pour les tailles <= 8, c'est directement la taille
+  if (sz<=8) return sz;
+  else {
+    if (sz==10) return 10;
+    else return 0;  // signale une erreur 
+  }
 }
 
@@ -653,15 +699,15 @@
 
 void
-PPFBinaryInputStream::CheckTag(short datasz, short datatype)
+PPFBinaryInputStream::CheckTag(unsigned char datasz, unsigned char datatype)
 // datatype = PPS_DATATYPE_CHAR or PPS_DATATYPE_FLOAT or PPS_DATATYPE_INTEGER or PPS_DATATYPE_UNSIGNED
 {
   unsigned char ppstype;
   GetTypeTag(ppstype);
-  if (ppstype != PPS_SIMPLE + datasz + datatype)
+  if (ppstype != PPS_SIMPLE + datasize2tagsize(datasz) + datatype)
     throw FileFormatExc("PPFBinaryInputStream::CheckTag   bad type in ppersist file");
 }
 
 void
-PPFBinaryInputStream::CheckArrayTag(short datasz, size_t sz, short datatype)
+PPFBinaryInputStream::CheckArrayTag(unsigned char datasz, size_t sz, unsigned char datatype)
 // datatype = PPS_DATATYPE_CHAR or PPS_DATATYPE_FLOAT or PPS_DATATYPE_INTEGER or PPS_DATATYPE_UNSIGNED
 {
@@ -670,10 +716,10 @@
   size_t filesz;
   if (sz <= 0x7fffffff) {
-    if (ppstype != PPS_SIMPLE_ARRAY4 + datasz + datatype)
+    if (ppstype != PPS_SIMPLE_ARRAY4 + datasize2tagsize(datasz) + datatype)
       throw FileFormatExc("PPFBinaryInputStream::CheckArrayTag   bad type in ppersist file");
     int_4 ff;
     GetRawI4(ff); filesz=ff;
   } else {
-    if (ppstype != PPS_SIMPLE_ARRAY8 + datasz + datatype)
+    if (ppstype != PPS_SIMPLE_ARRAY8 + datasize2tagsize(datasz) + datatype)
       throw FileFormatExc("PPFBinaryInputStream::CheckArrayTag   bad type in ppersist file");
     uint_8 ff;
@@ -691,5 +737,4 @@
 }
 
-
 void
 PPFBinaryInputStream::GetBytes(void* ptr, size_t bytes)
@@ -698,4 +743,5 @@
   GetRawBytes(ptr, bytes);
 }
+
 void
 PPFBinaryInputStream::GetR4   (r_4& result)
@@ -715,6 +761,5 @@
   if (bigEndian == IS_BIG_ENDIAN) return;
 
-  for (unsigned int i=0; i<n; i++)
-    bswap4(tab+i);
+  for (size_t i=0; i<n; i++)  bswap4(tab+i);
 
   return;
@@ -737,6 +782,5 @@
   if (bigEndian == IS_BIG_ENDIAN) return;
 
-  for (unsigned int i=0; i<n; i++)
-    bswap8(tab+i);
+  for (size_t i=0; i<n; i++)  bswap8(tab+i);
 
   return;
@@ -787,6 +831,5 @@
   if (bigEndian == IS_BIG_ENDIAN) return;
 
-  for (unsigned int i=0; i<n; i++)
-    bswap2(tab+i);
+  for (size_t i=0; i<n; i++)  bswap2(tab+i);
 
   return;
@@ -809,6 +852,5 @@
   if (bigEndian == IS_BIG_ENDIAN) return;
 
-  for (unsigned int i=0; i<n; i++)
-    bswap2(tab+i);
+  for (size_t i=0; i<n; i++)  bswap2(tab+i);
 
   return;
@@ -831,6 +873,5 @@
   if (bigEndian == IS_BIG_ENDIAN) return;
 
-  for (unsigned int i=0; i<n; i++)
-    bswap4(tab+i);
+  for (size_t i=0; i<n; i++)  bswap4(tab+i);
 
   return;
@@ -853,6 +894,5 @@
   if (bigEndian == IS_BIG_ENDIAN) return;
 
-  for (unsigned int i=0; i<n; i++)
-    bswap4(tab+i);
+  for (size_t i=0; i<n; i++)  bswap4(tab+i);
 
   return;
@@ -876,6 +916,5 @@
   if (bigEndian == IS_BIG_ENDIAN) return;
 
-  for (unsigned int i=0; i<n; i++)
-    bswap8(tab+i);
+  for (size_t i=0; i<n; i++)  bswap8(tab+i);
 
   return;
@@ -898,6 +937,5 @@
   if (bigEndian == IS_BIG_ENDIAN) return;
 
-  for (unsigned int i=0; i<n; i++)
-    bswap8(tab+i);
+  for (size_t i=0; i<n; i++)  bswap8(tab+i);
 
   return;
@@ -951,5 +989,5 @@
 
   r_4 * p = (r_4 *)tab;
-  for (unsigned int i=0; i<n; i++) {
+  for (size_t i=0; i<n; i++) {
     bswap4(p);  p++;
     bswap4(p);  p++;
@@ -979,5 +1017,5 @@
 
   r_8 * p = (r_8 *)tab;
-  for (unsigned int i=0; i<n; i++) {
+  for (size_t i=0; i<n; i++) {
     bswap8(p);  p++;
     bswap8(p);  p++;
@@ -986,4 +1024,55 @@
 }
 
+// Support pour les long double (128 bits floating point numbers)
+#ifdef SO_LDBLE128
+void
+PPFBinaryInputStream::GetR16  (r_16& result)
+{
+  CheckTag(16,PPS_DATATYPE_FLOAT);
+  GetRawBytes(&result, sizeof(r_16));
+  if (bigEndian != IS_BIG_ENDIAN)
+    bswap16(&result);
+}
+
+void
+PPFBinaryInputStream::GetR16s  (r_16* tab, size_t n)
+{
+  CheckArrayTag(16,n,PPS_DATATYPE_FLOAT);
+  GetRawBytes(tab, n*sizeof(r_16));
+  if (bigEndian == IS_BIG_ENDIAN) return;
+
+  for (size_t i=0; i<n; i++)  bswap16(tab+i);
+
+  return;
+}
+
+void
+PPFBinaryInputStream::GetZ16   (complex<r_16>& result)
+{
+  CheckTag(16,PPS_DATATYPE_COMPLEX);
+  r_16 reim[2];
+  GetRawBytes(reim, 2*sizeof(r_16));
+  if (bigEndian != IS_BIG_ENDIAN) {
+    bswap16(reim);
+    bswap16(reim+1);
+  }
+  result = complex<r_16>(reim[0], reim[1]);
+}
+
+void
+PPFBinaryInputStream::GetZ16s  (complex<r_16>* tab, size_t n)
+{
+  CheckArrayTag(16,n,PPS_DATATYPE_COMPLEX);
+  GetRawBytes(tab, n*2*sizeof(r_16));
+  if (bigEndian == IS_BIG_ENDIAN) return;
+
+  r_16 * p = (r_16 *)tab;
+  for (size_t i=0; i<n; i++) {
+    bswap16(p);  p++;
+    bswap16(p);  p++;
+  }
+  return;
+}
+#endif
 
 void
@@ -1185,5 +1274,5 @@
       else if (ppst3 == PPS_DATATYPE_INTEGER) dtype = "INTEGER x";
       else if (ppst3 == PPS_DATATYPE_UNSIGNED) dtype = "UNSIGNED x";
-      int_4 dsize = ppst1;
+      int_4 dsize = (int_4)tagsize2datasize(ppst1);
       int_8 dsizeskip = dsize;
       if (ppst30 == PPS_DATATYPE_COMPLEX) { 
@@ -1236,22 +1325,4 @@
 
 
-//++
-// Class	POutPersist
-// Lib		Outils++
-// include	ppersist.h
-//
-//	Fichier d'objets persistants, en écriture.
-//--
-
-
-//++
-//  POutPersist(string const& flnm, int endianness = PPersist::PPS_NATIVE)
-//
-//	Crée un nouveau fichier ppersist. Par défaut, il est petit=boutien
-//	sur machines petit-boutiennes, et gros-boutien sur machines
-//	gros-boutiennes. On peut explicitement spécifier PPersist::PPS_LITTLE_ENDIAN
-//	ou PPersist::PPS_BIG_ENDIAN.
-//--
-
 /*!
    \class SOPHYA::PPFBinaryInputStream
@@ -1302,5 +1373,5 @@
   version = 3;
   // Header
-  PutRawBytes("SOS-SOPHYA-PPersistFile V3               ",32);
+  PutRawBytes("SOS-SOPHYA-PPersistFile V4               ",32);
   PutRawBytes(bigEndian 
 	   ? "BIG-ENDIAN                             "
@@ -1482,12 +1553,12 @@
 
 void
-PPFBinaryOutputStream::PutArrayTag(short datasz, size_t sz, short datatype) 
+PPFBinaryOutputStream::PutArrayTag(unsigned char datasz, size_t sz, unsigned char datatype) 
 // datatype = PPS_DATATYPE_CHAR or PPS_DATATYPE_FLOAT or PPS_DATATYPE_INTEGER or PPS_DATATYPE_UNSIGNED
 {
   if (sz <= 0x7fffffff) {
-    PutRawUByte(PPS_SIMPLE_ARRAY4 + datasz + datatype);
+    PutRawUByte(PPS_SIMPLE_ARRAY4 + datasize2tagsize(datasz) + datatype);
     PutRawI4(sz);
   } else {
-    PutRawUByte(PPS_SIMPLE_ARRAY8 + datasz + datatype);
+    PutRawUByte(PPS_SIMPLE_ARRAY8 + datasize2tagsize(datasz) + datatype);
     PutRawU8(sz);
   } 
@@ -1497,5 +1568,5 @@
 PPFBinaryOutputStream::PutByte(char c)
 {
-  PutRawByte(PPS_SIMPLE + 1 + PPS_DATATYPE_CHAR);
+  PutRawByte(PPS_SIMPLE + datasize2tagsize(1) + PPS_DATATYPE_CHAR);
   PutRawBytes(&c, 1);
 }
@@ -1513,5 +1584,5 @@
 PPFBinaryOutputStream::PutR4   (r_4 val)
 {
-  PutRawUByte(PPS_SIMPLE + 4 + PPS_DATATYPE_FLOAT);
+  PutRawUByte(PPS_SIMPLE + datasize2tagsize(4) + PPS_DATATYPE_FLOAT);
   
   if (bigEndian != IS_BIG_ENDIAN)
@@ -1529,5 +1600,5 @@
     PutRawBytes(tab, n*sizeof(r_4));
   } else {
-    for (unsigned int i=0; i<n; i++) {
+    for (size_t i=0; i<n; i++) {
       r_4 val = tab[i];
       bswap4(&val);
@@ -1540,5 +1611,5 @@
 PPFBinaryOutputStream::PutR8   (r_8 val)
 {
-  PutRawUByte(PPS_SIMPLE + 8 + PPS_DATATYPE_FLOAT);
+  PutRawUByte(PPS_SIMPLE + datasize2tagsize(8) + PPS_DATATYPE_FLOAT);
 
   if (bigEndian != IS_BIG_ENDIAN)
@@ -1556,5 +1627,5 @@
     PutRawBytes(tab, n*sizeof(r_8));
   } else {
-    for (unsigned int i=0; i<n; i++) {
+    for (size_t i=0; i<n; i++) {
       r_8 val = tab[i];
       bswap8(&val);
@@ -1567,5 +1638,5 @@
 PPFBinaryOutputStream::PutI1   (int_1 val)
 {
-  PutRawUByte(PPS_SIMPLE + 1 + PPS_DATATYPE_INTEGER);
+  PutRawUByte(PPS_SIMPLE + datasize2tagsize(1) + PPS_DATATYPE_INTEGER);
   PutRawBytes(&val, sizeof(int_1));
 }
@@ -1581,5 +1652,5 @@
 PPFBinaryOutputStream::PutU1   (uint_1 val)
 {
-  PutRawUByte(PPS_SIMPLE + 1 + PPS_DATATYPE_UNSIGNED);
+  PutRawUByte(PPS_SIMPLE + datasize2tagsize(1) + PPS_DATATYPE_UNSIGNED);
   PutRawBytes(&val, sizeof(uint_1));
 }
@@ -1595,5 +1666,5 @@
 PPFBinaryOutputStream::PutI2   (int_2 val)
 {
-  PutRawUByte(PPS_SIMPLE + 2 + PPS_DATATYPE_INTEGER);
+  PutRawUByte(PPS_SIMPLE + datasize2tagsize(2) + PPS_DATATYPE_INTEGER);
 
   if (bigEndian != IS_BIG_ENDIAN)
@@ -1611,5 +1682,5 @@
     PutRawBytes(tab, n*sizeof(int_2));
   } else {
-    for (unsigned int i=0; i<n; i++) {
+    for (size_t i=0; i<n; i++) {
       int_2 val = tab[i];
       bswap2(&val);
@@ -1622,5 +1693,5 @@
 PPFBinaryOutputStream::PutU2   (uint_2 val)
 {
-  PutRawUByte(PPS_SIMPLE + 2 + PPS_DATATYPE_UNSIGNED);
+  PutRawUByte(PPS_SIMPLE + datasize2tagsize(2) + PPS_DATATYPE_UNSIGNED);
 
   if (bigEndian != IS_BIG_ENDIAN)
@@ -1638,5 +1709,5 @@
     PutRawBytes(tab, n*sizeof(uint_2));
   } else {
-    for (unsigned int i=0; i<n; i++) {
+    for (size_t i=0; i<n; i++) {
       uint_2 val = tab[i];
       bswap2(&val);
@@ -1649,5 +1720,5 @@
 PPFBinaryOutputStream::PutI4   (int_4 val)
 {
-  PutRawUByte(PPS_SIMPLE + 4 + PPS_DATATYPE_INTEGER);
+  PutRawUByte(PPS_SIMPLE + datasize2tagsize(4) + PPS_DATATYPE_INTEGER);
 
   if (bigEndian != IS_BIG_ENDIAN)
@@ -1665,5 +1736,5 @@
     PutRawBytes(tab, n*sizeof(int_4));
   } else {
-    for (unsigned int i=0; i<n; i++) {
+    for (size_t i=0; i<n; i++) {
       int_4 val = tab[i];
       bswap4(&val);
@@ -1676,5 +1747,5 @@
 PPFBinaryOutputStream::PutU4   (uint_4 val)
 {
-  PutRawUByte(PPS_SIMPLE + 4 + PPS_DATATYPE_UNSIGNED);
+  PutRawUByte(PPS_SIMPLE + datasize2tagsize(4) + PPS_DATATYPE_UNSIGNED);
 
   if (bigEndian != IS_BIG_ENDIAN)
@@ -1692,5 +1763,5 @@
     PutRawBytes(tab, n*sizeof(uint_4));
   } else {
-    for (unsigned int i=0; i<n; i++) {
+    for (size_t i=0; i<n; i++) {
       uint_4 val = tab[i];
       bswap4(&val);
@@ -1703,5 +1774,5 @@
 PPFBinaryOutputStream::PutI8   (int_8 val)
 {
-  PutRawUByte(PPS_SIMPLE + 8 + PPS_DATATYPE_INTEGER);
+  PutRawUByte(PPS_SIMPLE + datasize2tagsize(8) + PPS_DATATYPE_INTEGER);
 
   if (bigEndian != IS_BIG_ENDIAN)
@@ -1719,5 +1790,5 @@
     PutRawBytes(tab, n*sizeof(int_8));
   } else {
-    for (unsigned int i=0; i<n; i++) {
+    for (size_t i=0; i<n; i++) {
       int_8 val = tab[i];
       bswap8(&val);
@@ -1730,5 +1801,5 @@
 PPFBinaryOutputStream::PutU8   (uint_8 val)
 {
-  PutRawUByte(PPS_SIMPLE + 8 + PPS_DATATYPE_UNSIGNED);
+  PutRawUByte(PPS_SIMPLE + datasize2tagsize(8) + PPS_DATATYPE_UNSIGNED);
 
   if (bigEndian != IS_BIG_ENDIAN)
@@ -1746,5 +1817,5 @@
     PutRawBytes(tab, n*sizeof(uint_8));
   } else {
-    for (unsigned int i=0; i<n; i++) {
+    for (size_t i=0; i<n; i++) {
       uint_8 val = tab[i];
       bswap8(&val);
@@ -1773,5 +1844,5 @@
 PPFBinaryOutputStream::PutZ4   (complex<r_4> val)
 {
-  PutRawUByte(PPS_SIMPLE + 4 + PPS_DATATYPE_COMPLEX);
+  PutRawUByte(PPS_SIMPLE + datasize2tagsize(4) + PPS_DATATYPE_COMPLEX);
   r_4 reim[2];
   reim[0] = val.real();
@@ -1792,5 +1863,5 @@
     PutRawBytes(tab, n*2*sizeof(r_4));
   } else {
-    for (unsigned int i=0; i<n; i++) {
+    for (size_t i=0; i<n; i++) {
       r_4 reim[2];
       reim[0] = tab[i].real();
@@ -1806,5 +1877,5 @@
 PPFBinaryOutputStream::PutZ8   (complex<r_8> val)
 {
-  PutRawUByte(PPS_SIMPLE + 8 + PPS_DATATYPE_COMPLEX);
+  PutRawUByte(PPS_SIMPLE + datasize2tagsize(8) + PPS_DATATYPE_COMPLEX);
   r_8 reim[2];
   reim[0] = val.real();
@@ -1825,5 +1896,5 @@
     PutRawBytes(tab, n*2*sizeof(r_8));
   } else {
-    for (unsigned int i=0; i<n; i++) {
+    for (size_t i=0; i<n; i++) {
       r_8 reim[2];
       reim[0] = tab[i].real();
@@ -1836,4 +1907,67 @@
 }
 
+// Support pour les long double (128 bits floating point numbers)
+#ifdef SO_LDBLE128
+void
+PPFBinaryOutputStream::PutR16   (r_16 val)
+{
+  PutRawUByte(PPS_SIMPLE + datasize2tagsize(16) + PPS_DATATYPE_FLOAT);
+
+  if (bigEndian != IS_BIG_ENDIAN)
+    bswap16(&val);
+
+  PutRawBytes(&val, sizeof(r_16));
+}
+
+void
+PPFBinaryOutputStream::PutR16s  (r_16 const* tab, size_t n)
+{
+  PutArrayTag(16, n, PPS_DATATYPE_FLOAT);
+
+  if (bigEndian == IS_BIG_ENDIAN) {
+    PutRawBytes(tab, n*sizeof(r_16));
+  } else {
+    for (size_t i=0; i<n; i++) {
+      r_16 val = tab[i];
+      bswap16(&val);
+      PutRawBytes(&val, sizeof(r_16));
+    }
+  }
+}
+
+void
+PPFBinaryOutputStream::PutZ16   (complex<r_16> val)
+{
+  PutRawUByte(PPS_SIMPLE + datasize2tagsize(16) + PPS_DATATYPE_COMPLEX);
+  r_16 reim[2];
+  reim[0] = val.real();
+  reim[1] = val.imag();
+  if (bigEndian != IS_BIG_ENDIAN) {
+    bswap16(reim);
+    bswap16(reim+1);
+  }
+  PutRawBytes(reim, 2*sizeof(r_16));
+}
+
+void
+PPFBinaryOutputStream::PutZ16s  (complex<r_16> const* tab, size_t n)
+{
+  PutArrayTag(16, n, PPS_DATATYPE_COMPLEX);
+
+  if (bigEndian == IS_BIG_ENDIAN) {
+    PutRawBytes(tab, n*2*sizeof(r_16));
+  } else {
+    for (size_t i=0; i<n; i++) {
+      r_16 reim[2];
+      reim[0] = tab[i].real();
+      reim[1] = tab[i].imag();
+      bswap16(reim);
+      bswap16(reim+1);
+      PutRawBytes(reim, 2*sizeof(r_16));
+    }
+  }
+}
+#endif
+
 void
 PPFBinaryOutputStream::PutPosTagTable(int_8 const * ptab, size_t sz)
Index: trunk/SophyaLib/BaseTools/ppfbinstream.h
===================================================================
--- trunk/SophyaLib/BaseTools/ppfbinstream.h	(revision 3741)
+++ trunk/SophyaLib/BaseTools/ppfbinstream.h	(revision 3750)
@@ -142,4 +142,10 @@
   void   GetZ8   (complex<r_8> &);
   void   GetZ8s  (complex<r_8> *, size_t);
+#ifdef SO_LDBLE128
+  void   GetR16  (r_16&);
+  void   GetR16s (r_16*, size_t);
+  void   GetZ16  (complex<r_16> &);
+  void   GetZ16s (complex<r_16> *, size_t);
+#endif
   
   inline void   Get(char&   c) {GetByte(c);}
@@ -170,5 +176,10 @@
   inline void   Get(complex<r_4> * x, size_t n) { GetZ4s(x, n); }
   inline void   Get(complex<r_8> * x, size_t n) { GetZ8s(x, n); }
-  
+#ifdef SO_LDBLE128
+  inline void   Get(r_16&   x) {GetR16(x);}
+  inline void   Get(r_16*   x, size_t n) {GetR16s(x,n);}
+  inline void   Get(complex<r_16> & x) {GetZ16(x);}
+  inline void   Get(complex<r_16> * x, size_t n) { GetZ16s(x, n); }
+#endif  
   // Reading a list (table) of position tags
   void    GetPosTagTable(int_8*, size_t);
@@ -184,6 +195,6 @@
   void   SkipItem(bool fgrdi=true, unsigned char itag=0);
 
-  void   CheckTag   (short datasz, short datatype);
-  void   CheckArrayTag(short datasz, size_t sz, short datatype);
+  void   CheckTag   (unsigned char datasz, unsigned char datatype);
+  void   CheckArrayTag(unsigned char datasz, size_t sz, unsigned char datatype);
   void   GetTypeTag (unsigned char& c);
   void   GetRawByte (char& c);
@@ -245,5 +256,10 @@
   void PutZ8   (complex<r_8>);
   void PutZ8s  (complex<r_8> const*, size_t);
-  
+#ifdef SO_LDBLE128
+  void PutR16  (r_16);
+  void PutR16s (r_16 const*, size_t);
+  void PutZ16  (complex<r_16>);
+  void PutZ16s (complex<r_16> const*, size_t);
+#endif  
   
   void   Put(char   c) {PutByte(c);}
@@ -264,4 +280,10 @@
   void   Put(complex<r_4> const*    x, size_t n) {PutZ4s(x,n);}
   void   Put(complex<r_8> const*    x, size_t n) {PutZ8s(x,n);}
+#ifdef SO_LDBLE128
+  void   Put(r_16   x) {PutR16(x);}
+  void   Put(r_16 const*   x, size_t n) {PutR16s(x,n);}
+  void   Put(complex<r_16>  x) {PutZ16(x);}
+  void   Put(complex<r_16> const*   x, size_t n) {PutZ16s(x,n);}
+#endif
   void   Put(uint_1 const* x, size_t n) {PutU1s(x,n);}
   void   Put(int_1 const*  x, size_t n) {PutI1s(x,n);}
@@ -284,5 +306,5 @@
   void     WriteNameTagTableV2();
 
-  void     PutArrayTag(short datasz, size_t sz, short datatype);
+  void     PutArrayTag(unsigned char datasz, size_t sz, unsigned char datatype);
   void     PutRawByte (char);
   void     PutRawUByte (unsigned char);
Index: trunk/SophyaLib/BaseTools/sophyainit.cc
===================================================================
--- trunk/SophyaLib/BaseTools/sophyainit.cc	(revision 3741)
+++ trunk/SophyaLib/BaseTools/sophyainit.cc	(revision 3750)
@@ -36,6 +36,10 @@
 //  - Exceptions sophya heritent de std::exception  (mars 09)
 //  - Extension / ajout de classes generateur aleatoires (Mersenne-Twister ...avril 09)      
-// Module version number - 2.20 ,  Avr09      
-#define MOD_VERS   2.20
+// Module version number - 2.20 ,  Avr09 
+//  - Ajout type long double (r_16) et prise en chage des r_16 et complex<r_16> 
+//    par les PPersist (fev 2010) 
+// Module version number - 2.30 ,  Fev10 
+     
+#define MOD_VERS   2.30
 
 // Pour garder la liste des modules et leurs numeros de version
@@ -98,5 +102,10 @@
   PPRegister(FIO_NDataBlock< complex<r_8> >);
   DObjRegister(FIO_NDataBlock< complex<r_8> >, NDataBlock< complex<r_8> >);
-
+#ifdef SO_LDBLE128
+  PPRegister(FIO_NDataBlock<r_16>);
+  DObjRegister(FIO_NDataBlock<r_16>, NDataBlock<r_16>);
+  PPRegister(FIO_NDataBlock< complex<r_16> >);
+  DObjRegister(FIO_NDataBlock< complex<r_16> >, NDataBlock< complex<r_16> >);
+#endif
   // Enregistrement des handlers PPF pour les TimeStamp
   PPRegister(ObjFileIO<TimeStamp>);
Index: trunk/SophyaLib/BaseTools/sversion.h
===================================================================
--- trunk/SophyaLib/BaseTools/sversion.h	(revision 3741)
+++ trunk/SophyaLib/BaseTools/sversion.h	(revision 3750)
@@ -3,6 +3,6 @@
 
 #define SOPHYA_VERSION   2.1
-#define SOPHYA_REVISION  45
-#define SOPHYA_TAG       "V_Jan2010"
+#define SOPHYA_REVISION  50
+#define SOPHYA_TAG       "V_Mar2010"
 
 #endif
