Index: trunk/Ohana/src/relphot/include/relphot.h
===================================================================
--- trunk/Ohana/src/relphot/include/relphot.h	(revision 39479)
+++ trunk/Ohana/src/relphot/include/relphot.h	(revision 39481)
@@ -11,7 +11,19 @@
 # define ID_SECF_STACK_PRIMARY 0x00004000
 
+# ifndef MAX_INT
+# define MAX_INT 2147483647
+# endif
+
 // choose off_t or int depending on full-scale relphot analysis resources
 // # define IDX_T off_t
 # define IDX_T int 
+
+typedef struct {
+  int minID;
+  int maxID;
+  int *index;
+  int Nindex;
+  int NINDEX;
+} myIndexType;
 
 typedef enum {
@@ -279,4 +291,5 @@
 int    RESET;
 int    RESET_ZEROPTS;
+int    REPAIR_WARPS;
 int    UPDATE;
 int    SAVE_IMAGE_UPDATES;
@@ -418,5 +431,5 @@
 Catalog      *load_catalogs_parallel PROTO((SkyList *sky, int *Ncatalog, char *syncfile));
 
-int           load_images         PROTO((FITS_DB *db, SkyList *skylist, SkyRegion *region));
+int           load_images         PROTO((FITS_DB *db, SkyList *skylist, SkyRegion *region, int unlockImages));
 Image        *select_images       PROTO((SkyList *skylist, Image *timage, off_t Ntimage, char *inSubset, off_t **LineNumber, off_t *Nimage, SkyRegion *region));
 
@@ -475,5 +488,5 @@
 void          wimages             PROTO((void));
 void          write_coords        PROTO((Header *header, Coords *coords));
-int relphot_objects (SkyTable *sky, SkyList *skylist, int hostID, char *hostpath);
+int relphot_objects (SkyList *skylist, int hostID, char *hostpath);
 int relphot_images (SkyList *skylist);
 
@@ -507,4 +520,5 @@
 
 int load_tess (char *treefile);
+void free_tess (void);
 int get_tess_ids (int *tessID, int *projID, int *skycellID, double ra, double dec);
 int TessellationIDsByImageName (int *tessID, int *projID, int *skycellID, char *name);
@@ -532,5 +546,6 @@
 int add_synthetic_mags (AverageTiny *average, SecFilt *secfilt, MeasureTiny *measure, off_t *Nmeasure, off_t *Nm);
 
-int relphot_parallel_regions ();
+int relphot_parallel_regions (SkyTable *sky);
+int relphot_parallel_images (SkyTable *sky);
 
 int assign_images (FITS_DB *db, RegionHostTable *regionHosts);
@@ -546,4 +561,5 @@
 int indexCatalogs (Catalog *catalog, int Ncatalog);
 int catID_and_objID_to_seq (int catID, int objID, int *catSeq, off_t *objSeq);
+void freeCatalogIndexes (int Ncatalog);
 
 int check_sync_file (char *filename, int nloop);
@@ -569,7 +585,4 @@
 
 int markObjects (Catalog *catalog, int Ncatalog);
-
-int relphot_parallel_images ();
-int relphot_parallel_regions ();
 
 // in extra.c
@@ -587,5 +600,5 @@
 SynthZeroPoints *SynthZeroPointsGet ();
 
-int relphot_synthphot (int hostID, char *hostpath);
+int relphot_synthphot (SkyList *sky, int hostID, char *hostpath);
 int relphot_synthphot_parallel (SkyList *sky);
 
@@ -598,7 +611,25 @@
 
 void relphot_free (SkyTable *sky, SkyList *skylist);
-void freeImages ();
+void freeImages (int freeImageData);
 void relphot_client_free (SkyTable *sky, SkyList *skylist);
 void BrightCatalogFree (BrightCatalog *bcatalog);
 
+void put_astrom_table (AstromOffsetTable *myTable);
 void free_astrom_table ();
+
+int RepairWarpMeasures (Catalog *catalog);
+
+int FindWarpGroups (void);
+int GetWarpSeq (Image *image, int obstime, unsigned short photcode, double Rave, double Dave, float X, float Y);
+void FreeWarpGroups (void);
+
+myIndexType *myIndexInit ();
+int myIndexFree (myIndexType *myIndex);
+int myIndexUpdateLimits (myIndexType *myIndex, int value);
+int myIndexSetRange (myIndexType *myIndex);
+int myIndexSetEntry (myIndexType *myIndex, int value, int entry);
+int myIndexGetEntry (myIndexType *myIndex, int value);
+
+uint64_t CreatePSPSObjectID(double ra, double dec);
+uint64_t CreatePSPSStackDetectionID(int sourceID, int imageID, int detID);
+uint64_t CreatePSPSDetectionID(double tobs, int ccdid, int detID);
