Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: notesfiles Path: utzoo!watmath!clyde!cbosgd!ihnp4!mhuxn!mhuxr!mhuxt!houxm!vax135!cornell!uw-beaver!tektronix!hplabs!hp-pcd!orstcs!hakanson From: hakanson@orstcs.UUCP (hakanson) Newsgroups: net.emacs Subject: Unipress #264 TrmTERM patch(es) Message-ID: <13100005@orstcs.UUCP> Date: Wed, 11-Sep-85 20:38:00 EDT Article-I.D.: orstcs.13100005 Posted: Wed Sep 11 20:38:00 1985 Date-Received: Thu, 19-Sep-85 05:56:47 EDT Organization: Oregon State University - Corvallis, OR Lines: 445 Nf-ID: #N:orstcs:13100005:000:13542 Nf-From: orstcs!hakanson Sep 11 16:38:00 1985 Here's something I should've posted long ago, but when Unipress came out with 2.xx, I figured #264 was history (except for us). We are still using #264, and the following diffs take care of the standout problem on HP's, as well as a few other things: This TrmTERM driver handles the magic-cookie terminals very nicely, and to get it to do so cost me considerable effort. As a side-effect of making emacs work for magic-cookie terminals (tvi910/925/950, wyse50, freedom100, etc.), this also fixes the problem with standout on the HP-type terminals (which is caused by moving off a line while in standout mode). The TrmTERM driver is the only terminal driver we link in with our emacs, as it has been capable enough to handle terminals as well as vi/termcap does. This has the added benefit of making the executable emacs much smaller and faster to start up. If you don't wish to ignore the other terminal drivers, then display.c will have to be edited accordingly, after installing the patches below. We have been running with this TERM driver for about 6 months or more, and like it better than the vt100 driver on vt100's (for example, emacs now pays attention to the termcap entry init-strings, etc., rather than doing funny things to your terminal when you had it set up in a nonstandard way). It also makes emacs usable on our many Televideo's. I hope people will find this useful, and let me know about any problems found with these modifications. Marion Hakanson CSnet: hakanson%oregon-state@csnet-relay UUCP : {hp-pcd,tektronix}!orstcs!hakanson /*--------cut here, patches follow-----------*/ RCS file: RCS/Trm.h,v retrieving revision 1.1 diff -r1.1 Trm.h 39,40c39 < int (*t_flash) (); /* Flash the screen -- not set if this < terminal type won't support it. */ --- > int (*t_ding) (); /* Flash the screen or ring the bell */ =================================================================== RCS file: RCS/TrmTERM.c,v retrieving revision 1.1 diff -r1.1 TrmTERM.c 13a14,44 > * Modified 5-Dec-84 by hakanson@oregon-state (RMH): > * - added HLcookie to flag magic-cookie terminals. > * - changed setHL() so it counts HLcookie, and so it sends HLBstr > * only at the beginning of a line on magic-cookie terminals. > * - modified setHL() to put HLEstr at left or right margin on > * magic-cookie terminals. > * - modified topos() to offset all lines by HLcookie. > * - subtract HLcookie from width of screen. > * Modified 11-Dec-84 by R. Marion Hakanson (Oregon State University). > * Most of these changes are to allow doing away with all of the > * special terminal drivers, as this one seems adequate, given > * a decent termcap(3) entry. Tputs(3) takes care of all padding. > * - added CSinslines, CSdellines routines to handle the > * VT100 terminal (no IL/DL, but can change scroll-region). > * - modified init() to use these routines if no IL/DL. > * - changed all tputs(3) calls which had 0 as the second > * arguement (now 1, as it should be). > * - changed BaudFactor calculation, which had a fixedpoint > * number being divided by an integer (put division on > * inside of the itofixp() call instead of outside). > * Modified 16-Dec-84 by R. Marion Hakanson (OSU). > * - changed flash() to ding(), to make it term-dependent. > * - added BLstr to support ding(). > * Modified 01-Jan-85 by R. Marion Hakanson (OSU). > * - Now use "ms" flag and check before doing clearHL() in topos(). > * - Added CRstr instead of putchar(015) in topos(). > * - Removed pad(), since it wasn't being used. > * - Changed "BC" to "BCstr" to make things more clear. > * Modified 15-Jan-85 by R. Marion Hakanson (OSU). > * - Changed the sense of the test before doing clearHL() > * in topos(), in order to clarify what's going on. 26c57 < char *BC; --- > char *BCstr; 33c64,65 < *ICEstr, *NDstr, *VBstr, *EDstr, *DMstr, *NLstr; --- > *ICEstr, *NDstr, *VBstr, *BLstr, *EDstr, *DMstr, *CRstr, *NLstr; > static char *CSstr, *SFstr, *SRstr; /* RMH -- see CSinslines */ 35a68,69 > static int MSflag; /* RMH -- 1 if safe to move while in standout mode */ > static int HLcookie; /* RMH -- space taken on screen by HLBstr/HLEstr */ 57c91 < } --- > }; 61,67c95,97 < register char *com; < if (curHL == desHL) < return; < if(com = desHL ? HLBstr : HLEstr) < tputs (com, 0, dumpchar); < curHL = desHL; < } --- > if (curHL != desHL) { > register char *com; > curHL = 0; /* lie 'til we're done, avoid recursion */ 68a99,124 > if (com = desHL ? HLBstr : HLEstr) > if (HLcookie == 0) > tputs (com, 1, dumpchar); > else if (curX == 1 || curX == 1 + HLcookie) { /* empty line */ > register i; > for (i = curX; i > 1; i--) > tputs (BCstr, 1, dumpchar); /* go to REAL col. 1 */ > tputs (com, 1, dumpchar); /* cursor now at curX */ > } else { /* not an empty line */ > register oldY = curY; /* assume OK to move on same line */ > register oldX = curX; > topos (oldY, (desHL) ? 1-HLcookie /* topos() adds */ > : tt.t_width+1); > tputs (com, 1, dumpchar); > > if (desHL) > curX = 1 + HLcookie; /* Here we are! */ > else > curX = curY = -1; /* may have wrapped */ > > topos (oldY, oldX-HLcookie); /* topos() adds (again!) */ > } > curHL = desHL; > } > }; > 77c133 < } --- > }; 83c139 < tputs(DesMode==m_insert ? ICstr : ICEstr, 0, dumpchar); --- > tputs(DesMode==m_insert ? ICstr : ICEstr, 1, dumpchar); 92a149 > curX = 1; /* assume insert-line leaves us at column 1 */ 98a156 > curX = 1; /* assume delete-line leaves us at column 1 */ 100a159,164 > /* > ** The following routines are for terminals like the VT100 which > ** do not have IL/DL, but do have change-scrolling-region. > */ > static int WindowSize; > 101a166,200 > window (n) { > if (n <= 0 || n > tt.t_length) > n = tt.t_length; > WindowSize = n; > }; > > static > CSinslines (n) { > register oldY = curY; > HLmode (0); /* DJH -- Don't highlight the inserted line */ > setHL (); > tputs (tgoto(CSstr, WindowSize-1, oldY-1), 1, dumpchar); > curX = curY = -1; > topos(oldY, 1-HLcookie); > while (--n >= 0) { > tputs (SRstr, WindowSize-oldY, dumpchar); > } > tputs (tgoto(CSstr, tt.t_length-1, 0), 1, dumpchar); > curX = curY = -1; > }; > > static > CSdellines (n) { > register oldY = curY; > tputs (tgoto(CSstr, WindowSize-1, oldY-1), 1, dumpchar); > curX = curY = -1; > topos(WindowSize, 1-HLcookie); > while (--n >= 0) { > tputs (SFstr, WindowSize-oldY, dumpchar); > } > tputs (tgoto(CSstr, tt.t_length-1, 0), 1, dumpchar); > curX = curY = -1; > }; > > static 112c211 < putchar (*BC); --- > tputs (BCstr, 1, dumpchar); 134d232 < static fixedpoint BaudFactor; 137,144d234 < pad(n,f) < fixedpoint f; { < register k = fixptoi(fixpmul(itofixp(n), fixpmul(f, BaudFactor))); < while (--k >= 0) < putchar (PC); < }; < < static 146c236,239 < clearHL (); /* many terminals can't hack highlighting --- > column += HLcookie; /* compensate for the magic cookie -- RMH */ > /* assume ok to move IN SAME LINE on magic-cookie terminals */ > if (!MSflag && (HLcookie == 0 || curY != row)) > clearHL (); /* many terminals can't hack highlighting 149c242 < tputs(ICEstr, 0, dumpchar); /* some terminals can't move in */ --- > tputs(ICEstr, 1, dumpchar); /* some terminals can't move in */ 156c249 < tputs (BC, 0, dumpchar); --- > tputs (BCstr, 1, dumpchar); 160c253 < tputs (NDstr, 0, dumpchar); --- > tputs (NDstr, 1, dumpchar); 166c259 < tputs (UP, 0, dumpchar); --- > tputs (UP, 1, dumpchar); 171,173c264,265 < if(column!=curX) putchar (015); < tputs (NLstr, 0, dumpchar); < /* putchar (012); JCM */ --- > if(column!=curX) tputs (CRstr, 1, dumpchar); > tputs (NLstr, 1, dumpchar); 176c268 < tputs(tgoto (CursStr, column-1, row-1), 0, dumpchar); --- > tputs(tgoto (CursStr, column-1, row-1), 1, dumpchar); 181a274,275 > > 183,184c277,284 < flash () { /* dump a visible bell */ < tputs (VBstr, 0, dumpchar); --- > ding () > { /* dump a bell */ > extern VisibleBell; > > if (VisibleBell && VBstr) > tputs (VBstr, 1, dumpchar); > else > tputs (BLstr, 1, dumpchar); 186a287,288 > > 190a293 > fixedpoint BaudFactor; 192a296 > char *xPC; 207a312 > MSflag = tgetflag ("ms"); /* can move in standout mode */ 212a318,319 > HLcookie = tgetnum ("sg"); /* space taken by HLB/Estr -- RMH */ > if (HLcookie < 0) HLcookie = 0; 218a326,327 > if ((BLstr = tgetstr ("bl", &fill)) == 0) > BLstr = "\007"; 223,225c332,333 < BC = tgetstr ("bc", &fill); < if (BC == 0) < BC = "\b"; --- > if ((BCstr = tgetstr ("bc", &fill)) == 0) > BCstr = "\b"; 227,228c335,339 < NLstr = tgetstr ("nl", &fill);/* JCM -- find out about newline */ < if (NLstr == 0) --- > /* RMH -- find out about carriage return */ > if ((CRstr = tgetstr ("cr", &fill)) == 0) > CRstr = "\r"; /* use default if none specified */ > /* JCM -- find out about newline */ > if ((NLstr = tgetstr ("nl", &fill)) == 0) 230,233c341,345 < MetaFlag = tgetflag ("MT"); < BEGINstr = tgetstr ("ti", &fill); < /* PC = (tgetstr("pc", &fill)!=0) ? *tgetstr("pc", &fill) : 0; JQJ */ < PC = 0; --- > MetaFlag = tgetflag ("MT") || tgetflag ("km"); > BEGINstr = tgetstr ("vs", &fill); > ENDstr = tgetstr ("ve", &fill); > xPC = tgetstr("pc", &fill); > PC = (xPC) ? xPC[0] : 0; 235,236c347,348 < (itofixp(1) - (fltofixp(.45) +fixpmul(fltofixp(.3), < itofixp(BaudRate)/9600))) --- > (itofixp(1) - (fltofixp(.45) + fixpmul(fltofixp(.3), > itofixp(BaudRate/9600)))) 245a358,371 > if (!ILstr || !DLstr) { /* try another way, a la VT100 */ > CSstr = tgetstr("cs", &fill); /* change scrolling region */ > SFstr = tgetstr("sf", &fill); /* scroll forward */ > if (!SFstr) SFstr = NLstr; > SRstr = tgetstr("sr", &fill); /* scroll reverse */ > > if (CSstr && SFstr && SRstr) { > tt.t_inslines = CSinslines; > tt.t_dellines = CSdellines; > tt.t_window = window; > DLstr = ILstr = CSstr; /* show that we can do it anyway */ > } else > tt.t_inslines = tt.t_dellines = (int (*) ()) - 1; > } 248,251c374 < if (!ILstr) < tt.t_inslines = tt.t_dellines = (int (*) ()) - 1; < if (VBstr) < tt.t_flash = flash; --- > 267c390,393 < tt.t_width = tgetnum ("co") - 1;/* Always lie about the width */ --- > /* Always lie about the width, & save room for HLEstr */ > tt.t_width = tgetnum ("co") - ((HLcookie == 0) ? 1 : HLcookie); > tt.t_width -= HLcookie; /* reserve room for HLBstr */ > tt.t_needspaces = tgetflag ("in"); 270d395 < 273,276c398,400 < curX = -1; < curY = -1; < if (BEGINstr) tputs(BEGINstr, 0, dumpchar); < if (TIstr) tputs(TIstr, 0, dumpchar); --- > if (BEGINstr) tputs(BEGINstr, 1, dumpchar); > if (TIstr) tputs(TIstr, 1, dumpchar); > wipescreen(); /* leaves cursor at 1,1 */ 278c402 < tputs(ESstr, 0, dumpchar); --- > window(0); 285a410 > setHL(); 288c413,416 < if (TEstr) tputs(TEstr, 0, dumpchar); --- > window(0); > topos(tt.t_length, 1-HLcookie); > if (TEstr) tputs(TEstr, 1, dumpchar); > if (ENDstr) tputs(ENDstr, 1, dumpchar); 292,293c420,425 < wipeline () { < setHL (); --- > wipeline (ChangingHighlight) { > if (ChangingHighlight) { > if (curHL == desHL) > curHL = !desHL; /* Force something to be done */ > setHL (); > } 299,300c431,432 < tputs(ESstr, 0, dumpchar); < curX = curY = -1; --- > tputs(ESstr, 1, dumpchar); > curY = curX = 1; /* ESstr leaves you at home */ 308c440 < tputs(ICstr,0,dumpchar); --- > tputs(ICstr,1,dumpchar); 314c446 < tputs(ICEstr, 0, dumpchar); --- > tputs(ICEstr, 1, dumpchar); 317c449 < tputs(DMstr,0,dumpchar); --- > tputs(DMstr,1,dumpchar); 328c460 < tputs(EDstr,0,dumpchar); --- > tputs(EDstr,1,dumpchar); 346a479,481 > tt.t_ding = ding; > tt.t_UpdateBegin = 0; > tt.t_UpdateEnd = 0; 352c487,488 < tt.t_width = 80; --- > tt.t_width = 79; > tt.t_needspaces = 0; =================================================================== RCS file: RCS/display.c,v retrieving revision 1.1 diff -r1.1 display.c 89a90 > /* Unused, apparently -- RMH 93a95 > /* Unused -- RMH 95a98 > */ 765c768 < static VisibleBell; /* If true and the terminal will support it --- > int VisibleBell; /* If true and the terminal will support it 770,773c773,774 < Ding () { /* BOGUS! this should really be terminal < type specific! */ < if (VisibleBell && tt.t_flash) (*tt.t_flash) (); < else putchar (07); --- > Ding () { > (*tt.t_ding) (); 799c800 < /* initialize the teminal package */ --- > /* initialize the terminal package */ 821a823 > #if 0 /* Deleted in favor of termcap(3) -- RMH */ 853c855 < /* "concept-LNZ", 99, TrmCLNZ, --- > "concept-LNZ", 99, TrmCLNZ, 856c858 < "z10", 3, TrmCLNZ, */ --- > "z10", 3, TrmCLNZ, 867a870 > #endif /* RMH */ 872c875 < tname = "concept"; --- > tname = "dumb"; /* used to be "concept" -- RMH */ 877a881 > #if 0 /* Deleted in favor of termcap(3) -- RMH */ 887a892 > #endif /* RMH */ 889a895 > VisibleBell = 1; /*------cut here, de end of de patches--------*/ Marion Hakanson CSnet: hakanson%oregon-state@csnet-relay UUCP : {hp-pcd,tektronix}!orstcs!hakanson Brought to you by Super Global Mega Corp .com