
# This is a shell archive.  Remove anything before this line,
# then unpack it by saving it in a file and typing "sh file".
#
# Wrapped by tralfaz!ove on Wed Jan 13 14:07:18 PST 1988
# Contents:  bug.h ctype.h ebind.h edef.h efunc.h epath.h esearc.h estruc.h
#	evar.h io.h ll.h macros.h tcplib.h
 
echo x - bug.h
sed 's/^@//' > "bug.h" <<'@//E*O*F bug.h//'
#ifndef BUG
#define BUG
#define TCP_IN          0x01    /* incoming TCP messages */
#define TCP_OUT         0x02    /* outgoing TCP messages */
#define TCP             0x03    /* incoming & outgoing TCP messages */
#define TCP_Q           0x04    /* tcplib event queues */
#define TCP_FLOW        0x08    /* every function call in tcplib */
#define NSP_PARSE       0x10    /* parse all nsp messages */
#define TFLOW           0x20    /* every telnet function call */
#define SESS            0x40    /* session creation and deletion in telnet */
#define COMMANDS        0x80    /* ftp commands */
#define CCCFLOW         0x100   /* function calls in ccclib */
#define NSP_RAW         0x200   /* parse all nsp messages */
#define TIMING          0x400   /* timings */
#define DHEX            0x800   /* output data in hexadecimal */
#define SHIP            0x1000  /* print input/output as it is sent */
#define MEMORY          0x2000  /* memory allocation */
#define ACK             0x4000  /* acknowledgement */
#define IPC_TYPES       0x8000  /* ipc message types */
unsigned char *Visible();
#endif

@//E*O*F bug.h//
chmod u=rw,g=r,o=r bug.h
 
echo x - ctype.h
sed 's/^@//' > "ctype.h" <<'@//E*O*F ctype.h//'
/* CRAYSCCS @(#)include/ctype.h	1.4	1/14/86 15:37:31 */
/*	@(#)ctype.h	1.2	*/
/*	3.0 SID #	1.2	*/
#define	_U	01
#define	_L	02
#define	_N	04
#define	_S	010
#define	_P	020
#define	_C	040
#define	_B	0100
#define	_X	0200

extern char	_ctype[];

#ifndef lint
#define	isalpha(c)	(_ctype[(int)(c)+1]&(_U|_L))
#define	isupper(c)	(_ctype[(int)(c)+1]&_U)
#define	islower(c)	(_ctype[(int)(c)+1]&_L)
#define	isdigit(c)	(_ctype[(int)(c)+1]&_N)
#define	isxdigit(c)	(_ctype[(int)(c)+1]&_X)
#define	isalnum(c)	(_ctype[(int)(c)+1]&(_U|_L|_N))
#define	isspace(c)	(_ctype[(int)(c)+1]&_S)
#define	ispunct(c)	(_ctype[(int)(c)+1]&_P)
#define	isprint(c)	(_ctype[(int)(c)+1]&(_P|_U|_L|_N|_B))
#define	isgraph(c)	(_ctype[(int)(c)+1]&(_P|_U|_L|_N))
#define	iscntrl(c)	(_ctype[(int)(c)+1]&_C)
#define	isascii(c)	(!((long)(c)&~0177))
#define	_toupper(c)	((c)-'a'+'A')
#define	_tolower(c)	((c)-'A'+'a')
#define	toascii(c)	((c)&0177)
#endif
@//E*O*F ctype.h//
chmod u=rw,g=r,o=r ctype.h
 
echo x - ebind.h
sed 's/^@//' > "ebind.h" <<'@//E*O*F ebind.h//'
/*	EBIND:		Initial default key to function bindings for
			MicroEMACS 3.7
*/

/*
 * Command table.
 * This table  is *roughly* in ASCII order, left to right across the
 * characters of the command. This explains the funny location of the
 * control-X commands.
 */
