/* ====================================================================== *
 *	 def.h  															  *
 * ====================================================================== *
 *	rt/1 #defines reside in this file									  *
 *																		  *
 *  last changed for  #9 board on 2/14/87 by tad                          */

/*  debug aids*/
/*#define TRACE(x) x;			/*trace of each function call*/
#define TRACE(x)			/**/
/*#define DEBUG	1			/*include extra debug code*/
#define DBG1(x)	        	/*exclude debug code*/
#define DBG2(x,y)	        /**/
#define DBG3(x,y,z)      	/**/
/*#define DBG1(x) x;		/*include debug code*/
/*#define DBG2(x,y) x;y;	/**/
/*#define DBG3(x,y,z) x;y;z;	/**/

/* to include/exclude groups of commands */
#define IBMPC   1
#define DEB		1
#define MANUALCURSOR 	1	/* use software cursor on the command line */
#define NDEBUG		1		/* ^N print names, etc.*/
#undef ALARMING				/* remove interrupts */
/* #define HYPERBOL	1		/*include hyperbolic functions*/
#define TEMPDEBUG	1		/*add temp list printer for debugging*/
#define CPLDEBUG	1		/*add compiled printer for debugging*/
#define ZWHILE	1			/* include smeet's whiles */

/* for use in interrupts */
#define TICKS	1	/* number of 1/60 second ticks between interrupts */
#define TIMEOUT 16	/* signal number for ticktim() timeout */

/* flags */
#define NDEL 0x01
#define DOLDEL 0x02
#define DOLOOP 0x04
#define RDONLY 0x08	/* for special names ($SC, etc) not to be changed */
#define STICKY 0x10	/* for assignable specials, sticky type */

/* data types */
#define BITS short  		/*type for flags*/
#define BOOL unsigned char	/*type for logical functions*/
#define COORD float	    	/*type for coordinate data*/
#define ITYPE long	     	/*type for IVALs*/
#define FTYPE float		    /*type for FVALs*/
#define BTYPE unsigned char	/*type for BVALs*/
#define TINY char		    /*type for type structure member*/
#define HTYPE short     /*type for HVALs (16 bit integer), by Dai 7/31/86*/
#define NTYPE unsigned char   /* type for NVALs, by Dai 8/1/86 */


/* types */
#define EXPEND -1		/* end of expression*/
#define EOARG 0			/* end of arguments*/
#define CPLNULL 1		/* NULLTYPE for compiled */
#define NULLTYPE 2
#define LOCAL 3
#define IVAL 4			/* integer */
#define HVAL 5          /* 16 bit integer, by Dai 7/31/86 */
#define FVAL 6
#define BVAL 7
#define STRADR 8		/* address of a temp structure for string*/
#define NVAL 9          /* 4 bit integer, by Dai 8/1/86 */
#define NAMADR 10		/* address of name block*/
#define HADR 11         /* 16 bit integer address (for array reference),
                           by Dai 7/31/86 */
#define IADR 12			/* int address (for array reference)*/
#define SADR 13			/* string address (for array reference)*/
#define FADR 14			/* float address (array reference)*/
#define BADR 15			/* byte address (array reference)*/
#define AADR 16			/* array */
#define NADR 17         /* 4 bit integer address (for array reference),
						   by Dai 8/1/86 */
#define CPLADR 18		/* compiled macro */
#define CGR 19			/* c graphics type to go in ttype in a TEMP*/
#define SWAPADR 20		/* swap command */
#define CMDADR 24		/* command */
#define MIBBLK 34		/* IS MIB */
#define KEYBLK 38		/* is kbd mib */
#define CZBLOK 40		/* is ^Z mib */
#define CPLMIB 42		/* is a cpl mib */
#define REPEAT 48		/* repeat last argument*/
#define ANYVAL 50		/* any value*/
#define ANYNAM 52		/* any address*/
#define ANYTHING 54		/* any operand*/
#define SWITCH 56		/* switches allowed in this operand list*/
#define LINEND 60		/* end of line (compiled)*/
#define LABEL 62		/* label (compiled)*/
#define IGNORE 64		/* place holder (compiled) */
#define BRANCH 66		/* branch (compiled)*/
#define CPLEND 68		/* end (of compiled)*/
#define UNARY 71		/* unary operator*/
#define BINARY 72		/* binary operator*/
#define LPAREN 73		/* left parenthesis*/
#define RPAREN 74		/* right parenthesis*/
#define CPLRPAREN 75		/* right parenthesis*/

