Index: /trunk/SophyaLib/BaseTools/fiondblock.cc
===================================================================
--- /trunk/SophyaLib/BaseTools/fiondblock.cc	(revision 2440)
+++ /trunk/SophyaLib/BaseTools/fiondblock.cc	(revision 2441)
@@ -8,6 +8,6 @@
 #include <complex>
 #include "pexceptions.h"
+#include "datatype.h"
 #include "fiondblock.h"
-#include "datatype.h"
 #include <typeinfo>
 
@@ -24,7 +24,4 @@
 */
 
-// Pour pouvoir ecrire des tableaux de complex, en attendant 
-// PIn/POutPersist::Get/Put(complex<>)
-#include "piocmplx.h"
 
 template <class T>
@@ -110,4 +107,30 @@
 }
 
+//---------------------------------------------------------------------------
+// Pour compatibilite de lecture avec PPF V2 
+inline void PIOSReadArray(PInPersist & is, uint_1 * arr, size_t n)
+{ is.GetBytes(arr, n); }
+inline void PIOSReadArray(PInPersist & is, uint_2 * arr, size_t n)
+{ is.Get(arr, n); }
+inline void PIOSReadArray(PInPersist & is, int_2 * arr, size_t n)
+{ is.Get(arr, n); }
+inline void PIOSReadArray(PInPersist & is, uint_4 * arr, size_t n)
+{ is.Get(arr, n); }
+inline void PIOSReadArray(PInPersist & is, int_4 * arr, size_t n)
+{ is.Get(arr, n); }
+inline void PIOSReadArray(PInPersist & is, uint_8 * arr, size_t n)
+{ is.Get(arr, n); }
+inline void PIOSReadArray(PInPersist & is, int_8 * arr, size_t n)
+{ is.Get(arr, n); }
+inline void PIOSReadArray(PInPersist & is, r_4 * arr, size_t n)
+{ is.Get(arr, n); }
+inline void PIOSReadArray(PInPersist & is, r_8 * arr, size_t n)
+{ is.Get(arr, n); }
+inline void PIOSReadArray(PInPersist & is, complex<float> * arr, size_t n)
+{ r_4 * pr = (r_4 *)arr; is.Get(pr, n*2); }
+inline void PIOSReadArray(PInPersist & is, complex<double> * arr, size_t n)
+{ r_8 * pr = (r_8 *)arr; is.Get(pr, n*2); }
+//---------------------------------------------------------------------------
+
 template <class T>
 void FIO_NDataBlock<T>::ReadSelf(PInPersist& is)
@@ -119,5 +142,7 @@
 else if (itab[1] != dobj->Size()) dobj->ReSize(itab[1]);
 // On lit le tableau de nombres
-PIOSReadArray(is, dobj->Data(), dobj->Size()); 
+if (is.Version() <= 2)   // lecture ancienne version PPF
+  PIOSReadArray(is, dobj->Data(), dobj->Size()); 
+else is.Get(dobj->Data(), dobj->Size());
 }
 
@@ -135,5 +160,5 @@
 os.Put(itab, 3);
 //  On ecrit le tableau de nombres 
-PIOSWriteArray(os, dobj->Data(), dobj->Size()); 
+os.Put(dobj->Data(), dobj->Size());
 }
 
