MicroEMACS 3.5 (2 of 7)

lawrence at duncan.UUCP lawrence at duncan.UUCP
Tue Mar 18 22:17:00 AEST 1986


echo x - ebind.h
sed 's/^X//' >ebind.h <<'*-*-END-of-ebind.h-*-*'
X/*	EBIND:		Initial default key to function bindings for
X			MicroEMACS 3.2
X
X			written by Dave G. Conroy
X			modified by Steve Wilhite, George Jones
X			greatly modified by Daniel Lawrence
X*/
X
X/*
X * Command table.
X * This table  is *roughly* in ASCII order, left to right across the
X * characters of the command. This expains the funny location of the
X * control-X commands.
X */
XKEYTAB  keytab[NBINDS] = {
X        CTRL|'A',		gotobol,
X        CTRL|'B',		backchar,
X	CTRL|'C',		bindtokey,
X        CTRL|'D',		forwdel,
X        CTRL|'E',		gotoeol,
X        CTRL|'F',		forwchar,
X        CTRL|'G',		ctrlg,
X        CTRL|'H',		backdel,
X        CTRL|'I',		tab,
X        CTRL|'J',		indent,
X        CTRL|'K',		killtext,
X        CTRL|'L',		refresh,
X        CTRL|'M',		newline,
X        CTRL|'N',		forwline,
X        CTRL|'O',		openline,
X        CTRL|'P',		backline,
X        CTRL|'Q',		quote,
X        CTRL|'R',		backsearch,
X        CTRL|'S',		forwsearch,
X        CTRL|'T',		twiddle,
X        CTRL|'V',		forwpage,
X        CTRL|'W',		killregion,
X        CTRL|'Y',		yank,
X        CTRL|'Z',		backpage,
X        CTLX|CTRL|'B',		listbuffers,
X        CTLX|CTRL|'C',		quit,          /* Hard quit.           */
X        CTLX|CTRL|'F',		filefind,
X	CTLX|CTRL|'I',		insfile,
X        CTLX|CTRL|'L',		lowerregion,
X	CTLX|CTRL|'M',		delmode,
X        CTLX|CTRL|'N',		mvdnwind,
X        CTLX|CTRL|'O',		deblank,
X        CTLX|CTRL|'P',		mvupwind,
X        CTLX|CTRL|'R',		fileread,
X        CTLX|CTRL|'S',		filesave,
X        CTLX|CTRL|'U',		upperregion,
X	CTLX|CTRL|'V',		viewfile,
X        CTLX|CTRL|'W',		filewrite,
X        CTLX|CTRL|'X',		swapmark,
X        CTLX|CTRL|'Z',		shrinkwind,
X	CTLX|'?',		deskey,
X        CTLX|'!',		spawn,         /* Run 1 command.       */
X        CTLX|'=',		showcpos,
X        CTLX|'(',		ctlxlp,
X        CTLX|')',		ctlxrp,
X	CTLX|'^',		enlargewind,
X        CTLX|'1',		onlywind,
X        CTLX|'2',		splitwind,
X        CTLX|'B',		usebuffer,
X        CTLX|'C',		spawncli,      /* Run CLI in subjob.   */
X#if	V7 & BSD
X	CTLX|'D',		bktoshell,	/* suspend emacs */
X#endif
X        CTLX|'E',		ctlxe,
X        CTLX|'F',		setfillcol,
X        CTLX|'K',		killbuffer,
X	CTLX|'M',		setmode,
X        CTLX|'N',		filename,
X	CTLX|'O',		nextwind,
X        CTLX|'P',		prevwind,
X	CTLX|'S',		filesave,
X        CTLX|'Z',		enlargewind,
X	META|CTRL|'C',		unbindkey,
X        META|CTRL|'H',		delbword,
X	META|CTRL|'L',		reposition,
X	META|CTRL|'N',		namebuffer,
X	META|CTRL|'R',		qreplace,
X	META|CTRL|'V',		scrnextdw,
X	META|CTRL|'Z',		scrnextup,
X	META|' ',		setmark,
X	META|'?',		help,
X        META|'!',		reposition,
X        META|'.',		setmark,
X        META|'>',		gotoeob,
X        META|'<',		gotobob,
X        META|'B',		backword,
X        META|'C',		capword,
X        META|'D',		delfword,
X        META|'F',		forwword,
X	META|'G',		gotoline,
X        META|'L',		lowerword,
X	META|'N',		gotoeop,
X	META|'P',		gotobop,
X	META|'Q',		fillpara,
X	META|'R',		sreplace,
X#if	V7 & BSD
X	META|'S',		bktoshell,
X#endif
X        META|'U',		upperword,
X        META|'V',		backpage,
X        META|'W',		copyregion,
X	META|'X',		namedcmd,
X	META|'Z',		quickexit,
X        META|0x7F,              delbword,
X
X#if	MSDOS & (HP150 == 0)
X	SPEC|71,		gotobob,
X	SPEC|72,		backline,
X	SPEC|73,		backpage,
X	SPEC|75,		backchar,
X	SPEC|77,		forwchar,
X	SPEC|79,		gotoeob,
X	SPEC|80,		forwline,
X	SPEC|81,		forwpage,
X	SPEC|82,		openline,
X	SPEC|83,		killtext,
X	SPEC|115,		backword,
X	SPEC|116,		forwword,
X	SPEC|132,		gotobop,
X	SPEC|118,		gotoeop,
X#endif
X
X#if	HP150
X	SPEC|32,		backline,
X	SPEC|33,		forwline,
X	SPEC|35,		backchar,
X	SPEC|34,		forwchar,
X	SPEC|44,		gotobob,
X	SPEC|46,		forwpage,
X	SPEC|47,		backpage,
X	SPEC|82,		nextwind,
X	SPEC|68,		openline,
X	SPEC|69,		killtext,
X	SPEC|65,		forwdel,
X	SPEC|64,		ctlxe,
X	SPEC|67,		refresh,
X	SPEC|66,		reposition,
X	SPEC|83,		help,
X	SPEC|81,		deskey,
X#endif
X
X        0x7F,			backdel,
X	0,			NULL
X};
X
X#if RAINBOW
X
X#include "rainbow.h"
X
X/*
X * Mapping table from the LK201 function keys to the internal EMACS character.
X */
X
Xshort lk_map[][2] = {
X        Up_Key,                         CTRL+'P',
X        Down_Key,                       CTRL+'N',
X        Left_Key,                       CTRL+'B',
X        Right_Key,                      CTRL+'F',
X        Shift+Left_Key,                 META+'B',
X        Shift+Right_Key,                META+'F',
X        Control+Left_Key,               CTRL+'A',
X        Control+Right_Key,              CTRL+'E',
X        Prev_Scr_Key,                   META+'V',
X        Next_Scr_Key,                   CTRL+'V',
X        Shift+Up_Key,                   META+'<',
X        Shift+Down_Key,                 META+'>',
X        Cancel_Key,                     CTRL+'G',
X        Find_Key,                       CTRL+'S',
X        Shift+Find_Key,                 CTRL+'R',
X        Insert_Key,                     CTRL+'Y',
X        Options_Key,                    CTRL+'D',
X        Shift+Options_Key,              META+'D',
X        Remove_Key,                     CTRL+'W',
X        Shift+Remove_Key,               META+'W',
X        Select_Key,                     CTRL+'@',
X        Shift+Select_Key,               CTLX+CTRL+'X',
X        Interrupt_Key,                  CTRL+'U',
X        Keypad_PF2,                     META+'L',
X        Keypad_PF3,                     META+'C',
X        Keypad_PF4,                     META+'U',
X        Shift+Keypad_PF2,               CTLX+CTRL+'L',
X        Shift+Keypad_PF4,               CTLX+CTRL+'U',
X        Keypad_1,                       CTLX+'1',
X        Keypad_2,                       CTLX+'2',
X        Do_Key,                         CTLX+'E',
X        Keypad_4,                       CTLX+CTRL+'B',
X        Keypad_5,                       CTLX+'B',
X        Keypad_6,                       CTLX+'K',
X        Resume_Key,                     META+'!',
X        Control+Next_Scr_Key,           CTLX+'N',
X        Control+Prev_Scr_Key,           CTLX+'P',
X        Control+Up_Key,                 CTLX+CTRL+'P',
X        Control+Down_Key,               CTLX+CTRL+'N',
X        Help_Key,                       CTLX+'=',
X        Shift+Do_Key,                   CTLX+'(',
X        Control+Do_Key,                 CTLX+')',
X        Keypad_0,                       CTLX+'Z',
X        Shift+Keypad_0,                 CTLX+CTRL+'Z',
X        Main_Scr_Key,                   CTRL+'C',
X        Keypad_Enter,                   CTLX+'!',
X        Exit_Key,                       CTLX+CTRL+'C',
X        Shift+Exit_Key,                 CTRL+'Z'
X        };
X
X#define lk_map_size     (sizeof(lk_map)/2)
X#endif
X
*-*-END-of-ebind.h-*-*
echo x - edef.h
sed 's/^X//' >edef.h <<'*-*-END-of-edef.h-*-*'
X/*	EDEF:		Global variable definitions for
X			MicroEMACS 3.2
X
X			written by Dave G. Conroy
X			modified by Steve Wilhite, George Jones
X			greatly modified by Daniel Lawrence
X*/
X
X#ifdef	maindef
X
X/* for MAIN.C */
X
X/* initialized global definitions */
X
Xint     fillcol = 72;                   /* Current fill column          */
Xshort   kbdm[NKBDM] = {CTLX|')'};       /* Macro                        */
Xchar    pat[NPAT];                      /* Search pattern		*/
Xchar	rpat[NPAT];			/* replacement pattern		*/
Xchar	sarg[NSTRING] = "";		/* string argument for line exec*/
Xint	eolexist = TRUE;		/* does clear to EOL exist	*/
Xchar	*modename[] = {			/* name of modes		*/
X	"WRAP", "CMODE", "SPELL", "EXACT", "VIEW" };
Xchar	modecode[] = "WCSEV";		/* letters to represent modes	*/
Xint     sgarbf  = TRUE;                 /* TRUE if screen is garbage */
Xint     mpresf  = FALSE;                /* TRUE if message in last line */
Xint	clexec	= FALSE;		/* command line execution flag	*/
X
X/* uninitialized global definitions */
X
Xint     currow;                 /* Cursor row                   */
Xint     curcol;                 /* Cursor column                */
Xint     thisflag;               /* Flags, this command          */
Xint     lastflag;               /* Flags, last command          */
Xint     curgoal;                /* Goal for C-P, C-N            */
XWINDOW  *curwp;                 /* Current window               */
XBUFFER  *curbp;                 /* Current buffer               */
XWINDOW  *wheadp;                /* Head of list of windows      */
XBUFFER  *bheadp;                /* Head of list of buffers      */
XBUFFER  *blistp;                /* Buffer for C-X C-B           */
Xshort   *kbdmip;                /* Input pointer for above      */
Xshort   *kbdmop;                /* Output pointer for above     */
X
XBUFFER  *bfind();               /* Lookup a buffer by name      */
XWINDOW  *wpopup();              /* Pop up window creation       */
XLINE    *lalloc();              /* Allocate a line              */
X
X#else
X
X/* for all the other .C files */
X
X/* initialized global external declarations */
X
Xextern  int     fillcol;                /* Fill column                  */
Xextern  short   kbdm[];                 /* Holds kayboard macro data    */
Xextern  char    pat[];                  /* Search pattern               */
Xextern	char	rpat[];			/* Replacement pattern		*/
Xextern	char	sarg[];			/* string argument for line exec*/
Xextern	int	eolexist;		/* does clear to EOL exist?	*/
Xextern	char *modename[];		/* text names of modes		*/
Xextern	char	modecode[];		/* letters to represent modes	*/
Xextern	KEYTAB keytab[];		/* key bind to functions table	*/
Xextern	NBIND names[];			/* name to function table	*/
Xextern  int     sgarbf;                 /* State of screen unknown      */
Xextern  int     mpresf;                 /* Stuff in message line        */
Xextern	int	clexec;			/* command line execution flag	*/
X
X/* initialized global external declarations */
X
Xextern  int     currow;                 /* Cursor row                   */
Xextern  int     curcol;                 /* Cursor column                */
Xextern  int     thisflag;               /* Flags, this command          */
Xextern  int     lastflag;               /* Flags, last command          */
Xextern  int     curgoal;                /* Goal for C-P, C-N            */
Xextern  WINDOW  *curwp;                 /* Current window               */
Xextern  BUFFER  *curbp;                 /* Current buffer               */
Xextern  WINDOW  *wheadp;                /* Head of list of windows      */
Xextern  BUFFER  *bheadp;                /* Head of list of buffers      */
Xextern  BUFFER  *blistp;                /* Buffer for C-X C-B           */
Xextern  short   *kbdmip;                /* Input pointer for above      */
Xextern  short   *kbdmop;                /* Output pointer for above     */
X
Xextern  BUFFER  *bfind();               /* Lookup a buffer by name      */
Xextern  WINDOW  *wpopup();              /* Pop up window creation       */
Xextern  LINE    *lalloc();              /* Allocate a line              */
X
X#endif
X
X/* terminal table defined only in TERM.C */
X
X#ifndef	termdef
Xextern  TERM    term;                   /* Terminal information.        */
X#endif
X
X
*-*-END-of-edef.h-*-*
echo x - efunc.h
sed 's/^X//' >efunc.h <<'*-*-END-of-efunc.h-*-*'
X/*	EFUNC.H:	MicroEMACS function declarations and names
X
X		This file list all the C code functions used by MicroEMACS
X	and the names to use to bind keys to them. To add functions,
X	declare it here in both the extern function list and the name
X	binding table.
X
X	Update History:
X
X	Daniel Lawrence
X		29-jan-86
X		- separeted out external declarations to a separate .h file
X		- built original name to function binding table
X		30-jan-86
X		- added command declarations for Fill Paragraph command
X		11-feb-86
X		- added declaration for help and describe key commands
X		13-feb-86
X		- added declarations for view-file command
X		15-feb-86
X		- added declataitons for insert file command
X		17-feb-86
X		- added declarations for scroll next window up/down
X		20-feb-86
X		- expanded binding table to make room for new bindings
X		24-feb-86
X		- added declarations for bind-to-key and unbind-key
X		  execute named command and describe bindings
X		26-feb-86
X		- added declarations for execute command
X		- changed name of "visit-file" to "find-file"
X		- added declaration for execute-buffer command
X		27-feb-86
X		- added declarations for execute-file command
X*/
X
X/*	External function declarations		*/
X
Xextern  int     ctrlg();                /* Abort out of things          */
Xextern  int     quit();                 /* Quit                         */
Xextern  int     ctlxlp();               /* Begin macro                  */
Xextern  int     ctlxrp();               /* End macro                    */
Xextern  int     ctlxe();                /* Execute macro                */
Xextern  int     fileread();             /* Get a file, read only        */
Xextern  int     filefind();		/* Get a file, read write       */
Xextern  int     filewrite();            /* Write a file                 */
Xextern  int     filesave();             /* Save current file            */
Xextern  int     filename();             /* Adjust file name             */
Xextern  int     getccol();              /* Get current column           */
Xextern  int     gotobol();              /* Move to start of line        */
Xextern  int     forwchar();             /* Move forward by characters   */
Xextern  int     gotoeol();              /* Move to end of line          */
Xextern  int     backchar();             /* Move backward by characters  */
Xextern  int     forwline();             /* Move forward by lines        */
Xextern  int     backline();             /* Move backward by lines       */
Xextern  int     forwpage();             /* Move forward by pages        */
Xextern  int     backpage();             /* Move backward by pages       */
Xextern  int     gotobob();              /* Move to start of buffer      */
Xextern  int     gotoeob();              /* Move to end of buffer        */
Xextern  int     setfillcol();           /* Set fill column.             */
Xextern  int     setmark();              /* Set mark                     */
Xextern  int     swapmark();             /* Swap "." and mark            */
Xextern  int     forwsearch();           /* Search forward               */
Xextern  int     backsearch();           /* Search backwards             */
Xextern	int	sreplace();		/* search and replace		*/
Xextern	int	qreplace();		/* search and replace w/query	*/
Xextern  int     showcpos();             /* Show the cursor position     */
Xextern  int     nextwind();             /* Move to the next window      */
Xextern  int     prevwind();             /* Move to the previous window  */
Xextern  int     onlywind();             /* Make current window only one */
Xextern  int     splitwind();            /* Split current window         */
Xextern  int     mvdnwind();             /* Move window down             */
Xextern  int     mvupwind();             /* Move window up               */
Xextern  int     enlargewind();          /* Enlarge display window.      */
Xextern  int     shrinkwind();           /* Shrink window.               */
Xextern  int     listbuffers();          /* Display list of buffers      */
Xextern  int     usebuffer();            /* Switch a window to a buffer  */
Xextern  int     killbuffer();           /* Make a buffer go away.       */
Xextern  int     reposition();           /* Reposition window            */
Xextern  int     refresh();              /* Refresh the screen           */
Xextern  int     twiddle();              /* Twiddle characters           */
Xextern  int     tab();                  /* Insert tab                   */
Xextern  int     newline();              /* Insert CR-LF                 */
Xextern  int     indent();               /* Insert CR-LF, then indent    */
Xextern  int     openline();             /* Open up a blank line         */
Xextern  int     deblank();              /* Delete blank lines           */
Xextern  int     quote();                /* Insert literal               */
Xextern  int     backword();             /* Backup by words              */
Xextern  int     forwword();             /* Advance by words             */
Xextern  int     forwdel();              /* Forward delete               */
Xextern  int     backdel();              /* Backward delete              */
Xextern  int     killtext();             /* Kill forward                 */
Xextern  int     yank();                 /* Yank back from killbuffer.   */
Xextern  int     upperword();            /* Upper case word.             */
Xextern  int     lowerword();            /* Lower case word.             */
Xextern  int     upperregion();          /* Upper case region.           */
Xextern  int     lowerregion();          /* Lower case region.           */
Xextern  int     capword();              /* Initial capitalize word.     */
Xextern  int     delfword();             /* Delete forward word.         */
Xextern  int     delbword();             /* Delete backward word.        */
Xextern  int     killregion();           /* Kill region.                 */
Xextern  int     copyregion();           /* Copy region to kill buffer.  */
Xextern  int     spawncli();             /* Run CLI in a subjob.         */
Xextern  int     spawn();                /* Run a command in a subjob.   */
Xextern  int     quickexit();            /* low keystroke style exit.    */
Xextern	int	setmode();		/* set an editor mode		*/
Xextern	int	delmode();		/* delete a mode		*/
Xextern	int	gotoline();		/* go to a numbered line	*/
Xextern	int	namebuffer();		/* rename the current buffer	*/
Xextern	int	gotobop();		/* go to begining/paragraph	*/
Xextern	int	gotoeop();		/* go to end/paragraph		*/
Xextern	int	fillpara();		/* fill current paragraph	*/
Xextern	int	help();			/* get the help file here	*/
Xextern	int	deskey();		/* describe a key's binding	*/
Xextern	int	viewfile();		/* find a file in view mode	*/
Xextern	int	insfile();		/* insert a file		*/
Xextern	int	scrnextup();		/* scroll next window back	*/
Xextern	int	scrnextdw();		/* scroll next window down	*/
Xextern	int	bindtokey();		/* bind a function to a key	*/
Xextern	int	unbindkey();		/* unbind a key's function	*/
Xextern	int	namedcmd();		/* execute named command	*/
Xextern	int	desbind();		/* describe bindings		*/
Xextern	int	execcmd();		/* execute a command line	*/
Xextern	int	execbuf();		/* exec commands from a buffer	*/
Xextern	int	execfile();		/* exec commands from a file	*/
X
X#if	V7 & BSD
Xextern	int	bktoshell();		/* suspend emacs to parent shell*/
Xextern	int	rtfrmshell();		/* return from a suspended state*/
X#endif
X
X/*	Name to function binding table
X
X		This table gives the names of all the bindable functions
X	end their C function address. These are used for the bind-to-key
X	function.
X*/
X
XNBIND	names[] = {
X	"add-mode",			setmode,
X	"backward-character",		backchar,
X	"begin-macro",			ctlxlp,
X	"begining-of-file",		gotobob,
X	"begining-of-line",		gotobol,
X	"bind-to-key",			bindtokey,
X	"buffer-position",		showcpos,
X	"case-region-lower",		lowerregion,
X	"case-region-upper",		upperregion,
X	"case-word-capitalize",		capword,
X	"case-word-lower",		lowerword,
X	"case-word-upper",		upperword,
X	"change-file-name",		filename,
X	"clear-and-redraw",		refresh,
X	"copy-region",			copyregion,
X	"delete-blank-lines",		deblank,
X	"delete-buffer",		killbuffer,
X	"delete-mode",			delmode,
X	"delete-next-character",	forwdel,
X	"delete-next-word",		delfword,
X	"delete-other-windows",		onlywind,
X	"delete-previous-character",	backdel,
X	"delete-previous-word",		delbword,
X	"describe-bindings",		desbind,
X	"describe-key",			deskey,
X	"end-macro",			ctlxrp,
X	"end-of-file",			gotoeob,
X	"end-of-line",			gotoeol,
X	"exchange-point-and-mark",	swapmark,
X	"execute-buffer",		execbuf,
X	"execute-command-line",		execcmd,
X	"execute-file",			execfile,
X	"execute-macro",		ctlxe,
X	"execute-named-command",	namedcmd,
X	"exit-emacs",			quit,
X	"fill-paragraph",		fillpara,
X	"find-file",			filefind,
X	"forward-character",		forwchar,
X	"goto-line",			gotoline,
X	"grow-window",			enlargewind,
X	"handle-tab",			tab,
X	"help",				help,
X	"i-shell",			spawncli,
X	"insert-file",			insfile,
X	"kill-region",			killregion,
X	"kill-to-end-of-line",		killtext,
X	"list-buffers",			listbuffers,
X	"move-window-down",		mvdnwind,
X	"move-window-up",		mvupwind,
X	"name-buffer",			namebuffer,
X	"newline",			newline,
X	"newline-and-indent",		indent,
X	"next-line",			forwline,
X	"next-page",			forwpage,
X	"next-paragraph",		gotoeop,
X	"next-window",			nextwind,
X	"next-word",			forwword,
X	"open-line",			openline,
X	"previous-line",		backline,
X	"previous-page",		backpage,
X	"previous-paragraph",		gotobop,
X	"previous-window",		prevwind,
X	"previous-word",		backword,
X	"query-replace-string",		qreplace,
X	"quick-exit",			quickexit,
X	"quote-character",		quote,
X	"read-file",			fileread,
X	"redraw-display",		reposition,
X	"replace-string",		sreplace,
X	"save-file",			filesave,
X	"scroll-next-up",		scrnextup,
X	"scroll-next-down",		scrnextdw,
X	"search-forward",		forwsearch,
X	"search-reverse",		backsearch,
X	"select-buffer",		usebuffer,
X	"set-fill-column",		setfillcol,
X	"set-mark",			setmark,
X	"shell-command",		spawn,
X	"shrink-window",		shrinkwind,
X	"split-current-window",		splitwind,
X#if	V7 & BSD
X	"suspend-emacs",		bktoshell,
X#endif
X	"transpose-characters",		twiddle,
X	"unbind-key",			unbindkey,
X	"view-file",			viewfile,
X	"write-file",			filewrite,
X	"yank",				yank,
X
X	"",			NULL
X};
*-*-END-of-efunc.h-*-*
echo x - epath.h
sed 's/^X//' >epath.h <<'*-*-END-of-epath.h-*-*'
X/*	PATH:	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	".emacsrc"
X	"emacs.hlp",
X	"",
X	":c/",
X	":t/"
X#endif
X
X#if	MSDOS
X	"emacs.rc",
X	"emacs.hlp",
X	"\\sys\\public\\",
X	"\\usr\\bin\\",
X	"\\bin\\",
X	"\\",
X	""
X#endif
X
X#if	V7
X	".emacsrc",
X	"emacs.hlp",
X	"/usr/local/",
X	"/usr/lib/",
X	""
X#endif
X
X#if	VMS
X	"emacs.rc",
X	"emacs.hlp",
X	"",
X	"sys$sysdevice:[vmstools]"
X#endif
X
X	};
X
X#define	NPNAMES	(sizeof(pathname)/sizeof(char *))
*-*-END-of-epath.h-*-*
echo x - estruct.h
sed 's/^X//' >estruct.h <<'*-*-END-of-estruct.h-*-*'
X/*	ESTRUCT:	Structure and preprocesser defined for
X			MicroEMACS 3.2
X
X			written by Dave G. Conroy
X			modified by Steve Wilhite, George Jones
X			greatly modified by Daniel Lawrence
X*/
X
X#undef	LATTICE		/* don't use their definitions...use ours	*/
X#undef	MSDOS
X#undef	CPM
X
X/*	Machine/OS definitions			*/
X
X#define AMIGA   0                       /* AmigaDOS			*/
X#define ST520   0                       /* ST520, TOS                   */
X#define MSDOS   0                       /* MS-DOS                       */
X#define V7      1                       /* V7 UN*X or Coherent or BSD4.2*/
X#define	BSD	0			/* also needed for BSD 4.2	*/
X#define VMS     0                       /* VAX/VMS                      */
X#define CPM     0                       /* CP/M-86                      */
X
X/*	Compiler definitions			*/
X#define MWC86   0
X#define	LATTICE	0
X
X/*	Terminal Output definitions		*/
X
X#define ANSI    0			/* ansi escape sequences	*/
X#define	HP150	0			/* HP150 screen driver		*/
X#define	VMSVT	0			/* various VMS terminal entries	*/
X#define VT52    0                       /* VT52 terminal (Zenith).      */
X#define VT100   0                       /* Handle VT100 style keypad.   */
X#define LK201   0                       /* Handle LK201 style keypad.   */
X#define RAINBOW 0                       /* Use Rainbow fast video.      */
X#define TERMCAP 1                       /* Use TERMCAP                  */
X
X/*	Configuration options	*/
X
X#define CVMVAS  1	/* arguments to page forward/back in pages	*/
X#define	NFWORD	1	/* forward word jumps to begining of word	*/
X#define	CLRMSG	0	/* space clears the message line with no insert	*/
X#define	TYPEAH	1	/* type ahead causes update to be skipped	*/
X#define	FILOCK	0	/* file locking under unix BSD 4.2		*/
X
X/*	internal constants	*/
X
X#define	NBINDS	120			/* 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, line             */
X#define	NSTRING	256			/* # of bytes, string buffers	*/
X#define NKBDM   256                     /* # of strokes, keyboard macro */
X#define NPAT    80                      /* # of bytes, pattern          */
X#define HUGE    1000                    /* Huge number                  */
X#define	NLOCKS	100			/* max # of file locks active	*/
X
X#define AGRAVE  0x60                    /* M- prefix,   Grave (LK201)   */
X#define METACH  0x1B                    /* M- prefix,   Control-[, ESC  */
X#define CTMECH  0x1C                    /* C-M- prefix, Control-\       */
X#define EXITCH  0x1D                    /* Exit level,  Control-]       */
X#define CTRLCH  0x1E                    /* C- prefix,   Control-^       */
X#define HELPCH  0x1F                    /* Help key,    Control-_       */
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#define FALSE   0                       /* False, no, bad, etc.         */
X#define TRUE    1                       /* True, yes, good, etc.        */
X#define ABORT   2                       /* Death, ^G, abort, etc.       */
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	FIOLNG	4			/*line longer than allowed len	*/
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/*
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}       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
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 accosiated 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	char	b_mode;			/* editor mode of this buffer	*/
X        char    b_fname[NFILEN];        /* File name                    */
X        char    b_bname[NBUFN];         /* Buffer name                  */
X}       BUFFER;
X
X#define BFTEMP  0x01                    /* Internal temporary buffer    */
X#define BFCHG   0x02                    /* Changed since last write     */
X
X/*	mode flags	*/
X#define	NUMMODES	5		/* # 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
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        short   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_nrow;                 /* Number of rows.              */
X        short   t_ncol;                 /* Number of columns.           */
X	short	t_margin;		/* min margin for extended lines*/
X	short	t_scrsiz;		/* size of scroll region "	*/
X        int     (*t_open)();            /* Open terminal at the start.  */
X        int     (*t_close)();           /* Close terminal at end.       */
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}       TERM;
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
*-*-END-of-estruct.h-*-*
exit



More information about the Comp.sources.unix mailing list