 
/*****************************************************************************
	Bit masks for ED mode control flag.  The ones that are commented out
are not used in TECO-C.  They are included here because they are used by
TECO-11.
*****************************************************************************/

#define ED_CARET_OK	1	/* don't use "^" as control-char prefix */
#define ED_YANK_OK	2	/* let yanks clear text buffer */
/*#define ED_NO_EXP	4*/	/* don't allow arbitrary expansions */
#define ED_PRES_DOT	16	/* preserve "dot" on failing searches */
/*#define ED_IMMED_OK	32*/	/* allow immediate mode commands */
#define ED_DOT_BY_ONE	64	/* move dot by one on iter. search failure */
/*#define ED_NO_W	128*/	/* don't do automatic "W" before prompt */

/*****************************************************************************
	Value for EH flag.
*****************************************************************************/

#define EH_COMMAND	4	/* on error,  output failing command string */

/*****************************************************************************
	Bit masks for ET mode control flag.  The ones that are commented out
are not used in TECO-C.  They are included here because they are used by
TECO-11.
*****************************************************************************/

#define ET_IMAGE_MODE	1	/* output without doing conversions */
#define ET_SCOPE	2	/* use scope for delete and control-U */
#define ET_READ_LOWER	4	/* accept lowercase input */
#define ET_NO_ECHO	8	/* don't echo input on control-T */
/*#define ET_CAN_CTRL_O	16*/	/* cancel control-O on output */
#define ET_NO_WAIT	32	/* read with no wait on control-T */
/*#define ET_DETACH	64*/	/* process detached flag */
#define ET_MUNG_MODE	128	/* mung mode */
/*#define ET_TRUNCATE	256*/	/* terminal can't wrap,  truncate on output */
#define ET_WAT_SCOPE	512	/* "WATCH" code exists, terminal is scope */
#define ET_WAT_REFRESH	1024	/* "WATCH" code exists, terminal is refresh */
/*#define ET_EIGHTBIT	4096*/	/* it's an eight-bit terminal */
#define ET_ACCENT_GRAVE	8192	/* accept ` as escape (for VT220 terminals) */
#define ET_VT200	16384	/* special VT200 mode */
#define ET_TRAP_CTRL_C	32768	/* trap control-C */

/*****************************************************************************
	Values for EU flag.
*****************************************************************************/

#define EU_LOWER	0	/* flag lowercase characters on output */
#define EU_UPPER	1	/* flag uppercase characters on output */

/*****************************************************************************
	These identifiers are used to index into the global ChrMsk array.
The ChrMsk array is used by the macros defined in the ChrMac.h file.  It is
also used in ReadCS to make the character input code fast.  See the comment
above the definition of the ChrMsk array in file TECOC.C.
*****************************************************************************/

#define RCS_AST		'\1'	/* asterisk */
#define RCS_BS		'\2'	/* backspace */
#define RCS_CCH		'\3'	/* control character other than ^G, ^U or ^Z */
#define RCS_CR		'\4'	/* carriage return */
#define RCS_CTG		'\5'	/* control-G */
#define RCS_CTU		'\6'	/* control-U */
#define RCS_CTZ		'\7'	/* control-Z */
#define RCS_DEF		'\10'	/* character other than RCS_AST, RCS_BS, etc. */
#define RCS_DEL		'\11'	/* delete */
#define RCS_GRV		'\12'	/* accent grave */
#define RCS_LF		'\13'	/* line feed */
#define RCS_LWR		'\14'	/* lowercase character */
#define RCS_SP		'\15'	/* space */
#define RCS_VF		'\16'	/* vertical tab or form feed */
#define CM_DIGIT	'\20'	/* digits */
#define CM_LINE_TERM	'\40'	/* line terminators (lf, vt, ff) */
#define CM_LOWER	'\100'	/* lowercase */
#define CM_UPPER	'\200'	/* uppercase */

/*****************************************************************************
	These identifiers are set by the search commands.  They provide a way
for the search commands to all rely on common code,  even when the commands
behave slightly differently.  It's a terrible way to code,  but it was only
done in the search code.
*****************************************************************************/

#define E_SEARCH  1
#define FB_SEARCH 2
#define FK_SEARCH 3
#define N_SEARCH  4
#define S_SEARCH  5
#define U_SEARCH  6