Index: unk/SophyaLib/BaseTools/piocmplx.h
===================================================================
--- /trunk/SophyaLib/BaseTools/piocmplx.h	(revision 2440)
+++ 	(revision )
@@ -1,154 +1,0 @@
-// This may look like C code, but it is really -*- C++ -*-
-// Fonctions d'ecriture de tableaux numeriques
-#ifndef PIOCMPLX_H_SEEN
-#define PIOCMPLX_H_SEEN
-
-/*
-// Pour gerer les Persist I/O de tableaux numerique templates
-template <class T>
-void PIOSReadArray(PInPersist & is, T* arr, size_t n);
-template <class T>
-void PIOSWriteArray(POutPersist & os, T const * arr, size_t n);
-*/
-
-// Pour pouvoir ecrire des tableau de complex, en attendant 
-// PIn/POutPersist::Get/Put(complex<>)
-
-inline
-void PIOSReadArray(PInPersist & is, uint_1 * arr, size_t n)
-{
-is.GetBytes(arr, n);
-}
-
-inline
-void PIOSReadArray(PInPersist & is, uint_2 * arr, size_t n)
-{
-is.Get(arr, n);
-}
-
-inline
-void PIOSReadArray(PInPersist & is, int_2 * arr, size_t n)
-{
-is.Get(arr, n);
-}
-
-inline
-void PIOSReadArray(PInPersist & is, uint_4 * arr, size_t n)
-{
-is.Get(arr, n);
-}
-
-inline
-void PIOSReadArray(PInPersist & is, int_4 * arr, size_t n)
-{
-is.Get(arr, n);
-}
-
-inline
-void PIOSReadArray(PInPersist & is, uint_8 * arr, size_t n)
-{
-is.Get(arr, n);
-}
-
-inline
-void PIOSReadArray(PInPersist & is, int_8 * arr, size_t n)
-{
-is.Get(arr, n);
-}
-
-inline
-void PIOSReadArray(PInPersist & is, r_4 * arr, size_t n)
-{
-is.Get(arr, n);
-}
-
-inline
-void PIOSReadArray(PInPersist & is, r_8 * arr, size_t n)
-{
-is.Get(arr, n);
-}
-
-inline
-void PIOSReadArray(PInPersist & is, complex<float> * arr, size_t n)
-{
-r_4 * pr = (r_4 *)arr;
-is.Get(pr, n*2);
-}
-
-inline
-void PIOSReadArray(PInPersist & is, complex<double> * arr, size_t n)
-{
-r_8 * pr = (r_8 *)arr;
-is.Get(pr, n*2);
-}
-
-// Fonctions d ecriture de tableaux de nombre
-inline
-void PIOSWriteArray(POutPersist & os, uint_1 const * arr, size_t n)
-{
-os.PutBytes(arr, n);
-}
-
-inline
-void PIOSWriteArray(POutPersist & os, uint_2 const * arr, size_t n)
-{
-os.Put(arr, n);
-}
-
-inline
-void PIOSWriteArray(POutPersist & os, int_2 const * arr, size_t n)
-{
-os.Put(arr, n);
-}
-
-inline
-void PIOSWriteArray(POutPersist & os, uint_4 const * arr, size_t n)
-{
-os.Put(arr, n);
-}
-
-inline
-void PIOSWriteArray(POutPersist & os, int_4 const * arr, size_t n)
-{
-os.Put(arr, n);
-}
-
-inline
-void PIOSWriteArray(POutPersist & os, uint_8 const * arr, size_t n)
-{
-os.Put(arr, n);
-}
-
-inline
-void PIOSWriteArray(POutPersist & os, int_8 const * arr, size_t n)
-{
-os.Put(arr, n);
-}
-
-inline
-void PIOSWriteArray(POutPersist & os, r_4 const * arr, size_t n)
-{
-os.Put(arr, n);
-}
-
-inline
-void PIOSWriteArray(POutPersist & os, r_8 const * arr, size_t n)
-{
-os.Put(arr, n);
-}
-
-inline
-void PIOSWriteArray(POutPersist & os, complex<float> const * arr, size_t n)
-{
-r_4 const * pr = (r_4 const *)arr;
-os.Put(pr, n*2);
-}
-
-inline
-void PIOSWriteArray(POutPersist & os, complex<double> const * arr, size_t n)
-{
-r_8 const * pr = (r_8 const *)arr;
-os.Put(pr, n*2);
-}
-
-#endif
Index: /trunk/SophyaLib/BaseTools/ppersist.cc
===================================================================
--- /trunk/SophyaLib/BaseTools/ppersist.cc	(revision 2440)
+++ /trunk/SophyaLib/BaseTools/ppersist.cc	(revision 2441)
@@ -336,5 +336,5 @@
 //--
 {
-  s.WriteTag(tag);
+  s.WriteNameTag(tag);
   s.PutPPObject(this);
 }
@@ -431,12 +431,14 @@
   rbuf[32] = '\0'; 
   struct tm tm;
-  #if !(defined(__MWERKS__) || defined(OS_MACOSX))
+  /*  #if !(defined(__MWERKS__) || defined(OS_MACOSX))  RZ-DEL */
   strptime(rbuf,"%d/%m/%Y %H:%M:%S GMT",&tm);
-  #else
+  /*  #else
   sscanf(rbuf,"%2d/%2d/%4d %2d:%2d:%2d GMT",&tm.tm_mday,&tm.tm_mon,&tm.tm_year,
                                             &tm.tm_hour,&tm.tm_min,&tm.tm_sec);
+
   tm.tm_mon  --;
   tm.tm_year -= 1900;
-  #endif
+  #endif    RZ-DEL */
+
   creationdate = mktime(&tm);
   filename = flnm;  // keep the filename
@@ -516,5 +518,5 @@
     if (ppstype == PPS_EOF) break;
     
-    if (ppstype != PPS_TAG)
+    if (ppstype != PPS_NAMETAG_TABLE)
       throw FileFormatExc("PInPersist::Scan   corrupted file, bad tag entry");
 
@@ -540,10 +542,21 @@
 
 bool 
