glenn@extro.ucc.su.oz.au (G Geers) (02/16/90)
Well here it is. The next 14 postings contain the source of the much wanted TeX. This should run unmodified on Xenix/386 2.2 and up. It won't run on an 80286. I tried but with no success. However, if someone in netland figures this out please tell me how and I will be eternally grateful. The files are distributed as shars of less than 45 k to avoid some mailers grokking on files larger than 50 k. Share and Enjoy, Glenn
glenn@extro.ucc.su.oz.au (G Geers) (02/16/90)
---- Cut Here and unpack ---- #!/bin/sh # shar: Shell Archiver (v1.22) # # This is part 1 of a multipart archive # do not concatenate these parts, unpack them in order with /bin/sh # # Run the following text with /bin/sh to create: # BIG.shr1 # BIGG.shr1 # CONTENTS.tex # COPYING # JOY # Makefile # README # SMALL.shr1 # align.c # align.h # arith.c # arith.h # box.c # box.h # boxlists.c # boxlists.h # char.c # char.h # cmds.c # cmds.h # cond.c # cond.h # ctexbugs # def.c # def.h # dvi.c # dvi.h # eq.c # eq.h # eqstack.c # eqstack.h # error.c # error.h # eval.c # eval.h # evalstack.c # evalstack.h # expand.c # expand.h # file.c # file.h # fmt.c # fmt.h # hash.c # hash.h # heap.c # heap.h # hyph.c # hyph.h # io.c # io.h # math.c # math.h # mathlists.c # mathlists.h # mklog # mlist-hlist.c # mlist-hlist.h # pack.c # pack.h # page.c # page.h # par.c # par.h # print.c # print.h # scan.c # scan.h # setenv.sh # str.c # str.h # tex.1 # tex.c # tex.h # texext.c # texext.h # tfm.c # tfm.h # tfms.c # token.c # token.h # tokenlists.c # tokenlists.h # tokenstack.c # tokenstack.h # if test -r s2_seq_.tmp then echo "Must unpack archives in sequence!" next=`cat s2_seq_.tmp`; echo "Please unpack part $next next" exit 1; fi echo "x - extracting BIG.shr1 (Text)" sed 's/^X//' << 'SHAR_EOF' > BIG.shr1 && X#!/bin/sh X# to extract, remove the header and type "sh filename" Xif `test ! -d ./BIG` Xthen X mkdir ./BIG X echo "mkdir ./BIG" Xfi Xif `test ! -d ./BIG/INIT` Xthen X mkdir ./BIG/INIT X echo "mkdir ./BIG/INIT" Xfi Xif `test ! -s ./BIG/INIT/Makefile` Xthen Xecho "writing ./BIG/INIT/Makefile" Xcat > ./BIG/INIT/Makefile << '\Rogue\Monster\' X# X# Pehong Chen, University of California, Berkeley (phc@renoir.berkeley.edu) X# X# modified for distribution, monardo@renoir.berkeley.edu X# X XVPATH = .. X XDEST = /usr/local X XMANDIR = /usr/man/manl X XMANUAL = X XHDRS = align.h \ X arith.h \ X box.h \ X boxlists.h \ X char.h \ X cmds.h \ X cond.h \ X def.h \ X dvi.h \ X eq.h \ X eqstack.h \ X error.h \ X eval.h \ X evalstack.h \ X expand.h \ X file.h \ X fmt.h \ X hash.h \ X heap.h \ X hyph.h \ X io.h \ X math.h \ X mathlists.h \ X mlist-hlist.h \ X pack.h \ X page.h \ X par.h \ X print.h \ X scan.h \ X str.h \ X tex.h \ X texext.h \ X tfm.h \ X token.h \ X tokenlists.h \ X tokenstack.h X X# Option for compiling SUN 68010 code with a 68020 CPU X68010CFLAGS = -m68010 -L/usr.MC68010/lib -Qpath /usr.MC68010/cstart X X# 16-bit word X#CFLAGS = -O -DINIT X#CFLAGS = -O -DINIT $(68010CFLAGS) X X# 32-bit word XCFLAGS = -O -DINIT -DBIG X#CFLAGS = -O -DINIT -DBIG $(68010CFLAGS) X X# 64-bit word X#CFLAGS = -O -DINIT -DBIGG X#CFLAGS = -O -DINIT -DBIGG $(68010CFLAGS) X XLDFLAGS = $(CFLAGS) X XLIBS = X XLINKER = cc X XMAKEFILE = Makefile X XOBJS = align.o \ X arith.o \ X box.o \ X boxlists.o \ X char.o \ X cmds.o \ X cond.o \ X def.o \ X dvi.o \ X eq.o \ X eqstack.o \ X error.o \ X eval.o \ X evalstack.o \ X expand.o \ X file.o \ X fmt.o \ X hash.o \ X heap.o \ X hyph.o \ X io.o \ X math.o \ X mathlists.o \ X mlist-hlist.o \ X pack.o \ X page.o \ X par.o \ X print.o \ X scan.o \ X str.o \ X tex.o \ X texext.o \ X tfm.o \ X token.o \ X tokenlists.o \ X tokenstack.o X XPRINT = tgrind -c X XPROGRAM = initex X XSRCS = align.c \ X arith.c \ X box.c \ X boxlists.c \ X char.c \ X cmds.c \ X cond.c \ X def.c \ X dvi.c \ X eq.c \ X eqstack.c \ X error.c \ X eval.c \ X evalstack.c \ X expand.c \ X file.c \ X fmt.c \ X hash.c \ X heap.c \ X hyph.c \ X io.c \ X math.c \ X mathlists.c \ X mlist-hlist.c \ X pack.c \ X page.c \ X par.c \ X print.c \ X scan.c \ X str.c \ X tex.c \ X texext.c \ X tfm.c \ X token.c \ X tokenlists.c \ X tokenstack.c X X$(PROGRAM): $(OBJS) X @rm -f $(PROGRAM) X $(LINKER) $(LDFLAGS) $(OBJS) $(LIBS) -o $(PROGRAM) X @size $(PROGRAM) X Xinstall: $(PROGRAM) X install -c -s -m 0755 $(PROGRAM) $(DEST) X @ls -lgs $(DEST)/$(PROGRAM) X Xclean:; @rm -f $(OBJS) core $(PROGRAM) *.out X Xdepend:; @rm -f .#*.[chly] X mkmf -f $(MAKEFILE) PROGRAM=$(PROGRAM) DEST=$(DEST) X Xindex:; @ctags -wx $(HDRS) $(SRCS) X Xprint:; @$(PRINT) $(HDRS) $(SRCS) X Xprogram: $(PROGRAM) X Xtags: $(HDRS) $(SRCS); @ctags $(HDRS) $(SRCS) X Xupdate: $(DEST)/$(PROGRAM) X X$(DEST)/$(PROGRAM): $(SRCS) $(HDRS) X @make -f $(MAKEFILE) DEST=$(DEST) install X X.DEFAULT:; X### Xalign.o: tex.h cmds.h heap.h arith.h eq.h eqstack.h hash.h \ X token.h tokenstack.h scan.h evalstack.h box.h pack.h math.h \ X mlist-hlist.h error.h align.h Xarith.o: tex.h print.h arith.h Xbox.o: tex.h texext.h arith.h heap.h char.h str.h \ X eq.h hash.h tfm.h print.h math.h box.h tokenlists.h Xboxlists.o: tex.h cmds.h heap.h eq.h eqstack.h def.h box.h \ X tokenstack.h token.h scan.h tokenlists.h evalstack.h tfm.h pack.h \ X page.h math.h io.h print.h error.h boxlists.h Xchar.o: tex.h char.h Xcmds.o: tex.h texext.h heap.h eq.h eqstack.h str.h \ X hash.h token.h tokenlists.h tokenstack.h scan.h evalstack.h def.h \ X cond.h expand.h box.h boxlists.h tfm.h math.h mathlists.h align.h \ X error.h print.h cmds.h Xcond.o: tex.h cmds.h heap.h box.h eq.h eqstack.h hash.h \ X token.h tokenlists.h scan.h tokenstack.h evalstack.h file.h print.h \ X error.h cond.h Xdef.o: tex.h cmds.h heap.h io.h eq.h hash.h eqstack.h \ X evalstack.h token.h scan.h tokenstack.h expand.h arith.h str.h \ X box.h boxlists.h tokenlists.h file.h tfm.h dvi.h page.h print.h \ X error.h def.h Xdvi.o: tex.h texext.h heap.h str.h io.h eq.h box.h \ X scan.h tfm.h file.h pack.h print.h error.h dvi.h Xeq.o: tex.h cmds.h heap.h char.h hash.h box.h print.h \ X error.h eq.h Xeqstack.o: tex.h cmds.h heap.h eq.h token.h tokenstack.h \ X tokenlists.h print.h error.h eqstack.h Xerror.o: tex.h tokenstack.h token.h eq.h io.h print.h \ X error.h str.h Xeval.o: tex.h cmds.h heap.h char.h tfm.h eq.h eqstack.h \ X hash.h token.h scan.h tokenstack.h evalstack.h box.h boxlists.h \ X math.h mathlists.h cond.h def.h dvi.h pack.h page.h par.h print.h \ X error.h eval.h Xevalstack.o: tex.h cmds.h heap.h tokenstack.h eq.h box.h \ X page.h print.h error.h evalstack.h Xexpand.o: tex.h cmds.h heap.h io.h eq.h hash.h box.h \ X tokenstack.h scan.h token.h tokenlists.h cond.h file.h print.h \ X error.h expand.h Xfile.o: tex.h cmds.h heap.h char.h eq.h token.h scan.h \ X tokenstack.h str.h fmt.h io.h print.h error.h file.h Xfmt.o: tex.h texext.h heap.h token.h eq.h box.h \ X eqstack.h hash.h file.h tfm.h str.h hyph.h io.h print.h error.h \ X fmt.h Xhash.o: tex.h cmds.h heap.h box.h scan.h eq.h io.h math.h \ X boxlists.h str.h error.h hash.h Xheap.o: tex.h eq.h arith.h box.h token.h tokenlists.h \ X evalstack.h par.h page.h print.h error.h heap.h Xhyph.o: tex.h cmds.h heap.h token.h eq.h str.h tfm.h \ X box.h scan.h tokenstack.h par.h print.h error.h hyph.h Xio.o: tex.h char.h tokenstack.h print.h io.h Xmath.o: tex.h heap.h eq.h scan.h evalstack.h arith.h \ X str.h box.h tfm.h print.h pack.h math.h Xmathlists.o: tex.h cmds.h heap.h arith.h eq.h eqstack.h \ X evalstack.h token.h tokenstack.h scan.h tfm.h box.h pack.h math.h \ X mlist-hlist.h par.h page.h print.h error.h mathlists.h Xmlist-hlist.o: tex.h heap.h arith.h scan.h eq.h box.h math.h \ X pack.h tfm.h print.h error.h mlist-hlist.h Xpack.o: tex.h heap.h arith.h scan.h tokenstack.h eq.h \ X eqstack.h evalstack.h box.h tfm.h dvi.h print.h error.h pack.h Xpage.o: tex.h heap.h arith.h tokenstack.h tokenlists.h \ X eq.h eqstack.h evalstack.h scan.h expand.h box.h pack.h par.h math.h \ X dvi.h print.h error.h page.h Xpar.o: tex.h heap.h arith.h eq.h tfm.h tokenstack.h \ X evalstack.h box.h pack.h hyph.h print.h error.h par.h Xprint.o: tex.h texext.h eq.h char.h str.h io.h print.h Xscan.o: tex.h cmds.h heap.h arith.h eq.h token.h \ X tokenstack.h evalstack.h char.h str.h box.h expand.h tfm.h dvi.h \ X print.h error.h page.h scan.h Xstr.o: tex.h io.h file.h error.h str.h Xtex.o: tex.h texext.h cmds.h heap.h char.h str.h eq.h \ X hash.h evalstack.h eqstack.h tokenstack.h token.h box.h pack.h cond.h \ X io.h file.h tfm.h hyph.h dvi.h fmt.h error.h print.h page.h Xtexext.o: tex.h cmds.h heap.h eq.h hash.h token.h box.h \ X scan.h def.h tokenstack.h tokenlists.h evalstack.h io.h str.h \ X file.h dvi.h print.h error.h texext.h Xtfm.o: tex.h cmds.h heap.h arith.h eq.h hash.h box.h \ X scan.h token.h tokenstack.h io.h file.h print.h error.h tfm.h Xtoken.o: tex.h cmds.h heap.h eq.h hash.h scan.h io.h \ X char.h box.h cond.h print.h error.h expand.h align.h tokenstack.h \ X token.h Xtokenlists.o: tex.h cmds.h heap.h eq.h hash.h str.h box.h \ X token.h expand.h tokenstack.h io.h scan.h def.h file.h tfm.h print.h \ X error.h tokenlists.h Xtokenstack.o: tex.h cmds.h heap.h eq.h def.h char.h io.h \ X token.h tokenlists.h box.h print.h error.h tokenstack.h X\Rogue\Monster\ Xelse X echo "will not over write ./BIG/INIT/Makefile" Xfi Xif `test ! -d ./BIG/VIR` Xthen X mkdir ./BIG/VIR X echo "mkdir ./BIG/VIR" Xfi Xif `test ! -s ./BIG/VIR/Makefile` Xthen Xecho "writing ./BIG/VIR/Makefile" Xcat > ./BIG/VIR/Makefile << '\Rogue\Monster\' X# X# Pehong Chen, University of California, Berkeley (phc@renoir.berkeley.edu) X# X# modified for distribution, monardo@renoir.berkeley.edu X# X XVPATH = .. X XDEST = /usr/local X XMANDIR = /usr/man/manl X XMANUAL = X XHDRS = align.h \ X arith.h \ X box.h \ X boxlists.h \ X char.h \ X cmds.h \ X cond.h \ X def.h \ X dvi.h \ X eq.h \ X eqstack.h \ X error.h \ X eval.h \ X evalstack.h \ X expand.h \ X file.h \ X fmt.h \ X hash.h \ X heap.h \ X hyph.h \ X io.h \ X math.h \ X mathlists.h \ X mlist-hlist.h \ X pack.h \ X page.h \ X par.h \ X print.h \ X scan.h \ X str.h \ X tex.h \ X texext.h \ X tfm.h \ X token.h \ X tokenlists.h \ X tokenstack.h X X# Option for compiling SUN 68010 code with a 68020 CPU X68010CFLAGS = -m68010 -L/usr.MC68010/lib -Qpath /usr.MC68010/cstart X X# 16-bit word X#CFLAGS = -O X#CFLAGS = -O $(68010CFLAGS) X X# 32-bit word XCFLAGS = -O -DBIG X#CFLAGS = -O -DBIG $(68010CFLAGS) X X# 64-bit word X#CFLAGS = -O -DBIGG X#CFLAGS = -O -DBIGG $(68010CFLAGS) X XLDFLAGS = $(CFLAGS) X XLIBS = X XLINKER = cc X XMAKEFILE = Makefile X XOBJS = align.o \ X arith.o \ X box.o \ X boxlists.o \ X char.o \ X cmds.o \ X cond.o \ X def.o \ X dvi.o \ X eq.o \ X eqstack.o \ X error.o \ X eval.o \ X evalstack.o \ X expand.o \ X file.o \ X fmt.o \ X hash.o \ X heap.o \ X hyph.o \ X io.o \ X math.o \ X mathlists.o \ X mlist-hlist.o \ X pack.o \ X page.o \ X par.o \ X print.o \ X scan.o \ X str.o \ X tex.o \ X texext.o \ X tfm.o \ X token.o \ X tokenlists.o \ X tokenstack.o X XPRINT = tgrind -c X XPROGRAM = virtex X XSRCS = align.c \ X arith.c \ X box.c \ X boxlists.c \ X char.c \ X cmds.c \ X cond.c \ X def.c \ X dvi.c \ X eq.c \ X eqstack.c \ X error.c \ X eval.c \ X evalstack.c \ X expand.c \ X file.c \ X fmt.c \ X hash.c \ X heap.c \ X hyph.c \ X io.c \ X math.c \ X mathlists.c \ X mlist-hlist.c \ X pack.c \ X page.c \ X par.c \ X print.c \ X scan.c \ X str.c \ X tex.c \ X texext.c \ X tfm.c \ X token.c \ X tokenlists.c \ X tokenstack.c X X$(PROGRAM): $(OBJS) X @rm -f $(PROGRAM) X $(LINKER) $(LDFLAGS) $(OBJS) $(LIBS) -o $(PROGRAM) X @size $(PROGRAM) X Xinstall: $(PROGRAM) X install -c -s -m 0755 $(PROGRAM) $(DEST) X @ls -lgs $(DEST)/$(PROGRAM) X Xclean:; @rm -f $(OBJS) core $(PROGRAM) *.out X Xdepend:; @rm -f .#*.[chly] X mkmf -f $(MAKEFILE) PROGRAM=$(PROGRAM) DEST=$(DEST) X Xindex:; @ctags -wx $(HDRS) $(SRCS) X Xprint:; @$(PRINT) $(HDRS) $(SRCS) X Xprogram: $(PROGRAM) X Xtags: $(HDRS) $(SRCS); @ctags $(HDRS) $(SRCS) X Xupdate: $(DEST)/$(PROGRAM) X X$(DEST)/$(PROGRAM): $(SRCS) $(HDRS) X @make -f $(MAKEFILE) DEST=$(DEST) install X X.DEFAULT:; X### Xalign.o: tex.h cmds.h heap.h arith.h eq.h eqstack.h hash.h \ X token.h tokenstack.h scan.h evalstack.h box.h pack.h math.h \ X mlist-hlist.h error.h align.h Xarith.o: tex.h print.h arith.h Xbox.o: tex.h texext.h arith.h heap.h char.h str.h \ X eq.h hash.h tfm.h print.h math.h box.h tokenlists.h Xboxlists.o: tex.h cmds.h heap.h eq.h eqstack.h def.h box.h \ X tokenstack.h token.h scan.h tokenlists.h evalstack.h tfm.h pack.h \ X page.h math.h io.h print.h error.h boxlists.h Xchar.o: tex.h char.h Xcmds.o: tex.h texext.h heap.h eq.h eqstack.h str.h \ X hash.h token.h tokenlists.h tokenstack.h scan.h evalstack.h def.h \ X cond.h expand.h box.h boxlists.h tfm.h math.h mathlists.h align.h \ X error.h print.h cmds.h Xcond.o: tex.h cmds.h heap.h box.h eq.h eqstack.h hash.h \ X token.h tokenlists.h scan.h tokenstack.h evalstack.h file.h print.h \ X error.h cond.h Xdef.o: tex.h cmds.h heap.h io.h eq.h hash.h eqstack.h \ X evalstack.h token.h scan.h tokenstack.h expand.h arith.h str.h \ X box.h boxlists.h tokenlists.h file.h tfm.h dvi.h page.h print.h \ X error.h def.h Xdvi.o: tex.h texext.h heap.h str.h io.h eq.h box.h \ X scan.h tfm.h file.h pack.h print.h error.h dvi.h Xeq.o: tex.h cmds.h heap.h char.h hash.h box.h print.h \ X error.h eq.h Xeqstack.o: tex.h cmds.h heap.h eq.h token.h tokenstack.h \ X tokenlists.h print.h error.h eqstack.h Xerror.o: tex.h tokenstack.h token.h eq.h io.h print.h \ X error.h str.h Xeval.o: tex.h cmds.h heap.h char.h tfm.h eq.h eqstack.h \ X hash.h token.h scan.h tokenstack.h evalstack.h box.h boxlists.h \ X math.h mathlists.h cond.h def.h dvi.h pack.h page.h par.h print.h \ X error.h eval.h Xevalstack.o: tex.h cmds.h heap.h tokenstack.h eq.h box.h \ X page.h print.h error.h evalstack.h Xexpand.o: tex.h cmds.h heap.h io.h eq.h hash.h box.h \ X tokenstack.h scan.h token.h tokenlists.h cond.h file.h print.h \ X error.h expand.h Xfile.o: tex.h cmds.h heap.h char.h eq.h token.h scan.h \ X tokenstack.h str.h fmt.h io.h print.h error.h file.h Xfmt.o: tex.h texext.h heap.h token.h eq.h box.h \ X eqstack.h hash.h file.h tfm.h str.h hyph.h io.h print.h error.h \ X fmt.h Xhash.o: tex.h cmds.h heap.h box.h scan.h eq.h io.h math.h \ X boxlists.h str.h error.h hash.h Xheap.o: tex.h eq.h arith.h box.h token.h tokenlists.h \ X evalstack.h par.h page.h print.h error.h heap.h Xhyph.o: tex.h cmds.h heap.h token.h eq.h str.h tfm.h \ X box.h scan.h tokenstack.h par.h print.h error.h hyph.h Xio.o: tex.h char.h tokenstack.h print.h io.h Xmath.o: tex.h heap.h eq.h scan.h evalstack.h arith.h \ X str.h box.h tfm.h print.h pack.h math.h Xmathlists.o: tex.h cmds.h heap.h arith.h eq.h eqstack.h \ X evalstack.h token.h tokenstack.h scan.h tfm.h box.h pack.h math.h \ X mlist-hlist.h par.h page.h print.h error.h mathlists.h Xmlist-hlist.o: tex.h heap.h arith.h scan.h eq.h box.h math.h \ X pack.h tfm.h print.h error.h mlist-hlist.h Xpack.o: tex.h heap.h arith.h scan.h tokenstack.h eq.h \ X eqstack.h evalstack.h box.h tfm.h dvi.h print.h error.h pack.h Xpage.o: tex.h heap.h arith.h tokenstack.h tokenlists.h \ X eq.h eqstack.h evalstack.h scan.h expand.h box.h pack.h par.h math.h \ X dvi.h print.h error.h page.h Xpar.o: tex.h heap.h arith.h eq.h tfm.h tokenstack.h \ X evalstack.h box.h pack.h hyph.h print.h error.h par.h Xprint.o: tex.h texext.h eq.h char.h str.h io.h print.h Xscan.o: tex.h cmds.h heap.h arith.h eq.h token.h \ X tokenstack.h evalstack.h char.h str.h box.h expand.h tfm.h dvi.h \ X print.h error.h page.h scan.h Xstr.o: tex.h io.h file.h error.h str.h Xtex.o: tex.h texext.h cmds.h heap.h char.h str.h eq.h \ X hash.h evalstack.h eqstack.h tokenstack.h token.h box.h pack.h cond.h \ X io.h file.h tfm.h hyph.h dvi.h fmt.h error.h print.h page.h Xtexext.o: tex.h cmds.h heap.h eq.h hash.h token.h box.h \ X scan.h def.h tokenstack.h tokenlists.h evalstack.h io.h str.h \ X file.h dvi.h print.h error.h texext.h Xtfm.o: tex.h cmds.h heap.h arith.h eq.h hash.h box.h \ X scan.h token.h tokenstack.h io.h file.h print.h error.h tfm.h Xtoken.o: tex.h cmds.h heap.h eq.h hash.h scan.h io.h \ X char.h box.h cond.h print.h error.h expand.h align.h tokenstack.h \ X token.h Xtokenlists.o: tex.h cmds.h heap.h eq.h hash.h str.h box.h \ X token.h expand.h tokenstack.h io.h scan.h def.h file.h tfm.h print.h \ X error.h tokenlists.h Xtokenstack.o: tex.h cmds.h heap.h eq.h def.h char.h io.h \ X token.h tokenlists.h box.h print.h error.h tokenstack.h X\Rogue\Monster\ Xelse X echo "will not over write ./BIG/VIR/Makefile" Xfi Xecho "Finished archive 1 of 1" Xexit SHAR_EOF chmod 0444 BIG.shr1 || echo "restore of BIG.shr1 fails" set `wc -c BIG.shr1`;Sum=$1 if test "$Sum" != "14734" then echo original size 14734, current size $Sum;fi echo "x - extracting BIGG.shr1 (Text)" sed 's/^X//' << 'SHAR_EOF' > BIGG.shr1 && X#!/bin/sh X# to extract, remove the header and type "sh filename" Xif `test ! -d ./BIGG` Xthen X mkdir ./BIGG X echo "mkdir ./BIGG" Xfi Xif `test ! -d ./BIGG/INIT` Xthen X mkdir ./BIGG/INIT X echo "mkdir ./BIGG/INIT" Xfi Xif `test ! -s ./BIGG/INIT/Makefile` Xthen Xecho "writing ./BIGG/INIT/Makefile" Xcat > ./BIGG/INIT/Makefile << '\Rogue\Monster\' X# X# Pehong Chen, University of California, Berkeley (phc@renoir.berkeley.edu) X# X# modified for distribution, monardo@renoir.berkeley.edu X# X XVPATH = .. X XDEST = /usr/local X XMANDIR = /usr/man/manl X XMANUAL = X XHDRS = align.h \ X arith.h \ X box.h \ X boxlists.h \ X char.h \ X cmds.h \ X cond.h \ X def.h \ X dvi.h \ X eq.h \ X eqstack.h \ X error.h \ X eval.h \ X evalstack.h \ X expand.h \ X file.h \ X fmt.h \ X hash.h \ X heap.h \ X hyph.h \ X io.h \ X math.h \ X mathlists.h \ X mlist-hlist.h \ X pack.h \ X page.h \ X par.h \ X print.h \ X scan.h \ X str.h \ X tex.h \ X texext.h \ X tfm.h \ X token.h \ X tokenlists.h \ X tokenstack.h X X# Option for compiling SUN 68010 code with a 68020 CPU X68010CFLAGS = -m68010 -L/usr.MC68010/lib -Qpath /usr.MC68010/cstart X X# 16-bit word X#CFLAGS = -O -DINIT X#CFLAGS = -O -DINIT $(68010CFLAGS) X X# 32-bit word X#CFLAGS = -O -DINIT -DBIG X#CFLAGS = -O -DINIT -DBIG $(68010CFLAGS) X X# 64-bit word XCFLAGS = -O -DINIT -DBIGG X#CFLAGS = -O -DINIT -DBIGG $(68010CFLAGS) X XLDFLAGS = $(CFLAGS) X XLIBS = X XLINKER = cc X XMAKEFILE = Makefile X XOBJS = align.o \ X arith.o \ X box.o \ X boxlists.o \ X char.o \ X cmds.o \ X cond.o \ X def.o \ X dvi.o \ X eq.o \ X eqstack.o \ X error.o \ X eval.o \ X evalstack.o \ X expand.o \ X file.o \ X fmt.o \ X hash.o \ X heap.o \ X hyph.o \ X io.o \ X math.o \ X mathlists.o \ X mlist-hlist.o \ X pack.o \ X page.o \ X par.o \ X print.o \ X scan.o \ X str.o \ X tex.o \ X texext.o \ X tfm.o \ X token.o \ X tokenlists.o \ X tokenstack.o X XPRINT = tgrind -c X XPROGRAM = initex X XSRCS = align.c \ X arith.c \ X box.c \ X boxlists.c \ X char.c \ X cmds.c \ X cond.c \ X def.c \ X dvi.c \ X eq.c \ X eqstack.c \ X error.c \ X eval.c \ X evalstack.c \ X expand.c \ X file.c \ X fmt.c \ X hash.c \ X heap.c \ X hyph.c \ X io.c \ X math.c \ X mathlists.c \ X mlist-hlist.c \ X pack.c \ X page.c \ X par.c \ X print.c \ X scan.c \ X str.c \ X tex.c \ X texext.c \ X tfm.c \ X token.c \ X tokenlists.c \ X tokenstack.c X X$(PROGRAM): $(OBJS) X @rm -f $(PROGRAM) X $(LINKER) $(LDFLAGS) $(OBJS) $(LIBS) -o $(PROGRAM) X @size $(PROGRAM) X Xinstall: $(PROGRAM) X install -c -s -m 0755 $(PROGRAM) $(DEST) X @ls -lgs $(DEST)/$(PROGRAM) X Xclean:; @rm -f $(OBJS) core $(PROGRAM) *.out X Xdepend:; @rm -f .#*.[chly] X mkmf -f $(MAKEFILE) PROGRAM=$(PROGRAM) DEST=$(DEST) X Xindex:; @ctags -wx $(HDRS) $(SRCS) X Xprint:; @$(PRINT) $(HDRS) $(SRCS) X Xprogram: $(PROGRAM) X Xtags: $(HDRS) $(SRCS); @ctags $(HDRS) $(SRCS) X Xupdate: $(DEST)/$(PROGRAM) X X$(DEST)/$(PROGRAM): $(SRCS) $(HDRS) X @make -f $(MAKEFILE) DEST=$(DEST) install X X.DEFAULT:; X### Xalign.o: tex.h cmds.h heap.h arith.h eq.h eqstack.h hash.h \ X token.h tokenstack.h scan.h evalstack.h box.h pack.h math.h \ X mlist-hlist.h error.h align.h Xarith.o: tex.h print.h arith.h Xbox.o: tex.h texext.h arith.h heap.h char.h str.h \ X eq.h hash.h tfm.h print.h math.h box.h tokenlists.h Xboxlists.o: tex.h cmds.h heap.h eq.h eqstack.h def.h box.h \ X tokenstack.h token.h scan.h tokenlists.h evalstack.h tfm.h pack.h \ X page.h math.h io.h print.h error.h boxlists.h Xchar.o: tex.h char.h Xcmds.o: tex.h texext.h heap.h eq.h eqstack.h str.h \ X hash.h token.h tokenlists.h tokenstack.h scan.h evalstack.h def.h \ X cond.h expand.h box.h boxlists.h tfm.h math.h mathlists.h align.h \ X error.h print.h cmds.h Xcond.o: tex.h cmds.h heap.h box.h eq.h eqstack.h hash.h \ X token.h tokenlists.h scan.h tokenstack.h evalstack.h file.h print.h \ X error.h cond.h Xdef.o: tex.h cmds.h heap.h io.h eq.h hash.h eqstack.h \ X evalstack.h token.h scan.h tokenstack.h expand.h arith.h str.h \ X box.h boxlists.h tokenlists.h file.h tfm.h dvi.h page.h print.h \ X error.h def.h Xdvi.o: tex.h texext.h heap.h str.h io.h eq.h box.h \ X scan.h tfm.h file.h pack.h print.h error.h dvi.h Xeq.o: tex.h cmds.h heap.h char.h hash.h box.h print.h \ X error.h eq.h Xeqstack.o: tex.h cmds.h heap.h eq.h token.h tokenstack.h \ X tokenlists.h print.h error.h eqstack.h Xerror.o: tex.h tokenstack.h token.h eq.h io.h print.h \ X error.h str.h Xeval.o: tex.h cmds.h heap.h char.h tfm.h eq.h eqstack.h \ X hash.h token.h scan.h tokenstack.h evalstack.h box.h boxlists.h \ X math.h mathlists.h cond.h def.h dvi.h pack.h page.h par.h print.h \ X error.h eval.h Xevalstack.o: tex.h cmds.h heap.h tokenstack.h eq.h box.h \ X page.h print.h error.h evalstack.h Xexpand.o: tex.h cmds.h heap.h io.h eq.h hash.h box.h \ X tokenstack.h scan.h token.h tokenlists.h cond.h file.h print.h \ X error.h expand.h Xfile.o: tex.h cmds.h heap.h char.h eq.h token.h scan.h \ X tokenstack.h str.h fmt.h io.h print.h error.h file.h Xfmt.o: tex.h texext.h heap.h token.h eq.h box.h \ X eqstack.h hash.h file.h tfm.h str.h hyph.h io.h print.h error.h \ X fmt.h Xhash.o: tex.h cmds.h heap.h box.h scan.h eq.h io.h math.h \ X boxlists.h str.h error.h hash.h Xheap.o: tex.h eq.h arith.h box.h token.h tokenlists.h \ X evalstack.h par.h page.h print.h error.h heap.h Xhyph.o: tex.h cmds.h heap.h token.h eq.h str.h tfm.h \ X box.h scan.h tokenstack.h par.h print.h error.h hyph.h Xio.o: tex.h char.h tokenstack.h print.h io.h Xmath.o: tex.h heap.h eq.h scan.h evalstack.h arith.h \ X str.h box.h tfm.h print.h pack.h math.h Xmathlists.o: tex.h cmds.h heap.h arith.h eq.h eqstack.h \ X evalstack.h token.h tokenstack.h scan.h tfm.h box.h pack.h math.h \ X mlist-hlist.h par.h page.h print.h error.h mathlists.h Xmlist-hlist.o: tex.h heap.h arith.h scan.h eq.h box.h math.h \ X pack.h tfm.h print.h error.h mlist-hlist.h Xpack.o: tex.h heap.h arith.h scan.h tokenstack.h eq.h \ X eqstack.h evalstack.h box.h tfm.h dvi.h print.h error.h pack.h Xpage.o: tex.h heap.h arith.h tokenstack.h tokenlists.h \ X eq.h eqstack.h evalstack.h scan.h expand.h box.h pack.h par.h math.h \ X dvi.h print.h error.h page.h Xpar.o: tex.h heap.h arith.h eq.h tfm.h tokenstack.h \ X evalstack.h box.h pack.h hyph.h print.h error.h par.h Xprint.o: tex.h texext.h eq.h char.h str.h io.h print.h Xscan.o: tex.h cmds.h heap.h arith.h eq.h token.h \ X tokenstack.h evalstack.h char.h str.h box.h expand.h tfm.h dvi.h \ X print.h error.h page.h scan.h Xstr.o: tex.h io.h file.h error.h str.h Xtex.o: tex.h texext.h cmds.h heap.h char.h str.h eq.h \ X hash.h evalstack.h eqstack.h tokenstack.h token.h box.h pack.h cond.h \ X io.h file.h tfm.h hyph.h dvi.h fmt.h error.h print.h page.h Xtexext.o: tex.h cmds.h heap.h eq.h hash.h token.h box.h \ X scan.h def.h tokenstack.h tokenlists.h evalstack.h io.h str.h \ X file.h dvi.h print.h error.h texext.h Xtfm.o: tex.h cmds.h heap.h arith.h eq.h hash.h box.h \ X scan.h token.h tokenstack.h io.h file.h print.h error.h tfm.h Xtoken.o: tex.h cmds.h heap.h eq.h hash.h scan.h io.h \ X char.h box.h cond.h print.h error.h expand.h align.h tokenstack.h \ X token.h Xtokenlists.o: tex.h cmds.h heap.h eq.h hash.h str.h box.h \ X token.h expand.h tokenstack.h io.h scan.h def.h file.h tfm.h print.h \ X error.h tokenlists.h Xtokenstack.o: tex.h cmds.h heap.h eq.h def.h char.h io.h \ X token.h tokenlists.h box.h print.h error.h tokenstack.h X\Rogue\Monster\ Xelse X echo "will not over write ./BIGG/INIT/Makefile" Xfi Xif `test ! -d ./BIGG/VIR` Xthen X mkdir ./BIGG/VIR X echo "mkdir ./BIGG/VIR" Xfi Xif `test ! -s ./BIGG/VIR/Makefile` Xthen Xecho "writing ./BIGG/VIR/Makefile" Xcat > ./BIGG/VIR/Makefile << '\Rogue\Monster\' X# X# Pehong Chen, University of California, Berkeley (phc@renoir.berkeley.edu) X# X# modified for distribution, monardo@renoir.berkeley.edu X# X XVPATH = .. X XDEST = /usr/local X XMANDIR = /usr/man/manl X XMANUAL = X XHDRS = align.h \ X arith.h \ X box.h \ X boxlists.h \ X char.h \ X cmds.h \ X cond.h \ X def.h \ X dvi.h \ X eq.h \ X eqstack.h \ X error.h \ X eval.h \ X evalstack.h \ X expand.h \ X file.h \ X fmt.h \ X hash.h \ X heap.h \ X hyph.h \ X io.h \ X math.h \ X mathlists.h \ X mlist-hlist.h \ X pack.h \ X page.h \ X par.h \ X print.h \ X scan.h \ X str.h \ X tex.h \ X texext.h \ X tfm.h \ X token.h \ X tokenlists.h \ X tokenstack.h X X# Option for compiling SUN 68010 code with a 68020 CPU X68010CFLAGS = -m68010 -L/usr.MC68010/lib -Qpath /usr.MC68010/cstart X X# 16-bit word X#CFLAGS = -O X#CFLAGS = -O -DINIT $(68010CFLAGS) X X# 32-bit word X#CFLAGS = -O -DBIG X#CFLAGS = -O -DINIT -DBIG $(68010CFLAGS) X X# 64-bit word XCFLAGS = -O -DINIT -DBIGG X#CFLAGS = -O -DINIT -DBIGG $(68010CFLAGS) X XLDFLAGS = $(CFLAGS) X XLIBS = X XLINKER = cc X XMAKEFILE = Makefile X XOBJS = align.o \ X arith.o \ X box.o \ X boxlists.o \ X char.o \ X cmds.o \ X cond.o \ X def.o \ X dvi.o \ X eq.o \ X eqstack.o \ X error.o \ X eval.o \ X evalstack.o \ X expand.o \ X file.o \ X fmt.o \ X hash.o \ X heap.o \ X hyph.o \ X io.o \ X math.o \ X mathlists.o \ X mlist-hlist.o \ X pack.o \ X page.o \ X par.o \ X print.o \ X scan.o \ X str.o \ X tex.o \ X texext.o \ X tfm.o \ X token.o \ X tokenlists.o \ X tokenstack.o X XPRINT = tgrind -c X XPROGRAM = virtex X XSRCS = align.c \ X arith.c \ X box.c \ X boxlists.c \ X char.c \ X cmds.c \ X cond.c \ X def.c \ X dvi.c \ X eq.c \ X eqstack.c \ X error.c \ X eval.c \ X evalstack.c \ X expand.c \ X file.c \ X fmt.c \ X hash.c \ X heap.c \ X hyph.c \ X io.c \ X math.c \ X mathlists.c \ X mlist-hlist.c \ X pack.c \ X page.c \ X par.c \ X print.c \ X scan.c \ X str.c \ X tex.c \ X texext.c \ X tfm.c \ X token.c \ X tokenlists.c \ X tokenstack.c X X$(PROGRAM): $(OBJS) X @rm -f $(PROGRAM) X $(LINKER) $(LDFLAGS) $(OBJS) $(LIBS) -o $(PROGRAM) X @size $(PROGRAM) X Xinstall: $(PROGRAM) X install -c -s -m 0755 $(PROGRAM) $(DEST) X @ls -lgs $(DEST)/$(PROGRAM) X Xclean:; @rm -f $(OBJS) core $(PROGRAM) *.out X Xdepend:; @rm -f .#*.[chly] X mkmf -f $(MAKEFILE) PROGRAM=$(PROGRAM) DEST=$(DEST) X Xindex:; @ctags -wx $(HDRS) $(SRCS) X Xprint:; @$(PRINT) $(HDRS) $(SRCS) X Xprogram: $(PROGRAM) X Xtags: $(HDRS) $(SRCS); @ctags $(HDRS) $(SRCS) X Xupdate: $(DEST)/$(PROGRAM) X X$(DEST)/$(PROGRAM): $(SRCS) $(HDRS) X @make -f $(MAKEFILE) DEST=$(DEST) install X X.DEFAULT:; X### Xalign.o: tex.h cmds.h heap.h arith.h eq.h eqstack.h hash.h \ X token.h tokenstack.h scan.h evalstack.h box.h pack.h math.h \ X mlist-hlist.h error.h align.h Xarith.o: tex.h print.h arith.h Xbox.o: tex.h texext.h arith.h heap.h char.h str.h \ X eq.h hash.h tfm.h print.h math.h box.h tokenlists.h Xboxlists.o: tex.h cmds.h heap.h eq.h eqstack.h def.h box.h \ X tokenstack.h token.h scan.h tokenlists.h evalstack.h tfm.h pack.h \ X page.h math.h io.h print.h error.h boxlists.h Xchar.o: tex.h char.h Xcmds.o: tex.h texext.h heap.h eq.h eqstack.h str.h \ X hash.h token.h tokenlists.h tokenstack.h scan.h evalstack.h def.h \ X cond.h expand.h box.h boxlists.h tfm.h math.h mathlists.h align.h \ X error.h print.h cmds.h Xcond.o: tex.h cmds.h heap.h box.h eq.h eqstack.h hash.h \ X token.h tokenlists.h scan.h tokenstack.h evalstack.h file.h print.h \ X error.h cond.h Xdef.o: tex.h cmds.h heap.h io.h eq.h hash.h eqstack.h \ X evalstack.h token.h scan.h tokenstack.h expand.h arith.h str.h \ X box.h boxlists.h tokenlists.h file.h tfm.h dvi.h page.h print.h \ X error.h def.h Xdvi.o: tex.h texext.h heap.h str.h io.h eq.h box.h \ X scan.h tfm.h file.h pack.h print.h error.h dvi.h Xeq.o: tex.h cmds.h heap.h char.h hash.h box.h print.h \ X error.h eq.h Xeqstack.o: tex.h cmds.h heap.h eq.h token.h tokenstack.h \ X tokenlists.h print.h error.h eqstack.h Xerror.o: tex.h tokenstack.h token.h eq.h io.h print.h \ X error.h str.h Xeval.o: tex.h cmds.h heap.h char.h tfm.h eq.h eqstack.h \ X hash.h token.h scan.h tokenstack.h evalstack.h box.h boxlists.h \ X math.h mathlists.h cond.h def.h dvi.h pack.h page.h par.h print.h \ X error.h eval.h Xevalstack.o: tex.h cmds.h heap.h tokenstack.h eq.h box.h \ X page.h print.h error.h evalstack.h Xexpand.o: tex.h cmds.h heap.h io.h eq.h hash.h box.h \ X tokenstack.h scan.h token.h tokenlists.h cond.h file.h print.h \ X error.h expand.h Xfile.o: tex.h cmds.h heap.h char.h eq.h token.h scan.h \ X tokenstack.h str.h fmt.h io.h print.h error.h file.h Xfmt.o: tex.h texext.h heap.h token.h eq.h box.h \ X eqstack.h hash.h file.h tfm.h str.h hyph.h io.h print.h error.h \ X fmt.h Xhash.o: tex.h cmds.h heap.h box.h scan.h eq.h io.h math.h \ X boxlists.h str.h error.h hash.h Xheap.o: tex.h eq.h arith.h box.h token.h tokenlists.h \ X evalstack.h par.h page.h print.h error.h heap.h Xhyph.o: tex.h cmds.h heap.h token.h eq.h str.h tfm.h \ X box.h scan.h tokenstack.h par.h print.h error.h hyph.h Xio.o: tex.h char.h tokenstack.h print.h io.h Xmath.o: tex.h heap.h eq.h scan.h evalstack.h arith.h \ X str.h box.h tfm.h print.h pack.h math.h Xmathlists.o: tex.h cmds.h heap.h arith.h eq.h eqstack.h \ X evalstack.h token.h tokenstack.h scan.h tfm.h box.h pack.h math.h \ X mlist-hlist.h par.h page.h print.h error.h mathlists.h Xmlist-hlist.o: tex.h heap.h arith.h scan.h eq.h box.h math.h \ X pack.h tfm.h print.h error.h mlist-hlist.h Xpack.o: tex.h heap.h arith.h scan.h tokenstack.h eq.h \ X eqstack.h evalstack.h box.h tfm.h dvi.h print.h error.h pack.h Xpage.o: tex.h heap.h arith.h tokenstack.h tokenlists.h \ X eq.h eqstack.h evalstack.h scan.h expand.h box.h pack.h par.h math.h \ X dvi.h print.h error.h page.h Xpar.o: tex.h heap.h arith.h eq.h tfm.h tokenstack.h \ X evalstack.h box.h pack.h hyph.h print.h error.h par.h Xprint.o: tex.h texext.h eq.h char.h str.h io.h print.h Xscan.o: tex.h cmds.h heap.h arith.h eq.h token.h \ X tokenstack.h evalstack.h char.h str.h box.h expand.h tfm.h dvi.h \ X print.h error.h page.h scan.h Xstr.o: tex.h io.h file.h error.h str.h Xtex.o: tex.h texext.h cmds.h heap.h char.h str.h eq.h \ X hash.h evalstack.h eqstack.h tokenstack.h token.h box.h pack.h cond.h \ X io.h file.h tfm.h hyph.h dvi.h fmt.h error.h print.h page.h Xtexext.o: tex.h cmds.h heap.h eq.h hash.h token.h box.h \ X scan.h def.h tokenstack.h tokenlists.h evalstack.h io.h str.h \ X file.h dvi.h print.h error.h texext.h Xtfm.o: tex.h cmds.h heap.h arith.h eq.h hash.h box.h \ X scan.h token.h tokenstack.h io.h file.h print.h error.h tfm.h Xtoken.o: tex.h cmds.h heap.h eq.h hash.h scan.h io.h \ X char.h box.h cond.h print.h error.h expand.h align.h tokenstack.h \ X token.h Xtokenlists.o: tex.h cmds.h heap.h eq.h hash.h str.h box.h \ X token.h expand.h tokenstack.h io.h scan.h def.h file.h tfm.h print.h \ X error.h tokenlists.h Xtokenstack.o: tex.h cmds.h heap.h eq.h def.h char.h io.h \ X token.h tokenlists.h box.h print.h error.h tokenstack.h X\Rogue\Monster\ Xelse X echo "will not over write ./BIGG/VIR/Makefile" Xfi Xecho "Finished archive 1 of 1" Xexit SHAR_EOF chmod 0444 BIGG.shr1 || echo "restore of BIGG.shr1 fails" set `wc -c BIGG.shr1`;Sum=$1 if test "$Sum" != "14779" then echo original size 14779, current size $Sum;fi echo "x - extracting CONTENTS.tex (Text)" sed 's/^X//' << 'SHAR_EOF' > CONTENTS.tex && SHAR_EOF chmod 0444 CONTENTS.tex || echo "restore of CONTENTS.tex fails" set `wc -c CONTENTS.tex`;Sum=$1 if test "$Sum" != "0" then echo original size 0, current size $Sum;fi echo "x - extracting COPYING (Text)" sed 's/^X//' << 'SHAR_EOF' > COPYING && X X/************************************************************************ X* * X* Common TeX is an Electric Planet Production * X* * X* Copyright (C) 1986, 1987 Pat Joseph Monardo * X* * X* * X* Permission is hereby granted to make and distribute verbatim copies * X* of this program provided that the copyright notice and this * X* permission notice are preserved and provided that the recipient is * X* not asked to waive or limit his right to redistribute copies as * X* allowed by this permission notice and provided that anyone who * X* receives an executable form of this program is granted access to a * X* machine-readable form of the source code for this program at a * X* cost not greater than reasonable reproduction, shipping, and * X* handling costs. Executable forms of this program distributed * X* without the source code must be accompanied by a conspicuous copy * X* of this permission notice and a statement that tells the recipient * X* how to obtain the source code. * X* * X* Permission is granted to distribute modified versions of all or * X* part of this program under the conditions above with the additional * X* requirement that the entire modified work must be covered by a * X* permission notice identical to this permission notice. Anything * X* distributed with and usable only in conjunction with something * X* derived from this program, whose useful purpose is to extend or * X* adapt or add capabilities to this program, is to be considered a * X* modified version of this program under the requirement above. * X* * X* This program is distributed with no warranty of any sort. No * X* contributor accepts responsibility for the consequences of using * X* this program or for whether it serves any particular purpose. * X* * X************************************************************************/ SHAR_EOF chmod 0444 COPYING || echo "restore of COPYING fails" set `wc -c COPYING`;Sum=$1 if test "$Sum" != "2517" then echo original size 2517, current size $Sum;fi echo "x - extracting JOY (Text)" sed 's/^X//' << 'SHAR_EOF' > JOY && X XCommon TeX is dedicated to the memory of my mother, Xwho passed away before this work could be completed. XShe allowed me to live a free spirit. XCertainly this program would not exist otherwise. X SHAR_EOF chmod 0444 JOY || echo "restore of JOY fails" set `wc -c JOY`;Sum=$1 if test "$Sum" != "197" then echo original size 197, current size $Sum;fi echo "x - extracting Makefile (Text)" sed 's/^X//' << 'SHAR_EOF' > Makefile && X# X# Pehong Chen, University of California, Berkeley (phc@renoir.berkeley.edu) X# X# modified for distribution, monardo@renoir.berkeley.edu X# X XVPATH = .. X XDEST = /usr/local X XMANDIR = /usr/man/manl X XMANUAL = X XHDRS = align.h \ X arith.h \ X box.h \ X boxlists.h \ X char.h \ X cmds.h \ X cond.h \ X def.h \ X dvi.h \ X eq.h \ X eqstack.h \ X error.h \ X eval.h \ X evalstack.h \ X expand.h \ X file.h \ X fmt.h \ X hash.h \ X heap.h \ X hyph.h \ X io.h \ X math.h \ X mathlists.h \ X mlist-hlist.h \ X pack.h \ X page.h \ X par.h \ X print.h \ X scan.h \ X str.h \ X tex.h \ X texext.h \ X tfm.h \ X token.h \ X tokenlists.h \ X tokenstack.h X X# Option for compiling SUN 68010 code with a 68020 CPU X68010CFLAGS = -m68010 -L/usr.MC68010/lib -Qpath /usr.MC68010/cstart X X# 16-bit word X#CFLAGS = -O X#CFLAGS = -O $(68010CFLAGS) X X# 32-bit word XCFLAGS = -O -DBIG X#CFLAGS = -O -DBIG $(68010CFLAGS) X X# 64-bit word X#CFLAGS = -O -DBIGG X#CFLAGS = -O -DBIGG $(68010CFLAGS) X XLDFLAGS = $(CFLAGS) X XLIBS = X XLINKER = cc X XMAKEFILE = Makefile X XOBJS = align.o \ X arith.o \ X box.o \ X boxlists.o \ X char.o \ X cmds.o \ X cond.o \ X def.o \ X dvi.o \ X eq.o \ X eqstack.o \ X error.o \ X eval.o \ X evalstack.o \ X expand.o \ X file.o \ X fmt.o \ X hash.o \ X heap.o \ X hyph.o \ X io.o \ X math.o \ X mathlists.o \ X mlist-hlist.o \ X pack.o \ X page.o \ X par.o \ X print.o \ X scan.o \ X str.o \ X tex.o \ X texext.o \ X tfm.o \ X token.o \ X tokenlists.o \ X tokenstack.o X XPRINT = tgrind -c X XPROGRAM = virtex X XSRCS = align.c \ X arith.c \ X box.c \ X boxlists.c \ X char.c \ X cmds.c \ X cond.c \ X def.c \ X dvi.c \ X eq.c \ X eqstack.c \ X error.c \ X eval.c \ X evalstack.c \ X expand.c \ X file.c \ X fmt.c \ X hash.c \ X heap.c \ X hyph.c \ X io.c \ X math.c \ X mathlists.c \ X mlist-hlist.c \ X pack.c \ X page.c \ X par.c \ X print.c \ X scan.c \ X str.c \ X tex.c \ X texext.c \ X tfm.c \ X token.c \ X tokenlists.c \ X tokenstack.c X X$(PROGRAM): $(OBJS) X @rm -f $(PROGRAM) X $(LINKER) $(LDFLAGS) $(OBJS) $(LIBS) -o $(PROGRAM) X @size $(PROGRAM) X Xinstall: $(PROGRAM) X install -c -s -m 0755 $(PROGRAM) $(DEST) X @ls -lgs $(DEST)/$(PROGRAM) X Xclean:; @rm -f $(OBJS) core $(PROGRAM) *.out X Xdepend:; @rm -f .#*.[chly] X mkmf -f $(MAKEFILE) PROGRAM=$(PROGRAM) DEST=$(DEST) X Xindex:; @ctags -wx $(HDRS) $(SRCS) X Xprint:; @$(PRINT) $(HDRS) $(SRCS) X Xprogram: $(PROGRAM) X Xtags: $(HDRS) $(SRCS); @ctags $(HDRS) $(SRCS) X Xupdate: $(DEST)/$(PROGRAM) X X$(DEST)/$(PROGRAM): $(SRCS) $(HDRS) X @make -f $(MAKEFILE) DEST=$(DEST) install X X.DEFAULT:; X### Xalign.o: tex.h cmds.h heap.h arith.h eq.h eqstack.h hash.h \ X token.h tokenstack.h scan.h evalstack.h box.h pack.h math.h \ X mlist-hlist.h error.h align.h Xarith.o: tex.h print.h arith.h Xbox.o: tex.h texext.h arith.h heap.h char.h str.h \ X eq.h hash.h tfm.h print.h math.h box.h tokenlists.h Xboxlists.o: tex.h cmds.h heap.h eq.h eqstack.h def.h box.h \ X tokenstack.h token.h scan.h tokenlists.h evalstack.h tfm.h pack.h \ X page.h math.h io.h print.h error.h boxlists.h Xchar.o: tex.h char.h Xcmds.o: tex.h texext.h heap.h eq.h eqstack.h str.h \ X hash.h token.h tokenlists.h tokenstack.h scan.h evalstack.h def.h \ X cond.h expand.h box.h boxlists.h tfm.h math.h mathlists.h align.h \ X error.h print.h cmds.h Xcond.o: tex.h cmds.h heap.h box.h eq.h eqstack.h hash.h \ X token.h tokenlists.h scan.h tokenstack.h evalstack.h file.h print.h \ X error.h cond.h Xdef.o: tex.h cmds.h heap.h io.h eq.h hash.h eqstack.h \ X evalstack.h token.h scan.h tokenstack.h expand.h arith.h str.h \ X box.h boxlists.h tokenlists.h file.h tfm.h dvi.h page.h print.h \ X error.h def.h Xdvi.o: tex.h texext.h heap.h str.h io.h eq.h box.h \ X scan.h tfm.h file.h pack.h print.h error.h dvi.h Xeq.o: tex.h cmds.h heap.h char.h hash.h box.h print.h \ X error.h eq.h Xeqstack.o: tex.h cmds.h heap.h eq.h token.h tokenstack.h \ X tokenlists.h print.h error.h eqstack.h Xerror.o: tex.h tokenstack.h token.h eq.h io.h print.h \ X error.h str.h Xeval.o: tex.h cmds.h heap.h char.h tfm.h eq.h eqstack.h \ X hash.h token.h scan.h tokenstack.h evalstack.h box.h boxlists.h \ X math.h mathlists.h cond.h def.h dvi.h pack.h page.h par.h print.h \ X error.h eval.h Xevalstack.o: tex.h cmds.h heap.h tokenstack.h eq.h box.h \ X page.h print.h error.h evalstack.h Xexpand.o: tex.h cmds.h heap.h io.h eq.h hash.h box.h \ X tokenstack.h scan.h token.h tokenlists.h cond.h file.h print.h \ X error.h expand.h Xfile.o: tex.h cmds.h heap.h char.h eq.h token.h scan.h \ X tokenstack.h str.h fmt.h io.h print.h error.h file.h Xfmt.o: tex.h texext.h heap.h token.h eq.h box.h \ X eqstack.h hash.h file.h tfm.h str.h hyph.h io.h print.h error.h \ X fmt.h Xhash.o: tex.h cmds.h heap.h box.h scan.h eq.h io.h math.h \ X boxlists.h str.h error.h hash.h Xheap.o: tex.h eq.h arith.h box.h token.h tokenlists.h \ X evalstack.h par.h page.h print.h error.h heap.h Xhyph.o: tex.h cmds.h heap.h token.h eq.h str.h tfm.h \ X box.h scan.h tokenstack.h par.h print.h error.h hyph.h Xio.o: tex.h char.h tokenstack.h print.h io.h Xmath.o: tex.h heap.h eq.h scan.h evalstack.h arith.h \ X str.h box.h tfm.h print.h pack.h math.h Xmathlists.o: tex.h cmds.h heap.h arith.h eq.h eqstack.h \ X evalstack.h token.h tokenstack.h scan.h tfm.h box.h pack.h math.h \ X mlist-hlist.h par.h page.h print.h error.h mathlists.h Xmlist-hlist.o: tex.h heap.h arith.h scan.h eq.h box.h math.h \ X pack.h tfm.h print.h error.h mlist-hlist.h Xpack.o: tex.h heap.h arith.h scan.h tokenstack.h eq.h \ X eqstack.h evalstack.h box.h tfm.h dvi.h print.h error.h pack.h Xpage.o: tex.h heap.h arith.h tokenstack.h tokenlists.h \ X eq.h eqstack.h evalstack.h scan.h expand.h box.h pack.h par.h math.h \ X dvi.h print.h error.h page.h Xpar.o: tex.h heap.h arith.h eq.h tfm.h tokenstack.h \ X evalstack.h box.h pack.h hyph.h print.h error.h par.h Xprint.o: tex.h texext.h eq.h char.h str.h io.h print.h Xscan.o: tex.h cmds.h heap.h arith.h eq.h token.h \ X tokenstack.h evalstack.h char.h str.h box.h expand.h tfm.h dvi.h \ X print.h error.h page.h scan.h Xstr.o: tex.h io.h file.h error.h str.h Xtex.o: tex.h texext.h cmds.h heap.h char.h str.h eq.h \ X hash.h evalstack.h eqstack.h tokenstack.h token.h box.h pack.h cond.h \ X io.h file.h tfm.h hyph.h dvi.h fmt.h error.h print.h page.h Xtexext.o: tex.h cmds.h heap.h eq.h hash.h token.h box.h \ X scan.h def.h tokenstack.h tokenlists.h evalstack.h io.h str.h \ X file.h dvi.h print.h error.h texext.h Xtfm.o: tex.h cmds.h heap.h arith.h eq.h hash.h box.h \ X scan.h token.h tokenstack.h io.h file.h print.h error.h tfm.h Xtoken.o: tex.h cmds.h heap.h eq.h hash.h scan.h io.h \ X char.h box.h cond.h print.h error.h expand.h align.h tokenstack.h \ X token.h Xtokenlists.o: tex.h cmds.h heap.h eq.h hash.h str.h box.h \ X token.h expand.h tokenstack.h io.h scan.h def.h file.h tfm.h print.h \ X error.h tokenlists.h Xtokenstack.o: tex.h cmds.h heap.h eq.h def.h char.h io.h \ X token.h tokenlists.h box.h print.h error.h tokenstack.h SHAR_EOF chmod 0444 Makefile || echo "restore of Makefile fails" set `wc -c Makefile`;Sum=$1 if test "$Sum" != "6993" then echo original size 6993, current size $Sum;fi echo "x - extracting README (Text)" sed 's/^X//' << 'SHAR_EOF' > README && X XThis is the common TeX for PCAT's,SUNS,VAXEN,3B,etc. XUnder UNIX, Makefiles control everything. XFor DOS, I have provided two batch files for making initex and virtex. XHowever, replace tex.h with tex.doc found in INIT. X XTeX will look for files of three types: Xtext files, font files, and format files. XFormats files are the files ending in .fmt Xwhich are generated by a \dump command (see the TeXbook). XFont files end in .tfm. And text files end in .tex, Xbut TeX will input files of any extension including Xthe null extension. XTo use the path searching facility, set environment variables: X Xset texformats=/tex/lib:. Xset texinputs=/tex/lib:. Xset texfonts=/tex/tfm:. X XNotice that everything is still as they were inherited Xfrom UNIX. I have not bothered to change to DOS pathnames. XUnfortunately this means you cant specify file system prefixes X(e.g. c:) in pathnames. I will tell you how to do this if Xyou need to. (I am working on it) Contact me. XAlso be sure to include . in the pathlist. XUpdate: I think the subst command will alleviate the problem... X XThere was a delay of two weeks in which I couldnt Xtest TeX due to lack of a working dvi printer. Sorry. XI have spent considerable effort examing the torture Xtest results and am confident that it will perform well. XStill it is a very new program. Let me know of any problems. XYou can reach me at (415) 327 - 8114 after 10:00AM till whenever. XMy address remains SHAR_EOF echo "End of part 1" echo "File README is continued in part 2" echo "2" > s2_seq_.tmp exit 0
glenn@extro.ucc.su.oz.au (G Geers) (02/16/90)
---- Cut Here and unpack ---- #!/bin/sh # this is part 2 of a multipart archive # do not concatenate these parts, unpack them in order with /bin/sh # file README continued # CurArch=2 if test ! -r s2_seq_.tmp then echo "Please unpack part 1 first!" exit 1; fi ( read Scheck if test "$Scheck" != $CurArch then echo "Please unpack part $Scheck next!" exit 1; else exit 0; fi ) < s2_seq_.tmp || exit 1 echo "x - Continuing file README" sed 's/^X//' << 'SHAR_EOF' >> README X XPat Monardo X299 California Ave #205 XPalo Alto, CA 94306 X X sincerley, X pat X SHAR_EOF echo "File README is complete" chmod 0444 README || echo "restore of README fails" set `wc -c README`;Sum=$1 if test "$Sum" != "1491" then echo original size 1491, current size $Sum;fi echo "x - extracting SMALL.shr1 (Text)" sed 's/^X//' << 'SHAR_EOF' > SMALL.shr1 && X#!/bin/sh X# to extract, remove the header and type "sh filename" Xif `test ! -d ./SMALL` Xthen X mkdir ./SMALL X echo "mkdir ./SMALL" Xfi Xif `test ! -d ./SMALL/INIT` Xthen X mkdir ./SMALL/INIT X echo "mkdir ./SMALL/INIT" Xfi Xif `test ! -s ./SMALL/INIT/Makefile` Xthen Xecho "writing ./SMALL/INIT/Makefile" Xcat > ./SMALL/INIT/Makefile << '\Rogue\Monster\' X# X# Pehong Chen, University of California, Berkeley (phc@renoir.berkeley.edu) X# X# modified for distribution, monardo@renoir.berkeley.edu X# X XVPATH = .. X XDEST = /usr/local X XMANDIR = /usr/man/manl X XMANUAL = X XHDRS = align.h \ X arith.h \ X box.h \ X boxlists.h \ X char.h \ X cmds.h \ X cond.h \ X def.h \ X dvi.h \ X eq.h \ X eqstack.h \ X error.h \ X eval.h \ X evalstack.h \ X expand.h \ X file.h \ X fmt.h \ X hash.h \ X heap.h \ X hyph.h \ X io.h \ X math.h \ X mathlists.h \ X mlist-hlist.h \ X pack.h \ X page.h \ X par.h \ X print.h \ X scan.h \ X str.h \ X tex.h \ X texext.h \ X tfm.h \ X token.h \ X tokenlists.h \ X tokenstack.h X X# Option for compiling SUN 68010 code with a 68020 CPU X68010CFLAGS = -m68010 -L/usr.MC68010/lib -Qpath /usr.MC68010/cstart X X# 16-bit word XCFLAGS = -O -DINIT X#CFLAGS = -O -DINIT $(68010CFLAGS) X X# 32-bit word X#CFLAGS = -O -DINIT -DBIG X#CFLAGS = -O -DINIT -DBIG $(68010CFLAGS) X X# 64-bit word X#CFLAGS = -O -DINIT -DBIGG X#CFLAGS = -O -DINIT -DBIGG $(68010CFLAGS) X XLDFLAGS = $(CFLAGS) X XLIBS = X XLINKER = cc X XMAKEFILE = Makefile X XOBJS = align.o \ X arith.o \ X box.o \ X boxlists.o \ X char.o \ X cmds.o \ X cond.o \ X def.o \ X dvi.o \ X eq.o \ X eqstack.o \ X error.o \ X eval.o \ X evalstack.o \ X expand.o \ X file.o \ X fmt.o \ X hash.o \ X heap.o \ X hyph.o \ X io.o \ X math.o \ X mathlists.o \ X mlist-hlist.o \ X pack.o \ X page.o \ X par.o \ X print.o \ X scan.o \ X str.o \ X tex.o \ X texext.o \ X tfm.o \ X token.o \ X tokenlists.o \ X tokenstack.o X XPRINT = tgrind -c X XPROGRAM = initex X XSRCS = align.c \ X arith.c \ X box.c \ X boxlists.c \ X char.c \ X cmds.c \ X cond.c \ X def.c \ X dvi.c \ X eq.c \ X eqstack.c \ X error.c \ X eval.c \ X evalstack.c \ X expand.c \ X file.c \ X fmt.c \ X hash.c \ X heap.c \ X hyph.c \ X io.c \ X math.c \ X mathlists.c \ X mlist-hlist.c \ X pack.c \ X page.c \ X par.c \ X print.c \ X scan.c \ X str.c \ X tex.c \ X texext.c \ X tfm.c \ X token.c \ X tokenlists.c \ X tokenstack.c X X$(PROGRAM): $(OBJS) X @rm -f $(PROGRAM) X $(LINKER) $(LDFLAGS) $(OBJS) $(LIBS) -o $(PROGRAM) X @size $(PROGRAM) X Xinstall: $(PROGRAM) X install -c -s -m 0755 $(PROGRAM) $(DEST) X @ls -lgs $(DEST)/$(PROGRAM) X Xclean:; @rm -f $(OBJS) core $(PROGRAM) *.out X Xdepend:; @rm -f .#*.[chly] X mkmf -f $(MAKEFILE) PROGRAM=$(PROGRAM) DEST=$(DEST) X Xindex:; @ctags -wx $(HDRS) $(SRCS) X Xprint:; @$(PRINT) $(HDRS) $(SRCS) X Xprogram: $(PROGRAM) X Xtags: $(HDRS) $(SRCS); @ctags $(HDRS) $(SRCS) X Xupdate: $(DEST)/$(PROGRAM) X X$(DEST)/$(PROGRAM): $(SRCS) $(HDRS) X @make -f $(MAKEFILE) DEST=$(DEST) install X X.DEFAULT:; X### Xalign.o: tex.h cmds.h heap.h arith.h eq.h eqstack.h hash.h \ X token.h tokenstack.h scan.h evalstack.h box.h pack.h math.h \ X mlist-hlist.h error.h align.h Xarith.o: tex.h print.h arith.h Xbox.o: tex.h texext.h arith.h heap.h char.h str.h \ X eq.h hash.h tfm.h print.h math.h box.h tokenlists.h Xboxlists.o: tex.h cmds.h heap.h eq.h eqstack.h def.h box.h \ X tokenstack.h token.h scan.h tokenlists.h evalstack.h tfm.h pack.h \ X page.h math.h io.h print.h error.h boxlists.h Xchar.o: tex.h char.h Xcmds.o: tex.h texext.h heap.h eq.h eqstack.h str.h \ X hash.h token.h tokenlists.h tokenstack.h scan.h evalstack.h def.h \ X cond.h expand.h box.h boxlists.h tfm.h math.h mathlists.h align.h \ X error.h print.h cmds.h Xcond.o: tex.h cmds.h heap.h box.h eq.h eqstack.h hash.h \ X token.h tokenlists.h scan.h tokenstack.h evalstack.h file.h print.h \ X error.h cond.h Xdef.o: tex.h cmds.h heap.h io.h eq.h hash.h eqstack.h \ X evalstack.h token.h scan.h tokenstack.h expand.h arith.h str.h \ X box.h boxlists.h tokenlists.h file.h tfm.h dvi.h page.h print.h \ X error.h def.h Xdvi.o: tex.h texext.h heap.h str.h io.h eq.h box.h \ X scan.h tfm.h file.h pack.h print.h error.h dvi.h Xeq.o: tex.h cmds.h heap.h char.h hash.h box.h print.h \ X error.h eq.h Xeqstack.o: tex.h cmds.h heap.h eq.h token.h tokenstack.h \ X tokenlists.h print.h error.h eqstack.h Xerror.o: tex.h tokenstack.h token.h eq.h io.h print.h \ X error.h str.h Xeval.o: tex.h cmds.h heap.h char.h tfm.h eq.h eqstack.h \ X hash.h token.h scan.h tokenstack.h evalstack.h box.h boxlists.h \ X math.h mathlists.h cond.h def.h dvi.h pack.h page.h par.h print.h \ X error.h eval.h Xevalstack.o: tex.h cmds.h heap.h tokenstack.h eq.h box.h \ X page.h print.h error.h evalstack.h Xexpand.o: tex.h cmds.h heap.h io.h eq.h hash.h box.h \ X tokenstack.h scan.h token.h tokenlists.h cond.h file.h print.h \ X error.h expand.h Xfile.o: tex.h cmds.h heap.h char.h eq.h token.h scan.h \ X tokenstack.h str.h fmt.h io.h print.h error.h file.h Xfmt.o: tex.h texext.h heap.h token.h eq.h box.h \ X eqstack.h hash.h file.h tfm.h str.h hyph.h io.h print.h error.h \ X fmt.h Xhash.o: tex.h cmds.h heap.h box.h scan.h eq.h io.h math.h \ X boxlists.h str.h error.h hash.h Xheap.o: tex.h eq.h arith.h box.h token.h tokenlists.h \ X evalstack.h par.h page.h print.h error.h heap.h Xhyph.o: tex.h cmds.h heap.h token.h eq.h str.h tfm.h \ X box.h scan.h tokenstack.h par.h print.h error.h hyph.h Xio.o: tex.h char.h tokenstack.h print.h io.h Xmath.o: tex.h heap.h eq.h scan.h evalstack.h arith.h \ X str.h box.h tfm.h print.h pack.h math.h Xmathlists.o: tex.h cmds.h heap.h arith.h eq.h eqstack.h \ X evalstack.h token.h tokenstack.h scan.h tfm.h box.h pack.h math.h \ X mlist-hlist.h par.h page.h print.h error.h mathlists.h Xmlist-hlist.o: tex.h heap.h arith.h scan.h eq.h box.h math.h \ X pack.h tfm.h print.h error.h mlist-hlist.h Xpack.o: tex.h heap.h arith.h scan.h tokenstack.h eq.h \ X eqstack.h evalstack.h box.h tfm.h dvi.h print.h error.h pack.h Xpage.o: tex.h heap.h arith.h tokenstack.h tokenlists.h \ X eq.h eqstack.h evalstack.h scan.h expand.h box.h pack.h par.h math.h \ X dvi.h print.h error.h page.h Xpar.o: tex.h heap.h arith.h eq.h tfm.h tokenstack.h \ X evalstack.h box.h pack.h hyph.h print.h error.h par.h Xprint.o: tex.h texext.h eq.h char.h str.h io.h print.h Xscan.o: tex.h cmds.h heap.h arith.h eq.h token.h \ X tokenstack.h evalstack.h char.h str.h box.h expand.h tfm.h dvi.h \ X print.h error.h page.h scan.h Xstr.o: tex.h io.h file.h error.h str.h Xtex.o: tex.h texext.h cmds.h heap.h char.h str.h eq.h \ X hash.h evalstack.h eqstack.h tokenstack.h token.h box.h pack.h cond.h \ X io.h file.h tfm.h hyph.h dvi.h fmt.h error.h print.h page.h Xtexext.o: tex.h cmds.h heap.h eq.h hash.h token.h box.h \ X scan.h def.h tokenstack.h tokenlists.h evalstack.h io.h str.h \ X file.h dvi.h print.h error.h texext.h Xtfm.o: tex.h cmds.h heap.h arith.h eq.h hash.h box.h \ X scan.h token.h tokenstack.h io.h file.h print.h error.h tfm.h Xtoken.o: tex.h cmds.h heap.h eq.h hash.h scan.h io.h \ X char.h box.h cond.h print.h error.h expand.h align.h tokenstack.h \ X token.h Xtokenlists.o: tex.h cmds.h heap.h eq.h hash.h str.h box.h \ X token.h expand.h tokenstack.h io.h scan.h def.h file.h tfm.h print.h \ X error.h tokenlists.h Xtokenstack.o: tex.h cmds.h heap.h eq.h def.h char.h io.h \ X token.h tokenlists.h box.h print.h error.h tokenstack.h X\Rogue\Monster\ Xelse X echo "will not over write ./SMALL/INIT/Makefile" Xfi Xif `test ! -s ./SMALL/INIT/make.bat` Xthen Xecho "writing ./SMALL/INIT/make.bat" Xcat > ./SMALL/INIT/make.bat << '\Rogue\Monster\' Xcl -c -M2l -DINIT -DNOHELP -DDOS ..\CHAR.C >> errs Xcl -c -M2l -DINIT -DNOHELP -DDOS ..\IO.C >> errs Xcl -c -M2l -DINIT -DNOHELP -DDOS ..\STR.C >> errs Xcl -c -M2l -DINIT -DNOHELP -DDOS ..\PRINT.C >> errs Xcl -c -M2l -DINIT -DNOHELP -DDOS ..\ERROR.C >> errs Xcl -c -M2l -DINIT -DNOHELP -DDOS ..\ARITH.C >> errs Xcl -c -M2l -DINIT -DNOHELP -DDOS ..\HEAP.C >> errs Xcl -c -M2l -DINIT -DNOHELP -DDOS ..\BOX.C >> errs Xcl -c -M2l -Od -DINIT -DNOHELP -DDOS ..\CMDS.C > errs Xcl -c -M2l -DINIT -DNOHELP -DDOS ..\EVALSTAC.C >> errs Xcl -c -M2l -DINIT -DNOHELP -DDOS ..\EQ.C >> errs Xcl -c -M2l -DINIT -DNOHELP -DDOS ..\HASH.C >> errs Xcl -c -M2l -DINIT -DNOHELP -DDOS ..\EQSTACK.C >> errs Xcl -c -M2l -DINIT -DNOHELP -DDOS ..\TOKENSTA.C >> errs Xcl -c -M2l -Od -DINIT -DNOHELP -DDOS ..\TOKEN.C >> errs Xcl -c -M2l -DINIT -DNOHELP -DDOS ..\EXPAND.C >> errs Xcl -c -M2l -DINIT -DNOHELP -DDOS ..\SCAN.C >> errs Xcl -c -M2l -DINIT -DNOHELP -DDOS ..\TOKENLIS.C >> errs Xcl -c -M2l -DINIT -DNOHELP -DDOS ..\COND.C >> errs Xcl -c -M2l -DINIT -DNOHELP -DDOS ..\FILE.C >> errs Xcl -c -M2l -DINIT -DNOHELP -DDOS ..\TFM.C >> errs Xcl -c -M2l -DINIT -DNOHELP -DDOS ..\DVI.C >> errs Xcl -c -M2l -DINIT -DNOHELP -DDOS ..\PACK.C >> errs Xcl -c -M2l -DINIT -DNOHELP -DDOS ..\MATH.C >> errs Xcl -c -M2l -DINIT -DNOHELP -DDOS ..\MLIST-HL.C >> errs Xcl -c -M2l -DINIT -DNOHELP -DDOS ..\ALIGN.C >> errs Xcl -c -M2l -DINIT -DNOHELP -DDOS ..\PAR.C >> errs Xcl -c -M2l -DINIT -DNOHELP -DDOS ..\HYPH.C >> errs Xcl -c -M2l -DINIT -DNOHELP -DDOS ..\PAGE.C >> errs Xcl -c -M2l -DINIT -DNOHELP -DDOS ..\EVAL.C >> errs Xcl -c -M2l -DINIT -DNOHELP -DDOS ..\BOXLISTS.C >> errs Xcl -c -M2l -DINIT -DNOHELP -DDOS ..\MATHLIST.C >> errs Xcl -c -M2l -DINIT -DNOHELP -DDOS ..\DEF.C >> errs Xcl -c -M2l -DINIT -DNOHELP -DDOS ..\FMT.C >> errs Xcl -c -M2l -DINIT -DNOHELP -DDOS ..\TEX.C >> errs Xcl -c -M2l -DINIT -DNOHELP -DDOS ..\TEXEXT.C >> errs Xlink @initex.lnk >> errs Xinitex plain\dump X\Rogue\Monster\ Xelse X echo "will not over write ./SMALL/INIT/make.bat" Xfi Xif `test ! -s ./SMALL/INIT/initex.lnk` Xthen Xecho "writing ./SMALL/INIT/initex.lnk" Xcat > ./SMALL/INIT/initex.lnk << '\Rogue\Monster\' XCHAR.OBJ+ XIO.OBJ+ XSTR.OBJ+ XPRINT.OBJ+ XERROR.OBJ+ XARITH.OBJ+ XHEAP.OBJ+ XBOX.OBJ+ XCMDS.OBJ+ XEVALSTAC.OBJ+ XEQ.OBJ+ XHASH.OBJ+ XEQSTACK.OBJ+ XTOKENSTA.OBJ+ XTOKEN.OBJ+ XEXPAND.OBJ+ XSCAN.OBJ+ XTOKENLIS.OBJ+ XCOND.OBJ+ XFILE.OBJ+ XTFM.OBJ+ XDVI.OBJ+ XPACK.OBJ+ XMATH.OBJ+ XMLIST-HL.OBJ+ XALIGN.OBJ+ XPAR.OBJ+ XHYPH.OBJ+ XPAGE.OBJ+ XEVAL.OBJ+ XBOXLISTS.OBJ+ XMATHLIST.OBJ+ XDEF.OBJ+ XFMT.OBJ+ XTEX.OBJ+ XTEXEXT.OBJ XINITEX.EXE/EXEPACK; X\Rogue\Monster\ Xelse X echo "will not over write ./SMALL/INIT/initex.lnk" Xfi Xif `test ! -s ./SMALL/INIT/tex.dos` Xthen Xecho "writing ./SMALL/INIT/tex.dos" Xcat > ./SMALL/INIT/tex.dos << '\Rogue\Monster\' X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * tex.h X */ X X#include <stdio.h> X#include <signal.h> X#include <time.h> X X/* X * constants in the outer block X */ X X#define NUL '\0' X#define EOLN '\n' X#define FALSE 0 X#define TRUE 1 X#define EMPTY 0 X X#ifdef INIT X#define BUF_SIZE 512 X#define DVI_BUF_SIZE 1024 X#define ERROR_LINE 78 X#define FILE_NAME_SIZE 104 X#define FONT_BASE 0 X#define FONT_MAX 75 X#define FONT_MEM_SIZE 16380 X#define HALF_BUF 512 X#define HALF_ERROR_LINE 39 X#define HASH_SIZE 3000 X#define HASH_PRIME 2551 X#define HYPH_SIZE 307 X#define MAX_IN_OPEN 15 X#define MAX_PRINT_LINE 78 X#define MAX_STRINGS 5400 X#define NEST_SIZE 40 X#define PARAM_SIZE 30 X#define POOL_SIZE 12000 X#define SAVE_SIZE 600 X#define STACK_SIZE 200 X#define STRING_VACANCIES 1000 X#define TRIE_OP_HASH_SIZE 512 X#define TRIE_SIZE 8000 X X#if !defined(BIGG) && !defined(BIG) X#define MEM_BOT 0 X#define MEM_TOP 7000 X#define TOK_BOT 0 X#define TOK_TOP 12000 X#define MEM_MIN MEM_BOT X#define MEM_MAX MEM_TOP X#define TOK_MIN TOK_BOT X#define TOK_MAX TOK_TOP X#define MIN_QUARTERWORD 0 X#define MAX_QUARTERWORD 255 X#define MIN_HALFWORD 0 X#define MAX_HALFWORD 65535 X#endif X X#ifdef BIG X#define MEM_BOT 0 X#define MEM_TOP 17000 X#define TOK_BOT 0 X#define TOK_TOP 27000 X#define MEM_MIN MEM_BOT X#define MEM_MAX MEM_TOP X#define TOK_MIN TOK_BOT X#define TOK_MAX TOK_TOP X#define MIN_QUARTERWORD 0 X#define MAX_QUARTERWORD 255 X#define MIN_HALFWORD 0 X#define MAX_HALFWORD 655350 X#endif X X#ifdef BIGG X#define MEM_BOT 0 X#define MEM_TOP 27000 X#define TOK_BOT 0 X#define TOK_TOP 37000 X#define MEM_MIN MEM_BOT X#define MEM_MAX MEM_TOP X#define TOK_MIN TOK_BOT X#define TOK_MAX TOK_TOP X#define MIN_QUARTERWORD 0 X#define MAX_QUARTERWORD 255 X#define MIN_HALFWORD 0 X#define MAX_HALFWORD 6553500 X#endif X X#else X X#define BUF_SIZE 512 X#define DVI_BUF_SIZE 1024 X#define ERROR_LINE 78 X#define FILE_NAME_SIZE 104 X#define FONT_BASE 0 X#define FONT_MAX 75 X#define FONT_MEM_SIZE 16380 X#define HALF_BUF 512 X#define HALF_ERROR_LINE 39 X#define HASH_SIZE 3000 X#define HASH_PRIME 2551 X#define HYPH_SIZE 307 X#define MAX_IN_OPEN 15 X#define MAX_PRINT_LINE 78 X#define MAX_STRINGS 5400 X#define NEST_SIZE 40 X#define PARAM_SIZE 30 X#define POOL_SIZE 12000 X#define SAVE_SIZE 600 X#define STACK_SIZE 200 X#define STRING_VACANCIES 1000 X#define TRIE_OP_HASH_SIZE 512 X#define TRIE_SIZE 8000 X X#if !defined(BIGG) && !defined(BIG) X#define MEM_BOT 0 X#define MEM_TOP 7000 X#define TOK_BOT 0 X#define TOK_TOP 12000 X#define MEM_MIN 0 X#define MEM_MAX 16300 X#define TOK_MIN 0 X#define TOK_MAX 25000 X#define MIN_QUARTERWORD 0 X#define MAX_QUARTERWORD 255 X#define MIN_HALFWORD 0 X#define MAX_HALFWORD 65535 X#endif X X#ifdef BIG X#define MEM_BOT 0 X#define MEM_TOP 17000 X#define TOK_BOT 0 X#define TOK_TOP 27000 X#define MEM_MIN 0 X#define MEM_MAX 128000 X#define TOK_MIN 0 X#define TOK_MAX 45000 X#define MIN_QUARTERWORD 0 X#define MAX_QUARTERWORD 255 X#define MIN_HALFWORD 0 X#define MAX_HALFWORD 655350 X#endif X X#ifdef BIGG X#define MEM_BOT 0 X#define MEM_TOP 27000 X#define TOK_BOT 0 X#define TOK_TOP 37000 X#define MEM_MIN 0 X#define MEM_MAX 256000 X#define TOK_MIN 0 X#define TOK_MAX 65000 X#define MIN_QUARTERWORD 0 X#define MAX_QUARTERWORD 255 X#define MIN_HALFWORD 0 X#define MAX_HALFWORD 6553500 X#endif X X#endif X X/* X * types in the outer block X */ X X#define global extern X X#define ascii unsigned char X#define bool int X#define byte unsigned char X#define fnt int X#define gord unsigned char X#define gratio float X#define group int X#define ptr hword X#define sc i X#define scal long X#define str hword X#define val long X Xtypedef FILE *word_file; Xtypedef FILE *alpha_file; Xtypedef FILE *byte_file; X X#define qword unsigned char X X#if defined(BIG) || defined(BIGG) X#define hword unsigned long X#else X#define hword unsigned short X#endif X Xtypedef union { X struct { X hword rh; X hword lh; X } hh1; X struct { X hword rh; X qword b0; X qword b1; X } hh2; X} twoh; X Xtypedef struct { X qword b0; X qword b1; X qword b2; X qword b3; X} fourq; X Xtypedef union { X long i; X gratio gr; X twoh hh; X fourq qqqq; X} mword; X X/* X * variables in the outer block X */ X Xglobal char banner[]; Xglobal int ready_already; X X/* X * functions in the outer block X */ X Xint final_cleanup(); Xint close_files_and_terminate(); Xint initialize(); Xbool decode_args(); Xint handle_int(); X X/* X * some common programming idioms X */ X X#define incr(i) ++(i) X#define decr(i) --(i) X#define odd(i) ((i) & 1) X#define abs(i) ((i) >= 0 ? (i) : -(i)) X#define round(x) (long) ((x) > 0.0 ? ((x) + 0.5) : ((x) - 0.5)) X#define negate(x) (x) = -(x) X#define loop while (1) X\Rogue\Monster\ Xelse X echo "will not over write ./SMALL/INIT/tex.dos" Xfi Xif `test ! -d ./SMALL/VIR` Xthen X mkdir ./SMALL/VIR X echo "mkdir ./SMALL/VIR" Xfi Xif `test ! -s ./SMALL/VIR/Makefile` Xthen Xecho "writing ./SMALL/VIR/Makefile" Xcat > ./SMALL/VIR/Makefile << '\Rogue\Monster\' X# X# Pehong Chen, University of California, Berkeley (phc@renoir.berkeley.edu) X# X# modified for distribution, monardo@renoir.berkeley.edu X# X XVPATH = .. X XDEST = /usr/local X XMANDIR = /usr/man/manl X XMANUAL = X XHDRS = align.h \ X arith.h \ X box.h \ X boxlists.h \ X char.h \ X cmds.h \ X cond.h \ X def.h \ X dvi.h \ X eq.h \ X eqstack.h \ X error.h \ X eval.h \ X evalstack.h \ X expand.h \ X file.h \ X fmt.h \ X hash.h \ X heap.h \ X hyph.h \ X io.h \ X math.h \ X mathlists.h \ X mlist-hlist.h \ X pack.h \ X page.h \ X par.h \ X print.h \ X scan.h \ X str.h \ X tex.h \ X texext.h \ X tfm.h \ X token.h \ X tokenlists.h \ X tokenstack.h X X# Option for compiling SUN 68010 code with a 68020 CPU X68010CFLAGS = -m68010 -L/usr.MC68010/lib -Qpath /usr.MC68010/cstart X X# 16-bit word XCFLAGS = -O X#CFLAGS = -O -DINIT $(68010CFLAGS) X X# 32-bit word X#CFLAGS = -O -DINIT -DBIG X#CFLAGS = -O -DINIT -DBIG $(68010CFLAGS) X X# 64-bit word X#CFLAGS = -O -DINIT -DBIGG X#CFLAGS = -O -DINIT -DBIGG $(68010CFLAGS) X XLDFLAGS = $(CFLAGS) X XLIBS = X XLINKER = cc X XMAKEFILE = Makefile X XOBJS = align.o \ X arith.o \ X box.o \ X boxlists.o \ X char.o \ X cmds.o \ X cond.o \ X def.o \ X dvi.o \ X eq.o \ X eqstack.o \ X error.o \ X eval.o \ X evalstack.o \ X expand.o \ X file.o \ X fmt.o \ X hash.o \ X heap.o \ X hyph.o \ X io.o \ X math.o \ X mathlists.o \ X mlist-hlist.o \ X pack.o \ X page.o \ X par.o \ X print.o \ X scan.o \ X str.o \ X tex.o \ X texext.o \ X tfm.o \ X token.o \ X tokenlists.o \ X tokenstack.o X XPRINT = tgrind -c X XPROGRAM = virtex X XSRCS = align.c \ X arith.c \ X box.c \ X boxlists.c \ X char.c \ X cmds.c \ X cond.c \ X def.c \ X dvi.c \ X eq.c \ X eqstack.c \ X error.c \ X eval.c \ X evalstack.c \ X expand.c \ X file.c \ X fmt.c \ X hash.c \ X heap.c \ X hyph.c \ X io.c \ X math.c \ X mathlists.c \ X mlist-hlist.c \ X pack.c \ X page.c \ X par.c \ X print.c \ X scan.c \ X str.c \ X tex.c \ X texext.c \ X tfm.c \ X token.c \ X tokenlists.c \ X tokenstack.c X X$(PROGRAM): $(OBJS) X @rm -f $(PROGRAM) X $(LINKER) $(LDFLAGS) $(OBJS) $(LIBS) -o $(PROGRAM) X @size $(PROGRAM) X Xinstall: $(PROGRAM) X install -c -s -m 0755 $(PROGRAM) $(DEST) X @ls -lgs $(DEST)/$(PROGRAM) X Xclean:; @rm -f $(OBJS) core $(PROGRAM) *.out X Xdepend:; @rm -f .#*.[chly] X mkmf -f $(MAKEFILE) PROGRAM=$(PROGRAM) DEST=$(DEST) X Xindex:; @ctags -wx $(HDRS) $(SRCS) X Xprint:; @$(PRINT) $(HDRS) $(SRCS) X Xprogram: $(PROGRAM) X Xtags: $(HDRS) $(SRCS); @ctags $(HDRS) $(SRCS) X Xupdate: $(DEST)/$(PROGRAM) X X$(DEST)/$(PROGRAM): $(SRCS) $(HDRS) X @make -f $(MAKEFILE) DEST=$(DEST) install X X.DEFAULT:; X### Xalign.o: tex.h cmds.h heap.h arith.h eq.h eqstack.h hash.h \ X token.h tokenstack.h scan.h evalstack.h box.h pack.h math.h \ X mlist-hlist.h error.h align.h Xarith.o: tex.h print.h arith.h Xbox.o: tex.h texext.h arith.h heap.h char.h str.h \ X eq.h hash.h tfm.h print.h math.h box.h tokenlists.h Xboxlists.o: tex.h cmds.h heap.h eq.h eqstack.h def.h box.h \ X tokenstack.h token.h scan.h tokenlists.h evalstack.h tfm.h pack.h \ X page.h math.h io.h print.h error.h boxlists.h Xchar.o: tex.h char.h Xcmds.o: tex.h texext.h heap.h eq.h eqstack.h str.h \ X hash.h token.h tokenlists.h tokenstack.h scan.h evalstack.h def.h \ X cond.h expand.h box.h boxlists.h tfm.h math.h mathlists.h align.h \ X error.h print.h cmds.h Xcond.o: tex.h cmds.h heap.h box.h eq.h eqstack.h hash.h \ X token.h tokenlists.h scan.h tokenstack.h evalstack.h file.h print.h \ X error.h cond.h Xdef.o: tex.h cmds.h heap.h io.h eq.h hash.h eqstack.h \ X evalstack.h token.h scan.h tokenstack.h expand.h arith.h str.h \ X box.h boxlists.h tokenlists.h file.h tfm.h dvi.h page.h print.h \ X error.h def.h Xdvi.o: tex.h texext.h heap.h str.h io.h eq.h box.h \ X scan.h tfm.h file.h pack.h print.h error.h dvi.h Xeq.o: tex.h cmds.h heap.h char.h hash.h box.h print.h \ X error.h eq.h Xeqstack.o: tex.h cmds.h heap.h eq.h token.h tokenstack.h \ X tokenlists.h print.h error.h eqstack.h Xerror.o: tex.h tokenstack.h token.h eq.h io.h print.h \ X error.h str.h Xeval.o: tex.h cmds.h heap.h char.h tfm.h eq.h eqstack.h \ X hash.h token.h scan.h tokenstack.h evalstack.h box.h boxlists.h \ X math.h mathlists.h cond.h def.h dvi.h pack.h page.h par.h print.h \ X error.h eval.h Xevalstack.o: tex.h cmds.h heap.h tokenstack.h eq.h box.h \ X page.h print.h error.h evalstack.h Xexpand.o: tex.h cmds.h heap.h io.h eq.h hash.h box.h \ X tokenstack.h scan.h token.h tokenlists.h cond.h file.h print.h \ X error.h expand.h Xfile.o: tex.h cmds.h heap.h char.h eq.h token.h scan.h \ X tokenstack.h str.h fmt.h io.h print.h error.h file.h Xfmt.o: tex.h texext.h heap.h token.h eq.h box.h \ X eqstack.h hash.h file.h tfm.h str.h hyph.h io.h print.h error.h \ X fmt.h Xhash.o: tex.h cmds.h heap.h box.h scan.h eq.h io.h math.h \ X boxlists.h str.h error.h hash.h Xheap.o: tex.h eq.h arith.h box.h token.h tokenlists.h \ X evalstack.h par.h page.h print.h error.h heap.h Xhyph.o: tex.h cmds.h heap.h token.h eq.h str.h tfm.h \ X box.h scan.h tokenstack.h par.h print.h error.h hyph.h Xio.o: tex.h char.h tokenstack.h print.h io.h Xmath.o: tex.h heap.h eq.h scan.h evalstack.h arith.h \ X str.h box.h tfm.h print.h pack.h math.h Xmathlists.o: tex.h cmds.h heap.h arith.h eq.h eqstack.h \ X evalstack.h token.h tokenstack.h scan.h tfm.h box.h pack.h math.h \ X mlist-hlist.h par.h page.h print.h error.h mathlists.h Xmlist-hlist.o: tex.h heap.h arith.h scan.h eq.h box.h math.h \ X pack.h tfm.h print.h error.h mlist-hlist.h Xpack.o: tex.h heap.h arith.h scan.h tokenstack.h eq.h \ X eqstack.h evalstack.h box.h tfm.h dvi.h print.h error.h pack.h Xpage.o: tex.h heap.h arith.h tokenstack.h tokenlists.h \ X eq.h eqstack.h evalstack.h scan.h expand.h box.h pack.h par.h math.h \ X dvi.h print.h error.h page.h Xpar.o: tex.h heap.h arith.h eq.h tfm.h tokenstack.h \ X evalstack.h box.h pack.h hyph.h print.h error.h par.h Xprint.o: tex.h texext.h eq.h char.h str.h io.h print.h Xscan.o: tex.h cmds.h heap.h arith.h eq.h token.h \ X tokenstack.h evalstack.h char.h str.h box.h expand.h tfm.h dvi.h \ X print.h error.h page.h scan.h Xstr.o: tex.h io.h file.h error.h str.h Xtex.o: tex.h texext.h cmds.h heap.h char.h str.h eq.h \ X hash.h evalstack.h eqstack.h tokenstack.h token.h box.h pack.h cond.h \ X io.h file.h tfm.h hyph.h dvi.h fmt.h error.h print.h page.h Xtexext.o: tex.h cmds.h heap.h eq.h hash.h token.h box.h \ X scan.h def.h tokenstack.h tokenlists.h evalstack.h io.h str.h \ X file.h dvi.h print.h error.h texext.h Xtfm.o: tex.h cmds.h heap.h arith.h eq.h hash.h box.h \ X scan.h token.h tokenstack.h io.h file.h print.h error.h tfm.h Xtoken.o: tex.h cmds.h heap.h eq.h hash.h scan.h io.h \ X char.h box.h cond.h print.h error.h expand.h align.h tokenstack.h \ X token.h Xtokenlists.o: tex.h cmds.h heap.h eq.h hash.h str.h box.h \ X token.h expand.h tokenstack.h io.h scan.h def.h file.h tfm.h print.h \ X error.h tokenlists.h Xtokenstack.o: tex.h cmds.h heap.h eq.h def.h char.h io.h \ X token.h tokenlists.h box.h print.h error.h tokenstack.h X\Rogue\Monster\ Xelse X echo "will not over write ./SMALL/VIR/Makefile" Xfi Xif `test ! -s ./SMALL/VIR/virtex.lnk` Xthen Xecho "writing ./SMALL/VIR/virtex.lnk" Xcat > ./SMALL/VIR/virtex.lnk << '\Rogue\Monster\' XCHAR.OBJ+ XIO.OBJ+ XSTR.OBJ+ XPRINT.OBJ+ XERROR.OBJ+ XARITH.OBJ+ XHEAP.OBJ+ XBOX.OBJ+ XCMDS.OBJ+ XEVALSTAC.OBJ+ XEQ.OBJ+ XHASH.OBJ+ XEQSTACK.OBJ+ XTOKENSTA.OBJ+ XTOKEN.OBJ+ XEXPAND.OBJ+ XSCAN.OBJ+ XTOKENLIS.OBJ+ XCOND.OBJ+ XFILE.OBJ+ XTFM.OBJ+ XDVI.OBJ+ XPACK.OBJ+ XMATH.OBJ+ XMLIST-HL.OBJ+ XALIGN.OBJ+ XPAR.OBJ+ XHYPH.OBJ+ XPAGE.OBJ+ XEVAL.OBJ+ XBOXLISTS.OBJ+ XMATHLIST.OBJ+ XDEF.OBJ+ XFMT.OBJ+ XTEX.OBJ+ XTEXEXT.OBJ XVIRTEX.EXE/EXEPACK; X\Rogue\Monster\ Xelse X echo "will not over write ./SMALL/VIR/virtex.lnk" Xfi Xif `test ! -s ./SMALL/VIR/make.bat` Xthen Xecho "writing ./SMALL/VIR/make.bat" Xcat > ./SMALL/VIR/make.bat << '\Rogue\Monster\' Xcl -c -M2l -DDOS ..\CHAR.C >> errs Xcl -c -M2l -DDOS ..\IO.C >> errs Xcl -c -M2l -DDOS ..\STR.C >> errs Xcl -c -M2l -DDOS ..\PRINT.C >> errs Xcl -c -M2l -DDOS ..\ERROR.C >> errs Xcl -c -M2l -DDOS ..\ARITH.C >> errs Xcl -c -M2l -DDOS ..\HEAP.C >> errs Xcl -c -M2l -DDOS ..\BOX.C >> errs Xcl -c -M2l -Od -DDOS ..\CMDS.C > errs Xcl -c -M2l -DDOS ..\EVALSTAC.C >> errs Xcl -c -M2l -DDOS ..\EQ.C >> errs Xcl -c -M2l -DDOS ..\HASH.C >> errs Xcl -c -M2l -DDOS ..\EQSTACK.C >> errs Xcl -c -M2l -DDOS ..\TOKENSTA.C >> errs Xcl -c -M2l -Od -DDOS ..\TOKEN.C >> errs Xcl -c -M2l -DDOS ..\EXPAND.C >> errs Xcl -c -M2l -DDOS ..\SCAN.C >> errs Xcl -c -M2l -DDOS ..\TOKENLIS.C >> errs Xcl -c -M2l -DDOS ..\COND.C >> errs Xcl -c -M2l -DDOS ..\FILE.C >> errs Xcl -c -M2l -DDOS ..\TFM.C >> errs Xcl -c -M2l -DDOS ..\DVI.C >> errs Xcl -c -M2l -DDOS ..\PACK.C >> errs Xcl -c -M2l -DDOS ..\MATH.C >> errs Xcl -c -M2l -DDOS ..\MLIST-HL.C >> errs Xcl -c -M2l -DDOS ..\ALIGN.C >> errs Xcl -c -M2l -DDOS ..\PAR.C >> errs Xcl -c -M2l -DDOS ..\HYPH.C >> errs Xcl -c -M2l -DDOS ..\PAGE.C >> errs Xcl -c -M2l -DDOS ..\EVAL.C >> errs Xcl -c -M2l -DDOS ..\BOXLISTS.C >> errs Xcl -c -M2l -DDOS ..\MATHLIST.C >> errs Xcl -c -M2l -DDOS ..\DEF.C >> errs Xcl -c -M2l -DDOS ..\FMT.C >> errs Xcl -c -M2l -DDOS ..\TEX.C >> errs Xcl -c -M2l -DDOS ..\TEXEXT.C >> errs Xlink @virtex.lnk >> errs X\Rogue\Monster\ Xelse X echo "will not over write ./SMALL/VIR/make.bat" Xfi Xif `test ! -s ./SMALL/VIR/errs` Xthen Xecho "writing ./SMALL/VIR/errs" Xcat > ./SMALL/VIR/errs << '\Rogue\Monster\' Xcc -O -c ../align.c X\Rogue\Monster\ Xelse X echo "will not over write ./SMALL/VIR/errs" Xfi Xecho "Finished archive 1 of 1" Xexit SHAR_EOF chmod 0444 SMALL.shr1 || echo "restore of SMALL.shr1 fails" set `wc -c SMALL.shr1`;Sum=$1 if test "$Sum" != "25015" then echo original size 25015, current size $Sum;fi echo "x - extracting align.c (Text)" sed 's/^X//' << 'SHAR_EOF' > align.c && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * align.c X */ X X#include "tex.h" X#include "cmds.h" X#include "heap.h" X#include "arith.h" X#include "eq.h" X#include "eqstack.h" X#include "hash.h" X#include "token.h" X#include "tokenstack.h" X#include "scan.h" X#include "evalstack.h" X#include "box.h" X#include "pack.h" X#include "math.h" X#include "mlist-hlist.h" X#include "error.h" X#include "align.h" X Xptr align_ptr; X Xptr cur_align; Xptr cur_span; Xptr cur_loop; Xptr cur_head; Xptr cur_tail; X Xpush_alignment () X{ X ptr p; X X p = get_node(ALIGN_STACK_NODE_SIZE); X link(p) = align_ptr; X info(p) = cur_align; X llink(p) = preamble; X rlink(p) = cur_span; X mem[p + 2].i = cur_loop; X mem[p + 3].i = align_state; X info(p + 4) = cur_head; X link(p + 4) = cur_tail; X align_ptr = p; X cur_head = get_avail(); X} X Xpop_alignment () X{ X ptr p; X X free_avail(cur_head); X p = align_ptr; X cur_tail = link(p + 4); X cur_head = info(p + 4); X align_state = mem[p + 3].i; X cur_loop = mem[p + 2].i; X cur_span = rlink(p); X preamble = llink(p); X cur_align = info(p); X align_ptr = link(p); X free_node(p, ALIGN_STACK_NODE_SIZE); X} X Xinit_align () X{ X ptr p; X ptr save_cs_ptr; X X save_cs_ptr = cur_cs; X push_alignment(); X align_state = -1000000; X if (mode == MMODE && (tail != head || incompleat_noad != NULL)) { X print_err("Improper "); X print_esc("halign"); X print(" inside $$'s"); X help_display_align(); X error(); X flush_math(); X } X push_nest(); X if (mode == MMODE) { X mode = -VMODE; X prev_depth = nest[nest_ptr - 2].aux_field; X } else if (mode > 0) X negate(mode); X scan_spec(); X new_save_level(ALIGN_GROUP); X preamble = NULL; X cur_align = align_head; X cur_loop = NULL; X scanner_status = ALIGNING; X warning_index = save_cs_ptr; X align_state = -1000000; X loop { X link(cur_align) = new_param_glue(TAB_SKIP_CODE); X cur_align = link(cur_align); X if (cur_cmd == CAR_RET) X break; X p = align_tokens; X token_link(p) = NULL; X loop { X get_preamble_token(); X if (cur_cmd == MAC_PARAM) X break; X if (cur_cmd <= CAR_RET && X cur_cmd >= TAB_MARK && X align_state == -1000000) { X if (p == align_tokens && X cur_loop == NULL && X cur_cmd == TAB_MARK) { X cur_loop = cur_align; X } else { X print_err("Missing # inserted in alignment preamble"); X help_preamble_missing(); X back_error(); X break; X } X } else if (cur_cmd != SPACER || p != align_tokens) { X token_link(p) = new_token(); X p = token_link(p); X token(p) = cur_tok; X } X } X link(cur_align) = new_null_box(); X cur_align = link(cur_align); X info(cur_align) = end_span; X width(cur_align) = NULL_FLAG; X u_part(cur_align) = token_link(align_tokens); X p = align_tokens; X token_link(p) = NULL; X loop { X get_preamble_token(); X if (cur_cmd <= CAR_RET && X cur_cmd >= TAB_MARK && X align_state == -1000000) X break; X if (cur_cmd == MAC_PARAM) { X print_err("Only one # is allowed per tab"); X help_preamble_many(); X error(); X continue; X } X token_link(p) = new_token(); X p = token_link(p); X token(p) = cur_tok; X } X token_link(p) = new_token(); X p = token_link(p); X token(p) = END_TEMPLATE_TOKEN; X v_part(cur_align) = token_link(align_tokens); X } X scanner_status = NORMAL; X new_save_level(ALIGN_GROUP); X if (every_cr != NULL) X begin_token_list(every_cr, EVERY_CR_TEXT); X align_peek(); X} X Xget_preamble_token () X{ Xrestart: X get_token(); X while (cur_chr == SPAN_CODE && cur_cmd == TAB_MARK) { X get_token(); X if (cur_cmd > MAX_COMMAND) { X expand(); X get_token(); X } X } X if (cur_cmd == ASSIGN_GLUE && cur_chr == GLUE_BASE + TAB_SKIP_CODE) { X scan_optional_equals(); X scan_glue(GLUE_VAL); X if (global_defs > 0) X geq_define(GLUE_BASE + TAB_SKIP_CODE, GLUE_REF, (ptr) cur_val); X else eq_define(GLUE_BASE + TAB_SKIP_CODE, GLUE_REF, (ptr) cur_val); X goto restart; X } X} X Xalign_peek () X{ Xrestart: X align_state = 1000000; X get_nbx_token(); X if (cur_cmd == NO_ALIGN) { X scan_left_brace(); X new_save_level(NO_ALIGN_GROUP); X if (mode == -VMODE) X normal_paragraph(); X } else if (cur_cmd == RIGHT_BRACE) X fin_align(); X else if (cur_cmd == CAR_RET && cur_chr == CR_CR_CODE) X goto restart; X else { X init_row(); X init_col(); X } X} X Xinit_row() X{ X push_nest(); X mode = (-HMODE - VMODE) - mode; X aux = 0; X tail_append(new_glue(glue_ptr(preamble))); X subtype(tail) = TAB_SKIP_CODE + 1; X cur_align = link(preamble); X cur_tail = cur_head; X init_span(cur_align); X} X Xinit_span (p) X ptr p; X{ X push_nest(); X if (mode == -HMODE) X space_factor = 1000; X else { X prev_depth = IGNORE_DEPTH; X normal_paragraph(); X } X cur_span = p; X} X Xinit_col () X{ X extra_info(cur_align) = cur_cmd; X if (cur_cmd == OMIT) X align_state = 0; X else { X back_input(); X begin_token_list((ptr) u_part(cur_align), (qword) U_TEMPLATE); X } X} X Xbool Xfin_col () X{ X hword n; X gord o; X ptr p; X ptr q; X ptr r; X ptr s; X ptr u; X scal w; X X q = link(cur_align); X if (cur_align == NULL || q == NULL) X confusion("endv"); X p = link(q); X if (p == NULL && extra_info(cur_align) < CR_CODE) { X if (cur_loop != NULL) { X link(q) = new_null_box(); X p = link(q); X info(p) = end_span; X width(p) = NULL_FLAG; X cur_loop = link(cur_loop); X q = align_tokens; X r = u_part(cur_loop); X while (r != NULL) { X token_link(q) = new_token(); X q = token_link(q); X token(q) = token(r); X r = token_link(r); X } X token_link(q) = NULL; X u_part(p) = token_link(align_tokens); X q = align_tokens; X r = v_part(cur_loop); X while (r != NULL) { X token_link(q) = new_token(); X q = token_link(q); X token(q) = token(r); X r = token_link(r); X } X token_link(q) = NULL; X v_part(p) = token_link(align_tokens); X cur_loop = link(cur_loop); X link(p) = new_glue(glue_ptr(cur_loop)); X } else { X print_err("Extra alignment tab has been changed to "); X print_esc("cr"); X help_align_apply(); X extra_info(cur_align) = CR_CODE; X error(); X } X } X if (extra_info(cur_align) != SPAN_CODE) { X unsave(); X new_save_level(ALIGN_GROUP); X if (mode == -HMODE) { X adjust_tail = cur_tail; X u = hpack(link(head), NATURAL); X w = width(u); X cur_tail = adjust_tail; X adjust_tail = NULL; X } else { X u = vpackage(link(head), NATURAL, 0L); X w = height(u); X } X n = MIN_QUARTERWORD; X if (cur_span != cur_align) { X q = cur_span; X do { X incr(n); X q = link(link(q)); X } while (q != cur_align); X if (n > MAX_QUARTERWORD) X confusion("256 spans"); X q = cur_span; X while (link(info(q)) < n) X q = info(q); X if (link(info(q)) > n) { X s = get_node(SPAN_NODE_SIZE); X info(s) = info(q); X link(s) = n; X info(q) = s; X width(s) = w; X } else if (width(info(q)) < w) X width(info(q)) = w; X } else if (w > width(cur_align)) X width(cur_align) = w; X type(u) = UNSET_NODE; X span_count(u) = n; X get_stretch_order(); X glue_order(u) = o; X glue_stretch(u) = total_stretch[o]; X get_shrink_order(); X glue_sign(u) = o; X glue_shrink(u) = total_shrink[o]; X pop_nest(); X link(tail) = u; X tail = u; X tail_append(new_glue(glue_ptr(link(cur_align)))); X subtype(tail) = TAB_SKIP_CODE + 1; X if (extra_info(cur_align) >= CR_CODE) X return TRUE; X init_span(p); X } X align_state = 1000000; X get_nbx_token(); X cur_align = p; X init_col(); X return FALSE; X} X Xfin_row () X{ X ptr p; X X if (mode == -HMODE) { X p = hpack(link(head), NATURAL); X pop_nest(); X append_to_vlist(p); X if(cur_head != cur_tail) { X link(tail) = link(cur_head); X tail = cur_tail; X } X } else { X p = vpack(link(head), NATURAL); X pop_nest(); X link(tail) = p; X tail = p; X space_factor = 1000; X } X type(p) = UNSET_NODE; X glue_stretch(p) = 0; X if (every_cr != NULL) X begin_token_list(every_cr, EVERY_CR_TEXT); X align_peek(); X} X Xfin_align () X{ X hword n; X scal o; X ptr p; X ptr q; X ptr r; X ptr s; X scal t; X ptr u; X ptr v; X scal w; X scal rule_save; X X if (cur_group != ALIGN_GROUP) X confusion("align1"); X unsave(); X if (cur_group != ALIGN_GROUP) X confusion("align0"); X unsave(); X if (nest[nest_ptr - 1].mode_field == MMODE) X o = display_indent; X else o = 0; X q = link(preamble); X do { X flush_list((ptr) u_part(q)); X flush_list((ptr) v_part(q)); X p = link(link(q)); X if (width(q) == NULL_FLAG) { X width(q) = 0; X r = link(q); X s = glue_ptr(r); X if (s != zero_glue) { X add_glue_ref(zero_glue); X delete_glue_ref(s); X glue_ptr(r) = zero_glue; X } X } X if (info(q) != end_span) { X t = width(q) + width(glue_ptr(link(q))); X r = info(q); X s = end_span; X info(s) = p; X n = MIN_QUARTERWORD + 1; X do { X width(r) -= t; X u = info(r); X while (link(r) > n) { X s = info(s); X n = link(info(s)) + 1; X } X if (link(r) < n) { X info(r) = info(s); X info(s) = r; X decr(link(r)); X s = r; X } else { X if (width(r) > width(info(s))) X width(info(s)) = width(r); X free_node(r, SPAN_NODE_SIZE); X } X r = u; X } while (r != end_span); X } X type(q) = UNSET_NODE; X span_count(q) = MIN_QUARTERWORD; X height(q) = 0; X depth(q) = 0; X glue_order(q) = NORMAL; X glue_sign(q) = NORMAL; X glue_stretch(q) = 0; X glue_shrink(q) = 0; X q = p; X } while (q != NULL); X save_ptr -= 2; X pack_begin_line = -mode_line; X if (mode == -VMODE) { X rule_save = overfull_rule; X overfull_rule = 0; X p = hpack(preamble, saved(1), (int) saved(0)); X overfull_rule = rule_save; X } else { X q = link(preamble); X do { X height(q) = width(q); X width(q) = 0; X q = link(link(q)); X } while (q != NULL); X p = vpackage(preamble, saved(1), (int) saved(0), MAX_DIMEN); X q = link(preamble); X do { X width(q) = height(q); X height(q) = 0; X q = link(link(q)); X } while (q != NULL); X } X pack_begin_line = 0; X for (q = link(head); q != NULL; q = link(q)) { X if (type(q) == UNSET_NODE) { X if (mode == -VMODE) { X type(q) = HLIST_NODE; X width(q) = width(p); X } else { X type(q) = VLIST_NODE; X height(q) = height(p); X } X glue_order(q) = glue_order(p); X glue_sign(q) = glue_sign(p); X glue_set(q) = glue_set(p); X shift_amount(q) = o; X r = link(list_ptr(q)); X s = link(list_ptr(p)); X do { X n = span_count(r); X t = width(s); X w = t; X u = hold_head; X while (n > MIN_QUARTERWORD) { X decr(n); X s = link(s); X v = glue_ptr(s); X link(u) = new_glue(v); X u = link(u); X subtype(u) = TAB_SKIP_CODE + 1; X t += width(v); X if (glue_sign(p) == STRETCHING) X if (stretch_order(v) == glue_order(p)) X t += round(glue_set(p) * stretch(v)); X else if (glue_sign(p) == SHRINKING) X if (shrink_order(v) == glue_order(p)) X t -= round(glue_set(p) * shrink(v)); X s = link(s); X link(u) = new_null_box(); X u = link(u); X t += width(s); X if (mode == -VMODE) X width(u) = width(s); X else { X type(u) = VLIST_NODE; X height(u) = width(s); X } X } X if (mode == -VMODE) { X height(r) = height(q); X depth(r) = depth(q); X if (t == width(r)) { X glue_sign(r) = NORMAL; X glue_order(r) = NORMAL; X glue_set(r) = 0.0; X } else if (t > width(r)) { X glue_sign(r) = STRETCHING; X if (glue_stretch(r) == 0) X glue_set(r) = 0.0; X else glue_set(r) = X (float) (t - width(r)) / glue_stretch(r); X } else { X glue_order(r) = glue_sign(r); X glue_sign(r) = SHRINKING; X if (glue_shrink(r) == 0) X glue_set(r) = 0.0; X else if (glue_order(r) == NORMAL && X width(r) - t > glue_shrink(r)) X glue_set(r) = 1.0; X else glue_set(r) = X (float)(width(r) - t) / glue_shrink(r); X } X width(r) = w; X type(r) = HLIST_NODE; X } else { X width(r) = width(q); X if (t == height(r)) { X glue_sign(r) = NORMAL; X glue_order(r) = NORMAL; X glue_set(r) = 0.0; X } else if (t > height(r)) { X glue_sign(r) = STRETCHING; X if (glue_stretch(r) == 0) X glue_set(r) = 0.0; X else glue_set(r) = X (float) (t - height(r)) / glue_stretch(r); X } else { X glue_order(r) = glue_sign(r); X glue_sign(r) = SHRINKING; X if (glue_shrink(r) == 0) X glue_set(r) = 0.0; X else if (glue_order(r) == NORMAL && X height(r) - t > glue_shrink(r)) X glue_set(r) = 1.0; X else glue_set(r) = X (float) (height(r) - t) / glue_shrink(r); X } X height(r) = w; X type(r) = VLIST_NODE; X } X shift_amount(r) = 0; X if (u != hold_head) { X link(u) = link(r); X link(r) = link(hold_head); X r = u; X } X r = link(link(r)); X s = link(link(s)); X } while (r != NULL); X } else if (type(q) == RULE_NODE) { X if (is_running(width(q))) X width(q) = width(p); X if (is_running(height(q))) X height(q) = height(p); X if (is_running(depth(q))) X depth(q) = depth(p); X } X } X flush_node_list(p); X pop_alignment(); X t = aux; X p = link(head); X q = tail; X pop_nest(); X if (mode == MMODE) { X do_assignments(); X if (cur_cmd != MATH_SHIFT) { X print_err("Missing $$ inserted"); X help_display_align(); X back_error(); X } else { X get_x_token(); X if (cur_cmd != MATH_SHIFT) { X print_err("Display math should end with $$"); X help_display(); X back_error(); X } X } X pop_nest(); X tail_append(new_penalty(pre_display_penalty)); X tail_append(new_param_glue(ABOVE_DISPLAY_SKIP_CODE)); X link(tail) = p; X if (p != NULL) X tail = q; X tail_append(new_penalty(post_display_penalty)); X tail_append(new_param_glue(BELOW_DISPLAY_SKIP_CODE)); X prev_depth = t; X resume_after_display(); X } else { X aux = t; X link(tail) = p; X if (p != NULL) X tail = q; X if (mode == VMODE) X build_page(); X } X} X X/* X * Help text X */ X Xhelp_display_align () X{ X help3("Displays can use special alignments (like \\eqalignno)", X "only if nothing but the alignment itself is between $$'s.", X "So I've deleted the formulas that preceded this alignment."); X} X Xhelp_preamble_missing () X{ X help3("There should be exactly one # between &'s, when an", X "\\halign or \\valign is being set up. In this case you had", X "none, so I've put one in; maybe that will work."); X} X Xhelp_preamble_many () X{ X help3("There should be exactly one # between &'s, when an", X "\\halign or \\valign is being set up. In this case you had", X "more than one, so I'm ignoring all but the first."); X} X Xhelp_align_apply () X{ X help3("You have given more \\span or & marks than there were", X "in the preamble to the \\halign or \\valign now in progress.", X "So I'll assume that you meant to type \\cr instead."); X} X Xhelp_display () X{ X help2("The `$' that I just saw supposedly matches a previous `$$'.", X "So I shall assume that you typed `$$' both times."); X} SHAR_EOF chmod 0444 align.c || echo "restore of align.c fails" set `wc -c align.c`;Sum=$1 if test "$Sum" != "14594" then echo original size 14594, current size $Sum;fi echo "x - extracting align.h (Text)" sed 's/^X//' << 'SHAR_EOF' > align.h && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * align.h X */ X Xint push_alignment(); Xint pop_alignment(); X X#define ALIGN_STACK_NODE_SIZE 5 X X#define u_part(A) mem[A + HEIGHT_OFFSET].i X#define v_part(A) mem[A + DEPTH_OFFSET].i X#define extra_info(A) info(A + LIST_OFFSET) X X#define SPAN_CODE 128 X#define CR_CODE 129 X#define CR_CR_CODE CR_CODE + 1 X X#define SPAN_NODE_SIZE 2 X X#define preamble link(align_head) X Xglobal ptr cur_align; Xglobal ptr cur_span; Xglobal ptr cur_loop; Xglobal ptr cur_head; Xglobal ptr cur_tail; Xglobal ptr align_ptr; X Xint init_align(); Xint get_preamble_token(); Xint align_peek(); Xint init_row(); Xint init_span(); Xint init_col(); Xbool fin_col(); Xint fin_row(); Xint fin_align(); SHAR_EOF chmod 0444 align.h || echo "restore of align.h fails" set `wc -c align.h`;Sum=$1 if test "$Sum" != "902" then echo original size 902, current size $Sum;fi echo "x - extracting arith.c (Text)" sed 's/^X//' << 'SHAR_EOF' > arith.c && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * arith.c X */ X X#include "tex.h" X#include "print.h" X#include "arith.h" X Xbool arith_error; Xscal remainder; X Xval Xhalf (x) X val x; X{ X return (odd(x) ? (x + 1) / 2 : x / 2); X} X X Xscal Xround_decimals (k) X int k; X{ X val a; X X a = 0; X while (k > 0) { X decr(k); X a = (a + dig[k] * TWO) / 10; X } X return ((a + 1) / 2); X} X Xprint_scaled (s) X scal s; X{ X scal delta; X X if (s < 0) { X print_char('-'); X negate(s); X } X print_val(s / UNITY); X print_char('.'); X s = 10 * (s % UNITY) + 5; X delta = 10; X do { X if (delta > UNITY) X s += 0100000 - (delta / 2); X print_char('0' + s / UNITY); X s = 10 * (s % UNITY); X delta *= 10; X } while (s > delta); X} X Xscal Xnx_plus_y (n, x, y) X val n; X scal x; X scal y; X{ X if (n < 0) { X negate(x); X negate(n); X } X if (n == 0) X return y; X else if (x <= (07777777777 - y) / n && X -x <= (07777777777 + y) / n) X return (n * x + y); X else { X arith_error = TRUE; X return 0; X } X} X Xscal Xx_over_n (x, n) SHAR_EOF echo "End of part 2" echo "File arith.c is continued in part 3" echo "3" > s2_seq_.tmp exit 0
glenn@extro.ucc.su.oz.au (G Geers) (02/16/90)
---- Cut Here and unpack ---- #!/bin/sh # this is part 3 of a multipart archive # do not concatenate these parts, unpack them in order with /bin/sh # file arith.c continued # CurArch=3 if test ! -r s2_seq_.tmp then echo "Please unpack part 1 first!" exit 1; fi ( read Scheck if test "$Scheck" != $CurArch then echo "Please unpack part $Scheck next!" exit 1; else exit 0; fi ) < s2_seq_.tmp || exit 1 echo "x - Continuing file arith.c" sed 's/^X//' << 'SHAR_EOF' >> arith.c X scal x; X val n; X{ X bool negative; X scal quotient; X X negative = FALSE; X if (n == 0) { X arith_error = TRUE; X remainder = x; X return 0; X } X if (n < 0) { X negate(x); X negate(n); X negative = TRUE; X } X if (x >= 0) { X quotient = x / n; X remainder = x % n; X } else { X quotient = -(-x / n); X remainder = -(-x % n); X } X if (negative) X negate(remainder); X return quotient; X} X Xscal Xxn_over_d (x, n, d) X scal x; X val n; X val d; X{ X val t; X val u; X val v; X bool positive; X X if (x >= 0) X positive = TRUE; X else { X negate(x); X positive = FALSE; X } X t = (x % 0100000) * n; X u = (x / 0100000) * n + (t / 0100000); X v = (u % d) * 0100000 + (t % 0100000); X if (u / d >= 0100000) X arith_error = TRUE; X else u = 0100000 * (u / d) + (v / d); X if (positive) { X remainder = v % d; X return u; X } else { X remainder = - (v % d); X return -u; X } X} X Xhword Xbadness (t, s) X scal t; X scal s; X{ X val r; X X if (t == 0) X return 0; X else if (s <= 0) X return INF_BAD; X else { X if (t <= 7230584) X r = (t * 297) / s; X else if (s >= 1663497) X r = t / (s / 297); X else r = t; X if (r > 1290) X return INF_BAD; X else return ((r * r * r + 0400000) / 01000000); X } X} SHAR_EOF echo "File arith.c is complete" chmod 0444 arith.c || echo "restore of arith.c fails" set `wc -c arith.c`;Sum=$1 if test "$Sum" != "2301" then echo original size 2301, current size $Sum;fi echo "x - extracting arith.h (Text)" sed 's/^X//' << 'SHAR_EOF' > arith.h && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * arith.h X */ X X#define UNITY 0200000 X#define TWO 0400000 X Xval half(); Xscal round_decimals(); Xint print_scaled(); X Xglobal bool arith_error; Xglobal scal remainder; X Xscal nx_plus_y(); Xscal x_over_n(); Xscal xn_over_d(); X X#define INF_BAD 10000 X Xhword badness(); SHAR_EOF chmod 0444 arith.h || echo "restore of arith.h fails" set `wc -c arith.h`;Sum=$1 if test "$Sum" != "485" then echo original size 485, current size $Sum;fi echo "x - extracting box.c (Text)" sed 's/^X//' << 'SHAR_EOF' > box.c && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * box.c X */ X X#include "tex.h" X#include "texext.h" X#include "arith.h" X#include "heap.h" X#include "char.h" X#include "str.h" X#include "eq.h" X#include "hash.h" X#include "tfm.h" X#include "print.h" X#include "math.h" X#include "box.h" X#include "token.h" X#include "tokenlists.h" X Xval depth_threshold; Xval breadth_max; Xfnt font_in_short_display; X Xptr Xnew_null_box () X{ X ptr p; X X p = get_node(BOX_NODE_SIZE); X type(p) = HLIST_NODE; X subtype(p) = MIN_QUARTERWORD; X width(p) = 0; X depth(p) = 0; X height(p) = 0; X shift_amount(p) = 0; X list_ptr(p) = NULL; X glue_sign(p) = NORMAL; X glue_order(p) = NORMAL; X glue_set(p) = 0.0; X X return p; X} X Xptr Xnew_rule () X{ X ptr p; X X p = get_node(RULE_NODE_SIZE); X type(p) = RULE_NODE; X subtype(p) = 0; X width(p) = NULL_FLAG; X depth(p) = NULL_FLAG; X height(p) = NULL_FLAG; X X return p; X} X Xptr Xnew_ligature (f, c, q) X qword f; X qword c; X ptr q; X{ X ptr p; X X p = get_node(SMALL_NODE_SIZE); X type(p) = LIGATURE_NODE; X subtype(p) = 0; X font(lig_char(p)) = f; X character(lig_char(p)) = c; X lig_ptr(p) = q; X X return p; X} X Xptr Xnew_disc () X{ X ptr p; X X p = get_node(SMALL_NODE_SIZE); X type(p) = DISC_NODE; X replace_count(p) = 0; X pre_break(p) = NULL; X post_break(p) = NULL; X X return p; X} X Xptr Xnew_math (w, s) X scal w; X int s; X{ X ptr p; X X p = get_node(SMALL_NODE_SIZE); X type(p) = MATH_NODE; X subtype(p) = s; X width(p) = w; X X return p; X} X Xptr Xnew_spec (p) X ptr p; X{ X ptr q; X X q = get_node(GLUE_SPEC_SIZE); X mem[q] = mem[p]; X glue_ref_count(q) = NULL; X width(q) = width(p); X stretch(q) = stretch(p); X shrink(q) = shrink(p); X X return q; X} X Xptr Xnew_param_glue (n) X int n; X{ X ptr p; X ptr q; X X p = get_node(SMALL_NODE_SIZE); X type(p) = GLUE_NODE; X subtype(p) = n + 1; X leader_ptr(p) = NULL; X q = glue_par(n); X glue_ptr(p) = q; X incr(glue_ref_count(q)); X X return p; X} X Xptr Xnew_glue (q) X ptr q; X{ X ptr p; X X p = get_node(SMALL_NODE_SIZE); X type(p) = GLUE_NODE; X subtype(p) = NORMAL; X leader_ptr(p) = NULL; X glue_ptr(p) = q; X incr(glue_ref_count(q)); X X return p; X} X Xptr Xnew_skip_param (n) X int n; X{ X ptr p; X X temp_ptr = new_spec(glue_par(n)); X p = new_glue(temp_ptr); X glue_ref_count(temp_ptr) = NULL; X subtype(p) = n + 1; X X return p; X} X Xptr Xnew_kern (w) X scal w; X{ X ptr p; X X p = get_node(SMALL_NODE_SIZE); X type(p) = KERN_NODE; X subtype(p) = NORMAL; X width(p) = w; X X return p; X} X Xptr Xnew_penalty (m) X val m; X{ X ptr p; X X p = get_node(SMALL_NODE_SIZE); X type(p) = PENALTY_NODE; X subtype(p) = 0; X penalty(p) = m; X X return p; X} X Xprint_font_and_char (p) X ptr p; X{ X if (p > mem_end) X print_esc("CLOBBERED."); X else { X if (font(p) < FONT_BASE || font(p) > FONT_MAX) X print_char('*'); X else { X print_esc(""); X print_str(font_id_text(font(p))); X print_char(' '); X print_ASCII(qo(character(p))); X } X } X} X Xprint_mark (p) X ptr p; X{ X print_char('{'); X if (p < 0 || p > tok_end) X print_esc("CLOBBERED."); X else show_token_list(token_link(p), NULL, (val) MAX_PRINT_LINE - 10); X print_char('}'); X} X Xprint_rule_dimen (d) X scal d; X{ X if (is_running(d)) X print_char('*'); X else print_scaled(d); X} X Xprint_glue (d, o, s) X scal d; X qword o; X char* s; X{ X print_scaled(d); X if (o < NORMAL || o > FILLL) X print("foul"); X else if (o > NORMAL) { X print("fil"); X while (o > FIL) { X print_char('l'); X decr(o); X } X } else if (s) X print(s); X} X Xprint_spec (p, s) X ptr p; X char* s; X{ X if (p < MEM_MIN || p >= hi_mem_min) X print_char('*'); X else { X print_scaled(width(p)); X if (s) print(s); X if (stretch(p) != 0) { X print(" plus "); X print_glue(stretch(p), stretch_order(p), s); X } X if (shrink(p) != 0) { X print(" minus "); X print_glue(shrink(p), shrink_order(p), s); X } X } X} X Xshort_display (p) X ptr p; X{ X int n; X X for (p; p > NULL; p = link(p)) { X if (is_char_node(p) && p <= mem_end) { X if (font(p) != font_in_short_display) { X if (font(p) < FONT_BASE || font(p) > FONT_MAX) X print_char('*'); X else { X print_esc(""); X print_str(font_id_text(font(p))); X } X print_char(' '); X font_in_short_display = font(p); X } X print_ASCII(qo(character(p))); X } else { X switch (type(p)) X { X case HLIST_NODE: X case VLIST_NODE: X case INS_NODE: X case WHATSIT_NODE: X case MARK_NODE: X case ADJUST_NODE: X case UNSET_NODE: X print("[]"); X break; X X case RULE_NODE: X print_char('|'); X break; X X case GLUE_NODE: X if (glue_ptr(p) != zero_glue) X print_char(' '); X break; X X case MATH_NODE: X print_char('$'); X break; X X case LIGATURE_NODE: X short_display(lig_ptr(p)); X break; X X case DISC_NODE: X short_display(pre_break(p)); X short_display(post_break(p)); X n = replace_count(p); X while (n > 0) { X if (link(p) != NULL) X p = link(p); X decr(n); X } X break; X X default: X break; X } X } X } X} X Xshow_box (p) X ptr p; X{ X depth_threshold = show_box_depth; X breadth_max = show_box_breadth; X if (breadth_max <= 0) X breadth_max = 5; X if (pool_ptr + depth_threshold >= POOL_SIZE) X depth_threshold = POOL_SIZE - pool_ptr - 1; X show_node_list(p); X print_ln(); X} X Xshow_box1 (p) X ptr p; X{ X if (type(p) == HLIST_NODE) X print_esc("h"); X else if (type(p) == VLIST_NODE) X print_esc("v"); X else print_esc("unset"); X print("box("); X print_scaled(height(p)); X print_char('+') ; X print_scaled(depth(p)); X print(")x") ; X print_scaled(width(p)); X if (type(p) == UNSET_NODE) { X if (span_count(p) != MIN_QUARTERWORD) { X print(" ("); X print_int(qo(span_count(p))+1); X print(" columns)"); X } X if (glue_stretch(p) != 0) { X print(", stretch "); X print_glue(glue_stretch(p), glue_order(p), ""); X } X if (glue_shrink(p) != 0) { X print(", shrink "); X print_glue(glue_shrink(p), glue_sign(p), ""); X } X } else { X show_glue_set(p); X if (shift_amount(p) != 0) { X print(", shifted "); X print_scaled(shift_amount(p)); X } X } X node_list_display(list_ptr(p)); X} X Xshow_glue_set (p) X ptr p; X{ X if (glue_set(p) != 0 && glue_sign(p) != NORMAL) { X print(", glue set "); X if (glue_sign(p) == SHRINKING) X print("- "); X if (abs(glue_set(p)) > 20000.0) { X if (glue_set(p) > 0) X print_char('>'); X else print("< -"); X print_glue(20000 * UNITY, glue_order(p), ""); X } else X print_glue(round(glue_set(p) * UNITY), glue_order(p), ""); X } X} X Xshow_rule (p) X ptr p; X{ X print_esc("rule("); X print_rule_dimen(height(p)); X print_char('+'); X print_rule_dimen(depth(p)); X print(")x"); X print_rule_dimen(width(p)); X} X Xshow_insertion (p) X ptr p; X{ X print_esc("insert"); X print_int(qo(subtype(p))); X print(", natural size "); X print_scaled(height(p)); X print("; split("); X print_spec(split_top_ptr(p), ""); X print_char(','); X print_scaled(depth(p)); X print("); float cost "); X print_val(float_cost(p)); X node_list_display(ins_ptr(p)); X} X Xshow_leaders (p) X ptr p; X{ X print_esc(""); X if (subtype(p) == C_LEADERS) X print_char('c'); X else if (subtype(p) == X_LEADERS) X print_char('x'); X print("leaders "); X print_spec(glue_ptr(p), ""); X node_list_display(leader_ptr(p)); X} X Xshow_glue (p) X ptr p; X{ X if (subtype(p) >= A_LEADERS) X show_leaders(p); X else { X print_esc("glue"); X if (subtype(p) != NORMAL) { X print_char('('); X if (subtype(p) < COND_MATH_GLUE) X print_skip_param(subtype(p) - 1); X else if (subtype(p) == COND_MATH_GLUE) X print_esc("nonscript"); X else print_esc("mskip"); X print_char(')'); X } X if (subtype(p) != COND_MATH_GLUE) { X print_char(' '); X if (subtype(p) < COND_MATH_GLUE) X print_spec(glue_ptr(p), ""); X else print_spec(glue_ptr(p), "mu"); X } X } X} X Xshow_kern (p) X ptr p; X{ X if (subtype(p) != MU_GLUE) { X print_esc("kern"); X if (subtype(p) != NORMAL) X print_char(' '); X print_scaled(width(p)); X if (subtype(p) == ACC_KERN) X print(" (for accent)");} X else { X print_esc("mkern"); X print_scaled(width(p)); X print("mu"); X } X} X Xshow_math (p) X ptr p; X{ X print_esc("math"); X if (subtype(p) == BEFORE) X print("on"); X else print("off"); X if (width(p) != 0) { X print(", surrounded "); X print_scaled(width(p)); X } X} X Xshow_ligature (p) X ptr p; X{ X print_font_and_char(lig_char(p)); X print(" (ligature "); X font_in_short_display = font(lig_char(p)); X short_display(lig_ptr(p)); X print_char(')'); X} X Xshow_discretionary (p) X ptr p; X{ X print_esc("discretionary"); X if (replace_count(p) > 0) { X print(" replacing "); X print_int(replace_count(p)); X } X node_list_display(pre_break(p)); X append_char('|'); X show_node_list(post_break(p)); X flush_char(); X} X Xshow_penalty (p) X ptr p; X{ X print_esc("penalty "); X print_val(penalty(p)); X} X Xshow_mark (p) X ptr p; X{ X print_esc("mark"); X print_mark(mark_ptr(p)); X} X Xshow_adjust (p) X ptr p; X{ X print_esc("vadjust"); X node_list_display(adjust_ptr(p)); X} X Xshow_node_list (p) X ptr p; X{ X int n; X X if (cur_length() > depth_threshold) { X if (p > NULL) X print(" []"); X return; X } X n = 0; X while (p > NULL) { X print_ln(); X print_current_string(); X if (p > mem_end) { X print("Bad link, display aborted."); X return; X } X incr(n); X if (n > breadth_max) { X print("etc."); X return; X } X if (is_char_node(p)) X print_font_and_char(p); X else { X switch (type(p)) X { X case HLIST_NODE: X case VLIST_NODE: X case UNSET_NODE: X show_box1(p); X break; X X case RULE_NODE: X show_rule(p); X break; X X case INS_NODE: X show_insertion(p); X break; X X case WHATSIT_NODE: X show_whatsit(p); X break; X X case GLUE_NODE: X show_glue(p); X break; X X case KERN_NODE: X show_kern(p); X break; X X case MATH_NODE: X show_math(p); X break; X X case LIGATURE_NODE: X show_ligature(p); X break; X X case PENALTY_NODE: X show_penalty(p); X break; X X case DISC_NODE: X show_discretionary(p); X break; X X case MARK_NODE: X show_mark(p); X break; X X case ADJUST_NODE: X show_adjust(p); X break; X X case STYLE_NODE: X print_style(subtype(p)); X break; X X case CHOICE_NODE: X show_choice_node(p); X break; X X case INNER_NOAD: X case ORD_NOAD: X case OP_NOAD: X case BIN_NOAD: X case REL_NOAD: X case OPEN_NOAD: X case CLOSE_NOAD: X case PUNCT_NOAD: X case RADICAL_NOAD: X case OVER_NOAD: X case UNDER_NOAD: X case VCENTER_NOAD: X case ACCENT_NOAD: X case LEFT_NOAD: X case RIGHT_NOAD: X show_normal_noad(p); X break; X X case FRACTION_NOAD: X show_fraction_noad(p); X break; X X default: X print("Unknown node type!"); X break; X } X } X p = link(p); X } X} X Xshow_info () X{ X show_node_list(info(temp_ptr)); X} X Xdelete_glue_ref (p) X ptr p; X{ X if (glue_ref_count(p) == NULL) X free_node(p, GLUE_SPEC_SIZE); X else decr(glue_ref_count(p)); X} X Xflush_node_list (p) X ptr p; X{ X ptr q; X X while (p != NULL) { X q = link(p); X if (is_char_node(p)) { X free_avail(p); X } else { X switch (type(p)) X { X case HLIST_NODE: X case VLIST_NODE: X case UNSET_NODE: X flush_node_list(list_ptr(p)); X free_node(p, BOX_NODE_SIZE); X goto done; X break; X X case RULE_NODE: X free_node(p, RULE_NODE_SIZE); X goto done; X break; X X case INS_NODE: X flush_node_list(ins_ptr(p)); X delete_glue_ref(split_top_ptr(p)); X free_node(p, INS_NODE_SIZE); X goto done; X break; X X case WHATSIT_NODE: X free_whatsit(p); X goto done; X break; X X case GLUE_NODE: X fast_delete_glue_ref(glue_ptr(p)); X if (leader_ptr(p) != NULL) X flush_node_list(leader_ptr(p)); X break; X X case KERN_NODE: X case MATH_NODE: X case PENALTY_NODE: X break; X X case LIGATURE_NODE: X flush_node_list(lig_ptr(p)); X break; X X case MARK_NODE: X delete_token_ref(mark_ptr(p)); X break; X X case DISC_NODE: X flush_node_list(pre_break(p)); X flush_node_list(post_break(p)); X break; X X case ADJUST_NODE: X flush_node_list(adjust_ptr(p)); X break; X X case STYLE_NODE: X free_node(p, STYLE_NODE_SIZE); X goto done; X break; X X case CHOICE_NODE: X flush_node_list(display_mlist(p)); X flush_node_list(text_mlist(p)); X flush_node_list(script_mlist(p)); X flush_node_list(script_script_mlist(p)); X free_node(p, STYLE_NODE); X goto done; X break; X X case ORD_NOAD: X case OP_NOAD: X case BIN_NOAD: X case REL_NOAD: X case OPEN_NOAD: X case CLOSE_NOAD: X case PUNCT_NOAD: X case INNER_NOAD: X case RADICAL_NOAD: X case OVER_NOAD: X case UNDER_NOAD: X case VCENTER_NOAD: X case ACCENT_NOAD: X if (math_type(nucleus(p)) >= SUB_BOX) X flush_node_list(info(nucleus(p))); X if (math_type(supscr(p)) >= SUB_BOX) X flush_node_list(info(supscr(p))); X if (math_type(subscr(p)) >= SUB_BOX) X flush_node_list(info(subscr(p))); X if (type(p) == RADICAL_NOAD) X free_node(p, RADICAL_NOAD_SIZE); X else if (type(p) == ACCENT_NOAD) X free_node(p, ACCENT_NOAD_SIZE); X else free_node(p, NOAD_SIZE); X goto done; X break; X X case LEFT_NOAD: X case RIGHT_NOAD: X free_node(p, NOAD_SIZE); X goto done; X break; X X case FRACTION_NOAD: X flush_node_list(info(numerator(p))); X flush_node_list(info(denominator(p))); X free_node(p, FRACTION_NOAD_SIZE); X goto done; X break; X X default: X confusion("flushing"); X break; X } X free_node(p, SMALL_NODE_SIZE); X done:; X } X p = q; X } X} X Xptr Xcopy_node_list (p) X ptr p; X{ X ptr h; X ptr q; X ptr r; X int words; X X h = get_avail(); X q = h; X while (p != NULL) { X words = 1; X if (is_char_node(p)) X r = get_avail(); X else { X switch (type(p)) X { X case HLIST_NODE: X case VLIST_NODE: X case UNSET_NODE: X r = get_node(BOX_NODE_SIZE); X mem[r + 6] = mem[p + 6]; X mem[r + 5] = mem[p + 5]; X list_ptr(r) = copy_node_list(list_ptr(p)); X words = 5; X break; X X case RULE_NODE: X r = get_node(RULE_NODE_SIZE); X words = RULE_NODE_SIZE; X break; X X case INS_NODE: X r = get_node(INS_NODE_SIZE); X mem[r + 4] = mem[p + 4]; X add_glue_ref(split_top_ptr(p)); X ins_ptr(r) = copy_node_list(ins_ptr(p)); X words = INS_NODE_SIZE - 1; X break; X X case WHATSIT_NODE: X r = copy_whatsit(p); X break; X X case GLUE_NODE: X r = get_node(SMALL_NODE_SIZE); X add_glue_ref(glue_ptr(p)); X glue_ptr(r) = glue_ptr(p); X leader_ptr(r) = copy_node_list(leader_ptr(p)); X break; X X case KERN_NODE: X case MATH_NODE: X case PENALTY_NODE: X r = get_node(SMALL_NODE_SIZE); X words = SMALL_NODE_SIZE; X break; X X case LIGATURE_NODE: X r = get_node(SMALL_NODE_SIZE); X mem[lig_char(r)] = mem[lig_char(p)]; X lig_ptr(r) = copy_node_list(lig_ptr(p)); X break; X X case DISC_NODE: X r = get_node(SMALL_NODE_SIZE); X pre_break(r) = copy_node_list(pre_break(p)); X post_break(r) = copy_node_list(post_break(p)); X break; X X case MARK_NODE: X r = get_node(SMALL_NODE_SIZE); X add_token_ref(mark_ptr(p)); X words = SMALL_NODE_SIZE; X break; X X case ADJUST_NODE: X r = get_node(SMALL_NODE_SIZE); X adjust_ptr(r) = copy_node_list(adjust_ptr(p)); X break; X X default: X confusion("copying"); X break; X } X } X while (words > 0) { X decr(words); X mem[r + words] = mem[p + words]; X } X link(q) = r; X q = r; X p = link(p); X } X link(q) = NULL; X q = link(h); X free_avail(h); X return q; X} SHAR_EOF chmod 0444 box.c || echo "restore of box.c fails" set `wc -c box.c`;Sum=$1 if test "$Sum" != "15162" then echo original size 15162, current size $Sum;fi echo "x - extracting box.h (Text)" sed 's/^X//' << 'SHAR_EOF' > box.h && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * box.h X */ X X#define type(M) mem[M].hh.hh2.b0 X#define subtype(M) mem[M].hh.hh2.b1 X X#define font type X#define character subtype X#define is_char_node(M) (M >= hi_mem_min) X Xptr new_null_box(); X X#define HLIST_NODE 0 X#define VLIST_NODE 1 X X#define BOX_NODE_SIZE 7 X#define WIDTH_OFFSET 1 X#define DEPTH_OFFSET 2 X#define HEIGHT_OFFSET 3 X#define SHIFT_OFFSET 4 X#define LIST_OFFSET 5 X#define GLUE_OFFSET 6 X#define width(B) mem[B + WIDTH_OFFSET].sc X#define depth(B) mem[B + DEPTH_OFFSET].sc X#define height(B) mem[B + HEIGHT_OFFSET].sc X#define shift_amount(B) mem[B + SHIFT_OFFSET].sc X#define list_ptr(B) link(B + LIST_OFFSET) X#define glue_order(B) subtype(B + LIST_OFFSET) X#define glue_sign(B) type(B + LIST_OFFSET) X#define glue_set(B) mem[B + GLUE_OFFSET].gr X X#define NORMAL 0 X#define STRETCHING 1 X#define SHRINKING 2 X Xptr new_rule(); X X#define RULE_NODE 2 X#define RULE_NODE_SIZE 4 X#define NULL_FLAG -010000000000 X#define is_running(R) (R == NULL_FLAG) X X#define INS_NODE 3 X#define INS_NODE_SIZE 5 X#define float_cost(I) mem[I + 1].i X#define ins_ptr(I) info(I + 4) X#define split_top_ptr(I) link(I + 4) X X#define MARK_NODE 4 X#define SMALL_NODE_SIZE 2 X#define mark_ptr(M) link(M + 1) X X#define ADJUST_NODE 5 X#define adjust_ptr mark_ptr X Xptr new_ligature(); X X#define LIGATURE_NODE 6 X#define lig_char(L) L + 1 X#define lig_ptr(L) link(lig_char(L)) X Xptr new_disc(); X X#define DISC_NODE 7 X#define replace_count subtype X#define pre_break llink X#define post_break rlink X X#define WHATSIT_NODE 8 X Xptr new_math(); X X#define MATH_NODE 9 X#define BEFORE 0 X#define AFTER 1 X X#define precedes_break(M) (type(M) < MATH_NODE) X#define non_discardable(M) (type(M) < MATH_NODE) X Xptr new_spec(); Xptr new_param_glue(); Xptr new_glue(); Xptr new_skip_param(); X X#define GLUE_NODE 10 X#define COND_MATH_GLUE 98 X#define MU_GLUE 99 X#define A_LEADERS 100 X#define C_LEADERS 101 X#define X_LEADERS 102 X#define glue_ptr llink X#define leader_ptr rlink X X#define GLUE_SPEC_SIZE 4 X#define glue_ref_count(G) link(G) X#define stretch(G) mem[G + 2].sc X#define shrink(G) mem[G + 3].sc X#define stretch_order type X#define shrink_order subtype X#define FIL 1 X#define FILL 2 X#define FILLL 3 X Xptr new_kern(); X X#define KERN_NODE 11 X#define EXPLICIT 1 X#define ACC_KERN 2 X Xptr new_penalty(); X X#define PENALTY_NODE 12 X#define INF_PENALTY 10000L X#define EJECT_PENALTY -INF_PENALTY X#define penalty(P) mem[P + 1].i X X#define UNSET_NODE 13 X#define span_count subtype X#define glue_stretch(U) mem[U + GLUE_OFFSET].sc X#define glue_shrink shift_amount X Xint print_short_display(); Xint print_font_and_char(); Xint print_mark(); Xint print_rule_dimen(); Xint print_glue(); Xint print_spec(); X X#define node_list_display(N) \ X {append_char('.'); show_node_list(N); flush_char();} X Xglobal int font_in_short_display; Xglobal val depth_threshold; Xglobal val breadth_max; Xglobal int words; X Xint show_node_list(); Xint show_box(); Xint show_info(); Xint short_display(); X Xptr copy_node_list(); Xint flush_node_list(); X Xint delete_glue_ref(); X#define fast_delete_glue_ref(G) \ X {if (glue_ref_count(G) == NULL) \ X free_node(G, GLUE_SPEC_SIZE); \ X else decr(glue_ref_count(G));} X#define add_glue_ref(G) \ X incr(glue_ref_count(G)) SHAR_EOF chmod 0444 box.h || echo "restore of box.h fails" set `wc -c box.h`;Sum=$1 if test "$Sum" != "3489" then echo original size 3489, current size $Sum;fi echo "x - extracting boxlists.c (Text)" sed 's/^X//' << 'SHAR_EOF' > boxlists.c && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * boxlists.c X */ X X#include "tex.h" X#include "cmds.h" X#include "heap.h" X#include "eq.h" X#include "eqstack.h" X#include "def.h" X#include "box.h" X#include "tokenstack.h" X#include "token.h" X#include "scan.h" X#include "tokenlists.h" X#include "evalstack.h" X#include "tfm.h" X#include "pack.h" X#include "page.h" X#include "math.h" X#include "io.h" X#include "print.h" X#include "error.h" X#include "boxlists.h" X Xptr cur_box; X Xappend_glue () X{ X hword s; X X s = cur_chr; X switch (s) X { X case FIL_CODE: X cur_val = fil_glue; X break; X X case FILL_CODE: X cur_val = fill_glue; X break; X X case SS_CODE: X cur_val = ss_glue; X break; X X case FIL_NEG_CODE: X cur_val = fil_neg_glue; X break; X X case SKIP_CODE: X scan_glue(GLUE_VAL); X break; X X case MSKIP_CODE: X scan_glue(MU_VAL); X break; X X default: X break; X } X tail_append(new_glue((ptr) cur_val)); X if (s >= SKIP_CODE) { X decr(glue_ref_count((ptr) cur_val)); X if (s > SKIP_CODE) X subtype(tail) = MU_GLUE; X } X} X Xappend_kern () X{ X qword s; X X s = cur_chr; X scan_dimen(s == MU_GLUE, FALSE, FALSE); X tail_append(new_kern(cur_val)); X subtype(tail) = s; X} X Xhandle_right_brace () X{ X scal d; X val f; X ptr p; X ptr q; X X switch (cur_group) X { X case SIMPLE_GROUP: X unsave(); X break; X X case BOTTOM_LEVEL: X print_err("Too many }'s"); X help_close_group(); X error(); X break; X X case SEMI_SIMPLE_GROUP: X case MATH_SHIFT_GROUP: X case MATH_LEFT_GROUP: X extra_right_brace(); X break; X X case HBOX_GROUP: X package(0); X break; X X case ADJUSTED_HBOX_GROUP: X adjust_tail = adjust_head; X package(0); X break; X X case VBOX_GROUP: X end_graf(); X package(0); X break; X X case VTOP_GROUP: X end_graf(); X package(VTOP_CODE); X break; X X case INSERT_GROUP: X end_graf(); X q = split_top_skip; X add_glue_ref(q); X d = split_max_depth; X f = floating_penalty; X unsave(); X decr(save_ptr); X p = vpack(link(head), NATURAL); X pop_nest(); X if (saved(0) < 255) { X tail_append(get_node(INS_NODE_SIZE)); X type(tail) = INS_NODE; X subtype(tail) = qi(saved(0)); X height(tail) = height(p) + depth(p); X ins_ptr(tail) = list_ptr(p); X split_top_ptr(tail) = q; X depth(tail) = d; X float_cost(tail) = f; X } else { X tail_append(get_node(SMALL_NODE_SIZE)); X type(tail) = ADJUST_NODE; X subtype(tail) = 0; X adjust_ptr(tail) = list_ptr(p); X delete_glue_ref(q); X } X free_node(p, BOX_NODE_SIZE); X if (nest_ptr == 0) X build_page(); X break; X X case OUTPUT_GROUP: X if (loc != NULL) { X print_err("Unbalanced output routine"); X help_output_balance(); X error(); X do get_token(); X while (loc != NULL); X } X end_token_list(); X end_graf(); X unsave(); X output_active = FALSE; X insert_penalties = 0; X if (box(255) != NULL) { X print_err("Output routine didn't use all of "); X print_esc("box255"); X help_output(); X box_error(255); X } X if (tail != head) { X link(page_tail) = link(head); X page_tail = tail; X } X if (link(page_head) != NULL) { X if (link(contrib_head) == NULL) X contrib_tail = page_tail; X link(page_tail) = link(contrib_head); X link(contrib_head) = link(page_head); X link(page_head) = NULL; X page_tail = page_head; X } X pop_nest(); X build_page(); X break; X X case DISC_GROUP: X build_discretionary(); X break; X X case ALIGN_GROUP: X back_input(); X cur_tok = CS_TOKEN_FLAG + FROZEN_CR; X print_err("Missing "); X print_esc("cr"); X print(" inserted"); X help_align_cr(); X ins_error(); X break; X X case NO_ALIGN_GROUP: X end_graf(); X unsave(); X align_peek(); X break; X X case VCENTER_GROUP: X end_graf(); X unsave(); X save_ptr -= 2; X p = vpackage(link(head), saved(1), (int) saved(0), MAX_DIMEN); X pop_nest(); X tail_append(new_noad()); X type(tail) = VCENTER_NOAD; X math_type(nucleus(tail)) = SUB_BOX; X info(nucleus(tail)) = p; X break; X X case MATH_CHOICE_GROUP: X build_choices(); X break; X X case MATH_GROUP: X unsave(); X decr(save_ptr); X math_type(saved(0)) = SUB_MLIST; X p = fin_mlist(NULL); X info(saved(0)) = p; X if (p != NULL) { X if (link(p) == NULL) { X if (type(p) == ORD_NOAD) { X if (math_type(subscr(p)) == EMPTY && X math_type(supscr(p)) == EMPTY) { X mem[saved(0)].hh = mem[nucleus(p)].hh; X free_node(p, NOAD_SIZE); X } X } else if (type(p) == ACCENT_NOAD && X saved(0) == nucleus(tail) && X type(tail) == ORD_NOAD) { X q = head; X while (link(q) != tail) X q = link(q); X link(q) = p; X free_node(tail, NOAD_SIZE); X tail = p; X } X } X } X break; X X default: X confusion("rightbrace"); X break; X } X} X Xextra_right_brace () X{ X print_err("Extra }, or forgotten "); X switch (cur_group) X { X case SEMI_SIMPLE_GROUP: X print_esc("endgroup"); X break; X X case MATH_SHIFT_GROUP: X print_char('$'); X break; X X case MATH_LEFT_GROUP: X print_esc("right"); X break; X } X help_group_close(); X error(); X incr(align_state); X} X Xpackage (c) X int c; X{ X scal d; X scal h; X ptr p; X X d = box_max_depth; X unsave(); X save_ptr -= 3; X if (mode == -HMODE) X cur_box = hpack(link(head), saved(2), (int) saved(1)); X else { X cur_box = vpackage(link(head), saved(2), (int) saved(1), d); X if (c == VTOP_CODE) { X h = 0; X p = list_ptr(cur_box); X if (p != NULL && type(p) <= RULE_NODE) X h = height(p); X depth(cur_box) += height(cur_box) - h; X height(cur_box) = h; X } X } X pop_nest(); X box_end(); X} X Xbox_end () X{ X ptr p; X X if (saved(0) < BOX_FLAG) { X if (cur_box != NULL) { X shift_amount(cur_box) = saved(0); X if (abs(mode) == VMODE) { X append_to_vlist(cur_box); X if (adjust_tail != NULL) { X if (adjust_head != adjust_tail) { X link(tail) = link(adjust_head); X tail = adjust_tail; X } X adjust_tail = NULL; X } X if (mode > 0) X build_page(); X } else { X if (abs(mode) == HMODE) X space_factor = 1000; X else { X p = new_noad(); X math_type(nucleus(p)) = SUB_BOX; X info(nucleus(p)) = cur_box; X cur_box = p; X } X link(tail) = cur_box; X tail = cur_box; X } X } X } else if (saved(0) < SHIP_OUT_FLAG) X if (saved(0) < BOX_FLAG + 256) X eq_define((ptr)(BOX_BASE-BOX_FLAG+saved(0)), BOX_REF, cur_box); X else X geq_define((ptr)(BOX_BASE-BOX_FLAG-256+saved(0)), BOX_REF, cur_box); X else if (cur_box != NULL) { X if (saved(0) > SHIP_OUT_FLAG) { X get_nbrx_token(); X if (cur_cmd == HSKIP && abs(mode) != VMODE || X cur_cmd == VSKIP && abs(mode) == VMODE || X cur_cmd == MSKIP && abs(mode) == MMODE) { X append_glue(); X leader_ptr(tail) = cur_box; X subtype(tail) = saved(0) - (LEADER_FLAG - A_LEADERS); X } else { X print_err("Leaders not followed by proper glue"); X help_leaders(); X back_error(); X flush_node_list(cur_box); X } X } else X ship_out(cur_box); X } X} X Xbegin_box () X{ X int k; X int m; X int n; X ptr p; X ptr q; X X switch (cur_chr) X { X case BOX_CODE: X scan_eight_bit_int(); X cur_box = box(cur_val); X box(cur_val) = NULL; X break; X X case COPY_CODE: X scan_eight_bit_int(); X cur_box = copy_node_list(box(cur_val)); X break; X X case LAST_BOX_CODE: X cur_box = NULL; X if (abs(mode) == MMODE) { X you_cant(); X help_lastbox_m(); X error(); X } else if (mode == VMODE && head == tail) { X you_cant(); X help_lastbox_v(); X error(); X } else if (!is_char_node(tail) && X (type(tail) == HLIST_NODE || type(tail) == VLIST_NODE)) { X q = head; X do { X p = q; X if (!is_char_node(q) && type(q) == DISC_NODE) { X for (m = 1; m <= replace_count(q); incr(m)) X p = link(p); X if (p == tail) X break; X } X q = link(p); X } while (q != tail); X cur_box = tail; X shift_amount(cur_box) = 0; X tail = p; X link(p) = NULL; X } X break; X X case VSPLIT_CODE: X scan_eight_bit_int(); X n = cur_val; X if (!scan_keyword("to")) { X print_err("Missing `to' inserted"); X help_vsplit(); X error(); X } X scan_normal_dimen(); X cur_box = vsplit(n, cur_val); X break; X X default: X k = cur_chr - VTOP_CODE; X incr(save_ptr); X scan_spec(); X if (k == HMODE) { X if (saved(-3) < BOX_FLAG && abs(mode) == VMODE) X new_save_level(ADJUSTED_HBOX_GROUP); X else new_save_level(HBOX_GROUP); X } else { X if (k == VMODE) X new_save_level(VBOX_GROUP); X else { X new_save_level(VTOP_GROUP); X k = VMODE; X } X normal_paragraph(); X } X push_nest(); X mode = -k; X if (k == VMODE) { X prev_depth = IGNORE_DEPTH; X if (every_vbox != NULL) X begin_token_list(every_vbox, EVERY_VBOX_TEXT); X } else { X space_factor = 1000; X if (every_hbox != NULL) X begin_token_list(every_hbox, EVERY_HBOX_TEXT); X } X return; X break; X } X box_end(); X} X Xscan_spec () X{ X if (scan_keyword("to")) X saved(0) = EXACTLY; X else if (scan_keyword("spread")) X saved(0) = ADDITIONAL; X else { X saved(0) = ADDITIONAL; X saved(1) = 0; X goto found; X } X scan_normal_dimen(); X saved(1) = cur_val; X Xfound: X save_ptr += 2; X scan_left_brace(); X} X Xscan_box () X{ X get_nbrx_token(); X if (cur_cmd == MAKE_BOX) X begin_box(); X else if (saved(0) >= LEADER_FLAG && X (cur_cmd == HRULE || cur_cmd == VRULE)) { X cur_box = scan_rule_spec(); X box_end(); X } else { X print_err("A <box> was supposed to be here"); X help_box(); X back_error(); X } X} X Xnormal_paragraph () X{ X if (looseness != 0) X eq_word_define((ptr) INT_BASE + LOOSENESS_CODE, 0L); X if (hang_indent != 0) X eq_word_define((ptr) DIMEN_BASE + HANG_INDENT_CODE, 0L); X if (hang_after != 1) X eq_word_define((ptr) INT_BASE + HANG_AFTER_CODE, 1L); X if (par_shape_ptr != NULL) X eq_define(PAR_SHAPE_LOC, SHAPE_REF, NULL); X} X Xnew_graf (indented) X bool indented; X{ X prev_graf = 0; X if (mode == VMODE || head != tail) X tail_append(new_param_glue(PAR_SKIP_CODE)); X push_nest(); X mode = HMODE; X space_factor = 1000; X if (indented) { X tail = new_null_box(); X link(head) = tail; X width(tail) = par_indent; X } X if (every_par != NULL) X begin_token_list(every_par, EVERY_PAR_TEXT); X if (nest_ptr == 1) X build_page(); X} X Xindent_in_hmode () X{ X ptr p; X ptr q; X X if (cur_chr > 0) { X p = new_null_box(); X width(p) = par_indent; X if (abs(mode) == HMODE) X space_factor = 1000; X else { X q = new_noad(); X math_type(nucleus(q)) = SUB_BOX; X info(nucleus(q)) = p; X p = q; X } X tail_append(p); X } X} X Xhead_for_vmode () X{ X if (mode < 0) { X if (cur_cmd != HRULE) X off_save(); X else { X print_err("You can't use `"); X print_esc("hrule"); X print("' here except with leaders"); X help_head_for_vmode(); X error(); X } X } else { X back_input(); X cur_tok = par_token; X back_input(); X token_type = INSERTED; X } X} X Xend_graf () X{ X if (mode == HMODE) { X if (head == tail) X pop_nest(); X else X line_break(widow_penalty); X normal_paragraph(); X error_count = 0; X } X} X Xappend_to_vlist (b) X ptr b; X{ X scal d; X ptr p; X X if (prev_depth > IGNORE_DEPTH) { X d = width(baseline_skip) - prev_depth - height(b); X if (d < line_skip_limit) X p = new_param_glue(LINE_SKIP_CODE); X else { X p = new_skip_param(BASELINE_SKIP_CODE); X width(temp_ptr) = d; X } X link(tail) = p; X tail = p; X } X link(tail) = b; X tail = b; X prev_depth = depth(b); X} X Xbegin_insert_or_adjust () X{ X if (cur_cmd == VADJUST) X cur_val = 255; X else { X scan_eight_bit_int(); X if (cur_val == 255) { X print_err("You can't "); X print_esc("insert"); X print_int(255); X help_insert_255(); X error(); X cur_val = 0; X } X } X saved(0) = cur_val; X incr(save_ptr); X new_save_level(INSERT_GROUP); X scan_left_brace(); X normal_paragraph(); X push_nest(); X mode = -VMODE; X prev_depth = IGNORE_DEPTH; X} X Xmake_mark () X{ X ptr p; X X scan_toks(FALSE, TRUE); X p = get_node(SMALL_NODE_SIZE); X type(p) = MARK_NODE; X subtype(p) = 0; X mark_ptr(p) = def_ref; X link(tail) = p; X tail = p; X} X Xappend_penalty () X{ X scan_int(); X tail_append(new_penalty(cur_val)); X if (mode == VMODE) X build_page(); X} X Xdelete_last () X{ X qword m; X ptr p; X ptr q; X X if (mode == VMODE && tail == head) { X if (cur_chr != GLUE_NODE || last_glue != MAX_HALFWORD) { X you_cant(); X help_delete_last(); X if (cur_chr == KERN_NODE) X help_line[1] = "Try `I\\kern-\\lastkern' instead."; X else if (cur_chr != GLUE_NODE) X help_line[1] = "Perhaps you can make the output routine do it."; X error(); X } X } else if (!is_char_node(tail) && type(tail) == cur_chr) { X q = head; X do { X p = q; X if (!is_char_node(q) && type(q) == DISC_NODE) { X for (m = 1; m <= replace_count(q); incr(m)) X p = link(p); X if (p == tail) X return; X } X q = link(p); X } while (q != tail); X link(p) = NULL; X flush_node_list(tail); X tail = p; X } X} X Xunpackage () X{ X int c; X ptr p; X X c = cur_chr; X scan_eight_bit_int(); X p = box(cur_val); X if (p == NULL) return; X if (abs(mode) == MMODE || X abs(mode) == VMODE && type(p) != VLIST_NODE || X abs(mode) == HMODE && type(p) != HLIST_NODE) { X print_err("Incompatible list can't be unboxed"); X help_pandora(); X error(); X return; X } X if (c == COPY_CODE) X link(tail) = copy_node_list(list_ptr(p)); X else { X link(tail) = list_ptr(p); X box(cur_val) = NULL; X free_node(p, BOX_NODE_SIZE); X } X while (link(tail) != NULL) X tail = link(tail); X} X Xappend_italic_correction () X{ X ptr p; X fnt f; X X if (tail != head) { X if (is_char_node(tail)) X p = tail; X else if (type(tail) == LIGATURE_NODE) X p = lig_char(tail); X else return; X } X f = font(p); X tail_append(new_kern(char_italic(f, char_info(f, character(p))))); X subtype(tail) = EXPLICIT; X} X Xappend_discretionary () X{ X int c; X X tail_append(new_disc()); X if (cur_chr == 1) { X c = hyphen_char[cur_font]; X if (c >= 0 && c < 256) X pre_break(tail) = new_character(cur_font, c); X } else { X incr(save_ptr); X saved(-1) = 0; X scan_left_brace(); X new_save_level(DISC_GROUP); X push_nest(); X mode = -HMODE; X space_factor = 1000; X } X} X Xbuild_discretionary () X{ X int n; X ptr p; X ptr q; X X unsave(); X q = head; X p = link(q); X n = 0; X while (p != NULL) { X if (!is_char_node(p) && type(p) > RULE_NODE && X type(p) != KERN_NODE && type(p) != LIGATURE_NODE) { X print_err("Improper discretionary list"); X help_discretionary(); X error(); X begin_diagnostic(); X print_nl("The following discretionary sublist has been deleted:"); X show_box(p); X end_diagnostic(TRUE); X flush_node_list(p); X link(q) = NULL; X break; X } X q = p; X p = link(q); X incr(n); X } X p = link(head); X pop_nest(); X switch ((int) saved(-1)) X { X case 0: X pre_break(tail) = p; X break; X X case 1: X post_break(tail) = p; X break; X X case 2: X if (n > 0 && abs(mode) == MMODE) { X print_err("Illegal math "); X print_esc("discretionary"); X help_math_disc(); X flush_node_list(p); X n = 0; X error(); X } else X link(tail) = p; X if (n <= MAX_QUARTERWORD) X replace_count(tail) = n; X else { X print_err("Discretionary list is too long"); X help_disc(); X error(); X } X if (n > 0) tail = q; X decr(save_ptr); X return; X } X incr(saved(-1)); X scan_left_brace(); X new_save_level(DISC_GROUP); X push_nest(); X mode = -HMODE; X space_factor = 1000; X} X Xmake_accent () X{ X scal a; X fnt f; X scal h; X fourq i; X ptr p; X ptr q; X ptr r; X float s; X float t; X scal w; X scal x; X scal delta; X X scan_char_num(); X f = cur_font; X p = new_character(f, cur_val); X if (p != NULL) { X x = x_height(f); X s = (float) slant(f) / 65536.0; X a = char_width(f, char_info(f, character(p))); X do_assignments(); X q = NULL; X f = cur_font; X if (cur_cmd == LETTER || X cur_cmd == OTHER_CHAR || X cur_cmd == CHAR_GIVEN) X q = new_character(f, cur_chr); X else if (cur_cmd == CHAR_NUM) { X scan_char_num(); X q = new_character(f, cur_val); X } else back_input(); X if (q != NULL) { X t = (float) slant(f) / 65536.0; X i = char_info(f, character(q)); X w = char_width(f, i); X h = char_height(f, height_depth(i)); X if (h != x) { X p = hpack(p, NATURAL); X shift_amount(p) = x - h; X } X delta = round((float) (w - a) / 2.0 + h * t - x * s); X r = new_kern(delta); X subtype(r) = ACC_KERN; X link(tail) = r; X link(r) = p; X tail = new_kern(-a - delta); X subtype(tail) = ACC_KERN; X link(p) = tail; p = q; X } X link(tail) = p; X tail = p; X space_factor = 1000; X } X} X Xalign_error () X{ X if (abs(align_state) > 2) { X print_err("Misplaced "); X print_cmd_chr(cur_cmd, cur_chr); X if (cur_tok == TAB_TOKEN + '&') X help_tab(); X else help_align_error(); X error(); X } else { X back_input(); X if (align_state < 0) { X print_err("Missing { inserted"); X incr(align_state); X cur_tok = LEFT_BRACE_TOKEN + '{'; X } else { X print_err("Missing } inserted"); X decr(align_state); X cur_tok = RIGHT_BRACE_TOKEN + '}'; X } X help_fix_alignment(); X ins_error(); X } X} X Xno_align_error () X{ X print_err("Misplaced "); X print_esc("noalign"); X help_noalign(); X error(); X} X Xomit_error () X{ X print_err("Misplaced "); X print_esc("omit"); X help_omit(); X error(); X} X Xdo_endv () X{ X if (cur_group == ALIGN_GROUP) { X end_graf(); X if (fin_col()) X fin_row(); X } else off_save(); X} X Xcs_error () X{ X print_err("Extra "); X print_esc("endcsname"); X help_csname(); X error(); X} X X/* X * Help text X */ X X Xhelp_head_for_vmode () X{ X help2("To put a horizontal rule in an hbox or an alignment,", X "you should use \\leaders or \\hrulefill (see The TeXbook)."); X} X X Xhelp_close_group () X{ X help2("You've closed more groups than you opened.", X "Such booboos are generally harmless, so keep going."); X} X X Xhelp_output_balance () X{ X help2("Your sneaky output routine has fewer real {'s than }'s.", X "I can't handle that very well; good luck."); X} X X Xhelp_output () X{ X help3("Your \\output commands should empty \\box255,", X "e.g., by saying `\\shipout\\box255'.", X "Proceed; I'll discard its present contents."); X} X X Xhelp_group_close () X{ X help5("I've deleted a group-closing symbol because it seems to be", X "spurious, as in `$x}$'. But perhaps the } is legitimate and", X "you forgot something else, as in `\\hbox{$x}'. In such cases", X "the way to recover is to insert both the forgotten and the", X "deleted material, e.g., by typing `I$}'."); X} X X Xhelp_leaders () X{ X help3("You should say `\\leaders <box or rule><hskip or vskip>'.", X "I found the <box or rule>, but there's no suitable", X "<hskip or vskip>, so I'm ignoring these leaders."); X} X X Xhelp_lastbox_m () X{ X help1("Sorry; this \\lastbox will be void."); X} X X Xhelp_lastbox_v () X{ X help2("Sorry...I usually can't take things from the current page.", X "This \\lastbox will therefore be void."); X} X X Xhelp_vsplit () X{ X help2("I'm working on `\\vsplit<box number> to <dimen>';", X "will look for the <dimen> next."); X} X X Xhelp_box () X{ X help3("I was expecting to see \\hbox or \\vbox or \\copy or \\box or", X "something like that. So you might find something missing in", X "your output. But keep trying; you can fix this later."); X} X X Xhelp_insert_255 () X{ X help1("I'm changing to \\insert0; box 255 is special."); X} X X Xhelp_space_fac () X{ X help1("I allow only values in the range 1..65536 here."); X} X X Xhelp_delete_last () X{ X help2("Sorry...I usually can't take things from the current page.", X "Try `I\\vskip-\\lastskip' instead."); X} X X Xhelp_pandora () X{ X help3("Sorry, Pandora. (You sneaky devil.)", X "I refuse to unbox an \\hbox in vertical mode or vice versa.", X "And I can't open any boxes in math mode."); X} X X Xhelp_math_disc () X{ X help2("Sorry: The third part of a discretionary break must be", X "empty, in math formulas. I had to delete your third part."); X} X X Xhelp_discretionary () X{ X help1("Discretionary lists must contain only boxes and kerns."); X} X X Xhelp_disc () X{ X help2("Wow---I never thought anybody would tweak me here.", X "You can't seriously need such a huge discretionary list?"); X} X X Xhelp_missing_the () X{ X help3("Please dont say \\count or \\dimen or \\skip in the midst of", X "a paragraph or formula. I'm going to assume that you", X "meant to say `\\the\\count' or `\\the\\dimen' or `\\the\\skip',"); X} X X Xhelp_tab () X{ X help6("I can't figure out why you would want to use a tab mark", X "here. If you want an ampersand, the remedy is", X "simple: Just type `I\\&' now. But if some right brace", X "up above has ended a previous alignment prematurely,", X "you're probably due for more error messages, and you", X "might try typing `S' now just to see what is salvageable."); SHAR_EOF echo "End of part 3" echo "File boxlists.c is continued in part 4" echo "4" > s2_seq_.tmp exit 0
glenn@extro.ucc.su.oz.au (G Geers) (02/16/90)
---- Cut Here and unpack ---- #!/bin/sh # this is part 4 of a multipart archive # do not concatenate these parts, unpack them in order with /bin/sh # file boxlists.c continued # CurArch=4 if test ! -r s2_seq_.tmp then echo "Please unpack part 1 first!" exit 1; fi ( read Scheck if test "$Scheck" != $CurArch then echo "Please unpack part $Scheck next!" exit 1; else exit 0; fi ) < s2_seq_.tmp || exit 1 echo "x - Continuing file boxlists.c" sed 's/^X//' << 'SHAR_EOF' >> boxlists.c X} X X Xhelp_align_error () X{ X help5("I can't figure out why you would want to use a tab mark", X "or \\cr or \\span just now. If something like a right brace", X "up above has ended a previous alignment prematurely,", X "you're probably due for more error messages, and you", X "might try typing `S' now just to see what is salvageable."); X} X X Xhelp_align_cr () X{ X help1("I'm guessing that you meant to end an alignment here."); X} X X Xhelp_fix_alignment () X{ X help3("I've put in what seems to be necessary to fix", X "the current column of the current alignment.", X "Try to go on, since this might almost work."); X} X X Xhelp_noalign () X{ X help2("I expect to see \\noalign only after the \\cr of", X "an alignment. Proceed, and I'll ignore this case."); X} X X Xhelp_omit () X{ X help2("I expect to see \\omit only after tab marks or the \\cr of", X "an alignment. Proceed, and I'll ignore this case."); X} X X Xhelp_csname () X{ X help1("I'm ignoring this, since I wasn't doing a \\csname."); X} SHAR_EOF echo "File boxlists.c is complete" chmod 0444 boxlists.c || echo "restore of boxlists.c fails" set `wc -c boxlists.c`;Sum=$1 if test "$Sum" != "21019" then echo original size 21019, current size $Sum;fi echo "x - extracting boxlists.h (Text)" sed 's/^X//' << 'SHAR_EOF' > boxlists.h && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * boxlists.h X */ X Xint append_glue(); X X#define FIL_CODE 0 X#define FILL_CODE 1 X#define SS_CODE 2 X#define FIL_NEG_CODE 3 X#define SKIP_CODE 4 X#define MSKIP_CODE 5 X Xint append_kern(); X Xint handle_right_brace(); Xint extra_right_brace(); X Xglobal ptr cur_box; X Xint begin_box(); Xint scan_box(); Xint scan_spec(); Xint package(); X Xint box_end(); X X#define BOX_FLAG 010000000000 X#define SHIP_OUT_FLAG (BOX_FLAG + 512) X#define LEADER_FLAG (BOX_FLAG + 513) X#define BOX_CODE 0 X#define COPY_CODE 1 X#define LAST_BOX_CODE 2 X#define VSPLIT_CODE 3 X#define VTOP_CODE 4 X Xint normal_paragraph(); Xint new_graf(); Xint indent_in_hmode(); Xint head_for_vmode(); Xint end_graf(); Xint append_to_vlist(); Xint begin_insert_or_adjust(); Xint make_mark(); Xint append_penalty(); Xint delete_skip(); Xint unpackage(); Xint append_italic_correction(); Xint append_discretionary(); Xint build_discretionary(); Xint make_accent(); Xint align_error(); Xint no_align_error(); Xint omit_error(); Xint do_endv(); Xint cs_error(); SHAR_EOF chmod 0444 boxlists.h || echo "restore of boxlists.h fails" set `wc -c boxlists.h`;Sum=$1 if test "$Sum" != "1217" then echo original size 1217, current size $Sum;fi echo "x - extracting char.c (Text)" sed 's/^X//' << 'SHAR_EOF' > char.c && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X */ X X X/* X * char.c X */ X X#include "tex.h" X#include "char.h" X X Xascii xord[128]; Xchar xchr[128]; X Xinit_char () X{ X int i; X X xchr[040] = ' '; X xchr[041] = '!'; X xchr[042] = '"'; X xchr[043] = '#'; X xchr[044] = '$'; X xchr[045] = '%'; X xchr[046] = '&'; X xchr[047] = '\''; X xchr[050] = '('; X xchr[051] = ')'; X xchr[052] = '*'; X xchr[053] = '+'; X xchr[054] = ','; X xchr[055] = '-'; X xchr[056] = '.'; X xchr[057] = '/'; X xchr[060] = '0'; X xchr[061] = '1'; X xchr[062] = '2'; X xchr[063] = '3'; X xchr[064] = '4'; X xchr[065] = '5'; X xchr[066] = '6'; X xchr[067] = '7'; X xchr[070] = '8'; X xchr[071] = '9'; X xchr[072] = ':'; X xchr[073] = ';'; X xchr[074] = '<'; X xchr[075] = '='; X xchr[076] = '>'; X xchr[077] = '?'; X xchr[0100] = '@'; X xchr[0101] = 'A'; X xchr[0102] = 'B'; X xchr[0103] = 'C'; X xchr[0104] = 'D'; X xchr[0105] = 'E'; X xchr[0106] = 'F'; X xchr[0107] = 'G'; X xchr[0110] = 'H'; X xchr[0111] = 'I'; X xchr[0112] = 'J'; X xchr[0113] = 'K'; X xchr[0114] = 'L'; X xchr[0115] = 'M'; X xchr[0116] = 'N'; X xchr[0117] = 'O'; X xchr[0120] = 'P'; X xchr[0121] = 'Q'; X xchr[0122] = 'R'; X xchr[0123] = 'S'; X xchr[0124] = 'T'; X xchr[0125] = 'U'; X xchr[0126] = 'V'; X xchr[0127] = 'W'; X xchr[0130] = 'X'; X xchr[0131] = 'Y'; X xchr[0132] = 'Z'; X xchr[0133] = '['; X xchr[0134] = '\\'; X xchr[0135] = ']'; X xchr[0136] = '^'; X xchr[0137] = '_'; X xchr[0140] = '`'; X xchr[0141] = 'a'; X xchr[0142] = 'b'; X xchr[0143] = 'c'; X xchr[0144] = 'd'; X xchr[0145] = 'e'; X xchr[0146] = 'f'; X xchr[0147] = 'g'; X xchr[0150] = 'h'; X xchr[0151] = 'i'; X xchr[0152] = 'j'; X xchr[0153] = 'k'; X xchr[0154] = 'l'; X xchr[0155] = 'm'; X xchr[0156] = 'n'; X xchr[0157] = 'o'; X xchr[0160] = 'p'; X xchr[0161] = 'q'; X xchr[0162] = 'r'; X xchr[0163] = 's'; X xchr[0164] = 't'; X xchr[0165] = 'u'; X xchr[0166] = 'v'; X xchr[0167] = 'w'; X xchr[0170] = 'x'; X xchr[0171] = 'y'; X xchr[0172] = 'z'; X xchr[0173] = '{'; X xchr[0174] = '|'; X xchr[0175] = '}'; X xchr[0176] = '~'; X xchr[0177] = xchr[000] = ' '; X for (i = 1; i <= 037; incr(i)) X xchr[i] = ' '; X xchr[FORM_FEED] = '\l'; X xchr[TAB] = '\t'; X xchr[NUL] = '\0'; X X for (i = FIRST_TEXT_CHAR; i <= LAST_TEXT_CHAR; incr(i)) X xord[xchr[i]] = INVALID_CODE; X X for (i = 1; i <= 0176; incr(i)) X xord[xchr[i]] = i; X xord[xchr[NULL_CODE]] = NULL_CODE; X} SHAR_EOF chmod 0444 char.c || echo "restore of char.c fails" set `wc -c char.c`;Sum=$1 if test "$Sum" != "2296" then echo original size 2296, current size $Sum;fi echo "x - extracting char.h (Text)" sed 's/^X//' << 'SHAR_EOF' > char.h && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * char.h X */ X Xglobal ascii xord[]; X X#define FIRST_ASCII_CODE 0 X#define LAST_ASCII_CODE 127 X Xglobal char xchr[]; X X#define FIRST_TEXT_CHAR 0 X#define LAST_TEXT_CHAR 127 X X#define TAB 011 X#define FORM_FEED 014 X#define CARRIAGE_RETURN 015 X#define NULL_CODE 000 X#define INVALID_CODE 0177 X Xint init_char(); SHAR_EOF chmod 0444 char.h || echo "restore of char.h fails" set `wc -c char.h`;Sum=$1 if test "$Sum" != "540" then echo original size 540, current size $Sum;fi echo "x - extracting cmds.c (Text)" sed 's/^X//' << 'SHAR_EOF' > cmds.c && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * cmds.c X */ X X#include "tex.h" X#include "texext.h" X#include "heap.h" X#include "eq.h" X#include "eqstack.h" X#include "str.h" X#include "hash.h" X#include "token.h" X#include "tokenlists.h" X#include "tokenstack.h" X#include "scan.h" X#include "evalstack.h" X#include "def.h" X#include "cond.h" X#include "expand.h" X#include "box.h" X#include "boxlists.h" X#include "tfm.h" X#include "math.h" X#include "mathlists.h" X#include "align.h" X#include "error.h" X#include "print.h" X#include "cmds.h" X X#define chr_cmd(S) \ X {print(S); print_ASCII(chr_code);} X Xshow_cur_cmd_chr() X{ X begin_diagnostic(); X print_nl("{"); X if (mode != shown_mode) { X print_mode(mode); X print(": "); X shown_mode = mode; X } X print_cmd_chr(cur_cmd, cur_chr); X print_char('}'); X end_diagnostic(FALSE); X} X Xprint_cmd_chr (cmd, chr_code) X qword cmd; X hword chr_code; X{ X switch (cmd) X { X case RELAX: X print_esc("relax"); X break; X X case LEFT_BRACE: X chr_cmd("begin-group character "); X break; X X case RIGHT_BRACE: X chr_cmd("end-group character "); X break; X X case MATH_SHIFT: X chr_cmd("math shift character "); X break; X X case TAB_MARK: X if (chr_code == SPAN_CODE) X print_esc("span"); X else chr_cmd("alignment tab character "); X break; X X case CAR_RET: X if (chr_code == CR_CODE) X print_esc("cr"); X else print_esc("crcr"); X break; X X case MAC_PARAM: X chr_cmd("macro parameter character "); X break; X X case SUP_MARK: X chr_cmd("superscript character "); X break; X X case SUB_MARK: X chr_cmd("subscript character "); X break; X X case ENDV: X print("end of alignment template"); X break; X X case SPACER: X chr_cmd("blank space "); X break; X X case LETTER: X chr_cmd("the letter "); X break; X X case OTHER_CHAR: X chr_cmd("the character "); X break; X X case ASSIGN_GLUE: X case ASSIGN_MU_GLUE: X if (chr_code < SKIP_BASE) X print_skip_param(chr_code - GLUE_BASE); X else if (chr_code < MU_SKIP_BASE) { X print_esc("skip"); X print_int(chr_code - SKIP_BASE); X } else { X print_esc("muskip"); X print_int(chr_code - MU_SKIP_BASE); X } X break; X X case ASSIGN_TOKS: X if (chr_code >= TOKS_BASE) { X print_esc("toks"); X print_int(chr_code - TOKS_BASE); X } else { X switch (chr_code) X { X case OUTPUT_ROUTINE_LOC: X print_esc("output"); X break; X X case EVERY_PAR_LOC: X print_esc("everypar"); X break; X X case EVERY_MATH_LOC: X print_esc("everymath"); X break; X X case EVERY_DISPLAY_LOC: X print_esc("everydisplay"); X break; X X case EVERY_HBOX_LOC: X print_esc("everyhbox"); X break; X X case EVERY_VBOX_LOC: X print_esc("everyvbox"); X break; X X case EVERY_JOB_LOC: X print_esc("everyjob"); X break; X X case EVERY_CR_LOC: X print_esc("everycr"); X break; X X default: X print_esc("errhelp"); X break; X } X } X break; X X case ASSIGN_INT: X if (chr_code < COUNT_BASE) X print_param(chr_code - INT_BASE); X else { X print_esc("count"); X print_int(chr_code - COUNT_BASE); X } X break; X X case ASSIGN_DIMEN: X if (chr_code < SCALED_BASE) X print_length_param(chr_code - DIMEN_BASE); X else { X print_esc("dimen"); X print_int(chr_code - SCALED_BASE); X } X break; X X case ACCENT: X print_esc("accent"); X break; X X case ADVANCE: X print_esc("advance"); X break; X X case AFTER_ASSIGNMENT: X print_esc("afterassignment"); X break; X X case AFTER_GROUP: X print_esc("aftergroup"); X break; X X case ASSIGN_FONT_DIMEN: X print_esc("fontdimen"); X break; X X case BEGIN_GROUP: X print_esc("begingroup"); X break; X X case BREAK_PENALTY: X print_esc("penalty"); X break; X X case CHAR_NUM: X print_esc("char"); X break; X X case CS_NAME: X print_esc("csname"); X break; X X case DEF_FONT: X print_esc("font"); X break; X X case DELIM_NUM: X print_esc("delimiter"); X break; X X case DIVIDE: X print_esc("divide"); X break; X X case END_CS_NAME: X print_esc("endcsname"); X break; X X case END_GROUP: X print_esc("endgroup"); X break; X X case EX_SPACE: X print_esc(" "); X break; X X case EXPAND_AFTER: X print_esc("expandafter"); X break; X X case INPUT: X if (chr_code == 0) X print_esc("input"); X else print_esc("endinput"); X break; X X case HALIGN: X print_esc("halign"); X break; X X case HRULE: X print_esc("hrule"); X break; X X case IGNORE_SPACES: X print_esc("ignorespaces"); X break; X X case INSERT: X print_esc("insert"); X break; X X case ITAL_CORR: X print_esc("/"); X break; X X case MARK: X print_esc("mark"); X break; X X case TOP_BOT_MARK: X switch (chr_code) X { X case TOP_MARK_CODE: X print_esc("topmark"); X break; X X case FIRST_MARK_CODE: X print_esc("firstmark"); X break; X X case BOT_MARK_CODE: X print_esc("botmark"); X break; X X case SPLIT_FIRST_MARK_CODE: X print_esc("splitfirstmark"); X break; X X case SPLIT_BOT_MARK_CODE: X print_esc("splitbotmark"); X break; X } X break; X X case MATH_ACCENT: X print_esc("mathaccent"); X break; X X case MATH_CHAR_NUM: X print_esc("mathchar"); X break; X X case MATH_CHOICE: X print_esc("mathchoice"); X break; X X case MULTIPLY: X print_esc("multiply"); X break; X X case NO_ALIGN: X print_esc("noalign"); X break; X X case NO_EXPAND: X print_esc("noexpand"); X break; X X case NON_SCRIPT: X print_esc("nonscript"); X break; X X case OMIT: X print_esc("omit"); X break; X X case RADICAL: X print_esc("radical"); X break; X X case READ_TO_CS: X print_esc("read"); X break; X X case SET_BOX: X print_esc("setbox"); X break; X X case SET_PREV_GRAF: X print_esc("prevgraf"); X break; X X case SET_SHAPE: X print_esc("parshape"); X break; X X case THE: X print_esc("the"); X break; X X case TOKS_REGISTER: X print_esc("toks"); X break; X X case VADJUST: X print_esc("vadjust"); X break; X X case VALIGN: X print_esc("valign"); X break; X X case VCENTER: X print_esc("vcenter"); X break; X X case VRULE: X print_esc("vrule"); X break; X X case PAR_END: X print_esc("par"); X break; X X case SET_AUX: X if (chr_code == VMODE) X print_esc("prevdepth"); X else print_esc("spacefactor"); X break; X X case SET_PAGE_INT: X if (chr_code == 0) X print_esc("deadcycles"); X else print_esc("insertpenalties"); X break; X X case SET_BOX_DIMEN: X if (chr_code == WIDTH_OFFSET) X print_esc("wd"); X else if (chr_code == HEIGHT_OFFSET) X print_esc("ht"); X else print_esc("dp"); X break; X X case SET_PAGE_DIMEN: X switch (chr_code) X { X case 0: X print_esc("pagegoal"); X break; X X case 1: X print_esc("pagetotal"); X break; X X case 2: X print_esc("pagestretch"); X break; X X case 3: X print_esc("pagefilstretch"); X break; X X case 4: X print_esc("pagefillstretch"); X break; X X case 5: X print_esc("pagefilllstretch"); X break; X X case 6: X print_esc("pageshrink"); X break; X } X break; X X case LAST_ITEM: X if (chr_code == INT_VAL) X print_esc("lastpenalty"); X else if (chr_code == DIMEN_VAL) X print_esc("lastkern"); X else print_esc("lastskip"); X break; X X case REGISTER: X if (chr_code == INT_VAL) X print_esc("count"); X else if (chr_code == DIMEN_VAL) X print_esc("dimen"); X else if (chr_code == GLUE_VAL) X print_esc("skip"); X else print_esc("muskip"); X break; X X case CONVERT: X switch (chr_code) X { X case NUMBER_CODE: X print_esc("number"); X break; X X case ROMAN_NUMERAL_CODE: X print_esc("romannumeral"); X break; X X case STRING_CODE: X print_esc("string"); X break; X X case MEANING_CODE: X print_esc("meaning"); X break; X X case FONT_NAME_CODE: X print_esc("fontname"); X break; X X default: X print_esc("jobname"); X break; X } X break; X X case IF_TEST: X switch (chr_code) X { X case IF_CHAR_CODE: X print_esc("if"); X break; X X case IF_CAT_CODE: X print_esc("ifcat"); X break; X X case IF_INT_CODE: X print_esc("ifnum"); X break; X X case IF_DIM_CODE: X print_esc("ifdim"); X break; X X case IF_ODD_CODE: X print_esc("ifodd"); X break; X X case IF_VMODE_CODE: X print_esc("ifvmode"); X break; X X case IF_HMODE_CODE: X print_esc("ifhmode"); X break; X X case IF_MMODE_CODE: X print_esc("ifmmode"); X break; X X case IF_INNER_CODE: X print_esc("ifinner"); X break; X X case IF_VOID_CODE: X print_esc("ifvoid"); X break; X X case IF_HBOX_CODE: X print_esc("ifhbox"); X break; X X case IF_VBOX_CODE: X print_esc("ifvbox"); X break; X X case IFX_CODE: X print_esc("ifx"); X break; X X case IF_EOF_CODE: X print_esc("ifeof"); X break; X X case IF_TRUE_CODE: X print_esc("iftrue"); X break; X X case IF_FALSE_CODE: X print_esc("iffalse"); X break; X X case IF_CASE_CODE: X print_esc("ifcase"); X break; X } X break; X X case FI_OR_ELSE: X if (chr_code == FI_CODE) X print_esc("fi"); X else if (chr_code == OR_CODE) X print_esc("or"); X else print_esc("else"); X break; X X case PREFIX: X if (chr_code == 1) X print_esc("long"); X else if (chr_code == 2) X print_esc("outer"); X else print_esc("global"); X break; X X case DEF: X if (chr_code == 0) X print_esc("def"); X else if (chr_code == 1) X print_esc("gdef"); X else if (chr_code == 2) X print_esc("edef"); X else print_esc("xdef"); X break; X X case LET: X if (chr_code != NORMAL) X print_esc("futurelet"); X else print_esc("let"); X break; X X case SHORTHAND_DEF: X switch (chr_code) X { X case CHAR_DEF_CODE: X print_esc("chardef"); X break; X X case MATH_CHAR_DEF_CODE: X print_esc("mathchardef"); X break; X X case COUNT_DEF_CODE: X print_esc("countdef"); X break; X X case DIMEN_DEF_CODE: X print_esc("dimendef"); X break; X X case SKIP_DEF_CODE: X print_esc("skipdef"); X break; X X case MU_SKIP_DEF_CODE: X print_esc("muskipdef"); X break; X X default: X print_esc("toksdef"); X break; X } X break; X X case CHAR_GIVEN: X print_esc("char"); X print_hex((val) chr_code); X break; X X case MATH_GIVEN: X print_esc("mathchar"); X print_hex((val) chr_code); X break; X X case DEF_CODE: X if (chr_code == CAT_CODE_BASE) X print_esc("catcode"); X else if (chr_code == MATH_CODE_BASE) X print_esc("mathcode"); X else if (chr_code == LC_CODE_BASE) X print_esc("lccode"); X else if (chr_code == UC_CODE_BASE) X print_esc("uccode"); X else if (chr_code == SF_CODE_BASE) X print_esc("sfcode"); X else print_esc("delcode"); X break; X X case DEF_FAMILY: X print_size(chr_code - MATH_FONT_BASE); X break; X X case SET_FONT: X print("select font "); X print_str(font_name[chr_code]); X if (font_size[chr_code] != font_dsize[chr_code]) { X print(" at "); X print_scaled(font_size[chr_code]); X print("pt"); X } X break; X X case ASSIGN_FONT_INT: X if (chr_code == 1) X print_esc("skewchar"); X else print_esc("hyphenchar"); X break; X X case HYPH_DATA: X if (chr_code == 1) X print_esc("patterns"); X else print_esc("hyphenation"); X break; X X case SET_INTERACTION: X switch (chr_code) X { X case BATCH_MODE: X print_esc("batchmode"); X break; X X case NONSTOP_MODE: X print_esc("nonstop"); X break; X X case SCROLL_MODE: X print_esc("scrollmode"); X break; X X default: X print_esc("errorstopmode"); X break; X } X break; X X case IN_STREAM: X if (chr_code == 0) X print_esc("closein"); X else print_esc("openin"); X break; X X case MESSAGE: X if (chr_code == 0) X print_esc("message"); X else print_esc("errmessage"); X break; X X case CASE_SHIFT: X if (chr_code == LC_CODE_BASE) X print_esc("lowercase"); X else print_esc("uppercase"); X break; X X case XRAY: X switch (chr_code) X { X case SHOW_BOX_CODE: X print_esc("showbox"); X break; X X case SHOW_THE_CODE: X print_esc("showthe"); X break; X X case SHOW_LISTS: X print_esc("showlists"); X break; X X default: X print_esc("show"); X break; X } X break; X X case UNDEFINED_CS: X print("undefined"); X break; X X case CALL: X print("macro"); X break; X X case LONG_CALL: X print_esc("long macro"); X break; X X case OUTER_CALL: X print_esc("outer macro"); X break; X X case LONG_OUTER_CALL: X print_esc("long"); X print_esc("outer macro"); X break; X X case END_TEMPLATE: X print_esc("outer endtemplate"); X break; X X case STOP: X if (chr_code == 1) X print_esc("dump"); X else print_esc("end"); X break; X X case HSKIP: X switch (chr_code) X { X case SKIP_CODE: X print_esc("hskip"); X break; X X case FIL_CODE: X print_esc("hfil"); X break; X X case FILL_CODE: X print_esc("hfill"); X break; X X case SS_CODE: X print_esc("hss"); X break; X X default: X print_esc("hfilneg"); X break; X } X break; X X case VSKIP: X switch (chr_code) X { X case SKIP_CODE: X print_esc("vskip"); X break; X X case FIL_CODE: X print_esc("vfil"); X break; X X case FILL_CODE: X print_esc("vfill"); X break; X X case SS_CODE: X print_esc("vss"); X break; X X default: X print_esc("vfilneg"); X break; X } X break; X X case MSKIP: X print_esc("mskip"); X break; X X case KERN: X print_esc("kern"); X break; X X case MKERN: X print_esc("mkern"); X break; X X case HMOVE: X if (chr_code == 1) X print_esc("moveleft"); X else print_esc("moveright"); X break; X X case VMOVE: X if (chr_code == 1) X print_esc("raise"); X else print_esc("lower"); X break; X X case MAKE_BOX: X switch (chr_code) X { X case BOX_CODE: X print_esc("box"); X break; X X case COPY_CODE: X print_esc("copy"); X break; X X case LAST_BOX_CODE: X print_esc("lastbox"); X break; X X case VSPLIT_CODE: X print_esc("vsplit"); X break; X X case VTOP_CODE: X print_esc("vtop"); X break; X X case VTOP_CODE + VMODE: X print_esc("vbox"); X break; X X default: X print_esc("hbox"); X break; X } X break; X X case LEADER_SHIP: X if (chr_code == A_LEADERS) X print_esc("leaders"); X else if (chr_code == C_LEADERS) X print_esc("cleaders"); X else if (chr_code == X_LEADERS) X print_esc("xleaders"); X else print_esc("shipout"); X break; X X case START_PAR: X if (chr_code == 0) X print_esc("noindent"); X else print_esc("indent"); X break; X X case REMOVE_ITEM: X if (chr_code == GLUE_NODE) X print_esc("unskip"); X else if (chr_code == KERN_NODE) X print_esc("unkern"); X else print_esc("unpenalty"); X break; X X case UN_HBOX: X if (chr_code == COPY_CODE) X print_esc("unhcopy"); X else print_esc("unhbox"); X break; X X case UN_VBOX: X if (chr_code == COPY_CODE) X print_esc("unvcopy"); X else print_esc("unvbox"); X break; X X case DISCRETIONARY: X if (chr_code == 1) X print_esc("-"); X else print_esc("discretionary"); X break; X X case EQ_NO: X if (chr_code == 1) X print_esc("leqno"); X else print_esc("eqno"); X break; X X case MATH_COMP: X switch (chr_code) X { X case ORD_NOAD: X print_esc("mathord"); X break; X X case OP_NOAD: X print_esc("mathop"); X break; X X case BIN_NOAD: X print_esc("mathbin"); X break; X X case REL_NOAD: X print_esc("mathrel"); X break; X X case OPEN_NOAD: X print_esc("mathopen"); X break; X X case CLOSE_NOAD: X print_esc("mathclose"); X break; X X case PUNCT_NOAD: X print_esc("mathpunct"); X break; X X case INNER_NOAD: X print_esc("mathinner"); X break; X X case UNDER_NOAD: X print_esc("underline"); X break; X X default: X print_esc("overline"); X break; X } X break; X X case LIMIT_SWITCH: X if (chr_code == LIMITS) X print_esc("limits"); X else if (chr_code == NO_LIMITS) X print_esc("nolimits"); X else print_esc("displaylimits"); X break; X X case MATH_STYLE: X print_style(chr_code); X break; X X case ABOVE: X switch (chr_code) X { X case OVER_CODE: X print_esc("over"); X break; X X case ATOP_CODE: X print_esc("atop"); X break; X X case DELIMITED_CODE + ABOVE_CODE: X print_esc("abovewithdelims"); X break; X X case DELIMITED_CODE + OVER_CODE: X print_esc("overwithdelims"); X break; X X case DELIMITED_CODE + ATOP_CODE: X print_esc("atopwithdelims"); X break; X X default: X print_esc("above"); X break; X } X break; X X case LEFT_RIGHT: X if (chr_code == LEFT_NOAD) X print_esc("left"); X else print_esc("right"); X break; X X case EXTENSION: X switch (chr_code) { X case OPEN_NODE: X print_esc("openout"); X break; X X case WRITE_NODE: X print_esc("write"); X break; X X case CLOSE_NODE: X print_esc("closeout"); X break; X X case SPECIAL_NODE: X print_esc("special"); X break; X X case IMMEDIATE_CODE: X print_esc("immediate"); X break; X } X break; X } X } X Xinit_cmds () X{ X#ifdef INIT Xno_new_control_sequence = FALSE; Xprimitive("lineskip", ASSIGN_GLUE, GLUE_BASE + LINE_SKIP_CODE); Xprimitive("baselineskip", ASSIGN_GLUE, GLUE_BASE + BASELINE_SKIP_CODE); Xprimitive("parskip", ASSIGN_GLUE, GLUE_BASE + PAR_SKIP_CODE); Xprimitive("abovedisplayskip", ASSIGN_GLUE, XGLUE_BASE + ABOVE_DISPLAY_SKIP_CODE); Xprimitive("abovedisplayshortskip", ASSIGN_GLUE, XGLUE_BASE + ABOVE_DISPLAY_SHORT_SKIP_CODE); Xprimitive("belowdisplayskip", ASSIGN_GLUE, XGLUE_BASE + BELOW_DISPLAY_SKIP_CODE); Xprimitive("belowdisplayshortskip", ASSIGN_GLUE, XGLUE_BASE + BELOW_DISPLAY_SHORT_SKIP_CODE); Xprimitive("leftskip", ASSIGN_GLUE, GLUE_BASE + LEFT_SKIP_CODE); Xprimitive("rightskip", ASSIGN_GLUE, GLUE_BASE + RIGHT_SKIP_CODE); Xprimitive("topskip", ASSIGN_GLUE, GLUE_BASE + TOP_SKIP_CODE); Xprimitive("splittopskip", ASSIGN_GLUE, GLUE_BASE + SPLIT_TOP_SKIP_CODE); Xprimitive("tabskip", ASSIGN_GLUE, GLUE_BASE + TAB_SKIP_CODE); Xprimitive("spaceskip", ASSIGN_GLUE, GLUE_BASE + SPACE_SKIP_CODE); Xprimitive("xspaceskip", ASSIGN_GLUE, GLUE_BASE + XSPACE_SKIP_CODE); Xprimitive("parfillskip", ASSIGN_GLUE, GLUE_BASE + PAR_FILL_SKIP_CODE); Xprimitive("thinmuskip", ASSIGN_MU_GLUE, GLUE_BASE + THIN_MU_SKIP_CODE); Xprimitive("medmuskip", ASSIGN_MU_GLUE, GLUE_BASE + MED_MU_SKIP_CODE); Xprimitive("thickmuskip", ASSIGN_MU_GLUE, GLUE_BASE + THICK_MU_SKIP_CODE); Xprimitive("output", ASSIGN_TOKS, OUTPUT_ROUTINE_LOC); Xprimitive("everycr", ASSIGN_TOKS, EVERY_CR_LOC); Xprimitive("everypar", ASSIGN_TOKS, EVERY_PAR_LOC); Xprimitive("everymath", ASSIGN_TOKS, EVERY_MATH_LOC); Xprimitive("everydisplay", ASSIGN_TOKS, EVERY_DISPLAY_LOC); Xprimitive("everyhbox", ASSIGN_TOKS, EVERY_HBOX_LOC); Xprimitive("everyvbox", ASSIGN_TOKS, EVERY_VBOX_LOC); Xprimitive("everyjob", ASSIGN_TOKS, EVERY_JOB_LOC); Xprimitive("errhelp", ASSIGN_TOKS, ERR_HELP_LOC); Xprimitive("pretolerance", ASSIGN_INT, INT_BASE + PRETOLERANCE_CODE); Xprimitive("tolerance", ASSIGN_INT, INT_BASE + TOLERANCE_CODE); Xprimitive("linepenalty", ASSIGN_INT, INT_BASE + LINE_PENALTY_CODE); Xprimitive("hyphenpenalty", ASSIGN_INT, INT_BASE + HYPHEN_PENALTY_CODE); Xprimitive("exhyphenpenalty", ASSIGN_INT, INT_BASE + EX_HYPHEN_PENALTY_CODE); Xprimitive("clubpenalty", ASSIGN_INT, INT_BASE + CLUB_PENALTY_CODE); Xprimitive("widowpenalty", ASSIGN_INT, INT_BASE + WIDOW_PENALTY_CODE); Xprimitive("displaywidowpenalty", ASSIGN_INT, XINT_BASE + DISPLAY_WIDOW_PENALTY_CODE); Xprimitive("brokenpenalty", ASSIGN_INT, INT_BASE + BROKEN_PENALTY_CODE); Xprimitive("binoppenalty", ASSIGN_INT, INT_BASE + BIN_OP_PENALTY_CODE); Xprimitive("relpenalty", ASSIGN_INT, INT_BASE + REL_PENALTY_CODE); Xprimitive("predisplaypenalty", ASSIGN_INT, XINT_BASE + PRE_DISPLAY_PENALTY_CODE); Xprimitive("postdisplaypenalty", ASSIGN_INT, XINT_BASE + POST_DISPLAY_PENALTY_CODE); Xprimitive("interlinepenalty", ASSIGN_INT, XINT_BASE + INTER_LINE_PENALTY_CODE); Xprimitive("doublehyphendemerits", ASSIGN_INT, XINT_BASE + DOUBLE_HYPHEN_DEMERITS_CODE); Xprimitive("finalhyphendemerits", ASSIGN_INT, XINT_BASE + FINAL_HYPHEN_DEMERITS_CODE); Xprimitive("adjdemerits", ASSIGN_INT, INT_BASE + ADJ_DEMERITS_CODE); Xprimitive("mag", ASSIGN_INT, INT_BASE + MAG_CODE); Xprimitive("delimiterfactor", ASSIGN_INT, INT_BASE + DELIMITER_FACTOR_CODE); Xprimitive("looseness", ASSIGN_INT, INT_BASE + LOOSENESS_CODE); Xprimitive("time", ASSIGN_INT, INT_BASE + TIME_CODE); Xprimitive("day", ASSIGN_INT, INT_BASE + DAY_CODE); Xprimitive("month", ASSIGN_INT, INT_BASE + MONTH_CODE); Xprimitive("year", ASSIGN_INT, INT_BASE + YEAR_CODE); Xprimitive("showboxbreadth", ASSIGN_INT, INT_BASE + SHOW_BOX_BREADTH_CODE); Xprimitive("showboxdepth", ASSIGN_INT, INT_BASE + SHOW_BOX_DEPTH_CODE); Xprimitive("hbadness", ASSIGN_INT, INT_BASE + HBADNESS_CODE); Xprimitive("vbadness", ASSIGN_INT, INT_BASE + VBADNESS_CODE); Xprimitive("pausing", ASSIGN_INT, INT_BASE + PAUSING_CODE); Xprimitive("tracingonline", ASSIGN_INT, INT_BASE + TRACING_ONLINE_CODE); Xprimitive("tracingmacros", ASSIGN_INT, INT_BASE + TRACING_MACROS_CODE); Xprimitive("tracingstats", ASSIGN_INT, INT_BASE + TRACING_STATS_CODE); Xprimitive("tracingoutput", ASSIGN_INT, INT_BASE + TRACING_OUTPUT_CODE); Xprimitive("tracingparagraphs", ASSIGN_INT, INT_BASE + TRACING_PARAGRAPHS_CODE); Xprimitive("tracingpages", ASSIGN_INT, INT_BASE + TRACING_PAGES_CODE); Xprimitive("tracinglostchars", ASSIGN_INT, INT_BASE + TRACING_LOST_CHARS_CODE); Xprimitive("tracingcommands", ASSIGN_INT, INT_BASE + TRACING_COMMANDS_CODE); Xprimitive("tracingrestores", ASSIGN_INT, INT_BASE + TRACING_RESTORES_CODE); Xprimitive("uchyph", ASSIGN_INT, INT_BASE + UC_HYPH_CODE); Xprimitive("outputpenalty", ASSIGN_INT, INT_BASE + OUTPUT_PENALTY_CODE); Xprimitive("maxdeadcycles", ASSIGN_INT, INT_BASE + MAX_DEAD_CYCLES_CODE); Xprimitive("floatingpenalty", ASSIGN_INT, INT_BASE + FLOATING_PENALTY_CODE); Xprimitive("globaldefs", ASSIGN_INT, INT_BASE + GLOBAL_DEFS_CODE); Xprimitive("fam", ASSIGN_INT, INT_BASE + CUR_FAM_CODE); Xprimitive("escapechar", ASSIGN_INT, INT_BASE + ESCAPE_CHAR_CODE); Xprimitive("defaulthyphenchar", ASSIGN_INT, INT_BASE + DEFAULT_HYPHEN_CHAR_CODE); Xprimitive("defaultskewchar", ASSIGN_INT, INT_BASE + DEFAULT_SKEW_CHAR_CODE); Xprimitive("endlinechar", ASSIGN_INT, INT_BASE + END_LINE_CHAR_CODE); Xprimitive("newlinechar", ASSIGN_INT, INT_BASE + NEW_LINE_CHAR_CODE); Xprimitive("parindent", ASSIGN_DIMEN, DIMEN_BASE + PAR_INDENT_CODE); Xprimitive("mathsurround", ASSIGN_DIMEN, DIMEN_BASE + MATH_SURROUND_CODE); Xprimitive("lineskiplimit", ASSIGN_DIMEN, DIMEN_BASE + LINE_SKIP_LIMIT_CODE); Xprimitive("hsize", ASSIGN_DIMEN, DIMEN_BASE + HSIZE_CODE); Xprimitive("vsize", ASSIGN_DIMEN, DIMEN_BASE + VSIZE_CODE); Xprimitive("maxdepth", ASSIGN_DIMEN, DIMEN_BASE + MAX_DEPTH_CODE); Xprimitive("splitmaxdepth", ASSIGN_DIMEN, DIMEN_BASE + SPLIT_MAX_DEPTH_CODE); Xprimitive("boxmaxdepth", ASSIGN_DIMEN, DIMEN_BASE + BOX_MAX_DEPTH_CODE); Xprimitive("hfuzz", ASSIGN_DIMEN, DIMEN_BASE + HFUZZ_CODE); Xprimitive("vfuzz", ASSIGN_DIMEN, DIMEN_BASE + VFUZZ_CODE); Xprimitive("delimitershortfall", ASSIGN_DIMEN, XDIMEN_BASE + DELIMITER_SHORTFALL_CODE); Xprimitive("nulldelimiterspace", ASSIGN_DIMEN, XDIMEN_BASE + NULL_DELIMITER_SPACE_CODE); Xprimitive("scriptspace", ASSIGN_DIMEN, DIMEN_BASE + SCRIPT_SPACE_CODE); Xprimitive("predisplaysize", ASSIGN_DIMEN, DIMEN_BASE + PRE_DISPLAY_SIZE_CODE); Xprimitive("displaywidth", ASSIGN_DIMEN, DIMEN_BASE + DISPLAY_WIDTH_CODE); Xprimitive("displayindent", ASSIGN_DIMEN, DIMEN_BASE + DISPLAY_INDENT_CODE); Xprimitive("overfullrule", ASSIGN_DIMEN, DIMEN_BASE + OVERFULL_RULE_CODE); Xprimitive("hangafter", ASSIGN_INT, INT_BASE + HANG_AFTER_CODE); Xprimitive("hangindent", ASSIGN_DIMEN, DIMEN_BASE + HANG_INDENT_CODE); Xprimitive("hoffset", ASSIGN_DIMEN, DIMEN_BASE + H_OFFSET_CODE); Xprimitive("voffset", ASSIGN_DIMEN, DIMEN_BASE + V_OFFSET_CODE); Xprimitive(" ", EX_SPACE, 0); Xprimitive("/", ITAL_CORR, 0); Xprimitive("accent", ACCENT, 0); Xprimitive("advance", ADVANCE, 0); Xprimitive("afterassignment", AFTER_ASSIGNMENT, 0); Xprimitive("aftergroup", AFTER_GROUP, 0); Xprimitive("begingroup", BEGIN_GROUP, 0); Xprimitive("char", CHAR_NUM, 0); Xprimitive("csname", CS_NAME, 0); Xprimitive("font", DEF_FONT, 0); Xprimitive("fontdimen", ASSIGN_FONT_DIMEN, 0); Xprimitive("nullfont", SET_FONT, NULL_FONT); Xeqtb[FROZEN_NULL_FONT] = eqtb[cur_val]; Xfont_name[NULL_FONT] = Xtext(FROZEN_NULL_FONT) = text(cur_val); Xfont_area[NULL_FONT] = null_str; Xprimitive("delimiter", DELIM_NUM, 0); Xprimitive("divide", DIVIDE, 0); Xprimitive("endcsname", END_CS_NAME, 0); Xprimitive("endgroup", END_GROUP, 0); Xtext(FROZEN_END_GROUP) = make_string_given("endgroup"); Xeqtb[FROZEN_END_GROUP] = eqtb[cur_val]; Xprimitive("expandafter", EXPAND_AFTER, 0); Xprimitive("halign", HALIGN, 0); Xprimitive("hrule", HRULE, 0); Xprimitive("ignorespaces", IGNORE_SPACES, 0); Xprimitive("insert", INSERT, 0); Xprimitive("mark", MARK, 0); Xprimitive("topmark", TOP_BOT_MARK, TOP_MARK_CODE); Xprimitive("firstmark", TOP_BOT_MARK, FIRST_MARK_CODE); Xprimitive("botmark", TOP_BOT_MARK, BOT_MARK_CODE); Xprimitive("splitfirstmark", TOP_BOT_MARK, SPLIT_FIRST_MARK_CODE); Xprimitive("splitbotmark", TOP_BOT_MARK, SPLIT_BOT_MARK_CODE); Xprimitive("mathaccent", MATH_ACCENT, 0); Xprimitive("mathchar", MATH_CHAR_NUM, 0); Xprimitive("mathchoice", MATH_CHOICE, 0); Xprimitive("multiply", MULTIPLY, 0); Xprimitive("noalign", NO_ALIGN, 0); Xprimitive("noexpand", NO_EXPAND, 0); Xeq_type(FROZEN_DONT_EXPAND) = DONT_EXPAND; Xtext(FROZEN_DONT_EXPAND) = make_string_given("notexpanded:"); Xprimitive("nonscript", NON_SCRIPT, 0); Xprimitive("omit", OMIT, 0); Xprimitive("parshape", SET_SHAPE, 0); Xprimitive("penalty", BREAK_PENALTY, 0); Xprimitive("prevgraf", SET_PREV_GRAF, 0); Xprimitive("radical", RADICAL, 0); Xprimitive("read", READ_TO_CS, 0); Xprimitive("relax", RELAX, 256); Xtext(FROZEN_RELAX) = make_string_given("relax"); Xeqtb[FROZEN_RELAX] = eqtb[cur_val]; Xprimitive("setbox", SET_BOX, 0); Xprimitive("the", THE, 0); Xprimitive("toks", TOKS_REGISTER, 0); Xprimitive("vadjust", VADJUST, 0); Xprimitive("valign", VALIGN, 0); Xprimitive("vcenter", VCENTER, 0); Xprimitive("vrule", VRULE, 0); Xprimitive("par", PAR_END, 0); Xpar_loc = cur_val; par_token = CS_TOKEN_FLAG + par_loc; Xprimitive("count", REGISTER, INT_VAL); Xprimitive("dimen", REGISTER, DIMEN_VAL); Xprimitive("skip", REGISTER, GLUE_VAL); Xprimitive("muskip", REGISTER, MU_VAL); Xprimitive("spacefactor", SET_AUX, HMODE); Xprimitive("prevdepth", SET_AUX, VMODE); Xprimitive("deadcycles", SET_PAGE_INT, 0); Xprimitive("insertpenalties", SET_PAGE_INT, 1); Xprimitive("wd", SET_BOX_DIMEN, WIDTH_OFFSET); Xprimitive("ht", SET_BOX_DIMEN, HEIGHT_OFFSET); Xprimitive("dp", SET_BOX_DIMEN, DEPTH_OFFSET); Xprimitive("pagegoal", SET_PAGE_DIMEN, 0); Xprimitive("pagetotal", SET_PAGE_DIMEN, 1); Xprimitive("pagestretch", SET_PAGE_DIMEN, 2); Xprimitive("pagefilstretch", SET_PAGE_DIMEN, 3); Xprimitive("pagefillstretch", SET_PAGE_DIMEN, 4); Xprimitive("pagefilllstretch", SET_PAGE_DIMEN, 5); Xprimitive("pageshrink", SET_PAGE_DIMEN, 6); Xprimitive("pagedepth", SET_PAGE_DIMEN, 7); Xprimitive("lastpenalty", LAST_ITEM, INT_VAL); Xprimitive("lastkern", LAST_ITEM, DIMEN_VAL); Xprimitive("lastskip", LAST_ITEM, GLUE_VAL); Xprimitive("input", INPUT, 0); Xprimitive("endinput", INPUT, 1); Xprimitive("number", CONVERT, NUMBER_CODE); Xprimitive("romannumeral", CONVERT, ROMAN_NUMERAL_CODE); Xprimitive("string", CONVERT, STRING_CODE); Xprimitive("meaning", CONVERT, MEANING_CODE); Xprimitive("fontname", CONVERT, FONT_NAME_CODE); Xprimitive("jobname", CONVERT, JOB_NAME_CODE); Xprimitive("if", IF_TEST, IF_CHAR_CODE); Xprimitive("ifcat", IF_TEST, IF_CAT_CODE); Xprimitive("ifnum", IF_TEST, IF_INT_CODE); Xprimitive("ifdim", IF_TEST, IF_DIM_CODE); Xprimitive("ifodd", IF_TEST, IF_ODD_CODE); Xprimitive("ifvmode", IF_TEST, IF_VMODE_CODE); Xprimitive("ifhmode", IF_TEST, IF_HMODE_CODE); Xprimitive("ifmmode", IF_TEST, IF_MMODE_CODE); Xprimitive("ifinner", IF_TEST, IF_INNER_CODE); Xprimitive("ifvoid", IF_TEST, IF_VOID_CODE); Xprimitive("ifhbox", IF_TEST, IF_HBOX_CODE); Xprimitive("ifvbox", IF_TEST, IF_VBOX_CODE); Xprimitive("ifx", IF_TEST, IFX_CODE); Xprimitive("ifeof", IF_TEST, IF_EOF_CODE); Xprimitive("iftrue", IF_TEST, IF_TRUE_CODE); Xprimitive("iffalse", IF_TEST, IF_FALSE_CODE); Xprimitive("ifcase", IF_TEST, IF_CASE_CODE); Xprimitive("fi", FI_OR_ELSE, FI_CODE); Xtext(FROZEN_FI) = make_string_given("fi"); Xeqtb[FROZEN_FI] = eqtb[cur_val]; Xprimitive("or", FI_OR_ELSE, OR_CODE); Xprimitive("else", FI_OR_ELSE, ELSE_CODE); Xprimitive("hskip", HSKIP, SKIP_CODE); Xprimitive("hfil", HSKIP, FIL_CODE); Xprimitive("hfill", HSKIP, FILL_CODE); Xprimitive("hss", HSKIP, SS_CODE); Xprimitive("hfilneg", HSKIP, FIL_NEG_CODE); Xprimitive("vskip", VSKIP, SKIP_CODE); Xprimitive("vfil", VSKIP, FIL_CODE); Xprimitive("vfill", VSKIP, FILL_CODE); Xprimitive("vss", VSKIP, SS_CODE); Xprimitive("vfilneg", VSKIP, FIL_NEG_CODE); Xprimitive("mskip", MSKIP, MSKIP_CODE); Xprimitive("kern", KERN, EXPLICIT); Xprimitive("mkern", MKERN, MU_GLUE); Xprimitive("moveleft", HMOVE, 1); Xprimitive("moveright", HMOVE, 0); Xprimitive("raise", VMOVE, 1); Xprimitive("lower", VMOVE, 0); Xprimitive("box", MAKE_BOX, BOX_CODE); Xprimitive("copy", MAKE_BOX, COPY_CODE); Xprimitive("lastbox", MAKE_BOX, LAST_BOX_CODE); Xprimitive("vsplit", MAKE_BOX, VSPLIT_CODE); Xprimitive("vtop", MAKE_BOX, VTOP_CODE); Xprimitive("vbox", MAKE_BOX, VTOP_CODE + VMODE); Xprimitive("hbox", MAKE_BOX, VTOP_CODE + HMODE); Xprimitive("indent", START_PAR, 1); Xprimitive("noindent", START_PAR, 0); Xprimitive("shipout", LEADER_SHIP, A_LEADERS - 1); Xprimitive("leaders", LEADER_SHIP, A_LEADERS); Xprimitive("cleaders", LEADER_SHIP, C_LEADERS); Xprimitive("xleaders", LEADER_SHIP, X_LEADERS); Xprimitive("unpenalty", REMOVE_ITEM, PENALTY_NODE); Xprimitive("unkern", REMOVE_ITEM, KERN_NODE); Xprimitive("unskip", REMOVE_ITEM, GLUE_NODE); Xprimitive("unhbox", UN_HBOX, BOX_CODE); Xprimitive("unhcopy", UN_HBOX, COPY_CODE); Xprimitive("unvbox", UN_VBOX, BOX_CODE); Xprimitive("unvcopy", UN_VBOX, COPY_CODE); Xprimitive("discretionary", DISCRETIONARY, 0); Xprimitive("-", DISCRETIONARY, 1); Xprimitive("eqno", EQ_NO, 0); Xprimitive("leqno", EQ_NO, 1); Xprimitive("mathord", MATH_COMP, ORD_NOAD); Xprimitive("mathop", MATH_COMP, OP_NOAD); Xprimitive("mathbin", MATH_COMP, BIN_NOAD); Xprimitive("mathrel", MATH_COMP, REL_NOAD); Xprimitive("mathopen", MATH_COMP, OPEN_NOAD); Xprimitive("mathclose", MATH_COMP, CLOSE_NOAD); Xprimitive("mathpunct", MATH_COMP, PUNCT_NOAD); Xprimitive("mathinner", MATH_COMP, INNER_NOAD); Xprimitive("underline", MATH_COMP, UNDER_NOAD); Xprimitive("overline", MATH_COMP, OVER_NOAD); Xprimitive("displaylimits", LIMIT_SWITCH, NORMAL); Xprimitive("limits", LIMIT_SWITCH, LIMITS); Xprimitive("nolimits", LIMIT_SWITCH, NO_LIMITS); Xprimitive("displaystyle", MATH_STYLE, DISPLAY_STYLE); Xprimitive("textstyle", MATH_STYLE, TEXT_STYLE); Xprimitive("scriptstyle", MATH_STYLE, SCRIPT_STYLE); Xprimitive("scriptscriptstyle", MATH_STYLE, SCRIPT_SCRIPT_STYLE); Xprimitive("above", ABOVE, ABOVE_CODE); Xprimitive("over", ABOVE, OVER_CODE); Xprimitive("atop", ABOVE, ATOP_CODE); Xprimitive("abovewithdelims", ABOVE, DELIMITED_CODE + ABOVE_CODE); Xprimitive("overwithdelims", ABOVE, DELIMITED_CODE + OVER_CODE); Xprimitive("atopwithdelims", ABOVE, DELIMITED_CODE + ATOP_CODE); Xprimitive("left", LEFT_RIGHT, LEFT_NOAD); Xprimitive("right", LEFT_RIGHT, RIGHT_NOAD); Xtext(FROZEN_RIGHT) = make_string_given("right"); Xeqtb[FROZEN_RIGHT] = eqtb[cur_val]; Xprimitive("span", TAB_MARK, SPAN_CODE); Xprimitive("cr", CAR_RET, CR_CODE); Xtext(FROZEN_CR) = text(cur_val); Xeqtb[FROZEN_CR] = eqtb[cur_val]; Xprimitive("crcr", CAR_RET, CR_CR_CODE); Xtext(FROZEN_END_TEMPLATE) = make_string_given("endtemplate"); Xtext(FROZEN_ENDV) = text(FROZEN_END_TEMPLATE); Xeq_type(FROZEN_ENDV) = ENDV; Xequiv(FROZEN_ENDV) = null_list; Xeq_level(FROZEN_ENDV) = LEVEL_ONE; Xeqtb[FROZEN_END_TEMPLATE] = eqtb[FROZEN_ENDV]; Xeq_type(FROZEN_END_TEMPLATE) = END_TEMPLATE; Xprimitive("long", PREFIX, 1); Xprimitive("outer", PREFIX, 2); Xprimitive("global", PREFIX, 4); Xprimitive("def", DEF, 0); Xprimitive("gdef", DEF, 1); Xprimitive("edef", DEF, 2); Xprimitive("xdef", DEF, 3); Xprimitive("let", LET, NORMAL); Xprimitive("futurelet", LET, NORMAL + 1); Xprimitive("chardef", SHORTHAND_DEF, CHAR_DEF_CODE); Xprimitive("mathchardef", SHORTHAND_DEF, MATH_CHAR_DEF_CODE); Xprimitive("countdef", SHORTHAND_DEF, COUNT_DEF_CODE); Xprimitive("dimendef", SHORTHAND_DEF, DIMEN_DEF_CODE); Xprimitive("skipdef", SHORTHAND_DEF, SKIP_DEF_CODE); Xprimitive("muskipdef", SHORTHAND_DEF, MU_SKIP_DEF_CODE); Xprimitive("toksdef", SHORTHAND_DEF, TOKS_DEF_CODE); Xprimitive("catcode", DEF_CODE, CAT_CODE_BASE); Xprimitive("mathcode", DEF_CODE, MATH_CODE_BASE); Xprimitive("lccode", DEF_CODE, LC_CODE_BASE); Xprimitive("uccode", DEF_CODE, UC_CODE_BASE); Xprimitive("sfcode", DEF_CODE, SF_CODE_BASE); Xprimitive("delcode", DEF_CODE, DEL_CODE_BASE); Xprimitive("textfont", DEF_FAMILY, MATH_FONT_BASE); Xprimitive("scriptfont", DEF_FAMILY, MATH_FONT_BASE + SCRIPT_SIZE); Xprimitive("scriptscriptfont", DEF_FAMILY, MATH_FONT_BASE + SCRIPT_SCRIPT_SIZE); Xprimitive("hyphenation", HYPH_DATA, 0); Xprimitive("patterns", HYPH_DATA, 1); Xprimitive("hyphenchar", ASSIGN_FONT_INT, 0); Xprimitive("skewchar", ASSIGN_FONT_INT, 1); Xprimitive("batchmode", SET_INTERACTION, BATCH_MODE); Xprimitive("nonstopmode", SET_INTERACTION, NONSTOP_MODE); Xprimitive("scrollmode", SET_INTERACTION, SCROLL_MODE); Xprimitive("errorstopmode", SET_INTERACTION, ERROR_STOP_MODE); Xprimitive("closein", IN_STREAM, 0); Xprimitive("openin", IN_STREAM, 1); Xprimitive("message", MESSAGE, 0); Xprimitive("errmessage", MESSAGE, 1); Xprimitive("lowercase", CASE_SHIFT, LC_CODE_BASE); Xprimitive("uppercase", CASE_SHIFT, UC_CODE_BASE); Xprimitive("show", XRAY, SHOW_CODE); Xprimitive("showbox", XRAY, SHOW_BOX_CODE); Xprimitive("showthe", XRAY, SHOW_THE_CODE); Xprimitive("showlists", XRAY, SHOW_LISTS); Xprimitive("openout", EXTENSION, OPEN_NODE); Xprimitive("write", EXTENSION, WRITE_NODE); Xwrite_loc = cur_val; Xtext(END_WRITE) = make_string_given("endwrite"); Xeq_level(END_WRITE) = LEVEL_ONE; Xeq_type(END_WRITE) = OUTER_CALL; Xequiv(END_WRITE) = NULL; Xprimitive("closeout", EXTENSION, CLOSE_NODE); Xprimitive("special", EXTENSION, SPECIAL_NODE); Xprimitive("immediate", EXTENSION, IMMEDIATE_CODE); Xprimitive("end", STOP, 0); Xprimitive("dump", STOP, 1); Xtext(FROZEN_PROTECTION) = make_string_given("inaccessible"); Xno_new_control_sequence = TRUE; X#endif X} SHAR_EOF chmod 0444 cmds.c || echo "restore of cmds.c fails" set `wc -c cmds.c`;Sum=$1 if test "$Sum" != "33231" then echo original size 33231, current size $Sum;fi echo "x - extracting cmds.h (Text)" sed 's/^X//' << 'SHAR_EOF' > cmds.h && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * cmds.h X */ X X#define ESCAPE 0 X#define RELAX 0 X#define LEFT_BRACE 1 X#define RIGHT_BRACE 2 X#define MATH_SHIFT 3 X#define TAB_MARK 4 X#define CAR_RET 5 X#define OUT_PARAM 5 X#define MAC_PARAM 6 X#define SUP_MARK 7 X#define SUB_MARK 8 X#define IGNORE 9 X#define ENDV 9 X#define SPACER 10 X#define LETTER 11 X#define OTHER_CHAR 12 X#define ACTIVE_CHAR 13 X#define PAR_END 13 X#define MATCH 13 X#define COMMENT 14 X#define END_MATCH 14 X#define STOP 14 X#define INVALID_CHAR 15 X#define DELIM_NUM 15 X#define MAX_CHAR_CODE 15 X#define CHAR_NUM 16 X#define MATH_CHAR_NUM 17 X#define MARK 18 X#define XRAY 19 X#define MAKE_BOX 20 X#define HMOVE 21 X#define VMOVE 22 X#define UN_HBOX 23 X#define UN_VBOX 24 X#define REMOVE_ITEM 25 X#define HSKIP 26 X#define VSKIP 27 X#define MSKIP 28 X#define KERN 29 X#define MKERN 30 X#define LEADER_SHIP 31 X#define HALIGN 32 X#define VALIGN 33 X#define NO_ALIGN 34 X#define VRULE 35 X#define HRULE 36 X#define INSERT 37 X#define VADJUST 38 X#define IGNORE_SPACES 39 X#define AFTER_ASSIGNMENT 40 X#define AFTER_GROUP 41 X#define BREAK_PENALTY 42 X#define START_PAR 43 X#define ITAL_CORR 44 X#define ACCENT 45 X#define MATH_ACCENT 46 X#define DISCRETIONARY 47 X#define EQ_NO 48 X#define LEFT_RIGHT 49 X#define MATH_COMP 50 X#define LIMIT_SWITCH 51 X#define ABOVE 52 X#define MATH_STYLE 53 X#define MATH_CHOICE 54 X#define NON_SCRIPT 55 X#define VCENTER 56 X#define CASE_SHIFT 57 X#define MESSAGE 58 X#define EXTENSION 59 X#define IN_STREAM 60 X#define BEGIN_GROUP 61 X#define END_GROUP 62 X#define OMIT 63 X#define EX_SPACE 64 X#define RADICAL 65 X#define END_CS_NAME 66 X#define MIN_INTERNAL 67 X#define CHAR_GIVEN 67 X#define MATH_GIVEN 68 X#define LAST_ITEM 69 X X#define MAX_NON_PREFIXED_COMMAND 69 X X#define TOKS_REGISTER 70 X#define ASSIGN_TOKS 71 X#define ASSIGN_INT 72 X#define ASSIGN_DIMEN 73 X#define ASSIGN_GLUE 74 X#define ASSIGN_MU_GLUE 75 X#define ASSIGN_FONT_DIMEN 76 X#define ASSIGN_FONT_INT 77 X#define SET_AUX 78 X#define SET_PREV_GRAF 79 X#define SET_PAGE_DIMEN 80 X#define SET_PAGE_INT 81 X#define SET_BOX_DIMEN 82 X#define SET_SHAPE 83 X#define DEF_CODE 84 X#define DEF_FAMILY 85 X#define SET_FONT 86 X#define DEF_FONT 87 X#define REGISTER 88 X#define MAX_INTERNAL 88 X#define ADVANCE 89 X#define MULTIPLY 90 X#define DIVIDE 91 X#define PREFIX 92 X#define LET 93 X#define SHORTHAND_DEF 94 X#define READ_TO_CS 95 X#define DEF 96 X#define SET_BOX 97 X#define HYPH_DATA 98 X#define SET_INTERACTION 99 X#define MAX_COMMAND 99 X X#define UNDEFINED_CS (MAX_COMMAND + 1) X#define EXPAND_AFTER (MAX_COMMAND + 2) X#define NO_EXPAND (MAX_COMMAND + 3) X#define INPUT (MAX_COMMAND + 4) X#define IF_TEST (MAX_COMMAND + 5) X#define FI_OR_ELSE (MAX_COMMAND + 6) X#define CS_NAME (MAX_COMMAND + 7) X#define CONVERT (MAX_COMMAND + 8) X#define THE (MAX_COMMAND + 9) X#define TOP_BOT_MARK (MAX_COMMAND + 10) SHAR_EOF echo "End of part 4" echo "File cmds.h is continued in part 5" echo "5" > s2_seq_.tmp exit 0
glenn@extro.ucc.su.oz.au (G Geers) (02/16/90)
---- Cut Here and unpack ---- #!/bin/sh # this is part 5 of a multipart archive # do not concatenate these parts, unpack them in order with /bin/sh # file cmds.h continued # CurArch=5 if test ! -r s2_seq_.tmp then echo "Please unpack part 1 first!" exit 1; fi ( read Scheck if test "$Scheck" != $CurArch then echo "Please unpack part $Scheck next!" exit 1; else exit 0; fi ) < s2_seq_.tmp || exit 1 echo "x - Continuing file cmds.h" sed 's/^X//' << 'SHAR_EOF' >> cmds.h X#define CALL (MAX_COMMAND + 11) X#define LONG_CALL (MAX_COMMAND + 12) X#define OUTER_CALL (MAX_COMMAND + 13) X#define LONG_OUTER_CALL (MAX_COMMAND + 14) X#define END_TEMPLATE (MAX_COMMAND + 15) X#define DONT_EXPAND (MAX_COMMAND + 16) X#define GLUE_REF (MAX_COMMAND + 17) X#define SHAPE_REF (MAX_COMMAND + 18) X#define BOX_REF (MAX_COMMAND + 19) X#define DATA (MAX_COMMAND + 20) X Xint print_cmd_chr(); Xint show_cur_cmd_chr(); SHAR_EOF echo "File cmds.h is complete" chmod 0444 cmds.h || echo "restore of cmds.h fails" set `wc -c cmds.h`;Sum=$1 if test "$Sum" != "3642" then echo original size 3642, current size $Sum;fi echo "x - extracting cond.c (Text)" sed 's/^X//' << 'SHAR_EOF' > cond.c && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * cond.c X */ X X#include "tex.h" X#include "cmds.h" X#include "heap.h" X#include "box.h" X#include "eq.h" X#include "eqstack.h" X#include "hash.h" X#include "token.h" X#include "tokenlists.h" X#include "scan.h" X#include "tokenstack.h" X#include "evalstack.h" X#include "file.h" X#include "print.h" X#include "error.h" X#include "cond.h" X Xptr cond_ptr; Xint cur_if; Xint if_limit; Xval if_line; X Xval skip_line; X Xget_x_token_or_active_char() X{ X get_x_token(); X if (cur_cmd == RELAX && cur_chr == NO_EXPAND_FLAG) { X cur_cmd = ACTIVE_CHAR; X cur_chr = cur_tok - CS_TOKEN_FLAG - ACTIVE_BASE; X } X} X Xpush_cond() X{ X ptr p; X X p = get_node(IF_NODE_SIZE); X link(p) = cond_ptr; X type(p) = if_limit; X subtype(p) = cur_if; X if_line_field(p) = if_line; X cond_ptr = p; X cur_if = cur_chr; X if_limit = IF_CODE; X if_line = line; X} X Xpop_cond() X{ X ptr p; X X p = cond_ptr; X if_line = if_line_field(p); X cur_if = subtype(p); X if_limit = type(p); X cond_ptr = link(p); X free_node(p, IF_NODE_SIZE); X} X Xpass_text () X{ X int l; X int save_scanner_status; X X l = 0; X save_scanner_status = scanner_status; X scanner_status = SKIPPING; X skip_line = line; X loop { X get_next(); X if (cur_cmd == FI_OR_ELSE) { X if (l == 0) X break; X if (cur_chr == FI_CODE) X decr(l); X } else if (cur_cmd == IF_TEST) X incr(l); X } X scanner_status = save_scanner_status; X} X Xchange_if_limit (l, p) X int l; X ptr p; X{ X ptr q; X X if (p == cond_ptr) X if_limit = l; X else { X q = cond_ptr; X loop { X if (q == NULL) X confusion("if"); X if (link(q) == p) { X type(q) = l; X return; X } X q = link(q); X } X } X} X Xconditional () X{ X bool b; X val m; X val n; X ptr p; X ptr q; X ptr r; X int this_if; X ptr save_cond_ptr; X int save_scanner_status; X X push_cond(); X save_cond_ptr = cond_ptr; X this_if = cur_chr; X switch (this_if) X { X case IF_CHAR_CODE: X case IF_CAT_CODE: X get_x_token_or_active_char(); X if (cur_cmd > ACTIVE_CHAR || cur_chr > 127) { X m = RELAX; X n = 256; X } else { X m = cur_cmd; X n = cur_chr; X } X get_x_token_or_active_char(); X if (cur_cmd > ACTIVE_CHAR || cur_chr > 127) { X cur_cmd = RELAX; X cur_chr = 256; X } X if (this_if == IF_CHAR_CODE) X b = (n == cur_chr); X else b = (m == cur_cmd); X break; X X case IF_INT_CODE: X case IF_DIM_CODE: X if (this_if == IF_INT_CODE) X scan_int(); X else scan_normal_dimen(); X n = cur_val; X get_nbx_token(); X if (cur_tok >= OTHER_TOKEN + '<' && X cur_tok <= OTHER_TOKEN + '>') X r = cur_tok - OTHER_TOKEN; X else { X print_err("Missing = inserted for "); X print_cmd_chr(IF_TEST, this_if); X help_relation(); X back_error(); X r = '='; X } X if (this_if == IF_INT_CODE) X scan_int(); X else scan_normal_dimen(); X switch (r) X { X case '<': X b = (n < cur_val); X break; X X case '=': X b = (n == cur_val); X break; X X case '>': X b = (n > cur_val); X break; X } X break; X X case IF_ODD_CODE: X scan_int(); X b = odd(cur_val); X break; X X case IF_VMODE_CODE: X b = (abs(mode) == VMODE); X break; X X case IF_HMODE_CODE: X b = (abs(mode) == HMODE); X break; X X case IF_MMODE_CODE: X b = (abs(mode) == MMODE); X break; X X case IF_INNER_CODE: X b = (mode < 0); X break; X X case IF_VOID_CODE: X case IF_HBOX_CODE: X case IF_VBOX_CODE: X scan_eight_bit_int(); X p = box(cur_val); X if (this_if == IF_VOID_CODE) X b = (p == NULL); X else if (p == NULL) X b = FALSE; X else if (this_if == IF_HBOX_CODE) X b = (type(p) == HLIST_NODE); X else b = (type(p) == VLIST_NODE); X break; X X case IFX_CODE: X save_scanner_status = scanner_status; X scanner_status = NORMAL; X get_next(); X n = cur_cs; X p = cur_cmd; X q = cur_chr; X get_next(); X if (cur_cmd != p) X b = FALSE; X else if (cur_cmd < CALL) X b = (cur_chr == q); X else { X p = token_link(cur_chr); X q = token_link(equiv(n)); X while (p != NULL && q != NULL) { X if (token(p) != token(q)) X p = NULL; X else { X p = token_link(p); X q = token_link(q); X } X } X b = (p == NULL && q == NULL); X } X scanner_status = save_scanner_status; X break; X X case IF_EOF_CODE: X scan_four_bit_int(); X b = (read_open[cur_val] == CLOSED); X break; X X case IF_TRUE_CODE: X b = TRUE; X break; X X case IF_FALSE_CODE: X b = FALSE; X break; X X case IF_CASE_CODE: X scan_int(); X n = cur_val; X if (tracing_commands > 1) { X begin_diagnostic(); X print("{case "); X print_int(n); X print_char('}'); X end_diagnostic(FALSE); X } X while (n != 0) { X pass_text(); X if (cond_ptr == save_cond_ptr) { X if (cur_chr == OR_CODE) X decr(n); X else goto common_end; X } else if (cur_chr == FI_CODE) X pop_cond(); X } X change_if_limit(OR_CODE, save_cond_ptr); X return; X X default: X break; X } X X if (tracing_commands > 1) { X begin_diagnostic(); X print(b ? "{true}" : "{false}"); X end_diagnostic(FALSE); X } X X if (b) { X change_if_limit(ELSE_CODE, save_cond_ptr); X return; X } X X loop { X pass_text(); X if (cond_ptr == save_cond_ptr) { X if (cur_chr != OR_CODE) X goto common_end; X print_err("Extra "); X print_esc("or"); X help_or(); X error(); X } else if (cur_chr == FI_CODE) X pop_cond(); X } X Xcommon_end: X if (cur_chr == FI_CODE) X pop_cond(); X else if_limit = FI_CODE; X} X X/* X * Help text X */ X Xhelp_or () X{ X help1("I'm ignoring this; it doesn't match any \\if."); X} X Xhelp_relation () X{ X help1("I was expecting to see `<', `=', or `>'. Didn't."); X} SHAR_EOF chmod 0444 cond.c || echo "restore of cond.c fails" set `wc -c cond.c`;Sum=$1 if test "$Sum" != "5483" then echo original size 5483, current size $Sum;fi echo "x - extracting cond.h (Text)" sed 's/^X//' << 'SHAR_EOF' > cond.h && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * cond.h X */ X Xglobal ptr cond_ptr; Xglobal int cur_if; Xglobal int if_limit; Xglobal val if_line; X X#define IF_NODE_SIZE 2 X#define if_line_field(M) mem[M + 1].i X X#define IF_CODE 1 X#define FI_CODE 2 X#define ELSE_CODE 3 X#define OR_CODE 4 X X#define IF_CHAR_CODE 0 X#define IF_CAT_CODE 1 X#define IF_INT_CODE 2 X#define IF_DIM_CODE 3 X#define IF_ODD_CODE 4 X#define IF_VMODE_CODE 5 X#define IF_HMODE_CODE 6 X#define IF_MMODE_CODE 7 X#define IF_INNER_CODE 8 X#define IF_VOID_CODE 9 X#define IF_HBOX_CODE 10 X#define IF_VBOX_CODE 11 X#define IFX_CODE 12 X#define IF_EOF_CODE 13 X#define IF_TRUE_CODE 14 X#define IF_FALSE_CODE 15 X#define IF_CASE_CODE 16 X Xint push_cond(); Xint pop_cond(); Xint pass_text(); Xint change_if_limit(); Xint conditional(); X Xglobal long skip_line; SHAR_EOF chmod 0444 cond.h || echo "restore of cond.h fails" set `wc -c cond.h`;Sum=$1 if test "$Sum" != "1006" then echo original size 1006, current size $Sum;fi echo "x - extracting ctexbugs (Text)" sed 's/^X//' << 'SHAR_EOF' > ctexbugs && XArticle 470 of comp.sources.bugs: XPath: phadfa!csadfa!neumann!munnari!vuwcomp!mark XFrom: mark@comp.vuw.ac.nz (Mark Davies) XNewsgroups: comp.text,comp.sources.bugs XSubject: Patches to Common TeX 2.1 XMessage-ID: <13127@comp.vuw.ac.nz> XDate: 12 Dec 87 23:11:32 GMT XOrganization: Comp Sci, Victoria Univ., Wellington, New Zealand XLines: 1127 XXref: phadfa comp.text:1013 comp.sources.bugs:470 X XApologies for the size of this posting and the probable inappropriateness Xof the newsgroups sent to (they were the most appropriate I could think Xof). X XWhat follows are context diffs of the changes I have made to Common TeX 2.1 Xin an attempt to get it to pass the trip test. X XIt includes: X Xo Several bug fixes, most importantly one in def.c where the function X trap_zero_glue was not getting called due to a missing pair of (). X Xo The changes made to TeX in version 2.1 to correct anomalies in X discretionary breaks. X Xo Various fixes of spelling/punctuation/grammar in the error messages X XCommon TeX with these changes almost passes the version of the Trip Test Xdistributed with the UNIX TeX 2.1 release (the dvi file produced is fine, Xbut there are a couple of discrepancies in the log file that I am not sure Xof yet). X XNOTE: Your line numbers will probably differ as I have been adding comments Xto my version but have not included them here as they would more than Xtriple the size of this diff. X X-- mark X Xdiff -c Common.TeX.orig/box.c Common.TeX/box.c X*** Common.TeX.orig/box.c Tue Jul 28 17:40:53 1987 X--- Common.TeX/box.c Tue Dec 1 00:08:03 1987 X*************** X*** 264,270 X print_char('*'); X else { X print_scaled(width(p)); X! print(s); X if (stretch(p) != 0) { X print(" plus "); X print_glue(stretch(p), stretch_order(p), s); X X--- 264,270 ----- X print_char('*'); X else { X print_scaled(width(p)); X! if (s) print(s); X if (stretch(p) != 0) { X print(" plus "); X print_glue(stretch(p), stretch_order(p), s); Xdiff -c Common.TeX.orig/boxlists.c Common.TeX/boxlists.c X*** Common.TeX.orig/boxlists.c Tue Jul 28 17:40:54 1987 X--- Common.TeX/boxlists.c Tue Nov 17 21:27:58 1987 X*************** X*** 665,673 X you_cant(); X help_delete_last(); X if (cur_chr == KERN_NODE) X! help_line[1] = "Try `I\\kern-\\lastkern instead."; X else if (cur_chr != GLUE_NODE) X! help_line[1] = "Perhaps you can make an output routine do it."; X error(); X } X } else if (!is_char_node(tail) && type(tail) == cur_chr) { X X--- 665,673 ----- X you_cant(); X help_delete_last(); X if (cur_chr == KERN_NODE) X! help_line[1] = "Try `I\\kern-\\lastkern' instead."; X else if (cur_chr != GLUE_NODE) X! help_line[1] = "Perhaps you can make the output routine do it."; X error(); X } X } else if (!is_char_node(tail) && type(tail) == cur_chr) { Xdiff -c Common.TeX.orig/cmds.c Common.TeX/cmds.c X*** Common.TeX.orig/cmds.c Tue Jul 28 17:40:55 1987 X--- Common.TeX/cmds.c Fri Dec 4 14:34:44 1987 X*************** X*** 690,696 X break; X X case SCROLL_MODE: X! print_esc("scroll"); X break; X X default: X X--- 690,696 ----- X break; X X case SCROLL_MODE: X! print_esc("scrollmode"); X break; X X default: X*************** X*** 747,753 X break; X X case LONG_CALL: X! print("long macro"); X break; X X case OUTER_CALL: X X--- 747,753 ----- X break; X X case LONG_CALL: X! print_esc("long macro"); X break; X X case OUTER_CALL: X*************** X*** 1195,1201 X primitive("noalign", NO_ALIGN, 0); X primitive("noexpand", NO_EXPAND, 0); X eq_type(FROZEN_DONT_EXPAND) = DONT_EXPAND; X! text(FROZEN_DONT_EXPAND) = make_string_given("notexpanded"); X primitive("nonscript", NON_SCRIPT, 0); X primitive("omit", OMIT, 0); X primitive("parshape", SET_SHAPE, 0); X X--- 1195,1201 ----- X primitive("noalign", NO_ALIGN, 0); X primitive("noexpand", NO_EXPAND, 0); X eq_type(FROZEN_DONT_EXPAND) = DONT_EXPAND; X! text(FROZEN_DONT_EXPAND) = make_string_given("notexpanded:"); X primitive("nonscript", NON_SCRIPT, 0); X primitive("omit", OMIT, 0); X primitive("parshape", SET_SHAPE, 0); Xdiff -c Common.TeX.orig/def.c Common.TeX/def.c X*** Common.TeX.orig/def.c Tue Jul 28 17:40:56 1987 X--- Common.TeX/def.c Mon Dec 7 11:28:08 1987 X*************** X*** 563,569 X if (p < GLUE_VAL) { X word_def(l, cur_val); X } else { X! trap_zero_glue; X def(l, GLUE_REF, (ptr) cur_val); X } X } X X--- 563,569 ----- X if (p < GLUE_VAL) { X word_def(l, cur_val); X } else { X! trap_zero_glue(); X def(l, GLUE_REF, (ptr) cur_val); X } X } X*************** X*** 602,608 X scan_optional_equals(); X scan_int(); X if (cur_val < 0) { X! print_err("Bad"); X print_esc("prevgraf"); X help_prevgraf(); X int_error(cur_val); X X--- 602,608 ----- X scan_optional_equals(); X scan_int(); X if (cur_val < 0) { X! print_err("Bad "); X print_esc("prevgraf"); X help_prevgraf(); X int_error(cur_val); X*************** X*** 813,819 X use_err_help = TRUE; X else if (long_help_seen) X help_err_msg(); X! else help_poirot(); X error(); X use_err_help = FALSE; X } X X--- 818,828 ----- X use_err_help = TRUE; X else if (long_help_seen) X help_err_msg(); X! else { X! if (interaction < ERROR_STOP_MODE) X! long_help_seen = TRUE; X! help_poirot(); X! } X error(); X use_err_help = FALSE; X } X*************** X*** 915,924 X help_missing_cs () X { X help5("Please don't say `\\def cs{...}', say `\\def\\cs{...}'.", X! "I've inserted an innaccessible control sequence so that your", X "definition will be completed without mixing me up too badly.", X "You can recover graciously from this error, if you're", X! "careful; see excersize 27.2 in the TeXbook."); X } X X help_prefix () X X--- 928,937 ----- X help_missing_cs () X { X help5("Please don't say `\\def cs{...}', say `\\def\\cs{...}'.", X! "I've inserted an inaccessible control sequence so that your", X "definition will be completed without mixing me up too badly.", X "You can recover graciously from this error, if you're", X! "careful; see exercise 27.2 in The TeXbook."); X } X X help_prefix () X*************** X*** 971,977 X X help_font_magnification () X { X! help1("The magnification ratio must be between 1 and 32768"); X } X X help_mag() X X--- 984,990 ----- X X help_font_magnification () X { X! help1("The magnification ratio must be between 1 and 32768."); X } X X help_mag() Xdiff -c Common.TeX.orig/eq.c Common.TeX/eq.c X*** Common.TeX.orig/eq.c Tue Jul 28 17:40:56 1987 X--- Common.TeX/eq.c Mon Nov 30 23:48:57 1987 X*************** X*** 380,386 X break; X X case DISPLAY_INDENT_CODE: X! print_esc("diplayindent"); X break; X X case DISPLAY_WIDTH_CODE: X X--- 380,386 ----- X break; X X case DISPLAY_INDENT_CODE: X! print_esc("displayindent"); X break; X X case DISPLAY_WIDTH_CODE: Xdiff -c Common.TeX.orig/error.c Common.TeX/error.c X*** Common.TeX.orig/error.c Tue Jul 28 17:40:57 1987 X--- Common.TeX/error.c Tue Dec 1 00:22:44 1987 X*************** X*** 328,335 X X help_wounded () X { X! help2("One of your earlier faux pas has wounded me deeply,", X! "so I'm barely conscious. Please fix it and try again."); X } X X help_interrupt () X X--- 328,335 ----- X X help_wounded () X { X! help2("One of your faux pas seems to have wounded me deeply...", X! "in fact, I'm barely conscious. Please fix it and try again."); X } X X help_interrupt () X*************** X*** 336,340 X { X help3("You rang?", X "Try to insert some instructions for me (e.g., `I\\showlists),", X! "unless you just want to jump out by typing `X'."); X } X X--- 336,340 ----- X { X help3("You rang?", X "Try to insert some instructions for me (e.g., `I\\showlists),", X! "unless you just want to quit by typing `X'."); X } Xdiff -c Common.TeX.orig/eval.c Common.TeX/eval.c X*** Common.TeX.orig/eval.c Tue Jul 28 17:40:57 1987 X--- Common.TeX/eval.c Tue Nov 17 21:25:53 1987 X*************** X*** 718,722 X help4("Sorry, but I'm not programmed to handle this case;", X "I'll just pretend that you didn't ask for it.", X "If you're in the wrong mode, you might be able to", X! "return to the right one by typing `I}' or `I\par'."); X } X X--- 718,722 ----- X help4("Sorry, but I'm not programmed to handle this case;", X "I'll just pretend that you didn't ask for it.", X "If you're in the wrong mode, you might be able to", X! "return to the right one by typing `I}' or `I$' or `I\\par'."); X } Xdiff -c Common.TeX.orig/expand.c Common.TeX/expand.c X*** Common.TeX.orig/expand.c Tue Jul 28 17:40:58 1987 X--- Common.TeX/expand.c Wed Dec 2 14:27:01 1987 X*************** X*** 442,448 X { X help6("I've run across a `}' that doesn't seem to match anything.", X "For example, `\\def\\a#1{...}' and `\\a}' would produce", X! "this error. If you simply proceed nw, the `\\par' that", X "I've just inserted will cause me to report a runaway", X "argument that might be the root of the problem. But if", X "your `}' was spurious, just type `2' and it will go away."); X X--- 482,488 ----- X { X help6("I've run across a `}' that doesn't seem to match anything.", X "For example, `\\def\\a#1{...}' and `\\a}' would produce", X! "this error. If you simply proceed now, the `\\par' that", X "I've just inserted will cause me to report a runaway", X "argument that might be the root of the problem. But if", X "your `}' was spurious, just type `2' and it will go away."); X*************** X*** 460,466 X help_cs () X { X help2("The control sequence marked <to be read again> should", X! "not appear between \\csname and \\endcsname"); X } X X help_extra_if () X X--- 500,506 ----- X help_cs () X { X help2("The control sequence marked <to be read again> should", X! "not appear between \\csname and \\endcsname."); X } X X help_extra_if () Xdiff -c Common.TeX.orig/fmt.c Common.TeX/fmt.c X*** Common.TeX.orig/fmt.c Tue Jul 28 17:40:59 1987 X--- Common.TeX/fmt.c Fri Dec 4 15:24:33 1987 X*************** X*** 409,415 X dump_int(exten_base[k]); X dump_int(param_base[k]); X dump_int(font_glue[k]); X! print_nl("\\font "); X print_esc(""); X print_str(font_id_text(k)); X print_char('='); X X--- 409,415 ----- X dump_int(exten_base[k]); X dump_int(param_base[k]); X dump_int(font_glue[k]); X! print_nl("\\font"); X print_esc(""); X print_str(font_id_text(k)); X print_char('='); Xdiff -c Common.TeX.orig/hash.c Common.TeX/hash.c X*** Common.TeX.orig/hash.c Tue Jul 28 17:40:59 1987 X--- Common.TeX/hash.c Tue Dec 1 16:24:08 1987 X*************** X*** 86,96 X print_char(' '); X } X } else if (p < ACTIVE_BASE) X! print_esc("IMPOSSIBLE"); X else print_str(p - ACTIVE_BASE); X } else if (p >= UNDEFINED_CONTROL_SEQUENCE) X print_esc("IMPOSSIBLE."); X! else if (text(p) < 0 || text(p) > str_ptr) X print_esc("NONEXISTENT."); X else { X print_esc(""); X X--- 108,118 ----- X print_char(' '); X } X } else if (p < ACTIVE_BASE) X! print_esc("IMPOSSIBLE."); X else print_str(p - ACTIVE_BASE); X } else if (p >= UNDEFINED_CONTROL_SEQUENCE) X print_esc("IMPOSSIBLE."); X! else if (text(p) < 0 || text(p) >= str_ptr) X print_esc("NONEXISTENT."); X else { X print_esc(""); Xdiff -c Common.TeX.orig/hyph.c Common.TeX/hyph.c X*** Common.TeX.orig/hyph.c Tue Jul 28 17:41:00 1987 X--- Common.TeX/hyph.c Tue Nov 17 19:27:37 1987 X*************** X*** 703,709 X } X if (trie_o[q] != MIN_QUARTERWORD) { X print_err("Duplicate pattern"); X! help1("(See Appendix H)"); X error(); X } X trie_o[q] = v; X X--- 703,709 ----- X } X if (trie_o[q] != MIN_QUARTERWORD) { X print_err("Duplicate pattern"); X! help1("(See Appendix H.)"); X error(); X } X trie_o[q] = v; X*************** X*** 718,724 X default: X print_err("Bad "); X print_esc("patterns"); X! help1("(See Appendix H)"); X error(); X break; X } X X--- 718,724 ----- X default: X print_err("Bad "); X print_esc("patterns"); X! help1("(See Appendix H.)"); X error(); X break; X } Xdiff -c Common.TeX.orig/math.c Common.TeX/math.c X*** Common.TeX.orig/math.c Tue Jul 28 17:41:01 1987 X--- Common.TeX/math.c Mon Nov 30 23:43:46 1987 X*************** X*** 246,252 X show_fraction_noad (p) X ptr p; X { X! print_esc("fraction, thickness"); X if (thickness(p) == DEFAULT_CODE) X print("= default"); X else print_scaled(thickness(p)); X X--- 246,252 ----- X show_fraction_noad (p) X ptr p; X { X! print_esc("fraction, thickness "); X if (thickness(p) == DEFAULT_CODE) X print("= default"); X else print_scaled(thickness(p)); Xdiff -c Common.TeX.orig/page.c Common.TeX/page.c X*** Common.TeX.orig/page.c Tue Jul 28 17:41:03 1987 X--- Common.TeX/page.c Wed Nov 25 22:41:29 1987 X*************** X*** 884,890 X X help_box_255 () X { X! help2("You shouldn't use \\box255 except in output routines.", X "Proceed, and I'll discard its present contents."); X } X X X--- 884,890 ----- X X help_box_255 () X { X! help2("You shouldn't use \\box255 except in \\output routines.", X "Proceed, and I'll discard its present contents."); X } X X*************** X*** 891,896 X help_dead_cycles () X { X help3("I've concluded that your \\output is awry; it never does a", X! "\\shipout, so I'm shipping \box255 out myself. Next time", X "increase \\maxdeadcycles if you want me to be more patient!"); X } X X--- 892,897 ----- X help_dead_cycles () X { X help3("I've concluded that your \\output is awry; it never does a", X! "\\shipout, so I'm shipping \\box255 out myself. Next time", X "increase \\maxdeadcycles if you want me to be more patient!"); X } Xdiff -c Common.TeX.orig/par.c Common.TeX/par.c X*** Common.TeX.orig/par.c Tue Jul 28 17:41:04 1987 X--- Common.TeX/par.c Sat Dec 5 13:02:54 1987 X*************** X*** 186,243 X int break_type; X { X ptr s; X! qword t; X ptr v; X X do_all_six(set_break_width_to_background); X! if (break_type == UNHYPHENATED || cur_p == NULL) { X! for (s = cur_p; s != NULL; s = link(s)) { X! if (is_char_node(s)) X! return; X! switch (type(s)) X! { X! case GLUE_NODE: X! v = glue_ptr(s); X! break_width[1] -= width(v); X! break_width[2 + stretch_order(v)] -= stretch(v); X! break_width[6] -= shrink(v); X! break; X! X! case PENALTY_NODE: X! break; X! X! case MATH_NODE: X! case KERN_NODE: X! if (subtype(s) == ACC_KERN) X! return; X! else break_width[1] -= width(s); X! break; X! X! default: X! return; X! break; X! } X! } X! } else { X t = replace_count(cur_p); X! s = cur_p; X while (t > 0) { X decr(t); X! s = link(s); X! if (is_char_node(s)) X! break_width[1] -= width_char(s); X else { X! switch (type(s)) X { X case LIGATURE_NODE: X! break_width[1] -= width_lig_char(s); X break; X X case HLIST_NODE: X case VLIST_NODE: X case RULE_NODE: X case KERN_NODE: X! break_width[1] -= width(s); X break; X X default: X X--- 186,217 ----- X int break_type; X { X ptr s; X! int t; X ptr v; X X do_all_six(set_break_width_to_background); X! s = cur_p; X! if (break_type > UNHYPHENATED && cur_p != NULL) { X t = replace_count(cur_p); X! v = cur_p; X! s = post_break(cur_p); X while (t > 0) { X decr(t); X! v = link(v); X! if (is_char_node(v)) X! break_width[1] -= width_char(v); X else { X! switch (type(v)) X { X case LIGATURE_NODE: X! break_width[1] -= width_lig_char(v); X break; X X case HLIST_NODE: X case VLIST_NODE: X case RULE_NODE: X case KERN_NODE: X! break_width[1] -= width(v); X break; X X default: X*************** X*** 246,252 X } X } X } X! for (s = post_break(cur_p); s != NULL; s = link(s)) { X if (is_char_node(s)) X break_width[1] += width_char(s); X else { X X--- 220,226 ----- X } X } X } X! for (; s != NULL; s = link(s)) { X if (is_char_node(s)) X break_width[1] += width_char(s); X else { X*************** X*** 259,276 X case HLIST_NODE: X case VLIST_NODE: X case RULE_NODE: X- case KERN_NODE: X break_width[1] += width(s); X break; X X default: X confusion("disc2"); X break; X } X } X } X break_width[1] += disc_width; X } X } X X try_break (pi, break_type) X X--- 233,286 ----- X case HLIST_NODE: X case VLIST_NODE: X case RULE_NODE: X break_width[1] += width(s); X break; X X+ case KERN_NODE: X+ if (t == 0 && subtype(s) != ACC_KERN) X+ t = -1; /* discardable */ X+ else X+ break_width[1] += width(s); X+ break; X+ X default: X confusion("disc2"); X break; X } X } X+ incr(t); X } X break_width[1] += disc_width; X+ if (t == 0) X+ s = link(v); /* more nodes may be discardable after X+ the break */ X } X+ for (; s != NULL; s = link(s)) { X+ if (is_char_node(s)) X+ return; X+ switch (type(s)) { X+ case GLUE_NODE: X+ v = glue_ptr(s); X+ break_width[1] -= width(v); X+ break_width[2 + stretch_order(v)] -= stretch(v); X+ break_width[6] -= shrink(v); X+ break; X+ X+ case PENALTY_NODE: X+ break; X+ X+ case MATH_NODE: X+ case KERN_NODE: X+ if (subtype(s) == ACC_KERN) X+ return; X+ else break_width[1] -= width(s); X+ break; X+ X+ default: X+ return; X+ break; X+ } X+ } X } X X try_break (pi, break_type) X*************** X*** 971,980 X } X link(q) = r; X disc_break = TRUE; X! } X! if (!is_char_node(q) && X! (type(q) == MATH_NODE || type(q) == KERN_NODE)) X! width(q) = 0; X } X } else { X q = temp_head; X X--- 981,990 ----- X } X link(q) = r; X disc_break = TRUE; X! } else X! if (type(q) == MATH_NODE || X! type(q) == KERN_NODE) X! width(q) = 0; X } X } else { X q = temp_head; Xdiff -c Common.TeX.orig/print.c Common.TeX/print.c X*** Common.TeX.orig/print.c Tue Jul 28 17:41:04 1987 X--- Common.TeX/print.c Sun Nov 29 12:22:22 1987 X*************** X*** 304,310 X print_char(*j); X n -= v; X } X! if (n == 0) return; X k = j + 2; X u = v / (*(k - 1) - '0'); X if (*(k - 1) == '2') { X X--- 324,330 ----- X print_char(*j); X n -= v; X } X! if (n <= 0) return; /* nonpositive input produces no output */ X k = j + 2; X u = v / (*(k - 1) - '0'); X if (*(k - 1) == '2') { Xdiff -c Common.TeX.orig/scan.c Common.TeX/scan.c X*** Common.TeX.orig/scan.c Tue Jul 28 17:41:05 1987 X--- Common.TeX/scan.c Mon Dec 7 12:56:32 1987 X*************** X*** 245,250 X case GLUE_VAL: X cur_val = skip(cur_val); X break; X } X cur_val_level = m; X break; X X--- 286,295 ----- X case GLUE_VAL: X cur_val = skip(cur_val); X break; X+ X+ case MU_VAL: X+ cur_val = mu_skip(cur_val); X+ break; X } X cur_val_level = m; X break; X*************** X*** 363,369 X scan_int(); X if (cur_val < 0 || cur_val > 255) { X print_err("Bad character code"); X! help_char(); X int_error(cur_val); X cur_val = 0; X } X X--- 408,414 ----- X scan_int(); X if (cur_val < 0 || cur_val > 255) { X print_err("Bad character code"); X! help_char_num(); X int_error(cur_val); X cur_val = 0; X } X*************** X*** 741,748 X X help_mathchar () X { X! help2("A numeric \\mathchar code must be between 0 and 32767.", X! "I changed this one to zero"); X } X X help_number () X X--- 841,848 ----- X X help_mathchar () X { X! help2("A numeric math code must be between 0 and 32767.", X! "I changed this one to zero."); X } X X help_number () X*************** X*** 753,762 X X help_char () X { X! help2("The numeric code following \\char must be between 0 and 255.", X "I changed this one to zero."); X } X X help_char_const () X { X help2("A one-character control sequence belongs after a ` mark.", X X--- 853,868 ----- X X help_char () X { X! help2("The numeric code for a character must be between 0 and 127.", X "I changed this one to zero."); X } X X+ help_char_num () X+ { X+ help2("A character number must be between 0 and 255.", X+ "I changed this one to zero."); X+ } X+ X help_char_const () X { X help2("A one-character control sequence belongs after a ` mark.", X*************** X*** 772,779 X help_missing_number () X { X help3("A number should have been here; I inserted `0'.", X! "(If you can't figure out why I needed a number,", X! "look up `weird error' in the TeX manual index.)"); X } X X help_filll () X X--- 878,885 ----- X help_missing_number () X { X help3("A number should have been here; I inserted `0'.", X! "(If you can't figure out why I needed to see a number,", X! "look up `weird error' in the index to The TeXbook.)"); X } X X help_filll () X*************** X*** 783,792 X X help_mu () X { X! help4("The unit of measurement in \\mskip glue must be mu.", X "To recover gracefully from this error, it's best to", X! "delete the erroneous units; e.g. type `2' to delete", X! "two letters. (See Chapter 27 of the manual.)"); X } X X help_mu_error () X X--- 889,898 ----- X X help_mu () X { X! help4("The unit of measurement in math glue must be mu.", X "To recover gracefully from this error, it's best to", X! "delete the erroneous units; e.g., type `2' to delete", X! "two letters. (See Chapter 27 of The TeXbook.)"); X } X X help_mu_error () X*************** X*** 812,819 X X help_thee () X { X! help2("I'm forgetting what you said", X! "and using zero for this \\the."); X } X X help_left () X X--- 918,924 ----- X X help_thee () X { X! help1("I'm forgetting what you said and using zero instead."); X } X X help_left () X*************** X*** 840,844 X X help_reg () X { X! help1("I'm forgetting what you said and not changing anything."); X } X X--- 945,950 ----- X X help_reg () X { X! help2("A register number must be between 0 and 255.", X! "I changed this one to zero."); X } Xdiff -c Common.TeX.orig/tex.c Common.TeX/tex.c X*** Common.TeX.orig/tex.c Tue Jul 28 17:41:06 1987 X--- Common.TeX/tex.c Fri Dec 4 15:38:58 1987 X*************** X*** 35,41 X #include "print.h" X #include "page.h" X X! char banner[] = "This is Common TeX, Version 2.1"; X int ready_already; X X main (argc, argv) X X--- 35,41 ----- X #include "print.h" X #include "page.h" X X! char banner[] = "This is Common TeX, Version 2.1.1"; X int ready_already; X X main (argc, argv) Xdiff -c Common.TeX.orig/texext.c Common.TeX/texext.c X*** Common.TeX.orig/texext.c Tue Jul 28 17:41:06 1987 X--- Common.TeX/texext.c Mon Dec 7 16:19:42 1987 X*************** X*** 124,130 X X case CLOSE_NODE: X print_write("closeout", p); X- print_int(write_stream(p)); X break; X X case SPECIAL_NODE: X X--- 124,129 ----- X X case CLOSE_NODE: X print_write("closeout", p); X break; X X case SPECIAL_NODE: X*************** X*** 353,358 X X help_unbal_write () X { X! help2("On this page there's a \\write with fewer real {'s than }'s", X "I can't handle that very well; good luck."); X } X X--- 358,363 ----- X X help_unbal_write () X { X! help2("On this page there's a \\write with fewer real {'s than }'s.", X "I can't handle that very well; good luck."); X } Xdiff -c Common.TeX.orig/tfm.c Common.TeX/tfm.c X*** Common.TeX.orig/tfm.c Tue Jul 28 17:41:07 1987 X--- Common.TeX/tfm.c Fri Dec 4 15:24:42 1987 X*************** X*** 68,74 X {print_err("Font "); sprint_cs(u); \ X print_char('='); print_file_name(nom, aire, null_str); \ X if (s >= 0) {print(" at "); print_scaled(s); print("pt");} \ X! else if (s != -1000) {print(" scaled "); print_scaled(-s);}} X X #define get_font_byte() \ X (font_byte = getc(tfm_file)) X X--- 68,74 ----- X {print_err("Font "); sprint_cs(u); \ X print_char('='); print_file_name(nom, aire, null_str); \ X if (s >= 0) {print(" at "); print_scaled(s); print("pt");} \ X! else if (s != -1000) {print(" scaled "); print_int(-s);}} X X #define get_font_byte() \ X (font_byte = getc(tfm_file)) X*************** X*** 416,422 X { X if (tracing_lost_chars > 0) { X begin_diagnostic(); X! print("Missing character: There is no "); X print_ASCII(c); X print(" in font "); X print_str(font_name[f]); X X--- 447,453 ----- X { X if (tracing_lost_chars > 0) { X begin_diagnostic(); X! print_nl("Missing character: There is no "); X print_ASCII(c); X print(" in font "); X print_str(font_name[f]); X*************** X*** 479,485 X help_font_param () X { X help2("To increase the number of font parameters, you must", X! "use \\fontdimen immediately after the font code is defined."); X } X X help_font_cs () X X--- 516,522 ----- X help_font_param () X { X help2("To increase the number of font parameters, you must", X! "use \\fontdimen immediately after the \\font is loaded."); X } X X help_font_cs () Xdiff -c Common.TeX.orig/token.c Common.TeX/token.c X*** Common.TeX.orig/token.c Tue Jul 28 17:41:07 1987 X--- Common.TeX/token.c Wed Dec 2 14:09:58 1987 X*************** X*** 508,515 X { X help4("I suspect you have forgotten a `}', causing me", X "to read past where you wanted me to stop.", X! "Either type `I}' to try recovering,", X! "or type 'X' and fix your file."); X } X X help_funny () X X--- 535,542 ----- X { X help4("I suspect you have forgotten a `}', causing me", X "to read past where you wanted me to stop.", X! "I'll try to recover; but if the error is serious,", X! "you'd better type `E' or `X' now and fix your file."); X } X X help_funny () Xdiff -c Common.TeX.orig/tokenlists.c Common.TeX/tokenlists.c X*** Common.TeX.orig/tokenlists.c Tue Jul 28 17:41:08 1987 X--- Common.TeX/tokenlists.c Sat Dec 5 15:31:25 1987 X*************** X*** 400,406 X else { X m = token(p) / 0400; X c = token(p) % 0400; X! if (m < 0 || c > 127) X print_esc("BAD."); X else { X switch (m) X X--- 492,498 ----- X else { X m = token(p) / 0400; X c = token(p) % 0400; X! if (token(p) < 0 || c > 127) X print_esc("BAD."); X else { X switch (m) X*************** X*** 418,429 X break; X X case MAC_PARAM: X! print_char(c); X! print_char(c); X break; X X case OUT_PARAM: X! print_char(match_chr); X if (c <= 9) X print_char(c + '0'); X else { X X--- 510,521 ----- X break; X X case MAC_PARAM: X! print_str(c); X! print_str(c); X break; X X case OUT_PARAM: X! print_str(match_chr); X if (c <= 9) X print_char(c + '0'); X else { X*************** X*** 434,440 X X case MATCH: X match_chr = c; X! print_char(c); X incr(n); X print_char(n); X if (n > '9') X X--- 526,532 ----- X X case MATCH: X match_chr = c; X! print_str(c); X incr(n); X print_char(n); X if (n > '9') Xdiff -c Common.TeX.orig/tokenstack.c Common.TeX/tokenstack.c X*** Common.TeX.orig/tokenstack.c Tue Jul 28 17:41:08 1987 X--- Common.TeX/tokenstack.c Fri Dec 4 16:45:50 1987 X*************** X*** 282,288 X for (i = start; i < j; incr(i)) { X if (i == loc) X set_trick_count(); X! print_char(buffer[i]); X } X } X } else { X X--- 337,343 ----- X for (i = start; i < j; incr(i)) { X if (i == loc) X set_trick_count(); X! print_str(buffer[i]); X } X } X } else { X-- XDomainised: mark@comp.vuw.ac.nz Bang form: ...!uunet!vuwcomp!mark X X SHAR_EOF chmod 0444 ctexbugs || echo "restore of ctexbugs fails" set `wc -c ctexbugs`;Sum=$1 if test "$Sum" != "27054" then echo original size 27054, current size $Sum;fi echo "x - extracting def.c (Text)" sed 's/^X//' << 'SHAR_EOF' > def.c && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * def.c X */ X X#include "tex.h" X#include "cmds.h" X#include "heap.h" X#include "io.h" X#include "eq.h" X#include "hash.h" X#include "eqstack.h" X#include "evalstack.h" X#include "hash.h" X#include "token.h" X#include "scan.h" X#include "tokenstack.h" X#include "expand.h" X#include "arith.h" X#include "str.h" X#include "box.h" X#include "boxlists.h" X#include "tokenlists.h" X#include "file.h" X#include "tfm.h" X#include "dvi.h" X#include "page.h" X#include "print.h" X#include "error.h" X#include "def.h" X Xhword after_token; Xbool long_help_seen; Xval mag_set; X X#define glob (a >= 4) X X#define def(code, type, value) \ X {if (glob) \ X geq_define(code, type, value); \ X else eq_define(code, type, value);} X X#define word_def(code, value) \ X {if (glob) \ X geq_word_define(code, value); \ X else eq_word_define(code, value);} X Xget_r_token () X{ Xrestart: X do get_token(); X while (cur_tok == SPACE_TOKEN); X if (cur_cs == 0 || cur_cs > FROZEN_CONTROL_SEQUENCE) { X print_err("Missing control sequence inserted"); X help_missing_cs(); X if (cur_cs == 0) back_input(); X cur_tok = CS_TOKEN_FLAG + FROZEN_PROTECTION; X ins_error(); X goto restart; X } X} X Xprefixed_command () X{ X int a; X bool e; X fnt f; X int j; X int k; X val n; X ptr p; X ptr q; X X a = 0; X while (cur_cmd == PREFIX) { X if (!odd(a / cur_chr)) X a += cur_chr; X get_nbrx_token(); X if (cur_cmd <= MAX_NON_PREFIXED_COMMAND) { X print_err("You can't use a prefix with `"); X print_cmd_chr(cur_cmd, cur_chr); X print("'"); X help_prefix(); X back_error(); X return; X } X } X X if (cur_cmd != DEF && a % 4 != 0) { X print_err("You can't use `"); X print_esc("long"); X print("' or `"); X print_esc("outer"); X print("' with `"); X print_cmd_chr(cur_cmd, cur_chr); X print("'"); X help_pref(); X error(); X } X X if (global_defs != 0) { X if (global_defs < 0) { X if (glob) a -= 4; X } else { X if (!glob) a += 4; X } X } X X switch (cur_cmd) X { X case SET_FONT: X def(CUR_FONT_LOC, DATA, cur_chr); X break; X X case DEF: X if (odd(cur_chr) && !glob && global_defs >= 0) X a += 4; X e = (cur_chr >= 2); X get_r_token(); X p = cur_cs; X scan_toks(TRUE, e); X def(p, CALL + (a % 4), def_ref); X break; X X case LET: X n = cur_chr; X get_r_token(); X p = cur_cs; X if (n == NORMAL) { X do get_token(); X while (cur_cmd == SPACER); X if (cur_tok == OTHER_TOKEN + '=') { X get_token(); X if (cur_cmd == SPACER) X get_token(); X } X } else { X get_token(); X q = cur_tok; X get_token(); X back_input(); X cur_tok = q; X back_input(); X } X if (cur_cmd >= CALL) X add_token_ref(cur_chr); X def(p, cur_cmd, cur_chr); X break; X X case SHORTHAND_DEF: X n = cur_chr; X get_r_token(); X p = cur_cs; X def(p, RELAX, 256); X scan_optional_equals(); X switch ((hword) n) X { X case CHAR_DEF_CODE: X scan_char_num(); X def(p, CHAR_GIVEN, (hword) cur_val); X break; X X case MATH_CHAR_DEF_CODE: X scan_fifteen_bit_int(); X def(p, MATH_GIVEN, (hword) cur_val); X break; X X default: X scan_eight_bit_int(); X switch ((hword) n) X { X case COUNT_DEF_CODE: X def(p, ASSIGN_INT, (hword) (COUNT_BASE + cur_val)); X break; X X case DIMEN_DEF_CODE: X def(p, ASSIGN_DIMEN, (hword) (SCALED_BASE + cur_val)); X break; X X case SKIP_DEF_CODE: X def(p, ASSIGN_GLUE, (hword) (SKIP_BASE + cur_val)); X break; X X case MU_SKIP_DEF_CODE: X def(p, ASSIGN_MU_GLUE, (hword) (MU_SKIP_BASE + cur_val)); X break; X X case TOKS_DEF_CODE: X def(p, ASSIGN_TOKS, (hword) (TOKS_BASE + cur_val)); X break; X } X break; X } X break; X X case READ_TO_CS: X scan_int(); X n = (int) cur_val; X if (!scan_keyword("to")) { X print_err("Missing `to' inserted"); X help_read_to(); X error(); X } X get_r_token(); X p = cur_cs; X read_toks(n, p); X def(p, CALL, (hword) cur_val); X break; X X case TOKS_REGISTER: X case ASSIGN_TOKS: X q = cur_cs; X if (cur_cmd == TOKS_REGISTER) { X scan_eight_bit_int(); X p = TOKS_BASE + cur_val; X } else p = cur_chr; X scan_optional_equals(); X get_nbrx_token(); X if (cur_cmd != LEFT_BRACE) { X if (cur_cmd == TOKS_REGISTER) { X scan_eight_bit_int(); X cur_cmd = ASSIGN_TOKS; X cur_chr = TOKS_BASE + cur_val; X } X if (cur_cmd == ASSIGN_TOKS) { X q = equiv(cur_chr); X if (q == NULL) { X def(p, UNDEFINED_CS, NULL); X } else { X add_token_ref(q); X def(p, CALL, q); X } X break; X } X } X back_input(); X cur_cs = q; X q = scan_toks(FALSE, FALSE); X if (token_link(def_ref) == NULL) { X def(p, UNDEFINED_CS, NULL); X free_token(def_ref); X } else { X if (p == OUTPUT_ROUTINE_LOC) { X token_link(q) = new_token(); X q = token_link(q); X token(q) = RIGHT_BRACE_TOKEN + '}'; X q = new_token(); X token(q) = LEFT_BRACE_TOKEN + '{'; X token_link(q) = token_link(def_ref); X token_link(def_ref) = q; X } X def(p, CALL, def_ref); X } X break; X X case ASSIGN_INT: X p = cur_chr; X scan_optional_equals(); X scan_int(); X word_def(p, cur_val); X break; X X case ASSIGN_DIMEN: X p = cur_chr; X scan_optional_equals(); X scan_normal_dimen(); X word_def(p, cur_val); X break; X X case ASSIGN_GLUE: X case ASSIGN_MU_GLUE: X p = cur_chr; X n = cur_cmd; X scan_optional_equals(); X if (n == ASSIGN_MU_GLUE) X scan_glue(MU_VAL); X else scan_glue(GLUE_VAL); X trap_zero_glue(); X def(p, GLUE_REF, (ptr) cur_val); X break; X X case DEF_CODE: X if (cur_chr == CAT_CODE_BASE) X n = MAX_CHAR_CODE; X else if (cur_chr == MATH_CODE_BASE) X n = 0100000; X else if (cur_chr == SF_CODE_BASE) X n = 077777; X else if (cur_chr == DEL_CODE_BASE) X n = 077777777; X else n = 127; X p = cur_chr; X scan_seven_bit_int(); X p += cur_val; X scan_optional_equals(); X scan_int(); X if (cur_val < 0 && p < DEL_CODE_BASE || cur_val > n) { X print_err("Invalid code ("); X print_val(cur_val); X if (p < DEL_CODE_BASE) X print("), should be in the range 0.."); X else print("), should be at most "); X print_val(n); X help_code(); X error(); X cur_val = 0; X } X if (p < MATH_CODE_BASE) { X def(p, DATA, (hword) cur_val); X } else if (p < DEL_CODE_BASE) { X def(p, DATA, (hword) hi(cur_val)); X } else word_def(p, cur_val); X break; X X case DEF_FAMILY: X p = cur_chr; X scan_four_bit_int(); X p += cur_val; X scan_optional_equals(); X scan_font_ident(); X def(p, DATA, (hword) cur_val); X break; X X case REGISTER: X case ADVANCE: X case MULTIPLY: X case DIVIDE: X do_register_command(a); X break; X X case SET_BOX: X scan_eight_bit_int(); X if (glob) X saved(0) = BOX_FLAG + 256 + cur_val; X else saved(0) = BOX_FLAG + cur_val; X scan_optional_equals(); X scan_box(); X break; X X case SET_AUX: X alter_aux(); X break; X X case SET_PREV_GRAF: X alter_prev_graf(); X break; X X case SET_PAGE_DIMEN: X alter_page_so_far(); X break; X X case SET_PAGE_INT: X alter_integer(); X break; X X case SET_BOX_DIMEN: X alter_box_dimen(); X break; X X case SET_SHAPE: X scan_optional_equals(); X scan_int(); X n = cur_val; X if (n <= 0) X p = NULL; X else { X p = get_node(2 * n + 1); X info(p) = n; X for (j = 1; j <= n; incr(j)) { X scan_normal_dimen(); X mem[p + 2 * j - 1].sc = cur_val; X scan_normal_dimen(); X mem[p + 2 * j].sc = cur_val; X } X } X def(PAR_SHAPE_LOC, SHAPE_REF, p); X break; X X case HYPH_DATA: X#ifdef INIT X if (cur_chr == 1) X new_patterns(); SHAR_EOF echo "End of part 5" echo "File def.c is continued in part 6" echo "6" > s2_seq_.tmp exit 0
glenn@extro.ucc.su.oz.au (G Geers) (02/16/90)
---- Cut Here and unpack ---- #!/bin/sh # this is part 6 of a multipart archive # do not concatenate these parts, unpack them in order with /bin/sh # file def.c continued # CurArch=6 if test ! -r s2_seq_.tmp then echo "Please unpack part 1 first!" exit 1; fi ( read Scheck if test "$Scheck" != $CurArch then echo "Please unpack part $Scheck next!" exit 1; else exit 0; fi ) < s2_seq_.tmp || exit 1 echo "x - Continuing file def.c" sed 's/^X//' << 'SHAR_EOF' >> def.c X#else X if (cur_chr == 1) { X print_err("Patterns can only be loaded by INITEX"); X error(); X } X#endif X else new_hyph_exceptions(); X break; X X case ASSIGN_FONT_DIMEN: X find_font_dimen(TRUE); X k = cur_val; X scan_optional_equals(); X scan_normal_dimen(); X font_info[k].sc = cur_val; X break; X X case ASSIGN_FONT_INT: X n = cur_chr; X scan_font_ident(); X f = cur_val; X scan_optional_equals(); X scan_int(); X if (n == 0) X hyphen_char[f] = cur_val; X else skew_char[f] = cur_val; X break; X X case DEF_FONT: X new_font(a); X break; X X case SET_INTERACTION: X new_interaction(); X break; X X default: X confusion("prefix"); X break; X } X if (after_token != 0) { X cur_tok = after_token; X back_input(); X after_token = 0; X } X} X Xtrap_zero_glue () X{ X if (width(cur_val) == 0 && X stretch(cur_val) == 0 && X shrink(cur_val) == 0) { X add_glue_ref(zero_glue); X delete_glue_ref(cur_val); X cur_val = zero_glue; X } X} X Xdo_register_command (a) X int a; X{ X ptr l; X ptr p; X ptr q; X ptr r; X ptr s; X X q = cur_cmd; X if (q != REGISTER) { X get_x_token(); X if (cur_cmd >= ASSIGN_INT && cur_cmd <= ASSIGN_MU_GLUE) { X l = cur_chr; X p = cur_cmd - ASSIGN_INT; X goto found; X } X if (cur_cmd != REGISTER) { X print_err("You can't use `"); X print_cmd_chr(cur_cmd, cur_chr); X print("' after "); X print_cmd_chr(q, 0); X help_register(); X error(); X return; X } X } X p = cur_chr; X scan_eight_bit_int(); X switch (p) X { X case INT_VAL: X l = cur_val + COUNT_BASE; X break; X X case DIMEN_VAL: X l = cur_val + SCALED_BASE; X break; X X case GLUE_VAL: X l = cur_val + SKIP_BASE; X break; X X case MU_VAL: X l = cur_val + MU_SKIP_BASE; X break; X } X Xfound: X if (q == REGISTER) X scan_optional_equals(); X else scan_keyword("by"); X arith_error = FALSE; X if (q < MULTIPLY) { X if (p < GLUE_VAL) { X if (p == INT_VAL) X scan_int(); X else scan_normal_dimen(); X if (q == ADVANCE) X cur_val += eqtb[l].i; X } else { X scan_glue(p); X if (q == ADVANCE) { X q = new_spec(cur_val); X r = equiv(l); X delete_glue_ref(cur_val); X width(q) += width(r); X if (stretch(q) == 0) X stretch_order(q) = NORMAL; X else if (stretch_order(q) == stretch_order(r)) X stretch(q) += stretch(r); X else if (stretch_order(q) < stretch_order(r) && X stretch_order(r) != 0) { X stretch(q) = stretch(r); X stretch_order(q) = stretch_order(r); X } X if (shrink(q) == 0) X shrink_order(q) = NORMAL; X if (shrink_order(q) == shrink_order(r)) X shrink(q) += shrink(r); X else if (shrink_order(q) < shrink_order(r) && X shrink_order(r) != 0) { X shrink(q) = shrink(r); X shrink_order(q) = shrink_order(r); X } X cur_val = q; X } X } X } else { X scan_int(); X if (p < GLUE_VAL) { X if (q == MULTIPLY) X cur_val = nx_plus_y(eqtb[l].i, cur_val, 0L); X else cur_val = x_over_n(eqtb[l].i, cur_val); X } else { X s = equiv(l); X r = new_spec(s); X if (q == MULTIPLY) { X width(r) = nx_plus_y(width(s), cur_val, 0L); X stretch(r) = nx_plus_y(stretch(s), cur_val, 0L); X shrink(r) = nx_plus_y(shrink(s), cur_val, 0L); X } else { X width(r) = x_over_n(width(s), cur_val); X stretch(r) = x_over_n(stretch(s), cur_val); X shrink(r) = x_over_n(shrink(s), cur_val); X } X cur_val = r; X } X } X if (arith_error) { X print_err("Arithmetic overflow"); X help_overflow(); X error(); X return; X } X if (p < GLUE_VAL) { X word_def(l, cur_val); X } else { X trap_zero_glue(); X def(l, GLUE_REF, (ptr) cur_val); X } X} X Xalter_aux() X{ X hword c; X X if (cur_chr != abs(mode)) X report_illegal_case(); X else { X c = cur_chr; X scan_optional_equals(); X if (c == VMODE) { X scan_normal_dimen(); X prev_depth = cur_val; X } else { X scan_int(); X if (cur_val <= 0 || cur_val > 32767) { X print_err("Bad space factor"); X help_space_factor(); X int_error(cur_val); X } else space_factor = cur_val; X } X } X} X Xalter_prev_graf () X{ X ptr p; X X nest[nest_ptr] = cur_list; X p = nest_ptr; X while (abs(nest[p].mode_field) != VMODE) X decr(p); X scan_optional_equals(); X scan_int(); X if (cur_val < 0) { X print_err("Bad "); X print_esc("prevgraf"); X help_prevgraf(); X int_error(cur_val); X } else { X nest[p].pg_field = cur_val; X cur_list = nest[nest_ptr]; X } X} X Xalter_page_so_far () X{ X hword c; X X c = cur_chr; X scan_optional_equals(); X scan_normal_dimen(); X page_so_far[c] = cur_val; X} X Xalter_integer () X{ X hword c; X X c = cur_chr; X scan_optional_equals(); X scan_int(); X if (c == 0) X dead_cycles = cur_val; X else insert_penalties = cur_val; X} X Xalter_box_dimen () X{ X byte b; X hword c; X X c = cur_chr; X scan_eight_bit_int(); X b = cur_val; X scan_optional_equals(); X scan_normal_dimen(); X if (box(b) != NULL) X mem[box(b) + c].sc = cur_val; X} X Xnew_font (a) X int a; X{ X fnt f; X scal s; X str t; X ptr u; X int old_setting; X X if (job_name == 0) X open_log_file(); X get_r_token(); X u = cur_cs; X if (u >= HASH_BASE) X t = text(u); X else if (u >= SINGLE_BASE) { X if (u == NULL_CS) X t = make_string_given("FONT"); X else t = u - SINGLE_BASE; X } else { X old_setting = selector; X selector = NEW_STRING; X print("FONT"); X print_str(u - ACTIVE_BASE); X selector = old_setting; X str_room(1); X t = make_string(); X } X def(u, SET_FONT, NULL_FONT); X scan_optional_equals(); X scan_file_name(); X name_in_progress = TRUE; X if (scan_keyword("at")) { X scan_normal_dimen(); X s = cur_val; X if (s <= 0 || s >= 01000000000) { X print_err("Improper `at' size ("); X print_scaled(s); X print("pt), replaced by 10pt"); X help_font_at(); X error(); X s = 10 * UNITY; X } X } else if (scan_keyword("scaled")) { X scan_int(); X s = -cur_val; X if (cur_val <= 0 || cur_val > 32768) { X print_err("Illegal magnification has been changed to 1000"); X help_font_magnification(); X int_error(cur_val); X s = -1000; X } X } else s = -1000; X name_in_progress = FALSE; X for (f = FONT_BASE + 1; f <= font_ptr; f++) { X if (str_eq_str(font_name[f], cur_name) && X str_eq_str(font_area[f], cur_area)) { X if (s > 0) { X if (s == font_size[f]) X goto common_end; X } else if (font_size[f] == xn_over_d(font_dsize[f], -s, 1000L)) X goto common_end; X } X } X f = read_font_info(u, cur_name, cur_area, s); X Xcommon_end: X equiv(u) = f; X eqtb[FONT_ID_BASE + f] = eqtb[u]; X font_id_text(f) = t; X} X Xprepare_mag () X{ X if (mag_set > 0 && mag != mag_set) { X print_err("Incompatible magnification ("); X print_val(mag); X print(");"); X print_nl(" the previous value will be retained"); X help_mag(); X int_error(mag_set); X geq_word_define((ptr) INT_BASE + MAG_CODE, mag_set); X } X if (mag <= 0 || mag > 32768) { X print_err("Illegal magnification has been changed to 1000"); X help_ill_mag(); X int_error(mag); X geq_word_define((ptr) INT_BASE + MAG_CODE, 1000L); X } X mag_set = mag; X} X Xnew_interaction () X{ X print_ln(); X interaction = cur_chr; X if (interaction == BATCH_MODE) X selector = NO_PRINT; X else selector = TERM_ONLY; X if (job_name != 0) X selector += 2; X} X Xdo_assignments () X{ X loop { X get_nbrx_token(); X if (cur_cmd <= MAX_NON_PREFIXED_COMMAND) X break; X prefixed_command(); X } X} X Xclopen_stream () X{ X int c; X int n; X X c = cur_chr; X scan_four_bit_int(); X n = cur_val; X if (read_open[n] != CLOSED) { X a_close(read_file[n]); X read_open[n] = CLOSED; X } X if (c != 0) { X scan_optional_equals(); X scan_file_name(); X if (cur_ext == null_str) X cur_ext = str_tex; X pack_cur_name(); X if (read_file[n] = a_open_in()) X read_open[n] = JUST_OPENED; X } X} X Xissue_message () X{ X int c; X str s; X int old_setting; X X c = cur_chr; X scan_toks(FALSE, TRUE); X old_setting = selector; X selector = NEW_STRING; X token_show(def_ref); X selector = old_setting; X flush_list(def_ref); X str_room(1); X s = make_string(); X if (c == 0) { X if (term_offset + length(s) > MAX_PRINT_LINE - 2) X print_ln(); X else if (term_offset > 0 || file_offset > 0) X print_char(' '); X print_str(s); X update_terminal(); X } else { X print_err(""); X print_str(s); X if (err_help != NULL) X use_err_help = TRUE; X else if (long_help_seen) X help_err_msg(); X else { X if (interaction < ERROR_STOP_MODE) X long_help_seen = TRUE; X help_poirot(); X } X error(); X use_err_help = FALSE; X } X flush_string(); X} X Xgive_err_help () X{ X token_show(err_help); X} X Xshift_case () X{ X ptr b; X byte c; X ptr p; X hword t; X X b = cur_chr; X scan_toks(FALSE, FALSE); X for (p = token_link(def_ref); p != NULL; p = token_link(p)) { X t = token(p); X if (t < CS_TOKEN_FLAG + SINGLE_BASE) { X if (t >= CS_TOKEN_FLAG) X t -= ACTIVE_BASE; X c = t % 256; X if (c < 128 && equiv(b + c) != 0) X t = 256 * (t / 256) + equiv(b + c); X if (t >= CS_TOKEN_FLAG) X token(p) = t + ACTIVE_BASE; X else token(p) = t; X } X } X back_list(token_link(def_ref)); X free_token(def_ref); X} X Xshow_whatever () X{ X switch (cur_chr) X { X case SHOW_LISTS: X begin_diagnostic(); X show_activities(); X break; X X case SHOW_BOX_CODE: X scan_eight_bit_int(); X begin_diagnostic(); X print_nl("> \\box"); X print_val(cur_val); X print_char('='); X if (box(cur_val) == NULL) X print("void"); X else show_box(box(cur_val)); X break; X X case SHOW_CODE: X get_token(); X print_nl("> "); X if (cur_cs != 0) { X sprint_cs(cur_cs); X print_char('='); X } X print_meaning(); X goto common_end; X break; X X default: X the_toks(); X print_nl("> "); X token_show(temp_toks); X flush_list(token_link(temp_toks)); X goto common_end; X break; X } X end_diagnostic(TRUE); X print_err("OK"); X if (selector == TERM_AND_LOG && tracing_online <= 0) { X selector = TERM_ONLY; X print(" (see the transcript file)"); X selector = TERM_AND_LOG; X } X Xcommon_end: X if (interaction < ERROR_STOP_MODE) { X help0(); X decr(error_count); X } else if (tracing_online > 0) X help_show_online(); X else help_show(); X error(); X} X X/* X * Help text X */ X Xhelp_missing_cs () X{ X help5("Please don't say `\\def cs{...}', say `\\def\\cs{...}'.", X "I've inserted an inaccessible control sequence so that your", X "definition will be completed without mixing me up too badly.", X "You can recover graciously from this error, if you're", X "careful; see exercise 27.2 in The TeXbook."); X} X Xhelp_prefix () X{ X help1("I'll pretend that you didn't say \\long or \\outer or \\global."); X} X Xhelp_pref () X{ X help1("I'll pretend that you didn't say \\long or \\outer here."); X} X Xhelp_read_to () X{ X help2("You should have said `\\read<number> to \\cs'.", X "I'm going to look for the \\cs now."); X} X Xhelp_code () X{ X help1("I'm going to use 0 instead of that illegal code value."); X} X Xhelp_register () X{ X help1("I'm forgetting what you said and not changing anything."); X} X Xhelp_space_factor () X{ X help1("I allow only values in the range 1..32767 here."); X} X Xhelp_prevgraf () X{ X help1("I allow only nonnegative values here."); X} X Xhelp_overflow () X{ X help2(" I can't carry out that multiplication or division,", X "since the result is out of range."); X} X Xhelp_font_at () X{ X help2("I can only handle fonts at positive sizes that are", X "less than 2048pt, so I've changed what you said to 10pt."); X} X Xhelp_font_magnification () X{ X help1("The magnification ratio must be between 1 and 32768."); X} X Xhelp_mag() X{ X help2("I can handle only one magnification ratio per job. So I've", X "reverted to the magnification you used earlier on this run."); X} X Xhelp_ill_mag () X{ X help1("The magnification ratio must be between 1 and 32768."); X} X Xhelp_err_msg () X{ X help1("(That was another \\errmessage.)"); X} X Xhelp_poirot () X{ X help4("This error message was generated by an \\errmessage", X "command, so I can't give any explicit help.", X "Pretend that you're Hercule Poirot, examine all clues,", X "and deduce the truth by order and method."); X} X Xhelp_show_online () X{ X help3("This isn't an error message; I'm just \\showing something.", X "Type `I\\show...' to show more (e.g., \\show\\cs,", X "\\showthe\\count10, \\showbox255, \\showlists)."); X} X Xhelp_show () X{ X help5("This isn't an error message; I'm just \\showing something.", X "Type `I\\show...' to show more (e.g., \\show\\cs,", X "\\showthe\\count10, \\showbox255, \\showlists).", X "And type `I\\tracingonline=1\\show...' to show boxes and", X "lists on your terminal as well as in the transcript file."); X} SHAR_EOF echo "File def.c is complete" chmod 0444 def.c || echo "restore of def.c fails" set `wc -c def.c`;Sum=$1 if test "$Sum" != "19388" then echo original size 19388, current size $Sum;fi echo "x - extracting def.h (Text)" sed 's/^X//' << 'SHAR_EOF' > def.h && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * def.h X */ X Xglobal hword after_token; Xglobal bool long_help_seen; Xglobal val mag_set; X Xint get_r_token(); Xint prefixed_command(); X X#define CHAR_DEF_CODE 0 X#define MATH_CHAR_DEF_CODE 1 X#define COUNT_DEF_CODE 2 X#define DIMEN_DEF_CODE 3 X#define SKIP_DEF_CODE 4 X#define MU_SKIP_DEF_CODE 5 X#define TOKS_DEF_CODE 6 X Xint do_register_command(); Xint trap_zero_glue(); Xint alter_aux(); Xint alter_prev_graf(); Xint alter_page_so_far(); Xint alter_integer(); Xint alter_box_dimen(); Xint new_font(); Xint prepare_mag(); Xint new_interaction(); Xint do_assignments(); Xint clopen_stream(); Xint issue_message(); Xint give_err_help(); Xint shift_case(); Xint show_whatever(); X X#define SHOW_CODE 0 X#define SHOW_BOX_CODE 1 X#define SHOW_THE_CODE 2 X#define SHOW_LISTS 3 SHAR_EOF chmod 0444 def.h || echo "restore of def.h fails" set `wc -c def.h`;Sum=$1 if test "$Sum" != "971" then echo original size 971, current size $Sum;fi echo "x - extracting dvi.c (Text)" sed 's/^X//' << 'SHAR_EOF' > dvi.c && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * dvi.c X */ X X#include "tex.h" X#include "texext.h" X#include "heap.h" X#include "str.h" X#include "io.h" X#include "eq.h" X#include "box.h" X#include "scan.h" X#include "tfm.h" X#include "file.h" X#include "pack.h" X#include "print.h" X#include "error.h" X#include "dvi.h" X Xbyte_file dvi_file; X Xptr dvi_ptr; Xbyte dvi_buf[DVI_BUF_SIZE]; Xptr dvi_limit = DVI_BUF_SIZE; Xval dvi_offset; Xval dvi_gone; X Xqword c; Xqword f; Xptr g; Xval lq; Xval lr; Xint cur_s; Xscal cur_h; Xscal cur_v; Xfnt dvi_f; Xscal dvi_h; Xscal dvi_v; Xscal max_h; Xscal max_v; Xscal rule_dp; Xscal rule_ht; Xscal rule_wd; Xint max_push; Xint total_pages; Xint dead_cycles; Xbool doing_leaders; Xval last_bop = -1; X Xptr down_ptr; Xptr right_ptr; X Xdvi_swap () X{ X if (dvi_limit == DVI_BUF_SIZE) { X write_dvi(0, HALF_BUF); X dvi_limit = HALF_BUF; X dvi_offset += DVI_BUF_SIZE; X dvi_ptr = 0; X } else { X write_dvi(HALF_BUF, DVI_BUF_SIZE); X dvi_limit = DVI_BUF_SIZE; X } X dvi_gone += HALF_BUF; X} X Xdvi_four (x) X val x; X{ X if (x >= 0) { X dvi_out(x / 0100000000); X } else { X x += 010000000000; X x += 010000000000; X dvi_out(x / 0100000000 + 128); X } X x %= 01000000000; X dvi_out(x / 0200000); X x %= 0200000; X dvi_out(x / 0400); X dvi_out(x % 0400); X} X Xdvi_pop (l) X val l; X{ X if (l == dvi_offset + dvi_ptr && dvi_ptr > 0) X decr(dvi_ptr); X else dvi_out(POP); X} X Xdvi_font_def (f) X fnt f; X{ X int k; X X dvi_out(FNT_DEF1); X dvi_out(f - FONT_BASE - 1); X dvi_out(qo(font_check[f].b0)); X dvi_out(qo(font_check[f].b1)); X dvi_out(qo(font_check[f].b2)); X dvi_out(qo(font_check[f].b3)); X dvi_four(font_size[f]); X dvi_four(font_dsize[f]); X dvi_out(length(font_area[f])); X dvi_out(length(font_name[f])); X for (k = str_start[font_area[f]]; k < str_start[font_area[f] + 1]; incr(k)) X dvi_out(str_pool[k]); X for (k = str_start[font_name[f]]; k < str_start[font_name[f] + 1]; incr(k)) X dvi_out(str_pool[k]); X} X X#define Y_HERE 1 X#define Z_HERE 2 X#define YZ_OK 3 X#define Y_OK 4 X#define Z_OK 5 X#define D_FIXED 6 X#define NONE_SEEN 0 X#define Y_SEEN 6 X#define Z_SEEN 12 X Xmovement (w, o) X scal w; X byte o; X{ X val k; X ptr p; X ptr q; X int mstate; X X q = get_node(MOVEMENT_NODE_SIZE); X width(q) = w; X location(q) = dvi_offset + dvi_ptr; X if (o == DOWN1) { X link(q) = down_ptr; X down_ptr = q; X } else { X link(q) = right_ptr; X right_ptr = q; X } X mstate = NONE_SEEN; X for (p = link(q); p != NULL; p = link(p)) { X if (width(p) == w) { X switch (mstate + info(p)) X { X case NONE_SEEN + YZ_OK: X case NONE_SEEN + Y_OK: X case Z_SEEN + YZ_OK: X case Z_SEEN + Y_OK: X if (location(p) < dvi_gone) X goto not_found; X else { X k = location(p) - dvi_offset; X if (k < 0) X k += DVI_BUF_SIZE; X dvi_buf[(int)k] += Y1 - DOWN1; X info(p) = Y_HERE; X goto found; X } X break; X X case NONE_SEEN + Z_OK: X case Y_SEEN + YZ_OK: X case Y_SEEN + Z_OK: X if (location(p) < dvi_gone) { X goto not_found; X } else { X k = location(p) - dvi_offset; X if (k < 0) X k += DVI_BUF_SIZE; X dvi_buf[(int)k] += Z1 - DOWN1; X info(p) = Z_HERE; X goto found; X } X break; X X case NONE_SEEN + Y_HERE: X case NONE_SEEN + Z_HERE: X case Y_SEEN + Z_HERE: X case Z_SEEN + Y_HERE: X goto found; X break; X } X } else { X switch (mstate + info(p)) X { X case NONE_SEEN + Y_HERE: X mstate = Y_SEEN; X break; X X case NONE_SEEN + Z_HERE: X mstate = Z_SEEN; X break; X X case Y_SEEN + Z_HERE: X case Z_SEEN + Y_HERE: X goto not_found; X break; X X default: X break; X } X } X } X Xnot_found: X info(q) = YZ_OK; X if (abs(w) >= 040000000) { X dvi_out(o + 3); X dvi_four(w); X return; X } X if (abs(w) >= 0100000) { X dvi_out(o + 2); X if (w < 0) X w += 0100000000; X dvi_out(w / 0200000); X w %= 0200000; X goto two; X } X if (abs(w) >= 0200) { X dvi_out(o + 1); X if (w < 0) X w += 0200000; X goto two; X } X dvi_out(o); X if (w < 0) X w += 0400; X goto one; X Xtwo: dvi_out(w / 0400); Xone: dvi_out(w % 0400); X return; X Xfound: X info(q) = info(p); X if (info(q) == Y_HERE) { X dvi_out(o + Y0 - DOWN1); X while (link(q) != p) { X q = link(q); X switch (info(q)) X { X case YZ_OK: X info(q) = Z_OK; X break; X X case Y_OK: X info(q) = D_FIXED; X break; X } X } X } else { X dvi_out(o + Z0 - DOWN1); X while (link(q) != p) { X q = link(q); X switch (info(q)) X { X case YZ_OK: X info(q) = Y_OK; X break; X X case Z_OK: X info(q) = D_FIXED; X break; X default: X break; X } X } X } X} X Xprune_movements (l) X val l; X{ X ptr p; X X while (down_ptr != NULL) { X if (location(down_ptr) < l) X break; X p = down_ptr; X down_ptr = link(p); X free_node(p, MOVEMENT_NODE_SIZE); X } X while (right_ptr != NULL) { X if (location(right_ptr) < l) X break; X p = right_ptr; X right_ptr = link(p); X free_node(p, MOVEMENT_NODE_SIZE); X } X} X Xhlist_out () X{ X ptr p; X scal lx; X scal edge; X int g_sign; X scal save_h; X scal save_v; X gord g_order; X val save_loc; X ptr this_box; X scal base_line; X scal leader_wd; X scal left_edge; X ptr leader_box; X bool outer_doing_leaders; X X this_box = temp_ptr; X g_order = glue_order(this_box); X g_sign = glue_sign(this_box); X p = list_ptr(this_box); X incr(cur_s); X if (cur_s > 0) X dvi_out(PUSH); X if (cur_s > max_push) X max_push = cur_s; X save_loc = dvi_offset + dvi_ptr; X base_line = cur_v; X left_edge = cur_h; X while (p != NULL) { Xreswitch: X if (is_char_node(p)) { X synch_h(); X synch_v(); X do { X f = font(p); X c = character(p); X if (f != dvi_f) { X if (!font_used[f]) { X dvi_font_def(f); X font_used[f] = TRUE; X } X if (f <= 64 + FONT_BASE) { X dvi_out(f - FONT_BASE - 1 + FNT_NUM_0); X } else { X dvi_out(FNT1); X dvi_out(f - FONT_BASE - 1); X } X dvi_f = f; X } X if (c < qi(128)) { X dvi_out(qo(c)); X } else { X dvi_out(SET1); X dvi_out(qo(c)); X } X cur_h += char_width(f, char_info(f, c)); X p = link(p); X } while (is_char_node(p)); X dvi_h = cur_h; X } else { X switch (type(p)) X { X case HLIST_NODE: X case VLIST_NODE: X if (list_ptr(p) == NULL) X cur_h += width(p); X else { X save_h = dvi_h; X save_v = dvi_v; X cur_v = base_line + shift_amount(p); X temp_ptr = p; X edge = cur_h; X if (type(p) == VLIST_NODE) X vlist_out(); X else hlist_out(); X dvi_h = save_h; X dvi_v = save_v; X cur_h = edge + width(p); X cur_v = base_line; X } X break; X X case RULE_NODE: X rule_ht = height(p); X rule_dp = depth(p); X rule_wd = width(p); X goto fin_rule; X break; X X case WHATSIT_NODE: X out_whatsit(p); X break; X X case GLUE_NODE: X g = glue_ptr(p); X rule_wd = width(g); X if (g_sign != NORMAL) { X if (g_sign == STRETCHING) { X if (stretch_order(g) == g_order) X rule_wd += round(glue_set(this_box) * stretch(g)); X } else { X if (shrink_order(g) == g_order) X rule_wd -= round(glue_set(this_box) * shrink(g)); X } X } X if (subtype(p) >= A_LEADERS) { X leader_box = leader_ptr(p); X if (type(leader_box) == RULE_NODE) { X rule_ht = height(leader_box); X rule_dp = depth(leader_box); X goto fin_rule; X } X leader_wd = width(leader_box); X if (leader_wd > 0 && rule_wd > 0) { X edge = cur_h + rule_wd; X lx = 0; X if (subtype(p) == A_LEADERS) { X save_h = cur_h; X cur_h = left_edge + X leader_wd * ((cur_h - left_edge) / leader_wd); X if (cur_h < save_h) X cur_h += leader_wd; X } else { X lq = rule_wd / leader_wd; X lr = rule_wd % leader_wd; X if (subtype(p) == C_LEADERS) X cur_h += (lr / 2); X else { X lx = (2 * lr + lq + 1) / (2 * lq + 2); X cur_h += (lr - (lq - 1) * lx) / 2; X } X } X while (cur_h + leader_wd <= edge) { X cur_v = base_line + shift_amount(leader_box); X synch_v(); X save_v = dvi_v; X synch_h(); X save_h = dvi_h; X temp_ptr = leader_box; X outer_doing_leaders = doing_leaders; X doing_leaders = TRUE; X if (type(leader_box) == VLIST_NODE) X vlist_out(); X else hlist_out(); X doing_leaders = outer_doing_leaders; X dvi_v = save_v; X dvi_h = save_h; X cur_v = save_v; X cur_h = save_h + lx + leader_wd; X } X } X cur_h = edge; X goto next_p; X } X goto move_past; X break; X X case KERN_NODE: X case MATH_NODE: X cur_h += width(p); X break; X X case LIGATURE_NODE: X make_char_from_lig(); X goto reswitch; X X default: break; X } X goto next_p; X X fin_rule: X if (is_running(rule_ht)) X rule_ht = height(this_box); X if (is_running(rule_dp)) X rule_dp = depth(this_box); X rule_ht = rule_ht + rule_dp; X if (rule_ht > 0 && rule_wd > 0) { X synch_h(); X cur_v = base_line + rule_dp; X synch_v(); X dvi_out(SET_RULE); X dvi_four(rule_ht); X dvi_four(rule_wd); X cur_v = base_line; X dvi_h += rule_wd; X } X X move_past: X cur_h += rule_wd; X X next_p: X p = link(p); X } X } X prune_movements(save_loc); X if (cur_s > 0) X dvi_pop(save_loc); X decr(cur_s); X} X Xvlist_out () X{ X ptr p; X scal lx; X scal edge; X int g_sign; X scal save_h; X scal save_v; X gord g_order; X val save_loc; X scal top_edge; X ptr this_box; X scal leader_ht; X scal left_edge; X ptr leader_box; X bool outer_doing_leaders; X X this_box = temp_ptr; X g_order = glue_order(this_box); X g_sign = glue_sign(this_box); X p = list_ptr(this_box); X incr(cur_s); X if (cur_s > 0) X dvi_out(PUSH); X if (cur_s > max_push) X max_push = cur_s; X save_loc = dvi_offset + dvi_ptr; X left_edge = cur_h; X cur_v -= height(this_box); X top_edge = cur_v; X while (p != NULL) { X if (is_char_node(p)) X confusion("vlistout"); X else { X switch (type(p)) X { X case HLIST_NODE: X case VLIST_NODE: X if (list_ptr(p) == NULL) X cur_v += height(p) + depth(p); X else { X cur_v += height(p); X synch_v(); X save_h = dvi_h; X save_v = dvi_v; X cur_h = left_edge + shift_amount(p); X temp_ptr = p; X if (type(p) == VLIST_NODE) X vlist_out(); X else hlist_out(); X dvi_h = save_h; X dvi_v = save_v; X cur_v = save_v + depth(p); X cur_h = left_edge; X } X break; X X case RULE_NODE: X rule_ht = height(p); X rule_dp = depth(p); X rule_wd = width(p); X goto fin_rule; X break; X X case WHATSIT_NODE: X out_whatsit(p); X break; X X case GLUE_NODE: X g = glue_ptr(p); X rule_ht = width(g); X if (g_sign != NORMAL) { X if (g_sign == STRETCHING) { X if (stretch_order(g) == g_order) X rule_ht += round(glue_set(this_box) * stretch(g)); X } else if (shrink_order(g) == g_order) X rule_ht -= round(glue_set(this_box) * shrink(g)); X } X if (subtype(p) >= A_LEADERS) { X leader_box = leader_ptr(p); X if (type(leader_box) == RULE_NODE) { X rule_wd = width(leader_box); X rule_dp = 0; X goto fin_rule; X } X leader_ht = height(leader_box) + depth(leader_box); X if (leader_ht > 0 && rule_ht > 0) { X edge = cur_v + rule_ht; X lx = 0; X if (subtype(p) == A_LEADERS) { X save_v = cur_v; X cur_v = top_edge + X leader_ht * ((cur_v - top_edge) / leader_ht); X if (cur_v < save_v) X cur_v += leader_ht; X } else { X lq = rule_ht / leader_ht; X lr = rule_ht % leader_ht; X if (subtype(p) == C_LEADERS) X cur_v += lr / 2; X else { X lx = (2 * lr + lq + 1) / (2 * lq + 2); X cur_v += (lr - (lq - 1) * lx) / 2; X } X } X while (cur_v + leader_ht <= edge) { X cur_h = left_edge + shift_amount(leader_box); X synch_h(); X save_h = dvi_h; X cur_v += height(leader_box); X synch_v(); X save_v = dvi_v; X temp_ptr = leader_box; X outer_doing_leaders = doing_leaders; X doing_leaders = TRUE; X if (type(leader_box) == VLIST_NODE) X vlist_out(); X else hlist_out(); X doing_leaders = outer_doing_leaders; X dvi_v = save_v; X dvi_h = save_h; X cur_h = save_h; X cur_v = save_v - height(leader_box)+lx+leader_ht; X } X cur_v = edge; X goto next_p; X } X } X goto move_past; X break; X X case KERN_NODE: X cur_v += width(p); X break; X X default: X break; X } X goto next_p; X X fin_rule: X if (is_running(rule_wd)) X rule_wd = width(this_box); X rule_ht += rule_dp; X cur_v += rule_ht; X if (rule_ht > 0 && rule_wd > 0) { X synch_h(); X synch_v(); X dvi_out(PUT_RULE); X dvi_four(rule_ht); X dvi_four(rule_wd); X } X goto next_p; X X move_past: X cur_v += rule_ht; X } X X next_p: X p = link(p); X } X prune_movements(save_loc); X if (cur_s > 0) X dvi_pop(save_loc); X decr(cur_s); X} X X#define ensure_dvi_open() \ X {if (dvi_name == 0) { \ X if (job_name == 0) \ X job_name = str_texput; \ X pack_job_name(str_dvi); \ X while ((dvi_file = b_open_out()) == NULL) \ X prompt_file_name("file name for output", str_dvi); \ X dvi_name = b_make_name_string(dvi_file);}} X Xship_out (p) X ptr p; X{ X int j; X int k; X int s; X val page_loc; X X if (tracing_output > 0) { X print_ln(); X print_nl("Completed box being shipped out"); X } X if (term_offset > MAX_PRINT_LINE - 9) X print_ln(); X else if (term_offset > 0 || file_offset > 0) X print_char(' '); X print_char('['); X for (j = 9; count(j) == 0 && j > 0; decr(j)) X {} X for (k = 0; k <= j; incr(k)) { X print_val(count(k)); X if (k < j) X print_char('.'); X } X update_terminal(); X if (tracing_output > 0) { X print_char(']'); X begin_diagnostic(); X show_box(p); X end_diagnostic(TRUE); X } X if (height(p) > MAX_DIMEN || depth(p) > MAX_DIMEN || X height(p) + depth(p) + v_offset > MAX_DIMEN || X width(p) + h_offset > MAX_DIMEN) { X print_err("Huge page cannot be shipped out"); X help_huge_page(); X error(); X if (tracing_output <= 0) { X begin_diagnostic(); X print_nl("The following box has been deleted:"); X show_box(p); X end_diagnostic(TRUE); X } X goto done; X } X if (height(p) + depth(p) + v_offset > max_v) X max_v = height(p) + depth(p) + v_offset; X if (width(p) + h_offset > max_h) X max_h = width(p) + h_offset; X dvi_h = 0; X dvi_v = 0; X cur_h = 0; X dvi_f = NULL_FONT; X cur_s = -1; X ensure_dvi_open(); X if (total_pages == 0) { X dvi_out(PRE); X dvi_out(ID_BYTE); X dvi_four(25400000); X dvi_four(473628672); X prepare_mag(); X dvi_four(mag); X old_setting = selector; X selector = NEW_STRING; X print("Common TeX output "); X print_int(year); X print_char('.'); X print_two(month); X print_char('.'); X print_two(day); X print_char(':'); X print_two(time / 60); X print_two(time % 60); X selector = old_setting; X dvi_out(cur_length()); X for (s = str_start[str_ptr]; s < pool_ptr; incr(s)) X dvi_out(str_pool[s]); X pool_ptr = str_start[str_ptr]; X } X page_loc = dvi_offset + dvi_ptr; X dvi_out(BOP); X for (k = 0; k <= 9; incr(k)) X dvi_four(count(k)); X dvi_four(last_bop); X last_bop = page_loc; X cur_v = height(p) + v_offset; X temp_ptr = p; X if (type(p) == VLIST_NODE) X vlist_out(); X else hlist_out(); X dvi_out(EOP); X incr(total_pages); X Xdone: X if (tracing_output <= 0) print_char(']'); X dead_cycles = 0; X update_terminal(); X X#ifdef STAT X if (tracing_stats > 1) { X print_nl("Memory usage before: "); X print_int(var_used); X print_char('&'); X print_int(dyn_used); X print_char(';'); X } X#endif X X flush_node_list(p); X X#ifdef STAT X if (tracing_stats > 1) { X print(" after: "); X print_int(var_used); X print_char('&'); X print_int(dyn_used); X print("; still untouched: "); X print_int(hi_mem_min - lo_mem_max - 1); X print_ln(); X } X#endif X} X X/* X * Help text X */ X Xhelp_huge_page () X{ X help2("The page just created is more than 18 feet tall or", X "more than 18 feet wide, so I suspect something went wrong."); X} SHAR_EOF chmod 0444 dvi.c || echo "restore of dvi.c fails" set `wc -c dvi.c`;Sum=$1 if test "$Sum" != "15784" then echo original size 15784, current size $Sum;fi echo "x - extracting dvi.h (Text)" sed 's/^X//' << 'SHAR_EOF' > dvi.h && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * dvi.h X */ X Xglobal byte_file dvi_file; X X#define SET_CHAR_0 0 X#define SET1 128 X#define SET_RULE 132 X#define PUT1 133 X#define PUT_RULE 137 X#define NOP 138 X#define BOP 139 X#define EOP 140 X#define PUSH 141 X#define POP 142 X#define RIGHT1 143 X#define W0 147 X#define W1 148 X#define X0 152 X#define X1 153 X#define DOWN1 157 X#define Y0 161 X#define Y1 162 X#define Z0 166 X#define Z1 167 X#define FNT_NUM_0 171 X#define FNT1 235 X#define XXX1 239 X#define XXX4 242 X#define FNT_DEF1 243 X#define PRE 247 X#define POST 248 X#define POST_POST 249 X#define ID_BYTE 2 X Xglobal qword c; Xglobal qword f; Xglobal ptr g; Xglobal int dead_cycles; Xglobal bool doing_leaders; Xglobal val last_bop; Xglobal val lq; Xglobal val lr; Xglobal val lx; Xglobal scal max_h; Xglobal scal max_v; Xglobal int max_push; Xglobal scal rule_ht; Xglobal scal rule_dp; Xglobal scal rule_wd; X Xglobal fnt dvi_f; Xglobal scal dvi_h; Xglobal scal dvi_v; Xglobal scal cur_h; Xglobal scal cur_v; Xglobal int cur_s; X Xglobal ptr down_ptr; Xglobal ptr right_ptr; X Xglobal byte dvi_buf[]; Xglobal ptr dvi_limit; Xglobal ptr dvi_ptr; Xglobal val dvi_offset; Xglobal val dvi_gone; Xglobal bool output_active; Xglobal int total_pages; X X#define MOVEMENT_NODE_SIZE 3 X#define location(L) mem[L + 2].i X X#define synch_h() \ X {if (cur_h != dvi_h) \ X {movement(cur_h - dvi_h, RIGHT1); dvi_h = cur_h;}} X X#define synch_v() \ X {if (cur_v != dvi_v) \ X {movement(cur_v - dvi_v, DOWN1); dvi_v = cur_v;}} X X#define dvi_out(B) \ X {dvi_buf[dvi_ptr] = B; \ X incr(dvi_ptr); \ X if (dvi_ptr == dvi_limit) \ X dvi_swap();} X X#define write_dvi(a, b) \ X {fwrite(&dvi_buf[a], sizeof(dvi_buf[0]), b - a, dvi_file);} X X Xint dvi_swap(); Xint dvi_four(); Xint dvi_pop(); Xint dvi_font_def(); Xint movement(); Xint prune_movements(); Xint hlist_out(); Xint vlist_out(); Xint ship_out(); SHAR_EOF chmod 0444 dvi.h || echo "restore of dvi.h fails" set `wc -c dvi.h`;Sum=$1 if test "$Sum" != "2105" then echo original size 2105, current size $Sum;fi echo "x - extracting eq.c (Text)" sed 's/^X//' << 'SHAR_EOF' > eq.c && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * eq.c X */ X X#include "tex.h" X#include "cmds.h" X#include "heap.h" X#include "char.h" X#include "token.h" X#include "hash.h" X#include "box.h" X#include "print.h" X#include "error.h" X#include "eq.h" X Xmword eqtb[EQTB_SIZE+1]; Xqword xeq_level[EQTB_SIZE+1 - INT_BASE]; X Xprint_skip_param (n) X int n; X{ X switch (n) X { X case LINE_SKIP_CODE: X print_esc("lineskip"); X break; X X case BASELINE_SKIP_CODE: X print_esc("baselineskip"); X break; X X case PAR_SKIP_CODE: X print_esc("parskip"); X break; X X case ABOVE_DISPLAY_SKIP_CODE: X print_esc("abovedisplayskip"); X break; X X case BELOW_DISPLAY_SKIP_CODE: X print_esc("belowdisplayskip"); X break; X X case ABOVE_DISPLAY_SHORT_SKIP_CODE: X print_esc("abovedisplayshortskip"); X break; X X case BELOW_DISPLAY_SHORT_SKIP_CODE: X print_esc("belowdisplayshortskip"); X break; X X case LEFT_SKIP_CODE: X print_esc("leftskip"); X break; X X case RIGHT_SKIP_CODE: X print_esc("rightskip"); X break; X X case TOP_SKIP_CODE: X print_esc("topskip"); X break; X X case SPLIT_TOP_SKIP_CODE: X print_esc("splittopskip"); X break; X X case TAB_SKIP_CODE: X print_esc("tabskip"); X break; X X case SPACE_SKIP_CODE: X print_esc("spaceskip"); X break; X X case XSPACE_SKIP_CODE: X print_esc("xspaceskip"); X break; X X case PAR_FILL_SKIP_CODE: X print_esc("parfillskip"); X break; X X case THIN_MU_SKIP_CODE: X print_esc("thinmuskip"); X break; X X case MED_MU_SKIP_CODE: X print_esc("medmuskip"); X break; X X case THICK_MU_SKIP_CODE: X print_esc("thickmuskip"); X break; X X default: X print("[unknown glue parameter!]"); X break; X } X} X Xprint_param (n) X int n; X{ X switch (n) X { X case PRETOLERANCE_CODE: X print_esc("pretolerance"); X break; X X case TOLERANCE_CODE: X print_esc("tolerance"); X break; X X case LINE_PENALTY_CODE: X print_esc("linepenalty"); X break; X X case HYPHEN_PENALTY_CODE: X print_esc("hyphenpenalty"); X break; X X case EX_HYPHEN_PENALTY_CODE: X print_esc("exhyphenpenalty"); X break; X X case CLUB_PENALTY_CODE: X print_esc("clubpenalty"); X break; X X case WIDOW_PENALTY_CODE: X print_esc("widowpenalty"); X break; X X case DISPLAY_WIDOW_PENALTY_CODE: X print_esc("displaywidowpenalty"); X break; X X case BROKEN_PENALTY_CODE: X print_esc("brokenpenalty"); X break; X X case BIN_OP_PENALTY_CODE: X print_esc("binoppenalty"); X break; X X case REL_PENALTY_CODE: X print_esc("relpenalty"); X break; X X case PRE_DISPLAY_PENALTY_CODE: X print_esc("predisplaypenalty"); X break; X X case POST_DISPLAY_PENALTY_CODE: X print_esc("postdisplaypenalty"); X break; X X case INTER_LINE_PENALTY_CODE: X print_esc("interlinepenalty"); X break; X X case DOUBLE_HYPHEN_DEMERITS_CODE: X print_esc("doublehyphendemerits"); X break; X X case FINAL_HYPHEN_DEMERITS_CODE: X print_esc("finalhyphendemerits"); X break; X X case ADJ_DEMERITS_CODE: X print_esc("adjdemerits"); X break; X X case MAG_CODE: X print_esc("mag"); X break; X X case DELIMITER_FACTOR_CODE: X print_esc("delimiterfactor"); X break; X X case LOOSENESS_CODE: X print_esc("looseness"); X break; X X case TIME_CODE: X print_esc("time"); X break; X X case DAY_CODE: X print_esc("day"); X break; X X case MONTH_CODE: X print_esc("month"); X break; X X case YEAR_CODE: X print_esc("year"); X break; X X case SHOW_BOX_BREADTH_CODE: X print_esc("showboxbreadth"); X break; X X case SHOW_BOX_DEPTH_CODE: X print_esc("showboxdepth"); X break; X X case HBADNESS_CODE: X print_esc("hbadness"); X break; X X case VBADNESS_CODE: X print_esc("vbadness"); X break; X X case PAUSING_CODE: X print_esc("pause"); X break; X X case TRACING_ONLINE_CODE: X print_esc("tracingonline"); X break; X X case TRACING_MACROS_CODE: X print_esc("tracingmacros"); X break; X X case TRACING_STATS_CODE: X print_esc("tracingstats"); X break; X X case TRACING_PARAGRAPHS_CODE: X print_esc("tracingparagraphs"); X break; X X case TRACING_PAGES_CODE: X print_esc("tracingpages"); X break; X X case TRACING_OUTPUT_CODE: X print_esc("tracingoutput"); X break; X X case TRACING_LOST_CHARS_CODE: X print_esc("tracinglostchars"); X break; X X case TRACING_COMMANDS_CODE: X print_esc("tracingcommands"); X break; X X case TRACING_RESTORES_CODE: X print_esc("tracingrestores"); X break; X X case UC_HYPH_CODE: X print_esc("uchyph"); X break; X X case OUTPUT_PENALTY_CODE: X print_esc("outputpenalty"); X break; X X case MAX_DEAD_CYCLES_CODE: X print_esc("maxdeadcycles"); X break; X X case HANG_AFTER_CODE: X print_esc("hangafter"); X break; X X case FLOATING_PENALTY_CODE: X print_esc("floatingpenalty"); X break; X X case GLOBAL_DEFS_CODE: X print_esc("globaldefs"); X break; X X case CUR_FAM_CODE: X print_esc("fam"); X break; X X case ESCAPE_CHAR_CODE: X print_esc("escapechar"); X break; X X case DEFAULT_HYPHEN_CHAR_CODE: X print_esc("defaulthyphenchar"); X break; X X case DEFAULT_SKEW_CHAR_CODE: X print_esc("defaultskewchar"); X break; X X case END_LINE_CHAR_CODE: X print_esc("endlinechar"); X break; X X case NEW_LINE_CHAR_CODE: X print_esc("newlinechar"); X break; X X default: X print("[unknown integer parameter!]"); X break; X } X} X Xprint_length_param (n) X int n; X{ X switch (n) X { X case PAR_INDENT_CODE: X print_esc("parindent"); X break; X X case MATH_SURROUND_CODE: X print_esc("mathsurround"); X break; X X case LINE_SKIP_LIMIT_CODE: X print_esc("lineskiplimit"); X break; X X case HSIZE_CODE: X print_esc("hsize"); X break; X X case VSIZE_CODE: X print_esc("vsize"); X break; X X case MAX_DEPTH_CODE: X print_esc("maxdepth"); X break; X X case SPLIT_MAX_DEPTH_CODE: X print_esc("splitmaxdepth"); X break; X X case BOX_MAX_DEPTH_CODE: X print_esc("boxmaxdepth"); X break; X X case HFUZZ_CODE: X print_esc("hfuzz"); X break; X X case VFUZZ_CODE: X print_esc("vfuzz"); X break; X X case DELIMITER_SHORTFALL_CODE: X print_esc("delimitershortfall"); X break; X X case NULL_DELIMITER_SPACE_CODE: X print_esc("nulldelimiterspace"); X break; X X case SCRIPT_SPACE_CODE: X print_esc("scriptspace"); X break; X X case PRE_DISPLAY_SIZE_CODE: X print_esc("predisplaysize"); X break; X X case DISPLAY_INDENT_CODE: X print_esc("displayindent"); X break; X X case DISPLAY_WIDTH_CODE: X print_esc("displaywidth"); X break; X X case OVERFULL_RULE_CODE: X print_esc("overfullrule"); X break; X X case HANG_INDENT_CODE: X print_esc("hangindent"); X break; X X case H_OFFSET_CODE: X print_esc("hoffset"); X break; X X case V_OFFSET_CODE: X print_esc("voffset"); X break; X X default: X print("[unknown dimen parameter!]"); X break; X } X} X X#ifdef STAT Xshow_eqtb (n) X ptr n; X{ X if (n < ACTIVE_BASE) X print_char('?'); X else if (n < GLUE_BASE) { X sprint_cs(n); X print_char('='); X print_cmd_chr(eq_type(n), equiv(n)); X if (eq_type(n) >= CALL) { X print_char(':'); X show_token_list(token_link(equiv(n)), NULL, 32L); X } X } else if (n < LOCAL_BASE) { X if (n < SKIP_BASE) { X print_skip_param(n - GLUE_BASE); X print_char('='); X if (n < GLUE_BASE + THIN_MU_SKIP_CODE) X print_spec(equiv(n), "pt"); X else print_spec(equiv(n), "mu"); X } else if (n < MU_SKIP_BASE) { X print_esc("skip"); X print_int(n - SKIP_BASE); X print_char('='); X print_spec(equiv(n), "pt"); X } else { X print_esc("muskip"); X print_int(n - MU_SKIP_BASE); X print_char('='); X print_spec(equiv(n), "mu"); X } X } else if (n < INT_BASE) { X if (n == PAR_SHAPE_LOC) { X print_esc("parshape"); X print_char('='); X if (par_shape_ptr == NULL) X print_char('O'); X else print_int(info(par_shape_ptr)); X } else if (n < TOKS_BASE) { X print_cmd_chr(ASSIGN_TOKS, n); X print_char('='); X if (equiv(n) != NULL) X show_token_list(token_link(equiv(n)), NULL, 32L); X } else if (n < BOX_BASE) { X print_esc("toks"); X print_int(n - TOKS_BASE); X print_char('='); X if (equiv(n) != NULL) X show_token_list(token_link(equiv(n)), NULL, 32L); X } else if (n < CUR_FONT_LOC) { X print_esc("box"); X print_int(n - BOX_BASE); X print_char('='); X if (equiv(n) == NULL) X print("void"); X else { X depth_threshold = 0; X breadth_max = 1; X show_node_list(equiv(n)); X } X } else if (n < CAT_CODE_BASE) { X if (n == CUR_FONT_LOC) X print("current font"); X else if (n < MATH_FONT_BASE + 16) { X print_esc("textfont"); X print_int(n - MATH_FONT_BASE); X } else if (n < MATH_FONT_BASE + 32) { X print_esc("scriptfont"); X print_int(n - MATH_FONT_BASE - 16); X } else { X print_esc("scriptscritpfont"); X print_int(n - MATH_FONT_BASE - 32); X } X print_char('='); X print_esc(""); X print_str(hash[FONT_ID_BASE + equiv(n)].hh1.rh); X } else { X if (n < MATH_CODE_BASE) { X if (n < LC_CODE_BASE) { X print_esc("catcode"); X print_int(n - CAT_CODE_BASE); X } else if (n < UC_CODE_BASE) { X print_esc("lccode"); X print_int(n - LC_CODE_BASE); X } else if (n < SF_CODE_BASE) { X print_esc("uccode"); X print_int(n - UC_CODE_BASE); X } else { X print_esc("sfcode"); X print_int(n - SF_CODE_BASE); X } X print_char('='); X print_int(equiv(n)); X } else { X print_esc("math_code"); X print_int(n - MATH_CODE_BASE); X print_char('='); X print_int(ho(equiv(n))); X } X } X } else if (n < DIMEN_BASE) { X if (n < COUNT_BASE) X print_param(n - INT_BASE); X else if (n < DEL_CODE_BASE) { X print_esc("count"); X print_int(n - COUNT_BASE); X } else { X print_esc("delcode"); X print_int(n - DEL_CODE_BASE); X } X print_char('='); X print_val(eqtb[n].i); X } else if (n <= EQTB_SIZE) { X if (n < SCALED_BASE) X print_length_param(n - DIMEN_BASE); X else { X print_esc("dimen"); X print_int(n - SCALED_BASE); X } X print_char('='); X print_scaled(eqtb[n].sc); X print("pt"); X } else print_char('?'); X} X#endif X Xinit_eq () X{ X int k; X X for (k = 0; k <= EQTB_SIZE - INT_BASE; incr(k)) X xeq_level[k] = LEVEL_ONE; X X#ifdef INIT X eq_type(UNDEFINED_CONTROL_SEQUENCE) = UNDEFINED_CS; X equiv(UNDEFINED_CONTROL_SEQUENCE) = NULL; X eq_level(UNDEFINED_CONTROL_SEQUENCE) = LEVEL_ZERO; X for (k = ACTIVE_BASE; k < UNDEFINED_CONTROL_SEQUENCE; incr(k)) X eqtb[k]= eqtb[UNDEFINED_CONTROL_SEQUENCE]; X X equiv(GLUE_BASE) = zero_glue; X eq_level(GLUE_BASE) = LEVEL_ONE; SHAR_EOF echo "End of part 6" echo "File eq.c is continued in part 7" echo "7" > s2_seq_.tmp exit 0
glenn@extro.ucc.su.oz.au (G Geers) (02/16/90)
---- Cut Here and unpack ---- #!/bin/sh # this is part 7 of a multipart archive # do not concatenate these parts, unpack them in order with /bin/sh # file eq.c continued # CurArch=7 if test ! -r s2_seq_.tmp then echo "Please unpack part 1 first!" exit 1; fi ( read Scheck if test "$Scheck" != $CurArch then echo "Please unpack part $Scheck next!" exit 1; else exit 0; fi ) < s2_seq_.tmp || exit 1 echo "x - Continuing file eq.c" sed 's/^X//' << 'SHAR_EOF' >> eq.c X eq_type(GLUE_BASE) = GLUE_REF; X for (k = GLUE_BASE + 1; k < LOCAL_BASE; incr(k)) X eqtb[k] = eqtb[GLUE_BASE]; X glue_ref_count(zero_glue) += LOCAL_BASE - GLUE_BASE; X X par_shape_ptr = NULL; X eq_type(PAR_SHAPE_LOC) = SHAPE_REF; X eq_level(PAR_SHAPE_LOC)= LEVEL_ONE; X for (k = OUTPUT_ROUTINE_LOC; k < TOKS_BASE + 256; incr(k)) X eqtb[k] = eqtb[UNDEFINED_CONTROL_SEQUENCE]; X box(0) = NULL; X eq_type(BOX_BASE) = BOX_REF; X eq_level(BOX_BASE) = LEVEL_ONE; X for (k = BOX_BASE + 1; k < BOX_BASE + 256; incr(k)) X eqtb[k] = eqtb[BOX_BASE]; X cur_font = NULL_FONT; X eq_type(CUR_FONT_LOC) = DATA; X eq_level(CUR_FONT_LOC) = LEVEL_ONE; X for (k = MATH_FONT_BASE; k < MATH_FONT_BASE + 48; incr(k)) X eqtb[k] = eqtb[CUR_FONT_LOC]; X equiv(CAT_CODE_BASE) = 0; X eq_type(CAT_CODE_BASE) = DATA; X eq_level(CAT_CODE_BASE) = LEVEL_ONE; X for (k = CAT_CODE_BASE; k < INT_BASE; incr(k)) X eqtb[k] = eqtb[CAT_CODE_BASE]; X for (k = 0; k <= 127; incr(k)) { X cat_code(k) = OTHER_CHAR; X math_code(k) = hi(k); X sf_code(k) = 1000; X } X cat_code(CARRIAGE_RETURN) = CAR_RET; X cat_code(' ') = SPACER; X cat_code('^') = SUP_MARK; X cat_code('\\') = ESCAPE; X cat_code('%') = COMMENT; X cat_code(INVALID_CODE) = INVALID_CHAR; X cat_code(NULL_CODE) = IGNORE; X for (k = '0'; k <= '9'; incr(k)) X math_code(k) = hi(k + VAR_CODE); X for (k = 'A'; k <= 'Z'; incr(k)) { X cat_code(k) = cat_code(k + 'a' - 'A') = LETTER; X math_code(k) = hi(k + VAR_CODE + 0x100); X math_code(k + 'a' - 'A') = hi(k + 'a' - 'A'+ VAR_CODE + 0x100); X lc_code(k) = lc_code(k + 'a' - 'A') = k + 'a' - 'A'; X uc_code(k) = uc_code(k + 'a' - 'A') = k; X sf_code(k) = 999; X } X for (k = INT_BASE; k < DEL_CODE_BASE; incr(k)) X eqtb[k].i = 0; X mag = 1000; X tolerance = 10000; X hang_after = 1; X max_dead_cycles = 25; X escape_char = '\\'; X end_line_char = CARRIAGE_RETURN; X for (k = 0; k <= 127; incr(k)) X del_code(k) = -1; X del_code('.') = 0; X for (k = DIMEN_BASE; k <= EQTB_SIZE; incr(k)) X eqtb[k].sc = 0; X#endif X} SHAR_EOF echo "File eq.c is complete" chmod 0444 eq.c || echo "restore of eq.c fails" set `wc -c eq.c`;Sum=$1 if test "$Sum" != "12034" then echo original size 12034, current size $Sum;fi echo "x - extracting eq.h (Text)" sed 's/^X//' << 'SHAR_EOF' > eq.h && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * eq.h X */ X X#define eq_level_field(EQ) EQ.hh.hh2.b1 X#define eq_type_field(EQ) EQ.hh.hh2.b0 X#define equiv_field(EQ) EQ.hh.hh2.rh X#define eq_level(EQ) eq_level_field(eqtb[EQ]) X#define eq_type(EQ) eq_type_field(eqtb[EQ]) X#define equiv(EQ) equiv_field(eqtb[EQ]) X X#define LEVEL_ZERO MIN_QUARTERWORD X#define LEVEL_ONE (LEVEL_ZERO + 1) X X#define ACTIVE_BASE 1 X#define SINGLE_BASE (ACTIVE_BASE + 128) X#define NULL_CS (SINGLE_BASE + 128) X#define HASH_BASE (NULL_CS + 1) X#define FROZEN_CONTROL_SEQUENCE (HASH_BASE + HASH_SIZE) X#define FROZEN_PROTECTION (FROZEN_CONTROL_SEQUENCE) X#define FROZEN_CR (FROZEN_CONTROL_SEQUENCE + 1) X#define FROZEN_END_GROUP (FROZEN_CONTROL_SEQUENCE + 2) X#define FROZEN_RIGHT (FROZEN_CONTROL_SEQUENCE + 3) X#define FROZEN_FI (FROZEN_CONTROL_SEQUENCE + 4) X#define FROZEN_END_TEMPLATE (FROZEN_CONTROL_SEQUENCE + 5) X#define FROZEN_ENDV (FROZEN_CONTROL_SEQUENCE + 6) X#define FROZEN_RELAX (FROZEN_CONTROL_SEQUENCE + 7) X#define END_WRITE (FROZEN_CONTROL_SEQUENCE + 8) X#define FROZEN_DONT_EXPAND (FROZEN_CONTROL_SEQUENCE + 9) X#define FROZEN_NULL_FONT (FROZEN_CONTROL_SEQUENCE + 10) X#define FONT_ID_BASE (FROZEN_NULL_FONT - FONT_BASE) X X#define UNDEFINED_CONTROL_SEQUENCE (FROZEN_NULL_FONT + 257) X X#define GLUE_BASE (UNDEFINED_CONTROL_SEQUENCE + 1) X#define GLUE_PARS 18 X#define glue_par(G) equiv(GLUE_BASE + G) X X#define LINE_SKIP_CODE 0 X#define BASELINE_SKIP_CODE 1 X#define PAR_SKIP_CODE 2 X#define ABOVE_DISPLAY_SKIP_CODE 3 X#define BELOW_DISPLAY_SKIP_CODE 4 X#define ABOVE_DISPLAY_SHORT_SKIP_CODE 5 X#define BELOW_DISPLAY_SHORT_SKIP_CODE 6 X#define LEFT_SKIP_CODE 7 X#define RIGHT_SKIP_CODE 8 X#define TOP_SKIP_CODE 9 X#define SPLIT_TOP_SKIP_CODE 10 X#define TAB_SKIP_CODE 11 X#define SPACE_SKIP_CODE 12 X#define XSPACE_SKIP_CODE 13 X#define PAR_FILL_SKIP_CODE 14 X#define THIN_MU_SKIP_CODE 15 X#define MED_MU_SKIP_CODE 16 X#define THICK_MU_SKIP_CODE 17 X X#define line_skip glue_par(LINE_SKIP_CODE) X#define baseline_skip glue_par(BASELINE_SKIP_CODE) X#define par_skip glue_par(PAR_SKIP_CODE) X#define above_display_skip glue_par(ABOVE_DISPLAY_SKIP_CODE) X#define below_display_skip glue_par(BELOW_DISPLAY_SKIP_CODE) X#define above_display_short_skip glue_par(ABOVE_DISPLAY_SHORT_SKIP_CODE) X#define below_display_short_skip glue_par(BELOW_DISPLAY_SHORT_SKIP_CODE) X#define left_skip glue_par(LEFT_SKIP_CODE) X#define right_skip glue_par(RIGHT_SKIP_CODE) X#define top_skip glue_par(TOP_SKIP_CODE) X#define split_top_skip glue_par(SPLIT_TOP_SKIP_CODE) X#define tab_skip glue_par(TAB_SKIP_CODE) X#define space_skip glue_par(SPACE_SKIP_CODE) X#define xspace_skip glue_par(XSPACE_SKIP_CODE) X#define par_fill_skip glue_par(PAR_FILL_SKIP_CODE) X#define thin_mu_skip glue_par(THIN_MU_SKIP_CODE) X#define med_mu_skip glue_par(MED_MU_SKIP_CODE) X#define thick_mu_skip glue_par(THICK_MU_USKIP_CODE) X X#define SKIP_BASE (GLUE_BASE + GLUE_PARS) X#define skip(S) equiv(SKIP_BASE + S) X X#define MU_SKIP_BASE (SKIP_BASE + 256) X#define mu_skip(M) equiv(MU_SKIP_BASE + M) X X#define LOCAL_BASE (MU_SKIP_BASE + 256) X X#define PAR_SHAPE_LOC LOCAL_BASE X#define OUTPUT_ROUTINE_LOC (LOCAL_BASE + 1) X#define EVERY_PAR_LOC (LOCAL_BASE + 2) X#define EVERY_MATH_LOC (LOCAL_BASE + 3) X#define EVERY_DISPLAY_LOC (LOCAL_BASE + 4) X#define EVERY_HBOX_LOC (LOCAL_BASE + 5) X#define EVERY_VBOX_LOC (LOCAL_BASE + 6) X#define EVERY_JOB_LOC (LOCAL_BASE + 7) X#define EVERY_CR_LOC (LOCAL_BASE + 8) X#define ERR_HELP_LOC (LOCAL_BASE + 9) X X#define TOKS_BASE (LOCAL_BASE + 10) X#define BOX_BASE (TOKS_BASE + 256) X#define CUR_FONT_LOC (BOX_BASE + 256) X#define MATH_FONT_BASE (CUR_FONT_LOC + 1) X#define CAT_CODE_BASE (MATH_FONT_BASE + 48) X#define LC_CODE_BASE (CAT_CODE_BASE + 128) X#define UC_CODE_BASE (LC_CODE_BASE + 128) X#define SF_CODE_BASE (UC_CODE_BASE + 128) X#define MATH_CODE_BASE (SF_CODE_BASE + 128) X X#define par_shape_ptr equiv(PAR_SHAPE_LOC) X#define output_routine equiv(OUTPUT_ROUTINE_LOC) X#define every_par equiv(EVERY_PAR_LOC) X#define every_math equiv(EVERY_MATH_LOC) X#define every_display equiv(EVERY_DISPLAY_LOC) X#define every_hbox equiv(EVERY_HBOX_LOC) X#define every_vbox equiv(EVERY_VBOX_LOC) X#define every_job equiv(EVERY_JOB_LOC) X#define every_cr equiv(EVERY_CR_LOC) X#define err_help equiv(ERR_HELP_LOC) X#define toks(M) equiv(TOKS_BASE + M) X#define box(M) equiv(BOX_BASE + M) X#define cur_font equiv(CUR_FONT_LOC) X#define fam_fnt(M) equiv(MATH_FONT_BASE + M) X#define cat_code(M) equiv(CAT_CODE_BASE + M) X#define lc_code(M) equiv(LC_CODE_BASE + M) X#define uc_code(M) equiv(UC_CODE_BASE + M) X#define sf_code(M) equiv(SF_CODE_BASE + M) X#define math_code(M) equiv(MATH_CODE_BASE + M) X X#define NULL_FONT FONT_BASE X#define VAR_CODE 070000 X X#define INT_BASE (MATH_CODE_BASE + 128) X#define INT_PARS 50 X#define int_par(I) eqtb[INT_BASE + I].i X X#define PRETOLERANCE_CODE 0 X#define TOLERANCE_CODE 1 X#define LINE_PENALTY_CODE 2 X#define HYPHEN_PENALTY_CODE 3 X#define CLUB_PENALTY_CODE 4 X#define EX_HYPHEN_PENALTY_CODE 5 X#define WIDOW_PENALTY_CODE 6 X#define DISPLAY_WIDOW_PENALTY_CODE 7 X#define BROKEN_PENALTY_CODE 8 X#define BIN_OP_PENALTY_CODE 9 X#define REL_PENALTY_CODE 10 X#define PRE_DISPLAY_PENALTY_CODE 11 X#define POST_DISPLAY_PENALTY_CODE 12 X#define INTER_LINE_PENALTY_CODE 13 X#define DOUBLE_HYPHEN_DEMERITS_CODE 14 X#define FINAL_HYPHEN_DEMERITS_CODE 15 X#define ADJ_DEMERITS_CODE 16 X#define MAG_CODE 17 X#define DELIMITER_FACTOR_CODE 18 X#define LOOSENESS_CODE 19 X#define TIME_CODE 20 X#define DAY_CODE 21 X#define MONTH_CODE 22 X#define YEAR_CODE 23 X#define SHOW_BOX_BREADTH_CODE 24 X#define SHOW_BOX_DEPTH_CODE 25 X#define HBADNESS_CODE 26 X#define VBADNESS_CODE 27 X#define PAUSING_CODE 28 X#define TRACING_ONLINE_CODE 29 X#define TRACING_MACROS_CODE 30 X#define TRACING_STATS_CODE 31 X#define TRACING_PARAGRAPHS_CODE 32 X#define TRACING_PAGES_CODE 33 X#define TRACING_OUTPUT_CODE 34 X#define TRACING_LOST_CHARS_CODE 35 X#define TRACING_COMMANDS_CODE 36 X#define TRACING_RESTORES_CODE 37 X#define UC_HYPH_CODE 38 X#define OUTPUT_PENALTY_CODE 39 X#define MAX_DEAD_CYCLES_CODE 40 X#define HANG_AFTER_CODE 41 X#define FLOATING_PENALTY_CODE 42 X#define GLOBAL_DEFS_CODE 43 X#define CUR_FAM_CODE 44 X#define ESCAPE_CHAR_CODE 45 X#define DEFAULT_HYPHEN_CHAR_CODE 46 X#define DEFAULT_SKEW_CHAR_CODE 47 X#define END_LINE_CHAR_CODE 48 X#define NEW_LINE_CHAR_CODE 49 X X#define pretolerance int_par(PRETOLERANCE_CODE) X#define tolerance int_par(TOLERANCE_CODE) X#define line_penalty int_par(LINE_PENALTY_CODE) X#define hyphen_penalty int_par(HYPHEN_PENALTY_CODE) X#define ex_hyphen_penalty int_par(EX_HYPHEN_PENALTY_CODE) X#define club_penalty int_par(CLUB_PENALTY_CODE) X#define widow_penalty int_par(WIDOW_PENALTY_CODE) X#define display_widow_penalty int_par(DISPLAY_WIDOW_PENALTY_CODE) X#define broken_penalty int_par(BROKEN_PENALTY_CODE) X#define bin_op_penalty int_par(BIN_OP_PENALTY_CODE) X#define rel_penalty int_par(REL_PENALTY_CODE) X#define pre_display_penalty int_par(PRE_DISPLAY_PENALTY_CODE) X#define post_display_penalty int_par(POST_DISPLAY_PENALTY_CODE) X#define inter_line_penalty int_par(INTER_LINE_PENALTY_CODE) X#define double_hyphen_demerits int_par(DOUBLE_HYPHEN_DEMERITS_CODE) X#define final_hyphen_demerits int_par(FINAL_HYPHEN_DEMERITS_CODE) X#define adj_demerits int_par(ADJ_DEMERITS_CODE) X#define mag int_par(MAG_CODE) X#define delimiter_factor int_par(DELIMITER_FACTOR_CODE) X#define looseness int_par(LOOSENESS_CODE) X#define time int_par(TIME_CODE) X#define day int_par(DAY_CODE) X#define month int_par(MONTH_CODE) X#define year int_par(YEAR_CODE) X#define show_box_breadth int_par(SHOW_BOX_BREADTH_CODE) X#define show_box_depth int_par(SHOW_BOX_DEPTH_CODE) X#define hbadness int_par(HBADNESS_CODE) X#define vbadness int_par(VBADNESS_CODE) X#define pausing int_par(PAUSING_CODE) X#define tracing_online int_par(TRACING_ONLINE_CODE) X#define tracing_macros int_par(TRACING_MACROS_CODE) X#define tracing_stats int_par(TRACING_STATS_CODE) X#define tracing_paragraphs int_par(TRACING_PARAGRAPHS_CODE) X#define tracing_pages int_par(TRACING_PAGES_CODE) X#define tracing_output int_par(TRACING_OUTPUT_CODE) X#define tracing_lost_chars int_par(TRACING_LOST_CHARS_CODE) X#define tracing_commands int_par(TRACING_COMMANDS_CODE) X#define tracing_restores int_par(TRACING_RESTORES_CODE) X#define uc_hyph int_par(UC_HYPH_CODE) X#define max_dead_cycles int_par(MAX_DEAD_CYCLES_CODE) X#define output_penalty int_par(OUTPUT_PENALTY_CODE) X#define hang_after int_par(HANG_AFTER_CODE) X#define floating_penalty int_par(FLOATING_PENALTY_CODE) X#define global_defs int_par(GLOBAL_DEFS_CODE) X#define cur_fam int_par(CUR_FAM_CODE) X#define escape_char int_par(ESCAPE_CHAR_CODE) X#define default_hyphen_char int_par(DEFAULT_HYPHEN_CHAR_CODE) X#define default_skew_char int_par(DEFAULT_SKEW_CHAR_CODE) X#define end_line_char int_par(END_LINE_CHAR_CODE) X#define new_line_char int_par(NEW_LINE_CHAR_CODE) X X#define COUNT_BASE (INT_BASE + INT_PARS) X#define count(C) eqtb[COUNT_BASE + C].i X X#define DEL_CODE_BASE (COUNT_BASE + 256) X#define del_code(D) eqtb[DEL_CODE_BASE + D].i X X#define DIMEN_BASE (DEL_CODE_BASE + 128) X#define DIMEN_PARS 20 X#define dimen_par(D) eqtb[DIMEN_BASE + D].sc X X#define PAR_INDENT_CODE 0 X#define MATH_SURROUND_CODE 1 X#define LINE_SKIP_LIMIT_CODE 2 X#define HSIZE_CODE 3 X#define VSIZE_CODE 4 X#define MAX_DEPTH_CODE 5 X#define SPLIT_MAX_DEPTH_CODE 6 X#define BOX_MAX_DEPTH_CODE 7 X#define HFUZZ_CODE 8 X#define VFUZZ_CODE 9 X#define DELIMITER_SHORTFALL_CODE 10 X#define NULL_DELIMITER_SPACE_CODE 11 X#define SCRIPT_SPACE_CODE 12 X#define PRE_DISPLAY_SIZE_CODE 13 X#define DISPLAY_WIDTH_CODE 14 X#define DISPLAY_INDENT_CODE 15 X#define OVERFULL_RULE_CODE 16 X#define HANG_INDENT_CODE 17 X#define H_OFFSET_CODE 18 X#define V_OFFSET_CODE 19 X X#define par_indent dimen_par(PAR_INDENT_CODE) X#define math_surround dimen_par(MATH_SURROUND_CODE) X#define line_skip_limit dimen_par(LINE_SKIP_LIMIT_CODE) X#define hsize dimen_par(HSIZE_CODE) X#define vsize dimen_par(VSIZE_CODE) X#define max_depth dimen_par(MAX_DEPTH_CODE) X#define split_max_depth dimen_par(SPLIT_MAX_DEPTH_CODE) X#define box_max_depth dimen_par(BOX_MAX_DEPTH_CODE) X#define hfuzz dimen_par(HFUZZ_CODE) X#define vfuzz dimen_par(VFUZZ_CODE) X#define delimiter_shortfall dimen_par(DELIMITER_SHORTFALL_CODE) X#define null_delimiter_space dimen_par(NULL_DELIMITER_SPACE_CODE) X#define script_space dimen_par(SCRIPT_SPACE_CODE) X#define pre_display_size dimen_par(PRE_DISPLAY_SIZE_CODE) X#define display_width dimen_par(DISPLAY_WIDTH_CODE) X#define display_indent dimen_par(DISPLAY_INDENT_CODE) X#define overfull_rule dimen_par(OVERFULL_RULE_CODE) X#define hang_indent dimen_par(HANG_INDENT_CODE) X#define h_offset dimen_par(H_OFFSET_CODE) X#define v_offset dimen_par(V_OFFSET_CODE) X X#define SCALED_BASE (DIMEN_BASE + DIMEN_PARS) X#define dimen(D) eqtb[SCALED_BASE + D].sc X X#define EQTB_SIZE (SCALED_BASE + 255) X Xglobal mword eqtb[]; Xglobal qword xeq_level[]; X Xint print_param(); Xint print_length_param(); Xint print_skip_param(); Xint show_eqtb(); Xint init_eq(); SHAR_EOF chmod 0444 eq.h || echo "restore of eq.h fails" set `wc -c eq.h`;Sum=$1 if test "$Sum" != "11599" then echo original size 11599, current size $Sum;fi echo "x - extracting eqstack.c (Text)" sed 's/^X//' << 'SHAR_EOF' > eqstack.c && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * eqstack.c X */ X X#include "tex.h" X#include "cmds.h" X#include "heap.h" X#include "eq.h" X#include "token.h" X#include "tokenstack.h" X#include "tokenlists.h" X#include "print.h" X#include "error.h" X#include "eqstack.h" X Xptr save_ptr = 0; Xmword save_stack[SAVE_SIZE]; Xptr max_save_stack = 0; Xqword cur_level = LEVEL_ONE; Xgroup cur_group = BOTTOM_LEVEL; Xptr cur_boundary = 0; X X#define check_full_save_stack() \ X {if (save_ptr > max_save_stack) { \ X max_save_stack = save_ptr; \ X if (max_save_stack > SAVE_SIZE - 6) \ X overflow("save size", SAVE_SIZE);}} X Xnew_save_level (c) X group c; X{ X check_full_save_stack(); X save_type(save_ptr) = LEVEL_BOUNDARY; X save_level(save_ptr) = cur_group; X save_index(save_ptr) = cur_boundary; X if (cur_level == MAX_QUARTERWORD) X overflow("grouping levels", MAX_QUARTERWORD - MIN_QUARTERWORD); X cur_boundary = save_ptr; X cur_group = c; X incr(cur_level); X incr(save_ptr); X} X Xeq_destroy (w) X mword w; X{ X ptr q; X X switch (eq_type_field(w)) X { X case CALL: X case LONG_CALL: X case LONG_OUTER_CALL: X delete_token_ref(equiv_field(w)); X break; X X case GLUE_REF: X delete_glue_ref(equiv_field(w)); X break; X X case SHAPE_REF: X q = equiv_field(w); X if (q != NULL) X free_node(q, link(q) + link(q) + 1); X break; X X case BOX_REF: X flush_node_list(equiv_field(w)); X break; X } X} X Xeq_save (p, l) X ptr p; X qword l; X{ X check_full_save_stack(); X if (l == LEVEL_ZERO) X save_type(save_ptr) = RESTORE_ZERO; X else { X save_stack[save_ptr] = eqtb[p]; X incr(save_ptr); X save_type(save_ptr)= RESTORE_OLD_VALUE; X } X save_index(save_ptr) = p; X save_level(save_ptr) = l; X incr(save_ptr); X} X Xeq_define (p, t, e) X ptr p; X qword t; X hword e; X{ X if (eq_level(p) == cur_level) X eq_destroy(eqtb[p]); X else if (cur_level > LEVEL_ONE) X eq_save(p, eq_level(p)); X eq_level(p) = cur_level; X eq_type(p) = t; X equiv(p) = e; X} X Xeq_word_define (p, w) X ptr p; X val w; X{ X if (xeq_level[p - INT_BASE] != cur_level) { X eq_save(p, xeq_level[p - INT_BASE]); X xeq_level[p - INT_BASE] = cur_level; X } X eqtb[p].i = w; X} X Xgeq_define (p, t, e) X ptr p; X qword t; X hword e; X{ X eq_destroy(eqtb[p]); X eq_level(p) = LEVEL_ONE; X eq_type(p) = t; X equiv(p) = e; X} X Xgeq_word_define (p, w) X ptr p; X val w; X{ X eqtb[p].i = w; X xeq_level[p - INT_BASE] = LEVEL_ONE; X} X Xsave_for_after (t) X hword t; X{ X check_full_save_stack(); X save_type(save_ptr) = INSERT_TOKEN; X save_level(save_ptr) = LEVEL_ZERO; X save_index(save_ptr) = t; X incr(save_ptr); X} X Xunsave () X{ X qword l; X ptr p; X hword t; X X if (cur_level > LEVEL_ONE) { X decr(cur_level); X loop { X decr(save_ptr); X if (save_type(save_ptr) == LEVEL_BOUNDARY) X break; X p = save_index(save_ptr); X if (save_type(save_ptr) == INSERT_TOKEN) { X t = cur_tok; X cur_tok = p; X back_input(); X cur_tok = t; X } else { X if (save_type(save_ptr) == RESTORE_OLD_VALUE) { X l = save_level(save_ptr); X decr(save_ptr); X } else X save_stack[save_ptr] = eqtb[UNDEFINED_CONTROL_SEQUENCE]; X#ifdef STAT X if (p < INT_BASE) { X if (eq_level(p) == LEVEL_ONE) { X eq_destroy(save_stack[save_ptr]); X if (tracing_restores > 0) X restore_trace(p, "retaining"); X } else { X eq_destroy(eqtb[p]); X eqtb[p] = save_stack[save_ptr]; X if (tracing_restores > 0) X restore_trace(p, "restoring"); X } X } else if (xeq_level[p - INT_BASE] != LEVEL_ONE) { X eqtb[p] = save_stack[save_ptr]; X xeq_level[p - INT_BASE] = l; X if (tracing_restores > 0) X restore_trace(p, "restoring"); X } else { X if (tracing_restores > 0) X restore_trace(p, "retaining"); X } X#else X if (p < INT_BASE) { X if (eq_level(p) == LEVEL_ONE) X eq_destroy(save_stack[save_ptr]); X else { X eq_destroy(eqtb[p]); X eqtb[p] = save_stack[save_ptr]; X } X } else if (xeq_level[p - INT_BASE] != LEVEL_ONE) { X eqtb[p] = save_stack[save_ptr]; X xeq_level[p - INT_BASE] = l; X } X#endif X } X } X cur_group = save_level(save_ptr); X cur_boundary = save_index(save_ptr); X } else X confusion("curlevel"); X} X Xoff_save () X{ X ptr p; X X if (cur_group == BOTTOM_LEVEL) { X print_err("Extra "); X print_cmd_chr(cur_cmd, cur_chr); X help_offsave_xtra(); X error(); X } else { X back_input(); X p = new_token(); X token_link(temp_toks) = p; X print_err("Missing "); X switch (cur_group) X { X case SEMI_SIMPLE_GROUP: X token(p) = CS_TOKEN_FLAG + FROZEN_END_GROUP; X print_esc("groupend"); X break; X X case MATH_SHIFT_GROUP: X token(p) = MATH_SHIFT_TOKEN + '$'; X print_char('$'); X break; X X case MATH_LEFT_GROUP: X token(p) = CS_TOKEN_FLAG + FROZEN_RIGHT; X token_link(p) = new_token(); X p = token_link(p); X token(p) = OTHER_TOKEN + '.'; X print_esc("right."); X break; X X default: X token(p) = RIGHT_BRACE_TOKEN + '}'; X print_char('}'); X break; X } X print(" inserted"); X ins_list(token_link(temp_toks)); X help_offsave_missing(); X error(); X } X} X X#ifdef STAT Xrestore_trace (p, s) X ptr p; X char* s; X{ X begin_diagnostic(); X print_char('{'); X print(s); X print_char(' '); X show_eqtb(p); X print_char('}'); X end_diagnostic(FALSE); X} X#endif X X/* X * Help text X */ X Xhelp_offsave_xtra () X{ X help1("Things are pretty mixed up, but I think the worst is over."); X} X Xhelp_offsave_missing () X{ X help5("I've inserted something that you may have forgotten.", X "(see the <inserted text> above.)", X "With luck, this will get me unwedged. But if you", X "really didn't forget anything, try typing `2' now; then", X "my insertion and my current dilemma will both disappear."); X} SHAR_EOF chmod 0444 eqstack.c || echo "restore of eqstack.c fails" set `wc -c eqstack.c`;Sum=$1 if test "$Sum" != "5694" then echo original size 5694, current size $Sum;fi echo "x - extracting eqstack.h (Text)" sed 's/^X//' << 'SHAR_EOF' > eqstack.h && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * eqstack.h X */ X Xglobal ptr save_ptr; Xglobal mword save_stack[]; Xglobal ptr max_save_stack; X Xglobal qword cur_level; Xglobal group cur_group; Xglobal ptr cur_boundary; X X#define save_type(S) save_stack[S].hh.hh2.b0 X#define save_level(S) save_stack[S].hh.hh2.b1 X#define save_index(S) save_stack[S].hh.hh2.rh X X#define RESTORE_OLD_VALUE 0 X#define RESTORE_ZERO 1 X#define INSERT_TOKEN 2 X#define LEVEL_BOUNDARY 3 X X#define BOTTOM_LEVEL 0 X#define SIMPLE_GROUP 1 X#define HBOX_GROUP 2 X#define ADJUSTED_HBOX_GROUP 3 X#define VBOX_GROUP 4 X#define VTOP_GROUP 5 X#define ALIGN_GROUP 6 X#define NO_ALIGN_GROUP 7 X#define OUTPUT_GROUP 8 X#define MATH_GROUP 9 X#define DISC_GROUP 10 X#define INSERT_GROUP 11 X#define VCENTER_GROUP 12 X#define MATH_CHOICE_GROUP 13 X#define SEMI_SIMPLE_GROUP 14 X#define MATH_SHIFT_GROUP 15 X#define MATH_LEFT_GROUP 16 X#define MAX_GROUP_CODE 16 X X#define saved(I) save_stack[save_ptr + I].i X Xint new_save_level(); Xint eq_destroy(); Xint eq_save(); Xint eq_define(); Xint eq_word_define(); Xint geq_define(); Xint geq_word_define(); Xint unsave(); Xint offsave(); X X#ifdef STAT Xint restore_trace(); X#endif SHAR_EOF chmod 0444 eqstack.h || echo "restore of eqstack.h fails" set `wc -c eqstack.h`;Sum=$1 if test "$Sum" != "1378" then echo original size 1378, current size $Sum;fi echo "x - extracting error.c (Text)" sed 's/^X//' << 'SHAR_EOF' > error.c && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * error.c X */ X X#include "tex.h" X#include "str.h" X#include "tokenstack.h" X#include "token.h" X#include "eq.h" X#include "io.h" X#include "file.h" X#include "print.h" X#include "error.h" X Xint OK_to_interrupt = TRUE; Xbool deletions_allowed = TRUE; Xint error_count; Xchar* help_line[6]; Xint help_ptr; Xint history; Xint interaction = ERROR_STOP_MODE; Xint interrupt; Xint old_setting; Xbool use_err_help = FALSE; X Xjump_out () X{ X close_files_and_terminate(FALSE); X} X Xbegin_diagnostic () X{ X old_setting = selector; X if (tracing_online <= 0 && selector == TERM_AND_LOG) { X decr(selector); X if (history == SPOTLESS) X history = WARNING_ISSUED; X } X} X Xend_diagnostic (blank_line) X bool blank_line; X{ X print_nl(""); X if (blank_line) print_ln(); X selector = old_setting; X} X Xprint_err (msg) X char* msg; X{ X if (interaction == ERROR_STOP_MODE) X wake_up_terminal(); X print_nl("! "); X print(msg); X} X Xerror () X{ X ascii c; X int hx; X hword s1; X hword s2; X hword s3; X val s4; X X if (history < ERROR_MESSAGE_ISSUED) X history = ERROR_MESSAGE_ISSUED; X print_char('.'); X show_context(); X if (interaction == ERROR_STOP_MODE) { X loop { X clear_for_error_prompt(); X prompt_input("? "); X if (last == first) X return; X c = buffer[first]; X if (c >= 'a') X c -= 'a' - 'A'; X switch (c) X { X case '1': case '2': case '3': X case '4': case '5': case '6': X case '7': case '8': case '9': X s1 = cur_tok; X s2 = cur_cmd; X s3 = cur_chr; X s4 = align_state; X align_state = 1000000; X OK_to_interrupt = FALSE; X if (last > first + 1 && X buffer[first + 1] >= '0' && X buffer[first + 1] <= '9') X c = c * 10 + buffer[first + 1] - '0' * 11; X else c -= '0'; X while (c > 0) { X get_token(); X decr(c); X } X cur_tok = s1; X cur_cmd = s2; X cur_chr = s3; X align_state = s4; X OK_to_interrupt = TRUE; X help_delete_text(); X show_context(); X continue; X X case 'H': X if (use_err_help) { X give_err_help(); X use_err_help = FALSE; X } else { X if (help_ptr == 0) X help_no_help(); X else for (hx = 0; hx < help_ptr; incr(hx)) { X print(help_line[hx]); X print_ln(); X } X help_help(); X } X continue; X X case 'I': X begin_file_reading(); X if (last > first + 1) { X loc = first + 1; X buffer[first] = ' '; X } else { X prompt_input("insert>"); X loc = first; X } X first = last; X limit = last - 1; X return; X X case 'Q': X case 'R': X case 'S': X error_count = 0; X interaction = BATCH_MODE + c - 'Q'; X print("OK, entering "); X switch (c) X { X case 'Q': X print_esc("batchmode"); X decr(selector); X break; X X case 'R': X print_esc("nonstopmode"); X break; X X case 'S': X print_esc("scrollmode"); X break; X } X print("..."); X print_ln(); X update_terminal(); X return; X X case 'E': X if (base_ptr > 0) X close_files_and_terminate(TRUE); X break; X X case 'X': X interaction = SCROLL_MODE; X jump_out(); X break; X X default: X print_menu(); X break; X } X } X } X X incr(error_count); X if (error_count == 100) { X print_nl("(That makes 100 errors; please try again.)"); X history = FATAL_ERROR_STOP; X jump_out(); X } X if (interaction > BATCH_MODE) X decr(selector); X if (use_err_help) { X print_ln(); X give_err_help(); X } else for (hx = 0; hx < help_ptr; incr(hx)) X print_nl(help_line[hx]); X help_ptr = 0; X print_ln(); X if (interaction > BATCH_MODE) X incr(selector); X print_ln(); X} X Xprint_menu () X{ X print("Type <return> to proceed, S to scroll future error messages,"); X print_nl("R to run without stopping, Q to run quietly,"); X print_nl("I to insert something, "); X if (base_ptr > 0) X print("E to edit your file,"); X if (deletions_allowed) X print_nl("1 or ... or 9 to ignore the next 1 to 9 tokens of input"); X} X Xint_error (v) X val v; X{ X print(" ("); X print_val(v); X print_char(')'); X error(); X} X Xnormalize_selector () X{ X if (job_name > 0) X selector = TERM_AND_LOG; X else X selector = TERM_ONLY; X if (job_name == 0) X open_log_file(); X if (interaction == BATCH_MODE) X decr(selector); X} X Xfatal_error (s) X char* s; X{ X normalize_selector(); X print_err("Emergency stop"); X help1(s); X succumb(); X} X Xoverflow (s, n) X char* s; X int n; X{ X normalize_selector(); X print_err("TeX capacity exceeded, sorry ["); X print(s); X print_char('='); X print_int(n); X print_char(']'); X help_capacity(); X succumb(); X} X Xconfusion (s) X char* s; X{ X normalize_selector(); X if (history < ERROR_MESSAGE_ISSUED) { X print_err("This can't happen ("); X print(s); X print_char(')'); X help_broken(); X } else { X print_err("I can't go on meeting you like this"); X help_wounded(); X } X succumb(); X} X Xpause_for_instructions () X{ X if (OK_to_interrupt) { X interaction = ERROR_STOP_MODE; X if (selector == LOG_ONLY || selector == NO_PRINT) X incr(selector); X print_err("Interruption"); X help_interrupt(); X deletions_allowed = FALSE; X error(); X deletions_allowed = TRUE; X interrupt = 0; X } X} X X/* X * Help text X */ X Xhelp_delete_text () X{ X help2("I have just deleted some text, as you asked.", X "You can now delete more, or insert, or whatever."); X} X Xhelp_no_help () X{ X help2("Sorry, I don't know how to help in this situation.", X "Maybe you should try asking a human?"); X} X Xhelp_help () X{ X help4("Sorry, I already gave what help I could...", X "Maybe you should try asking a human?", X "An error might have occurred before I noticed any problems.", X "``If all else fails, read the instructions.''"); X} X Xhelp_capacity () X{ X help2("If you really absolutely need more capacity,", X "you can ask a wizard to enlarge me."); X} X Xhelp_broken () X{ X help1("I'm broken. Please show this to someone who can fix can fix"); X} X Xhelp_wounded () X{ X help2("One of your faux pas seems to have wounded me deeply...", X "in fact, I'm barely conscious. Please fix it and try again."); X} X Xhelp_interrupt () X{ X help3("You rang?", X "Try to insert some instructions for me (e.g., `I\\showlists),", X "unless you just want to quit by typing `X'."); X} SHAR_EOF chmod 0444 error.c || echo "restore of error.c fails" set `wc -c error.c`;Sum=$1 if test "$Sum" != "6218" then echo original size 6218, current size $Sum;fi echo "x - extracting error.h (Text)" sed 's/^X//' << 'SHAR_EOF' > error.h && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * error.h X */ X X#define BATCH_MODE 0 X#define NONSTOP_MODE 1 X#define SCROLL_MODE 2 X#define ERROR_STOP_MODE 3 X X#define wake_up_terminal() X Xglobal int old_setting; X Xint begin_diagnostic(); Xint end_diagnostic(); X Xint print_err(); X Xglobal int interaction; Xglobal bool deletions_allowed; Xglobal int history; Xglobal int error_count; X X#ifndef NOHELP X#define help0() \ X {help_ptr = 0;} X X#define help1(h0) \ X {help_ptr = 1; help_line[0] = h0;} X X#define help2(h0, h1) \ X {help_ptr = 2; \ X help_line[0] = h0; help_line[1] = h1;} X X#define help3(h0, h1, h2) \ X {help_ptr = 3; help_line[0] = h0; \ X help_line[1] = h1; help_line[2] = h2;} X X#define help4(h0, h1, h2, h3) \ X {help_ptr = 4; \ X help_line[0] = h0; help_line[1] = h1; \ X help_line[2] = h2; help_line[3] = h3;} X X#define help5(h0, h1, h2, h3, h4) \ X {help_ptr = 5; help_line[0] = h0; \ X help_line[1] = h1; help_line[2] = h2; \ X help_line[3] = h3; help_line[4] = h4;} X X#define help6(h0, h1, h2, h3, h4, h5) \ X {help_ptr = 6; \ X help_line[0] = h0; help_line[1] = h1; \ X help_line[2] = h2; help_line[3] = h3; \ X help_line[4] = h4; help_line[5] = h5;} X#else X#define help0() X#define help1(h0) X#define help2(h0, h1) X#define help3(h0, h1, h2) X#define help4(h0, h1, h2, h3) X#define help5(h0, h1, h2, h3, h4) X#define help6(h0, h1, h2, h3, h4, h5) X#endif X Xglobal char* help_line[]; Xglobal int help_ptr; Xglobal bool use_err_help; X Xint jump_out(); Xint error(); Xint int_error(); Xint normalize_selector(); X X#define succumb() \ X {if (interaction == ERROR_STOP_MODE) \ X interaction = SCROLL_MODE; \ X error(); history = FATAL_ERROR_STOP; jump_out();} X X#define SPOTLESS 0 X#define WARNING_ISSUED 1 X#define ERROR_MESSAGE_ISSUED 2 X#define FATAL_ERROR_STOP 3 X Xint fatal_error(); Xint overflow(); Xint confusion(); X Xglobal int interrupt; Xglobal bool OK_to_interrupt; X X#define check_interrupt() \ X {if (interrupt != 0) pause_for_instructions();} X Xint pause_for_instructions(); SHAR_EOF chmod 0444 error.h || echo "restore of error.h fails" set `wc -c error.h`;Sum=$1 if test "$Sum" != "2139" then echo original size 2139, current size $Sum;fi echo "x - extracting eval.c (Text)" sed 's/^X//' << 'SHAR_EOF' > eval.c && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * eval.c X */ X X#include "tex.h" X#include "cmds.h" X#include "heap.h" X#include "arith.h" X#include "char.h" X#include "tfm.h" X#include "eq.h" X#include "eqstack.h" X#include "hash.h" X#include "token.h" X#include "scan.h" X#include "tokenstack.h" X#include "evalstack.h" X#include "box.h" X#include "boxlists.h" X#include "math.h" X#include "mathlists.h" X#include "cond.h" X#include "def.h" X#include "dvi.h" X#include "pack.h" X#include "page.h" X#include "par.h" X#include "print.h" X#include "error.h" X#include "eval.h" X X#define vmode(CMD) \ X case VMODE + CMD X X#define hmode(CMD) \ X case HMODE + CMD X X#define non_math(M) \ X case VMODE + M: \ X case HMODE + M X X#define mmode(CMD) \ X case MMODE + CMD X X#define any_mode(CMD) \ X case VMODE + CMD: \ X case HMODE + CMD: \ X case MMODE + CMD X Xmain_control () X{ X byte c; X fnt f; X fourq i; X fourq j; X int k; X qword l; X ptr p; X ptr q; X hword r; X int s; X int t; X bool ligature_present; X X X if (every_job != NULL) X begin_token_list(every_job, EVERY_JOB_TEXT); X Xbig_switch: X get_x_token(); X Xreswitch: X if (interrupt) { X if (OK_to_interrupt) { X back_input(); X pause_for_instructions(); X goto big_switch; X } X } X X if (tracing_commands > 0) X show_cur_cmd_chr(); X X switch (abs(mode) + cur_cmd) X { X hmode(LETTER): X hmode(OTHER_CHAR): X hmode(CHAR_GIVEN): X goto main_loop; X X hmode(CHAR_NUM): X scan_char_num(); X cur_chr = cur_val; X goto main_loop; X X hmode(SPACER): X if (space_factor == 1000) X goto append_normal_space; X else app_space(); X break; X X hmode(EX_SPACE): X mmode(EX_SPACE): X goto append_normal_space; X X any_mode(RELAX): X vmode(SPACER): X mmode(SPACER): X break; X X any_mode(IGNORE_SPACES): X get_nbx_token(); X goto reswitch; X X vmode(STOP): X if (its_all_over()) X return; X break; X X any_mode(LAST_ITEM): X any_mode(MAC_PARAM): X non_math(EQ_NO): X vmode(VMOVE): X hmode(HMOVE): X mmode(HMOVE): X vmode(VADJUST): X vmode(ITAL_CORR): X report_illegal_case(); X break; X X non_math(SUP_MARK): X non_math(SUB_MARK): X non_math(MATH_CHAR_NUM): X non_math(MATH_GIVEN): X non_math(MATH_COMP): X non_math(DELIM_NUM): X non_math(LEFT_RIGHT): X non_math(ABOVE): X non_math(RADICAL): X non_math(MATH_STYLE): X non_math(MATH_CHOICE): X non_math(VCENTER): X non_math(NON_SCRIPT): X non_math(MKERN): X non_math(LIMIT_SWITCH): X non_math(MSKIP): X non_math(MATH_ACCENT): X mmode(ENDV): X mmode(PAR_END): X mmode(STOP): X mmode(VSKIP): X mmode(UN_VBOX): X mmode(VALIGN): X mmode(HRULE): X insert_dollar_sign(); X break; X X vmode(HRULE): X hmode(VRULE): X mmode(VRULE): X tail_append(scan_rule_spec()); X if (abs(mode) == VMODE) X prev_depth = IGNORE_DEPTH; X else if (abs(mode) == HMODE) X space_factor = 1000; X break; X X vmode(VSKIP): X hmode(HSKIP): X mmode(HSKIP): X mmode(MSKIP): X append_glue(); X break; X X any_mode(KERN): X mmode(MKERN): X append_kern(); X break; X X non_math(LEFT_BRACE): X new_save_level(SIMPLE_GROUP); X break; X X any_mode(BEGIN_GROUP): X new_save_level(SEMI_SIMPLE_GROUP); X break; X X any_mode(END_GROUP): X if (cur_group == SEMI_SIMPLE_GROUP) X unsave(); X else off_save(); X break; X X any_mode(RIGHT_BRACE): X handle_right_brace(); X break; X X vmode(HMOVE): X hmode(VMOVE): X mmode(VMOVE): X t = cur_chr; X scan_normal_dimen(); X if (t == 0) X saved(0) = cur_val; X else saved(0) = -cur_val; X scan_box(); X break; X X any_mode(LEADER_SHIP): X saved(0) = LEADER_FLAG - A_LEADERS + cur_chr; X scan_box(); X break; X X any_mode(MAKE_BOX): X saved(0) = 0; X begin_box(); X break; X X vmode(START_PAR): X new_graf(cur_chr > 0); X break; X X vmode(LETTER): X vmode(OTHER_CHAR): X vmode(CHAR_NUM): X vmode(CHAR_GIVEN): X vmode(MATH_SHIFT): X vmode(UN_HBOX): X vmode(VRULE): X vmode(ACCENT): X vmode(DISCRETIONARY): X vmode(HSKIP): X vmode(VALIGN): X vmode(EX_SPACE): X back_input(); X new_graf(TRUE); X break; X X hmode(START_PAR): X mmode(START_PAR): X indent_in_hmode(); X break; X X vmode(PAR_END): X normal_paragraph(); X if (mode > 0) X build_page(); X break; X X hmode(PAR_END): X if (align_state < 0) X off_save(); X end_graf(); X if (mode == VMODE) X build_page(); X break; X X hmode(STOP): X hmode(VSKIP): X hmode(HRULE): X hmode(UN_VBOX): X hmode(HALIGN): X head_for_vmode(); X break; X X any_mode(INSERT): X hmode(VADJUST): X mmode(VADJUST): X begin_insert_or_adjust(); X break; X X any_mode(MARK): X make_mark(); X break; X X any_mode(BREAK_PENALTY): X append_penalty(); X break; X X any_mode(REMOVE_ITEM): X delete_last(); X break; X X vmode(UN_VBOX): X hmode(UN_HBOX): X mmode(UN_HBOX): X unpackage(); X break; X X hmode(ITAL_CORR): X append_italic_correction(); X break; X X mmode(ITAL_CORR): X tail_append(new_kern(0L)); X break; X X hmode(DISCRETIONARY): X mmode(DISCRETIONARY): X append_discretionary(); X break; X X hmode(ACCENT): X make_accent(); X break; X X any_mode(CAR_RET): X any_mode(TAB_MARK): X align_error(); X break; X X any_mode(NO_ALIGN): X no_align_error(); X break; X X any_mode(OMIT): X omit_error(); X break; X X vmode(HALIGN): X hmode(VALIGN): X init_align(); X break; X X mmode(HALIGN): X if (privileged()) X init_align(); X break; X X vmode(ENDV): X hmode(ENDV): X do_endv(); X break; X X any_mode(END_CS_NAME): X cs_error(); X break; X X hmode(MATH_SHIFT): X init_math(); X break; X X mmode(EQ_NO): X if (privileged()) X start_eq_no(); X break; X X mmode(LEFT_BRACE): X tail_append(new_noad()); X back_input(); X scan_math(nucleus(tail)); X break; X X mmode(LETTER): X mmode(OTHER_CHAR): X mmode(CHAR_GIVEN): X if (cur_chr < 128) X set_math_char((val)ho(math_code(cur_chr))); X else set_math_char((val)cur_chr); X break; X X mmode(CHAR_NUM): X scan_char_num(); X cur_chr = cur_val; X if (cur_chr < 128) X set_math_char((val)ho(math_code(cur_chr))); X else set_math_char((val)cur_chr); X break; X X mmode(MATH_CHAR_NUM): X scan_fifteen_bit_int(); X set_math_char(cur_val); X break; X X mmode(MATH_GIVEN): X set_math_char((val) cur_chr); X break; X X mmode(DELIM_NUM): X scan_twenty_seven_bit_int(); X set_math_char(cur_val / 010000); X break; X X mmode(MATH_COMP): X tail_append(new_noad()); X type(tail) = cur_chr; X scan_math(nucleus(tail)); X break; X X mmode(LIMIT_SWITCH): X math_limit_switch(); X break; X X mmode(RADICAL): X math_radical(); X break; X X mmode(ACCENT): X mmode(MATH_ACCENT): X math_ac(); X break; X X mmode(VCENTER): X scan_spec(); X new_save_level(VCENTER_GROUP); X normal_paragraph(); X push_nest(); X mode = -VMODE; X prev_depth = IGNORE_DEPTH; X if (every_vbox != NULL) X begin_token_list(every_vbox, EVERY_VBOX_TEXT); X break; X X mmode(MATH_STYLE): X tail_append(new_style(cur_chr)); X break; X X mmode(NON_SCRIPT): X tail_append(new_glue(zero_glue)); X subtype(tail) = COND_MATH_GLUE; X break; X X mmode(MATH_CHOICE): X append_choices(); X break; X X mmode(SUB_MARK): X mmode(SUP_MARK): X sub_sup(); X break; X X mmode(ABOVE): X math_fraction(); X break; X X mmode(LEFT_RIGHT): X math_left_right(); X break; X X mmode(MATH_SHIFT): X if (cur_group == MATH_SHIFT_GROUP) X after_math(); X else off_save(); X break; X X any_mode(ASSIGN_TOKS): X any_mode(ASSIGN_INT): X any_mode(ASSIGN_DIMEN): X any_mode(ASSIGN_GLUE): X any_mode(ASSIGN_MU_GLUE): X any_mode(ASSIGN_FONT_DIMEN): X any_mode(ASSIGN_FONT_INT): X any_mode(SET_AUX): X any_mode(SET_PREV_GRAF): X any_mode(SET_PAGE_DIMEN): X any_mode(SET_PAGE_INT): X any_mode(SET_BOX_DIMEN): X any_mode(SET_SHAPE): X any_mode(DEF_CODE): X any_mode(DEF_FAMILY): X any_mode(SET_FONT): X any_mode(DEF_FONT): X any_mode(REGISTER): X any_mode(ADVANCE): X any_mode(MULTIPLY): X any_mode(DIVIDE): X any_mode(PREFIX): X any_mode(LET): X any_mode(SHORTHAND_DEF): X any_mode(READ_TO_CS): X any_mode(DEF): X any_mode(SET_BOX): X any_mode(TOKS_REGISTER): X any_mode(HYPH_DATA): X any_mode(SET_INTERACTION): X prefixed_command(); X break; X X any_mode(AFTER_ASSIGNMENT): X get_token(); X after_token = cur_tok; X break; X X any_mode(AFTER_GROUP): X get_token(); X save_for_after(cur_tok); X break; X X any_mode(IN_STREAM): X clopen_stream(); X break; X X any_mode(MESSAGE): X issue_message(); X break; X X any_mode(CASE_SHIFT): X shift_case(); X break; X X any_mode(XRAY): X show_whatever(); X break; X X any_mode(EXTENSION): X do_extension(); X break; X } X goto big_switch; X X#define make_lig_disc() \ X {if (ligature_present) { \ X p = new_ligature(f, l, link(q)); \ X link(q) = p; \ X tail = p;} \ X if (c == hyphen_char[f] && mode == HMODE) \ X tail_append(new_disc());} X X#define space_glue() \ X {p = font_glue[cur_font]; \ X if (p == NULL) { \ X f = cur_font; \ X p = new_spec(zero_glue); \ X k = param_base[f] + SPACE_CODE; \ X width(p) = font_info[k].sc; \ X stretch(p) = font_info[k + 1].sc; \ X shrink(p) = font_info[k + 2].sc; \ X font_glue[f] = p;}} X Xmain_loop: X f = cur_font; X c = cur_chr; X Xmain_loop_1: X if (c < font_bc[f] || c > font_ec[f]) { X char_warning(f, c); X goto big_switch; X } X Xmain_loop_2: X q = tail; X ligature_present = FALSE; X l = qi(c); X Xmain_loop_3: X if (c < 128) { X s = sf_code(c); X if (s == 1000) X space_factor = 1000; X else if (s < 1000) { X if (s > 0) X space_factor = s; X } else if (space_factor < 1000) X space_factor = 1000; X else space_factor = s; X } else space_factor = 1000; X i = char_info(f, l); X if (char_exists(i)) { X fast_get_avail(p); X font(p) = f; X character(p) = qi(c); X link(tail) = p; X tail = p; X } else char_warning(f, qo(l)); X get_next(); X if (cur_cmd == LETTER || X cur_cmd == OTHER_CHAR || X cur_cmd == CHAR_GIVEN) X r = qi(cur_chr); X else { X x_token(); X if (cur_cmd == LETTER || X cur_cmd == OTHER_CHAR || X cur_cmd == CHAR_GIVEN) X r = qi(cur_chr); X else if (cur_cmd == CHAR_NUM) { X scan_char_num(); X r = qi(cur_val); X } else X r = qi(256); X } X if (char_tag(i) == LIG_TAG && r != qi(256)) { X k = lig_kern_start(f, i); X do { X j = font_info[k].qqqq; X if (next_char(j) == r) { X if (op_bit(j) < KERN_FLAG) { X ligature_present = TRUE; X l = rem_byte(j); X c = qo(r); X goto main_loop_3; X } else { X make_lig_disc(); X tail_append(new_kern(char_kern(f, j))); X c = qo(r); X goto main_loop_2; X } X } X incr(k); X } while (stop_bit(j) < STOP_FLAG); X } X make_lig_disc(); X if (r == qi(256)) X goto reswitch; X c = qo(r); X goto main_loop_1; X Xappend_normal_space: X if (space_skip == zero_glue) { X space_glue(); X q = new_glue(p); X } else X q = new_param_glue(SPACE_SKIP_CODE); X link(tail) = q; X tail = q; X goto big_switch; X} X Xapp_space () X{ X fnt f; X int k; X ptr p; X ptr q; X X if (space_factor >= 2000 && xspace_skip != zero_glue) X q = new_param_glue(XSPACE_SKIP_CODE); X else { X if (space_skip != zero_glue) X p = space_skip; X else space_glue(); X p = new_spec(p); X if (space_factor >= 2000) X width(p) += extra_space(cur_font); X stretch(p) = xn_over_d(stretch(p), space_factor, 1000L); X shrink(p) = xn_over_d(shrink(p), 1000L, space_factor); X q = new_glue(p); X glue_ref_count(p) = NULL; X } X link(tail) = q; X tail = q; X} X Xinsert_dollar_sign () X{ X back_input(); X cur_tok = MATH_SHIFT_TOKEN + '$'; X print_err("Missing $ inserted"); X help_dollar(); X ins_error(); X} X Xreport_illegal_case () X{ X you_cant(); X help_illegal_case(); X error(); X} X Xyou_cant () X{ X print_err("You can't use `"); X print_cmd_chr(cur_cmd, cur_chr); X print("' in "); X print_mode(mode); X} X Xbool Xprivileged () X{ X if (mode > 0) X return TRUE; X else { X report_illegal_case(); X return FALSE; X } X} X Xbool Xits_all_over () X{ X if (privileged()) { X if (page_head == page_tail && X head == tail && X dead_cycles == 0) { X return TRUE; X } X back_input(); X tail_append(new_null_box()); X width(tail) = hsize; X tail_append(new_glue(fill_glue)); X tail_append(new_penalty(-010000000000)); X build_page(); X } X return FALSE; X} X X/* X * Help text SHAR_EOF echo "End of part 7" echo "File eval.c is continued in part 8" echo "8" > s2_seq_.tmp exit 0
glenn@extro.ucc.su.oz.au (G Geers) (02/16/90)
---- Cut Here and unpack ---- #!/bin/sh # this is part 8 of a multipart archive # do not concatenate these parts, unpack them in order with /bin/sh # file eval.c continued # CurArch=8 if test ! -r s2_seq_.tmp then echo "Please unpack part 1 first!" exit 1; fi ( read Scheck if test "$Scheck" != $CurArch then echo "Please unpack part $Scheck next!" exit 1; else exit 0; fi ) < s2_seq_.tmp || exit 1 echo "x - Continuing file eval.c" sed 's/^X//' << 'SHAR_EOF' >> eval.c X */ X Xhelp_dollar () X{ X help2("I've inserted a begin-math/end-math symbol since I think", X "you left one out. Proceed with fingers crossed."); X} X Xhelp_illegal_case () X{ X help4("Sorry, but I'm not programmed to handle this case;", X "I'll just pretend that you didn't ask for it.", X "If you're in the wrong mode, you might be able to", X "return to the right one by typing `I}' or `I$' or `I\\par'."); X} SHAR_EOF echo "File eval.c is complete" chmod 0444 eval.c || echo "restore of eval.c fails" set `wc -c eval.c`;Sum=$1 if test "$Sum" != "12031" then echo original size 12031, current size $Sum;fi echo "x - extracting eval.h (Text)" sed 's/^X//' << 'SHAR_EOF' > eval.h && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * eval.h X */ X Xint main_control(); Xint app_space(); Xint insert_dollar_sign(); Xint you_cant(); Xint report_illegal_case(); Xbool privileged(); Xint missing_font(); Xbool its_all_over(); SHAR_EOF chmod 0444 eval.h || echo "restore of eval.h fails" set `wc -c eval.h`;Sum=$1 if test "$Sum" != "539" then echo original size 539, current size $Sum;fi echo "x - extracting evalstack.c (Text)" sed 's/^X//' << 'SHAR_EOF' > evalstack.c && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * evalstack.c X */ X X#include "tex.h" X#include "cmds.h" X#include "heap.h" X#include "str.h" X#include "arith.h" X#include "tokenstack.h" X#include "eq.h" X#include "box.h" X#include "page.h" X#include "print.h" X#include "error.h" X#include "evalstack.h" X Xlist cur_list; Xlist nest[NEST_SIZE]; Xptr nest_ptr; Xint max_nest_stack; Xint shown_mode; X Xpush_nest () X{ X if (nest_ptr > max_nest_stack) { X max_nest_stack = nest_ptr; X if (nest_ptr == NEST_SIZE) X overflow("semantic nest size", NEST_SIZE); X } X nest[nest_ptr] = cur_list; X incr(nest_ptr); X head = get_avail(); X tail = head; X prev_graf = 0; X mode_line = line; X} X Xpop_nest () X{ X free_avail(head); X decr(nest_ptr); X cur_list = nest[nest_ptr]; X} X Xprint_mode (m) X int m; X{ X if (m > 0) { X switch (m / (MAX_COMMAND + 1)) X { X case 0: X print("vertical"); X break; X X case 1: X print("horizontal"); X break; X X case 2: X print("display math"); X break; X } X } else if (m == 0) X print("no"); X else { X switch (-m / (MAX_COMMAND + 1)) X { X case 0: X print("internal vertical"); X break; X X case 1: X print("restricted horizontal"); X break; X X case 2: X print("math"); X break; X } X } X print(" mode"); X} X Xshow_activities () X{ X val a; X int p; X int m; X ptr q; X ptr r; X val t; X X nest[nest_ptr] = cur_list; X print_nl(""); X print_ln(); X for (p = nest_ptr; p >= 0; decr(p)) { X m = nest[p].mode_field; X a = nest[p].aux_field; X print_nl("### "); X print_mode(m); X print(" entered at line "); X print_val(abs(nest[p].ml_field)); X if (nest[p].ml_field < 0) X print(" (\\output routine)"); X if (p == 0) { X if (page_head != page_tail) { X print_nl("### current page:"); X if (output_active) X print(" (held over for next output)"); X show_box(link(page_head)); X if (page_contents > EMPTY) { X print_nl("total height "); X print_totals(); X print_nl(" goal height "); X print_scaled(page_goal); X r = link(page_ins_head); X while (r != page_ins_head) { X print_ln(); X print_esc("insert"); X t = qo(subtype(r)); X print_int((int) t); X print(" adds "); X t = x_over_n(height(r), 1000L) * count(t); X print_scaled((scal) t); X if (type(r) == SPLIT_UP) { X q = page_head; X t = 0; X do { X q = link(q); X if (type(q) == INS_NODE && X subtype(q) == subtype(r)) X incr(t); X } while (q != broken_ins(r)); X print(", #"); X print_int((int) t); X print(" might split"); X } X r = link(r); X } X } X } X if (link(contrib_head) != NULL) X print_nl("### recent contributions:"); X } X show_box(link(nest[p].head_field)); X switch (abs(m) / (MAX_COMMAND + 1)) X { X case 0: X print_nl("prevdepth "); X if (a <= IGNORE_DEPTH) X print("ignored"); X else print_scaled((scal) a); X if (nest[p].pg_field != 0) { X print(", prevgraf "); X print_int(nest[p].pg_field); X print(" line"); X if (nest[p].pg_field != 1) X print_char('s'); X } X break; X X case 1: X print_nl("spacefactor "); X print_int((int) a); X break; X X case 2: X if (a != NULL) { X print("this will be a denominator of:"); X show_box((ptr) a); X } X break; X } X } X} SHAR_EOF chmod 0444 evalstack.c || echo "restore of evalstack.c fails" set `wc -c evalstack.c`;Sum=$1 if test "$Sum" != "3367" then echo original size 3367, current size $Sum;fi echo "x - extracting evalstack.h (Text)" sed 's/^X//' << 'SHAR_EOF' > evalstack.h && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * evalstack.h X */ X X#define VMODE 1 X#define HMODE (VMODE + MAX_COMMAND + 1) X#define MMODE (HMODE + MAX_COMMAND + 1) X Xint push_nest(); Xint pop_nest(); Xint print_mode(); X X#define IGNORE_DEPTH -65536000 X Xtypedef struct X{ X int mode_field; X ptr head_field; X ptr tail_field; X int pg_field; X val aux_field; X val ml_field; X} X list; X Xglobal list cur_list; Xglobal ptr nest_ptr; Xglobal list nest[]; Xglobal int max_nest_stack; X X#define mode cur_list.mode_field X#define head cur_list.head_field X#define tail cur_list.tail_field X#define prev_graf cur_list.pg_field X#define aux cur_list.aux_field X#define prev_depth aux X#define space_factor aux X#define incompleat_noad aux X#define mode_line cur_list.ml_field X Xglobal int shown_mode; X Xint show_activities(); X X#define tail_append(N) \ X {link(tail) = N; tail = link(tail);} SHAR_EOF chmod 0444 evalstack.h || echo "restore of evalstack.h fails" set `wc -c evalstack.h`;Sum=$1 if test "$Sum" != "1060" then echo original size 1060, current size $Sum;fi echo "x - extracting expand.c (Text)" sed 's/^X//' << 'SHAR_EOF' > expand.c && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * expand.c X */ X X#include "tex.h" X#include "cmds.h" X#include "heap.h" X#include "io.h" X#include "eq.h" X#include "hash.h" X#include "box.h" X#include "tokenstack.h" X#include "scan.h" X#include "token.h" X#include "tokenlists.h" X#include "cond.h" X#include "file.h" X#include "print.h" X#include "error.h" X#include "expand.h" X Xint long_state; Xptr pstack[9]; Xptr cur_mark[5]; X Xget_x_token () X{ Xrestart: X get_next(); X if (cur_cmd <= MAX_COMMAND) X goto done; X if (cur_cmd >= CALL) { X if (cur_cmd < END_TEMPLATE) X macro_call(); X else { X cur_cs = FROZEN_ENDV; X cur_cmd = ENDV; X goto done; X } X } else expand(); X goto restart; X Xdone: X if (cur_cs == 0) X cur_tok = cur_cmd * 0400 + cur_chr; X else cur_tok = CS_TOKEN_FLAG + cur_cs; X} X Xexpand () X{ X int j; X ptr p; X ptr q; X ptr r; X hword t; X int save_scanner_status; X val cv_backup = cur_val; X int radix_backup = radix; X int cvl_backup = cur_val_level; X ptr backup_backup = token_link(backup_tokens); X X if (cur_cmd < CALL) { X if (tracing_commands > 1) X show_cur_cmd_chr(); X switch (cur_cmd) X { X case TOP_BOT_MARK: X if (cur_mark[cur_chr] != NULL) X begin_token_list(cur_mark[cur_chr], MARK_TEXT); X break; X X case EXPAND_AFTER: X get_token(); X t = cur_tok; X get_token(); X if (cur_cmd > MAX_COMMAND) X expand(); X else back_input(); X cur_tok = t; X back_input(); X break; X X case NO_EXPAND: X save_scanner_status = scanner_status; X scanner_status = NORMAL; X get_token(); X scanner_status = save_scanner_status; X t = cur_tok; X back_input(); X if (t >= CS_TOKEN_FLAG) { X p = new_token(); X token(p) = CS_TOKEN_FLAG + FROZEN_DONT_EXPAND; X token_link(p) = loc; X start = p; X loc = p; X } X break; X X case CS_NAME: X p = r = new_token(); X do { X get_x_token(); X if (cur_cs == 0) X store_new_token(cur_tok); X } while (cur_cs == 0); X if (cur_cmd != END_CS_NAME) { X print_err("Missing "); X print_esc("endcsname"); X print(" inserted"); X help_cs(); X back_error(); X } X j = first; X p = token_link(r); X while (p != NULL) { X if (j >= max_buf_stack) { X max_buf_stack = j + 1; X if (max_buf_stack == BUF_SIZE) X overflow("buffer size", BUF_SIZE); X } X buffer[j] = token(p) % 0400; X incr(j); X p = token_link(p); X } X if (j > first + 1) { X no_new_control_sequence = FALSE; X cur_cs = id_lookup(first, j - first); X no_new_control_sequence = TRUE; X } else if (j == first) X cur_cs = NULL_CS; X else cur_cs = SINGLE_BASE + buffer[first]; X flush_list(r); X if (eq_type(cur_cs) == UNDEFINED_CS) X eqtb[cur_cs] = eqtb[FROZEN_RELAX]; X cur_tok = cur_cs + CS_TOKEN_FLAG; X back_input(); X break; X X case CONVERT: X conv_toks(); X break; X X case THE: X ins_the_toks(); X break; X X case IF_TEST: X conditional(); X break; X X case FI_OR_ELSE: X if (cur_chr > if_limit) { X if (if_limit == IF_CODE) { X insert_relax(); X } else { X print_err("Extra "); X print_cmd_chr(FI_OR_ELSE, cur_chr); X help_extra_if(); X error(); X } X } else { X while (cur_chr != FI_CODE) X pass_text(); X pop_cond(); X } X break; X X case INPUT: X if (cur_chr > 0) X force_eof = TRUE; X else if (name_in_progress) X insert_relax(); X else start_input(); X break; X X default: X print_err("Undefined control sequence"); X help_undefd(); X error(); X break; X } X } else if (cur_cmd < END_TEMPLATE) X macro_call(); X else { X cur_tok = CS_TOKEN_FLAG + FROZEN_ENDV; X back_input(); X } X cur_val = cv_backup; X cur_val_level = cvl_backup; X radix = radix_backup; X token_link(backup_tokens) = backup_backup; X} X Xinsert_relax () X{ X cur_tok = CS_TOKEN_FLAG + cur_cs; X back_input(); X cur_tok = CS_TOKEN_FLAG + FROZEN_RELAX; X back_input(); X token_type = INSERTED; X} X X#define runaway_arg() \ X {if (long_state == CALL) { \ X runaway(); \ X print_err("Paragraph ended before "); \ X sprint_cs(warning_index); \ X print(" was complete"); \ X help_runaway(); \ X back_error();} \ X pstack[n] = token_link(temp_toks); \ X align_state -= unbalance; \ X for (m = 0; m <= n; incr(m)) \ X flush_list(pstack[m]); \ X goto local_exit;} X Xmacro_call () X{ X int m; X int n; X ptr p; X ptr q; X ptr r; X ptr s; X ptr t; X ptr u; X ptr v; X ascii match_chr; X ptr ref_count; X ptr rbrace_ptr; X ptr save_warning_index; X int save_scanner_status; X int unbalance; X X n = 0; X ref_count = cur_chr; X r = token_link(ref_count); X save_scanner_status = scanner_status; X save_warning_index = warning_index; X warning_index = cur_cs; X if (tracing_macros > 0) { X begin_diagnostic(); X print_ln(); X print_cs(warning_index); X token_show(ref_count); X end_diagnostic(FALSE); X } X if (token(r) != END_MATCH_TOKEN) { X scanner_status = MATCHING; X unbalance = 0; X long_state = eq_type(cur_cs); X if (long_state >= OUTER_CALL) X long_state -= 2; X do { X if (token(r) > MATCH_TOKEN + 127 || X token(r) < MATCH_TOKEN) { X s = NULL; X } else { X match_chr = token(r) - MATCH_TOKEN; X s = token_link(r); X r = s; X p = temp_toks; X token_link(p) = NULL; X m = 0; X } X X contin: X get_token(); X if (cur_tok == token(r)) { X r = token_link(r); X if (token(r) >= MATCH_TOKEN && X token(r) <= END_MATCH_TOKEN) { X if (cur_tok < LEFT_BRACE_LIMIT) X decr(align_state); X goto found; X } else goto contin; X } X if (s != r) { X if (s == NULL) { X print_err("Use of "); X sprint_cs(warning_index); X print(" doesn't match its definition"); X help_match(); X error(); X goto local_exit; X } else { X t = s; X do { X store_new_token(token(t)); X incr(m); X u = token_link(t); X v = s; X loop { X if (u == r) { X if (cur_tok != token(v)) X break; X else { X r = token_link(v); X goto contin; X } X } X if (token(u) != token(v)) X break; X u = token_link(u); X v = token_link(v); X } X t = token_link(t); X } while (t != r); X r = s; X } X } X if (cur_tok == par_token && long_state != LONG_CALL) X runaway_arg(); X if (cur_tok < RIGHT_BRACE_LIMIT) { X if (cur_tok < LEFT_BRACE_LIMIT) { X unbalance = 1; X loop { X fast_store_new_token(cur_tok); X get_token(); X if (cur_tok == par_token && X long_state != LONG_CALL) { X runaway_arg(); X } X if (cur_tok < RIGHT_BRACE_LIMIT) { X if (cur_tok < LEFT_BRACE_LIMIT) X incr(unbalance); X else { X decr(unbalance); X if (unbalance == 0) X break; X } X } X } X rbrace_ptr = p; X store_new_token(cur_tok); X } else { X back_input(); X print_err("Argument of "); X sprint_cs(warning_index); X print(" has an extra `}'"); X help_match_xtra(); X incr(align_state); X long_state = CALL; X cur_tok = par_token; X ins_error(); X } X } else { X if (cur_tok == SPACE_TOKEN && X token(r) <= END_MATCH_TOKEN && X token(r) >= MATCH_TOKEN) X goto contin; X store_new_token(cur_tok); X } X incr(m); X if (token(r) > END_MATCH_TOKEN || token(r) < MATCH_TOKEN) X goto contin; X X found: X if (s != NULL) { X if (m == 1 && X token(p) < RIGHT_BRACE_LIMIT && X p != temp_toks) { X token_link(rbrace_ptr) = NULL; X free_token(p); X p = token_link(temp_toks); X pstack[n] = token_link(p); X free_token(p); X } else pstack[n] = token_link(temp_toks); X incr(n); X if (tracing_macros > 0) { X begin_diagnostic(); X print_nl(""); X print_char(match_chr); X print_int(n); X print("<-"); X show_token_list(pstack[n - 1], NULL, 1000L); X end_diagnostic(FALSE); X } X } X } while (token(r) != END_MATCH_TOKEN); X } X while (state == TOKEN_LIST && loc == NULL) X end_token_list(); X begin_token_list(ref_count, MACRO); X name = warning_index; X loc = token_link(r); X if (n > 0) { X if (param_ptr + n > max_param_stack) { X max_param_stack = param_ptr + n; X if (max_param_stack >= PARAM_SIZE) X overflow("parameter stack size", PARAM_SIZE); X } X for (m = 0; m < n; incr(m)) X param_stack[param_ptr + m] = pstack[m]; X param_ptr += n; X } X Xlocal_exit: X scanner_status = save_scanner_status; X warning_index = save_warning_index; X} X Xx_token () X{ X while (cur_cmd > MAX_COMMAND) { X expand(); X get_next(); X } X if (cur_cs == 0) X cur_tok = cur_cmd * 0400 + cur_chr; X else cur_tok = CS_TOKEN_FLAG + cur_cs; X} X X/* X * Help text X */ X Xhelp_runaway () X{ X help3("I suspect you've forgotten a `}', causing me to apply this", X "control sequence to too much text. How can we recover?", X "My plan is to forget the whole thing and hope for the best."); X} X Xhelp_match () X{ X help4("If you say, e.g., `\\def\\a1{...}', then you must always", X "put `1' after `\\a', since control sequence names are", X "made up of letters only. The macro here has not been", X "followed by the required stuff, so I'm ignoring it."); X} X Xhelp_match_xtra () X{ X help6("I've run across a `}' that doesn't seem to match anything.", X "For example, `\\def\\a#1{...}' and `\\a}' would produce", X "this error. If you simply proceed now, the `\\par' that", X "I've just inserted will cause me to report a runaway", X "argument that might be the root of the problem. But if", X "your `}' was spurious, just type `2' and it will go away."); X} X Xhelp_undefd () X{ X help5("The control sequence at the end of the top line", X "of your error message was never \\def'ed. If you have", X "misspelled it (e.g., `\\hobx'), type `I' and the correct", X "spelling (e.g., `I\\hbox'). Otherwise just continue,", X "and I'll forget about whatever was undefined."); X} X Xhelp_cs () X{ X help2("The control sequence marked <to be read again> should", X "not appear between \\csname and \\endcsname."); X} X Xhelp_extra_if () X{ X help1("I'm ignoring this; it doesn't match any \\if."); X} SHAR_EOF chmod 0444 expand.c || echo "restore of expand.c fails" set `wc -c expand.c`;Sum=$1 if test "$Sum" != "9947" then echo original size 9947, current size $Sum;fi echo "x - extracting expand.h (Text)" sed 's/^X//' << 'SHAR_EOF' > expand.h && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * expand.h X */ X Xint get_x_token(); Xint expand(); Xint insert_relax(); X X#define TOP_MARK_CODE 0 X#define FIRST_MARK_CODE 1 X#define BOT_MARK_CODE 2 X#define SPLIT_FIRST_MARK_CODE 3 X#define SPLIT_BOT_MARK_CODE 4 X X#define top_mark cur_mark[TOP_MARK_CODE] X#define first_mark cur_mark[FIRST_MARK_CODE] X#define bot_mark cur_mark[BOT_MARK_CODE] X#define split_first_mark cur_mark[SPLIT_FIRST_MARK_CODE] X#define split_bot_mark cur_mark[SPLIT_BOT_MARK_CODE] X Xglobal ptr cur_mark[]; X Xglobal int long_state; Xglobal ptr pstack[]; X Xint macro_call(); Xint x_token(); SHAR_EOF chmod 0444 expand.h || echo "restore of expand.h fails" set `wc -c expand.h`;Sum=$1 if test "$Sum" != "799" then echo original size 799, current size $Sum;fi echo "x - extracting file.c (Text)" sed 's/^X//' << 'SHAR_EOF' > file.c && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * file.c X */ X X#include "tex.h" X#include "cmds.h" X#include "heap.h" X#include "char.h" X#include "eq.h" X#include "token.h" X#include "scan.h" X#include "tokenstack.h" X#include "str.h" X#include "fmt.h" X#include "io.h" X#include "print.h" X#include "error.h" X#include "file.h" X Xchar name_of_file[FILE_NAME_SIZE]; Xint name_length; X Xint area_delimiter; Xint ext_delimiter; X Xstr cur_area; Xstr cur_name; Xstr cur_ext; X Xbool name_in_progress = FALSE; Xstr job_area; Xstr job_name; Xstr log_name; Xstr dvi_name; X Xalpha_file read_file[16]; X Xint read_open[17]; X Xstr str_dvi; Xstr str_log; Xstr str_tex; Xstr str_tfm; Xstr str_fmt; Xstr str_texput; X Xbool Xbegin_name () X{ X area_delimiter = 0; X ext_delimiter = 0; X} X Xbool Xmore_name (c) X ascii c; X{ X if (c == ' ') X return FALSE; X else { X if (c == '/') { X area_delimiter = pool_ptr; X ext_delimiter = 0; X } else if (c == '.' && ext_delimiter == 0) X ext_delimiter = pool_ptr; X str_room(1); X append_char(c); X return TRUE; X } X} X Xend_name () X{ X if (str_ptr + 3 > MAX_STRINGS) X overflow("number of strings", MAX_STRINGS); X if (area_delimiter == 0) X cur_area = null_str; X else { X cur_area = str_ptr; X incr(str_ptr); X str_start[str_ptr] = area_delimiter + 1; X } X if (ext_delimiter == 0) { X cur_ext = null_str; X cur_name = make_string(); X } else { X cur_name = str_ptr; X incr(str_ptr); X str_start[str_ptr] = ext_delimiter; X cur_ext = make_string(); X } X} X X#define append_to_name(F) \ X {c = F; name_of_file[k] = xchr[c]; incr(k);} X Xpack_file_name (n, a, e) X str n; X str a; X str e; X{ X ascii c; X int j; X int k; X X if (length(a) + length(n) + length(e) >= FILE_NAME_SIZE) X overflow("file name size", FILE_NAME_SIZE); X k = 0; X for (j = str_start[a]; j < str_start[a+1]; incr(j)) X append_to_name(str_pool[j]); X for (j = str_start[n]; j < str_start[n+1]; incr(j)) X append_to_name(str_pool[j]); X for (j = str_start[e]; j < str_start[e+1]; incr(j)) X append_to_name(str_pool[j]); X name_length = k; X name_of_file[k] = NUL; X} X Xprint_file_name (n, a, e) X str n; X str a; X str e; X{ X print_str(a); X print_str(n); X print_str(e); X} X Xpack_job_name (s) X{ X cur_area = job_area; X cur_name = job_name; X cur_ext = s; X pack_cur_name(); X} X Xstr Xmake_name_string () X{ X int k; X X str_room(name_length); X for (k = 0; k < name_length; incr(k)) X append_char(xord[name_of_file[k]]); X return (make_string()); X} X Xwrite_name_string () X{ X int k; X X for (k = 0; k < name_length; incr(k)) X print_char(name_of_file[k]); X} X Xscan_file_name () X{ X name_in_progress = TRUE; X get_nbx_token(); X begin_name(); X loop { X if (cur_cmd > OTHER_CHAR || cur_chr > 127) { X back_input(); X break; X } X if (!more_name(cur_chr)) break; X get_x_token(); X } X end_name(); X name_in_progress = FALSE; X} X Xprompt_file_name (s, e) X char* s; X str e; X{ X int k; X X if (s[0] == 'i' && s[1] == 'n') X print_nl("! I can't find file `"); X else print_nl("! I can't write on file `"); X print_file_name(cur_name, cur_area, cur_ext); X print("'."); X if (e == str_tex) X show_context(); X print_nl("Please type another "); X print(s); X if (interaction < SCROLL_MODE) X fatal_error("*** (job aborted, file error in nonstop mode)"); X clear_terminal(); X prompt_input(": "); X begin_name(); X k = first; X while (buffer[k] == ' ' && k < last) X incr(k); X loop { X if (k == last) X break; X if (! more_name(buffer[k])) X break; X incr(k); X } X end_name(); X if (cur_ext == null_str) X cur_ext = e; X pack_cur_name(); X} X Xstart_input () X{ X scan_file_name(); X if (cur_ext == null_str) X cur_ext = str_tex; X pack_cur_name(); X loop { X begin_file_reading(); X if (cur_file = a_open_in()) X break; X end_file_reading(); X if (cur_ext == str_tex) { X cur_ext = null_str; X pack_cur_name(); X begin_file_reading(); X if (cur_file = a_open_in()) X break; X end_file_reading(); X } X prompt_file_name("input file name", str_tex); X } X name = a_make_name_string(cur_file); X if (job_name == 0) { X job_area = cur_area; X job_name = cur_name; X open_log_file(); X if (job_area != null_str) X set_def_area(); X } X if (term_offset + length(name) > MAX_PRINT_LINE - 2) X print_ln(); X else if (term_offset > 0 || file_offset > 0) X print_char(' '); X print_char('('); X print_str(name); X update_terminal(); X state = NEW_LINE; X input_ln(cur_file, FALSE); X firm_up_the_line(); X if (end_line_char < 0 || end_line_char > 127) X decr(limit); X else buffer[limit] = end_line_char; X first = limit + 1; X loc = start; X line = 1; X} X Xopen_log_file () X{ X int k; X int l; X char months[37]; X int old_setting; X X old_setting = selector; X if (job_name == 0) { X job_area = null_str; X job_name = str_texput; X } X pack_job_name(str_log); X while ((log_file = a_open_out()) == NULL) X prompt_file_name("transcript file name", str_log); X log_name = a_make_name_string(log_file); X selector = LOG_ONLY; X fputs(banner, log_file); X if (format_ident == 0) X print(" (no format preloaded)"); X else print_str(format_ident); X print_char(' '); X print_int(day); X print_char(' '); X strcpy(months, "JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC"); X for (k = 3 * month - 3; k < 3 * month; incr(k)) X putc(months[k], log_file); X print_char(' '); X print_int(year); X print_char(' '); X print_two(time / 60); X print_char(':'); X print_two(time % 60); X input_stack[input_ptr] = cur_input; X print_nl("**"); X l = input_stack[0].limit_field; X if (buffer[l] == end_line_char) decr(l); X for (k = 1; k <= l; incr(k)) X print_char(buffer[k]); X print_ln(); X selector = old_setting + 2; X} X Xbool Xopen_fmt_file () X{ X int j; X X j = loc; X if (buffer[loc] == '&') { X incr(loc); X j = loc; X buffer[last] = ' '; X while (buffer[j] != ' ') incr(j); X pack_buffered_name(loc, j); X if (fmt_file = w_open_in()) goto found; X wake_up_terminal(); X puts("Sorry, I can't find that format, will try PLAIN."); X update_terminal(); X } X strcpy(name_of_file, TeX_format_default); X name_length = 9; X if ((fmt_file = w_open_in()) == NULL) { X puts("I can't find the PLAIN format file!"); X return FALSE; X } Xfound: X loc = j; X return TRUE; X} X Xpack_buffered_name (a, b) X int a; X int b; X{ X ascii c; X int j; X int k; X X k = 0; X for (j = a; j < b; incr(j)) X append_to_name(buffer[j]); X append_to_name(xchr['.']); X append_to_name(xchr['f']); X append_to_name(xchr['m']); X append_to_name(xchr['t']); X append_to_name(NUL); X name_length = b - a + 4; X} X X/* X * fixed arrays are used to hold the paths, to avoid any possible problems X * involving interaction of malloc and undump X */ X Xchar* cur_path; X Xchar input_path[MAX_PATH_CHARS] = default_input_path; Xchar font_path[MAX_PATH_CHARS] = default_font_path; Xchar format_path[MAX_PATH_CHARS] = default_format_path; X Xset_paths () X{ X char* env_path; X char* getenv(); X X if (env_path = getenv("TEXINPUTS")) X copy_path(input_path, env_path, MAX_PATH_CHARS); X if (env_path = getenv("TEXFONTS")) X copy_path(font_path, env_path, MAX_PATH_CHARS); X if (env_path = getenv("TEXFORMATS")) X copy_path(format_path, env_path, MAX_PATH_CHARS); X} X X/* X * copy_path(s1,s2,n) copies at most n characters (including the null) X * from string s2 to string s1, giving an error message for paths X * that are too long. X */ X Xcopy_path (s1, s2, n) X char* s1; X char* s2; X int n; X{ X int i; X X i = 0; X while (s2[i] != NUL) { X s1[i] = s2[i]; X incr(i); X if (i == n) { X fprintf(stderr, "! Environment search path is too big\n"); X s1[i - 1] = '\0'; X return; X } X } X s1[i] = NUL; X} X X#define append_to_def_area(C) \ X {if (i == MAX_PATH_CHARS) \ X overflow("def_area", MAX_PATH_CHARS); \ X def_area[i] = C; \ X incr(i), incr(j);} X Xset_def_area() X{ X char c; X int i; X int j; X char def_area[MAX_PATH_CHARS]; X X i = 0; X j = str_start[job_area]; X while (j < str_start[job_area + 1]) X append_to_def_area(str_pool[j]); X append_to_def_area(':'); X j = 0; X while ((c = input_path[j]) != NUL) X append_to_def_area(c); X append_to_def_area(NUL); X strcpy(input_path, def_area); X} X X/* X * test_access(amode, file_path) X * X * Test whether or not the file whose name is in the global name_of_file X * can be opened for reading according to access mode. X * X * If the filename given in name_of_file does not begin with '/', we try X * prepending all the ':'-separated areanames in the appropriate path to the X * filename until access can be made. X */ X Xbool Xtest_access (amode, file_path) X int amode; X int file_path; X{ X int nl; X bool ok; X char original_name[FILE_NAME_SIZE]; X X strcpy(original_name, name_of_file); X nl = name_length; X switch (file_path) X { X case NO_FILE_PATH: X cur_path = NULL; X break; X X case INPUT_FILE_PATH: X cur_path = input_path; X break; X X case FONT_FILE_PATH: X cur_path = font_path; X break; X X case FORMAT_FILE_PATH: X cur_path = format_path; X break; X } X if (name_of_file[0] == '/' || X name_of_file[0] == '.' && name_of_file[1] == '/') X cur_path = NULL; X do { X strcpy(name_of_file, original_name); X name_length = nl; X get_real_name(); X switch (amode) X { X case READ_ACCESS: X ok = access(name_of_file, amode) == 0 ? TRUE : FALSE; X break; X X case WRITE_ACCESS: X {FILE *fp = fopen(name_of_file, "w"); X ok = fp != (FILE *) 0; X if (ok) fclose(fp);} X break; X } X } while (!ok && cur_path != NULL); X return ok; X} X X#define append_to_real_name(C) \ X {if (i == FILE_NAME_SIZE) \ X overflow("real_name", FILE_NAME_SIZE); \ X real_name[i] = C; \ X incr(i), incr(j);} X Xget_real_name () X{ X int i; X int j; X char real_name[FILE_NAME_SIZE]; X X i = j = 0; X if (cur_path) { X while (cur_path[j] != ':' && cur_path[j] != NUL) X append_to_real_name(cur_path[j]); X if (real_name[i - 1] != '/') X append_to_real_name('/'); X if (cur_path[j] == NUL) X cur_path = NULL; X else cur_path += j; X } X j = 0; X while (j < name_length) X append_to_real_name(name_of_file[j]); X append_to_real_name(NUL); X strcpy(name_of_file, real_name); X name_length = i - 1; X} X Xinit_file () X{ X int i; X X name_in_progress = FALSE; X str_tex = make_string_given(".tex"); X str_dvi = make_string_given(".dvi"); X str_log = make_string_given(".log"); X str_tfm = make_string_given(".tfm"); X str_fmt = make_string_given(".fmt"); X str_texput = make_string_given("texput"); X for (i = 0; i <= 16; incr(i)) X read_open[i] = CLOSED; X} SHAR_EOF chmod 0444 file.c || echo "restore of file.c fails" set `wc -c file.c`;Sum=$1 if test "$Sum" != "10343" then echo original size 10343, current size $Sum;fi echo "x - extracting file.h (Text)" sed 's/^X//' << 'SHAR_EOF' > file.h && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * file.h X */ X Xglobal char name_of_file[]; Xglobal int name_length; X Xglobal str cur_name; Xglobal str cur_area; Xglobal str cur_ext; X Xglobal int area_delimiter; Xglobal int ext_delimiter; X X#define MAX_PATH_CHARS 1024 X Xglobal char input_path[]; Xglobal char format_path[]; Xglobal char font_path[]; X Xint set_paths(); X X#define default_font_path ".:/usra/tex/fonts" X#define default_format_path ".:/usra/ctex/formats" X#define default_input_path ".:/usra/tex/inputs" X Xint print_file_name(); Xint pack_file_name(); X X#define TeX_format_default "plain.fmt" X Xbool open_fmt_file(); X Xstr make_name_string(); Xint write_name_string(); X X#define a_make_name_string(f) make_name_string() X#define b_make_name_string(f) make_name_string() X#define w_make_name_string(f) make_name_string() X Xglobal bool name_in_progress; Xint scan_file_name(); X X#define pack_cur_name() \ X {pack_file_name(cur_name, cur_area, cur_ext);} X Xint pack_job_name(); Xint prompt_job_name(); X Xglobal str dvi_name; X Xglobal str job_name; Xglobal str job_area; Xglobal str log_name; X Xint open_log_file(); Xint start_input(); X Xglobal alpha_file read_file[]; Xglobal int read_open[]; X X#define JUST_OPENED 1 X#define CLOSED 2 X Xbool test_access(); X X#define READ_ACCESS 4 X#define WRITE_ACCESS 2 X X#define NO_FILE_PATH 0 X#define INPUT_FILE_PATH 1 X#define FONT_FILE_PATH 2 X#define FORMAT_FILE_PATH 3 X Xglobal str str_dvi; Xglobal str str_tex; Xglobal str str_log; Xglobal str str_tfm; Xglobal str str_fmt; Xglobal str str_texput; X X#ifdef INIT Xint init_file(); X#endif SHAR_EOF chmod 0444 file.h || echo "restore of file.h fails" set `wc -c file.h`;Sum=$1 if test "$Sum" != "1756" then echo original size 1756, current size $Sum;fi echo "x - extracting fmt.c (Text)" sed 's/^X//' << 'SHAR_EOF' > fmt.c && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * fmt.c X */ X X#include "tex.h" X#include "texext.h" X#include "heap.h" X#include "token.h" X#include "eq.h" X#include "box.h" X#include "eqstack.h" X#include "hash.h" X#include "file.h" X#include "tfm.h" X#include "str.h" X#include "hyph.h" X#include "token.h" X#include "io.h" X#include "print.h" X#include "error.h" X#include "fmt.h" X Xword_file fmt_file; X Xstr format_ident; X X#define undump_ascii() (str_pool[k] = getc(fmt_file)) X#define undump_int(M) M = getw(fmt_file) X#define undump_wd(M) fread(&M, sizeof(M), 1, fmt_file); X#define undump_hh(M) fread(&M, sizeof(M), 1, fmt_file); X#define undump_qqqq(M) fread(&M, sizeof(M), 1, fmt_file); X X#define undump(MIN, MAX, X) \ X {undump_int(x); \ X if (x < MIN || x > MAX) \ X goto bad_fmt; \ X else X = x;} X X#define too_small(S) \ X printf("---! Must increase the %s\n", S) X X#define undump_size(MIN, MAX, TABLE, X) \ X {undump_int(x); \ X if (x < MIN) goto bad_fmt; \ X if (x > MAX) too_small(TABLE); \ X else X = x;} X Xbool Xload_fmt_file () X{ X int j; X int k; X ptr p; X ptr q; X int w; X int x; X X undump_int(x); X if (x != MEM_BOT) goto bad_fmt; X undump_int(x); X if (x != MEM_TOP) goto bad_fmt; X undump_int(x); X if (x != TOK_BOT) goto bad_fmt; X undump_int(x); X if (x != TOK_TOP) goto bad_fmt; X undump_int(x); X if (x != EQTB_SIZE) goto bad_fmt; X undump_int(x); X if (x != HASH_PRIME) goto bad_fmt; X undump_int(x); X if (x != HYPH_SIZE) goto bad_fmt; X X undump_int(pool_ptr); X undump_int(str_ptr); X undump_int(null_str); X for (k = 0; k <= str_ptr; incr(k)) X undump(0, pool_ptr, str_start[k]); X for (k = 0; k < pool_ptr; incr(k)) X undump_ascii(); X X undump(LO_MEM_STAT_MAX + 1000, HI_MEM_STAT_MIN - 1, lo_mem_max); X undump(LO_MEM_STAT_MAX + 1, lo_mem_max, rover); X p = MEM_BOT; X q = rover; X x = 0; X do { X for (k = p; k <= q + 1; incr(k)) X undump_wd(mem[k]); X p = q + node_size(q); X if (p > lo_mem_max || q >= rlink(q) && rlink(q) != rover) X goto bad_fmt; X q = rlink(q); X } while (q != rover); X for (k = p; k <= lo_mem_max; incr(k)) X undump_wd(mem[k]); X X undump(lo_mem_max + 1, HI_MEM_STAT_MIN, hi_mem_min); X undump(NULL, MEM_TOP, avail); X mem_end = MEM_TOP; X for (k = hi_mem_min; k <= mem_end; incr(k)) X undump_wd(mem[k]); X X undump(TOK_BOT, tok_high, tok_low); X undump(NULL, TOK_TOP, tok_head); X tok_end = TOK_TOP; X for (k = tok_low; k <= tok_end; incr(k)) { X undump_wd(tok_link[k]); X undump_wd(tok[k]); X } X X undump_int(var_used); X undump_int(dyn_used); X undump_int(tok_used); X X k = ACTIVE_BASE; X do { X undump_int(x); X if (x < 1 || k + x > EQTB_SIZE + 1) X goto bad_fmt; X for (j = k; j < k + x; incr(j)) X undump_wd(eqtb[j]); X k += x; X undump_int(x); X if (x < 0 || k + x > EQTB_SIZE + 1) X goto bad_fmt; X for (j = k; j < k + x; incr(j)) X eqtb[j] = eqtb[k - 1]; X k += x; X } while (k <= EQTB_SIZE); X undump(HASH_BASE, FROZEN_CONTROL_SEQUENCE, par_loc); X par_token = CS_TOKEN_FLAG + par_loc; X undump(HASH_BASE, FROZEN_CONTROL_SEQUENCE, write_loc); X X undump(HASH_BASE, FROZEN_CONTROL_SEQUENCE, hash_used); X p = HASH_BASE - 1; X do { X undump(p + 1, hash_used, p); X undump_hh(hash[p]); X } while (p != hash_used); X for (p = hash_used + 1; p < UNDEFINED_CONTROL_SEQUENCE; incr(p)) X undump_hh(hash[p]); X undump_int(cs_count); X X undump_size(7, FONT_MEM_SIZE, "font mem size", fmem_ptr); X for (k = 0; k < fmem_ptr; incr(k)) X undump_wd(font_info[k]); X undump_size(FONT_BASE, FONT_MAX, "font max", font_ptr); X for (k = NULL_FONT; k <= font_ptr; incr(k)) { X undump_qqqq(font_check[k]); X undump_wd(font_size[k]); X undump_wd(font_dsize[k]); X undump(MIN_HALFWORD, MAX_HALFWORD, font_params[k]); X undump_int(hyphen_char[k]); X undump_int(skew_char[k]); X undump(0, str_ptr, font_name[k]); X undump(0, str_ptr, font_area[k]); X undump(0, 255, font_bc[k]); X undump(0, 255, font_ec[k]); X undump_int(char_base[k]); X undump_int(width_base[k]); X undump_int(height_base[k]); X undump_int(depth_base[k]); X undump_int(italic_base[k]); X undump_int(lig_kern_base[k]); X undump_int(kern_base[k]); X undump_int(exten_base[k]); X undump_int(param_base[k]); X undump(MIN_HALFWORD, hi_mem_min, font_glue[k]); X } X X undump(0, HYPH_SIZE, hyph_count); X for (k = 1; k <= hyph_count; incr(k)) { X undump(0, HYPH_SIZE, j); X undump(0, str_ptr, hyph_word[j]); X undump(MIN_HALFWORD, MAX_HALFWORD, hyph_list[j]); X } X undump_size(0, TRIE_SIZE, "trie size", trie_max); X for (k = 0; k <= trie_max; incr(k)) X undump_hh(trie[k]); X undump(MIN_QUARTERWORD, MAX_QUARTERWORD, trie_op_ptr); X for (k = MIN_QUARTERWORD + 1; k <= trie_op_ptr; incr(k)) { X undump(0, 63, hyf_distance[k]); X undump(0, 63, hyf_num[k]); X undump(MIN_QUARTERWORD, MAX_QUARTERWORD, hyf_next[k]); X } X undump(BATCH_MODE, ERROR_STOP_MODE, interaction); X undump(0, str_ptr, format_ident); X undump_int(x); X if (x != 6969 || feof(fmt_file)) goto bad_fmt; X return TRUE; X Xbad_fmt: X print("(Fatal format file error; I'm stymied)"); X return FALSE; X} X X#ifdef INIT X X#define dump_ascii() putc(str_pool[k], fmt_file) X#define dump_int(W) putw(W, fmt_file) X#define dump_hh(W) fwrite(&W, sizeof(W), 1, fmt_file); X#define dump_wd(W) fwrite(&W, sizeof(W), 1, fmt_file); X#define dump_qqqq(W) fwrite(&W, sizeof(W), 1, fmt_file); X Xstore_fmt_file () X{ X int j; X int k; X int l; X ptr p; X ptr q; X fourq w; X int x; X X if (save_ptr != 0) { X print_nl("! You can't \\dump inside a group"); X help1("`{...\\dump}' is a no-no."); X succumb(); X } X selector = NEW_STRING; X print(" (preloaded format="); X print_str(job_name); X print_char(' '); X print_val(abs(year) % 100); X print_char('.'); X print_val(month); X print_char('.'); X print_val(day); X print_char(')'); X if (interaction == BATCH_MODE) X selector = LOG_ONLY; X else selector = TERM_AND_LOG; X str_room(1); X format_ident = make_string(); X pack_job_name(str_fmt); X while ((fmt_file = w_open_out()) == NULL) X prompt_file_name("format file name", str_fmt); X print_nl("Beginning to dump on file "); X print_str(w_make_name_string(fmt_file)); X flush_string(); X print_nl(""); X print_str(format_ident); X X dump_int(MEM_BOT); X dump_int(MEM_TOP); X dump_int(TOK_BOT); X dump_int(TOK_TOP); X dump_int(EQTB_SIZE); X dump_int(HASH_PRIME); X dump_int(HYPH_SIZE); X X dump_int(pool_ptr); X dump_int(str_ptr); X dump_int(null_str); X for (k = 0; k <= str_ptr; incr(k)) X dump_int(str_start[k]); X for (k = 0; k < pool_ptr; incr(k)) X dump_ascii(); X print_ln(); X print_int(str_ptr); X print(" strings of total length "); X print_int(pool_ptr); X X sort_avail(); X var_used = 0; X dump_int(lo_mem_max); X dump_int(rover); X p = MEM_BOT; X q = rover; X x = 0; X do { X for (k = p; k <= q + 1; incr(k)) X dump_wd(mem[k]); X x = x + q + 2 - p; X var_used = var_used + q - p; X p = q + node_size(q); X q = rlink(q); X } while (q != rover); X var_used = var_used + lo_mem_max - p; X dyn_used = mem_end + 1 - hi_mem_min; X for (k = p; k <= lo_mem_max; incr(k)) X dump_wd(mem[k]); X x = x + lo_mem_max + 1 - p; X dump_int(hi_mem_min); X dump_int(avail); X for (k = hi_mem_min; k <= mem_end; incr(k)) X dump_wd(mem[k]); X x = x + mem_end + 1 - hi_mem_min; X for (p = avail; p != NULL; p = link(p)) X decr(dyn_used); X tok_used = tok_end + 1 - tok_low; X dump_int(tok_low); X dump_int(tok_head); X for (k = tok_low; k <= tok_end; incr(k)) { X dump_wd(tok_link[k]); X dump_wd(tok[k]); X } X for (p = tok_head; p != NULL; p = token_link(p)) X decr(tok_used); X x = x + tok_end + 1 - tok_low; X dump_int(var_used); X dump_int(dyn_used); X dump_int(tok_used); X print_ln(); X print_int(x); X print(" memory locations dumped; current usage is "); X print_int(var_used); X print_char(','); X print_int(dyn_used); X print_char(','); X print_int(tok_used); X X k = ACTIVE_BASE; X do { X for (j = k; j < INT_BASE - 1; incr(j)) X if (equiv(j) == equiv(j + 1) && X eq_type(j) == eq_type(j + 1) && X eq_level(j) == eq_level(j + 1)) X goto found1; X l = INT_BASE; X goto done1; X X found1: X incr(j); X l = j; X for (; j < INT_BASE - 1; incr(j)) X if (equiv(j) != equiv(j + 1) || X eq_type(j) != eq_type(j + 1) || X eq_level(j) != eq_level(j + 1)) X goto done1; X X done1: X dump_int(l - k); X for (; k < l; incr(k)) X dump_wd(eqtb[k]); X k = j + 1; X dump_int(k - l); X } while (k != INT_BASE); X X do { X for (j = k; j < EQTB_SIZE; incr(j)) X if (eqtb[j].i == eqtb[j + 1].i) X goto found2; X l = EQTB_SIZE + 1; X goto done2; X X found2: X incr(j); X l = j; X for (; j < EQTB_SIZE; incr(j)) X if (eqtb[j].i != eqtb[j + 1].i) X goto done2; X X done2: X dump_int(l - k); X for (; k < l; incr(k)) X dump_wd(eqtb[k]); X k = j + 1; X dump_int(k - l); X } while (k <= EQTB_SIZE); X dump_int(par_loc); X dump_int(write_loc); X X dump_int(hash_used); X cs_count = FROZEN_CONTROL_SEQUENCE - 1 - hash_used; X for (p = HASH_BASE; p <= hash_used; incr(p)) X if (text(p) != 0) { X dump_int(p); X dump_hh(hash[p]); X incr(cs_count); X } X for (p = hash_used + 1; p < UNDEFINED_CONTROL_SEQUENCE; incr(p)) X dump_hh(hash[p]); X dump_int(cs_count); X print_ln(); X print_int(cs_count); X print(" multiletter control sequences"); X X dump_int(fmem_ptr); X for (k = 0; k < fmem_ptr; incr(k)) X dump_wd(font_info[k]); X dump_int(font_ptr); X for (k = NULL_FONT; k <= font_ptr; incr(k)) { X dump_qqqq(font_check[k]); X dump_wd(font_size[k]); X dump_wd(font_dsize[k]); X dump_int(font_params[k]); X dump_int(hyphen_char[k]); X dump_int(skew_char[k]); X dump_int(font_name[k]); X dump_int(font_area[k]); X dump_int(font_bc[k]); X dump_int(font_ec[k]); X dump_int(char_base[k]); X dump_int(width_base[k]); X dump_int(height_base[k]); X dump_int(depth_base[k]); X dump_int(italic_base[k]); X dump_int(lig_kern_base[k]); X dump_int(kern_base[k]); X dump_int(exten_base[k]); X dump_int(param_base[k]); X dump_int(font_glue[k]); X print_nl("\\font"); X print_esc(""); X print_str(font_id_text(k)); X print_char('='); X print_file_name(font_name[k], font_area[k], null_str); X if (font_size[k] != font_dsize[k]) { X print(" at "); X print_scaled(font_size[k]); X print("pt"); X } X } X print_ln(); X print_int(fmem_ptr - 7); X print(" words of font info for "); X print_int(font_ptr - FONT_BASE); X print(" preloaded font"); X if (font_ptr != FONT_BASE + 1) X print_char('s'); X dump_int(hyph_count); X for (k = 0; k <= HYPH_SIZE; incr(k)) X if (hyph_word[k] != 0) { X dump_int(k); X dump_int(hyph_word[k]); X dump_int(hyph_list[k]); X } X dump_int(trie_max); X for (k = 0; k <= trie_max; incr(k)) X dump_hh(trie[k]); X dump_int(trie_op_ptr); X for (k = MIN_QUARTERWORD + 1; k <= trie_op_ptr; incr(k)) { X dump_int(hyf_distance[k]); X dump_int(hyf_num[k]); X dump_int(hyf_next[k]); X } X print_ln(); X print_int(hyph_count); X print(" hyphenation exception"); X if (hyph_count != 1) X print_char('s'); X print_nl("Hyphenation trie of length "); X print_int(trie_max); X print(" has "); X print_int(qo(trie_op_ptr)); X print(" op"); X if (trie_op_ptr != MIN_QUARTERWORD + 1) X print_char('s'); X X dump_int(interaction); X dump_int(format_ident); X dump_int(6969); X w_close(fmt_file); X tracing_stats = 0; X} X#endif SHAR_EOF chmod 0444 fmt.c || echo "restore of fmt.c fails" set `wc -c fmt.c`;Sum=$1 if test "$Sum" != "11010" then echo original size 11010, current size $Sum;fi echo "x - extracting fmt.h (Text)" sed 's/^X//' << 'SHAR_EOF' > fmt.h && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * fmt.h X */ X Xglobal word_file fmt_file; X Xglobal str format_ident; X Xbool load_fmt_file(); X X#ifdef INIT Xint store_fmt_file(); X#endif SHAR_EOF chmod 0444 fmt.h || echo "restore of fmt.h fails" set `wc -c fmt.h`;Sum=$1 if test "$Sum" != "350" then echo original size 350, current size $Sum;fi echo "x - extracting hash.c (Text)" sed 's/^X//' << 'SHAR_EOF' > hash.c && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * hash.c X */ X X#include "tex.h" X#include "cmds.h" X#include "heap.h" X#include "box.h" X#include "scan.h" X#include "eq.h" X#include "io.h" X#include "math.h" X#include "boxlists.h" X#include "str.h" X#include "error.h" X#include "hash.h" X Xtwoh hash[UNDEFINED_CONTROL_SEQUENCE+1]; Xptr hash_used = FROZEN_CONTROL_SEQUENCE; Xbool no_new_control_sequence = TRUE; Xint cs_count = 0; X Xptr Xid_lookup (j, l) X int j; X int l; X{ X int h; X int k; SHAR_EOF echo "End of part 8" echo "File hash.c is continued in part 9" echo "9" > s2_seq_.tmp exit 0
glenn@extro.ucc.su.oz.au (G Geers) (02/16/90)
---- Cut Here and unpack ---- #!/bin/sh # this is part 9 of a multipart archive # do not concatenate these parts, unpack them in order with /bin/sh # file hash.c continued # CurArch=9 if test ! -r s2_seq_.tmp then echo "Please unpack part 1 first!" exit 1; fi ( read Scheck if test "$Scheck" != $CurArch then echo "Please unpack part $Scheck next!" exit 1; else exit 0; fi ) < s2_seq_.tmp || exit 1 echo "x - Continuing file hash.c" sed 's/^X//' << 'SHAR_EOF' >> hash.c X ptr p; X X h = buffer[j]; X for (k = j + 1; k < j + l; incr(k)) { X h = h + h + buffer[k]; X while (h >= HASH_PRIME) X h -= HASH_PRIME; X } X for (p = h + HASH_BASE; ; p = next(p)) { X if (text(p) > 0 && length(text(p)) == l) X if (str_eq_buf(text(p), j)) X return p; X if (next(p) == 0) { X if (no_new_control_sequence) X return UNDEFINED_CONTROL_SEQUENCE; X if (text(p) > 0) { X do X if (hash_is_full) X overflow("hash size", HASH_SIZE); X else decr(hash_used); X while (text(hash_used) != 0); X next(p) = hash_used; X p = hash_used; X } X str_room(l); X for (k = j; k < j + l; incr(k)) X append_char(buffer[k]); X text(p) = make_string(); X#ifdef STAT X incr(cs_count); X#endif X return p; X } X } X} X Xprint_cs (p) X ptr p; X{ X if (p < HASH_BASE) { X if (p >= SINGLE_BASE) { X if (p == NULL_CS) { X print_esc("csname"); X print_esc("endcsname"); X } else { X print_esc(""); X print_str(p - SINGLE_BASE); X if (cat_code(p - SINGLE_BASE) == LETTER) X print_char(' '); X } X } else if (p < ACTIVE_BASE) X print_esc("IMPOSSIBLE."); X else print_str(p - ACTIVE_BASE); X } else if (p >= UNDEFINED_CONTROL_SEQUENCE) X print_esc("IMPOSSIBLE."); X else if (text(p) < 0 || text(p) >= str_ptr) X print_esc("NONEXISTENT."); X else { X print_esc(""); X slow_print(text(p)); X print_char(' '); X } X} X Xsprint_cs (p) X ptr p; X{ X if (p < HASH_BASE) { X if (p < SINGLE_BASE) X print_str(p - ACTIVE_BASE); X else if (p < NULL_CS) { X print_esc(""); X print_str(p - SINGLE_BASE); X } else { X print_esc("csname"); X print_esc("endcsname"); X } X } else { X print_esc(""); X slow_print(text(p)); X } X} X X#ifdef INIT Xprimitive (s, c, o) X char* s; X qword c; X hword o; X{ X int j; X int k; X int l; X str new_str; X X if (s[1] == NUL) X cur_val = s[0] + SINGLE_BASE; X else { X new_str = make_string_given(s); X k = str_start[new_str]; X l = length(new_str); X for (j = 0; j < l; incr(j)) X buffer[j] = str_pool[k + j]; X cur_val = id_lookup(0, l); X flush_string(); X text(cur_val) = new_str; X } X eq_level(cur_val) = LEVEL_ONE; X eq_type(cur_val) = c; X equiv(cur_val) = o; X} X#endif SHAR_EOF echo "File hash.c is complete" chmod 0444 hash.c || echo "restore of hash.c fails" set `wc -c hash.c`;Sum=$1 if test "$Sum" != "2748" then echo original size 2748, current size $Sum;fi echo "x - extracting hash.h (Text)" sed 's/^X//' << 'SHAR_EOF' > hash.h && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * hash.h X */ X X#define next(H) hash[H].hh1.lh X#define text(H) hash[H].hh1.rh X#define font_id_text(H) text(FONT_ID_BASE + H) X X#define hash_is_full (hash_used == HASH_BASE) X Xglobal twoh hash[]; Xglobal ptr hash_used; Xglobal bool no_new_control_sequence; Xglobal int cs_count; X Xptr id_lookup(); Xint print_cs(); Xint sprint_cs(); X X#ifdef INIT Xint primitive(); X#endif SHAR_EOF chmod 0444 hash.h || echo "restore of hash.h fails" set `wc -c hash.h`;Sum=$1 if test "$Sum" != "591" then echo original size 591, current size $Sum;fi echo "x - extracting heap.c (Text)" sed 's/^X//' << 'SHAR_EOF' > heap.c && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * heap.c X */ X X#include "tex.h" X#include "eq.h" X#include "arith.h" X#include "box.h" X#include "evalstack.h" X#include "par.h" X#include "page.h" X#include "print.h" X#include "error.h" X#include "heap.h" X Xmword mem[MEM_MAX-MEM_MIN+1]; Xptr mem_end; Xptr lo_mem_max; Xptr hi_mem_min; Xptr avail; Xint dyn_used; Xptr rover; Xint var_used; Xint max_var_used; Xptr temp_ptr; X Xptr Xget_avail () X{ X ptr p; X X p = avail; X if (p != NULL) X avail = link(avail); X else if (mem_end < MEM_MAX) { X incr(mem_end); X p = mem_end; X } else { X decr(hi_mem_min); X p = hi_mem_min; X if (hi_mem_min <= lo_mem_max) { X runaway(); X overflow("main memory size", MEM_MAX - MEM_MIN); X } X } X link(p) = NULL; X#ifdef STAT X incr(dyn_used); X#endif X return p; X} X Xptr Xget_node (s) X int s; X{ X ptr p; X ptr q; X int r; X int t; X Xrestart: X p = rover; X do { X q = p + node_size(p); X while (is_empty(q)) { X t = rlink(q); X if (q == rover) X rover = t; X llink(t) = llink(q); X rlink(llink(q)) = t; X q += node_size(q); X } X r = q - s; X if (r > (int) p + 1) { X node_size(p) = r - p; X rover = p; X goto found; X } X if (r == p && (rlink(p) != rover || llink(p) != rover)) { X rover = rlink(p); X t = llink(p); X llink(rover) = t; X rlink(t) = rover; X goto found; X } X node_size(p) = q - p; X p = rlink(p); X } while (p != rover); X if (s == 010000000000) X return MAX_HALFWORD; X if (lo_mem_max + 2 < hi_mem_min && X lo_mem_max + 2 <= MEM_BOT + MAX_HALFWORD) { X if (lo_mem_max + 1000 < hi_mem_min) X t = lo_mem_max + 1000; X else t = (lo_mem_max + hi_mem_min + 2) / 2; X p = llink(rover); X q = lo_mem_max; X rlink(p) = q; X llink(rover) = q; X if (t > MEM_BOT + MAX_HALFWORD) X t = MEM_BOT + MAX_HALFWORD; X rlink(q) = rover; X llink(q) = p; X link(q) = EMPTY_FLAG; X node_size(q) = t - lo_mem_max; X lo_mem_max = t; X link(lo_mem_max) = NULL; X info(lo_mem_max) = NULL; X rover = q; X goto restart; X } X X overflow("main memory size", MEM_MAX + 1 - MEM_MIN); X Xfound: X link(r) = NULL; X#ifdef STAT X var_used += s; X#endif X return r; X} X Xfree_node (p, s) X ptr p; X hword s; X{ X ptr q; X X node_size(p) = s; X link(p) = EMPTY_FLAG; X q = llink(rover); X llink(p) = q; X rlink(p) = rover; X llink(rover) = p; X rlink(q) = p; X#ifdef STAT X var_used -= s; X#endif X} X Xinit_mem () X{ X int k; X X#ifdef INIT X for (k = MEM_BOT + 1; k <= LO_MEM_STAT_MAX; k++) X mem[k].sc = 0; X for (k = MEM_BOT; k <= LO_MEM_STAT_MAX; k += GLUE_SPEC_SIZE) { X glue_ref_count(k) = NULL + 1; X stretch_order(k) = NORMAL; X shrink_order(k) = NORMAL; X } X stretch(fil_glue) = UNITY; X stretch_order(fil_glue) = FIL; X stretch(fill_glue) = UNITY; X stretch_order(fill_glue) = FILL; X stretch(ss_glue) = UNITY; X stretch_order(ss_glue) = FIL; X shrink(ss_glue) = UNITY; X shrink_order(ss_glue) = FIL; X stretch(fil_neg_glue) = -UNITY; X stretch_order(fil_neg_glue) = FIL; X X rover = LO_MEM_STAT_MAX + 1; X link(rover) = EMPTY_FLAG; X node_size(rover) = 1000; X llink(rover) = rover; X rlink(rover) = rover; X X lo_mem_max = rover + 1000; X link(lo_mem_max) = NULL; X info(lo_mem_max) = NULL; X for (k = HI_MEM_STAT_MIN; k <= MEM_TOP; incr(k)) X mem[k] = mem[lo_mem_max]; X X link(end_span) = MAX_QUARTERWORD + 1; X info(end_span) = NULL; X type(last_active) = HYPHENATED; X subtype(last_active) = 0; X line_number(last_active) = MAX_HALFWORD; X type(page_ins_head) = SPLIT_UP; X subtype(page_ins_head) = qi(255); X link(page_ins_head) = page_ins_head; X type(page_head) = GLUE_NODE; X subtype(page_head) = NORMAL; X X avail = NULL; X mem_end = MEM_TOP; X hi_mem_min = HI_MEM_STAT_MIN; X var_used = LO_MEM_STAT_MAX + 1 - MEM_BOT; X dyn_used = HI_MEM_STAT_USAGE; X#endif X} X Xsort_avail() X{ X ptr p; X ptr q; X ptr r; X ptr old_rover; X X#ifdef INIT X get_node(010000000000); X p = rlink(rover); X rlink(rover) = MAX_HALFWORD; X old_rover = rover; X while (p != old_rover) { X if (p < rover) { X q = p; X p = rlink(q); X rlink(q) = rover; X rover = q; X } else { X q = rover; X while (rlink(q) < p) X q = rlink(q); X r = rlink(p); X rlink(p) = rlink(q); X rlink(q) = p; X p = r; X } X } X p = rover; X while (rlink(p) != MAX_HALFWORD) { X llink(rlink(p)) = p; X p = rlink(p); X } X rlink(p) = rover; X llink(rover) = p; X#endif X} SHAR_EOF chmod 0444 heap.c || echo "restore of heap.c fails" set `wc -c heap.c`;Sum=$1 if test "$Sum" != "4344" then echo original size 4344, current size $Sum;fi echo "x - extracting heap.h (Text)" sed 's/^X//' << 'SHAR_EOF' > heap.h && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * heap.h X */ X X#define qi(M) (M + MIN_QUARTERWORD) X#define qo(M) (M - MIN_QUARTERWORD) X#define hi(M) (M + MIN_HALFWORD) X#define ho(M) (M - MIN_HALFWORD) X X#ifdef NULL X#undef NULL X#endif X#define NULL MIN_HALFWORD X Xglobal mword mem[]; Xglobal ptr lo_mem_max; Xglobal ptr hi_mem_min; X Xglobal int var_used; Xglobal int max_var_used; Xglobal int dyn_used; X X#define link(M) mem[M].hh.hh1.rh X#define info(M) mem[M].hh.hh1.lh X Xglobal ptr avail; Xglobal ptr mem_end; X Xptr get_avail(); X X X#ifdef STAT X#define fast_get_avail(M) \ X {M = avail; \ X if (M == NULL) M = get_avail(); \ X else {avail = link(M); link(M) = NULL; incr(dyn_used);}} X#else X#define fast_get_avail(M) \ X {M = avail; \ X if (M == NULL) M = get_avail(); \ X else {avail = link(M); link(M) = NULL;}} X#endif X X X#ifdef STAT X#define free_avail(M) \ X {link(M) = avail; avail = M; decr(dyn_used);} X#else X#define free_avail(M) \ X {link(M) = avail; avail = M;} X#endif X Xint flush_list(); X X#define is_empty(M) (link(M) == EMPTY_FLAG) X#define EMPTY_FLAG MAX_HALFWORD X#define node_size info X#define llink(M) info(M + 1) X#define rlink(M) link(M + 1) X Xglobal ptr rover; X Xptr get_node(); Xint free_node(); X Xglobal ptr temp_ptr; X X#define zero_glue MEM_BOT X#define fil_glue (zero_glue + GLUE_SPEC_SIZE) X#define fill_glue (fil_glue + GLUE_SPEC_SIZE) X#define ss_glue (fill_glue + GLUE_SPEC_SIZE) X#define fil_neg_glue (ss_glue + GLUE_SPEC_SIZE) X X#define LO_MEM_STAT_MAX (fil_neg_glue + GLUE_SPEC_SIZE - 1) X X#define page_ins_head (MEM_TOP) X#define contrib_head (MEM_TOP - 1) X#define page_head (MEM_TOP - 2) X#define temp_head (MEM_TOP - 3) X#define hold_head (MEM_TOP - 4) X#define adjust_head (MEM_TOP - 5) X#define active (MEM_TOP - 7) X#define align_head (MEM_TOP - 8) X#define end_span (MEM_TOP - 9) X#define lig_trick (MEM_TOP - 10) X#define garbage (MEM_TOP - 10) X X#define HI_MEM_STAT_MIN (MEM_TOP - 10) X#define HI_MEM_STAT_USAGE 11 X Xbool init_mem(); X X#ifdef INIT Xint sort_avail(); X#endif SHAR_EOF chmod 0444 heap.h || echo "restore of heap.h fails" set `wc -c heap.h`;Sum=$1 if test "$Sum" != "2203" then echo original size 2203, current size $Sum;fi echo "x - extracting hyph.c (Text)" sed 's/^X//' << 'SHAR_EOF' > hyph.c && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * hyph.c X */ X X#include "tex.h" X#include "cmds.h" X#include "heap.h" X#include "token.h" X#include "eq.h" X#include "str.h" X#include "tfm.h" X#include "box.h" X#include "scan.h" X#include "tokenstack.h" X#include "par.h" X#include "print.h" X#include "error.h" X#include "hyph.h" X Xptr ha; Xptr hb; Xhword hc[66]; Xfnt hf; Xint hn; Xascii hu[64]; Xbyte hyf[65]; Xint hyf_char; Xint hyf_distance[256]; Xqword hyf_next[256]; Xint hyf_num[256]; Xint hyph_count; Xptr hyph_list[HYPH_SIZE+1]; Xstr hyph_word[HYPH_SIZE+1]; Xint hyphen_passed; Xint trie_max; Xqword trie_op_ptr; Xtwoh trie[TRIE_SIZE+1]; X Xhyphenate () X{ X ascii c; X int h; X int i; X int j; X str k; X int l; X ptr q; X ptr r; X ptr s; X int u; X qword v; X int z; X ptr hyf_node; X ptr major_tail; X ptr minor_tail; X X for (j = 0; j <= hn; incr(j)) X hyf[j] = 0; X h = hc[1]; X for (j = 2; j <= hn; incr(j)) X h = (h + h + hc[j]) % HYPH_SIZE; X loop { X k = hyph_word[h]; X if (k == 0) goto not_found; X if (length(k) < hn) goto not_found; X if (length(k) == hn) { X j = 1; X u = str_start[k]; X do { X if (str_pool[u] < hc[j]) goto not_found; X if (str_pool[u] > hc[j]) goto done; X incr(u); incr(j); X } while (j <= hn); X for (s = hyph_list[h]; s != NULL; s = link(s)) X hyf[info(s)] = 1; X goto found; X } X X done: X if (h > 0) X decr(h); X else h = HYPH_SIZE; X } X Xnot_found: X hc[0] = 127; X hc[hn + 1] = 127; X hc[hn + 2] = 256; X for (j = 0; j <= hn - 2; incr(j)) { X z = hc[j]; X l = j; X while (hc[l] == trie_char(z)) { X if (trie_op(z) != MIN_QUARTERWORD) { X v = trie_op(z); X do { X i = l - hyf_distance[v]; X if (hyf_num[v] > hyf[i]) X hyf[i] = hyf_num[v]; X v = hyf_next[v]; X } while (v != MIN_QUARTERWORD); X } X incr(l); X z = trie_link(z) + hc[l]; X } X } X Xfound: X hyf[1] = 0; X hyf[hn - 2] = 0; X hyf[hn - 1] = 0; X hyf[hn] = 0; X X for (j = 2; j <= hn - 3; incr(j)) X if (odd(hyf[j])) goto found1; X return; X Xfound1: X q = link(hb); X link(hb) = NULL; X s = cur_p; X while (link(s) != ha) X s = link(s); X link(s) = NULL; X flush_node_list(ha); X j = 0; X do { X l = j; X j = reconstitute(j + 1, hn); X if (hyphen_passed != 0) { X r = get_node(SMALL_NODE_SIZE); X link(s) = r; X link(r) = link(hold_head); X type(r) = DISC_NODE; X major_tail = link(hold_head); X if (link(major_tail) != NULL) X major_tail = link(major_tail); X i = hyphen_passed; X minor_tail = NULL; X hyf_node = new_character(hf, (ascii) hyf_char); X if (hyf_node != NULL) { X incr(i); X c = hu[i]; X hu[i] = hyf_char; X } X do { X l = reconstitute(l + 1, i); X if (minor_tail == NULL) X pre_break(r) = link(hold_head); X else link(minor_tail) = link(hold_head); X minor_tail = link(hold_head); X if (link(minor_tail) != NULL) X minor_tail = link(minor_tail); X } while (l != i); X if (hyf_node != NULL) { X hu[i] = c; X free_avail(hyf_node); X decr(i); X l = i; X } X hyf[i] = 0; X minor_tail = NULL; X post_break(r) = NULL; X while (l < j) { X do { X l = reconstitute(l + 1, hn); X if (minor_tail == NULL) X post_break(r) = link(hold_head); X else link(minor_tail) = link(hold_head); X minor_tail = link(hold_head); X if (link(minor_tail) != NULL) { X hyf[l] = 0; X minor_tail = link(minor_tail); X } X } while (l < j); X while (l > j) { X j = reconstitute(j + 1, hn); X link(major_tail) = link(hold_head); X major_tail = link(hold_head); X if (link(major_tail) != NULL) { X hyf[j] = 0; X major_tail = link(major_tail); X } X } X } X i = 0; X s = r; X while(link(s) != NULL) { X incr(i); X s = link(s); X } X replace_count(r) = i; X } else { X link(s) = link(hold_head); X s = link(s); X if (link(s) != NULL) X s = link(s); X } X if (odd(hyf[j])) { X r = new_disc(); X pre_break(r) = new_character(hf, (ascii) hyf_char); X link(s) = r; X s = r; X } X } while (j != hn); X link(s) = q; X} X Xreconstitute (j, n) X int j; X int n; X{ X qword c; X qword d; X ptr p; X fourq q; X int r; X ptr s; X scal w; X X hyphen_passed = 0; X s = hold_head; X w = 0; X c = d = qi(hu[j]); X loop { Xcontin: p = get_avail(); X font(p) = hf; X character(p) = c; X link(s) = p; X if (j == n) break; X q = char_info(hf, d); X if (char_tag(q) != LIG_TAG) break; X r = lig_kern_start(hf, q); X c = qi(hu[j + 1]); X loop { X q = font_info[r].qqqq; X if (next_char(q) == c) { X if (odd(hyf[j]) && hyphen_passed == 0) X hyphen_passed = j; X if (op_bit(q) < KERN_FLAG) { X d = rem_byte(q); X incr(j); X s = p; X goto contin; X } else { X w = char_kern(hf, q); X goto done; X } X } else if (stop_bit(q) < STOP_FLAG) X incr(r); X else goto done; X } X } X Xdone: X if (s != hold_head) { X p = new_ligature(hf, d, link(hold_head)); X link(hold_head) = p; X } X if (w != 0) X link(link(hold_head)) = new_kern(w); X return j; X} X Xnew_hyph_exceptions () X{ X int h; X int j; X str k; X int n; X ptr p; X ptr q; X str s; X str t; X int u; X int v; X X n = 0; X p = NULL; X scan_left_brace(); X loop { X get_x_token(); X X reswitch: X switch (cur_cmd) X { X case LETTER: X case OTHER_CHAR: X case CHAR_GIVEN: X if (cur_chr == '-') { X if (n > 1) { X q = get_avail(); X link(q) = p; X info(q) = n; X p = q; X } X } else { X if (cur_chr > 127 || lc_code(cur_chr) == 0) { X print_err("Not a letter"); X help_hyph_lccode(); X error(); X } else if (n < 63) { X incr(n); X hc[n] = lc_code(cur_chr) - 1; X } X } X break; X X case CHAR_NUM: X scan_char_num(); X cur_chr = cur_val; X cur_cmd = CHAR_GIVEN; X goto reswitch; X break; X X case SPACER: X case RIGHT_BRACE: X if (n > 4) { X str_room(n); X h = 0; X for (j = 1; j <= n; incr(j)) { X h = (h + h + hc[j]) % HYPH_SIZE; X append_char(hc[j]); X } X s = make_string(); X loop { X if (p == NULL) X break; X if (info(p) < n - 2) X break; X q = link(p); X free_avail(p); X p = q; X } X if (hyph_count == HYPH_SIZE) X overflow("exception dictionary", HYPH_SIZE); X incr(hyph_count); X while (hyph_word[h] != 0) { X k = hyph_word[h]; X if (length(k) < length(s)) X goto found; X if (length(k) > length(s)) X goto not_found; X u = str_start[k]; X v = str_start[s]; X do { X if (str_pool[u] < str_pool[v]) X goto found; X if (str_pool[u] > str_pool[v]) X goto not_found; X incr(u); incr(v); X } while (u != str_start[k + 1]); X X found: X q = hyph_list[h]; X hyph_list[h] = p; X p = q; X t = hyph_word[h]; X hyph_word[h] = s; X s = t; X X not_found: X if (h > 0) X decr(h); X else h = HYPH_SIZE; X } X hyph_word[h] = s; X hyph_list[h] = p; X } X if (cur_cmd == RIGHT_BRACE) X return; X n = 0; X p = NULL; X break; X X default: X print_err("Improper "); X print_esc("hyphenation"); X print(" will be flushed"); X help_hyph(); X error(); X break; X } X } X} X X/* X * Help text X */ X Xhelp_hyph_lccode () X{ X help2("Letters in \\hyphenation words must have \\lccode > 0", X "Proceed; I'll ignore the character I just read."); X} X Xhelp_hyph () X{ X help2("Hyphenation exceptions must contain only letters", X "and hyphens. But continue; I'll forgive and forget."); X} X X#ifdef INIT X Xqword trie_op_hash[TRIE_OP_HASH_SIZE+1]; Xqword trie_op_ptr; X Xint trie_hash[TRIE_SIZE+1]; Xascii trie_c[TRIE_SIZE+1]; Xqword trie_o[TRIE_SIZE+1]; Xint trie_l[TRIE_SIZE+1]; Xint trie_r[TRIE_SIZE+1]; Xint trie_min; Xint trie_ptr; Xbool trie_taken[TRIE_SIZE+1]; X Xqword Xnew_trie_op (d, n, v) X int d; X int n; X qword v; X{ X int h; X qword u; X X/* h = abs((n + 313 * d + 361 * v)) % TRIE_OP_HASH_SIZE; */ X if ((h=(n+313*d+361*v))<0) X h=(-h); /* patch to overcome a bug in /lib/ccom X ** on Dual DHD 3/89 X */ X h %= TRIE_OP_HASH_SIZE; X loop { X u = trie_op_hash[h]; X if (u == MIN_QUARTERWORD) { X if (trie_op_ptr == MAX_QUARTERWORD) X return MIN_QUARTERWORD; X incr(trie_op_ptr); X hyf_distance[trie_op_ptr] = d; X hyf_num[trie_op_ptr] = n; X hyf_next[trie_op_ptr] = v; X trie_op_hash[h] = trie_op_ptr; X return trie_op_ptr; X } X if (hyf_distance[u] == d && X hyf_num[u] == n && X hyf_next[u] == v) X return u; X if (h > 0) X decr(h); X else h = TRIE_OP_HASH_SIZE; X } X} X Xtrie_node (p) X int p; X{ X int h; X int q; X X/* h = abs(trie_c[p] + X 1009 * trie_o[p] + X 2718 * trie_l[p] + X 3142 * trie_r[p]) X % TRIE_SIZE; */ X if ((h = (trie_c[p] + X 1009 * trie_o[p] + X 2718 * trie_l[p] + X 3142 * trie_r[p])) < 0) X h = (-h); X h %= TRIE_SIZE; /* Similar patch to above */ X loop { X q = trie_hash[h]; X if (q == 0) { X trie_hash[h] = p; X return p; X } X if (trie_c[q] == trie_c[p] && X trie_o[q] == trie_o[p] && X trie_l[q] == trie_l[p] && X trie_r[q] == trie_r[p]) X return q; X if (h > 0) X decr(h); X else h = TRIE_SIZE; X } X} X Xcompress_trie (p) X int p; X{ X if (p == 0) X return 0; X else { X trie_l[p] = compress_trie(trie_l[p]); X trie_r[p] = compress_trie(trie_r[p]); X return (trie_node(p)); X } X} X Xinit_pattern_memory () X{ X int h; X int p; X X for (h = 0; h <= TRIE_OP_HASH_SIZE; incr(h)) X trie_op_hash[h] = MIN_QUARTERWORD; X trie_op_ptr = MIN_QUARTERWORD; X trie_root = 0; X trie_c[0] = 0; X trie_ptr = 0; X for (p = 0; p <= TRIE_SIZE; incr(p)) X trie_hash[p] = 0; X} X Xinit_trie_memory () X{ X int p; X X for (p = 0; p <= trie_ptr; incr(p)) X trie_ref[p] = 0; X trie_max = trie_min = 128; X trie_link(0) = 1; X trie_taken[0] = FALSE; X for (p = 1; p <= 128; p++) { X trie_back(p) = p - 1; X trie_link(p) = p + 1; X trie_taken[p] = FALSE; X } X} X Xfirst_fit (p) X int p; X{ X ascii c; X int h; X int q; X int z; X X c = trie_c[p]; X if (c < trie_min) X trie_min = c; X z = trie_link(trie_min - 1); X loop { X if (z < c) X goto not_found; X h = z - c; X if (trie_max < h + 128) { X if (TRIE_SIZE <= h + 128) X overflow("pattern memory", TRIE_SIZE); X do { X incr(trie_max); X trie_taken[trie_max] = FALSE; X trie_link(trie_max) = trie_max + 1; X trie_back(trie_max) = trie_max - 1; X } while (trie_max != h + 128); X } X if (trie_taken[h]) X goto not_found; X for (q = trie_r[p]; q > 0; q = trie_r[q]) X if (trie_link(h + trie_c[q]) == 0) X goto not_found; X goto found; X X not_found: X z = trie_link(z); X } X Xfound: X trie_taken[h] = TRUE; X trie_ref[p] = h; X q = p; X do { X z = h + trie_c[q]; X trie_back(trie_link(z)) = trie_back(z); X trie_link(trie_back(z)) = trie_link(z); X trie_link(z) = 0; X q = trie_r[q]; X } while (q != 0); X} X Xtrie_pack (p) X int p; X{ X int q; X X do { X q = trie_l[p]; X if (q > 0 && trie_ref[q] == 0) { X first_fit(q); X trie_pack(q); X } X p = trie_r[p]; X } while (p != 0); X} X Xtrie_fix (p) X int p; X{ X ascii c; X int q; X int z; X X z = trie_ref[p]; X while (p != 0) { X q = trie_l[p]; X c = trie_c[p]; X trie_link(z + c) = trie_ref[q]; X trie_char(z + c) = c; X trie_op(z + c) = trie_o[p]; X if (q > 0) X trie_fix(q); X p = trie_r[p]; X } X} X Xnew_patterns () X{ X ascii c; X twoh h; X int k; X int l; X int p; X int q; X int r; X int s; X qword v; X bool digit_sensed; X bool first_child; X X scan_left_brace(); X init_pattern_memory(); X k = 0; X hyf[0] = 0; X digit_sensed = FALSE; X loop { X get_x_token(); X switch (cur_cmd) X { X case LETTER: X case OTHER_CHAR: X if (digit_sensed || cur_chr < '0' || cur_chr > '9') { X if (cur_chr == '.') X cur_chr = 128; X else { X cur_chr = lc_code(cur_chr); X if (cur_chr == 0) { X print_err("Nonletter"); X help1("(See Appendix H.)"); X error(); X cur_chr = 128; X } X } X if (k < 63) { X incr(k); X hc[k] = cur_chr - 1; X hyf[k] = 0; X digit_sensed = FALSE; X } X } else { X hyf[k] = cur_chr - '0'; X if (k < 63) X digit_sensed = TRUE; X } X break; X X case SPACER: X case RIGHT_BRACE: X if (k > 0) { X if (hc[1] == 127) X hyf[0] = 0; X if (hc[k] == 127) X hyf[k] = 0; X l = k; X v = MIN_QUARTERWORD; X loop { X if (hyf[l] != 0) X v = new_trie_op(k - l, hyf[l], v); X if (l > 0) X decr(l); X else break; X } X q = 0; X while (l < k) { X incr(l); X c = hc[l]; X p = trie_l[q]; X first_child = TRUE; X while (p > 0 && c > trie_c[p]) { X q = p; X p = trie_r[q]; X first_child = FALSE; X } X if (p == 0 || c < trie_c[p]) { X if (trie_ptr == TRIE_SIZE) X overflow("pattern memory", TRIE_SIZE); X incr(trie_ptr); X trie_r[trie_ptr] = p; X p = trie_ptr; X trie_l[p] = 0; X if (first_child) X trie_l[q] = p; X else trie_r[q] = p; X trie_c[p] = c; X trie_o[p] = MIN_QUARTERWORD; X } X q = p; X } X if (trie_o[q] != MIN_QUARTERWORD) { X print_err("Duplicate pattern"); X help1("(See Appendix H.)"); X error(); X } X trie_o[q] = v; X } X if (cur_cmd == RIGHT_BRACE) X goto done; X k = 0; X hyf[0] = 0; X digit_sensed = FALSE; X break; X X default: X print_err("Bad "); X print_esc("patterns"); X help1("(See Appendix H.)"); X error(); X break; X } X } X Xdone: X trie_root = compress_trie(trie_root); X init_trie_memory(); X if (trie_root != 0) { X first_fit(trie_root); X trie_pack(trie_root); X } X r = 0; X while (trie_taken[r]) X incr(r); X trie_ref[0] = r; X trie_fix(trie_root); X r = 0; X h.hh2.rh = 0; X h.hh2.b0 = 0; X h.hh2.b1 = 0; X do { X s = trie_link(r); X trie[r] = h; X r = s; X } while (r <= trie_max); X} X#endif X Xinit_hyph () X{ X#ifdef INIT X int k; X int z; X X trie_op_ptr = MIN_QUARTERWORD; X trie_link(0) = 0; X trie_char(0) = 0; X trie_op(0) = 0; X for (k = 1; k <= 127; k++) X trie[k] = trie[0]; X trie_max = 127; X for (z = 0; z <= HYPH_SIZE; z++) { X hyph_word[z] = 0; X hyph_list[z] = NULL; X } X hyph_count = 0; X#endif X} SHAR_EOF chmod 0444 hyph.c || echo "restore of hyph.c fails" set `wc -c hyph.c`;Sum=$1 if test "$Sum" != "13684" then echo original size 13684, current size $Sum;fi echo "x - extracting hyph.h (Text)" sed 's/^X//' << 'SHAR_EOF' > hyph.h && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * hyph.h X */ X Xglobal ptr ha; Xglobal ptr hb; Xglobal hword hc[]; Xglobal int hn; Xglobal fnt hf; Xglobal ascii hu[]; Xglobal int hyf_char; X Xint hyphenate(); X Xglobal byte hyf[]; Xglobal int hyphen_passed; X Xint reconstitute(); X X#define trie_link(T) trie[T].hh2.rh X#define trie_char(T) trie[T].hh2.b1 X#define trie_op(T) trie[T].hh2.b0 X Xglobal twoh trie[]; Xglobal qword trie_op_ptr; Xglobal int trie_max; X Xglobal int hyf_distance[]; Xglobal int hyf_num[]; Xglobal qword hyf_next[]; X Xint new_hyph_exceptions(); X Xglobal str hyph_word[]; Xglobal ptr hyph_list[]; Xglobal int hyph_count; X X#ifdef INIT X Xglobal qword trie_op_hash[]; Xglobal int trie_min; X Xqword new_trie_op(); X X#define trie_root trie_l[0] X Xglobal int trie_ptr; Xglobal ascii trie_c[]; Xglobal qword trie_o[]; Xglobal int trie_l[]; Xglobal int trie_r[]; X Xglobal int trie_hash[]; X Xint trie_node(); Xint compress_trie(); X Xint init_pattern_memory(); X X#define trie_ref trie_hash X#define trie_back(T) trie[T].hh1.lh X Xglobal bool trie_taken[]; X Xint init_trie_memory(); X Xint first_fit(); Xint trie_pack(); Xint trie_fix(); X Xint new_patterns(); X X#endif SHAR_EOF chmod 0444 hyph.h || echo "restore of hyph.h fails" set `wc -c hyph.h`;Sum=$1 if test "$Sum" != "1335" then echo original size 1335, current size $Sum;fi echo "x - extracting io.c (Text)" sed 's/^X//' << 'SHAR_EOF' > io.c && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * io.c X */ X X#include "tex.h" X#include "char.h" X#include "str.h" X#include "tokenstack.h" X#include "print.h" X#include "file.h" X#include "io.h" X Xint last; Xascii buffer[BUF_SIZE]; Xint first; Xint max_buf_stack; X XFILE * Xa_open_in () X{ X if (test_access(READ_ACCESS, INPUT_FILE_PATH)) X return (fopen(name_of_file, "r")); X return NULL; X} X XFILE * Xa_open_out () X{ X if (test_access(WRITE_ACCESS, NO_FILE_PATH)) X return (fopen(name_of_file, "w")); X return NULL; X} X XFILE * Xb_open_in () X{ X if (test_access(READ_ACCESS, FONT_FILE_PATH)) X return (fopen(name_of_file, "r")); X return NULL; X} X XFILE * Xb_open_out () X{ X if (test_access(WRITE_ACCESS, NO_FILE_PATH)) X return (fopen(name_of_file, "w")); X return NULL; X} X XFILE * Xw_open_in () X{ X if (test_access(READ_ACCESS, FORMAT_FILE_PATH)) X return (fopen(name_of_file, "r")); X return NULL; X} X XFILE * Xw_open_out () X{ X if (test_access(WRITE_ACCESS, NO_FILE_PATH)) X return (fopen(name_of_file, "w")); X return NULL; X} X Xbool Xinput_ln (f, bypass_eoln) X alpha_file f; X bool bypass_eoln; X{ X int c; X X last = first; X loop { X c = getc(f); X if (c == EOLN) X break; X if (c == EOF) { X if (last == first) X return FALSE; X else X break; X } X if (last > max_buf_stack) { X max_buf_stack = last + 1; X if (max_buf_stack == BUF_SIZE - 1) X overflow("buffer size", BUF_SIZE); X } X buffer[last] = xord[c]; X incr(last); X } X loop { X if (last == first) X break; X else if (buffer[last - 1] != ' ') X break; X else decr(last); X } X return TRUE; X} X Xterm_input () X{ X int k; X X update_terminal(); X if (!input_ln(term_in, FALSE)) X fatal_error("! End of file on the terminal"); X term_offset = 0; X decr(selector); X if (last != first) X for (k = first; k < last; incr(k)) X print_char(buffer[k]); X print_ln(); X incr(selector); X} X Xbool Xinit_terminal () X{ X loop { X fputs("**", stdout); X update_terminal(); X if (!input_ln(term_in, FALSE)) { X puts("\n! End of file on the terminal...why?"); X return FALSE; X } X loc = first; X while (loc < last && buffer[loc] == ' ') X incr(loc); X if (loc < last) X return TRUE; X puts("Please type the name of your input file."); X } X} SHAR_EOF chmod 0444 io.c || echo "restore of io.c fails" set `wc -c io.c`;Sum=$1 if test "$Sum" != "2327" then echo original size 2327, current size $Sum;fi echo "x - extracting io.h (Text)" sed 's/^X//' << 'SHAR_EOF' > io.h && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X */ X X X/* X * io.h X */ X Xglobal int last; Xglobal ascii buffer[]; Xglobal int first; Xglobal int max_buf_stack; X XFILE *a_open_in(); XFILE *a_open_out(); X XFILE *b_open_in(); XFILE *b_open_out(); X XFILE *w_open_in(); XFILE *w_open_out(); X X#define a_close(FD) (fclose(FD)) X#define b_close(FD) (fclose(FD)) X#define w_close(FD) (fclose(FD)) X X#define prompt_input(S) {print(S); term_input();} X Xbool init_terminal(); Xint term_input(); Xbool input_ln(); X X#define term_in stdin X#define term_out stdout X#define t_open_in() X#define t_open_out() X#define update_terminal() fflush(stdout) X#define clear_terminal() SHAR_EOF chmod 0444 io.h || echo "restore of io.h fails" set `wc -c io.h`;Sum=$1 if test "$Sum" != "686" then echo original size 686, current size $Sum;fi echo "x - extracting math.c (Text)" sed 's/^X//' << 'SHAR_EOF' > math.c && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * math.c X */ X X#include "tex.h" X#include "heap.h" X#include "eq.h" X#include "scan.h" X#include "evalstack.h" X#include "arith.h" X#include "str.h" X#include "box.h" X#include "tfm.h" X#include "print.h" X#include "pack.h" X#include "math.h" X Xtwoh empty_field; X Xptr Xnew_style (s) X int s; X{ X ptr p; X X p = get_node(STYLE_NODE_SIZE); X type(p) = STYLE_NODE; X subtype(p) = s; X width(p)= 0; X depth(p) = 0; X X return p; X} X Xptr Xnew_choice () X{ X ptr p; X X p = get_node(STYLE_NODE_SIZE); X type(p) = CHOICE_NODE; X subtype(p) = 0; X display_mlist(p) = NULL; X text_mlist(p) = NULL; X script_mlist(p) = NULL; X script_script_mlist(p) = NULL; X X return p; X} X Xptr Xnew_noad () X{ X ptr p; X X p = get_node(NOAD_SIZE); X type(p) = ORD_NOAD; X subtype(p) = NORMAL; X mem[nucleus(p)].hh = empty_field; X mem[subscr(p)].hh = empty_field; X mem[supscr(p)].hh = empty_field; X X return p; X} X Xprint_fam_and_char (p) X ptr p; X{ X print_esc("fam"); X print_int(fam(p)); X print_char(' '); X print_ASCII(qo(character(p))); X} X Xprint_delimiter (p) X ptr p; X{ X val a; X X a = small_fam(p) * 256 + qo(small_char(p)); X a = a * 0x1000 + large_fam(p) * 256 + qo(large_char(p)); X if (a < 0) X print_val(a); X else print_hex(a); X} X Xprint_subsidiary_data (p, c) X ptr p; X ascii c; X{ X if (cur_length() >= depth_threshold) { X if (math_type(p) != EMPTY) X print(" []"); X return; X } X append_char(c); X temp_ptr = p; X switch (math_type(p)) X { X case MATH_CHAR: X print_ln(); X print_current_string(); X print_fam_and_char(p); X break; X X case SUB_BOX: X show_info(); X break; X X case SUB_MLIST: X if (info(p) == NULL) { X print_ln(); X print_current_string(); X print("{}"); X } else show_info(); X break; X } X flush_char(); X} X Xprint_style (c) X int c; X{ X switch (c / 2) X { X case 0: X print_esc("displaystyle"); X break; X X case 1: X print_esc("textstyle"); X break; X X case 2: X print_esc("scriptstyle"); X break; X X case 3: X print_esc("scriptscriptstyle"); X break; X X default: X print("Unknown style!"); X break; X } X} X Xprint_size (s) X int s; X{ X if (s == 0) X print_esc("textfont"); X else if (s == SCRIPT_SIZE) X print_esc("scriptfont"); X else print_esc("scriptscriptfont"); X} X Xshow_normal_noad (p) X ptr p; X{ X switch (type(p)) X { X case ORD_NOAD: X print_esc("mathord"); X break; X X case OP_NOAD: X print_esc("mathop"); X break; X X case BIN_NOAD: X print_esc("mathbin"); X break; X X case REL_NOAD: X print_esc("mathrel"); X break; X X case OPEN_NOAD: X print_esc("mathopen"); X break; X X case CLOSE_NOAD: X print_esc("mathclose"); X break; X X case PUNCT_NOAD: X print_esc("mathpunct"); X break; X X case INNER_NOAD: X print_esc("mathinner"); X break; X X case OVER_NOAD: X print_esc("overline"); X break; X X case UNDER_NOAD: X print_esc("underline"); X break; X X case VCENTER_NOAD: X print_esc("vcenter"); X break; X X case RADICAL_NOAD: X print_esc("radical"); X print_delimiter(left_delimiter(p)); X break; X X case ACCENT_NOAD: X print_esc("accent"); X print_fam_and_char(accent_chr(p)); X break; X X case LEFT_NOAD: X print_esc("left"); X print_delimiter(nucleus(p)); X break; X X case RIGHT_NOAD: X print_esc("right"); X print_delimiter(nucleus(p)); X break; X X } X if (subtype(p) != NORMAL) X if (subtype(p) == LIMITS) X print_esc("limits"); X else print_esc("nolimits"); X if (type(p) < LEFT_NOAD) X print_subsidiary_data(nucleus(p), '.'); X print_subsidiary_data(supscr(p), '^'); X print_subsidiary_data(subscr(p), '_'); X} X Xshow_fraction_noad (p) X ptr p; X{ X print_esc("fraction, thickness "); X if (thickness(p) == DEFAULT_CODE) X print("= default"); X else print_scaled(thickness(p)); X if (small_fam(left_delimiter(p)) != 0 || X small_char(left_delimiter(p)) != MIN_QUARTERWORD || X large_fam(left_delimiter(p)) != 0 || X large_char(left_delimiter(p)) != MIN_QUARTERWORD) { X print(", left-delimiter "); X print_delimiter(left_delimiter(p)); X } X if (small_fam(right_delimiter(p)) != 0 || X small_char(right_delimiter(p)) != MIN_QUARTERWORD || X large_fam(right_delimiter(p)) != 0 || X large_char(right_delimiter(p)) != MIN_QUARTERWORD) { X print(", right-delimiter "); X print_delimiter(right_delimiter(p)); X } X print_subsidiary_data(numerator(p), '\\'); X print_subsidiary_data(denominator(p), '/'); X} X Xshow_choice_node (p) X ptr p; X{ X print_esc("mathchoice"); X append_char('D'); X show_node_list(display_mlist(p)); X flush_char(); X append_char('T'); X show_node_list(text_mlist(p)); X flush_char(); X append_char('S'); X show_node_list(script_mlist(p)); X flush_char(); X append_char('s'); X show_node_list(script_script_mlist(p)); X flush_char(); X} X Xptr Xfraction_rule (t) X scal t; X{ X ptr p; X X p = new_rule(); X height(p) = t; X depth(p) = 0; X X return p; X} X Xptr Xoverbar (b, k, t) X ptr b; X scal k; X scal t; X{ X ptr p; X ptr q; X X p = new_kern(k); X link(p) = b; X q = fraction_rule(t); X link(q) = p; X p = new_kern(t); X link(p) = q; X return (vpack(p, NATURAL)); X} X Xptr Xvar_delimiter (d, s, v) X ptr d; X int s; X scal v; X{ X ptr b; X qword c; X fnt f; X fnt g; X int m; X int n; X fourq q; X fourq r; X scal u; X scal w; X qword x; X qword y; X int z; X byte hd; X bool large_attempt; X X f = NULL_FONT; X w = 0; X large_attempt = FALSE; X z = small_fam(d); X x = small_char(d); X loop { X if (z != 0 || x != MIN_QUARTERWORD) { X z = z + s + 16; X do { X z = z - 16; X g = fam_fnt(z); X if (g != NULL_FONT) { X y = x; X contin: X if (qo(y) >= font_bc[g] && qo(y) <= font_ec[g]) { X q = char_info(g, y); X if (char_exists(q)) { X if (char_tag(q) == EXT_TAG) { X f = g; X c = y; X goto found; X } X hd = height_depth(q); X u = char_height(g, hd) + char_depth(g, hd); X if (u > w) { X f = g; X c = y; X w = u; X if (u >= v) X goto found; X } X if (char_tag(q) == LIST_TAG) { X y = rem_byte(q); X goto contin; X } X } X } X } X } while (z >= 16); X } X if (large_attempt) X goto found; X large_attempt = TRUE; X z = large_fam(d); X x = large_char(d); X } X Xfound: X if (f != NULL_FONT) { X if (char_tag(q) == EXT_TAG) { X b = new_null_box(); X type(b) = VLIST_NODE; X r = font_info[exten_base[f] + rem_byte(q)].qqqq; X c = ext_rep(r); X u = height_plus_depth(f, c); X w = 0; X q = char_info(f, c); X width(b) = char_width(f, q) + char_italic(f, q); X c = ext_bot(r); X if (c != MIN_QUARTERWORD) X w += height_plus_depth(f, c); X c = ext_mid(r); X if (c != MIN_QUARTERWORD) X w += height_plus_depth(f, c); X c = ext_top(r); X if (c != MIN_QUARTERWORD) X w += height_plus_depth(f, c); X n = 0; X if (u > 0) { X while (w < v) { X w = w + u; X incr(n); X if (ext_mid(r) != MIN_QUARTERWORD) X w = w + u; X } X } X c = ext_bot(r); X if (c != MIN_QUARTERWORD) X stack_into_box(b, f, c); X c = ext_rep(r); X for (m = 1; m <= n; incr(m)) X stack_into_box(b, f, c); X c = ext_mid(r); X if (c != MIN_QUARTERWORD) { X stack_into_box(b, f, c); X c = ext_rep(r); X for (m = 1; m <= n; incr(m)) X stack_into_box(b, f, c); X } X c = ext_top(r); X if (c != MIN_QUARTERWORD) X stack_into_box(b, f, c); X depth(b) = w - height(b); X } else X b = char_box(f, c); X } else { X b = new_null_box(); X width(b) = null_delimiter_space; X } X shift_amount(b) = half(height(b) - depth(b)) - axis_height(s); X return b; X} X Xptr Xchar_box (f, c) X fnt f; X qword c; X{ X ptr b; X ptr p; X fourq q; X byte hd; X X q = char_info(f, c); X hd = height_depth(q); X b = new_null_box(); X width(b) = char_width(f, q) + char_italic(f, q); X height(b) = char_height(f, hd); X depth(b) = char_depth(f, hd); X p = get_avail(); X character(p) = c; X font(p) = f; X list_ptr(b) = p; X X return b; X} X Xstack_into_box (b, f, c) X ptr b; X fnt f; X qword c; X{ X ptr p; X X p = char_box(f, c); X link(p) = list_ptr(b); X list_ptr(b) = p; X height(b) = height(p); X} X Xscal Xheight_plus_depth (f, c) X fnt f; X qword c; X{ X fourq q; X byte hd; X X q = char_info(f, c); X hd = height_depth(q); X return (char_height(f, hd) + char_depth(f, hd)); X} X Xptr Xrebox (b, w) X ptr b; X scal w; X{ X fnt f; X ptr p; X scal v; X X if (width(b) != w && list_ptr(b) != NULL) { X if (type(b) == VLIST_NODE) X b = hpack(b, NATURAL); X p = list_ptr(b); X if (is_char_node(p) && link(p) == NULL) { X f = font(p); X v = char_width(f, char_info(f, character(p))); X if (v != width(b)) X link(p) = new_kern(width(b) - v); X } X free_node(b, BOX_NODE_SIZE); X b = new_glue(ss_glue); X link(b) = p; X while (link(p) != NULL) X p = link(p); X link(p) = new_glue(ss_glue); X return (hpack(b, w, EXACTLY)); X } else { X width(b) = w; X return b; X } X} X X#define mu_mult(x) \ X nx_plus_y(n, x, xn_over_d(x, f, 0200000L)) X Xptr Xmath_glue (g, m) X ptr g; X scal m; X{ X scal f; X val n; X ptr p; X X n = x_over_n(m, 0200000L); X f = remainder; X p = get_node(GLUE_SPEC_SIZE); X width(p) = mu_mult(width(g)); X stretch_order(p) = stretch_order(g); X if (stretch_order(p) == NORMAL) X stretch(p) = mu_mult(stretch(g)); X else stretch(p) = stretch(g); X shrink_order(p) = shrink_order(g); X if (shrink_order(p) == NORMAL) X shrink(p) = mu_mult(shrink(g)); X else shrink(p) = shrink(g); X X return p; X} X Xmath_kern (p, m) X ptr p; X scal m; X{ X scal f; X val n; X X if (subtype(p) == MU_GLUE) { X n = x_over_n(m, 0200000L); X f = remainder; X width(p) = mu_mult(width(p)); X subtype(p) = NORMAL; X } X} X Xflush_math () X{ X flush_node_list(link(head)); X flush_node_list(incompleat_noad); X link(head) = NULL; X tail = head; X incompleat_noad = NULL; X} SHAR_EOF chmod 0444 math.c || echo "restore of math.c fails" set `wc -c math.c`;Sum=$1 if test "$Sum" != "9504" then echo original size 9504, current size $Sum;fi echo "x - extracting math.h (Text)" sed 's/^X//' << 'SHAR_EOF' > math.h && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * math.h X */ X Xptr new_style(); X X#define STYLE_NODE (UNSET_NODE + 1) X#define STYLE_NODE_SIZE 3 X#define DISPLAY_STYLE 0 X#define TEXT_STYLE 2 X#define SCRIPT_STYLE 4 X#define SCRIPT_SCRIPT_STYLE 6 X#define CRAMPED 1 X Xptr new_choice(); X X#define CHOICE_NODE (UNSET_NODE + 2) X#define display_mlist(C) info(C + 1) X#define text_mlist(C) link(C + 1) X#define script_mlist(C) info(C + 2) X#define script_script_mlist(C) link(C + 2) X Xptr new_noad(); X X#define NOAD_SIZE 4 X#define nucleus(N) (N + 1) X#define supscr(N) (N + 2) X#define subscr(N) (N + 3) X#define fam font X#define math_type link X X#define ORD_NOAD (UNSET_NODE + 3) X#define OP_NOAD (ORD_NOAD + 1) X#define BIN_NOAD (ORD_NOAD + 2) X#define REL_NOAD (ORD_NOAD + 3) X#define OPEN_NOAD (ORD_NOAD + 4) X#define CLOSE_NOAD (ORD_NOAD + 5) X#define PUNCT_NOAD (ORD_NOAD + 6) X#define INNER_NOAD (ORD_NOAD + 7) X X#define MATH_CHAR 1 X#define SUB_BOX 2 X#define SUB_MLIST 3 X#define MATH_TEXT_CHAR 4 X X#define LIMITS 1 X#define NO_LIMITS 2 X X#define left_delimiter(D) (D + 4) X#define right_delimiter(D) (D + 5) X X#define small_fam(D) mem[D].qqqq.b0 X#define small_char(D) mem[D].qqqq.b1 X#define large_fam(D) mem[D].qqqq.b2 X#define large_char(D) mem[D].qqqq.b3 X X#define RADICAL_NOAD (INNER_NOAD + 1) X#define RADICAL_NOAD_SIZE 5 X#define FRACTION_NOAD (RADICAL_NOAD + 1) X#define FRACTION_NOAD_SIZE 6 X#define DEFAULT_CODE 010000000000 X#define thickness width X#define numerator supscr X#define denominator subscr X X#define null_delimiter null_character X Xglobal twoh empty_field; X X#define UNDER_NOAD (FRACTION_NOAD + 1) X#define OVER_NOAD (UNDER_NOAD + 1) X#define ACCENT_NOAD (OVER_NOAD + 1) X#define ACCENT_NOAD_SIZE 5 X#define accent_chr(A) (A + 4) X#define VCENTER_NOAD (ACCENT_NOAD + 1) X#define LEFT_NOAD (VCENTER_NOAD + 1) X#define RIGHT_NOAD (LEFT_NOAD + 1) X#define delimiter nucleus X X#define scripts_allowed(N) (type(N) >= ORD_NOAD && type(N) < LEFT_NOAD) X Xint print_fam_and_char(); Xint print_delimiter(); Xint print_subsidiary_data(); Xint print_style(); Xint print_size(); X X#define TEXT_SIZE 0 X#define SCRIPT_SIZE 16 X#define SCRIPT_SCRIPT_SIZE 32 X Xint show_normal_noad(); Xint show_fraction_noad(); X X#define mathsy(F, P) \ X font_info[param_base[fam_fnt(2 + F)] + P].sc X X#define math_x_height(F) mathsy(F, 5) X#define math_quad(F) mathsy(F, 6) X#define num1(F) mathsy(F, 8) X#define num2(F) mathsy(F, 9) X#define num3(F) mathsy(F, 10) X#define denom1(F) mathsy(F, 11) X#define denom2(F) mathsy(F, 12) X#define sup1(F) mathsy(F, 13) X#define sup2(F) mathsy(F, 14) X#define sup3(F) mathsy(F, 15) X#define sub1(F) mathsy(F, 16) X#define sub2(F) mathsy(F, 17) X#define sup_drop(F) mathsy(F, 18) X#define sub_drop(F) mathsy(F, 19) X#define delim1(F) mathsy(F, 20) X#define delim2(F) mathsy(F, 21) X#define axis_height(F) mathsy(F, 22) X X#define TOTAL_MATHSY_PARAMS 22 X X#define mathex(P) \ X font_info[param_base[fam_fnt(3 + cur_size)] + P].sc X X#define default_rule_thickness mathex(8) X#define big_op_spacing1 mathex(9) X#define big_op_spacing2 mathex(10) X#define big_op_spacing3 mathex(11) X#define big_op_spacing4 mathex(12) SHAR_EOF echo "End of part 9" echo "File math.h is continued in part 10" echo "10" > s2_seq_.tmp exit 0
glenn@extro.ucc.su.oz.au (G Geers) (02/16/90)
---- Cut Here and unpack ---- #!/bin/sh # this is part 10 of a multipart archive # do not concatenate these parts, unpack them in order with /bin/sh # file math.h continued # CurArch=10 if test ! -r s2_seq_.tmp then echo "Please unpack part 1 first!" exit 1; fi ( read Scheck if test "$Scheck" != $CurArch then echo "Please unpack part $Scheck next!" exit 1; else exit 0; fi ) < s2_seq_.tmp || exit 1 echo "x - Continuing file math.h" sed 's/^X//' << 'SHAR_EOF' >> math.h X#define big_op_spacing5 mathex(13) X X#define TOTAL_MATHEX_PARAMS 13 X X#define cramped_style(S) 2 * (S / 2) + CRAMPED X#define sub_style(S) 2 * (S / 4) + SCRIPT_STYLE + CRAMPED X#define sup_style(S) 2 * (S / 4) + SCRIPT_STYLE + (S % 2) X#define num_style(S) S + 2 - 2 * (S / 6) X#define denom_style(S) 2 * (S / 2) + CRAMPED + 2 - 2 * (S / 6) X X#define change_size_and_mu() \ X {if (cur_style < SCRIPT_STYLE) \ X cur_size = TEXT_SIZE; \ X else cur_size = 16 * ((cur_style - TEXT_STYLE) / 2); \ X cur_mu = x_over_n(math_quad(cur_size), 18L);} X Xptr fraction_rule(); Xptr overbar(); Xptr var_delimiter(); Xint stack_into_box(); Xscal height_plus_depth(); Xptr char_box(); Xptr rebox(); Xptr math_glue(); Xint math_kern(); Xint flush_math(); SHAR_EOF echo "File math.h is complete" chmod 0444 math.h || echo "restore of math.h fails" set `wc -c math.h`;Sum=$1 if test "$Sum" != "4115" then echo original size 4115, current size $Sum;fi echo "x - extracting mathlists.c (Text)" sed 's/^X//' << 'SHAR_EOF' > mathlists.c && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * mathlists.c X */ X X#include "tex.h" X#include "cmds.h" X#include "heap.h" X#include "arith.h" X#include "eq.h" X#include "eqstack.h" X#include "evalstack.h" X#include "token.h" X#include "tokenstack.h" X#include "scan.h" X#include "tfm.h" X#include "box.h" X#include "pack.h" X#include "math.h" X#include "mlist-hlist.h" X#include "par.h" X#include "page.h" X#include "print.h" X#include "error.h" X#include "mathlists.h" X Xpush_math (c) X group c; X{ X push_nest(); X mode = -MMODE; X incompleat_noad = NULL; X new_save_level(c); X} X Xinit_math () X{ X scal d; X fnt f; X scal l; X int n; X ptr p; X ptr q; X scal s; X scal v; X scal w; X X get_token(); X if (cur_cmd == MATH_SHIFT && mode > 0) { X if (head == tail) { X pop_nest(); X w = -MAX_DIMEN; X } else { X line_break(display_widow_penalty); X v = shift_amount(just_box) + 2 * quad(cur_font); X w = -MAX_DIMEN; X p = list_ptr(just_box); X while (p != NULL) { X reswitch: X if (is_char_node(p)) { X f = font(p); X d = char_width(f, char_info(f, character(p))); X goto found; X } X switch (type(p)) X { X case HLIST_NODE: X case VLIST_NODE: X case RULE_NODE: X d = width(p); X goto found; X break; X X case LIGATURE_NODE: X make_char_from_lig(); X goto reswitch; X break; X X case KERN_NODE: X case MATH_NODE: X d = width(p); X break; X X case GLUE_NODE: X q = glue_ptr(p); X d = width(q); X if (glue_sign(just_box) == STRETCHING) { X if (glue_order(just_box) == stretch_order(q) && X stretch(q) != 0) X v = MAX_DIMEN; X } else if (glue_sign(just_box) == SHRINKING) { X if (glue_order(just_box) == shrink_order(q) && X shrink(q) != 0) X v = MAX_DIMEN; X } X if (subtype(p) >= A_LEADERS) X goto found; X break; X X case WHATSIT_NODE: X d = 0; X break; X X default: X d = 0; X break; X } X if (v < MAX_DIMEN) X v += d; X goto not_found; X X found: X if (v < MAX_DIMEN) { X v += d; X w = v; X } else { X w = MAX_DIMEN; X break; X } X X not_found: X p = link(p); X } X } X if (par_shape_ptr == NULL) { X if (hang_indent != 0 && X (hang_after >= 0 && X prev_graf + 2 > hang_after || X prev_graf + 1 < -hang_after)) { X l = hsize - abs(hang_indent); X s = (hang_indent > 0) ? hang_indent : 0; X } else { X l = hsize; X s = 0; X } X } else { X n = info(par_shape_ptr); X if (prev_graf + 2 >= n) X p = par_shape_ptr + 2 * n; X else p = par_shape_ptr + 2 * (prev_graf + 2); X s = mem[p - 1].sc; X l = mem[p].sc; X } X push_math(MATH_SHIFT_GROUP); X mode = MMODE; X eq_word_define(INT_BASE + CUR_FAM_CODE, -1L); X eq_word_define(DIMEN_BASE + PRE_DISPLAY_SIZE_CODE, w); X eq_word_define(DIMEN_BASE + DISPLAY_WIDTH_CODE, l); X eq_word_define(DIMEN_BASE + DISPLAY_INDENT_CODE, s); X if (every_display != NULL) X begin_token_list(every_display, EVERY_DISPLAY_TEXT); X if (nest_ptr == 1) X build_page(); X } else { X back_input(); X push_math(MATH_SHIFT_GROUP); X eq_word_define(INT_BASE + CUR_FAM_CODE, -1L); X if (every_math != NULL) X begin_token_list(every_math, EVERY_MATH_TEXT); X } X} X Xstart_eq_no () X{ X saved(0) = cur_chr; X incr(save_ptr); X push_math(MATH_SHIFT_GROUP); X eq_word_define(INT_BASE + CUR_FAM_CODE, -1L); X if (every_math != NULL) X begin_token_list(every_math, EVERY_MATH_TEXT); X} X X#define fam_in_range() (cur_fam >= 0 && cur_fam < 16) X Xscan_math (p) X ptr p; X{ X int c; X Xrestart: X get_nbrx_token(); X Xreswitch: X switch (cur_cmd) X { X case LETTER: X case OTHER_CHAR: X case CHAR_GIVEN: X if (cur_chr >= 128) X c = cur_chr; X else { X c = ho(math_code(cur_chr)); X if (c == 0100000) { X cur_cs = cur_chr + ACTIVE_BASE; X cur_cmd = eq_type(cur_cs); X cur_chr = equiv(cur_cs); X x_token(); X back_input(); X goto restart; X } X } X break; X X case CHAR_NUM: X scan_char_num(); X cur_chr = cur_val; X cur_cmd = CHAR_GIVEN; X goto reswitch; X break; X X case MATH_CHAR_NUM: X scan_fifteen_bit_int(); X c = cur_val; X break; X X case MATH_GIVEN: X c = cur_chr; X break; X X case DELIM_NUM: X scan_twenty_seven_bit_int(); X c = cur_val / 010000; X break; X X default: X back_input(); X scan_left_brace(); X saved(0) = p; X incr(save_ptr); X push_math(MATH_GROUP); X return; X break; X } X math_type(p) = MATH_CHAR; X character(p) = c % 256; X if (c >= VAR_CODE && fam_in_range()) X fam(p) = cur_fam; X else fam(p) = (c / 256) % 16; X} X Xset_math_char (c) X val c; X{ X ptr p; X X if (c >= 0100000) { X cur_cs = cur_chr + ACTIVE_BASE; X cur_cmd = eq_type(cur_cs); X cur_chr = equiv(cur_cs); X x_token(); X back_input(); X } else { X p = new_noad(); X math_type(nucleus(p)) = MATH_CHAR; X character(nucleus(p)) = c % 256; X fam(nucleus(p)) = (c / 256) % 16; X if (c >= VAR_CODE) { X if (fam_in_range()) X fam(nucleus(p)) = cur_fam; X type(p) = ORD_NOAD; X } else type(p) = ORD_NOAD + (c / 010000); X link(tail) = p; X tail = p; X } X} X Xmath_limit_switch () X{ X if (head != tail && type(tail) == OP_NOAD) { X subtype(tail) = cur_chr; X return; X } X print_err("Limit controls must follow a math operator"); X help_limits(); X error(); X} X Xscan_delimiter (p, r) X ptr p; X bool r; X{ X if (r) X scan_twenty_seven_bit_int(); X else { X get_nbrx_token(); X switch (cur_cmd) X { X case LETTER: X case OTHER_CHAR: X cur_val = del_code(cur_chr); X break; X X case DELIM_NUM: X scan_twenty_seven_bit_int(); X break; X X default: X cur_val = -1; X break; X } X } X if (cur_val < 0) { X print_err("Missing delimiter (. inserted)"); X help_delimiter(); X back_error(); X cur_val = 0; X } X small_fam(p) = (cur_val / 04000000) % 16; X small_char(p) = qi((cur_val / 010000) % 256); X large_fam(p) = (cur_val / 256) % 16; X large_char(p) = qi(cur_val % 256); X} X Xmath_radical () X{ X tail_append(get_node(RADICAL_NOAD_SIZE)); X type(tail) = RADICAL_NOAD; X subtype(tail) = NORMAL; X mem[nucleus(tail)].hh = empty_field; X mem[supscr(tail)].hh = empty_field; X mem[subscr(tail)].hh = empty_field; X scan_delimiter(left_delimiter(tail), TRUE); X scan_math(nucleus(tail)); X} X Xmath_ac () X{ X if (cur_cmd == ACCENT) { X print_err("Please use "); X print_esc("mathaccent"); X print(" for accents in math mode"); X help_math_accent(); X error(); X } X tail_append(get_node(ACCENT_NOAD_SIZE)); X type(tail) = ACCENT_NOAD; X subtype(tail) = NORMAL; X mem[nucleus(tail)].hh = empty_field; X mem[subscr(tail)].hh = empty_field; X mem[supscr(tail)].hh = empty_field; X math_type(accent_chr(tail)) = MATH_CHAR; X scan_fifteen_bit_int(); X character(accent_chr(tail)) = qi(cur_val % 256); X if (cur_val >= VAR_CODE && fam_in_range()) X fam(accent_chr(tail)) = cur_fam; X else fam(accent_chr(tail)) = (cur_val / 256) % 16; X scan_math(nucleus(tail)); X} X Xappend_choices () X{ X tail_append(new_choice()); X incr(save_ptr); X saved(-1) = 0; X scan_left_brace(); X push_math(MATH_CHOICE_GROUP); X} X Xbuild_choices () X{ X ptr p; X X unsave(); X p = fin_mlist(NULL); X switch ((int) saved(-1)) X { X case 0: X display_mlist(tail) = p; X break; X X case 1: X text_mlist(tail) = p; X break; X X case 2: X script_mlist(tail) = p; X break; X X case 3: X script_script_mlist(tail) = p; X decr(save_ptr); X return; X } X incr(saved(-1)); X scan_left_brace(); X push_math(MATH_CHOICE_GROUP); X} X Xsub_sup () X{ X ptr p = NULL; X short t = EMPTY; X X if (tail != head && scripts_allowed(tail)) { X p = supscr(tail) + cur_cmd - SUP_MARK; X t = math_type(p); X } X if (p == NULL || t != EMPTY) { X tail_append(new_noad()); X p = supscr(tail) + cur_cmd - SUP_MARK; X if (t != EMPTY) { X if (cur_cmd == SUP_MARK) { X print_err("Double superscript"); X help_double_sup(); X } else { X print_err("Double subscript"); X help_double_sub(); X } X error(); X } X } X scan_math(p); X} X Xmath_fraction () X{ X int c; X X c = cur_chr; X if (incompleat_noad != NULL) { X if (c >= DELIMITED_CODE) { X scan_delimiter(garbage, FALSE); X scan_delimiter(garbage, FALSE); X } X if (c % DELIMITED_CODE == ABOVE_CODE) X scan_normal_dimen(); X print_err("Ambiguous; you need another { and }"); X help_fraction(); X error(); X } else { X incompleat_noad = get_node(FRACTION_NOAD_SIZE); X type(incompleat_noad) = FRACTION_NOAD; X subtype(incompleat_noad) = NORMAL; X math_type(numerator(incompleat_noad)) = SUB_MLIST; X info(numerator(incompleat_noad)) = link(head); X mem[denominator(incompleat_noad)].hh = empty_field; X mem[left_delimiter(incompleat_noad)].qqqq = null_delimiter; X mem[right_delimiter(incompleat_noad)].qqqq = null_delimiter; X link(head) = NULL; X tail = head; X if (c >= DELIMITED_CODE) { X scan_delimiter(left_delimiter(incompleat_noad), FALSE); X scan_delimiter(right_delimiter(incompleat_noad), FALSE); X } X switch (c % DELIMITED_CODE) X { X case ABOVE_CODE: X scan_normal_dimen(); X thickness(incompleat_noad) = cur_val; X break; X X case OVER_CODE: X thickness(incompleat_noad) = DEFAULT_CODE; X break; X X case ATOP_CODE: X thickness(incompleat_noad) = 0; X break; X } X } X} X Xptr Xfin_mlist (p) X ptr p; X{ X ptr q; X X if (incompleat_noad != NULL) { X math_type(denominator(incompleat_noad)) = SUB_MLIST; X info(denominator(incompleat_noad)) = link(head); X if (p == NULL) X q = incompleat_noad; X else { X q = info(numerator(incompleat_noad)); X if (type(q) != LEFT_NOAD) X confusion("right"); X info(numerator(incompleat_noad)) = link(q); X link(q) = incompleat_noad; X link(incompleat_noad) = p; X } X } else { X link(tail) = p; X q = link(head); X } X pop_nest(); X return q; X} X Xmath_left_right () X{ X ptr p; X int t; X X t = cur_chr; X if (t == RIGHT_NOAD && cur_group != MATH_LEFT_GROUP) { X if (cur_group == MATH_SHIFT_GROUP) { X scan_delimiter(garbage, FALSE); X print_err("Extra "); X print_esc("right"); X help_xtra_right(); X error(); X } else X off_save(); X } else { X p = new_noad(); X type(p) = t; X scan_delimiter(delimiter(p), FALSE); X if (t == LEFT_NOAD) { X push_math(MATH_LEFT_GROUP); X link(head) = p; X tail = p; X } else { X p = fin_mlist(p); X unsave(); X tail_append(new_noad()); X type(tail) = INNER_NOAD; X math_type(nucleus(tail)) = SUB_MLIST; X info(nucleus(tail)) = p; X } X } X} X Xafter_math () X{ X ptr a; X ptr b; X scal d; X scal e; X bool l; X int m; X ptr p; X scal q; X ptr r; X scal s; X scal t; X scal w; X scal z; X int g1; X int g2; X bool danger; X X danger = FALSE; X if (font_params[fam_fnt(2 + TEXT_SIZE)] < TOTAL_MATHSY_PARAMS || X font_params[fam_fnt(2 + SCRIPT_SIZE)] < TOTAL_MATHSY_PARAMS || X font_params[fam_fnt(2 + SCRIPT_SCRIPT_SIZE)] < TOTAL_MATHSY_PARAMS) { X print_err("Math formula deleted: Insufficient symbol fonts"); X help_math_sy(); X error(); X flush_math(); X danger = TRUE; X } else if (font_params[fam_fnt(3 + TEXT_SIZE)] < TOTAL_MATHEX_PARAMS || X font_params[fam_fnt(3 + SCRIPT_SIZE)] < TOTAL_MATHEX_PARAMS || X font_params[fam_fnt(3 + SCRIPT_SCRIPT_SIZE)] < TOTAL_MATHEX_PARAMS) { X print_err("Math formula deleted: Insufficient extension fonts"); X help_math_ex(); X error(); X flush_math(); X danger = TRUE; X } X m = mode; X l = FALSE; X p = fin_mlist(NULL); X if (mode == -m) { X cur_mlist = p; X cur_style = TEXT_STYLE; X mlist_penalties = FALSE; X mlist_to_hlist(); X a = hpack(link(temp_head), NATURAL); X unsave(); X decr(save_ptr); X if (saved(0) == 1) X l = TRUE; X if (danger) X flush_math(); X m = mode; X p = fin_mlist(NULL); X } else X a = NULL; X if (m < 0) { X tail_append(new_math(math_surround, BEFORE)); X cur_mlist = p; X cur_style = TEXT_STYLE; X mlist_penalties = (mode > 0); X mlist_to_hlist(); X link(tail) = link(temp_head); X while (link(tail) != NULL) X tail = link(tail); X tail_append(new_math(math_surround, AFTER)); X space_factor = 1000; X unsave(); X } else { X get_x_token(); X if (cur_cmd != MATH_SHIFT) { X print_err("Display math should end with $$"); X help_doldol(); X back_error(); X } X cur_mlist = p; X cur_style = DISPLAY_STYLE; X mlist_penalties = FALSE; X mlist_to_hlist(); X p = link(temp_head); X adjust_tail = adjust_head; X b = hpack(p, NATURAL); X t = adjust_tail; X adjust_tail = NULL; X w = width(b); X z = display_width; X s = display_indent; X if (a == NULL || danger) X e = q = 0; X else { X e = width(a); X q = e + math_quad(TEXT_SIZE); X } X if (w + q > z) { X if (e != 0 && X (w - total_shrink[NORMAL] + q <= z || X total_shrink[FIL] != 0 || X total_shrink[FILL] != 0 || X total_shrink[FILLL] != 0)) { X free_node(b, BOX_NODE_SIZE); X b = hpack(p, z - q, EXACTLY); X } else { X e = 0; X if (w > z) { X free_node(b, BOX_NODE_SIZE); X b = hpack(p, z, EXACTLY); X } X } X w = width(b); X } X d = half(z - w); X if (e > 0 && d < 2 * e) { X d = half(z - w - e); X if (p != NULL && type(p) == GLUE_NODE) X d = 0; X } X tail_append(new_penalty(pre_display_penalty)); X if (d + s <= pre_display_size || l) { X g1 = ABOVE_DISPLAY_SKIP_CODE; X g2 = BELOW_DISPLAY_SKIP_CODE; X } else { X g1 = ABOVE_DISPLAY_SHORT_SKIP_CODE; X g2 = BELOW_DISPLAY_SHORT_SKIP_CODE; X } X if (l && e == 0) { X shift_amount(a) = s; X append_to_vlist(a); X tail_append(new_penalty(INF_PENALTY)); X } else X tail_append(new_param_glue(g1)); X if (e != 0) { X r = new_kern(z - w - e - d); X if (l) { X link(a) = r; X link(r) = b; X b = a; X d = 0; X } else { X link(b) = r; X link(r) = a; X } X b = hpack(b, NATURAL); X } X shift_amount(b) = s + d; X append_to_vlist(b); X if (t != adjust_head) { X link(tail) = link(adjust_head); X tail = t; X } X if (a != NULL && e == 0 && !l) { X tail_append(new_penalty(INF_PENALTY)); X shift_amount(a) = s + z - width(a); X append_to_vlist(a); X tail_append(new_penalty(post_display_penalty)); X } else { X tail_append(new_penalty(post_display_penalty)); X tail_append(new_param_glue(g2)); X } X resume_after_display(); X } X} X Xresume_after_display () X{ X if (cur_group != MATH_SHIFT_GROUP) X confusion("display"); X unsave(); X prev_graf += 3; X push_nest(); X mode = HMODE; X space_factor = 1000; X scan_optional_space(); X if (nest_ptr == 1) X build_page(); X} X X/* X * Help text X */ X Xhelp_math_accent () X{ X help2("I'm changing \\accent to \\mathaccent here; wish me luck.", X "(Accents are not the same in formulas as they are in text.)" ); X} X Xhelp_math_sy () X{ X help3("Sorry, but I can't typeset math unless \\textfont 2", X "and \\scriptfont 2 and \\scriptscriptfont 2 have all", X "the \\fontdimen values needed in math symbol fonts." ); X} X Xhelp_math_ex () X{ X help3("Sorry, but I can't typeset math unless \\textfont 3", X "and \\scriptfont 3 and \\scriptscriptfont 3 have all", X "the \\fontdimen values needed in math extension fonts." ); X} X Xhelp_limits () X{ X help1("I'm ignoring this misplaced \\limits or \\nolimits command."); X} X Xhelp_delimiter () X{ X help6("I was expecting to see something like `(' or `\\{' or", X "`\\}' here. If you typed, e.g., `{' instead of `\\{', you", X "should probably delete the `{' by typing `1' now, so that", X "braces don't get unbalanced. Otherwise just proceed.", X "Acceptable delimiters are characters whose \\delcode is", X "nonnegative, or you can use `\\delimiter <delimiter code>'."); X} X Xhelp_fraction () X{ X help3("I'm ignoring this fraction specification, since I don't", X "know whether a construction like `x \\over y \\over z'", X "means `{x \\over y} \\over z' or `x \\over {y \\over z}'."); X} X Xhelp_xtra_right () X{ X help1("I'm ignoring a \\right that had no matching \\left."); X} X Xhelp_doldol () X{ X help2("The `$' that I just saw supposedly matches a previous `$$'.", X "So I shall assume that you typed `$$' both times."); X} X Xhelp_double_sub () X{ X help1("I treat `x_1_2' essentially like `x_1{}_2'."); X} X Xhelp_double_sup () X{ X help1("I treat `x^1^2' essentially like `x^1{}^2'."); X} SHAR_EOF chmod 0444 mathlists.c || echo "restore of mathlists.c fails" set `wc -c mathlists.c`;Sum=$1 if test "$Sum" != "15642" then echo original size 15642, current size $Sum;fi echo "x - extracting mathlists.h (Text)" sed 's/^X//' << 'SHAR_EOF' > mathlists.h && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * mathlist.h X */ X X#define ABOVE_CODE 0 X#define OVER_CODE 1 X#define ATOP_CODE 2 X#define DELIMITED_CODE 3 X Xint init_math(); Xint start_eq_no(); Xint scan_math(); Xint set_math_char(); Xint math_limit_switch(); Xint scan_delimiter(); Xint math_radical(); Xint math_ac(); Xint append_choices(); Xint build_choices(); Xint sub_sup(); Xint math_fraction(); Xptr fin_mlist(); Xint math_left_right(); Xint after_math(); Xint resume_after_display(); SHAR_EOF chmod 0444 mathlists.h || echo "restore of mathlists.h fails" set `wc -c mathlists.h`;Sum=$1 if test "$Sum" != "663" then echo original size 663, current size $Sum;fi echo "x - extracting mklog (Text)" sed 's/^X//' << 'SHAR_EOF' > mklog && Xcc -O -DINIT -DBIG -c align.c Xcc -O -DINIT -DBIG -c arith.c Xcc -O -DINIT -DBIG -c box.c Xcc -O -DINIT -DBIG -c boxlists.c Xcc -O -DINIT -DBIG -c char.c Xcc -O -DINIT -DBIG -c cmds.c Xcc -O -DINIT -DBIG -c cond.c Xcc -O -DINIT -DBIG -c def.c Xcc -O -DINIT -DBIG -c dvi.c Xcc -O -DINIT -DBIG -c eq.c Xcc -O -DINIT -DBIG -c eqstack.c Xcc -O -DINIT -DBIG -c error.c Xcc -O -DINIT -DBIG -c eval.c Xcc -O -DINIT -DBIG -c evalstack.c Xcc -O -DINIT -DBIG -c expand.c Xcc -O -DINIT -DBIG -c file.c Xcc -O -DINIT -DBIG -c fmt.c Xcc -O -DINIT -DBIG -c hash.c Xcc -O -DINIT -DBIG -c heap.c Xcc -O -DINIT -DBIG -c hyph.c Xcc -O -DINIT -DBIG -c io.c Xcc -O -DINIT -DBIG -c math.c Xcc -O -DINIT -DBIG -c mathlists.c Xcc -O -DINIT -DBIG -c mlist-hlist.c Xcc -O -DINIT -DBIG -c pack.c Xcc -O -DINIT -DBIG -c page.c Xcc -O -DINIT -DBIG -c par.c Xcc -O -DINIT -DBIG -c print.c Xcc -O -DINIT -DBIG -c scan.c Xcc -O -DINIT -DBIG -c str.c Xcc -O -DINIT -DBIG -c tex.c Xcc -O -DINIT -DBIG -c texext.c Xcc -O -DINIT -DBIG -c tfm.c Xcc -O -DINIT -DBIG -c token.c Xcc -O -DINIT -DBIG -c tokenlists.c Xcc -O -DINIT -DBIG -c tokenstack.c Xcc -O -DINIT -DBIG align.o arith.o box.o boxlists.o char.o cmds.o cond.o def.o dvi.o eq.o eqstack.o error.o eval.o evalstack.o expand.o file.o fmt.o hash.o heap.o hyph.o io.o math.o mathlists.o mlist-hlist.o pack.o page.o par.o print.o scan.o str.o tex.o texext.o tfm.o token.o tokenlists.o tokenstack.o -o initex Xtext data bss dec hex X210944 45056 1107196 1363196 14ccfc Xcc -O -DBIG -c cmds.c Xcc -O -DBIG -c def.c Xcc -O -DBIG -c eq.c Xcc -O -DBIG -c fmt.c Xcc -O -DBIG -c hash.c Xcc -O -DBIG -c heap.c Xcc -O -DBIG -c hyph.c Xcc -O -DBIG -c tex.c Xcc -O -DBIG -c token.c Xcc -O -DBIG align.o arith.o box.o boxlists.o char.o cmds.o cond.o def.o dvi.o eq.o eqstack.o error.o eval.o evalstack.o expand.o file.o fmt.o hash.o heap.o hyph.o io.o math.o mathlists.o mlist-hlist.o pack.o page.o par.o print.o scan.o str.o tex.o texext.o tfm.o token.o tokenlists.o tokenstack.o -o virtex Xtext data bss dec hex X192512 40960 1834492 2067964 1f8dfc SHAR_EOF chmod 0444 mklog || echo "restore of mklog fails" set `wc -c mklog`;Sum=$1 if test "$Sum" != "2080" then echo original size 2080, current size $Sum;fi echo "x - extracting mlist-hlist.c (Text)" sed 's/^X//' << 'SHAR_EOF' > mlist-hlist.c && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * mlist-hlist.c X */ X X#include "tex.h" X#include "heap.h" X#include "arith.h" X#include "scan.h" X#include "eq.h" X#include "box.h" X#include "math.h" X#include "pack.h" X#include "tfm.h" X#include "print.h" X#include "error.h" X#include "str.h" X#include "mlist-hlist.h" X Xqword cur_c; Xfnt cur_f; Xfourq cur_i; Xscal cur_mu; Xint cur_size; Xint cur_style; Xptr cur_mlist; Xbool mlist_penalties; X Xptr Xclean_box (p, s) X ptr p; X int s; X{ X ptr q; X ptr r; X ptr x; X int save_style; X X switch (math_type(p)) X { X case MATH_CHAR: X cur_mlist = new_noad(); X mem[nucleus(cur_mlist)] = mem[p]; X break; X X case SUB_BOX: X q = info(p); X goto found; X break; X X case SUB_MLIST: X cur_mlist = info(p); X break; X X default: X q = new_null_box(); X goto found; X break; X } X save_style = cur_style; X cur_style = s; X mlist_penalties = FALSE; X mlist_to_hlist(); X q = link(temp_head); X cur_style = save_style; X change_size_and_mu(); X Xfound: X if (is_char_node(q) || q == NULL) X x = hpack(q, NATURAL); X else if (link(q) == NULL && X type(q) <= VLIST_NODE && X shift_amount(q) == 0) X x = q; X else x = hpack(q, NATURAL); X q = list_ptr(x); X if (is_char_node(q)) { X r = link(q); X if (r != NULL && X link(r) == NULL && X !is_char_node(r) && X type(r) == KERN_NODE) { X free_node(r, SMALL_NODE_SIZE); X link(q) = NULL; X } X } X return x; X} X Xfetch (a) X ptr a; X{ X cur_c = character(a); X cur_f = fam_fnt(fam(a) + cur_size); X if (cur_f == NULL_FONT) { X print_err(""); X print_size(cur_size); X print_char(' '); X print_int(fam(a)); X print(" is undefined (character "); X print_ASCII(qo(cur_c)); X print_char(')'); X help_undefd_mathchar(); X error(); X cur_i = null_character; X math_type(a) = EMPTY; X } else { X if (qo(cur_c) >= font_bc[cur_f] && X qo(cur_c) <= font_ec[cur_f]) X cur_i = char_info(cur_f, cur_c); X else cur_i = null_character; X if (!char_exists(cur_i)) { X char_warning(cur_f, qo(cur_c)); X math_type(a) = EMPTY; X } X } X} X Xchar math_spacing[] = X "0234000122*4000133**3**344*0400400*000000234000111*1111112341011"; X X#define choose_mlist(L) \ X {p = L(q); L(q) = NULL;} X Xmlist_to_hlist () X{ X ptr p; X ptr q; X ptr r; X int s; X int t; X ptr x; X ptr y; X ptr z; X val pen; X scal delta; X scal max_d; X scal max_h; X ptr mlist; X int style; X int r_type; X bool penalties; X int save_style; X X mlist = cur_mlist; X penalties = mlist_penalties; X style = cur_style; X q = mlist; X r = NULL; X r_type = OP_NOAD; X max_h = 0; X max_d = 0; X change_size_and_mu(); X X while (q != NULL) X { Xreswitch: X delta = 0; X switch (type(q)) X { X case BIN_NOAD: X switch (r_type) X { X case BIN_NOAD: X case OP_NOAD: X case REL_NOAD: X case OPEN_NOAD: X case PUNCT_NOAD: X case LEFT_NOAD: X type(q) = ORD_NOAD; X goto reswitch; X break; X X default: X break; X } X break; X X case REL_NOAD: X case CLOSE_NOAD: X case PUNCT_NOAD: X case RIGHT_NOAD: X if (r_type == BIN_NOAD) X type(r) = ORD_NOAD; X if (type(q) == RIGHT_NOAD) X goto done_with_noad; X break; X X case LEFT_NOAD: X goto done_with_noad; X break; X X case FRACTION_NOAD: X make_fraction(q); X goto check_dimensions; X break; X X case OP_NOAD: X delta = make_op(q); X if (subtype(q) == LIMITS) X goto check_dimensions; X break; X X case ORD_NOAD: X make_ord(q); X break; X X case OPEN_NOAD: X case INNER_NOAD: X break; X X case RADICAL_NOAD: X make_radical(q); X break; X X case OVER_NOAD: X make_over(q); X break; X X case UNDER_NOAD: X make_under(q); X break; X X case ACCENT_NOAD: X make_math_accent(q); X break; X X case VCENTER_NOAD: X make_vcenter(q); X break; X X case STYLE_NODE: X cur_style = subtype(q); X change_size_and_mu(); X goto done_with_node; X break; X X case CHOICE_NODE: X switch (cur_style / 2) X { X case 0: X choose_mlist(display_mlist); X break; X X case 1: X choose_mlist(text_mlist); X break; X X case 2: X choose_mlist(script_mlist); X break; X X case 3: X choose_mlist(script_script_mlist); X break; X } X flush_node_list(display_mlist(q)); X flush_node_list(text_mlist(q)); X flush_node_list(script_mlist(q)); X flush_node_list(script_script_mlist(q)); X type(q) = STYLE_NODE; X subtype(q) = cur_style; X width(q) = 0; X depth(q) = 0; X if (p != NULL) { X z = link(q); X link(q) = p; X while (link(p) != NULL) X p = link(p); X link(p) = z; X } X goto done_with_node; X break; X X case INS_NODE: X case MARK_NODE: X case ADJUST_NODE: X case WHATSIT_NODE: X case PENALTY_NODE: X case DISC_NODE: X goto done_with_node; X break; X X case RULE_NODE: X if (height(q) > max_h) X max_h = height(q); X if (depth(q) > max_d) X max_d = depth(q); X goto done_with_node; X break; X X case GLUE_NODE: X if (subtype(q) == MU_GLUE) { X x = glue_ptr(q); X y = math_glue(x, cur_mu); X delete_glue_ref(x); X glue_ptr(q) = y; X subtype(q) = NORMAL; X } else if (cur_size != TEXT_SIZE && X subtype(q) == COND_MATH_GLUE) { X p = link(q); X if (p != NULL && X (type(p) == GLUE_NODE || X type(p) == KERN_NODE)) { X link(q) = link(p); X link(p) = NULL; X flush_node_list(p); X } X } X goto done_with_node; X break; X X case KERN_NODE: X math_kern(q, cur_mu); X goto done_with_node; X break; X X default: X confusion("mlist1"); X } X X switch (math_type(nucleus(q))) X { X case MATH_CHAR: X case MATH_TEXT_CHAR: X fetch(nucleus(q)); X if (char_exists(cur_i)) { X delta = char_italic(cur_f, cur_i); X p = new_character(cur_f, qo(cur_c)); X if (math_type(nucleus(q)) == MATH_TEXT_CHAR && X space(cur_f) != 0) X delta = 0; X if (math_type(subscr(q)) == EMPTY && delta != 0) { X link(p) = new_kern(delta); X delta = 0; X } X } else X p = NULL; X break; X X case EMPTY: X p = NULL; X break; X X case SUB_BOX: X p = info(nucleus(q)); X break; X X case SUB_MLIST: X cur_mlist = info(nucleus(q)); X save_style = cur_style; X mlist_penalties = FALSE; X mlist_to_hlist(); X cur_style = save_style; X change_size_and_mu(); X p = hpack(link(temp_head), NATURAL); X break; X X default: X confusion("mlist2"); X } X new_hlist(q) = p; X if (math_type(subscr(q)) == EMPTY && X math_type(supscr(q)) == EMPTY) X goto check_dimensions; X make_scripts(q, delta); X Xcheck_dimensions: X z = hpack((ptr)new_hlist(q), NATURAL); X if (height(z) > max_h) X max_h = height(z); X if (depth(z) > max_d) X max_d = depth(z); X free_node(z, BOX_NODE_SIZE); X Xdone_with_noad: X r = q; X r_type = type(r); X Xdone_with_node: X q = link(q); X } X X if (r_type == BIN_NOAD) X type(r) = ORD_NOAD; X p = temp_head; X link(p) = NULL; X q = mlist; X r_type = 0; X cur_style = style; X change_size_and_mu(); X X while (q != NULL) { X t = ORD_NOAD; X s = NOAD_SIZE; X pen = INF_PENALTY; X switch (type(q)) X { X case OP_NOAD: X case OPEN_NOAD: X case CLOSE_NOAD: X case PUNCT_NOAD: X case INNER_NOAD: X t = type(q); X break; X X case BIN_NOAD: X t = BIN_NOAD; X pen = bin_op_penalty; X break; X X case REL_NOAD: X t = REL_NOAD; X pen = rel_penalty; X break; X X case ORD_NOAD: X case VCENTER_NOAD: X case OVER_NOAD: X case UNDER_NOAD: X break; X X case RADICAL_NOAD: X s = RADICAL_NOAD_SIZE; X break; X X case ACCENT_NOAD: X s = ACCENT_NOAD_SIZE; X break; X X case FRACTION_NOAD: X t = INNER_NOAD; X s = FRACTION_NOAD_SIZE; X break; X X case LEFT_NOAD: X case RIGHT_NOAD: X t = make_left_right(q, style, max_d, max_h); X break; X X case STYLE_NODE: X cur_style = subtype(q); X s = STYLE_NODE_SIZE; X change_size_and_mu(); X goto delete_q; X break; X X case WHATSIT_NODE: X case PENALTY_NODE: X case RULE_NODE: X case DISC_NODE: X case ADJUST_NODE: X case INS_NODE: X case MARK_NODE: X case GLUE_NODE: X case KERN_NODE: X link(p) = q; X p = q; X q = link(q); X link(p) = NULL; X continue; X X default: X confusion("mlist3"); X } X X if (r_type > 0) { X switch (math_spacing[r_type * 8 + t + magic_offset]) X { X case '0': X x = 0; X break; X X case '1': X if (cur_style < SCRIPT_STYLE) X x = THIN_MU_SKIP_CODE; X else x = 0; X break; X X case '2': X x = THIN_MU_SKIP_CODE; X break; X X case '3': X if (cur_style < SCRIPT_STYLE) X x = MED_MU_SKIP_CODE; X else x = 0; X break; X X case '4': X if (cur_style < SCRIPT_STYLE) X x = THICK_MU_SKIP_CODE; X else x = 0; X break; X X default: X confusion("mlist4"); X break; X } X if (x != 0) { X y = math_glue(glue_par(x), cur_mu); X z = new_glue(y); X glue_ref_count(y) = NULL; X link(p) = z; X p = z; X subtype(z) = x + 1; X } X } X if (new_hlist(q) != NULL) { X link(p) = new_hlist(q); X do p = link(p); X while (link(p) != NULL); X } X if (penalties && link(q) != NULL && pen < INF_PENALTY) { X r_type = type(link(q)); X if (r_type != PENALTY_NODE && r_type != REL_NOAD) { X z = new_penalty(pen); X link(p) = z; X p = z; X } X } X r_type = t; X Xdelete_q: X r = q; X q = link(q); X free_node(r, s); X } X} X Xmake_over (q) X ptr q; X{ X info(nucleus(q)) = X overbar(clean_box(nucleus(q), cramped_style(cur_style)), X 3 * default_rule_thickness, default_rule_thickness); X math_type(nucleus(q)) = SUB_BOX; X} X Xmake_under (q) X ptr q; X{ X ptr p; X ptr x; X ptr y; X scal delta; X X x = clean_box(nucleus(q), cur_style); X p = new_kern(3 * default_rule_thickness); X link(x) = p; X link(p) = fraction_rule(default_rule_thickness); X y = vpack(x, NATURAL); X delta = height(y) + depth(y) + default_rule_thickness; X height(y) = height(x); X depth(y) = delta - height(y); X info(nucleus(q)) = y; X math_type(nucleus(q)) = SUB_BOX; X} X Xmake_vcenter (q) X ptr q; X{ X ptr v; X scal delta; X X v = info(nucleus(q)); X if (type(v) != VLIST_NODE) X confusion("vcenter"); X delta = height(v) + depth(v); X height(v) = axis_height(cur_size) + half(delta); X depth(v) = delta - height(v); X} X Xmake_radical (q) X ptr q; X{ X ptr x; X ptr y; X scal clr; X scal delta; X X x = clean_box(nucleus(q), cramped_style(cur_style)); X if (cur_style < TEXT_STYLE) X clr = default_rule_thickness + (abs(math_x_height(cur_size)) / 4); X else { X clr = default_rule_thickness; X clr += (abs(clr) / 4); X } X y = var_delimiter(left_delimiter(q), cur_size, X height(x) + depth(x) + clr + default_rule_thickness); X delta = depth(y) - (height(x) + depth(x) + clr); X if (delta > 0) clr += half(delta); X shift_amount(y) = -(height(x) + clr); X link(y) = overbar(x, clr, height(y)); X info(nucleus(q)) = hpack(y, NATURAL); X math_type(nucleus(q)) = SUB_BOX; X} X Xmake_math_accent (q) X ptr q; X{ X int a; X qword c; X fnt f; X scal h; X fourq i; X ptr p; X scal s; X scal w; X ptr x; X ptr y; X scal delta; X X fetch(accent_chr(q)); X if (char_exists(cur_i)) { X i = cur_i; X c = cur_c; X f = cur_f; X s = 0; X if (math_type(nucleus(q)) == MATH_CHAR) { X fetch(nucleus(q)); X if (char_tag(cur_i) == LIG_TAG) { X a = lig_kern_start(cur_f, cur_i); X do { X cur_i = font_info[a].qqqq; X if (qo(next_char(cur_i)) == skew_char[cur_f]) { X if (op_bit(cur_i) >= KERN_FLAG) X s = char_kern(cur_f, cur_i); X break; X } X incr(a); X } while (stop_bit(cur_i) < STOP_FLAG); X } X } X x = clean_box(nucleus(q), cramped_style(cur_style)); X w = width(x); X h = height(x); X loop { X if (char_tag(i) != LIST_TAG) X break; X y = rem_byte(i); X i = char_info(f, y); X if (char_width(f, i) > w) X break; X c = y; X } X delta = (h < x_height(f) ? h : x_height(f)); X if ((math_type(supscr(q)) != EMPTY || X math_type(subscr(q)) != EMPTY) && X math_type(nucleus(q)) == MATH_CHAR) { X flush_node_list(x); X x = new_noad(); X mem[nucleus(x)] = mem[nucleus(q)]; X mem[supscr(x)] = mem[supscr(q)]; X mem[subscr(x)] = mem[subscr(q)]; X mem[supscr(q)].hh = empty_field; X mem[subscr(q)].hh = empty_field; X math_type(nucleus(q)) = SUB_MLIST; X info(nucleus(q)) = x; X x = clean_box(nucleus(q), cur_style); X delta = delta + height(x) - h; X h = height(x); X } X y = char_box(f, c); X shift_amount(y) = s + half(w - width(y)); X width(y) = 0; X p = new_kern(-delta); X link(p) = x; X link(y) = p; X y = vpack(y, NATURAL); X width(y) = width(x); X if (height(y) < h) { X p = new_kern(h - height(y)); X link(p) = list_ptr(y); X list_ptr(y) = p; X height(y) = h; X } X info(nucleus(q)) = y; X math_type(nucleus(q)) = SUB_BOX; X } X} X Xmake_fraction (q) X ptr q; X{ X ptr p; X ptr v; X ptr x; X ptr y; X ptr z; X scal clr; X scal delta; X scal delta1; X scal delta2; X scal shift_up; X scal shift_down; X X if (thickness(q) == DEFAULT_CODE) X thickness(q) = default_rule_thickness; X x = clean_box(numerator(q), num_style(cur_style)); X z = clean_box(denominator(q), denom_style(cur_style)); X if (width(x) < width(z)) X x = rebox(x, width(z)); X else z = rebox(z, width(x)); X if (cur_style < TEXT_STYLE) { X shift_up = num1(cur_size); X shift_down = denom1(cur_size); X } else { X shift_down = denom2(cur_size); X if (thickness(q) != 0) X shift_up = num2(cur_size); X else shift_up = num3(cur_size); X } X if (thickness(q) == 0) { X if (cur_style < TEXT_STYLE) X clr = 7 * default_rule_thickness; X else clr = 3 * default_rule_thickness; X delta = half(clr - ((shift_up - depth(x)) - (height(z) - shift_down))); X if (delta > 0) { X shift_up += delta; X shift_down += delta; X } X } else { X if (cur_style < TEXT_STYLE) X clr = 3 * thickness(q); X else clr = thickness(q); X delta = half(thickness(q)); X delta1 = clr - X ((shift_up - depth(x)) - (axis_height(cur_size) + delta)); X delta2 = clr - X ((axis_height(cur_size) - delta) - (height(z) - shift_down)); X if (delta1 > 0) shift_up += delta1; X if (delta2 > 0) shift_down += delta2; X } X v = new_null_box(); X type(v) = VLIST_NODE; X height(v) = shift_up + height(x); X depth(v) = depth(z) + shift_down; X width(v) = width(x); X if (thickness(q) == 0) { X p = new_kern((shift_up - depth(x)) - (height(z) - shift_down)); X link(p) = z; X } else { X y = fraction_rule(thickness(q)); X p = new_kern((axis_height(cur_size)-delta) - (height(z)-shift_down)); X link(y) = p; X link(p) = z; X p = new_kern((shift_up - depth(x)) - (axis_height(cur_size) + delta)); X link(p) = y; X } X link(x) = p; X list_ptr(v) = x; X if (cur_style < TEXT_STYLE) X delta = delim1(cur_size); X else delta = delim2(cur_size); X x = var_delimiter(left_delimiter(q), cur_size, delta); X link(x) = v; X z = var_delimiter(right_delimiter(q), cur_size, delta); X link(v) = z; X new_hlist(q) = hpack(x, NATURAL); X} X Xscal Xmake_op (q) X ptr q; X{ X ptr p; X ptr v; X ptr x; X ptr y; X ptr z; X scal delta; X scal shift_up; X scal shift_down; X X if (subtype(q) == NORMAL && cur_style < TEXT_STYLE) X subtype(q) = LIMITS; X if (math_type(nucleus(q)) == MATH_CHAR) { X fetch(nucleus(q)); X if (cur_style < TEXT_STYLE && char_tag(cur_i) == LIST_TAG) { X cur_c = rem_byte(cur_i); X character(nucleus(q)) = cur_c; X cur_i = char_info(cur_f, cur_c); X } X delta = char_italic(cur_f, cur_i); X x = clean_box(nucleus(q), cur_style); X if (math_type(subscr(q)) != EMPTY && subtype(q) != LIMITS) X width(x) -= delta; X shift_amount(x) = half(height(x) - depth(x)) - axis_height(cur_size); X math_type(nucleus(q)) = SUB_BOX; X info(nucleus(q)) = x; X } else delta = 0; X if (subtype(q) == LIMITS) { X x = clean_box(supscr(q), sup_style(cur_style)); X y = clean_box(nucleus(q), cur_style); X z = clean_box(subscr(q), sub_style(cur_style)); X v = new_null_box(); X type(v) = VLIST_NODE; X width(v) = width(y); X if (width(x) > width(v)) X width(v) = width(x); X if (width(z) > width(v)) X width(v) = width(z); X x = rebox(x, width(v)); X y = rebox(y, width(v)); X z = rebox(z, width(v)); X shift_amount(x) = half(delta); X shift_amount(z) = -shift_amount(x); X height(v) = height(y); X depth(v) = depth(y); X if (math_type(supscr(q)) == EMPTY) { X free_node(x, BOX_NODE_SIZE); X list_ptr(v) = y; X } else { X shift_up = big_op_spacing3 - depth(x); X if (shift_up < big_op_spacing1) X shift_up = big_op_spacing1; X p = new_kern(shift_up); X link(p) = y; X link(x) = p; X p = new_kern(big_op_spacing5); X link(p) = x; X list_ptr(v) = p; X height(v) += big_op_spacing5 + height(x) + depth(x) + shift_up; X } X if (math_type(subscr(q)) == EMPTY) X free_node(z, BOX_NODE_SIZE); X else { X shift_down = big_op_spacing4 - height(z); X if (shift_down < big_op_spacing2) X shift_down = big_op_spacing2; X p = new_kern(shift_down); X link(y) = p; X link(p) = z; X p = new_kern(big_op_spacing5); X link(z) = p; X depth(v) += big_op_spacing5 + height(z) + depth(z) + shift_down; X } X new_hlist(q) = v; X } X return delta; X} X Xmake_ord (q) X ptr q; X{ X int a; X ptr p; X Xrestart: X if (math_type(subscr(q)) == EMPTY && X math_type(supscr(q)) == EMPTY && X math_type(nucleus(q)) == MATH_CHAR) { X p = link(q); X if (p != NULL && X type(p) >= ORD_NOAD && X type(p) <= PUNCT_NOAD && X math_type(nucleus(p)) == MATH_CHAR && X fam(nucleus(p)) == fam(nucleus(q))) { X math_type(nucleus(q)) = MATH_TEXT_CHAR; X fetch(nucleus(q)); X if (char_tag(cur_i) == LIG_TAG) { X a = lig_kern_start(cur_f, cur_i); X cur_c = character(nucleus(p)); X do { X cur_i = font_info[a].qqqq; X if (next_char(cur_i) == cur_c) { X if (op_bit(cur_i) >= KERN_FLAG) { X p = new_kern(char_kern(cur_f, cur_i)); X link(p) = link(q); X link(q) = p; X return; X } else { X link(q) = link(p); X math_type(nucleus(q)) = MATH_CHAR; X character(nucleus(q)) = rem_byte(cur_i); X mem[subscr(q)] = mem[subscr(p)]; X mem[supscr(q)] = mem[supscr(p)]; X free_node(p, NOAD_SIZE); X goto restart; X } X } X incr(a); X } while (stop_bit(cur_i) < STOP_FLAG); X } X } X } X} X Xmake_scripts (q, delta) X ptr q; X scal delta; X{ X ptr p; X int t; X ptr x; X ptr y; X ptr z; X scal clr; X scal shift_up; X scal shift_down; X X p = new_hlist(q); X if (is_char_node(p)) { X shift_up = 0; X shift_down = 0; X } else { X z = hpack(p, NATURAL); X if (cur_style < SCRIPT_STYLE) X t = SCRIPT_SIZE; X else t = SCRIPT_SCRIPT_SIZE; X shift_up = height(z) - sup_drop(t); X shift_down = depth(z) + sub_drop(t); X free_node(z, BOX_NODE_SIZE); X } X if (math_type(supscr(q)) == EMPTY) { X x = clean_box(subscr(q), sub_style(cur_style)); X width(x) += script_space; X if (shift_down < sub1(cur_size)) X shift_down = sub1(cur_size); X clr = height(x) - (abs(math_x_height(cur_size) * 4) / 5); X if (shift_down < clr) X shift_down = clr; X shift_amount(x) = shift_down; X } else { X x = clean_box(supscr(q), sup_style(cur_style)); X width(x) += script_space; X if (odd(cur_style)) X clr = sup3(cur_size); X else if (cur_style < TEXT_STYLE) X clr = sup1(cur_size); X else clr = sup2(cur_size); X if (shift_up < clr) X shift_up = clr; X clr = depth(x) + (abs(math_x_height(cur_size)) / 4); X if (shift_up < clr) X shift_up = clr; X if (math_type(subscr(q)) == EMPTY) X shift_amount(x) = -shift_up; X else { X y = clean_box(subscr(q), sub_style(cur_style)); X width(y) += script_space; X if (shift_down < sub2(cur_size)) X shift_down = sub2(cur_size); X clr = 4 * default_rule_thickness - X ((shift_up - depth(x)) - (height(y) - shift_down)); X if (clr > 0) { X shift_down += clr; X clr = (abs(math_x_height(cur_size) * 4) / 5) - X (shift_up - depth(x)); X if (clr > 0) { X shift_up += clr; X shift_down -= clr; X } X } X shift_amount(x) = delta; X p = new_kern((shift_up - depth(x)) - (height(y) - shift_down)); X link(x) = p; X link(p) = y; X x = vpack(x, NATURAL); X shift_amount(x) = shift_down; X } X } X if (new_hlist(q) == NULL) X new_hlist(q) = x; X else { X p = new_hlist(q); X while (link(p) != NULL) X p = link(p); X link(p) = x; X } X} X Xmake_left_right (q, style, max_d, max_h) X ptr q; X int style; X scal max_d; X scal max_h; X{ X scal delta; X scal delta1; X scal delta2; X X if (style < SCRIPT_STYLE) X cur_size = TEXT_SIZE; X else cur_size = 16 * ((style - TEXT_STYLE) / 2); X delta2 = max_d + axis_height(cur_size); X delta1 = max_h + max_d - delta2; X if (delta2 > delta1) X delta1 = delta2; X delta = (delta1 / 500) * delimiter_factor; X delta2 = delta1 + delta1 - delimiter_shortfall; X if (delta < delta2) X delta = delta2; X new_hlist(q) = var_delimiter(delimiter(q), cur_size, delta); X return (type(q) - (LEFT_NOAD - OPEN_NOAD)); X} X Xint magic_offset = - 9 * ORD_NOAD; X X/* X * Help text X */ X Xhelp_undefd_mathchar () X{ X help4("Somewhere in the math formula just ended, you used the", X "stated character from an undefined font family. For example,", X "plain TeX doesn't allow \\it or \\sl in subscripts. Proceed,", X "and I'll try to forget that I needed that character."); X} SHAR_EOF chmod 0444 mlist-hlist.c || echo "restore of mlist-hlist.c fails" set `wc -c mlist-hlist.c`;Sum=$1 if test "$Sum" != "20509" then echo original size 20509, current size $Sum;fi echo "x - extracting mlist-hlist.h (Text)" sed 's/^X//' << 'SHAR_EOF' > mlist-hlist.h && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * mlist-hl.h X */ X Xglobal qword cur_c; Xglobal fnt cur_f; Xglobal fourq cur_i; Xglobal ptr cur_mlist; Xglobal scal cur_mu; Xglobal int cur_size; Xglobal int cur_style; Xglobal bool mlist_penalties; X Xptr clean_box(); Xint fetch(); X X#define new_hlist(N) mem[nucleus(N)].i X Xint mlist_to_hlist(); X Xint make_over(); Xint make_under(); Xint make_vcenter(); Xint make_radical(); Xint make_math_accent(); Xint make_fraction(); Xscal make_op(); Xint make_ord(); Xint make_scripts(); Xint make_left_right(); X Xglobal int magic_offset; SHAR_EOF chmod 0444 mlist-hlist.h || echo "restore of mlist-hlist.h fails" set `wc -c mlist-hlist.h`;Sum=$1 if test "$Sum" != "742" then echo original size 742, current size $Sum;fi echo "x - extracting pack.c (Text)" sed 's/^X//' << 'SHAR_EOF' > pack.c && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * pack.c X */ X X#include "tex.h" X#include "heap.h" X#include "arith.h" X#include "scan.h" X#include "tokenstack.h" X#include "eq.h" X#include "eqstack.h" X#include "evalstack.h" X#include "box.h" X#include "tfm.h" X#include "dvi.h" X#include "print.h" X#include "error.h" X#include "pack.h" X Xptr adjust_tail; Xval pack_begin_line; Xscal total_shrink[4]; Xscal total_stretch[4]; X X#define clr_dimens() \ X {d = x = 0; \ X total_stretch[FILLL] = 0; \ X total_stretch[FILL] = 0; \ X total_stretch[FIL] = 0; \ SHAR_EOF echo "End of part 10" echo "File pack.c is continued in part 11" echo "11" > s2_seq_.tmp exit 0
glenn@extro.ucc.su.oz.au (G Geers) (02/16/90)
---- Cut Here and unpack ---- #!/bin/sh # this is part 11 of a multipart archive # do not concatenate these parts, unpack them in order with /bin/sh # file pack.c continued # CurArch=11 if test ! -r s2_seq_.tmp then echo "Please unpack part 1 first!" exit 1; fi ( read Scheck if test "$Scheck" != $CurArch then echo "Please unpack part $Scheck next!" exit 1; else exit 0; fi ) < s2_seq_.tmp || exit 1 echo "x - Continuing file pack.c" sed 's/^X//' << 'SHAR_EOF' >> pack.c X total_stretch[NORMAL] = 0; \ X total_shrink[FILLL] = 0; \ X total_shrink[FILL] = 0; \ X total_shrink[FIL] = 0; \ X total_shrink[NORMAL] = 0;} X Xptr Xhpack (p, w, m) X ptr p; X scal w; X int m; X{ X int b; X scal d; X fnt f; X ptr g; X scal h; X fourq i; X gord o; X ptr q; X ptr r; X scal s; X scal x; X byte hd; X X r = get_node(BOX_NODE_SIZE); X type(r) = HLIST_NODE; X subtype(r) = MIN_QUARTERWORD; X shift_amount(r) = 0; X q = r + LIST_OFFSET; X link(q) = p; X h = 0; X clr_dimens(); X while (p != NULL) { Xreswitch: X while (is_char_node(p)) { X f = font(p); X i = char_info(f, character(p)); X hd = height_depth(i); X x += char_width(f, i); X s = char_height(f, hd); X if (s > h) X h = s; X s = char_depth(f, hd); X if (s > d) X d = s; X p = link(p); X } X if (p != NULL) { X switch (type(p)) X { X case HLIST_NODE: X case VLIST_NODE: X case RULE_NODE: X case UNSET_NODE: X x += width(p); X if (type(p) >= RULE_NODE) X s = 0; X else s = shift_amount(p); X if (height(p) - s > h) X h = height(p) - s; X if (depth(p) + s > d) X d = depth(p) + s; X break; X X case INS_NODE: X case MARK_NODE: X case ADJUST_NODE: X if (adjust_tail != NULL) { X while (link(q) != p) X q = link(q); X if (type(p) == ADJUST_NODE) { X link(adjust_tail) = adjust_ptr(p); X while (link(adjust_tail) != NULL) X adjust_tail = link(adjust_tail); X p = link(p); X free_node(link(q), SMALL_NODE_SIZE); X } else { X link(adjust_tail) = p; X adjust_tail = p; X p = link(p); X } X link(q) = p; X p = q; X } X break; X X case WHATSIT_NODE: X break; X X case GLUE_NODE: X g = glue_ptr(p); X x += width(g); X o = stretch_order(g); X total_stretch[o] += stretch(g); X o = shrink_order(g); X total_shrink[o] += shrink(g); X if (subtype(p) >= A_LEADERS) { X g = leader_ptr(p); X if (height(g) > h) X h = height(g); X if (depth(g) > d) X d = depth(g); X } X break; X X case KERN_NODE: X case MATH_NODE: X x += width(p); X break; X X case LIGATURE_NODE: X make_char_from_lig(); X goto reswitch; X break; X X default: X break; X } X p = link(p); X } X } X if (adjust_tail != NULL) X link(adjust_tail) = NULL; X height(r) = h; X depth(r) = d; X if (m == ADDITIONAL) X w += x; X width(r) = w; X x = w - x; X if (x == 0) { X glue_sign(r) = NORMAL; X glue_order(r) = NORMAL; X glue_set(r) = 0.0; X return r; X } else if (x > 0) { X get_stretch_order(); X glue_order(r) = o; X glue_sign(r) = STRETCHING; X if (total_stretch[o] != 0) X glue_set(r) = (float) x / total_stretch[o]; X else { X glue_sign(r) = NORMAL; X glue_set(r) = 0.0; X } X if (hbadness < INF_BAD && o == NORMAL && list_ptr(r) != NULL) { X b = badness(x, total_stretch[NORMAL]); X if (b > hbadness) { X print_ln(); X if (b > 100) X print_nl("Underfull"); X else print_nl("Loose"); X print(" \\hbox (badness "); X print_int(b); X goto common_end; X } X } X return r; X } else { X get_shrink_order(); X glue_order(r) = o; X glue_sign(r) = SHRINKING; X if (total_shrink[o] != 0) X glue_set(r) = (float) -x / total_shrink[o]; X else { X glue_sign(r) = NORMAL; X glue_set(r) = 0.0; X } X if (total_shrink[o] < -x && o == NORMAL && list_ptr(r) != NULL) { X glue_set(r) = 1.0; X if (-x - total_shrink[NORMAL] > hfuzz || hbadness < 100) { X if (overfull_rule > 0 && -x - total_shrink[NORMAL] > hfuzz) { X while (link(q) != NULL) X q = link(q); X link(q) = new_rule(); X width(link(q)) = overfull_rule; X } X print_ln(); X print_nl("Overfull \\hbox ("); X print_scaled(-x - total_shrink[NORMAL]); X print("pt too wide"); X goto common_end; X } X } else if (hbadness < 100 && o == NORMAL && list_ptr(r) != NULL) { X b = badness(-x, total_shrink[NORMAL]); X if (b > hbadness) { X print_ln(); X print_nl("Tight \\hbox (badness "); X print_int(b); X goto common_end; X } X } X return r; X } X Xcommon_end: X if (output_active) X print(") has occurred while \\output is active"); X else { X if (pack_begin_line != 0) { X if (pack_begin_line > 0) X print(") in paragraph at lines "); X else print(") in alignment at lines "); X print_val(abs(pack_begin_line)); X print("--"); X } else print(") detected at line "); X print_val(line); X } X print_ln(); X font_in_short_display = NULL_FONT; X short_display(list_ptr(r)); X print_ln(); X begin_diagnostic(); X show_box(r); X end_diagnostic(TRUE); X return r; X} X Xptr Xvpackage (p, h, m, l) X ptr p; X scal h; X int m; X scal l; X{ X int b; X scal d; X ptr g; X gord o; X ptr r; X scal s; X scal w; X scal x; X X r = get_node(BOX_NODE_SIZE); X type(r) = VLIST_NODE; X subtype(r) = MIN_QUARTERWORD; X shift_amount(r) = 0; X list_ptr(r) = p; X w = 0; X clr_dimens(); X while (p != NULL) { X if (is_char_node(p)) X confusion("vpack"); X else { X switch (type(p)) X { X case HLIST_NODE: X case VLIST_NODE: X case RULE_NODE: X case UNSET_NODE: X x += d + height(p); X d = depth(p); X if (type(p) >= RULE_NODE) X s = 0; X else s = shift_amount(p); X if (width(p) + s > w) X w = width(p) + s; X break; X X case WHATSIT_NODE: X break; X X case GLUE_NODE: X x += d; X d = 0; X g = glue_ptr(p); X x += width(g); X o = stretch_order(g); X total_stretch[o] += stretch(g); X o = shrink_order(g); X total_shrink[o] += shrink(g); X if (subtype(p) >= A_LEADERS) { X g = leader_ptr(p); X if (width(g) > w) X w = width(g); X } X break; X X case KERN_NODE: X x += d + width(p); X d = 0; X break; X X default: X break; X } X p = link(p); X } X } X width(r) = w; X if (d > l) { X x += d - l; X depth(r) = l; X } else depth(r) = d; X if (m == ADDITIONAL) X h += x; X height(r) = h; X x = h - x; X if (x == 0) { X glue_sign(r) = NORMAL; X glue_order(r) = NORMAL; X glue_set(r) = 0.0; X return r; X } else if (x > 0) { X get_stretch_order(); X glue_order(r) = o; X glue_sign(r) = STRETCHING; X if (total_stretch[o] != 0) X glue_set(r) = (float) x / total_stretch[o]; X else { X glue_sign(r) = NORMAL; X glue_set(r) = 0.0; X } X if (vbadness < INF_BAD && o == NORMAL && list_ptr(r) != NULL) { X b = badness(x, total_stretch[NORMAL]); X if (b > vbadness) { X print_ln(); X if (b > 100) X print_nl("Underfull"); X else print_nl("Loose"); X print(" \\vbox (badness "); X print_int(b); X goto common_end; X } X } X return r; X } else { X get_shrink_order(); X glue_order(r) = o; X glue_sign(r) = SHRINKING; X if (total_shrink[o] != 0) X glue_set(r) = (float) -x / total_shrink[o]; X else { X glue_sign(r) = NORMAL; X glue_set(r) = 0.0; X } X if (total_shrink[o] < -x && o == NORMAL && list_ptr(r) != NULL) { X glue_set(r) = 1.0; X if (-x - total_shrink[NORMAL] > vfuzz || vbadness < 100) { X print_ln(); X print_nl("Overfull \\vbox ("); X print_scaled(-x - total_shrink[NORMAL]); X print("pt too high"); X goto common_end; X } X } else if (vbadness < 100 && o == NORMAL && list_ptr(r) != NULL) { X b = badness(-x, total_shrink[NORMAL]); X if (b > vbadness) { X print_ln(); X print_nl("Tight \\vbox (badness "); X print_int(b); X goto common_end; X } X } X return r; X } X Xcommon_end: X if (output_active) X print(") has occurred while \\output is active"); X else { X if (pack_begin_line != 0) { X print(") in alignment at lines "); X print_val(abs(pack_begin_line)); X print("--"); X } else print(") detected at line "); X print_val(line); X print_ln(); X } X begin_diagnostic(); X show_box(r); X end_diagnostic(TRUE); X return r; X} SHAR_EOF echo "File pack.c is complete" chmod 0444 pack.c || echo "restore of pack.c fails" set `wc -c pack.c`;Sum=$1 if test "$Sum" != "8143" then echo original size 8143, current size $Sum;fi echo "x - extracting pack.h (Text)" sed 's/^X//' << 'SHAR_EOF' > pack.h && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * pack.h X */ X X#define EXACTLY 0 X#define ADDITIONAL 1 X#define NATURAL 0L, ADDITIONAL X Xglobal ptr adjust_tail; Xglobal scal total_stretch[]; Xglobal scal total_shrink[]; X Xglobal long pack_begin_line; X X#define make_char_from_lig() \ X {mem[lig_trick] = mem[lig_char(p)]; \ X link(lig_trick) = link(p); \ X p = lig_trick;} X X#define get_stretch_order() \ X {if (total_stretch[FILLL] != 0) o = FILLL; \ X else if (total_stretch[FILL] != 0) o = FILL; \ X else if (total_stretch[FIL] != 0) o = FIL; \ X else o = NORMAL;} X X#define get_shrink_order() \ X {if (total_shrink[FILLL] != 0) o = FILLL; \ X else if (total_shrink[FILL] != 0) o = FILL; \ X else if (total_shrink[FIL] != 0) o = FIL; \ X else o = NORMAL;} X X#define vpack(P, H) vpackage(P, H, MAX_DIMEN) Xptr vpackage(); Xptr hpack(); SHAR_EOF chmod 0444 pack.h || echo "restore of pack.h fails" set `wc -c pack.h`;Sum=$1 if test "$Sum" != "1000" then echo original size 1000, current size $Sum;fi echo "x - extracting page.c (Text)" sed 's/^X//' << 'SHAR_EOF' > page.c && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * page.c X */ X X#include "tex.h" X#include "heap.h" X#include "arith.h" X#include "str.h" X#include "token.h" X#include "tokenstack.h" X#include "tokenlists.h" X#include "eq.h" X#include "eqstack.h" X#include "evalstack.h" X#include "scan.h" X#include "expand.h" X#include "box.h" X#include "pack.h" X#include "par.h" X#include "math.h" X#include "dvi.h" X#include "print.h" X#include "error.h" X#include "page.h" X Xscal best_height_plus_depth; Xptr best_page_break; Xscal best_size; Xscal cur_page_depth; Xval insert_penalties; Xptr last_glue = MAX_HALFWORD; Xscal last_kern; Xval last_penalty; Xval least_page_cost; Xbool output_active; Xint page_contents; Xscal page_max_depth; Xptr page_tail; Xscal page_so_far[8]; X X#define set_page_so_far_zero(P) (page_so_far[P] = 0) X#define set_height_zero(H) (active_height[H] = 0) X Xptr Xprune_page_top (p) X ptr p; X{ X ptr q; X ptr prev_p; X X prev_p = temp_head; X link(temp_head) = p; X while (p != NULL) { X switch (type(p)) X { X case HLIST_NODE: X case VLIST_NODE: X case RULE_NODE: X q = new_skip_param(SPLIT_TOP_SKIP_CODE); X link(prev_p) = q; X link(q) = p; X if (width(temp_ptr) > height(p)) X width(temp_ptr) -= height(p); X else width(temp_ptr) = 0; X p = NULL; X break; X X case WHATSIT_NODE: X case MARK_NODE: X case INS_NODE: X prev_p = p; X p = link(prev_p); X break; X X case GLUE_NODE: X case KERN_NODE: X case PENALTY_NODE: X q = p; X p = link(q); X link(q) = NULL; X link(prev_p) = p; X flush_node_list(q); X break; X X default: X confusion("pruning"); X break; X } X } X return (link(temp_head)); X} X Xptr Xvert_break (p, h, d) X ptr p; X scal h; X scal d; X{ X val b; X ptr q; X ptr r; X int t; X val pi; X ptr prev_p; X scal prev_dp; X ptr best_place; X val least_cost; X X prev_p = p; X least_cost = AWFUL_BAD; X do_all_six(set_height_zero); X prev_dp = 0; X loop { X if (p == NULL) X pi = EJECT_PENALTY; X else { X switch (type(p)) X { X case HLIST_NODE: X case VLIST_NODE: X case RULE_NODE: X cur_height = cur_height + prev_dp + height(p); X prev_dp = depth(p); X goto not_found; X break; X X case WHATSIT_NODE: X goto not_found; X break; X X case GLUE_NODE: X if (precedes_break(prev_p)) X pi = 0; X else goto update_heights; X break; X X case KERN_NODE: X if (link(p) == NULL) X t = PENALTY_NODE; X else t = type(link(p)); X if (t == GLUE_NODE) X pi = 0; X else goto update_heights; X break; X X case PENALTY_NODE: X pi = penalty(p); X break; X X case MARK_NODE: X case INS_NODE: X goto not_found; X break; X X default: X confusion("vertbreak"); X break; X } X } X if (pi < INF_PENALTY) { X if (cur_height < h) { X if (active_height[3] != 0 || X active_height[4] != 0 || X active_height[5] != 0) X b = 0; X else b = badness(h - cur_height, active_height[2]); X } else if (cur_height - h > active_height[6]) X b = AWFUL_BAD; X else b = badness(cur_height - h, active_height[6]); X if (b < AWFUL_BAD) { X if (pi <= EJECT_PENALTY) X b = pi; X else if (b < INF_BAD) X b += pi; X else b = DEPLORABLE; X } X if (b <= least_cost) { X best_place = p; X least_cost = b; X best_height_plus_depth = cur_height + prev_dp; X } X if (b == AWFUL_BAD || pi <= EJECT_PENALTY) X return best_place; X } X if (type(p) < GLUE_NODE || type(p) > KERN_NODE) X goto not_found; X X update_heights: X if (type(p) == KERN_NODE) X q = p; X else { X q = glue_ptr(p); X active_height[2 + stretch_order(q)] += stretch(q); X active_height[6] += shrink(q); X if (shrink_order(q) != NORMAL && shrink(q) != 0) { X print_err("Infinite glue shrinkage found in box being split"); X help_inf_shrink_box(); X error(); X r = new_spec(q); X delete_glue_ref(q); X shrink_order(r) = NORMAL; X glue_ptr(p) = r; X } X } X cur_height = cur_height + prev_dp + width(q); X prev_dp = 0; X X not_found: X if (prev_dp > d) { X cur_height = cur_height + prev_dp - d; X prev_dp = d; X } X prev_p = p; X p = link(prev_p); X } X} X Xptr Xvsplit (n, h) X int n; X scal h; X{ X ptr p; X ptr q; X ptr v; X X v = box(n); X if (split_first_mark != NULL) { X delete_token_ref(split_first_mark); X split_first_mark = NULL; X delete_token_ref(split_bot_mark); X split_bot_mark = NULL; X } X if (v == NULL) X return NULL; X if (type(v) != VLIST_NODE) { X print_err(""); X print_esc("vsplit"); X print(" needs a "); X print_esc("vbox"); X help_vsplit_vbox(); X error(); X return NULL; X } X q = vert_break(list_ptr(v), h, split_max_depth); X p = list_ptr(v); X if (p == q) X list_ptr(v) = NULL; X else { X loop { X if (type(p) == MARK_NODE) { X if (split_first_mark == NULL) { X split_first_mark = mark_ptr(p); X split_bot_mark = split_first_mark; X token_ref_count(split_first_mark) += 2; X } else { X delete_token_ref(split_bot_mark); X split_bot_mark = mark_ptr(p); X add_token_ref(split_bot_mark); X } X } X if (link(p) == q) { X link(p) = NULL; X break; X } X p = link(p); X } X } X q = prune_page_top(q); X p = list_ptr(v); X free_node(v, BOX_NODE_SIZE); X if (q == NULL) X box(n) = NULL; X else box(n) = vpack(q, NATURAL); X return (vpackage(p, h, EXACTLY, split_max_depth)); X} X Xfreeze_page_specs (s) X int s; X{ X page_contents = s; X page_goal = vsize; X page_max_depth = max_depth; X page_depth = 0; X do_all_six(set_page_so_far_zero); X least_page_cost = AWFUL_BAD; X#ifdef STAT X if (tracing_pages > 0) { X begin_diagnostic(); X print_nl("%% goal height="); X print_scaled(page_goal); X print(", max depth="); X print_scaled(page_max_depth); X end_diagnostic(FALSE); X } X#endif X} X Xbox_error (n) X int n; X{ X error(); X begin_diagnostic(); X print_nl("The following box has been deleted:"); X show_box(box(n)); X end_diagnostic(TRUE); X flush_node_list(box(n)); X box(n) = NULL; X} X Xensure_vbox (n) X int n; X{ X ptr p; X X p = box(n); X if (p != NULL && type(p) == HLIST_NODE) { X print_err("Insertions can only be added to a vbox"); X help_tut(); X box_error(n); X } X} X Xprint_plus (s, o) X int s; X char* o; X{ X if (page_so_far[s] != 0) { X print(" plus "); X print_scaled(page_so_far[s]); X print(o); X } X} X Xprint_totals () X{ X print_scaled(page_total); X print_plus(2, ""); X print_plus(3, "fil"); X print_plus(4, "fill"); X print_plus(5, "filll"); X if (page_shrink != 0) { X print(" minus "); X print_scaled(page_shrink); X } X} X X#ifdef STAT Xshow_split(n, w, q) X int n; X scal w; X ptr q; X{ X begin_diagnostic(); X print_nl("% split"); X print_int(n); X print(" to "); X print_scaled(w); X print_char(','); X print_scaled(best_height_plus_depth); X print(" p="); X if (q == NULL) X print_int(EJECT_PENALTY); X else if (type(q) == PENALTY_NODE) X print_val(penalty(q)); X else print_char('0'); X end_diagnostic(FALSE); X} X Xshow_page_stats (b, p, c) X val b; X val p; X val c; X{ X if (tracing_pages > 0) { X begin_diagnostic(); X print_nl("%"); X print(" t="); X print_totals(); X print(" g="); X print_scaled(page_goal); X print(" b="); X if (b == AWFUL_BAD) X print_char('*'); X else print_val(b); X print(" p="); X print_val(p); X print(" c="); X if (c == AWFUL_BAD) X print_char('*'); X else print_val(c); X if (c <= least_page_cost) X print_char('#'); X end_diagnostic(FALSE); X } X} X#endif X Xbuild_page () X{ X val b; X val c; X scal h; X int n; X ptr p; X ptr q; X ptr r; X scal w; X val pi; X scal delta; X X if (link(contrib_head) == NULL || output_active) X return; X do { X p = link(contrib_head); X if (last_glue != MAX_HALFWORD) X delete_glue_ref(last_glue); X last_penalty = 0; X last_kern = 0; X if (type(p) == GLUE_NODE) { X last_glue = glue_ptr(p); X add_glue_ref(last_glue); X } else { X last_glue = MAX_HALFWORD; X if (type(p) == PENALTY_NODE) X last_penalty = penalty(p); X else if (type(p) == KERN_NODE) X last_kern = width(p); X } X switch (type(p)) X { X case HLIST_NODE: X case VLIST_NODE: X case RULE_NODE: X if (page_contents < BOX_THERE) { X if (page_contents == EMPTY) X freeze_page_specs(BOX_THERE); X else page_contents = BOX_THERE; X q = new_skip_param(TOP_SKIP_CODE); X link(q) = p; X if (width(temp_ptr) > height(p)) X width(temp_ptr) -= height(p); X else width(temp_ptr) = 0; X link(q) = p; X link(contrib_head) = q; X continue; X } else { X page_total = page_total + page_depth + height(p); X page_depth = depth(p); X goto contribute; X } X break; X X case WHATSIT_NODE: X goto contribute; X break; X X case GLUE_NODE: X if (page_contents < BOX_THERE) X goto done; X else if (precedes_break(page_tail)) X pi = 0; X else goto update_heights; X break; X X case KERN_NODE: X if (page_contents < BOX_THERE) X goto done; X else if (link(p) == NULL) X return; X else if (type(link(p)) == GLUE_NODE) X pi = 0; X else goto update_heights; X break; X X case PENALTY_NODE: X if (page_contents < BOX_THERE) X goto done; X else pi = penalty(p); X break; X X case MARK_NODE: X goto contribute; X break; X X case INS_NODE: X if (page_contents == EMPTY) X freeze_page_specs(INSERTS_ONLY); X n = subtype(p); X r = page_ins_head; X while (n >= subtype(link(r))) X r = link(r); X if (subtype(r) != n) { X q = get_node(PAGE_INS_NODE_SIZE); X link(q) = link(r); X link(r) = q; X r = q; X subtype(r) = qi(n); X type(r) = INSERTING; X ensure_vbox(n); X if (box(n) == NULL) X height(r) = 0; X else height(r) = height(box(n)) + depth(box(n)); X best_ins_ptr(r) = NULL; X q = skip(n); X if (count(n) == 1000) X h = height(r); X else h = x_over_n(height(r), 1000L) * count(n); X page_goal = page_goal - h - width(q); X page_so_far[2 + stretch_order(q)] += stretch(q); X page_shrink += shrink(q); X if (shrink_order(q) != NORMAL && shrink(q) != 0) { X print_err("Infinite glue shrinkage inserted from "); X print_esc("skip"); X print_int(n); X help_inf_shrink_ins(); X error(); X } X } X if (type(r) == SPLIT_UP) X insert_penalties += float_cost(p); X else { X last_ins_ptr(r) = p; X delta = page_goal - page_total - page_depth + page_shrink; X if (count(n) == 1000) X h = height(p); X else h = x_over_n(height(p), 1000L) * count(n); X if ((h <= 0 || h <= delta) && X height(p) + height(r) <= dimen(n)) { X page_goal -= h; X height(r) += height(p); X } else { X if (count(n) <= 0) X w = MAX_DIMEN; X else { X w = page_goal - page_total - page_depth; X if (count(n) != 1000) X w = x_over_n(w, count(n)) * 1000; X } X if (w > dimen(n) - height(r)) X w = dimen(n) - height(r); X q = vert_break(ins_ptr(p), w, depth(p)); X height(r) += best_height_plus_depth; X#ifdef STAT X show_split(n, w, q); X#endif X if (count(n) != 1000) X best_height_plus_depth = X x_over_n(best_height_plus_depth, 1000L) * count(n); X page_goal -= best_height_plus_depth; X type(r) = SPLIT_UP; X broken_ptr(r) = q; X broken_ins(r) = p; X if (q == NULL) X insert_penalties += EJECT_PENALTY; X else if (type(q) == PENALTY_NODE) X insert_penalties += penalty(q); X } X } X goto contribute; X break; X X default: X confusion("page"); X break; X } X if (pi < INF_PENALTY) { X if (page_total < page_goal) { X if (page_so_far[3] != 0 || X page_so_far[4] != 0 || X page_so_far[5] != 0) X b = 0; X else b = badness(page_goal - page_total, page_so_far[2]); X } else if (page_total - page_goal > page_shrink) X b = AWFUL_BAD; X else b = badness(page_total - page_goal, page_shrink); X if (b < AWFUL_BAD) { X if (pi <= EJECT_PENALTY) X c = pi; X else if (b < INF_BAD) X c = b + pi + insert_penalties; X else c = DEPLORABLE; X } else c = b; X if (insert_penalties >= 10000) X c = AWFUL_BAD; X#ifdef STAT X show_page_stats(b, pi, c); X#endif X if (c <= least_page_cost) { X best_page_break = p; X best_size = page_goal; X least_page_cost = c; X r = link(page_ins_head); X while (r != page_ins_head) { X best_ins_ptr(r) = last_ins_ptr(r); X r = link(r); X } X } X if (c == AWFUL_BAD || pi <= EJECT_PENALTY) { X fire_up(p); X if (output_active) return; X continue; X } X } X if (type(p) < GLUE_NODE || type(p) > KERN_NODE) X goto contribute; X X update_heights: X if (type(p) == KERN_NODE) X q = p; X else { X q = glue_ptr(p); X page_so_far[2 + stretch_order(q)] += stretch(q); X page_shrink += shrink(q); X if (shrink_order(q) != NORMAL && shrink(q) != 0) { X print_err("Infinite glue shrinkage found on current page"); X help_inf_shrink_page(); X error(); X r = new_spec(q); X shrink_order(r) = NORMAL; X delete_glue_ref(q); X glue_ptr(p) = r; X } X } X page_total = page_total + page_depth + width(q); X page_depth = 0; X X contribute: X if (page_depth > page_max_depth) { X page_total = page_total + page_depth - page_max_depth; X page_depth = page_max_depth; X } X link(page_tail) = p; X page_tail = p; X link(contrib_head) = link(p); X link(p) = NULL; X continue; X X done: X link(contrib_head) = link(p); X link(p) = NULL; X flush_node_list(p); X } while (link(contrib_head) != NULL); X if (nest_ptr == 0) X tail = contrib_head; X else contrib_tail = contrib_head; X} X Xfire_up (c) X ptr c; X{ X int n; X ptr p; X ptr q; X ptr r; X ptr s; X bool wait; X ptr prev_p; X scal save_vfuzz; X val save_vbadness; X ptr save_split_top_skip; X X if (type(best_page_break) == PENALTY_NODE) { X geq_word_define(INT_BASE+OUTPUT_PENALTY_CODE, penalty(best_page_break)); X penalty(best_page_break) = INF_PENALTY; X } else geq_word_define(INT_BASE+OUTPUT_PENALTY_CODE, INF_PENALTY); X if (bot_mark != NULL) { X if (top_mark != NULL) X delete_token_ref(top_mark); X top_mark = bot_mark; X add_token_ref(top_mark); X delete_token_ref(first_mark); X first_mark = NULL; X } X if (c == best_page_break) X best_page_break = NULL; X if (box(255) != NULL) { X print_err(""); X print_esc("box"); X print("255 is not void"); X help_box_255(); X box_error(255); X } X insert_penalties = 0; X save_split_top_skip = split_top_skip; X r = link(page_ins_head); X while (r != page_ins_head) { X if (best_ins_ptr(r) != NULL) { X n = qo(subtype(r)); X ensure_vbox(n); X if (box(n) == NULL) X box(n) = new_null_box(); X p = box(n) + LIST_OFFSET; X while (link(p) != NULL) X p = link(p); X last_ins_ptr(r) = p; X } X r = link(r); X } X q = hold_head; X link(q) = NULL; X prev_p = page_head; X p = link(prev_p); X while (p != best_page_break) { X if (type(p) == INS_NODE) { X r = link(page_ins_head); X while (subtype(r) != subtype(p)) X r = link(r); X if (best_ins_ptr(r) == NULL) X wait = TRUE; X else { X wait = FALSE; X s = ins_ptr(p); X link(last_ins_ptr(r)) = s; X s = last_ins_ptr(r); X if (best_ins_ptr(r) == p) { X if (type(r) == SPLIT_UP && X broken_ins(r) == p && X broken_ptr(r) != NULL) { X while (link(s) != broken_ptr(r)) X s = link(s); X split_top_skip = split_top_ptr(p); X ins_ptr(p) = prune_page_top(broken_ptr(r)); X if (ins_ptr(p) != NULL) { X temp_ptr = vpack(ins_ptr(p), NATURAL); X height(p) = height(temp_ptr) + depth(temp_ptr); X free_node(temp_ptr, BOX_NODE_SIZE); X wait = TRUE; X } X link(s) = NULL; X } X best_ins_ptr(r) = NULL; X n = qo(subtype(r)); X temp_ptr = list_ptr(box(n)); X free_node(box(n), BOX_NODE_SIZE); X box(n) = vpack(temp_ptr, NATURAL); X } else { X while (link(s) != NULL) X s = link(s); X last_ins_ptr(r) = s; X } X } X link(prev_p) = link(p); X link(p) = NULL; X if (wait) { X link(q) = p; X q = p; X incr(insert_penalties); X } else { X delete_glue_ref(split_top_ptr(p)); X free_node(p, INS_NODE_SIZE); X } X p = prev_p; X } else if (type(p) == MARK_NODE) { X if (first_mark == NULL) { X first_mark = mark_ptr(p); X add_token_ref(first_mark); X } X if (bot_mark != NULL) X delete_token_ref(bot_mark); X bot_mark = mark_ptr(p); X add_token_ref(bot_mark); X } X prev_p = p; X p = link(prev_p); X } X split_top_skip = save_split_top_skip; X if (p != NULL) { X if (link(contrib_head) == NULL) { X if (nest_ptr == 0) X tail = page_tail; X else contrib_tail = page_tail; X } X link(page_tail) = link(contrib_head); X link(contrib_head) = p; X link(prev_p) = NULL; X } X save_vbadness = vbadness; X vbadness = INF_BAD; X save_vfuzz = vfuzz; X vfuzz = MAX_DIMEN; X box(255) = vpackage(link(page_head), best_size, EXACTLY, page_max_depth); X vbadness = save_vbadness; X vfuzz = save_vfuzz; X if (last_glue != MAX_HALFWORD) X delete_glue_ref(last_glue); X start_new_page(); X if (q != hold_head) { X link(page_head) = link(hold_head); X page_tail = q; X } X r = link(page_ins_head); X while (r != page_ins_head) { X q = link(r); X free_node(r, PAGE_INS_NODE_SIZE); X r = q; X } X link(page_ins_head) = page_ins_head; X if (top_mark != NULL && first_mark == NULL) { X first_mark = top_mark; X add_token_ref(top_mark); X } X if (output_routine != NULL) { X if (dead_cycles >= max_dead_cycles) { X print_err("Output loop---"); X print_int(dead_cycles); X print(" consecutive dead cycles"); X help_dead_cycles(); X error(); X } else { X output_active = TRUE; X incr(dead_cycles); X push_nest(); X mode = -VMODE; X prev_depth = IGNORE_DEPTH; X mode_line = -line; X begin_token_list(output_routine, OUTPUT_TEXT); X new_save_level(OUTPUT_GROUP); X normal_paragraph(); X scan_left_brace(); X return; X } X } X if (link(page_head) != NULL) { X if (link(contrib_head) == NULL) { X if (nest_ptr == 0) tail = page_tail; X else contrib_tail = page_tail; X } else link(page_tail) = link(contrib_head); X link(contrib_head) = link(page_head); X link(page_head) = NULL; X page_tail = page_head; X } X ship_out(box(255)); X box(255) = NULL; X} X X/* X * Help text X */ X Xhelp_tut () X{ X help3("Tut tut: You're trying to \\insert into a", X "\\box register that now contains an \\hbox.", X "Proceed, and I'll discard its present contents."); X} X Xhelp_vsplit_vbox () X{ X help2("The box you are trying to split is an \\hbox.", X "I can't split such boxes, so I'll leave it alone."); X} X Xhelp_inf_shrink_ins () X{ X help3("The correction glue for page breaking with insertions", X "must have finite shrinkability. But you may proceed,", X "since the offensive shrinkability has been made finite."); X} X Xhelp_inf_shrink_box () X{ X help4("The box you are \\vsplitting contains some infinitely", X "shrinkable glue, e.g., `\\vss' or `\\vskip 0pt minus 1fil'.", X "Such glue doesn't belong there; but you can safely proceed,", X "since the offensive shrinkability has been made finite."); X} X Xhelp_inf_shrink_page () X{ X help4("The page about to be output contains some infinitely ", X "shrinkable glue, e.g., `\\vss' or `\\vskip 0pt minus 1fil'.", X "Such glue doesn't belong there; but you can safely proceed,", X "since the offensive shrinkability has been made finite."); X} X Xhelp_box_255 () X{ X help2("You shouldn't use \\box255 except in \\output routines.", X "Proceed, and I'll discard its present contents."); X} X Xhelp_dead_cycles () X{ X help3("I've concluded that your \\output is awry; it never does a", X "\\shipout, so I'm shipping \\box255 out myself. Next time", X "increase \\maxdeadcycles if you want me to be more patient!"); X} SHAR_EOF chmod 0444 page.c || echo "restore of page.c fails" set `wc -c page.c`;Sum=$1 if test "$Sum" != "19118" then echo original size 19118, current size $Sum;fi echo "x - extracting page.h (Text)" sed 's/^X//' << 'SHAR_EOF' > page.h && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * page.h X */ X Xglobal ptr last_page_glue; X X#define active_height active_width X#define cur_height active_height[1] X Xptr prune_page_top(); X Xglobal scal best_height_plus_depth; X#define DEPLORABLE 100000 X Xptr vert_break(); Xptr vsplit(); X Xglobal ptr page_tail; Xglobal int page_contents; X X#define INSERTS_ONLY 1 X#define BOX_THERE 2 X Xglobal ptr best_page_break; Xglobal scal best_size; Xglobal scal page_max_depth; Xglobal val least_page_cost; X X#define INSERTING 0 X#define SPLIT_UP 1 X#define broken_ptr(N) link(N + 1) X#define broken_ins(N) info(N + 1) X#define last_ins_ptr(N) link(N + 2) X#define best_ins_ptr(N) info(N + 2) X#define PAGE_INS_NODE_SIZE 4 X Xglobal scal page_so_far[]; X X#define page_goal page_so_far[0] X#define page_total page_so_far[1] X#define page_shrink page_so_far[6] X#define page_depth page_so_far[7] X Xglobal ptr last_glue; Xglobal val last_penalty; Xglobal scal last_kern; Xglobal val insert_penalties; X Xint print_totals(); X X#define start_new_page() \ X {page_contents = EMPTY; \ X page_tail = page_head; \ X link(page_head) = NULL; \ X last_glue = MAX_HALFWORD; \ X last_penalty = 0; \ X last_kern = 0; \ X page_depth = 0; \ X page_max_depth = 0;} X Xint freeze_page_specs(); X Xglobal bool output_active; X Xint ensure_vbox(); Xint box_error(); Xint build_page(); Xint fire_up(); X X#define contrib_tail nest[0].tail_field SHAR_EOF chmod 0444 page.h || echo "restore of page.h fails" set `wc -c page.h`;Sum=$1 if test "$Sum" != "1565" then echo original size 1565, current size $Sum;fi echo "x - extracting par.c (Text)" sed 's/^X//' << 'SHAR_EOF' > par.c && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * par.c X */ X X#include "tex.h" X#include "heap.h" X#include "arith.h" X#include "eq.h" X#include "tfm.h" X#include "str.h" X#include "tokenstack.h" X#include "evalstack.h" X#include "box.h" X#include "pack.h" X#include "hyph.h" X#include "print.h" X#include "error.h" X#include "par.h" X Xscal active_width[7]; Xval actual_looseness; Xscal background[7]; Xptr best_bet; Xhword best_line; Xhword best_pl_line[4]; Xptr best_place[4]; Xscal break_width[7]; Xscal cur_active_width[7]; Xptr cur_p; Xscal disc_width; Xhword easy_line; Xval fewest_demerits; Xscal first_indent; Xscal first_width; Xptr just_box; Xhword last_special_line; Xint line_diff; Xval minimal_demerits[4]; Xval minimum_demerits; Xbool no_shrink_error_yet; Xptr passive; Xptr printed_node; Xptr pass_number; Xscal second_indent; Xbool second_pass; Xscal second_width; Xval threshold; X X#define act_width active_width[1] X X#define store_background(W) \ X (active_width[W] = background[W]) X X#define store_break_width(W) \ X (active_width[W] = break_width[W]) X X#define update_active(W) \ X (active_width[W] += mem[r + W].sc) X X#define copy_to_cur_active(W) \ X (cur_active_width[W] = active_width[W]) X X#define downdate_width(W) \ X (cur_active_width[W] -= mem[prev_r + W].sc) X X#define update_width(W) \ X (cur_active_width[W] += mem[r + W].sc) X X#define set_break_width_to_background(W) \ X (break_width[W] = background[W]) X X#define combine_two_deltas(W) \ X (mem[prev_r + W].sc += mem[r + W].sc) X X#define convert_to_break_width(W) \ X (mem[prev_r + W].sc = mem[prev_r + W].sc + \ X break_width[W] - cur_active_width[W]) X X#define new_delta_to_break_width(W) \ X (mem[q + W].sc = break_width[W] - cur_active_width[W]) X X#define new_delta_from_break_width(W) \ X (mem[q + W].sc = cur_active_width[W] - break_width[W]) X X#define width_lig_char(C) \ X char_width(font(lig_char(C)), \ X char_info(font(lig_char(C)), character(lig_char(C)))) X X#define width_char(C) \ X char_width(font(C), char_info(font(C), character(C))) X X#ifdef STAT Xshow_break_node (q, f, h) X ptr q; X int f; X int h; X{ X if (tracing_paragraphs > 0) { X print_nl("@@"); X print_int(serial(passive)); X print(": line "); X print_int(line_number(q) - 1); X print_char('.'); X print_int(f); X if (h == HYPHENATED) X print_char('-'); X print(" t="); X print_val(total_demerits(q)); X print(" -> @@"); X if (prev_break(passive) == NULL) X print("0"); X else print_int(serial(prev_break(passive))); X } X} X Xshow_break_status (r, a, b, p, d) X ptr r; X bool a; X val b; X val p; X val d; X{ X ptr save_link; X X if (tracing_paragraphs > 0) { X if (printed_node != cur_p) { X print_nl(""); X if (cur_p == NULL) X short_display(link(printed_node)); X else { X save_link = link(cur_p); X link(cur_p) = NULL; X print_nl(""); X short_display(link(printed_node)); X link(cur_p) = save_link; X } X printed_node = cur_p; X } X print_nl("@"); X if (cur_p == NULL) X print_esc("par"); X else if (type(cur_p) != GLUE_NODE) { X if (type(cur_p) == PENALTY_NODE) X print_esc("penalty"); X else if (type(cur_p) == DISC_NODE) X print_esc("discretionary"); X else if (type(cur_p) == KERN_NODE) X print_esc("kern"); X else print_esc("math"); X } X print(" via @@"); X if (break_node(r) == NULL) X print_char('0'); X else print_int(serial(break_node(r))); X print(" b="); X if (a) print_char('*'); X else print_val(b); X print(" p="); X print_val(p); X print(" d="); X print_val(d); X } X} X Xupdate_printed_node() X{ X qword t; X X if (cur_p == printed_node && X cur_p != NULL && X type(cur_p) == DISC_NODE) X for (t = replace_count(cur_p); t > 0; decr(t)) X printed_node = link(printed_node); X} X#endif X Xset_break_width (break_type) X int break_type; X{ X ptr s; X int t; X ptr v; X X do_all_six(set_break_width_to_background); X s = cur_p; X if (break_type > UNHYPHENATED && cur_p != NULL) { X t = replace_count(cur_p); X v = cur_p; X s = post_break(cur_p); X while (t > 0) { X decr(t); X v = link(v); X if (is_char_node(v)) X break_width[1] -= width_char(v); X else { X switch (type(v)) X { X case LIGATURE_NODE: X break_width[1] -= width_lig_char(v); X break; X X case HLIST_NODE: X case VLIST_NODE: X case RULE_NODE: X case KERN_NODE: X break_width[1] -= width(v); X break; X X default: X confusion("disc1"); X break; X } X } X } X for (; s != NULL; s = link(s)) { X if (is_char_node(s)) X break_width[1] += width_char(s); X else { X switch (type(s)) X { X case LIGATURE_NODE: X break_width[1] += width_lig_char(s); X break; X X case HLIST_NODE: X case VLIST_NODE: X case RULE_NODE: X break_width[1] += width(s); X break; X X case KERN_NODE: X if (t == 0 && subtype(s) != ACC_KERN) X t = -1; /* discardable */ X else X break_width[1] += width(s); X break; X X default: X confusion("disc2"); X break; X } X } X incr(t); X } X break_width[1] += disc_width; X if (t == 0) X s = link(v); /* more nodes may be discardable after X the break */ X } X for (; s != NULL; s = link(s)) { X if (is_char_node(s)) X return; X switch (type(s)) { X case GLUE_NODE: X v = glue_ptr(s); X break_width[1] -= width(v); X break_width[2 + stretch_order(v)] -= stretch(v); X break_width[6] -= shrink(v); X break; X X case PENALTY_NODE: X break; X X case MATH_NODE: X case KERN_NODE: X if (subtype(s) == ACC_KERN) X return; X else break_width[1] -= width(s); X break; X X default: X return; X break; X } X } X} X Xtry_break (pi, break_type) X val pi; X int break_type; X{ X val b; X val d; X hword l; X ptr q; X ptr r; X hword old_l; X ptr prev_r; X int fit_class; X scal shortfall; X scal line_width; X ptr prev_prev_r; X bool no_break_yet; X bool artificial_badness; X bool node_r_stays_active; X X no_break_yet = TRUE; X old_l = 0; X prev_r = active; X if (abs(pi) >= INF_PENALTY) { X if (pi > 0) { X#ifdef STAT X update_printed_node(); X#endif X return; X } else X pi = EJECT_PENALTY; X } X do_all_six(copy_to_cur_active); X loop { X r = link(prev_r); X if (type(r) == DELTA_NODE) { X do_all_six(update_width); X prev_prev_r = prev_r; X prev_r = r; X continue; X } X l = line_number(r); X if (l > old_l) { X if (minimum_demerits < AWFUL_BAD && X (old_l != easy_line || r == last_active)) { X if (no_break_yet) { X no_break_yet = FALSE; X set_break_width(break_type); X } X if (type(prev_r) == DELTA_NODE) { X do_all_six(convert_to_break_width); X } else if (prev_r == active) { X do_all_six(store_break_width); X } else { X q = get_node(DELTA_NODE_SIZE); X link(q) = r; X type(q) = DELTA_NODE; X subtype(q) = 0; X do_all_six(new_delta_to_break_width); X link(prev_r) = q; X prev_prev_r = prev_r; X prev_r = q; X } X minimum_demerits += abs(adj_demerits); X fit_class = VERY_LOOSE_FIT; X while (fit_class <= TIGHT_FIT) { X if (minimal_demerits[fit_class] <= minimum_demerits) { X q = get_node(PASSIVE_NODE_SIZE); X link(q) = passive; X passive = q; X cur_break(q) = cur_p; X#ifdef STAT X incr(pass_number); X serial(q) = pass_number; X#endif X prev_break(q) = best_place[fit_class]; X q = get_node(ACTIVE_NODE_SIZE); X break_node(q) = passive; X line_number(q) = best_pl_line[fit_class] + 1; X fitness(q) = fit_class; X type(q) = break_type; X total_demerits(q) = minimal_demerits[fit_class]; X link(q) = r; X link(prev_r) = q; X prev_r = q; X#ifdef STAT X show_break_node(q, fit_class, break_type); X#endif X } X minimal_demerits[fit_class] = AWFUL_BAD; X incr(fit_class); X } X minimum_demerits = AWFUL_BAD; X if (r != last_active) { X q = get_node(DELTA_NODE_SIZE); X link(q) = r; X type(q) = DELTA_NODE; X subtype(q) = 0; X do_all_six(new_delta_from_break_width); X link(prev_r) = q; X prev_prev_r = prev_r; X prev_r = q; X } X } X if (r == last_active) { X#ifdef STAT X update_printed_node(); X#endif X return; X } X if (l > easy_line) { X line_width = second_width; X old_l = MAX_HALFWORD - 1; X } else { X old_l = l; X if (l > last_special_line) X line_width = second_width; X else if (par_shape_ptr == NULL) X line_width = first_width; X else line_width = mem[par_shape_ptr + 2 * l].sc; X } X } X#ifdef STAT X artificial_badness = FALSE; X#endif X shortfall = line_width - cur_active_width[1]; X if (shortfall > 0) { X if (cur_active_width[3] != 0 || X cur_active_width[4] != 0 || X cur_active_width[5] != 0) { X b = 0; X fit_class = DECENT_FIT; X } else { X if (shortfall > 7230584 && cur_active_width[2] < 1663497) { X b = INF_BAD; X fit_class = VERY_LOOSE_FIT; X goto done; X } X b = badness(shortfall, cur_active_width[2]); X if (b > 12) X if (b > 99) X fit_class = VERY_LOOSE_FIT; X else fit_class = LOOSE_FIT; X else fit_class = DECENT_FIT; X } X } else { X if (-shortfall > cur_active_width[6]) X b = INF_BAD + 1; X else b = badness(-shortfall, cur_active_width[6]); X if (b > 12) X fit_class = TIGHT_FIT; X else fit_class = DECENT_FIT; X } X X done: X if (b > INF_BAD || pi == EJECT_PENALTY) { X if (second_pass && X minimum_demerits == AWFUL_BAD && X link(r) == last_active && X prev_r == active) { X b = 0; X#ifdef STAT X artificial_badness = TRUE; X#endif X } else if (b > threshold) X goto deactivate; X node_r_stays_active = FALSE; X } else { X prev_r = r; X if (b > threshold) continue; X node_r_stays_active = TRUE; X } X d = line_penalty + b; X d = d * d; X if (pi != 0) { X if (pi > 0) X d += pi * pi; X else if (pi > EJECT_PENALTY) X d -= pi * pi; X } X if (break_type == HYPHENATED && type(r) == HYPHENATED) { X if (cur_p != NULL) X d += double_hyphen_demerits; X else d += final_hyphen_demerits; X } X if (abs(fit_class - (int) fitness(r)) > 1) X d += adj_demerits; X#ifdef STAT X show_break_status(r, artificial_badness, b, pi, d); X#endif X d += total_demerits(r); X if (d <= minimal_demerits[fit_class]) { X minimal_demerits[fit_class] = d; X best_place[fit_class] = break_node(r); X best_pl_line[fit_class] = l; X if (d < minimum_demerits) X minimum_demerits = d; X } X if (node_r_stays_active) continue; X X deactivate: X link(prev_r) = link(r); X free_node(r, ACTIVE_NODE_SIZE); X if (prev_r == active) { X r = link(active); X if (type(r) == DELTA_NODE) { X do_all_six(update_active); X do_all_six(copy_to_cur_active); X link(active) = link(r); X free_node(r, DELTA_NODE_SIZE); X } X } else if (type(prev_r) == DELTA_NODE) { X r = link(prev_r); X if (r == last_active) { X do_all_six(downdate_width); X link(prev_prev_r) = last_active; X free_node(prev_r, DELTA_NODE_SIZE); X prev_r = prev_prev_r; X } else if (type(r) == DELTA_NODE) { X do_all_six(update_width); X do_all_six(combine_two_deltas); X link(prev_r) = link(r); X free_node(r, DELTA_NODE_SIZE); X } X } X } X} X X X#define kern_break() \ X {if (!is_char_node(link(cur_p)) && auto_breaking && \ X type(link(cur_p)) == GLUE_NODE) \ X try_break(0L, UNHYPHENATED); \ X act_width += width(cur_p);} X X#define check_shrinkage(S) \ X {if (shrink_order(S) != NORMAL && shrink(S) != 0) \ X S = finite_shrink(S);} X Xline_break (final_widow_penalty) X val final_widow_penalty; X{ X int c; X int j; X ptr q; X ptr r; X ptr s; X ptr prev_p; X bool auto_breaking; X X pack_begin_line = mode_line; X link(temp_head) = link(head); X if (is_char_node(tail)) { X tail_append(new_penalty(INF_PENALTY)); X } else if (type(tail) != GLUE_NODE) { X tail_append(new_penalty(INF_PENALTY)); X } else { X type(tail) = PENALTY_NODE; X delete_glue_ref(glue_ptr(tail)); X flush_node_list(leader_ptr(tail)); X penalty(tail) = INF_PENALTY; X } X link(tail) = new_param_glue(PAR_FILL_SKIP_CODE); X pop_nest(); X no_shrink_error_yet = TRUE; X check_shrinkage(left_skip); X check_shrinkage(right_skip); X q = left_skip; X r = right_skip; X background[1] = width(q) + width(r); X background[2] = 0; SHAR_EOF echo "End of part 11" echo "File par.c is continued in part 12" echo "12" > s2_seq_.tmp exit 0
glenn@extro.ucc.su.oz.au (G Geers) (02/16/90)
---- Cut Here and unpack ---- #!/bin/sh # this is part 12 of a multipart archive # do not concatenate these parts, unpack them in order with /bin/sh # file par.c continued # CurArch=12 if test ! -r s2_seq_.tmp then echo "Please unpack part 1 first!" exit 1; fi ( read Scheck if test "$Scheck" != $CurArch then echo "Please unpack part $Scheck next!" exit 1; else exit 0; fi ) < s2_seq_.tmp || exit 1 echo "x - Continuing file par.c" sed 's/^X//' << 'SHAR_EOF' >> par.c X background[3] = 0; X background[4] = 0; X background[5] = 0; X background[2 + stretch_order(q)] = stretch(q); X background[2 + stretch_order(r)] += stretch(r); X background[6] = shrink(q) + shrink(r); X minimum_demerits = AWFUL_BAD; X minimal_demerits[VERY_LOOSE_FIT] = AWFUL_BAD; X minimal_demerits[LOOSE_FIT] = AWFUL_BAD; X minimal_demerits[DECENT_FIT] = AWFUL_BAD; X minimal_demerits[TIGHT_FIT] = AWFUL_BAD; X if (par_shape_ptr == NULL) { X if (hang_indent == 0) { X last_special_line = 0; X second_width = hsize; X second_indent = 0; X } else { X last_special_line = abs(hang_after); X if (hang_after < 0) { X first_width = hsize - abs(hang_indent); X first_indent = (hang_indent >= 0 ? hang_indent : 0); X second_width = hsize; X second_indent = 0; X } else { X first_width = hsize; X first_indent = 0; X second_width = hsize - abs(hang_indent); X second_indent = (hang_indent >= 0 ? hang_indent : 0); X } X } X } else { X last_special_line = info(par_shape_ptr) - 1; X second_width = mem[par_shape_ptr + 2 * (last_special_line + 1)].sc; X second_indent = mem[par_shape_ptr + 2 * last_special_line + 1].sc; X } X easy_line = (looseness == 0 ? last_special_line : MAX_HALFWORD); X threshold = pretolerance; X#ifdef STAT X if (threshold >= 0) { X if (tracing_paragraphs > 0) { X begin_diagnostic(); X print_nl("@firstpass"); X } X second_pass = FALSE; X } else { X threshold = tolerance; X second_pass = TRUE; X if (tracing_paragraphs > 0) X begin_diagnostic(); X } X#else X if (threshold >= 0) X second_pass = FALSE; X else { X threshold = tolerance; X second_pass = TRUE; X } X#endif X loop { X q = get_node(ACTIVE_NODE_SIZE); X type(q) = UNHYPHENATED; X fitness(q) = DECENT_FIT; X link(q) = last_active; X break_node(q) = NULL; X line_number(q) = prev_graf + 1; X total_demerits(q) = 0; X link(active) = q; X do_all_six(store_background); X passive = NULL; X printed_node = temp_head; X pass_number = 0; X font_in_short_display = NULL_FONT; X cur_p = link(temp_head); X auto_breaking = TRUE; X prev_p = cur_p; X while (cur_p != NULL && link(active) != last_active) { X if (is_char_node(cur_p)) { X prev_p = cur_p; X do { X act_width += width_char(cur_p); X cur_p = link(cur_p); X } while (is_char_node(cur_p)); X } X switch (type(cur_p)) X { X case HLIST_NODE: X case VLIST_NODE: X case RULE_NODE: X act_width += width(cur_p); X break; X X case WHATSIT_NODE: X break; X X case GLUE_NODE: X if (auto_breaking) { X if (is_char_node(prev_p)) X try_break(0L, UNHYPHENATED); X else if (precedes_break(prev_p)) X try_break(0L, UNHYPHENATED); X } X check_shrinkage(glue_ptr(cur_p)); X q = glue_ptr(cur_p); X act_width += width(q); X active_width[2 + stretch_order(q)] += stretch(q); X active_width[6] += shrink(q); X if (second_pass && auto_breaking) { X s = link(cur_p); X if (s != NULL) { X loop { X if (is_char_node(s)) { X c = qo(character(s)); X hf = font(s); X } else if (type(s) == LIGATURE_NODE) { X q = lig_ptr(s); X c = qo(character(q)); X hf = font(q); X } else if (type(s) == KERN_NODE && X subtype(s) == NORMAL) X c = 128; X else if (type(s) == WHATSIT_NODE) X c = 128; X else goto done1; X if (c < 128 && lc_code(c) != 0) { X if (lc_code(c) == c || uc_hyph > 0) X goto done2; X else goto done1; X } X s = link(s); X } X X done2: X hyf_char = hyphen_char[hf]; X if (hyf_char < 0 || hyf_char > 255) X goto done1; X ha = s; X hn = 0; X loop { X if (is_char_node(s)) { X if (font(s) != hf) X goto done3; X c = qo(character(s)); X if (c >= 128) X goto done3; X if (lc_code(c) == 0 || hn == 63) X goto done3; X hb = s; X incr(hn); X hu[hn] = c; X hc[hn] = lc_code(c) - 1; X } else if (type(s) == LIGATURE_NODE) { X j = hn; X q = lig_ptr(s); X if (font(q) != hf) X goto done3; X do { X c = qo(character(q)); X if (c >= 128) X goto done3; X if (lc_code(c) == 0 || j == 63) X goto done3; X incr(j); X hu[j] = c; X hc[j] = lc_code(c) - 1; X q = link(q); X } while (q != NULL); X hb = s; X hn = j; X } else if (type(s) != KERN_NODE || X subtype(s) != NORMAL) X goto done3; X s = link(s); X } X X done3: X if (hn < 5) X goto done1; X loop { X if (!is_char_node(s)) { X switch (type(s)) X { X case LIGATURE_NODE: X break; X X case KERN_NODE: X if (subtype(s) != NORMAL) X goto done4; X break; X X case WHATSIT_NODE: X case GLUE_NODE: X case PENALTY_NODE: X case INS_NODE: X case ADJUST_NODE: X case MARK_NODE: X goto done4; X break; X X default: X goto done1; X break; X } X } X s = link(s); X } X X done4: X hyphenate(); X } X } X done1: X break; X X case KERN_NODE: X kern_break(); X break; X X case LIGATURE_NODE: X act_width += width_lig_char(cur_p); X break; X X case DISC_NODE: X s = pre_break(cur_p); X disc_width = 0; X if (s == NULL) X try_break(ex_hyphen_penalty, HYPHENATED); X else { X do { X if (is_char_node(s)) X disc_width += width_char(s); X else { X switch (type(s)) X { X case LIGATURE_NODE: X disc_width += width_lig_char(s); X break; X X case HLIST_NODE: X case VLIST_NODE: X case RULE_NODE: X case KERN_NODE: X disc_width += width(s); X break; X X default: X confusion("disc3"); X break; X } X } X s = link(s); X } while (s != NULL); X act_width += disc_width; X try_break(hyphen_penalty, HYPHENATED); X act_width -= disc_width; X } X break; X X case MATH_NODE: X auto_breaking = (subtype(cur_p) == AFTER); X kern_break(); X break; X X case PENALTY_NODE: X try_break(penalty(cur_p), UNHYPHENATED); X break; X X case MARK_NODE: X case INS_NODE: X case ADJUST_NODE: X break; X X default: X confusion("paragraph"); X break; X } X prev_p = cur_p; X cur_p = link(cur_p); X } X if (cur_p == NULL) { X try_break(EJECT_PENALTY, HYPHENATED); X if (link(active) != last_active) { X r = link(active); X fewest_demerits = AWFUL_BAD; X do { X if (type(r) != DELTA_NODE && X total_demerits(r) < fewest_demerits) { X fewest_demerits = total_demerits(r); X best_bet = r; X } X r = link(r); X } while (r != last_active); X best_line = line_number(best_bet); X if (looseness == 0) X goto done; X r = link(active); X actual_looseness = 0; X do { X if (type(r) != DELTA_NODE) { X line_diff = (int) line_number(r) - (int) best_line; X if (line_diff < actual_looseness && X looseness <= line_diff || X line_diff > actual_looseness && X looseness >= line_diff) { X best_bet = r; X actual_looseness = line_diff; X fewest_demerits = total_demerits(r); X } else if (line_diff == actual_looseness && X total_demerits(r) < fewest_demerits) { X best_bet = r; X fewest_demerits = total_demerits(r); X } X } X r = link(r); X } while (r != last_active); X best_line = line_number(best_bet); X if (actual_looseness == looseness || second_pass) X goto done; X } X } X for (q = link(active); q != last_active; q = cur_p) { X cur_p = link(q); X if (type(q) == DELTA_NODE) X free_node(q, DELTA_NODE_SIZE); X else free_node(q, ACTIVE_NODE_SIZE); X } X for (q = passive; q != NULL; q = cur_p) { X cur_p = link(q); X free_node(q, PASSIVE_NODE_SIZE); X } X#ifdef STAT X if (tracing_paragraphs > 0) X print_nl("@secondpass"); X#endif X threshold = tolerance; X second_pass = TRUE; X } X Xdone: X#ifdef STAT X if (tracing_paragraphs > 0) X end_diagnostic(TRUE); X X#endif X post_line_break(final_widow_penalty); X for (q = link(active); q != last_active; q = cur_p) { X cur_p = link(q); X if (type(q) == DELTA_NODE) X free_node(q, DELTA_NODE_SIZE); X else free_node(q, ACTIVE_NODE_SIZE); X } X for (q = passive; q != NULL; q = cur_p) { X cur_p = link(q); X free_node(q, PASSIVE_NODE_SIZE); X } X pack_begin_line = 0; X} X Xpost_line_break (final_widow_penalty) X val final_widow_penalty; X{ X ptr q; X ptr r; X ptr s; X qword t; X val pen; X hword cur_line; X scal cur_width; X scal cur_indent; X bool disc_break; X X q = break_node(best_bet); X cur_p = NULL; X do { X r = q; X q = prev_break(q); X next_break(r) = cur_p; X cur_p = r; X } while (q != NULL); X cur_line = prev_graf + 1; X do { X q = cur_break(cur_p); X disc_break = FALSE; X if (q != NULL) { X if (type(q) == GLUE_NODE) { X delete_glue_ref(glue_ptr(q)); X glue_ptr(q) = right_skip; X subtype(q) = RIGHT_SKIP_CODE + 1; X add_glue_ref(right_skip); X goto done; X } else { X if (type(q) == DISC_NODE) { X t = replace_count(q); X if (t == 0) X r = link(q); X else { X r = q; X while (t > 1) { X r = link(r); X decr(t); X } X s = link(r); X if (!is_char_node(s) && X next_break(cur_p) != NULL && X cur_break(next_break(cur_p)) == s) X s = r; X r = link(s); X link(s) = NULL; X flush_node_list(link(q)); X replace_count(q) = 0; X } X if (post_break(q) != NULL) { X s = post_break(q); X while (link(s) != NULL) X s = link(s); X link(s) = r; X r = post_break(q); X post_break(q) = NULL; X } X if (pre_break(q) != NULL) { X s = pre_break(q); X link(q) = s; X while (link(s) != NULL) X s = link(s); X pre_break(q) = NULL; X q = s; X } X link(q) = r; X disc_break = TRUE; X } else X if (type(q) == MATH_NODE || X type(q) == KERN_NODE) X width(q) = 0; X } X } else { X q = temp_head; X while (link(q) != NULL) X q = link(q); X } X r = new_param_glue(RIGHT_SKIP_CODE); X link(r) = link(q); X link(q) = r; X q = r; X X done: X r = link(q); X link(q) = NULL; X q = link(temp_head); X link(temp_head) = r; X if (left_skip != zero_glue) { X r = new_param_glue(LEFT_SKIP_CODE); X link(r) = q; X q = r; X } X if (cur_line > last_special_line) { X cur_width = second_width; X cur_indent = second_indent; X } else if (par_shape_ptr == NULL) { X cur_width = first_width; X cur_indent = first_indent; X } else { X cur_width = mem[par_shape_ptr + 2 * cur_line].sc; X cur_indent = mem[par_shape_ptr + 2 * cur_line - 1].sc; X } X adjust_tail = adjust_head; X just_box = hpack(q, cur_width, EXACTLY); X shift_amount(just_box) = cur_indent; X append_to_vlist(just_box); X if (adjust_head != adjust_tail) { X link(tail) = link(adjust_head); X tail = adjust_tail; X } X adjust_tail = NULL; X if (cur_line + 1 != best_line) { X pen = inter_line_penalty; X if (cur_line == prev_graf + 1) X pen += club_penalty; X if (cur_line + 2 == best_line) X pen += final_widow_penalty; X if (disc_break) X pen += broken_penalty; X if (pen != 0) { X r = new_penalty(pen); X link(tail) = r; X tail = r; X } X } X incr(cur_line); X cur_p = next_break(cur_p); X if (cur_p != NULL) { X r = temp_head; X loop { X q = link(r); X if (q == cur_break(cur_p)) X break; X if (is_char_node(q)) X break; X if (non_discardable(q)) X break; X if (subtype(q) == ACC_KERN && type(q) == KERN_NODE) X break; X r = q; X } X if (r != temp_head) { X link(r) = NULL; X flush_node_list(link(temp_head)); X link(temp_head) = q; X } X } X } while (cur_p != NULL); X if (cur_line != best_line || link(temp_head) != NULL) X confusion("line breaking"); X prev_graf = best_line - 1; X} X Xptr Xfinite_shrink (p) X ptr p; X{ X ptr q; X X if (no_shrink_error_yet) { X no_shrink_error_yet = FALSE; X print_err("Infinite glue shrinkage found in a paragraph"); X help_shrink(); X error(); X } X q = new_spec(p); X shrink_order(q) = NORMAL; X delete_glue_ref(p); X return q; X} X X/* X * Help text X */ X Xhelp_shrink() X{ X help5("The paragraph just ended includes some glue that has", X "infinite shrinkability, e.g., `\\hskip 0pt minus 1fil'.", X "Such glue doesn't belong there---it allows a paragraph", X "of any length to fit on one line. But it's safe to proceed,", X "since the offensive shrinkability has been made finite."); X} SHAR_EOF echo "File par.c is complete" chmod 0444 par.c || echo "restore of par.c fails" set `wc -c par.c`;Sum=$1 if test "$Sum" != "24379" then echo original size 24379, current size $Sum;fi echo "x - extracting par.h (Text)" sed 's/^X//' << 'SHAR_EOF' > par.h && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * par.h X */ X X#define last_active active X X#define VERY_LOOSE_FIT 0 X#define LOOSE_FIT 1 X#define DECENT_FIT 2 X#define TIGHT_FIT 3 X X#define ACTIVE_NODE_SIZE 3 X#define UNHYPHENATED 0 X#define HYPHENATED 1 X#define fitness subtype X#define break_node rlink X#define line_number llink X#define total_demerits(D) mem[(D) + 2].i X X#define PASSIVE_NODE_SIZE 2 X#define cur_break rlink X#define prev_break llink X#define next_break prev_break X#define serial info X X#define DELTA_NODE 2 X#define DELTA_NODE_SIZE 7 X X#define do_all_six(F) \ X {F(1); F(2); F(3); F(4); F(5); F(6);} X Xglobal ptr just_box; X Xint line_break(); X Xglobal ptr passive; Xglobal ptr printed_node; Xglobal ptr pass_number; X Xglobal scal active_width[]; Xglobal scal cur_active_width[]; Xglobal scal background[]; Xglobal scal break_width[]; Xglobal bool no_shrink_error_yet; X Xptr finite_shrink(); X Xglobal ptr cur_p; Xglobal bool second_pass; Xglobal val threshold; X Xint try_break(); X X#define AWFUL_BAD 07777777777 X Xglobal val minimal_demerits[]; Xglobal val minimum_demerits; Xglobal ptr best_place[]; Xglobal hword best_pl_line[]; X Xglobal hword easy_line; Xglobal hword last_special_line; Xglobal scal first_width; Xglobal scal second_width; Xglobal scal first_indent; Xglobal scal second_indent; Xglobal scal disc_width; Xglobal ptr best_bet; Xglobal val fewest_demerits; Xglobal hword best_line; Xglobal val actual_looseness; Xglobal int line_diff; X Xint post_line_break(); SHAR_EOF chmod 0444 par.h || echo "restore of par.h fails" set `wc -c par.h`;Sum=$1 if test "$Sum" != "1666" then echo original size 1666, current size $Sum;fi echo "x - extracting print.c (Text)" sed 's/^X//' << 'SHAR_EOF' > print.c && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * print.c X */ X X#include "tex.h" X#include "texext.h" X#include "eq.h" X#include "char.h" X#include "str.h" X#include "io.h" X#include "print.h" X Xalpha_file log_file; X Xchar dig[23]; Xint file_offset; Xval first_count; Xint selector = TERM_ONLY; Xval tally; Xint term_offset; Xascii trick_buf[ERROR_LINE]; Xval trick_count; X Xprint_ln () X{ X switch (selector) X { X case TERM_AND_LOG: X wterm_cr(); X term_offset = 0; X wlog_cr(); X file_offset = 0; X break; X X case LOG_ONLY: X wlog_cr(); X file_offset = 0; X break; X X case TERM_ONLY: X wterm_cr(); X term_offset = 0; X break; X X case NO_PRINT: X case PSEUDO: X case NEW_STRING: X break; X X default: X wfile_cr(); X break; X } X} X Xprint_char (c) X ascii c; X{ X if (c == new_line_char && selector < PSEUDO) { X print_ln(); X return; X } X switch (selector) X { X case TERM_AND_LOG: X wterm(xchr[c]); X incr(term_offset); X wlog(xchr[c]); X incr(file_offset); X if (term_offset == MAX_PRINT_LINE) { X wterm_cr(); X term_offset = 0; X } X if (file_offset == MAX_PRINT_LINE) { X wlog_cr(); X file_offset = 0; X } X break; X X case LOG_ONLY: X wlog(xchr[c]); X incr(file_offset); X if (file_offset == MAX_PRINT_LINE) X print_ln(); X break; X X case TERM_ONLY: X wterm(xchr[c]); X incr(term_offset); X if (term_offset == MAX_PRINT_LINE) X print_ln(); X break; X X case NO_PRINT: X return; X X case PSEUDO: X if (tally < trick_count) X trick_buf[tally % ERROR_LINE] = c; X break; X X case NEW_STRING: X if (pool_ptr < POOL_SIZE) X append_char(c); X break; X X default: X wfile(xchr[c]); X break; X } X incr(tally); X} X Xprint_ASCII (c) X int c; X{ X if (c >= 0 && c <= 127) X print_str(c); X else { X print_char('['); X if (c < 0) X print_int(c); X else print_hex((val) c); X print_char(']'); X } X} X Xprint_str (s) X str s; X{ X int j; X X if (s >= str_ptr) X s = make_string_given("???"); X else if (s < 128) { X if (s < 0) X s = make_string_given("???"); X else if (s == new_line_char && selector < PSEUDO) { X print_ln(); X return; X } X } X j = str_start[s]; X while (j < str_start[s + 1]) { X print_char(str_pool[j]); X incr(j); X } X} X Xslow_print (s) X str s; X{ X int j; X X if (s >= str_ptr) X s = make_string_given("???"); X else if (s < 128) { X if (s < 0) X s = make_string_given("???"); X else if (s == new_line_char && selector < PSEUDO) { X print_ln(); X return; X } X } X j = str_start[s]; X while (j < str_start[s + 1]) { X print_str(str_pool[j]); X incr(j); X } X} X Xprint (s) X char* s; X{ X while (*s) { X print_char(*s); X incr(s); X } X} X Xprint_nl (s) X char* s; X{ X if (term_offset > 0 && odd(selector) || X file_offset > 0 && selector >= LOG_ONLY) X print_ln(); X print(s); X} X Xprint_esc (s) X char* s; X{ X ascii c; X X c = escape_char; X if (c >= 0 && c < 128) X print_char(c); X print(s); X} X Xprint_int (n) X int n; X{ X int k; X int m; X X k = 0; X if (n < 0) { X print_char('-'); X negate(n); X } X do { X dig[k] = n % 10; X n /= 10; X incr(k); X } while (n != 0); X print_the_digs(k); X} X Xprint_val (n) X val n; X{ X int k; X val m; X X k = 0; X if (n < 0) { X print_char('-'); X if (n > -100000000) X negate(n); X else { X m = -1 - n; X n = m / 10; X m = m % 10 + 1; X k = 1; X if (m < 10) X dig[0] = m; X else { X dig[0] = 0; X incr(n); X } X } X } X do { X dig[k] = n % 10; X n /= 10; X incr(k); X } while (n != 0); X print_the_digs(k); X} X Xprint_hex (v) X val v; X{ X int k; X X k = 0; X print_char('"'); X do { X dig[k] = v&15; X v >>= 4; X incr(k); X } while (v != 0); X print_the_digs(k); X} X Xprint_the_digs (k) X int k; X{ X while (k > 0) { X decr(k); X if (dig[k] < 10) X print_char('0' + dig[k]); X else print_char('A' - 10 + dig[k]); X } X} X Xprint_two (n) X int n; X{ X n = abs(n) % 100; X print_char('0' + n / 10); X print_char('0' + n % 10); X} X Xprint_roman_int (n) X val n; X{ X char* j = "m2d5c2l5x2v5i"; X char* k; X val u; X val v = 1000; X X loop { X while (n >= v) { X print_char(*j); X n -= v; X } X if (n <= 0) return; /* nonpositive input produces no output */ X k = j + 2; X u = v / (*(k - 1) - '0'); X if (*(k - 1) == '2') { X k += 2; X u /= *(k - 1) - '0'; X } X if (n + u >= v) { X print_char(*k); X n += u; X } else { X j += 2; X v /= *(j - 1) - '0'; X } X } X} X Xprint_current_string () X{ X int j; X X j = str_start[str_ptr]; X while (j < pool_ptr) { X print_char(str_pool[j]); X incr(j); X } X} SHAR_EOF chmod 0444 print.c || echo "restore of print.c fails" set `wc -c print.c`;Sum=$1 if test "$Sum" != "4438" then echo original size 4438, current size $Sum;fi echo "x - extracting print.h (Text)" sed 's/^X//' << 'SHAR_EOF' > print.h && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * print.h X */ X X#define NO_PRINT 16 X#define TERM_ONLY 17 X#define LOG_ONLY 18 X#define TERM_AND_LOG 19 X#define PSEUDO 20 X#define NEW_STRING 21 X#define MAX_SELECTOR 21 X Xglobal alpha_file log_file; X Xglobal int selector; X Xglobal int term_offset; Xglobal int file_offset; X Xglobal char dig[]; Xglobal val tally; Xglobal ascii trick_buf[]; Xglobal val trick_count; Xglobal val first_count; X Xint print(); Xint print_char(); Xint print_sym(); Xint print_ln(); Xint print_esc(); Xint print_nl(); Xint print_the_digs(); Xint print_int(); Xint print_val(); Xint print_hex(); Xint print_ASCII(); Xint print_roman_int(); Xint print_current_string(); X X#define wterm(c) putchar(c); X#define wterm_ln(c) {putchar(c); putchar('\n');} X#define wterm_cr() putchar('\n'); X X#define wlog(c) putc(c, log_file) X#define wlog_ln(c) {putc(c, log_file); putc('\n', log_file);} X#define wlog_cr() putc('\n', log_file); X X#define wfile(c) putc(c, write_file[selector]) X#define wfile_ln(c) {putc(c, write_file[selector]); \ X putc('\n', write_file[selector]);} X#define wfile_cr() putc('\n', write_file[selector]); SHAR_EOF chmod 0444 print.h || echo "restore of print.h fails" set `wc -c print.h`;Sum=$1 if test "$Sum" != "1333" then echo original size 1333, current size $Sum;fi echo "x - extracting scan.c (Text)" sed 's/^X//' << 'SHAR_EOF' > scan.c && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * scan.c X */ X X#include "tex.h" X#include "cmds.h" X#include "heap.h" X#include "arith.h" X#include "eq.h" X#include "token.h" X#include "tokenstack.h" X#include "tokenlists.h" X#include "evalstack.h" X#include "char.h" X#include "str.h" X#include "box.h" X#include "tfm.h" X#include "dvi.h" X#include "print.h" X#include "error.h" X#include "page.h" X#include "scan.h" X Xgord cur_order; Xval cur_val; Xint cur_val_level = INT_VAL; Xint radix; X Xscan_left_brace () X{ X get_nbrx_token(); X if (cur_cmd != LEFT_BRACE) { X print_err("Missing { inserted"); X help_left(); X back_error(); X cur_tok = LEFT_BRACE_TOKEN; X cur_cmd = LEFT_BRACE; X cur_chr= '{'; X incr(align_state); X } X} X Xscan_optional_equals () X{ X get_nbx_token(); X if (cur_tok != OTHER_TOKEN + '=') X back_input(); X} X Xbool Xscan_keyword (s) X char* s; X{ X char c; X ptr p; X ptr q; X X p = backup_tokens; X token_link(p) = NULL; X c = *s; X while (c != NUL) { X get_x_token(); X if (cur_cs == 0 && (cur_chr == c || cur_chr == c - 'a' + 'A')) { X store_new_token(cur_tok); X incr(s); X c = *s; X } else if (cur_cmd != SPACER || p != backup_tokens) { X back_input(); X if (p != backup_tokens) X back_list(token_link(backup_tokens)); X return FALSE; X } X } X flush_list(token_link(backup_tokens)); X return TRUE; X} X Xmu_error () X{ X print_err("Incompatible glue units"); X help_mu_error(); X error(); X} X X#define scanned_result(CV, CVL) \ X {cur_val = CV; cur_val_level = CVL;} X X#define negate_glue() \ X {width(cur_val) = -width(cur_val); \ X stretch(cur_val) = -stretch(cur_val); \ X shrink(cur_val) = -shrink(cur_val);} X Xscan_something_internal (level, negative) X int level; X bool negative; X{ X hword m; X int p; X X m = cur_chr; X switch (cur_cmd) X { X case DEF_CODE: X scan_seven_bit_int(); X if (m == MATH_CODE_BASE) X {scanned_result(ho(math_code(cur_val)), INT_VAL);} X else if (m < MATH_CODE_BASE) X {scanned_result(equiv(m + cur_val), INT_VAL);} X else {scanned_result(eqtb[m + cur_val].i, INT_VAL);} X break; X X case TOKS_REGISTER: X case ASSIGN_TOKS: X case DEF_FAMILY: X case SET_FONT: X case DEF_FONT: X if (level != TOK_VAL) { X print_err("Missing number, treated as zero"); X help_missing_number(); X back_error(); X scanned_result(0, DIMEN_VAL); X } else if (cur_cmd <= ASSIGN_TOKS) { X if (cur_cmd < ASSIGN_TOKS) { X scan_eight_bit_int(); X m = TOKS_BASE + cur_val; X } X scanned_result(equiv(m), TOK_VAL); X } else { X back_input(); X scan_font_ident(); X scanned_result(FONT_ID_BASE + cur_val, IDENT_VAL); X } X break; X X case ASSIGN_INT: X scanned_result(eqtb[m].i, INT_VAL); X break; X X case ASSIGN_DIMEN: X scanned_result(eqtb[m].sc, DIMEN_VAL); X break; X X case ASSIGN_GLUE: X scanned_result(equiv(m), GLUE_VAL); X break; X X case ASSIGN_MU_GLUE: X scanned_result(equiv(m), MU_VAL); X break; X X case SET_AUX: X if (abs(mode) != m) { X print_err("Improper "); X print_cmd_chr(SET_AUX, m); X help_aux(); X error(); X if (level != TOK_VAL) X {scanned_result(0, DIMEN_VAL);} X else scanned_result(0, INT_VAL); X } else { X cur_val = aux; X if (m == VMODE) X cur_val_level = DIMEN_VAL; X else cur_val_level = INT_VAL; X } X break; X X case SET_PREV_GRAF: X nest[nest_ptr] = cur_list; X p = nest_ptr; X while (abs(nest[p].mode_field) != VMODE) X decr(p); X scanned_result(nest[p].pg_field, INT_VAL); X break; X X case SET_PAGE_INT: X if (m == 0) X cur_val = dead_cycles; X else cur_val = insert_penalties; X cur_val_level = INT_VAL; X break; X X case SET_PAGE_DIMEN: X if (page_contents == EMPTY) X if (m == 0) X cur_val = MAX_DIMEN; X else cur_val = 0; X else cur_val = page_so_far[m]; X cur_val_level = DIMEN_VAL; X break; X X case SET_SHAPE: X if (par_shape_ptr == NULL) X cur_val = 0; X else cur_val = info(par_shape_ptr); X cur_val_level = INT_VAL; X break; X X case SET_BOX_DIMEN: X scan_eight_bit_int(); X if (box(cur_val) == NULL) X cur_val = 0; X else cur_val = mem[box(cur_val) + m].sc; X cur_val_level = DIMEN_VAL; X break; X X case CHAR_GIVEN: X case MATH_GIVEN: X scanned_result(cur_chr, INT_VAL); X break; X X case ASSIGN_FONT_DIMEN: X find_font_dimen(FALSE); X font_info[fmem_ptr].sc = 0; X scanned_result(font_info[cur_val].sc, DIMEN_VAL); X break; X X case ASSIGN_FONT_INT: X scan_font_ident(); X if (m == 0) X {scanned_result(hyphen_char[cur_val], INT_VAL);} X else scanned_result(skew_char[cur_val], INT_VAL); X break; X X case REGISTER: X scan_eight_bit_int(); X switch (m) X { X case INT_VAL: X cur_val = count(cur_val); X break; X X case DIMEN_VAL: X cur_val = dimen(cur_val); X break; X X case GLUE_VAL: X cur_val = skip(cur_val); X break; X X case MU_VAL: X cur_val = mu_skip(cur_val); X break; X } X cur_val_level = m; X break; X X case LAST_ITEM: X if (cur_chr == GLUE_VAL) X cur_val = zero_glue; X else cur_val = 0; X cur_val_level = cur_chr; X if (!is_char_node(tail) && mode != 0) { X switch (cur_chr) X { X case INT_VAL: X if (type(tail) == PENALTY_NODE) X cur_val = penalty(tail); X break; X X case DIMEN_VAL: X if (type(tail) == KERN_NODE) X cur_val = width(tail); X break; X X case GLUE_VAL: X if (type(tail) == GLUE_NODE) { X cur_val = glue_ptr(tail); X if (subtype(tail) == MU_GLUE) X cur_val_level = MU_VAL; X } X break; X X default: X break; X } X } else if (mode == VMODE && tail == head) { X switch (cur_chr) X { X case INT_VAL: X cur_val = last_penalty; X break; X X case DIMEN_VAL: X cur_val = last_kern; X break; X X case GLUE_VAL: X if (last_glue != MAX_HALFWORD) X cur_val = last_glue; X break; X } X } X break; X X default: X print_err("You can't use `"); X print_cmd_chr(cur_cmd, cur_chr); X print("' after "); X print_esc("the"); X help_thee(); X error(); X if (level != TOK_VAL) X {scanned_result(0, DIMEN_VAL);} X else {scanned_result(0, INT_VAL);} X break; X } X while (cur_val_level > level) { X if (cur_val_level == GLUE_VAL) X cur_val = width(cur_val); X else if (cur_val_level == MU_VAL) X mu_error(); X decr(cur_val_level); X } X if (negative) { X if (cur_val_level >= GLUE_VAL) { X cur_val = new_spec(cur_val); X negate_glue(); X } else negate(cur_val); X } else if (cur_val_level >= GLUE_VAL && cur_val_level <= MU_VAL) X add_glue_ref(cur_val); X} X Xscan_seven_bit_int () X{ X scan_int(); X if (cur_val < 0 || cur_val > 127) { X print_err("Bad character code"); X help_char(); X int_error(cur_val); X cur_val = 0; X } X} X Xscan_eight_bit_int () X{ X scan_int(); X if (cur_val < 0 || cur_val > 255) { X print_err("Bad register code"); X help_reg(); X int_error(cur_val); X cur_val = 0; X } X} X Xscan_four_bit_int() X{ X scan_int(); X if (cur_val < 0 || cur_val > 15) { X print_err("Bad number"); X help_number(); X int_error(cur_val); X cur_val = 0; X } X} X Xscan_char_num () X{ X scan_int(); X if (cur_val < 0 || cur_val > 255) { X print_err("Bad character code"); X help_char_num(); X int_error(cur_val); X cur_val = 0; X } X} X Xscan_fifteen_bit_int () X{ X scan_int(); X if (cur_val < 0 || cur_val > 077777) { X print_err("Bad math code"); X help_mathchar(); X int_error(cur_val); X cur_val = 0; X } X} X Xscan_twenty_seven_bit_int () X{ X scan_int(); X if (cur_val < 0 || cur_val> 0777777777) { X print_err("Bad delimiter code"); X help_del(); X int_error(cur_val); X cur_val = 0; X } X} X X#define get_nbsx_token() \ X {negative = FALSE; \ X do {get_nbx_token(); \ X if (cur_tok == MINUS_TOKEN) { \ X negative = !negative; \ X cur_tok = PLUS_TOKEN;} \ X } while (cur_tok == PLUS_TOKEN);} X Xscan_int () X{ X int d; X val m; X bool vacuous; X bool negative; X bool OK_so_far; X X d = 0; X radix = 0; X OK_so_far = TRUE; X get_nbsx_token(); X if (cur_tok == ALPHA_TOKEN) { X get_token(); X if (cur_tok < CS_TOKEN_FLAG) { X cur_val = cur_chr; X if (cur_cmd <= RIGHT_BRACE) { X if (cur_cmd == RIGHT_BRACE) X incr(align_state); X else decr(align_state); X } X } else if (cur_tok < CS_TOKEN_FLAG + SINGLE_BASE) X cur_val = cur_tok - CS_TOKEN_FLAG - ACTIVE_BASE; X else cur_val = cur_tok - CS_TOKEN_FLAG - SINGLE_BASE; X if (cur_val > 127) { X print_err("Improper alphabetic constant"); X help_char_const(); X cur_val = 0; X back_error(); X } else scan_optional_space(); X } else if (cur_cmd >= MIN_INTERNAL && cur_cmd <= MAX_INTERNAL) X scan_something_internal(INT_VAL, FALSE); X else { X radix = 10; X m = 214748364; X if (cur_tok == OCTAL_TOKEN) { X radix = 8; X m = 02000000000; X get_x_token(); X } else if (cur_tok == HEX_TOKEN) { X radix = 16; X m = 010000000000; X get_x_token(); X } X vacuous = TRUE; X cur_val = 0; X loop { X if (cur_tok < ZERO_TOKEN + radix && X cur_tok >= ZERO_TOKEN && X cur_tok <= ZERO_TOKEN + 9) X d = cur_tok - ZERO_TOKEN; X else if (radix == 16) { X if (cur_tok <= A_TOKEN + 5 && cur_tok >= A_TOKEN) X d = cur_tok - A_TOKEN + 10; X else if (cur_tok <= OTHER_A_TOKEN + 5 && X cur_tok >= OTHER_A_TOKEN) X d = cur_tok - OTHER_A_TOKEN + 10; X else break; X } else break; X vacuous = FALSE; X if (cur_val >= m && (cur_val > m || d > 7 || radix != 10)) { X if (OK_so_far) { X print_err("Number too big"); X help_big_num(); X error(); X cur_val = INFINITY; X OK_so_far = FALSE; X } X } else cur_val = cur_val * radix + d; X get_x_token(); X } X if (vacuous) { X print_err("Missing number, treated as zero"); X help_missing_number(); X back_error(); X } else if (cur_cmd != SPACER) X back_input(); X } X if (negative) X negate(cur_val); X} X X#define set_conversion(NUM, DENOM) \ X {num = NUM; denom = DENOM;} X Xscan_dimen (mu, inf, shortcut) X bool mu; X bool inf; X bool shortcut; X{ X val f; X int k; X scal v; X val num; X val denom; X bool negative; X val save_cur_val; X X f = 0; X negative = FALSE; X arith_error = FALSE; X cur_order = NORMAL; X if (!shortcut) { X get_nbsx_token(); X if (cur_cmd >= MIN_INTERNAL && cur_cmd <= MAX_INTERNAL) { X if (mu) { X scan_something_internal(MU_VAL, FALSE); X if (cur_val_level >= GLUE_VAL) { X v = width(cur_val); X delete_glue_ref(cur_val); X cur_val = v; X } X if (cur_val_level == MU_VAL) X goto attach_sign; X if (cur_val_level != INT_VAL) X mu_error(); X } else { X scan_something_internal(DIMEN_VAL, FALSE); X if (cur_val_level == DIMEN_VAL) X goto attach_sign; X } X } else { X back_input(); X if (cur_tok == EURO_POINT_TOKEN) X cur_tok = POINT_TOKEN; X if (cur_tok != POINT_TOKEN) X scan_int(); X else { X radix = 10; X cur_val = 0; X } X if (cur_tok == EURO_POINT_TOKEN) X cur_tok = POINT_TOKEN; X if (radix == 10 && cur_tok == POINT_TOKEN) { X k = 0; X get_token(); X loop { X get_x_token(); X if (cur_tok > ZERO_TOKEN + 9 || cur_tok < ZERO_TOKEN) X break; X if (k < 17) { X dig[k] = cur_tok - ZERO_TOKEN; X incr(k); X } X } X f = round_decimals(k); X if (cur_cmd != SPACER) X back_input(); X } X } X } X if (cur_val < 0) { X negative = !negative; X negate(cur_val); X } X if (inf) { X if (scan_keyword("fil")) { X cur_order = FIL; X while (scan_keyword("l")) { X if (cur_order == FILLL) { X print_err("Illegal unit of measure ("); X print("replaced by filll)"); X help_filll(); X error(); X } else incr(cur_order); X } X goto attach_fraction; X } X } X save_cur_val = cur_val; X get_nbx_token(); X if (cur_cmd < MIN_INTERNAL || cur_cmd > MAX_INTERNAL) X back_input(); X else { X if (mu) { X scan_something_internal(MU_VAL, FALSE); X if (cur_val_level >= GLUE_VAL) { X v = width(cur_val); X delete_glue_ref(cur_val); X cur_val = v; X } X if (cur_val_level != MU_VAL) X mu_error(); X } else scan_something_internal(DIMEN_VAL, FALSE); X v = cur_val; X goto found; X } X if (mu) X goto not_found; X if (scan_keyword("em")) X v = quad(cur_font); X else if (scan_keyword("ex")) X v = x_height(cur_font); X else goto not_found; X scan_optional_space(); X Xfound: X cur_val = nx_plus_y(save_cur_val, v, xn_over_d(v, f, 0200000L)); X goto attach_sign; X Xnot_found: X if (mu) { X if (scan_keyword("mu")) X goto attach_fraction; X else { X print_err("Illegal unit of measure ("); X print("mu inserted)"); X help_mu(); X error(); X goto attach_fraction; X } X } X if (scan_keyword("true")) { X prepare_mag(); X if (mag != 1000) { X cur_val = xn_over_d(cur_val, 1000L, mag); X f = (1000 * f + 0200000 * remainder) / mag; X cur_val += f / 0200000; X f %= 0200000; X } X } X if (scan_keyword("pt")) X goto attach_fraction; X if (scan_keyword("in")) {set_conversion(7227, 100);} X else if (scan_keyword("pc")) {set_conversion(12, 1);} X else if (scan_keyword("cm")) {set_conversion(7227, 254);} X else if (scan_keyword("mm")) {set_conversion(7227, 2540);} X else if (scan_keyword("bp")) {set_conversion(7227, 7200);} X else if (scan_keyword("dd")) {set_conversion(1238, 1157);} X else if (scan_keyword("cc")) {set_conversion(14856, 1157);} X else if (scan_keyword("sp")) goto done; X else { X print_err("Illegal unit of measure ("); X print("pt inserted)"); X help_dimen(); X error(); X goto attach_fraction; X } X cur_val = xn_over_d(cur_val, num, denom); X f = (num * f + 0200000 * remainder) / denom; X cur_val += f / 0200000; X f %= 0200000; X Xattach_fraction: X if (cur_val >= 0400000) X arith_error = TRUE; X else cur_val = cur_val * UNITY + f; X Xdone: X scan_optional_space(); X Xattach_sign: X if (arith_error || abs(cur_val) >= 010000000000) { X print_err("Dimension too large"); X help_big_dimen(); X error(); X cur_val = MAX_DIMEN; X arith_error = FALSE; X } X if (negative) X negate(cur_val); X} X Xscan_glue (level) X int level; X{ X ptr q; X bool mu; X bool negative; X X mu = (level == MU_VAL); X get_nbsx_token(); X if (cur_cmd >= MIN_INTERNAL && cur_cmd <= MAX_INTERNAL) { X scan_something_internal(level, negative); X if (cur_val_level >= GLUE_VAL) { X if (cur_val_level != level) X mu_error(); X return; X } X if (cur_val_level == INT_VAL) X scan_dimen(mu, FALSE, TRUE); X else if (level == MU_VAL) X mu_error(); X } else { X back_input(); X scan_dimen(mu, FALSE, FALSE); X if (negative) X negate(cur_val); X } X q = new_spec(zero_glue); X width(q) = cur_val; X if (scan_keyword("plus")) { X scan_dimen(mu, TRUE, FALSE); X stretch(q) = cur_val; X stretch_order(q) = cur_order; X } X if (scan_keyword("minus")) { X scan_dimen(mu, TRUE, FALSE); X shrink(q) = cur_val; X shrink_order(q) = cur_order; X } X cur_val = q; X} X Xptr Xscan_rule_spec () X{ X ptr q; X X q = new_rule(); X if (cur_cmd == VRULE) X width(q) = DEFAULT_RULE; X else { X height(q) = DEFAULT_RULE; X depth(q) = 0; X } X Xreswitch: X if (scan_keyword("width")) { X scan_normal_dimen(); X width(q) = cur_val; X goto reswitch; X } X if (scan_keyword("height")) { X scan_normal_dimen(); X height(q) = cur_val; X goto reswitch; X } X if (scan_keyword("depth")) { X scan_normal_dimen(); X depth(q) = cur_val; X goto reswitch; X } X return q; X} X X/* X * Help text X */ X Xhelp_mathchar () X{ X help2("A numeric math code must be between 0 and 32767.", X "I changed this one to zero."); X} X Xhelp_number () X{ X help2("Since I expected to read a number between 0 and 15,", X "I changed this one to zero."); X} X Xhelp_char () X{ X help2("The numeric code for a character must be between 0 and 127.", X "I changed this one to zero."); X} X Xhelp_char_num () X{ X help2("A character number must be between 0 and 255.", X "I changed this one to zero."); X} X Xhelp_char_const () X{ X help2("A one-character control sequence belongs after a ` mark.", X "So I'm essentially inserting \\0 here."); X} X Xhelp_big_num () X{ X help2("I can only go up to 2147483647 = 017777777777 = 0x7FFFFFFF.", X "so I'm using that number instead of yours."); X} X Xhelp_missing_number () X{ X help3("A number should have been here; I inserted `0'.", X "(If you can't figure out why I needed to see a number,", X "look up `weird error' in the index to The TeXbook.)"); X} X Xhelp_filll () X{ X help1("I dddon't go any higher than filll."); X} X Xhelp_mu () X{ X help4("The unit of measurement in math glue must be mu.", X "To recover gracefully from this error, it's best to", X "delete the erroneous units; e.g., type `2' to delete", X "two letters. (See Chapter 27 of The TeXbook.)"); X} X Xhelp_mu_error () X{ X help1("I'm going to assume that 1mu=1pt when they're mixed."); X} X Xhelp_dimen () X{ X help6("Dimensions can be in units of em, ex, in, pt, pc,", X "cm, mm, dd, cc, bp, or sp; but yours is a new one!", X "I'll assume that you meant to say pt, for printers' points.", X "To recover gracefully from this error, it's best to", X "delete the erroneous units; e.g. type `2' to delete", X "two letters. (See Chapter 27 of The TeXbook.)"); X} X Xhelp_big_dimen () X{ X help2("I can't work with sizes bigger than about 19 feet.", X "Continue and I'll use the largest value I can."); X} X Xhelp_thee () X{ X help1("I'm forgetting what you said and using zero instead."); X} X Xhelp_left () X{ X help4("A left brace was mandatory here, so I've put one in.", X "You might want to delete and/or insert some corrections", X "so that I will find a matching right brace soon.", X "If you're confused by all this, try typing `I}' now.") X} X Xhelp_aux () X{ X help4("You can refer to \\spacefactor only in horizontal mode;", X "you can refer to \\prevdepth only in vertical mode; and", X "neither of these is meaningful inside \\write. So", X "I'm forgetting what you said and using zero instead."); X} X Xhelp_del () X{ X help2("A numeric delimiter code must be between 0 and 2^{27}-1.", X "I changed this one to zero."); X} X Xhelp_reg () X{ X help2("A register number must be between 0 and 255.", X "I changed this one to zero."); X} SHAR_EOF chmod 0444 scan.c || echo "restore of scan.c fails" set `wc -c scan.c`;Sum=$1 if test "$Sum" != "17405" then echo original size 17405, current size $Sum;fi echo "x - extracting scan.h (Text)" sed 's/^X//' << 'SHAR_EOF' > scan.h && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * scan.h X */ X Xint scan_left_brace(); Xint scan_optional_equals(); Xbool scan_keyword(); X Xglobal val cur_val; Xglobal int cur_val_level; X Xint scan_something_internal(); X X#define INT_VAL 0 X#define DIMEN_VAL 1 X#define GLUE_VAL 2 X#define MU_VAL 3 X#define IDENT_VAL 4 X#define TOK_VAL 5 X Xint scan_eight_bit_int(); Xint scan_seven_bit_int(); Xint scan_four_bit_int(); Xint scan_char_num(); Xint scan_fifteen_bit_int(); Xint scan_twenty_seven_bit_int(); X Xint scan_int(); X#define INFINITY 017777777777 X Xglobal int radix; X X#define PLUS_TOKEN (OTHER_TOKEN + '+') X#define MINUS_TOKEN (OTHER_TOKEN + '-') X#define ZERO_TOKEN (OTHER_TOKEN + '0') X#define A_TOKEN (LETTER_TOKEN + 'A') X#define OTHER_A_TOKEN (OTHER_TOKEN + 'A') X#define OCTAL_TOKEN (OTHER_TOKEN + '\'') X#define HEX_TOKEN (OTHER_TOKEN + '"') X#define ALPHA_TOKEN (OTHER_TOKEN + '`') X#define POINT_TOKEN (OTHER_TOKEN + '.') X#define EURO_POINT_TOKEN (OTHER_TOKEN + ',') X Xint scan_dimen(); X#define MAX_DIMEN 07777777777 X X#define scan_normal_dimen() scan_dimen(FALSE, FALSE, FALSE) X Xglobal gord cur_order; Xint scan_glue(); X X#define scan_optional_space() \ X {get_x_token(); if (cur_cmd != SPACER) back_input();} X X#define get_nbx_token() \ X {do get_x_token(); while (cur_cmd == SPACER);} X X#define get_nbrx_token() \ X {do get_x_token(); while (cur_cmd == SPACER || cur_cmd == RELAX);} X Xptr scan_rule_spec(); X#define DEFAULT_RULE 26215 SHAR_EOF chmod 0444 scan.h || echo "restore of scan.h fails" set `wc -c scan.h`;Sum=$1 if test "$Sum" != "1628" then echo original size 1628, current size $Sum;fi echo "x - extracting setenv.sh (Text)" sed 's/^X//' << 'SHAR_EOF' > setenv.sh && X Xexport TEXFORMATS TEXINPUTS TEXFONTS XTEXFORMATS=.:/users/physics/astron/minard/tex/formats XTEXINPUTS=.:/users/physics/astron/minard/tex/inputs XTEXFONTS=.:/users/physics/astron/minard/tex/fonts SHAR_EOF chmod 0444 setenv.sh || echo "restore of setenv.sh fails" set `wc -c setenv.sh`;Sum=$1 if test "$Sum" != "194" then echo original size 194, current size $Sum;fi echo "x - extracting str.c (Text)" sed 's/^X//' << 'SHAR_EOF' > str.c && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * str.c X */ X X#include "tex.h" X#include "io.h" X#include "file.h" X#include "error.h" X#include "str.h" X Xascii str_pool[POOL_SIZE]; Xptr pool_ptr; Xptr str_start[MAX_STRINGS]; Xstr str_ptr; Xstr null_str; X Xbool Xstr_eq_buf (s, k) X str s; X int k; X{ X int j; X X j = str_start[s]; X while (j < str_start[s + 1]) { X if (str_pool[j] != buffer[k]) X return FALSE; X incr(j); incr(k); X } X return TRUE; X} X Xbool Xstr_eq_str (s, t) X str s; X str t; X{ X int j; X int k; X X if (length(s) != length(t)) X return FALSE; X j = str_start[s]; X k = str_start[t]; X while (j < str_start[s + 1]) { X if (str_pool[j] != str_pool[k]) X return FALSE; X incr(j); incr(k); X } X return TRUE; X} X Xstr Xmake_string () X{ X incr(str_ptr); X if (str_ptr == MAX_STRINGS) X overflow("number of strings", MAX_STRINGS); X str_start[str_ptr] = pool_ptr; X return (str_ptr - 1); X} X Xstr Xmake_string_given (s) X char* s; X{ X while (*s != NUL) { X append_char(*s); X incr(s); X } X return (make_string()); X} X Xinit_strings () X{ X int k; X X str_ptr = pool_ptr = 0; X for (k = 0; k <= 127; incr(k)) { X if (k < ' ') { X append_char('^'); X append_char('^'); X append_char(k + 0100); X } else if (k == 127) X make_string_given("^^?"); X else append_char(k); X make_string(); X } X null_str = make_string(); X} SHAR_EOF chmod 0444 str.c || echo "restore of str.c fails" set `wc -c str.c`;Sum=$1 if test "$Sum" != "1470" then echo original size 1470, current size $Sum;fi echo "x - extracting str.h (Text)" sed 's/^X//' << 'SHAR_EOF' > str.h && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. SHAR_EOF echo "End of part 12" echo "File str.h is continued in part 13" echo "13" > s2_seq_.tmp exit 0
glenn@extro.ucc.su.oz.au (G Geers) (02/16/90)
---- Cut Here and unpack ---- #!/bin/sh # this is part 13 of a multipart archive # do not concatenate these parts, unpack them in order with /bin/sh # file str.h continued # CurArch=13 if test ! -r s2_seq_.tmp then echo "Please unpack part 1 first!" exit 1; fi ( read Scheck if test "$Scheck" != $CurArch then echo "Please unpack part $Scheck next!" exit 1; else exit 0; fi ) < s2_seq_.tmp || exit 1 echo "x - Continuing file str.h" sed 's/^X//' << 'SHAR_EOF' >> str.h X */ X X X/* X * string.h X */ X Xglobal ptr str_start[]; Xglobal str str_ptr; X Xglobal ascii str_pool[]; Xglobal ptr pool_ptr; X Xglobal str null_str; X X#define length(S) (str_start[S + 1] - str_start[S]) X#define cur_length() (pool_ptr - str_start[str_ptr]) X X#define append_char(C) {str_pool[pool_ptr] = C; incr(pool_ptr);} X#define flush_char() decr(pool_ptr) X X#define str_room(S) \ X {if (pool_ptr + S >= POOL_SIZE) \ X overflow("pool_size", POOL_SIZE);} X Xstr make_string(); Xstr make_string_given(); X X#define flush_string() \ X {decr(str_ptr); pool_ptr = str_start[str_ptr];} X Xbool str_eq_buf(); Xbool str_eq_str(); X Xint init_strings(); SHAR_EOF echo "File str.h is complete" chmod 0444 str.h || echo "restore of str.h fails" set `wc -c str.h`;Sum=$1 if test "$Sum" != "843" then echo original size 843, current size $Sum;fi echo "x - extracting tex.1 (Text)" sed 's/^X//' << 'SHAR_EOF' > tex.1 && X.TH TEX 1L 8/20/85 X.SH NAME Xtex, latex, initex, virtex \- text formatting and typesetting X.SH SYNOPSIS X.B tex X[ first line ] X.PP X.B latex X[ first line ] X.PP X.B initex X[ first line ] X.PP X.B virtex X[ first line ] X X.SH DESCRIPTION XTeX Xformats the interspersed text and commands contained in the named Xfiles Xand outputs a typesetter independent file (called X.I DVI Xwhich is short for X.IR D e V ice X.IR I ndependent ). XTeX Xcapabilities and language are described in X.I The TeXbook Xby Donald E. Knuth, published by Addison-Wesley. There is also an older Xmanual, X.I TeX and METAFONT, Xwhich describes the older version of TeX, now called TeX78, but this Xdescription is now obsolete. XThe present version of TeX (often refered to internally as TeX82) Xincorporates literally hundreds of changes from this older version. X.PP XThe \fItex\fR command loads the plain format. XAny arguments given on the command line to the XTeX Xprograms are passed to them as the first input line. XAs described in X.I The TeXbook, Xthat line should begin with a file name Xor a \\controlsequence. XThe normal usage is to say X.RB `` tex X.IR paper '' Xto start processing X.I paper.tex. XThe name ``paper'' will be the ``jobname'', and is used in forming Xoutput file names. XIf TeX doesn't get a file name in the first line, the jobname is ``texput''. XThe default `.tex' extension can be overridden by specifying an extension Xexplicitly. X.PP XIf there is no paper.tex in the current directory, TeX will look Xlook through a search path of directories to try to find it. XThe standard library on the default search path Xhas the basic format package, plain.tex, described Xin the TeXbook, as well as several others. XNote that it is hardly ever necessary to \\input plain, since the X.I tex Xprogram has preloaded it. XThis means that all of the control sequences discussed in the TeXbook Xare known to TeX. X.PP XThe output DVI file is written on X.I name.dvi Xwhere X.I name Xis the jobname. XA log of error messages goes into X.I name.log. X.PP X.PP XNote that there have been incompatible changes in the DVI format Xbetween XTeX78 Xand XTeX82, Xso programs used to print TeX78 output will not work for TeX82. XA number of output drivers are available. The one to use on this system Xis X.I dvialw Xfollowed by X.I lw -X . X.PP XThere are some environment variables that can be used to set up directory Xpaths to search when TeX opens a file for input. XFor example, the X.I csh Xcommand X.br X.in +2 Xsetenv TEXINPUTS .:/usr/me/myinputs:/usr/tex/inputs X.in -2 Xor the X.I sh Xcommand sequence X.br X.in +2 XTEXINPUTS=.:/usr/me/myinputs:/usr/tex/inputs X.br Xexport TEXINPUTS X.in -2 X.br Xwould cause all invocations of tex and its derivatives to look for X\\input files first in the current directory, then in a hypothetical Xuser's ``myinputs'', and finally in the system library. XNormally, the user will place the command sequence which sets up the XTEXINPUTS environment variable in the X.I .cshrc Xor X.I .profile Xfile. XThe Environment section below lists the relevant environment variables, Xand their defaults. X.PP XA convenient file in the library is null.tex, containing nothing. XWhen tex can't find a file it thinks you want to input, it keeps Xasking you for another file name; responding `null' gets you out Xof the loop if you don't want to input anything. Typing `control-D' Xalso works. Presently, `control-C' is ignored. X.PP XTwo other TeX programs, X.I initex Xand X.IR virtex , Xcan be used to create fast-loading customized versions of TeX. XThe X.I initex Xprogram is used to create a X.I format (.fmt) Xfile that permits fast loading of fonts and macro packages. XAfter processing the fonts and definitions desired, a \\dump command Xwill create the format file. XThe format file is used by X.I virtex. XIt needs to be given a format file name as the first thing it reads. XA format file name is preceded by an &, which needs to be escaped with \\ Xif given on the command line. XSo, for instance, one could create a file myfmt.fmt using initex, Xand then set up a cshell alias with X.br X.ti +2 Xalias mytex "virtex \\&myfmt" X.br Xto allow the use of ``mytex paper''. X.SH ENVIRONMENT X.PP X.IP TEXINPUTS XSearch path for \\input and \\openin files. It should be colon-separated, Xand start with ``.''. The entire path must be no longer than 700 Xcharacters long. XDefault: .:/usr/tex/inputs X.IP TEXFONTS XSearch path for font metric files. The entire path must be no longer than 100 Xcharacters long. The default doesn't include the current area (".") to Xavoid confusing the programs that convert the output for printing on the Xvarious output devices (most of which don't know about the path stuff yet). XDefault: /usr/tex/fonts X.IP TEXFORMATS XSearch path for format files. Default: .:/usr/tex/formats X.IP TEXPOOL XSearch path for TeX strings. Default: .:/usr/tex/formats X X.SH FILES X X.TP 2.5i X/usr/tex XTeX's source and library area X.TP X/usr/tex/formats/tex.pool XEncoded text of TeX's messages X.TP X/usr/tex/fonts XTeX's fonts and width tables X.TP X/usr/tex/fonts/*.*pxl,gf,pk XBit maps for low resolution devices X.TP X/usr/tex/fonts/*.tfm XWidth information used by TeX (TeX Font Metric files) X.TP X/usr/tex/formats/*.fmt XDumped binary form TeX system macros X.TP X/usr/tex/inputs XDefault TeX and LaTeX inputs X.br X.SH "SEE ALSO" XOn-line manual entries for XI. dvialw X.br XDonald E. Knuth, X.I The TeXbook X.br XLeslie Lamport, X.I The LaTeX Document Preparation System X.br XMichael Spivak, X.I The Joy of TeX X.br X.I TUGBOAT X(the publication of the TeX Users Group) X.br X.I Differences between TeX82 and SAIL TeX X.SH "TRIVIA" XTeX, pronounced properly, rhymes with ``blecchhh.'' Note that the proper Xspelling in typewriter-like output is ``TeX'' and not ``TEX'' or ``tex.'' X.SH "BUGS" XMaybe there should be character other than & to specify format files, Xsince if you forget the \\ on the command line, it doesn't do what you want! XAlso, there is no way to read a TeX input file with no filename extension. X.SH "AUTHORS" XTeX was designed by Donald E. Knuth, Xwho implemented it using his WEB system for Pascal programs. XIt was ported to Unix at Stanford by Howard Trickey, and Xat Cornell by Pavel Curtis. XWe are running a version of TeX82 which was translated into `C' by XPat Joseph Monardo. SHAR_EOF chmod 0444 tex.1 || echo "restore of tex.1 fails" set `wc -c tex.1`;Sum=$1 if test "$Sum" != "6180" then echo original size 6180, current size $Sum;fi echo "x - extracting tex.c (Text)" sed 's/^X//' << 'SHAR_EOF' > tex.c && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * tex.c X */ X X#include "tex.h" X#include "texext.h" X#include "cmds.h" X#include "heap.h" X#include "char.h" X#include "str.h" X#include "eq.h" X#include "hash.h" X#include "evalstack.h" X#include "eqstack.h" X#include "tokenstack.h" X#include "token.h" X#include "box.h" X#include "pack.h" X#include "cond.h" X#include "io.h" X#include "file.h" X#include "tfm.h" X#include "hyph.h" X#include "dvi.h" X#include "fmt.h" X#include "error.h" X#include "print.h" X#include "page.h" X Xchar banner[] = "This is Common TeX, Version 2.1.1"; Xint ready_already; X Xmain (argc, argv) X int argc; X char *argv[]; X{ X job_name = 0; X history = FATAL_ERROR_STOP; X signal(SIGINT, handle_int); X set_paths(); X adjust_tail = NULL; X page_tail = page_head; X mode = VMODE; X head = tail = contrib_head; X prev_depth = IGNORE_DEPTH; X mode_line = 0; X t_open_out(); X for (first = 0; first < BUF_SIZE; incr(first)) X buffer[first] = 0; X first = 1; X state = NEW_LINE; X start = 1; X if (ready_already != 314159) X initialize(); X ready_already = 314159; X print(banner); X selector = TERM_ONLY; X if (format_ident == 0) X print(" (no format preloaded)"); X else print_str(format_ident); X print_ln(); X if (!decode_args(argc, argv)) X if (!init_terminal()) X exit(history); X limit = last; X first = last + 1; X if (format_ident == 0 || buffer[loc] == '&') { X /*if (format_ident != 0) X initialize();*/ X if (!open_fmt_file()) X exit(history); X if (!load_fmt_file()) X exit(history); X w_close(fmt_file); X while (loc < limit && buffer[loc] == ' ') X incr(loc); X } X if (end_line_char < 0 || end_line_char > 127) X decr(limit); X else buffer[limit] = end_line_char; X fix_date_and_time(); X if (interaction == BATCH_MODE) X selector = NO_PRINT; X else selector = TERM_ONLY; X if (loc < limit && cat_code(buffer[loc]) != ESCAPE) X start_input(); X history = SPOTLESS; X main_control(); X final_cleanup(); X close_files_and_terminate(FALSE); X} X X#define USAGE "usage: %s [ -d dir ] [ file ]\n" X Xbool Xdecode_args (argc, argv) X int argc; X char* *argv; X{ X int j; X char* ap; X char* pgm; X char dir[MAX_PATH_CHARS]; X X ap = pgm = argv[0]; X while (*pgm++ != NUL) X if (*pgm == '/' || *pgm == '\\') X ap = pgm, ap++; X pgm = ap; X X decr(argc), incr(argv); X if (argc) { X last = first; X while (argc) { X if (argv[0][0] == '-') { X for (ap = *argv + 1; *ap != NUL; incr(ap)) { X switch (*ap) X { X case 'd': X decr(argc), incr(argv); X strcpy(dir, *argv); X strcat(dir, ":"); X strcat(dir, input_path); X strcpy(input_path, dir); X break; X X default: X fprintf(stderr, USAGE, pgm); X exit(history); X } X } X } else { X j = 0; X while (j <= FILE_NAME_SIZE && argv[0][j] != NUL) { X buffer[last] = argv[0][j]; X incr(last), incr(j); X } X if (j > 0) X buffer[last++] = ' '; X } X decr(argc), incr(argv); X } X if (last > first) { X loc = first; X return TRUE; X } X } X return FALSE; X} X Xfix_date_and_time () X{ X val clock, begin_time(); X struct tm *tm_ptr, *localtime(); X X clock = begin_time(); X tm_ptr = localtime(&clock); X time = 60 * tm_ptr->tm_hour + tm_ptr->tm_min; X day = tm_ptr->tm_mday; X month = tm_ptr->tm_mon + 1; X year = tm_ptr->tm_year + 1900; X} X Xval Xbegin_time () X{ X#undef time X val time(); X return (time((long *) 0)); X} X Xfinal_cleanup () X{ X int c; X X c = cur_chr; X if (job_name == 0) X open_log_file(); X if (cur_level > LEVEL_ONE) { X print_nl("("); X print_esc("end occured "); X print("inside a group at level "); X print_int(cur_level - LEVEL_ONE); X print_char(')'); X } X while (cond_ptr != NULL) { X print_nl("("); X print_esc("end occurred "); X print("when "); X print_cmd_chr(IF_TEST, cur_if); X if (if_line != 0) { X print(" on line "); X print_val(if_line); X } X print(" was incomplete)"); X if_line = if_line_field(cond_ptr); X cur_if = subtype(cond_ptr); X cond_ptr = link(cond_ptr); X } X if (history != SPOTLESS && X (history == WARNING_ISSUED || interaction < ERROR_STOP_MODE) && X selector == TERM_AND_LOG) { X selector = TERM_ONLY; X print_nl("(see the transcript file for additional information)"); X selector = TERM_AND_LOG; X } X if (c == 1) X#ifdef INIT X store_fmt_file(); X#else X print_nl("(\\dump is performed only by INITEX)"); X#endif X} X Xclose_files_and_terminate (edit) X bool edit; X{ X int k; X X for (k = 0; k < 16; incr(k)) X if (write_open[k]) X a_close(write_file[k]); X X#ifdef STAT X if (tracing_stats > 0) { X print_ln(); X print(" Here is how much of TeX's memory you used:"); X print_ln(); X print_int(str_ptr); X print(" strings out of "); X print_int(MAX_STRINGS); X print_ln(); X print_int(pool_ptr); X print(" string characters out of "); X print_int(POOL_SIZE); X print_ln(); X print_int(lo_mem_max - MEM_MIN + mem_end - hi_mem_min); X print(" words of memory out of "); X print_int(mem_end + 1 - MEM_MIN); X print_ln(); X print_int(cs_count); X print(" multiletter control sequences out of "); X print_int(HASH_SIZE); X print_ln(); X print_int(fmem_ptr); X print(" words of font info for "); X print_int(font_ptr - FONT_BASE); X print(" font"); X if (font_ptr != FONT_BASE + 1) X print_char('s'); X print(", out of "); X print_int(FONT_MEM_SIZE); X print(" for "); X print_int(FONT_MAX - FONT_BASE); X print_ln(); X print_int(hyph_count); X print(" hyphenation exception"); X if (hyph_count != 1) print_char('s'); X print(" out of "); X print_int(HYPH_SIZE); X print_ln(); X print_int(max_in_stack); print("i, "); X print_int(max_nest_stack); print("n, "); X print_int(max_param_stack); print("p, "); X print_int(max_buf_stack + 1); print("b, "); X print_int(max_save_stack + 6); print("s, "); X print_ln(); X } X#endif X wake_up_terminal(); X if (total_pages == 0) X print_nl("No pages of output."); X else { X dvi_out(POST); X dvi_four(last_bop); X last_bop = dvi_offset + dvi_ptr - 5; X dvi_four(25400000); X dvi_four(473628672); X prepare_mag(); X dvi_four(mag); X dvi_four(max_v); X dvi_four(max_h); X dvi_out(max_push / 256); X dvi_out(max_push % 256); X dvi_out(total_pages / 256); X dvi_out(total_pages % 256); X while (font_ptr > FONT_BASE) { X if (font_used[font_ptr]) X dvi_font_def(font_ptr); X decr(font_ptr); X } X dvi_out(POST_POST); X dvi_four(last_bop); X dvi_out(ID_BYTE); X for (k = 4 + (DVI_BUF_SIZE - dvi_ptr) % 4; k > 0; decr(k)) X dvi_out(223); X if (dvi_limit == HALF_BUF) X write_dvi(HALF_BUF, DVI_BUF_SIZE); X if (dvi_ptr > 0) write_dvi(0, dvi_ptr); X print_nl("Output written on "); X print_str(dvi_name); X print(" ("); X print_int(total_pages); X print(" page"); X if (total_pages != 1) X print_char('s'); X print(", "); X print_val(dvi_offset + dvi_ptr); X print(" bytes)."); X b_close(dvi_file); X } X if (job_name > 0) { X wlog_cr(); X a_close(log_file); X selector -= 2; X if (selector == TERM_ONLY) { X print_nl("Transcript written on "); X print_str(log_name); X print_char('.'); X } X } X print_ln(); X if (edit) X {} X exit(history); X} X Xinitialize () X{ X init_char(); X init_strings(); X init_file(); X init_mem(); X init_tok_mem(); X init_eq(); X init_cmds(); X init_hyph(); X init_tfm(); X#ifdef INIT X format_ident = make_string_given(" (INITEX)"); X#endif X} X Xhandle_int () X{ X signal(SIGINT, handle_int); X interrupt = 1; X} SHAR_EOF chmod 0444 tex.c || echo "restore of tex.c fails" set `wc -c tex.c`;Sum=$1 if test "$Sum" != "7361" then echo original size 7361, current size $Sum;fi echo "x - extracting tex.h (Text)" sed 's/^X//' << 'SHAR_EOF' > tex.h && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * tex.h X */ X X#include <stdio.h> X#include <signal.h> X#include <time.h> X X/* X * constants in the outer block X */ X X#define NUL '\0' X#define EOLN '\n' X#define FALSE 0 X#define TRUE 1 X#define EMPTY 0 X X#define BUF_SIZE 5000 X#define DVI_BUF_SIZE 1024 X#define ERROR_LINE 78 X#define FILE_NAME_SIZE 104 X#define FONT_BASE 0 X#define FONT_MAX 100 X#define FONT_MEM_SIZE 25000 X#define HALF_BUF 512 X#define HALF_ERROR_LINE 39 X#define HASH_SIZE 3000 X#define HASH_PRIME 2551 X#define HYPH_SIZE 307 X#define MAX_IN_OPEN 15 X#define MAX_PRINT_LINE 78 X#define MAX_STRINGS 5400 X#define NEST_SIZE 40 X#define PARAM_SIZE 30 X#define POOL_SIZE 25000 X#define SAVE_SIZE 600 X#define STACK_SIZE 200 X#define STRING_VACANCIES 1000 X#define TRIE_OP_HASH_SIZE 512 X#define TRIE_SIZE 8000 X X#ifdef INIT X#if !defined(BIGG) && !defined(BIG) X#define MEM_BOT 0 X#define MEM_TOP 17000 X#define TOK_BOT 0 X#define TOK_TOP 27000 X#define MEM_MIN MEM_BOT X#define MEM_MAX MEM_TOP X#define TOK_MIN TOK_BOT X#define TOK_MAX TOK_TOP X#define MIN_QUARTERWORD 0 X#define MAX_QUARTERWORD 255 X#define MIN_HALFWORD 0 X#define MAX_HALFWORD 65535 X#endif X X#ifdef BIG X#define MEM_BOT 0 X#define MEM_TOP 27000 X#define TOK_BOT 0 X#define TOK_TOP 37000 X#define MEM_MIN MEM_BOT X#define MEM_MAX MEM_TOP X#define TOK_MIN TOK_BOT X#define TOK_MAX TOK_TOP X#define MIN_QUARTERWORD 0 X#define MAX_QUARTERWORD 255 X#define MIN_HALFWORD 0 X#define MAX_HALFWORD 655350 X#endif X X#ifdef BIGG X#define MEM_BOT 0 X#define MEM_TOP 37000 X#define TOK_BOT 0 X#define TOK_TOP 47000 X#define MEM_MIN MEM_BOT X#define MEM_MAX MEM_TOP X#define TOK_MIN TOK_BOT X#define TOK_MAX TOK_TOP X#define MIN_QUARTERWORD 0 X#define MAX_QUARTERWORD 255 X#define MIN_HALFWORD 0 X#define MAX_HALFWORD 6553500 X#endif X X#else X X#if !defined(BIGG) && !defined(BIG) X#define MEM_BOT 0 X#define MEM_TOP 17000 X#define TOK_BOT 0 X#define TOK_TOP 27000 X#define MEM_MIN 0 X#define MEM_MAX 32000 X#define TOK_MIN 0 X#define TOK_MAX 35000 X#define MIN_QUARTERWORD 0 X#define MAX_QUARTERWORD 255 X#define MIN_HALFWORD 0 X#define MAX_HALFWORD 65535 X#endif X X#ifdef BIG X#define MEM_BOT 0 X#define MEM_TOP 27000 X#define TOK_BOT 0 X#define TOK_TOP 37000 X#define MEM_MIN 0 X#define MEM_MAX 128000 X#define TOK_MIN 0 X#define TOK_MAX 45000 X#define MIN_QUARTERWORD 0 X#define MAX_QUARTERWORD 255 X#define MIN_HALFWORD 0 X#define MAX_HALFWORD 655350 X#endif X X#ifdef BIGG X#define MEM_BOT 0 X#define MEM_TOP 37000 X#define TOK_BOT 0 X#define TOK_TOP 47000 X#define MEM_MIN 0 X#define MEM_MAX 256000 X#define TOK_MIN 0 X#define TOK_MAX 65000 X#define MIN_QUARTERWORD 0 X#define MAX_QUARTERWORD 255 X#define MIN_HALFWORD 0 X#define MAX_HALFWORD 6553500 X#endif X X#endif X X/* X * types in the outer block X */ X X#define global extern X X#define ascii unsigned char X#define bool int X#define byte unsigned char X#define fnt int X#define gord unsigned char X#define gratio float X#define group int X#define ptr hword X#define sc i X#define scal long X#define str hword X#define val long X Xtypedef FILE *word_file; Xtypedef FILE *alpha_file; Xtypedef FILE *byte_file; X X#define qword unsigned char X X#if defined(BIG) || defined(BIGG) X#define hword unsigned long X#else X#define hword unsigned short X#endif X Xtypedef union { X struct { X hword rh; X hword lh; X } hh1; X struct { X hword rh; X qword b0; X qword b1; X } hh2; X} twoh; X Xtypedef struct { X qword b0; X qword b1; X qword b2; X qword b3; X} fourq; X Xtypedef union { X long i; X gratio gr; X twoh hh; X fourq qqqq; X} mword; X X/* X * variables in the outer block X */ X Xglobal char banner[]; Xglobal int ready_already; X X/* X * functions in the outer block X */ X Xint final_cleanup(); Xint close_files_and_terminate(); Xint initialize(); Xbool decode_args(); Xint handle_int(); X X/* X * some common programming idioms X */ X X#define incr(i) ++(i) X#define decr(i) --(i) X#define odd(i) ((i) & 1) X#define abs(i) ((i) >= 0 ? (i) : -(i)) X#define round(x) (long) ((x) > 0.0 ? ((x) + 0.5) : ((x) - 0.5)) X#define negate(x) (x) = -(x) X#define loop while (1) SHAR_EOF chmod 0444 tex.h || echo "restore of tex.h fails" set `wc -c tex.h`;Sum=$1 if test "$Sum" != "4374" then echo original size 4374, current size $Sum;fi echo "x - extracting texext.c (Text)" sed 's/^X//' << 'SHAR_EOF' > texext.c && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * texext.c X */ X X#include "tex.h" X#include "cmds.h" X#include "heap.h" X#include "eq.h" X#include "hash.h" X#include "token.h" X#include "box.h" X#include "scan.h" X#include "def.h" X#include "tokenstack.h" X#include "tokenlists.h" X#include "evalstack.h" X#include "io.h" X#include "str.h" X#include "file.h" X#include "dvi.h" X#include "print.h" X#include "error.h" X#include "texext.h" X Xalpha_file write_file[16]; X Xbool write_open[18]; Xptr write_loc; X Xdo_extension () X{ X int i; X int j; X int k; X ptr p; X ptr q; X ptr r; X X switch (cur_chr) X { X case OPEN_NODE: X new_write(OPEN_NODE_SIZE); X scan_optional_equals(); X scan_file_name(); X open_name(tail) = cur_name; X open_area(tail) = cur_area; X open_ext(tail) = cur_ext; X break; X X case WRITE_NODE: X k = cur_cs; X new_write(WRITE_NODE_SIZE); X cur_cs = k; X scan_toks(FALSE, FALSE); X write_tokens(tail) = def_ref; X break; X X case CLOSE_NODE: X new_write(WRITE_NODE_SIZE); X write_tokens(tail) = NULL; X break; X X case SPECIAL_NODE: X new_whatsit(SPECIAL_NODE, WRITE_NODE_SIZE); X cur_cs = k; X scan_toks(FALSE, TRUE); X write_tokens(tail) = def_ref; X break; X X case IMMEDIATE_CODE: X get_x_token(); X if (cur_cmd == EXTENSION && cur_chr <= CLOSE_NODE) { X p = tail; X do_extension(); X out_whatsit(tail); X flush_node_list(tail); X tail = p; X link(p) = NULL; X } else back_input(); X break; X X default: X confusion("ext1"); X break; X } X} X Xnew_whatsit (s, w) X int s; X int w; X{ X ptr p; X X p = get_node(w); X type(p) = WHATSIT_NODE; X subtype(p) = s; X link(tail) = p; X tail = p; X} X Xshow_whatsit (p) X ptr p; X{ X switch (subtype(p)) X { X case OPEN_NODE: X print_write("openout", p); X print_char('='); X print_file_name(open_name(p), open_area(p), open_ext(p)); X break; X X case WRITE_NODE: X print_write("write", p); X print_mark(write_tokens(p)); X break; X X case CLOSE_NODE: X print_write("closeout", p); X break; X X case SPECIAL_NODE: X print_esc("special"); X print_mark(write_tokens(p)); X break; X X default: X print("whatsit?"); X break; X } X} X Xptr Xcopy_whatsit (p) X ptr p; X{ X ptr q; X X switch (subtype(p)) X { X case OPEN_NODE: X q = get_node(OPEN_NODE_SIZE); X mem[q + 2] = mem[p + 2]; X mem[q + 1] = mem[p + 1]; X break; X X case WRITE_NODE: X case SPECIAL_NODE: X q = get_node(WRITE_NODE_SIZE); X add_token_ref(write_tokens(p)); X mem[q + 1] = mem[p + 1]; X break; X X case CLOSE_NODE: X q = get_node(WRITE_NODE_SIZE); X mem[q + 1] = mem[p + 1]; X break; X X default: X confusion("ext2"); X break; X } X return q; X} X Xfree_whatsit (p) X ptr p; X{ X switch (subtype(p)) X { X case OPEN_NODE: X free_node(p, OPEN_NODE_SIZE); X break; X X case WRITE_NODE: X case SPECIAL_NODE: X delete_token_ref(write_tokens(p)); X free_node(p, WRITE_NODE_SIZE); X break; X X case CLOSE_NODE: X free_node(p, WRITE_NODE_SIZE); X break; X X default: X confusion("ext3"); X break; X } X} X Xout_whatsit (p) X ptr p; X{ X int j; X X switch (subtype(p)) X { X case OPEN_NODE: X case WRITE_NODE: X case CLOSE_NODE: X if (!doing_leaders) { X j = write_stream(p); X if (subtype(p) == WRITE_NODE) X out_write(p); X else { X if (write_open[j]) X a_close(write_file[j]); X if (subtype(p) == CLOSE_NODE) X write_open[j] = FALSE; X else { X cur_name = open_name(p); X cur_area = open_area(p); X cur_ext = open_ext(p); X if (cur_ext == null_str) X cur_ext = str_tex; X if (cur_area == null_str) X cur_area = job_area; X pack_cur_name(); X if ((write_file[j] = a_open_out()) == NULL) { X cur_area = null_str; X pack_cur_name(); X while ((write_file[j] = a_open_out()) == NULL) X prompt_file_name("output file name", str_tex); X } X write_open[j] = TRUE; X } X } X } X break; X X case SPECIAL_NODE: X out_special(p); X break; X X default: X confusion("ext4"); X break; X } X} X Xnew_write (w) X int w; X{ X new_whatsit(cur_chr, w); X if (w != WRITE_NODE_SIZE) X scan_four_bit_int(); X else { X scan_int(); X if (cur_val < 0) X cur_val = 17; X else if (cur_val > 15) X cur_val = 16; X } X write_stream(tail) = cur_val; X} X Xprint_write (s, p) X char* s; X ptr p; X{ X print_esc(s); X if (write_stream(p) < 16) X print_int(write_stream(p)); X else if (write_stream(p) == 16) X print_char('*'); X else print_char('-'); X} X Xout_write (p) X ptr p; X{ X int j; X ptr q; X ptr r; X int old_mode; X int old_setting; X X q = new_token(); X token(q) = RIGHT_BRACE_TOKEN + '}'; X r = new_token(); X token_link(q) = r; X token(r) = END_WRITE_TOKEN; X ins_list(q); X begin_token_list(write_tokens(p), WRITE_TEXT); X q = new_token(); X token(q) = LEFT_BRACE_TOKEN + '{'; X ins_list(q); X old_mode = mode; X mode = 0; X cur_cs = write_loc; X scan_toks(FALSE, TRUE); X get_token(); X if (cur_tok != END_WRITE_TOKEN) { X print_err("Unbalanced write command"); X help_unbal_write(); X error(); X do get_token(); X while (cur_tok != END_WRITE_TOKEN); X } X mode = old_mode; X end_token_list(); X old_setting = selector; X j = write_stream(p); X if (write_open[j]) X selector = j; X else { X if (j == 17 && selector == TERM_AND_LOG) X selector = LOG_ONLY; X print_nl(""); X } X show_token_list(token_link(def_ref), NULL, 10000000); X print_ln(); X flush_list(def_ref); X selector = old_setting; X} X Xout_special (p) X ptr p; X{ X int old_setting; X int k; X X synch_h(); X synch_v(); X old_setting = selector; X selector = NEW_STRING; X show_token_list(token_link(write_tokens(p)),NULL,(val)POOL_SIZE-pool_ptr); X selector = old_setting; X str_room(1); X if (cur_length() < 256) { X dvi_out(XXX1); X dvi_out(cur_length()); X } else { X dvi_out(XXX4); X dvi_four(cur_length()); X } X for (k = str_start[str_ptr]; k < pool_ptr; incr(k)) X dvi_out(str_pool[k]); X pool_ptr = str_start[str_ptr]; X} X X/* X * Help text X */ X Xhelp_unbal_write () X{ X help2("On this page there's a \\write with fewer real {'s than }'s.", X "I can't handle that very well; good luck."); X} SHAR_EOF chmod 0444 texext.c || echo "restore of texext.c fails" set `wc -c texext.c`;Sum=$1 if test "$Sum" != "6015" then echo original size 6015, current size $Sum;fi echo "x - extracting texext.h (Text)" sed 's/^X//' << 'SHAR_EOF' > texext.h && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * texext.h X */ X X X#define OPEN_NODE 0 X#define open_name(M) link(M + 1) X#define open_area(M) info(M + 2) X#define open_ext(M) link(M + 2) X#define OPEN_NODE_SIZE 3 X X#define WRITE_NODE 1 X#define write_tokens(M) link(M + 1) X#define write_stream(M) info(M + 1) X#define WRITE_NODE_SIZE 2 X X#define CLOSE_NODE 2 X#define SPECIAL_NODE 3 X X#define IMMEDIATE_CODE 4 X#define END_WRITE_TOKEN CS_TOKEN_FLAG + END_WRITE X Xglobal alpha_file write_file[]; X Xglobal bool write_open[]; Xglobal ptr write_loc; X Xint do_extension(); X Xint new_whatsit(); Xint show_whatsit(); Xint free_whatsit(); Xptr copy_whatsit(); Xint out_whatsit(); Xint new_write(); Xint out_write(); Xint print_write(); Xint out_special(); SHAR_EOF chmod 0444 texext.h || echo "restore of texext.h fails" set `wc -c texext.h`;Sum=$1 if test "$Sum" != "921" then echo original size 921, current size $Sum;fi echo "x - extracting tfm.c (Text)" sed 's/^X//' << 'SHAR_EOF' > tfm.c && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * tfm.c X */ X X#include "tex.h" X#include "cmds.h" X#include "heap.h" X#include "arith.h" X#include "eq.h" X#include "hash.h" X#include "box.h" X#include "scan.h" X#include "token.h" X#include "tokenstack.h" X#include "str.h" X#include "io.h" X#include "file.h" X#include "print.h" X#include "error.h" X#include "tfm.h" X X/* X * Read and check the font data; X * If the TFM file is malformed, goto bad_tfm; X * If there is no room for this font, say so and goto done; X * otherwise, incr(font_ptr) and goto done. X */ X Xbyte_file tfm_file; X Xfourq null_character; X Xptr fmem_ptr; Xmword font_info[FONT_MEM_SIZE]; X Xfnt font_ptr = FONT_BASE; Xfourq font_check[FONT_MAX]; Xscal font_size[FONT_MAX]; Xscal font_dsize[FONT_MAX]; Xhword font_params[FONT_MAX]; Xstr font_name[FONT_MAX]; Xstr font_area[FONT_MAX]; Xbyte font_bc[FONT_MAX]; Xbyte font_ec[FONT_MAX]; Xptr font_glue[FONT_MAX]; Xbool font_used[FONT_MAX]; Xint hyphen_char[FONT_MAX]; Xint skew_char[FONT_MAX]; Xint char_base[FONT_MAX]; Xint width_base[FONT_MAX]; Xint height_base[FONT_MAX]; Xint depth_base[FONT_MAX]; Xint italic_base[FONT_MAX]; Xint lig_kern_base[FONT_MAX]; Xint kern_base[FONT_MAX]; Xint exten_base[FONT_MAX]; Xint param_base[FONT_MAX]; X X#define start_font_error_message() \ X {print_err("Font "); sprint_cs(u); \ X print_char('='); print_file_name(nom, aire, null_str); \ X if (s >= 0) {print(" at "); print_scaled(s); print("pt");} \ X else if (s != -1000) {print(" scaled "); print_int(-s);}} X X#define get_font_byte() \ X (font_byte = getc(tfm_file)) X X#define read_sixteen(X) \ X {get_font_byte(); X = font_byte; \ X if (X > 127) goto bad_tfm; \ X get_font_byte(); X = (X) * 0400 + font_byte;} X X#define store_four_quarters(Q) \ X {a = get_font_byte(); b = get_font_byte(); \ X c = get_font_byte(); d = get_font_byte(); \ X qw.b0 = qi(a); qw.b1 = qi(b); \ X qw.b2 = qi(c); qw.b3 = qi(d); Q = qw;} X X#define store_scaled(S) \ X {a = get_font_byte(); b = get_font_byte(); \ X c = get_font_byte(); d = get_font_byte(); \ X sw = ((((d * z) / 0400) + (c * z)) / 0400 + (b * z)) / beta; \ X if (a == 0) S = sw; else if (a == 255) S = sw - alpha; \ X else goto bad_tfm;} X X#define check_byte_range(C) {if (C < bc || C > ec) goto bad_tfm;} X#define ccbwo (k + bc - fmem_ptr) X#define adjust(I) (I[f] = qo(I[f])) X Xfnt Xread_font_info (u, nom, aire, s) X fnt u; X str nom; X str aire; X scal s; X{ X byte a; X byte b; X byte c; X byte d; X fnt f; X fnt g; X int k; X scal z; X hword bc; X hword ec; X hword lf; X hword lh; X hword nd; X hword ne; X hword nh; X hword ni; X hword nk; X hword nl; X hword np; X hword nw; X fourq qw; X scal sw; X val alpha; X hword beta; X bool file_opened; X byte font_byte; X fourq dev_null; X/* X * Open tfm_file for input X */ X g = NULL_FONT; X file_opened = FALSE; X pack_file_name(nom, aire, str_tfm); X if ((tfm_file = b_open_in()) == NULL) X goto bad_tfm; X file_opened = TRUE; X/* X * Read the TFM size fields X */ X read_sixteen(lf); X read_sixteen(lh); X read_sixteen(bc); X read_sixteen(ec); X if (bc > ec + 1 || ec > 255) goto bad_tfm; X read_sixteen(nw); X read_sixteen(nh); X read_sixteen(nd); X read_sixteen(ni); X read_sixteen(nl); X read_sixteen(nk); X read_sixteen(ne); X read_sixteen(np); X if (lf != 6 + lh + (ec - bc + 1) + nw + nh + nd + ni + nl + nk + ne + np) X goto bad_tfm; X/* X * Use size fields to allocate font information X */ X lf = lf - 6 - lh; X if (np < 7) lf += 7 - np; X if (font_ptr == FONT_MAX-1 || fmem_ptr + lf >= FONT_MEM_SIZE) { X start_font_error_message(); X print(" not loaded: No more room"); X help_font(); X error(); X goto done; X } X f = font_ptr + 1; X char_base[f] = fmem_ptr - bc; X width_base[f] = char_base[f] + ec + 1; X height_base[f] = width_base[f] + nw; X depth_base[f] = height_base[f] + nh; X italic_base[f] = depth_base[f] + nd; X lig_kern_base[f] = italic_base[f] + ni; X kern_base[f] = lig_kern_base[f] + nl; X exten_base[f] = kern_base[f] + nk; X param_base[f] = exten_base[f] + ne; X/* X * Read the TFM header X */ X if (lh < 2) goto bad_tfm; X store_four_quarters(font_check[f]); X read_sixteen(z); X get_font_byte(); X z = z * 0400 + font_byte; X get_font_byte(); X z = z * 020 + font_byte / 020; X if (z < UNITY) goto bad_tfm; X while (lh > 2) { X store_four_quarters(dev_null); X decr(lh); X } X font_dsize[f] = z; X if (s != -1000) { X if (s >= 0) X z = s; X else z = xn_over_d(z, -s, 1000L); X } X font_size[f] = z; X/* X * Read character data X */ X for (k = fmem_ptr; k < width_base[f]; incr(k)) { X store_four_quarters(font_info[k].qqqq); X if (a >= nw || b / 020 >= nh || b % 020 >= nd || c / 4 > ni) X goto bad_tfm; X switch (c % 4) X { X case LIG_TAG: X if (d >= nl) goto bad_tfm; X break; X X case EXT_TAG: X if (d >= ne) goto bad_tfm; X break; X X case LIST_TAG: X check_byte_range(d); X while (d < ccbwo) { X qw = char_info(f, d); X if (char_tag(qw) != LIST_TAG) X goto not_found; X d = qo(rem_byte(qw)); X } X if (d == ccbwo) goto bad_tfm; X break; X X not_found: X break; X } X } X/* X * Read box dimensions X */ X alpha = 16 * z; beta = 16; X while (z >= 040000000) { X z >>= 1; X beta >>= 1; X } X X for (k = width_base[f]; k < lig_kern_base[f]; incr(k)) X store_scaled(font_info[k].sc); X if (font_info[width_base[f]].sc != 0) X goto bad_tfm; X if (font_info[height_base[f]].sc != 0) X goto bad_tfm; X if (font_info[depth_base[f]].sc != 0) X goto bad_tfm; X if (font_info[italic_base[f]].sc != 0) X goto bad_tfm; X/* X * Read ligature/kern programs X */ X for (k = lig_kern_base[f]; k < kern_base[f]; incr(k)) { X store_four_quarters(font_info[k].qqqq); X check_byte_range(b); X if (c < KERN_FLAG) { X check_byte_range(d); X } else if (d >= nk) X goto bad_tfm; X } X if (nl > 0 && a < STOP_FLAG) X goto bad_tfm; X X for (k = kern_base[f]; k < exten_base[f]; incr(k)) X store_scaled(font_info[k].sc); X/* X * Read extensible character recipes X */ X for (k = exten_base[f]; k < param_base[f]; incr(k)) { X store_four_quarters(font_info[k].qqqq); X if (a != 0) X check_byte_range(a); X if (b != 0) X check_byte_range(b); X if (c != 0) X check_byte_range(c); X check_byte_range(d); X } X/* X * Read font parameters X */ X for (k = 1; k <= np; incr(k)) { X if (k == 1) { X get_font_byte(); X sw = font_byte; X if (sw > 127) X sw -= 256; X get_font_byte(); X sw = sw * 0400 + font_byte; X get_font_byte(); X sw = sw * 0400 + font_byte; X get_font_byte(); X font_info[param_base[f]].sc = sw * 020 + font_byte / 020; X } else X store_scaled(font_info[param_base[f] + k - 1].sc); X } X if (feof(tfm_file)) X goto bad_tfm; X X for (k = np + 1; k <= 7; incr(k)) X font_info[param_base[f] + k - 1].sc = 0; X/* X * Make final adjustments and done X */ X font_params[f] = (np >= 7) ? np : 7; X hyphen_char[f] = default_hyphen_char; X skew_char[f] = default_skew_char; X font_name[f] = nom; X font_area[f] = aire; X font_bc[f] = bc; X font_ec[f] = ec; X font_glue[f] = NULL; X adjust(char_base); X adjust(width_base); X adjust(lig_kern_base); X adjust(kern_base); X adjust(exten_base); X decr(param_base[f]); X fmem_ptr += lf; X font_ptr = f; X g = f; X goto done; X Xbad_tfm: X start_font_error_message(); X if (file_opened) X print(" not loadable: Bad metric (TFM) file"); X else print(" not loadable: Metric (TFM) file not found"); X help_tfm(); X error(); X return NULL_FONT; X Xdone: X b_close(tfm_file); X return g; X} X Xscan_font_ident () X{ X fnt f; X int m; X X get_nbx_token(); X if (cur_cmd == DEF_FONT) X f = cur_font; X else if (cur_cmd == SET_FONT) X f = cur_chr; X else if (cur_cmd == DEF_FAMILY) { X m = cur_chr; X scan_four_bit_int(); X f = equiv(m + cur_val); X } else { X print_err("Missing font identifier"); X help_font_cs(); X back_error(); X f = NULL_FONT; X } X cur_val = f; X} X Xfind_font_dimen (writing) X bool writing; X{ X fnt f; X int n; X X scan_int(); X n = cur_val; X scan_font_ident(); X f = cur_val; X if (n <= 0) X cur_val = fmem_ptr; X else { X if (writing && X n <= SPACE_SHRINK_CODE && X n >= SPACE_CODE && X font_glue[f] != NULL) { X delete_glue_ref(font_glue[f]); X font_glue[f] = NULL; X } X if (n > font_params[f]) { X if (f < font_ptr) X cur_val = fmem_ptr; X else { X do { X if (fmem_ptr == FONT_MEM_SIZE) X overflow("font_memory", FONT_MEM_SIZE); X font_info[fmem_ptr].sc = 0; X incr(fmem_ptr); X incr(font_params[f]); X } while (n != font_params[f]); X cur_val = fmem_ptr - 1; X } X } else X cur_val = n + param_base[f]; X } X if (cur_val == fmem_ptr) { X print_nl("! Font "); X print_esc(""); X print_str(font_id_text(f)); X print(" has only "); X print_int(font_params[f]); X print(" fontdimen parameters"); X help_font_param(); X error(); X } X} X Xchar_warning (f, c) X fnt f; X byte c; X{ X if (tracing_lost_chars > 0) { X begin_diagnostic(); X print_nl("Missing character: There is no "); X print_ASCII(c); X print(" in font "); X print_str(font_name[f]); X print_char('!'); X end_diagnostic(FALSE); X } X} X Xptr Xnew_character (f, c) X fnt f; X byte c; X{ X ptr p; X X if (font_bc[f] <= c && font_ec[f] >= c) { X if (char_exists(char_info(f, qi(c)))) { X p = get_avail(); X font(p) = f; X character(p) = qi(c); X return p; X } X } X char_warning(f, c); X return NULL; X} X Xinit_tfm () X{ X fmem_ptr = 7; X font_params[0] = 7; X font_bc[0] = 1; X font_glue[0] = zero_glue; X hyphen_char[0] = '-'; X skew_char[0] = -1; X param_base[0] = -1; X} X X/* X * Help text X */ X Xhelp_font () X{ X help4("I'm afraid I won't be able to make use of this font,", X "because my memory for character-size data is too small.", X "If you're really stuck, ask a wizard to enlarge me.", X "Or maybe try `I\\font<same font id>=<name of loaded font>'."); X} X Xhelp_tfm () X{ X help5("I wasn't able to read the size data for this font,", X "so I will ignore the font specification.", X "[Wizards can fix TFM files using TFtoPL/PLtoTF.]", X "You might try inserting a different font spec;", X "e.g., type `I\\font<same font id>=<substitute font name>'."); X} X Xhelp_font_param () X{ X help2("To increase the number of font parameters, you must", X "use \\fontdimen immediately after the \\font is loaded."); X} X Xhelp_font_cs () X{ X help2("I was looking for a control sequence whose", X "current meaning has been defined by \\font."); X} SHAR_EOF chmod 0444 tfm.c || echo "restore of tfm.c fails" set `wc -c tfm.c`;Sum=$1 if test "$Sum" != "10162" then echo original size 10162, current size $Sum;fi echo "x - extracting tfm.h (Text)" sed 's/^X//' << 'SHAR_EOF' > tfm.h && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * tfm.h X */ X Xglobal byte_file tfm_file; X Xglobal mword font_info[]; Xglobal ptr fmem_ptr; X Xglobal fourq null_character; X Xglobal fourq font_check[]; Xglobal scal font_size[]; Xglobal scal font_dsize[]; Xglobal hword font_params[]; Xglobal str font_name[]; Xglobal str font_area[]; Xglobal byte font_bc[]; Xglobal byte font_ec[]; Xglobal ptr font_glue[]; Xglobal bool font_used[]; Xglobal int hyphen_char[]; Xglobal int skew_char[]; X Xglobal int char_base[]; Xglobal int width_base[]; Xglobal int height_base[]; Xglobal int depth_base[]; Xglobal int italic_base[]; Xglobal int lig_kern_base[]; Xglobal int kern_base[]; Xglobal int exten_base[]; Xglobal int param_base[]; X Xglobal fnt font_ptr; X X#define char_exists(CI) \ X ((CI).b0 > MIN_QUARTERWORD) X X#define char_info(F, C) \ X font_info[char_base[F] + (C)].qqqq X X#define char_width(F, CI) \ X font_info[width_base[F] + CI.b0].sc X X#define char_height(F, CB) \ X font_info[height_base[F] + (CB) / 16].sc X X#define char_depth(F, CB) \ X font_info[depth_base[F] + (CB) % 16].sc X X#define char_italic(F, CI) \ X font_info[italic_base[F] + qo(CI.b2) / 4].sc X X#define NO_TAG 0 X#define LIG_TAG 1 X#define LIST_TAG 2 X#define EXT_TAG 3 X X#define stop_bit(M) M.b0 X#define next_char(M) M.b1 X#define op_bit(M) M.b2 X#define rem_byte(M) M.b3 X#define STOP_FLAG 128 X#define KERN_FLAG 128 X X#define ext_top(M) M.b0 X#define ext_mid(M) M.b1 X#define ext_bot(M) M.b2 X#define ext_rep(W) W.b3 X X#define char_tag(CI) \ X qo(CI.b2) % 4 X X#define height_depth(CI) \ X qo(CI.b1) X X#define lig_kern_start(F, CI) \ X lig_kern_base[F] + rem_byte(CI) X X#define char_kern(F, CI) \ X font_info[kern_base[F] + rem_byte(CI)].sc X X#define SLANT_CODE 1 X#define SPACE_CODE 2 X#define SPACE_STRETCH_CODE 3 X#define SPACE_SHRINK_CODE 4 X#define X_HEIGHT_CODE 5 X#define QUAD_CODE 6 X#define EXTRA_SPACE_CODE 7 X X#define param(F, CODE) \ X font_info[param_base[F] + CODE].sc X X#define slant(F) \ X param(F, SLANT_CODE) X X#define space(F) \ X param(F, SPACE_CODE) X X#define space_stretch(F) \ X param(F, SPACE_STRETCH_CODE) X X#define space_shrink(F) \ X param(F, SPACE_SHRINK_CODE) X X#define x_height(F) \ X param(F, X_HEIGHT_CODE) X X#define quad(F) \ X param(F, QUAD_CODE) X X#define extra_space(F) \ X param(F, EXTRA_SPACE_CODE) X Xfnt read_font_info(); Xint find_font_dimen(); Xint scan_font_ident(); Xint char_warning(); Xptr new_character(); SHAR_EOF chmod 0444 tfm.h || echo "restore of tfm.h fails" set `wc -c tfm.h`;Sum=$1 if test "$Sum" != "2561" then echo original size 2561, current size $Sum;fi echo "x - extracting tfms.c (Text)" sed 's/^X//' << 'SHAR_EOF' > tfms.c && SHAR_EOF chmod 0444 tfms.c || echo "restore of tfms.c fails" set `wc -c tfms.c`;Sum=$1 if test "$Sum" != "0" then echo original size 0, current size $Sum;fi echo "x - extracting token.c (Text)" sed 's/^X//' << 'SHAR_EOF' > token.c && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * token.c X */ X X#include "tex.h" X#include "cmds.h" X#include "heap.h" X#include "eq.h" X#include "hash.h" X#include "scan.h" X#include "io.h" X#include "char.h" X#include "box.h" X#include "cond.h" X#include "print.h" X#include "error.h" X#include "expand.h" X#include "align.h" X#include "tokenstack.h" X#include "token.h" X Xhword cur_chr; Xbyte cur_cmd; Xptr cur_cs; Xhword cur_tok; X X/* X * this is the TeX segment X */ X Xhword tok[TOK_MAX-TOK_MIN+1]; Xhword tok_link[TOK_MAX-TOK_MIN+1]; Xptr tok_head; Xptr tok_low; Xptr tok_end; Xint tok_used; X Xptr par_loc; Xhword par_token; X Xbool force_eof; X Xget_token () X{ X no_new_control_sequence = FALSE; X get_next(); X no_new_control_sequence = TRUE; X if (cur_cs == 0) X cur_tok = cur_cmd * 0400 + cur_chr; X else cur_tok = CS_TOKEN_FLAG + cur_cs; X} X X#define reduce_expanded_cc() \ X {if (buffer[k] == cur_chr && \ X cat == SUP_MARK && k < limit) { \ X cur_chr = buffer[k + 1]; \ X if (cur_chr < 0100) \ X buffer[k - 1] = cur_chr + 0100; \ X else buffer[k - 1] = cur_chr - 0100; \ X limit -= 2; \ X first -= 2; \ X while (k <= limit) { \ X buffer[k] = buffer[k + 2]; \ X incr(k);} \ X goto start_cs;}} X X#define any_state(CAT) \ X case MID_LINE + CAT: \ X case SKIP_BLANKS + CAT: \ X case NEW_LINE + CAT X X#define delims(CAT) \ X case MATH_SHIFT + CAT: \ X case TAB_MARK + CAT: \ X case MAC_PARAM + CAT: \ X case SUB_MARK + CAT: \ X case LETTER + CAT: \ X case OTHER_CHAR + CAT X X#define mid_line(CAT) \ X case MID_LINE + CAT X X#define new_line(CAT) \ X case NEW_LINE + CAT X X#define skip_blanks(CAT) \ X case SKIP_BLANKS + CAT X Xget_next () X{ X int k; X hword t; X int cat; X Xrestart: X cur_cs = 0; X if (state != TOKEN_LIST) { Xreread: X if (loc <= limit) { X cur_chr = buffer[loc]; X incr(loc); Xreswitch: X cur_cmd = cat_code(cur_chr); X switch (state + cur_cmd) X { X any_state(IGNORE): X skip_blanks(SPACER): X new_line(SPACER): X goto reread; X break; X X any_state(ESCAPE): X if (loc > limit) X cur_cs = NULL_CS; X else { X start_cs: SHAR_EOF echo "End of part 13" echo "File token.c is continued in part 14" echo "14" > s2_seq_.tmp exit 0
glenn@extro.ucc.su.oz.au (G Geers) (02/16/90)
---- Cut Here and unpack ---- #!/bin/sh # this is part 14 of a multipart archive # do not concatenate these parts, unpack them in order with /bin/sh # file token.c continued # CurArch=14 if test ! -r s2_seq_.tmp then echo "Please unpack part 1 first!" exit 1; fi ( read Scheck if test "$Scheck" != $CurArch then echo "Please unpack part $Scheck next!" exit 1; else exit 0; fi ) < s2_seq_.tmp || exit 1 echo "x - Continuing file token.c" sed 's/^X//' << 'SHAR_EOF' >> token.c X k = loc; X cur_chr = buffer[k]; X cat = cat_code(cur_chr); X incr(k); X if (cat == LETTER) X state = SKIP_BLANKS; X else if (cat == SPACER) X state = SKIP_BLANKS; X else state = MID_LINE; X if (cat == LETTER && k <= limit) { X do { X cur_chr = buffer[k]; X incr(k); X cat = cat_code(cur_chr); X } while (cat == LETTER && k <= limit); X reduce_expanded_cc(); X if (cat != LETTER) X decr(k); X if (k > loc + 1) { X cur_cs = id_lookup(loc, k - loc); X loc = k; X goto found; X } X } else reduce_expanded_cc(); X cur_cs = SINGLE_BASE + buffer[loc]; X incr(loc); X } X found: X cur_cmd = eq_type(cur_cs); X cur_chr = equiv(cur_cs); X if (cur_cmd >= OUTER_CALL) X check_outer_validity(); X break; X X any_state(ACTIVE_CHAR): X cur_cs = cur_chr + ACTIVE_BASE; X cur_cmd = eq_type(cur_cs); X cur_chr = equiv(cur_cs); X state = MID_LINE; X if (cur_cmd >= OUTER_CALL) X check_outer_validity(); X break; X X any_state(SUP_MARK): X if (cur_chr == buffer[loc] && loc < limit) { X if (buffer[loc + 1] < 0100) X cur_chr = buffer[loc + 1] + 0100; X else cur_chr = buffer[loc + 1] - 0100; X loc += 2; X goto reswitch; X } X state = MID_LINE; X break; X X any_state(INVALID_CHAR): X print_err("Text line contains an invalid character"); X help_funny(); X deletions_allowed = FALSE; X error(); X deletions_allowed = TRUE; X goto restart; X break; X X mid_line(SPACER): X state = SKIP_BLANKS; X cur_chr = ' '; X break; X X mid_line(CAR_RET): X loc = limit + 1; X cur_cmd = SPACER; X cur_chr = ' '; X break; X X skip_blanks(CAR_RET): X any_state(COMMENT): X loc = limit + 1; X goto reread; X break; X X new_line(CAR_RET): X loc = limit + 1; X cur_cs = par_loc; X cur_cmd = eq_type(cur_cs); X cur_chr = equiv(cur_cs); X if (cur_cmd >= OUTER_CALL) X check_outer_validity(); X break; X X mid_line(LEFT_BRACE): X incr(align_state); X break; X X skip_blanks(LEFT_BRACE): X new_line(LEFT_BRACE): X state = MID_LINE; X incr(align_state); X break; X X mid_line(RIGHT_BRACE): X decr(align_state); X break; X X skip_blanks(RIGHT_BRACE): X new_line(RIGHT_BRACE): X state = MID_LINE; X decr(align_state); X break; X X delims(SKIP_BLANKS): X delims(NEW_LINE): X state = MID_LINE; X break; X X default: X break; X } X } else { X state = NEW_LINE; X if (name > 17) { X incr(line); X first = start; X if (!force_eof) { X if (input_ln(cur_file, TRUE)) X firm_up_the_line(); X else force_eof = TRUE; X } X if (force_eof) { X print_char(')'); X force_eof = FALSE; X update_terminal(); X end_file_reading(); X check_outer_validity(); X goto restart; X } X if (end_line_char < 0 || end_line_char > 127) X decr(limit); X else buffer[limit] = end_line_char; X first = limit + 1; X loc = start; X } else { X if (!terminal_input) { X cur_cmd = 0; X cur_chr = 0; X return; X } X if (input_ptr > 0) { X end_file_reading(); X goto restart; X } X if (selector < LOG_ONLY) X open_log_file(); X if (interaction > NONSTOP_MODE) { X if (limit == start) X print_nl("(Please type a command or say `\\end')"); X print_ln(); X first = start; X prompt_input("*"); X limit = last; X if (end_line_char < 0 || end_line_char > 127) X decr(limit); X else buffer[limit] = end_line_char; X first = limit + 1; X loc = start; X } else X fatal_error( X "*** (job aborted, no legal \\end found)"); X } X check_interrupt(); X goto reread; X } X } else { X if (loc != NULL) { X t = token(loc); X loc = token_link(loc); X if (t >= CS_TOKEN_FLAG) { X cur_cs = t - CS_TOKEN_FLAG; X cur_cmd = eq_type(cur_cs); X cur_chr = equiv(cur_cs); X if (cur_cmd >= OUTER_CALL) { X if (cur_cmd == DONT_EXPAND) { X cur_cs = token(loc) - CS_TOKEN_FLAG; X loc = NULL; X cur_cmd = eq_type(cur_cs); X cur_chr = equiv(cur_cs); X if (cur_cmd > MAX_COMMAND) { X cur_cmd = RELAX; X cur_chr = NO_EXPAND_FLAG; X } X } else check_outer_validity(); X } X } else { X cur_cmd = t / 0400; X cur_chr = t % 0400; X switch (cur_cmd) X { X case LEFT_BRACE: X incr(align_state); X break; X X case RIGHT_BRACE: X decr(align_state); X break; X X case OUT_PARAM: X begin_token_list( X param_stack[param_start + cur_chr - 1], X PARAMETER); X goto restart; X break; X X default: X break; X } X } X } else { X end_token_list(); X goto restart; X } X } X if (cur_cmd <= CAR_RET && X cur_cmd >= TAB_MARK && X align_state == 0) { X if (scanner_status == ALIGNING) X fatal_error("(interwoven alignment preambles are not allowed)"); X cur_cmd = extra_info(cur_align); X extra_info(cur_align) = cur_chr; X if (cur_cmd == OMIT) X begin_token_list(omit_template, (qword) V_TEMPLATE); X else begin_token_list((ptr) v_part(cur_align), (qword) V_TEMPLATE); X align_state = 1000000; X goto restart; X } X} X Xcheck_outer_validity () X{ X ptr p; X ptr q; X X if (scanner_status != NORMAL) { X deletions_allowed = FALSE; X if (cur_cs != 0) { X if (state == TOKEN_LIST || name < 1 || name > 17) { X p = new_token(); X token(p) = CS_TOKEN_FLAG + cur_cs; X back_list(p); X } X cur_cmd = SPACER; X cur_chr = ' '; X } X if (scanner_status > SKIPPING) { X runaway(); X if (cur_cs == 0) X print_err("File ended"); X else { X cur_cs = 0; X print_err("Forbidden control sequence found"); X } X print(" while scanning "); X p = new_token(); X switch (scanner_status) X { X case DEFINING: X print("definition"); X token(p) = RIGHT_BRACE_TOKEN + '}'; X break; X X case MATCHING: X print("use"); X token(p) = par_token; X long_state = OUTER_CALL; X break; X X case ALIGNING: X print("preamble"); X token(p) = RIGHT_BRACE_TOKEN + '}'; X q = p; X p = new_token(); X token_link(p) = q; X token(p) = CS_TOKEN_FLAG + FROZEN_CR; X align_state = -1000000; X break; X X case ABSORBING: X print("text"); X token(p) = RIGHT_BRACE_TOKEN + '}'; X break; X } X ins_list(p); X print(" of "); X sprint_cs(warning_index); X help_scanner(); X error(); X } else { X print_err("Incomplete "); X print_cmd_chr(IF_TEST, cur_if); X print("; all text was ignored after line "); X print_val(skip_line); X help_skif(); X if (cur_cs != 0) X cur_cs = 0; X else X help_line[0] = X "The file ended while I was skipping conditional text."; X cur_tok = CS_TOKEN_FLAG + FROZEN_FI; X ins_error(); X } X deletions_allowed = TRUE; X } X} X Xfirm_up_the_line () X{ X int k; X X limit = last; X if (pausing > 0 && interaction > NONSTOP_MODE) { X wake_up_terminal(); X print_ln(); X if (start < limit) { X for (k = start; k < limit; incr(k)) X print_char(buffer[k]); X } X first = limit; X prompt_input("=>"); X if (last > first) { X for (k = first; k < last; incr(k)) X buffer[k + start - first] = buffer[k]; X limit = start + last - first; X } X } X} X Xptr Xnew_token () X{ X ptr p; X X p = tok_head; X if (p != NULL) X tok_head = token_link(tok_head); X else if (tok_end < TOK_MAX) { X incr(tok_end); X p = tok_end; X } else { X decr(tok_low); X p = tok_low; X if (tok_low <= TOK_MIN) { X runaway(); X overflow("token memory size", TOK_MAX - TOK_MIN + 1); X } X } X token_link(p) = NULL; X#ifdef STAT X incr(tok_used); X#endif X return p; X} X Xinit_tok_mem() X{ X int i; X X#ifdef INIT X tok_head = NULL; X tok_end = TOK_TOP; X tok_low = tok_high; X for (i = TOK_TOP; i > tok_low; decr(i)) { X token(i) = 0; X token_link(i) = NULL; X } X token(omit_template) = END_TEMPLATE_TOKEN; X tok_used = tok_usage; X#endif X X} X X/* X * Help text X */ X Xhelp_scanner () X{ X help4("I suspect you have forgotten a `}', causing me", X "to read past where you wanted me to stop.", X "I'll try to recover; but if the error is serious,", X "you'd better type `E' or `X' now and fix your file."); X} X Xhelp_funny () X{ X help2("A funny symbol that I can't read has just been input.", X "Continue, and I'll forget that it ever happened."); X} X Xhelp_skif () X{ X help3("A forbidden control sequence occurred in skipped text.", X "This kind of error happens when you say `\\if...' and forget", X "the matching `\\fi'. I've inserted a `\\fi'; this might work."); X} SHAR_EOF echo "File token.c is complete" chmod 0444 token.c || echo "restore of token.c fails" set `wc -c token.c`;Sum=$1 if test "$Sum" != "10484" then echo original size 10484, current size $Sum;fi echo "x - extracting token.h (Text)" sed 's/^X//' << 'SHAR_EOF' > token.h && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * token.h X */ X Xglobal hword cur_tok; Xglobal byte cur_cmd; Xglobal hword cur_chr; Xglobal ptr cur_cs; X X#define LEFT_BRACE_TOKEN 0400 X#define LEFT_BRACE_LIMIT 01000 X#define RIGHT_BRACE_TOKEN 01000 X#define RIGHT_BRACE_LIMIT 01400 X#define MATH_SHIFT_TOKEN 01400 X#define TAB_TOKEN 02000 X#define OUT_PARAM_TOKEN 02400 X#define SPACE_TOKEN 05040 X#define LETTER_TOKEN 05400 X#define OTHER_TOKEN 06000 X#define MATCH_TOKEN 06400 X#define END_MATCH_TOKEN 07000 X#define CS_TOKEN_FLAG 010000 X#define END_TEMPLATE_TOKEN CS_TOKEN_FLAG + FROZEN_END_TEMPLATE X X#define NO_EXPAND_FLAG 257 X Xglobal ptr par_loc; Xglobal hword par_token; Xglobal bool force_eof; X X#define token(T) tok[T] X#define token_link(T) tok_link[T] X Xglobal hword tok[]; Xglobal hword tok_link[]; Xglobal ptr tok_head; Xglobal ptr tok_low; Xglobal ptr tok_end; Xglobal int tok_used; X X#define temp_toks TOK_TOP X#define align_tokens (TOK_TOP - 1) X#define omit_template (TOK_TOP - 2) X#define null_list (TOK_TOP - 3) X#define backup_tokens (TOK_TOP - 4) X#define tok_high (TOK_TOP - 4) X#define tok_usage 5 X X#ifdef STAT X#define fast_new_token(T) \ X {T = tok_head; \ X if (T == NULL) T = new_token(); \ X else {tok_head = token_link(T); token_link(T) = NULL; incr(tok_used);}} X#else X#define fast_new_token(T) \ X {T = tok_head; \ X if (T == NULL) T = new_token(); \ X else {tok_head = token_link(T); token_link(T) = NULL;}} X#endif X Xint get_token(); Xint get_next(); Xptr new_token(); X X#ifdef STAT X#define free_token(T) \ X {token_link(T) = tok_head; tok_head = T; decr(tok_used);} X#else X#define free_token(T) \ X {token_link(T) = tok_head; tok_head = T;} X#endif X Xint check_outer_validity(); Xint firm_up_the_line(); SHAR_EOF chmod 0444 token.h || echo "restore of token.h fails" set `wc -c token.h`;Sum=$1 if test "$Sum" != "1877" then echo original size 1877, current size $Sum;fi echo "x - extracting tokenlists.c (Text)" sed 's/^X//' << 'SHAR_EOF' > tokenlists.c && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * tokenlists.c X */ X X#include "tex.h" X#include "cmds.h" X#include "heap.h" X#include "eq.h" X#include "hash.h" X#include "str.h" X#include "box.h" X#include "token.h" X#include "expand.h" X#include "tokenstack.h" X#include "io.h" X#include "scan.h" X#include "def.h" X#include "file.h" X#include "tfm.h" X#include "print.h" X#include "error.h" X#include "tokenlists.h" X Xptr Xstr_toks () X{ X int k; X ptr p; X ptr q; X hword t; X X str_room(1); X p = temp_toks; X token_link(p) = NULL; X k = str_start[str_ptr]; X while (k < pool_ptr) { X t = str_pool[k]; X if (t == ' ') X t = SPACE_TOKEN; X else t += OTHER_TOKEN; X fast_store_new_token(t); X incr(k); X } X pool_ptr = str_start[str_ptr]; X return p; X} X Xptr Xthe_toks () X{ X ptr p; X ptr q; X ptr r; X int old_setting; X X get_x_token(); X scan_something_internal(TOK_VAL, FALSE); X if (cur_val_level >= IDENT_VAL) { X p = temp_toks; X token_link(p) = NULL; X if (cur_val_level == IDENT_VAL) X {store_new_token(CS_TOKEN_FLAG + cur_val);} X else if (cur_val != NULL) { X r = token_link(cur_val); X while (r != NULL) { X fast_store_new_token(token(r)); X r = token_link(r); X } X } X return p; X } else { X old_setting = selector; X selector = NEW_STRING; X switch (cur_val_level) X { X case INT_VAL: X print_val(cur_val); X break; X X case DIMEN_VAL: X print_scaled(cur_val); X print("pt"); X break; X X case GLUE_VAL: X print_spec((ptr) cur_val, "pt"); X delete_glue_ref((ptr) cur_val); X break; X X case MU_VAL: X print_spec((ptr) cur_val,"mu"); X delete_glue_ref((ptr) cur_val); X break; X } X selector = old_setting; X return (str_toks()); X } X} X Xins_the_toks () X{ X the_toks(); X ins_list(token_link(temp_toks)); X} X Xconv_toks () X{ X int c; X int old_setting; X int save_scanner_status; X X c = cur_chr; X switch (c) X { X case NUMBER_CODE: X case ROMAN_NUMERAL_CODE: X scan_int(); X break; X X case STRING_CODE: X case MEANING_CODE: X save_scanner_status = scanner_status; X scanner_status = NORMAL; X get_token(); X scanner_status = save_scanner_status; X break; X X case FONT_NAME_CODE: X scan_font_ident(); X break; X X case JOB_NAME_CODE: X if (job_name == 0) X open_log_file(); X break; X } X old_setting = selector; X selector = NEW_STRING; X switch (c) X { X case NUMBER_CODE: X print_val(cur_val); X break; X X case ROMAN_NUMERAL_CODE: X print_roman_int(cur_val); X break; X X case STRING_CODE: X if (cur_cs != 0) X sprint_cs(cur_cs); X else print_char((ascii) cur_chr); X break; X X case MEANING_CODE: X print_meaning(); X break; X X case FONT_NAME_CODE: X print_str(font_name[cur_val]); X if (font_size[cur_val] != font_dsize[cur_val]) { X print(" at "); X print_scaled(font_size[cur_val]); X print("pt"); X } X break; X X case JOB_NAME_CODE: X print_str(job_name); X break; X } X selector = old_setting; X str_toks(); X ins_list(token_link(temp_toks)); X} X Xptr Xscan_toks (macro_def, xpand) X bool macro_def; X bool xpand; X{ X ptr p; X ptr q; X hword s; X hword t; X int unbalance; X hword hash_brace; X X if (macro_def) X scanner_status = DEFINING; X else scanner_status = ABSORBING; X warning_index = cur_cs; X def_ref = new_token(); X token_ref_count(def_ref) = NULL; X p = def_ref; X hash_brace = 0; X t = ZERO_TOKEN; X if (macro_def) { X loop { X get_token(); X if (cur_tok < RIGHT_BRACE_LIMIT) X break; X if (cur_cmd == MAC_PARAM) { X s = MATCH_TOKEN + cur_chr; X get_token(); X if (cur_cmd == LEFT_BRACE) { X hash_brace = cur_tok; X store_new_token(cur_tok); X store_new_token(END_MATCH_TOKEN); X goto done; X } X if (t == ZERO_TOKEN + 9) { X print_err("You already have nine parameters"); X help_param_count(); X error(); X } else { X incr(t); X if (cur_tok != t) { X print_err("Parameters must be numbered consecutively"); X help_param_num(); X back_error(); X } X cur_tok = s; X } X } X store_new_token(cur_tok); X } X store_new_token(END_MATCH_TOKEN); X if (cur_cmd == RIGHT_BRACE) { X print_err("Missing { inserted"); X incr(align_state); X help_left_brace(); X error(); X goto found; X } X } else X scan_left_brace(); X Xdone: X unbalance = 1; X loop { X if (xpand) { X loop { X get_next(); X if (cur_cmd <= MAX_COMMAND) X break; X if (cur_cmd != THE) X expand(); X else { X q = the_toks(); X if (token_link(temp_toks) != NULL) { X token_link(p) = token_link(temp_toks); X p = q; X } X } X } X x_token(); X } else get_token(); X if (cur_tok < RIGHT_BRACE_LIMIT) { X if (cur_cmd < RIGHT_BRACE) X incr(unbalance); X else { X decr(unbalance); X if (unbalance == 0) X break; X } X } else if (cur_cmd == MAC_PARAM && macro_def) { X s = cur_tok; X if (xpand) X get_x_token(); X else get_token(); X if (cur_cmd != MAC_PARAM) { X if (cur_tok <= ZERO_TOKEN || cur_tok > t) { X print_err("Illegal parameter number in definition of "); X sprint_cs(warning_index); X help_param_use(); X back_error(); X cur_tok = s; X } else X cur_tok = OUT_PARAM_TOKEN + cur_chr - '0'; X } X } X store_new_token(cur_tok); X } X Xfound: X scanner_status = NORMAL; X if (hash_brace != 0) X store_new_token(hash_brace); X return p; X} X Xread_toks (n, r) X int n; X ptr r; X{ X int m; X ptr p; X ptr q; X val s; X X scanner_status = DEFINING; X warning_index = r; X def_ref = new_token(); X token_ref_count(def_ref) = NULL; X p = def_ref; X store_new_token(END_MATCH_TOKEN); X if (n < 0 || n > 15) X m = 16; X else m = n; X s = align_state; X align_state = 1000000; X do { X begin_file_reading(); X name = m + 1; X if (read_open[m] == CLOSED) { X if (interaction > NONSTOP_MODE) { X if (n < 0) { X prompt_input(""); X } else { X wake_up_terminal(); X print_ln(); X sprint_cs(r); X prompt_input("="); X n = -1; X } X } else X fatal_error X ("*** (cannot \\read from terminal in nonstop modes)"); X } else if (read_open[m] == JUST_OPENED) { X if (input_ln(read_file[m], FALSE)) X read_open[m] = NORMAL; X else { X a_close(read_file[m]); X read_open[m] = CLOSED; X } X } else { X if (!input_ln(read_file[m], TRUE)) { X a_close(read_file[m]); X read_open[m] = CLOSED; X if (align_state != 1000000) { X runaway(); X print_err("File ended within "); X print_esc("read"); X help_read(); X align_state = 1000000; X error(); X } X } X } X limit = last; X if (end_line_char < 0 || end_line_char > 127) X decr(limit); X else buffer[limit] = end_line_char; X first = limit + 1; X loc = start; X state = NEW_LINE; X loop { X get_token(); X if (cur_tok == 0) X break; X store_new_token(cur_tok); X } X end_file_reading(); X } while (align_state != 1000000); X cur_val = def_ref; X scanner_status = NORMAL; X align_state = s; X} X Xshow_token_list (p, q, l) X ptr p; X ptr q; X val l; X{ X hword c; X hword m; X ascii n; X ascii match_chr; X X match_chr = '#'; X n = '0'; X for (tally = 0; p != NULL && tally < l; p = token_link(p)) { X if (p == q) X magic_c(); X if (p > tok_end) { X print_esc("CLOBBERED."); X return; X } X if (token(p) >= CS_TOKEN_FLAG) X print_cs(token(p) - CS_TOKEN_FLAG); X else { X m = token(p) / 0400; X c = token(p) % 0400; X if (token(p) < 0 || c > 127) X print_esc("BAD."); X else { X switch (m) X { X case LEFT_BRACE: X case RIGHT_BRACE: X case MATH_SHIFT: X case TAB_MARK: X case SUP_MARK: X case SUB_MARK: X case SPACER: X case LETTER: X case OTHER_CHAR: X print_char(c); X break; X X case MAC_PARAM: X print_str(c); X print_str(c); X break; X X case OUT_PARAM: X print_str(match_chr); X if (c <= 9) X print_char(c + '0'); X else { X print_char('!'); X return; X } X break; X X case MATCH: X match_chr = c; X print_str(c); X incr(n); X print_char(n); X if (n > '9') X return; X break; X X case END_MATCH: X print("->"); X break; X X default: X print_esc("BAD."); X break; X } X } X } X } X if (p != NULL) X print_esc("ETC."); X} X Xtoken_show (p) X ptr p; X{ X if (p == NULL) X print("(null)"); X else show_token_list(token_link(p), NULL, 1000L); X} X Xprint_meaning () X{ X print_cmd_chr(cur_cmd, cur_chr); X if (cur_cmd >= CALL) { X print_char(':'); X print_ln(); X token_show(cur_chr); X } else if (cur_cmd == TOP_BOT_MARK) { X print_char(':'); X print_ln(); X token_show(cur_mark[cur_chr]); X } X} X Xflush_list (p) X ptr p; X{ X ptr q; X ptr r; X X if (p != NULL) { X r = p; X do { X q = r; X r = token_link(r); X#ifdef STAT X decr(tok_used); X#endif X } while (r != NULL); X token_link(q) = tok_head; X tok_head = p; X } X} X X/* X * Help text X */ X Xhelp_param_num () X{ X help2("I've inserted the digit you should have used after the #.", X "Type `1' to delete what you did use."); X} X Xhelp_param_count () X{ X help1("I'm going to ignore the # sign you just used."); X} X Xhelp_left_brace () X{ X help2("Where was the left brace? You said something like `\\def\\a}',", X "which I'm going to interpret as `\\def\\a{}'."); X} X Xhelp_param_use () X{ X help3("You meant to type ## instead of #, right?", X "Or maybe a } was forgotten somewhere earlier, and things", X "are all screwed up? I'm going to assume you meant ##."); X} X Xhelp_read () X{ X help1("This \\read has unbalanced braces."); X} SHAR_EOF chmod 0444 tokenlists.c || echo "restore of tokenlists.c fails" set `wc -c tokenlists.c`;Sum=$1 if test "$Sum" != "9302" then echo original size 9302, current size $Sum;fi echo "x - extracting tokenlists.h (Text)" sed 's/^X//' << 'SHAR_EOF' > tokenlists.h && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * tokenlists.h X */ X Xptr str_toks(); Xptr the_toks(); Xint conv_toks(); X X#define NUMBER_CODE 0 X#define ROMAN_NUMERAL_CODE 1 X#define STRING_CODE 2 X#define MEANING_CODE 3 X#define FONT_NAME_CODE 4 X#define JOB_NAME_CODE 5 X X#define token_ref_count(T) token(T) X Xptr scan_toks(); Xint read_toks(); Xint ins_the_toks(); Xint print_meaning(); X Xint flush_list(); X X#define add_token_ref(T) incr(token_ref_count(T)) X X#define delete_token_ref(T) \ X {if (token_ref_count(T) == NULL) \ X flush_list(T); \ X else decr(token_ref_count(T));} X X#define store_new_token(T) \ X {q = new_token(); token_link(p) = q; token(q) = T; p = q;} X X#define fast_store_new_token(T) \ X {fast_new_token(q); token_link(p) = q; token(q) = T; p = q;} X Xint show_token_list(); Xint token_show(); SHAR_EOF chmod 0444 tokenlists.h || echo "restore of tokenlists.h fails" set `wc -c tokenlists.h`;Sum=$1 if test "$Sum" != "981" then echo original size 981, current size $Sum;fi echo "x - extracting tokenstack.c (Text)" sed 's/^X//' << 'SHAR_EOF' > tokenstack.c && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * tokenstack.c X */ X X#include "tex.h" X#include "cmds.h" X#include "heap.h" X#include "eq.h" X#include "def.h" X#include "char.h" X#include "io.h" X#include "token.h" X#include "tokenlists.h" X#include "box.h" X#include "print.h" X#include "error.h" X#include "tokenstack.h" X Xinput cur_input; Xinput input_stack[STACK_SIZE]; Xptr input_ptr; Xptr max_in_stack; X Xalpha_file input_file[MAX_IN_OPEN]; X Xval line; Xval line_stack[MAX_IN_OPEN]; Xptr in_open; X Xptr param_stack[PARAM_SIZE]; Xptr param_ptr; Xptr max_param_stack; X Xval align_state = 1000000; Xptr base_ptr; Xptr def_ref; Xptr warning_index; Xint scanner_status; X Xpush_input() X{ X if (input_ptr > max_in_stack) { X max_in_stack = input_ptr; X if (input_ptr == STACK_SIZE) X overflow("input stack size", STACK_SIZE); X } X input_stack[input_ptr] = cur_input; X incr(input_ptr); X} X Xpop_input() X{ X decr(input_ptr); X cur_input = input_stack[input_ptr]; X} X Xbegin_token_list (p, t) X ptr p; X qword t; X{ X push_input(); X state = TOKEN_LIST; X start = p; X token_type = t; X if (t >= MACRO) { X add_token_ref(p); X if (t == MACRO) X param_start = param_ptr; X else { X loc = token_link(p); X if (tracing_macros > 1) { X begin_diagnostic(); X print_ln(); X switch (t) X { X case MARK_TEXT: X print_esc("mark"); X break; X X case WRITE_TEXT: X print_esc("write"); X break; X X default: X print_cmd_chr (ASSIGN_TOKS, X t - OUTPUT_TEXT + OUTPUT_ROUTINE_LOC); X break; X } X print("->"); X token_show(p); X end_diagnostic(FALSE); X } X } X } else X loc = p; X} X Xend_token_list () X{ X if (token_type >= BACKED_UP) { X if (token_type <= INSERTED) X flush_list(start); X else { X delete_token_ref(start); X if (token_type == MACRO) { X while (param_ptr > param_start) { X decr(param_ptr); X flush_list(param_stack[param_ptr]); X } X } X } X } else if (token_type == U_TEMPLATE) X align_state = 0; X pop_input(); X check_interrupt(); X} X Xback_input () X{ X ptr p; X X while (state == TOKEN_LIST && loc == NULL) X end_token_list(); X p = new_token(); X token(p) = cur_tok; X if (cur_tok < RIGHT_BRACE_LIMIT) X if (cur_tok < LEFT_BRACE_LIMIT) X decr(align_state); X else incr(align_state); X push_input(); X state = TOKEN_LIST; X start = p; X token_type = BACKED_UP; X loc = p; X} X Xback_error () X{ X OK_to_interrupt = FALSE; X back_input(); X OK_to_interrupt = TRUE; X error(); X} X Xins_error () X{ X OK_to_interrupt = FALSE; X back_input(); X token_type = INSERTED; X OK_to_interrupt = TRUE; X error(); X} X Xclear_for_error_prompt () X{ X while (state != TOKEN_LIST && X terminal_input && X input_ptr > 0 && X loc > limit) X end_file_reading(); X print_ln(); X clear_terminal(); X} X Xbegin_file_reading () X{ X incr(in_open); X if (in_open == MAX_IN_OPEN) X overflow("text input levels", MAX_IN_OPEN); X if (first == BUF_SIZE) X overflow("buffer_size", BUF_SIZE); X push_input(); X index = in_open; X line_stack[index] = line; X start = first; X state = MID_LINE; X name = 0; X} X Xend_file_reading () X{ X first = start; X line = line_stack[index]; X if (name > 17) X a_close(cur_file); X pop_input(); X decr(in_open); X} X Xrunaway () X{ X ptr p; X X if (scanner_status > SKIPPING) { X print_nl("Runaway "); X switch (scanner_status) X { X case DEFINING: X print("definition"); X p = def_ref; X break; X X case MATCHING: X print("argument"); X p = temp_toks; X break; X X case ALIGNING: X print("preamble"); X p = align_tokens; X break; X X case ABSORBING: X print("text"); X p = def_ref; X break; X } X print_char('?'); X print_ln(); X show_token_list(token_link(p), NULL, (val) ERROR_LINE - 10); X } X} X X#define begin_pseudoprint() \ X {l = tally; \ X tally = 0; \ X selector = PSEUDO; \ X trick_count = 1000000;} X Xshow_context () X{ X int i; X int j; X val l; X int m; X int n; X int p; X int q; X int old_setting; X X base_ptr = input_ptr; X input_stack[base_ptr] = cur_input; X loop { X cur_input = input_stack[base_ptr]; X if (base_ptr == input_ptr || X state != TOKEN_LIST || X token_type != BACKED_UP || X loc != NULL) { X tally = 0; X old_setting = selector; X if (state != TOKEN_LIST) { X if (name <= 17) { X if (terminal_input) { X if (base_ptr == 0) X print_nl("<*>"); X else print_nl("<insert> "); X } else { X print_nl("<read "); X if (name == 17) X print_char('*'); X else print_int(name - 1); X print_char('>'); X } X } else { X print_nl("l."); X print_val(line); X } X print_char(' '); X begin_pseudoprint(); X if (buffer[limit] == CARRIAGE_RETURN) X j = limit; X else j = limit + 1; X if (j > 0) { X for (i = start; i < j; incr(i)) { X if (i == loc) X set_trick_count(); X print_str(buffer[i]); X } X } X } else { X switch (token_type) X { X case PARAMETER: X print_nl("<argument> "); X break; X X case U_TEMPLATE: X case V_TEMPLATE: X print_nl("<template> "); X break; X X case BACKED_UP: X if (loc == NULL) X print_nl("<recently read> "); X else print_nl("<to be read again> "); X break; X X case INSERTED: X print_nl("<inserted text> "); X break; X X case MACRO: X print_ln(); X print_cs(name); X break; X X case OUTPUT_TEXT: X print_nl("<output> "); X break; X X case EVERY_PAR_TEXT: X print_nl("<everypar> "); X break; X X case EVERY_MATH_TEXT: X print_nl("<everymath> "); X break; X X case EVERY_DISPLAY_TEXT: X print_nl("<everydisplay> "); X break; X X case EVERY_HBOX_TEXT: X print_nl("<everyhbox> "); X break; X X case EVERY_VBOX_TEXT: X print_nl("<everyvbox> "); X break; X X case EVERY_JOB_TEXT: X print_nl("<everyjob >"); X break; X X case EVERY_CR_TEXT: X print_nl("<everycr> "); X break; X X case MARK_TEXT: X print_nl("<mark> "); X break; X X case WRITE_TEXT: X print_nl("<write> "); X break; X X default: X print_nl("? "); X break; X } X begin_pseudoprint(); X if (token_type < MACRO) X show_token_list(start, loc, 100000); X else show_token_list(token_link(start), loc, 100000); X } X selector = old_setting; X if (trick_count == 1000000) X set_trick_count(); X if (tally < trick_count) X m = tally - first_count; X else m = trick_count - first_count; X if (l + first_count <= HALF_ERROR_LINE) { X p = 0; X n = l + first_count; X } else { X print("..."); X p = l + first_count - HALF_ERROR_LINE + 3; X n = HALF_ERROR_LINE; X } X for (q = p; q < first_count; incr(q)) X print_char(trick_buf[q % ERROR_LINE]); X print_ln(); X for (q = 1; q <= n; incr(q)) X print_char(' '); X if (m + n <= ERROR_LINE) X p = first_count + m; X else p = first_count + ERROR_LINE - n - 3; X for (q = first_count; q < p; q++) X print_char(trick_buf[q % ERROR_LINE]); X if (m + n > ERROR_LINE) X print("..."); X } X if (state != TOKEN_LIST && name > 17 || base_ptr == 0) X break; X decr(base_ptr); X } X cur_input = input_stack[input_ptr]; X} SHAR_EOF chmod 0444 tokenstack.c || echo "restore of tokenstack.c fails" set `wc -c tokenstack.c`;Sum=$1 if test "$Sum" != "7066" then echo original size 7066, current size $Sum;fi echo "x - extracting tokenstack.h (Text)" sed 's/^X//' << 'SHAR_EOF' > tokenstack.h && X X/* X * Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved. X * Copying of this file is granted according to the provisions X * specified in the file COPYING which must accompany this file. X */ X X X/* X * tokensta.h X */ X Xtypedef struct X{ X qword state_field; X qword index_field; X hword start_field; X hword loc_field; X hword limit_field; X hword name_field; X} X input; X Xglobal input cur_input; Xglobal input input_stack[]; Xglobal ptr input_ptr; Xglobal ptr max_in_stack; X X#define state cur_input.state_field X#define index cur_input.index_field X#define start cur_input.start_field X#define loc cur_input.loc_field X#define limit cur_input.limit_field X#define name cur_input.name_field X X#define MID_LINE 1 X#define SKIP_BLANKS (2 + MAX_CHAR_CODE) X#define NEW_LINE (3 + MAX_CHAR_CODE + MAX_CHAR_CODE) X X#define terminal_input (name == 0) X Xglobal alpha_file input_file[]; X Xglobal ptr in_open; Xglobal val line; Xglobal val line_stack[]; X X#define cur_file input_file[index] X X#define TOKEN_LIST 0 X#define param_start limit X#define token_type index X X#define PARAMETER 0 X#define U_TEMPLATE 1 X#define V_TEMPLATE 2 X#define BACKED_UP 3 X#define INSERTED 4 X#define MACRO 5 X#define OUTPUT_TEXT 6 X#define EVERY_PAR_TEXT 7 X#define EVERY_MATH_TEXT 8 X#define EVERY_DISPLAY_TEXT 9 X#define EVERY_HBOX_TEXT 10 X#define EVERY_VBOX_TEXT 11 X#define EVERY_JOB_TEXT 12 X#define EVERY_CR_TEXT 13 X#define MARK_TEXT 14 X#define WRITE_TEXT 15 X Xglobal ptr param_ptr; Xglobal ptr param_stack[]; Xglobal ptr max_param_stack; X Xint runaway(); Xint show_context(); X Xglobal val align_state; Xglobal ptr base_ptr; Xglobal ptr def_ref; Xglobal ptr warning_index; Xglobal int scanner_status; X X#define SKIPPING 1 X#define DEFINING 2 X#define MATCHING 3 X#define ALIGNING 4 X#define ABSORBING 5 X X#define set_trick_count() \ X {first_count = tally; \ X trick_count = tally + 1 + ERROR_LINE - HALF_ERROR_LINE; \ X if (trick_count < ERROR_LINE) \ X trick_count = ERROR_LINE;} X X#define magic_c() set_trick_count() X Xint push_input(); Xint pop_input(); X Xint begin_token_list(); Xint end_token_list(); X X#define back_list(L) begin_token_list(L, BACKED_UP) X#define ins_list(L) begin_token_list(L, INSERTED) X Xint back_input(); Xint back_error(); X Xint begin_file_reading(); Xint end_file_reading(); X Xint clear_for_error_prompt(); SHAR_EOF chmod 0444 tokenstack.h || echo "restore of tokenstack.h fails" set `wc -c tokenstack.h`;Sum=$1 if test "$Sum" != "2325" then echo original size 2325, current size $Sum;fi rm -f s2_seq_.tmp echo "You have unpacked the last part" exit 0
news@adelphi.UUCP (News Feed) (02/19/90)
We only received LaTex for xenix parts 1 - 10. There always seems to be trouble between us and our newsfeed so I am not surprised. Were parts 11 - 14 sent? Response via E-mail is appreciated. Mark J. DeFilippis
gnu@hoptoad.uucp (John Gilmore) (02/19/90)
glenn@extro.ucc.su.oz.au (G Geers) wrote:
> Well here it is. The next 14 postings contain the source...
I am all in favor of posting source code, but how about posting it to
the right newsgroup? This is a discussion group, not a source group.
Why does that make a difference, you ask. I'm glad you asked. . .
A lot of people like to archive all the sources that come through their
system -- they might need them later, and the articles only stick
around a week or two. If you post to a discussion group, most of these
folks will not notice your sources, and they will get discarded rather
than archived.
A lot of other people are running on small budgets (either of money,
modem speed, or disk space) and are not able to get high volume
newsgroups. If people start dumping sources into a discussion group,
the volume goes way up (each of those 14 messages was 45K -- the rest
of the postings in comp.unix.xenix on my system are 1-4k except one 9K
one). This fills people's disks or gives them a surprise when the
phone bill arrives. Then they have to stop receiving the group, even
though they want to participate in the discussion.
If you haven't checked out the sources groups, try it some time. The
best one is comp.sources.unix, which has the highest quality material,
though it's sometimes slow to get something published there. The other
groups for Unix stuff are comp.sources.misc and alt.sources. (Yes,
Xenix stuff belongs in Unix newsgroups; Xenix is Unix, or close
enough.) Everything that gets sent to these sources groups is archived
at dozens of places around the net, so you can easily get it later.
Check the group "comp.archives" for details.
One other note. When you port a program to Xenix, often the best thing
to do is to send back your changes to the original author (or the
current maintainer -- e.g. the guy who posted it). If your changes are
clean, and the author isn't swamped with other stuff, the next
"official" version will already run on Xenix and you (and everybody
else) won't have to port it again.
Oops, I guess it's two notes. If a program is widely available (like
TeX or anything posted to comp.sources.*) then if you really want to
post something, just post your patches to a sources group, then post a
short message to comp.unix.xenix telling people where the patches are.
The "patch" program is another widely available program, and everybody
who does any serious work on programs from the net will have or get a
copy. If your variant of Xenix doesn't have "diff -c", which generates
"context diffs" (the best kind of patches), you can also get free
programs that will generate them, including GNU Diff and "cdiff". See
comp.archives on how to get these.
--
John Gilmore {sun,pacbell,uunet,pyramid}!hoptoad!gnu gnu@toad.com
Just say *yes* to drugs. If someone offers you a drug war, just say no.
s1h@sppy00.UUCP (Steven J. Husting) (02/19/90)
In article <10306@hoptoad.uucp> gnu@hoptoad.uucp (John Gilmore) writes: >glenn@extro.ucc.su.oz.au (G Geers) wrote: >> Well here it is. The next 14 postings contain the source... > We didn't see a single posting here, and I've been watching carefully. If someone could help me get postings (email, ftp, anonymous uucp, usmail, whatever) I would be in your debt forever and ever. -- Steven Husting "Apart from drinking himself into a stupor, the king's OCLC, Inc. favorite activity was shooting at flying bison which sppy00!s1h.UUCP had been catapulted into the air for the purpose." slh@rcsh.oclc.org -about Karol Radziwill
jtc@van-bc.UUCP (J.T. Conklin) (02/20/90)
In article <10306@hoptoad.uucp> gnu@hoptoad.uucp (John Gilmore) writes: >glenn@extro.ucc.su.oz.au (G Geers) wrote: >> Well here it is. The next 14 postings contain the source... > >I am all in favor of posting source code, but how about posting it to >the right newsgroup? This is a discussion group, not a source group. >Why does that make a difference, you ask. I'm glad you asked. . . I'm a TeXnician at heart, and usually am estatic when it comes to exposing people to TeX, but I wholeheartedly agree that the posting of the TeX source was inapropriate. Furthermore, none of the .sty, .fmt, etc files were included. It was suggested that they should be obtained from the Unix-TeX distribution via anonymous ftp. Well, if you're going to ftp Unix-TeX, you might as well compile the sources from there. I've been running TeX for about six months. There are no Xenix patches needed. The posting of TeX to comp.unix.xenix was unnecessary. --jtc -- J.T. Conklin ...!{uunet,ubc-cs}!van-bc!jtc, jtc@wimsey.bc.ca
terry@tah386.manhattan.ks.us (Terry Hull) (02/21/90)
gnu@hoptoad.uucp (John Gilmore) writes: >If you haven't checked out the sources groups, try it some time. The >best one is comp.sources.unix, which has the highest quality material, >though it's sometimes slow to get something published there. I think this is a gross understatement. There have been reports of > 6 month delays getting stuff through c.s.u. Also, I don't think Rich Salz, the moderator of c.s.u, would accept sources that were just minor modifications to something as widely available as TeX. -- Terry Hull Department of Electrical and Computer Engineering, Kansas State University Work: terry@eecea.eece.ksu.edu, rutgers!ksuvax1!eecea!terry Play: terry@tah386.manhattan.ks.us, rutgers!ksuvax1!eecea!tah386!terry
wsinpdb@eutws1.win.tue.nl (Paul de Bra) (02/23/90)
In article <1990Feb20.194402.11461@tah386.manhattan.ks.us> terry@tah386.manhattan.ks.us (Terry Hull) writes: >gnu@hoptoad.uucp (John Gilmore) writes: > >>If you haven't checked out the sources groups, try it some time. The >>best one is comp.sources.unix, which has the highest quality material, >>though it's sometimes slow to get something published there. > >I think this is a gross understatement. There have been reports >of > 6 month delays getting stuff through c.s.u. Also, I don't think Rich >Salz, the moderator of c.s.u, would accept sources that were just >minor modifications to something as widely available as TeX. I have submitted a version of Tex for SCO Xenix 286 to comp.sources.unix a long time ago and although I never got a rejection from Rich Salz the sources never appeared as far as I know. I have posted these sources in this very newsgroup, but it's been so long ago that I don't blame anyone for not remembering or having missed them. The source of Tex 2.0 (old but nevertheless just as useful as any newer source as far as i know) is available for anonymous ftp from tuewsd.tue.nl, that is number 192.16.184.9. Remember that this port was done specifically for the 80286. It runs on any 32 bit machine of course, but so does the official distribution. This version is especially intended for machines with 16 bit ints. You do need SCO Xenix 2.2.1 or newer. Older compilers are too buggy, because the program needs the huge memory model. Paul. (debra@research.att.com)
wswietse@tuegate.tue.nl (Wietse Venema) (02/24/90)
wsinpdb@eutws1.win.tue.nl (Paul de Bra) writes: >The source of Tex 2.0 (old but nevertheless just as useful as any newer >source as far as i know) is available for anonymous ftp from >tuewsd.tue.nl, that is number 192.16.184.9. >Remember that this port was done specifically for the 80286. It runs on >any 32 bit machine of course, but so does the official distribution. >This version is especially intended for machines with 16 bit ints. Make that: tuewsd.lso.win.tue.nl, IP address 131.155.2.8. -- wswietse@tue.nl | Eindhoven University of Technology wswietse@heitue5.bitnet | 5600 MB Eindhoven, The Netherlands
jeff@hobbes.C2S.MN.ORG (Jeff Holmes) (02/25/90)
In article <722@sppy00.UUCP> s1h@sppy00.UUCP (Steven J. Husting) writes: > In article <10306@hoptoad.uucp> gnu@hoptoad.uucp (John Gilmore) writes: > >glenn@extro.ucc.su.oz.au (G Geers) wrote: > >> Well here it is. The next 14 postings contain the source... > > > > We didn't see a single posting here, and I've been watching carefully. We didn't see anything either I think a repost might be in order. Jeff Holmes DOMAIN: jeff@questar.mn.org Questar Data Systems UUCP: amdahl!bungia!questar!jeff St. Paul, MN 55121 AT&T: +1 612 688 0089
chip@chinacat.Lonestar.ORG (Chip Rosenthal) (02/25/90)
[ Original was in comp.unix.xenix -- followups directed back there. ] In article <10306@hoptoad.uucp> gnu@hoptoad.uucp (John Gilmore) writes: >[summary: patches are the way to go] >If your variant of Xenix doesn't have "diff -c", which generates >"context diffs" (the best kind of patches), you can also get free >programs that will generate them, including GNU Diff and "cdiff". The XENIX diff does not do context diffs. The GNU diff does, but it requires a couple of small hacks to get it running under XENIX. Below are two patches. One fixes GNU diff to run under XENIX. The second patch adds a "merged" diff option. If you want to run GNU diff under XENIX, you will obviously need to first grab a copy of the diff v1.7 sources. (osu-cis is a good place to snarf GNU stuff via anon uucp.) Besides my patch, you will also need a version of "alloca()" which runs on XENIX. These have been floating around; I remember one or two posted to comp.unix.xenix. My patch assumes that your alloca() is found in a library called SlibPW.a. The second patch gives you a merged diff feature which lets you do something like "diff -m diff.h~ diff.h" to get: ---------------------------------+--------------------------------- diff.h~ | diff.h --- insert at 106 ---------------+---- 107-108 -------------------- | /* Output the differences merg | OUTPUT_MERGED, --- insert at 181 ---------------+---- 184-186 -------------------- | | /* Output page width for merged | EXTERN int page_width; ---------------------------------+--------------------------------- If you need the XENIX 386 alloca.s, I suppose I can make it available. (I *do not* have a 286 version.) Also, I've archived a couple of other diff fixes/enhancements which have appeared in gnu.utils.bugs. Drop me a line if you need any of this stuff. --- cut here ----------------------------------------------------------------- #! /bin/sh # this is a "shar" archive - run through "/bin/sh" to extract 2 files: # Patch-1-xnx Patch-2-mopt # Wrapped by bin@chinacat on Sat Feb 24 14:14:53 CST 1990 # Unpacking this archive requires: sed test wc (possibly mkdir) # Existing files will not be clobbered unless "-c" is specified on the cmd line. if test -f Patch-1-xnx -a "$1" != "-c" ; then echo "Patch-1-xnx: file exists - will not be overwritten" else echo "x - Patch-1-xnx (file 1 of 2, 1771 chars)" sed -e 's/^X//' << 'END_OF_FILE_Patch-1-xnx' > Patch-1-xnx XThis patch ports GNU diff to SCO XENIX 386. Note that the "Makefile" Xassumes that you have "alloca()" available in libPW. X XChip Rosenthal X<chip@vector.Dallas.TX.US> X X XIndex: Makefile X*** Makefile~ Sat Aug 12 21:12:20 1989 X--- Makefile Sat Aug 12 21:19:28 1989 X*************** X*** 21,34 **** X # You can compile this with ordinary cc as well, X # but gcc makes it faster. X # Also, gcc supports -O and -g together. X! CC=gcc -O X! CFLAGS = -g X! INSTALL = install X X # On system V, enable these three lines: X # CFLAGS = -g -DUSG X # LIBS = -lPW X # INSTALL = cp X X bindir=/usr/local/bin X prefix= X--- 21,39 ---- X # You can compile this with ordinary cc as well, X # but gcc makes it faster. X # Also, gcc supports -O and -g together. X! # CC=gcc -O X! # CFLAGS = -g X! # INSTALL = install X X # On system V, enable these three lines: X # CFLAGS = -g -DUSG X # LIBS = -lPW X # INSTALL = cp X+ X+ # Use these definitions for XENIX: X+ CFLAGS = -O -DUSG -DXENIX X+ LIBS = -lx -lPW X+ INSTALL = cp X X bindir=/usr/local/bin X prefix= XIndex: diff.h X*** diff.h~ Sat Aug 12 21:12:23 1989 X--- diff.h Sat Aug 12 21:13:38 1989 X*************** X*** 28,37 **** X--- 28,43 ---- X #ifdef hp9000s800 X #include <ndir.h> X #else X+ #ifdef XENIX X+ #include <sys/ndir.h> X+ #else X #include <dirent.h> X #endif X+ #endif X #include <fcntl.h> X+ #ifndef XENIX X #define direct dirent X+ #endif X #else X #include <sys/time.h> X #include <sys/dir.h> XIndex: diff3.c X*** diff3.c~ Sat Aug 12 21:12:26 1989 X--- diff3.c Sat Aug 12 21:12:25 1989 X*************** X*** 31,37 **** X--- 31,39 ---- X #define bcmp(s1,s2,n) memcmp((s1),(s2),(n)) X #define bzero(s,n) memset((s),0,(n)) X X+ #ifndef XENIX X #define dup2(f,t) (close(t),fcntl((f),F_DUPFD,(t))) X+ #endif X X #define vfork fork X #define index strchr END_OF_FILE_Patch-1-xnx size="`wc -c < Patch-1-xnx`" if test 1771 -ne "$size" ; then echo "Patch-1-xnx: extraction error - got $size chars" fi fi if test -f Patch-2-mopt -a "$1" != "-c" ; then echo "Patch-2-mopt: file exists - will not be overwritten" else echo "x - Patch-2-mopt (file 2 of 2, 7939 chars)" sed -e 's/^X//' << 'END_OF_FILE_Patch-2-mopt' > Patch-2-mopt XThis patch adds "-m" and "-M width" options to GNU diff. For example, the Xcommand "diff -M 68 diff.h~ diff.h" generates: X X ---------------------------------+--------------------------------- X diff.h~ | diff.h X --- insert at 106 ---------------+---- 107-108 -------------------- X | /* Output the differences merg X | OUTPUT_MERGED, X --- insert at 181 ---------------+---- 184-186 -------------------- X | X | /* Output page width for merged X | EXTERN int page_width; X ---------------------------------+--------------------------------- X XChip Rosenthal X<chip@vector.Dallas.TX.US> X X XIndex: diff.h X*** diff.h~ Sat Aug 12 21:21:59 1989 X--- diff.h Sat Aug 12 21:10:14 1989 X*************** X*** 104,109 **** X--- 104,111 ---- X OUTPUT_ED, X /* Output the diff as a forward ed script (-f). */ X OUTPUT_FORWARD_ED, X+ /* Output the differences merged side-by-side (-m,-M). */ X+ OUTPUT_MERGED, X /* Like -f, but output a count of changed lines in each "command" (-n). */ X OUTPUT_RCS }; X X*************** X*** 179,184 **** X--- 181,189 ---- X X /* Nonzero means use heuristics for better speed. */ X EXTERN int heuristic; X+ X+ /* Output page width for merged (side-by-side) diff output. (-M,-m) */ X+ EXTERN int page_width; X X /* Name of program the user invoked (for error messages). */ X EXTERN char * program; XIndex: diff.c X*** diff.c~ Sat Aug 12 21:11:49 1989 X--- diff.c Sat Aug 12 21:10:17 1989 X*************** X*** 102,111 **** X msg_chain = NULL; X msg_chain_end = NULL; X no_discards = 0; X X /* Decode the options. */ X X! while ((c = getopt (argc, argv, "0123456789abBcC:defF:hHiI:lnNprsS:tTw")) X != EOF) X { X switch (c) X--- 102,112 ---- X msg_chain = NULL; X msg_chain_end = NULL; X no_discards = 0; X+ page_width = 80; X X /* Decode the options. */ X X! while ((c = getopt (argc, argv, "0123456789abBcC:defF:hHiI:lmM:nNprsS:tTw")) X != EOF) X { X switch (c) X*************** X*** 216,221 **** X--- 217,239 ---- X case 'l': X /* Pass the output through `pr' to paginate it. */ X paginate_flag = 1; X+ break; X+ X+ case 'm': X+ /* Print the differences side-by-side using default page width. */ X+ specify_style (OUTPUT_MERGED); X+ break; X+ X+ case 'M': X+ /* Print the differences side-by-side using specified page width. */ X+ { X+ char *p; X+ for (p = optarg; *p; p++) X+ if (*p < '0' || *p > '9') X+ fatal ("invalid page width argument (-M option)"); X+ } X+ specify_style (OUTPUT_MERGED); X+ page_width = atoi(optarg); X break; X X case 'n': XIndex: analyze.c X*** analyze.c~ Sat Aug 12 21:11:43 1989 X--- analyze.c Sat Aug 12 21:10:24 1989 X*************** X*** 760,765 **** X--- 760,769 ---- X print_rcs_script (script); X break; X X+ case OUTPUT_MERGED: X+ print_merged_script (script); X+ break; X+ X case OUTPUT_NORMAL: X print_normal_script (script); X break; XIndex: merged.c X*** merged.c~ Sat Aug 12 21:20:15 1989 X--- merged.c Sat Aug 12 21:09:59 1989 X*************** X*** 0 **** X--- 1,147 ---- X+ #include "diff.h" X+ X+ void print_merged_hunk (); X+ void print_number_range (); X+ struct change *find_change (); X+ X+ static void print_merged_hunk(); X+ static void print_merged_header(); X+ static void print_1_field(); X+ static void print_dashes(); X+ X+ static int field_width; X+ X+ void print_merged_script(script) X+ struct change *script; X+ { X+ register int i; X+ X+ field_width = ( page_width - 3 ) / 2; X+ X+ print_dashes( outfile, field_width ); X+ fputs( "-+-", outfile ); X+ print_dashes( outfile, field_width ); X+ putc( '\n', outfile ); X+ X+ print_1_field( files[0].name, strlen(files[0].name), field_width ); X+ fputs( " | ", outfile ); X+ print_1_field( files[1].name, strlen(files[1].name), field_width ); X+ putc( '\n', outfile ); X+ X+ print_script (script, find_change, print_merged_hunk); X+ X+ print_dashes( outfile, field_width ); X+ fputs( "-+-", outfile ); X+ print_dashes( outfile, field_width ); X+ putc( '\n', outfile ); X+ } X+ X+ X+ static void print_merged_hunk(hunk) X+ struct change *hunk; X+ { X+ int first0, last0, first1, last1, deletes, inserts; X+ register int i0, i1; X+ X+ /* Determine range of line numbers involved in each file. */ X+ analyze_hunk(hunk, &first0, &last0, &first1, &last1, &deletes, &inserts); X+ if (!deletes && !inserts) X+ return; X+ X+ /* Print header. */ X+ print_merged_header(outfile, &files[0], X+ first0, last0, field_width, deletes, inserts); X+ fputs("-+-", outfile); X+ print_merged_header(outfile, &files[1], X+ first1, last1, field_width, 0, 0); X+ putc('\n', outfile); X+ X+ for ( i0 = first0, i1 = first1 ; i0 <= last0 || i1 <= last1 ; ++i0, ++i1 ) { X+ if ( i0 <= last0 ) X+ print_1_field(files[0].linbuf[i0].text, X+ files[0].linbuf[i0].length, field_width); X+ else X+ fprintf(outfile, "%*s", field_width, ""); X+ fputs( " | ", outfile ); X+ if ( i1 <= last1 ) X+ print_1_field(files[1].linbuf[i1].text, X+ files[1].linbuf[i1].length, field_width); X+ else X+ fprintf(outfile, "%*s", field_width, ""); X+ putc('\n', outfile); X+ } X+ X+ } X+ X+ X+ static void print_merged_header(fp,file,first,last,width,delflag,insflag) X+ FILE *fp; X+ struct file_data *file; X+ int first, last, width, delflag, insflag; X+ { X+ char numbuf[64], *s; X+ int trans_first, trans_last; X+ X+ if ( delflag && insflag ) X+ s = "--- change at "; X+ else if ( delflag ) X+ s = "--- delete at "; X+ else if ( insflag ) X+ s = "--- insert at "; X+ else X+ s = "--- "; X+ fputs(s,fp); X+ width -= strlen(s); X+ X+ translate_range(file, first, last, &trans_first, &trans_last); X+ if ( trans_last > trans_first ) X+ (void) sprintf(numbuf,"%d-%d ",trans_first,trans_last); X+ else X+ (void) sprintf(numbuf,"%d ",trans_last); X+ fputs(numbuf,fp); X+ width -= strlen(numbuf); X+ X+ print_dashes(fp,width); X+ } X+ X+ X+ static void print_1_field(line,linelen,width) X+ register char *line; X+ int linelen; X+ int width; X+ { X+ register int col, i; X+ X+ for ( X+ col = 0, i = 0 ; X+ col < width && *line && *line != '\n' && i <= linelen ; X+ ++i, ++line X+ ) { X+ switch ( *line ) { X+ case '\t': X+ do { X+ putc (' ',outfile); X+ } while ( (++col & 7) != 0 && col < width ); X+ break; X+ case '\b': X+ putc(*line,outfile); X+ --col; X+ break; X+ default: X+ putc(*line,outfile); X+ ++col; X+ break; X+ } X+ } X+ while ( ++col <= width ) X+ putc(' ',outfile); X+ } X+ X+ X+ static void print_dashes(fp,n) X+ FILE *fp; X+ register int n; X+ { X+ while ( --n >= 0 ) X+ putc('-',fp); X+ } XIndex: Makefile X*** Makefile~ Sat Aug 12 21:20:06 1989 X--- Makefile Sat Aug 12 21:20:57 1989 X*************** X*** 39,48 **** X prefix= X X # All source files X! srcs=diff.c analyze.c io.c context.c ed.c normal.c util.c dir.c diff.h \ X! regex.c regex.h limits.h diff3.c X # Object files for diff only. X! objs=diff.o analyze.o io.o context.o ed.o normal.o util.o dir.o regex.o X tapefiles = $(srcs) README diagmeet.note Makefile COPYING X X all: diff diff3 X--- 39,48 ---- X prefix= X X # All source files X! srcs=diff.c analyze.c io.c context.c ed.c normal.c mreged.c util.c dir.c \ X! diff.h regex.c regex.h limits.h diff3.c X # Object files for diff only. X! objs=diff.o analyze.o io.o context.o ed.o normal.o merged.o util.o dir.o regex.o X tapefiles = $(srcs) README diagmeet.note Makefile COPYING X X all: diff diff3 END_OF_FILE_Patch-2-mopt size="`wc -c < Patch-2-mopt`" if test 7939 -ne "$size" ; then echo "Patch-2-mopt: extraction error - got $size chars" fi fi echo "done - 2 files extracted" exit 0 -- Chip Rosenthal | Yes, you're a happy man and you're chip@chinacat.Lonestar.ORG | a lucky man, but are you a smart Unicom Systems Development, 512-482-8260 | man? -David Bromberg
simon@ms.uky.edu (G. Simon Gales) (02/25/90)
/* _lef_ */ I tried these sources, and received an 'Internal Compiler Error' when compiling virtex9.c. Any ideas? -- Simon Gales@The University of Kentucky simon@ms.uky.edu | 'Fate... protects fools, little children, simon@UKMA.BITNET | and ships named Enterprise.' {rutgers, uunet}!ukma!simon | - Riker, ST:TNG
wsinpdb@eutws1.win.tue.nl (Paul de Bra) (02/26/90)
In article <14316@s.ms.uky.edu> simon@ms.uky.edu (G. Simon Gales) writes: >/* _lef_ */ > >I tried these sources, and received an 'Internal Compiler Error' when >compiling virtex9.c. Any ideas? The SCO compiler has problems with complicated expressions, especially those containing complicated array constructions. Different versions have different problems and sometimes generate bogus code even if they don't give an internal error message. If you use the sources posted about 2 years ago, available for anonymous ftp from tuewsd (131.155.2.8 as Wietse kindly corrected my earlier posting) you will not have problems on a 286 with SCO Xenix 2.2.1, but I cannot guarantee anything on other versions or on the 386. In general though the 386 should be a lot easier. Paul. (debra@research.att.com)
usenet@cps3xx.UUCP (Usenet file owner) (02/26/90)
From article <14316@s.ms.uky.edu>, by simon@ms.uky.edu (G. Simon Gales): > I tried these sources, and received an 'Internal Compiler Error' when > compiling virtex9.c. Any ideas? I don't know about the specific file you are talking about, but usually when I've seen this compiler error it is cured by removing the 'register' portion of a few variable declarations. j |%|John Lawitzke, Dale Computer Corp., R&D |%|UUCP: uunet!frith!dale1!jhl Work |%| uunet!frith!ipecac!jhl Home Inquiring minds just wondering. |%|Internet: jhl@frith.egr.msu.edu
simon@ms.uky.edu (G. Simon Gales) (02/27/90)
<><> Ok, I did a -Dregister= to remove the register declarations, now it compiles fine. Nice trick. But it doesn't run, when I type ./virtex, I get: ./virtex: #: not found ./virtex: ^Ke]K3@^^PP0~P0^BP (more garbage): not found ./virtex: ##^B0q#: not found ./virtex: syntax error at line 1: `H^BsUsU^(more garbage)` unexpected I've never seen this before, except when running a 386 binary on a vax. Any more ideas? Please? <><> -- Simon Gales@The University of Kentucky simon@ms.uky.edu | 'Fate... protects fools, little children, simon@UKMA.BITNET | and ships named Enterprise.' {rutgers, uunet}!ukma!simon | - Riker, ST:TNG
root@rdb1.UUCP (Robert Barrell) (02/28/90)
In article <952@chinacat.Lonestar.ORG>, chip@chinacat.Lonestar.ORG (Chip Rosenthal) writes: > > The XENIX diff does not do context diffs. The GNU diff does, but it > requires a couple of small hacks to get it running under XENIX. > > Below are two patches. One fixes GNU diff to run under XENIX. The second > patch adds a "merged" diff option. Okay. Having applied the patches, I still cannot get GNU diff to run on a 286 under SCO xenix. First of all, the compiler complains about a structure it can't find, which is in regex.h (supplied with GNU diff v1.7). Not all of the modules for diff bother to include regex.h, so I added #include lines where they were needed. Also, in cases where diff.h is included, it was necessary for me to include regex.h BEFORE including diff.h (maybe this is due to my relatively old version of the development system, but the programs wouldn't compile when the includes were the other way around). > If you want to run GNU diff under XENIX, you will obviously need to first > grab a copy of the diff v1.7 sources. (osu-cis is a good place to snarf > GNU stuff via anon uucp.) Besides my patch, you will also need a version > of "alloca()" which runs on XENIX. These have been floating around; I > remember one or two posted to comp.unix.xenix. My patch assumes that > your alloca() is found in a library called SlibPW.a. > ..... > If you need the XENIX 386 alloca.s, I suppose I can make it available. > (I *do not* have a 286 version.) Also, I've archived a couple of other > diff fixes/enhancements which have appeared in gnu.utils.bugs. Drop > me a line if you need any of this stuff. I guess I will need to find alloca() somewhere (has anyone seen it around recently? I couldn't find it on osu-cis). Odd, though, diff compiled and linked without the -lPW, so I checked my libs and found alloca() in ?libc.a. So, there already is an alloca() available. Even so, it must not work too well, since I can only compare files of 4K or less. -- Robert Barrell | Bang: ...!uunet!lgnp1!rdb1!root | Cody Computer Services Milo's Meadow BBS | or: root@rdb1 | 55 East High Street login: nuucp or bbs |-----------------------------------| Pottstown, PA 19464 (215) 323-0497 | Business and Police Dept Software | (215) 326-7476
chip@chinacat.Lonestar.ORG (Chip Rosenthal) (03/02/90)
In article <190@rdb1.UUCP> root@rdb1.UUCP (Robert Barrell) writes: >[Re: GNU diff on a 286] >Odd, though, diff compiled and linked without the -lPW, so I checked my libs >and found alloca() in ?libc.a. So, there already is an alloca() available. >Even so, it must not work too well, since I can only compare files of 4K >or less. alloca() is a lazy man's malloc(). The idea is that it gives you a bunch of memory which is automagically freed when the procedure returns. It does this by snarfing the memory off the stack so that the procedure return will cause the memory to be returned. Given that the default stack size is 0x1000 bytes, and gnu programs tend to alloca() like crazy, it isn't surprising that you can't get very far. I haven't looked at the source close enough to see how much gnu diff beats on alloca(), but you might want to fixhdr(C) the executable to make the stack bigger. -- Chip Rosenthal | Yes, you're a happy man and you're chip@chinacat.Lonestar.ORG | a lucky man, but are you a smart Unicom Systems Development, 512-482-8260 | man? -David Bromberg
jeff@hobbes.C2S.MN.ORG (Jeff Holmes) (03/05/90)
In article <190@rdb1.UUCP> root@rdb1.UUCP (Robert Barrell) writes: > In article <952@chinacat.Lonestar.ORG>, chip@chinacat.Lonestar.ORG (Chip Rosenthal) writes: > > If you want to run GNU diff under XENIX, you will obviously need to first > > grab a copy of the diff v1.7 sources. (osu-cis is a good place to snarf > > GNU stuff via anon uucp.) Besides my patch, you will also need a version > > I guess I will need to find alloca() somewhere (has anyone seen it around > recently? I couldn't find it on osu-cis). Odd, though, diff compiled and I would like to get GNU gdb. Is this available on osu-cis? And how do I get to osu-cis? -- Jeff Jeff Holmes DOMAIN: jeff@questar.mn.org Questar Data Systems UUCP: amdahl!bungia!questar!jeff St. Paul, MN 55121 AT&T: +1 612 688 0089