KEYTAB	keytab[NBINDS] = {
	{CTRL|'A',		gotobol},
	{CTRL|'B',		backchar},
	{CTRL|'C',		insspace},
	{CTRL|'D',		forwdel},
	{CTRL|'E',		gotoeol},
	{CTRL|'F',		forwchar},
	{CTRL|'G',		ctrlg},
	{CTRL|'H',		backdel},
	{CTRL|'I',		tab},
	{CTRL|'J',		indent},
	{CTRL|'K',		killtext},
	{CTRL|'L',		refresh},
	{CTRL|'M',		newline},
	{CTRL|'N',		forwline},
	{CTRL|'O',		openline},
	{CTRL|'P',		backline},
	{CTRL|'Q',		quote},
	{CTRL|'R',		backsearch},
	{CTRL|'S',		forwsearch},
	{CTRL|'T',		twiddle},
	{CTRL|'U',		unarg},
	{CTRL|'V',		forwpage},
	{CTRL|'W',		killregion},
	{CTRL|'X',		cex},
	{CTRL|'Y',		yank},
	{CTRL|'Z',		backpage},
	{CTRL|']',		meta},
	{CTLX|CTRL|'B', 	listbuffers},
	{CTLX|CTRL|'C', 	quit},		/* Hard quit.		*/
	{CTLX|CTRL|'F', 	filefind},
	{CTLX|CTRL|'I', 	insfile},
	{CTLX|CTRL|'L', 	lowerregion},
	{CTLX|CTRL|'M', 	delmode},
	{CTLX|CTRL|'N', 	mvdnwind},
	{CTLX|CTRL|'O', 	deblank},
	{CTLX|CTRL|'P', 	mvupwind},
	{CTLX|CTRL|'R', 	fileread},
	{CTLX|CTRL|'S', 	filesave},
	{CTLX|CTRL|'U', 	upperregion},
	{CTLX|CTRL|'V', 	viewfile},
	{CTLX|CTRL|'W', 	filewrite},
	{CTLX|CTRL|'X', 	swapmark},
	{CTLX|CTRL|'Z', 	shrinkwind},
	{CTLX|'?',		deskey},
	{CTLX|'!',		spawn},
	{CTLX|'@',		pipe},
	{CTLX|'#',		filter},
	{CTLX|'=',		showcpos},
	{CTLX|'(',		ctlxlp},
	{CTLX|')',		ctlxrp},
	{CTLX|'^',		enlargewind},
	{CTLX|'0',		delwind},
	{CTLX|'1',		onlywind},
	{CTLX|'2',		splitwind},
	{CTLX|'A',		setvar},
	{CTLX|'B',		usebuffer},
	{CTLX|'C',		spawncli},
#if	BSD
	{CTLX|'D',		bktoshell},
#endif
	{CTLX|'E',		ctlxe},
	{CTLX|'F',		setfillcol},
	{CTLX|'K',		killbuffer},
	{CTLX|'M',		setmode},
	{CTLX|'N',		filename},
	{CTLX|'O',		nextwind},
	{CTLX|'P',		prevwind},
#if	ISRCH
	{CTLX|'R',		risearch},
	{CTLX|'S',		fisearch},
#endif
	{CTLX|'W',		resize},
	{CTLX|'X',		nextbuffer},
	{CTLX|'Z',		enlargewind},
#if	WORDPRO
	{META|CTRL|'C', 	wordcount},
#endif
#if	CFENCE
	{META|CTRL|'F', 	getfence},
#endif
	{META|CTRL|'H', 	delbword},
	{META|CTRL|'K', 	unbindkey},
	{META|CTRL|'L', 	reposition},
	{META|CTRL|'M', 	delgmode},
	{META|CTRL|'N', 	namebuffer},
	{META|CTRL|'R', 	qreplace},
	{META|CTRL|'S', 	newsize},
	{META|CTRL|'T', 	newwidth},
	{META|CTRL|'V', 	scrnextdw},
#if	WORDPRO
	{META|CTRL|'W', 	killpara},
#endif
	{META|CTRL|'Z', 	scrnextup},
	{META|' ',		setmark},
	{META|'?',		help},
	{META|'!',		reposition},
	{META|'.',		setmark},
	{META|'>',		gotoeob},
	{META|'<',		gotobob},
	{META|'~',		unmark},
#if	APROP
	{META|'A',		apro},
#endif
	{META|'B',		backword},
	{META|'C',		capword},
	{META|'D',		delfword},
#if	CRYPT
	{META|'E',		setkey},
#endif
	{META|'F',		forwword},
	{META|'G',		gotoline},
	{META|'K',		bindtokey},
	{META|'L',		lowerword},
	{META|'M',		setgmode},
#if	WORDPRO
	{META|'N',		gotoeop},
	{META|'P',		gotobop},
	{META|'Q',		fillpara},
#endif
	{META|'R',		sreplace},
#if	BSD
	{META|'S',		bktoshell},
#endif
	{META|'U',		upperword},
	{META|'V',		backpage},
	{META|'W',		copyregion},
	{META|'X',		namedcmd},
	{META|'Z',		quickexit},
	{META|0x7F,		delbword},

#if	CRAY
	{SPEC|0,		setcursor},	/* cray mouse support */

/* top fkeys */
	{SPEC|'1',		filefind},
	{SPEC|'2',		fileread},
	{SPEC|'3',		insfile},
	{SPEC|'4',		viewfile},
	{SPEC|'5',		filesave},
	{SPEC|'6',		filewrite},
	{SPEC|'7',		filename},
	{SPEC|'8',		copyregion},
	{SPEC|'9',		unarg},

	{SPEC|33,		sreplace},
	{SPEC|34,		qreplace},
	{SPEC|35,		insspace},
	{SPEC|36,		upperregion},
	{SPEC|37,		lowerregion},
	{SPEC|38,		setmode},
	{SPEC|39,		delmode},
	{SPEC|40,		help},
	{SPEC|41,		apro},
	
/* right function keys */
	{SPEC|'a',		backpage},
	{SPEC|'b',		gotobob},
	{SPEC|'c',		risearch},
	{SPEC|'d',		forwpage},
	{SPEC|'e',		gotoeob},
	{SPEC|'f',		fisearch},
	{SPEC|'g',		gotobol},
	{SPEC|'h',		backline},
	{SPEC|'i',		gotoeol},
	{SPEC|'j',		backchar},
	{SPEC|'k',		setmark},
	{SPEC|'l',		forwchar},
	{SPEC|'m',		backword},
	{SPEC|'n',		forwline},
	{SPEC|'o',		forwword},
	
	{SPEC|'A',		ctlxe},
	{SPEC|'B',		ctlxlp},
	{SPEC|'C',		ctlxrp},
	{SPEC|'D',		nextbuffer},
	{SPEC|'E',		listbuffers},
	{SPEC|'F',		namebuffer},
	{SPEC|'G',		usebuffer},
	{SPEC|'H',		backline},
	{SPEC|'I',		killbuffer},
	{SPEC|'J',		backchar},
	{SPEC|'K',		namedcmd},
	{SPEC|'L',		forwchar},
	{SPEC|'M',		delbword},
	{SPEC|'N',		forwline},
	{SPEC|'O',		delfword},
	
	{SPEC|1,		scrnextup},
	{SPEC|2,		prevwind},
	{SPEC|3,		delwind},
	{SPEC|4,		scrnextdw},
	{SPEC|5,		nextwind},
	{SPEC|6,		onlywind},
	{SPEC|7,		resize},
	{SPEC|8,		backline},
	{SPEC|9,		reposition},
	{SPEC|10,		backchar},
	{SPEC|11,		splitwind},
	{SPEC|12,		forwchar},
	{SPEC|13,		shrinkwind},
	{SPEC|14,		forwline},
	{SPEC|15,		enlargewind},
#endif


#if	MSDOS & (HP150 == 0) & (WANGPC == 0) & (HP110 == 0)
	{SPEC|CTRL|'_', 	forwhunt},
	{SPEC|CTRL|'S', 	backhunt},
	{SPEC|71,		gotobob},
	{SPEC|72,		backline},
	{SPEC|73,		backpage},
	{SPEC|75,		backchar},
	{SPEC|77,		forwchar},
	{SPEC|79,		gotoeob},
	{SPEC|80,		forwline},
	{SPEC|81,		forwpage},
	{SPEC|82,		insspace},
	{SPEC|83,		forwdel},
	{SPEC|115,		backword},
	{SPEC|116,		forwword},
#if	WORDPRO
	{SPEC|132,		gotobop},
	{SPEC|118,		gotoeop},
#endif
	{SPEC|84,		cbuf1},
	{SPEC|85,		cbuf2},
	{SPEC|86,		cbuf3},
	{SPEC|87,		cbuf4},
	{SPEC|88,		cbuf5},
	{SPEC|89,		cbuf6},
	{SPEC|90,		cbuf7},
	{SPEC|91,		cbuf8},
	{SPEC|92,		cbuf9},
	{SPEC|93,		cbuf10},
#endif

#if	HP150
	{SPEC|32,		backline},
	{SPEC|33,		forwline},
	{SPEC|35,		backchar},
	{SPEC|34,		forwchar},
	{SPEC|44,		gotobob},
	{SPEC|46,		forwpage},
	{SPEC|47,		backpage},
	{SPEC|82,		nextwind},
	{SPEC|68,		openline},
	{SPEC|69,		killtext},
	{SPEC|65,		forwdel},
	{SPEC|64,		ctlxe},
	{SPEC|67,		refresh},
	{SPEC|66,		reposition},
	{SPEC|83,		help},
	{SPEC|81,		deskey},
#endif

#if	HP110
	{SPEC|0x4b,		backchar},
	{SPEC|0x4d,		forwchar},
	{SPEC|0x48,		backline},
	{SPEC|0x50,		forwline},
	{SPEC|0x43,		help},
	{SPEC|0x73,		backword},
	{SPEC|0x74,		forwword},
	{SPEC|0x49,		backpage},
	{SPEC|0x51,		forwpage},
	{SPEC|84,		cbuf1},
	{SPEC|85,		cbuf2},
	{SPEC|86,		cbuf3},
	{SPEC|87,		cbuf4},
	{SPEC|88,		cbuf5},
	{SPEC|89,		cbuf6},
	{SPEC|90,		cbuf7},
	{SPEC|91,		cbuf8},
#endif

#if	AMIGA
	{SPEC|'?',		help},
	{SPEC|'A',		backline},
	{SPEC|'B',		forwline},
	{SPEC|'C',		forwchar},
	{SPEC|'D',		backchar},
	{SPEC|'T',		backpage},
	{SPEC|'S',		forwpage},
	{SPEC|'a',		backword},
	{SPEC|'`',		forwword},
	{SPEC|'P',		cbuf1},
	{SPEC|'Q',		cbuf2},
	{SPEC|'R',		cbuf3},
	{SPEC|'S',		cbuf4},
	{SPEC|'T',		cbuf5},
	{SPEC|'U',		cbuf6},
	{SPEC|'V',		cbuf7},
	{SPEC|'W',		cbuf8},
	{SPEC|'X',		cbuf9},
	{SPEC|'Y',		cbuf10},

#endif

#if	ST520
	{SPEC|'?',		help},
	{SPEC|'A',		backline},
	{SPEC|'B',		forwline},
	{SPEC|'C',		forwchar},
	{SPEC|'D',		backchar},
	{SPEC|'T',		backpage},
	{SPEC|'S',		forwpage},
	{SPEC|'a',		backword},
	{SPEC|'`',		forwword},
	{SPEC|'P',		cbuf1},
	{SPEC|'Q',		cbuf2},
	{SPEC|'R',		cbuf3},
	{SPEC|'S',		cbuf4},
	{SPEC|'T',		cbuf5},
	{SPEC|'U',		cbuf6},
	{SPEC|'V',		cbuf7},
	{SPEC|'W',		cbuf8},
	{SPEC|'X',		cbuf9},
	{SPEC|'Y',		cbuf10},

#endif

#if  WANGPC
	SPEC|0xE0,		quit,		/* Cancel */
	SPEC|0xE1,		help,		/* Help */
	SPEC|0xF1,		help,		/* ^Help */
	SPEC|0xE3,		ctrlg,		/* Print */
	SPEC|0xF3,		ctrlg,		/* ^Print */
	SPEC|0xC0,		backline,	/* North */
	SPEC|0xD0,		gotobob,	/* ^North */
	SPEC|0xC1,		forwchar,	/* East */
	SPEC|0xD1,		gotoeol,	/* ^East */
	SPEC|0xC2,		forwline,	/* South */
	SPEC|0xD2,		gotobop,	/* ^South */
	SPEC|0xC3,		backchar,	/* West */
	SPEC|0xD3,		gotobol,	/* ^West */
	SPEC|0xC4,		ctrlg,		/* Home */
	SPEC|0xD4,		gotobob,	/* ^Home */
	SPEC|0xC5,		filesave,	/* Execute */
	SPEC|0xD5,		ctrlg,		/* ^Execute */
	SPEC|0xC6,		insfile,	/* Insert */
	SPEC|0xD6,		ctrlg,		/* ^Insert */
	SPEC|0xC7,		forwdel,	/* Delete */
	SPEC|0xD7,		killregion,	/* ^Delete */
	SPEC|0xC8,		backpage,	/* Previous */
	SPEC|0xD8,		prevwind,	/* ^Previous */
	SPEC|0xC9,		forwpage,	/* Next */
	SPEC|0xD9,		nextwind,	/* ^Next */
	SPEC|0xCB,		ctrlg,		/* Erase */
	SPEC|0xDB,		ctrlg,		/* ^Erase */
	SPEC|0xDC,		ctrlg,		/* ^Tab */
	SPEC|0xCD,		ctrlg,		/* BackTab */
	SPEC|0xDD,		ctrlg,		/* ^BackTab */
	SPEC|0x80,		ctrlg,		/* Indent */
	SPEC|0x90,		ctrlg,		/* ^Indent */
	SPEC|0x81,		ctrlg,		/* Page */
	SPEC|0x91,		ctrlg,		/* ^Page */
	SPEC|0x82,		ctrlg,		/* Center */
	SPEC|0x92,		ctrlg,		/* ^Center */
	SPEC|0x83,		ctrlg,		/* DecTab */
	SPEC|0x93,		ctrlg,		/* ^DecTab */
	SPEC|0x84,		ctrlg,		/* Format */
	SPEC|0x94,		ctrlg,		/* ^Format */
	SPEC|0x85,		ctrlg,		/* Merge */
	SPEC|0x95,		ctrlg,		/* ^Merge */
	SPEC|0x86,		setmark,	/* Note */
	SPEC|0x96,		ctrlg,		/* ^Note */
	SPEC|0x87,		ctrlg,		/* Stop */
	SPEC|0x97,		ctrlg,		/* ^Stop */
	SPEC|0x88,		forwsearch,	/* Srch */
	SPEC|0x98,		backsearch,	/* ^Srch */
	SPEC|0x89,		sreplace,	/* Replac */
	SPEC|0x99,		qreplace,	/* ^Replac */
	SPEC|0x8A,		ctrlg,		/* Copy */
	SPEC|0x9A,		ctrlg,		/* ^Copy */
	SPEC|0x8B,		ctrlg,		/* Move */
	SPEC|0x9B,		ctrlg,		/* ^Move */
	SPEC|0x8C,		namedcmd,	/* Command */
	SPEC|0x9C,		spawn,		/* ^Command */
	SPEC|0x8D,		ctrlg,		/* ^ */
	SPEC|0x9D,		ctrlg,		/* ^^ */
	SPEC|0x8E,		ctrlg,		/* Blank */
	SPEC|0x9E,		ctrlg,		/* ^Blank */
	SPEC|0x8F,		gotoline,	/* GoTo */
	SPEC|0x9F,		usebuffer,	/* ^GoTo */
#endif
 
	{0x7F,			backdel},

	/* special internal bindings */
	SPEC|META|'W',		wrapword,	/* called on word wrap */

	{0,			NULL}
};

#if RAINBOW

#include "rainbow.h"

/*
 * Mapping table from the LK201 function keys to the internal EMACS character.
 */