-PInPersist::GotoTag(string const& name)
+PInPersist::GotoPositionTag(int_8 pos)
+{
+  s->seekg(pos);
+  int_8 tpos;
+  GetRawI8(tpos);
+  if (tpos != pos) 
+    throw FileFormatExc("PInPersist::GotoPositionTag() - Wrong tag position!");
+  return true;
+}
+
+bool 
+PInPersist::GotoNameTag(string const& name)
 {
   map<string, int_8>::iterator i = tags.find(name);
   if (i == tags.end()) 
     return false;
-      //    throw NotFoundExc("PInPersist::GotoTag   tag not found");
+      //    throw NotFoundExc("PInPersist::GotoNameTag   tag not found");
   s->seekg((*i).second);
   seqread = false;
@@ -551,4 +564,5 @@
   return(true); 
 }
+
 
 bool
@@ -625,7 +639,11 @@
 PInPersist::GetTypeTag(unsigned char& c) 
 {
-  c = PPS_TAG_MARK;
-  while (c == PPS_TAG_MARK) GetRawUByte(c);
-  //  while (c == PPS_TAG_MARK) {    Il ne faut plus faire ca !
+  int_8 tpos;
+  c = PPS_NAMETAG_MARK;
+  while ( (c == PPS_NAMETAG_MARK) || (c == PPS_POSTAG_MARK) ) {
+    GetRawUByte(c);
+    if (c == PPS_POSTAG_MARK)  GetRawI8(tpos);
+  } 
+  //  while (c == PPS_NAMETAG_MARK) {    Il ne faut plus faire ca !
   //    objList.clear();             $CHECK$ Reza 03/2000
   //    GetRawByte(c);
@@ -776,4 +794,32 @@
 
 void
+PInPersist::GetI1   (int_1& result)
+{
+  CheckTag(1,PPS_DATATYPE_INTEGER);
+  GetRawBytes(&result, sizeof(int_1));
+}
+
+void
+PInPersist::GetI1s  (int_1* tab, size_t n)
+{
+  CheckArrayTag(1,n,PPS_DATATYPE_INTEGER);
+  GetRawBytes(tab, n*sizeof(int_1));
+}
+
+void
+PInPersist::GetU1   (uint_1& result)
+{
+  CheckTag(1,PPS_DATATYPE_UNSIGNED);
+  GetRawBytes(&result, sizeof(uint_1));
+}
+
+void
+PInPersist::GetU1s  (uint_1* tab, size_t n)
+{
+  CheckArrayTag(1,n,PPS_DATATYPE_UNSIGNED);
+  GetRawBytes(tab, n*sizeof(uint_1));
+}
+
+void
 PInPersist::GetI2   (int_2& result)
 {
@@ -934,4 +980,94 @@
 }
 
+void
+PInPersist::GetZ4   (complex<r_4>& result)
+{
+  CheckTag(4,PPS_DATATYPE_COMPLEX);
+  r_4 reim[2];
+  GetRawBytes(reim, 2*sizeof(r_4));
+  if (bigEndian != IS_BIG_ENDIAN) {
+    bswap4(reim);
+    bswap4(reim+1);
+  }
+  result = complex<r_4>(reim[0], reim[1]);
+}
+
+void
+PInPersist::GetZ4s  (complex<r_4>* tab, size_t n)
+{  
+  CheckArrayTag(4,n,PPS_DATATYPE_COMPLEX);
+  GetRawBytes(tab, n*2*sizeof(r_4));
+  if (bigEndian == IS_BIG_ENDIAN) return;
+
+  r_4 * p = (r_4 *)tab;
+  for (unsigned int i=0; i<n; i++) {
+    bswap4(p);  p++;
+    bswap4(p);  p++;
+  }
+  return;
+}
+
+void
+PInPersist::GetZ8   (complex<r_8>& result)
+{
+  CheckTag(8,PPS_DATATYPE_COMPLEX);
+  r_8 reim[2];
+  GetRawBytes(reim, 2*sizeof(r_8));
+  if (bigEndian != IS_BIG_ENDIAN) {
+    bswap8(reim);
+    bswap8(reim+1);
+  }
+  result = complex<r_8>(reim[0], reim[1]);
+}
+
+void
+PInPersist::GetZ8s  (complex<r_8>* tab, size_t n)
+{
+  CheckArrayTag(8,n,PPS_DATATYPE_COMPLEX);
+  GetRawBytes(tab, n*2*sizeof(r_8));
+  if (bigEndian == IS_BIG_ENDIAN) return;
+
+  r_8 * p = (r_8 *)tab;
+  for (unsigned int i=0; i<n; i++) {
+    bswap8(p);  p++;
+    bswap8(p);  p++;
+  }
+  return;
+}
+
+
+void
+PInPersist::GetPosTagTable(int_8* ptab, size_t sz)
+{
+  unsigned char ppstype;
+  GetTypeTag(ppstype);
+  if (ppstype != PPS_POSTAG_TABLE) 
+    throw FileFormatExc("PInPersist::GetPosTagTable  bad type in ppersist stream");
+  int_4 tsz;
+  GetRawI4(tsz);
+  if (tsz != sz)
+    throw FileFormatExc("PInPersist::GetPosTagTable Size mismatch ");
+  for(int kk=0; kk<tsz; kk++)
+    GetRawI8(ptab[kk]);
+  return;
+}
+
+void
+PInPersist::GetPosTagTable(vector<int_8>& ptab)
+{
+  unsigned char ppstype;
+  GetTypeTag(ppstype);
+  if (ppstype != PPS_POSTAG_TABLE) 
+    throw FileFormatExc("PInPersist::GetPosTagTable  bad type in ppersist stream");
+  ptab.clear();
+  int_4 tsz;
+  GetRawI4(tsz);
+  int_8 tpos;
+  for(int kk=0; kk<tsz; kk++) {
+    GetRawI8(tpos);
+    ptab.push_back(tpos);
+  }
+  return;
+}
 
 PPersist*
@@ -1010,5 +1146,5 @@
 {
   unsigned char ppstag=0;
-  unsigned char ppst1,ppst2,ppst3;
+  unsigned char ppst1,ppst2,ppst3,ppst30;
   uint_8 cpos,fsize;
   uint_8 ui8,cid,oid;
@@ -1053,4 +1189,5 @@
     ppst2 = ppstag&0x30;  // bits     45
     ppst3 = ppstag&0xc0;  // bits       67
+    ppst30 = ppstag&0xc1; // bits 0     67
     if ((ppst2 == 0) && (ppst3 == 0) ) {
       switch (ppst1) {
@@ -1081,6 +1218,12 @@
 	break;
 
-      case PPS_TAG_MARK :
-	cout << "<PPS_TAG_MARK> tag at position " << hex << cpos << dec << endl; 
+      case PPS_NAMETAG_MARK :
+	cout << "<PPS_NAMETAG_MARK> tag at position " << hex << cpos << dec << endl; 
+	break;
+
+      case PPS_POSTAG_MARK :
+	GetRawI8(i8);	
+	cout << "<PPS_POSTAG_MARK> tag at position " << hex << cpos 
+	     << " TPos=" << i8 << dec << endl; 
 	break;
      
@@ -1091,5 +1234,11 @@
 	break;
 
-      case PPS_TAG :
+      case PPS_POSTAG_TABLE :
+	GetRawI4(i4);
+	for(int kkt=0; kkt<i4; kkt++)  GetRawI8(i8);	
+	cout << "<PPS_POSTAG_TABLE> tag at position " << hex << cpos << dec << endl; 
+	break;
+
+      case PPS_NAMETAG_TABLE :
 	GetRawI8(i8);
 	GetRawI4(i4);
@@ -1117,9 +1266,15 @@
     else {
       string dtype = "???? x";
-      if (ppst3 == PPS_DATATYPE_CHAR) dtype = "CHAR x";
+      if (ppst30 == PPS_DATATYPE_COMPLEX) dtype = "COMPLEX x";
+      else if (ppst3 == PPS_DATATYPE_CHAR) dtype = "CHAR x";
       else if (ppst3 == PPS_DATATYPE_FLOAT) dtype = "FLOAT x";
       else if (ppst3 == PPS_DATATYPE_INTEGER) dtype = "INTEGER x";
       else if (ppst3 == PPS_DATATYPE_UNSIGNED) dtype = "UNSIGNED x";
       int_4 dsize = ppst1;
+      int_4 dsizeskip = dsize;
+      if (ppst30 == PPS_DATATYPE_COMPLEX) { 
+	dsize--;
+	dsizeskip = 2*dsize;
+      }
       char sb[16];
       sprintf(sb, "%d", dsize);
@@ -1131,5 +1286,5 @@
 	if (lev > 2)  cout << "<PPS_SIMPLE> tag at position " << hex << cpos << dec 
 			   << " DataType=" << dtype << endl;
-	s->seekg(dsize, ios::cur);
+	s->seekg(dsizeskip, ios::cur);
 	break;
 
@@ -1138,5 +1293,5 @@
 	if (lev > 0)  cout << "<PPS_SIMPLE_ARRAY4> tag at position " << hex << cpos << dec 
 			   << " DataType=" << dtype << " NElts= " << i4 << endl;
-	s->seekg((uint_8)dsize*(uint_8)i4, ios::cur);
+	s->seekg((uint_8)dsizeskip*(uint_8)i4, ios::cur);
 	break;
 
@@ -1145,5 +1300,5 @@
 	if (lev > 0)  cout << "<PPS_SIMPLE_ARRAY8> tag at position " << hex << cpos << dec 
 			   << " DataType=" << dtype << " NElts= " << ui8 << endl;
-	s->seekg((uint_8)dsize*ui8, ios::cur);
+	s->seekg((uint_8)dsizeskip*ui8, ios::cur);
 	break;
       }
@@ -1247,7 +1402,7 @@
   // Output stream creation
   s = new ofstream(flnm.c_str(),ios::out | IOS_BIN);  
-
+  version = 3;
   // Header
-  PutRawBytes("SOS-SOPHYA-PPersistFile V2               ",32);
+  PutRawBytes("SOS-SOPHYA-PPersistFile V3               ",32);
   PutRawBytes(bigEndian 
 	   ? "BIG-ENDIAN                             "
@@ -1279,5 +1434,5 @@
       string name = (*i).first;
       int_8 pos = (*i).second;
-      PutRawUByte(PPS_TAG);                       // This is a tag
+      PutRawUByte(PPS_NAMETAG_TABLE);                       // This is a tag
       PutRawI8(pos);                             // position of previous tag
       PutRawI4(name.length());                   // length of the name
@@ -1291,13 +1446,26 @@
 }
 
-
-void
-POutPersist::WriteTag(string const& name)
+int_8
+POutPersist::WritePositionTag()
+{
+  int_8 tagpos;
+#ifdef STREAMPOS_IS_CLASS
+  tagpos = s->tellp().offset();
+#else
+  tagpos = s->tellp();
+#endif
+  PutRawByte(PPS_POSTAG_MARK);
+  PutI8(tagpos);
+  return(tagpos);
+}
+
+void
+POutPersist::WriteNameTag(string const& name)
 {
   if (name.length() > MAXTAGLEN) 
-    throw ParmError("POutPersist::WriteTag   tag name too long");
+    throw ParmError("POutPersist::WriteNameTag   tag name too long");
 
   if (tags.find(name) != tags.end())
-    throw DuplicateIdExc("POutPersist::WriteTag   duplicate tag name");
+    throw DuplicateIdExc("POutPersist::WriteNameTag   duplicate tag name");
 
   // Get current file position
@@ -1311,5 +1479,5 @@
 
   tags[name] = tagPos;
-  PutRawUByte(PPS_TAG_MARK);                       // This is a tag
+  PutRawUByte(PPS_NAMETAG_MARK);                       // This is a tag
   //  objList.clear(); // $CHECK$ EA 171199  - Ne pas faire ? Reza 03/2000
 }
@@ -1482,4 +1650,32 @@
 
 void
+POutPersist::PutI1   (int_1 val)
+{
+  PutRawUByte(PPS_SIMPLE + 1 + PPS_DATATYPE_INTEGER);
+  PutRawBytes(&val, sizeof(int_1));
+}
+
+void
+POutPersist::PutI1s  (int_1 const* tab, size_t n)
+{
+  PutArrayTag(1, n, PPS_DATATYPE_INTEGER);
+  PutRawBytes(tab, n*sizeof(int_1));
+}
+
+void
+POutPersist::PutU1   (uint_1 val)
+{
+  PutRawUByte(PPS_SIMPLE + 1 + PPS_DATATYPE_UNSIGNED);
+  PutRawBytes(&val, sizeof(uint_1));
+}
+
+void
+POutPersist::PutU1s  (uint_1 const* tab, size_t n)
+{
+  PutArrayTag(1, n, PPS_DATATYPE_UNSIGNED);
+  PutRawBytes(tab, n*sizeof(uint_1));
+}
+
+void
 POutPersist::PutI2   (int_2 val)
 {
@@ -1660,4 +1856,92 @@
 
 void
+POutPersist::PutZ4   (complex<r_4> val)
+{
+  PutRawUByte(PPS_SIMPLE + 4 + PPS_DATATYPE_COMPLEX);
+  r_4 reim[2];
+  reim[0] = val.real();
+  reim[1] = val.imag();
+  if (bigEndian != IS_BIG_ENDIAN) {
+    bswap4(reim);
+    bswap4(reim+1);
+  }
+  PutRawBytes(reim, 2*sizeof(r_4));
+}
+
+void
+POutPersist::PutZ4s  (complex<r_4> const* tab, size_t n)
+{
+  PutArrayTag(4, n, PPS_DATATYPE_COMPLEX);
+
+  if (bigEndian == IS_BIG_ENDIAN) {
+    PutRawBytes(tab, n*2*sizeof(r_4));
+  } else {
+    for (unsigned int i=0; i<n; i++) {
+      r_4 reim[2];
+      reim[0] = tab[i].real();
+      reim[1] = tab[i].imag();
+      bswap4(reim);
+      bswap4(reim+1);
+      PutRawBytes(reim, 2*sizeof(r_4));
+    }
+  }
+}
+
+void
+POutPersist::PutZ8   (complex<r_8> val)
+{
+  PutRawUByte(PPS_SIMPLE + 8 + PPS_DATATYPE_COMPLEX);
+  r_8 reim[2];
+  reim[0] = val.real();
+  reim[1] = val.imag();
+  if (bigEndian != IS_BIG_ENDIAN) {
+    bswap8(reim);
+    bswap8(reim+1);
+  }
+  PutRawBytes(reim, 2*sizeof(r_8));
+}
+
+void
+POutPersist::PutZ8s  (complex<r_8> const* tab, size_t n)
+{
+  PutArrayTag(8, n, PPS_DATATYPE_COMPLEX);
+
+  if (bigEndian == IS_BIG_ENDIAN) {
+    PutRawBytes(tab, n*2*sizeof(r_8));
+  } else {
+    for (unsigned int i=0; i<n; i++) {
+      r_8 reim[2];
+      reim[0] = tab[i].real();
+      reim[1] = tab[i].imag();
+      bswap8(reim);
+      bswap8(reim+1);
+      PutRawBytes(reim, 2*sizeof(r_8));
+    }
+  }
+}
+
+void
+POutPersist::PutPosTagTable(int_8 const * ptab, size_t sz)
+{
+  PutRawUByte(PPS_POSTAG_TABLE);
+  int_4 tsz = sz;
+  PutRawI4(tsz);
+  for(int kk=0; kk<tsz; kk++)
+    PutRawI8(ptab[kk]);
+  return;
+}
+
+void
+POutPersist::PutPosTagTable(vector<int_8> const& ptab)
+{
+  PutRawUByte(PPS_POSTAG_TABLE);
+  int_4 tsz = ptab.size();
+  PutRawI4(tsz);
+  for(int kk=0; kk<tsz; kk++)
+    PutRawI8(ptab[kk]);
+  return;
+}
+
+void
 POutPersist::PutObject(AnyDataObj & o)
 {
@@ -1673,5 +1957,5 @@
 POutPersist::PutObject(AnyDataObj & o, string tagname)
 {
-  WriteTag(tagname);
+  WriteNameTag(tagname);
   PutObject(o);
 }
Index: /trunk/SophyaLib/BaseTools/ppersist.h
===================================================================
--- /trunk/SophyaLib/BaseTools/ppersist.h	(revision 2440)
+++ /trunk/SophyaLib/BaseTools/ppersist.h	(revision 2441)
@@ -17,4 +17,5 @@
 #include <time.h>
 
+#include <complex>
 #include <string>
 #include <map>
@@ -93,4 +94,5 @@
     static void Initialize();   // Pour initialiser classList
 
+    int    Version() {return version;}  // PIn/OutPersist version number
     string FileName() { return filename; }   // Retourne le nom de fichier
 
@@ -109,8 +111,10 @@
 	  PPS_OBJECT = 2,           // classId, data...
 	  PPS_REFERENCE = 3,        // objectId
-          PPS_TAG = 4,              // tag entries
+          PPS_NAMETAG_TABLE = 4,    // Name tag table (Written at the end of file/stream) 
 	  PPS_EOF = 5,              // Just before tag infomation, offset to PPS_TAG
 	  PPS_ENDOBJECT = 6,        // marks the end of a given object information
-          PPS_TAG_MARK = 7,         // To have a name tag, position marker in a file
+          PPS_NAMETAG_MARK = 7,     // To have a name tag, position marker in a file
+          PPS_POSTAG_MARK = 8,      // Position tag mark + 8 bytes (=stream position)
+          PPS_POSTAG_TABLE = 40,    // Position tag table + 8 bytes (=stream position)
           PPS_SIMPLE = 16,          // 16 + number of bytes, up to 8 bytes
           PPS_SIMPLE_ARRAY4 = 32,   // 32 + number of bytes, up to 8 bytes, then 4 bytes of length
@@ -120,4 +124,5 @@
    enum  {PPS_DATATYPE_CHAR = 0,        // 0  : DataType=character
           PPS_DATATYPE_FLOAT = 64,      // 64 : DataType=float 
+          PPS_DATATYPE_COMPLEX = 65,    // 65 : DataType=complex 
           PPS_DATATYPE_INTEGER = 128,   // 128 :DataType=integer 
           PPS_DATATYPE_UNSIGNED = 192   // 192 :DataType=Unsigned integer 
@@ -126,8 +131,9 @@
     map<string, int_8> tags;
     string filename;
+    int version;     // PPersist(In/Out) version 
   };
 
 
-  // TBD : use hash tables instead of maps. Check hashtbl status in STL.
+// TBD : use hash tables instead of maps. Check hashtbl status in STL.
 
 //! Input stream for PPersit objects.
@@ -137,5 +143,8 @@
     ~PInPersist();
 
-    bool   GotoTag(string const& name);
+    // Gestion des tags
+    bool   GotoPositionTag(int_8 pos);
+    bool   GotoNameTag(string const& name);
+    inline bool   GotoTag(string const& name) { return GotoNameTag(name); }
     int    NbTags();
     bool   GotoTagNum(int itag);  // 0..NbTags-1
@@ -144,4 +153,6 @@
     vector<string> const &  GetTagNames();  
 
+    // Lecture donnees de base et tableaux de donnees de base
+    // Basic data type (and corresponding arrays) reading
     void   GetByte (char& c);
     void   GetBytes(void* ptr, size_t bytes);
@@ -150,4 +161,8 @@
     void   GetR8   (r_8&);
     void   GetR8s  (r_8*, size_t);
+    void   GetI1   (int_1&);
+    void   GetI1s  (int_1*, size_t);
+    void   GetU1   (uint_1&);
+    void   GetU1s  (uint_1*, size_t);
     void   GetI2   (int_2&);
     void   GetI2s  (int_2*, size_t);
@@ -164,24 +179,41 @@
     void   GetLine (char* ptr, size_t len);
     void   GetStr  (string&);
-
-    void   Get(char&   c) {GetByte(c);}
-    void   Get(r_4&    x) {GetR4(x);}
-    void   Get(r_8&    x) {GetR8(x);}
-    void   Get(uint_2& x) {GetU2(x);}
-    void   Get(int_2&  x) {GetI2(x);}
-    void   Get(uint_4& x) {GetU4(x);}
-    void   Get(int_4&  x) {GetI4(x);}
-    void   Get(uint_8& x) {GetU8(x);}
-    void   Get(int_8&  x) {GetI8(x);}
-    void   Get(r_4*    x, size_t n) {GetR4s(x,n);}
-    void   Get(r_8*    x, size_t n) {GetR8s(x,n);}
-    void   Get(uint_2* x, size_t n) {GetU2s(x,n);}
-    void   Get(int_2*  x, size_t n) {GetI2s(x,n);}
-    void   Get(uint_4* x, size_t n) {GetU4s(x,n);}
-    void   Get(int_4*  x, size_t n) {GetI4s(x,n);}
-    void   Get(uint_8* x, size_t n) {GetU8s(x,n);}
-    void   Get(int_8*  x, size_t n) {GetI8s(x,n);}
-    void   Get(string& x) {GetStr(x);}
-  
+    void   GetZ4   (complex<r_4> &);
+    void   GetZ4s  (complex<r_4> *, size_t);
+    void   GetZ8   (complex<r_8> &);
+    void   GetZ8s  (complex<r_8> *, size_t);
+
+    inline void   Get(char&   c) {GetByte(c);}
+    inline void   Get(r_4&    x) {GetR4(x);}
+    inline void   Get(r_8&    x) {GetR8(x);}
+    inline void   Get(uint_1& x) {GetU1(x);}
+    inline void   Get(int_1&  x) {GetI1(x);}
+    inline void   Get(uint_2& x) {GetU2(x);}
+    inline void   Get(int_2&  x) {GetI2(x);}
+    inline void   Get(uint_4& x) {GetU4(x);}
+    inline void   Get(int_4&  x) {GetI4(x);}
+    inline void   Get(uint_8& x) {GetU8(x);}
+    inline void   Get(int_8&  x) {GetI8(x);}
+    inline void   Get(complex<r_4> & x) {GetZ4(x);}
+    inline void   Get(complex<r_8> & x) {GetZ8(x);}
+
+    inline void   Get(r_4*    x, size_t n) {GetR4s(x,n);}
+    inline void   Get(r_8*    x, size_t n) {GetR8s(x,n);}
+    inline void   Get(uint_1* x, size_t n) {GetU1s(x,n);}
+    inline void   Get(int_1*  x, size_t n) {GetI1s(x,n);}
+    inline void   Get(uint_2* x, size_t n) {GetU2s(x,n);}
+    inline void   Get(int_2*  x, size_t n) {GetI2s(x,n);}
+    inline void   Get(uint_4* x, size_t n) {GetU4s(x,n);}
+    inline void   Get(int_4*  x, size_t n) {GetI4s(x,n);}
+    inline void   Get(uint_8* x, size_t n) {GetU8s(x,n);}
+    inline void   Get(int_8*  x, size_t n) {GetI8s(x,n);}
+    inline void   Get(string& x) {GetStr(x);}
+    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); }
+
+    // Reading a list (table) of position tags
+    void    GetPosTagTable(int_8*, size_t);
+    void    GetPosTagTable(vector<int_8>&);
+
     //   Object Reading 
     PPersist*  ReadObject();
@@ -190,5 +222,4 @@
     PPersist*  GetPPObject(AnyDataObj * po=NULL);
 
-    int    Version() {return version;}
     time_t CreationDate() { return creationdate; }
     string CreationDateStr(); 
@@ -219,5 +250,4 @@
 
     bool bigEndian;
-    int version;
 
     time_t creationdate;
@@ -237,5 +267,8 @@
     ~POutPersist();
 
-    void WriteTag(string const& name);
+    // Ecriture de tags
+    int_8 WritePositionTag();
+    void  WriteNameTag(string const& name);
+    inline void WriteTag(string const& name) { WriteNameTag(name); }
   
     void PutByte (char c);
@@ -245,4 +278,8 @@
     void PutR8   (r_8);
     void PutR8s  (r_8 const*, size_t);
+    void PutI1   (int_1);
+    void PutI1s  (int_1 const*, size_t);
+    void PutU1   (uint_1);
+    void PutU1s  (uint_1 const*, size_t);
     void PutI2   (int_2);
     void PutI2s  (int_2 const*, size_t);
@@ -259,12 +296,17 @@
     void PutLine (char const* ptr, size_t len=0); // deprecated ?
     void PutStr  (string const&);
-    void PutPPObject (PPersist const*); // Like doing Write(stream) on PPersist object
-
-    void PutObject(AnyDataObj & o);   // Creates the corresponding PPersist Object and call Write()
-    void PutObject(AnyDataObj & o, string tagname);
+    void PutZ4   (complex<r_4>);
+    void PutZ4s  (complex<r_4> const*, size_t);
+    void PutZ8   (complex<r_8>);
+    void PutZ8s  (complex<r_8> const*, size_t);
+
 
     void   Put(char   c) {PutByte(c);}
     void   Put(r_4    x) {PutR4(x);}
     void   Put(r_8    x) {PutR8(x);}
+    void   Put(complex<r_4>   x) {PutZ4(x);}
+    void   Put(complex<r_8>   x) {PutZ8(x);}
+    void   Put(uint_1 x) {PutU1(x);}
+    void   Put(int_1  x) {PutI1(x);}
     void   Put(uint_2 x) {PutU2(x);}
     void   Put(int_2  x) {PutI2(x);}
@@ -275,4 +317,8 @@
     void   Put(r_4 const*    x, size_t n) {PutR4s(x,n);}
     void   Put(r_8 const*    x, size_t n) {PutR8s(x,n);}
+    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);}
+    void   Put(uint_1 const* x, size_t n) {PutU1s(x,n);}
+    void   Put(int_1 const*  x, size_t n) {PutI1s(x,n);}
     void   Put(uint_2 const* x, size_t n) {PutU2s(x,n);}
     void   Put(int_2 const*  x, size_t n) {PutI2s(x,n);}
@@ -283,4 +329,14 @@
     void   Put(string const& s) {PutStr(s);}
     void   Put(PPersist const* x) {PutPPObject(x);}
+
+    // Writing a list of position tag table
+    void   PutPosTagTable(int_8 const *, size_t);
+    void   PutPosTagTable(vector<int_8> const&);
+
+    // Objet Write - Ecriture des objets
+    void PutPPObject (PPersist const*); // Like doing Write(stream) on PPersist object
+
+    void PutObject(AnyDataObj & o);   // Creates the corresponding PPersist Object and call Write()
+    void PutObject(AnyDataObj & o, string tagname);
 
 
@@ -310,5 +366,7 @@
   };
   
-  
+
+// Le macro suivant permettent de simplifier la declaration 
+// des operateurs >> << sur les POutPersist et  PInPersist
 #define RAWPERSISTIO(_Type_,_xtyp_)                                             \
   inline POutPersist& operator << (POutPersist& c, _Type_ const& data)            \
@@ -324,4 +382,6 @@
   }                                                                               
 
+// On utilise le macro RAWPERSISTIO pour declarer POutPersist << et PInPersist >> 
+// pour les types de base r_4 r_8 int_4 int_8 ...
   RAWPERSISTIO(int_4,I4);
   RAWPERSISTIO(uint_4,U4);
@@ -331,4 +391,7 @@
   RAWPERSISTIO(r_4,R4);
   RAWPERSISTIO(r_8,R8);
+  RAWPERSISTIO(complex<r_4>,Z4);
+  RAWPERSISTIO(complex<r_8>,Z8);
+  RAWPERSISTIO(string,Str);
   
 #if 0
Index: /trunk/SophyaLib/BaseTools/sversion.h
===================================================================
--- /trunk/SophyaLib/BaseTools/sversion.h	(revision 2440)
+++ /trunk/SophyaLib/BaseTools/sversion.h	(revision 2441)
@@ -2,7 +2,7 @@
 #define SVERSION_H
 
-#define SOPHYA_VERSION   1.7
+#define SOPHYA_VERSION   1.8
 #define SOPHYA_REVISION  0 
-#define SOPHYA_TAG       "V_Sep2003"
+#define SOPHYA_TAG       "V_Oct2003"
 
 #endif
