Index: trunk/SophyaLib/BaseTools/dvlist.cc
===================================================================
--- trunk/SophyaLib/BaseTools/dvlist.cc	(revision 1309)
+++ 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 !");
 }
 
Index: trunk/SophyaLib/BaseTools/dvlist.h
===================================================================
--- trunk/SophyaLib/BaseTools/dvlist.h	(revision 1309)
+++ trunk/SophyaLib/BaseTools/dvlist.h	(revision 1310)
@@ -33,4 +33,9 @@
   void              Clear();
   DVList&           Merge(const DVList&);
+
+  //! Returns the number of elements (variables) in DVList object 
+  inline int	    Size() { return(mvlist.size()); }
+  //! Returns the number of elements (variables) in DVList object 
+  inline int	    NVar() { return(mvlist.size()); }
 
   int_8             GetI(string const& key, int_8 def=-1) const;
Index: trunk/SophyaLib/BaseTools/mutyv.cc
===================================================================
--- trunk/SophyaLib/BaseTools/mutyv.cc	(revision 1309)
+++ trunk/SophyaLib/BaseTools/mutyv.cc	(revision 1310)
@@ -38,5 +38,5 @@
 {
   typ = a.typ;  iv = a.iv;  dv = a.dv;  dv_im = a.dv_im; 
-  if (typ == 'S')  strv = new string(*(a.strv));
+  if (typ == MTVString)  strv = new string(*(a.strv));
   else strv = NULL;
 }
