
#include	"sysdef.h"

#include	"scerrd.h"
#include	"scterm.h"
#include	"tempio.h"



int	mactimes ;
int	macoffset ;
int	macsize[NMACROS] ;
int	maccurrent ;

int hlpopen	;

struct	patline	{
		char c[64] ;
		int  len ;
		} ;

struct	pat	{
		struct patline oldpattern ;
		struct patline newpattern ;
		struct patline newcompiled ;
		struct patline oldcompiled ;
		struct patline readbuffer ;
		} ;

struct pat patbuf ;


struct mark	{
		int	linenumber ;
		char	txt[32] ;
		} ;

struct mark markbuffer[5] ;


struct cutblock {
		int	cpnt	;
		int	cblk	;
		} ;

int bufnumber ;
struct	cutblock *pnt_cur,*pnt_eof ;
struct	cutblock cut_cur[5],cut_eof[5] ;
char	cutbuffer[512] ;
int	cut_lines ;
int	cut_st ;


char	*workpointer;		/* pointer to wrkbuf			*/
struct	textline txtsave ;	/* user text save area			*/
char	workbuffer[_maxlen+2];	/* temp work area for current lin	*/
int	worklength ;		/* length of text in workbuffer		*/


int	astaction ;
int	curch	;		/* current char just read 		*/
int	chposition ;		/* current line position 		*/
int	cnt_lines ;		/* keeping lines inserted count.	*/
int	curposition ;		/* current cursor position 		*/
int	doiref	;		/* did newline clear to end of screen?	*/
int	dopage	;		/* unused				*/
int	doxla	;		/* change upper in text to lower	*/
int	erasef	;		/* clear line before print flag 	*/
int	fastio	;		/* really do simple left/rights ?	*/
int	fildir	;		/* for text filling			*/
int	fill_s	;		/* size of fill				*/
int	goldcount;		/* modify next keypad cmd if set	*/
int	goldk	;		/* 'gold' was just typed		*/
int	inmode	;		/* currently in line insert mode	*/
int	inpage	;
int	kpstatus;
int	laddr	;		/* saved address of current line 	*/
int	lastx	;		/* last x axis position			*/
int	lasty	;		/* last y axis position			*/
int	ledstatus ;		/* which leds are turned on vt100 	*/
int	left_m	;		/* current left margin			*/
int	linenext ;
int	loaded	;		/* if the text in workbuf is valid 	*/
int	lrnmod	;		/* set if 'learning' is on		*/
int	no_echo	;		/* never echo any characters.		*/
int	noins	;		/* auto insert is turned off. 		*/
int	nwhite	;		/* line has other than 40 or 11		*/
int	oldch	;		/* last intacter read in loop		*/
int	prevdelete ;
int	prevchar;
int	rept	;		/* repeat count for command ?		*/
int	rltime	;		/* number of times since last dca	*/
int	scsval[16];		/* save switch values here.		*/
int	scswi	;		/* input switch bit patterns		*/
int	ttastarm;
int	twidth	;		/* terminal width at entry		*/
int	vt_status ;
int	sts_three ;
int	updheader ;
int	updcontext[5] ;

static  int junk;



scdainit()
{
	extern char *mapmacro() ;
	register int i ;

	updheader = 0 ;
	linenext = 0 ;
	astaction = 0 ;
	mactimes = 0 ;
	macoffset = -1 ;
	for (i=0; i < NMACROS; i++ ) {
		macsize[i] = 0 ;
		*mapmacro(i) = 0 ;
		} ;
	maccurrent = 0 ;
	patbuf.oldpattern.len = 0 ;
	patbuf.newpattern.len = 0 ;
	patbuf.newcompiled.len = 0 ;
	patbuf.oldcompiled.len = 0 ;
	patbuf.readbuffer.len = 0 ;
	for (i=4; i >= 0; i--) {
	  cut_eof[i].cpnt = 0 ;
	  cut_eof[i].cblk = 0 ;
	  cut_cur[i].cpnt = 0 ;
	  cut_cur[i].cblk = 0 ;
	}
	pnt_eof = &cut_eof[0] ;
	pnt_cur = &cut_cur[0] ;
	bufnumber = 0 ;
	cut_lines = 0 ;
	cut_st = 0 ;
	for (i=4; i >=0; i--) markbuffer[i].linenumber = 0 ;
	txtsave.len = 0 ;
	prevchar = 0 ;
	prevdelete = 0 ;
	lrnmod = 0 ;
}