short lk_map[][2] = {
	Up_Key, 			CTRL+'P',
	Down_Key,			CTRL+'N',
	Left_Key,			CTRL+'B',
	Right_Key,			CTRL+'F',
	Shift+Left_Key, 		META+'B',
	Shift+Right_Key,		META+'F',
	Control+Left_Key,		CTRL+'A',
	Control+Right_Key,		CTRL+'E',
	Prev_Scr_Key,			META+'V',
	Next_Scr_Key,			CTRL+'V',
	Shift+Up_Key,			META+'<',
	Shift+Down_Key, 		META+'>',
	Cancel_Key,			CTRL+'G',
	Find_Key,			CTRL+'S',
	Shift+Find_Key, 		CTRL+'R',
	Insert_Key,			CTRL+'Y',
	Options_Key,			CTRL+'D',
	Shift+Options_Key,		META+'D',
	Remove_Key,			CTRL+'W',
	Shift+Remove_Key,		META+'W',
	Select_Key,			CTRL+'@',
	Shift+Select_Key,		CTLX+CTRL+'X',
	Interrupt_Key,			CTRL+'U',
	Keypad_PF2,			META+'L',
	Keypad_PF3,			META+'C',
	Keypad_PF4,			META+'U',
	Shift+Keypad_PF2,		CTLX+CTRL+'L',
	Shift+Keypad_PF4,		CTLX+CTRL+'U',
	Keypad_1,			CTLX+'1',
	Keypad_2,			CTLX+'2',
	Do_Key, 			CTLX+'E',
	Keypad_4,			CTLX+CTRL+'B',
	Keypad_5,			CTLX+'B',
	Keypad_6,			CTLX+'K',
	Resume_Key,			META+'!',
	Control+Next_Scr_Key,		CTLX+'N',
	Control+Prev_Scr_Key,		CTLX+'P',
	Control+Up_Key, 		CTLX+CTRL+'P',
	Control+Down_Key,		CTLX+CTRL+'N',
	Help_Key,			CTLX+'=',
	Shift+Do_Key,			CTLX+'(',
	Control+Do_Key, 		CTLX+')',
	Keypad_0,			CTLX+'Z',
	Shift+Keypad_0, 		CTLX+CTRL+'Z',
	Main_Scr_Key,			CTRL+'C',
	Keypad_Enter,			CTLX+'!',
	Exit_Key,			CTLX+CTRL+'C',
	Shift+Exit_Key, 		CTRL+'Z'
};

#define lk_map_size	(sizeof(lk_map)/2)
#endif

@//E*O*F ebind.h//
chmod u=rw,g=r,o=r ebind.h
 
echo x - edef.h
sed 's/^@//' > "edef.h" <<'@//E*O*F edef.h//'
/*	EDEF:		Global variable definitions for
			MicroEMACS 3.2

			written by Dave G. Conroy
			modified by Steve Wilhite, George Jones
			greatly modified by Daniel Lawrence
*/

/* some global fuction declarations */

char *malloc();
char *strcpy();
char *strcat();
char *strncpy();
char *itoa();
char *getval();
char *gtenv();
char *gtusr();
char *gtfun();
char *token();
char *ltos();
char *flook();

#ifdef	maindef

/* for MAIN.C */

/* initialized global definitions */

int	fillcol = 72;			/* Current fill column		*/
short	kbdm[NKBDM];			/* Macro			*/
char	pat[NPAT];			/* Search pattern		*/
char	rpat[NPAT];			/* replacement pattern		*/
char	*execstr = NULL;		/* pointer to string to execute */
char	golabel[NPAT] = "";		/* current line to go to	*/
int	execlevel = 0;			/* execution IF level		*/
int	eolexist = TRUE;		/* does clear to EOL exist	*/
int	revexist = FALSE;		/* does reverse video exist?	*/
int	flickcode = FALSE;		/* do flicker supression?	*/
char	*modename[] = { 		/* name of modes		*/
	"WRAP", "CMODE", "SPELL", "EXACT", "VIEW", "OVER", "MAGIC", "CRYPT"};
char	modecode[] = "WCSEVOMY";	/* letters to represent modes	*/
int	gmode = 0;			/* global editor mode		*/
int	gfcolor = 7;			/* global forgrnd color (white) */
int	gbcolor = 0;			/* global backgrnd color (black)*/
int	sgarbf	= TRUE; 		/* TRUE if screen is garbage	*/
int	mpresf	= FALSE;		/* TRUE if message in last line */
int	clexec	= FALSE;		/* command line execution flag	*/
int	mstore	= FALSE;		/* storing text to macro flag	*/
struct	BUFFER *bstore = NULL;		/* buffer to store macro text to*/
int	vtrow	= 0;			/* Row location of SW cursor */
int	vtcol	= 0;			/* Column location of SW cursor */
int	ttrow	= HUGE; 		/* Row location of HW cursor */
int	ttcol	= HUGE; 		/* Column location of HW cursor */
int	lbound	= 0;			/* leftmost column of current line
					   being displayed */
int	taboff	= 0;			/* tab offset for display	*/
int	metac = CTRL | '[';		/* current meta character */
int	ctlxc = CTRL | 'X';		/* current control X prefix char */
int	reptc = CTRL | 'U';		/* current universal repeat char */
int	abortc = CTRL | 'G';		/* current abort command char	*/

int	quotec = 0x11;			/* quote char during mlreply() */
char	*cname[] = {			/* names of colors		*/
	"BLACK", "RED", "GREEN", "YELLOW", "BLUE",
	"MAGENTA", "CYAN", "WHITE"};
KILL *kbufp  = NULL;		/* current kill buffer chunk pointer	*/
KILL *kbufh  = NULL;		/* kill buffer header pointer		*/
int kused = KBLOCK;		/* # of bytes used in kill buffer	*/
WINDOW *swindow = NULL; 	/* saved window pointer 		*/
int cryptflag = FALSE;		/* currently encrypting?		*/
short	*kbdptr;		/* current position in keyboard buf */
short	*kbdend = &kbdm[0];	/* ptr to end of the keyboard */
int	kbdmode = STOP; 	/* current keyboard macro mode	*/
int	kbdrep = 0;		/* number of repetitions	*/
int	restflag = FALSE;	/* restricted use?		*/
long	envram = 0l;	/* # of bytes current in use by malloc */
int	macbug = FALSE; 	/* macro debuging flag		*/
char	errorm[] = "ERROR";	/* error literal		*/
char	truem[] = "TRUE";	/* true literal 		*/
char	falsem[] = "FALSE";	/* false litereal		*/
int	cmdstatus = TRUE;	/* last command status		*/

/* uninitialized global definitions */

int	currow; 		/* Cursor row			*/
int	curcol; 		/* Cursor column		*/
int	thisflag;		/* Flags, this command		*/
int	lastflag;		/* Flags, last command		*/
int	curgoal;		/* Goal for C-P, C-N		*/
WINDOW	*curwp; 		/* Current window		*/
BUFFER	*curbp; 		/* Current buffer		*/
WINDOW	*wheadp;		/* Head of list of windows	*/
BUFFER	*bheadp;		/* Head of list of buffers	*/
BUFFER	*blistp;		/* Buffer for C-X C-B		*/

BUFFER	*bfind();		/* Lookup a buffer by name	*/
WINDOW	*wpopup();		/* Pop up window creation	*/
LINE	*lalloc();		/* Allocate a line		*/
char	sres[NBUFN];		/* current screen resolution	*/

#if	CRAY
int	inhibit_update ;	/* prevents output to terminal */
int	inet_address ;
int	inet_port = 10000 ;
#endif

#else

/* for all the other .C files */

/* initialized global external declarations */

extern	int	fillcol;		/* Fill column			*/
extern	short	kbdm[]; 		/* Holds kayboard macro data	*/
extern	char	pat[];			/* Search pattern		*/
extern	char	rpat[]; 		/* Replacement pattern		*/
extern	char	*execstr;		/* pointer to string to execute */
extern	char	golabel[];		/* current line to go to	*/
extern	int	execlevel;		/* execution IF level		*/
extern	int	eolexist;		/* does clear to EOL exist?	*/
extern	int	revexist;		/* does reverse video exist?	*/
extern	int	flickcode;		/* do flicker supression?	*/
extern	char *modename[];		/* text names of modes		*/
extern	char	modecode[];		/* letters to represent modes	*/
extern	KEYTAB keytab[];		/* key bind to functions table	*/
extern	NBIND names[];			/* name to function table	*/
extern	int	gmode;			/* global editor mode		*/
extern	int	gfcolor;		/* global forgrnd color (white) */
extern	int	gbcolor;		/* global backgrnd color (black)*/
extern	int	sgarbf; 		/* State of screen unknown	*/
extern	int	mpresf; 		/* Stuff in message line	*/
extern	int	clexec; 		/* command line execution flag	*/
extern	int	mstore; 		/* storing text to macro flag	*/
extern	struct	BUFFER *bstore; 	/* buffer to store macro text to*/
extern	int	vtrow;			/* Row location of SW cursor */
extern	int	vtcol;			/* Column location of SW cursor */
extern	int	ttrow;			/* Row location of HW cursor */
extern	int	ttcol;			/* Column location of HW cursor */
extern	int	lbound; 		/* leftmost column of current line
					   being displayed */
extern	int	taboff; 		/* tab offset for display	*/
extern	int	metac;			/* current meta character */
extern	int	ctlxc;			/* current control X prefix char */
extern	int	reptc;			/* current universal repeat char */
extern	int	abortc; 		/* current abort command char	*/

extern	int	quotec; 		/* quote char during mlreply() */
extern	char	*cname[];		/* names of colors		*/
extern KILL *kbufp;			/* current kill buffer chunk pointer */
extern KILL *kbufh;			/* kill buffer header pointer	*/
extern int kused;			/* # of bytes used in KB	*/
extern WINDOW *swindow; 		/* saved window pointer 	*/
extern int cryptflag;			/* currently encrypting?	*/
extern	short	*kbdptr;		/* current position in keyboard buf */
extern	short	*kbdend;		/* ptr to end of the keyboard */
extern	int kbdmode;			/* current keyboard macro mode	*/
extern	int kbdrep;			/* number of repetitions	*/
extern	int restflag;			/* restricted use?		*/
extern	long envram;		/* # of bytes current in use by malloc */
extern	int	macbug; 		/* macro debuging flag		*/
extern	char	errorm[];		/* error literal		*/
extern	char	truem[];		/* true literal 		*/
extern	char	falsem[];		/* false litereal		*/
extern	int	cmdstatus;		/* last command status		*/

/* uninitialized global external declarations */

