titroff/ditroff (1.0) enhancements and fixes: part three

Russell Quin req at warwick.UUCP
Fri Nov 21 07:56:57 AEST 1986


#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	diffb
# This archive created: Thu Nov 20 21:49:58 1986
export PATH; PATH=/bin:$PATH
echo shar: extracting "'diffb'" '(42764 characters)'
if test -f 'diffb'
then
	echo shar: will not over-write existing file "'diffb'"
else
sed 's/^X//' << \SHAR_EOF > 'diffb'
Xdiff -rbc titroff/n2.c /distribution/dwb/text/troff.d/n2.c
X*** titroff/n2.c	Mon Nov 10 23:05:39 1986
X--- /distribution/dwb/text/troff.d/n2.c	Fri Sep  9 18:45:21 1983
X***************
X*** 1,3
X  #include "tdef.h"
X  #include <sgtty.h>
X  extern
X
X--- 1,4 -----
X+ /*	@(#)n2.c	1.2	*/
X  #include "tdef.h"
X  #include <sgtty.h>
X  extern
X***************
X*** 92,98
X  			oput(' ');
X  			return;
X  		}
X! 		if (j < 0177) {
X  			oput(j);
X  			return;
X  		}
X
X--- 93,99 -----
X  			oput(' ');
X  			return;
X  		}
X! 		if (j < 0177 && j != WORDSP) {
X  			oput(j);
X  			return;
X  		}
X***************
X*** 164,186
X  			}
X  #endif
X  		}
X- #ifdef TOOLATEFIX
X- 		/* integer overflow seems unlikely, but could be 
X- 		 * a little unfortunate in the *very* rare case that a
X- 		 * .po happened at exactly the wrong time...
X- 		 * Doing the stty twice would be bad, too, though
X- 		 * While we're about it, let's check the write, too.
X- 		 * though I don't know what to do if it fails!
X- 		 */
X- 		toolate = write(ptid, obuf, obufp - obuf);
X- 		if (toolate != obufp - obuf) {
X- #ifdef REPORTERRS
X- 			errmsg(EWARN, "Write failed, errno = %d", errno);
X- #endif REPORTERRS
X- 			/* do something, I suppose.  Like ignore it */
X- 		}
X- 		toolate = 1;
X- #else !TOOLATEFIX
X  		toolate += write(ptid, obuf, obufp - obuf);
X  #endif TOOLATEFIX
X  	}
X
X--- 165,170 -----
X  			}
X  #endif
X  		}
X  		toolate += write(ptid, obuf, obufp - obuf);
X  	}
X  	obufp = obuf;
X***************
X*** 182,188
X  		toolate = 1;
X  #else !TOOLATEFIX
X  		toolate += write(ptid, obuf, obufp - obuf);
X- #endif TOOLATEFIX
X  	}
X  	obufp = obuf;
X  }
X
X--- 166,171 -----
X  #endif
X  		}
X  		toolate += write(ptid, obuf, obufp - obuf);
X  	}
X  	obufp = obuf;
X  }
X***************
X*** 188,196
X  }
X  
X  
X- #ifdef LINTSTUFF
X- void
X- #endif LINTSTUFF
X  done(x) 
X  int	x;
X  {
X
X--- 171,176 -----
X  }
X  
X  
X  done(x) 
X  int	x;
X  {
X***************
X*** 205,216
X  		if (control(i, 0))
X  			longjmp(sjbuf, 1);
X  	}
X- #ifdef REPORTERRS
X- 	if (dilev) {
X- 		errmsg(EWARN, "End of File unexpected whilst diverting to %s",
X- 				realname(dip->curd));
X- 	}
X- #endif REPORTERRS
X  	if (!nfo)
X  		done3(0);
X  	mflg = 0;
X
X--- 185,190 -----
X  		if (control(i, 0))
X  			longjmp(sjbuf, 1);
X  	}
X  	if (!nfo)
X  		done3(0);
X  	mflg = 0;
X***************
X*** 234,242
X  }
X  
X  
X- #ifdef LINTSTUFF
X- void
X- #endif LINTSTUFF
X  done1(x) 
X  int	x; 
X  {
X
X--- 208,213 -----
X  }
X  
X  
X  done1(x) 
X  int	x; 
X  {
X***************
X*** 258,266
X  }
X  
X  
X- #ifdef LINTSTUFF
X- void
X- #endif LINTSTUFF
X  done2(x) 
X  int	x; 
X  {
X
X--- 229,234 -----
X  }
X  
X  
X  done2(x) 
X  int	x; 
X  {
X***************
X*** 273,287
X  	done3(x);
X  }
X  
X- #ifdef COMMENT
X- /* done3() seems to be the thing to call on a fatal error, as it does the
X-  * least afterwords.
X-  * -- req
X-  */
X- #endif COMMENT
X- #ifdef LINTSTUFF
X- void
X- #endif LINTSTUFF
X  done3(x) 
X  int	x;
X  {
X
X--- 241,246 -----
X  	done3(x);
X  }
X  
X  done3(x) 
X  int	x;
X  {
X***************
X*** 302,310
X  }
X  
X  
X- #ifdef LINTSTUFF
X- void
X- #endif LINTSTUFF
X  edone(x) 
X  int	x;
X  {
X
X--- 261,266 -----
X  }
X  
X  
X  edone(x) 
X  int	x;
X  {
X***************
X*** 322,330
X  	int	id[2];
X  
X  	if (toolate || skip() || !getname() || pipe(id) == -1 || (i = fork()) == -1) {
X- #ifdef REPORTERRS
X- 		errmsg(EWARN, ".pi: too late for pipe; not created");
X- #else !REPORTERRS
X  		fprintf(stderr, "Pipe not created.\n");
X  #endif REPORTERRS
X  		return;
X
X--- 278,283 -----
X  	int	id[2];
X  
X  	if (toolate || skip() || !getname() || pipe(id) == -1 || (i = fork()) == -1) {
X  		fprintf(stderr, "Pipe not created.\n");
X  		return;
X  	}
X***************
X*** 326,332
X  		errmsg(EWARN, ".pi: too late for pipe; not created");
X  #else !REPORTERRS
X  		fprintf(stderr, "Pipe not created.\n");
X- #endif REPORTERRS
X  		return;
X  	}
X  	ptid = id[1];
X
X--- 279,284 -----
X  
X  	if (toolate || skip() || !getname() || pipe(id) == -1 || (i = fork()) == -1) {
X  		fprintf(stderr, "Pipe not created.\n");
X  		return;
X  	}
X  	ptid = id[1];
X***************
X*** 340,348
X  	dup(id[0]);
X  	close(id[1]);
X  	execl(nextf, nextf, 0);
X- #ifdef REPORTERRS
X- 	errmsg(exit, -4, ".pi: cannot exec %s (errno = %d)", nextf, errno);
X- #else !REPORTERRS
X  	fprintf(stderr, "Cannot exec %s\n", nextf);
X  	exit(-4);
X  #endif REPORTERRS
X
X--- 292,297 -----
X  	dup(id[0]);
X  	close(id[1]);
X  	execl(nextf, nextf, 0);
X  	fprintf(stderr, "Cannot exec %s\n", nextf);
X  	exit(-4);
X  }
X***************
X*** 345,349
X  #else !REPORTERRS
X  	fprintf(stderr, "Cannot exec %s\n", nextf);
X  	exit(-4);
X- #endif REPORTERRS
X  }
X
X--- 294,297 -----
X  	execl(nextf, nextf, 0);
X  	fprintf(stderr, "Cannot exec %s\n", nextf);
X  	exit(-4);
X  }
Xdiff -rbc titroff/n3.c /distribution/dwb/text/troff.d/n3.c
X*** titroff/n3.c	Tue Nov 11 18:51:29 1986
X--- /distribution/dwb/text/troff.d/n3.c	Fri Sep  9 18:45:30 1983
X***************
X*** 1,3
X  #include "tdef.h"
X  extern
X  #include "d.h"
X
X--- 1,4 -----
X+ /*      @(#)n3.c	1.1     */
X  #include "tdef.h"
X  extern
X  #include "d.h"
X***************
X*** 49,61
X  }
X  
X  
X- #ifdef COMMENT
X- /* .rn aa bb
X-  * call aa bb
X-  * Question: is it an error if aa doesn't exist?  I guess so, so we print
X-  * a warning if -DREPORTERRS is set
X-  */
X- #endif COMMENT
X  casern()
X  {
X  	register i, j;
X
X--- 50,55 -----
X  }
X  
X  
X  casern()
X  {
X  	register i, j;
X***************
X*** 63,72
X  	lgf++;
X  	skip();
X  	if ((i = getrq()) == 0 || (oldmn = findmn(i)) < 0)
X- #ifdef REPORTERRS
X- 	{
X- 		if (i == 0) {
X- 			errmsg(EWARN, ".rn called without arguments");
X  			return;
X  		} else {
X  			errmsg(EWARN, ".rn: no macro called %s to rename",
X
X--- 57,62 -----
X  	lgf++;
X  	skip();
X  	if ((i = getrq()) == 0 || (oldmn = findmn(i)) < 0)
X  		return;
X  	skip();
X  	clrmn(findmn(j = getrq()));
X***************
X*** 68,81
X  		if (i == 0) {
X  			errmsg(EWARN, ".rn called without arguments");
X  			return;
X- 		} else {
X- 			errmsg(EWARN, ".rn: no macro called %s to rename",
X- 					realname(i));
X- 		}
X- 	}
X- #else !REPORTERRS
X- 		return;
X- #endif REPORTERRS
X  	skip();
X  	clrmn(findmn(j = getrq()));
X  	if (j)
X
X--- 58,63 -----
X  	skip();
X  	if ((i = getrq()) == 0 || (oldmn = findmn(i)) < 0)
X  		return;
X  	skip();
X  	clrmn(findmn(j = getrq()));
X  	if (j)
X***************
X*** 80,90
X  	clrmn(findmn(j = getrq()));
X  	if (j)
X  		contab[oldmn].rq = (contab[oldmn].rq & MMASK) | j;
X- #ifdef REPORTERRS
X- 	else {
X- 		errmsg(EWARN, ".rn %s: two arguments are needed", realname(i));
X- 	}
X- #endif REPORTERRS
X  }
X  
X  
X
X--- 62,67 -----
X  	clrmn(findmn(j = getrq()));
X  	if (j)
X  		contab[oldmn].rq = (contab[oldmn].rq & MMASK) | j;
X  }
X  
X  
X***************
X*** 88,100
X  }
X  
X  
X- #ifdef COMMENT
X- /* should probably be an error to .rm a non-existant macro, but this happens
X-  * too often for it to be helpful.
X-  * Think of .rm as rm -rf
X-  * -- req
X-  */
X- #endif COMMENT
X  caserm()
X  {
X  	lgf++;
X
X--- 65,70 -----
X  }
X  
X  
X  caserm()
X  {
X  	lgf++;
X***************
X*** 137,147
X  	lgf++;
X  	skip();
X  	if ((i = getrq()) == 0)
X- #ifdef REPORTERRS
X- 	{
X- 		errmsg(EWARN, "%s called with no argument",
X- 			ds ? (app ? ".as" : ".ds") :
X- 			     (app ? ".am" : ".de")  );
X  		goto de1;
X  	}
X  #else !REPORTERRS
X
X--- 107,112 -----
X  	lgf++;
X  	skip();
X  	if ((i = getrq()) == 0)
X  		goto de1;
X  	if ((offset = finds(i)) == 0)
X  		goto de1;
X***************
X*** 143,152
X  			ds ? (app ? ".as" : ".ds") :
X  			     (app ? ".am" : ".de")  );
X  		goto de1;
X- 	}
X- #else !REPORTERRS
X- 		goto de1;
X- #endif REPORTERRS
X  	if ((offset = finds(i)) == 0)
X  		goto de1;
X  #ifdef COMMENT
X
X--- 108,113 -----
X  	skip();
X  	if ((i = getrq()) == 0)
X  		goto de1;
X  	if ((offset = finds(i)) == 0)
X  		goto de1;
X  	if (ds)
X***************
X*** 149,159
X  #endif REPORTERRS
X  	if ((offset = finds(i)) == 0)
X  		goto de1;
X- #ifdef COMMENT
X- 		/* finds() returns 0 on an error, so no need to report it here
X- 		 * -- req
X- 		 */
X- #endif COMMENT
X  	if (ds)
X  		copys();
X  	else 
X
X--- 110,115 -----
X  		goto de1;
X  	if ((offset = finds(i)) == 0)
X  		goto de1;
X  	if (ds)
X  		copys();
X  	else 
X***************
X*** 200,210
X  	if (i >= 0) {
X  		if (contab[i].rq & MMASK)
X  			ffree((filep)contab[i].x.mx);
X- #ifdef PROTECTBUILTINS
X- 		else
X- 			errmsg(EWARN, "Builtin request %s removed",
X- 					realname(contab[i].rq & ~MMASK));
X- #endif PROTECTBUILTINS
X  		contab[i].rq = 0;
X  		contab[i].x.mx = 0;
X  	}
X
X--- 156,161 -----
X  	if (i >= 0) {
X  		if (contab[i].rq & MMASK)
X  			ffree((filep)contab[i].x.mx);
X  		contab[i].rq = 0;
X  		contab[i].x.mx = 0;
X  	}
X***************
X*** 233,242
X  			ip = incoff(ip);
X  		nextb = ip;
X  		ip = savip;
X- #ifdef PROTECTBUILTINS
X- 	} else if (app && oldmn >= 0) {
X- 		errmsg(EWARN, "Built-in request %s redefined", realname(mn));
X- #endif PROTECTBUILTINS
X  	} else {
X  		for (i = 0; i < NM; i++) {
X  			if (contab[i].rq == 0)
X
X--- 184,189 -----
X  			ip = incoff(ip);
X  		nextb = ip;
X  		ip = savip;
X  	} else {
X  		for (i = 0; i < NM; i++) {
X  			if (contab[i].rq == 0)
X***************
X*** 246,257
X  			app = 0;
X  			if (macerr++ > 1)
X  				done2(02);
X- #ifdef REPORTERRS
X- 			errmsg(edone,04, "too many (%d) string/macro names", NM);
X- 			/* edone() may return, so the return is needed.
X- 			 * -- req
X- 			 */
X- #else !REPORTERRS
X  			fprintf(stderr, "troff: Too many (%d) string/macro names.\n", NM);
X  			edone(04);
X  #endif REPORTERRS
X
X--- 193,198 -----
X  			app = 0;
X  			if (macerr++ > 1)
X  				done2(02);
X  			fprintf(stderr, "troff: Too many (%d) string/macro names.\n", NM);
X  			edone(04);
X  			return(offset = 0);
X***************
X*** 254,260
X  #else !REPORTERRS
X  			fprintf(stderr, "troff: Too many (%d) string/macro names.\n", NM);
X  			edone(04);
X- #endif REPORTERRS
X  			return(offset = 0);
X  		}
X  		contab[i].x.mx = (unsigned) nextb;
X
X--- 195,200 -----
X  				done2(02);
X  			fprintf(stderr, "troff: Too many (%d) string/macro names.\n", NM);
X  			edone(04);
X  			return(offset = 0);
X  		}
X  		contab[i].x.mx = (unsigned) nextb;
X***************
X*** 282,314
X  }
X  
X  
X- #ifdef COMMENT
X- /* copyb() simulates a finite state machine that recognises
X-  *	<start-of-line> .jk
X-  * where j and k are the 1 or 2 letters of the macro name that getrq() finds.
X-  *
X-  * start---><state==1>--"."--><state==2>--"j"--<state==3>--"k"-->ACCEPT
X-  * "\n" puts us back to <state==1>
X-  * anything else puts us back to start (which is equivalent)
X-  *
X-  * The idea is to copy stuff into a macro (i.e. into the tmp file) until
X-  * ACCEPT, when we return.  This is used by .de, .am and .ig.  .ig should
X-  * really not use this, as auto-incremented number registers will be
X-  * affected.  Or there could be another flag to getch().  Ugh.
X-  *
X-  * It would be nice if we could provide a warning if EOF was found, as a
X-  * very common cause of no output is to have unmatched .de xx and .., but
X-  * this is difficult.  We can warn about "open" diversions in done(), I
X-  * suppose.  The problem is that getach() calls nextfile() on EOF, which
X-  * in turn calls done() if there aren't any more; but done() doesn't know
X-  * that we're still in coyb, and deducing it from the state of the global
X-  * variables is too much effort.  The reason I'm content to leave it at that
X-  * point is that even if done() *did* know about copyb, it wouldn't be able
X-  * to relate that to the user-level .de or .am or whatever very easily.
X-  *
X-  * -- req
X-  */
X- #endif COMMENT
X  copyb()
X  {
X  	register i, j, k;
X
X--- 222,227 -----
X  }
X  
X  
X  copyb()
X  {
X  	register i, j, k;
X***************
X*** 375,384
X  
X  	copyf++;
X  	if (skip())
X- #ifdef REPORTERRS
X- 	{
X- 		/* would be nice if we knew the string name! */
X- 		errmsg(EWARN, ".ds: usage is .ds xx \"string; no string here!");
X  		goto c0;
X  	}
X  #else !REPORTERRS
X
X--- 288,293 -----
X  
X  	copyf++;
X  	if (skip())
X  		goto c0;
X  	if (cbits(i = getch()) != '"')
X  		wbf(i);
X***************
X*** 380,389
X  		/* would be nice if we knew the string name! */
X  		errmsg(EWARN, ".ds: usage is .ds xx \"string; no string here!");
X  		goto c0;
X- 	}
X- #else !REPORTERRS
X- 		goto c0;
X- #endif REPORTERRS
X  	if (cbits(i = getch()) != '"')
X  		wbf(i);
X  	while (cbits(i = getch()) != '\n')
X
X--- 289,294 -----
X  	copyf++;
X  	if (skip())
X  		goto c0;
X  	if (cbits(i = getch()) != '"')
X  		wbf(i);
X  	while (cbits(i = getch()) != '\n')
X***************
X*** 435,443
X  }
X  
X  
X- #ifdef COMMENT
X- /* wbf() --- Write Buffer File (or Block File)		-- req  */
X- #endif COMMENT
X  wbf(i)
X  tchar i;
X  {
X
X--- 340,345 -----
X  }
X  
X  
X  wbf(i)
X  tchar i;
X  {
X***************
X*** 469,477
X  }
X  
X  
X- #ifdef COMMENT
X- /* wbfl() --- Write BLock to File -- req  */
X- #endif COMMENT
X  wbfl()
X  {
X  	if (woff == 0)
X
X--- 371,376 -----
X  }
X  
X  
X  wbfl()
X  {
X  	if (woff == 0)
X***************
X*** 486,494
X  }
X  
X  
X- #ifdef COMMENT
X- /* rbf() -- read block from file -- req */
X- #endif COMMENT
X  tchar rbf()
X  {
X  	tchar i;
X
X--- 385,390 -----
X  }
X  
X  
X  tchar rbf()
X  {
X  	tchar i;
X***************
X*** 520,528
X  		p = ip;
X  		if (!((j = ++p) & (BLK - 1))) {
X  			if ((i = blist[blisti(--p)]) == -1) {
X- #ifdef REPORTERRS
X- 				errmsg(done2,-5, "Internal error in rbf()");
X- #else !REPORTERRS
X  				fprintf(stderr, "troff: Bad storage allocation.\n");
X  				done2(-5);
X  #endif REPORTERRS
X
X--- 416,421 -----
X  		p = ip;
X  		if (!((j = ++p) & (BLK - 1))) {
X  			if ((i = blist[blisti(--p)]) == -1) {
X  				fprintf(stderr, "troff: Bad storage allocation.\n");
X  				done2(-5);
X  			}
X***************
X*** 525,531
X  #else !REPORTERRS
X  				fprintf(stderr, "troff: Bad storage allocation.\n");
X  				done2(-5);
X- #endif REPORTERRS
X  			}
X  			j = ((filep)i);
X  		}
X
X--- 418,423 -----
X  			if ((i = blist[blisti(--p)]) == -1) {
X  				fprintf(stderr, "troff: Bad storage allocation.\n");
X  				done2(-5);
X  			}
X  			j = ((filep)i);
X  		}
X***************
X*** 540,550
X  {
X  	register filep i;
X  
X- #ifdef COMMENT
X- 	/* BLK is a power of 2, so p & ~(BLK - 1) is (on a 2's compl. m/c)
X- 	 * the bits higher than BLK
X- 	 * -- req */
X- #endif COMMENT
X  	if ((i = p & ~(BLK - 1)) != roff) {
X  		roff = i;
X  #ifndef INCORE
X
X--- 432,437 -----
X  {
X  	register filep i;
X  
X  	if ((i = p & ~(BLK - 1)) != roff) {
X  		roff = i;
X  #ifndef INCORE
X***************
X*** 567,575
X  
X  	if (!((j = ++p) & (BLK - 1))) {
X  		if ((i = blist[blisti(--p)]) == -1) {
X- #ifdef REPORTERRS
X- 			errmsg(done2, -5, "Internal storage error in incoff()");
X- #else !REPORTERRS
X  			fprintf(stderr, "troff: Bad storage allocation.\n");
X  			done2(-5);
X  #endif REPORTERRS
X
X--- 454,459 -----
X  
X  	if (!((j = ++p) & (BLK - 1))) {
X  		if ((i = blist[blisti(--p)]) == -1) {
X  			fprintf(stderr, "troff: Bad storage allocation.\n");
X  			done2(-5);
X  		}
X***************
X*** 572,578
X  #else !REPORTERRS
X  			fprintf(stderr, "troff: Bad storage allocation.\n");
X  			done2(-5);
X- #endif REPORTERRS
X  		}
X  		j = (filep) i;
X  	}
X
X--- 456,461 -----
X  		if ((i = blist[blisti(--p)]) == -1) {
X  			fprintf(stderr, "troff: Bad storage allocation.\n");
X  			done2(-5);
X  		}
X  		j = (filep) i;
X  	}
X***************
X*** 639,644
X  int	x;
X  {
X  	register char	*i;
X  	char	*sbrk();
X  
X  #ifdef ALIGNFIXES
X
X--- 522,528 -----
X  int	x;
X  {
X  	register char	*i;
X+ 	register j;
X  	char	*sbrk();
X  
X  	if (j = x % sizeof(int))	/*allocate only whole words for 3B*/
X***************
X*** 641,671
X  	register char	*i;
X  	char	*sbrk();
X  
X! #ifdef ALIGNFIXES
X! 	/* have to align x to a suitable boundary for storing an int.
X! 	 * Or a tchar?  Or a struct?  We'll use the larger of int and tchar
X! 	 * to be on the safe side...  Really ought to go through and check
X! 	 * every use, but...
X! 	 * - req
X! 	 */
X! 	unsigned int xsize = sizeof(int);
X! 
X! 	if (xsize < sizeof(tchar))
X! 		xsize = sizeof(tchar);
X! 	if (x % (int) xsize)
X! 		x += (int) (xsize - 1);
X! #else !ALIGNFIXES
X! 	if (x % 2 == 1) 
X! 		x++;
X! #endif ALIGNFIXES
X! #ifdef COMMENT
X! 	/* } for brace-match tool */
X! 
X! 	/* note that MAXPTR is (char *) -1, so it's really an error
X! 	 * rather than a cvalue to check against.
X! 	 * - req
X! 	 */
X! #endif COMMENT
X  	if ((i = sbrk(x)) == MAXPTR) {
X  #ifdef REPORTERRS
X  		errmsg(edone, 0100, "Out of memory at %d (recursive macro problem?)", i);
X
X--- 525,532 -----
X  	register j;
X  	char	*sbrk();
X  
X! 	if (j = x % sizeof(int))	/*allocate only whole words for 3B*/
X! 		x += sizeof(int) - j;
X  	if ((i = sbrk(x)) == MAXPTR) {
X  		fprintf(stderr, "troff: Core limit reached.\n");
X  		edone(0100);
X***************
X*** 667,676
X  	 */
X  #endif COMMENT
X  	if ((i = sbrk(x)) == MAXPTR) {
X- #ifdef REPORTERRS
X- 		errmsg(edone, 0100, "Out of memory at %d (recursive macro problem?)", i);
X- 		edone(0100);
X- #else !REPORTERRS
X  		fprintf(stderr, "troff: Core limit reached.\n");
X  		edone(0100);
X  #endif REPORTERRS
X
X--- 528,533 -----
X  	if (j = x % sizeof(int))	/*allocate only whole words for 3B*/
X  		x += sizeof(int) - j;
X  	if ((i = sbrk(x)) == MAXPTR) {
X  		fprintf(stderr, "troff: Core limit reached.\n");
X  		edone(0100);
X  	} else {
X***************
X*** 673,679
X  #else !REPORTERRS
X  		fprintf(stderr, "troff: Core limit reached.\n");
X  		edone(0100);
X- #endif REPORTERRS
X  	} else {
X  		enda = i + x;
X  	}
X
X--- 530,535 -----
X  	if ((i = sbrk(x)) == MAXPTR) {
X  		fprintf(stderr, "troff: Core limit reached.\n");
X  		edone(0100);
X  	} else {
X  		if ((unsigned)i % sizeof(int)){	/*check alignment for 3B*/
X  			fprintf(stderr, "troff: alignment problem.\n");
X***************
X*** 675,680
X  		edone(0100);
X  #endif REPORTERRS
X  	} else {
X  		enda = i + x;
X  	}
X  	return(i);
X
X--- 531,540 -----
X  		fprintf(stderr, "troff: Core limit reached.\n");
X  		edone(0100);
X  	} else {
X+ 		if ((unsigned)i % sizeof(int)){	/*check alignment for 3B*/
X+ 			fprintf(stderr, "troff: alignment problem.\n");
X+ 			edone(0100);
X+ 		}
X  		enda = i + x;
X  	}
X  	return(i);
X***************
X*** 681,689
X  }
X  
X  
X- #ifdef COMMENT
X- /* Long name stuff would go here, of course */
X- #endif COMMENT
X  getsn()
X  {
X  	register i;
X
X--- 541,546 -----
X  }
X  
X  
X  getsn()
X  {
X  	register i;
X***************
X*** 701,718
X  {
X  	register i;
X  
X- #ifdef COMMENT
X- 	/* lgf++ --- don't expand ligatures in strings.  Bug: if input that
X- 	 * would normally be turned into a ligature overlapps a string
X- 	 * (eg:
X- 	 * .ds a "i
X- 	 * f\*a  ), the ligature isn't expanded.  I don't know why.
X- 	 *
X- 	 * Is it an error to say \*x if x doesn't exist?  I guess so,
X- 	 * but this would make lots of errors with -ms.  I'll think about it.
X- 	 * -- req
X- 	 */
X- #endif COMMENT
X  	lgf++;
X  	if (((i = getsn()) == 0) ||  ((i = findmn(i)) == -1) ||  !(contab[i].rq & MMASK)) {
X  		lgf--;
X
X--- 558,563 -----
X  {
X  	register i;
X  
X  	lgf++;
X  	if (((i = getsn()) == 0) ||  ((i = findmn(i)) == -1) ||  !(contab[i].rq & MMASK)) {
X  		lgf--;
X***************
X*** 716,724
X  	lgf++;
X  	if (((i = getsn()) == 0) ||  ((i = findmn(i)) == -1) ||  !(contab[i].rq & MMASK)) {
X  		lgf--;
X- #ifdef COMMENT
X- 		/* an error message should prbably go here --- req */
X- #endif COMMENT
X  		return(0);
X  	} else {
X  		SPACETEST(nxf, sizeof(struct s));
X
X--- 561,566 -----
X  	lgf++;
X  	if (((i = getsn()) == 0) ||  ((i = findmn(i)) == -1) ||  !(contab[i].rq & MMASK)) {
X  		lgf--;
X  		return(0);
X  	} else {
X  		SPACETEST(nxf, sizeof(struct s));
X***************
X*** 731,739
X  
X  
X  
X- #ifdef COMMENT
X- /* collect macro arguments */
X- #endif COMMENT
X  collect()
X  {
X  	register j;
X
X--- 573,578 -----
X  
X  
X  
X  collect()
X  {
X  	register j;
X***************
X*** 809,819
X  				fprintf(stderr, "strp=0x%x, lim = 0x%x\n",
X  					strp, lim);
X  #endif 0
X- #ifdef REPORTERRS
X- 				copyf--;
X- 				errmsg(edone, 04,
X- 			"Macro arguments use more than %d characters", CPERMAC);
X- #else !REPORTERRS
X  				fprintf(stderr,
X  					"troff: Macro argument too long.\n");
X  				copyf--;
X
X--- 648,653 -----
X  				fprintf(stderr, "strp=0x%x, lim = 0x%x\n",
X  					strp, lim);
X  #endif 0
X  				fprintf(stderr,
X  					"troff: Macro argument too long.\n");
X  				copyf--;
X***************
X*** 818,824
X  					"troff: Macro argument too long.\n");
X  				copyf--;
X  				edone(004);
X- #endif REPORTERRS
X  			}
X  			SPACETEST(strp, 3 * sizeof(tchar));
X  		}
X
X--- 652,657 -----
X  					"troff: Macro argument too long.\n");
X  				copyf--;
X  				edone(004);
X  			}
X  			SPACETEST(strp, 3 * sizeof(tchar));
X  		}
X***************
X*** 824,836
X  		}
X  		*strp++ = 0;
X  	}
X- #ifdef COMMENT
X- 	/* should report if > APERMAC args... */
X- 	/* Also, the cast to (tchar **) may be wrong;  4.2bsd troff has int **
X- 	 * instead, but uses nxf rather than savnxf.  Who cares?
X- 	 * - req
X- 	 */
X- #endif COMMENT
X  	nxf = savnxf;
X  	nxf->nargs = argpp - (tchar **)(savnxf + 1);
X  	argtop = strp;
X
X--- 657,662 -----
X  		}
X  		*strp++ = 0;
X  	}
X  	nxf = savnxf;
X  	nxf->nargs = argpp - (tchar **)(savnxf + 1);
X  	argtop = strp;
X***************
X*** 866,874
X  
X  	lgf++;
X  	if (skip() || ((i = getrq()) == 0)) {
X- #ifdef COMMENT
X- 		/* .di */
X- #endif COMMENT
X  		if (dip != d)
X  			wbt((tchar)0);
X  		if (dilev > 0) {
X
X--- 692,697 -----
X  
X  	lgf++;
X  	if (skip() || ((i = getrq()) == 0)) {
X  		if (dip != d)
X  			wbt((tchar)0);
X  		if (dilev > 0) {
X***************
X*** 877,887
X  			dip = &d[--dilev];
X  			offset = dip->op;
X  		}
X- #ifdef REPORTERRS
X- 		else {
X- 			errmsg(EWARN, ".di without arguments outside a diversion");
X- 		}
X- #endif REPORTERRS
X  		goto rtn;
X  	}
X  	if (++dilev == NDI) {
X
X--- 700,705 -----
X  			dip = &d[--dilev];
X  			offset = dip->op;
X  		}
X  		goto rtn;
X  	}
X  	if (++dilev == NDI) {
X***************
X*** 886,895
X  	}
X  	if (++dilev == NDI) {
X  		--dilev;
X- #ifdef REPORTERRS
X- 		errmsg(edone,02,"Diversions nested deeper than %d levels", NDI);
X- 		edone(02);
X- #else !REPORTERRS
X  		fprintf(stderr, "troff: Diversions nested too deep.\n");
X  		edone(02);
X  #endif REPORTERRS
X
X--- 704,709 -----
X  	}
X  	if (++dilev == NDI) {
X  		--dilev;
X  		fprintf(stderr, "troff: Diversions nested too deep.\n");
X  		edone(02);
X  	}
X***************
X*** 892,898
X  #else !REPORTERRS
X  		fprintf(stderr, "troff: Diversions nested too deep.\n");
X  		edone(02);
X- #endif REPORTERRS
X  	}
X  	if (dip != d)
X  		wbt((tchar)0);
X
X--- 706,711 -----
X  		--dilev;
X  		fprintf(stderr, "troff: Diversions nested too deep.\n");
X  		edone(02);
X  	}
X  	if (dip != d)
X  		wbt((tchar)0);
X***************
X*** 917,925
X  	skip();
X  	dip->ditrap = vnumb((int *)0);
X  	if (nonumb)
X- #ifdef REPORTERRS
X- 	{
X- 		errmsg(EWARN, ".dt must have a numeric first argument");
X  		return;
X  	}
X  #else !REPORTERRS
X
X--- 730,735 -----
X  	skip();
X  	dip->ditrap = vnumb((int *)0);
X  	if (nonumb)
X  		return;
X  	skip();
X  	dip->dimac = getrq();
X***************
X*** 921,930
X  	{
X  		errmsg(EWARN, ".dt must have a numeric first argument");
X  		return;
X- 	}
X- #else !REPORTERRS
X- 		return;
X- #endif REPORTERRS
X  	skip();
X  #ifdef REPORTERRS
X  	if ((dip->dimac = getrq()) == 0) {
X
X--- 731,736 -----
X  	dip->ditrap = vnumb((int *)0);
X  	if (nonumb)
X  		return;
X  	skip();
X  	dip->dimac = getrq();
X  }
X***************
X*** 926,936
X  		return;
X  #endif REPORTERRS
X  	skip();
X- #ifdef REPORTERRS
X- 	if ((dip->dimac = getrq()) == 0) {
X- 		errmsg(EWARN, ".dt needs to have a macro-name as a third argument");
X- 	}
X- #else !REPORTERRS
X  	dip->dimac = getrq();
X  #endif REPORTERRS
X  }
X
X--- 732,737 -----
X  	if (nonumb)
X  		return;
X  	skip();
X  	dip->dimac = getrq();
X  }
X  
X***************
X*** 932,938
X  	}
X  #else !REPORTERRS
X  	dip->dimac = getrq();
X- #endif REPORTERRS
X  }
X  
X  
X
X--- 733,738 -----
X  		return;
X  	skip();
X  	dip->dimac = getrq();
X  }
X  
X  
X***************
X*** 951,959
X  	if ((offset = begin = alloc()) == 0)
X  		return;
X  	if (ismot(delim = getch())) {
X- #ifdef REPORTERRS
X- 		errmsg(EWARN, ".tl: first delimiter unsuitable; using \"'\"");
X- #endif REPORTERRS
X  		ch = delim;
X  		delim = '\'';
X  	} else 
X
X--- 751,756 -----
X  	if ((offset = begin = alloc()) == 0)
X  		return;
X  	if (ismot(delim = getch())) {
X  		ch = delim;
X  		delim = '\'';
X  	} else 
X***************
X*** 959,974
X  	} else 
X  		delim = cbits(delim);
X  	if (!nlflg)
X- #ifdef REPORTERRS
X- 	{
X- #endif REPORTERRS
X- #ifdef COMMENT
X- 		/* would like to detect .tl with no trailing delim here.
X- 		 * Maybe .tl 'left'
X- 		 * should be an error, too (no 'center'right')
X- 		 * - req
X- 		 */
X- #endif COMMENT
X  		while (cbits(i = getch()) != '\n') {
X  			if (cbits(i) == cbits(delim))
X  				i = IMP;
X
X--- 756,761 -----
X  	} else 
X  		delim = cbits(delim);
X  	if (!nlflg)
X  		while (cbits(i = getch()) != '\n') {
X  			if (cbits(i) == cbits(delim))
X  				i = IMP;
X***************
X*** 974,984
X  				i = IMP;
X  			wbf(i);
X  		}
X- #ifdef REPORTERRS
X- 	} else {
X- 		errmsg(EWARN, ".tl with no arguments ignored");
X- 	}
X- #endif REPORTERRS
X  	wbf((tchar)IMP);
X  	wbf((tchar)IMP);
X  	wbt((tchar)0);
X
X--- 761,766 -----
X  				i = IMP;
X  			wbf(i);
X  		}
X  	wbf((tchar)IMP);
X  	wbf((tchar)IMP);
X  	wbt((tchar)0);
X***************
X*** 1011,1020
X  }
X  
X  
X- #ifdef COMMENT
X- /* if no argument to .pc, set to IMP (i.e. turn the mechanism off
X-  * -- req */
X- #endif COMMENT
X  casepc()
X  {
X  	pagech = chget(IMP);
X
X--- 793,798 -----
X  }
X  
X  
X  casepc()
X  {
X  	pagech = chget(IMP);
Xdiff -rbc titroff/n4.c /distribution/dwb/text/troff.d/n4.c
X*** titroff/n4.c	Wed Nov 19 21:24:19 1986
X--- /distribution/dwb/text/troff.d/n4.c	Fri Sep  9 18:45:36 1983
X***************
X*** 1,3
X  #include	<ctype.h>
X  #include "tdef.h"
X  extern
X
X--- 1,4 -----
X+ /*      @(#)n4.c	1.1     */
X  #include	<ctype.h>
X  #include "tdef.h"
X  extern
X***************
X*** 18,28
X  #include <sgtty.h>
X  #include "ext.h"
X  
X- #ifndef NROFF
X- #ifdef PAPERSIZEREG
X- extern int paperwidth, paperlength;
X- #endif PAPERSIZEREG
X- #endif !NROFF
X  int	regcnt = NNAMES;
X  int	falsef	= 0;	/* on if inside false branch of if */
X  
X
X--- 19,24 -----
X  #include <sgtty.h>
X  #include "ext.h"
X  
X  int	regcnt = NNAMES;
X  int	falsef	= 0;	/* on if inside false branch of if */
X  
X***************
X*** 139,164
X  		case 'b':
X  			i = bdtab[font];
X  			break;
X! #ifndef NROFF
X! #ifdef PAPERSIZEREG
X! 		case 'W':	/* .W -- paperwidth */
X! 			i = paperwidth;
X! #ifdef LOCALWARN
X! 			lwarn(".W number register non-standard\n");
X! #endif LOCALWARN
X! 			break;
X! 		case 'M':	/* .M -- paperlength */
X! 			i = paperlength;
X! #ifdef LOCALWARN
X! 			lwarn(".M number register non-standard\n");
X! #endif LOCALWARN
X! 			break;
X! #endif PAPERSIZEREG
X! #endif !NROFF
X! #ifdef BLANKSMACRO
X! 		case 'B':	/* .B number of leading blanks on this line */
X! 			{
X! 				extern int nrspaces; /* from local.c */
X  
X  				i = nrspaces;
X  #ifdef LOCALWARN
X
X--- 135,144 -----
X  		case 'b': 
X  			i = bdtab[font];
X  			break;
X! 		case 'F':
X! 			for (i=0; cbuf[i] = cfname[ifi][i]; i++) ;
X! 			cp = cbuf;
X! 			return;
X  
X  		default:
X  			goto s0;
X***************
X*** 160,192
X  			{
X  				extern int nrspaces; /* from local.c */
X  
X- 				i = nrspaces;
X- #ifdef LOCALWARN
X- 				lwarn(".B number register non-standard\n");
X- #endif LOCALWARN
X- 				break;
X- 			}
X- 
X- 		case 'N':	/* nlflag */
X- 			{
X- 				extern int nrlines;
X- 
X- 				i = nrlines;
X- #ifdef LOCALWARN
X- 				lwarn(".B number register non-standard\n");
X- #endif LOCALWARN
X- 				break;
X- 			}
X- #endif BLANKSMACRO
X- 
X- #ifdef EVREG
X- 		case 'e':	/* .e -- environment number */
X- 			i = ev;
X- #ifdef LOCALWARN
X- 			lwarn(".e number register non-standard\n");
X- #endif LOCALWARN
X- 			break;
X- #endif EVREG
X  		default:
X  #ifdef REPORTERRS
X  			errmsg(EWARN, "\\n: No such read-only number register as .%c",
X
X--- 140,145 -----
X  			cp = cbuf;
X  			return;
X  
X  		default:
X  			goto s0;
X  		}
X***************
X*** 188,197
X  			break;
X  #endif EVREG
X  		default:
X- #ifdef REPORTERRS
X- 			errmsg(EWARN, "\\n: No such read-only number register as .%c",
X- 								i >> BYTE);
X- #endif REPORTERRS
X  			goto s0;
X  		}
X  	else {
X
X--- 141,146 -----
X  			return;
X  
X  		default:
X  			goto s0;
X  		}
X  	else {
X***************
X*** 196,207
X  		}
X  	else {
X  s0:
X- #ifdef COMMENT
X- 		/* no such number register could be an error, but it
X- 		 * happens too often to be worth moaning at.
X- 		 * -- req
X- 		 */
X- #endif COMMENT
X  		if ((j = findr(i)) == -1)
X  			i = 0;
X  		else {
X
X--- 145,150 -----
X  		}
X  	else {
X  s0:
X  		if ((j = findr(i)) == -1)
X  			i = 0;
X  		else {
X***************
X*** 249,257
X  		}
X  	}
X  	if (p == &r[NN]) {
X- #ifdef REPORTERRS
X- 		errmsg(done2, 04, "more than %d number registers", NN);
X- #else !REPORTERRS
X  		fprintf(stderr, "troff: too many number registers (%d).\n", NN);
X  		done2(04);
X  #endif REPORTERRS
X
X--- 192,197 -----
X  		}
X  	}
X  	if (p == &r[NN]) {
X  		fprintf(stderr, "troff: too many number registers (%d).\n", NN);
X  		done2(04); 
X  	}
X***************
X*** 254,260
X  #else !REPORTERRS
X  		fprintf(stderr, "troff: too many number registers (%d).\n", NN);
X  		done2(04);
X- #endif REPORTERRS
X  	}
X  	return(p - r);
X  }
X
X--- 194,199 -----
X  	if (p == &r[NN]) {
X  		fprintf(stderr, "troff: too many number registers (%d).\n", NN);
X  		done2(04); 
X  	}
X  	return(p - r);
X  }
X***************
X*** 389,397
X  }
X  
X  
X- #ifdef REPORTERRS
X- static int bracklevel = 0;	/* depth of ( ... ) in expressions */
X- #endif REPORTERRS
X  long	atoi0()
X  {
X  	register c, k, cnt;
X
X--- 328,333 -----
X  }
X  
X  
X  long	atoi0()
X  {
X  	register c, k, cnt;
X***************
X*** 412,425
X  		ch = ii;
X  		if (cnt)
X  			break;
X- #ifdef COMMENT
X- 		/* else fall through... */
X- 
X- 		/* Could warn here about trailing garbage, but things like
X- 		 * .ta 3iR or \l'3iX' would go horribly wrong then!
X- 		 * - req
X- 		 */
X- #endif COMMENT
X  	case '+':
X  		i = ckph();
X  #ifdef REPORTERRS
X
X--- 348,353 -----
X  		ch = ii;
X  		if (cnt)
X  			break;
X  	case '+':
X  		i = ckph();
X  		if (nonumb)
X***************
X*** 422,448
X  #endif COMMENT
X  	case '+':
X  		i = ckph();
X- #ifdef REPORTERRS
X- 		if (nonumb) {
X- 			if (cnt) {
X- 				if (cbits(ch) == '\n') {
X- 					errmsg(EWARN, "newline unexpected after +");
X- 				} else {
X- 					errmsg(EWARN, "Unexpected \"%s\" found after +", tchartos(ch));
X- 				}
X- 			} else if (cbits(ch) != '\n') {
X- 				/* caseif() turns off this message! */
X- 				if (reporterrs & LERR_BADEXPSTART) {
X- 					if (!(ismot(ch) && !isvmot(ch)) &&
X- 						cbits(ch) != RIGHT &&
X- 						cbits(ch) != ' ') {
X- 							errmsg(EWARN, "\"%s\" can't start an expression", tchartos(ch));
X- 					}
X- 				}
X- 			}
X- 			break;
X- 		} 
X- #else !REPORTERRS
X  		if (nonumb)
X  			break;
X  #endif REPORTERRS
X
X--- 350,355 -----
X  			break;
X  	case '+':
X  		i = ckph();
X  		if (nonumb)
X  			break;
X  		acc += i;
X***************
X*** 445,451
X  #else !REPORTERRS
X  		if (nonumb)
X  			break;
X- #endif REPORTERRS
X  		acc += i;
X  		goto a0;
X  	case '-':
X
X--- 352,357 -----
X  		i = ckph();
X  		if (nonumb)
X  			break;
X  		acc += i;
X  		goto a0;
X  	case '-':
X***************
X*** 451,459
X  	case '-':
X  		i = ckph();
X  		if (nonumb)
X- #ifdef REPORTERRS
X- 		{
X- 			errmsg(EWARN, "found \"%s\" after \"-\" in expression!", tchartos(ch));
X  			break;
X  		}
X  #else !REPORTERRS
X
X--- 357,362 -----
X  	case '-':
X  		i = ckph();
X  		if (nonumb)
X  			break;
X  		acc -= i;
X  		goto a0;
X***************
X*** 455,464
X  		{
X  			errmsg(EWARN, "found \"%s\" after \"-\" in expression!", tchartos(ch));
X  			break;
X- 		}
X- #else !REPORTERRS
X- 			break;
X- #endif REPORTERRS
X  		acc -= i;
X  		goto a0;
X  	case '*':
X
X--- 358,363 -----
X  		i = ckph();
X  		if (nonumb)
X  			break;
X  		acc -= i;
X  		goto a0;
X  	case '*':
X***************
X*** 464,472
X  	case '*':
X  		i = ckph();
X  		if (nonumb)
X- #ifdef REPORTERRS
X- 		{
X- 			errmsg(EWARN, "found \"%s\" after * in expression!", tchartos(ch));
X  			break;
X  		}
X  #else !REPORTERRS
X
X--- 363,368 -----
X  	case '*':
X  		i = ckph();
X  		if (nonumb)
X  			break;
X  		acc *= i;
X  		goto a0;
X***************
X*** 468,477
X  		{
X  			errmsg(EWARN, "found \"%s\" after * in expression!", tchartos(ch));
X  			break;
X- 		}
X- #else !REPORTERRS
X- 			break;
X- #endif REPORTERRS
X  		acc *= i;
X  		goto a0;
X  	case '/':
X
X--- 364,369 -----
X  		i = ckph();
X  		if (nonumb)
X  			break;
X  		acc *= i;
X  		goto a0;
X  	case '/':
X***************
X*** 477,485
X  	case '/':
X  		i = ckph();
X  		if (nonumb)
X- #ifdef REPORTERRS
X- 		{
X- 			errmsg(EWARN, "found \"%s\" after / in expression!", tchartos(ch));
X  			break;
X  		}
X  #else !REPORTERRS
X
X--- 369,374 -----
X  	case '/':
X  		i = ckph();
X  		if (nonumb)
X  			break;
X  		if (i == 0) {
X  			flusho();
X***************
X*** 481,490
X  		{
X  			errmsg(EWARN, "found \"%s\" after / in expression!", tchartos(ch));
X  			break;
X- 		}
X- #else !REPORTERRS
X- 			break;
X- #endif REPORTERRS
X  		if (i == 0) {
X  			flusho();
X  #ifdef REPORTERRS
X
X--- 370,375 -----
X  		i = ckph();
X  		if (nonumb)
X  			break;
X  		if (i == 0) {
X  			flusho();
X  			fprintf(stderr, "troff: divide by zero.\n");
X***************
X*** 487,495
X  #endif REPORTERRS
X  		if (i == 0) {
X  			flusho();
X- #ifdef REPORTERRS
X- 			errmsg(EWARN, "divide by zero in expression (result is 0)");
X- #else !REPORTERRS
X  			fprintf(stderr, "troff: divide by zero.\n");
X  #endif REPORTERRS
X  			acc = 0;
X
X--- 372,377 -----
X  			break;
X  		if (i == 0) {
X  			flusho();
X  			fprintf(stderr, "troff: divide by zero.\n");
X  			acc = 0;
X  		} else 
X***************
X*** 491,497
X  			errmsg(EWARN, "divide by zero in expression (result is 0)");
X  #else !REPORTERRS
X  			fprintf(stderr, "troff: divide by zero.\n");
X- #endif REPORTERRS
X  			acc = 0;
X  		} else
X  			acc /= i;
X
X--- 373,378 -----
X  		if (i == 0) {
X  			flusho();
X  			fprintf(stderr, "troff: divide by zero.\n");
X  			acc = 0;
X  		} else 
X  			acc /= i;
X***************
X*** 499,507
X  	case '%':
X  		i = ckph();
X  		if (nonumb)
X- #ifdef REPORTERRS
X- 		{
X- 			errmsg(EWARN, "found \"%s\" after % (mod) in expression!", tchartos(ch));
X  			break;
X  		}
X  #else !REPORTERRS
X
X--- 380,385 -----
X  	case '%':
X  		i = ckph();
X  		if (nonumb)
X  			break;
X  		acc %= i;
X  		goto a0;
X***************
X*** 503,512
X  		{
X  			errmsg(EWARN, "found \"%s\" after % (mod) in expression!", tchartos(ch));
X  			break;
X- 		}
X- #else !REPORTERRS
X- 			break;
X- #endif REPORTERRS
X  		acc %= i;
X  		goto a0;
X  	case '&':	/*and*/
X
X--- 381,386 -----
X  		i = ckph();
X  		if (nonumb)
X  			break;
X  		acc %= i;
X  		goto a0;
X  	case '&':	/*and*/
X***************
X*** 512,520
X  	case '&':	/*and*/
X  		i = ckph();
X  		if (nonumb)
X- #ifdef REPORTERRS
X- 		{
X- 			errmsg(EWARN, "found \"%s\" after & in expression!", tchartos(ch));
X  			break;
X  		}
X  #else !REPORTERRS
X
X--- 386,391 -----
X  	case '&':	/*and*/
X  		i = ckph();
X  		if (nonumb)
X  			break;
X  		if ((acc > 0) && (i > 0))
X  			acc = 1; 
X***************
X*** 516,525
X  		{
X  			errmsg(EWARN, "found \"%s\" after & in expression!", tchartos(ch));
X  			break;
X- 		}
X- #else !REPORTERRS
X- 			break;
X- #endif REPORTERRS
X  		if ((acc > 0) && (i > 0))
X  			acc = 1;
X  		else
X
X--- 387,392 -----
X  		i = ckph();
X  		if (nonumb)
X  			break;
X  		if ((acc > 0) && (i > 0))
X  			acc = 1; 
X  		else 
X***************
X*** 528,536
X  	case ':':	/*or*/
X  		i = ckph();
X  		if (nonumb)
X- #ifdef REPORTERRS
X- 		{
X- 			errmsg(EWARN, "found \"%s\" after : (logical or) in expression!", tchartos(ch));
X  			break;
X  		}
X  #else !REPORTERRS
X
X--- 395,400 -----
X  	case ':':	/*or*/
X  		i = ckph();
X  		if (nonumb)
X  			break;
X  		if ((acc > 0) || (i > 0))
X  			acc = 1; 
X***************
X*** 532,541
X  		{
X  			errmsg(EWARN, "found \"%s\" after : (logical or) in expression!", tchartos(ch));
X  			break;
X- 		}
X- #else !REPORTERRS
X- 			break;
X- #endif REPORTERRS
X  		if ((acc > 0) || (i > 0))
X  			acc = 1;
X  		else
X
X--- 396,401 -----
X  		i = ckph();
X  		if (nonumb)
X  			break;
X  		if ((acc > 0) || (i > 0))
X  			acc = 1; 
X  		else 
X***************
X*** 547,555
X  		i = ckph();
X  		if (nonumb) {
X  			acc = 0;
X- #ifdef REPORTERRS
X- 			errmsg(EWARN, "found \"%s\" after = in expression!", tchartos(ch));
X- #endif REPORTERRS
X  			break;
X  		}
X  		if (i == acc)
X
X--- 407,412 -----
X  		i = ckph();
X  		if (nonumb) {
X  			acc = 0; 
X  			break;
X  		}
X  		if (i == acc)
X***************
X*** 566,574
X  		i = ckph();
X  		if (nonumb) {
X  			acc = 0;
X- #ifdef REPORTERRS
X- 			errmsg(EWARN, "found \"%s\" after > in expression!", tchartos(ch));
X- #endif REPORTERRS
X  			break;
X  		}
X  		if (acc > (i - k))
X
X--- 423,428 -----
X  		i = ckph();
X  		if (nonumb) {
X  			acc = 0; 
X  			break;
X  		}
X  		if (acc > (i - k))
X***************
X*** 585,593
X  		i = ckph();
X  		if (nonumb) {
X  			acc = 0;
X- #ifdef REPORTERRS
X- 			errmsg(EWARN, "found \"%s\" after < in expression!", tchartos(ch));
X- #endif REPORTERRS
X  			break;
X  		}
X  		if (acc < (i + k))
X
X--- 439,444 -----
X  		i = ckph();
X  		if (nonumb) {
X  			acc = 0; 
X  			break;
X  		}
X  		if (acc < (i + k))
X***************
X*** 596,608
X  			acc = 0;
X  		goto a0;
X  	case ')':
X- #ifdef REPORTERRS
X- 		if (bracklevel) {
X- 			bracklevel--;
X- 		} else {
X- 			errmsg(EWARN, "too many ) in expression!");
X- 		}
X- #endif REPORTERRS
X  		break;
X  	case '(':
X  #ifdef REPORTERRS
X
X--- 447,452 -----
X  			acc = 0;
X  		goto a0;
X  	case ')': 
X  		break;
X  	case '(':
X  		acc = atoi0();
X***************
X*** 605,613
X  #endif REPORTERRS
X  		break;
X  	case '(':
X- #ifdef REPORTERRS
X- 		bracklevel++;
X- #endif REPORTERRS
X  		acc = atoi0();
X  		goto a0;
X  	}
X
X--- 449,454 -----
X  	case ')': 
X  		break;
X  	case '(':
X  		acc = atoi0();
X  		goto a0;
X  	}
X***************
X*** 623,631
X  	extern long	atoi1();
X  
X  	if (cbits(i = getch()) == '(')
X- #ifdef REPORTERRS
X- 	{
X- 		bracklevel++;
X  		j = atoi0();
X  	}
X  #else !REPORTERRS
X
X--- 464,469 -----
X  	extern long	atoi1();
X  
X  	if (cbits(i = getch()) == '(')
X  		j = atoi0();
X  	else {
X  		ch = i;
X***************
X*** 627,636
X  	{
X  		bracklevel++;
X  		j = atoi0();
X- 	}
X- #else !REPORTERRS
X- 		j = atoi0();
X- #endif REPORTERRS
X  	else {
X  		ch = i;
X  		j = atoi1();
X
X--- 465,470 -----
X  
X  	if (cbits(i = getch()) == '(')
X  		j = atoi0();
X  	else {
X  		ch = i;
X  		j = atoi1();
X***************
X*** 770,778
X  casenr()
X  {
X  	register i, j;
X- #ifdef REPORTERRS
X- 	tchar name;
X- #endif REPORTERRS
X  
X  	lgf++;
X  #ifdef REPORTERRS
X
X--- 604,609 -----
X  casenr()
X  {
X  	register i, j;
X  
X  	lgf++;
X  	skip();
X***************
X*** 775,799
X  #endif REPORTERRS
X  
X  	lgf++;
X- #ifdef REPORTERRS
X- 	if (skip()) {
X- 		errmsg(EWARN, ".nr request with no arguments ignored");
X- 		goto rtn;
X- 	}
X- 	if ((i = findr(name = getrq())) == -1)
X- 		goto rtn;
X- 		/* findr() allocates a new register & warns if there are none,
X- 		 * so no need to give an error here too.
X- 		 *
X- 		 * We save the name of the register for error messages
X- 		 *
X- 		 * -- req
X- 		 */
X- 	if (skip()) {
X- 		errmsg(EWARN, ".nr %s: missing expression!", realname(name));
X- 		goto rtn;
X- 	}
X- #else !REPORTERRS
X  	skip();
X  	if ((i = findr(getrq())) == -1)
X  		goto rtn;
X
X--- 606,611 -----
X  	register i, j;
X  
X  	lgf++;
X  	skip();
X  	if ((i = findr(getrq())) == -1)
X  		goto rtn;
X***************
X*** 798,807
X  	if ((i = findr(getrq())) == -1)
X  		goto rtn;
X  	skip();
X- #endif REPORTERRS
X- #ifdef COMMENT
X- 		/* should warn about read-only number registers here? */
X- #endif COMMENT
X  	j = inumb(&vlist[i]);
X  #ifdef REPORTERRS
X  	if (nonumb) {
X
X--- 610,615 -----
X  	if ((i = findr(getrq())) == -1)
X  		goto rtn;
X  	skip();
X  	j = inumb(&vlist[i]);
X  	if (nonumb)
X  		goto rtn;
X***************
X*** 803,824
X  		/* should warn about read-only number registers here? */
X  #endif COMMENT
X  	j = inumb(&vlist[i]);
X- #ifdef REPORTERRS
X- 	if (nonumb) {
X- 		/* ch can be set to 0 & then have font & size info ORed in,
X- 		 * so you can have NULLs in different fonts!!  This is why we
X- 		 * test cbits(ch) rather than ch itself.  -- req
X- 		 */
X- 		if (cbits(ch) && cbits(ch) != '\n') {
X- 			errmsg(EWARN,
X- ".nr %s: extra characters ignored from \"%s\"", realname(name), tchartos(ch));
X- 		} else {
X- 			errmsg(EWARN, ".nr %s %d ignored (error in expression?)",
X- 								realname(name), j);
X- 		}
X- 		goto rtn;
X- 	}
X- #else !REPORTERRS
X  	if (nonumb)
X  		goto rtn;
X  #endif REPORTERRS
X
X--- 611,616 -----
X  		goto rtn;
X  	skip();
X  	j = inumb(&vlist[i]);
X  	if (nonumb)
X  		goto rtn;
X  	vlist[i] = j;
X***************
X*** 821,827
X  #else !REPORTERRS
X  	if (nonumb)
X  		goto rtn;
X- #endif REPORTERRS
X  	vlist[i] = j;
X  #ifdef REPORTERRS
X  	if (!skip()) {
X
X--- 613,618 -----
X  	j = inumb(&vlist[i]);
X  	if (nonumb)
X  		goto rtn;
X  	vlist[i] = j;
X  	skip();
X  	j = atoi();
X***************
X*** 823,853
X  		goto rtn;
X  #endif REPORTERRS
X  	vlist[i] = j;
X- #ifdef REPORTERRS
X- 	if (!skip()) {
X- 		/* 3rd argument to .nr is auto-increment value (which may
X- 		 * be -ve, of course)
X- 		 */
X- 		int savrpterrs = reporterrs;
X- 		int n = j;
X- 
X- 		/* as arg is optional...  Otherwise a trailing TAB */
X- 		/* produces error messages! */
X- 		/* this might confuse people who use the reporterrs number
X- 		 * register as an increment, I suppose!
X- 		 */
X- 		reporterrs &= (~LERR_BADEXPSTART);
X- 
X- 		j = atoi();
X- 
X- 		reporterrs = savrpterrs;
X- 
X- 		if (nonumb && cbits(ch) == '\n') {
X- 				errmsg(EWARN,
X- 					".nr %s %d: non-numeric increment ignored", realname(name), n);
X- 		}
X- 	}
X- #else !REPORTERRS
X  	skip();
X  	j = atoi();
X  #endif REPORTERRS
X
X--- 614,619 -----
X  	if (nonumb)
X  		goto rtn;
X  	vlist[i] = j;
X  	skip();
X  	j = atoi();
X  	if (nonumb)
X***************
X*** 850,856
X  #else !REPORTERRS
X  	skip();
X  	j = atoi();
X! #endif REPORTERRS
X  	inc[i] = j;
X  rtn:
X  	return;
X
X--- 616,623 -----
X  	vlist[i] = j;
X  	skip();
X  	j = atoi();
X! 	if (nonumb)
X! 		goto rtn;
X  	inc[i] = j;
X  rtn:
X  	return;
X***************
X*** 863,880
X  	tchar j;
X  
X  	lgf++;
X- #ifdef REPORTERRS
X- 	if (skip()) {
X- 		errmsg(EWARN, ".af: called without arguments");
X- 		return;
X- 	} else if (!(i = getrq())) {
X- 		errmsg(EWARN, ".af: need a register name as 2nd argument");
X- 		return;
X- 	} else if (skip()) {
X- 		errmsg(EWARN, ".af: need 2 arguments (reg, format), found 1");
X- 		return;
X- 	}
X- #else !REPORTERRS
X  	if (skip() || !(i = getrq()) || skip())
X  		return;
X  #endif REPORTERRS
X
X--- 630,635 -----
X  	tchar j;
X  
X  	lgf++;
X  	if (skip() || !(i = getrq()) || skip())
X  		return;
X  	k = 0;
X***************
X*** 877,883
X  #else !REPORTERRS
X  	if (skip() || !(i = getrq()) || skip())
X  		return;
X- #endif REPORTERRS
X  	k = 0;
X  	j = getch();
X  	if (!isalpha(cbits(j))) {
X
X--- 632,637 -----
X  	lgf++;
X  	if (skip() || !(i = getrq()) || skip())
X  		return;
X  	k = 0;
X  	j = getch();
X  	if (!isalpha(cbits(j))) {
X***************
X*** 888,899
X  	if (!k)
X  		k = j;
X  	fmt[findr(i)] = k & BMASK;
X- #ifdef COMMENT
X- 	/* note that (1) findr could return -1 if i == 0, so we check it
X- 	 * 	     (2) we allocate a new number register if necessary
X- 	 * - req
X- 	 */
X- #endif COMMENT
X  }
X  
X  setaf()	/* return format of number register */
X
X--- 642,647 -----
X  	if (!k)
X  		k = j;
X  	fmt[findr(i)] = k & BMASK;
X  }
X  
X  setaf()	/* return format of number register */
X***************
X*** 970,981
X  		neg++;
X  		n = -n;
X  	}
X- #ifdef REPORTERRS
X- 	if (m == 0) {
X- 		errmsg(EWARN, "Internal Error: m == 0 in quant()");
X- 		m = 1;	/* guess... */
X- 	}
X- #endif REPORTERRS
X  	/* better as i = ((n + (m/2))/m)*m */
X  	i = n / m;
X  	if ((n - m * i) > (m / 2))
X
X--- 718,723 -----
X  		neg++;
X  		n = -n;
X  	}
X  	/* better as i = ((n + (m/2))/m)*m */
X  	i = n / m;
X  	if ((n - m * i) > (m / 2))
X***************
X*** 985,987
X  		i = -i;
X  	return(i);
X  }
X
X--- 727,731 -----
X  		i = -i;
X  	return(i);
X  }
X+ 
X+ 
SHAR_EOF
if test 42764 -ne "`wc -c < 'diffb'`"
then
	echo shar: error transmitting "'diffb'" '(should have been 42764 characters)'
fi
fi # end of overwriting check
#	End of shell archive
exit 0
-- 
ARPA		req%uu.warwick.ac.uk at ucl-cs.arpa
EARN/BITNET	req%UK.AC.WARWICK.UU at AC.UK
JANET		req at uk.ac.warwick.uu
UUCP		seismo!mcvax!ukc!warwick!req  (req at warwick.UUCP)
PHONE		+44 203 523485
For mail.frplist, use "frplist" instead of "req" in the above lines.
The BITNET path only works from sites that have AC.UK in their tables.  Sorry.



More information about the Comp.sources.unix mailing list