lawrence@duncan.UUCP (03/18/86)
Greetings, Not to confuse matters, but below is a posting of another version of MicroEMACS (3.5) which I have been working on for several months. It is a shell arcive file and as such should be split up on a UNIX system. If this causes problems for many, mail me and I can repost it differently. Read the README file for the new goodies, there are a lot. Also since I use this so heavaly on different machines I will be willing to maintain it. have fun! Dan Lawrence ihnp4!pur-ee!pur-phy!duncan!lawrence ----------------cut here-------------------------------------------- echo x - readme sed 's/^X//' >readme <<'*-*-END-of-readme-*-*' X MicroEMACS 3.5 X X This version of MicroEMACS is based on the version written by XDave G. Conroy, and latter modified by Steve Wilhite and George Jones. XMy thanks goes to them for writting such nice, well structured and Xdocumented code. It is nice to see that there are some people out there Xwho know how to program well. X X I intend to continue to maintain this version and will consider Xadding features and supported machines on request. Current hardware Xsupported includes: X X IBM-PC under PCDOS/MSDOS and many compatibles X Dec Rainbow X Commodore Amiga X Unix V7 X Unix and Multix BSD 4.2 X Hewlett Packard 150 and various upgrades X XFeatures added to MicroEMACS since version 2.0 include: X X- Meta repeat codes X X Striking the <ESC> key followed by a numeric argument (possibly Xwith a leading minus sign) passes an argument down to a command which is Xusually used as a repeat count. This is similar to the ^U command, but Xthere is no default value. X X- Change in repositioning command X X The command to reposition the cursor now repositions it, by Xdefault, to the center of the current window, rather than the first line Xof the window. This I think is much more usefull and also consistant Xwith many other emacs'. X X- File writting message.... X X For those of us with big files, when you start a write of a file Xto disk, the message [Writing..] now appears. This is so we know the Xmachine is really still there. (Paranoids Ahead!) X X- Search strings now can have <NL>s in them X X It is very usefull to be able to have newlines in search and Xreplace strings. To do this, all text input to searching commands is now Xterminated by an <ESC>. X X- Replace!!!!! X X Yes, now we can replace as well as search. There are two flavors Xof this command. <ESC> R allows us to replace each occurence of a string Xwith another string from the current point to the end of the file. X<ESC> ^R also queries us at each string to see if we want to replace it. XTyping a question mark here will display the options. X X- Yes/no responces X X no longer require (or want) a return typed after them. X X- Spawning X X Fixed up some MSDOS spawning messages. WARNING: If you have your Xswitchchar set to a '-' instead of a '/' Lattice C may have problems Xwhen yanking up a new command processer. It will use a line like XCOMMAND /C <command line>. You may have to rewrite this library function Xto get it to work on your system properly. X X- Suspend MicroEMACS X X Under Unix BSD 4.2 we now have code to put the editor into the Xbackground and return to the parent shell. This is initially bound to Xthe ^X D keys. X X- Function keys X X Under MSDOS on IBM-PCs and compatibles, the function keys and Xcursor arrows now do what one would expect them to. There is a new Xprefix in the editor to accodate this. (Look in MAIN.C for this) This Xcan be used to add function key support to most any machine by adding a Xsmall piece of code to reconize the keys in the getkey() routine in Xmain.c, and adding the new definitions to the ebind.h header file. For XMSDOS and the HP150, the describe-key command can be used to find out Xwhat the code for a particular key is. X X- Abort (^G) X X now prints out [Aborted] on the command line so you know what Xhappened. X X- Editor Modes X X Buffers now have modes associated with them. These modes can be Xset with the set-mode (^X M) and the delete-mode (^X ^M) commands. X X- CMODE mode X X When a file is read in with a .c or .h extention, CMODE is set Xfor that buffer. (This can also be manually set/deleted[see above]) In XCMODE, MicroEMACS attemts to be intelligent about doing automatic Xindentation for you. It will indent any line the same as the privious Xline unless the last line ended with a brace ({). Then it will indent an Xextra tab stop (which varies depending on how tabs are set). Any lines Xbegining with a close brace (}) will by undented one tab stop if possible. X X- WRAP mode X X This mode automatically wraps words onto the next line when the Xword extends beyond the current fill column. X X- VIEW mode X X This mode disables all commands that can change the current buffer. X X- EXACT mode X X Normally all searches are done ignoring case. With this mode Xset, only strings which exactly match the search string, including case, Xare matched. X X- GOTO line command X X The goto-line (<ESC> G) command will go to a specific line Xnumber of the file. For example to go to the 76th line of a file, type: X X <ESC> 76 <ESC> G X X- Rename buffer X X The command rename-buffer (<ESC> ^N) allows you to change the Xname of the current buffer. X X- Paragraph movement X X The forward-paragraph (<ESC> N) and previous-paragraph (<ESC> P) Xcommands allow movement from one paragraph to another. X X- nasty algorith fixed.... X X A rather nasty algorithm in the kill buffer processing got Xrewritten which ends up reducing the speed neeeded to wipe large areas Ximmensly. This may have appeared to lock up the machine on the older Xversions when a large wipe was attempted. X X- Header files rearranged X X ESTRUCT.H Structure and option declarations X EDEF.H Global and external variable declarations X EPATH.H Help and startup file paths X EFUNC.H Name binding table X EBIND.H Initial key binding tables X X- Paragraph filling!! X X The fill-paragraph (<ESC> Q) command reformats the current Xparagraph filling to the fill column as possible. Very handy.... X X- Long lines X X Lines longer than the screen now scroll right-left as you move Xthrough them. Seeing what your editing is a big improvement. X X- word move and deletes X X Due to massive demand by my users here, I have changed the way Xword move and delete work so that they are more consistant and usefull. XBut this change is configurable by changing the value of the NFWORD Xconstant in ESTRUCT.H X X- View flag on command line X X -v on the command line causes the editor to read a file in with XVIEW mode set on. -e (edit) is the opposite causing it to read in for Xediting (which is also the default). X X- Quick EXIT has done a quick change.... X X (sorry....) Quick-exit now writes out all changed buffers before Xexiting. X X- Very long file lines X X Very long lines (>255 chars) being read from a file now get Xwrapped on multiple lines (instead of simple refusing to read any more Xof the file as before) The user is warned about them with a message at Xthe end of the read. X X- Space not clearing messages X X Many of my users complained about the space not inserting itself Xafter a message (it just cleared the message line). This is now Xconfiguable in ESTRUCT.H X X- HELP commands! X X the describe-key (^X ?) command allows the user to type in one Xcommand and the editor echos back the command name bound to that key. XThe help (<ESC> ?) command grabs the top window (or splits if if not Xthere) and reads in the EMACS.HLP file. The list of places to look for Xthe help file are in EPATH.H X X- View file command X X View-file (^X ^V) is the same as find-file (old visit-file) Xexcept it leaves the found file in VIEW mode. X X- Improved updating X X On the systems that code has been written for, the screen update Xroutines will defer updating if there is type ahead present. This makes Xall movement commands much more pleasant. The code for this is in the Xfunction typahead() in TERMIO.C. This is currently implimented for XMSDOS, BSD4.2 and possible the AMIGA (Some one please check this out. I Xonly have limited access to an AMIGA) X X- Buffer lists X X are now alphabetically maintained. X X- Insert file X X Insert-file (^X ^I) allows you to insert the contents of a file Xat the current position of the current buffer. very useful X X- Scroll next window X X Scroll-next-down (<ESC> ^V) and scroll-next-up (<ESC> ^Z) allow Xyou to scroll the next window up and down by pages. X X- Arguments to searches X X All searches and replaces now take a preceding numeric argument Xto say how many times, rather than all the way to the bottom of the Xfile. X X- Binding keys X X The bind-to-key (^C) function allows you to change what Xcommand a key invokes. It will promt you for a command name, and then a Xkeystroke sequence. This is happy. Unbind-key (<ESC> ^C) allows you to Xmake a key now longer have a function. (This is good when you accidently Xbind <RET> or a letter to something) X X- Execute named command X X Will prompt you for a command name, and then execute it. This Xallows you to execute commands that are not currently bound to any keys. X X- Command name completion X X Any time you are prompted for a command, if you type in part of Xit and hit the space bar, the editor will try to finish it. If the bell Xrings, it means there is now command like what you are typing. X X- Describe bindings X X Describe-bindings (not bound) will display a list of all the Xcommands in a window (splitting if neccesary) and the keys bound with Xthem. These will reflect the current bindings and not the default ones. XThis is a good way to find out the name of a command you can't remember, Xor which I picked a bad name for. (The names have been changed to Xprotect the guilty (thats me) and are in EFUNC.H You too can change them Xif you are into it). X X- Executing stuff X X The execute-command-line command prompts you for a command line Xon the bottom of the screen in the form: X X {Numeric argument} <command-name> {<string arg> {<string arg>}} X X (where {} are for optional stuff) and then executes it. X X Execute-buffer executes a number of these commands in a buffer. XIf any errors are found, the buffers current location will be set to the Xbegining of the line with the error in it. X X Execute-file will read a file into a buffer, execute it, and Xthen kill the buffer if it executed to completion with no errors. X X- Startup file X X MicroEMACS will attempt to execute a startup file (whose name is Xin EPATH.H) on startup. The MSDOS name is EMACS.RC and under unix it is Xusually .emacsrc X X- Multiple files on the command line X X MicroEMACS will now except a list of files on the command line. XThese files will all be assigned buffers, but will not be read in until Xthe buffer is brought up in a window. -v and -e switches affect all the Xfiles following them. X X- HP150 Function keys X X The function keys on the HP150 are now active and can be Xbound. This also works for the touchscreen areas. X X X- FILE LOCKING X X This is for people on multi-user UNIX systems. What this feature Xcan do is prevent two people from editing the same file and stomping on Xeach others edits. Unfortunatly, the actually locking mechanism used Xwhere I work is propritory so I could not send it out, but I have left Xall the code (conditionally defined by the FILOCK symbol in ESTRUCT.H) Xleading up to the actually locking routines so some one else can add it Xwith little effort. Here are the comments for the actual routines that Xneed to be added: X X/********************** X * X * dolock -- lock the file fname X * X * if successful, returns NULL X * if file locked, returns username of person locking the file X * if other error, returns "LOCK ERROR: explanation" X * X *********************/ X Xchar *dolock(fname) X Xchar *fname; /* file name to be locked */ X X Xand X X X/********************** X * X * undolock -- unlock the file fname X * X * if successful, returns NULL X * if other error, returns "LOCK ERROR: explanation" X * X *********************/ X Xchar *undolock(fname) X Xchar *fname; /* file name to unlock */ X X X If some one wants to write these functions so they can be Xdistributed publicly, please mail a separate file with them to me Xand I will include them with these sources for others to use. X X*************************** X X again, I thank the original authors of MicroEMACS for a good Xprogram that was a lot of fun to work on. I will maintain this version Xand expand it as long as there is any interest in it. Future additions Xwill probably include: X X -s on command line for alternative startup file X global default modes for buffers and a way to set/unset them X numbered kill buffers X fence matching for CMODE X sort region command X sentance movement and deletion commands X AMIGA function keys X X Send any ideas, suggestions or futher goodies to X Daniel Lawrence X ihnp4!pur-ee!pur-phy!duncan!lawrence X *-*-END-of-readme-*-* echo x - Makefile sed 's/^X//' >Makefile <<'*-*-END-of-Makefile-*-*' XCFLAGS= -O X XOFILES= ansi.o basic.o bind.o buffer.o display.o file.o \ X fileio.o hp150.o line.o lock.c main.o random.o region.o \ X search.o spawn.o tcap.o termio.o vt52.o window.o word.o X XCFILES= ansi.c basic.c bind.c buffer.c display.c file.c \ X fileio.c hp150.c line.c lock.c main.c random.c region.c \ X search.c spawn.c tcap.c termio.c vt52.c window.c word.c X XHFILES= estruct.h edef.h efunc.h epath.h ebind.h X Xemacs: $(OFILES) X $(CC) $(CFLAGS) $(OFILES) -ltermcap -lc -o emacs X X$(OFILES): $(HFILES) X Xinstall: X install -c -m 775 emacs /usr/local/emacs *-*-END-of-Makefile-*-* echo x - emacs.hlp sed 's/^X//' >emacs.hlp <<'*-*-END-of-emacs.hlp-*-*' X MicroEMACS 3.4 Help screens (03/03/86) 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 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) SEARCHING X X^S Search forward from cursor position. Type in a string to be searched X for at the prompt and end it with ESC. Either case matches either X unless EXECT mode is set for the current buffer X X^R As above, but Reverse search from cursor position. X X----------------------------------------------------------------------- X (3) 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 (4) CAPITALIZING & TRANSPOSING X XM-U UPPERCASE word XM-C Capitalize word ^T Transpose characters XM-L lowercase word M-T Transpose words X^Q Quote next entry, so that control codes may be entered into text X X X----------------------------------------------------------------------- X (5) 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 (6) DELETING & INSERTING X X<-- Delete previous character M-<-- Delete previous word X^D Delete next character M-D Delete next word X^K Close (delete) to end of line 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 (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 ^X ^M Delete Mode X X WRAP Turns on word wrap (automatic carraige return). X VIEW Allows viewing file without insertion and deletion. X EXACT All searches done with exact case matching X CMODE Automatic indenting for C program entry X (automatically set on any files ending with .C or .H) X----------------------------------------------------------------------- X (9) 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, size X X X----------------------------------------------------------------------- X (10) 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^X 2 Split the current window in two ^X 1 remove all but current window X^X O cursor to next window ^X ^ Enlarge current window XM-^V scroll down, other window M-^Z scroll up, other window X----------------------------------------------------------------------- X (11) MULTIPLE BUFFERS XA BUFFER is a named area containing a document being edited. Many buffers Xmay be activated at once. Each buffer has a name, which is typically the Xlowercased disk filename of the document it contains. X^X B Switch to another buffer. <CR> = use just-previous buffer X^X ^B Type buffer directory in a window X^X ^F Find file; read into a new buffer created from filename. X^X K Delete a non-displayed buffer. X----------------------------------------------------------------------- X (12) 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 (13) SAVING TO DISK X X^X^S Save current buffer to disk, using the buffer's filename X as the name of the disk file. Any disk file of that name X will be overwritten. X^X^W Write current buffer to disk. Type in a new filename at the X prompt to write to; it will become the current buffer's filename. XM-Z Write out all changed buffers and exit MicroEMACS X----------------------------------------------------------------------- X (14) ACCESSING THE OPERATING SYSTEM X X^X! Send one command to the operating system and return X^XC Start a new command processer under MicroEMACS X^XD Suspend MicroEMACS into the background (UNIX BSD4.2 only) X^X^C Exit MicroEMACS XM-Z Write out all changed buffers and then Exit MicroEMACS X X----------------------------------------------------------------------- X (15) SPECIAL KEYS AND KEY BINDINGS 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^C Bind a key to a named command XDisplay-Bindings X List the current key bindings in a buffer *-*-END-of-emacs.hlp-*-* exit
lawrence@duncan.UUCP (03/18/86)
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