/*     ***     *    *****    *
       *  *   * *     *     * *
       *  *  *   *    *    *   *
       *  *  *****    *    ***** 
       ***   *   *    *    *   * 
*/

/*GENERAL STUFF */
#define	version		'0'
#define revision 	'5'

#define	FOXTABLESIZE	2048	/* bytes in function key buffer */
#define V5TABLESIZE	1024
#define	NUMFKEYS	30
#define SIZFUNCSTRUCT	FOXTABLESIZE + 10 + (2 * 93) + (1 * 90)
/* size of FK settings              int size ^          ^ char size */
	
#define	NORMVID 0x80	/* bit in SCvidset that says normal video if on */
#define	V5INVON 0x02	/* bit in 5000 status byte that says inverse is on */
#define	VERTBIT 0x01	/* bit in 5000 tatus byte for vertical screen */

#define	TFDSIZE	25	/* size of directory table in CRT/KBD transpositon file */
#define CHSSIZE	50	/* size of directory table in characer set file */

#define	DESCENDBYTES	96  /* bytes in descender table */

	char	dummy; /* throw away */
	
/* KEYBOARD BUFFER */
	
	int	keyin;
	int	keyout;
	char	useesc; /* escape char to use or this terminal */
	char	keybuff [KBUFFSIZE];


/* GRID and DRAWING DATA */
	int	gdwidth;	/* cell width of grid */
	int	gdheight;	/* cell height of grid */
	int	charbytes;	/*number bytes in a character definition */

/* FUNCTION KEY TABLE AND STUFF */ 


	char	funkseq [3];	/* turn on literals for func keys */
	char	defunkseq [3];   /* turn off literals for func keys */
	char	fvenqseq [3];	/* fox inquiry video status */
	char	fvsetseq [3];	/* fox set video status */
	char	V5invenqseq [3];   /* 5000 inverse inquiry */
	char	V5invtogseq [3];   /* 5000 inverse toggle */
	char	FXinvtogseq [3];   /* FOX inverse toggle */
	char	intupseq [3]; /*  intensity up 1 */
	char	intdownseq [3];  /*  intensity down 1 */
	char	halfseq [3];	/* set following chars to half intensity */
	char	inverseseq [3];	/* set following chars to inverse video */
	char	normseq [3];	/* set following chars normal */
	char	crflashseq [5];	/* set flashing cursor */
	char	crnonflseq [5];	/* set non flashing cursor  */
	char	crinvseq [3];	/* set invisble cursor */
	char	crvisseq [3];	/* set visble cursor */
	char	clearseq [2];	/* clear screen */
	char	graphseq [2];	/* enter grahics mode */
	char	g5000seq [3];	/* disable coordinate scaling */
	char	charseq [2];	/* enter character mode */
	char	positseq [3];	/* position cursor sequence */
	char	defshapeseq [3]; /*  shape definiton prefix */
	char	showshape [3];	/* shape display prefix */
	char	GRorseq [3];	/* draw in OR mode */
	char	GRandseq [3];	/* draw in AND mode */
	char	GRxorseq [3];	/* draw in XOR mode */
	char	ldCRTseq [3];   /* download CRT transposition table */
	char	ldKBDseq [3];   /* download KBD transposition table */
	char	smallseq [3];	/* set small character set */
	char	largeseq [3];	/* set large character set */
	char	ldcharseq [3];   /* down load character set to 5000 */
	char	lddescseq [3];   /* down load descender table to 5000 */
	char	ldlangseq [3];   /* download language choice to 5000 */
	char	stunderseq [3];  /* start underlining */
	char	clrtoeolseq [3];	 /* clear to end of line */
	char	keybzeroseq [3];   /* zero out keyb transposition table */
	char	big24seq [3];	/* for 24 line screen */
	char	big26seq [3];	/* for 26 line screen */
	char	homeseq [3];	/* home cursor */
	
