Index: trunk/Ohana/src/addstar/include/addstar.h
===================================================================
--- trunk/Ohana/src/addstar/include/addstar.h	(revision 38467)
+++ trunk/Ohana/src/addstar/include/addstar.h	(revision 38553)
@@ -33,4 +33,10 @@
 
 # define myAbortF(FORMAT,...) { fprintf (stderr, FORMAT, __VA_ARGS__); abort(); }
+
+// things that are needed for a single file
+typedef struct {
+  char *filename;  // name of the file on disk (full path)
+  char *imagename; // name of the image for user reference (eg, base of neb path, full path, etc)
+} AddstarFile;
 
 typedef struct {
@@ -44,4 +50,5 @@
 } HeaderSet;
 
+# if (0)
 typedef struct {
   Average  average;
@@ -61,4 +68,5 @@
   char *refcat;
 } DVO_DATA;
+# endif
 
 # define IDTYPE int
@@ -190,4 +198,5 @@
 AddstarClientOptions args         	  PROTO((int argc, char **argv, AddstarClientOptions options));
 AddstarClientOptions args_parallel_client PROTO((int argc, char **argv, AddstarClientOptions options));
+void FreeConfig PROTO((void));
 
 void       AddToCalibration       PROTO((Average *average, SecFilt *secfilt, Measure *measure, Measure *new, off_t *next, off_t Nstar));
@@ -205,17 +214,21 @@
 SkyTable  *SkyTableFromTychoIndex PROTO((char *filename, int VERBOSE));
 void       check_permissions      PROTO((char *basefile));
-int        dump_rawstars          PROTO((Stars *stars, unsigned int Nstars));
 int        edge_check             PROTO((double *x1, double *y1, double *x2, double *y2));
 Image     *fakeimage              PROTO((char *rootname, off_t *Nimage, int photcode));
 
-int        find_matches           	 PROTO((SkyRegion *region, Stars *stars,  unsigned int Nstars, Catalog *catalog, AddstarClientOptions options));
-int        find_matches_closest   	 PROTO((SkyRegion *region, Stars *stars,  unsigned int Nstars, Catalog *catalog, AddstarClientOptions options));
+double     get_subpix             PROTO((double x, double y));
+
+int        find_matches_closest   PROTO((SkyRegion *region, Catalog *newcat, Catalog *catalog, AddstarClientOptions options));
+int        find_matches        	  PROTO((SkyRegion *region, Catalog *newcat, Catalog *catalog, AddstarClientOptions options));
+
+# if (0)
 int        find_matches_refstars  	 PROTO((SkyRegion *region, Stars **stars, unsigned int Nstars, Catalog *catalog, AddstarClientOptions options));
 int        find_matches_closest_refstars PROTO((SkyRegion *region, Stars **stars, unsigned int Nstars, Catalog *catalog, AddstarClientOptions options));
+
+int        dump_rawstars          PROTO((Stars *stars, unsigned int Nstars));
 
 Stars    **find_subset            PROTO((SkyRegion *region, Stars *stars, unsigned int Nstars, unsigned int *NSTARS));
 int        gcatalog               PROTO((Catalog *catalog));
 Stars     *get2mass               PROTO((SkyRegion *patch, int photcode, int mode, unsigned int *NSTARS));
-double     get_subpix             PROTO((double x, double y));
 
 Stars     *greference             PROTO((char *Refcat, SkyRegion *catstats, int photcode, unsigned int *nstars));
@@ -227,8 +240,14 @@
 Stars     *grefstars              PROTO((char *file, int photcode, unsigned int *Nstars));
 
-Stars     *LoadStars              PROTO((char *file, unsigned int *Nstars, Image **images, off_t *Nimages, AddstarClientOptions *options));
+Stars     *rd_gsc                 PROTO((char *filename, unsigned int *nstars));
+
+int        replace_match          PROTO((Average *average, Measure *measure, Stars *star));
+# endif
+
+Catalog   *LoadStars              PROTO((char *file, Image **images, off_t *Nimages, AddstarClientOptions *options));
 Header   **LoadHeaders            PROTO((FILE *f, int *mode, int *Nheader));
 HeaderSet *MatchHeaders           PROTO((off_t **extsize, off_t *nimage, int mode, Header **headers, int Nheaders));
-int        LoadData               PROTO((FILE *f, char *file, Image **images, off_t *nvalid, Stars **stars, unsigned int *Nstars, Header **headers, off_t *extsize, HeaderSet *headerSets, int NheaderSets, AddstarClientOptions *options));
+void       HeaderSetFree          PROTO((HeaderSet *headerSets, off_t NheaderSets));
+Catalog   *LoadData               PROTO((FILE *f, AddstarFile *file, Image **images, off_t *nvalid, Header **headers, off_t *extsize, HeaderSet *headerSets, int NheaderSets, AddstarClientOptions *options));
 int        GetZeroPointExposure   PROTO((Header **headers, HeaderSet *headerSets, off_t Nimages));
 
@@ -240,6 +259,4 @@
 double     opening_angle          PROTO((double x1, double y1, double x2, double y2, double x3, double y3));
 int        parse_time             PROTO((Header *header));
-Stars     *rd_gsc                 PROTO((char *filename, unsigned int *nstars));
-int        replace_match          PROTO((Average *average, Measure *measure, Stars *star));
 int        resort_catalogs        PROTO((AddstarClientOptions *options, SkyTable *sky));
 int        resort_catalogs_parallel PROTO((AddstarClientOptions *options, SkyList *sky));