@@ -51,5 +51,5 @@
 MuTyV::MuTyV(char const* s)
 {
-  typ = 'S';
+  typ = MTVString;
   strv = new string(s);
   mutyv_decodestr(s, dv, dv_im);
@@ -60,5 +60,5 @@
 MuTyV::MuTyV(string const& s)
 {
-  typ = 'S';
+  typ = MTVString;
   strv = new string(s);
   mutyv_decodestr(s.c_str(), dv, dv_im);
@@ -70,5 +70,5 @@
 {
   typ = a.typ;  iv = a.iv;  dv = a.dv;  dv_im = a.dv_im; 
-  if (typ == 'S')  { 
+  if (typ == MTVString)  { 
     if (strv) *strv = *(a.strv);  
     else strv = new string(*(a.strv));
@@ -80,5 +80,5 @@
 char * MuTyV::operator= (char* s)
 {
-  typ = 'S';
+  typ = MTVString;
   if (strv) *strv = s;  
   else strv = new string(s);
@@ -91,5 +91,5 @@
 string & MuTyV::operator= (string& s)
 {
-  typ = 'S';
+  typ = MTVString;
   if (strv) *strv = s;  
   else strv = new string(s);
@@ -102,10 +102,10 @@
 MuTyV::operator string() const 
 {
-  if (typ == 'S')  return(*strv);
+  if (typ == MTVString)  return(*strv);
   else {
     char buff[96];
-    if (typ == 'I')  sprintf(buff,"%ld", (long)iv);
-    else if (typ == 'D') sprintf(buff,"%.20g", dv);
-    else if (typ == 'Z') sprintf(buff,"(%.20g , %.20g)", dv, dv_im);
+    if (typ == MTVInteger)  sprintf(buff,"%ld", (long)iv);
+    else if (typ == MTVFloat) sprintf(buff,"%.20g", dv);
+    else if (typ == MTVComplex) sprintf(buff,"(%.20g , %.20g)", dv, dv_im);
     else buff[0] = '\0';
     return(string(buff));
Index: trunk/SophyaLib/BaseTools/mutyv.h
===================================================================
--- trunk/SophyaLib/BaseTools/mutyv.h	(revision 1309)
+++ trunk/SophyaLib/BaseTools/mutyv.h	(revision 1310)
@@ -20,14 +20,21 @@
 public:
 
-  inline MuTyV() { typ = 'I'; iv = 0;  dv = dv_im = 0.;  strv = NULL; }
+  enum MTVType {
+    MTVInteger,
+    MTVFloat,
+    MTVComplex,
+    MTVString
+  };
+
+  inline MuTyV() { typ = MTVInteger; iv = 0;  dv = dv_im = 0.;  strv = NULL; }
          MuTyV(MuTyV const & a);
-  inline MuTyV(uint_2 i) { typ = 'I'; iv = (int_8)i;  dv = (r_8)i;  dv_im = 0.;  strv = NULL; }
-  inline MuTyV(int_4 i)  { typ = 'I'; iv = (int_8)i;  dv = (r_8)i;  dv_im = 0.;  strv = NULL; }
-  inline MuTyV(int_8 i)  { typ = 'I'; iv = i;  dv = (r_8)i;  dv_im = 0.;  strv = NULL; }
-  inline MuTyV(r_4 f) { typ = 'D'; dv = (r_8)f; iv = (int_8)f;  dv_im = 0.;  strv = NULL; } 
-  inline MuTyV(r_8 d) { typ = 'D'; dv = d;  iv = (int_8)d;  dv_im = 0.;  strv = NULL; } 
-  inline MuTyV(complex<r_4> z) { typ = 'Z'; dv = (r_8)z.real();  dv_im = z.imag();  
+  inline MuTyV(uint_2 i) { typ = MTVInteger; iv = (int_8)i;  dv = (r_8)i;  dv_im = 0.;  strv = NULL; }
+  inline MuTyV(int_4 i)  { typ = MTVInteger; iv = (int_8)i;  dv = (r_8)i;  dv_im = 0.;  strv = NULL; }
+  inline MuTyV(int_8 i)  { typ = MTVInteger; iv = i;  dv = (r_8)i;  dv_im = 0.;  strv = NULL; }
+  inline MuTyV(r_4 f) { typ = MTVFloat; dv = (r_8)f; iv = (int_8)f;  dv_im = 0.;  strv = NULL; } 
+  inline MuTyV(r_8 d) { typ = MTVFloat; dv = d;  iv = (int_8)d;  dv_im = 0.;  strv = NULL; } 
+  inline MuTyV(complex<r_4> z) { typ = MTVComplex; dv = (r_8)z.real();  dv_im = z.imag();  
                                  iv = (int_8)dv;  strv = NULL; } 
-  inline MuTyV(complex<r_8> z) { typ = 'Z'; dv = z.real();  dv_im = z.imag();  
+  inline MuTyV(complex<r_8> z) { typ = MTVComplex; dv = z.real();  dv_im = z.imag();  
                                  iv = (int_8)dv;  strv = NULL; } 
 
@@ -37,15 +44,15 @@
          ~MuTyV();
  
-  inline char Type() const { return typ; }
+  inline MTVType Type() const { return typ; }
 
          MuTyV & operator= (MuTyV const & a);
-  inline uint_2  operator= (uint_2 v)  { typ = 'I'; iv = (int_8)v;  dv = (r_8)v;  dv_im = 0.;  return(v); }
-  inline int_4  operator= (int_4 v)  { typ = 'I'; iv = (int_8)v;  dv = (r_8)v;  dv_im = 0.;  return(v); }
-  inline int_8  operator= (int_8 v)  { typ = 'I'; iv = v;  dv = (r_8)v; dv_im = 0.;  return(v); }
-  inline r_4  operator= (r_4 v)  { typ = 'D'; dv = (r_8)v; iv = (int_8)v;  dv_im = 0.;  return(v); }
-  inline r_8  operator= (r_8 v) { typ = 'D'; dv = v; iv = (int_8)v;  dv_im = 0.;  return(v); }
-  inline complex<r_4> operator= (complex<r_4> v) { typ = 'Z'; dv = (r_8)v.real();  dv_im = v.imag();
+  inline uint_2  operator= (uint_2 v)  { typ = MTVInteger; iv = (int_8)v;  dv = (r_8)v;  dv_im = 0.;  return(v); }
+  inline int_4  operator= (int_4 v)  { typ = MTVInteger; iv = (int_8)v;  dv = (r_8)v;  dv_im = 0.;  return(v); }
+  inline int_8  operator= (int_8 v)  { typ = MTVInteger; iv = v;  dv = (r_8)v; dv_im = 0.;  return(v); }
+  inline r_4  operator= (r_4 v)  { typ = MTVFloat; dv = (r_8)v; iv = (int_8)v;  dv_im = 0.;  return(v); }
+  inline r_8  operator= (r_8 v) { typ = MTVFloat; dv = v; iv = (int_8)v;  dv_im = 0.;  return(v); }
+  inline complex<r_4> operator= (complex<r_4> v) { typ = MTVComplex; dv = (r_8)v.real();  dv_im = v.imag();
                                                     iv = (int_8)dv;  return(v); }
-  inline complex<r_8> operator= (complex<r_8> v) { typ = 'Z'; dv = (r_8)v.real();  dv_im = v.imag();
+  inline complex<r_8> operator= (complex<r_8> v) { typ = MTVComplex; dv = (r_8)v.real();  dv_im = v.imag();
                                                     iv = (int_8)dv;  return(v); }
          char*  operator= (char* s);
@@ -66,5 +73,5 @@
   r_8 dv_im;   /* for holding imaginary part of a complex */
   string * strv; 
-  char typ;
+  MTVType typ;
 
 };
Index: trunk/SophyaLib/BaseTools/sversion.h
===================================================================
--- trunk/SophyaLib/BaseTools/sversion.h	(revision 1309)
+++ trunk/SophyaLib/BaseTools/sversion.h	(revision 1310)
@@ -3,5 +3,5 @@
 
 #define SOPHYA_VERSION   0.9 
-#define SOPHYA_REVISION  96
+#define SOPHYA_REVISION  97
 #define SOPHYA_TAG       "V_Oct2000"
 
