# include <ohana.h>
# include <dvo.h>
# include <signal.h>
# include <glob.h>

enum {NONE, SIMPLE_CMP, SIMPLE_CMF, SIMPLE_MEF, MOSAIC_CMP, MOSAIC_CMF, MOSAIC_MEF, MOSAIC_PHU};

int       VERBOSE;

char OUTPUT[256];
char GSCFILE[256];
char CATDIR[256];
char CATMODE[16];    /* raw, mef, split, mysql */
char CATFORMAT[16];  /* internal, elixir, loneos, panstarrs */
char SKY_TABLE[256];
int  SKY_DEPTH;
char   ImageCat[256];
Coords *MOSAIC;         // carries the mosaic into ReadImageHeader

int WITH_PHU;
int SOLO_PHU;
int ACCEPT_ASTROM;

int  args_overlaps    	 PROTO((int argc, char **argv));
int  ConfigInit_overlaps PROTO((int *argc, char **argv));
int  Shutdown         PROTO((char *format, ...));
void TrapSignal       PROTO((int sig));
void SetProtect       PROTO((int mode));
int  SetSignals       PROTO(());

Image *ReadImageFiles (char *filename, int *Nimages);
int ReadImageHeader (Header *header, Image *image);
int *MatchImage (Image *dbImages, int NdbImages, Image *image, int *Nmatch);
int ListImageOverlaps (Image *dbImages, Image *image, int *matches, int Nmatches);

int GetFileMode (Header *header);
int edge_check (double *x1, double *y1, double *x2, double *y2);
double opening_angle (double x1, double y1, double x2, double y2, double x3, double y3);