extern	int	currow; 		/* Cursor row			*/
extern	int	curcol; 		/* Cursor column		*/
extern	int	thisflag;		/* Flags, this command		*/
extern	int	lastflag;		/* Flags, last command		*/
extern	int	curgoal;		/* Goal for C-P, C-N		*/
extern	WINDOW	*curwp; 		/* Current window		*/
extern	BUFFER	*curbp; 		/* Current buffer		*/
extern	WINDOW	*wheadp;		/* Head of list of windows	*/
extern	BUFFER	*bheadp;		/* Head of list of buffers	*/
extern	BUFFER	*blistp;		/* Buffer for C-X C-B		*/

extern	BUFFER	*bfind();		/* Lookup a buffer by name	*/
extern	WINDOW	*wpopup();		/* Pop up window creation	*/
extern	LINE	*lalloc();		/* Allocate a line		*/
extern	char	sres[NBUFN];		/* current screen resolution	*/

#if	CRAY
extern	int	inhibit_update ;	/* prevents output to terminal */
extern	int	inet_address ;
extern	int	inet_port ;
#endif

#endif

/* terminal table defined only in TERM.C */

#ifndef termdef
extern	TERM	term;			/* Terminal information.	*/
#endif
@//E*O*F edef.h//
chmod u=rw,g=r,o=r edef.h
 
echo x - efunc.h
sed 's/^@//' > "efunc.h" <<'@//E*O*F efunc.h//'
/*	EFUNC.H:	MicroEMACS function declarations and names

		This file list all the C code functions used by MicroEMACS
	and the names to use to bind keys to them. To add functions,
	declare it here in both the extern function list and the name
	binding table.

*/

/*	External function declarations		*/

extern	int	ctrlg();		/* Abort out of things		*/
extern	int	quit(); 		/* Quit 			*/
extern	int	ctlxlp();		/* Begin macro			*/
extern	int	ctlxrp();		/* End macro			*/
extern	int	ctlxe();		/* Execute macro		*/
extern	int	fileread();		/* Get a file, read only	*/
extern	int	filefind();		/* Get a file, read write	*/
extern	int	filewrite();		/* Write a file 		*/
extern	int	filesave();		/* Save current file		*/
extern	int	filename();		/* Adjust file name		*/
extern	int	getccol();		/* Get current column		*/
extern	int	gotobol();		/* Move to start of line	*/
extern	int	forwchar();		/* Move forward by characters	*/
extern	int	gotoeol();		/* Move to end of line		*/
extern	int	backchar();		/* Move backward by characters	*/
extern	int	forwline();		/* Move forward by lines	*/
extern	int	backline();		/* Move backward by lines	*/
extern	int	forwpage();		/* Move forward by pages	*/
extern	int	backpage();		/* Move backward by pages	*/
extern	int	gotobob();		/* Move to start of buffer	*/
extern	int	gotoeob();		/* Move to end of buffer	*/
extern	int	setfillcol();		/* Set fill column.		*/
extern	int	setmark();		/* Set mark			*/
extern	int	swapmark();		/* Swap "." and mark		*/
extern	int	forwsearch();		/* Search forward		*/
extern	int	backsearch();		/* Search backwards		*/
extern	int	sreplace();		/* search and replace		*/
extern	int	qreplace();		/* search and replace w/query	*/
extern	int	showcpos();		/* Show the cursor position	*/
extern	int	nextwind();		/* Move to the next window	*/
extern	int	prevwind();		/* Move to the previous window	*/
extern	int	onlywind();		/* Make current window only one */
extern	int	splitwind();		/* Split current window 	*/
extern	int	mvdnwind();		/* Move window down		*/
extern	int	mvupwind();		/* Move window up		*/
extern	int	enlargewind();		/* Enlarge display window.	*/
extern	int	shrinkwind();		/* Shrink window.		*/
extern	int	listbuffers();		/* Display list of buffers	*/
extern	int	usebuffer();		/* Switch a window to a buffer	*/
extern	int	killbuffer();		/* Make a buffer go away.	*/
extern	int	reposition();		/* Reposition window		*/
extern	int	refresh();		/* Refresh the screen		*/
extern	int	twiddle();		/* Twiddle characters		*/
extern	int	tab();			/* Insert tab			*/
extern	int	newline();		/* Insert CR-LF 		*/
extern	int	indent();		/* Insert CR-LF, then indent	*/
extern	int	openline();		/* Open up a blank line 	*/
extern	int	deblank();		/* Delete blank lines		*/
extern	int	quote();		/* Insert literal		*/
extern	int	backword();		/* Backup by words		*/
extern	int	forwword();		/* Advance by words		*/
extern	int	forwdel();		/* Forward delete		*/
extern	int	backdel();		/* Backward delete		*/
extern	int	killtext();		/* Kill forward 		*/
extern	int	yank(); 		/* Yank back from killbuffer.	*/
extern	int	upperword();		/* Upper case word.		*/
extern	int	lowerword();		/* Lower case word.		*/
extern	int	upperregion();		/* Upper case region.		*/
extern	int	lowerregion();		/* Lower case region.		*/
extern	int	capword();		/* Initial capitalize word.	*/
extern	int	delfword();		/* Delete forward word. 	*/
extern	int	delbword();		/* Delete backward word.	*/
extern	int	killregion();		/* Kill region. 		*/
extern	int	copyregion();		/* Copy region to kill buffer.	*/
extern	int	spawncli();		/* Run CLI in a subjob. 	*/
extern	int	spawn();		/* Run a command in a subjob.	*/
#if	BSD
extern	int	bktoshell();		/* suspend emacs to parent shell*/
extern	int	rtfrmshell();		/* return from a suspended state*/
#endif
extern	int	quickexit();		/* low keystroke style exit.	*/
extern	int	setmode();		/* set an editor mode		*/
extern	int	delmode();		/* delete a mode		*/
extern	int	gotoline();		/* go to a numbered line	*/
extern	int	namebuffer();		/* rename the current buffer	*/
#if	WORDPRO
extern	int	gotobop();		/* go to beginning/paragraph	*/
extern	int	gotoeop();		/* go to end/paragraph		*/
extern	int	fillpara();		/* fill current paragraph	*/
#endif
extern	int	help(); 		/* get the help file here	*/
extern  int     deskey();               /* describe a key's binding	*/
extern	int	viewfile();		/* find a file in view mode	*/
extern	int	insfile();		/* insert a file		*/
extern	int	scrnextup();		/* scroll next window back	*/
extern	int	scrnextdw();		/* scroll next window down	*/
extern	int	bindtokey();		/* bind a function to a key	*/
extern  int     unbindkey();            /* unbind a key's function	*/
extern	int	namedcmd();		/* execute named command	*/
extern	int	desbind();		/* describe bindings		*/
extern	int	execcmd();		/* execute a command line	*/
extern	int	execbuf();		/* exec commands from a buffer	*/
extern	int	execfile();		/* exec commands from a file	*/
extern	int	nextbuffer();		/* switch to the next buffer	*/
#if	WORDPRO
extern	int	killpara();		/* kill the current paragraph	*/
#endif
extern	int	setgmode();		/* set a global mode		*/
extern	int	delgmode();		/* delete a global mode 	*/
extern	int	insspace();		/* insert a space forword	*/
extern	int	forwhunt();		/* hunt forward for next match	*/
extern	int	backhunt();		/* hunt backwards for next match*/
extern	int	pipe(); 		/* pipe command into buffer	*/
extern	int	filter();		/* filter buffer through dos	*/
extern	int	delwind();		/* delete the current window	*/
extern	int	cbuf1();		/* execute numbered comd buffer */
extern	int	cbuf2();
extern	int	cbuf3();
extern	int	cbuf4();
extern	int	cbuf5();
extern	int	cbuf6();
extern	int	cbuf7();
extern	int	cbuf8();
extern	int	cbuf9();
extern	int	cbuf10();
extern	int	cbuf11();
extern	int	cbuf12();
extern	int	cbuf13();
extern	int	cbuf14();
extern	int	cbuf15();
extern	int	cbuf16();
extern	int	cbuf17();
extern	int	cbuf18();
extern	int	cbuf19();
extern	int	cbuf20();
extern	int	cbuf21();
extern	int	cbuf22();
extern	int	cbuf23();
extern	int	cbuf24();
extern	int	cbuf25();
extern	int	cbuf26();
extern	int	cbuf27();
extern	int	cbuf28();
extern	int	cbuf29();
extern	int	cbuf30();
extern	int	cbuf31();
extern	int	cbuf32();
extern	int	cbuf33();
extern	int	cbuf34();
extern	int	cbuf35();
extern	int	cbuf36();
extern	int	cbuf37();
extern	int	cbuf38();
extern	int	cbuf39();
extern	int	cbuf40();
extern	int	storemac();		/* store text for macro 	*/
extern	int	resize();		/* resize current window	*/
extern	int	clrmes();		/* clear the message line	*/
extern	int	meta(); 		/* meta prefix dummy function	*/
extern	int	cex();			/* ^X prefix dummy function	*/
extern	int	unarg();		/* ^U repeat arg dummy function */
extern	int	istring();		/* insert string in text	*/
extern	int	unmark();		/* unmark current buffer	*/
#if	ISRCH
extern	int	fisearch();		/* forward incremental search	*/
extern	int	risearch();		/* reverse incremental search	*/
#endif
#if	WORDPRO
extern	int	wordcount();		/* count words in region	*/
#endif
extern	int	savewnd();		/* save current window		*/
extern	int	restwnd();		/* restore current window	*/
extern	int	upscreen();		/* force screen update		*/
extern	int	writemsg();		/* write text on message line	*/
#if	FLABEL
extern	int	fnclabel();		/* set function key label	*/
#endif
#if	APROP
extern	int	apro(); 		/* apropos fuction		*/
#endif
#if	CRYPT
extern	int	setkey();		/* set encryption key		*/
#endif
extern	int	wrapword();		/* wordwrap function		*/
#if	CFENCE
extern	int	getfence();		/* move cursor to a matching fence */
#endif
extern	int	newsize();		/* change the current screen size */
extern	int	setvar();		/* set a variables value */
extern	int	newwidth();		/* change the current screen width */
#if	CRAY
extern	int	setcursor() ;		/* mouse support function */
#endif


/*	Name to function binding table

		This table gives the names of all the bindable functions
	end their C function address. These are used for the bind-to-key
	function.
*/

