Subversion Repositories planix.SVN

Compare Revisions

Ignore whitespace Rev 114 → Rev 115

/ports/trunk/editors/rvi/Makefile
28,7 → 28,7
BINDIR = bin
DESTDIR = /usr/local
DEBUGFLAGS= -DTRACE -g
NONDEBUGFLAGS= -O0
NONDEBUGFLAGS= -O
DEB= $(NONDEBUGFLAGS) # or $(DEBUGFLAGS) to to debug
# this should be correct for any modern Unix
OPTIONS=-DLISPCODE -DCHDIR -DFASTTAG -DUSG3TTY -DVMUNIX -DBIGMEM -D_BSD_EXTENSION -DTRACE
39,7 → 39,7
 
# That's it.
 
CFLAGS= $(OPTIONS) $(DEB) -DUSG3TTY -DVMUNIX -g
CFLAGS= $(OPTIONS) $(DEB) -DUSG3TTY -DVMUNIX -Wno-return-type
INCLUDE=/usr/include
OBJS= ex.o ex_addr.o ex_cmds.o ex_cmds2.o ex_cmdsub.o \
ex_data.o ex_extern.o ex_get.o ex_io.o ex_put.o ex_re.o \
/ports/trunk/editors/rvi/ex.c
88,8 → 88,6
register int ac;
register char *av[];
{
 
#ifndef VMUNIX
char *erpath = EXSTRINGS;
#endif
112,8 → 110,6
mallopt(M_MMAP_THRESHOLD, 0);
#endif
 
 
/*
* Immediately grab the tty modes so that we wont
* get messed up if an interrupt comes in quickly.
231,7 → 227,7
ac--, av++;
itag = 1;
/* BUG: should check for too long tag. */
strcpy(lasttag, av[0]);
CP(lasttag, av[0]);
}
break;
 
296,7 → 292,7
filioerr(EXRECOVER);
exit(1);
}
strcpy(savedfile, *av++), ac--;
CP(savedfile, *av++), ac--;
}
 
/*
316,7 → 312,7
intty = isatty(0);
value(PROMPT) = intty;
if (cp = getenv("SHELL"))
strcpy(shell, cp);
CP(shell, cp);
if (fast || !intty)
setterm("dumb");
else {
/ports/trunk/editors/rvi/ex.h
282,9 → 282,7
/*
* Macros
*/
/*#define CP(a, b) (ignore(strcpy(a, b)))*/
#define CP(a,b) error error error
 
#define CP(a, b) (ignore(strcpy(a, b)))
/*
* FIXUNDO: do we want to mung undo vars?
* Usually yes unless in a macro or global.
373,11 → 371,11
#define NOSTR (char *) 0
#define NOLINE (line *) 0
 
extern void (*Outchar)(int);
extern int (*Outchar)();
extern int (*Pline)();
extern void (*Putchar)(short);
extern int (*Putchar)();
void (*oldhup)();
void (*setlist())();
int (*setlist())();
int (*setnorm())();
int (*setnorm())();
int (*setnumb())();
406,8 → 404,8
char *vinit();
char *vpastwh();
char *vskipwh();
void put();
void putreg();
int put();
int putreg();
int YANKreg();
int delete();
int execl();
416,9 → 414,9
int getsub();
int gettty();
int join();
void listchar(short);
int listchar();
off_t lseek();
void normchar(short);
int normchar();
int normline();
int numbline();
var void (*oldquit)();
427,13 → 425,13
void onsusp();
int putch();
int shift();
void termchar();
void vfilter();
int termchar();
int vfilter();
#ifdef CBREAK
void vintr();
#endif
int vputch();
void vshftop();
int vshftop();
int yank();
 
int tgets(char *, int cnt, int fd);
/ports/trunk/editors/rvi/ex_cmds2.c
16,10 → 16,6
 
extern bool pflag, nflag; /* mjm: extern; also in ex_cmds.c */
extern int poffset; /* mjm: extern; also in ex_cmds.c */
void vcontin(bool ask);
void resetflav();
void setflav();
void error0();
 
