Index: trunk/psModules/src/objects/pmSourceIO.c
===================================================================
--- trunk/psModules/src/objects/pmSourceIO.c	(revision 12706)
+++ trunk/psModules/src/objects/pmSourceIO.c	(revision 12832)
@@ -3,6 +3,6 @@
  *  @author EAM, IfA
  *
- *  @version $Revision: 1.33 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2007-03-31 04:18:04 $
+ *  @version $Revision: 1.34 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-04-14 03:22:48 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -66,5 +66,5 @@
 
 // Given a FITS file pointer, write the table of object data
-bool pmFPAviewWriteObjects (const pmFPAview *view, pmFPAfile *file, pmConfig *config)
+bool pmFPAviewWriteObjects (const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
 {
 
@@ -125,5 +125,5 @@
 
 // read in all chip-level Objects files for this FPA
-bool pmFPAWriteObjects (pmFPA *fpa, const pmFPAview *view, pmFPAfile *file, pmConfig *config)
+bool pmFPAWriteObjects (pmFPA *fpa, const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
 {
 
@@ -140,5 +140,5 @@
 
 // read in all cell-level Objects files for this chip
-bool pmChipWriteObjects (pmChip *chip, const pmFPAview *view, pmFPAfile *file, pmConfig *config)
+bool pmChipWriteObjects (pmChip *chip, const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
 {
 
@@ -155,5 +155,5 @@
 
 // read in all readout-level Objects files for this cell
-bool pmCellWriteObjects (pmCell *cell, const pmFPAview *view, pmFPAfile *file, pmConfig *config)
+bool pmCellWriteObjects (pmCell *cell, const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
 {
 
@@ -170,5 +170,5 @@
 
 // write out all readout-level Objects files for this cell
-bool pmReadoutWriteObjects (pmReadout *readout, const pmFPAview *view, pmFPAfile *file, pmConfig *config)
+bool pmReadoutWriteObjects (pmReadout *readout, const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
 {
 
@@ -260,6 +260,6 @@
         // we only need a PHU if chips->n > 1 and file->fileLevel == FPA
         // otherwise, the chip header fills the PHU location
-	// XXX this code could be placed in a 'pmSource_CMF_WritePHU' function and called
-	// from pmFPAfileIO.c.
+        // XXX this code could be placed in a 'pmSource_CMF_WritePHU' function and called
+        // from pmFPAfileIO.c.
         if ((file->fileLevel == PM_FPA_LEVEL_FPA) && (file->fpa->chips->n > 1) && !file->phu) {
 
@@ -275,10 +275,10 @@
                 pmConfigConformHeader (outhead, file->format);
 
-		psMetadata *fileData = psMetadataLookupMetadata(NULL, file->format, "FILE"); // File information
-		const char *fpaNameHdr = psMetadataLookupStr(NULL, fileData, "FPA.NAME");
-		if (fpaNameHdr && strlen(fpaNameHdr) > 0) {
-		    const char *fpaName = psMetadataLookupStr(NULL, file->fpa->concepts, "FPA.NAME");
-		    psMetadataAddStr(outhead, PS_LIST_TAIL, fpaNameHdr, PS_META_REPLACE, "FPA name", fpaName);
-		}
+                psMetadata *fileData = psMetadataLookupMetadata(NULL, file->format, "FILE"); // File information
+                const char *fpaNameHdr = psMetadataLookupStr(NULL, fileData, "FPA.NAME");
+                if (fpaNameHdr && strlen(fpaNameHdr) > 0) {
+                    const char *fpaName = psMetadataLookupStr(NULL, file->fpa->concepts, "FPA.NAME");
+                    psMetadataAddStr(outhead, PS_LIST_TAIL, fpaNameHdr, PS_META_REPLACE, "FPA name", fpaName);
+                }
             }
 
@@ -298,23 +298,23 @@
         // lookup the EXTNAME values used for table data and image header segments
         char *rule = NULL;
-	// Menu of EXTNAME rules
-        psMetadata *menu = psMetadataLookupMetadata(&status, file->camera, "EXTNAME.RULES"); 
-	if (!menu) {
-	    psError(PS_ERR_UNKNOWN, true, "missing EXTNAME.RULES in camera.config");
-	    return false;
-	}
-	// EXTNAME for image header
-	rule = psMetadataLookupStr(&status, menu, "CMF.HEAD"); 
-	if (!rule) {
-	    psError(PS_ERR_UNKNOWN, true, "missing entry for CMF.HEAD in EXTNAME.RULES in camera.config");
-	    return false;
-	}
+        // Menu of EXTNAME rules
+        psMetadata *menu = psMetadataLookupMetadata(&status, file->camera, "EXTNAME.RULES");
+        if (!menu) {
+            psError(PS_ERR_UNKNOWN, true, "missing EXTNAME.RULES in camera.config");
+            return false;
+        }
+        // EXTNAME for image header
+        rule = psMetadataLookupStr(&status, menu, "CMF.HEAD");
+        if (!rule) {
+            psError(PS_ERR_UNKNOWN, true, "missing entry for CMF.HEAD in EXTNAME.RULES in camera.config");
+            return false;
+        }
         headname = pmFPAfileNameFromRule (rule, file, view);
-	// EXTNAME for table data
-        rule = psMetadataLookupStr(&status, menu, "CMF.DATA"); 
-	if (!rule) {
-	    psError(PS_ERR_UNKNOWN, true, "missing entry for CMF.DATA in EXTNAME.RULES in camera.config");
-	    return false;
-	}
+        // EXTNAME for table data
+        rule = psMetadataLookupStr(&status, menu, "CMF.DATA");
+        if (!rule) {
+            psError(PS_ERR_UNKNOWN, true, "missing entry for CMF.DATA in EXTNAME.RULES in camera.config");
+            return false;
+        }
         dataname = pmFPAfileNameFromRule (rule, file, view);
 
@@ -348,31 +348,31 @@
         }
 
-	// create a header to hold the output data
-	outhead = psMetadataAlloc ();
-
-	// determine the output table format 
-	psMetadata *recipe = psMetadataLookupMetadata(&status, config->recipes, "PSPHOT");
-	if (!status) {
-	    psError(PS_ERR_UNKNOWN, true, "missing recipe PSPHOT in config data");
-	    return false;
-	}
-	exttype = psMemIncrRefCounter (psMetadataLookupStr(&status, recipe, "OUTPUT.FORMAT"));
-	if (!exttype) {
-	    exttype = psStringCopy ("SMPDATA");
-	} 
-
-	// write the links to the image header
+        // create a header to hold the output data
+        outhead = psMetadataAlloc ();
+
+        // determine the output table format
+        psMetadata *recipe = psMetadataLookupMetadata(&status, config->recipes, "PSPHOT");
+        if (!status) {
+            psError(PS_ERR_UNKNOWN, true, "missing recipe PSPHOT in config data");
+            return false;
+        }
+        exttype = psMemIncrRefCounter (psMetadataLookupStr(&status, recipe, "OUTPUT.FORMAT"));
+        if (!exttype) {
+            exttype = psStringCopy ("SMPDATA");
+        }
+
+        // write the links to the image header
         psMetadataAddStr (outhead, PS_LIST_TAIL, "EXTHEAD", PS_META_REPLACE, "name of image extension w/", headname);
         psMetadataAddStr (outhead, PS_LIST_TAIL, "EXTTYPE", PS_META_REPLACE, "extension type", exttype);
         psFree (exttype);
 
-	// XXX these are case-sensitive since the EXTYPE is case-sensitive
-	status = false;
-	if (!strcmp (exttype, "SMPDATA")) {
-	    status = pmSourcesWrite_SMPDATA (file->fits, sources, file->header, outhead, dataname);
-	}
-	if (!strcmp (exttype, "PS1_DEV_0")) {
-	    status = pmSourcesWrite_PS1_DEV_0 (file->fits, sources, file->header, outhead, dataname);
-	}
+        // XXX these are case-sensitive since the EXTYPE is case-sensitive
+        status = false;
+        if (!strcmp (exttype, "SMPDATA")) {
+            status = pmSourcesWrite_SMPDATA (file->fits, sources, file->header, outhead, dataname);
+        }
+        if (!strcmp (exttype, "PS1_DEV_0")) {
+            status = pmSourcesWrite_PS1_DEV_0 (file->fits, sources, file->header, outhead, dataname);
+        }
 
         if (!status) {
@@ -400,5 +400,5 @@
 
 // Given a FITS file pointer, read the table of object data
-bool pmFPAviewReadObjects (const pmFPAview *view, pmFPAfile *file, pmConfig *config)
+bool pmFPAviewReadObjects (const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
 {
     pmFPA *fpa = file->fpa;
@@ -439,5 +439,5 @@
 
 // read in all chip-level Objects files for this FPA
-bool pmFPAReadObjects (pmFPA *fpa, const pmFPAview *view, pmFPAfile *file, pmConfig *config)
+bool pmFPAReadObjects (pmFPA *fpa, const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
 {
     for (int i = 0; i < fpa->chips->n; i++) {
@@ -449,5 +449,5 @@
 
 // read in all cell-level Objects files for this chip
-bool pmChipReadObjects (pmChip *chip, const pmFPAview *view, pmFPAfile *file, pmConfig *config)
+bool pmChipReadObjects (pmChip *chip, const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
 {
     chip->data_exists = false;
@@ -455,6 +455,6 @@
         pmCell *cell = chip->cells->data[i];
         pmCellReadObjects (cell, view, file, config);
-	if (!cell->data_exists) continue;
-	chip->data_exists = true;
+        if (!cell->data_exists) continue;
+        chip->data_exists = true;
     }
     return true;
@@ -462,5 +462,5 @@
 
 // read in all readout-level Objects files for this cell
-bool pmCellReadObjects (pmCell *cell, const pmFPAview *view, pmFPAfile *file, pmConfig *config)
+bool pmCellReadObjects (pmCell *cell, const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
 {
     // multiple readout mode is not yet defined for CMP or CMF files
@@ -475,14 +475,14 @@
         pmReadout *readout = cell->readouts->data[i];
         pmReadoutReadObjects (readout, view, file, config);
-	if (!readout->data_exists) {
-	    continue;
-	}
-
-	// load in the concept information for this cell
-	if (!pmConceptsReadCell(cell, PM_CONCEPT_SOURCE_HEADER, true, NULL)) {
-	    //psError(PS_ERR_UNKNOWN, false, "Failed to read concepts for cell");
-	    //return false;
-	    psWarning("Difficulty reading concepts for cell; attempting to proceed.");
-	}
+        if (!readout->data_exists) {
+            continue;
+        }
+
+        // load in the concept information for this cell
+        if (!pmConceptsReadCell(cell, PM_CONCEPT_SOURCE_HEADER, true, NULL)) {
+            //psError(PS_ERR_UNKNOWN, false, "Failed to read concepts for cell");
+            //return false;
+            psWarning("Difficulty reading concepts for cell; attempting to proceed.");
+        }
         cell->data_exists = true;
     }
@@ -491,5 +491,5 @@
 
 // read in all readout-level Objects files for this cell
-bool pmReadoutReadObjects (pmReadout *readout, const pmFPAview *view, pmFPAfile *file, pmConfig *config)
+bool pmReadoutReadObjects (pmReadout *readout, const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
 {
 
@@ -500,10 +500,10 @@
     switch (file->type) {
       case PM_FPA_FILE_OBJ:
-	psError(PS_ERR_UNKNOWN, true, "OBJ is not supported as an input object format");
-	return false;
+        psError(PS_ERR_UNKNOWN, true, "OBJ is not supported as an input object format");
+        return false;
 
       case PM_FPA_FILE_SX:
-	psError(PS_ERR_UNKNOWN, true, "SX is not supported as an input object format");
-	return false;
+        psError(PS_ERR_UNKNOWN, true, "SX is not supported as an input object format");
+        return false;
 
       case PM_FPA_FILE_CMP:
@@ -530,5 +530,5 @@
         psString realname = pmConfigConvertFilename (file->filename, config, create);
 
-	// read the PHU from this file 
+        // read the PHU from this file
         file->fits = psFitsOpen (realname, "r");
         if (hdu->header != NULL) {
@@ -549,34 +549,34 @@
         // lookup the EXTNAME values used for table data and image header segments
         char *rule = NULL;
-	// Menu of EXTNAME rules
+        // Menu of EXTNAME rules
         psMetadata *menu = psMetadataLookupMetadata(&status, file->camera, "EXTNAME.RULES");
-	if (!menu) {
-	    psError(PS_ERR_UNKNOWN, true, "missing EXTNAME.RULES in camera.config");
-	    return false;
-	}
-	// EXTNAME for image header
-	rule = psMetadataLookupStr(&status, menu, "CMF.HEAD");
-	if (!rule) {
-	    psError(PS_ERR_UNKNOWN, true, "missing entry for CMF.HEAD in EXTNAME.RULES in camera.config");
-	    return false;
-	}
+        if (!menu) {
+            psError(PS_ERR_UNKNOWN, true, "missing EXTNAME.RULES in camera.config");
+            return false;
+        }
+        // EXTNAME for image header
+        rule = psMetadataLookupStr(&status, menu, "CMF.HEAD");
+        if (!rule) {
+            psError(PS_ERR_UNKNOWN, true, "missing entry for CMF.HEAD in EXTNAME.RULES in camera.config");
+            return false;
+        }
         char *headname = pmFPAfileNameFromRule (rule, file, view);
-	// EXTNAME for table data
+        // EXTNAME for table data
         rule = psMetadataLookupStr(&status, menu, "CMF.DATA");
-	if (!rule) {
-	    psError(PS_ERR_UNKNOWN, true, "missing entry for CMF.DATA in EXTNAME.RULES in camera.config");
-	    return false;
-	}
+        if (!rule) {
+            psError(PS_ERR_UNKNOWN, true, "missing entry for CMF.DATA in EXTNAME.RULES in camera.config");
+            return false;
+        }
         char *dataname = pmFPAfileNameFromRule (rule, file, view);
 
-	// advance to the IMAGE HEADER extension
+        // advance to the IMAGE HEADER extension
         if (hdu->header == NULL) {
-	    // if the IMAGE header does not exist, we have no data for this view
+            // if the IMAGE header does not exist, we have no data for this view
             if (!psFitsMoveExtName (file->fits, headname)) {
-		readout->data_exists = false;
-		psFree (headname);
-		psFree (dataname);
-		return true;
-	    }
+                readout->data_exists = false;
+                psFree (headname);
+                psFree (dataname);
+                return true;
+            }
             hdu->header = psFitsReadHeader (NULL, file->fits);
         }
@@ -587,32 +587,32 @@
         if (extdata) {
             // if EXTDATA is defined in the header, use that value for 'dataname'
-	    psFree (dataname);
-	    dataname = psMemIncrRefCounter (extdata);
-        }
-	
-	// advance to the table data extension
-	// since we have read the IMAGE header, the TABLE header should exist
+            psFree (dataname);
+            dataname = psMemIncrRefCounter (extdata);
+        }
+
+        // advance to the table data extension
+        // since we have read the IMAGE header, the TABLE header should exist
         if (!psFitsMoveExtName (file->fits, dataname)) {
             psAbort("cannot find data extension %s in %s", dataname, file->filename);
         }
 
-	psMetadata *tableHeader = psFitsReadHeader(NULL, file->fits); // The FITS header
-	if (!tableHeader) psAbort("cannot read table header");
+        psMetadata *tableHeader = psFitsReadHeader(NULL, file->fits); // The FITS header
+        if (!tableHeader) psAbort("cannot read table header");
 
         char *exttype = psMetadataLookupStr (NULL, tableHeader, "EXTTYPE");
-	if (!exttype) psAbort("cannot read table type");
-
-	// XXX these are case-sensitive since the EXTYPE is case-sensitive
-	if (!strcmp (exttype, "SMPDATA")) {
-	    sources = pmSourcesRead_SMPDATA (file->fits, hdu->header);
-	}
-	if (!strcmp (exttype, "PS1_DEV_0")) {
-	    sources = pmSourcesRead_PS1_DEV_0 (file->fits, hdu->header);
-	}
+        if (!exttype) psAbort("cannot read table type");
+
+        // XXX these are case-sensitive since the EXTYPE is case-sensitive
+        if (!strcmp (exttype, "SMPDATA")) {
+            sources = pmSourcesRead_SMPDATA (file->fits, hdu->header);
+        }
+        if (!strcmp (exttype, "PS1_DEV_0")) {
+            sources = pmSourcesRead_PS1_DEV_0 (file->fits, hdu->header);
+        }
 
         psTrace("psModules.objects", 6, "read CMF table from %s : %s : %s", file->filename, headname, dataname);
-	psFree (headname);
+        psFree (headname);
         psFree (dataname);
-	psFree (tableHeader);
+        psFree (tableHeader);
         break;
 