NBIND	names[] = {
	{"abort-command",		ctrlg},
	{"add-mode",			setmode},
	{"add-global-mode",		setgmode},
#if	APROP
	{"apropos",			apro},
#endif
	{"backward-character",		backchar},
	{"begin-macro", 		ctlxlp},
	{"beginning-of-file",		gotobob},
	{"beginning-of-line",		gotobol},
	{"bind-to-key", 		bindtokey},
	{"buffer-position",		showcpos},
	{"case-region-lower",		lowerregion},
	{"case-region-upper",		upperregion},
	{"case-word-capitalize",	capword},
	{"case-word-lower",		lowerword},
	{"case-word-upper",		upperword},
	{"change-file-name",		filename},
	{"change-screen-size",		newsize},
	{"change-screen-width", 	newwidth},
	{"clear-and-redraw",		refresh},
	{"clear-message-line",		clrmes},
	{"copy-region", 		copyregion},
#if	WORDPRO
	{"count-words", 		wordcount},
#endif
	{"ctlx-prefix", 		cex},
	{"delete-blank-lines",		deblank},
	{"delete-buffer",		killbuffer},
	{"delete-mode", 		delmode},
	{"delete-global-mode",		delgmode},
	{"delete-next-character",	forwdel},
	{"delete-next-word",		delfword},
	{"delete-other-windows",	onlywind},
	{"delete-previous-character",	backdel},
	{"delete-previous-word",	delbword},
	{"delete-window",		delwind},
	{"describe-bindings",		desbind},
	{"describe-key",		deskey},
	{"end-macro",			ctlxrp},
	{"end-of-file", 		gotoeob},
	{"end-of-line", 		gotoeol},
	{"exchange-point-and-mark",	swapmark},
	{"execute-buffer",		execbuf},
	{"execute-command-line",	execcmd},
	{"execute-file",		execfile},
	{"execute-macro",		ctlxe},
	{"execute-macro-1",		cbuf1},
	{"execute-macro-2",		cbuf2},
	{"execute-macro-3",		cbuf3},
	{"execute-macro-4",		cbuf4},
	{"execute-macro-5",		cbuf5},
	{"execute-macro-6",		cbuf6},
	{"execute-macro-7",		cbuf7},
	{"execute-macro-8",		cbuf8},
	{"execute-macro-9",		cbuf9},
	{"execute-macro-10",		cbuf10},
	{"execute-macro-11",		cbuf11},
	{"execute-macro-12",		cbuf12},
	{"execute-macro-13",		cbuf13},
	{"execute-macro-14",		cbuf14},
	{"execute-macro-15",		cbuf15},
	{"execute-macro-16",		cbuf16},
	{"execute-macro-17",		cbuf17},
	{"execute-macro-18",		cbuf18},
	{"execute-macro-19",		cbuf19},
	{"execute-macro-20",		cbuf20},
	{"execute-macro-21",		cbuf21},
	{"execute-macro-22",		cbuf22},
	{"execute-macro-23",		cbuf23},
	{"execute-macro-24",		cbuf24},
	{"execute-macro-25",		cbuf25},
	{"execute-macro-26",		cbuf26},
	{"execute-macro-27",		cbuf27},
	{"execute-macro-28",		cbuf28},
	{"execute-macro-29",		cbuf29},
	{"execute-macro-30",		cbuf30},
	{"execute-macro-31",		cbuf31},
	{"execute-macro-32",		cbuf32},
	{"execute-macro-33",		cbuf33},
	{"execute-macro-34",		cbuf34},
	{"execute-macro-35",		cbuf35},
	{"execute-macro-36",		cbuf36},
	{"execute-macro-37",		cbuf37},
	{"execute-macro-38",		cbuf38},
	{"execute-macro-39",		cbuf39},
	{"execute-macro-40",		cbuf40},
	{"execute-named-command",	namedcmd},
	{"exit-emacs",			quit},
#if	WORDPRO
	{"fill-paragraph",		fillpara},
#endif
	{"filter-buffer",		filter},
	{"find-file",			filefind},
	{"forward-character",		forwchar},
	{"goto-line",			gotoline},
#if	CFENCE
	{"goto-matching-fence", 	getfence},
#endif
	{"grow-window", 		enlargewind},
	{"handle-tab",			tab},
	{"hunt-forward",		forwhunt},
	{"hunt-backward",		backhunt},
	{"help",			help},
	{"i-shell",			spawncli},
#if	ISRCH
	{"incremental-search",		fisearch},
#endif
	{"insert-file", 		insfile},
	{"insert-space",		insspace},
	{"insert-string",		istring},
#if	WORDPRO
	{"kill-paragraph",		killpara},
#endif
	{"kill-region", 		killregion},
	{"kill-to-end-of-line", 	killtext},
#if	FLABEL
	{"label-function-key",		fnclabel},
#endif
	{"list-buffers",		listbuffers},
	{"meta-prefix", 		meta},
	{"move-window-down",		mvdnwind},
	{"move-window-up",		mvupwind},
	{"name-buffer", 		namebuffer},
	{"newline",			newline},
	{"newline-and-indent",		indent},
	{"next-buffer", 		nextbuffer},
	{"next-line",			forwline},
	{"next-page",			forwpage},
#if	WORDPRO
	{"next-paragraph",		gotoeop},
#endif
	{"next-window", 		nextwind},
	{"next-word",			forwword},
	{"open-line",			openline},
	{"pipe-command",		pipe},
	{"previous-line",		backline},
	{"previous-page",		backpage},
#if	WORDPRO
	{"previous-paragraph",		gotobop},
#endif
	{"previous-window",		prevwind},
	{"previous-word",		backword},
	{"query-replace-string",	qreplace},
	{"quick-exit",			quickexit},
	{"quote-character",		quote},
	{"read-file",			fileread},
	{"redraw-display",		reposition},
	{"resize-window",		resize},
	{"restore-window",		restwnd},
	{"replace-string",		sreplace},
#if	ISRCH
	{"reverse-incremental-search",	risearch},
#endif
	{"save-file",			filesave},
	{"save-window", 		savewnd},
	{"scroll-next-up",		scrnextup},
	{"scroll-next-down",		scrnextdw},
	{"search-forward",		forwsearch},
	{"search-reverse",		backsearch},
	{"select-buffer",		usebuffer},
	{"set", 			setvar},
#if	CRYPT
	{"set-encryption-key",		setkey},
#endif
	{"set-fill-column",		setfillcol},
	{"set-mark",			setmark},
	{"shell-command",		spawn},
	{"shrink-window",		shrinkwind},
	{"split-current-window",	splitwind},
	{"store-macro", 		storemac},
#if	BSD
	{"suspend-emacs",		bktoshell},
#endif
	{"transpose-characters",	twiddle},
	{"unbind-key",			unbindkey},
	{"universal-argument",		unarg},
	{"unmark-buffer",		unmark},
	{"update-screen",		upscreen},
	{"view-file",			viewfile},
	{"wrap-word",			wrapword},
	{"write-file",			filewrite},
	{"write-message",		writemsg},
	{"yank",			yank},

	{"",			NULL}
};
@//E*O*F efunc.h//
chmod u=rw,g=r,o=r efunc.h
 
echo x - epath.h
sed 's/^@//' > "epath.h" <<'@//E*O*F epath.h//'
/*	PATH:	This file contains certain info needed to locate the
		MicroEMACS files on a system dependant basis.

									*/

/*	possible names and paths of help files under different OSs	*/

char *pathname[] =

#if	AMIGA
{
	".emacsrc",
	"emacs.hlp",
	"",
	":c/",
	":t/"
};
#endif

#if	ST520
{
	"emacs.rc",
	"emacs.hlp",
	"\\",
	"\\bin\\",
	"\\util\\",
	""
};
#endif

#if	FINDER
{
	"emacs.rc",
	"emacs.hlp",
	"/bin",
	"/sys/public",
	""
};
#endif

#if	MSDOS
{
	"emacs.rc",
	"emacs.hlp",
	"\\sys\\public\\",
	"\\usr\\bin\\",
	"\\bin\\",
	"\\",
	""
};
#endif

#if	V7 | BSD | USG 
#if	CRAY
{
	".emacsrc",
	"uehelp",
	"",
};
#else
{
	".emacsrc",
	"emacs.hlp",
	"/usr/local/",
	"/usr/lib/",
	""
};
#endif
#endif

#if	VMS
{
	"emacs.rc",
	"emacs.hlp",
	"",
	"sys$sysdevice:[vmstools]"
};
#endif


#define	NPNAMES	(sizeof(pathname)/sizeof(char *))
@//E*O*F epath.h//
chmod u=rw,g=r,o=r epath.h
 
echo x - esearc.h
sed 's/^@//' > "esearc.h" <<'@//E*O*F esearc.h//'

/*
 * ESEARCH.H
 *
 * Defines, typdefs, and global variables that are of use for the
 * routines in search.c and isearch.c.
 *
 */

/*
 * PTBEG, PTEND, FORWARD, and REVERSE are all toggle-able values for
 * the scan routines.
 */
#define	PTBEG	0	/* Leave the point at the beginning on search.*/
#define	PTEND	1	/* Leave the point at the end on search.*/

#if	MAGIC

/*
 * Defines for the metacharacters in the regular expressions.
 */

#define	MCNIL		0	/* Like the '\0' for strings.*/
#define	LITCHAR		1
#define	ANY		2
#define	CCL		3
#define	NCCL		4
#define	BOL		5
#define	EOL		6
#define	CLOSURE		256	/* An or-able value.*/
#define	MASKCL		CLOSURE - 1

#define	MC_ANY		'.'	/* 'Any' character (except newline).*/
#define	MC_CCL		'['	/* Character class.*/
#define	MC_NCCL		'^'	/* Negate character class.*/
#define	MC_RCCL		'-'	/* Range in character class.*/
#define	MC_ECCL		']'	/* End of character class.*/
#define	MC_BOL		'^'	/* Beginning of line.*/
#define	MC_EOL		'$'	/* End of line.*/
#define	MC_CLOSURE	'*'	/* Closure - does not extend past newline.*/

#define	MC_ESC		'\\'	/* Escape - suppress meta-meaning.*/

#define	BIT(n)		(1 << (n))	/* An integer with one bit set.*/
#define	CHCASE(c)	((c) ^ DIFCASE)	/* Toggle the case of a letter.*/

/* HICHAR - 1 is the largest character we will deal with.
 * HIBYTE represents the number of bytes in the bitmap.
 */

