Path: uunet!husc6!mit-eddie!ll-xn!adelie!necntc!ncoast!allbery
From: nwd@j.cc.purdue.edu (Daniel Lawrence)
Newsgroups: comp.sources.misc
Subject: MicroEmacs 3.9 (Part 16 of 16)
Message-ID: <5692@ncoast.UUCP>
Date: 17 Nov 87 02:37:35 GMT
Sender: allbery@ncoast.UUCP
Lines: 960
Approved: allbery@ncoast.UUCP
X-Archive: comp.sources.misc/microemacs-3.9/15

# This is a shar archive.
# Remove everything above this line.
# Run the file through sh, not csh.
# (type `sh mes.16')
# If you do not see the message
#	`mes.16 completed!'
# then the file was incomplete.
echo extracting - epath.h
sed 's/^X//' > epath.h << 'FRIDAY_NIGHT'
X/*	EPATH:	This file contains certain info needed to locate the
X		MicroEMACS files on a system dependant basis.
X
X									*/
X
X/*	possible names and paths of help files under different OSs	*/
X
Xchar *pathname[] =
X
X#if	AMIGA
X{
X	".emacsrc",
X	"emacs.hlp",
X	"",
X	"sys:c/",
X	"sys:t/",
X	"sys:s/",
X	"c:/",
X	":t/",
X	":s/"
X};
X#endif
X
X#if	ST520
X{
X	"emacs.rc",
X	"emacs.hlp",
X	"\\",
X	"\\bin\\",
X	"\\util\\",
X	""
X};
X#endif
X
X#if	FINDER
X{
X	"emacs.rc",
X	"emacs.hlp",
X	"/bin",
X	"/sys/public",
X	""
X};
X#endif
X
X#if	MSDOS
X{
X	"emacs.rc",
X	"emacs.hlp",
X	"\\sys\\public\\",
X	"\\usr\\bin\\",
X	"\\bin\\",
X	"\\",
X	""
X};
X#endif
X
X#if	V7 | BSD | USG
X{
X	".emacsrc",
X	"emacs.hlp",
X	"/usr/local/",
X	"/usr/lib/",
X	""
X};
X#endif
X
X#if	VMS
X{
X	"emacs.rc",
X	"emacs.hlp",
X	"",
X	"sys$sysdevice:[vmstools]"
X};
X#endif
X
X#define	NPNAMES	(sizeof(pathname)/sizeof(char *))
FRIDAY_NIGHT
echo extracting - estruct.h
sed 's/^X//' > estruct.h << 'FRIDAY_NIGHT'
X/*      ESTRUCT:        Structure and preprocesser defined for
X                        MicroEMACS 3.9
X
X                        written by Dave G. Conroy
X                        modified by Steve Wilhite, George Jones
X                        substantially modified by Daniel Lawrence
X*/
X
X#ifdef	LATTICE
X#undef	LATTICE		/* don't use their definitions...use ours	*/
X#endif
X#ifdef	MSDOS
X#undef	MSDOS
X#endif
X#ifdef	CPM
X#undef	CPM
X#endif
X#ifdef	AMIGA
X#undef	AMIGA
X#endif
X#ifdef	EGA
X#undef	EGA
X#endif
X#ifdef	CTRLZ
X#undef	CTRLZ
X#endif
X
X/*	Program Identification.....
X
X	PROGNAME should always be MicroEMACS for a distibrution
X	unmodified version. People using MicroEMACS as a shell
X	for other products should change this to reflect their
X	product. Macros can query this via the $progname variable
X*/
X
X#define	PROGNAME	"MicroEMACS"
X#define	VERSION		"3.9e"
X
X/*	Machine/OS definitions			*/
X
X#define AMIGA   0                       /* AmigaDOS			*/
X#define ST520   0                       /* ST520, TOS                   */
X#define MSDOS   1                       /* MS-DOS                       */
X#define V7      0                       /* V7 UNIX or Coherent or BSD4.2*/
X#define	BSD	0			/* UNIX BSD 4.2	and ULTRIX	*/
X#define	USG	0			/* UNIX system V		*/
X#define VMS     0                       /* VAX/VMS                      */
X#define CPM     0                       /* CP/M-86                      */
X#define	FINDER	0			/* Macintosh OS			*/
X
X/*	Compiler definitions			*/
X#define	UNIX	0	/* a random UNIX compiler */
X#define MWC	0	/* Marc Williams C */
X#define	LATTICE	0	/* Lattice 2.14 thruough 3.0 compilers */
X#define	AZTEC	1	/* Aztec C 3.20e */
X#define	MSC	0	/* MicroSoft C compile version 3 & 4 */
X#define	TURBO	0	/* Turbo C/MSDOS */
X
X/*	Debugging options	*/
X#define	RAMSIZE	0	/* dynamic RAM memory usage tracking */
X#define	RAMSHOW	0	/* auto dynamic RAM reporting */
X
X/*   Special keyboard definitions            */
X
X#define WANGPC	0		/* WangPC - mostly escape sequences     */
X#define VT100   0               /* Handle VT100 style keypad.   */
X
X/*	Terminal Output definitions		*/
X
X#define ANSI    0			/* ANSI escape sequences	*/
X#define	HP150	0			/* HP150 screen driver		*/
X#define	HP110	0			/* HP110 screen driver		*/
X#define	VMSVT	0			/* various VMS terminal entries	*/
X#define VT52    0                       /* VT52 terminal (Zenith).      */
X#define RAINBOW 0                       /* Use Rainbow fast video.      */
X#define TERMCAP 0                       /* Use TERMCAP                  */
X#define	IBMPC	1			/* IBM-PC CGA/MONO/EGA driver	*/
X#define	DG10	0			/* Data General system/10	*/
X#define	TIPC	0			/* TI Profesional PC driver	*/
X#define	Z309	0			/* Zenith 100 PC family	driver	*/
X#define	MAC	0			/* Macintosh			*/
X#define	ATARI	0			/* Atari 520/1040ST screen	*/
X
X/*	Configuration options	*/
X
X#define CVMVAS  1	/* arguments to page forward/back in pages	*/
X#define	CLRMSG	0	/* space clears the message line with no insert	*/
X#define	CFENCE	1	/* fench matching in CMODE			*/
X#define	TYPEAH	1	/* type ahead causes update to be skipped	*/
X#define DEBUGM	1	/* $debug triggers macro debugging		*/
X#define	VISMAC	0	/* update display during keyboard macros	*/
X#define	CTRLZ	0	/* add a ^Z at end of files under MSDOS only	*/
X#define ADDCR	0	/* ajout d'un CR en fin de chaque ligne (ST520) */
X#define	NBRACE	1	/* new style brace matching command		*/
X
X#define	REVSTA	1	/* Status line appears in reverse video		*/
X#define	COLOR	1	/* color commands and windows			*/
X
X#define	FILOCK	0	/* file locking under unix BSD 4.2		*/
X#define	ISRCH	1	/* Incremental searches like ITS EMACS		*/
X#define	WORDPRO	1	/* Advanced word processing features		*/
X#define	FLABEL	0	/* function key label code [HP150]		*/
X#define	APROP	1	/* Add code for Apropos command			*/
X#define	CRYPT	1	/* file encryption enabled?			*/
X#define MAGIC	1	/* include regular expression matching?		*/
X#define	AEDIT	1	/* advanced editing options: en/detabbing	*/
X#define	PROC	1	/* named procedures				*/
X#define	CLEAN	0	/* de-alloc memory on exit			*/
X#define	CALLED	0	/* is emacs a called subroutine? or stand alone */
X
X#define ASCII	1	/* always using ASCII char sequences for now	*/
X#define EBCDIC	0	/* later IBM mainfraim versions will use EBCDIC	*/
X
X/*	System dependant library redefinitions, structures and includes	*/
X
X#if	TURBO
X#include      <dos.h>
X#include      <mem.h>
X#undef peek
X#undef poke
X#define       peek(a,b,c,d)   movedata(a,b,FP_SEG(c),FP_OFF(c),d)
X#define       poke(a,b,c,d)   movedata(FP_SEG(c),FP_OFF(c),a,b,d)
X#endif
X
X#if	VMS
X#define	atoi	xatoi
X#define	abs	xabs
X#define	getname	xgetname
X#endif
X
X#if	LATTICE
X#define	unsigned
X#endif
X
X#if	AZTEC
X#undef	fputc
X#undef	fgetc
X#if	MSDOS
X#define	fgetc	a1getc
X#define	int86	sysint
X#define	intdos(a, b)	sysint(33, a, b)
X#define	inp	inportb
X#define	outp	outportb
X#else
X#define	fgetc	agetc
X#endif
X#define	fputc	aputc
X
Xstruct XREG {
X	unsigned ax,bx,cx,dx,si,di,ds,es;
X};
X
Xstruct HREG {
X	char al,ah,bl,bh,cl,ch,dl,dh,d1,d2,e1,e2;
X};
X
Xunion REGS {
X	struct XREG x;
X	struct HREG h;
X};
X
Xstruct SREGS {
X	unsigned cs, ss, ds, es;
X};
X#endif
X
X#if	MSDOS & MWC
X#include	<dos.h>
X#define	int86(a, b, c)	intcall(b, c, a)
X#define	inp	in
X
Xstruct XREG {
X	int ax,bx,cx,dx,si,di,ds,es,flags;
X};
X
Xstruct HREG {
X	char al,ah,bl,bh,cl,ch,dl,dh;
X	int ds,es,flags;
X};
X
Xunion REGS {
X	struct XREG x;
X	struct HREG h;
X};
X#endif
X
X#if	MSDOS & MSC
X#include	<dos.h>
X#include	<memory.h>
X#define	peek(a,b,c,d)	movedata(a,b,FP_SEG(c),FP_OFF(c),d)
X#define	poke(a,b,c,d)	movedata(FP_SEG(c),FP_OFF(c),a,b,d)
X#define	movmem(a, b, c)		memcpy(b, a, c)
X#endif
X
X#if	MSDOS & LATTICE
X#undef	CPM
X#undef	LATTICE
X#include	<dos.h>
X#undef	CPM
X#endif
X
X#if	VMS
X#define	unlink(a)	delete(a)
X#endif
X
X/*	define some ability flags */
X
X#if	IBMPC | Z309
X#define	MEMMAP	1
X#else
X#define	MEMMAP	0
X#endif
X
X#if	MSDOS | V7 | USG | BSD | (ST520 & MWC)
X#define	ENVFUNC	1
X#else
X#define	ENVFUNC	0
X#endif
X
X/*	Emacs global flag bit definitions (for gflags)	*/
X
X#define	GFREAD	1
X
X/*	internal constants	*/
X
X#define	NBINDS	256			/* max # of bound keys		*/
X#define NFILEN  80                      /* # of bytes, file name        */
X#define NBUFN   16                      /* # of bytes, buffer name      */
X#define NLINE   256                     /* # of bytes, input line       */
X#define	NSTRING	128			/* # of bytes, string buffers	*/
X#define NKBDM   256                     /* # of strokes, keyboard macro */
X#define NPAT    128                     /* # of bytes, pattern          */
X#define HUGE    1000                    /* Huge number                  */
X#define	NLOCKS	100			/* max # of file locks active	*/
X#define	NCOLORS	8			/* number of supported colors	*/
X#define	KBLOCK	250			/* sizeof kill buffer chunks	*/
X#define	NBLOCK	16			/* line block chunk size	*/
X#define	NVSIZE	10			/* max #chars in a var name	*/
X
X#define CTRL    0x0100                  /* Control flag, or'ed in       */
X#define META    0x0200                  /* Meta flag, or'ed in          */
X#define CTLX    0x0400                  /* ^X flag, or'ed in            */
X#define	SPEC	0x0800			/* special key (function keys)	*/
X
X#ifdef	FALSE
X#undef	FALSE
X#endif
X#ifdef	TRUE
X#undef	TRUE
X#endif
X
X#define FALSE   0                       /* False, no, bad, etc.         */
X#define TRUE    1                       /* True, yes, good, etc.        */
X#define ABORT   2                       /* Death, ^G, abort, etc.       */
X#define	FAILED	3			/* not-quite fatal false return	*/
X
X#define	STOP	0			/* keyboard macro not in use	*/
X#define	PLAY	1			/*		  playing	*/
X#define	RECORD	2			/*		  recording	*/
X
X/*	Directive definitions	*/
X
X#define	DIF		0
X#define DELSE		1
X#define DENDIF		2
X#define DGOTO		3
X#define DRETURN		4
X#define DENDM		5
X#define DWHILE		6
X#define	DENDWHILE	7
X#define	DBREAK		8
X#define DFORCE		9
X
X#define NUMDIRS		10
X
X/*
X * PTBEG, PTEND, FORWARD, and REVERSE are all toggle-able values for
X * the scan routines.
X */
X#define	PTBEG	0	/* Leave the point at the beginning on search	*/
X#define	PTEND	1	/* Leave the point at the end on search		*/
X#define	FORWARD	0			/* forward direction		*/
X#define REVERSE	1			/* backwards direction		*/
X
X#define FIOSUC  0                       /* File I/O, success.           */
X#define FIOFNF  1                       /* File I/O, file not found.    */
X#define FIOEOF  2                       /* File I/O, end of file.       */
X#define FIOERR  3                       /* File I/O, error.             */
X#define	FIOMEM	4			/* File I/O, out of memory	*/
X#define	FIOFUN	5			/* File I/O, eod of file/bad line*/
X
X#define CFCPCN  0x0001                  /* Last command was C-P, C-N    */
X#define CFKILL  0x0002                  /* Last command was a kill      */
X
X#define	BELL	0x07			/* a bell character		*/
X#define	TAB	0x09			/* a tab character		*/
X
X#if	V7 | USG | BSD
X#define	PATHCHR	':'
X#else
X#define	PATHCHR	';'
X#endif
X
X#define	INTWIDTH	sizeof(int) * 3
X
X/*	Macro argument token types					*/
X
X#define	TKNUL	0			/* end-of-string		*/
X#define	TKARG	1			/* interactive argument		*/
X#define	TKBUF	2			/* buffer argument		*/
X#define	TKVAR	3			/* user variables		*/
X#define	TKENV	4			/* environment variables	*/
X#define	TKFUN	5			/* function....			*/
X#define	TKDIR	6			/* directive			*/
X#define	TKLBL	7			/* line label			*/
X#define	TKLIT	8			/* numeric literal		*/
X#define	TKSTR	9			/* quoted string literal	*/
X#define	TKCMD	10			/* command name			*/
X
X/*	Internal defined functions					*/
X
X#define	nextab(a)	(a & ~7) + 8
X#ifdef	abs
X#undef	abs
X#endif
X
X/* DIFCASE represents the integer difference between upper
X   and lower case letters.  It is an xor-able value, which is
X   fortunate, since the relative positions of upper to lower
X   case letters is the opposite of ascii in ebcdic.
X*/
X
X#ifdef	islower
X#undef	islower
X#endif
X
X#if	ASCII
X
X#define	DIFCASE		0x20
X#define isletter(c)	(('a' <= c && 'z' >= c) || ('A' <= c && 'Z' >= c))
X#define islower(c)	(('a' <= c && 'z' >= c))
X#endif
X
X#if	EBCDIC
X
X#define	DIFCASE		0x40
X#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))
X#define islower(c)	(('a' <= c && 'i' >= c) || ('j' <= c && 'r' >= c) || ('s' <= c && 'z' >= c))
X#endif
X
X/*	Dynamic RAM tracking and reporting redefinitions	*/
X
X#if	RAMSIZE
X#define	malloc	allocate
X#define	free	release
X#endif
X
X/*	De-allocate memory always on exit (if the operating system or
X	main program can not
X*/
X
X#if	CLEAN
X#define	exit(a)	cexit(a)
X#endif
X
X/*
X * There is a window structure allocated for every active display window. The
X * windows are kept in a big list, in top to bottom screen order, with the
X * listhead at "wheadp". Each window contains its own values of dot and mark.
X * The flag field contains some bits that are set by commands to guide
X * redisplay. Although this is a bit of a compromise in terms of decoupling,
X * the full blown redisplay is just too expensive to run for every input
X * character.
X */
Xtypedef struct  WINDOW {
X        struct  WINDOW *w_wndp;         /* Next window                  */
X        struct  BUFFER *w_bufp;         /* Buffer displayed in window   */
X        struct  LINE *w_linep;          /* Top line in the window       */
X        struct  LINE *w_dotp;           /* Line containing "."          */
X        short   w_doto;                 /* Byte offset for "."          */
X        struct  LINE *w_markp;          /* Line containing "mark"       */
X        short   w_marko;                /* Byte offset for "mark"       */
X        char    w_toprow;               /* Origin 0 top row of window   */
X        char    w_ntrows;               /* # of rows of text in window  */
X        char    w_force;                /* If NZ, forcing row.          */
X        char    w_flag;                 /* Flags.                       */
X#if	COLOR
X	char	w_fcolor;		/* current forground color	*/
X	char	w_bcolor;		/* current background color	*/
X#endif
X}       WINDOW;
X
X#define WFFORCE 0x01                    /* Window needs forced reframe  */
X#define WFMOVE  0x02                    /* Movement from line to line   */
X#define WFEDIT  0x04                    /* Editing within a line        */
X#define WFHARD  0x08                    /* Better to a full display     */
X#define WFMODE  0x10                    /* Update mode line.            */
X#define	WFCOLR	0x20			/* Needs a color change		*/
X
X/*
X * Text is kept in buffers. A buffer header, described below, exists for every
X * buffer in the system. The buffers are kept in a big list, so that commands
X * that search for a buffer by name can find the buffer header. There is a
X * safe store for the dot and mark in the header, but this is only valid if
X * the buffer is not being displayed (that is, if "b_nwnd" is 0). The text for
X * the buffer is kept in a circularly linked list of lines, with a pointer to
X * the header line in "b_linep".
X * 	Buffers may be "Inactive" which means the files associated with them
X * have not been read in yet. These get read in at "use buffer" time.
X */
Xtypedef struct  BUFFER {
X        struct  BUFFER *b_bufp;         /* Link to next BUFFER          */
X        struct  LINE *b_dotp;           /* Link to "." LINE structure   */
X        short   b_doto;                 /* Offset of "." in above LINE  */
X        struct  LINE *b_markp;          /* The same as the above two,   */
X        short   b_marko;                /* but for the "mark"           */
X        struct  LINE *b_linep;          /* Link to the header LINE      */
X	char	b_active;		/* window activated flag	*/
X        char    b_nwnd;                 /* Count of windows on buffer   */
X        char    b_flag;                 /* Flags                        */
X	int	b_mode;			/* editor mode of this buffer	*/
X        char    b_fname[NFILEN];        /* File name                    */
X        char    b_bname[NBUFN];         /* Buffer name                  */
X#if	CRYPT
X	char	b_key[NPAT];		/* current encrypted key	*/
X#endif
X}       BUFFER;
X
X#define BFINVS  0x01                    /* Internal invisable buffer    */
X#define BFCHG   0x02                    /* Changed since last write     */
X#define	BFTRUNC	0x04			/* buffer was truncated when read */
X
X/*	mode flags	*/
X#define	NUMMODES	9		/* # of defined modes		*/
X
X#define	MDWRAP	0x0001			/* word wrap			*/
X#define	MDCMOD	0x0002			/* C indentation and fence match*/
X#define	MDSPELL	0x0004			/* spell error parcing		*/
X#define	MDEXACT	0x0008			/* Exact matching for searches	*/
X#define	MDVIEW	0x0010			/* read-only buffer		*/
X#define MDOVER	0x0020			/* overwrite mode		*/
X#define MDMAGIC	0x0040			/* regular expresions in search */
X#define	MDCRYPT	0x0080			/* encrytion mode active	*/
X#define	MDASAVE	0x0100			/* auto-save mode		*/
X
X/*
X * The starting position of a region, and the size of the region in
X * characters, is kept in a region structure.  Used by the region commands.
X */
Xtypedef struct  {
X        struct  LINE *r_linep;          /* Origin LINE address.         */
X        short   r_offset;               /* Origin LINE offset.          */
X        long	r_size;                 /* Length in characters.        */
X}       REGION;
X
X/*
X * All text is kept in circularly linked lists of "LINE" structures. These
X * begin at the header line (which is the blank line beyond the end of the
X * buffer). This line is pointed to by the "BUFFER". Each line contains a the
X * number of bytes in the line (the "used" size), the size of the text array,
X * and the text. The end of line is not stored as a byte; it's implied. Future
X * additions will include update hints, and a list of marks into the line.
X */
Xtypedef struct  LINE {
X        struct  LINE *l_fp;             /* Link to the next line        */
X        struct  LINE *l_bp;             /* Link to the previous line    */
X        short   l_size;                 /* Allocated size               */
X        short   l_used;                 /* Used size                    */
X        char    l_text[1];              /* A bunch of characters.       */
X}       LINE;
X
X#define lforw(lp)       ((lp)->l_fp)
X#define lback(lp)       ((lp)->l_bp)
X#define lgetc(lp, n)    ((lp)->l_text[(n)]&0xFF)
X#define lputc(lp, n, c) ((lp)->l_text[(n)]=(c))
X#define llength(lp)     ((lp)->l_used)
X
X/*
X * The editor communicates with the display using a high level interface. A
X * "TERM" structure holds useful variables, and indirect pointers to routines
X * that do useful operations. The low level get and put routines are here too.
X * This lets a terminal, in addition to having non standard commands, have
X * funny get and put character code too. The calls might get changed to
X * "termp->t_field" style in the future, to make it possible to run more than
X * one terminal type.
X */
Xtypedef struct  {
X	short	t_mrow;			/* max number of rows allowable */
X        short   t_nrow;                 /* current number of rows used  */
X        short   t_mcol;                 /* max Number of columns.       */
X        short   t_ncol;                 /* current Number of columns.   */
X	short	t_margin;		/* min margin for extended lines*/
X	short	t_scrsiz;		/* size of scroll region "	*/
X	int	t_pause;		/* # times thru update to pause */
X        int     (*t_open)();            /* Open terminal at the start.  */
X        int     (*t_close)();           /* Close terminal at end.       */
X	int	(*t_kopen)();		/* Open keyboard		*/
X	int	(*t_kclose)();		/* close keyboard		*/
X        int     (*t_getchar)();         /* Get character from keyboard. */
X        int     (*t_putchar)();         /* Put character to display.    */
X        int     (*t_flush)();           /* Flush output buffers.        */
X        int     (*t_move)();            /* Move the cursor, origin 0.   */
X        int     (*t_eeol)();            /* Erase to end of line.        */
X        int     (*t_eeop)();            /* Erase to end of page.        */
X        int     (*t_beep)();            /* Beep.                        */
X	int	(*t_rev)();		/* set reverse video state	*/
X	int	(*t_rez)();		/* change screen resolution	*/
X#if	COLOR
X	int	(*t_setfor)();		/* set forground color		*/
X	int	(*t_setback)();		/* set background color		*/
X#endif
X}       TERM;
X
X/*	TEMPORARY macros for terminal I/O  (to be placed in a machine
X					    dependant place later)	*/
X
X#define	TTopen		(*term.t_open)
X#define	TTclose		(*term.t_close)
X#define	TTkopen		(*term.t_kopen)
X#define	TTkclose	(*term.t_kclose)
X#define	TTgetc		(*term.t_getchar)
X#define	TTputc		(*term.t_putchar)
X#define	TTflush		(*term.t_flush)
X#define	TTmove		(*term.t_move)
X#define	TTeeol		(*term.t_eeol)
X#define	TTeeop		(*term.t_eeop)
X#define	TTbeep		(*term.t_beep)
X#define	TTrev		(*term.t_rev)
X#define	TTrez		(*term.t_rez)
X#if	COLOR
X#define	TTforg		(*term.t_setfor)
X#define	TTbacg		(*term.t_setback)
X#endif
X
X/*	structure for the table of initial key bindings		*/
X
Xtypedef struct  {
X        short   k_code;                 /* Key code                     */
X        int     (*k_fp)();              /* Routine to handle it         */
X}       KEYTAB;
X
X/*	structure for the name binding table		*/
X
Xtypedef struct {
X	char *n_name;		/* name of function key */
X	int (*n_func)();	/* function name is bound to */
X}	NBIND;
X
X/*	The editor holds deleted text chunks in the KILL buffer. The
X	kill buffer is logically a stream of ascii characters, however
X	due to its unpredicatable size, it gets implemented as a linked
X	list of chunks. (The d_ prefix is for "deleted" text, as k_
X	was taken up by the keycode structure)
X*/
X
Xtypedef	struct KILL {
X	struct KILL *d_next;	/* link to next chunk, NULL if last */
X	char d_chunk[KBLOCK];	/* deleted text */
X} KILL;
X
X/*	When emacs' command interpetor needs to get a variable's name,
X	rather than it's value, it is passed back as a VDESC variable
X	description structure. The v_num field is a index into the
X	appropriate variable table.
X*/
X
Xtypedef struct VDESC {
X	int v_type;	/* type of variable */
X	int v_num;	/* ordinal pointer to variable in list */
X} VDESC;
X
X/*	The !WHILE directive in the execution language needs to
X	stack references to pending whiles. These are stored linked
X	to each currently open procedure via a linked list of
X	the following structure
X*/
X
Xtypedef struct WHBLOCK {
X	LINE *w_begin;		/* ptr to !while statement */
X	LINE *w_end;		/* ptr to the !endwhile statement*/
X	int w_type;		/* block type */
X	struct WHBLOCK *w_next;	/* next while */
X} WHBLOCK;
X
X#define	BTWHILE		1
X#define	BTBREAK		2
X
X/*
X * Incremental search defines.
X */
X#if	ISRCH
X
X#define	CMDBUFLEN	256	/* Length of our command buffer */
X
X#define	IS_ABORT	0x07	/* Abort the isearch */
X#define IS_BACKSP	0x08	/* Delete previous char */
X#define	IS_TAB		0x09	/* Tab character (allowed search char) */
X#define IS_NEWLINE	0x0D	/* New line from keyboard (Carriage return) */
X#define	IS_QUOTE	0x11	/* Quote next character */
X#define IS_REVERSE	0x12	/* Search backward */
X#define	IS_FORWARD	0x13	/* Search forward */
X#define	IS_VMSQUOTE	0x16	/* VMS quote character */
X#define	IS_VMSFORW	0x18	/* Search forward for VMS */
X#define	IS_QUIT		0x1B	/* Exit the search */
X#define	IS_RUBOUT	0x7F	/* Delete previous character */
X
X/* IS_QUIT is no longer used, the variable metac is used instead */
X
X#endif
X
X#if	MAGIC
X/*
X * Defines for the metacharacters in the regular expression
X * search routines.
X */
X#define	MCNIL		0	/* Like the '\0' for strings.*/
X#define	LITCHAR		1	/* Literal character, or string.*/
X#define	ANY		2
X#define	CCL		3
X#define	NCCL		4
X#define	BOL		5
X#define	EOL		6
X#define	DITTO		7
X#define	CLOSURE		256	/* An or-able value.*/
X#define	MASKCL		CLOSURE - 1
X
X#define	MC_ANY		'.'	/* 'Any' character (except newline).*/
X#define	MC_CCL		'['	/* Character class.*/
X#define	MC_NCCL		'^'	/* Negate character class.*/
X#define	MC_RCCL		'-'	/* Range in character class.*/
X#define	MC_ECCL		']'	/* End of character class.*/
X#define	MC_BOL		'^'	/* Beginning of line.*/
X#define	MC_EOL		'$'	/* End of line.*/
X#define	MC_CLOSURE	'*'	/* Closure - does not extend past newline.*/
X#define	MC_DITTO	'&'	/* Use matched string in replacement.*/
X#define	MC_ESC		'\\'	/* Escape - suppress meta-meaning.*/
X
X#define	BIT(n)		(1 << (n))	/* An integer with one bit set.*/
X#define	CHCASE(c)	((c) ^ DIFCASE)	/* Toggle the case of a letter.*/
X
X/* HICHAR - 1 is the largest character we will deal with.
X * HIBYTE represents the number of bytes in the bitmap.
X */
X#define	HICHAR		256
X#define	HIBYTE		HICHAR >> 3
X
X/* Typedefs that define the bitmap type for searching (BITMAP),
X * the meta-character structure for MAGIC mode searching (MC),
X * and the meta-character structure for MAGIC mode replacment (RMC).
X */
Xtypedef char	*BITMAP;
X
Xtypedef	struct {
X	short int	mc_type;
X	union {
X		int	lchar;
X		BITMAP	cclmap;
X	} u;
X} MC;
X
Xtypedef	struct {
X	short int	mc_type;
X	char	*rstr;
X} RMC;
X#endif
X
FRIDAY_NIGHT
echo extracting - evar.h
sed 's/^X//' > evar.h << 'FRIDAY_NIGHT'
X/*	EVAR.H:	Environment and user variable definitions
X		for MicroEMACS
X
X		written 1986 by Daniel Lawrence
X*/
X
X/*	structure to hold user variables and their definitions	*/
X
Xtypedef struct UVAR {
X	char u_name[NVSIZE + 1];		/* name of user variable */
X	char *u_value;				/* value (string) */
X} UVAR;
X
X/*	current user variables (This structure will probably change)	*/
X
X#define	MAXVARS		255
X
XUVAR uv[MAXVARS + 1];	/* user variables */
X
X/*	list of recognized environment variables	*/
X
Xchar *envars[] = {
X	"fillcol",		/* current fill column */
X	"pagelen",		/* number of lines used by editor */
X	"curcol",		/* current column pos of cursor */
X	"curline",		/* current line in file */
X	"ram",			/* ram in use by malloc */
X	"flicker",		/* flicker supression */
X	"curwidth",		/* current screen width */
X	"cbufname",		/* current buffer name */
X	"cfname",		/* current file name */
X	"sres",			/* current screen resolution */
X	"debug",		/* macro debugging */
X	"status",		/* returns the status of the last command */
X	"palette",		/* current palette string */
X	"asave",		/* # of chars between auto-saves */
X	"acount",		/* # of chars until next auto-save */
X	"lastkey",		/* last keyboard char struck */
X	"curchar",		/* current character under the cursor */
X	"discmd",		/* display commands on command line */
X	"version",		/* current version number */
X	"progname",		/* returns current prog name - "MicroEMACS" */
X	"seed",			/* current random number seed */
X	"disinp",		/* display command line input characters */
X	"wline",		/* # of lines in current window */
X	"cwline",		/* current screen line in window */
X	"target",		/* target for line moves */
X	"search",		/* search pattern */
X	"replace",		/* replacement pattern */
X	"match",		/* last matched magic pattern */
X	"kill",			/* kill buffer (read only) */
X	"cmode",		/* mode of current buffer */
X	"gmode",		/* global modes */
X	"tpause",		/* length to pause for paren matching */
X	"pending",		/* type ahead pending flag */
X	"lwidth",		/* width of current line */
X	"line",			/* text of current line */
X	"gflags",		/* global internal emacs flags */
X	"rval",			/* child process return value */
X};
X
X#define	NEVARS	sizeof(envars) / sizeof(char *)
X
X/* 	and its preprocesor definitions		*/
X
X#define	EVFILLCOL	0
X#define	EVPAGELEN	1
X#define	EVCURCOL	2
X#define	EVCURLINE	3
X#define	EVRAM		4
X#define	EVFLICKER	5
X#define	EVCURWIDTH	6
X#define	EVCBUFNAME	7
X#define	EVCFNAME	8
X#define	EVSRES		9
X#define	EVDEBUG		10
X#define	EVSTATUS	11
X#define	EVPALETTE	12
X#define	EVASAVE		13
X#define	EVACOUNT	14
X#define	EVLASTKEY	15
X#define	EVCURCHAR	16
X#define	EVDISCMD	17
X#define	EVVERSION	18
X#define	EVPROGNAME	19
X#define	EVSEED		20
X#define	EVDISINP	21
X#define	EVWLINE		22
X#define EVCWLINE	23
X#define	EVTARGET	24
X#define	EVSEARCH	25
X#define	EVREPLACE	26
X#define	EVMATCH		27
X#define	EVKILL		28
X#define	EVCMODE		29
X#define	EVGMODE		30
X#define	EVTPAUSE	31
X#define	EVPENDING	32
X#define	EVLWIDTH	33
X#define	EVLINE		34
X#define	EVGFLAGS	35
X#define	EVRVAL		36
X
X/*	list of recognized user functions	*/
X
Xtypedef struct UFUNC {
X	char *f_name;	/* name of function */
X	int f_type;	/* 1 = monamic, 2 = dynamic */
X} UFUNC;
X
X#define	NILNAMIC	0
X#define	MONAMIC		1
X#define	DYNAMIC		2
X#define	TRINAMIC	3
X
XUFUNC funcs[] = {
X	"add", DYNAMIC,		/* add two numbers together */
X	"sub", DYNAMIC,		/* subtraction */
X	"tim", DYNAMIC,		/* multiplication */
X	"div", DYNAMIC,		/* division */
X	"mod", DYNAMIC,		/* mod */
X	"neg", MONAMIC,		/* negate */
X	"cat", DYNAMIC,		/* concatinate string */
X	"lef", DYNAMIC,		/* left string(string, len) */
X	"rig", DYNAMIC,		/* right string(string, pos) */
X	"mid", TRINAMIC,	/* mid string(string, pos, len) */
X	"not", MONAMIC,		/* logical not */
X	"equ", DYNAMIC,		/* logical equality check */
X	"les", DYNAMIC,		/* logical less than */
X	"gre", DYNAMIC,		/* logical greater than */
X	"seq", DYNAMIC,		/* string logical equality check */
X	"sle", DYNAMIC,		/* string logical less than */
X	"sgr", DYNAMIC,		/* string logical greater than */
X	"ind", MONAMIC,		/* evaluate indirect value */
X	"and", DYNAMIC,		/* logical and */
X	"or",  DYNAMIC,		/* logical or */
X	"len", MONAMIC,		/* string length */
X	"upp", MONAMIC,		/* uppercase string */
X	"low", MONAMIC,		/* lower case string */
X	"tru", MONAMIC,		/* Truth of the universe logical test */
X	"asc", MONAMIC,		/* char to integer conversion */
X	"chr", MONAMIC,		/* integer to char conversion */
X	"gtk", NILNAMIC,	/* get 1 charater */
X	"rnd", MONAMIC,		/* get a random number */
X	"abs", MONAMIC,		/* absolute value of a number */
X	"sin", DYNAMIC,		/* find the index of one string in another */
X	"env", MONAMIC,		/* retrieve a system environment var */
X	"bin", MONAMIC,		/* loopup what function name is bound to a key */
X	"exi", MONAMIC,		/* check if a file exists */
X	"fin", MONAMIC,		/* look for a file on the path... */
X 	"ban", DYNAMIC,		/* bitwise and   9-10-87  jwm */
X 	"bor", DYNAMIC,		/* bitwise or    9-10-87  jwm */
X 	"bxo", DYNAMIC,		/* bitwise xor	 9-10-87  jwm */
X	"bno", MONAMIC,		/* bitwise not */
X	"xla", TRINAMIC,	/* XLATE character string translation */
X};
X
X#define	NFUNCS	sizeof(funcs) / sizeof(UFUNC)
X
X/* 	and its preprocesor definitions		*/
X
X#define	UFADD		0
X#define	UFSUB		1
X#define	UFTIMES		2
X#define	UFDIV		3
X#define	UFMOD		4
X#define	UFNEG		5
X#define	UFCAT		6
X#define	UFLEFT		7
X#define	UFRIGHT		8
X#define	UFMID		9
X#define	UFNOT		10
X#define	UFEQUAL		11
X#define	UFLESS		12
X#define	UFGREATER	13
X#define	UFSEQUAL	14
X#define	UFSLESS		15
X#define	UFSGREAT	16
X#define	UFIND		17
X#define	UFAND		18
X#define	UFOR		19
X#define	UFLENGTH	20
X#define	UFUPPER		21
X#define	UFLOWER		22
X#define	UFTRUTH		23
X#define	UFASCII		24
X#define	UFCHR		25
X#define	UFGTKEY		26
X#define	UFRND		27
X#define	UFABS		28
X#define	UFSINDEX	29
X#define	UFENV		30
X#define	UFBIND		31
X#define	UFEXIST		32
X#define	UFFIND		33
X#define UFBAND		34
X#define UFBOR		35
X#define UFBXOR		36
X#define	UFBNOT		37
X#define	UFXLATE		38
FRIDAY_NIGHT
echo mes.16 completed!
# That's all folks!
