LaTeX for Xenix (7 of 14)

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


---- 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



More information about the Comp.unix.xenix mailing list