Index: unk/ippTools/src/p2insertPendingFrames.c
===================================================================
--- /trunk/ippTools/src/p2insertPendingFrames.c	(revision 10225)
+++ 	(revision )
@@ -1,102 +1,0 @@
-/*
- * p2insertPendingFrames.c
- *
- * Copyright (C) 2006  Joshua Hoblitt
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * program; see the file COPYING. If not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "pxtools.h"
-
-// select pending frames (exposure+images) which are done/not done
-// NOTE this function converts the rawFrames to pendingFrames AND inserts them
-//      this is useful since the table must be locked the whole time, to get the versions
-bool p2insertPendingFrames(pxConfig *config, psArray *rawFrames) {
-    PS_ASSERT_PTR_NON_NULL(config, false);
-    PS_ASSERT_PTR_NON_NULL(rawFrames, false);
-
-    // can we use p2rawToPending() here?
-    for (long i = 0; i < rawFrames->n; i++) {
-        rawScienceFrame *rawFrame = rawFrames->data[i];
-
-        // find the next available version numbers
-        // broken
-        /*
-        psMetadata *where = psMetadataAlloc();
-
-        psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", PS_META_REPLACE, "==",
-            rawFrame->exposure->exp_tag);
-        psArray *exposures = p2PendingExpSelectRowObjects(config->dbh,
-            where, MAX_ROWS);
-        psFree(where);
-        if (!exposures) {
-            psError(PS_ERR_UNKNOWN, false, "no p2PedningExps found");
-            return false;
-        }
-
-        int version = -1;
-        for (long j = 0; j < exposures->n; j++) {
-            p2PendingExpRow *exposure = exposures->data[j];
-            version = PS_MAX(version, exposure->p2_version);
-        }
-        version ++;
-        */
-
-        p2PendingExpRow *pendingExposure = p2PendingExpRowAlloc(
-            rawFrame->exposure->exp_tag,
-            "my recipe",
-            0xff,
-            0xff
-            // pendingExposure->Ndone = 0;
-        );
-
-        psArray *pendingImages = psArrayAllocEmpty(rawFrame->images->n);
-        for (long j = 0; j < rawFrame->images->n; j++) {
-            rawImfileRow *rawImage = rawFrame->images->data[j];
-            p2PendingImfileRow *pendingImage = p2PendingImfileRowAlloc(
-                rawImage->exp_tag,
-                rawImage->class_id,
-                rawImage->uri,
-                "my recipe",
-                0xff, // p1
-                0xff  // p2
-            );
-
-            psArrayAdd(pendingImages, 100, pendingImage);
-        }
-
-        if (!p2PendingExpInsertObject(config->dbh, pendingExposure)) {
-            psError(PS_ERR_UNKNOWN, false, "dbh access failed");
-            return false;
-        }
-
-        for (long i = 0; i < pendingImages->n; i++) {
-            if (!p2PendingImfileInsertObject(config->dbh,
-                    pendingImages->data[i])) {
-                psError(PS_ERR_UNKNOWN, false, "dbh access failed");
-                return false;
-            }
-        }
-    }
-
-    return true;
-}
-
-// XXX the filename layout is defined by this code
-// XXX have the SQL command update the version number?
-// XXX EAM : need to lock the table : inner or outer loop?
Index: unk/ippTools/src/p2pendingToDone.c
===================================================================
--- /trunk/ippTools/src/p2pendingToDone.c	(revision 10225)
+++ 	(revision )
@@ -1,87 +1,0 @@
-/*
- * p2pendingToDone.c
- *
- * Copyright (C) 2006  Joshua Hoblitt
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * program; see the file COPYING. If not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "pxtools.h"
-
-// select pending frames (exposure+images) which are done/not done
-psArray *p2pendingToDone(pxConfig *config, psArray *pendingFrames) {
-    PS_ASSERT_PTR_NON_NULL(config, NULL);
-    PS_ASSERT_PTR_NON_NULL(pendingFrames, NULL);
-
-    psArray *doneFrames = psArrayAllocEmpty(pendingFrames->n);
-
-    for (long i = 0; i < pendingFrames->n; i++) {
-        p2PendingFrame *pendingFrame = pendingFrames->data[i];
-// if (pendingFrame->exposure->state != P2_STATE_DONE) continue;
-
-        p2DoneExpRow *doneExposure = p2DoneExpRowAlloc(
-            pendingFrame->exposure->exp_tag,
-            "my recipe",
-            pendingFrame->exposure->p1_version,
-            pendingFrame->exposure->p2_version
-        );
-
-        psArray *doneImages = psArrayAllocEmpty(pendingFrame->images->n);
-        for (long j = 0; j < pendingFrame->images->n; j++) {
-            p2PendingImfileRow *pendingImage = pendingFrame->images->data[j];
-
-            /*
-            if (pendingImage->state != P2_STATE_DONE) {
-                psAbort ("p2search", "programming error!");
-            }
-            */
-
-            p2DoneImfileRow *doneImage = p2DoneImfileRowAlloc(
-                pendingImage->exp_tag,
-                pendingImage->class_id,
-                pendingImage->uri,
-                "my recipe", // recipe
-                pendingImage->p1_version,
-                pendingImage->p2_version
-            );
-
-            psArrayAdd(doneImages, 100, doneImage);
-        }
-
-        // XXX FIXME
-        p2DoneFrame *doneFrame = p2DoneFrameAlloc(doneExposure, doneImages);
-
-        psArrayAdd(doneFrames, 100, doneFrame);
-    }
-
-    return doneFrames;
-}
-
-p2DoneExpRow *p2pendingToDoneExp(p2PendingExpRow *pendingExp)
-{
-    PS_ASSERT_PTR_NON_NULL(pendingExp, NULL);
-
-    p2DoneExpRow *doneExp = p2DoneExpRowAlloc(
-        pendingExp->exp_tag,
-        "my recipe",
-        pendingExp->p1_version,
-        pendingExp->p2_version
-    );
-
-    return doneExp;
-}
Index: unk/ippTools/src/p2rawToPending.c
===================================================================
--- /trunk/ippTools/src/p2rawToPending.c	(revision 10225)
+++ 	(revision )
@@ -1,76 +1,0 @@
-/*
- * p2rawToPending.c
- *
- * Copyright (C) 2006  Joshua Hoblitt
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * program; see the file COPYING. If not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "pxtools.h"
-
-// select pending frames (exposure+images) which are done/not done
-psArray *p2rawToPending(pxConfig *config, psArray *rawFrames) {
-    PS_ASSERT_PTR_NON_NULL(config, NULL);
-    PS_ASSERT_PTR_NON_NULL(rawFrames, NULL);
-
-    psArray *pendingFrames = psArrayAllocEmpty(rawFrames->n);
-
-    for (long i = 0; i < rawFrames->n; i++) {
-        rawScienceFrame *rawFrame = rawFrames->data[i];
-
-        p2PendingExpRow *pendingExposure = p2PendingExpRowAlloc(
-            rawFrame->exposure->exp_tag,
-            rawFrame->exposure->camera,
-            rawFrame->exposure->telescope,
-            rawFrame->exposure->exp_type,
-            rawFrame->exposure->imfiles,
-            rawFrame->exposure->filter,
-            rawFrame->exposure->airmass,
-            rawFrame->exposure->ra,
-            rawFrame->exposure->decl,
-            rawFrame->exposure->exp_time,
-            rawFrame->exposure->background,
-            "my recipe",
-            0xff,   // p1
-            0xff    // p2
-        );
-
-        psArray *pendingImages = psArrayAllocEmpty(rawFrame->images->n);
-        for (long j = 0; j < rawFrame->images->n; j++) {
-            rawImfileRow *rawImage = rawFrame->images->data[j];
-            p2PendingImfileRow *pendingImage = p2PendingImfileRowAlloc(
-                rawImage->exp_tag,
-                rawImage->class_id,
-                rawImage->uri,
-                "my recipe",     // recipe
-                0xff,   // p1
-                0xff    // p2
-            );
-
-            psArrayAdd(pendingImages, 100, pendingImage);
-        }
-
-        p2PendingFrame *pendingFrame = p2PendingFrameAlloc(pendingExposure,
-            pendingImages);
-        psArrayAdd(pendingFrames, 100, pendingFrame);
-    }
-
-    return pendingFrames;
-}
-
-// XXX the filename layout is defined by this code
Index: unk/ippTools/src/p2searchDoneFrames.c
===================================================================
--- /trunk/ippTools/src/p2searchDoneFrames.c	(revision 10225)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/*
- * p2searchDoneFrames.c
- *
- * Copyright (C) 2006  Joshua Hoblitt
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * program; see the file COPYING. If not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "pxtools.h"
-
-// select raw frames (exposure+images) which match the given config options
-psArray *p2searchDoneFrames(pxConfig *config) {
-    PS_ASSERT_PTR_NON_NULL(config, NULL);
-
-    psArray *exposures = p2DoneExpSelectRowObjects(config->dbh,
-        config->where, MAX_ROWS);
-    if (!exposures) {
-        psError(PS_ERR_UNKNOWN, false, "no p2DoneExp rows found");
-
-        return NULL;
-    }
-
-    // output array of rawScienceFrame
-    psArray *frames = psArrayAllocEmpty(exposures->n);
-
-    for (long i = 0; i < exposures->n; i++) {
-        p2DoneExpRow *exposure = exposures->data[i];
-
-        // 'where' to select each exposure
-        psMetadata *where = psMetadataAlloc ();
-        psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", PS_META_REPLACE, "==",
-            exposure->exp_tag);
-
-        psArray *images = p2DoneImfileSelectRowObjects(config->dbh, where,
-            MAX_ROWS);
-        psFree(where);
-        if (!images) {
-            psError(PS_ERR_UNKNOWN, false, "dbh access failed");
-
-            return NULL;
-        }
-
-        p2DoneFrame *doneFrame = p2DoneFrameAlloc(exposure, images);
-        psArrayAdd(frames, 100, doneFrame);
-    }
-
-    return frames;
-}
Index: unk/ippTools/src/p2searchPendingFrames.c
===================================================================
--- /trunk/ippTools/src/p2searchPendingFrames.c	(revision 10225)
+++ 	(revision )
@@ -1,109 +1,0 @@
-/*
- * p2searchPendingFrames.c
- *
- * Copyright (C) 2006  Joshua Hoblitt
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * program; see the file COPYING. If not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "pxtools.h"
-
-// select pending frames (exposure+images) which are done/not done
-psArray *p0searchPendingFrames(pxConfig *config) {
-    PS_ASSERT_PTR_NON_NULL(config, NULL);
-
-    psArray *exposures = p2PendingExpSelectRowObjects(config->dbh,
-        config->where, MAX_ROWS);
-    if (!exposures) {
-        psError(PS_ERR_UNKNOWN, false, "no p2PendingExp rows found");
-        return NULL;
-    }
-
-
-    // output array of rawSet
-    psArray *frames = psArrayAllocEmpty(exposures->n);
-
-    // 'where' to select each exposure
-    psMetadata *where = psMetadataAlloc();
-    for (long i = 0; i < exposures->n; i++) {
-        p2PendingExpRow *exposure = exposures->data[i];
-
-        psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", PS_META_REPLACE, "==", exposure->exp_tag);
-        psMetadataAddS32(where, PS_LIST_TAIL, "p2_version", PS_META_REPLACE, "==", exposure->p2_version);
-
-        psArray *images = p2PendingImfileSelectRowObjects(config->dbh, where, MAX_ROWS);
-
-        p2PendingFrame *frame = p2PendingFrameAlloc(exposure, images);
-
-        psArrayAdd(frames, 100, frame);
-    }
-
-    return frames;
-}
-
-// XXX EAM : this may be more efficient if we just select all p2PendingImages
-// which have the appropriate state.  that would limit the ability to filter
-// the selection.  test to see how well/poorly this performs
-
-psArray *p2searchPendingImfiles(pxConfig *config)
-{
-    PS_ASSERT_PTR_NON_NULL(config, NULL);
-
-    psArray *imfiles = p2PendingImfileSelectRowObjects(config->dbh,
-        config->where, MAX_ROWS);
-    if (!imfiles) {
-        psError(PS_ERR_UNKNOWN, false, "no rawScienceExp rows found");
-
-        return NULL;
-    }
-
-    return imfiles;
-}
-
-psArray *p2searchPendingExp(pxConfig *config)
-{
-    PS_ASSERT_PTR_NON_NULL(config, NULL);
-
-    // exp_tag is optional
-    bool status = false;
-    psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
-        return false;
-    }
-
-    // search only based on exp_tag -- either they specified it or not
-    psMetadata *where = NULL;
-    if (exp_tag) {
-        where = psMetadataAlloc();
-        if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", 0, "==", exp_tag)) {
-            psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
-            psFree(where);
-            return false;
-        }
-    }
-    psArray *exps = p2PendingExpSelectRowObjects(config->dbh, where, MAX_ROWS);
-    psFree(where);
-    if (!exps) {
-        psError(PS_ERR_UNKNOWN, false, "no p2PendingExp rows found");
-
-        return NULL;
-    }
-
-    return exps;
-}