@@ -249,12 +266,14 @@
 void       resort_catalog_old     PROTO((Catalog *catalog));
 
-Stars     *ReadStarsFITS          PROTO((FILE *f, Header *header, Header *in_theader, unsigned int *nstars));
-Stars     *ReadStarsTEXT          PROTO((FILE *f, unsigned int *nstars));
-Stars     *ReadStarsSDSS          PROTO((FILE *f, char *name, Header *header, Header *in_theader, Image *images, off_t *nimages, unsigned int *nstars));
+// Stars  *ReadStarsTEXT          PROTO((FILE *f, unsigned int *nstars));
+
 int        ReadImageHeader        PROTO((Header *header, Image *image, int photcode));
-Stars     *FilterStars            PROTO((Stars *instars, Image *image, unsigned int imageID, const AddstarClientOptions *options));
-Stars     *MergeStars             PROTO((Stars *stars, unsigned int *Nstars, Stars *instars, unsigned int Ninstars));
-
-int        ReadXradFITS           PROTO((FILE *f, Header *theader, Stars *stars, unsigned int Nstars));
+
+Catalog   *ReadStarsFITS          PROTO((FILE *f, Header *header, Header *in_theader));
+Catalog   *FilterStars            PROTO((Catalog *newcat, Image *image, unsigned int imageID, const AddstarClientOptions *options));
+int        ReadXradFITS           PROTO((FILE *f, Header *theader, Catalog *catalog));
+
+Catalog   *LoadDataSDSS           PROTO((FILE *f, char *file, Image **images, off_t *nvalid, Header **headers, off_t *extsize, HeaderSet *headerSets, off_t Nimages));
+Catalog   *ReadStarsSDSS          PROTO((FILE *f, char *name, Header *header, Header *in_theader, Image *images, off_t *nimages));
 
 double     scat_subpix            PROTO((double x, double y));
@@ -276,4 +295,9 @@
 AddstarClientOptions args_load2mass PROTO((int argc, char **argv, AddstarClientOptions options));
 AddstarClientOptions args_sedstar PROTO((int argc, char **argv, AddstarClientOptions options));
+
+SkyList   *SkyListExistingSubset  PROTO((SkyList *input, char *path));
+
+// these are all for the addstar client/server which has not been maintained
+# if (0)
 void	   args_server		  PROTO((int argc, char **argv));
 int 	   CheckPassword	  PROTO((int BindSocket));
@@ -288,5 +312,4 @@
 int 	   UpdateDatabase_Refcat  PROTO((AddstarClientOptions *options, SkyRegion *UserPatch, char *refcat));
 SkyList   *SkyListForStars	  PROTO((SkyTable *table, int depth, Stars *stars, unsigned int Nstars));
-SkyList   *SkyListExistingSubset  PROTO((SkyList *input, char *path));
 int        SkyListSetPath	  PROTO((SkyList *list, char *path));
 int 	   InitDataset		  PROTO((void));
@@ -297,16 +320,14 @@
 int 	   NewRefcat_Thread	  PROTO((int BindSocket));
 int 	   NewReflist_Thread	  PROTO((int BindSocket));
-
-int        InitStar               PROTO((Stars *star));
+# endif
 
 int args_skycells (int argc, char **argv);
 int ConfigInit_skycells (int *argc, char **argv);
-int UpdateImageIDs (Stars *stars, unsigned int Nstars, Image *images, off_t Nimages);
+int UpdateImageIDs (Catalog *catalog, Image *images, off_t Nimages);
 
 int CheckDuplicateImageIDs (Image *images, off_t Nimages);
 int ImageIndexFileInit ();
 
-int LoadDataSDSS (FILE *f, char *file, Image **images, off_t *nvalid, Stars **stars, unsigned int *Nstars, Header **headers, off_t *extsize, HeaderSet *headerSets, off_t Nimages);
-int LoadDataPMM (FILE *f, char *file, Image **images, off_t *nvalid, Stars **stars, unsigned int *Nstars);
+Catalog *LoadDataPMM (FILE *f, char *file, Image **images, off_t *nvalid);
 
 PhotCode *LoadMetadataPMM (char *datafile, Image *image);
@@ -330,7 +351,11 @@
 void saveMosaicCoords (Coords *input);
 
-
-Stars *ReadStarsUKIRT (FILE *f, char *name, Header *header, Image *images, off_t *nimages, unsigned int *nstars);
-int LoadDataUKIRT (FILE *f, char *file, Image **images, off_t *nimages, Stars **stars, unsigned int *Nstars, Header **headers, off_t *extsize, HeaderSet *headerSets, off_t NheaderSets);
+Catalog *ReadStarsUKIRT (FILE *f, char *name, Header *header, Image *images, off_t *nimages);
+Catalog *LoadDataUKIRT (FILE *f, char *file, Image **images, off_t *nimages, Header **headers, off_t *extsize, HeaderSet *headerSets, off_t NheaderSets);
+
+AddstarFile *LoadFilenames (int *nfile, char *filename, AddstarClientOptions *options);
+void AddstarFileFree (AddstarFile *file, int Nfile);
+
+Catalog *addstar_catalog_init (int Nstars);
 
 /** 