/* DATA SETTINGS */
	char	heado [15]; 	/* version etc. */
	char	changeMade;  /* change this session */
	char	isHoriz;	/*  is screen horizontal */
	char	isFox;     /* she's a fox */
	char	dealer;		/* dealer mode */
	char	standLang;	/* language of program */
	char	UfileName [15];	/* name of file for User language */
	char	UkeybName [15];	/* name if file fir User Keyboard */
	char	saveName [15];	/* name of file for saving settings */
	char	readName [15];	/* name of file for reading settings */

	char isUseLang;		/* does file contain a user language */
	char isUseKeyb;		/* does file contain a user language */
	char	loadLang;	/* load chosen language to screen */

	char	linelen;	/* display cols on screen */

	/* files consist of four parts
			table - header and file directory
			scsettings - screen attirbute settings
			lgsettings - language settings
			FKstruct - function key directory and settings
	*/

	/* these are term def settings */
	struct	filtable
		{
		char	justUse;	/* this file holds just  user 
					defined stuff (lang and/or  keyboard) */
		char	headstring [15];	/* version etc. */
		int	scloc;		/* offset to attribute structure */
		int	lgloc;		/* offset to language structure */
		int	fkloc;		/* offset to attribute structure */
		int	chsloc;		/* offset to character set */
		int	kbdloc;		/* offset to keyboard trans table in char def*/
		int	fksize;		/* size of fk so we can calc ch loc */
		int	dum4;
		int	dum5;
		int	dum6;
		int	dum7;
		int	dum8;
		int	dum9;
		};
	struct scsettings
		{
		char SCdoVid; /* change screen inverse */
		char SCinverse; /* inverse setting */
		char SCdoBright; /* change screen intensity */
		char SCbright;   /* brightness level */
		char SCdoCurse; /* cursor setting */
		char SCcurse; /* cursor setting */
		char SCdoSize;	/* set small?*/
		char isSmall;	/* charactersize is large or small */
		char SCexLines;   /* 24 or 26 lines in bug screen, true = 26 */
		char emulnum;  /* number of emulation choice */ 
		char emulname[15];  /* emulation program to chain to */
		char dummyarea [4];  /* dead space for file safety */
		};

	struct lgsettings
		{
		char charset; /* which character set */
		char Ukeyb;	/* use a user defined keyboard */
		char noCRTtran;     /* does structure contain valid fox crt tran table */
		char keytrantable [129];   /* keyboard transpostion table */
		char crttrantable [129];   /* CRT transposition table */
		char dummy2area [6]; 	/* dead space for file safety */
		};

	struct	FKsettings
		{
		int	nextavail;	/* offset to free area of buffer */
		int	bytesleft;	/* bytes of buffer left */
		int	tablesize;	/* size of buffer */
		char	numfuncs;	/* number of keys used */
		int	off [(NUMFKEYS * 3)];	/* offset of entry into buffer */		
		char	len [(NUMFKEYS * 3)];	/* length of entry */		
		char	buffer [FOXTABLESIZE + 10]; /* just in case */
		};

/* directory for transposition table file */
	struct	tranfileDir
		{ char	entname [3];  /* table name for language */
		  int	entoff;
		};

struct cellbuild
	{ char isDescend;  /* should char descend */
	  int wcell;
	  int hcell;	/* coordinates of current cell */
	  char	charmap [BIGHEIGHT+1];	/* map of charater created */
	};

struct 	CHset
	{
	char	Usmall;		/* language size */
	char	langbuffer [((((BIGLANG+DESCENDBYTES)/128) + 1)*128)]; /* user char set */
	};


	struct filtable   ft;
	struct scsettings st;
	struct lgsettings lg;
	struct FKsettings FK;

	int	fbstartrec;  /* first record in memory */
	int	fblastrec;  /* last record in memory */
	char	filebuffer [SIZFUNCSTRUCT + 128];

	int	langsize;    /* number of bytes to define a character set */
	struct CHset cs;
	char	descenders [DESCENDBYTES]; /* descender table */

	char	keybBuffer [128];  /* user defined keyboard transposition */

	char	chROWents [5];	/* number of entries in character rows */
	char	*chRstring [5]; /* choice strings for keyb def */

	char	kyRWrowcorn [4];  /* row coordinates of lower key corner */
	char	kyRWcolcorn [4][14];  /* row coordinates of lower key corner */
	char	kyROWents [4];  /* number of keys in row */
	char	kyRWbig [4][14];  /* type of key */

	char	KYrowLoc [128];  /* logical key values of characters */
	char	KYcolLoc [128];

	char	seqcount [4];	/* count of pairs of display sequences 
				imbeeded in a line of key choice display */

	/* OVERLAY INFo */
	int 	*roottop;	/* top of root addr */
	char	ovlIn;   /* what overlay is currently loaded */
	char	(*ovlcall)();	/*  overlay function call */
	char	readIt;	/* read or save flag for overlay */


	char	charsuc;	/* was chardraw succesful (can't return
				   result normally becasue of overlay */

	/* OPTION NUMBERS */
	char	Obright;
	char	OscrType;
	char	OcursType;
	char	OscrSize;
	char	OemulType;
	char	OfuncKeys;
	char	Olang;
	char	Okeys;
	char	Oread;
	char	Osave;
	char	OcreLang;
	char	OcreKey;
	char	OsignOff;

	char	readMen;	/* array number of file read menu */

