Index: trunk/archive/p2tools/doc/pipeline.txt
===================================================================
--- trunk/archive/p2tools/doc/pipeline.txt	(revision 5878)
+++ 	(revision )
@@ -1,24 +1,0 @@
-
-Phase 2 pipeline tools:
-
-p2define -time (start) (stop) -camera (camera) -region (ra,dec) (ra,dec)
-  * input: searches mddb:raw_exposures,raw_images
-  * output: updates mddb:P2_exposures_pending,P2_images_pending
-  * alternative output: identical to p2pending
- 
-p2pending 
-  * input: searches mddb:P2_exposures_pending,P2_images_pending
-  * output: Nlines consisting of:
-    (expID) (class) (URL) 
-  * options: ?
-
-(place both of these in a single user tool, p2search)
-
-p2search -quick [options]
-p2search -define [options]
-p2search -pending [options]
-p2search -update [options]
-
-ppImage file://path/filename file://path/outroot -recipe (recipe) 
-ppImage neb://nebname neb://outroot -recipe (recipe)
-
Index: trunk/archive/p2tools/src/p2admin.c
===================================================================
--- trunk/archive/p2tools/src/p2admin.c	(revision 5878)
+++ 	(revision )
@@ -1,16 +1,0 @@
-# include "p2search.h"
-
-int main (int argc, char **argv) {
-
-    p2adminConfig (&config, argc, argv);
-
-    if (config->mode == P2_MODE_CREATE) {
-	p2deleteTables (config);
-    }
-
-    if (config->mode == P2_MODE_DELETE) {
-	p2createTables (config);
-    }
-
-    exit (0);
-}
Index: trunk/archive/p2tools/src/p2adminConfig.c
===================================================================
--- trunk/archive/p2tools/src/p2adminConfig.c	(revision 5878)
+++ 	(revision )
@@ -1,64 +1,0 @@
-# include "p2search.h"
-
-bool p2adminConfig (psConfig *config, int argc, char **argv) {
-
-    // Parse the configurations (re-org a la ppImage)
-    config->site = NULL;            // Site configuration
-    config->camera = NULL;          // Camera configuration
-    config->recipe = NULL;          // Recipe configuration
-    if (! pmConfigRead(&config->site, &config->camera, &config->recipe, &argc, argv, RECIPE)) {
-        psErrorStackPrint(stderr, "Can't find site configuration!\n");
-        exit(EXIT_FAILURE);
-    }
-
-    // Parse other command-line arguments
-    config->arguments = psMetadataAlloc(); // The arguments, with default values
-
-    config->mode = P2_MODE_NONE;
-    if ((N = psArgumentGet (*argc, argv, "-create"))) {
-	psArgumentRemove (N, argc, argv);
-	if (config->mode) psAbort ("p2search", "only one mode selection is allowed");
-	config->mode = P2_MODE_CREATE;
-    }
-    if ((N = psArgumentGet (*argc, argv, "-delete"))) {
-	psArgumentRemove (N, argc, argv);
-	if (config->mode) psAbort ("p2search", "only one mode selection is allowed");
-	config->mode = P2_MODE_DELETE;
-    }
-
-    if (config->mode == P2_MODE_NONE) {
-	fprintf (stderr, "admin mode not specified\n");
-        psArgumentHelp(config->arguments);
-        psFree(config->arguments);
-        exit(EXIT_FAILURE);
-    }
-
-    // paul's argument parsing convention requires: -key value 
-    psMetadataAddStr(config->arguments, PS_LIST_TAIL, "-create", 0, "create the P2 tables", "");
-    psMetadataAddStr(config->arguments, PS_LIST_TAIL, "-delete", 0, "delete the P2 tables", "");
-
-    if ((N = psArgumentGet (*argc, argv, "-help"))) {
-        psArgumentHelp(config->arguments);
-        psFree(config->arguments);
-        exit(EXIT_FAILURE);
-    }
-
-    if (! psArgumentParse(config->arguments, &argc, argv) || argc != 1) {
-        printf("\nPan-STARRS Phase 2 Admin Tool\n\n");
-        printf("Usage: %s [mode]\n", argv[0]);
-        printf(" [mode] : -create | -delete\n\n");
-        psArgumentHelp(config->arguments);
-        psFree(config->arguments);
-        exit(EXIT_FAILURE);
-    }
-
-    // define Database handle, if used
-    config->database = pmConfigDB(config->site);
-    return true;
-} 
-
-/*
- * USAGE:
- * p2admin -create : create the P2 tables
- * p2admin -delete : delete the P2 tables (asks for confirmation)
- */
Index: trunk/archive/p2tools/src/p2adminTables.c
===================================================================
--- trunk/archive/p2tools/src/p2adminTables.c	(revision 5878)
+++ 	(revision )
@@ -1,38 +1,0 @@
-# include "p2search.h"
-
-bool p2createTables (p2config *config) {
-
-    p2PendingImageCreateTable (config->database);
-    p2PendingExposureCreateTable (config->database);
-
-    return true;
-}
-
-bool p2deleteTables (p2config *config) {
-
-    char line[128], answer[128];
-
-    fprintf (stdout, "*** delete the P2 tables? ***\n");
-    fprintf (stdout, "*** to delete the tables, answer YES, and give password ***\n");
-    fprintf (stdout, "*** WARNING: this action is permanent ***\n\n");
-
-    fprintf (stdout, "delete the P2 tables [n]:  \n");
-    fgets (line, 128, stdin);
-    sscanf (line, "%s", answer);
-    if (strcmp (answer, "YES")) goto escape;
-
-    fprintf (stdout, "enter password:  \n");
-    fgets (line, 128, stdin);
-    sscanf (line, "%s", answer);
-    if (strcmp (answer, "*ipp*")) goto escape;
-
-    p2PendingImageDropTable (config->database);
-    p2PendingExposureDropTable (config->database);
-
-    return true;
-
-
-escape:
-    fprintf (stdout, "tables NOT deleted\n");
-    return false;
-}
Index: trunk/archive/p2tools/src/p2insertDoneFrames.c
===================================================================
--- trunk/archive/p2tools/src/p2insertDoneFrames.c	(revision 5878)
+++ 	(revision )
@@ -1,19 +1,0 @@
-# include "p2search.h"
-
-// select pending frames (exposure+images) which are done/not done
-bool p2insertDoneFrames (p2SearchConfig *config, psArray *doneFrames) {
-
-    for (int i = 0; i < doneFrames->n; i++) {
-	p2DoneFrame *doneFrame = doneFrames->data[i];
-	p2DoneExposure *doneExposure = doneFrame->exposure;
-	
-	psArray *doneImages = doneFrame->images;
-	
-	p2DoneExposureInsertOneRow (config->database, doneExposure);
-	p2DoneImageInsertRows (config->database, doneImages);
-    }
-    return true;
-} 
-
-// XXX : must remove the done frames from the pending table, or we'll get duplicates
-// XXX : add P3pending insert function? selected on recipe type? 
Index: trunk/archive/p2tools/src/p2insertPendingFrames.c
===================================================================
--- trunk/archive/p2tools/src/p2insertPendingFrames.c	(revision 5878)
+++ 	(revision )
@@ -1,62 +1,0 @@
-# include "p2search.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 (p2SearchConfig *config, psArray *rawFrames) {
-
-    psMetadata *where = psMetadataAlloc ();
-
-    for (int i = 0; i < rawFrames->n; i++) {
-	ppRawFrame *rawFrame = rawFrames->data[i];
-
-	// find the next available version numbers
-	psMetadataAddStr (where, PS_LIST_TAIL, "EXP_ID", PS_META_REPLACE, "==", rawFrame->exposure->expID);
-	psArray *exposures = p2PendingExposureSelectRows (config->database, where, MAX_ROWS);
-	int version = -1;
-	for (int j = 0; j < exposures->n; j++) {
-	    p2PendingExposure *exposure = exposures->data[j];
-	    version = PS_MAX (version, exposure->P2version);
-	}
-	version ++;
-
-	p2PendingExposure *pendingExposure = p2PendingExposureAlloc ();
-	strcpy (pendingExposure->expID, rawFrame->exposure->expID);
-	pendingExposure->class = rawFrame->exposure->class;
-	pendingExposure->Nclass = rawFrame->exposure->Nclass;
-	pendingExposure->Ndone = 0;
-	pendingExposure->P1version = 0xff;
-	pendingExposure->P2version = version;
-	pendingExposure->state = P2_STATE_PENDING;
-
-	psArray *pendingImages = psArrayAlloc (rawFrame->images->n);
-	pendingImages->n = 0;
-	for (int j = 0; j < rawFrame->images->n; j++) {
-	    ppRawImage *rawImage = rawFrame->images->data[j];
-	    p2PendingImage *pendingImage = p2PendingImageAlloc ();
-
-	    strcpy (pendingImage->expID, rawImage->expID);
-	    pendingImage->P2version = version;
-	    pendingImage->class = rawImage->class;
-	    strcpy (pendingImage->classID, rawImage->classID);
-
-	    // XXX cleanup the url somehow
-	    strcpy (pendingImage->urlroot = rawImage->url);
-	    strcpy (pendingImage->input, "raw.fits");
-	    strcpy (pendingImage->output, "flt.fits");
-	    strcpy (pendingImage->log, "log");
-	    strcpy (pendingImage->smf, "smf");
-	    pendingImage->state = P2_STATE_PENDING;
-
-	    psArrayAdd (pendingImages, 100, pendingImage);
-	}
-	
-	p2PendingExposureInsertOneRow (config->database, pendingExposure);
-	p2PendingImageInsertRows (config->database, pendingImages);
-    }
-    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: trunk/archive/p2tools/src/p2pendingToDone.c
===================================================================
--- trunk/archive/p2tools/src/p2pendingToDone.c	(revision 5878)
+++ 	(revision )
@@ -1,51 +1,0 @@
-# include "p2search.h"
-
-// select pending frames (exposure+images) which are done/not done
-psArray *p2pendingToDone (p2SearchConfig *config, psArray *pendingFrames) {
-
-    psArray *doneFrames = psArrayAlloc (frames->n);
-    doneFrames->n = 0;
-
-    for (int i = 0; i < pendingFrames->n; i++) {
-	ppPendingFrame *pendingFrame = pendingFrames->data[i];
-	if (pendingFrame->exposure->state != P2_STATE_DONE) continue;
-
-	p2DoneExposure *doneExposure = p2DoneExposureAlloc ();
-	strcpy (doneExposure->expID, pendingFrame->exposure->expID);
-	doneExposure->class = pendingFrame->exposure->class;
-	doneExposure->Nclass = pendingFrame->exposure->Nclass;
-	doneExposure->Ndone = pendingFrame->exposure->Nclass;
-	doneExposure->P1version = pendingFrame->exposure->P1version;
-	doneExposure->P2version = pendingFrame->exposure->P2version;
-	doneExposure->state = P2_STATE_DONE;
-
-	psArray *doneImages = psArrayAlloc (pendingFrame->images->n);
-	doneImages->n = 0;
-	for (int j = 0; j < pendingFrame->images->n; j++) {
-	    ppPendingImage *pendingImage = pendingFrame->images->data[j];
-	    if (pendingImage->state != P2_STATE_DONE) {
-		psAbort ("p2search", "programming error!");
-	    }
-
-	    p2DoneImage *doneImage = p2DoneImageAlloc ();
-
-	    strcpy (doneImage->expID, pendingImage->expID);
-	    doneImage->P2version = pendingImage->P2version;
-	    doneImage->class = pendingImage->class;
-	    strcpy (doneImage->classID, pendingImage->classID);
-	    strcpy (doneImage->urlroot, pendingImage->urlroot);
-	    strcpy (doneImage->input,   pendingImage->input);
-	    strcpy (doneImage->output,  pendingImage->output);
-	    strcpy (doneImage->log,     pendingImage->log);
-	    strcpy (doneImage->smf,     pendingImage->smf);
-	    doneImage->state = P2_STATE_DONE;
-	    psArrayAdd (doneImages, 100, doneImage);
-	}
-	
-	p2DoneFrame *doneFrame = p2DoneFrameAlloc (doneExposure, doneImages);
-	psArrayAdd (doneFrames, 100, doneFrame);
-    }
-    return doneFrames;
-} 
-
-// XXX the filename layout is defined by this code
Index: trunk/archive/p2tools/src/p2rawToPending.c
===================================================================
--- trunk/archive/p2tools/src/p2rawToPending.c	(revision 5878)
+++ 	(revision )
@@ -1,48 +1,0 @@
-# include "p2search.h"
-
-// select pending frames (exposure+images) which are done/not done
-psArray *p2rawToPending (p2SearchConfig *config, psArray *rawFrames) {
-
-    psArray *pendingFrames = psArrayAlloc (frames->n);
-    pendingFrames->n = 0;
-
-    for (int i = 0; i < rawFrames->n; i++) {
-	ppRawFrame *rawFrame = rawFrames->data[i];
-
-	p2PendingExposure *pendingExposure = p2PendingExposureAlloc ();
-	strcpy (pendingExposure->expID, rawFrame->exposure->expID);
-	pendingExposure->class = rawFrame->exposure->class;
-	pendingExposure->Nclass = rawFrame->exposure->Nclass;
-	pendingExposure->Ndone = 0;
-	pendingExposure->P1version = 0xff;
-	pendingExposure->P2version = 0xff;
-	pendingExposure->state = P2_STATE_PENDING;
-
-	psArray *pendingImages = psArrayAlloc (rawFrame->images->n);
-	pendingImages->n = 0;
-	for (int j = 0; j < rawFrame->images->n; j++) {
-	    ppRawImage *rawImage = rawFrame->images->data[j];
-	    p2PendingImage *pendingImage = p2PendingImageAlloc ();
-
-	    strcpy (pendingImage->expID, rawImage->expID);
-	    pendingImage->P2version = 0xff;
-	    pendingImage->class = rawImage->;
-	    strcpy (pendingImage->classID, rawImage->classID);
-
-	    pendingImage->urlroot = rawImage->;
-	    strcpy (pendingImage->input, "raw.fits");
-	    strcpy (pendingImage->output, "flt.fits");
-	    strcpy (pendingImage->log, "log");
-	    strcpy (pendingImage->smf, "smf");
-	    pendingImage->state = P2_STATE_PENDING;
-
-	    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: trunk/archive/p2tools/src/p2search.c
===================================================================
--- trunk/archive/p2tools/src/p2search.c	(revision 5878)
+++ 	(revision )
@@ -1,38 +1,0 @@
-# include "p2search.h"
-
-int main (int argc, char **argv) {
-
-    psArray *rawFrames;
-    psArray *doneFrames;
-    psArray *pendingFrames;
-
-    p2searchConfig (&config, argc, argv);
-
-    if (config->mode == P2_MODE_QUICK) {
-	rawFrames = p2searchRawFrames (config);
-	pendingFrames = p2rawToPending (config, rawFrames);
-	p2writePendingFrames (config, pendingFrames);
-    }	
-
-    if (config->mode == P2_MODE_DEFINE) {
-	rawFrames = p2searchRawFrames (config);
-	p2insertPendingFrames (config, rawFrames);
-    }
-
-    if (config->mode == P2_MODE_PENDING) {
-	pendingFrames = p2searchPendingFrames (config, FALSE);
-	p2writePendingImages (config, pendingFrames);
-    }
-
-    if (config->mode == P2_MODE_UPDATE) {
-	p2updatePendingFrames (config, pendingFrames);
-    }
-
-    if (config->mode == P2_MODE_DONE) {
-	pendingFrames = p2searchPendingFrames (config, TRUE);
-	doneFrames = p2pendingToDone (config);
-	p2insertDoneFrames (config, doneFrames);
-    }
-
-    exit (0);
-}
Index: trunk/archive/p2tools/src/p2search.h
===================================================================
--- trunk/archive/p2tools/src/p2search.h	(revision 5878)
+++ 	(revision )
@@ -1,125 +1,0 @@
-# include <stdio.h>
-# include <strings.h>  // for strcasecmp
-# include <unistd.h>   // for unlink
-# include <pslib.h>
-# include <pmObjects.h>
-# include <pmPSF.h>
-# include <pmPSFtry.h>
-# include <pmModelGroup.h>
-
-// load these values from the db in the init stage
-# define P2_TYPE_OBJECT 1
-# define P2_STATE_READY 2
-
-typedef enum {
-    P2_MODE_NONE,		      	// grab from raw, output for ppImage
-    P2_MODE_QUICK,		      	// grab from raw, output for ppImage
-    P2_MODE_DEFINE,			// grab from raw, create pending
-    P2_MODE_PENDING,			// grab from pending, output for ppImage
-    P2_MODE_UPDATE,			// set the current state
-    P2_MODE_DONE,			// set the current state
-    P2_MODE_CREATE,			// set the current state
-    P2_MODE_DELETE,			// set the current state
-} p2mode;
-
-typedef struct {
-    p2mode mode;
-    psTime start;
-    psTime stop;
-    psSphere r1;
-    psSphere r2;
-    char *camera;
-    char *filter;
-    psDB *database;
-} p2config;
-
-// this structure should be defined using the mddb api tools
-typedef struct {
-    char expID[32];			// free-form exposure ID string
-    char class;				// class of file: fpa (0), chip (1), cell (2), readout (3)?
-    int Nclass;				// number of files of this class
-    char camera[32];			// free-form camera ID string
-    char filter[32];			// free-form filter ID string
-    psTime time_start;			// exposure start time
-    psTime time_stop;			// exposure stop time
-    psTime exptime;			// exposure duration (seconds)
-    char exptype;			// type of exposure: object (0), bias (1), dark (2), flat (3), etc
-    float sky;				// measure sky brightness
-    float seeing;			// measured image quality 
-    float dettemp;			// temperature of detector
-} ppRawExposure;
-
-// this structure should be defined using the mddb api tools
-typedef struct {
-    char expID[32];			// free-form exposure ID string
-    char class;				// class of file: fpa (0), chip (1), cell (2), readout (3)?
-    char classID[32];			// identifier for class (chip00, cell00, etc)
-    char url[128];			// locator for file (neb / file)
-    char state;				// current load state
-} ppRawImfile;
-
-// this structure should be defined using the mddb api tools
-typedef struct {
-    char expID[32];			// free-form exposure ID string
-    char class;				// class of file: fpa (0), chip (1), cell (2), readout (3)?
-    int Nclass;				// number of files of this class
-    int Ndone;				// number of files of this class
-    char P1version;
-    char P2version;
-    char state;
-} p2PendingExposure;
-
-// this structure should be defined using the mddb api tools
-typedef struct {
-    char expID[32];			// free-form exposure ID string
-    char P2version;
-    char class;				// class of file: fpa (0), chip (1), cell (2), readout (3)?
-    char classID[32];			// identifier for class (chip00, cell00, etc)
-    char urlroot[128];			// locator for file (neb / file)
-    char input[16];			// extension for input image
-    char output[16];			// extension for output image
-    char log[16];			// extension for log file
-    char smf[16];			// extension for object table
-    char state;				// current P2 state
-} p2PendingImfile;
-
-// this structure should be defined using the mddb api tools
-typedef struct {
-    char expID[32];			// free-form exposure ID string
-    char class;				// class of file: fpa (0), chip (1), cell (2), readout (3)?
-    int Nclass;				// number of files of this class
-    int Ndone;				// number of files of this class
-    char P1version;
-    char P2version;
-    char state;
-} p2DoneExposure;
-
-// this structure should be defined using the mddb api tools
-typedef struct {
-    char expID[32];			// free-form exposure ID string
-    char P2version;
-    char class;				// class of file: fpa (0), chip (1), cell (2), readout (3)?
-    char classID[32];			// identifier for class (chip00, cell00, etc)
-    char urlroot[128];			// locator for file (neb / file)
-    char input[16];			// extension for input image
-    char output[16];			// extension for output image
-    char log[16];			// extension for log file
-    char smf[16];			// extension for object table
-    char state;				// current P2 state
-} p2DoneImfile;
-
-typedef struct {
-    ppRawExposure *exposure;
-    psArray *images;
-} ppRawFrame;
-
-typedef struct {
-    ppPendingExposure *exposure;
-    psArray *images;
-} p2PendingFrame;
-
-typedef struct {
-    ppDoneExposure *exposure;
-    psArray *images;
-} p2DoneFrame;
-
Index: trunk/archive/p2tools/src/p2searchConfig.c
===================================================================
--- trunk/archive/p2tools/src/p2searchConfig.c	(revision 5878)
+++ 	(revision )
@@ -1,68 +1,0 @@
-# include "p2search.h"
-
-bool p2searchConfig (psConfig *config, int argc, char **argv) {
-
-    // Parse the configurations (re-org a la ppImage)
-    config->site = NULL;            // Site configuration
-    config->camera = NULL;          // Camera configuration
-    config->recipe = NULL;          // Recipe configuration
-    if (! pmConfigRead(&config->site, &config->camera, &config->recipe, &argc, argv, RECIPE)) {
-        psErrorStackPrint(stderr, "Can't find site configuration!\n");
-        exit(EXIT_FAILURE);
-    }
-
-    // Parse other command-line arguments
-    config->arguments = psMetadataAlloc(); // The arguments, with default values
-
-    config->mode = P2_MODE_NONE;
-    if ((N = psArgumentGet (*argc, argv, "-quick"))) {
-	psArgumentRemove (N, argc, argv);
-	if (config->mode) psAbort ("p2search", "only one mode selection is allowed");
-	config->mode = P2_MODE_QUICK;
-    }
-    if ((N = psArgumentGet (*argc, argv, "-define"))) {
-	psArgumentRemove (N, argc, argv);
-	if (config->mode) psAbort ("p2search", "only one mode selection is allowed");
-	config->mode = P2_MODE_DEFINE;
-    }
-    if ((N = psArgumentGet (*argc, argv, "-pending"))) {
-	psArgumentRemove (N, argc, argv);
-	if (config->mode) psAbort ("p2search", "only one mode selection is allowed");
-	config->mode = P2_MODE_PENDING;
-    }
-    if ((N = psArgumentGet (*argc, argv, "-update"))) {
-	psArgumentRemove (N, argc, argv);
-	if (config->mode) psAbort ("p2search", "only one mode selection is allowed");
-	config->mode = P2_MODE_UPDATE;
-    }
-    if ((N = psArgumentGet (*argc, argv, "-done"))) {
-	psArgumentRemove (N, argc, argv);
-	if (config->mode) psAbort ("p2search", "only one mode selection is allowed");
-	config->mode = P2_MODE_UPDATE;
-    }
-
-    // paul's argument parsing convention requires: -key value 
-    psMetadataAddStr(config->arguments, PS_LIST_TAIL, "-quick",   0, "examine raw image table, write ppImage output", "");
-    psMetadataAddStr(config->arguments, PS_LIST_TAIL, "-define",  0, "examine raw image table, add to pending image table", "");
-    psMetadataAddStr(config->arguments, PS_LIST_TAIL, "-pending", 0, "examine pending image table, write ppImage output", "");
-    psMetadataAddStr(config->arguments, PS_LIST_TAIL, "-update",  0, "update pending image table", "");
-    psMetadataAddS32(config->arguments, PS_LIST_TAIL, "-time",    0, "define time range of interest", "");
-    psMetadataAddS32(config->arguments, PS_LIST_TAIL, "-camera",  0, "define camera of interest", "");
-    psMetadataAddS32(config->arguments, PS_LIST_TAIL, "-filter",  0, "define filter of interest", "");
-
-    if (! psArgumentParse(config->arguments, &argc, argv) || argc != 2) {
-        printf("\nPan-STARRS Phase 2 Search Tool\n\n");
-        printf("Usage: %s [mode] [options]\n\n", argv[0]);
-        printf(" [mode] : -quick | -define | -pending | -update\n\n");
-        psArgumentHelp(config->arguments);
-        psFree(config->arguments);
-        exit(EXIT_FAILURE);
-    }
-
-    // add the input and output images to the arguments list
-    psMetadataAddStr (config->arguments, PS_LIST_TAIL, "-output", 0, "Name of the output image", argv[1]);
-
-    // define Database handle, if used
-    config->database = pmConfigDB(config->site);
-    return true;
-} 
Index: trunk/archive/p2tools/src/p2searchPendingFrames.c
===================================================================
--- trunk/archive/p2tools/src/p2searchPendingFrames.c	(revision 5878)
+++ 	(revision )
@@ -1,52 +1,0 @@
-# include "p2search.h"
-
-// select pending frames (exposure+images) which are done/not done
-psArray *p2searchPendingFrames (p2SearchConfig *config, bool isDone) {
-
-    // build 'where' structure
-    psMetadata *where = psMetadataAlloc ();
-
-    if (isDone) {
-	psMetadataAddStr (where, PS_LIST_TAIL, "STATE", 0, "==", P2_STATE_DONE);
-    } else {
-	psMetadataAddStr (where, PS_LIST_TAIL, "STATE", 0, "==", P2_STATE_PENDING);
-    }
-
-    // in order to include these restrictions, we need to define these table columns
-    if (config->camera != NULL) {
-	psMetadataAddStr (where, PS_LIST_TAIL, "CAMERA", 0, "==", config->camera);
-    }
-    if (config->filter != NULL) {
-	psMetadataAddStr (where, PS_LIST_TAIL, "FILTER", 0, "==", config->filter);
-    }
-    if (!psTimeIsZero(config->start) && !psTimeIsZero(config->stop)) {
-	psMetadataAddTime (where, PS_LIST_TAIL, "TIME_START", 0, "<", config->time_stop);
-	psMetadataAddTime (where, PS_LIST_TAIL, "TIME_STOP", 0, ">", config->time_start);
-    }
-
-    psArray *exposures = p2PendingExposureSelectRows (config->database, where, MAX_ROWS);
-    psFree (where);
-
-    // output array of rawSet
-    psArray *frames = psArrayAlloc (exposures->n);
-
-    // 'where' to select each exposure
-    psMetadata *where = psMetadataAlloc ();
-    for (int i = 0; i < exposures->n; i++) {
-	p2PendingExposure *exposure = exposures->data[i];
-	
-	psMetadataAddStr (where, PS_LIST_TAIL, "EXP_ID", PS_META_REPLACE, "==", exposure->expID);
-	psMetadataAddStr (where, PS_LIST_TAIL, "P2_VERSION", PS_META_REPLACE, "==", exposure->P2version);
-
-	psArray *images = ppPendingImageSelectRows (config->database, where, MAX_ROWS);
-
-	ppPendingFrame *frame = ppPendingFrameAlloc (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
Index: trunk/archive/p2tools/src/p2searchRawFrames.c
===================================================================
--- trunk/archive/p2tools/src/p2searchRawFrames.c	(revision 5878)
+++ 	(revision )
@@ -1,42 +1,0 @@
-# include "p2search.h"
-
-// select raw frames (exposure+images) which match the given config options
-psArray p2searchRawImages (p2SearchConfig *config) {
-
-    // build 'where' structure
-    psMetadata *where = psMetadataAlloc ();
-
-    psMetadataAddU8  (where, PS_LIST_TAIL, "TYPE",  0, "==", P2_TYPE_OBJECT);
-    psMetadataAddStr (where, PS_LIST_TAIL, "STATE", 0, "==", P2_START_READY);
-
-    if (config->camera != NULL) {
-	psMetadataAddStr (where, PS_LIST_TAIL, "CAMERA", 0, "==", config->camera);
-    }
-    if (config->filter != NULL) {
-	psMetadataAddStr (where, PS_LIST_TAIL, "FILTER", 0, "==", config->filter);
-    }
-    if (!psTimeIsZero(config->start) && !psTimeIsZero(config->stop)) {
-	psMetadataAddTime (where, PS_LIST_TAIL, "TIME_START", 0, "<", config->time_stop);
-	psMetadataAddTime (where, PS_LIST_TAIL, "TIME_STOP", 0, ">", config->time_start);
-    }
-
-    psArray *exposures = ppRawExposureSelectRows (config->database, where, MAX_ROWS);
-    psFree (where);
-
-    // output array of ppRawFrame
-    psArray *frames = psArrayAlloc (exposures->n);
-
-    // 'where' to select each exposure
-    psMetadata *where = psMetadataAlloc ();
-    for (int i = 0; i < exposures->n; i++) {
-	ppRawExposure *exposure = exposures->data[i];
-	
-	psMetadataAddStr (where, PS_LIST_TAIL, "EXP_ID", PS_META_REPLACE, "==", exposure->expID);
-
-	psArray *images = ppRawImageSelectRows (config->database, where, MAX_ROWS);
-
-	ppRawFrame *frame = ppRawFrameAlloc (exposure, images);
-	psArrayAdd (frames, 100, frame);
-    }
-    return frames;
-} 
Index: trunk/archive/p2tools/src/p2updatePending.c
===================================================================
--- trunk/archive/p2tools/src/p2updatePending.c	(revision 5878)
+++ 	(revision )
@@ -1,31 +1,0 @@
-# include "p2search.h"
-
-// select pending frames (exposure+images) which are not done, select their done images, count, update
-bool p2updatePendingFrames (p2SearchConfig *config, psArray *pendingFrames) {
-
-    psMetadata *where = psMetadataAlloc ();
-
-    // select all of the exposures which are still pending
-    psMetadataAddStr (where, PS_LIST_TAIL, "STATE", 0, "==", P2_STATE_PENDING);
-    psArray *exposures = p2PendingExposureSelectRows (config->database, where, MAX_ROWS);
-
-    // we will now select all of the matching images which are done
-    psMetadataAddStr (where, PS_LIST_TAIL, "STATE", PS_META_REPLACE, "==", P2_STATE_DONE);
-    for (int i = 0; i < exposures->n; i++) {
-	p2PendingExposure *exposure = exposures->data[i];
-
-	// find the next available version numbers
-	psMetadataAddStr (where, PS_LIST_TAIL, "EXP_ID",     PS_META_REPLACE, "==", exposure->expID);
-	psMetadataAddStr (where, PS_LIST_TAIL, "P2_VERSION", PS_META_REPLACE, "==", exposure->P2version);
-	psArray *images = p2PendingImageSelectRows (config->database, where, MAX_ROWS);
-	if (images->n != exposure->Nclass) {
-	    // free things
-	    continue;
-	}
-	// frame is complete, set exposure state to done
-	// XXX add P2 stats here?
-	exposure->state = P2_STATE_DONE;
-	p2PendingExposureUpdateRows (config->database, exposure);
-    }
-    return true;
-} 
Index: trunk/archive/p2tools/src/p2writePendingFrames.c
===================================================================
--- trunk/archive/p2tools/src/p2writePendingFrames.c	(revision 5878)
+++ 	(revision )
@@ -1,25 +1,0 @@
-# include "p2search.h"
-
-// select pending frames (exposure+images) which are done/not done
-bool p2writePendingImages (p2SearchConfig *config, psArray *frames) {
-
-    for (int i = 0; i < frames->n; i++) {
-	p2PendingFrame *frame = frames->data[i];
-	
-	for (int j = 0; j < frame->images->n; j++) {
-	    p2PendingImage *image = frame->images->data[j];
-	    fprintf (stdout, "%s %c %c %s %s %s %s %s %s %c\n",
-		     image->expID,
-		     image->P2version,
-		     image->class,
-		     image->classID,
-		     image->urlroot,
-		     image->input,
-		     image->output,
-		     image->log,
-		     image->smf,
-		     image->state);
-	}
-    }
-    return true;
-} 
