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

typedef struct {
  double median;
  double mean;
  double sigma;
  double error;
  double chisq;
  double min;
  double max;
  double total;
  int    Nmeas;
} StatType;

/* global variables set in parameter file */
char   ImageCat[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;  /** XXX EAM : depth of catalog tables, fix usage */

int    VERBOSE;

int    UPDATE;
int    PLOTSTUFF;
int    SAVEPLOT;
int    PLOTDELAY;

int    SHOW_PARAMS;
char   STATMODE[32];

PhotCode      *photcode;
int            PhotNsec;
int            PhotSec;

double  PlotMmin, PlotMmax, PlotdMmin, PlotdMmax;

SkyRegion UserPatch;

/*** absphot prototypes ***/
int           main                PROTO((int argc, char **argv));
void          initialize          PROTO((int argc, char **argv));
int           args                PROTO((int argc, char **argv));
void          ConfigInit          PROTO((int *argc, char **argv));
void          GetConfig           PROTO((char *config, char *field, char *format, int N, void *ptr));
Catalog      *load_catalogs       PROTO((SkyList *skylist));
int           subset_catalog      PROTO((Catalog *subcatalog, Catalog *catalog));
void          free_catalogs       PROTO((Catalog *catalog, int Ncatalog));

void          initstats           PROTO((char *mode));
int           liststats           PROTO((double *value, double *dvalue, int N, StatType *stats));

SkyList      *find_regions        PROTO((FITS_DB *db, SkyRegion *region));