#define	HICHAR		256
#define	HIBYTE		HICHAR >> 3

typedef char	*BITMAP;

typedef	struct {
	short int	mc_type;
	union {
		int	lchar;
		BITMAP	cclmap;
	} u;
} MC;
#endif

/* Incremental search defines.
 */
#if	ISRCH
#define	CMDBUFLEN	256	/* Length of our command buffer */

#define	IS_ABORT	0x07	/* Abort the isearch */
#define IS_BACKSP	0x08	/* Delete previous char */
#define	IS_TAB		0x09	/* Tab character (allowed search char) */
#define IS_NEWLINE	0x0D	/* New line from keyboard (Carriage return) */
#define	IS_QUOTE	0x11	/* Quote next character */
#define IS_REVERSE	0x12	/* Search backward */
#define	IS_FORWARD	0x13	/* Search forward */
#define	IS_VMSQUOTE	0x16	/* VMS quote character */
#define	IS_VMSFORW	0x18	/* Search forward for VMS */
#define	IS_QUIT		0x1B	/* Exit the search */
#define	IS_RUBOUT	0x7F	/* Delete previous character */

/* IS_QUIT is no longer used, the variable metac is used instead */

#endif
@//E*O*F esearc.h//
chmod u=rw,g=r,o=r esearc.h
 
echo x - estruc.h
sed 's/^@//' > "estruc.h" <<'@//E*O*F estruc.h//'
/*	ESTRUCT:	Structure and preprocesser defined for
			MicroEMACS 3.8

			written by Dave G. Conroy
			modified by Steve Wilhite, George Jones
			greatly modified by Daniel Lawrence
*/

#ifdef	LATTICE
#undef  LATTICE         /* don't use their definitions...use ours	*/
#endif
#ifdef	MSDOS
#undef	MSDOS
#endif
#ifdef	CPM
#undef	CPM
#endif
#ifdef	AMIGA
#undef	AMIGA
#endif

/*	Version definition			*/

#define VERSION "3.8b"

/*	Machine/OS definitions			*/

#define AMIGA	0			/* AmigaDOS			*/
#define ST520	0			/* ST520, TOS			*/
#define MSDOS	0			/* MS-DOS			*/
#define V7	0			/* V7 UN*X or Coherent or BSD4.2*/
#define BSD	0			/* UNIX BSD 4.2 and ULTRIX	*/
#define USG	0			/* UNIX system V		*/
#define VMS	0			/* VAX/VMS			*/
#define CPM	0			/* CP/M-86			*/
#define FINDER	0			/* Macintosh OS 		*/
#define CRAY	1			/* Cray CTSS			*/

/* for Cray, hope its like unix */
#if CRAY
#undef USG
#define USG	1
#endif

/*	Compiler definitions			*/
#define MWC86	0	/* marc williams compiler */
#define LATTICE 0	/* Lattice 2.14 thruough 3.0 compilers */
#define AZTEC	0	/* Aztec C 3.20e */
#define MSC	0	/* MicroSoft C compile version 3 */
#define MEGAMAX 0	/* Megamax C compiler */

/*	Profiling options	*/
#define APROF	0	/* turn Aztec C profiling on? */
#define NBUCK	100	/* number of buckets to profile */
#define RAMSIZE 0	/* dynamic RAM memory usage tracking */
#define RAMSHOW 0	/* auto dynamic RAM reporting */

/*   Special keyboard definitions	     */

#define WANGPC	0		/* WangPC - mostly escape sequences	*/
 
/*	Terminal Output definitions		*/

#define ANSI	1			/* ansi escape sequences	*/
#define HP150	0			/* HP150 screen driver		*/
#define HP110	0			/* HP110 screen driver		*/
#define VMSVT	0			/* various VMS terminal entries */
#define VT52	0			/* VT52 terminal (Zenith).	*/
#define VT100	0			/* Handle VT100 style keypad.	*/
#define LK201	0			/* Handle LK201 style keypad.	*/
#define RAINBOW 0			/* Use Rainbow fast video.	*/
#define TERMCAP 0			/* Use TERMCAP			*/
#define IBMPC	0			/* IBM-PC CGA/MONO driver	*/
#define EGA	0			/* EGA IBM-PC specific driver	*/
#define DG10	0			/* Data General system/10	*/
#define TIPC	0			/* TI Profesional PC driver	*/
#define MAC	0			/* Macintosh			*/
#define ATARI	0			/* Atari 520/1040ST screen	*/
#define TCPIP	1			/* Cray using tcp/ip directly   */

/*	Configuration options	*/

#define CVMVAS	1	/* arguments to page forward/back in pages	*/
#define NFWORD	1	/* forward word jumps to beginning of word	*/
#define CLRMSG	0	/* space clears the message line with no insert */
#define ACMODE	1	/* auto CMODE on .C and .H files		*/
#define CFENCE	0	/* fench matching in CMODE			*/
#define TYPEAH	1	/* type ahead causes update to be skipped	*/
#define DEBUGM	1	/* Global SPELL mode triggers macro debugging	*/
#define VISMAC	0	/* update display during keyboard macros	*/
#define CTRLZ	0	/* add a ^Z at end of files under MSDOS only	*/

#define REVSTA	1	/* Status line appears in reverse video 	*/
#define COLOR	0	/* color commands and windows			*/

#define FILOCK	0	/* file locking under unix BSD 4.2		*/
#define ISRCH	1	/* Incremental searches like ITS EMACS		*/
#define WORDPRO 1	/* Advanced word processing features		*/
#define FLABEL	0	/* function key label code			*/
#define APROP	1	/* Add code for Apropos command 		*/
#define CRYPT	0	/* file encryption enabled?			*/
#define MAGIC	1	/* include regular expression matching? 	*/

#define ASCII	1	/* always using ASCII char sequences for now	*/
#define EBCDIC	0	/* later IBM mainfraim versions will use EBCDIC */

/*	System dependant library redefinitions, structures and includes */

/*  Megamax C defines short to be 1 byte and int to be 2 bytes */
#if	MEGAMAX & ST520
#define SHORT int
#else
#define SHORT short
#endif

#if	AZTEC
#undef	fputc
#undef	fgetc
#define fputc	aputc
#define fgetc	agetc
#define int86	sysint
#define intdos(a, b)	sysint(33, a, b)
#define inp	inportb

struct XREG {
	int ax,bx,cx,dx,si,di;
};

struct HREG {
	char al,ah,bl,bh,cl,ch,dl,dh;
};

union REGS {
	struct XREG x;
	struct HREG h;
};
#endif

#if	MSDOS & MWC86
#include	<dos.h>
#define int86(a, b, c)	intcall(b, c, a)
#define inp	in

struct XREG {
	int ax,bx,cx,dx,si,di,ds,es,flags;
};

struct HREG {
	char al,ah,bl,bh,cl,ch,dl,dh;
	int ds,es,flags;
};

union REGS {
	struct XREG x;
	struct HREG h;
};
#endif

#if	MSDOS & MSC
#include	<dos.h>
#define movmem(a, b, c) 	memcpy(b, a, c)
#endif

#if	MSDOS & LATTICE
#undef	CPM
#undef	LATTICE
#include	<dos.h>
#undef	CPM
#endif

#if	VMS
#define unlink(a)	delete(a)
#endif

/*	make sure cray version has needed settings */
#if	CRAY
#undef	TYPEAH
#define TYPEAH	1

/* 7 char name limit fixes */
#define scrnextup	scrnnup
#define scrnextdw	scrnndw
#define ansieeol	anseeol
#define ansieeop	anseeop
#define mlreplyt	mlrplyt

/* cray HCC putchar/ putc is screwed up  */
#undef putchar
#define putchar(c)	fputc(c,stdout)
#endif


/*	define memory mapped flag	*/

#define MEMMAP	0

#if	IBMPC
#undef	MEMMAP
#define MEMMAP	1
#endif

#if	IBMMONO
#undef	MEMMAP
#define MEMMAP	1
#endif

#if	EGA
#undef	MEMMAP
#define MEMMAP	1
#endif

/*	internal constants	*/

#define NBINDS	256			/* max # of bound keys		*/
#define NFILEN	80			/* # of bytes, file name	*/
#define NBUFN	16			/* # of bytes, buffer name	*/
#define NLINE	256			/* # of bytes, line		*/
#define NSTRING 128			/* # of bytes, string buffers	*/
#define NKBDM	256			/* # of strokes, keyboard macro */
#define NPAT	128			/* # of bytes, pattern		*/
#define HUGE	1000			/* Huge number			*/
#define NLOCKS	100			/* max # of file locks active	*/
#define NCOLORS 8			/* number of supported colors	*/
#define KBLOCK	250			/* sizeof kill buffer chunks	*/
#define NBLOCK	16			/* line block chunk size	*/
#define NVSIZE	10			/* max #chars in a var name	*/

#if	0
#define AGRAVE	0x60			/* M- prefix,	Grave (LK201)	*/
#define METACH	0x1B			/* M- prefix,	Control-[, ESC	*/
#define CTMECH	0x1C			/* C-M- prefix, Control-\	*/
#define EXITCH	0x1D			/* Exit level,	Control-]	*/
#define CTRLCH	0x1E			/* C- prefix,	Control-^	*/
#define HELPCH	0x1F			/* Help key,	Control-_	*/
#endif

#if	CRAY
#define META    0x0080                  /* Meta flag, or'ed in		*/
#define SPEC	0x0100			/* special key (function keys)	*/
#define CTRL    0x0200                  /* Control flag, or'ed in	*/
#define CTLX    0x0400                  /* ^X flag, or'ed in		*/
#else
#define CTRL    0x0100                  /* Control flag, or'ed in	*/
#define META    0x0200                  /* Meta flag, or'ed in		*/
#define CTLX    0x0400                  /* ^X flag, or'ed in		*/
#define SPEC	0x0800			/* special key (function keys)	*/
#endif

#define FALSE	0			/* False, no, bad, etc. 	*/
#define TRUE	1			/* True, yes, good, etc.	*/
#define ABORT	2			/* Death, ^G, abort, etc.	*/
#define FAILED	3			/* not-quite fatal false return */
#define RET	4			/* a return from buffer 	*/
#define GOLINE	5			/* exit flagging a GOTO 	*/