/*  operand types*/
#define NUMB 1
#define STRING 2
#define RELAT 3
#define ASSIGN 4


/*  size-dimension parameters*/
#define VALSTKSIZ	100	/* operand stack size*/
#define QUEUESIZE	80	/* parsing queue*/
/*#define CPLSIZE	500	/* compiled region size*/ /*in comp.c*/
#define CPLINES		200	/* compiled line table size*/
#define NUMOPERS	28	/* number of operators*/
#define BUFLIMIT	128	/* buffer size*/
#define MAXCMDS		180	/* max number of commands */
#define FREEMAX		20	/* number of mibs to initialize */
#define CNTLMAX		32	/* number of cntl's allowed */
#define NUMALPHA	28	/* number of valid alpha characters */
#define NUMTRAN		10	/* number of characters to translate */
#define NUMERR		10	/* number of errors buffered*/
#define STRSIZE		10000	/* unknown-size allocation for strings*/
#define WORKSIZE	130	/* character work area/buffer size*/
#ifdef IBMPC
#define BIGLONG		65535		/* 2**16 - 1*/
#else
#define BIGLONG		2147483647	/* 2**31 - 1*/
#endif
#define RANDRANGE	BIGLONG - 0	/* range of random function*/
#define NDIGIT		6	/* number of digits to print*/


/*  general constants*/
#define ERROR		-1
#define FAIL		-1
#define FLUB		0
#define SUCCEED		1
#define FALSE		0
#define TRUE		1
#define PERMANENT	0	/* mib alloc type */
#define TEMPORARY	1	/* mib alloc type */

/*  character typing constants*/
#define ALPH		1	/*alphabetic*/
#define DIG		    2	/*digit*/
#define LOW		    4	/*lower case alpha*/
#define OPR		    8	/*operator*/
#define STRD		16	/*initial string delimiter*/
#define LEXD		32  	/* , ; \n \0 for yylex*/
#define DEL1		64  	/* ; \n \0*/
#define DEL2		128 	/* \n \0*/
#define DEL3		256 	/* ; \n \0 ( for namadr*/
#define WSP	    	512 	/* blank \t white space*/
#define LDIG		1024	/* 0-9 . for yylex*/
#define CR	    	0x0d
#define TILDE		0x7e

/* control characters  */
#define CTLA	'\001'
#define CTLB	'\002'
#define CTLC	'\003'
#define CTLD	'\004'
#define CTLE	'\005'
#define CTLF	'\006'
#define CTLG	'\007'
#define CTLH	'\010'
#define CTLI	'\011'
#define CTLJ	'\012'
#define CTLK	'\013'
#define CTLL	'\014'
#define CTLM	'\015'
#define CTLN	'\016'
#define CTLO	'\017'
#define CTLP	'\020'
#define CTLQ	'\021'
#define CTLR	'\022'
#define CTLS	'\023'
#define CTLT	'\024'
#define CTLU	'\025'
#define CTLV	'\026'
#define CTLW	'\027'
#define CTLX	'\030'
#define CTLY	'\031'
#define CTLZ	'\032'

#define CTLLEFTBRKT	'\033'
#define CTLBACKSLASH	'\034'
#define CTLRIGHTBRKT	'\035'
#define CTLUPARROW	'\036'

#ifdef AMIGA
#define RUB	0x7f
#endif

#define CTL_	'\037'

#ifdef IBMPC
#define RIGHTARROW	(0x1C)
#define LEFTARROW	(0x1D)
#define UPARROW		(0x1E)
#define DOWNARROW	(0x1F)
#define CTRL_BS		(0x7F)
#define WINDOW		(0xBB)
#define HOMEKEY		(0xC8)
#define ENDKEY		(0xC9)
#define PAGEUP		(0xCA)
#define PAGEDOWN	(0xCB)
#define CTRL_HOME	(0xCC)
#define CTRL_END	(0xCD)
#define INSERT		(0xCE)
#define RUB			(0xCF)
#define FUNCTION1	(0xD2)
#define FUNCTION2	(0xD3)
#define FUNCTION3	(0xD4)
#define FUNCTION4	(0xD5)
#define FUNCTION5	(0xD6)
#define FUNCTION6	(0xD7)
#define FUNCTION7	(0xD8)
#define FUNCTION8	(0xD9)
#define FUNCTION9	(0xDA)
#define FUNCTION10	(0xDB)
#define SFUNCTION1	(0xDC)
#define SFUNCTION2	(0xDD)
#define SFUNCTION3	(0xDE)
#define SFUNCTION4	(0xDF)
#define SFUNCTION5	(0xE0)
#define SFUNCTION6	(0xE1)
#define SFUNCTION7	(0xE2)
#define SFUNCTION8	(0xE3)
#define SFUNCTION9	(0xE4)
#define HELP		(0xE5)
#endif

