LaTeX for Xenix

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


---- Cut Here and unpack ----
#!/bin/sh
# this is part 12 of a multipart archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file par.c continued
#
CurArch=12
if test ! -r s2_seq_.tmp
then echo "Please unpack part 1 first!"
     exit 1; fi
( read Scheck
  if test "$Scheck" != $CurArch
  then echo "Please unpack part $Scheck next!"
       exit 1;
  else exit 0; fi
) < s2_seq_.tmp || exit 1
echo "x - Continuing file par.c"
sed 's/^X//' << 'SHAR_EOF' >> par.c
X	background[3] = 0;
X	background[4] = 0;
X	background[5] = 0;
X	background[2 + stretch_order(q)] = stretch(q);
X	background[2 + stretch_order(r)] += stretch(r);
X	background[6] = shrink(q) + shrink(r);
X	minimum_demerits = AWFUL_BAD;
X	minimal_demerits[VERY_LOOSE_FIT] = AWFUL_BAD;
X	minimal_demerits[LOOSE_FIT] = AWFUL_BAD;
X	minimal_demerits[DECENT_FIT] = AWFUL_BAD;
X	minimal_demerits[TIGHT_FIT] = AWFUL_BAD;
X	if (par_shape_ptr == NULL) {
X		if (hang_indent == 0) {
X			last_special_line = 0;
X			second_width = hsize;
X			second_indent = 0;
X		} else {
X			last_special_line = abs(hang_after);
X			if (hang_after < 0) {
X				first_width = hsize - abs(hang_indent);
X				first_indent = (hang_indent >= 0 ? hang_indent : 0);
X				second_width = hsize;
X				second_indent = 0;
X			} else {
X				first_width = hsize;
X				first_indent = 0;
X				second_width = hsize - abs(hang_indent);
X				second_indent = (hang_indent >= 0 ? hang_indent : 0);
X			}
X		}
X	} else {
X		last_special_line = info(par_shape_ptr) - 1;
X		second_width = mem[par_shape_ptr + 2 * (last_special_line + 1)].sc;
X		second_indent = mem[par_shape_ptr + 2 * last_special_line + 1].sc;
X	}
X	easy_line = (looseness == 0 ? last_special_line : MAX_HALFWORD);
X	threshold = pretolerance;
X#ifdef STAT
X	if (threshold >= 0) {
X		if (tracing_paragraphs > 0) {
X			begin_diagnostic();
X			print_nl("@firstpass");
X		} 
X		second_pass = FALSE;
X	} else {
X		threshold = tolerance;
X		second_pass = TRUE;
X		if (tracing_paragraphs > 0)
X			begin_diagnostic();
X	}
X#else
X	if (threshold >= 0)
X		second_pass = FALSE;
X	else {
X		threshold = tolerance;
X		second_pass = TRUE;
X	}
X#endif
X	loop {
X		q = get_node(ACTIVE_NODE_SIZE);
X		type(q) = UNHYPHENATED;
X		fitness(q) = DECENT_FIT;
X		link(q) = last_active;
X		break_node(q) = NULL;
X		line_number(q) = prev_graf + 1;
X		total_demerits(q) = 0;
X		link(active) = q;
X		do_all_six(store_background);
X		passive = NULL;
X		printed_node = temp_head;
X		pass_number = 0;
X		font_in_short_display = NULL_FONT;
X		cur_p = link(temp_head);
X		auto_breaking = TRUE;
X		prev_p = cur_p;
X		while (cur_p != NULL && link(active) != last_active) {
X			if (is_char_node(cur_p)) {
X				prev_p = cur_p;
X				do {
X					act_width += width_char(cur_p);
X					cur_p = link(cur_p);
X				} while (is_char_node(cur_p));
X			}
X			switch (type(cur_p))
X			{
X			case HLIST_NODE:
X			case VLIST_NODE:
X			case RULE_NODE:
X				act_width += width(cur_p);
X				break;
X			
X			case WHATSIT_NODE:
X				break;
X			
X			case GLUE_NODE:
X				if (auto_breaking) {
X					if (is_char_node(prev_p))
X						try_break(0L, UNHYPHENATED);
X					else if (precedes_break(prev_p)) 
X						try_break(0L, UNHYPHENATED);
X				}
X				check_shrinkage(glue_ptr(cur_p));
X				q = glue_ptr(cur_p);
X				act_width += width(q);
X				active_width[2 + stretch_order(q)] += stretch(q);
X				active_width[6] += shrink(q);
X				if (second_pass && auto_breaking) {
X					s = link(cur_p);
X					if (s != NULL) {
X						loop {
X							if (is_char_node(s)) {
X								c = qo(character(s));
X								hf = font(s);
X							} else if (type(s) == LIGATURE_NODE) {
X								q = lig_ptr(s);
X								c = qo(character(q));
X								hf = font(q);
X							} else if (type(s) == KERN_NODE &&
X									subtype(s) == NORMAL)
X								c = 128;
X							else if (type(s) == WHATSIT_NODE)
X								c = 128;
X							else goto done1;
X							if (c < 128 && lc_code(c) != 0) {
X								if (lc_code(c) == c || uc_hyph > 0)
X									goto done2;
X								else goto done1;
X							}
X							s = link(s);
X						}
X
X					done2:
X						hyf_char = hyphen_char[hf];
X						if (hyf_char < 0 || hyf_char > 255)
X							goto done1;
X						ha = s;
X						hn = 0;
X						loop {
X							if (is_char_node(s)) {
X								if (font(s) != hf)
X									goto done3;
X								c = qo(character(s));
X								if (c >= 128)
X									goto done3;
X								if (lc_code(c) == 0 || hn == 63)
X									goto done3;
X								hb = s;
X								incr(hn);
X								hu[hn] = c;
X								hc[hn] = lc_code(c) - 1;
X							} else if (type(s) == LIGATURE_NODE) {
X								j = hn;
X								q = lig_ptr(s);
X								if (font(q) != hf)
X									goto done3;
X								do {
X									c = qo(character(q));
X									if (c >= 128)
X										goto done3;
X									if (lc_code(c) == 0 || j == 63)
X										goto done3;
X									incr(j);
X									hu[j] = c;
X									hc[j] = lc_code(c) - 1;
X									q = link(q);
X								} while (q != NULL);
X								hb = s;
X								hn = j;
X							} else if (type(s) != KERN_NODE ||
X									subtype(s) != NORMAL)
X								goto done3;
X							s = link(s);
X						}
X
X					done3:
X						if (hn < 5)
X							goto done1;
X						loop {
X							if (!is_char_node(s)) {
X								switch (type(s))
X								{
X								case LIGATURE_NODE:
X									break;
X
X								case KERN_NODE:
X									if (subtype(s) != NORMAL)
X										goto done4;
X									break;
X
X								case WHATSIT_NODE:
X								case GLUE_NODE:
X								case PENALTY_NODE:
X								case INS_NODE:
X								case ADJUST_NODE:
X								case MARK_NODE:
X									goto done4;
X									break;
X								
X								default: 
X									goto done1;
X									break;
X								}
X							}
X							s = link(s);
X						}
X
X					done4:
X						hyphenate();
X					}
X				}
X				done1:
X					break;
X			
X			case KERN_NODE:
X				kern_break();
X				break;
X			
X			case LIGATURE_NODE:
X				act_width += width_lig_char(cur_p);
X				break;
X			
X			case DISC_NODE:
X				s = pre_break(cur_p);
X				disc_width = 0;
X				if (s == NULL)
X					try_break(ex_hyphen_penalty, HYPHENATED);
X				else {
X					do {
X						if (is_char_node(s))
X							disc_width += width_char(s);
X						else {
X							switch (type(s))
X							{
X							case LIGATURE_NODE:
X								disc_width += width_lig_char(s);
X								break;
X							
X							case HLIST_NODE:
X							case VLIST_NODE:
X							case RULE_NODE:
X							case KERN_NODE:
X								disc_width += width(s);
X								break;
X							
X							default:
X								confusion("disc3");
X								break;
X							}
X						}
X						s = link(s);
X					} while (s != NULL);
X					act_width += disc_width;
X					try_break(hyphen_penalty, HYPHENATED);
X					act_width -= disc_width;
X				}
X				break;
X			
X			case MATH_NODE:
X				auto_breaking = (subtype(cur_p) == AFTER);
X				kern_break();
X				break;
X			
X			case PENALTY_NODE:
X				try_break(penalty(cur_p), UNHYPHENATED);
X				break;
X			
X			case MARK_NODE:
X			case INS_NODE:
X			case ADJUST_NODE:
X				break;
X			
X			default:
X				confusion("paragraph");
X				break;
X			}
X			prev_p = cur_p;
X			cur_p = link(cur_p);
X		}
X		if (cur_p == NULL) {
X			try_break(EJECT_PENALTY, HYPHENATED);
X			if (link(active) != last_active) {
X				r = link(active);
X				fewest_demerits = AWFUL_BAD;
X				do {
X					if (type(r) != DELTA_NODE &&
X						total_demerits(r) < fewest_demerits) {
X						fewest_demerits = total_demerits(r);
X						best_bet = r;
X					}
X					r = link(r);
X				} while (r != last_active);
X				best_line = line_number(best_bet);
X				if (looseness == 0)
X					goto done;
X				r = link(active);
X				actual_looseness = 0;
X				do {
X					if (type(r) != DELTA_NODE) {
X						line_diff = (int) line_number(r) - (int) best_line;
X						if (line_diff < actual_looseness &&
X							looseness <= line_diff ||	
X							line_diff > actual_looseness &&
X							looseness >= line_diff) {
X							best_bet = r;
X							actual_looseness = line_diff;
X							fewest_demerits = total_demerits(r);
X						} else if (line_diff == actual_looseness &&	
X							total_demerits(r) < fewest_demerits) {
X							best_bet = r;
X							fewest_demerits = total_demerits(r);
X						}
X					}
X					r = link(r);
X				} while (r != last_active);
X				best_line = line_number(best_bet);
X				if (actual_looseness == looseness || second_pass)
X					goto done;
X			}
X		}
X		for (q = link(active); q != last_active; q = cur_p) {
X			cur_p = link(q);
X			if (type(q) == DELTA_NODE)
X				free_node(q, DELTA_NODE_SIZE);
X			else free_node(q, ACTIVE_NODE_SIZE);
X		}
X		for (q = passive; q != NULL; q = cur_p) {
X			cur_p = link(q);
X			free_node(q, PASSIVE_NODE_SIZE);
X		}
X#ifdef STAT
X		if (tracing_paragraphs > 0)
X			print_nl("@secondpass"); 
X#endif
X		threshold = tolerance;
X		second_pass = TRUE;
X	}
X
Xdone:
X#ifdef STAT
X	if (tracing_paragraphs > 0)
X		end_diagnostic(TRUE);
X		
X#endif
X	post_line_break(final_widow_penalty);
X	for (q = link(active); q != last_active; q = cur_p) {
X		cur_p = link(q);
X		if (type(q) == DELTA_NODE)
X			free_node(q, DELTA_NODE_SIZE);
X		else free_node(q, ACTIVE_NODE_SIZE);
X	}
X	for (q = passive; q != NULL; q = cur_p) {
X		cur_p = link(q);
X		free_node(q, PASSIVE_NODE_SIZE);
X	}
X	pack_begin_line = 0;
X}
X
Xpost_line_break (final_widow_penalty)
X	val		final_widow_penalty;
X{
X	ptr		q;
X	ptr		r;
X	ptr		s;
X	qword	t;
X	val		pen;
X	hword	cur_line;
X	scal	cur_width;
X	scal	cur_indent;
X	bool	disc_break;
X
X	q = break_node(best_bet);
X	cur_p = NULL;
X	do {
X		r = q;
X		q = prev_break(q);
X		next_break(r) = cur_p;
X		cur_p = r;
X	} while (q != NULL);
X	cur_line = prev_graf + 1;
X	do {
X		q = cur_break(cur_p);
X		disc_break = FALSE;
X		if (q != NULL) {
X			if (type(q) == GLUE_NODE) {
X				delete_glue_ref(glue_ptr(q));
X				glue_ptr(q) = right_skip;
X				subtype(q) = RIGHT_SKIP_CODE + 1;
X				add_glue_ref(right_skip);
X				goto done;
X			} else {
X				if (type(q) == DISC_NODE) {
X					t = replace_count(q);
X					if (t == 0)
X						r = link(q);
X					else {
X						r = q;
X						while (t > 1) {
X							r = link(r);
X							decr(t);
X						}
X						s = link(r);
X						if (!is_char_node(s) &&
X							next_break(cur_p) != NULL &&
X							cur_break(next_break(cur_p)) == s)
X							s = r;
X						r = link(s);
X						link(s) = NULL;
X						flush_node_list(link(q));
X						replace_count(q) = 0;
X					}
X					if (post_break(q) != NULL) {
X						s = post_break(q);
X						while (link(s) != NULL)
X							s = link(s);
X						link(s) = r;
X						r = post_break(q);
X						post_break(q) = NULL;
X					}
X					if (pre_break(q) != NULL) {
X						s = pre_break(q);
X						link(q) = s;
X						while (link(s) != NULL)
X							s = link(s);
X						pre_break(q) = NULL;
X						q = s;
X					}
X					link(q) = r;
X					disc_break = TRUE;
X				} else
X					if (type(q) == MATH_NODE ||
X					    type(q) == KERN_NODE)
X						width(q) = 0;
X			}
X		} else {
X			q = temp_head; 
X			while (link(q) != NULL)
X				q = link(q);
X		}
X		r = new_param_glue(RIGHT_SKIP_CODE);
X		link(r) = link(q);
X		link(q) = r;
X		q = r;
X
X	done:
X		r = link(q);
X		link(q) = NULL;
X		q = link(temp_head);
X		link(temp_head) = r;
X		if (left_skip != zero_glue) {
X			r = new_param_glue(LEFT_SKIP_CODE);
X			link(r) = q;
X			q = r;
X		}
X		if (cur_line > last_special_line) {
X			cur_width = second_width;
X			cur_indent = second_indent;
X		} else if (par_shape_ptr == NULL) {
X			cur_width = first_width;
X			cur_indent = first_indent;
X		} else {
X			cur_width = mem[par_shape_ptr + 2 * cur_line].sc;
X			cur_indent = mem[par_shape_ptr + 2 * cur_line - 1].sc;
X		}
X		adjust_tail = adjust_head;
X		just_box = hpack(q, cur_width, EXACTLY);
X		shift_amount(just_box) = cur_indent;
X		append_to_vlist(just_box);
X		if (adjust_head != adjust_tail) {
X			link(tail) = link(adjust_head);
X			tail = adjust_tail;
X		}
X		adjust_tail = NULL;
X		if (cur_line + 1 != best_line) {
X			pen = inter_line_penalty;
X			if (cur_line == prev_graf + 1)
X				pen += club_penalty;
X			if (cur_line + 2 == best_line)
X				pen += final_widow_penalty;
X			if (disc_break)
X				pen += broken_penalty;
X			if (pen != 0) {
X				r = new_penalty(pen);
X				link(tail) = r;
X				tail = r;
X			}
X		}
X		incr(cur_line);
X		cur_p = next_break(cur_p);
X		if (cur_p != NULL) {
X			r = temp_head;
X			loop {
X				q = link(r);
X				if (q == cur_break(cur_p))
X					break;
X				if (is_char_node(q))
X					break;
X				if (non_discardable(q))
X					break;
X				if (subtype(q) == ACC_KERN && type(q) == KERN_NODE)
X					break;
X				r = q;
X			}
X			if (r != temp_head) {
X				link(r) = NULL;
X				flush_node_list(link(temp_head));
X				link(temp_head) = q;
X			}
X		}
X	} while (cur_p != NULL);
X	if (cur_line != best_line || link(temp_head) != NULL)
X		confusion("line breaking");
X	prev_graf = best_line - 1;
X}
X
Xptr
Xfinite_shrink (p)
X	ptr		p;
X{
X	ptr		q;
X
X	if (no_shrink_error_yet) {
X		no_shrink_error_yet = FALSE;
X		print_err("Infinite glue shrinkage found in a paragraph");
X		help_shrink();
X		error();
X	}
X	q = new_spec(p);
X	shrink_order(q) = NORMAL;
X	delete_glue_ref(p);
X	return q;
X}
X
X/*
X *	Help text
X */
X
Xhelp_shrink()
X{
X	help5("The paragraph just ended includes some glue that has",
X	"infinite shrinkability, e.g., `\\hskip 0pt minus 1fil'.",
X	"Such glue doesn't belong there---it allows a paragraph",
X	"of any length to fit on one line. But it's safe to proceed,",
X	"since the offensive shrinkability has been made finite.");
X}
SHAR_EOF
echo "File par.c is complete"
chmod 0444 par.c || echo "restore of par.c fails"
set `wc -c par.c`;Sum=$1
if test "$Sum" != "24379"
then echo original size 24379, current size $Sum;fi
echo "x - extracting par.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > par.h &&
X
X/*
X *    Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved.
X *    Copying of this file is granted according to the provisions 
X *    specified in the file COPYING which must accompany this file.
X */
X
X
X/*
X *		par.h
X */
X
X#define	last_active			active
X
X#define	VERY_LOOSE_FIT		0
X#define	LOOSE_FIT			1
X#define	DECENT_FIT			2
X#define	TIGHT_FIT			3
X
X#define	ACTIVE_NODE_SIZE	3
X#define	UNHYPHENATED		0
X#define	HYPHENATED			1
X#define	fitness				subtype
X#define	break_node			rlink
X#define	line_number			llink
X#define	total_demerits(D)	mem[(D) + 2].i
X
X#define	PASSIVE_NODE_SIZE	2
X#define	cur_break			rlink
X#define	prev_break			llink
X#define	next_break			prev_break
X#define	serial				info
X
X#define	DELTA_NODE			2
X#define	DELTA_NODE_SIZE		7
X
X#define	do_all_six(F) \
X	{F(1); F(2); F(3); F(4); F(5); F(6);}
X
Xglobal	ptr		just_box;
X
Xint		line_break();
X
Xglobal	ptr		passive;
Xglobal	ptr		printed_node;
Xglobal	ptr		pass_number;
X
Xglobal	scal	active_width[];
Xglobal	scal	cur_active_width[];
Xglobal	scal	background[];
Xglobal	scal	break_width[];
Xglobal	bool	no_shrink_error_yet;
X
Xptr		finite_shrink();
X
Xglobal	ptr		cur_p;
Xglobal	bool	second_pass;
Xglobal	val		threshold;
X
Xint		try_break();
X
X#define	AWFUL_BAD			07777777777
X
Xglobal	val		minimal_demerits[];
Xglobal	val		minimum_demerits;
Xglobal	ptr		best_place[];
Xglobal	hword	best_pl_line[];
X
Xglobal	hword	easy_line;
Xglobal	hword	last_special_line;
Xglobal	scal	first_width;
Xglobal	scal	second_width;
Xglobal	scal	first_indent;
Xglobal	scal	second_indent;
Xglobal	scal	disc_width;
Xglobal	ptr		best_bet;
Xglobal	val		fewest_demerits;
Xglobal	hword	best_line;
Xglobal	val		actual_looseness;
Xglobal	int		line_diff;
X
Xint		post_line_break();
SHAR_EOF
chmod 0444 par.h || echo "restore of par.h fails"
set `wc -c par.h`;Sum=$1
if test "$Sum" != "1666"
then echo original size 1666, current size $Sum;fi
echo "x - extracting print.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > print.c &&
X
X/*
X *    Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved.
X *    Copying of this file is granted according to the provisions 
X *    specified in the file COPYING which must accompany this file.
X */
X
X
X/*
X *		print.c
X */
X
X#include "tex.h"
X#include "texext.h"
X#include "eq.h"
X#include "char.h"
X#include "str.h"
X#include "io.h"
X#include "print.h"
X
Xalpha_file	log_file;
X
Xchar	dig[23];
Xint		file_offset;
Xval		first_count;
Xint		selector = TERM_ONLY;
Xval		tally;
Xint		term_offset;
Xascii	trick_buf[ERROR_LINE];
Xval		trick_count;
X
Xprint_ln ()
X{
X	switch (selector)
X	{
X	case TERM_AND_LOG:
X		wterm_cr();
X		term_offset = 0;
X		wlog_cr();
X		file_offset = 0;
X		break;
X
X	case LOG_ONLY:
X		wlog_cr();
X		file_offset = 0;
X		break;
X
X	case TERM_ONLY:
X		wterm_cr();
X		term_offset = 0;
X		break;
X
X	case NO_PRINT:
X	case PSEUDO:
X	case NEW_STRING:
X		break;
X
X	default:
X		wfile_cr();
X		break;
X	}
X}	
X
Xprint_char (c)
X	ascii	c;
X{
X	if (c == new_line_char && selector < PSEUDO) {
X		print_ln();
X		return;
X	}
X	switch (selector)
X	{
X	case TERM_AND_LOG:
X		wterm(xchr[c]);
X		incr(term_offset);
X		wlog(xchr[c]);
X		incr(file_offset);
X		if (term_offset == MAX_PRINT_LINE) {
X			wterm_cr();
X			term_offset = 0;
X		}
X		if (file_offset == MAX_PRINT_LINE) {
X			wlog_cr();
X			file_offset = 0;
X		}
X		break;
X
X	case LOG_ONLY:
X		wlog(xchr[c]);
X		incr(file_offset);
X		if (file_offset == MAX_PRINT_LINE)
X			print_ln();
X		break;
X
X	case TERM_ONLY:
X		wterm(xchr[c]);
X		incr(term_offset);
X		if (term_offset == MAX_PRINT_LINE)
X			print_ln();
X		break;
X
X	case NO_PRINT:
X		return;
X
X	case PSEUDO:
X		if (tally < trick_count) 
X			trick_buf[tally % ERROR_LINE] = c;
X		break;
X
X	case NEW_STRING:
X		if (pool_ptr < POOL_SIZE) 
X			append_char(c);
X		break;
X
X	default:
X		wfile(xchr[c]);
X		break;
X	}
X	incr(tally);
X}
X
Xprint_ASCII (c)
X	int		 c;
X{
X	if (c >= 0 && c <= 127)
X		print_str(c);
X	else {
X		print_char('[');
X		if (c < 0)
X			print_int(c);
X		else print_hex((val) c);
X		print_char(']');
X	}
X}
X
Xprint_str (s)
X	str		s;
X{
X	int		j;
X
X	if (s >= str_ptr)
X		s = make_string_given("???");
X	else if (s < 128) {
X		if (s < 0)
X			s = make_string_given("???");
X		else if (s == new_line_char && selector < PSEUDO) {
X			print_ln();
X			return;
X		}
X	}
X	j = str_start[s];
X	while (j < str_start[s + 1]) {
X		print_char(str_pool[j]);
X		incr(j);
X	}
X}
X
Xslow_print (s)
X	str		s;
X{
X	int		j;
X
X	if (s >= str_ptr)
X		s = make_string_given("???");
X	else if (s < 128) {
X		if (s < 0)
X			s = make_string_given("???");
X		else if (s == new_line_char && selector < PSEUDO) {
X			print_ln();
X			return;
X		}
X	}
X	j = str_start[s];
X	while (j < str_start[s + 1]) {
X		print_str(str_pool[j]);
X		incr(j);
X	}
X}
X
Xprint (s)
X	char*	s;
X{
X	while (*s) { 
X		print_char(*s);
X		incr(s);
X	}
X}
X
Xprint_nl (s)
X	char* 	s;
X{
X	if (term_offset > 0 && odd(selector) ||
X		file_offset > 0 && selector >= LOG_ONLY)
X		print_ln();
X	print(s);
X}
X
Xprint_esc (s)
X	char*	s;
X{
X	ascii	c;
X
X	c = escape_char;
X	if (c >= 0 && c < 128) 
X		print_char(c);
X	print(s);
X}
X
Xprint_int (n)
X	int		n;
X{
X	int		k;
X	int	 	m;
X
X	k = 0;
X	if (n < 0)  {
X		print_char('-');
X		negate(n);
X	}
X	do {
X		dig[k] = n % 10;
X		n /= 10;
X		incr(k);
X	} while (n != 0);
X	print_the_digs(k);
X}
X
Xprint_val (n)
X	val		n;
X{
X	int		k;
X	val	 	m;
X
X	k = 0;
X	if (n < 0)  {
X		print_char('-');
X		if (n > -100000000)
X			negate(n);
X		else {
X			m = -1 - n;
X			n = m / 10;
X			m = m % 10 + 1;
X			k = 1;
X			if (m < 10)
X				dig[0] = m;
X			else {
X				dig[0] = 0;
X				incr(n);
X			}
X		}
X	}
X	do {
X		dig[k] = n % 10;
X		n /= 10;
X		incr(k);
X	} while (n != 0);
X	print_the_digs(k);
X}
X
Xprint_hex (v)
X	val		v;
X{
X	int		k;
X
X	k = 0;
X	print_char('"');
X	do {
X		dig[k] = v&15;
X		v >>= 4;
X		incr(k);
X	} while (v != 0);
X	print_the_digs(k);
X}
X
Xprint_the_digs (k)
X	int		 k;
X{
X	while (k > 0) {
X		decr(k);
X		if (dig[k] < 10)
X			print_char('0' + dig[k]);
X		else print_char('A' - 10 + dig[k]);
X	}
X}
X
Xprint_two (n)
X	int		n;
X{
X	n = abs(n) % 100;
X	print_char('0' + n / 10);
X	print_char('0' + n % 10);
X}
X
Xprint_roman_int (n)
X	val		n;
X{
X	char* 	j = "m2d5c2l5x2v5i";
X	char* 	k;
X	val		u;
X	val		v = 1000;
X
X	loop {
X		while (n >= v) {
X			print_char(*j);
X			n -= v;
X		}
X		if (n <= 0) return; /* nonpositive input produces no output */
X		k = j + 2;
X		u = v / (*(k - 1) - '0');
X		if (*(k - 1) == '2')  {
X			k += 2;
X			u /= *(k - 1) - '0';
X		}
X		if (n + u >= v)  {
X			print_char(*k);
X			n += u;
X		} else {
X			j += 2;
X			v /= *(j - 1) - '0';
X		}
X	}
X}
X
Xprint_current_string ()
X{
X	int		j;
X
X	j = str_start[str_ptr];
X	while (j < pool_ptr) {
X		print_char(str_pool[j]);
X		incr(j);
X	}
X}
SHAR_EOF
chmod 0444 print.c || echo "restore of print.c fails"
set `wc -c print.c`;Sum=$1
if test "$Sum" != "4438"
then echo original size 4438, current size $Sum;fi
echo "x - extracting print.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > print.h &&
X
X/*
X *    Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved.
X *    Copying of this file is granted according to the provisions 
X *    specified in the file COPYING which must accompany this file.
X */
X
X
X/*
X *		print.h
X */
X
X#define	NO_PRINT			16 
X#define	TERM_ONLY			17
X#define	LOG_ONLY			18
X#define	TERM_AND_LOG		19
X#define	PSEUDO				20
X#define	NEW_STRING			21
X#define	MAX_SELECTOR		21
X
Xglobal	alpha_file		log_file;
X
Xglobal	int			selector;
X
Xglobal	int			term_offset;
Xglobal	int			file_offset;
X
Xglobal	char		dig[];
Xglobal	val			tally;
Xglobal	ascii		trick_buf[];
Xglobal	val			trick_count;
Xglobal	val			first_count;
X
Xint		print();
Xint		print_char();
Xint		print_sym();
Xint		print_ln();
Xint		print_esc();
Xint		print_nl();
Xint		print_the_digs();
Xint		print_int();
Xint		print_val();
Xint		print_hex();
Xint		print_ASCII();
Xint		print_roman_int();
Xint		print_current_string();
X
X#define	wterm(c)		putchar(c);
X#define	wterm_ln(c)		{putchar(c); putchar('\n');}
X#define	wterm_cr()		putchar('\n');
X
X#define	wlog(c)			putc(c, log_file)
X#define	wlog_ln(c)		{putc(c, log_file); putc('\n', log_file);}
X#define	wlog_cr()		putc('\n', log_file);
X
X#define	wfile(c)		putc(c, write_file[selector])
X#define	wfile_ln(c)		{putc(c, write_file[selector]); \
X						putc('\n', write_file[selector]);}
X#define	wfile_cr()		putc('\n', write_file[selector]);
SHAR_EOF
chmod 0444 print.h || echo "restore of print.h fails"
set `wc -c print.h`;Sum=$1
if test "$Sum" != "1333"
then echo original size 1333, current size $Sum;fi
echo "x - extracting scan.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > scan.c &&
X
X/*
X *    Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved.
X *    Copying of this file is granted according to the provisions 
X *    specified in the file COPYING which must accompany this file.
X */
X
X
X/*
X *		scan.c
X */
X
X#include	"tex.h"
X#include	"cmds.h"
X#include	"heap.h"
X#include	"arith.h"
X#include	"eq.h"
X#include	"token.h"
X#include	"tokenstack.h"
X#include	"tokenlists.h"
X#include	"evalstack.h"
X#include	"char.h"
X#include	"str.h"
X#include	"box.h"
X#include	"tfm.h"
X#include	"dvi.h"
X#include	"print.h"
X#include	"error.h"
X#include	"page.h"
X#include	"scan.h"
X
Xgord	cur_order;
Xval		cur_val;
Xint		cur_val_level = INT_VAL;
Xint		radix;
X
Xscan_left_brace ()
X{
X	get_nbrx_token();
X	if (cur_cmd != LEFT_BRACE) {
X		print_err("Missing { inserted");
X		help_left();
X		back_error();
X		cur_tok = LEFT_BRACE_TOKEN;
X		cur_cmd = LEFT_BRACE;
X		cur_chr= '{';
X		incr(align_state);
X	}
X}
X
Xscan_optional_equals ()
X{
X	get_nbx_token();
X	if (cur_tok != OTHER_TOKEN + '=')
X		back_input();
X}
X
Xbool
Xscan_keyword (s)
X	char*	s;
X{
X	char	c;
X	ptr		p;
X	ptr		q;
X
X	p = backup_tokens;
X	token_link(p) = NULL;
X	c = *s;
X	while (c != NUL) {
X		get_x_token();
X		if (cur_cs == 0 && (cur_chr == c || cur_chr == c - 'a' + 'A')) {
X			store_new_token(cur_tok);
X			incr(s);
X			c = *s;
X		} else if (cur_cmd != SPACER || p != backup_tokens) {
X			back_input();
X			if (p != backup_tokens)
X				back_list(token_link(backup_tokens));
X			return FALSE;
X		}
X	}
X	flush_list(token_link(backup_tokens));
X	return TRUE;
X}
X
Xmu_error ()
X{
X	print_err("Incompatible glue units");
X	help_mu_error();
X	error();
X}
X
X#define	scanned_result(CV, CVL) \
X	{cur_val = CV; cur_val_level = CVL;}
X
X#define	negate_glue() \
X	{width(cur_val) = -width(cur_val); \
X	stretch(cur_val) = -stretch(cur_val); \
X	shrink(cur_val) = -shrink(cur_val);}
X
Xscan_something_internal (level, negative)
X	int		level;
X	bool	negative;
X{
X	hword	m;
X	int		p;
X
X	m = cur_chr;
X	switch (cur_cmd)
X	{
X	case DEF_CODE:
X		scan_seven_bit_int();
X		if (m == MATH_CODE_BASE)
X			{scanned_result(ho(math_code(cur_val)), INT_VAL);}
X		else if (m < MATH_CODE_BASE)
X			{scanned_result(equiv(m + cur_val), INT_VAL);}
X		else {scanned_result(eqtb[m + cur_val].i, INT_VAL);}
X		break;
X
X	case TOKS_REGISTER:
X	case ASSIGN_TOKS:
X	case DEF_FAMILY:
X	case SET_FONT:
X	case DEF_FONT:
X		if (level != TOK_VAL) {
X			print_err("Missing number, treated as zero");
X			help_missing_number();
X			back_error();
X			scanned_result(0, DIMEN_VAL);
X		} else if (cur_cmd <= ASSIGN_TOKS) {
X			if (cur_cmd < ASSIGN_TOKS)  {
X				scan_eight_bit_int();
X				m = TOKS_BASE + cur_val;
X			}
X			scanned_result(equiv(m), TOK_VAL);
X		} else {
X			back_input();
X			scan_font_ident();
X			scanned_result(FONT_ID_BASE + cur_val, IDENT_VAL);
X		}
X		break;
X
X	case ASSIGN_INT:
X		scanned_result(eqtb[m].i, INT_VAL);
X		break;
X
X	case ASSIGN_DIMEN:
X		scanned_result(eqtb[m].sc, DIMEN_VAL);
X		break;
X
X	case ASSIGN_GLUE:
X		scanned_result(equiv(m), GLUE_VAL);
X		break;
X	
X	case ASSIGN_MU_GLUE:
X		 scanned_result(equiv(m), MU_VAL);
X		 break;
X
X	case SET_AUX:
X		if (abs(mode) != m) {
X			print_err("Improper ");
X			print_cmd_chr(SET_AUX, m);
X			help_aux();
X			error();
X			if (level != TOK_VAL)
X				{scanned_result(0, DIMEN_VAL);}
X			else scanned_result(0, INT_VAL);
X		} else {
X			cur_val = aux; 
X			if (m == VMODE)
X				cur_val_level = DIMEN_VAL;
X			else cur_val_level = INT_VAL;
X		}
X		break;
X
X	case SET_PREV_GRAF:
X		nest[nest_ptr] = cur_list;
X		p = nest_ptr;
X		while (abs(nest[p].mode_field) != VMODE)
X			decr(p);
X		scanned_result(nest[p].pg_field, INT_VAL);
X		break;
X
X	case SET_PAGE_INT:
X		if (m == 0)	
X			cur_val = dead_cycles;
X		else cur_val = insert_penalties;
X		cur_val_level = INT_VAL;
X		break;
X
X	case SET_PAGE_DIMEN:
X		if (page_contents == EMPTY)
X			if (m == 0)
X				cur_val = MAX_DIMEN; 
X			else cur_val = 0;
X		else cur_val = page_so_far[m];
X		cur_val_level = DIMEN_VAL;
X		break;
X	
X	case SET_SHAPE:
X		if (par_shape_ptr == NULL)
X			cur_val = 0;
X		else cur_val = info(par_shape_ptr);
X		cur_val_level = INT_VAL;
X		break;
X	
X	case SET_BOX_DIMEN:
X		scan_eight_bit_int();
X		if (box(cur_val) == NULL)
X			cur_val = 0;
X		else cur_val = mem[box(cur_val) + m].sc;
X		cur_val_level = DIMEN_VAL;
X		break;
X	
X	case CHAR_GIVEN:
X	case MATH_GIVEN:
X		scanned_result(cur_chr, INT_VAL);
X		break;
X	
X	case ASSIGN_FONT_DIMEN:
X		find_font_dimen(FALSE);
X		font_info[fmem_ptr].sc = 0;
X		scanned_result(font_info[cur_val].sc, DIMEN_VAL); 
X		break;
X	
X	case ASSIGN_FONT_INT:
X		scan_font_ident();
X		if (m == 0)
X			{scanned_result(hyphen_char[cur_val], INT_VAL);}
X		else scanned_result(skew_char[cur_val], INT_VAL);
X		break;
X
X	case REGISTER:
X		scan_eight_bit_int();
X		switch (m)
X		{
X		case INT_VAL:
X			cur_val = count(cur_val);
X			break;
X
X		case DIMEN_VAL:
X			cur_val = dimen(cur_val);
X			break;
X
X		case GLUE_VAL:
X			cur_val = skip(cur_val);
X			break;
X
X		case MU_VAL:
X			cur_val = mu_skip(cur_val);
X			break;
X		}
X		cur_val_level = m;
X		break;
X
X	case LAST_ITEM:
X		if (cur_chr == GLUE_VAL)
X			cur_val = zero_glue;
X		else cur_val = 0;
X		cur_val_level = cur_chr;
X		if (!is_char_node(tail) && mode != 0) {
X			switch (cur_chr)
X			{
X			case INT_VAL:
X				if (type(tail) == PENALTY_NODE)
X					cur_val = penalty(tail);
X				break;
X
X			case DIMEN_VAL:
X				if (type(tail) == KERN_NODE)
X					cur_val = width(tail);
X				break;
X
X			case GLUE_VAL:
X				if (type(tail) == GLUE_NODE) {
X					cur_val = glue_ptr(tail); 
X					if (subtype(tail) == MU_GLUE)
X						cur_val_level = MU_VAL;
X				}
X				break;
X
X			default:
X				break;
X			}
X		} else if (mode == VMODE && tail == head) {
X			switch (cur_chr)
X			{
X			case INT_VAL:
X				cur_val = last_penalty;
X				break;
X
X			case DIMEN_VAL:
X				cur_val = last_kern;
X				break;
X
X			case GLUE_VAL:
X				if (last_glue != MAX_HALFWORD)
X					cur_val = last_glue;
X				break;
X			}
X		}
X		break;
X			
X	default:
X		print_err("You can't use `");
X		print_cmd_chr(cur_cmd, cur_chr);
X		print("' after ");
X		print_esc("the");
X		help_thee();
X		error();
X		if (level != TOK_VAL)
X			{scanned_result(0, DIMEN_VAL);}
X		else {scanned_result(0, INT_VAL);}
X		break;
X	}
X	while (cur_val_level > level) {
X		if (cur_val_level == GLUE_VAL)
X			cur_val = width(cur_val);
X		else if (cur_val_level == MU_VAL)
X			mu_error();
X		decr(cur_val_level);
X	}
X	if (negative) {
X		if (cur_val_level >= GLUE_VAL) {
X			cur_val = new_spec(cur_val);
X			negate_glue();
X		} else negate(cur_val);
X	} else if (cur_val_level >= GLUE_VAL && cur_val_level <= MU_VAL)
X		add_glue_ref(cur_val);
X}
X
Xscan_seven_bit_int ()
X{
X	scan_int();
X	if (cur_val < 0 || cur_val > 127) {
X		print_err("Bad character code");
X		help_char();
X		int_error(cur_val);
X		cur_val = 0;
X	}
X}
X
Xscan_eight_bit_int ()
X{
X	scan_int();
X	if (cur_val < 0 || cur_val > 255) {
X		print_err("Bad register code");
X		help_reg();
X		int_error(cur_val);
X		cur_val = 0;
X	}
X}
X
Xscan_four_bit_int()
X{
X	scan_int();
X	if (cur_val < 0 || cur_val > 15) {
X		print_err("Bad number");
X		help_number();
X		int_error(cur_val);
X		cur_val = 0;
X	}
X}
X
Xscan_char_num ()
X{
X	scan_int();
X	if (cur_val < 0 || cur_val > 255) {
X		print_err("Bad character code");
X		help_char_num();
X		int_error(cur_val);
X		cur_val = 0;
X	}
X}
X
Xscan_fifteen_bit_int ()
X{
X	scan_int();
X	if (cur_val < 0 || cur_val > 077777) {
X		print_err("Bad math code");
X		help_mathchar();
X		int_error(cur_val);
X		cur_val = 0;
X	}
X}
X
Xscan_twenty_seven_bit_int ()
X{
X	scan_int();
X	if (cur_val < 0 || cur_val> 0777777777) {
X		print_err("Bad delimiter code");
X		help_del();
X		int_error(cur_val);
X		cur_val = 0;
X	}
X}
X
X#define	get_nbsx_token() \
X	{negative = FALSE; \
X	do {get_nbx_token(); \
X		if (cur_tok == MINUS_TOKEN) { \
X			negative = !negative; \
X			cur_tok = PLUS_TOKEN;} \
X	} while (cur_tok == PLUS_TOKEN);}
X
Xscan_int ()
X{
X	int		d;
X	val		m;
X	bool	vacuous;
X	bool	negative;
X	bool	OK_so_far;
X
X	d = 0;
X	radix = 0;
X	OK_so_far = TRUE;
X	get_nbsx_token();
X	if (cur_tok == ALPHA_TOKEN) {
X		get_token();
X		if (cur_tok < CS_TOKEN_FLAG) {
X			cur_val = cur_chr;
X			if (cur_cmd <= RIGHT_BRACE) {
X				if (cur_cmd == RIGHT_BRACE)
X					incr(align_state);
X				else decr(align_state);
X			}
X		} else if (cur_tok < CS_TOKEN_FLAG + SINGLE_BASE)
X			cur_val = cur_tok - CS_TOKEN_FLAG - ACTIVE_BASE;
X		else cur_val = cur_tok - CS_TOKEN_FLAG - SINGLE_BASE;
X		if (cur_val > 127) {
X			print_err("Improper alphabetic constant");
X			help_char_const();
X			cur_val = 0;
X			back_error();
X		} else scan_optional_space();
X	} else if (cur_cmd >= MIN_INTERNAL && cur_cmd <= MAX_INTERNAL)
X		scan_something_internal(INT_VAL, FALSE);
X	else {
X		radix = 10;
X		m = 214748364;
X		if (cur_tok == OCTAL_TOKEN) {
X			radix = 8;
X			m = 02000000000;
X			get_x_token();
X		} else if (cur_tok == HEX_TOKEN) {
X			radix = 16;
X			m = 010000000000;
X			get_x_token();
X		}
X		vacuous = TRUE;
X		cur_val = 0;
X		loop {
X			if (cur_tok < ZERO_TOKEN + radix &&
X				cur_tok >= ZERO_TOKEN &&
X				cur_tok <= ZERO_TOKEN + 9)
X				d = cur_tok - ZERO_TOKEN;
X			else if (radix == 16) {
X				if (cur_tok <= A_TOKEN + 5 && cur_tok >= A_TOKEN)
X					d = cur_tok - A_TOKEN + 10;
X				else if (cur_tok <= OTHER_A_TOKEN + 5 &&
X					cur_tok >= OTHER_A_TOKEN)
X					d = cur_tok - OTHER_A_TOKEN + 10;
X				else break;
X			} else break;
X			vacuous = FALSE;
X			if	(cur_val >= m && (cur_val > m || d > 7 || radix != 10)) {
X				if (OK_so_far) {
X					print_err("Number too big"); 
X					help_big_num();
X					error();
X					cur_val = INFINITY;
X					OK_so_far = FALSE;
X				}
X			} else cur_val = cur_val * radix + d;
X			get_x_token();
X		}
X		if (vacuous) {
X			print_err("Missing number, treated as zero");
X			help_missing_number();
X			back_error();
X		} else if (cur_cmd != SPACER)
X			back_input();
X	}
X	if (negative)
X		negate(cur_val);
X}	
X	
X#define	set_conversion(NUM, DENOM) \
X	{num = NUM; denom = DENOM;}
X
Xscan_dimen (mu, inf, shortcut)
X	bool	mu;
X	bool	inf;
X	bool	shortcut;
X{
X	val		f;
X	int		k;
X	scal	v;
X	val		num;
X	val		denom;
X	bool	negative;
X	val		save_cur_val;
X
X	f = 0;
X	negative = FALSE;
X	arith_error = FALSE;
X	cur_order = NORMAL;
X	if (!shortcut) {
X		get_nbsx_token();
X		if (cur_cmd >= MIN_INTERNAL && cur_cmd <= MAX_INTERNAL)	{
X			if (mu) {
X				scan_something_internal(MU_VAL, FALSE);
X				if (cur_val_level >= GLUE_VAL) {
X					v = width(cur_val);
X					delete_glue_ref(cur_val);
X					cur_val = v;
X				}
X				if (cur_val_level == MU_VAL)
X					goto attach_sign;
X				if (cur_val_level != INT_VAL)
X					mu_error();
X			} else {
X				scan_something_internal(DIMEN_VAL, FALSE);
X				if (cur_val_level == DIMEN_VAL)
X					goto attach_sign;
X			}
X		} else {
X			back_input();
X			if (cur_tok == EURO_POINT_TOKEN)
X				cur_tok = POINT_TOKEN;
X			if (cur_tok != POINT_TOKEN)
X				scan_int();
X			else {
X				radix = 10;
X				cur_val = 0;
X			}
X			if (cur_tok == EURO_POINT_TOKEN)
X				cur_tok = POINT_TOKEN;
X			if (radix == 10 && cur_tok == POINT_TOKEN) {
X				k = 0;
X				get_token();
X				loop {
X					get_x_token();
X					if (cur_tok > ZERO_TOKEN + 9 || cur_tok < ZERO_TOKEN)
X						break;
X					if (k < 17) {
X						dig[k] = cur_tok - ZERO_TOKEN;
X						incr(k);
X					}
X				}
X				f = round_decimals(k);
X				if (cur_cmd != SPACER)
X					back_input();
X			}
X		}
X	}
X	if (cur_val < 0) {
X		negative = !negative;
X		negate(cur_val);
X	}
X	if (inf) {
X		if (scan_keyword("fil")) {
X			cur_order = FIL;
X			while (scan_keyword("l")) {
X				if (cur_order == FILLL) {
X					print_err("Illegal unit of measure (");
X					print("replaced by filll)");
X					help_filll();
X					error();
X				} else incr(cur_order);
X			}
X			goto attach_fraction;
X		}
X	}
X	save_cur_val = cur_val;
X	get_nbx_token();
X	if (cur_cmd < MIN_INTERNAL || cur_cmd > MAX_INTERNAL)
X		back_input();
X	else {
X		if (mu) {
X			scan_something_internal(MU_VAL, FALSE);
X			if (cur_val_level >= GLUE_VAL) {
X				v = width(cur_val);
X				delete_glue_ref(cur_val);
X				cur_val = v;
X			}
X			if (cur_val_level != MU_VAL)
X				mu_error();
X		} else scan_something_internal(DIMEN_VAL, FALSE);
X		v = cur_val;
X		goto found;
X	}
X	if (mu)
X		goto not_found;
X	if (scan_keyword("em"))
X		v = quad(cur_font);
X	else if (scan_keyword("ex"))
X		v = x_height(cur_font);
X	else goto not_found;
X	scan_optional_space();
X
Xfound:
X	cur_val = nx_plus_y(save_cur_val, v, xn_over_d(v, f, 0200000L));
X	goto attach_sign;
X
Xnot_found:
X	if (mu)  {
X		if (scan_keyword("mu"))
X			goto attach_fraction;
X		else {
X			print_err("Illegal unit of measure (");
X			print("mu inserted)");
X			help_mu();
X			error();
X			goto attach_fraction;
X		}
X	}
X	if (scan_keyword("true")) {
X		prepare_mag();
X		if (mag != 1000) {
X			cur_val = xn_over_d(cur_val, 1000L, mag);
X			f = (1000 * f + 0200000 * remainder) / mag;
X			cur_val += f / 0200000;
X			f %= 0200000;
X		}
X	}
X	if (scan_keyword("pt"))
X		goto attach_fraction;
X	if (scan_keyword("in"))	{set_conversion(7227, 100);}
X	else if (scan_keyword("pc")) {set_conversion(12, 1);}
X	else if (scan_keyword("cm")) {set_conversion(7227, 254);}
X	else if (scan_keyword("mm")) {set_conversion(7227, 2540);}
X	else if (scan_keyword("bp")) {set_conversion(7227, 7200);}
X	else if (scan_keyword("dd")) {set_conversion(1238, 1157);}
X	else if (scan_keyword("cc")) {set_conversion(14856, 1157);}
X	else if (scan_keyword("sp")) goto done;
X	else {
X		print_err("Illegal unit of measure (");
X		print("pt inserted)");
X		help_dimen();
X		error();
X		goto attach_fraction;
X	}
X	cur_val = xn_over_d(cur_val, num, denom);
X	f = (num * f + 0200000 * remainder) / denom;
X	cur_val += f / 0200000;
X	f %= 0200000;
X
Xattach_fraction:
X	if (cur_val >= 0400000)
X		arith_error = TRUE;
X	else cur_val = cur_val * UNITY + f;
X
Xdone:
X	scan_optional_space();
X
Xattach_sign:
X	if (arith_error || abs(cur_val) >= 010000000000) {
X		print_err("Dimension too large");
X		help_big_dimen();
X		error();
X		cur_val = MAX_DIMEN;
X		arith_error = FALSE;
X	}
X	if (negative)
X		negate(cur_val);
X}
X
Xscan_glue (level)
X	int		level;
X{
X	ptr		q;
X	bool	mu;
X	bool	negative;
X
X	mu = (level == MU_VAL);
X	get_nbsx_token();
X	if (cur_cmd >= MIN_INTERNAL && cur_cmd <= MAX_INTERNAL) {
X		scan_something_internal(level, negative);
X		if (cur_val_level >= GLUE_VAL) {
X			if (cur_val_level != level)
X				mu_error();
X			return;
X		}
X		if (cur_val_level == INT_VAL)
X			scan_dimen(mu, FALSE, TRUE);
X		else if (level == MU_VAL)
X			mu_error();
X	} else {
X		back_input();
X		scan_dimen(mu, FALSE, FALSE);
X		if (negative)
X			negate(cur_val);
X	}
X	q = new_spec(zero_glue);
X	width(q) = cur_val;
X	if (scan_keyword("plus")) {
X		scan_dimen(mu, TRUE, FALSE);
X		stretch(q) = cur_val;
X		stretch_order(q) = cur_order;
X	}
X	if (scan_keyword("minus")) {
X		scan_dimen(mu, TRUE, FALSE);
X		shrink(q) = cur_val;
X		shrink_order(q) = cur_order;
X	}
X	cur_val = q;
X}
X
Xptr
Xscan_rule_spec ()
X{
X	ptr		q;
X
X	q = new_rule();
X	if (cur_cmd == VRULE)
X		width(q) = DEFAULT_RULE;
X	else {
X		height(q) = DEFAULT_RULE;
X		depth(q) = 0;
X	}
X
Xreswitch:
X	if (scan_keyword("width")) {
X		scan_normal_dimen();
X		width(q) = cur_val;
X		goto reswitch;
X	}
X	if (scan_keyword("height")) {
X		scan_normal_dimen();
X		height(q) = cur_val;
X		goto reswitch;
X	}
X	if (scan_keyword("depth")) {
X		scan_normal_dimen();
X		depth(q) = cur_val;
X		goto reswitch;
X	}
X	return q;
X}
X
X/*
X * 	Help text
X */
X
Xhelp_mathchar ()
X{
X	help2("A numeric math code must be between 0 and 32767.",
X	"I changed this one to zero.");
X}
X
Xhelp_number ()
X{
X	help2("Since I expected to read a number between 0 and 15,",
X	"I changed this one to zero.");
X}
X
Xhelp_char ()
X{
X	help2("The numeric code for a character must be between 0 and 127.",
X	"I changed this one to zero.");
X}
X
Xhelp_char_num ()
X{
X	help2("A character number must be between 0 and 255.",
X	"I changed this one to zero.");
X}
X
Xhelp_char_const ()
X{
X	help2("A one-character control sequence belongs after a ` mark.",
X	"So I'm essentially inserting \\0 here.");
X}
X
Xhelp_big_num ()
X{
X	help2("I can only go up to 2147483647 = 017777777777 = 0x7FFFFFFF.",
X	"so I'm using that number instead of yours.");
X}
X
Xhelp_missing_number ()
X{
X	help3("A number should have been here; I inserted `0'.",
X	"(If you can't figure out why I needed to see a number,",
X	"look up `weird error' in the index to The TeXbook.)");
X}
X
Xhelp_filll ()
X{
X	help1("I dddon't go any higher than filll.");
X}
X
Xhelp_mu ()
X{
X	help4("The unit of measurement in math glue must be mu.",
X	"To recover gracefully from this error, it's best to",
X	"delete the erroneous units; e.g., type `2' to delete",
X	"two letters. (See Chapter 27 of The TeXbook.)");
X}
X
Xhelp_mu_error ()
X{
X	help1("I'm going to assume that 1mu=1pt when they're mixed.");
X}
X
Xhelp_dimen ()
X{
X	help6("Dimensions can be in units of em, ex, in, pt, pc,",
X	"cm, mm, dd, cc, bp, or sp; but yours is a new one!",
X	"I'll assume that you meant to say pt, for printers' points.",
X	"To recover gracefully from this error, it's best to",
X	"delete the erroneous units; e.g. type `2' to delete",
X	"two letters. (See Chapter 27 of The TeXbook.)");
X}
X	
Xhelp_big_dimen ()
X{
X	help2("I can't work with sizes bigger than about 19 feet.",
X	"Continue and I'll use the largest value I can.");
X}
X
Xhelp_thee ()
X{
X	help1("I'm forgetting what you said and using zero instead.");
X}
X
Xhelp_left ()
X{
X	help4("A left brace was mandatory here, so I've put one in.",
X	"You might want to delete and/or insert some corrections",
X	"so that I will find a matching right brace soon.",
X	"If you're confused by all this, try typing `I}' now.")
X}
X
Xhelp_aux ()
X{
X	help4("You can refer to \\spacefactor only in horizontal mode;",
X	"you can refer to \\prevdepth only in vertical mode; and",
X	"neither of these is meaningful inside \\write. So",
X	"I'm forgetting what you said and using zero instead.");
X}
X
Xhelp_del ()
X{
X	help2("A numeric delimiter code must be between 0 and 2^{27}-1.",
X	"I changed this one to zero.");
X}
X
Xhelp_reg ()
X{
X	help2("A register number must be between 0 and 255.",
X	      "I changed this one to zero.");
X}
SHAR_EOF
chmod 0444 scan.c || echo "restore of scan.c fails"
set `wc -c scan.c`;Sum=$1
if test "$Sum" != "17405"
then echo original size 17405, current size $Sum;fi
echo "x - extracting scan.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > scan.h &&
X
X/*
X *    Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved.
X *    Copying of this file is granted according to the provisions 
X *    specified in the file COPYING which must accompany this file.
X */
X
X
X/*
X *		scan.h
X */
X
Xint		scan_left_brace();
Xint		scan_optional_equals();
Xbool	scan_keyword();
X
Xglobal	val		cur_val;
Xglobal	int		cur_val_level;
X
Xint		scan_something_internal();
X
X#define	INT_VAL			0
X#define	DIMEN_VAL		1
X#define	GLUE_VAL		2
X#define	MU_VAL			3
X#define	IDENT_VAL		4
X#define	TOK_VAL			5
X
Xint		scan_eight_bit_int();
Xint		scan_seven_bit_int();
Xint		scan_four_bit_int();
Xint		scan_char_num();
Xint		scan_fifteen_bit_int();
Xint		scan_twenty_seven_bit_int();
X
Xint		scan_int();
X#define INFINITY	017777777777
X
Xglobal	int		radix;
X
X#define	PLUS_TOKEN			(OTHER_TOKEN + '+')
X#define	MINUS_TOKEN			(OTHER_TOKEN + '-')
X#define	ZERO_TOKEN			(OTHER_TOKEN + '0')
X#define	A_TOKEN				(LETTER_TOKEN + 'A')
X#define	OTHER_A_TOKEN		(OTHER_TOKEN + 'A')
X#define	OCTAL_TOKEN			(OTHER_TOKEN + '\'')
X#define	HEX_TOKEN			(OTHER_TOKEN + '"')
X#define	ALPHA_TOKEN			(OTHER_TOKEN + '`')
X#define	POINT_TOKEN			(OTHER_TOKEN + '.')
X#define	EURO_POINT_TOKEN	(OTHER_TOKEN + ',')
X
Xint		scan_dimen();
X#define	MAX_DIMEN	07777777777
X
X#define	scan_normal_dimen()		scan_dimen(FALSE, FALSE, FALSE)
X
Xglobal	gord	cur_order;
Xint		scan_glue();
X
X#define	scan_optional_space() \
X	{get_x_token(); if (cur_cmd != SPACER) back_input();}
X
X#define	get_nbx_token() \
X	{do get_x_token(); while (cur_cmd == SPACER);}
X
X#define	get_nbrx_token() \
X	{do get_x_token(); while (cur_cmd == SPACER || cur_cmd == RELAX);}
X
Xptr		scan_rule_spec();
X#define	DEFAULT_RULE	26215
SHAR_EOF
chmod 0444 scan.h || echo "restore of scan.h fails"
set `wc -c scan.h`;Sum=$1
if test "$Sum" != "1628"
then echo original size 1628, current size $Sum;fi
echo "x - extracting setenv.sh (Text)"
sed 's/^X//' << 'SHAR_EOF' > setenv.sh &&
X
Xexport TEXFORMATS TEXINPUTS TEXFONTS
XTEXFORMATS=.:/users/physics/astron/minard/tex/formats
XTEXINPUTS=.:/users/physics/astron/minard/tex/inputs
XTEXFONTS=.:/users/physics/astron/minard/tex/fonts
SHAR_EOF
chmod 0444 setenv.sh || echo "restore of setenv.sh fails"
set `wc -c setenv.sh`;Sum=$1
if test "$Sum" != "194"
then echo original size 194, current size $Sum;fi
echo "x - extracting str.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > str.c &&
X
X/*
X *    Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved.
X *    Copying of this file is granted according to the provisions 
X *    specified in the file COPYING which must accompany this file.
X */
X
X
X/*
X *		str.c
X */
X
X#include "tex.h"
X#include "io.h"
X#include "file.h"
X#include "error.h"
X#include "str.h"
X
Xascii 	str_pool[POOL_SIZE];
Xptr		pool_ptr;
Xptr		str_start[MAX_STRINGS];
Xstr		str_ptr;
Xstr		null_str;
X
Xbool
Xstr_eq_buf (s, k)
X	str		s;
X	int		k;
X{
X	int		j;
X	
X	j = str_start[s];
X	while (j < str_start[s + 1]) {
X		if (str_pool[j] != buffer[k])
X			return FALSE;
X		incr(j); incr(k);
X	}
X	return TRUE;
X}
X
Xbool
Xstr_eq_str (s, t)
X	str		s;
X	str		t;
X{
X	int		j;
X	int		k;
X
X	if (length(s) != length(t))
X		return FALSE;
X	j = str_start[s];
X	k = str_start[t];
X	while (j < str_start[s + 1]) {
X		if (str_pool[j] != str_pool[k])
X			return FALSE;
X		incr(j); incr(k);
X	}
X	return TRUE;
X}
X
Xstr
Xmake_string ()
X{
X	incr(str_ptr);
X	if (str_ptr == MAX_STRINGS)
X		overflow("number of strings", MAX_STRINGS);
X	str_start[str_ptr] = pool_ptr;
X	return (str_ptr - 1);
X}
X
Xstr
Xmake_string_given (s)
X	char* 	s;
X{
X	while (*s != NUL) {
X		append_char(*s);
X		incr(s);
X	}
X	return (make_string());
X}
X
Xinit_strings ()
X{
X	int 	k;
X
X	str_ptr = pool_ptr = 0;
X	for (k = 0; k <= 127; incr(k)) {
X		if (k < ' ') {
X			append_char('^');
X			append_char('^');
X			append_char(k + 0100);
X		} else if (k == 127)
X			make_string_given("^^?");
X		else append_char(k);
X		make_string();
X	}
X	null_str = make_string();
X}
SHAR_EOF
chmod 0444 str.c || echo "restore of str.c fails"
set `wc -c str.c`;Sum=$1
if test "$Sum" != "1470"
then echo original size 1470, current size $Sum;fi
echo "x - extracting str.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > str.h &&
X
X/*
X *    Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved.
X *    Copying of this file is granted according to the provisions 
X *    specified in the file COPYING which must accompany this file.
SHAR_EOF
echo "End of part 12"
echo "File str.h is continued in part 13"
echo "13" > s2_seq_.tmp
exit 0



More information about the Comp.unix.xenix mailing list