Index: trunk/psModules/src/objects/pmSourceIO.c
===================================================================
--- trunk/psModules/src/objects/pmSourceIO.c	(revision 34259)
+++ trunk/psModules/src/objects/pmSourceIO.c	(revision 34268)
@@ -1031,36 +1031,22 @@
         if (!exttype) psAbort("cannot read table type");
 
+# define PM_SOURCES_READ_PSF(NAME,TYPE)				 \
+	if (!strcmp (exttype, NAME)) {				 \
+	    sources = pmSourcesRead_##TYPE(file->fits, hdu->header);	\
+	}									
+
         // XXX these are case-sensitive since the EXTYPE is case-sensitive
         if (file->type == PM_FPA_FILE_CMF) {
-            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 (!strcmp (exttype, "PS1_DEV_1")) {
-                sources = pmSourcesRead_PS1_DEV_1 (file->fits, hdu->header);
-            }
-            if (!strcmp (exttype, "PS1_V1")) {
-                sources = pmSourcesRead_CMF_PS1_V1 (file->fits, hdu->header);
-            }
-            if (!strcmp (exttype, "PS1_V2")) {
-                sources = pmSourcesRead_CMF_PS1_V2 (file->fits, hdu->header);
-            }
-            if (!strcmp (exttype, "PS1_V3")) {
-                sources = pmSourcesRead_CMF_PS1_V3 (file->fits, hdu->header);
-            }
-            if (!strcmp (exttype, "PS1_V4")) {
-                sources = pmSourcesRead_CMF_PS1_V4 (file->fits, hdu->header);
-            }
-            if (!strcmp (exttype, "PS1_SV1")) {
-                sources = pmSourcesRead_CMF_PS1_SV1 (file->fits, hdu->header);
-            }
-            if (!strcmp (exttype, "PS1_DV1")) {
-                sources = pmSourcesRead_CMF_PS1_DV1 (file->fits, hdu->header);
-            }
-            if (!strcmp (exttype, "PS1_DV2")) {
-                sources = pmSourcesRead_CMF_PS1_DV2 (file->fits, hdu->header);
-            }
+	    PM_SOURCES_READ_PSF("SMPDATA",   SMPDATA);
+	    PM_SOURCES_READ_PSF("PS1_DEV_0", PS1_DEV_0);
+	    PM_SOURCES_READ_PSF("PS1_DEV_1", PS1_DEV_1);
+	    PM_SOURCES_READ_PSF("PS1_CAL_0", PS1_CAL_0);
+	    PM_SOURCES_READ_PSF("PS1_V1",    CMF_PS1_V1);
+	    PM_SOURCES_READ_PSF("PS1_V2",    CMF_PS1_V2);
+	    PM_SOURCES_READ_PSF("PS1_V3",    CMF_PS1_V3);
+	    PM_SOURCES_READ_PSF("PS1_V4",    CMF_PS1_V4);
+	    PM_SOURCES_READ_PSF("PS1_SV1",   CMF_PS1_SV1);
+	    PM_SOURCES_READ_PSF("PS1_DV1",   CMF_PS1_DV1);
+	    PM_SOURCES_READ_PSF("PS1_DV2",   CMF_PS1_DV2);
 
             long *sourceIndex = NULL;
@@ -1088,21 +1074,21 @@
             }
             if (XSRC_OUTPUT && xsrcname) {
+		// a cmf file may have an XSRC extension, but it is not required
                 if (!pmReadoutReadXSRC(file, exttype, hdu->header, xsrcname, sources, sourceIndex)) {
-                    // XXX: is this an error?
-                    psErrorClear();
+		    // do anything?
                 }
                 psFree(xsrcname);
             }
             if (XFIT_OUTPUT && xfitname) {
+		// a cmf file may have an XFIT extension, but it is not required
                 if (!pmReadoutReadXFIT(file, exttype, hdu->header, xfitname, sources, sourceIndex)) {
-                    // XXX: is this an error?
-                    psErrorClear();
+		    // do anything?
                 }
                 psFree(xfitname);
             }
             if (XRAD_OUTPUT && xradname) {
+		// a cmf file may have an XRAD extension, but it is not required
                 if (!pmReadoutReadXRAD(file, readout, exttype, hdu->header, xradname, sources, sourceIndex)) {
-                    // XXX: is this an error?
-                    psErrorClear();
+		    // do anything?
                 }
                 psFree(xradname);
@@ -1241,5 +1227,5 @@
 {
     if (!psFitsMoveExtName (file->fits, xsrcname)) {
-        psError(PS_ERR_UNKNOWN, false, "cannot find xsrc extension %s in %s", xsrcname, file->filename);
+        psWarning ("cannot find xsrc extension %s in %s, skipping", xsrcname, file->filename);
         return false;
     }
@@ -1255,10 +1241,22 @@
     }
 
-    // XXX these are case-sensitive since the EXTYPE is case-sensitive
+# define PM_SOURCES_READ_XSRC(NAME,TYPE)				\
+    if (!strcmp (exttype, NAME)) {					\
+	status = pmSourcesRead_##TYPE##_XSRC(file->fits, hduHeader, sources, sourceIndex); \
+    }									
+
     bool status = false;
     if (file->type == PM_FPA_FILE_CMF) {
-        if (!strcmp (exttype, "PS1_SV1")) {
-            status  = pmSourcesRead_CMF_PS1_SV1_XSRC (file->fits, hduHeader, sources, sourceIndex);
-        }
+	PM_SOURCES_READ_XSRC("SMPDATA",   SMPDATA);
+	PM_SOURCES_READ_XSRC("PS1_DEV_0", PS1_DEV_0);
+	PM_SOURCES_READ_XSRC("PS1_DEV_1", PS1_DEV_1);
+	PM_SOURCES_READ_XSRC("PS1_CAL_0", PS1_CAL_0);
+	PM_SOURCES_READ_XSRC("PS1_V1",    CMF_PS1_V1);
+	PM_SOURCES_READ_XSRC("PS1_V2",    CMF_PS1_V2);
+	PM_SOURCES_READ_XSRC("PS1_V3",    CMF_PS1_V3);
+	PM_SOURCES_READ_XSRC("PS1_V4",    CMF_PS1_V4);
+	PM_SOURCES_READ_XSRC("PS1_SV1",   CMF_PS1_SV1);
+	PM_SOURCES_READ_XSRC("PS1_DV1",   CMF_PS1_DV1);
+	PM_SOURCES_READ_XSRC("PS1_DV2",   CMF_PS1_DV2);
     }
     psFree(tableHeader);
@@ -1269,5 +1267,5 @@
 {
     if (!psFitsMoveExtName (file->fits, extname)) {
-        psError(PS_ERR_UNKNOWN, false, "cannot find extension %s in %s", extname, file->filename);
+        psWarning ("cannot find xfit extension %s in %s, skipping", extname, file->filename);
         return false;
     }
@@ -1283,10 +1281,22 @@
     }
 
-    // XXX these are case-sensitive since the EXTYPE is case-sensitive
+# define PM_SOURCES_READ_XFIT(NAME,TYPE)				\
+    if (!strcmp (exttype, NAME)) {					\
+	status = pmSourcesRead_##TYPE##_XFIT(file->fits, hduHeader, sources, sourceIndex); \
+    }									
+
     bool status = false;
     if (file->type == PM_FPA_FILE_CMF) {
-        if (!strcmp (exttype, "PS1_SV1")) {
-            status  = pmSourcesRead_CMF_PS1_SV1_XFIT (file->fits, hduHeader, sources, sourceIndex);
-        }
+	PM_SOURCES_READ_XFIT("SMPDATA",   SMPDATA);
+	PM_SOURCES_READ_XFIT("PS1_DEV_0", PS1_DEV_0);
+	PM_SOURCES_READ_XFIT("PS1_DEV_1", PS1_DEV_1);
+	PM_SOURCES_READ_XFIT("PS1_CAL_0", PS1_CAL_0);
+	PM_SOURCES_READ_XFIT("PS1_V1",    CMF_PS1_V1);
+	PM_SOURCES_READ_XFIT("PS1_V2",    CMF_PS1_V2);
+	PM_SOURCES_READ_XFIT("PS1_V3",    CMF_PS1_V3);
+	PM_SOURCES_READ_XFIT("PS1_V4",    CMF_PS1_V4);
+	PM_SOURCES_READ_XFIT("PS1_SV1",   CMF_PS1_SV1);
+	PM_SOURCES_READ_XFIT("PS1_DV1",   CMF_PS1_DV1);
+	PM_SOURCES_READ_XFIT("PS1_DV2",   CMF_PS1_DV2);
     }
     psFree(tableHeader);
@@ -1296,5 +1306,5 @@
 {
     if (!psFitsMoveExtName (file->fits, extname)) {
-        psError(PS_ERR_UNKNOWN, false, "cannot find extension %s in %s", extname, file->filename);
+        psWarning ("cannot find xrad extension %s in %s, skipping", extname, file->filename);
         return false;
     }
@@ -1310,10 +1320,22 @@
     }
 
-    // XXX these are case-sensitive since the EXTYPE is case-sensitive
+# define PM_SOURCES_READ_XRAD(NAME,TYPE)				\
+    if (!strcmp (exttype, NAME)) {					\
+	status = pmSourcesRead_##TYPE##_XRAD(file->fits, readout, hduHeader, sources, sourceIndex); \
+    }									
+
     bool status = false;
     if (file->type == PM_FPA_FILE_CMF) {
-        if (!strcmp (exttype, "PS1_SV1")) {
-            status  = pmSourcesRead_CMF_PS1_SV1_XRAD (file->fits, readout, hduHeader, sources, sourceIndex);
-        }
+	PM_SOURCES_READ_XRAD("SMPDATA",   SMPDATA);
+	PM_SOURCES_READ_XRAD("PS1_DEV_0", PS1_DEV_0);
+	PM_SOURCES_READ_XRAD("PS1_DEV_1", PS1_DEV_1);
+	PM_SOURCES_READ_XRAD("PS1_CAL_0", PS1_CAL_0);
+	PM_SOURCES_READ_XRAD("PS1_V1",    CMF_PS1_V1);
+	PM_SOURCES_READ_XRAD("PS1_V2",    CMF_PS1_V2);
+	PM_SOURCES_READ_XRAD("PS1_V3",    CMF_PS1_V3);
+	PM_SOURCES_READ_XRAD("PS1_V4",    CMF_PS1_V4);
+	PM_SOURCES_READ_XRAD("PS1_SV1",   CMF_PS1_SV1);
+	PM_SOURCES_READ_XRAD("PS1_DV1",   CMF_PS1_DV1);
+	PM_SOURCES_READ_XRAD("PS1_DV2",   CMF_PS1_DV2);
     }
     psFree(tableHeader);
