LaTeX for Xenix (6 of 14)

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


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



More information about the Comp.unix.xenix mailing list