/*****************************************************************************
	Identifiers for indices into the IFiles and OFiles arrays.
*****************************************************************************/

#define	NOFDBS	3	/* number of output file data blocks */

#define	POUTFL	0	/* primary output stream */
#define	SOUTFL	1	/* secondary output stream */
#define	EPRCFL	2	/* output stream used by E% command */

#define	PINPFL	0	/* primary input stream */
#define	SINPFL	1	/* secondary input stream */
#define	EQFL	2	/* input stream used by EQ command */
#define EIFL	3	/* first input stream used by EI command */

/*****************************************************************************
	Miscellaneous identifiers.
*****************************************************************************/

#define ATSIGN    '\1'	/* mask of "at sign" bit in CmdMod */
#define COLON     '\2'	/* mask of "colon" bit in CmdMod */
#define DCOLON    '\4'	/* mask of "double colon" bit in CmdMod */
#define FAILURE   (-1)	/* return status, means "command string failed" */
#define FILENF    3	/* "file not found", returned by ZSWild */
#define INFINITE  -1L	/* loop count value for infinite loops */
#define LOWER     '\0'	/* case conversion mode specifier, for ^V, ^W */
#define MARGIS    '\10'	/* mask of "m defined" bit in CmdMod */
#define NONE      '\1'	/* case conversion mode specifier */
#define OPERAND   '\0'	/* means element is an integer */
#define OPERATOR  '\1'	/* means element is + - * / & or | */
#define PRIMARY   '\0'	/* primary input or output stream specifier */
#define SECNDARY  '\1'	/* secondary input or output stream specifier */
#define SUCCESS   0	/* return status, means "command string succeeded" */
#define UPPER     '\2'	/* case conversion mode specifier, for ^V, ^W */

#define DEBUGGING NO		/* if YES, compile debugging code */

#if DEBUGGING
/*
	There is an internal, messy-but-useful debugging system within TECO-C.
It is based on DbgLvl,  a variable which can have the following values:

			0	no debugging messages
			1	command echoing
			2	routine entry-exit messages
			3	higher-level "what I'm doing" messages
			4	everything

	Messages come out indented for readablility.  The variable DbgInd
contains the number of spaces output before each debugging message.  DbgInd is
incremented each time a routine is entered and decremented when the routine
exits.  All debugging messages come out in reverse video.
*/

extern	VOID	DbgDBf();	/* display a buffer on terminal screen */
extern	VOID	DbgMsg();	/* debugging: display indentation */
extern	VOID	MakDBf();	/* make ASCII number in digit buffer (DBf) */

EXTERN	DEFAULT DbgInd;		/* debugging indentation level */
EXTERN	DEFAULT DbgLvl;		/* debugging message level */
EXTERN	char	*DBfBeg;	/* digit buffer beginning */
EXTERN	char	*DBfPtr;	/* digit buffer pointer */

#endif /*********************************************************************/

/*****************************************************************************
	define structure for expression stack
*****************************************************************************/
struct EStck
	{
	LONG Elemnt;		/* integer or operand character */
	BYTE ElType;		/* Entry's type: OPERATOR or OPERAND */
	};

/*****************************************************************************
	define structure for loop stack
*****************************************************************************/
struct LStck
	{
	LONG LIndex;		/* loop repetition count */
	char *LAddr;		/* pointer to start of loop */
	};

/*****************************************************************************
	define structure for macro stack
*****************************************************************************/
struct MStck
	{
	char	*BegCS;		/* saves BegCSt */
	char	*CmdPt;		/* saves CmdPtr */
	char	*EndCS;		/* saves EndCSt */
	WORD	ESBot;		/* saves EStBot */
	WORD	ESTop;		/* saves EStTop */
	WORD	LSBot;		/* saves LStBot */
	WORD	LSTop;		/* saves LStTop */
	struct	QReg *LQTabl;	/* local q-register table */
	};

/*****************************************************************************
	define structure for q-registers
*****************************************************************************/
struct QReg
	{
	char	*Start;		/* start of text */
	char	*End_P1;	/* end of text, plus one */
	LONG	Number;		/* numeric part of q-register */
	};