#define STOP	0			/* keyboard macro not in use	*/
#define PLAY	1			/*		  playing	*/
#define RECORD	2			/*		  recording	*/

#define FORWARD 0			/* forward direction		*/
#define REVERSE 1			/* backwards direction		*/

#define FIOSUC	0			/* File I/O, success.		*/
#define FIOFNF	1			/* File I/O, file not found.	*/
#define FIOEOF	2			/* File I/O, end of file.	*/
#define FIOERR	3			/* File I/O, error.		*/
#define FIOLNG	4			/* line longer than allowed len */
#define FIOFUN	5			/* File I/O, eod of file/bad line*/

#define CFCPCN	0x0001			/* Last command was C-P, C-N	*/
#define CFKILL	0x0002			/* Last command was a kill	*/

#define BELL	0x07			/* a bell character		*/
#define TAB	0x09			/* a tab character		*/

#if	V7 | USG | BSD
#define PATHCHR ':'
#else
#define PATHCHR ';'
#endif

#define INTWIDTH	sizeof(int)/3 + 2

/*	Macro argument token types					*/

#define TKNUL	0			/* end-of-string		*/
#define TKARG	1			/* interactive argument 	*/
#define TKBUF	2			/* buffer argument		*/
#define TKVAR	3			/* user variables		*/
#define TKENV	4			/* environment variables	*/
#define TKFUN	5			/* function.... 		*/
#define TKDIR	6			/* directive			*/
#define TKLBL	7			/* line label			*/
#define TKLIT	8			/* numeric literal		*/
#define TKSTR	9			/* quoted string literal	*/
#define TKCMD	10			/* command name 		*/

/*	Internal defined functions					*/

/* DIFCASE represents the integer difference between upper
   and lower case letters.  It is an xor-able value, which is
   fortunate, since the relative positions of upper to lower
   case letters is the opposite of ascii in ebcdic.
*/

#ifdef	islower
#undef	islower
#endif

#if	ASCII

#define DIFCASE 	0x20
#define isletter(c)	(('a' <= c && 'z' >= c) || ('A' <= c && 'Z' >= c))
#define islower(c)	(('a' <= c && 'z' >= c))
#endif

#if	EBCDIC

#define DIFCASE 	0x40
#define isletter(c)	(('a' <= c && 'i' >= c) || ('j' <= c && 'r' >= c)\
			|| ('s' <= c && 'z' >= c) || ('A' <= c && 'I' >= c)\
			|| ('J' <= c && 'R' >= c) || ('S' <= c && 'Z' >= c))
#define islower(c)	(('a' <= c && 'i' >= c) || ('j' <= c && 'r' >= c)\
			|| ('s' <= c && 'z' >= c))
#endif

/*	Dynamic RAM tracking and reporting redefinitions	*/

#if	RAMSIZE
#define malloc	allocate
#define free	release
#endif

/*
 * There is a window structure allocated for every active display window. The
 * windows are kept in a big list, in top to bottom screen order, with the
 * listhead at "wheadp". Each window contains its own values of dot and mark.
 * The flag field contains some bits that are set by commands to guide
 * redisplay; although this is a bit of a compromise in terms of decoupling,
 * the full blown redisplay is just too expensive to run for every input
 * character.
 */
typedef struct	WINDOW {
	struct	WINDOW *w_wndp; 	/* Next window			*/
	struct	BUFFER *w_bufp; 	/* Buffer displayed in window	*/
	struct	LINE *w_linep;		/* Top line in the window	*/
	struct	LINE *w_dotp;		/* Line containing "."		*/
	short	w_doto; 		/* Byte offset for "."		*/
	struct	LINE *w_markp;		/* Line containing "mark"	*/
	short	w_marko;		/* Byte offset for "mark"	*/
	char	w_toprow;		/* Origin 0 top row of window	*/
	char	w_ntrows;		/* # of rows of text in window	*/
	char	w_force;		/* If NZ, forcing row.		*/
	char	w_flag; 		/* Flags.			*/
#if	COLOR
	char	w_fcolor;		/* current forground color	*/
	char	w_bcolor;		/* current background color	*/
#endif
}	WINDOW;

#define WFFORCE 0x01			/* Window needs forced reframe	*/
#define WFMOVE	0x02			/* Movement from line to line	*/
#define WFEDIT	0x04			/* Editing within a line	*/
#define WFHARD	0x08			/* Better to a full display	*/
#define WFMODE	0x10			/* Update mode line.		*/
#define WFCOLR	0x20			/* Needs a color change 	*/

/*
 * Text is kept in buffers. A buffer header, described below, exists for every
 * buffer in the system. The buffers are kept in a big list, so that commands
 * that search for a buffer by name can find the buffer header. There is a
 * safe store for the dot and mark in the header, but this is only valid if
 * the buffer is not being displayed (that is, if "b_nwnd" is 0). The text for
 * the buffer is kept in a circularly linked list of lines, with a pointer to
 * the header line in "b_linep".
 *	Buffers may be "Inactive" which means the files accosiated with them
 * have not been read in yet. These get read in at "use buffer" time.
 */
typedef struct	BUFFER {
	struct	BUFFER *b_bufp; 	/* Link to next BUFFER		*/
	struct	LINE *b_dotp;		/* Link to "." LINE structure	*/
	short	b_doto; 		/* Offset of "." in above LINE	*/
	struct	LINE *b_markp;		/* The same as the above two,	*/
	short	b_marko;		/* but for the "mark"		*/
	struct	LINE *b_linep;		/* Link to the header LINE	*/
	char	b_active;		/* window activated flag	*/
	char	b_nwnd; 		/* Count of windows on buffer	*/
	char	b_flag; 		/* Flags			*/
	char	b_mode; 		/* editor mode of this buffer	*/
	char	b_fname[NFILEN];	/* File name			*/
	char	b_bname[NBUFN]; 	/* Buffer name			*/
#if	CRYPT
	char	b_key[NPAT];		/* current encrypted key	*/
#endif
}	BUFFER;

#define BFINVS	0x01			/* Internal invisable buffer	*/
#define BFCHG	0x02			/* Changed since last write	*/

/*	mode flags	*/
#define NUMMODES	8		/* # of defined modes		*/

#define MDWRAP	0x0001			/* word wrap			*/
#define MDCMOD	0x0002			/* C indentation and fence match*/
#define MDSPELL 0x0004			/* spell error parcing		*/
#define MDEXACT 0x0008			/* Exact matching for searches	*/
#define MDVIEW	0x0010			/* read-only buffer		*/
#define MDOVER	0x0020			/* overwrite mode		*/
#define MDMAGIC 0x0040			/* regular expresions in search */
#define MDCRYPT 0x0080			/* encrytion mode active	*/

/*
 * The starting position of a region, and the size of the region in
 * characters, is kept in a region structure.  Used by the region commands.
 */
typedef struct	{
	struct	LINE *r_linep;		/* Origin LINE address. 	*/
	short	r_offset;		/* Origin LINE offset.		*/
	long	r_size; 		/* Length in characters.	*/
}	REGION;

/*
 * All text is kept in circularly linked lists of "LINE" structures. These
 * begin at the header line (which is the blank line beyond the end of the
 * buffer). This line is pointed to by the "BUFFER". Each line contains a the
 * number of bytes in the line (the "used" size), the size of the text array,
 * and the text. The end of line is not stored as a byte; it's implied. Future
 * additions will include update hints, and a list of marks into the line.
 */
typedef struct	LINE {
	struct	LINE *l_fp;		/* Link to the next line	*/
	struct	LINE *l_bp;		/* Link to the previous line	*/
	short	l_size; 		/* Allocated size		*/
	short	l_used; 		/* Used size			*/
	char	l_text[1];		/* A bunch of characters.	*/
}	LINE;

#define lforw(lp)	((lp)->l_fp)
#define lback(lp)	((lp)->l_bp)
#define lgetc(lp, n)	((lp)->l_text[(n)]&0xFF)
#define lputc(lp, n, c) ((lp)->l_text[(n)]=(c))
#define llength(lp)	((lp)->l_used)

/*
 * The editor communicates with the display using a high level interface. A
 * "TERM" structure holds useful variables, and indirect pointers to routines
 * that do useful operations. The low level get and put routines are here too.
 * This lets a terminal, in addition to having non standard commands, have
 * funny get and put character code too. The calls might get changed to
 * "termp->t_field" style in the future, to make it possible to run more than
 * one terminal type.
 */
typedef struct	{
	short	t_mrow; 		/* max number of rows allowable */
	short	t_nrow; 		/* current number of rows used	*/
	short	t_mcol; 		/* max Number of columns.	*/
	short	t_ncol; 		/* current Number of columns.	*/
	short	t_margin;		/* min margin for extended lines*/
	short	t_scrsiz;		/* size of scroll region "	*/
	int	t_pause;		/* # times thru update to pause */
	int	(*t_open)();		/* Open terminal at the start.	*/
	int	(*t_close)();		/* Close terminal at end.	*/
	int	(*t_kopen)();		/* Open keyboard		*/
	int	(*t_kclose)();		/* close keyboard		*/
	int	(*t_getchar)(); 	/* Get character from keyboard. */
	int	(*t_putchar)(); 	/* Put character to display.	*/
	int	(*t_flush)();		/* Flush output buffers.	*/
	int	(*t_move)();		/* Move the cursor, origin 0.	*/
	int	(*t_eeol)();		/* Erase to end of line.	*/
	int	(*t_eeop)();		/* Erase to end of page.	*/
	int	(*t_beep)();		/* Beep.			*/
	int	(*t_rev)();		/* set reverse video state	*/
	int	(*t_rez)();		/* change screen resolution	*/
#if	COLOR
	int	(*t_setfor)();		/* set forground color		*/
	int	(*t_setback)(); 	/* set background color 	*/
#endif
}	TERM;

/*	TEMPORARY macros for terminal I/O  (to be placed in a machine
					    dependant place later)	*/

#define TTopen		(*term.t_open)
#define TTclose 	(*term.t_close)
#define TTkopen 	(*term.t_kopen)
#define TTkclose	(*term.t_kclose)
#define TTgetc		(*term.t_getchar)
#define TTputc		(*term.t_putchar)
#define TTflush 	(*term.t_flush)
#define TTmove		(*term.t_move)
#define TTeeol		(*term.t_eeol)
#define TTeeop		(*term.t_eeop)
#define TTbeep		(*term.t_beep)
#define TTrev		(*term.t_rev)
#define TTrez		(*term.t_rez)
#if	COLOR
#define TTforg		(*term.t_setfor)
#define TTbacg		(*term.t_setback)
#endif

