Index: trunk/ippTools/src/dettool.c
===================================================================
--- trunk/ippTools/src/dettool.c	(revision 7048)
+++ trunk/ippTools/src/dettool.c	(revision 7058)
@@ -6,22 +6,45 @@
 
 #include "pxtools.h"
-#include "p1search.h"
+#include "dettool.h"
 
-static bool pendingMode(pxConfig *config);
 static bool defineMode(pxConfig *config);
-static p1PendingExpRow *rawScienceTop1PendingExp(pxConfig *config, rawScienceExpRow *raw);
+static bool rawMode(pxConfig *config);
+static bool addprocMode(pxConfig *config);
+static bool procMode(pxConfig *config);
+static bool addstacMode(pxConfig *config);
+static bool stacMode(pxConfig *config);
 
 int main(int argc, char **argv)
 {
-    pxConfig *config = p1searchConfig(NULL, argc, argv);
+    pxConfig *config = dettoolConfig(NULL, argc, argv);
 
     switch (config->mode) {
-        case PX_MODE_PENDING:
-            if (!pendingMode(config)) {
+        case DETTOOL_MODE_DEFINE:
+            if (!defineMode(config)) {
                 goto FAIL;
             }
             break;
-        case PX_MODE_DEFINE:
-            if (!defineMode(config)) {
+        case DETTOOL_MODE_RAW:
+            if (!rawMode(config)) {
+                goto FAIL;
+            }
+            break;
+        case DETTOOL_MODE_ADDPROCESSED:
+            if (!addprocMode(config)) {
+                goto FAIL;
+            }
+            break;
+        case DETTOOL_MODE_PROCESSED:
+            if (!procMode(config)) {
+                goto FAIL;
+            }
+            break;
+        case DETTOOL_MODE_ADDSTACKED:
+            if (!addstacMode(config)) {
+                goto FAIL;
+            }
+            break;
+        case DETTOOL_MODE_STACKED:
+            if (!stacMode(config)) {
                 goto FAIL;
             }
@@ -38,83 +61,43 @@
 }
 
-static bool pendingMode(pxConfig *config)
+static bool defineMode(pxConfig *config)
 {
     PS_ASSERT_PTR_NON_NULL(config, false);
-
-    // return all p1PendingExp rows unless there CLI search options
-    psArray *p1PendingExp = p1PendingExpSelectRowObjects(
-        config->dbh,
-        config->where ? config->where : NULL,
-        0
-    );
-    if (!p1PendingExp) {
-        psError(PS_ERR_UNKNOWN, false, "no p1PendingExp found");
-        return false;
-    }
-
-    psMetadata *output = psMetadataAlloc();
-
-    for (long i = 0; i < psArrayLength(p1PendingExp); i++) {
-        psMetadata *md = p1PendingExpMetadataFromObject(p1PendingExp->data[i]);
-        psMetadataAddMetadata(output, PS_LIST_TAIL, "p1PendingExp",
-            PS_META_DUPLICATE_OK, NULL, md);
-        psFree(md);
-    }
-
-    psString str = psMetadataConfigFormat(output);
-    psFree(output);
-
-    fprintf(stdout, "%s\n", str);
-    psFree(str);
 
     return true;
 }
 
-static bool defineMode(pxConfig *config)
+static bool rawMode(pxConfig *config)
 {
     PS_ASSERT_PTR_NON_NULL(config, false);
-    
-    // return all rawScienceExp rows unless there CLI search options
-    psArray *rawScienceExps = rawScienceExpSelectRowObjects(
-        config->dbh,
-        config->where ? config->where : NULL,
-        0
-    );
-
-    if (!rawScienceExps) {
-        psError(PS_ERR_UNKNOWN, false, "no rawScienceExp rows found");
-        return true;
-    }
-
-    // insert the rawScienceExps into p1PendingExp
-    // XXX for the being we're going to skip checking for duplicate entries
-    // XXX this will have to implimented unless duplicate key insertion 
-    // XXX support is implimented in psDB
-    for (long i = 0; i < psArrayLength(rawScienceExps); i++) {
-        p1PendingExpRow * new = rawScienceTop1PendingExp(
-                                            config, rawScienceExps->data[i]);
-        if (!p1PendingExpInsertObject(config->dbh, new)) {
-            psError(PS_ERR_UNKNOWN, false, "dbh access failed");
-            return false; 
-        }
-        psFree(new);
-    }
 
     return true;
 }
 
-static p1PendingExpRow *rawScienceTop1PendingExp(pxConfig *config, rawScienceExpRow *raw)
+static bool addprocMode(pxConfig *config)
 {
-    return p1PendingExpRowAlloc(
-        raw->exp_id,
-        raw->camera,
-        raw->telescope,
-        raw->exp_type,
-//        newExp->class,
-        raw->imfiles,
-        raw->filter,
-        raw->stats,
-        "my recipe",                    //recipe
-        0xff                            // XXX calc version number
-    );
+    PS_ASSERT_PTR_NON_NULL(config, false);
+
+    return true;
 }
+
+static bool procMode(pxConfig *config)
+{
+    PS_ASSERT_PTR_NON_NULL(config, false);
+
+    return true;
+}
+
+static bool addstacMode(pxConfig *config)
+{
+    PS_ASSERT_PTR_NON_NULL(config, false);
+
+    return true;
+}
+
+static bool stacMode(pxConfig *config)
+{
+    PS_ASSERT_PTR_NON_NULL(config, false);
+
+    return true;
+}