struct	men
	{
	char	*MENhead;	/* header */
	char	MENheadRow; 
	char	MENheadCol;
	char	MENintString [10];   /* input to interupt display on */
	char	MENsingleDef;        /* only one default char */
	char	MENdefChoice [MENMAX+1]; 	/* which choices to underline */
	char	MENactChoice; 	/* which choice  is active - OFFH if none */
	chaò	MENnumChoice»		/ª numbeò oæ choiceó */
	chaò	*MENchoicå [MENMAX]»	/ª choiceó */
	char	MENchRow [MENMAX];	/* screen address of choice */
	char	MENchCol [MENMAX];
	char	MENlastDisp; /* last choice displayed by men disp */
	};  /* new menu structure */

struct men	mens [10];

struct	ung	/* for saving and thne ungetting chars during display */
	{ char	ungPlace; /* number of chars */
	  char	ungString [12]; /*string of the stuff */
	};

struct men mainmen;  /* MAIN MENU */

	char	hat;     /* display characters */
	char	pipe;
	char	dash;  

struct  promarray
	{ char	*PAptr [5];
	};

struct promarray PA;

/* prompt ptrs */
char	*ms1ptr;  /* SET A BRIGHTNESS LEVEL */
char	*ms2ptr;
char	*ms3ptr;
char	*ms4ptr;
char	*ms5ptr;
char	*ms6ptr;
char	*ms7ptr;
char	*ms8ptr;
char	*ms9ptr;
char	*ms10ptr;
char	*ms11ptr;
char	*ms12ptr;
char	*ms13ptr;
char	*ms13aptr;
char	*ms14ptr;
char	*ms15ptr;
char	*ms16ptr;
char	*ms17ptr;
char	*ms18ptr;
char	*ms19ptr;
char	*ms20ptr;
char	*ms21ptr;
char	*ms22ptr;
char	*ms23ptr;
char	*ms24ptr;
char	*ms25ptr;
char	*ms26ptr;
char	*ms27ptr;
char	*ms28ptr;
char	*ms29ptr;
char	*ms30ptr;
char	*ms31ptr;
char	*ms32ptr;
char	*ms33ptr;
char	*ms34ptr;
char	*ms35ptr;
char	*ms36ptr;
char	*ms37ptr;
char	*ms38ptr;
char	*ms39ptr;
char	*ms40ptr;
char	*ms41ptr;
char	*ms42ptr;
char	*ms43ptr;
char	*ms44ptr;
char	*ms45ptr;
char	*ms46ptr;
char	*ms47ptr;
char	*ms48ptr;
char	*ms49ptr;
char	*ms50ptr;
char	*ms51ptr;
char	*ms52ptr;
char	*ms53ptr;
char	*ms54ptr;
char	*ms55ptr;
char	*ms56ptr;
char	*ms57ptr;
char	*ms58ptr;
char	*ms59ptr;
char	*ms60ptr;
char	*ms61ptr;
char	*ms62ptr;
char	*ms63ptr;
char	*ms64ptr;
char	*ms65ptr;
char	*ms66ptr;
char	*ms67ptr;
char	*ms68ptr;
char	*ms69ptr;
char	*ms70ptr;
char	*ms71ptr;
char	*ms72ptr;
char	*ms73ptr;
char	*ms74ptr;
char	*ms75ptr;
char	*ms76ptr;
char	*ms77ptr;
char	*ms78ptr;
char	*ms79ptr;
char	*ms80ptr;
char	*ms81ptr;
char	*ms82ptr;
char	*ms83ptr;
char	*ms84ptr;
char	*ms85ptr;
char	*ms86ptr;
char	*ms87ptr;
char	*ms88ptr;
char	*ms89ptr;
char	*ms90ptr;
char	*ms91ptr;
char	*ms92ptr;
char	*ms93ptr;
char	*ms94ptr;
char	*ms95ptr;
char	*ms96ptr;
char	*ms97ptr;
char	*ms98ptr;
char	*ms99ptr;


/* string of chars to retrun from sub men disp during main men */
char	mmrets [4];
char	sbrets [5]; /* standard return from sub menu */

/* special string pointers */
char	*noneptr;	/* don't change string */
char	*retmptr;	/* return to main menu messsage */
char	*defblkptr;	/* blank string for current settings list */

/* header strings */
char	*head1ptr;
char	*head2ptr;
char	*head3aptr;
char	*head3bptr;
char	vString [4];

/* items that have menus */

char	havemenus [13];

char	lstring [15];  /* characters  for language choices */
char	lStrBase [14];  /* commom immutable language choices */

/* numbers for read selections menu */
char	RDMSC;	
char	RDMLG;	
char	RDMFK;	
char	RDMUL;	
char	RDMUKB;	
char	RDMRR;	


char	drPromLine;	/* scrren line for prompt in char draw */

/*** END OF EXTERNAL DATA AREA ***/
