Index: /trunk/ippTools/src/pxframes.c
===================================================================
--- /trunk/ippTools/src/pxframes.c	(revision 6223)
+++ /trunk/ippTools/src/pxframes.c	(revision 6224)
@@ -3,64 +3,34 @@
 #include "pxtools.h"
 
-bool rawScienceFramePrint(FILE *stream, pxConfig *config, psArray *frames)
-{
-    PS_ASSERT_PTR_NON_NULL(config, false);
-    PS_ASSERT_PTR_NON_NULL(frames, false);
-
-    psMetadata *output = psMetadataAlloc();
-
-    for (int i = 0; i < frames->n; i++) {
-        rawScienceFrame *frame = frames->data[i];
-        PS_ASSERT_PTR_NON_NULL(frame, false);
-        PS_ASSERT_PTR_NON_NULL(frame->images, false);
-
-        for (int j = 0; j < frame->images->n; j++) {
-            rawImfileRow *image = frame->images->data[j];
-            fprintf (stream, "%s %s %s %s\n",
-                image->exp_id, image->class, image->class_id, image->url);
-            psMetadata *md = rawImfileMetadataFromObject(image);
-            psMetadataAddMetadata(output, PS_LIST_TAIL, "raw",  PS_META_DUPLICATE_OK, NULL, md);
-        }
-    }
-
-    psString str = psMetadataConfigFormat(output);
-    psFree(output);
-    fprintf(stream, "%s\n", str);
-    psFree(str);
-
-    return true;
+#define PX_FRAME_PRINT(frametype, imfiletype) \
+bool frametype##Print(FILE *stream, pxConfig *config, psArray *frames) \
+{\
+    PS_ASSERT_PTR_NON_NULL(config, false); \
+    PS_ASSERT_PTR_NON_NULL(frames, false); \
+\
+    psMetadata *output = psMetadataAlloc(); \
+\
+    for (int i = 0; i < frames->n; i++) { \
+        frametype *frame = frames->data[i]; \
+        PS_ASSERT_PTR_NON_NULL(frame, false); \
+        PS_ASSERT_PTR_NON_NULL(frame->images, false); \
+\
+        for (int j = 0; j < frame->images->n; j++) { \
+            imfiletype##Row *image = frame->images->data[j]; \
+            fprintf (stream, "%s %s %s %s\n", \
+                image->exp_id, image->class, image->class_id, image->url); \
+            psMetadata *md = imfiletype##MetadataFromObject(image); \
+            psMetadataAddMetadata(output, PS_LIST_TAIL, #imfiletype,  PS_META_DUPLICATE_OK, NULL, md); \
+        } \
+    } \
+\
+    psString str = psMetadataConfigFormat(output); \
+    psFree(output); \
+    fprintf(stream, "%s\n", str); \
+    psFree(str); \
+\
+    return true; \
 } 
 
-bool p2PendingFramePrint(FILE *stream, pxConfig *config, psArray *frames)
-{
-    PS_ASSERT_PTR_NON_NULL(config, false);
-    PS_ASSERT_PTR_NON_NULL(frames, false);
-
-    fprintf (stdout, "# exp_id class class_id url\n");
-
-    psMetadata *output = psMetadataAlloc();
-    for (int i = 0; i < frames->n; i++) {
-        p2PendingFrame *frame = frames->data[i];
-        PS_ASSERT_PTR_NON_NULL(frame, false);
-        PS_ASSERT_PTR_NON_NULL(frame->images, false);
-
-        for (int j = 0; j < frame->images->n; j++) {
-            p2PendingImfileRow *image = frame->images->data[j];
-            fprintf (stream, "%s %s %s %s\n",
-                image->exp_id,
-                image->class,
-                image->class_id,
-                image->url
-            );
-            psMetadata *md = p2PendingImfileMetadataFromObject(image);
-            psMetadataAddMetadata(output, PS_LIST_TAIL, "pending",  PS_META_DUPLICATE_OK, NULL, md);
-        }
-    }
-
-    psString str = psMetadataConfigFormat(output);
-    psFree(output);
-    fprintf(stream, "%s\n", str);
-    psFree(str);
-
-    return true;
-} 
+PX_FRAME_PRINT(rawScienceFrame, rawImfile);
+PX_FRAME_PRINT(p2PendingFrame, p2PendingImfile);
