darren@bacchus.UUCP (Darren Friedlein) (01/11/88)
What follows is a shell archive containing four files that, when added to the virgin MicroEMACS v3.9e sources, allow you to use almost all the function keys of the UNIXpc with uEMACS. The original patches (posted by Dave Arnold on September 7, 1987) must not be installed, or path will choke. The difference between this version and Dave's are: This version binds more function keys (almost all the available ones) This version will size the uEMACS screen to the current window size or will use full-screen all the time based on whether FULLSCR is defined. Raw mode is in effect, so uEMACS won't stop on ^S and ignore ^Q and all that. Problems still around: Key repeat is DAMN slow. If anyone knows how the value of sg_ispeed effects this, please let me know. Problems with windows and spawning a new process (^X!, ^X@, ^X$, etc...) make it not worth the trouble to try. May loose your changes if you do. The following files will be created after you run this file through sh (remembering to cut out everything before the '----- Cut Here -----' line): Makefile unixpc.page unixpc.c uemacs.pat - replace the existing MicroEMACS Makefile with the one out of this archive. - put unixpc.c in the MicroEMACS source directory . - apply the context diffs in uemacs.pat to the source directory with the command 'patch <uemacs.pat'. - add unixpc.page someplace in appendix D. These changes are being sent to Daniel Lawrence and should appear in an upcoming release. To get MicroEMACS, call: The Programmer's Room (317) 742-5533 Enjoy! -Darren /****** /***** {edo} Darren G. Friedlein * * /****** * {mcnc} Rt 4 Box 416, Durham NC 27703 * * * * {ethos} data(bacchus):919/596-7746 * *urham \*****\ * ompany {gladys} voice:919/596-9492 \****** *oftware \***** {bakerst}!bacchus!darren ******/ "I got up the other day and everything in my apartment had been stolen and replaced with an exact replica." -Steven Wright ----- Cut Here ----- echo x - Makefile sed 's/^X//' >Makefile <<'*-*-END-of-Makefile-*-*' Xinclude /usr/include/Makepre.h X XCFLAGS= -O XLDFLAGS= X XOFILES= ansi.o basic.o bind.o buffer.o crypt.o dg10.o \ X display.o eval.o exec.o file.o fileio.o \ X hp110.o hp150.o ibmpc.o input.o isearch.o line.o \ X lock.o main.o random.o region.o search.o spawn.o \ X st520.o tcap.o termio.o tipc.o unixpc.o vmsvt.o \ X vt52.o window.o word.o z309.o X XCFILES= ansi.c basic.c bind.c buffer.c crypt.c dg10.c \ X display.c eval.c exec.c file.c fileio.c \ X hp110.c hp150.c ibmpc.c input.c isearch.c line.c \ X lock.c main.c random.c region.c search.c spawn.c \ X st520.c tcap.c termio.c tipc.c unixpc.o vmsvt.c \ X vt52.c window.c word.c z309.c X XHFILES= estruct.h edef.h efunc.h epath.h ebind.h evar.h X Xemacs: $(OFILES) X $(CC) $(CFLAGS) $(OFILES) -ltermcap -lc -o emacs X Xunixpc: $(OFILES) X $(LD) $(LDFLAGS) $(OFILES) $(SHAREDLIB) -o emacs X X$(OFILES): $(HFILES) *-*-END-of-Makefile-*-* echo x - uemacs.pat sed 's/^X//' >uemacs.pat <<'*-*-END-of-uemacs.pat-*-*' X*** oldemacs/ebind.h Sun Jan 10 21:02:20 1988 X--- emacs/ebind.h Fri Dec 11 22:29:46 1987 X*************** X*** 118,124 X {META|'!', reposition}, X {META|'.', setmark}, X {META|'>', gotoeob}, X! {META|'<', gotobob}, X {META|'~', unmark}, X #if APROP X {META|'A', apro}, X X--- 118,124 ----- X {META|'!', reposition}, X {META|'.', setmark}, X {META|'>', gotoeob}, X! {META|'<', gotobob}, X {META|'~', unmark}, X #if APROP X {META|'A', apro}, X*************** X*** 330,335 X SPEC|0x8F, gotoline, /* GoTo */ X SPEC|0x9F, usebuffer, /* ^GoTo */ X #endif X X {0x7F, backdel}, X X X--- 330,384 ----- X SPEC|0x8F, gotoline, /* GoTo */ X SPEC|0x9F, usebuffer, /* ^GoTo */ X #endif X+ X+ #if UNIXPC X+ SPEC|'*', ctlxrp, /* s_Creat */ X+ SPEC|',', backsearch, /* s_Find */ X+ SPEC|'.', delmode, /* s_Dlete */ X+ SPEC|'/', setmode, /* Slect */ X+ SPEC|'0', fileread, /* Rstrt */ X+ SPEC|'1', quickexit, /* s_Save */ X+ SPEC|'3', qreplace, /* s_Replac */ X+ SPEC|'h', quit, /* Exit */ X+ SPEC|':', execprg, /* s_Cmd */ X+ SPEC|'>', backword, /* s_Back */ X+ SPEC|'A', delwind, /* Close */ X+ SPEC|'B', onlywind, /* Clear */ X+ SPEC|'C', gotoeob, /* s_Home */ X+ SPEC|'D', mvupwind, /* RollUp */ X+ SPEC|'E', mvdnwind, /* RollDn */ X+ SPEC|'F', deskey, /* s_Help */ X+ SPEC|'I', backpage, /* s_Page */ X+ SPEC|'L', forwword, /* s_Foreward */ X+ SPEC|'Y', killtext, /* ClearLine */ X+ SPEC|'Z', ctlxlp, /* Creat */ X+ SPEC|'[', unmark, /* Undo */ X+ SPEC|'\\', forwsearch, /* Find */ X+ SPEC|']', gotoline, /* Move */ X+ SPEC|'^', killregion, /* Dlete */ X+ SPEC|'_', setmark, /* Mark */ X+ SPEC|'a', filesave, /* Save */ X+ SPEC|'b', ctlxe, /* Redo */ X+ SPEC|'c', sreplace, /* Rplac */ X+ SPEC|'d', yank, /* Copy */ X+ SPEC|'e', forwdel, /* DleteChar */ X+ SPEC|'f', quote, /* InputMode */ X+ SPEC|'j', spawn, /* Cmd */ X+ SPEC|'l', gotobol, /* Beg */ X+ SPEC|'m', prevwind, /* Prev */ X+ SPEC|'n', backchar, /* Back */ X+ SPEC|'q', splitwind, /* Open */ X+ SPEC|'r', refresh, /* Rfrsh */ X+ SPEC|'s', gotobob, /* Home */ X+ SPEC|'t', backline, /* Up */ X+ SPEC|'u', forwline, /* Down */ X+ SPEC|'v', help, /* Help */ X+ SPEC|'x', ctrlg, /* Cancl */ X+ SPEC|'y', forwpage, /* Page */ X+ SPEC|'z', gotoeol, /* End */ X+ SPEC|'{', nextwind, /* Next */ X+ SPEC|'|', forwchar, /* Forward */ X+ #endif X X {0x7F, backdel}, X X*************** X*** 401,404 X X #define lk_map_size (sizeof(lk_map)/2) X #endif X- X X--- 450,452 ----- X X #define lk_map_size (sizeof(lk_map)/2) X #endif X*** oldemacs/epath.h Sun Jan 10 21:02:33 1988 X--- emacs/epath.h Fri Dec 11 22:29:50 1987 X*************** X*** 59,65 X ".emacsrc", X "emacs.hlp", X "/usr/local/", X! "/usr/lib/", X "" X }; X #endif X X--- 59,65 ----- X ".emacsrc", X "emacs.hlp", X "/usr/local/", X! "/usr/lib/uemacs", X "" X }; X #endif X*** oldemacs/estruct.h Sun Jan 10 21:02:39 1988 X--- emacs/estruct.h Tue Dec 22 20:50:04 1987 X*************** X*** 40,46 X X #define AMIGA 0 /* AmigaDOS */ X #define ST520 0 /* ST520, TOS */ X! #define MSDOS 1 /* MS-DOS */ X #define V7 0 /* V7 UNIX or Coherent or BSD4.2*/ X #define BSD 0 /* UNIX BSD 4.2 and ULTRIX */ X #define USG 0 /* UNIX system V */ X X--- 40,46 ----- 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*************** X*** 43,49 X #define MSDOS 1 /* MS-DOS */ X #define V7 0 /* V7 UNIX or Coherent or BSD4.2*/ X #define BSD 0 /* UNIX BSD 4.2 and ULTRIX */ X! #define USG 0 /* UNIX system V */ X #define VMS 0 /* VAX/VMS */ X #define CPM 0 /* CP/M-86 */ X #define FINDER 0 /* Macintosh OS */ X X--- 43,49 ----- 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*** 49,55 X #define FINDER 0 /* Macintosh OS */ X X /* Compiler definitions */ X! #define UNIX 0 /* a random UNIX compiler */ X #define MWC 0 /* Marc Williams C */ X #define LATTICE 0 /* Lattice 2.14 thruough 3.0 compilers */ X #define AZTEC 1 /* Aztec C 3.20e */ X X--- 49,55 ----- X #define FINDER 0 /* Macintosh OS */ X X /* Compiler definitions */ X! #define UNIX 1 /* a random UNIX compiler */ X #define MWC 0 /* Marc Williams C */ X #define LATTICE 0 /* Lattice 2.14 thruough 3.0 compilers */ X #define AZTEC 0 /* Aztec C 3.20e */ X*************** X*** 52,58 X #define UNIX 0 /* a random UNIX compiler */ X #define MWC 0 /* Marc Williams C */ X #define LATTICE 0 /* Lattice 2.14 thruough 3.0 compilers */ X! #define AZTEC 1 /* Aztec C 3.20e */ X #define MSC 0 /* MicroSoft C compile version 3 & 4 */ X #define TURBO 0 /* Turbo C/MSDOS */ X X X--- 52,58 ----- X #define UNIX 1 /* a random UNIX compiler */ X #define MWC 0 /* Marc Williams C */ X #define LATTICE 0 /* Lattice 2.14 thruough 3.0 compilers */ X! #define AZTEC 0 /* Aztec C 3.20e */ X #define MSC 0 /* MicroSoft C compile version 3 & 4 */ X #define TURBO 0 /* Turbo C/MSDOS */ X X*************** X*** 74,80 X #define VT52 0 /* VT52 terminal (Zenith). */ X #define RAINBOW 0 /* Use Rainbow fast video. */ X #define TERMCAP 0 /* Use TERMCAP */ X! #define IBMPC 1 /* IBM-PC CGA/MONO/EGA driver */ X #define DG10 0 /* Data General system/10 */ X #define TIPC 0 /* TI Profesional PC driver */ X #define Z309 0 /* Zenith 100 PC family driver */ X X--- 74,80 ----- X #define VT52 0 /* VT52 terminal (Zenith). */ X #define RAINBOW 0 /* Use Rainbow fast video. */ X #define TERMCAP 0 /* 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*************** X*** 80,85 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 X--- 80,86 ----- X #define Z309 0 /* Zenith 100 PC family driver */ X #define MAC 0 /* Macintosh */ X #define ATARI 0 /* Atari 520/1040ST screen */ X+ #define UNIXPC 1 /* AT&T UNIXpc/7300/3b1/Safari4 */ X X /* Configuration options */ X X*************** X*** 83,88 X X /* Configuration options */ X X #define CVMVAS 1 /* arguments to page forward/back in pages */ X #define CLRMSG 0 /* space clears the message line with no insert */ X #define CFENCE 1 /* fench matching in CMODE */ X X--- 84,90 ----- X X /* Configuration options */ X X+ #define FULLSCR 0 /* use full screen or window size on UNIXpc */ X #define CVMVAS 1 /* arguments to page forward/back in pages */ X #define CLRMSG 0 /* space clears the message line with no insert */ X #define CFENCE 1 /* fench matching in CMODE */ X*************** X*** 94,100 X #define NBRACE 1 /* new style brace matching command */ X X #define REVSTA 1 /* Status line appears in reverse video */ X! #define COLOR 1 /* color commands and windows */ X X #define FILOCK 0 /* file locking under unix BSD 4.2 */ X #define ISRCH 1 /* Incremental searches like ITS EMACS */ X X--- 96,102 ----- X #define NBRACE 1 /* new style brace matching command */ X X #define REVSTA 1 /* Status line appears in reverse video */ X! #define COLOR 0 /* 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*************** X*** 358,363 X /* De-allocate memory always on exit (if the operating system or X main program can not X */ X X #if CLEAN X #define exit(a) cexit(a) X X--- 360,369 ----- X /* De-allocate memory always on exit (if the operating system or X main program can not X */ X+ X+ #if UNIXPC X+ #define exit(a) wexit(a) X+ #endif X X #if CLEAN X #define exit(a) cexit(a) X*** oldemacs/input.c Sun Jan 10 21:03:16 1988 X--- emacs/input.c Fri Dec 11 22:30:26 1987 X*************** X*** 333,338 X } X #endif X X if (c>=0x00 && c<=0x1F) /* C0 control -> C- */ X c = CTRL | (c+'@'); X return (c); X X--- 333,342 ----- X } X #endif X X+ #if UNIXPC X+ if (c & 0x80) X+ return(SPEC | (c & 0x7f)); X+ #endif X if (c>=0x00 && c<=0x1F) /* C0 control -> C- */ X c = CTRL | (c+'@'); X return (c); X*** oldemacs/termio.c Sun Jan 10 21:04:22 1988 X--- emacs/termio.c Fri Dec 11 22:31:01 1987 X*************** X*** 440,445 X keyboard buffer X */ X X typahead() X X { X X--- 440,447 ----- X keyboard buffer X */ X X+ #if !UNIXPC X+ X typahead() X X { X*************** X*** 493,497 X #endif X return(FALSE); X } X #endif X X X--- 495,501 ----- X #endif X return(FALSE); X } X+ X #endif X X #endif X*************** X*** 495,497 X } X #endif X X X--- 498,501 ----- X X #endif X X+ #endif *-*-END-of-uemacs.pat-*-* echo x - unixpc.c sed 's/^X//' >unixpc.c <<'*-*-END-of-unixpc.c-*-*' X/* MicroEMACS 3.8 screen and keyboard driver for AT&T UNIXpc (7300 & 3B1) */ X/* Initial Release: Sept 7, 1987 by Dave Arnold (dave@arnold.UUCP) */ X/* Bug fix for remote logins by Rich Grant (mtune!fjrag!rich) */ X/* Fixes to make workspace expand to fit window, use raw mode and */ X/* make it work with version 3.9e by Darren Friedlein (darren@bacchus) */ X/* Second Release: January 10, 1988 */ X X/* Drawbacks: Slower key repeat; Problems spawning a user-specified process */ X X#include <stdio.h> X#include <tam.h> X#include "estruct.h" X#include "edef.h" X#if UNIXPC X X#define NROW 24 /* Screen size. */ X#define NCOL 80 /* Edit if you want to. */ X#define MARGIN 8 /* size of minimim margin and */ X#define SCRSIZ 64 /* scroll size for extended lines */ X#define NPAUSE 15 /* # times thru update to pause */ X#define BEL 0x07 /* BEL character. */ X#define ESC 0x1B /* ESC character. */ X#define BUFSIZ 1024 X#define RAW 0000040 X#define ECHO 0000010 X#define CRMOD 0000020 X Xstatic short wn; Xstatic char buf[BUFSIZ]; Xstatic int bufi; Xstruct sgttyb { X char sg_ispeed; X char sg_ospeed; X char sg_erase; X char sg_kill; X char sg_flags; X}; Xstruct sgttyb ostate; Xstruct sgttyb nstate; X X#if !FULLSCR Xstatic struct wstat wnstat; X#endif X Xstatic int TamOpen() X{ X winit(); X X#if !FULLSCR X/* if you the windo to expand to a full screen on invocation, define X FULLSCR in estruct.h. Otherwise it will expand to fit the current X window. (Right now it doesn't expand/contract after the window size X is changed. Maybe later... X*/ X wgetstat(wn, &wnstat); X#endif X X#if FULLSCR X/* First parameter in wcreate should be 0 for remote logins, and 1 for X windows. iswind() does the trick! Thank you, Rich. X*/ X wn = wcreate(iswind(), 0, NROW, NCOL, NBORDER); X#else X if (iswind()) /* Must use full screen on remote terminal */ X wn = wcreate(wnstat.begy, wnstat.begx, wnstat.height, wnstat.width, wnstat.uflags); X else X wn = wcreate(0, 0, NROW, NCOL, NBORDER); X#endif X gtty(0, &ostate); X gtty(0, &nstate); X printf("%d %d",ostate.sg_ispeed, ostate.sg_ospeed); X nstate.sg_flags &= ~(ECHO|CRMOD); X nstate.sg_ispeed=1; /* How do these work? */ X nstate.sg_ospeed=0; /* */ X stty(0, &nstate); X return(1); X} X X Xstatic int TamClose() X{ X wdelete(wn); X stty(0, &ostate); X return(1); X} X Xstatic int TamKbdOpen() X{ X if(iswind()) X keypad(0, 1); X bufi = 0; X return(1); X} X Xstatic int TamKbdClose() X{ X return(1); X} X Xstatic int TamGetchar() X{ X int c; X X c = wgetc(wn); X return(c); X} X Xstatic int TamPutchar(c) Xchar c; X{ X if(bufi >= BUFSIZ) X TamFlush(); X buf[bufi++] = c; X return(1); X} X Xstatic int TamFlush() X{ X buf[bufi] = 0; X wputs(wn, buf); X bufi = 0; X return(1); X} X Xstatic int TamMove(row, col) Xint row; Xint col; X{ X TamFlush(); X wgoto(wn, row, col); X return(1); X} X Xstatic int TamEeol() X{ X TamPutchar(ESC); X TamPutchar('['); X TamPutchar('0'); X TamPutchar('K'); X return(1); X} X Xstatic int TamEeop() X{ X TamPutchar(ESC); X TamPutchar('['); X TamPutchar('0'); X TamPutchar('J'); X return(1); X} X Xstatic int TamBeep() X{ X TamPutchar(BELL); X return(1); X} X Xstatic int TamRev(state) Xint state; X{ X if(state) X { X TamPutchar(ESC); X TamPutchar('['); X TamPutchar('7'); X TamPutchar('m'); X } X else X { X TamPutchar(ESC); X TamPutchar('['); X TamPutchar('0'); X TamPutchar('m'); X } X return(1); X} X Xstatic int TamNop() X{ X return(1); X} X X#if TYPEAH Xint typahead() X{ X return(0); X} X#endif X XTERM term = X { X NROW-1, X NROW-1, X NCOL, X NCOL, X MARGIN, X SCRSIZ, X NPAUSE, X TamOpen, X TamClose, X TamKbdOpen, X TamKbdClose, X TamGetchar, X TamPutchar, X TamFlush, X TamMove, X TamEeol, X TamEeop, X TamBeep, X TamRev, X TamNop X#if COLOR X , TamNop, X TamNop X#endif X }; X X/* Just to keep eval.c happy... */ X Xspal() X{ X} X X#endif *-*-END-of-unixpc.c-*-* echo x - unixpc.page sed 's/^X//' >unixpc.page <<'*-*-END-of-unixpc.page-*-*' XD.6 AT&T UNIXpc (7300/3b1/Safari-4) X X X The routines specific to the UNIXpc are not required for Xcompilation, but they provide a better user interface and allow the use Xof the UNIXpc's proliferation of function keys. The mouse is not Xsupported as of yet, but it may be used for cursor positioning in future Xreleases of MicroEMACS. The routine that initializes the screen can be Xset to always provide a full screen, or it can be fitted into the Xcurrent window (provided you are on the main console -- remote always Xgets full screen). If FULLSCR is defined in the estruct.h file, XMicroEMACS will always use a full screen, otherwise it will attempt to Xstay within the current window boundaries. NOTE -- this does not mean Xthat the workspace will expand or contract when the window size is Xchanged. It is set on invocation and stays constant (here is another Xproblem that will hopefully be resolved in the future). Since the Xadditions make use of the Terminal Access Method (T.A.M.) function calls, Xthe program uses the shared library as well as allowing proper parsing Xof function key return codes. What follows is a list of available Xfunction keys in FNx format. The default key bindings are on the right: X XUNIXpc Emacs Default XKey Name FNx Symbol Binding X-------- ---------- ------- X XBackTab 7 XMouse } XF1 Q XF2 R XF3 S XF4 T XF5 U XF6 V XF7 W XF8 X _ Xs_F1 ! \ Xs_F2 " | Xs_F3 # | Xs_F4 $ \_ Reserve these for use with the phone Xs_F5 % / Manager (repertory dialing numbers) Xs_F6 & | Xs_F7 ` | Xs_F8 ( _/ XClearLine Y killtext XCreat Z ctlxlp XUndo [ unmark XFind \ forwsearch XMove ] gotoline XDlete ^ killregion XMark _ setmark XRef ' XSave a filesave XRedo b ctlxe XRplac c sreplace XCopy d yank XDleteChar e forwdel XInputMode f quote Xs_ClearLine ) Xs_Creat * ctlxr Xs_Undo + Xs_Find , backsearch Xs_Move - Xs_Dlete . delmode XSlect / setmode XRstrt 0 fileread Xs_Save 1 quickexit Xs_Redo 2 Xs_Rplac 3 qreplace Xs_Copy 4 Xs_DleteChar 5 Xs_InputMode 6 XExit h quit XSuspd i (Keep this one open for 'W' icon) XCmd j spawn XPrint k XBeg l gotobol XPrev m prevwind XBack n backchar XMsg o (Keep this open for status/mail/error icons) XRsume p (Keep open in case you're running the new wmgr) XOpen q splitwind XRfrsh r refresh XHome s gotobob XUp t backline XDown u forwline XHelp v help XOpts w XCancl x ctrlg XPage y forwpage XEnd z gotoeol XNext { nextwind XForward | forwchar Xs_Exit 8 Xs_Suspd 9 (Keep open for the 'W' icon) Xs_Cmd : execprg Xs_Print ; (Keep open for print-screen) Xs_Beg < Xs_Prev = Xs_Back > backword Xs_Msg ? (Keep open for status/mail/error icons) Xs_Rsume @ (Keep open in case you're running the new wmgr) XClose A delwind XClear B onlywind Xs_Home C gotoeob XRollUp D mvupwind XRollDn E mvdnwind Xs_Help F deskey Xs_Opts G Xs_Cancl H Xs_Page I backpage Xs_End J gotoeol Xs_Next K Xs_Forward L forwword XPF1 ^A XPF2 ^B XPF3 ^C XPF4 ^D XPF5 ^E XPF6 ^F XPF7 ^G XPF8 ^H XPF9 ^I XPF10 ^J XPF11 ^K XPF12 ^L X X To use these features, define UNIXPC, UNIX, USG, and X(optionally) FULLSCR in estruct.h. Do not allocate MSDOS or TERMCAP. X X Since the MicroEMACS extensions for the UNIXpc are a fairly new, Xsome bugs will inevitably be encountered. If you are having a problem Xthat you think is related to the UNIXpc-specific portions of code, Xplease send email to Darren Friedlein (darren@bacchus) outlining the Xproblem. Will luck it will be fixed in the next revision. *-*-END-of-unixpc.page-*-* exit