[comp.sources.misc] memacs 3.8i 3 of 11

allbery@ncoast.UUCP (06/15/87)

:
#!/bin/sh
# shar+ created from directory /usr2/davidsen/emacs38i
# 13:42 on Thu Jun 11, 1987 by davidsen
echo 'x - efunc.h (text)'
sed << 'E!O!F' 's/^X//' > 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*/
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.   */
X#if	BSD
Xextern	int	bktoshell();		/* suspend emacs to parent shell*/
Xextern	int	rtfrmshell();		/* return from a suspended state*/
X#endif
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	*/
X#if	WORDPRO
Xextern	int	gotobop();		/* go to beginning/paragraph	*/
Xextern	int	gotoeop();		/* go to end/paragraph		*/
Xextern	int	fillpara();		/* fill current paragraph	*/
X#endif
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	*/
Xextern	int	nextbuffer();		/* switch to the next buffer	*/
X#if	WORDPRO
Xextern	int	killpara();		/* kill the current paragraph	*/
X#endif
Xextern	int	setgmode();		/* set a global mode		*/
Xextern	int	delgmode();		/* delete a global mode		*/
Xextern	int	insspace();		/* insert a space forword	*/
Xextern	int	forwhunt();		/* hunt forward for next match	*/
Xextern	int	backhunt();		/* hunt backwards for next match*/
Xextern	int	pipecmd();		/* pipe command into buffer	*/
Xextern	int	filter();		/* filter buffer through dos	*/
Xextern	int	delwind();		/* delete the current window	*/
Xextern	int	cbuf1();		/* execute numbered comd buffer */
Xextern	int	cbuf2();
Xextern	int	cbuf3();
Xextern	int	cbuf4();
Xextern	int	cbuf5();
Xextern	int	cbuf6();
Xextern	int	cbuf7();
Xextern	int	cbuf8();
Xextern	int	cbuf9();
Xextern	int	cbuf10();
Xextern	int	cbuf11();
Xextern	int	cbuf12();
Xextern	int	cbuf13();
Xextern	int	cbuf14();
Xextern	int	cbuf15();
Xextern	int	cbuf16();
Xextern	int	cbuf17();
Xextern	int	cbuf18();
Xextern	int	cbuf19();
Xextern	int	cbuf20();
Xextern	int	cbuf21();
Xextern	int	cbuf22();
Xextern	int	cbuf23();
Xextern	int	cbuf24();
Xextern	int	cbuf25();
Xextern	int	cbuf26();
Xextern	int	cbuf27();
Xextern	int	cbuf28();
Xextern	int	cbuf29();
Xextern	int	cbuf30();
Xextern	int	cbuf31();
Xextern	int	cbuf32();
Xextern	int	cbuf33();
Xextern	int	cbuf34();
Xextern	int	cbuf35();
Xextern	int	cbuf36();
Xextern	int	cbuf37();
Xextern	int	cbuf38();
Xextern	int	cbuf39();
Xextern	int	cbuf40();
Xextern	int	storemac();		/* store text for macro		*/
Xextern	int	resize();		/* resize current window	*/
Xextern	int	clrmes();		/* clear the message line	*/
Xextern	int	meta();			/* meta prefix dummy function	*/
Xextern	int	cex();			/* ^X prefix dummy function	*/
Xextern	int	unarg();		/* ^U repeat arg dummy function	*/
Xextern	int	istring();		/* insert string in text	*/
Xextern	int	unmark();		/* unmark current buffer	*/
X#if	ISRCH
Xextern	int	fisearch();		/* forward incremental search	*/
Xextern	int	risearch();		/* reverse incremental search	*/
X#endif
X#if	WORDPRO
Xextern	int	wordcount();		/* count words in region	*/
X#endif
Xextern	int	savewnd();		/* save current window		*/
Xextern	int	restwnd();		/* restore current window	*/
Xextern	int	upscreen();		/* force screen update		*/
Xextern	int	writemsg();		/* write text on message line	*/
X#if	FLABEL
Xextern	int	fnclabel();		/* set function key label	*/
X#endif
X#if	APROP
Xextern	int	apro();			/* apropos fuction		*/
X#endif
X#if	CRYPT
Xextern	int	setkey();		/* set encryption key		*/
X#endif
Xextern	int	wrapword();		/* wordwrap function		*/
X#if	CFENCE
Xextern	int	getfence();		/* move cursor to a matching fence */
X#endif
Xextern	int	newsize();		/* change the current screen size */
Xextern	int	setvar();		/* set a variables value */
Xextern	int	newwidth();		/* change the current screen width */
X#if	AEDIT
Xextern	int	trim();			/* trim whitespace from end of line */
Xextern	int	detab();		/* detab rest of line */
Xextern	int	entab();		/* entab rest of line */
X#endif
X#if	PROC
Xextern	int	storeproc();		/* store names procedure */
Xextern	int	execproc();		/* execute procedure */
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	{"abort-command",		ctrlg},
X	{"add-mode",			setmode},
X	{"add-global-mode",		setgmode},
X#if	APROP
X	{"apropos",			apro},
X#endif
X	{"backward-character",		backchar},
X	{"begin-macro",			ctlxlp},
X	{"beginning-of-file",		gotobob},
X	{"beginning-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	{"change-screen-size",		newsize},
X	{"change-screen-width",		newwidth},
X	{"clear-and-redraw",		refresh},
X	{"clear-message-line",		clrmes},
X	{"copy-region",			copyregion},
X#if	WORDPRO
X	{"count-words",			wordcount},
X#endif
X	{"ctlx-prefix",			cex},
X	{"delete-blank-lines",		deblank},
X	{"delete-buffer",		killbuffer},
X	{"delete-mode",			delmode},
X	{"delete-global-mode",		delgmode},
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	{"delete-window",		delwind},
X	{"describe-bindings",		desbind},
X	{"describe-key",		deskey},
X#if	AEDIT
X	{"detab-line",			detab},
X#endif
X	{"end-macro",			ctlxrp},
X	{"end-of-file",			gotoeob},
X	{"end-of-line",			gotoeol},
X#if	AEDIT
X	{"entab-line",			entab},
X#endif
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-macro-1",		cbuf1},
X	{"execute-macro-2",		cbuf2},
X	{"execute-macro-3",		cbuf3},
X	{"execute-macro-4",		cbuf4},
X	{"execute-macro-5",		cbuf5},
X	{"execute-macro-6",		cbuf6},
X	{"execute-macro-7",		cbuf7},
X	{"execute-macro-8",		cbuf8},
X	{"execute-macro-9",		cbuf9},
X	{"execute-macro-10",		cbuf10},
X	{"execute-macro-11",		cbuf11},
X	{"execute-macro-12",		cbuf12},
X	{"execute-macro-13",		cbuf13},
X	{"execute-macro-14",		cbuf14},
X	{"execute-macro-15",		cbuf15},
X	{"execute-macro-16",		cbuf16},
X	{"execute-macro-17",		cbuf17},
X	{"execute-macro-18",		cbuf18},
X	{"execute-macro-19",		cbuf19},
X	{"execute-macro-20",		cbuf20},
X	{"execute-macro-21",		cbuf21},
X	{"execute-macro-22",		cbuf22},
X	{"execute-macro-23",		cbuf23},
X	{"execute-macro-24",		cbuf24},
X	{"execute-macro-25",		cbuf25},
X	{"execute-macro-26",		cbuf26},
X	{"execute-macro-27",		cbuf27},
X	{"execute-macro-28",		cbuf28},
X	{"execute-macro-29",		cbuf29},
X	{"execute-macro-30",		cbuf30},
X	{"execute-macro-31",		cbuf31},
X	{"execute-macro-32",		cbuf32},
X	{"execute-macro-33",		cbuf33},
X	{"execute-macro-34",		cbuf34},
X	{"execute-macro-35",		cbuf35},
X	{"execute-macro-36",		cbuf36},
X	{"execute-macro-37",		cbuf37},
X	{"execute-macro-38",		cbuf38},
X	{"execute-macro-39",		cbuf39},
X	{"execute-macro-40",		cbuf40},
X	{"execute-named-command",	namedcmd},
X#if	PROC
X	{"execute-procedure",		execproc},
X#endif
X	{"exit-emacs",			quit},
X#if	WORDPRO
X	{"fill-paragraph",		fillpara},
X#endif
X	{"filter-buffer",		filter},
X	{"find-file",			filefind},
X	{"forward-character",		forwchar},
X	{"goto-line",			gotoline},
X#if	CFENCE
X	{"goto-matching-fence",		getfence},
X#endif
X	{"grow-window",			enlargewind},
X	{"handle-tab",			tab},
X	{"hunt-forward",		forwhunt},
X	{"hunt-backward",		backhunt},
X	{"help",			help},
X	{"i-shell",			spawncli},
X#if	ISRCH
X	{"incremental-search",		fisearch},
X#endif
X	{"insert-file",			insfile},
X	{"insert-space",		insspace},
X	{"insert-string",		istring},
X#if	WORDPRO
X	{"kill-paragraph",		killpara},
X#endif
X	{"kill-region",			killregion},
X	{"kill-to-end-of-line",		killtext},
X#if	FLABEL
X	{"label-function-key",		fnclabel},
X#endif
X	{"list-buffers",		listbuffers},
X	{"meta-prefix",			meta},
X	{"move-window-down",		mvdnwind},
X	{"move-window-up",		mvupwind},
X	{"name-buffer",			namebuffer},
X	{"newline",			newline},
X	{"newline-and-indent",		indent},
X	{"next-buffer",			nextbuffer},
X	{"next-line",			forwline},
X	{"next-page",			forwpage},
X#if	WORDPRO
X	{"next-paragraph",		gotoeop},
X#endif
X	{"next-window",			nextwind},
X	{"next-word",			forwword},
X	{"open-line",			openline},
X	{"pipe-command",		pipecmd},
X	{"previous-line",		backline},
X	{"previous-page",		backpage},
X#if	WORDPRO
X	{"previous-paragraph",		gotobop},
X#endif
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	{"resize-window",		resize},
X	{"restore-window",		restwnd},
X	{"replace-string",		sreplace},
X#if	ISRCH
X	{"reverse-incremental-search",	risearch},
X#endif
X#if	PROC
X	{"run",				execproc},
X#endif
X	{"save-file",			filesave},
X	{"save-window",			savewnd},
X	{"scroll-next-up",		scrnextup},
X	{"scroll-next-down",		scrnextdw},
X	{"search-forward",		forwsearch},
X	{"search-reverse",		backsearch},
X	{"select-buffer",		usebuffer},
X	{"set",				setvar},
X#if	CRYPT
X	{"set-encryption-key",		setkey},
X#endif
X	{"set-fill-column",		setfillcol},
X	{"set-mark",			setmark},
X	{"shell-command",		spawn},
X	{"shrink-window",		shrinkwind},
X	{"split-current-window",	splitwind},
X	{"store-macro",			storemac},
X#if	PROC
X	{"store-procedure",		storeproc},
X#endif
X#if	BSD
X	{"suspend-emacs",		bktoshell},
X#endif
X	{"transpose-characters",	twiddle},
X#if	AEDIT
X	{"trim-line",			trim},
X#endif
X	{"unbind-key",			unbindkey},
X	{"universal-argument",		unarg},
X	{"unmark-buffer",		unmark},
X	{"update-screen",		upscreen},
X	{"view-file",			viewfile},
X	{"wrap-word",			wrapword},
X	{"write-file",			filewrite},
X	{"write-message",		writemsg},
X	{"yank",			yank},
X
X	{"",			NULL}
X};
E!O!F
newsize=`wc -c < efunc.h`
if [ $newsize -ne 15264 ]
then echo "File efunc.h was $newsize bytes, 15264 expected"
fi
echo 'x - emacs.hlp (text)'
sed << 'E!O!F' 's/^X//' > emacs.hlp
X=>		MicroEMACS 3.8 Help screens		(01/18/87)
X
X	M-  means to use the <ESC> key prior to using another key
X	^A  means to use the control key at the same time as the A key
X
X^V or [Pg Dn]     Scroll down		M-< or <HOME>	Begining of file
X^Z or [Pg Up]     Scroll up		M-> or <END>	End of file
X
X-----------------------------------------------------------------------
X=>		(1) MOVING THE CURSOR
X
X^F  Forward character   M-F    Forward word		Keypad arrows
X^B  Backward character  M-B    Backward word		are active!
X^A  Front of line	M-G    Goto a line
X^E  End of line		
X^N  Next line		M-N    Front of paragraph
X^P  Previous line	M-P    End of paragraph
X-----------------------------------------------------------------------
X=>		(2) DELETING & INSERTING
X
X<--             Delete previous character
X^D or <DELETE>  Delete next character
X^C or <INSERT>  Insert a space
XM-<--           Delete previous word
XM-D             Delete next word
X^K              Close (delete) to end of line
X-----------------------------------------------------------------------
X=>		(2a) MORE DELETING & INSERTING
X
X<RETURN>   Insert a newline             <TAB>  Advance to next tab stop
X^J         Insert a newline and indent  M-^W   Delete paragraph
X^O         Open (insert) line
X^W         Delete region between mark (set using M-<spacebar>) and cursor
XM-W        Copy region to kill buffer
X^X ^O      Delete blank lines around cursor
X-----------------------------------------------------------------------
X=>		(3) SEARCHING
X
X^S	Search forward from cursor position.
X^R	Reverse search from cursor position.
X^X S	Forward incremental search
X^X R	Reverse incremental search
X<ALT> S	Search for the next occurence of the last string (IBM-PC only)
X<ALT> R	Search for the last occurence of the last string (IBM-PC only)
X-----------------------------------------------------------------------
X=>		(4) REPLACING
X
XM-R   Replace all instances of first typed-in string with second
X          typed-in string.  End each string with ESC.
XM-^R  Replace with query.  Answer with:
X	^G  cancel			.   exit to entry point
X	!   replace the rest		Y    replace & continue
X	?   Get a list of options	N   no replacement & continue
X-----------------------------------------------------------------------
X=>		(5) CAPITALIZING & TRANSPOSING
X
XM-U	UPPERCASE word
XM-C	Capitalize word		^T	Transpose characters
XM-L	lowercase word
X^X ^L	lowercase region
X^X ^U	uppercase region
X^Q	Quote next entry, so that control codes may be entered into text
X-----------------------------------------------------------------------
X=>		(6) REGIONS & THE KILL BUFFER
X
XM-<spacebar>	set MARK at current position
X^X ^X		eXchange mark and cursor
X
XA REGION will then be continuously-defined as the area between the mark and
Xthe current cursor position.  The KILL BUFFER is the text which has been
Xmost recently saved or deleted.
X-----------------------------------------------------------------------
X=>		(7) COPYING AND MOVING
X
X^W  Delete (Wipe) region		M-W	copy region to KILL buffer
X^Y  Yankback save buffer at cursor
XGenerally, the procedure for copying or moving text is:
X    1)  Mark a REGION using M-<spacebar> at beginning and cursor at end.
X    2)  Delete it (with ^W) or copy it (with M-W) into the KILL buffer.
X    3)  Move the cursor to the desired location and yank it back (with ^Y).
X-----------------------------------------------------------------------
X=>		(8) MODES OF OPERATION
X^X M	Add mode in buffer              M-M    Add global mode
X^X ^M   Delete mode in buffer           M-^M   Delete global mode
XOVER		Replaces (overwrites) rather than inserts characters
XWRAP		Turns on word wrap (automatic carraige return).
XVIEW		Allows viewing file without insertion and deletion.
XCMODE		Automatic indenting for C program entry
XEXACT/MAGIC	Changes how search and replace commands work (see next page)
X-----------------------------------------------------------------------
X=>		(9) SEARCH AND REPLACE MODES
X
XEXACT	Uppper/lower case is not ignored in searches
XMAGIC   Regular pattern matching characters are active
X    .   Matches any one character
X    *   Matches any any number of the preceding character
X    ^   Beginning of line        [ ]   Character class enclosure
X    $   End of line              \     Quote next character
X-----------------------------------------------------------------------
X=>		(10) ON-SCREEN FORMATTING
X
X^X F		Set fill column
XMn-<tab>	Set tab spacing to n charecters between tabs stops
XM-Q		Format paragraph so that text lies between margins
X^X =		Position report -- displays line number, char count,
X                                   file size and character under cursor
XM-^C		Count words/lines/chars in marked region
X-----------------------------------------------------------------------
X=>		(11) MULTIPLE WINDOWS
X
XMany WINDOWS may be active at once on the screen.  All windows may show
Xdifferent parts of the same buffer, or each may display a different one.
X^X 2	Split the current window in two	^X O	Change to next window
X^X 0    delete current window           ^X P    Change to previous window
X^X 1	delete all other windows        M-^V    Page down next window
X                                  	M-^Z	Page up other window
X-----------------------------------------------------------------------
X=>		(12) CONTROLLING WINDOWS AND THE SCREEN
X
X^X ^    Enlarge current window   M-<n> ^X W   Resize window to <n> lines
X^X ^Z   Shrink current window    M-<n> M-S    Change screen to <n> lines
X^X ^N   Move window down         M-<n> M-T    Change screen to <n> columns
X^X ^P   Move window up
XM-^L    Reposition window
X^L      Refresh the screen
X-----------------------------------------------------------------------
X=>		(13) MULTIPLE BUFFERS
XA BUFFER is a named area containing a document being edited.  Many buffers
Xmay be activated at once.
X^X B	Switch to another buffer.  <CR> = use just-previous buffer
X^X X	Switch to next buffer in buffer list
XM-^N    Change name of current buffer
X^X K	Delete a non-displayed buffer.
X^X ^B	Display buffer directory in a window
X-----------------------------------------------------------------------
X=>		(14) READING FROM DISK
X
X^X ^F	Find file; read into a new buffer created from filename.
X	(This is the usual way to begin editing a new file.)
X^X ^R	Read file into current buffer, erasing its previous contents.
X	No new buffer will be created.
X^X ^I	Insert file into current buffer at cursor's location.
X^X ^V	Find a file to make current in VIEW mode
X-----------------------------------------------------------------------
X=>		(15) SAVING TO DISK
X
X^X ^S	Save current buffer to disk
X^X ^W	Write current buffer to disk
X^X N    Change file name of current buffer
XM-Z	Write out all changed buffers and exit MicroEMACS
X
X
X-----------------------------------------------------------------------
X=>		(16) ACCESSING THE OPERATING SYSTEM
X
X^X !	Send one command to the operating system and return
X^X @	Pipe DOS command results to buffer
X^X #	Filter buffer through DOS filter program
X^X C	Start a new command processor under MicroEMACS
X^X D	Suspend MicroEMACS into the background (UNIX BSD4.2 only)
X^X ^C	Exit MicroEMACS
X-----------------------------------------------------------------------
X=>		(17) KEY BINDINGS AND COMMANDS
X
XM-K	Bind a key to a command        M-A  Describe a class of commands
XM-^K	Unbind a key from a command
X^X ?	Describe command bound to a key
XM-X	Execute a named (and possibly unbound) command
X{Describe-bindings}
X	Display a list of all commands and key bindings to a buffer
X-----------------------------------------------------------------------
X=>		(18) COMMAND EXECUTION
XCommands can be specified as command lines in the form:
X	<optional repeat count> {command-name} <optional arguments>
X{Execute-command-line}	execute a typed in command line
X{Execute-buffer}	executes commands lines in a buffer
X{Execute-file}		executes command lines from a file
X{clear-message-line}	clears the message line during execution
X   M-~			clears the change flag for a buffer
X-----------------------------------------------------------------------
X=>		(19) MACRO EXECUTION
X
X^X (	Start recording keyboard macro
X^X )	Stop recording keyboard macro
X^X E	Execute keyboard macro
XM-<n> {store-macro}	Start recording named macro
X      !endm		Stop recording named macro
X{execute-macro-n}	Execute macro n (where n is from 1 to 20)
X-----------------------------------------------------------------------
X=>		(20) SPECIAL KEYS
X
X^G		Cancel current command and return to top level of processing.
X^U or		Universal repeat.  May be followed by an integer (default = 4)
XM-<digit>	and repeats the next command that many times.
XM-X		Execute a named (and possibly unbound) command
X
X
E!O!F
newsize=`wc -c < emacs.hlp`
if [ $newsize -ne 8644 ]
then echo "File emacs.hlp was $newsize bytes, 8644 expected"
fi
echo 'x - emacs.rc (text)'
sed << 'E!O!F' 's/^X//' > emacs.rc
X;	EMACS.RC:	Startup file for MicroEMACS 3.8
X;
X;			This file is executed everytime the
X;			editor is entered
X
Xset $discmd "FALSE"
Xwrite-message "[Setting up....]"
X
X; If you screen "SNOWS", uncomment this line
X;	set $flicker "TRUE"
X
X; If you are on an IBM-PC EGA card and want to force the
X; screen to EGA mode, uncomment the following line
X;	set $sres "EGA"
X
X;	***** Rebind the Function key group
X
Xbind-to-key search-forward		FN;
Xbind-to-key search-reverse		FN<
Xbind-to-key hunt-forward		FN=
Xbind-to-key hunt-backward		FN>
Xbind-to-key next-window			FN?
Xbind-to-key execute-macro		FN@
Xbind-to-key find-file			FNA
Xbind-to-key execute-file		FNB
Xbind-to-key save-file			FNC
Xbind-to-key exit-emacs			FND
X
Xbind-to-key apropos			FNV
Xbind-to-key describe-key		FNW
Xbind-to-key fill-paragraph		FNX
Xbind-to-key shell-command		FN\
Xbind-to-key i-shell			FN]
X
X;	set screen colors
Xadd-global-mode "blue"
X
X;	toggle function key window off
X1 store-macro
X	save-window
X	1 next-window
X	!if &sequal "Function Keys" $cbufname
X		delete-window
X	!endif
X	bind-to-key execute-macro-14 FNT
X!force	restore-window
X	write-message "[Function key window OFF]"
X!endm
X
X;	toggle function key window back on
X14 store-macro
X	1 next-window
X	!if &sequal $cbufname "emacs.hlp"
X		execute-macro-11
X	!endif
X	!if &not &sequal $cbufname "Function Keys"
X		1 split-current-window
X		select-buffer "Function Keys"
X		add-mode "red"
X!force		5 resize-window
X		beginning-of-file
X	!endif
X	bind-to-key execute-macro-1 FNT
X	2 next-window
X	write-message "[Function key window ON]"
X!endm
X
X;	Enter Help
X2 store-macro
X	1 next-window		;Make sure the function key window isn't up!
X	!if &sequal $cbufname "Function Keys"
X		delete-window
X		bind-to-key execute-macro-14 FNT
X	!endif
X	help
X	8 resize-window
X	bind-to-key execute-macro-12 FNI
X	bind-to-key execute-macro-13 FNQ
X	bind-to-key execute-macro-11 FNU
X	bind-to-key execute-macro-15 ^XO
X	bind-to-key execute-macro-15 ^XP
X	bind-to-key execute-macro-15 FN?
X	add-mode "red"
X	beginning-of-file
X	2 forward-character
X	clear-message-line
X!endm
X
X;	Exit Help
X11 store-macro
X	bind-to-key previous-page FNI
X	bind-to-key next-page FNQ
X	bind-to-key execute-macro-2 FNU
X	bind-to-key next-window ^XO
X	bind-to-key previous-window ^XP
X	bind-to-key next-window FN?
X	delete-window
X	clear-message-line
X!endm
X
X;	don't allow these commands from within the HELP screen
X15	store-macro
X	write-message "[Use F2 to exit HELP]"
X!endm
X
X;	last help page
X12 store-macro
X	beginning-of-line
X	search-reverse "=>"
X	1 redraw-display
X!endm
X
X;	next help page
X13 store-macro
X	beginning-of-line
X	2 forward-character
X	search-forward "=>"
X	1 redraw-display
X!endm
X
X;	reformat indented paragraph
X
X6 store-macro
X	write-message "                    [Fixing paragraph]"
X	set $discmd "FALSE"
X	kill-region
X	2 split-current-window
X	select-buffer "[temp]"
X	yank
X	beginning-of-file
X	replace-string "~n	" "~n"
X	66 set-fill-column
X	fill-paragraph
X	77 set-fill-column
X	beginning-of-file
X	handle-tab
X	replace-string ~n "~n	"
X	end-of-file
X	2 delete-previous-character
X	beginning-of-file
X	set-mark
X	end-of-file
X	kill-region
X	unmark-buffer
X	delete-window
X	yank
X	delete-buffer "[temp]"
X	set $discmd "TRUE"
X	write-message "                    [Fixed paragraph]"
X!endm
X
X;	indent region
X
X7 store-macro
X	write-message "                    [Indenting region]"
X	kill-region
X	2 split-current-window
X	select-buffer "[temp]"
X	yank
X	beginning-of-file
X	handle-tab
X	replace-string "~n" "~n	"
X	end-of-file
X	4 delete-previous-character
X	beginning-of-file
X	set-mark
X	write-message "                    [Indenting region]"
X	end-of-file
X	kill-region
X	unmark-buffer
X	delete-window
X	yank
X	delete-buffer "[temp]"
X	write-message "                    [Region Indented]"
X!endm
X
X;	undent region
X
X8 store-macro
X	write-message "                    [Undenting region]"
X	kill-region
X	2 split-current-window
X	select-buffer "[temp]"
X	yank
X	beginning-of-file
X	delete-next-character
X	replace-string "~n	" "~n"
X	end-of-file
X	2 delete-previous-character
X	beginning-of-file
X	set-mark
X	write-message "                    [Undenting region]"
X	end-of-file
X	kill-region
X	unmark-buffer
X	delete-window
X	yank
X	delete-buffer "[temp]"
X	write-message "                    [Region undented]"
X!endm
X
X;	bring up the function key window
X
X	1 split-current-window
X	select-buffer "Function Keys"
X	add-mode "red"
X	5 resize-window
X	insert-string "f1 search      f2 search back | F1 toggle function list F2 toggle help file~n"
X	insert-string "f3 hunt        f4 hunt back   | F3 find command/apropos F4 describe key~n"
X	insert-string "f5 next window f6 exec macro  | F5 reformat paragraph   F6 ref undented region~n"
X	insert-string "f7 find file   f8 exec file   | F7 indent region        F8 undent region~n"
X	insert-string "f9 save file  f10 exit emacs  | F9 execute DOS command F10 shell up~n"
X	beginning-of-file
X	unmark-buffer
X	next-window
X	set $discmd "TRUE"
X	write-message "[Emacs is READY]"
E!O!F
newsize=`wc -c < emacs.rc`
if [ $newsize -ne 4869 ]
then echo "File emacs.rc was $newsize bytes, 4869 expected"
fi
echo 'x - epath.h (text)'
sed << 'E!O!F' 's/^X//' > 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{
X	".emacsrc",
X	"emacs.hlp",
X	"",
X	":c/",
X	":t/"
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 *))
E!O!F
newsize=`wc -c < epath.h`
if [ $newsize -ne 780 ]
then echo "File epath.h was $newsize bytes, 780 expected"
fi
echo 'x - estruct.h (text)'
sed << 'E!O!F' 's/^X//' > estruct.h
X/*	ESTRUCT:	Structure and preprocesser defined for
X			MicroEMACS 3.8
X
X			written by Dave G. Conroy
X			modified by Steve Wilhite, George Jones
X			greatly 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
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.8i"
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      0                       /* V7 UNIX or Coherent or BSD4.2*/
X#define	BSD	0			/* UNIX BSD 4.2	and ULTRIX	*/
X#define	USG	1			/* 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 MWC86   0	/* marc williams compiler */
X#define	LATTICE	0	/* Lattice 2.14 thruough 3.0 compilers */
X#define	AZTEC	0	/* Aztec C 3.20e */
X#define	MSC	0	/* MicroSoft C compile version 3 & 4 */
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 
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 VT100   0                       /* Handle VT100 style keypad.   */
X#define RAINBOW 0                       /* Use Rainbow fast video.      */
X#define TERMCAP 1                       /* Use TERMCAP                  */
X#define	IBMPC	0			/* 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	NFWORD	1	/* forward word jumps to beginning of word	*/
X#define	CLRMSG	0	/* space clears the message line with no insert	*/
X#define	ACMODE	0	/* auto CMODE on .C and .H files		*/
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
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:
X			   en/detabbing, rectangular regions [later]	*/
X#define	PROC	1	/* named procedures				*/
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	AZTEC
X#undef	fputc
X#undef	fgetc
X#if	MSDOS
X#define	fgetc	a1getc
X#else
X#define	fgetc	agetc
X#endif
X#define	fputc	aputc
X#define	int86	sysint
X#define	intdos(a, b)	sysint(33, a, b)
X#define	inp	inportb
X#define	outp	outportb
X
Xstruct XREG {
X	int ax,bx,cx,dx,si,di;
X};
X
Xstruct HREG {
X	char al,ah,bl,bh,cl,ch,dl,dh;
X};
X
Xunion REGS {
X	struct XREG x;
X	struct HREG h;
X};
X#endif
X
X#if	MSDOS & MWC86
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 memory mapped flag	*/
X
X#define	MEMMAP	0
X
X#if	IBMPC
X#undef	MEMMAP
X#define	MEMMAP	1
X#endif
X
X#if	Z309
X#undef	MEMMAP
X#define	MEMMAP	1
X#endif
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#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#define	RET	4			/* a return from buffer		*/
X#define	GOLINE	5			/* exit flagging a GOTO		*/
X
X#define	STOP	0			/* keyboard macro not in use	*/
X#define	PLAY	1			/*		  playing	*/
X#define	RECORD	2			/*		  recording	*/
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	FIOLNG	4			/* line longer than allowed len	*/
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/*
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
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
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/*
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/*
X * Defines for the metacharacters in the regular expressions in search
X * routines.
X */
X
X#define	MCNIL		0	/* Like the '\0' for strings.*/
X#define	LITCHAR		1
X#define	ANY		2
X#define	CCL		3
X#define	NCCL		4
X#define	BOL		5
X#define	EOL		6
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
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
X#define	HICHAR		256
X#define	HIBYTE		HICHAR >> 3
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#endif
X
E!O!F
newsize=`wc -c < estruct.h`
if [ $newsize -ne 20240 ]
then echo "File estruct.h was $newsize bytes, 20240 expected"
fi
	bill davidsen		(wedu@ge-crd.arpa)
  {chinet | philabs | sesimo}!steinmetz!crdos1!davidsen
"Stupidity, like virtue, is its own reward" -me