/*	structure for the table of initial key bindings 	*/

typedef struct	{
	short	k_code; 		/* Key code			*/
	int	(*k_fp)();		/* Routine to handle it 	*/
}	KEYTAB;

/*	structure for the name binding table		*/

typedef struct {
	char *n_name;		/* name of function key */
	int (*n_func)();	/* function name is bound to */
}	NBIND;

/*	The editor holds deleted text chunks in the KILL buffer. The
	kill buffer is logically a stream of ascii characters, however
	due to its unpredicatable size, it gets implemented as a linked
	list of chunks. (The d_ prefix is for "deleted" text, as k_
	was taken up by the keycode structure)			*/

typedef struct KILL {
	struct KILL *d_next;	/* link to next chunk, NULL if last */
	char d_chunk[KBLOCK];	/* deleted text */
} KILL;

@//E*O*F estruc.h//
chmod u=rw,g=r,o=r estruc.h
 
echo x - evar.h
sed 's/^@//' > "evar.h" <<'@//E*O*F evar.h//'
/*	EVAR.H: Environment and user variable definitions
		for MicroEMACS

		written 1986 by Daniel Lawrence
*/

/*	structure to hold user variables and their definitions	*/

typedef struct UVAR {
	char u_name[NVSIZE + 1];		/* name of user variable */
	char *u_value;				/* value (string) */
} UVAR;

/*	current user variables (This structure will probably change)	*/

#define MAXVARS 	100

UVAR uv[MAXVARS];	/* user variables */

/*	list of recognized environment variables	*/

char *envars[] = {
	"fillcol",		/* current fill column */
	"pagelen",		/* number of lines used by editor */
	"curcol",		/* current column pos of cursor */
	"curline",		/* current line in file */
	"ram",			/* ram in use by malloc */
	"flicker",		/* flicker supression */
	"curwidth",		/* current screen width */
	"cbufname",		/* current buffer name */
	"cfname",		/* current file name */
	"sres", 		/* current screen resolution */
	"debug",		/* macro debugging */
	"status",		/* returns the status of the last command */
};

#define NEVARS	sizeof(envars) / sizeof(char *)

/*	and its preprocesor definitions 	*/

#define EVFILLCOL	0
#define EVPAGELEN	1
#define EVCURCOL	2
#define EVCURLINE	3
#define EVRAM		4
#define EVFLICKER	5
#define EVCURWIDTH	6
#define EVCBUFNAME	7
#define EVCFNAME	8
#define EVSRES		9
#define EVDEBUG 	10
#define EVSTATUS	11

/*	list of recognized user functions	*/

typedef struct UFUNC {
	char *f_name;	/* name of function */
	int f_type;	/* 1 = monamic, 2 = dynamic */
} UFUNC;

#define MONAMIC 	1
#define DYNAMIC 	2
#define TRINAMIC	3

UFUNC funcs[] = {
	"add", DYNAMIC, 	/* add two numbers together */
	"sub", DYNAMIC, 	/* subtraction */
	"tim", DYNAMIC, 	/* multiplication */
	"div", DYNAMIC, 	/* division */
	"mod", DYNAMIC, 	/* mod */
	"neg", MONAMIC, 	/* negate */
	"cat", DYNAMIC, 	/* concatinate string */
	"lef", DYNAMIC, 	/* left string(string, len) */
	"rig", DYNAMIC, 	/* right string(string, pos) */
	"mid", TRINAMIC,	/* mid string(string, pos, len) */
	"not", MONAMIC, 	/* logical not */
	"equ", DYNAMIC, 	/* logical equality check */
	"les", DYNAMIC, 	/* logical less than */
	"gre", DYNAMIC, 	/* logical greater than */
	"seq", DYNAMIC, 	/* string logical equality check */
	"sle", DYNAMIC, 	/* string logical less than */
	"sgr", DYNAMIC, 	/* string logical greater than */
	"ind", MONAMIC, 	/* evaluate indirect value */
};

#define NFUNCS	sizeof(funcs) / sizeof(char *)

/*	and its preprocesor definitions 	*/

#define UFADD		0
#define UFSUB		1
#define UFTIMES 	2
#define UFDIV		3
#define UFMOD		4
#define UFNEG		5
#define UFCAT		6
#define UFLEFT		7
#define UFRIGHT 	8
#define UFMID		9
#define UFNOT		10
#define UFEQUAL 	11
#define UFLESS		12
#define UFGREATER	13
#define UFSEQUAL	14
#define UFSLESS 	15
#define UFSGREAT	16
#define UFIND		17
@//E*O*F evar.h//
chmod u=rw,g=r,o=r evar.h
 
echo x - io.h
sed 's/^@//' > "io.h" <<'@//E*O*F io.h//'
#ifndef IOH
#define IOH

#define MAXFD 4
#define CIOBSIZ 4096            /* buffer size in bytes */
#define BLKSIZ 4096             /* file size increment in words */

/* cache states */
#define CEMPTY  0
#define CPEND   1
#define CFULL   2
#define CERROR  3

typedef struct CDiskIOBuf CDiskIOBuf;
struct CDiskIOBuf
{
    unsigned long cdSys;
    long cdStat;
    int cdIOC;
    long cdCount;
    long cdSeq;
    unsigned long *cdBuffer;
    long cdOffset;
    long cdWords;
    unsigned long cdInterrupt;
};

typedef struct CCache CCache;
struct CCache
{
    char cfcBuf[CIOBSIZ];
    char *cfcBegin;
    char *cfcEnd;
    CDiskIOBuf cfcDIO;
    int cfcState;
};

typedef struct cfile CFILE;
struct cfile
{
    char cfName[9];
    int cfUser;
    int cfIOC;
    long cfSize;
    long cfSpot;
    int cfCurBuf;
    CCache cfBuffer[2];
    int cfPerm;
    char cfMode;
    int cfBinary;
    int cfErr;
};

#include "macros.h"
#define cferror(file)   (file->cfErr)
long cfread(), cfwrite();
CFILE *cfopen();
CFILE *cfuopen();
char *GiveFile();
#endif

@//E*O*F io.h//
chmod u=rw,g=r,o=r io.h
 
echo x - ll.h
sed 's/^@//' > "ll.h" <<'@//E*O*F ll.h//'
#ifndef LL
#define LL
#ifndef NULL
#define NULL 0
#endif

#define FORWARD 1
#define BACKWARD (-1)
typedef struct ListItem ListItem;
struct ListItem
{
    ListItem *prevItem;    /* previous item in chain */
    ListItem *nextItem;    /* next item in chain */
};

typedef struct List List;
struct List
{
    ListItem *firstItem;
    ListItem *lastItem;
    int listCount;
};

List *CreateList();		/* initialize a new list */
ListItem *InsertItem();		/* insert an item in a list */
ListItem *DeleteItem();		/* delete an item from the list */
ListItem *FindItem();		/* find an item with certain properties */
ListItem *PopItem();		/* remove and return the first item */
ListItem *PushItem();		/* add an item at front of list */
ListItem *QueueItem();		/* add an item to the end of a list */
int RecountList();		/* recount the number of items in a list */
#define ListIsEmpty(theList)	((theList)->firstItem==NULL)
#endif
@//E*O*F ll.h//
chmod u=rw,g=r,o=r ll.h
 
echo x - macros.h
sed 's/^@//' > "macros.h" <<'@//E*O*F macros.h//'
#ifndef MACROS
#define MACROS
#define LO(y)           ((y) & 0xff)/* low-order byte */
#define REPLY(y)        ((y) | 0x80)/* set high bit for replies */
#define TWOBYTE(m,i)    (m[i]*256 | m[i+1])/* extract two byte integer */
#define PADCPY(to,from) {strcpy(to,"        ");strncpy(to,from,strlen(from));}
#endif

@//E*O*F macros.h//
chmod u=rw,g=r,o=r macros.h
 
echo x - tcplib.h
sed 's/^@//' > "tcplib.h" <<'@//E*O*F tcplib.h//'
/*
 * this file contains definitions for functions and globals necessary
 * to use tcplib.  It should be included in any source that calls parts
 * of tcplib.
 */
#include "ll.h"
#ifndef REPLY
#define REPLY(y)        ((y) | 0x80)/* set high bit for replies */
#endif
#define STRIP(y)        ((y) & 0x7f)/* clear eighth bit */
 
/*
 * flag definitions
 */
#define PUSH 0x01
#define URGENT 0x02
/*
 * tcp request function codes.  tcp replies will have eighth bit set.
 */
#define TCP_OPEN 0x11
#define TCP_LISTEN 0x12
#define TCP_CLOSE 0x13
#define TCP_SEND 0x14
#define TCP_RECV 0x15
#define TCP_ABORT 0x16
#define TCP_PASS 0x70
#define TCP_TAKE 0x71
/*
 * debugging constants
 */
#define TCP_FLOW 0x8000
#define TCP_OUT 0x4000
#define TCP_Q 0x2000
#define TCP 0x01
/*
 * the event structure.  most routines in tcplib manipulate these
 */
typedef struct Event {
    ListItem   evLinks;     /* for linked lists */
    int     evXid;          /* connection number */
    int     evStat;         /* status of completed call */
    int     evType;         /* type of tcp event */
    int     evLocPort;      /* local port (listen and open) */
    unsigned long  evRemAddr;       /* remote inet address (listen) */
    int     evRemPort;      /* remote port (listen) */
    char   *evData;         /* data (receive) */
    int     evDataCount;    /* number of data bytes (receive) */
    int     evFlags;    /* flags (receive) */
    int     evSquelch;          /* throw this event away when complete */
} Event;
 
#ifndef TCPLIB
extern int  tcpid;
#endif
 
 /*
 * routine declaration
 */
unsigned long TcpOpen();
unsigned long TcpListen();
unsigned long TcpConn();
Event *GetTcpEvent();
void FreeTcpEvent ();
char *TcpCodeName ();
char *TcpErrorName ();
char *MakeDot();
int CatCode();
@//E*O*F tcplib.h//
chmod u=rw,g=r,o=r tcplib.h
 
exit 0
