
/**************************************************************************
 *                                                                        *
 * Copyright (c) 1989 Michael Richmond, Richard Treffers and              *
 *                    The Regents of the University of California         *
 *                                                                        *
 *                    This software may be copied and distributed for     *
 *                    educational, research and not for profit services   *
 *                    provided that this copyright and statement are      *
 *                    included in all such copies.                        *
 *                                                                        *
 **************************************************************************/


/*	include file for PCVISTA
*/

typedef unsigned short uint16;		/* an unsigned 16-bit integer type */
typedef short   int16;		/* a 16-bit integer type */
typedef int     int32;		/* a 32-bit integer type */

#define	NMAX	1024	/* maximum row size 		*/
#define	NBUF	80
#define BIG_BUF	255
#define NBOX	20		/* maximum number of boxes 	*/
#define NHIST  4096 	/* max number of bins in a histogram */
#define NDIV     1		/* default binsize - histograms and sky use it */
#define SMALL	1.0e-8
#define NWINDOW		16
#define NENTRY      100		/* max number of files in a directory which */
                       		/* can be handled by dir-searching routines */

	/* PCVISTA uses 16-bit signed integers to store data */
#define MAX_DATA_VAL  32767		/* maximum data value per pixel */
#define MIN_DATA_VAL -32767		/* minimum data value per pixel */

#define SCREEN_CLR	1		/* user screen mode switches */
#define SCREEN_ADD	2
#define SCREEN_TODOS	3
#define SCREEN_PAUSE	5
#define SCREEN_TOP	4

#ifdef PROTO

void autospan(int fh,int16 * span,int *zero,int sr,int sc,int nr,int nc );
void beep(void);
int16 **boxdata(int fh, int boxno, int imrows, int imcols, int *boxrows, int *boxcols);
void break_ch(void);
void check_box(int boxno, int nrow, int ncol);
int color_table(char *fname, char *errmsg);
int curses(int (*func)(),int *px,int *py,int mode);
void ditherow(int *data,int span,int zero, int npix,int zoom,char *buf);
void default_screen_puts(int mode, char *msg);
void error(int level, char *msg);
void exten(char *fname,char *ext);
double evaluate(char *);
char *find(char *, char *);
void find_drive(char *,char *);
void flush_windows(void);
int getbox(int boxno,int * sr, int * sc, int *nr, int * nc);
double get_col(char *buf, int col);
int get_data(int x,int y,int *prow,int *pcol,int *pdata,int ndata,char **fname,int* bin,int *zoom);	
double get_float(char *);
char **get_dir(char *);
double get_scale_factor(int x,int y);
int get_window(int x,int y);
int get_win_by_name(char *name);
char *getsym(char *);
void histeq(int *data,int num,char *buf);
void image_init(void);
int int_box(int *,int *,int *,int *);
int keyword(char *,char *);
int makehist(int fh,int sr,int sc,int nr,int nc,int16 hist_min, int16 hist_max,int binsize, int nskip, int quiet, int skyflag);
void open_histeq(char *,int);
void putsym(char *);
void put_float(char *,double);
void quick_beep(void);
void scale_data(int *data,int span,int zero, int npix, char *buf);
int sendpga(char *,int);
int show_box(int sr, sc, er, ec);
void sortem(char **);
void store_window(char *fname,int x_origin,int y_origin,int zoom,int sr,int endrow,int sc,int endcol,int bin);
void trim_window(int, int, int, int, int *, int *);
int window_init(void);
int xform_window(int i,int row,int col,int *px,int *py);
int xform_in_window(int i,int row,int col,int *px,int *py);
void zoom_data(int factor,int nrows, char *buf);
int (*image_dot)(int x,int y);
int (*image_vfill)(int x, int y, int npix, char *buf);
int (*image_puts)(int x, int y, char *msg);
int (*image_crosshair)(int x, int y);
int (*image_clr)(void);
int (*image_circle)(int x, int y, int rad);
int (*image_box)(int x1, int y1, int x2, int y2);
int (*screen_puts)(int mode,char *msg);
void ibm_box(int,int,int,int),
	ibm_circle(int,int,int),
	ibm_clr(void),
	ibm_colorfill(int,int,int,char *),
	ibm_crosshair(int,int),
	ibm_dot(int,int),
	ibm_puts(int,int,char *),
	set_ibm_color(int),
	ibm_screen_scroll(int,char *),
	ibm_screen_flip(int,char *),
	ibm_setup(int),
	ibm_cgafill(int,int,int,char *),
	ibm_vfill(int,int,int,char *);
void	tec_box(int,int,int,int),
	tec_circle(int,int,int),
	tec_color(int),
	tec_crosshair(int,int),
	tec_clr(void),
	tec_dot(int,int),
	tec_puts(int,int,char *),
	tec_vfill(int,int,int,char *);
void pga_box(int,int,int,int),
	pga_circle(int,int,int),
	pga_clr(void),
	pga_crosshair(int,int),
	pga_dot(int,int),
	pga_init(void),
	pga_puts(int,int,char *),
	set_pga_color(int),
	pga_screen_flip(int,char *),
	pga_hfill(int,int,int,char *),
	pga_vfill(int,int,int,char *);
void	set_win_id(int);
int	X_fill(int, int, int, char *),
	X_box(int, int, int, int);
void truncate(int);

#else		/* PROTO */

void autospan();
void beep();
int16 **boxdata();
void break_ch();
void check_box();
int curses();
void ditherow();
void default_screen_puts();
void error();
void exten();
double evaluate();
char *find();
void find_drive();
void flush_windows();
int getbox();
double get_col();
int get_data();	
double get_float();
char **get_dir();
double get_scale_factor();
int get_window();
int get_win_by_name();
char *getsym();
void histeq();
void image_init();
int int_box();
int keyword();
int makehist();
void open_hist();
void putsym();
void put_float();
void quick_beep();
void scale_data();
int sendpga();
int show_box();
void sortem();
void store_window();
void trim_window();
int window_init();
int xform_window();
int xform_in_window();
void zoom_data();
int (*image_dot)();
int (*image_vfill)();
int (*image_puts)();
int (*image_crosshair)();
int (*image_clr)();
int (*image_circle)();
int (*image_box)();
int (*screen_puts)();
void ibm_box(),
	ibm_circle(),
	ibm_clr(),
	ibm_colorfill(),
	ibm_crosshair(),
	ibm_dot(),
	ibm_dotit(),
	ibm_puts(),
	set_ibm_color(),
	ibm_screen_scroll(),
	ibm_screen_flip(),
	ibm_setup(),
	ibm_cgafill(),
	ibm_vfill();
void	tec_box(),
	tec_circle(),
	tec_color(),
	tec_crosshair(),
	tec_clr(),
	tec_dot(),
	tec_puts(),
	tec_vfill();
void pga_box(),
	pga_circle(),
	pga_clr(),
	pga_crosshair(),
	pga_dot(),
	pga_dotit(),
	pga_init(),
	pga_puts(),
	set_pga_color(),
	pga_screen_flip(),
	pga_hfill(),
	pga_vfill();
void	set_win_id();
int	X_fill(),
	X_box();
void truncate();

#endif 		/* PROTO */
