guy@rlgvax.UUCP (Guy Harris) (02/04/84)
This should correspond to the System III version of "nroff"; the line numbers should be correct, but I removed some local hacks from this "diff -c" listing and may not have correctly compensated. Most of the changes are to implement the VMUNIX compile-time option, which keeps the temporary file in memory but does not use "malloc" or standard I/O, and it supports compressed macro packages. Other changes are: It now gets time zone information from the system by using "localtime" to dissect a UNIX time in seconds from the epoch. It includes a fix to the S3 "nroff" (the fix may already be in the S5 "nroff") which makes it handle constructs like .if <condition> \{\ do this \} correctly. The V7 "nroff" handled this correctly, and the Berkeley "-me" package uses this heavily. It includes a change whose effect is uncertain, but someone told me that it changes the interpretation of some escape for local motions which makes some of the special character defintions in the "-me" package work correctly. Those changes are labelled with /* XXX */, just as they were in the 4.1BSD "nroff". It includes some minor bug fixes from the 4.xBSD "nroff". A couple of buffers were increased in size from 512 bytes to 1024 bytes; this is because we run this under 4.1cBSD UNIX. If you run with a large block size V7 file system (as some V7/S3 implementations and most S5 implementations do), you will want to do this; otherwise, you may want to leave them at 512 bytes. Guy Harris {seismo,ihnp4,allegra}!rlgvax!guy *** n1.c (old) Sat Feb 4 00:57:31 1984 --- n1.c (new) Sat Feb 4 00:57:38 1984 *************** *** 21,26 #define tso #endif #ifdef SMALL char ntSMALL[] = "@(#) SMALL"; #define NDIAGS --- 21,30 ----- #define tso #endif + #ifdef VMUNIX + char ntVMUNIX[] = "@(#) VMUNIX"; + #endif + #ifdef SMALL char ntSMALL[] = "@(#) SMALL"; #define NDIAGS *************** *** 47,52 #ifdef unix #include <sys/types.h> #include <sys/stat.h> #endif #include "tdef.hd" #include "strs.hd" --- 51,57 ----- #ifdef unix #include <sys/types.h> #include <sys/stat.h> + #include <time.h> #endif #include "tdef.hd" #include "strs.hd" *************** *** 50,56 #endif #include "tdef.hd" #include "strs.hd" ! #ifndef INCORE #include "uns.hd" #endif #ifdef NROFF --- 55,61 ----- #endif #include "tdef.hd" #include "strs.hd" ! #if !defined(INCORE) && !defined(VMUNIX) #include "uns.hd" #endif #ifdef NROFF *************** *** 70,75 input routines, escape function calling */ extern struct s *frame, *stk, *nxf; extern struct s *ejl; extern struct tmpfaddr ip; --- 75,81 ----- input routines, escape function calling */ + int inchar[LNSIZE], *pinchar = inchar; /* XXX */ extern struct s *frame, *stk, *nxf; extern struct s *ejl; extern struct tmpfaddr ip; *************** *** 73,79 extern struct s *frame, *stk, *nxf; extern struct s *ejl; extern struct tmpfaddr ip; ! #ifndef INCORE extern struct envblock eblock; /* environment block */ #else extern struct envblock eblock[NEV]; /* incore environments */ --- 79,85 ----- extern struct s *frame, *stk, *nxf; extern struct s *ejl; extern struct tmpfaddr ip; ! #if !defined(INCORE) && !defined(VMUNIX) extern struct envblock eblock; /* environment block */ #else extern struct envblock eblock[NEV]; /* incore environments */ *************** *** 321,326 if ((i = open(cmpctf,0)) < 0) { prstr("can't find compacted tmp file\n"); exit(1); } Mcp(i, ibf); /* copy tmp file */ close(i); --- 327,336 ----- if ((i = open(cmpctf,0)) < 0) { prstr("can't find compacted tmp file\n"); exit(1); } + #ifdef VMUNIX + read(i, (char *)eblock, NEV*sizeof(struct envblock)); /* read in environments */ + rdmemb(i); /* read in in-core temp buffers */ + #else Mcp(i, ibf); /* copy tmp file */ #endif close(i); *************** *** 322,327 prstr("can't find compacted tmp file\n"); exit(1); } Mcp(i, ibf); /* copy tmp file */ close(i); p = nextf[nnextf++].buf; /* save name of uncomp. area */ --- 332,338 ----- rdmemb(i); /* read in in-core temp buffers */ #else Mcp(i, ibf); /* copy tmp file */ + #endif close(i); p = nextf[nnextf++].buf; /* save name of uncomp. area */ *************** *** 541,547 acctg();/*open troff actg file while mode 4755*/ #endif #endif ! #ifndef INCORE if((suffid=open(suftab,0)) < 0) errcos(); read(suffid, sufind.chr, sizeof(sufind)); --- 552,558 ----- acctg();/*open troff actg file while mode 4755*/ #endif #endif ! #if !defined(INCORE) && !defined(VMUNIX) if((suffid=open(suftab,0)) < 0) errcos(); read(suffid, sufind.chr, sizeof(sufind)); *************** *** 556,562 for(i=256; --i;)trtab[i]=i; trtab[UNPAD] = ' '; mchbits(); ! #ifndef INCORE if(a != 'a')unlkp = p; #endif } --- 567,573 ----- for(i=256; --i;)trtab[i]=i; trtab[UNPAD] = ' '; mchbits(); ! #if !defined(INCORE) && !defined(VMUNIX) if(a != 'a')unlkp = p; #endif } *************** *** 597,603 #endif ptinit(); for(i=NEV; i--;) ! #ifndef INCORE write(ibf, (char *)&eblock, sizeof(struct envblock)); #else if (i) --- 608,614 ----- #endif ptinit(); for(i=NEV; i--;) ! #if !defined(INCORE) && !defined(VMUNIX) write(ibf, (char *)&eblock, sizeof(struct envblock)); #else if (i) *************** *** 608,613 olinep = oline; ibufp = eibuf = ibuf; v_hp = init = 0; ioff = 0; v_nl = -1; cvtime(); --- 619,625 ----- olinep = oline; ibufp = eibuf = ibuf; v_hp = init = 0; + pinchar = inchar; /* XXX */ ioff = 0; v_nl = -1; cvtime(); *************** *** 628,634 cvtime(){ long tt; ! register i; time(&tt); tt -= 3600*ZONE; /*5hrs for EST*/ --- 640,647 ----- cvtime(){ long tt; ! struct tm *localtime(); ! register struct tm *tp; time(&tt); tp = localtime(&tt); *************** *** 631,649 register i; time(&tt); ! tt -= 3600*ZONE; /*5hrs for EST*/ ! v_dy = (tt/86400L) + 1; ! v_dw = (v_dy + 3)%7 + 1; ! for(v_yr=70;; v_yr++){ ! if((v_yr)%4)ms[1]=28;else ms[1]=29; ! for(i=0;i<12;){ ! if(v_dy<=ms[i]){ ! v_mo = i+1; ! return; ! } ! v_dy -= ms[i++]; ! } ! } } cnum(a) char *a; --- 644,654 ----- register struct tm *tp; time(&tt); ! tp = localtime(&tt); ! v_dy = tp->tm_mday; ! v_dw = tp->tm_wday + 1; ! v_yr = tp->tm_year; ! v_mo = tp->tm_mon + 1; } cnum(a) char *a; *************** *** 663,668 static int mode; struct stat statb; if(!f){ stat(ttyp,&statb); mode = statb.st_mode; --- 668,675 ----- static int mode; struct stat statb; + if (ttyp==0) + return; if(!f){ stat(ttyp,&statb); mode = statb.st_mode; *************** *** 927,933 goto g0; case 'k': /*mark hor place*/ if((i=findr(getsn())) == -1)goto g0; ! vlist[i] = v_hp; goto g0; case 'j': /*mark output hor place*/ if(!(i=getach()))goto g0; --- 934,940 ----- goto g0; case 'k': /*mark hor place*/ if((i=findr(getsn())) == -1)goto g0; ! vlist[i] = v_hp = sumhp(); /* XXX */ goto g0; case 'j': /*mark output hor place*/ if(!(i=getach()))goto g0; *************** *** 955,960 if((ch_CMASK = (i & CMASK)) == '\n'){ nlflg++; v_hp = 0; if (!ip.b) cd++; } if(!--level){ --- 962,968 ----- if((ch_CMASK = (i & CMASK)) == '\n'){ nlflg++; v_hp = 0; + pinchar = inchar; /* XXX */ if (!ip.b) cd++; } if(!--level){ *************** *** 958,966 if (!ip.b) cd++; } if(!--level){ ! j = width(i); ! v_hp += j; ! cwidth = j; } return(i); } --- 966,979 ----- if (!ip.b) cd++; } if(!--level){ ! /* j = width(i); */ ! /* v_hp += j; */ ! /* cwidth = j; */ ! if (pinchar >= inchar + LNSIZE) { /* XXX */ ! inchar[0] = makem(sumhp()); ! pinchar = &inchar[1]; ! } ! *pinchar++ = i; /* XXX */ } return(i); } *************** *** 964,969 } return(i); } char ifilt[32] = {0,001,002,003,0,005,006,007,010, 011,012,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, --- 977,993 ----- } return(i); } + + sumhp() /* XXX - add up widths in inchar array */ + { + register int n; + register int *p; + + n = 0; + for (p = inchar; p < pinchar; p++) + n += width(*p); + return(n); + } char ifilt[32] = {0,001,002,003,0,005,006,007,010, 011,012,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, *************** *** 1128,1133 } copyf--; v_hp = 0; } getach(){ register i; --- 1152,1158 ----- } copyf--; v_hp = 0; + pinchar = inchar; /* XXX */ } getach(){ register i; *************** *** 1259,1264 #ifndef NOCOMPACT Mcp(oldp, newp) /* copy file on oldp to file on newp */ int oldp, newp; --- 1284,1290 ----- #ifndef NOCOMPACT + #ifndef VMUNIX Mcp(oldp, newp) /* copy file on oldp to file on newp */ int oldp, newp; *************** *** 1274,1279 } #endif caseco() /* perform .co request */ { --- 1300,1306 ----- } #endif + #endif caseco() /* perform .co request */ { *************** *** 1291,1299 close(i); /* done with data area */ cname[0] = 't'; /* now the tmp file */ - lseek(ibf, (long)(ev*sizeof(struct envblock)), 0); /* write curr env */ - write(ibf, (char *)&eblock, sizeof(struct envblock)); - lseek(ibf, (long)0, 0); /* rewind */ if ((i = creat(cname, 0666)) < 0) { prstr("can't create tmp file\n"); exit(1); } --- 1318,1323 ----- close(i); /* done with data area */ cname[0] = 't'; /* now the tmp file */ if ((i = creat(cname, 0666)) < 0) { prstr("can't create tmp file\n"); exit(1); } *************** *** 1297,1302 if ((i = creat(cname, 0666)) < 0) { prstr("can't create tmp file\n"); exit(1); } Mcp(ibf, i); /* copy tmp file */ unlink(unlkp); /* remove old tmp file */ --- 1321,1333 ----- if ((i = creat(cname, 0666)) < 0) { prstr("can't create tmp file\n"); exit(1); } + #if defined(INCORE) || defined(VMUNIX) + write(i, (char *)eblock, NEV*sizeof(struct envblock)); /* write out environments */ + wtmemb(i); /* write out in-core temp buffers */ + #else + lseek(ibf, (long)(ev*sizeof(struct envblock)), 0); /* write curr env */ + write(ibf, (char *)&eblock, sizeof(struct envblock)); + lseek(ibf, (long)0, 0); /* rewind */ Mcp(ibf, i); /* copy tmp file */ unlink(unlkp); /* remove old tmp file */ #endif *************** *** 1299,1304 exit(1); } Mcp(ibf, i); /* copy tmp file */ unlink(unlkp); /* remove old tmp file */ prstr("Compaction completed\n"); exit(1); --- 1330,1336 ----- lseek(ibf, (long)0, 0); /* rewind */ Mcp(ibf, i); /* copy tmp file */ unlink(unlkp); /* remove old tmp file */ + #endif prstr("Compaction completed\n"); exit(1); *************** *** 1309,1315 ertoomp() {prstr("Too many macro packages.\n"); exit(-1); } ! #ifndef INCORE errcos() {prstr("Cannot open suftab.\n"); exit(-1); } #endif --- 1341,1347 ----- ertoomp() {prstr("Too many macro packages.\n"); exit(-1); } ! #if !defined(INCORE) && !defined(VMUNIX) errcos() {prstr("Cannot open suftab.\n"); exit(-1); } #endif *************** *** 1315,1321 ferrex() { #ifdef unix ! #ifndef INCORE unlink(unlkp); #endif #endif --- 1347,1353 ----- ferrex() { #ifdef unix ! #if !defined(INCORE) && !defined(VMUNIX) unlink(unlkp); #endif #endif *** n10.c (old) Sat Feb 4 01:02:26 1984 --- n10.c (new) Sat Feb 4 01:02:29 1984 *************** *** 13,19 */ extern struct d d[NDI], *dip; ! #ifndef INCORE extern struct envblock eblock; #else extern struct envblock eblock[NEV]; --- 13,19 ----- */ extern struct d d[NDI], *dip; ! #if !defined(INCORE) && !defined(VMUNIX) extern struct envblock eblock; #else extern struct envblock eblock[NEV]; *** n2.c (old) Sat Feb 4 01:04:11 1984 --- n2.c (new) Sat Feb 4 01:04:13 1984 *************** *** 22,28 extern struct s *frame, *stk, *nxf; extern struct tmpfaddr ip; extern struct tmpfaddr offset; ! #ifndef INCORE extern struct envblock eblock; #else extern struct envblock eblock[NEV]; --- 22,28 ----- extern struct s *frame, *stk, *nxf; extern struct tmpfaddr ip; extern struct tmpfaddr offset; ! #if !defined(INCORE) && !defined(VMUNIX) extern struct envblock eblock; #else extern struct envblock eblock[NEV]; *************** *** 314,320 #ifdef unix signal(SIGINT, SIG_IGN); signal(SIGTERM, SIG_IGN); ! #ifndef INCORE unlink(unlkp); #endif #endif --- 314,320 ----- #ifdef unix signal(SIGINT, SIG_IGN); signal(SIGTERM, SIG_IGN); ! #if !defined(INCORE) && !defined(VMUNIX) unlink(unlkp); #endif #endif *************** *** 356,361 a.use = paper; a.uid = getuid(); write(acctf,(char *)&a,sizeof(a)); } } #endif --- 356,362 ----- a.use = paper; a.uid = getuid(); write(acctf,(char *)&a,sizeof(a)); + close(acctf); } } #endif *** n3.c (old) Sat Feb 4 01:05:35 1984 --- n3.c (new) Sat Feb 4 01:05:38 1984 *************** *** 17,22 extern struct tmpfaddr nextb; extern struct d d[NDI], *dip; #ifndef INCORE extern struct envblock eblock; #else extern struct envblock eblock[NEV]; --- 17,22 ----- extern struct tmpfaddr nextb; extern struct d d[NDI], *dip; #ifndef INCORE + #ifdef VMUNIX + extern struct envblock eblock[NEV]; + extern int ev; + #else extern struct envblock eblock; #endif #else *************** *** 18,23 extern struct d d[NDI], *dip; #ifndef INCORE extern struct envblock eblock; #else extern struct envblock eblock[NEV]; extern int ev; --- 22,28 ----- extern int ev; #else extern struct envblock eblock; + #endif #else extern struct envblock eblock[NEV]; extern int ev; *************** *** 71,76 int maclev=0; /* depth of macro (or string or diversion) calls */ extern int regcnt; int freenslot = -1; #ifdef INCORE tint *memblist[NBLIST]; /* incore tmp file mem pointers */ int *argstrs[NMACS]; /* macro arg strings */ --- 76,85 ----- int maclev=0; /* depth of macro (or string or diversion) calls */ extern int regcnt; int freenslot = -1; + #ifdef VMUNIX + tint *memblist[NBLIST+1]; /* incore tmp file mem pointers */ + tint Buf[NBLIST][BLK]; /* buffers allocated at load time */ + #endif #ifdef INCORE tint *memblist[NBLIST+1]; /* incore tmp file mem pointers */ int *argstrs[NMACS]; /* macro arg strings */ *************** *** 72,78 extern int regcnt; int freenslot = -1; #ifdef INCORE ! tint *memblist[NBLIST]; /* incore tmp file mem pointers */ int *argstrs[NMACS]; /* macro arg strings */ int argstrp = 0; /* index into argstrs */ int *argsp; /* pointer to latest collected args */ --- 81,87 ----- tint Buf[NBLIST][BLK]; /* buffers allocated at load time */ #endif #ifdef INCORE ! tint *memblist[NBLIST+1]; /* incore tmp file mem pointers */ int *argstrs[NMACS]; /* macro arg strings */ int argstrp = 0; /* index into argstrs */ int *argsp; /* pointer to latest collected args */ *************** *** 315,320 if(blist[i] == 0)break; if (i == NBLIST+1) i = 0; else { blist[i] = -1; #ifdef INCORE if ((memblist[i] = (tint *)malloc(BLK*sizeof(tint))) == NULL) { --- 324,332 ----- if(blist[i] == 0)break; if (i == NBLIST+1) i = 0; else { blist[i] = -1; + #ifdef VMUNIX + memblist[i] = Buf[i-1]; + #endif #ifdef INCORE if ((memblist[i] = (tint *)malloc(BLK*sizeof(tint))) == NULL) { *************** *** 366,372 } wbfl(){ register int i, j; ! #ifdef INCORE register tint *bp; #endif --- 378,384 ----- } wbfl(){ register int i, j; ! #if defined(INCORE) || defined(VMUNIX) register tint *bp; #endif *************** *** 371,377 #endif if (!woff.b) return; ! #ifndef INCORE lseek(ibf, (long)(boff(woff.b) + woff.o) * sizeof(tint), 0); write(ibf, wbuf.wp, (int)(wbfi * sizeof(tint))); #else --- 383,389 ----- #endif if (!woff.b) return; ! #if !defined(INCORE) && !defined(VMUNIX) lseek(ibf, (long)(boff(woff.b) + woff.o) * sizeof(tint), 0); write(ibf, wbuf.wp, (int)(wbfi * sizeof(tint))); #else *************** *** 413,418 return (((int)rbuf.rnt[umaccp][fp->o]) & 0177777); #endif } getblk(blk) filep blk; /* find a place in the cache and get a block */ { --- 425,454 ----- return (((int)rbuf.rnt[umaccp][fp->o]) & 0177777); #endif } + #ifdef VMUNIX + wtmemb(i) + int i; + { + register filep blk; + + write(i, memblist, sizeof(memblist)); + for (blk = 0; blk < NBLIST; blk++) { + if (memblist[blk] != 0) + write(i, memblist[blk], BLK*sizeof(tint)); + } + } + rdmemb(i) + int i; + { + register filep blk; + + read(i, memblist, sizeof(memblist)); + for (blk = 0; blk < NBLIST; blk++) { + if (memblist[blk] != 0) + read(i, memblist[blk], BLK*sizeof(tint)); + } + } + #endif getblk(blk) filep blk; /* find a place in the cache and get a block */ { *************** *** 417,423 filep blk; /* find a place in the cache and get a block */ { register int i; ! #ifdef INCORE register int j; register tint *bp; #endif --- 453,459 ----- filep blk; /* find a place in the cache and get a block */ { register int i; ! #if defined(INCORE) || defined(VMUNIX) register int j; register tint *bp; #endif *************** *** 427,433 i = rmaccp; rmaccp = (rmaccp + 1) % NB; } macbcnt++; ! #ifndef INCORE lseek(ibf, (long)boff(blk) * sizeof(tint), 0); if (read(ibf, rbuf.rp[i], BLK * sizeof(tint)) == 0) { prstr("Macro read failed\n"); --- 463,469 ----- i = rmaccp; rmaccp = (rmaccp + 1) % NB; } macbcnt++; ! #if !defined(INCORE) && !defined(VMUNIX) lseek(ibf, (long)boff(blk) * sizeof(tint), 0); if (read(ibf, rbuf.rp[i], BLK * sizeof(tint)) == 0) { prstr("Macro read failed\n"); *** n4.c (old) Sat Feb 4 01:07:19 1984 --- n4.c (new) Sat Feb 4 01:07:22 1984 *************** *** 10,15 number registers, conversion, arithmetic */ extern struct s *frame; #ifndef INCORE extern struct envblock eblock; --- 10,16 ----- number registers, conversion, arithmetic */ + extern int inchar[LNSIZE], *pinchar; /* XXX */ extern struct s *frame; #if !defined(INCORE) && !defined(VMUNIX) extern struct envblock eblock; *************** *** 11,17 */ extern struct s *frame; ! #ifndef INCORE extern struct envblock eblock; #else extern struct envblock eblock[NEV]; --- 12,18 ----- extern int inchar[LNSIZE], *pinchar; /* XXX */ extern struct s *frame; ! #if !defined(INCORE) && !defined(VMUNIX) extern struct envblock eblock; #else extern struct envblock eblock[NEV]; *************** *** 78,84 break; case 'u': i = fi; break; case 'j': i = ad + 2*admod; break; ! case 'w': i = cwidth; break; case 'x': i = nel; break; case 'y': i = un; break; case 'T': i = dotT; break; /*-Tterm used in nroff*/ --- 79,85 ----- break; case 'u': i = fi; break; case 'j': i = ad + 2*admod; break; ! case 'w': i = width(*(pinchar-1)); break; /* XXX */ case 'x': i = nel; break; case 'y': i = un; break; case 'T': i = dotT; break; /*-Tterm used in nroff*/ *************** *** 402,408 if((field != digits) && (digits > 0))while(digits--)acc /= 10; if(aabs){ if(dip != d)j = dip->dnl; else j = v_nl; ! if(!vflag)j = v_hp; if(aabs == 2)j = -j; acc -= j; } --- 413,419 ----- if((field != digits) && (digits > 0))while(digits--)acc /= 10; if(aabs){ if(dip != d)j = dip->dnl; else j = v_nl; ! if(!vflag)j = v_hp = sumhp(); /* XXX */ if(aabs == 2)j = -j; acc -= j; } *** n5.c (old) Sat Feb 4 01:14:38 1984 --- n5.c (new) Sat Feb 4 01:14:43 1984 *************** *** 11,16 misc processing requests */ extern struct s *frame; extern struct tmpfaddr offset, ip; extern struct d d[NDI], *dip; --- 11,17 ----- misc processing requests */ + extern int inchar[LNSIZE], *pinchar; /* XXX */ extern struct s *frame; extern struct tmpfaddr offset, ip; extern struct d d[NDI], *dip; *************** *** 14,20 extern struct s *frame; extern struct tmpfaddr offset, ip; extern struct d d[NDI], *dip; ! #ifndef INCORE extern struct envblock eblock; #else extern struct envblock eblock[NEV]; --- 15,21 ----- extern struct s *frame; extern struct tmpfaddr offset, ip; extern struct d d[NDI], *dip; ! #if !defined(INCORE) && !defined(VMUNIX) extern struct envblock eblock; #else extern struct envblock eblock[NEV]; *************** *** 380,386 return; } evlist[evi++] = ev; } if(ev == nxev)return; ! #ifndef INCORE lseek(ibf, (long)(ev*sizeof(struct envblock)), 0); write(ibf,(char *)&eblock, sizeof(struct envblock)); lseek(ibf, (long)(nxev*sizeof(struct envblock)), 0); --- 381,387 ----- return; } evlist[evi++] = ev; } if(ev == nxev)return; ! #if !defined(INCORE) && !defined(VMUNIX) lseek(ibf, (long)(ev*sizeof(struct envblock)), 0); write(ibf,(char *)&eblock, sizeof(struct envblock)); lseek(ibf, (long)(nxev*sizeof(struct envblock)), 0); *************** *** 451,457 if(x == 1)iflist[ifx] = !true; if(true){ do ! do { v_hp = 0; i = getch(); } while (ch_CMASK == ' '); while (ch_CMASK == LEFT); ch = i; --- 452,458 ----- if(x == 1)iflist[ifx] = !true; if(true){ do ! do { v_hp = 0; pinchar = inchar; i = getch(); } /* XXX */ while (ch_CMASK == ' '); while (ch_CMASK == LEFT); ch = i; *************** *** 473,479 else i = getch0() & CMASK; if (i == ESC) cnt++; ! else if (cnt == 1) if (i == '{') i = LEFT; else if (i == '}') i = RIGHT; else cnt = 0; --- 474,480 ----- else i = getch0() & CMASK; if (i == ESC) cnt++; ! else if (cnt == 1) { if (i == '{') i = LEFT; else if (i == '}') i = RIGHT; else if (i == '\n') i = 0; *************** *** 476,483 else if (cnt == 1) if (i == '{') i = LEFT; else if (i == '}') i = RIGHT; ! else cnt = 0; ! else cnt = 0; if (i == LEFT) eatblk(1); } while ((!inblk && (i != '\n')) || (inblk && (i != RIGHT))); --- 477,484 ----- else if (cnt == 1) { if (i == '{') i = LEFT; else if (i == '}') i = RIGHT; ! else if (i == '\n') i = 0; ! cnt = 0; } if (i == LEFT) eatblk(1); } while ((!inblk && (i != '\n')) || (inblk && (i != RIGHT))); *************** *** 503,508 offset.o = begin.o = 0; cnt = 0; v_hp = 0; savapts = apts; savapts1 = apts1; savfont = font; --- 504,510 ----- offset.o = begin.o = 0; cnt = 0; v_hp = 0; + pinchar = inchar; /* XXX */ savapts = apts; savapts1 = apts1; savfont = font; *************** *** 527,532 pts1 = savpts1; mchbits(); v_hp = 0; while ((i = getch()) && (ch_CMASK != delim) && (ch_CMASK != '\n')) { if(rbf0(&p) != i){ eat(delim); --- 529,535 ----- pts1 = savpts1; mchbits(); v_hp = 0; + pinchar = inchar; /* XXX */ while ((i = getch()) && (ch_CMASK != delim) && (ch_CMASK != '\n')) { if(rbf0(&p) != i){ eat(delim); *** n6.c (old) Sat Feb 4 01:17:19 1984 --- n6.c (new) Sat Feb 4 01:17:21 1984 *************** *** 10,16 width functions, sizes and fonts */ ! #ifndef INCORE extern struct envblock eblock; #else extern struct envblock eblock[NEV]; --- 10,16 ----- width functions, sizes and fonts */ ! #if !defined(INCORE) && !defined(VMUNIX) extern struct envblock eblock; #else extern struct envblock eblock[NEV]; *************** *** 27,32 extern long atoi0(); int sbold = 0; int bdtab[4] = {0, 0, 3, 0}; extern int eschar; extern int widthp; extern int xfont; --- 27,33 ----- extern long atoi0(); int sbold = 0; int bdtab[4] = {0, 0, 3, 0}; + extern int inchar[LNSIZE], *pinchar; /* XXX */ extern int eschar; extern int widthp; extern int xfont; *************** *** 126,131 register i, base, wid; int delim, em, k; int savlevel, savhp, savfont, savfont1; base = v_st = v_sb = wid = v_ct = 0; if (getch() && ((delim = ch_CMASK) & MOT)) return; --- 127,133 ----- register i, base, wid; int delim, em, k; int savlevel, savhp, savfont, savfont1; + int *savpinchar, *p, *q, tempinchar[LNSIZE]; /* XXX */ base = v_st = v_sb = wid = v_ct = 0; if (getch() && ((delim = ch_CMASK) & MOT)) return; *************** *** 130,135 base = v_st = v_sb = wid = v_ct = 0; if (getch() && ((delim = ch_CMASK) & MOT)) return; savhp = v_hp; savlevel = level; v_hp = level = 0; savfont = font; --- 132,141 ----- base = v_st = v_sb = wid = v_ct = 0; if (getch() && ((delim = ch_CMASK) & MOT)) return; savhp = v_hp; + savpinchar = pinchar; /* XXX */ + for (p=inchar, q=tempinchar; p < pinchar; ) /* XXX */ + *q++ = *p++; /* XXX */ + pinchar = inchar; /* XXX */ savlevel = level; v_hp = level = 0; savfont = font; *************** *** 151,156 nform = 0; setn1(wid); v_hp = savhp; level = savlevel; font = savfont; font1 = savfont1; --- 157,165 ----- nform = 0; setn1(wid); v_hp = savhp; + pinchar = savpinchar; /* XXX */ + for (p=inchar, q=tempinchar; p < pinchar; ) /* XXX */ + *p++ = *q++; /* XXX */ level = savlevel; font = savfont; font1 = savfont1; *** n7.c (old) Sat Feb 4 01:20:13 1984 --- n7.c (new) Sat Feb 4 01:20:15 1984 *************** *** 20,26 extern struct s *frame, *stk; extern struct s *ejl; extern struct d d[NDI], *dip; ! #ifndef INCORE extern struct envblock eblock; #else extern struct envblock eblock[NEV]; --- 20,26 ----- extern struct s *frame, *stk; extern struct s *ejl; extern struct d d[NDI], *dip; ! #if !defined(INCORE) && !defined(VMUNIX) extern struct envblock eblock; #else extern struct envblock eblock[NEV]; *************** *** 25,30 #else extern struct envblock eblock[NEV]; extern int ev; extern int maclev; #endif extern struct datablock dblock; --- 25,31 ----- #else extern struct envblock eblock[NEV]; extern int ev; + #ifdef INCORE extern int maclev; #endif #endif *************** *** 27,32 extern int ev; extern int maclev; #endif extern struct datablock dblock; extern struct tmpfaddr ip; --- 28,34 ----- #ifdef INCORE extern int maclev; #endif + #endif extern struct datablock dblock; extern struct tmpfaddr ip; *************** *** 599,605 continue; } if(j == ' '){ ! storeword(i,cwidth); continue; } break; --- 601,607 ----- continue; } if(j == ' '){ ! storeword(i,width(i)); /* XXX */ continue; } break; *************** *** 633,639 if(hyp > (hyptr+NHYP-1))hyp = hyptr+NHYP-1; } } ! storeword(i,cwidth); g1: i = GETCH(); j = ch_CMASK; if(j != ' '){ --- 635,641 ----- if(hyp > (hyptr+NHYP-1))hyp = hyptr+NHYP-1; } } ! storeword(i,width(i)); /* XXX */ g1: i = GETCH(); j = ch_CMASK; if(j != ' '){ *** n8.c (old) Sat Feb 4 01:22:13 1984 --- n8.c (new) Sat Feb 4 01:22:17 1984 *************** *** 1,6 #include "tdef.hd" #include "strs.hd" ! #ifndef INCORE #include "uns.hd" #endif --- 1,6 ----- #include "tdef.hd" #include "strs.hd" ! #if !defined(INCORE) && !defined(VMUNIX) #include "uns.hd" #endif *************** *** 14,20 char *nexth = hbuf; int *hyend; ! #ifndef INCORE extern struct envblock eblock; #else extern struct envblock eblock[NEV]; --- 14,20 ----- char *nexth = hbuf; int *hyend; ! #if !defined(INCORE) && !defined(VMUNIX) extern struct envblock eblock; #else extern struct envblock eblock[NEV]; *************** *** 145,151 register int *w; register char *s, *s0; int i; ! #ifndef INCORE unsigned off; #else char *off; --- 145,151 ----- register int *w; register char *s, *s0; int i; ! #if !defined(INCORE) && !defined(VMUNIX) unsigned off; #else char *off; *************** *** 151,157 char *off; #endif extern int *chkvow(); ! #ifdef INCORE #define getsuf(adr) adr #else extern char *getsuf(); --- 151,157 ----- char *off; #endif extern int *chkvow(); ! #if defined(INCORE) || defined(VMUNIX) #define getsuf(adr) adr #else extern char *getsuf(); *************** *** 160,166 again: if(!alph(i = *hyend & CMASK))return(0); if(i < 'a')i -= 'A'; else i -= 'a'; ! #ifndef INCORE if(!(off = sufind.uns[i]))return(0); #else if (!(off = sufind[i])) return(0); --- 160,166 ----- again: if(!alph(i = *hyend & CMASK))return(0); if(i < 'a')i -= 'A'; else i -= 'a'; ! #if !defined(INCORE) && !defined(VMUNIX) if(!(off = sufind.uns[i]))return(0); #else if (!(off = sufind[i])) return(0); *************** *** 212,218 while(--w >= wdstart)if(vowel(*w & CMASK))return(w); return(0); } ! #ifndef INCORE char *getsuf(x) unsigned x; { --- 212,218 ----- while(--w >= wdstart)if(vowel(*w & CMASK))return(w); return(0); } ! #if !defined(INCORE) && !defined(VMUNIX) char *getsuf(x) unsigned x; { *** n9.c (old) Sat Feb 4 01:23:24 1984 --- n9.c (new) Sat Feb 4 01:23:29 1984 *************** *** 10,16 misc functions */ ! #ifndef INCORE extern struct envblock eblock; #else extern struct envblock eblock[NEV]; --- 10,16 ----- misc functions */ ! #if !defined(INCORE) && !defined(VMUNIX) extern struct envblock eblock; #else extern struct envblock eblock[NEV]; *************** *** 231,236 j = 0; goto rtn; } if((length = ((tabtab[j] & TMASK) - v_hp)) > 0 )break; } type = tabtab[j] & (~TMASK); --- 231,237 ----- j = 0; goto rtn; } + v_hp = sumhp(); /* XXX */ if((length = ((tabtab[j] & TMASK) - v_hp)) > 0 )break; } type = tabtab[j] & (~TMASK); *** ni.c (old) Sat Feb 4 01:24:25 1984 --- ni.c (new) Sat Feb 4 01:24:26 1984 *************** *** 94,100 /* troff environment block */ ! #ifndef INCORE struct envblock eblock = { /* environment initialization */ #else struct envblock eblock[NEV] = { --- 94,100 ----- /* troff environment block */ ! #if !defined(INCORE) && !defined(VMUNIX) struct envblock eblock = { /* environment initialization */ #else struct envblock eblock[NEV] = { *** t10.c (old) Sat Feb 4 01:26:30 1984 --- t10.c (new) Sat Feb 4 01:26:32 1984 *************** *** 7,13 */ extern struct d d[NDI], *dip; ! #ifndef INCORE extern struct envblock eblock; #else extern struct envblock eblock[NEV]; --- 7,13 ----- */ extern struct d d[NDI], *dip; ! #if !defined(INCORE) && !defined(VMUNIX) extern struct envblock eblock; #else extern struct envblock eblock[NEV]; *** t6.c (old) Sat Feb 4 01:27:25 1984 --- t6.c (new) Sat Feb 4 01:27:30 1984 *************** *** 7,13 width functions, sizes and fonts */ ! #ifndef INCORE extern struct envblock eblock; #else extern struct envblock eblock[NEV]; --- 7,13 ----- width functions, sizes and fonts */ ! #if !defined(INCORE) && !defined(VMUNIX) extern struct envblock eblock; #else extern struct envblock eblock[NEV]; *************** *** 22,27 extern int tch[]; extern int ch_CMASK; extern long atoi0(); extern int eschar; extern int widthp; extern int xpts; --- 22,28 ----- extern int tch[]; extern int ch_CMASK; extern long atoi0(); + extern int inchar[LNSIZE], *pinchar; /* XXX */ extern int eschar; extern int widthp; extern int xpts; *************** *** 302,307 int delim, em, k; int savlevel, savhp, savapts, savapts1, savfont, savfont1, savpts, savpts1; base = v_st = v_sb = wid = v_ct = 0; if((delim = getch() & CMASK) & MOT)return; --- 303,309 ----- int delim, em, k; int savlevel, savhp, savapts, savapts1, savfont, savfont1, savpts, savpts1; + int *savpinchar, *p, *q, tempinchar[LNSIZE]; /* XXX */ base = v_st = v_sb = wid = v_ct = 0; if((delim = getch() & CMASK) & MOT)return; *************** *** 308,313 savhp = v_hp; savlevel = level; v_hp = level = 0; savapts = apts; savapts1 = apts1; savfont = font; --- 310,319 ----- savhp = v_hp; savlevel = level; v_hp = level = 0; + savpinchar = pinchar; /* XXX */ + for (p=inchar, q=tempinchar; p < pinchar; ) /* XXX */ + *q++ = *p++; /* XXX */ + pinchar = inchar; /* XXX */ savapts = apts; savapts1 = apts1; savfont = font; *************** *** 331,336 nform = 0; setn1(wid); v_hp = savhp; level = savlevel; apts = savapts; apts1 = savapts1; --- 337,345 ----- nform = 0; setn1(wid); v_hp = savhp; + pinchar = savpinchar; /* XXX */ + for (p=inchar, q=tempinchar; p < pinchar; ) /* XXX */ + *p++ = *q++; /* XXX */ level = savlevel; apts = savapts; apts1 = savapts1; *** tdef.hd (old) Sat Feb 4 01:28:53 1984 --- tdef.hd (new) Sat Feb 4 01:28:55 1984 *************** *** 32,37 * I/O, and hence is portable to non-UNIX C environments. * Automatically sets NOCOMPACT. * * NDIAGS Causes the pm request to not be included. * * NOCOMPACT Produces an nroff/troff without compacted macros. The --- 32,42 ----- * I/O, and hence is portable to non-UNIX C environments. * Automatically sets NOCOMPACT. * + * VMUNIX Like INCORE, only it knows it's running under UNIX. It + * uses "sbrk" instead of "malloc" and doesn't use standard I/O. + * It also does not set NOCOMPACT. Faster than INCORE, but not + * as portable. + * * NDIAGS Causes the pm request to not be included. * * NOCOMPACT Produces an nroff/troff without compacted macros. The *************** *** 118,124 #ifdef tso #include "stdio.h" #endif ! #define BSIZE 512 /* size of any IO buffers */ #define ARGLEN 50 /* exec request (!) argument length (approx) */ #define NARSP 0177 /*narrow space*/ #define HNSP 0226 /*half narrow space*/ --- 123,129 ----- #ifdef tso #include "stdio.h" #endif ! #define BSIZE 1024 /* size of any IO buffers */ #define ARGLEN 50 /* exec request (!) argument length (approx) */ #define NARSP 0177 /*narrow space*/ #define HNSP 0226 /*half narrow space*/ *************** *** 173,180 #define T_STOP 0111 #define NPP 10 /*pads per field*/ #define FBUFSZ 256 /*field buf size words*/ ! #define OBUFSZ 512 /*bytes*/ ! #define IBUFSZ 512 /*bytes*/ #define NC 256 /*cbuf size words*/ #define NOV 10 /*number of overstrike chars*/ #define ZONE 5 /*5hrs for EST*/ --- 178,185 ----- #define T_STOP 0111 #define NPP 10 /*pads per field*/ #define FBUFSZ 256 /*field buf size words*/ ! #define OBUFSZ 1024 /*bytes*/ ! #define IBUFSZ 1024 /*bytes*/ #define NC 256 /*cbuf size words*/ #define NOV 10 /*number of overstrike chars*/ #define LEFT 035 *************** *** 177,183 #define IBUFSZ 512 /*bytes*/ #define NC 256 /*cbuf size words*/ #define NOV 10 /*number of overstrike chars*/ - #define ZONE 5 /*5hrs for EST*/ #define LEFT 035 #define RIGHT 036 #define LEADER 001 --- 182,187 ----- #define IBUFSZ 1024 /*bytes*/ #define NC 256 /*cbuf size words*/ #define NOV 10 /*number of overstrike chars*/ #define LEFT 035 #define RIGHT 036 #define LEADER 001 *************** *** 191,196 #define BLK 128 /*alloc block words*/ typedef unsigned filep; #define NBLIST 512 /* /tmp file allocation list */ /* Compiler Dependent Defines */ --- 195,203 ----- #define BLK 128 /*alloc block words*/ typedef unsigned filep; + #ifdef VMUNIX + #define NBLIST 1024 /* /tmp file allocation list */ + #else #define NBLIST 512 /* /tmp file allocation list */ #endif *************** *** 192,197 #define BLK 128 /*alloc block words*/ typedef unsigned filep; #define NBLIST 512 /* /tmp file allocation list */ /* Compiler Dependent Defines */ --- 199,205 ----- #define NBLIST 1024 /* /tmp file allocation list */ #else #define NBLIST 512 /* /tmp file allocation list */ + #endif /* Compiler Dependent Defines */ *************** *** 273,279 * structure accesses. */ ! #ifndef INCORE #define ics eblock.Eics #define ic eblock.Eic #define icf eblock.Eicf --- 281,287 ----- * structure accesses. */ ! #if !defined(INCORE) && !defined(VMUNIX) #define ics eblock.Eics #define ic eblock.Eic #define icf eblock.Eicf