# include "external.h"
# include "shell.h"
# include "dvomath.h"
# include "convert.h"
# include "display.h"

# ifndef DATA_H
# define DATA_H

/* in misc/queues.c */
void InitQueues ();
Queue *FindQueue (char *name);
Queue *CreateQueue (char *name);
void PushQueue (Queue *queue, char *line);
char *PopQueue (Queue *queue);

/* in misc/sort.c */
void sort (double *value, int N);
void fsort (float *value, int N);
void sortpair (double *value1, double *value2, int N);
void fsortpair (float *X, float *Y, int N);
void sortthree (float *X, float *Y, float *Z, int N);
void sort_lists (float *X, float *Y, int *S, int N);
void dsort_lists (double *X, double *Y, int *S, int N);

/* in misc/fft.c */
void fft (float *Data, int N, int isign);
void fftold (float *Data, int N, int isign);
void fftN (float *data, int *nn, int ndim, int isign);
int IsBinary (int N);
void fourn (float *data, int *nn, int ndim, int isign);

/* in misc/gaussj.c */
int gaussj (double **a, int n, double **b, int m);
int fgaussj (float **a, int n, float **b, int m);

/* in misc/svdcmp.c */
int svdcmp (float *a, float *w, float *v, int Nx, int Ny);

/* in misc/spline.c */
void spline (float *x, float *y, int N, float *y2);
float splint (float *x, float *y, float *y2, int N, float X);

/* misc/mrqmin.c */
float mrqcof (float *x, float *y, float *dy, int Npts, 
	      float *par, int Npar, float **ta, float **tb, 
	      float (funcs)(float, float *, int, float *));

float mrqmin (float *x, float *y, float *dy, int Npts, 
	      float *par, int Npar, 
	      float (funcs)(float, float *, int, float *));

int mrqinit (float *x, float *y, float *dy, int Npts, 
	     float *par, int Npar, 
	     float (funcs)(float, float *, int, float *));

float **mrqcovar (int Npar);

void mrqfree (int Npar);

/* misc/mrq2dmin.c */
float mrq2dcof (float *x, float *t, float *y, float *dy, int Npts, 
		float *par, int Npar, float **ta, float **tb, 
		float (funcs)(float, float, float *, int, float *));

float mrq2dmin (float *x, float *t, float *y, float *dy, int Npts, 
		float *par, int Npar, 
		float (funcs)(float, float, float *, int, float *));

float mrq2dinit (float *x, float *t, float *y, float *dy, int Npts, 
		 float *par, int Npar, 
		 float (funcs)(float, float, float *, int, float *));

float **mrq2dcovar (int Npar);

void mrq2dfree (int Npar);

/* misc/powell.c */
void powell (float *p, int Npar, float (func)() );

/* misc/gaussian.c */
double gaussian (double x, double mean, double sigma);
void gauss_init (int Nbin);
double rnd_gauss (double mean, double sigma);

/* misc/starfuncs.c */
double get_aperture_stats (Matrix *matrix, int X, int Y, int Npix, int Nborder, double max);

/* misc/precess.c */
double BtoJ (double in_epoch);
double get_epoch (char *in_epoch, char mode);

/* misc/graphtools.c */
void          SetLimits             PROTO((Vector *xvec, Vector *yvec, Graphdata *graphmode));
void          ApplyLimits           PROTO((int Xgraph, Graphdata *graphmode, int apply));

int read_table_vectors (int argc, char **argv, char *extname);
# endif