/*
* Subroutines for major command loop.
117,7 → 113,6
* just fixing up the echo area for the print.
* Otherwise we reset a number of externals, and discard unused input.
*/
void
error0()
{
 
126,7 → 121,7
fixech();
if (!SO || !SE)
dingdong();
return;
return 0;
}
if (input) {
input = strend(input) - 1;
252,8 → 247,8
morargc = argc;
isalt = (strcmp(altfile, args)==0) + 1;
if (savedfile[0])
strcpy(altfile, savedfile);
strcpy(savedfile, args);
CP(altfile, savedfile);
CP(savedfile, args);
argc--;
args = argv ? *++argv : strend(args) + 1;
}
262,7 → 257,6
* Eat trailing flags and offsets after a command,
* saving for possible later post-command prints.
*/
void
newline()
{
register int c;
300,7 → 294,7
case '"':
comment();
setflav();
return;
return 0;
 
default:
if (!endcmd(c))
308,7 → 302,7
if (c == EOF)
ungetchar(c);
setflav();
return;
return 0;
}
pflag++;
}
318,12 → 312,11
* Before quit or respec of arg list, check that there are
* no more files in the arg list.
*/
void
nomore()
{
 
if (argc == 0 || morargc == argc)
return;
return 0;
morargc = argc;
merror("%d more file", argc);
serror("%s@to edit", plural((long) argc));
351,12 → 344,11
/*
* Reset the flavor of the output to print mode with no numbering.
*/
void
resetflav()
{
 
if (inopen)
return;
return 0;
listf = 0;
nflag = 0;
pflag = 0;
388,12 → 380,11
* and either use normally decoded (ARPAnet standard) characters or list mode,
* where end of lines are marked and tabs print as ^I.
*/
void
setflav()
{
 
if (inopen)
return;
return 0;
setnumb(nflag || value(NUMBER));
setlist(listf || value(LIST));
setoutt();
479,8 → 470,8
/*
* Continue after a : command from open/visual.
*/
void
vcontin(bool ask)
vcontin(ask)
bool ask;
{
 
if (vcnt > 0)
505,7 → 496,7
putch('\r');
putch('\n');
}
return;
return 0;
}
if (ask) {
merror("[Hit return to continue] ");
/ports/trunk/editors/rvi/ex_cmdsub.c
23,11 → 23,6
bool endline = 1;
line *tad1;
static jnoop();
void addmac(char *src,char * dest,char * dname,struct maps *mp);
void somechange();
void zop2(int lines, int op);
void put();
void squish();
 
/*
* Append after line a lines returned by function f.
185,7 → 180,6
* Crush out the undo save area, moving the open/visual
* save area down in its place.
*/
void
squish()
{
register line *a1 = dol + 1, *a2 = unddol + 1, *a3 = truedol + 1;
355,7 → 349,6
return (0);
}
 
void
put()
{
register int cnt;
462,7 → 455,7
}
if (cp + strlen(dp = vpastwh(linebuf)) >= &genbuf[LBSIZE - 2])
error("Line too long|Result line after shift would be too long");
strcpy(cp, dp);
CP(cp, dp);
strcLIN(genbuf);
putmark(addr);
}
473,7 → 466,6
* Find a tag in the tags file.
* Most work here is in parsing the tags file itself.
*/
void
tagfind(quick)
bool quick;
{
518,7 → 510,7
/*
* Loop once for each file in tags "path".
*/
strcpy(tagfbuf, svalue(TAGS));
CP(tagfbuf, svalue(TAGS));
fne = tagfbuf - 1;
while (fne) {
fn = ++fne;
786,7 → 778,6
putnl();
}
 
void
zop2(lines, op)
register int lines;
register int op;
1044,7 → 1035,6
* Be (almost completely) sure there really
* was a change, before claiming to undo.
*/
void
somechange()
{
register line *ip, *jp;
1082,7 → 1072,6
* Map command:
* map src dest
*/
void
mapcmd(un, ab)
int un; /* true if this is unmap command */
int ab; /* true if this is abbr command */
1179,7 → 1168,6
* using NOSTR for dest. Dname is what to show in listings. mp is
* the structure to affect (arrows, etc).
*/
void
addmac(src,dest,dname,mp)
register char *src, *dest, *dname;
register struct maps *mp;
1256,14 → 1244,14
/* Check is a bit conservative, we charge for dname even if reusing src */
if (msnext - mapspace + strlen(dest) + strlen(src) + strlen(dname) + 3 > MAXCHARMACS)
error("Too much macro text");
strcpy(msnext, src);
CP(msnext, src);
mp[slot].cap = msnext;
msnext += strlen(src) + 1; /* plus 1 for null on the end */
strcpy(msnext, dest);
CP(msnext, dest);
mp[slot].mapto = msnext;
msnext += strlen(dest) + 1;
if (dname) {
strcpy(msnext, dname);
CP(msnext, dname);
mp[slot].descr = msnext;
msnext += strlen(dname) + 1;
} else {
/ports/trunk/editors/rvi/ex_data.c
4,6 → 4,9
* specifies the terms and conditions for redistribution.
*/
 
#if !defined(lint) && defined(DOSCCS)
static char *sccsid = "@(#)ex_data.c 7.5 (Berkeley) 8/29/85";
#endif
 
#include "ex.h"
#include "ex_tty.h"
41,10 → 44,7
short COLUMNS = 80;
short LINES = 24;
 
 
struct option options[NOPTS + 1] = {
/* name abbrev type def. val osval */
"autoindent", "ai", ONOFF, 0, 0, 0,
"autoprint", "ap", ONOFF, 1, 1, 0,
"autowrite", "aw", ONOFF, 0, 0, 0,
/ports/trunk/editors/rvi/ex_get.c
228,7 → 228,7
for (; c > 0; c--)
*cp++ = ' ';
}
strcpy(cp, genbuf);
CP(cp, genbuf);
if (linebuf[0] == '.' && linebuf[1] == 0)
return (EOF);
return (0);
261,7 → 261,7
 
default:
cp--;
strcpy(ocp, cp);
CP(ocp, cp);
return (col);
}
}
/ports/trunk/editors/rvi/ex_io.c
13,10 → 13,6
#include "ex_temp.h"
#include "ex_tty.h"
#include "ex_vis.h"
void
checkmodeline(char * li_ne);
void
putfile(int isfilter);
 
/*
* File input/output, source, preserve and recover
45,7 → 41,6
* If comm is E then command is doomed and we are
* parsing just so user won't have to retype the name.
*/
void
filename(comm)
int comm;
{
56,7 → 51,7
if (endcmd(d)) {
if (savedfile[0] == 0 && comm != 'f')
error("No file|No current filename");
strcpy(file, savedfile);
CP(file, savedfile);
wasalt = (isalt > 0) ? isalt-1 : 0;
isalt = 0;
oldadot = altdot;
83,9 → 78,9
case 'e':
if (savedfile[0]) {
altdot = lineDOT();
strcpy(altfile, savedfile);
CP(altfile, savedfile);
}
strcpy(savedfile, file);
CP(savedfile, file);
break;
 
default:
92,7 → 87,7
if (file[0]) {
if (c != 'E')
altdot = lineDOT();
strcpy(altfile, file);
CP(altfile, file);
}
break;
}
148,7 → 143,7
}
if (skipend())
return (0);
strcpy(genbuf, "echo "); cp = &genbuf[5];
CP(genbuf, "echo "); cp = &genbuf[5];
for (;;) {
c = getchar();
if (endcmd(c)) {
196,7 → 191,6
* Glob the argument words in genbuf, or if no globbing
* is implied, just split them up directly.
*/
void
glob(gp)
struct glob *gp;
{
314,7 → 308,7
if (strlen(str) > FNSIZE - 4)
error("Filename too long");
samef:
strcpy(file, str);
CP(file, str);
}
 
/*
321,7 → 315,6
* Read a file from the world.
* C is command, 'e' if this really an edit (or a recover).
*/
void
rop(c)
int c;
{
553,7 → 546,7
saddr2=addr2;
addr1=one;
addr2=dol;
strcpy(file, savedfile);
CP(file, savedfile);
if (inopen) {
vclrech(0);
splitw++;
708,7 → 701,6
/*
* Write a range onto the io stream.
*/
void
putfile(isfilter)
int isfilter;
{
782,7 → 774,6
short slevel;
short ttyindes;
 
void
source(fil, okfail)
char *fil;
bool okfail;
895,7 → 886,6
# define rindex strrchr
#endif
 
void
checkmodeline(li_ne)
char *li_ne;
{
/ports/trunk/editors/rvi/ex_put.c
28,22 → 28,15
* During open/visual, outchar and putchar will be set to
* routines in the file ex_vput.c (vputchar, vinschar, etc.).
*/
void (*Outchar)() = termchar;
void (*Putchar)(short) = normchar;
int (*Outchar)() = termchar;
int (*Putchar)() = normchar;
int (*Pline)() = normline;
void
pstop();
void
pstart();
void slobber(int c);
void normchar(short c);
void listchar(short c);
 
void (*
int (*
setlist(t))()
bool t;
{
register void (*P)();
register int (*P)();
 
listf = t;
P = Putchar;
67,8 → 60,8
* Format c for list mode; leave things in common
* with normal print mode to be done by normchar.
*/
void
listchar(short c)
listchar(c)
register short c;
{
 
c &= (TRIM|QUOTE);
100,8 → 93,8
/*
* Format c for printing.
*/
void
normchar(short c)
normchar(c)
register short c;
{
register char *colp;
 
162,7 → 155,6
* the printing of the line will erase or otherwise obliterate
* the prompt which was printed before. If it won't, do it now.
*/
void
slobber(c)
int c;
{
223,7 → 215,6
* Otherwise flush into next level of buffering when
* small buffer fills or at a newline.
*/
void
termchar(c)
int c;
{
795,7 → 786,6
putchar('\n');
}
 
void
putS(cp)
char *cp;
{
862,7 → 852,7
lprintf(cp, dp)
char *cp, *dp;
{
register void (*P)();
register int (*P)();
 
P = setlist(1);
printf(cp, dp);
882,7 → 872,6
/*
* Try to start -nl mode.
*/
void
pstart()
{
 
909,7 → 898,6
/*
* Stop -nl mode.
*/
void
pstop()
{
 
/ports/trunk/editors/rvi/ex_re.c
10,8 → 10,6
 
#include "ex.h"
#include "ex_re.h"
void
snote(int total, int lines);
 
/*
* Global, substitute and regular expressions.
145,7 → 143,6
* and g/r.e./.,/r.e.2/d are not treated specially. There is no
* good reason for this except the question: where to you draw the line?
*/
void
gdelete()
{
register line *a1, *a2, *a3;
289,7 → 286,7
char orhsbuf[RHSSIZE];
 
rp = rhsbuf;
strcpy(orhsbuf, rp);
CP(orhsbuf, rp);
for (;;) {
c = getchar();
if (c == seof)
523,7 → 520,6
return (sp);
}
 
void
snote(total, lines)
register int total, lines;
{
/ports/trunk/editors/rvi/ex_set.c
17,7 → 17,6
*/
char optname[ONMSZ];
 
void
set()
{
register char *cp;
145,7 → 144,7
error("Can't change type of terminal from within open/visual");
setterm(optname);
} else {
strcpy(op->osvalue, optname);
CP(op->osvalue, optname);
op->odefault = 1;
}
break;
/ports/trunk/editors/rvi/ex_subr.c
13,14 → 13,6
#include "ex_tty.h"
#include "ex_vis.h"
 
void
save(line *a1, line *a2);
void qcount(int c);
void
netchange(int i);
void
killcnt(int cnt);
 
/*
* Random routines, in alphabetical order.
*/
147,7 → 139,7
genbuf[0] = 0;
return (i);
}
strcpy(genindent(i), cp);
CP(genindent(i), cp);
return (i);
}
 
252,7 → 244,6
killcnt(addr2 - addr1 + 1);
}
 
void
killcnt(cnt)
register int cnt;
{
354,7 → 345,6
}
 
/*VARARGS2*/
void
merror(seekpt, i)
#ifdef VMUNIX
char *seekpt;
400,7 → 390,7
#else
lseek(erfile, (long) seekpt, 0);
if (read(erfile, linebuf, 128) < 2)
strcpy(linebuf, "ERROR");
CP(linebuf, "ERROR");
#endif
}
 
445,7 → 435,6
netchange(lineDOL() - cnt);
}
 
void
netchange(i)
register int i;
{
497,6 → 486,7
return (i == 1 ? "" : "s");
}
 
int qcount();
short vcntcol;
 
qcolumn(lim, gp)
503,7 → 493,7
register char *lim, *gp;
{
register int x;
void (*OO)();
int (*OO)();
 
OO = Outchar;
Outchar = qcount;
520,7 → 510,7
return (vcntcol);
}
 
void
int
qcount(c)
int c;
{
532,7 → 522,6
vcntcol++;
}
 
void
reverse(a1, a2)
register line *a1, *a2;
{
547,7 → 536,6
}
}
 
void
save(a1, a2)
line *a1;
register line *a2;
622,7 → 610,6
}
 
/*VARARGS2*/
void
smerror(seekpt, cp)
#ifdef lint
char *seekpt;
658,7 → 645,7
char *dp;
{
 
strcpy(linebuf, dp);
CP(linebuf, dp);
}
 
syserror()
693,7 → 680,7
int i;
{
register char *cp;
register void (*OO)() = Outchar;
register int (*OO)() = Outchar;
 
Outchar = qcount;
ignore(qcolumn(linebuf - 1, NOSTR));
/ports/trunk/editors/rvi/ex_temp.c
13,9 → 13,6
#include "ex_vis.h"
#include "ex_tty.h"
 
void rbflush();
void blkio(short , char * , int (*f)());
 
/*
* Editor temporary file routines.
* Very similar to those of ed, except uses 2 input buffers.
29,7 → 26,6
short tfile = -1;
short rfile = -1;
 
void
fileinit()
{
register char *p;
48,7 → 44,7
iblock = -1;
iblock2 = -1;
oblock = -1;
strcpy(tfname, svalue(DIRECTORY));
CP(tfname, svalue(DIRECTORY));
if (stat(tfname, &stbuf)) {
dumbness:
if (setexit() == 0)
210,12 → 206,10
int stilinc; /* up to here not written yet */
#endif
 
/*void
blkio(b, buf, iofcn)
short b;
char *buf;
int (*iofcn)(); */
void blkio(short b, char *buf , int (*iofcn)())
int (*iofcn)();
{
 
#ifdef VMUNIX
261,7 → 255,6
* Synchronize the state of the temporary file in case
* a crash occurs.
*/
void
synctmp()
{
register int cnt;
378,7 → 371,7
{
 
if (rfile == -1) {
strcpy(rfname, tfname);
CP(rfname, tfname);
*(strend(rfname) - 7) = 'R';
rfile = creat(rfname, 0600);
if (rfile < 0)
462,7 → 455,6
 
int getREG();
 
void
putreg(c)
char c;
{
567,7 → 559,7
rblock = 0;
rnleft = 0;
}
strcpy(savelb,linebuf);
CP(savelb,linebuf);
for (addr = addr1; addr <= addr2; addr++) {
getline(*addr);
if (sp->rg_flags) {
580,7 → 572,7
}
rbflush();
killed();
strcpy(linebuf,savelb);
CP(linebuf,savelb);
}
 
kshift()
618,7 → 610,6
*rbufcp = 0;
}
 
void
rbflush()
{
register struct strreg *sp = strp;
/ports/trunk/editors/rvi/ex_tty.c
74,7 → 74,7
#endif
if (tgetent(ltcbuf, type) != 1) {
unknown++;
strcpy(ltcbuf, "xx|dumb:");
CP(ltcbuf, "xx|dumb:");
}
setsize();
aoftspace = tspace;
140,7 → 140,7
costRP = cost(tgoto(RIGHT_PARM, 10, 10));
PC = xPC ? xPC[0] : 0;
aoftspace = tspace;
strcpy(ttytype, longname(ltcbuf, type));
CP(ttytype, longname(ltcbuf, type));
/* proper strings to change tty type */
termreset();
gettmode();
/ports/trunk/editors/rvi/ex_unix.c
29,7 → 29,7
char printub, puxb[UXBSIZE + sizeof (int)];
 
printub = 0;
strcpy(puxb, uxb);
CP(puxb, uxb);
c = getchar();
if (c == '\n' || c == EOF)
error("Incomplete shell escape command@- use 'shell' to get a shell");
/ports/trunk/editors/rvi/ex_v.c
13,11 → 13,6
#include "ex_tty.h"
#include "ex_vis.h"
 
void vsetsiz(int size);
void
savevis();
 
 
/*
* Entry points to open and visual from command mode processor.
* The open/visual code breaks down roughly as follows:
184,20 → 179,9
netchHAD(Vlines);
}
 
 
/*
#define _RESEARCH_SOURCE
#include <libv.h>
#include <stdlib.h>
#include <unistd.h>
#include <termios.h>
*/
 
 
/*
* Enter visual mode
*/
void
vop()
{
register int c;
296,7 → 280,6
* at some point, and then quit from the visual and undo
* you get the old file back. Somewhat weird.
*/
void
savevis()
{
 
444,7 → 427,6
* Set the size of the screen to size lines, to take effect the
* next time the screen is redrawn.
*/
void
vsetsiz(size)
int size;
{
/ports/trunk/editors/rvi/ex_vadj.c
12,20 → 12,6
#include "ex_tty.h"
#include "ex_vis.h"
 
void
sethard();
void vreplace(int l, int cnt, int newcnt);
void vsync1(int p);
void vdirty(int base, int i);
void vdellin(int p, int cnt, int l);
void vredraw(int p);
void vscrap();
void
vscroll(int cnt);
void
vmoveitup(int cnt, bool doclr);
 
 
/*
* Routines to deal with management of logical versus physical
* display, opening and redisplaying lines on the screen, and
420,15 → 406,9
* If doclr is true, do a clear eol if the terminal
* has standout (to prevent it from scrolling up)
*/
/*
void
vmoveitup(cnt, doclr)
register int cnt;
bool doclr;
*/
 
void
vmoveitup(int cnt, bool doclr)
{
 
if (cnt == 0)
459,7 → 439,6
/*
* Scroll the screen up cnt lines logically.
*/
void
vscroll(cnt)
register int cnt;
{
492,7 → 471,6
/*
* Discard logical lines due to physical wandering off the screen.
*/
void
vscrap()
{
register int i, j;
543,7 → 521,6
* Repaint the screen, with cursor at curs, aftern an arbitrary change.
* Handle notification on large changes.
*/
void
vrepaint(curs)
char *curs;
{
634,7 → 611,6
* line after last won't completely fit. The routine vsync is
* more conservative and much less work on dumb terminals.
*/
void
vredraw(p)
register int p;
{
663,7 → 639,7
* search for first logical line affected by the redraw.
*/
vscrap();
strcpy(temp, linebuf);
CP(temp, linebuf);
l = 0;
tp = dot - vcline;
if (vcnt == 0)
756,7 → 732,6
* Do the real work in deleting cnt lines starting at line p from
* the display. First affected line is line l.
*/
void
vdellin(p, cnt, l)
int p, cnt, l;
{
856,7 → 831,6
* The guts of a sync. Similar to redraw but
* just less ambitous.
*/
void
vsync1(p)
register int p;
{
877,7 → 851,7
if (state == HARDOPEN || splitw)
return;
vscrap();
strcpy(temp, linebuf);
CP(temp, linebuf);
if (vcnt == 0)
LINE(0) = WTOP;
l = 0;
955,7 → 929,6
*
* Many boundary conditions here.
*/
void
vreplace(l, cnt, newcnt)
int l, cnt, newcnt;
{
1095,7 → 1068,6
* If we are in a scroll ^D within hardcopy open then all this
* is suppressed.
*/
void
sethard()
{
 
1116,7 → 1088,6
* as dirty so that they will be checked for correct
* display at next sync/redraw.
*/
void
vdirty(base, i)
register int base, i;
{
/ports/trunk/editors/rvi/ex_vget.c
12,21 → 12,6
#include "ex_tty.h"
#include "ex_vis.h"
 
void macpush(char *st , int canundo);
 
#ifdef BIT8
int addto(short *buf, char *str);
#else
void addto(char *buf, char *str);
#endif
 
 
 
void
setLAST();
void
addtext(char *cp);
 
/*
* Input routines for open/visual.
* We handle reading from the echo area here as well as notification on
271,7 → 256,6
* the purposes of repeat, so copy it from
* the working to the previous command buffer.
*/
void
setLAST()
{
 
281,7 → 265,7
lasthad = Xhadcnt;
lastcnt = Xcnt;
*lastcp = 0;
strcpy(lastcmd, workcmd);
CP(lastcmd, workcmd);
}
 
/*
289,7 → 273,6
* If the insertion buffer oveflows, then destroy
* the repeatability of the insert.
*/
void
addtext(cp)
char *cp;
{
331,12 → 314,8
*wp = c;
}
 
 
/* XXX what is this???:
#ifdef BIT8
int
#else
void
#endif
addto(buf, str)
#ifndef BIT8
345,15 → 324,6
register short *buf;
register char *str;
#endif
*/
 
#ifdef BIT8
int addto(short *buf, char *str)
#else
void addto(char *buf, char *str)
#endif
 
{
 
if ((buf[0] & (QUOTE|TRIM)) == OVERBUF)
551,7 → 521,6
* is false for, for example, pushing back lookahead from fastpeekkey(),
* since otherwise two fast escapes can clobber our undo.
*/
void
macpush(st, canundo)
char *st;
int canundo;
589,7 → 558,6
}
 
#ifdef TRACE
void
visdump(s)
char *s;
{
607,7 → 575,6
tvliny();
}
 
void
vudump(s)
char *s;
{
621,7 → 588,7
fprintf(trace, " undadot=%d, dot=%d, dol=%d, unddol=%d, truedol=%d\n",
lineno(undadot), lineno(dot), lineno(dol), lineno(unddol), lineno(truedol));
fprintf(trace, " [\n");
strcpy(savelb, linebuf);
CP(savelb, linebuf);
fprintf(trace, "linebuf = '%s'\n", linebuf);
for (p=zero+1; p<=truedol; p++) {
fprintf(trace, "%o ", *p);
629,7 → 596,7
fprintf(trace, "'%s'\n", linebuf);
}
fprintf(trace, "]\n");
strcpy(linebuf, savelb);
CP(linebuf, savelb);
}
#endif
 
/ports/trunk/editors/rvi/ex_vis.h
227,9 → 227,9
var bool HADUP; /* This insert line started with ^ then ^D */
var bool HADZERO; /* This insert line started with 0 then ^D */
#ifndef BIT8
char INS[VBSIZE]; /* Last inserted text */
var char INS[VBSIZE]; /* Last inserted text */
#else
short INS[VBSIZE]; /* Last inserted text */
var short INS[VBSIZE]; /* Last inserted text */
#endif
var int Vlines; /* Number of file lines "before" vi command */
var int Xcnt; /* External variable holding last cmd's count */
296,12 → 296,12
* Function types
*/
int beep();
void qcount();
void vchange();
void vdelete();
int qcount();
int vchange();
int vdelete();
int vgrabit();
void vinschar();
void vmove();
void vputchar();
int vinschar();
int vmove();
int vputchar();
int vshift();
void vyankit();
int vyankit();
/ports/trunk/editors/rvi/ex_vmain.c
8,18 → 8,10
static char *sccsid = "@(#)ex_vmain.c 7.7 (Berkeley) 6/7/85";
#endif
 
 
#include "ex.h"
#include "ex_tty.h"
#include "ex_vis.h"
 
 
 
 
void vzop();
void vsave();
 
 
#ifdef BIT8
short *ss_strcpy(dest, src)
short *dest;
85,7 → 77,6
 
#define forbid(a) { if (a) goto fonfon; }
 
void
vmain()
{
register int c, cnt, i;
100,8 → 91,7
line *addr;
int ind, nlput;
int shouldpo = 0;
int onumber, olist, (*OPline)();
void (*OPutchar)();
int onumber, olist, (*OPline)(), (*OPutchar)();
 
vch_mac = VC_NOTINMAC;
 
686,7 → 676,7
vundkind = VCHNG;
vmoving = 0;
#ifndef BIT8
strcpy(vutmp, linebuf);
CP(vutmp, linebuf);
#else
sc_strcpy(vutmp, linebuf);
#endif
1262,9 → 1252,7
* and addr2 surrounding cnt lines starting at dot.
*/
vremote(cnt, f, arg)
int cnt;
void(*f)();
int arg;
int cnt, (*f)(), arg;
{
register int oing = inglobal;
 
1283,12 → 1271,11
/*
* Save the current contents of linebuf, if it has changed.
*/
void
vsave()
{
char temp[LBSIZE];
 
strcpy(temp, linebuf);
CP(temp, linebuf);
if (FIXUNDO && vundkind == VCHNG || vundkind == VCAPU) {
/*
* If the undo state is saved in the temporary buffer
1329,7 → 1316,6
* Do a z operation.
* Code here is rather long, and very uninteresting.
*/
void
vzop(hadcnt, cnt, c)
bool hadcnt;
int cnt;
/ports/trunk/editors/rvi/ex_voper.c
15,8 → 15,6
#define blank() isspace(wcursor[0])
#define forbid(a) if (a) goto errlab;
 
void eend();
 
char vscandir[2] = { '/', 0 };
 
/*
29,7 → 27,6
* and if wcursor is zero, then the first non-blank location of the
* other line is implied.
*/
void
operate(c, cnt)
register int c, cnt;
{
622,9 → 619,9
if (!vglobp)
vscandir[0] = genbuf[0];
#ifndef BIT8
oglobp = globp; strcpy(vutmp, genbuf); globp = vutmp;
oglobp = globp; CP(vutmp, genbuf); globp = vutmp;
#else
oglobp = globp; strcpy((char*)vutmp, genbuf);
oglobp = globp; CP((char*)vutmp, genbuf);
globp = (char*)vutmp;
#endif
d = peekc;
797,7 → 794,6
* To end of word, with operator op and cnt more motions
* remaining after this.
*/
void
eend(op)
register int (*op)();
{
/ports/trunk/editors/rvi/ex_vops.c
12,16 → 12,6
#include "ex_tty.h"
#include "ex_vis.h"
 
 
void vshftop();
void vchange();
void vrep();
void vyankit();
void vfilter();
void vfilter();
void vshftop();
void vchange();
 
/*
* This file defines the operation sequences which interface the
* logical changes to the file buffer with the internal and external
47,7 → 37,6
char *vUA1, *vUA2;
char *vUD1, *vUD2;
 
void
vUndo()
{
 
59,7 → 48,7
return;
}
#ifndef BIT8
strcpy(vutmp, linebuf);
CP(vutmp, linebuf);
#else
sc_strcpy(vutmp, linebuf);
#endif
86,7 → 75,7
register char *cp;
char temp[LBSIZE];
bool savenote;
void (*OO)();
int (*OO)();
short oldhold = hold;
 
switch (vundkind) {
168,8 → 157,7
* Pseudo insert command.
*/
vcursat(cursor);
OO = Outchar;
Outchar = vinschar; hold |= HOLDQIK;
OO = Outchar; Outchar = vinschar; hold |= HOLDQIK;
vprepins();
temp[vUA2 - linebuf] = 0;
for (cp = &temp[vUA1 - linebuf]; *cp;)
197,7 → 185,6
* opposed to an ex command). This has nothing to do with being
* in open/visual mode as :s/foo/bar is not fromvis.
*/
void
vmacchng(fromvis)
bool fromvis;
{
233,7 → 220,7
vudump("before vmacchng hairy case");
#endif
savedot = dot; savedol = dol; savecursor = cursor;
strcpy(savelb, linebuf);
CP(savelb, linebuf);
nlines = dol - zero;
while ((line *) endcore - truedol < nlines)
morelines();
265,7 → 252,7
truedol -= nlines;
copyw(zero+1, truedol+1, nlines);
dot = savedot; dol = savedol ; cursor = savecursor;
strcpy(linebuf, savelb);
CP(linebuf, savelb);
vch_mac = VC_MANYCHANGE;
 
/* Arrange that no further undo saving happens within macro */
305,7 → 292,6
/*
* Move is simple, except for moving onto new lines in hardcopy open mode.
*/
void
vmove()
{
register int cnt;
383,7 → 369,6
* by vchange (although vchange may pass it back if it degenerates
* to a full line range delete.)
*/
void
vdelete(c)
char c;
{
421,7 → 406,7
i = vdcMID();
cp = cursor;
setDEL();
strcpy(cp, wcursor);
CP(cp, wcursor);
if (cp > linebuf && (cp[0] == 0 || c == '#'))
cp--;
if (state == HARDOPEN) {
444,7 → 429,6
* Across lines with both wcursor and wdot given, we delete
* and sync then append (but one operation for undo).
*/
void
vchange(c)
char c;
{
634,7 → 618,7
*/
cursor = cp;
setDEL();
strcpy(cursor, wcursor);
CP(cursor, wcursor);
if (state != HARDOPEN) {
vcursaft(cursor - 1);
doomed = i - cindent();
731,7 → 715,6
*/
char vshnam[2] = { 'x', 0 };
 
void
vshftop()
{
register line *addr;
755,7 → 738,6
*
* Filter portions of the buffer through unix commands.
*/
void
vfilter()
{
register line *addr;
895,7 → 877,6
* Replace a single character with the next input character.
* A funny kind of insert.
*/
void
vrep(cnt)
register int cnt;
{
917,7 → 898,7
ungetkey(c);
}
#ifndef BIT8
strcpy(vutmp, linebuf);
CP(vutmp, linebuf);
#else
sc_strcpy(vutmp, linebuf);
#endif
925,7 → 906,7
vundkind = VCHNG;
wcursor = cursor + cnt;
vUD1 = cursor; vUD2 = wcursor;
strcpy(cursor, wcursor);
CP(cursor, wcursor);
prepapp();
vappend('r', cnt, 0);
*lastcp++ = INS[0];
938,7 → 919,6
* Yanking to string registers occurs for free (essentially)
* in the routine xdw().
*/
void
vyankit()
{
register int cnt;
/ports/trunk/editors/rvi/ex_vops2.c
52,7 → 52,7
setLAST();
if (FIXUNDO)
#ifndef BIT8
vundkind = VCHNG, strcpy(vutmp, linebuf);
vundkind = VCHNG, CP(vutmp, linebuf);
#else
vundkind = VCHNG, sc_strcpy(vutmp, linebuf);
#endif
67,7 → 67,6
* in the VBSIZE buffer BUF. Used to save
* deleted text of part of line.
*/
void
takeout(BUF)
char *BUF;
{
128,7 → 127,6
bool gobbled;
char *ogcursor;
 
void
vappend(ch, cnt, indent)
int ch; /* mjm: char --> int */
int cnt, indent;
280,9 → 278,9
* in linebuf.
*/
cnt = vmaxrep(ch, cnt);
strcpy(gcursor + 1, cursor);
CP(gcursor + 1, cursor);
do {
strcpy(cursor, genbuf);
CP(cursor, genbuf);
if (cnt > 1) {
int oldhold = hold;
 
297,7 → 295,7
endim();
vUA2 = cursor;
if (escape != '\n')
strcpy(cursor, gcursor + 1);
CP(cursor, gcursor + 1);
 
/*
* If doomed characters remain, clobber them,
351,9 → 349,9
*gcursor = 0;
if (gcursor + strlen(linebuf) > &genbuf[LBSIZE - 2])
gcursor = genbuf;
strcpy(gcursor, linebuf);
CP(gcursor, linebuf);
} else {
strcpy(genbuf, gcursor + 1);
CP(genbuf, gcursor + 1);
gcursor = genbuf;
}
 
447,7 → 445,7
int x, y, iwhite, backsl=0;
char *iglobp;
char cstr[2];
void (*OO)() = Outchar;
int (*OO)() = Outchar;
 
/*
* Clear the output state and counters
914,7 → 912,7
len = strlen(cursor);
if (replen < len)
len = replen;
strcpy(cursor, cursor + len);
CP(cursor, cursor + len);
vUD2 += len;
}
len = strlen(linebuf);
/ports/trunk/editors/rvi/ex_vput.c
12,16 → 12,6
#include "ex_tty.h"
#include "ex_vis.h"
 
 
void enddm();
void godm();
void vnpins();
void vneedpos();
void vmaktop();
void vgoto();
void vclrech();
void vclreol();
 
/*
* Deal with the screen, clearing, cursor positioning, putting characters
* into the screen image, and deleting characters.
77,7 → 67,6
/*
* Clear to the end of the current physical line
*/
void
vclreol()
{
register int i, j;
126,7 → 115,6
* If work here is being held off, just remember, in
* heldech, if work needs to be done, don't do anything.
*/
void
vclrech(didphys)
bool didphys;
{
302,7 → 290,6
/*
* Move cursor to line y, column x, handling wraparound and scrolling.
*/
void
vgoto(y, x)
register int y, x;
{
499,7 → 486,6
}
}
 
void
vmaktop(p, cp)
register int p;
#ifndef BIT8
532,7 → 518,6
* for tabs) and code assumes this in several place
* to make life simpler.
*/
void
vinschar(c)
int c; /* mjm: char --> int */
{
769,7 → 754,6
* On a dumb terminal we may infact redisplay the rest of the
* screen here brute force to keep it pretty.
*/
void
vneedpos(cnt)
int cnt;
{
782,7 → 766,6
vnpins(1);
}
 
void
vnpins(dosync)
int dosync;
{
800,7 → 783,7
e = vglitchup(vcline, d);
vigoto(e, 0); vclreol();
if (dosync) {
void (*Ooutchar)() = Outchar;
int (*Ooutchar)() = Outchar;
Outchar = vputchar;
vsync(e + 1);
Outchar = Ooutchar;
1101,7 → 1084,6
* is the same as that which goes into insert
* mode, then we are in delete mode already.
*/
void
godm()
{
 
1121,7 → 1103,6
* if we just moved over to delete space from part of
* a tab (above).
*/
void
enddm()
{
 
1166,7 → 1147,6
* you can erase overstrikes with some work. CRT's which do underlining
* implicitly which has to be erased (like CONCEPTS) are also handled.
*/
void
vputchar(c)
register int c;
{
1398,7 → 1378,6
* Delete display positions stcol through endcol.
* Amount of use of special terminal features here is limited.
*/
void
physdc(stcol, endcol)
int stcol, endcol;
{
1501,7 → 1480,6
trubble = 0, techoin = 0;
}
 
void
tvliny()
{
register int i;
/ports/trunk/editors/rvi/ex_vwind.c
12,10 → 12,6
#include "ex_tty.h"
#include "ex_vis.h"
 
void vshow();
void vup();
void vdown();
 
/*
* Routines to adjust the window, showing specified lines
* in certain positions on the screen, and scrolling in both
82,7 → 78,6
* If scroll, then we MUST use a scroll.
* Otherwise clear and redraw if motion is far.
*/
void
vup(cnt, ind, scroll)
register int cnt, ind;
bool scroll;
132,7 → 127,6
/*
* Like vup, but scrolling down.
*/
void
vdown(cnt, ind, scroll)
register int cnt, ind;
bool scroll;
243,7 → 237,6
* (and call us recursively). Eventually, we clear the screen
* (or its open mode equivalent) and redraw.
*/
void
vshow(addr, top)
line *addr, *top;
{