From 3c7b865a0039cf2894c7639d2923d34db1a5210e Mon Sep 17 00:00:00 2001 From: Mark Horton Date: Thu, 3 Sep 1981 18:46:10 -0800 Subject: [PATCH] updates for Unix/370 and ins/del line on vt100 SCCS-vsn: usr.bin/ex/ex.h 7.4 SCCS-vsn: usr.bin/ex/ex_io.c 7.3 SCCS-vsn: usr.bin/ex/ex_put.c 7.2 SCCS-vsn: usr.bin/ex/ex_temp.c 7.3 SCCS-vsn: usr.bin/ex/ex_tty.c 7.2 SCCS-vsn: usr.bin/ex/ex_tune.h 7.3 SCCS-vsn: usr.bin/ex/ex_v.c 7.2 SCCS-vsn: usr.bin/ex/ex_vadj.c 7.2 SCCS-vsn: usr.bin/ex/ex_vis.h 7.3 SCCS-vsn: usr.bin/ex/OTHER/makefile.70 6.2 --- usr/src/usr.bin/ex/OTHER/makefile.70 | 4 +- usr/src/usr.bin/ex/ex.h | 6 +- usr/src/usr.bin/ex/ex_io.c | 6 +- usr/src/usr.bin/ex/ex_put.c | 6 +- usr/src/usr.bin/ex/ex_temp.c | 16 ++-- usr/src/usr.bin/ex/ex_tty.c | 20 +++-- usr/src/usr.bin/ex/ex_tune.h | 8 +- usr/src/usr.bin/ex/ex_v.c | 9 +- usr/src/usr.bin/ex/ex_vadj.c | 14 +-- usr/src/usr.bin/ex/ex_vis.h | 128 +++++++++++++-------------- 10 files changed, 119 insertions(+), 98 deletions(-) diff --git a/usr/src/usr.bin/ex/OTHER/makefile.70 b/usr/src/usr.bin/ex/OTHER/makefile.70 index 8cb75fab4f..5373cfdf6c 100644 --- a/usr/src/usr.bin/ex/OTHER/makefile.70 +++ b/usr/src/usr.bin/ex/OTHER/makefile.70 @@ -1,4 +1,4 @@ -VERSION=3.6 +VERSION=3.7 # # Ex skeletal makefile for version 7, USGS Overlay 11/70 system # @@ -97,7 +97,7 @@ tags: /tmp strings.o: strings ${XSTR} ${CC} -c -S xs.c -# ed - <:rofix xs.s +# ed - #endif @@ -130,7 +130,11 @@ extern struct option options[NOPTS + 1]; # ifdef VMUNIX # define BUFSIZ 1024 # else +# ifdef u370 +# define BUFSIZ 4096 +# else # define BUFSIZ 512 +# endif # endif # define NULL 0 # define EOF -1 diff --git a/usr/src/usr.bin/ex/ex_io.c b/usr/src/usr.bin/ex/ex_io.c index edcb0e60ac..be791aba3c 100644 --- a/usr/src/usr.bin/ex/ex_io.c +++ b/usr/src/usr.bin/ex/ex_io.c @@ -1,5 +1,5 @@ /* Copyright (c) 1981 Regents of the University of California */ -static char *sccsid = "@(#)ex_io.c 7.2 %G%"; +static char *sccsid = "@(#)ex_io.c 7.3 %G%"; #include "ex.h" #include "ex_argv.h" #include "ex_temp.h" @@ -277,10 +277,10 @@ gscan() /* * Parse one filename into file. */ +struct glob G; getone() { register char *str; - struct glob G; if (getargs() == 0) error("Missing filename"); @@ -620,7 +620,7 @@ edfile() /* * Extract the next line from the io stream. */ -static char *nextip; +char *nextip; getfile() { diff --git a/usr/src/usr.bin/ex/ex_put.c b/usr/src/usr.bin/ex/ex_put.c index 16ec31bfc3..550a1b68cd 100644 --- a/usr/src/usr.bin/ex/ex_put.c +++ b/usr/src/usr.bin/ex/ex_put.c @@ -1,5 +1,5 @@ /* Copyright (c) 1981 Regents of the University of California */ -static char *sccsid = "@(#)ex_put.c 7.1 %G%"; +static char *sccsid = "@(#)ex_put.c 7.2 %G%"; #include "ex.h" #include "ex_tty.h" #include "ex_vis.h" @@ -196,7 +196,7 @@ slobber(c) * message so we don't have to keep it in data space. */ static char linb[66]; -static char *linp = linb; +char *linp = linb; /* * Phadnl records when we have already had a complete line ending with \n. @@ -959,7 +959,7 @@ ostop(f) #ifndef USG3TTY pfast = (f & CRMOD) == 0; #else - pfast = (f.c_oflag & OCRNL) == 0; + pfast = (f.c_oflag & ONLCR) == 0; #endif termreset(), fgoto(), flusho(); normal(f); diff --git a/usr/src/usr.bin/ex/ex_temp.c b/usr/src/usr.bin/ex/ex_temp.c index 53475d441a..e50ff8ad92 100644 --- a/usr/src/usr.bin/ex/ex_temp.c +++ b/usr/src/usr.bin/ex/ex_temp.c @@ -1,5 +1,5 @@ /* Copyright (c) 1981 Regents of the University of California */ -static char *sccsid = "@(#)ex_temp.c 7.2 %G%"; +static char *sccsid = "@(#)ex_temp.c 7.3 %G%"; #include "ex.h" #include "ex_temp.h" #include "ex_vis.h" @@ -368,7 +368,7 @@ struct rbuf { short rb_prev; short rb_next; char rb_text[BUFSIZ - 2 * sizeof (short)]; -} *rbuf; +} *rbuf, KILLrbuf, putrbuf, YANKrbuf, regrbuf; #ifdef VMUNIX short rused[256]; #else @@ -440,10 +440,9 @@ int shread(); KILLreg(c) register int c; { - struct rbuf arbuf; register struct strreg *sp; - rbuf = &arbuf; + rbuf = &KILLrbuf; sp = mapreg(c); rblock = sp->rg_first; sp->rg_first = sp->rg_last = 0; @@ -473,14 +472,13 @@ int getREG(); putreg(c) char c; { - struct rbuf arbuf; register line *odot = dot; register line *odol = dol; register int cnt; deletenone(); appendnone(); - rbuf = &arbuf; + rbuf = &putrbuf; rnleft = 0; rblock = 0; rnext = mapreg(c)->rg_first; @@ -556,7 +554,6 @@ getREG() YANKreg(c) register int c; { - struct rbuf arbuf; register line *addr; register struct strreg *sp; char savelb[LBSIZE]; @@ -567,7 +564,7 @@ YANKreg(c) KILLreg(c); strp = sp = mapreg(c); sp->rg_flags = inopen && cursor && wcursor; - rbuf = &arbuf; + rbuf = &YANKrbuf; if (sp->rg_last) { regio(sp->rg_last, read); rnleft = sp->rg_nleft; @@ -646,10 +643,9 @@ char c; char *buf; int buflen; { - struct rbuf arbuf; register char *p, *lp; - rbuf = &arbuf; + rbuf = ®rbuf; rnleft = 0; rblock = 0; rnext = mapreg(c)->rg_first; diff --git a/usr/src/usr.bin/ex/ex_tty.c b/usr/src/usr.bin/ex/ex_tty.c index 2f2509e560..01c9b74b66 100644 --- a/usr/src/usr.bin/ex/ex_tty.c +++ b/usr/src/usr.bin/ex/ex_tty.c @@ -1,5 +1,5 @@ /* Copyright (c) 1981 Regents of the University of California */ -static char *sccsid = "@(#)ex_tty.c 7.1 %G%"; +static char *sccsid = "@(#)ex_tty.c 7.2 %G%"; #include "ex.h" #include "ex_tty.h" @@ -40,12 +40,12 @@ char *xPC; char **sstrs[] = { &AL, &BC, &BT, &CD, &CE, &CL, &CM, &xCR, &DC, &DL, &DM, &DO, &ED, &EI, &F0, &F1, &F2, &F3, &F4, &F5, &F6, &F7, &F8, &F9, - &HO, &IC, &IM, &IP, &KD, &KE, &KH, &KL, &KR, &KS, &KU, &LL, - &ND, &xNL, &xPC, &SE, &SF, &SO, &SR, &TA, &TE, &TI, &UP, &VB, &VS, &VE + &HO, &IC, &IM, &IP, &KD, &KE, &KH, &KL, &KR, &KS, &KU, &LL, &ND, &xNL, + &xPC, &SE, &SF, &SO, &SR, &TA, &TE, &TI, &UP, &VA, &VB, &VD, &VS, &VE }; bool *sflags[] = { &AM, &BS, &DA, &DB, &EO, &HC, &HZ, &IN, &MI, &NC, &NS, &OS, &UL, - &XB, &XN, &XT, &XV, &XX + &XB, &XN, &XT, &XX }; char **fkeys[10] = { &F0, &F1, &F2, &F3, &F4, &F5, &F6, &F7, &F8, &F9 @@ -89,6 +89,14 @@ setterm(type) arrows[3].cap = KR; arrows[3].mapto = "l"; arrows[3].descr = "right"; arrows[4].cap = KH; arrows[4].mapto = "H"; arrows[4].descr = "home"; + /* + * Handle funny termcap capabilities + */ + if (VA) AL=""; + if (VD) DL=""; + if (IC && IM==NULL) IM=""; + if (IC && EI==NULL) EI=""; + #ifdef TIOCLGET /* * Now map users susp char to ^Z, being careful that the susp @@ -146,13 +154,13 @@ zap() register bool **fp; register char ***sp; - namp = "ambsdadbeohchzinmincnsosulxbxnxtxvxx"; + namp = "ambsdadbeohchzinmincnsosulxbxnxtxx"; fp = sflags; do { *(*fp++) = tgetflag(namp); namp += 2; } while (*namp); - namp = "albcbtcdceclcmcrdcdldmdoedeik0k1k2k3k4k5k6k7k8k9hoicimipkdkekhklkrkskullndnlpcsesfsosrtatetiupvbvsve"; + namp = "albcbtcdceclcmcrdcdldmdoedeik0k1k2k3k4k5k6k7k8k9hoicimipkdkekhklkrkskullndnlpcsesfsosrtatetiupvavbvdvsve"; sp = sstrs; do { *(*sp++) = tgetstr(namp, &aoftspace); diff --git a/usr/src/usr.bin/ex/ex_tune.h b/usr/src/usr.bin/ex/ex_tune.h index ee86f91d41..c2e91b43d3 100644 --- a/usr/src/usr.bin/ex/ex_tune.h +++ b/usr/src/usr.bin/ex/ex_tune.h @@ -1,5 +1,5 @@ /* Copyright (c) 1981 Regents of the University of California */ -/* sccs id: @(#)ex_tune.h 7.2 %G% */ +/* sccs id: @(#)ex_tune.h 7.3 %G% */ /* * Definitions of editor parameters and limits */ @@ -38,10 +38,16 @@ #define ESIZE 512 #define CRSIZE 1024 #else +#ifdef u370 +#define LBSIZE 4096 +#define ESIZE 512 +#define CRSIZE 4096 +#else #define LBSIZE 512 /* Line length */ #define ESIZE 128 /* Size of compiled re */ #define CRSIZE 512 #endif +#endif #define RHSSIZE 256 /* Size of rhs of substitute */ #define NBRA 9 /* Number of re \( \) pairs */ #define TAGSIZE 32 /* Tag length */ diff --git a/usr/src/usr.bin/ex/ex_v.c b/usr/src/usr.bin/ex/ex_v.c index 721519281c..fa7f6c06ea 100644 --- a/usr/src/usr.bin/ex/ex_v.c +++ b/usr/src/usr.bin/ex/ex_v.c @@ -1,5 +1,5 @@ /* Copyright (c) 1981 Regents of the University of California */ -static char *sccsid = "@(#)ex_v.c 7.1 %G%"; +static char *sccsid = "@(#)ex_v.c 7.2 %G%"; #include "ex.h" #include "ex_re.h" #include "ex_tty.h" @@ -50,10 +50,15 @@ static char *sccsid = "@(#)ex_v.c 7.1 %G%"; /* * Enter open mode */ +#ifdef u370 +char atube[TUBESIZE+LBSIZE]; +#endif oop() { register char *ic; +#ifndef u370 char atube[TUBESIZE + LBSIZE]; +#endif ttymode f; /* mjm: was register */ ovbeg(); @@ -153,7 +158,9 @@ ovend(f) vop() { register int c; +#ifndef u370 char atube[TUBESIZE + LBSIZE]; +#endif ttymode f; /* mjm: was register */ if (!CA && UP == NOSTR) { diff --git a/usr/src/usr.bin/ex/ex_vadj.c b/usr/src/usr.bin/ex/ex_vadj.c index 2f1c174fba..2a3408d67f 100644 --- a/usr/src/usr.bin/ex/ex_vadj.c +++ b/usr/src/usr.bin/ex/ex_vadj.c @@ -1,5 +1,5 @@ /* Copyright (c) 1981 Regents of the University of California */ -static char *sccsid = "@(#)ex_vadj.c 7.1 %G%"; +static char *sccsid = "@(#)ex_vadj.c 7.2 %G%"; #include "ex.h" #include "ex_tty.h" #include "ex_vis.h" @@ -256,14 +256,14 @@ vinslin(p, cnt, l) * Use insert line. */ vgoto(p, 0); - if (XV) - vputp(tgoto(AL, 0, p), WECHO + 1 - p); + if (VA) + vputp(tgoto(VA, 0, p), WECHO + 1 - p); else vputp(AL, WECHO + 1 - p); for (i = cnt - 1; i > 0; i--) { vgoto(outline+1, 0); - if (XV) - vputp(tgoto(AL, 0, outline+1), WECHO + 1 - outline); + if (VA) + vputp(tgoto(VA, 0, outline+1), WECHO + 1 - outline); else vputp(AL, WECHO + 1 - outline); if ((hold & HOLDAT) == 0) @@ -727,8 +727,8 @@ vdellin(p, cnt, l) */ vgoto(p, 0); for (i = 0; i < cnt; i++) - if (XV) - vputp(tgoto(DL, 0, p), WECHO - p); + if (VD) + vputp(tgoto(VD, 0, p), WECHO - p); else vputp(DL, WECHO - p); vadjDL(p, cnt); diff --git a/usr/src/usr.bin/ex/ex_vis.h b/usr/src/usr.bin/ex/ex_vis.h index e4a3cdb707..cf6ebecccb 100644 --- a/usr/src/usr.bin/ex/ex_vis.h +++ b/usr/src/usr.bin/ex/ex_vis.h @@ -1,5 +1,5 @@ /* Copyright (c) 1981 Regents of the University of California */ -/* sccs id: @(#)ex_vis.h 7.2 %G% */ +/* sccs id: @(#)ex_vis.h 7.1 7/8/81 */ /* * Ex version 3 * Mark Horton, UCB @@ -17,8 +17,8 @@ * line is longer than 80. */ -var short bastate; -var short state; +var short bastate; +var short state; #define VISUAL 0 #define CRTOPEN 1 @@ -38,20 +38,20 @@ var short state; * If WBOT!=WECHO then WECHO will be the last line on the screen * and WBOT is the line before it. */ -var short basWTOP; -var short basWLINES; -var short WTOP; -var short WBOT; -var short WLINES; -var short WCOLS; -var short WECHO; +var short basWTOP; +var short basWLINES; +var short WTOP; +var short WBOT; +var short WLINES; +var short WCOLS; +var short WECHO; /* * When we are dealing with the echo area we consider the window * to be "split" and set the variable splitw. Otherwise, moving * off the bottom of the screen into WECHO causes a screen rollup. */ -var bool splitw; +var bool splitw; /* * Information about each line currently on the screen includes @@ -66,7 +66,7 @@ struct vlinfo { short vdepth; /* Depth of displayed line */ /*mjm: was char */ short vflags; /* Is line potentially dirty ? */ }; -var struct vlinfo vlinfo[TUBELINES + 2]; +var struct vlinfo vlinfo[TUBELINES + 2]; #define DEPTH(c) (vlinfo[c].vdepth) #define LINE(c) (vlinfo[c].vliny) @@ -93,8 +93,8 @@ var struct vlinfo vlinfo[TUBELINES + 2]; * Vcline is intimately tied to the current value of dot, * and when command mode is used as a subroutine fancy footwork occurs. */ -var short vcline; -var short vcnt; +var short vcline; +var short vcnt; /* * To allow many optimizations on output, an exact image of the terminal @@ -104,8 +104,8 @@ var short vcnt; * data itself. It is also rearranged during insert mode across line * boundaries to make incore work easier. */ -var char *vtube[TUBELINES]; -var char *vtube0; +var char *vtube[TUBELINES]; +var char *vtube0; /* * The current cursor position within the current line is kept in @@ -115,9 +115,9 @@ var char *vtube0; * lines to mark the other end of the affected area, or the target * for a motion. */ -var char *cursor; -var char *wcursor; -var line *wdot; +var char *cursor; +var char *wcursor; +var line *wdot; /* * Undo information is saved in a LBSIZE buffer at "vutmp" for changes @@ -133,8 +133,8 @@ var line *wdot; #define VMCHNG 4 #define VMANYINS 5 -var short vundkind; /* Which kind of undo - from above */ -var char *vutmp; /* Prev line image when "VCHNG" */ +var short vundkind; /* Which kind of undo - from above */ +var char *vutmp; /* Prev line image when "VCHNG" */ /* * State information for undoing of macros. The basic idea is that @@ -148,7 +148,7 @@ var char *vutmp; /* Prev line image when "VCHNG" */ #define VC_ONECHANGE 2 /* In a macro, one change so far */ #define VC_MANYCHANGE 3 /* In a macro, at least 2 changes so far */ -var short vch_mac; /* Change state - one of the above */ +var short vch_mac; /* Change state - one of the above */ /* * For U undo's the line is grabbed by "vmove" after it first appears @@ -157,9 +157,9 @@ var short vch_mac; /* Change state - one of the above */ * are made, i.e. after a 'J' join. This is because a 'JU' would * lose completely the text of the line just joined on. */ -var char *vUNDcurs; /* Cursor just before 'U' */ -var line *vUNDdot; /* The line address of line saved in vUNDsav */ -var line vUNDsav; /* Grabbed initial "*dot" */ +var char *vUNDcurs; /* Cursor just before 'U' */ +var line *vUNDdot; /* The line address of line saved in vUNDsav */ +var line vUNDsav; /* Grabbed initial "*dot" */ #define killU() vUNDdot = NOLINE @@ -189,8 +189,8 @@ var line vUNDsav; /* Grabbed initial "*dot" */ * is actually needed is recorded in heldech, which says that a clear * of the echo area was actually held off. */ -var short hold; -var short holdupd; /* Hold off update when echo line is too long */ +var short hold; +var short holdupd; /* Hold off update when echo line is too long */ #define HOLDAT 1 #define HOLDDOL 2 @@ -203,43 +203,43 @@ var short holdupd; /* Hold off update when echo line is too long */ /* * Miscellaneous variables */ -var short CDCNT; /* Count of ^D's in insert on this line */ -var char DEL[VBSIZE]; /* Last deleted text */ -var bool HADUP; /* This insert line started with ^ then ^D */ -var bool HADZERO; /* This insert line started with 0 then ^D */ -var char INS[VBSIZE]; /* Last inserted text */ -var int Vlines; /* Number of file lines "before" vi command */ -var int Xcnt; /* External variable holding last cmd's count */ -var bool Xhadcnt; /* Last command had explicit count? */ -var short ZERO; -var short dir; /* Direction for search (+1 or -1) */ -var short doomed; /* Disply chars right of cursor to be killed */ -var bool gobblebl; /* Wrapmargin space generated nl, eat a space */ -var bool hadcnt; /* (Almost) internal to vmain() */ -var bool heldech; /* We owe a clear of echo area */ -var bool insmode; /* Are in character insert mode */ -var char lastcmd[5]; /* Chars in last command */ -var int lastcnt; /* Count for last command */ -var char *lastcp; /* Save current command here to repeat */ -var bool lasthad; /* Last command had a count? */ -var short lastvgk; /* Previous input key, if not from keyboard */ -var short lastreg; /* Register with last command */ -var char *ncols['z'-'a'+2]; /* Cursor positions of marks */ -var char *notenam; /* Name to be noted with change count */ -var char *notesgn; /* Change count from last command */ -var char op; /* Operation of current command */ -var short Peekkey; /* Peek ahead key */ -var bool rubble; /* Line is filthy (in hardcopy open), redraw! */ -var int vSCROLL; /* Number lines to scroll on ^D/^U */ -var char *vglobp; /* Untyped input (e.g. repeat insert text) */ -var char vmacbuf[VBSIZE]; /* Text of visual macro, hence nonnestable */ -var char *vmacp; /* Like vglobp but for visual macros */ -var char *vmcurs; /* Cursor for restore after undo d), e.g. */ -var short vmovcol; /* Column to try to keep on arrow keys */ -var bool vmoving; /* Are trying to keep vmovcol */ -var short vreg; /* Reg for this command */ /* mjm: was char */ -var short wdkind; /* Liberal/conservative words? */ -var char workcmd[5]; /* Temporary for lastcmd */ +var short CDCNT; /* Count of ^D's in insert on this line */ +var char DEL[VBSIZE]; /* Last deleted text */ +var bool HADUP; /* This insert line started with ^ then ^D */ +var bool HADZERO; /* This insert line started with 0 then ^D */ +var char INS[VBSIZE]; /* Last inserted text */ +var int Vlines; /* Number of file lines "before" vi command */ +var int Xcnt; /* External variable holding last cmd's count */ +var bool Xhadcnt; /* Last command had explicit count? */ +var short ZERO; +var short dir; /* Direction for search (+1 or -1) */ +var short doomed; /* Disply chars right of cursor to be killed */ +var bool gobblebl; /* Wrapmargin space generated nl, eat a space */ +var bool hadcnt; /* (Almost) internal to vmain() */ +var bool heldech; /* We owe a clear of echo area */ +var bool insmode; /* Are in character insert mode */ +var char lastcmd[5]; /* Chars in last command */ +var int lastcnt; /* Count for last command */ +var char *lastcp; /* Save current command here to repeat */ +var bool lasthad; /* Last command had a count? */ +var short lastvgk; /* Previous input key, if not from keyboard */ +var short lastreg; /* Register with last command */ +var char *ncols['z'-'a'+2]; /* Cursor positions of marks */ +var char *notenam; /* Name to be noted with change count */ +var char *notesgn; /* Change count from last command */ +var char op; /* Operation of current command */ +var short Peekkey; /* Peek ahead key */ +var bool rubble; /* Line is filthy (in hardcopy open), redraw! */ +var int vSCROLL; /* Number lines to scroll on ^D/^U */ +var char *vglobp; /* Untyped input (e.g. repeat insert text) */ +var char vmacbuf[VBSIZE]; /* Text of visual macro, hence nonnestable */ +var char *vmacp; /* Like vglobp but for visual macros */ +var char *vmcurs; /* Cursor for restore after undo d), e.g. */ +var short vmovcol; /* Column to try to keep on arrow keys */ +var bool vmoving; /* Are trying to keep vmovcol */ +var short vreg; /* Reg for this command */ /* mjm: was char */ +var short wdkind; /* Liberal/conservative words? */ +var char workcmd[5]; /* Temporary for lastcmd */ /* -- 2.20.1