#define OPAREN		5	/*( index in optab*/
#define CPAREN		6	/*) index in optab*/
#define UOPFIRST	0	/*first unary entry in op_tab*/ 
#define UOPLAST		4	/*last unary entry in op_tab*/
#define U2OPFIRST	26	/*first unary entry in op_tab*/ 
#define U2OPLAST	27	/*last unary entry in op_tab*/
#define SOPFIRST	7	/*single char binary*/
#define SOPLAST		17
#define DOPFIRST	18	/*double char binary*/
#define DOPLAST		25


/* error equates */
#define ER_EXMPL 0	/* for example error */
#define ER_SYS	3	/* internal error*/
#define ER_CGR	4	/* not CGR type*/
#define ER_NULL	5	/* null path name*/
#define ER_TMOD	6	/* invalid transfer mode*/
#define ER_FNAM	7	/* invalid file name*/
#define ER_FCRT	8	/* cant create file*/
#define ER_COLT	9	/* bad color type*/
#define ER_LUTA	10	/* invalid lut array*/
#define ER_FILL 11	/* agenda overflow in fill */
#define ER_FILLS 12	/* fill seed out of window */
#define ER_OPN1 19	/* operand error*/
#define ER_OPN2 20	/* operand error*/
#define ER_CON1 22	/* ANYVAL*/
#define ER_CORE 27
#define ER_128	28	/* OVER BUFFER LIMIT IN INPTTY */
#define ER_LPAR 31	/* illegal (*/
#define ER_DKCH 33	/* unknown character in expression */
#define ER_CMD	34	/* not a command */
#define ER_MAC	35	/* not a macro */
#define ER_NOL	37	/* no such label */
#define ER_LAB2	38	/* duplicate label */
#define ER_ARG	39	/* incomplete argument list*/
#define ER_RPAR 42	/* right paren*/
#define ER_ARBND 47	/* array reference out of bounds */
#define ER_ARA 48	/* can't convert to array */
#define ER_DIM	50	/* too many dimensions for array*/
#define ER_INVL 52	/* invalid argument for command*/
#define ER_EDIT 53	/* can only edit STRADR and NULLTYPE */
#define ER_COMP 59	/* can't compile*/
#define ER_CPLN 60	/* too many lines for compile*/
#define ER_CPLQ 61	/* compile ran out of queue space*/
#define ER_INM	69	/* must be in macro */
#define ER_READ 79	/* read error */
#define ER_WRITE 80	/* write error */
#define ER_SWAP 82	/* can't swap this */
#define ER_TXT 83	/* text error */
#define ER_STKU 87	/* stack underflow*/
#define ER_STKF 88	/* stack full*/
#define ER_OPEN 90	/* can't open file*/
#define ER_DP 91	/* can't dput this*/
#define ER_0DIM 96	/* 0 dimension for array*/
#define ER_DIV0 97	/* divide or mod by 0*/
#define ER_SW	98	/* no such switch*/
#define ER_OPR	102	/* missing operator*/
#define ER_QUF	103	/* queue full*/
#define ER_BIN	104	/* missing binary*/
#define ER_IND	105	/* name from string for @*/
#define ER_ASN	122	/* assignment*/
#define ER_CON2 123	/* ANYVAL from name*/
#define ER_CON3 124	/* FVAL*/
#define ER_CON4 125	/* NAMADR*/
#define ER_CON5 126	/* STRADR*/


/* value references for global special names (To facilitate change to ival */
#define ABVAL _ab.nvalue.ival
#define DAVAL _da.nvalue.ival
#define ERVAL _er.nvalue.ival
#define HRVAL _hr.nvalue.ival
#define MNVAL _mn.nvalue.ival
#define SCVAL _sc.nvalue.ival
#define STVAL _st.nvalue.ival
#define TKVAL _tk.nvalue.ival
#define Z0VAL _z0.nvalue.ival


/*include files*/
/*these entries should be last!!*/

#include <stdio.h>		/*standard io*/
#include "struct.h"		/*structure definitions*/
#include "extern.h"		/*global variables*/
#include "mac.h"		/*macro definitions*/
/*#include <signal.h>
*/