LaTeX for Xenix (2 of 14)

G Geers glenn at extro.ucc.su.oz.au
Fri Feb 16 10:33:17 AEST 1990


---- 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 at renoir.berkeley.edu)
X#
X#      modified for distribution, monardo at 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 at renoir.berkeley.edu)
X#
X#      modified for distribution, monardo at 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



More information about the Comp.unix.xenix mailing list