/* include file for options.c & parse.c */

/* include statements */

#include <stdio.h>		/* standard i/o routines */
#include <fcntl.h>		/* other standard routines */
#include <stdlib.h>		/* more lattice c standard i/o routines */
/*#include <tardev.h>		/* targa header files */
#include <math.h>		/* some math functions needed */
/*#include <time.h>		/* some time functions needed */
#include <dos.h>		/* used for NO9 init call */
#include <ctype.h>		/* used for some character testing */
#include <memory.h>		/* used for some memory allocation routines */
#include <direct.h>		/* used for some directory routines */
#include <search.h>		/* used for some search and sort routines */
#include <string.h>		/* string functions */
#include <io.h>			/* used for mktemp call */
#include "df.h"			/* header file with defines for HDF */

#define NOMOUSE			/* change to define MOUSE if a mouse is to be used */

/* define statements */
#define HI 2
#define LO 3
#define	SCRLLEFT	203
#define	SCRLUP		200
#define	SCRLDOWN	208
#define	SCRLRIGHT	205
#define	PAGEUP		201
#define	PAGEDOWN	209
#define	HOME		199
#define	END			207
#define ALTSCRLUP		152
#define ALTSCRLDOWN		160
#define ALTSCRLLEFT		155
#define ALTSCRLRIGHT	157	
#define ALTPAGEUP		153
#define ALTPAGEDOWN		161
#define ALTHOME			151
#define ALTEND			159
#define HDF			'h'
#define	RASTER		'b'
#define NO9			'9'
#define	VGA			'v'
#define	EGA			'e'
#define	TARGA		't'
#define RAWSIZE 32000	/* maximum size of the block to be read in from disk */

extern int		i,j,k,l,c,		/* temporary global counters and such */
	xdim,ydim,			/* x & y dimensions for the image to be displayed */
	file,				/* the file pointer for binary files */
	xoff,yoff,			/* the offset into the picture to be displayed */
	palnum,				/* the palette number which is currently displayed */
	show,				/* a binary variable telling whether the palette is displayed on the screen */
	palmax,				/* the number of palettes in memory */
	maxx,maxy,			/* the x & y dimensions of the screen */
	palspeed,			/* how fast the palette rotates */
	lastref,			/* the last reference number used in palette searching */
	lasttag,			/* the last tag number used in searching for palettes */
	newref,				/* reference number for a new palette */
	imref,				/* the current image's reference number */
	imtag,				/* the current image's tag number */
	slope,				/* slope of line in fiddle mode */
	offset,				/* offset for center of palette for fiddle mode */
	animate,			/* the animation toggle */
	one_file,			/* the one file animation toggle */
	first_hdf,			/* boolean to flag the first time through an hdf animation */
	cycled,				/* boolean variable to tell whether a sequence has been animated */
	oneimage,			/* boolean variable to indicate whether there are multiple binary images to be displayed */
	xshow,				/* the width of the image */
	m1,m2,m3,m4,		/* mouse variables */
	leftbutton,			/* boolean variables for buttons on the mouse */
	rightbutton,
	mouse,				/* boolean variable to determine if the mouse is active */
	mx,my,				/* last position where the mouse was at */
	pal_xoff,			/* location of the upper left hand corner of the color bar */
	pal_yoff,
	screen,				/* boolean variable for screen on or off */
	before,				/* boolean variable for mouse activated previously */
	anispeed,			/* speed for animation */
	doneinit,			/* boolean variable to keep track of whether the palette has been initialized for ega mode */
	getout,				/* boolean variable to exit program abruptly */
	pal_height,			/* height in bytes of the color bar on the screen */
	expandit,			/* preference boolean variable to expand(1) or interpolate(0) */ 
	center,				/* boolean variable to specify a centered image */
	xwhere,ywhere;		/* where the upper left hand of the image is */

#ifdef QAK
extern	long	waitcount;		/* counter for timing out */
#endif

extern	unsigned short int l16[512];	/* array for the targa line */


extern char *store[1024], 		/* one per line of image */
	*p,					/* temporary character storage */
	mode,				/* the display mode we are in = EGA,VGA,NO9 */
	filetype; 	 		/* the type of file to be read = 'h,'b' */

extern unsigned char rmap[256],gmap[256],bmap[256],	/* the red, green, and blue bytes for 24 bit palettes */
			pal[768],							/* the full 24 bit palette, interleaved as red, green, blue, red, green ... */
			*rpal[16],*gpal[16],*bpal[16],		/* arrays of pointers to different palettes */
			*egapals[16],						/* array of pointers to different ega palettes */
			raw[RAWSIZE],						/* for file buffering */
			filename[128],						/* name of binary image file */
			palfile[128],						/* starts out = NULL */
			palstore[8][512],					/* large array to store the portion of the screen the palette overlays */
			bigstore[4096];						/* array to expand four lines of imcomp compressed image into */

extern unsigned char trans[256],	/* translation table for palette in ega mode */
					trans1[256],	/* temporary translation table */
					count[64],		/* the colors to choose from in ega mode */
					regrs[16];		/* the actual palette for ega mode */

extern FILE *fp,		/* file pointer for binary image files */
		*pfp;	/* file pointer for binary palette files */

extern struct {
		int xdim,
			ydim;
		} dims;		/* dimension structure for HDF dimension reads */

/* HDF stuff */
extern DF *dff;			/* HDF file descriptor */
extern DFdesc ddstr;		/* HDF structure for the tag & ref of something */

/* mouse stuff */
#ifdef MOUSE
extern void mousecml();		/* appropriate mouse routines for compiler size */
#endif
