Index: trunk/SophyaExt/FitsIOServer/fitsfile.cc
===================================================================
--- trunk/SophyaExt/FitsIOServer/fitsfile.cc	(revision 1045)
+++ trunk/SophyaExt/FitsIOServer/fitsfile.cc	(revision 1047)
@@ -33,4 +33,5 @@
   nrows_ = 0;
   nbcols_ = 0;
+  fits_status_ = 0;
   naxisn_.clear();
   repeat_.clear();
@@ -125,5 +126,12 @@
 {
   ReadFInit(flnm, hdunum);
-  /*
+  //  ReadFromFits(*this);
+    ReadFromFits();
+}
+
+
+//FitsFile* FitsFile::ReadFInit(char flnm[],int hdunum) 
+void FitsFile::ReadFInit(char flnm[],int hdunum) 
+{
   InitNull();
   int status = 0;
@@ -163,55 +171,7 @@
       moveToFollowingHeader();
     }
-  */
-  ReadFromFits(*this);
-}
-
-
-FitsFile* FitsFile::ReadFInit(char flnm[],int hdunum) 
-{
-  InitNull();
-  int status = 0;
-  //  hdutype_= 0;
-  
-  fits_open_file(&fptr_,flnm,READONLY,&status);
-  if( status ) printerror( status );
-  //
-  if (hdunum <= 1) 
-    {
-      hdunum_ = 1; 
-      // presence of image ?
-      int naxis= 0;
-      fits_read_key(fptr_,TINT,"NAXIS",&naxis,NULL,&status);
-      if( status ) printerror( status );
-      if (naxis > 0 )       // there is an image
-	{
-	  hdutype_ = IMAGE_HDU;
-	  GetImageParameters (fptr_, bitpix_, naxis_, naxisn_);
-	  nbData_ =  1;
-	  int k;
-	  for (k=0; k<naxis_; k++) if (naxisn_[k] > 0) nbData_ *= naxisn_[k];
-	  KeywordsIntoDVList(fptr_, dvl_,hdunum_);
-	}
-      else
-	{
-	  throw PException(" first header : no image, probably error in hdunum");
-	}
-  //
-    }
-  else 
-    {
-      hdunum_ = hdunum-1; 
-      int hdutype;
-      fits_movabs_hdu(fptr_,hdunum_,&hdutype,&status);
-      if( status ) printerror( status,":FitsFile::ReadF : erreur movabs");
-      moveToFollowingHeader();
-    }
-  return this;
-}
-
-void FitsFile::ReadFFromFits() 
-{
-  ReadFromFits(*this);
-}
+  //  return this;
+}
+
 void FitsFile::moveToFollowingHeader()
 {
@@ -261,5 +221,6 @@
 
     }
-  WriteToFits(*this);
+  //  WriteToFits(*this);
+  WriteToFits();
 }
 void FitsFile::GetSingleColumn(double* map, int nentries) const
@@ -636,5 +597,5 @@
 
 
-void FitsFile::GetBinTabLine(int NoLine, double* ddata, float* fdata, int* idata, char ** cdata) const
+void FitsFile::GetBinTabLine(int NoLine, double* ddata, float* fdata, int* idata, char ** cdata) 
 {
   int status= 0;
@@ -656,24 +617,26 @@
 	case 'D' :
 	  fits_read_col(fptr_,TDOUBLE,ncol+1,NoLine+1,1,1,&dnull,&ddata[dcount++],&anull,&status);
-	  if( status ) printerror( status,"GetBinTabLine : erreur lecture de colonne double" );
 	    break;
 	case 'E' :
 	  fits_read_col(fptr_,TFLOAT,ncol+1,NoLine+1,1,1,&fnull,&fdata[fcount++],&anull,&status);
-	  if( status ) printerror( status,"GetBinTabLine : erreur lecture de colonne float" );
 	  break;
 	case 'I' :
 	  fits_read_col(fptr_,TINT,ncol+1,NoLine+1,1,1,&inull,&idata[icount++],
 			&anull,&status);
-	  if( status ) printerror( status,"GetBinTabLine : erreur lecture de colonne tint" );
 	  break;
 	case 'S' :
 	  fits_read_col(fptr_,TSTRING,ncol+1,NoLine+1,1,1,cnull,&cdata[ccount++],&anull,&status);
-	  if( status ) printerror( status,"GetBinTabLine : erreur lecture de colonne char" );
 	  break;
 	}
-    }
-}
-
-void FitsFile::GetBinTabLine(int NoLine, float* fdata) const
+      if (status)
+	{
+	  ResetStatus(status);
+	  break;
+	}
+      //	  if( status ) printerror( status,"GetBinTabLine : erreur lecture de colonne char" );
+    }
+}
+
+void FitsFile::GetBinTabLine(int NoLine, float* fdata) 
 {
   int status= 0;
@@ -685,5 +648,10 @@
     {
       fits_read_col(fptr_,TFLOAT,ncol+1,NoLine+1,1,1,&fnull,&fdata[ncol],&anull,&status);
-      if( status ) printerror( status,"GetBinTabLine : erreur lecture de colonne float" );
+      if (status)
+	{
+	  ResetStatus(status);
+	  break;
+	}
+       //      if( status ) printerror( status,"GetBinTabLine : erreur lecture de colonne float" );
     }
 }
@@ -1066,31 +1034,4 @@
 
 
-void FitsFile::readheader()
-  //*************************************/
-  //* Print out all the header keywords */
-  //*************************************/
-{
-  // standard string lengths defined in fitsioc.h
-  char card[FLEN_CARD];
-
-  int status = 0;
-
-  // get the number of keywords
-  int nkeys, keypos;
-  if( fits_get_hdrpos(fptr_,&nkeys,&keypos,&status) )
-    printerror( status );
-
-  cout << " Header listing for HDU : " << hdunum_ << endl;
-  int jj;
-  for(jj = 1; jj <= nkeys; jj++)  
-    {
-      if( fits_read_record(fptr_,jj,card,&status) )
-	printerror( status );
-      
-      // print the keyword card
-      cout << card << endl; 
-    }
-  cout << "END" << endl;
-}
 
 
@@ -1143,2 +1084,19 @@
   throw IOExc("FitsFile:: error FITSIO status");
 }
+
+int FitsFile::statusF() const
+{
+  return fits_status_;
+}
+void FitsFile::ResetStatus(int& status) 
+{
+  fits_status_ = status;
+  status = 0;
+}
+
+string FitsFile::getErrStatus(int status) 
+{
+  char text[31];
+  fits_get_errstatus(status, text);
+  return string(text);
+}
