Index: /trunk/archive/dettools/src/dettools.h
===================================================================
--- /trunk/archive/dettools/src/dettools.h	(revision 5878)
+++ /trunk/archive/dettools/src/dettools.h	(revision 5878)
@@ -0,0 +1,153 @@
+# 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>
+
+typedef enum {
+    DET_MODE_NONE,		      	// 
+    DET_MODE_QUICK,		      	// 
+    DET_MODE_SELECT_RAW,		// 
+    DET_MODE_SELECT_RESID,		// 
+    DET_MODE_SELECT_STACK,		// 
+    DET_MODE_SELECT_NORM,		// 
+
+    DET_MODE_UPDATE_RAW,		// 
+    DET_MODE_UPDATE_RESID,		// 
+    DET_MODE_UPDATE_RUN,		// 
+
+    DET_MODE_DEFINE_RUN,		// 
+    DET_MODE_DEFINE_RESID,		// 
+} detMode;
+
+typedef unsigned char detType;
+typedef unsigned char detState;
+
+typedef struct {
+    p2mode mode;
+
+    detType type;
+    char *camera;
+    char *filter;
+
+    bool groupSelect;
+    char *groupID;
+
+    bool timeSelect;
+    psTime start;
+    psTime stop;
+
+    bool exptimeSelect;
+    float exptimeMin;
+    float exptimeMax;
+
+    bool airmassSelect;
+    float airmassMin;
+    float airmassMax;
+
+    psDB *database;
+} detConfig;
+
+// these structures should be defined using the mddb api tools
+// check definition in p2search.h
+typedef struct ppRawExposure;
+typedef struct 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;
+} detInputExposure;
+
+// 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
+} detInputImfile;
+
+// this structure should be defined using the mddb api tools
+typedef struct {
+    a detID;
+    a version;
+    a iteration;
+    a type;
+    a camera;
+    a filter;
+    a class;
+    int nInput;
+    int nImfiles;
+    detState state;
+    float stats;
+} detMasterExposure;
+
+typedef struct {
+    a detID;
+    a version;
+    a iteration;
+    a classID;
+    a stats;
+    detState state;
+} detMasterImfile;
+
+typedef struct {
+    a detID;
+    a version;
+    a state;
+
+    int nIterations;			// number of iterations STARTED
+
+    detType type;
+    char *camera;
+    char *filter;
+
+    bool groupSelect;
+    char *groupID;
+
+    bool timeSelect;
+    psTime start;
+    psTime stop;
+
+    bool exptimeSelect;
+    float exptimeMin;
+    float exptimeMax;
+
+    bool airmassSelect;
+    float airmassMin;
+    float airmassMax;
+} detMasterRun;
+
+typedef struct {
+    ppRawExposure *exposure;
+    psArray *images;
+} ppRawFrame;
+
+typedef struct {
+    detMasterImfile *imfile;
+    psArray *inputImfiles;
+} detStackFrame;
+
+typedef struct {
+    detMasterExposure *exposure;
+    psArray *imfiles;
+} detNormFrame;
+
+typedef struct {
+    ppDoneExposure *exposure;
+    psArray *images;
+} p2DoneFrame;
