Index: trunk/SophyaLib/BaseTools/dvlist.cc
===================================================================
--- trunk/SophyaLib/BaseTools/dvlist.cc	(revision 1245)
+++ trunk/SophyaLib/BaseTools/dvlist.cc	(revision 1310)
@@ -158,16 +158,16 @@
 for(it = dvl.mvlist.begin(); it != dvl.mvlist.end(); it++)
   {
-  switch ((*it).second.elval.typ) 
+  switch ((*it).second.elval.Type()) 
     {
-    case 'I' :
+    case MuTyV::MTVInteger :
       SetI((*it).first, (*it).second.elval.iv);
       break;
-    case 'D' : 
+    case  MuTyV::MTVFloat : 
       SetD((*it).first, (*it).second.elval.dv);
       break;
-    case 'Z' : 
+    case MuTyV::MTVComplex : 
       SetZ((*it).first, complex<r_8>((*it).second.elval.dv, (*it).second.elval.dv_im));
       break;
-    case 'S' : 
+    case MuTyV::MTVString : 
       SetS((*it).first, *((*it).second.elval.strv));
       break;
@@ -398,24 +398,24 @@
 os << "DVList::Print() - NVar= " << (int)mvlist.size() << "\n";
 if (comment.length() > 0)  os << comment << endl;
-char buff[256];
+char buff[1024];
 ValList::const_iterator it;
 for(it = mvlist.begin(); it != mvlist.end(); it++)  {
-  switch ((*it).second.elval.typ) 
+  switch ((*it).second.elval.Type()) 
     {
-    case 'I' :
+    case MuTyV::MTVInteger :
       sprintf(buff, "%s = %ld (int) %s\n", (*it).first.substr(0,64).c_str(), 
 	      (long)((*it).second.elval.iv), (*it).second.elcomm.substr(0,128).c_str());
       break;
-    case 'D' : 
+    case MuTyV::MTVFloat : 
       sprintf(buff, "%s = %.20g (double) %s\n", (*it).first.substr(0,64).c_str(), 
 	      (*it).second.elval.dv, (*it).second.elcomm.substr(0,128).c_str());
       break;
-    case 'Z' : 
+    case MuTyV::MTVComplex : 
       sprintf(buff, "%s = %.20g %.20g i (complex) %s\n", (*it).first.substr(0,64).c_str(), 
 	      (*it).second.elval.dv, (*it).second.elval.dv_im, (*it).second.elcomm.substr(0,128).c_str());
       break;
-    case 'S' : 
+    case MuTyV::MTVString : 
       sprintf(buff, "%s = %s (string) %s\n", (*it).first.substr(0,64).c_str(), 
-	      (*it).second.elval.strv->c_str(), (*it).second.elcomm.substr(0,128).c_str());
+	      (*it).second.elval.strv->substr(0,800).c_str(), (*it).second.elcomm.substr(0,128).c_str());
       break;
     default :
@@ -469,32 +469,37 @@
 void        ObjFileIO<DVList>::WriteSelf(POutPersist& s) const
 {
-char buf[512];
+char buf[1024];
 string sfw;
-
 int lc = dobj->Comment().length();
-if (lc > 0) {
-  sprintf(buf,"Comment: ( %6d ) ", lc); 
-  sfw = buf;  s.PutStr(sfw);
-  s.PutStr(dobj->Comment());
-  }
-sfw = "----Variable-List---------------";  s.PutStr(sfw);
+//  itab -  0 : Version,  1 : NVar,  2  : Comment length, 3 reserved
+uint_4 itab[4];
+itab[0] = 2;  // Version number = 2 
+itab[1] = dobj->Size(); 
+itab[2] = lc; 
+itab[3] = 0;
+s.Put(itab, 4);
+
+if (lc > 0) s.PutStr(dobj->Comment());
+sfw = "\n----Variable-List---------------\n";  
+s.PutStr(sfw);
+
 DVList::ValList::const_iterator it;
 for(it = dobj->Begin(); it != dobj->End(); it++)  {
-  switch ((*it).second.elval.typ) {
-    case 'I' :
-      sprintf(buf,"I %s %ld", (*it).first.substr(0,64).c_str(), (long)((*it).second.elval.iv) );
+  switch ((*it).second.elval.Type()) {
+    case MuTyV::MTVInteger :
+      sprintf(buf,"I %s %ld\n", (*it).first.substr(0,64).c_str(), (long)((*it).second.elval.iv) );
       sfw = buf;  s.PutStr(sfw);
       break;
-    case 'D' : 
-      sprintf(buf,"D %s %.20g", (*it).first.substr(0,64).c_str(), (*it).second.elval.dv );
+    case MuTyV::MTVFloat : 
+      sprintf(buf,"F %s %.20g\n", (*it).first.substr(0,64).c_str(), (*it).second.elval.dv );
       sfw = buf;  s.PutStr(sfw);
       break;
-    case 'Z' : 
-      sprintf(buf,"Z %s %.20g %.20g", (*it).first.substr(0,64).c_str(), (*it).second.elval.dv, 
+    case MuTyV::MTVComplex : 
+      sprintf(buf,"Z %s %.20g %.20g\n", (*it).first.substr(0,64).c_str(), (*it).second.elval.dv, 
                                       (*it).second.elval.dv_im);
       sfw = buf;  s.PutStr(sfw);
       break;
-    case 'S' : 
-      sprintf(buf,"S %s %s", (*it).first.substr(0,64).c_str(), (*it).second.elval.strv->c_str() );
+    case MuTyV::MTVString : 
+      sprintf(buf,"S %s %s\n", (*it).first.substr(0,64).c_str(), (*it).second.elval.strv->substr(0,960).c_str() );
       sfw = buf;  s.PutStr(sfw);
       break;
@@ -515,5 +520,5 @@
 void        ObjFileIO<DVList>::ReadSelf(PInPersist& s)
 {
-char buf[512];
+char buf[1024];
 string sfr;
 int_8 j,iv,k;
@@ -524,15 +529,21 @@
 dobj->Clear();
 
-s.GetStr(sfr);  // Pour lire les "------- "
-if (sfr[0] != '-') {  // Il y a un champ commentaire a lire 
+//  itab -  0 : Version,  1 : NVar,  2  : Comment length, 3 reserved
+uint_4 itab[4];
+s.Get(itab, 4);
+if (itab[2] > 0) {  // Il y a un champ commentaire a lire 
   s.GetStr(sfr);
   dobj->Comment() = sfr;
   }
+
+s.GetStr(sfr);  // Pour lire les "------- "
 
 string key="";
 while(ok) {
   s.GetStr(sfr);
-  strncpy(buf, sfr.c_str(), 512);
-  buf[511] = '\0';
+  strncpy(buf, sfr.c_str(), 1024);
+  buf[1023] = '\0';
+  j = strlen(buf)-1;
+  if ( (j >= 0) && (buf[j] == '\n') )  buf[j] = '\0';
   if (strncmp(buf,"ZZZZZ",5) == 0)  { ok=false; break; }
   if (buf[0] == '#') {
@@ -548,5 +559,5 @@
       dobj->SetI(key, iv);
       break;
-    case 'D' :
+    case 'F' :
       dv = atof(buf+j+1);
       key = buf+2;
@@ -562,5 +573,5 @@
       dobj->SetZ(key, z);
       break;
-    case 'S' :
+    case  'S' :
       key = buf+2;
       dobj->SetS(key, buf+j+1);
@@ -569,5 +580,7 @@
       break;
     }
-  } 
+  }
+if (dobj->Size() != itab[1])  // Probleme !!!
+  throw FileFormatExc("ObjFileIO<DVList>::ReadSelf() Error in Nb. Variables !");
 }
 
