LaTeX for Xenix (5 of 14)

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


---- Cut Here and unpack ----
#!/bin/sh
# this is part 5 of a multipart archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file cmds.h continued
#
CurArch=5
if test ! -r s2_seq_.tmp
then echo "Please unpack part 1 first!"
     exit 1; fi
( read Scheck
  if test "$Scheck" != $CurArch
  then echo "Please unpack part $Scheck next!"
       exit 1;
  else exit 0; fi
) < s2_seq_.tmp || exit 1
echo "x - Continuing file cmds.h"
sed 's/^X//' << 'SHAR_EOF' >> cmds.h
X#define	CALL				(MAX_COMMAND + 11)
X#define	LONG_CALL			(MAX_COMMAND + 12)
X#define	OUTER_CALL			(MAX_COMMAND + 13)
X#define	LONG_OUTER_CALL		(MAX_COMMAND + 14)
X#define	END_TEMPLATE		(MAX_COMMAND + 15)
X#define	DONT_EXPAND			(MAX_COMMAND + 16)
X#define	GLUE_REF			(MAX_COMMAND + 17)
X#define	SHAPE_REF			(MAX_COMMAND + 18)
X#define	BOX_REF				(MAX_COMMAND + 19)
X#define	DATA				(MAX_COMMAND + 20)
X
Xint		print_cmd_chr();
Xint		show_cur_cmd_chr();
SHAR_EOF
echo "File cmds.h is complete"
chmod 0444 cmds.h || echo "restore of cmds.h fails"
set `wc -c cmds.h`;Sum=$1
if test "$Sum" != "3642"
then echo original size 3642, current size $Sum;fi
echo "x - extracting cond.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > cond.c &&
X
X/*
X *    Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved.
X *    Copying of this file is granted according to the provisions 
X *    specified in the file COPYING which must accompany this file.
X */
X
X
X/*
X *		cond.c
X */
X
X#include	"tex.h"
X#include	"cmds.h"
X#include	"heap.h"
X#include	"box.h"
X#include	"eq.h"
X#include	"eqstack.h"
X#include	"hash.h"
X#include	"token.h"
X#include	"tokenlists.h"
X#include	"scan.h"
X#include	"tokenstack.h"
X#include	"evalstack.h"
X#include	"file.h"
X#include	"print.h"
X#include	"error.h"
X#include	"cond.h"
X
Xptr		cond_ptr;
Xint		cur_if;
Xint		if_limit;
Xval		if_line;
X
Xval		skip_line;
X
Xget_x_token_or_active_char()
X{
X	get_x_token();
X	if (cur_cmd == RELAX && cur_chr == NO_EXPAND_FLAG) {
X		cur_cmd = ACTIVE_CHAR;
X		cur_chr = cur_tok - CS_TOKEN_FLAG - ACTIVE_BASE;
X	}
X}
X
Xpush_cond()
X{
X	ptr		p;
X
X	p = get_node(IF_NODE_SIZE);
X	link(p) = cond_ptr;
X	type(p) = if_limit;
X	subtype(p) = cur_if;
X	if_line_field(p) = if_line;
X	cond_ptr = p;
X	cur_if = cur_chr;
X	if_limit = IF_CODE;
X	if_line = line;
X}
X
Xpop_cond()
X{
X	ptr		p;
X
X	p = cond_ptr;
X	if_line = if_line_field(p);
X	cur_if = subtype(p);
X	if_limit = type(p);
X	cond_ptr = link(p);
X	free_node(p, IF_NODE_SIZE);
X}
X
Xpass_text ()
X{
X	int		l;
X	int		save_scanner_status;
X
X	l = 0;
X	save_scanner_status = scanner_status;
X	scanner_status = SKIPPING;
X	skip_line = line;
X	loop {
X		get_next();
X		if (cur_cmd == FI_OR_ELSE) {
X			if (l == 0)
X				break;
X			if (cur_chr == FI_CODE)
X				decr(l);
X		} else if (cur_cmd == IF_TEST)
X			incr(l);
X	}
X	scanner_status = save_scanner_status;
X}
X					
Xchange_if_limit (l, p)
X	int		l;
X	ptr		p;
X{
X	ptr		q;
X
X	if (p == cond_ptr)
X		if_limit = l;
X	else {
X		q = cond_ptr; 
X		loop {
X			if (q == NULL)
X				confusion("if");
X			if (link(q) == p) {
X				type(q) = l;
X				return;
X			}
X			q = link(q);
X		}
X	}
X}
X
Xconditional ()
X{
X	bool	b;
X	val		m;
X	val		n;
X	ptr		p;
X	ptr		q;
X	ptr		r;
X	int		this_if;
X	ptr		save_cond_ptr;
X	int		save_scanner_status;
X
X	push_cond();
X	save_cond_ptr = cond_ptr;
X	this_if = cur_chr;
X	switch (this_if)
X	{
X	case IF_CHAR_CODE:
X	case IF_CAT_CODE:
X		get_x_token_or_active_char();
X		if (cur_cmd > ACTIVE_CHAR || cur_chr > 127) {
X			m = RELAX;
X			n = 256;
X		} else {
X			m = cur_cmd;
X			n = cur_chr;
X		}
X		get_x_token_or_active_char();
X		if (cur_cmd > ACTIVE_CHAR || cur_chr > 127) {
X			cur_cmd = RELAX;
X			cur_chr = 256;
X		}
X		if (this_if == IF_CHAR_CODE)
X			b = (n == cur_chr);
X		else b = (m == cur_cmd);
X		break;
X	
X	case IF_INT_CODE:
X	case IF_DIM_CODE:
X		if (this_if == IF_INT_CODE)
X			scan_int();
X		else scan_normal_dimen();
X		n = cur_val;
X		get_nbx_token(); 
X		if (cur_tok >= OTHER_TOKEN + '<' &&
X			cur_tok <= OTHER_TOKEN + '>')
X			r = cur_tok - OTHER_TOKEN;
X		else {
X			print_err("Missing = inserted for ");
X			print_cmd_chr(IF_TEST, this_if);
X			help_relation();
X			back_error();
X			r = '=';
X		}
X		if (this_if == IF_INT_CODE)
X			scan_int();
X		else scan_normal_dimen();
X		switch (r)
X		{
X		case '<':
X			b = (n < cur_val);
X			break;
X
X		case '=':
X			b = (n == cur_val);
X			break;
X
X		case '>':
X			b = (n > cur_val);
X			break;
X		}
X		break;
X	
X	case IF_ODD_CODE:
X		scan_int();
X		b = odd(cur_val);
X		break;
X	
X	case IF_VMODE_CODE:
X		b = (abs(mode) == VMODE);
X		break;
X
X	case IF_HMODE_CODE:
X		b = (abs(mode) == HMODE);
X		break;
X
X	case IF_MMODE_CODE:
X		b = (abs(mode) == MMODE);
X		break;
X	
X	case IF_INNER_CODE:
X		b = (mode < 0);
X		break;
X	
X	case IF_VOID_CODE:
X	case IF_HBOX_CODE:
X	case IF_VBOX_CODE:
X		scan_eight_bit_int();
X		p = box(cur_val);
X		if (this_if == IF_VOID_CODE)
X			b = (p == NULL);
X		else if (p == NULL)
X			b = FALSE;
X		else if (this_if == IF_HBOX_CODE)
X			b = (type(p) == HLIST_NODE);
X		else b = (type(p) == VLIST_NODE);
X		break;
X
X	case IFX_CODE:
X		save_scanner_status = scanner_status;
X		scanner_status = NORMAL;
X		get_next();
X		n = cur_cs;
X		p = cur_cmd;
X		q = cur_chr;
X		get_next(); 
X		if (cur_cmd != p)
X			b = FALSE;
X		else if (cur_cmd < CALL)
X			b = (cur_chr == q);
X		else {
X			p = token_link(cur_chr);
X			q = token_link(equiv(n));
X			while (p != NULL && q != NULL) {
X				if (token(p) != token(q))
X					p = NULL;
X				else {
X					p = token_link(p);
X					q = token_link(q);
X				}
X			}
X			b = (p == NULL && q == NULL);
X		}
X		scanner_status = save_scanner_status;
X		break;
X
X	case IF_EOF_CODE:
X		scan_four_bit_int();
X		b = (read_open[cur_val] == CLOSED);
X		break;
X	
X	case IF_TRUE_CODE:
X		b = TRUE;
X		break;
X
X	case IF_FALSE_CODE:
X		b = FALSE;
X		break;
X
X	case IF_CASE_CODE: 
X		scan_int();
X		n = cur_val;
X		if (tracing_commands > 1) {
X			begin_diagnostic();
X			print("{case ");
X			print_int(n);
X			print_char('}');
X			end_diagnostic(FALSE);
X		}
X		while (n != 0) {
X			pass_text();
X			if (cond_ptr == save_cond_ptr) {
X				if (cur_chr == OR_CODE)
X					decr(n);
X				else goto common_end;
X			} else if (cur_chr == FI_CODE)
X				pop_cond();
X		}
X		change_if_limit(OR_CODE, save_cond_ptr);
X		return;
X	
X	default:
X		break;
X	}
X
X	if (tracing_commands > 1) {
X		begin_diagnostic();
X		print(b ? "{true}" : "{false}");
X		end_diagnostic(FALSE);
X	}
X
X	if (b) {
X		change_if_limit(ELSE_CODE, save_cond_ptr);
X		return;
X	}
X
X	loop {
X		pass_text(); 
X		if (cond_ptr == save_cond_ptr) {
X			if (cur_chr != OR_CODE)
X				goto common_end;
X			print_err("Extra ");
X			print_esc("or");
X			help_or();
X			error();
X		} else if (cur_chr == FI_CODE)
X			pop_cond();
X	}
X
Xcommon_end:
X	if (cur_chr == FI_CODE)
X		pop_cond();
X	else if_limit = FI_CODE;
X}
X
X/*
X *	Help text
X */
X
Xhelp_or ()
X{
X	help1("I'm ignoring this; it doesn't match any \\if.");
X}
X
Xhelp_relation ()
X{
X	help1("I was expecting to see `<', `=', or `>'. Didn't.");
X}
SHAR_EOF
chmod 0444 cond.c || echo "restore of cond.c fails"
set `wc -c cond.c`;Sum=$1
if test "$Sum" != "5483"
then echo original size 5483, current size $Sum;fi
echo "x - extracting cond.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > cond.h &&
X
X/*
X *    Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved.
X *    Copying of this file is granted according to the provisions 
X *    specified in the file COPYING which must accompany this file.
X */
X
X
X/*
X *		cond.h
X */
X
Xglobal	ptr		cond_ptr;
Xglobal	int		cur_if;
Xglobal	int		if_limit;
Xglobal	val		if_line;
X
X#define	IF_NODE_SIZE		2
X#define	if_line_field(M)	mem[M + 1].i
X
X#define	IF_CODE				1
X#define	FI_CODE				2
X#define	ELSE_CODE			3
X#define	OR_CODE				4
X
X#define	IF_CHAR_CODE		0
X#define	IF_CAT_CODE			1
X#define	IF_INT_CODE			2
X#define	IF_DIM_CODE			3
X#define	IF_ODD_CODE			4
X#define	IF_VMODE_CODE		5
X#define	IF_HMODE_CODE		6
X#define	IF_MMODE_CODE		7
X#define	IF_INNER_CODE		8
X#define	IF_VOID_CODE		9
X#define	IF_HBOX_CODE		10
X#define	IF_VBOX_CODE		11
X#define	IFX_CODE			12
X#define	IF_EOF_CODE			13
X#define	IF_TRUE_CODE		14
X#define	IF_FALSE_CODE		15
X#define	IF_CASE_CODE		16
X
Xint		push_cond();
Xint		pop_cond();
Xint		pass_text();
Xint		change_if_limit();
Xint		conditional();
X
Xglobal	long	skip_line;
SHAR_EOF
chmod 0444 cond.h || echo "restore of cond.h fails"
set `wc -c cond.h`;Sum=$1
if test "$Sum" != "1006"
then echo original size 1006, current size $Sum;fi
echo "x - extracting ctexbugs (Text)"
sed 's/^X//' << 'SHAR_EOF' > ctexbugs &&
XArticle 470 of comp.sources.bugs:
XPath: phadfa!csadfa!neumann!munnari!vuwcomp!mark
XFrom: mark at comp.vuw.ac.nz (Mark Davies)
XNewsgroups: comp.text,comp.sources.bugs
XSubject: Patches to Common TeX 2.1
XMessage-ID: <13127 at comp.vuw.ac.nz>
XDate: 12 Dec 87 23:11:32 GMT
XOrganization: Comp Sci, Victoria Univ., Wellington, New Zealand
XLines: 1127
XXref: phadfa comp.text:1013 comp.sources.bugs:470
X
XApologies for the size of this posting and the probable inappropriateness
Xof the newsgroups sent to (they were the most appropriate I could think
Xof).
X
XWhat follows are context diffs of the changes I have made to Common TeX 2.1
Xin an attempt to get it to pass the trip test.
X
XIt includes:
X
Xo Several bug fixes, most importantly one in def.c where the function
X  trap_zero_glue was not getting called due to a missing pair of ().
X
Xo The changes made to TeX in version 2.1 to correct anomalies in
X  discretionary breaks.
X
Xo Various fixes of spelling/punctuation/grammar in the error messages
X
XCommon TeX with these changes almost passes the version of the Trip Test
Xdistributed with the UNIX TeX 2.1 release (the dvi file produced is fine,
Xbut there are a couple of discrepancies in the log file that I am not sure
Xof yet). 
X
XNOTE: Your line numbers will probably differ as I have been adding comments
Xto my version but have not included them here as they would more than
Xtriple the size of this diff.
X
X-- mark
X
Xdiff -c Common.TeX.orig/box.c Common.TeX/box.c
X*** Common.TeX.orig/box.c	Tue Jul 28 17:40:53 1987
X--- Common.TeX/box.c	Tue Dec  1 00:08:03 1987
X***************
X*** 264,270
X  		print_char('*');
X  	else {
X  		print_scaled(width(p));
X! 		print(s);
X  		if (stretch(p) != 0) {
X  			print(" plus ");
X  			print_glue(stretch(p), stretch_order(p), s);
X
X--- 264,270 -----
X  		print_char('*');
X  	else {
X  		print_scaled(width(p));
X! 		if (s) print(s);
X  		if (stretch(p) != 0) {
X  			print(" plus ");
X  			print_glue(stretch(p), stretch_order(p), s);
Xdiff -c Common.TeX.orig/boxlists.c Common.TeX/boxlists.c
X*** Common.TeX.orig/boxlists.c	Tue Jul 28 17:40:54 1987
X--- Common.TeX/boxlists.c	Tue Nov 17 21:27:58 1987
X***************
X*** 665,673
X  			you_cant();
X  			help_delete_last();
X  			if (cur_chr == KERN_NODE)
X! 				help_line[1] = "Try `I\\kern-\\lastkern instead.";
X  			else if (cur_chr != GLUE_NODE)
X! 				help_line[1] = "Perhaps you can make an output routine do it.";
X  			error();
X  		}
X  	} else if (!is_char_node(tail) && type(tail) == cur_chr) {
X
X--- 665,673 -----
X  			you_cant();
X  			help_delete_last();
X  			if (cur_chr == KERN_NODE)
X! 				help_line[1] = "Try `I\\kern-\\lastkern' instead.";
X  			else if (cur_chr != GLUE_NODE)
X! 				help_line[1] = "Perhaps you can make the output routine do it.";
X  			error();
X  		}
X  	} else if (!is_char_node(tail) && type(tail) == cur_chr) {
Xdiff -c Common.TeX.orig/cmds.c Common.TeX/cmds.c
X*** Common.TeX.orig/cmds.c	Tue Jul 28 17:40:55 1987
X--- Common.TeX/cmds.c	Fri Dec  4 14:34:44 1987
X***************
X*** 690,696
X  			break;
X  
X  		case SCROLL_MODE:
X! 			print_esc("scroll"); 
X  			break;
X  
X  		default:
X
X--- 690,696 -----
X  			break;
X  
X  		case SCROLL_MODE:
X! 			print_esc("scrollmode"); 
X  			break;
X  
X  		default:
X***************
X*** 747,753
X  		break;
X  
X  	case LONG_CALL:
X! 		print("long macro"); 
X  		break;
X  
X  	case OUTER_CALL:
X
X--- 747,753 -----
X  		break;
X  
X  	case LONG_CALL:
X! 		print_esc("long macro"); 
X  		break;
X  
X  	case OUTER_CALL:
X***************
X*** 1195,1201
X  primitive("noalign", NO_ALIGN, 0);
X  primitive("noexpand", NO_EXPAND, 0);
X  eq_type(FROZEN_DONT_EXPAND) = DONT_EXPAND;
X! text(FROZEN_DONT_EXPAND) = make_string_given("notexpanded");
X  primitive("nonscript", NON_SCRIPT, 0);
X  primitive("omit", OMIT, 0);
X  primitive("parshape", SET_SHAPE, 0);
X
X--- 1195,1201 -----
X  primitive("noalign", NO_ALIGN, 0);
X  primitive("noexpand", NO_EXPAND, 0);
X  eq_type(FROZEN_DONT_EXPAND) = DONT_EXPAND;
X! text(FROZEN_DONT_EXPAND) = make_string_given("notexpanded:");
X  primitive("nonscript", NON_SCRIPT, 0);
X  primitive("omit", OMIT, 0);
X  primitive("parshape", SET_SHAPE, 0);
Xdiff -c Common.TeX.orig/def.c Common.TeX/def.c
X*** Common.TeX.orig/def.c	Tue Jul 28 17:40:56 1987
X--- Common.TeX/def.c	Mon Dec  7 11:28:08 1987
X***************
X*** 563,569
X  	if (p < GLUE_VAL) {
X  		word_def(l, cur_val);
X  	} else {
X! 		trap_zero_glue;
X  		def(l, GLUE_REF, (ptr) cur_val);
X  	}
X  }
X
X--- 563,569 -----
X  	if (p < GLUE_VAL) {
X  		word_def(l, cur_val);
X  	} else {
X! 		trap_zero_glue();
X  		def(l, GLUE_REF, (ptr) cur_val);
X  	}
X  }
X***************
X*** 602,608
X  	scan_optional_equals();
X  	scan_int();
X  	if (cur_val < 0) {
X! 		print_err("Bad");
X  		print_esc("prevgraf");
X  		help_prevgraf();
X  		int_error(cur_val);
X
X--- 602,608 -----
X  	scan_optional_equals();
X  	scan_int();
X  	if (cur_val < 0) {
X! 		print_err("Bad ");
X  		print_esc("prevgraf");
X  		help_prevgraf();
X  		int_error(cur_val);
X***************
X*** 813,819
X  			use_err_help = TRUE;
X  		else if (long_help_seen)
X  			help_err_msg();
X! 		else help_poirot();
X  		error();
X  		use_err_help = FALSE;
X  	}
X
X--- 818,828 -----
X  			use_err_help = TRUE;
X  		else if (long_help_seen)
X  			help_err_msg();
X! 		else {
X! 			if (interaction < ERROR_STOP_MODE)
X! 				long_help_seen = TRUE;
X! 			help_poirot();
X! 		}
X  		error();
X  		use_err_help = FALSE;
X  	}
X***************
X*** 915,924
X  help_missing_cs ()
X  {
X  	help5("Please don't say `\\def cs{...}', say `\\def\\cs{...}'.",
X! 	"I've inserted an innaccessible control sequence so that your",
X  	"definition will be completed without mixing me up too badly.",
X  	"You can recover graciously from this error, if you're",
X! 	"careful; see excersize 27.2 in the TeXbook.");
X  }
X  
X  help_prefix ()
X
X--- 928,937 -----
X  help_missing_cs ()
X  {
X  	help5("Please don't say `\\def cs{...}', say `\\def\\cs{...}'.",
X! 	"I've inserted an inaccessible control sequence so that your",
X  	"definition will be completed without mixing me up too badly.",
X  	"You can recover graciously from this error, if you're",
X! 	"careful; see exercise 27.2 in The TeXbook.");
X  }
X  
X  help_prefix ()
X***************
X*** 971,977
X  
X  help_font_magnification ()
X  {
X! 	help1("The magnification ratio must be between 1 and 32768");
X  }
X  
X  help_mag()
X
X--- 984,990 -----
X  
X  help_font_magnification ()
X  {
X! 	help1("The magnification ratio must be between 1 and 32768.");
X  }
X  
X  help_mag()
Xdiff -c Common.TeX.orig/eq.c Common.TeX/eq.c
X*** Common.TeX.orig/eq.c	Tue Jul 28 17:40:56 1987
X--- Common.TeX/eq.c	Mon Nov 30 23:48:57 1987
X***************
X*** 380,386
X  		break;
X  
X  	case DISPLAY_INDENT_CODE:
X! 		print_esc("diplayindent"); 
X  		break;
X  
X  	case DISPLAY_WIDTH_CODE:
X
X--- 380,386 -----
X  		break;
X  
X  	case DISPLAY_INDENT_CODE:
X! 		print_esc("displayindent"); 
X  		break;
X  
X  	case DISPLAY_WIDTH_CODE:
Xdiff -c Common.TeX.orig/error.c Common.TeX/error.c
X*** Common.TeX.orig/error.c	Tue Jul 28 17:40:57 1987
X--- Common.TeX/error.c	Tue Dec  1 00:22:44 1987
X***************
X*** 328,335
X  
X  help_wounded () 
X  {
X! 	help2("One of your earlier faux pas has wounded me deeply,",
X! 	"so I'm barely conscious. Please fix it and try again.");
X  }
X  
X  help_interrupt () 
X
X--- 328,335 -----
X  
X  help_wounded () 
X  {
X! 	help2("One of your faux pas seems to have wounded me deeply...",
X! 	"in fact, I'm barely conscious. Please fix it and try again.");
X  }
X  
X  help_interrupt () 
X***************
X*** 336,340
X  {
X  	help3("You rang?",
X  	"Try to insert some instructions for me (e.g., `I\\showlists),",
X! 	"unless you just want to jump out by typing `X'.");
X  }
X
X--- 336,340 -----
X  {
X  	help3("You rang?",
X  	"Try to insert some instructions for me (e.g., `I\\showlists),",
X! 	"unless you just want to quit by typing `X'.");
X  }
Xdiff -c Common.TeX.orig/eval.c Common.TeX/eval.c
X*** Common.TeX.orig/eval.c	Tue Jul 28 17:40:57 1987
X--- Common.TeX/eval.c	Tue Nov 17 21:25:53 1987
X***************
X*** 718,722
X  	help4("Sorry, but I'm not programmed to handle this case;",
X  	"I'll just pretend that you didn't ask for it.",
X  	"If you're in the wrong mode, you might be able to",
X! 	"return to the right one by typing `I}' or `I\par'.");
X  }
X
X--- 718,722 -----
X  	help4("Sorry, but I'm not programmed to handle this case;",
X  	"I'll just pretend that you didn't ask for it.",
X  	"If you're in the wrong mode, you might be able to",
X! 	"return to the right one by typing `I}' or `I$' or `I\\par'.");
X  }
Xdiff -c Common.TeX.orig/expand.c Common.TeX/expand.c
X*** Common.TeX.orig/expand.c	Tue Jul 28 17:40:58 1987
X--- Common.TeX/expand.c	Wed Dec  2 14:27:01 1987
X***************
X*** 442,448
X  {
X  	help6("I've run across a `}' that doesn't seem to match anything.",
X  	"For example, `\\def\\a#1{...}' and `\\a}' would produce",
X! 	"this error. If you simply proceed nw, the `\\par' that",
X  	"I've just inserted will cause me to report a runaway",
X  	"argument that might be the root of the problem. But if",
X  	"your `}' was spurious, just type `2' and it will go away.");
X
X--- 482,488 -----
X  {
X  	help6("I've run across a `}' that doesn't seem to match anything.",
X  	"For example, `\\def\\a#1{...}' and `\\a}' would produce",
X! 	"this error. If you simply proceed now, the `\\par' that",
X  	"I've just inserted will cause me to report a runaway",
X  	"argument that might be the root of the problem. But if",
X  	"your `}' was spurious, just type `2' and it will go away.");
X***************
X*** 460,466
X  help_cs ()
X  {
X  	help2("The control sequence marked <to be read again> should",
X! 	"not appear between \\csname and \\endcsname");
X  }
X  
X  help_extra_if ()
X
X--- 500,506 -----
X  help_cs ()
X  {
X  	help2("The control sequence marked <to be read again> should",
X! 	"not appear between \\csname and \\endcsname.");
X  }
X  
X  help_extra_if ()
Xdiff -c Common.TeX.orig/fmt.c Common.TeX/fmt.c
X*** Common.TeX.orig/fmt.c	Tue Jul 28 17:40:59 1987
X--- Common.TeX/fmt.c	Fri Dec  4 15:24:33 1987
X***************
X*** 409,415
X  		dump_int(exten_base[k]);
X  		dump_int(param_base[k]);
X  		dump_int(font_glue[k]);
X! 		print_nl("\\font ");
X  		print_esc("");
X  		print_str(font_id_text(k));
X  		print_char('=');
X
X--- 409,415 -----
X  		dump_int(exten_base[k]);
X  		dump_int(param_base[k]);
X  		dump_int(font_glue[k]);
X! 		print_nl("\\font");
X  		print_esc("");
X  		print_str(font_id_text(k));
X  		print_char('=');
Xdiff -c Common.TeX.orig/hash.c Common.TeX/hash.c
X*** Common.TeX.orig/hash.c	Tue Jul 28 17:40:59 1987
X--- Common.TeX/hash.c	Tue Dec  1 16:24:08 1987
X***************
X*** 86,96
X  					print_char(' ');
X  			}
X  		} else if (p < ACTIVE_BASE)
X! 			print_esc("IMPOSSIBLE");
X  		else print_str(p - ACTIVE_BASE);
X  	} else if (p >= UNDEFINED_CONTROL_SEQUENCE)
X  		print_esc("IMPOSSIBLE.");
X! 	else if (text(p) < 0 || text(p) > str_ptr)
X  		print_esc("NONEXISTENT.");
X  	else {
X  		print_esc("");
X
X--- 108,118 -----
X  					print_char(' ');
X  			}
X  		} else if (p < ACTIVE_BASE)
X! 			print_esc("IMPOSSIBLE.");
X  		else print_str(p - ACTIVE_BASE);
X  	} else if (p >= UNDEFINED_CONTROL_SEQUENCE)
X  		print_esc("IMPOSSIBLE.");
X! 	else if (text(p) < 0 || text(p) >= str_ptr)
X  		print_esc("NONEXISTENT.");
X  	else {
X  		print_esc("");
Xdiff -c Common.TeX.orig/hyph.c Common.TeX/hyph.c
X*** Common.TeX.orig/hyph.c	Tue Jul 28 17:41:00 1987
X--- Common.TeX/hyph.c	Tue Nov 17 19:27:37 1987
X***************
X*** 703,709
X  				}
X  				if (trie_o[q] != MIN_QUARTERWORD) {
X  					print_err("Duplicate pattern");
X! 					help1("(See Appendix H)");
X  					error();
X  				}
X  				trie_o[q] = v;
X
X--- 703,709 -----
X  				}
X  				if (trie_o[q] != MIN_QUARTERWORD) {
X  					print_err("Duplicate pattern");
X! 					help1("(See Appendix H.)");
X  					error();
X  				}
X  				trie_o[q] = v;
X***************
X*** 718,724
X  		default:
X  			print_err("Bad ");
X  			print_esc("patterns");
X! 			help1("(See Appendix H)");
X  			error();
X  			break;
X  		}
X
X--- 718,724 -----
X  		default:
X  			print_err("Bad ");
X  			print_esc("patterns");
X! 			help1("(See Appendix H.)");
X  			error();
X  			break;
X  		}
Xdiff -c Common.TeX.orig/math.c Common.TeX/math.c
X*** Common.TeX.orig/math.c	Tue Jul 28 17:41:01 1987
X--- Common.TeX/math.c	Mon Nov 30 23:43:46 1987
X***************
X*** 246,252
X  show_fraction_noad (p)
X  	ptr		p;
X  {
X! 	print_esc("fraction, thickness");
X  	if (thickness(p) == DEFAULT_CODE)
X  		print("= default");
X  	else print_scaled(thickness(p));
X
X--- 246,252 -----
X  show_fraction_noad (p)
X  	ptr		p;
X  {
X! 	print_esc("fraction, thickness ");
X  	if (thickness(p) == DEFAULT_CODE)
X  		print("= default");
X  	else print_scaled(thickness(p));
Xdiff -c Common.TeX.orig/page.c Common.TeX/page.c
X*** Common.TeX.orig/page.c	Tue Jul 28 17:41:03 1987
X--- Common.TeX/page.c	Wed Nov 25 22:41:29 1987
X***************
X*** 884,890
X  
X  help_box_255 ()
X  {
X! 	help2("You shouldn't use \\box255 except in output routines.",
X  	"Proceed, and I'll discard its present contents.");
X  }
X  
X
X--- 884,890 -----
X  
X  help_box_255 ()
X  {
X! 	help2("You shouldn't use \\box255 except in \\output routines.",
X  	"Proceed, and I'll discard its present contents.");
X  }
X  
X***************
X*** 891,896
X  help_dead_cycles ()
X  {
X  	help3("I've concluded that your \\output is awry; it never does a",
X! 	"\\shipout, so I'm shipping \box255 out myself. Next time",
X  	"increase \\maxdeadcycles if you want me to be more patient!");
X  }
X
X--- 892,897 -----
X  help_dead_cycles ()
X  {
X  	help3("I've concluded that your \\output is awry; it never does a",
X! 	"\\shipout, so I'm shipping \\box255 out myself. Next time",
X  	"increase \\maxdeadcycles if you want me to be more patient!");
X  }
Xdiff -c Common.TeX.orig/par.c Common.TeX/par.c
X*** Common.TeX.orig/par.c	Tue Jul 28 17:41:04 1987
X--- Common.TeX/par.c	Sat Dec  5 13:02:54 1987
X***************
X*** 186,243
X  	int		break_type;
X  {
X  	ptr		s;
X! 	qword	t;
X  	ptr		v;
X  
X  	do_all_six(set_break_width_to_background);
X! 	if (break_type == UNHYPHENATED || cur_p == NULL) {
X! 		for (s = cur_p; s != NULL; s = link(s)) {
X! 			if (is_char_node(s))
X! 				return;
X! 			switch (type(s))
X! 			{
X! 			case GLUE_NODE:
X! 				v = glue_ptr(s);
X! 				break_width[1] -= width(v);
X! 				break_width[2 + stretch_order(v)] -= stretch(v);
X! 				break_width[6] -= shrink(v);
X! 				break;
X! 			
X! 			case PENALTY_NODE:
X! 				break;
X! 			
X! 			case MATH_NODE:
X! 			case KERN_NODE:
X! 				if (subtype(s) == ACC_KERN) 
X! 					return;
X! 				else break_width[1] -= width(s);
X! 				break;
X! 
X! 			default:
X! 				return;
X! 				break;
X! 			}
X! 		}
X! 	} else {
X  		t = replace_count(cur_p);
X! 		s = cur_p;
X  		while (t > 0) {
X  			decr(t);
X! 			s = link(s);
X! 			if (is_char_node(s))
X! 				break_width[1] -= width_char(s);
X  			else {
X! 				switch (type(s))
X  				{
X  				case LIGATURE_NODE:
X! 					break_width[1] -= width_lig_char(s);
X  					break;
X  
X  				case HLIST_NODE:
X  				case VLIST_NODE:
X  				case RULE_NODE:
X  				case KERN_NODE:
X! 					break_width[1] -= width(s);
X  					break;
X  
X  				default:
X
X--- 186,217 -----
X  	int		break_type;
X  {
X  	ptr		s;
X! 	int		t;
X  	ptr		v;
X  
X  	do_all_six(set_break_width_to_background);
X! 	s = cur_p;
X! 	if (break_type > UNHYPHENATED && cur_p != NULL) {
X  		t = replace_count(cur_p);
X! 		v = cur_p;
X! 		s = post_break(cur_p);
X  		while (t > 0) {
X  			decr(t);
X! 			v = link(v);
X! 			if (is_char_node(v)) 
X! 				break_width[1] -= width_char(v);
X  			else {
X! 				switch (type(v))
X  				{
X  				case LIGATURE_NODE:
X! 					break_width[1] -= width_lig_char(v);
X  					break;
X  
X  				case HLIST_NODE:
X  				case VLIST_NODE:
X  				case RULE_NODE:
X  				case KERN_NODE:
X! 					break_width[1] -= width(v);
X  					break;
X  
X  				default:
X***************
X*** 246,252
X  				}
X  			}
X  		}
X! 		for (s = post_break(cur_p); s != NULL; s = link(s)) {
X  			if (is_char_node(s))
X  				break_width[1] += width_char(s);
X  			else {
X
X--- 220,226 -----
X  				}
X  			}
X  		}
X! 		for (; s != NULL; s = link(s)) {
X  			if (is_char_node(s))
X  				break_width[1] += width_char(s);
X  			else {
X***************
X*** 259,276
X  				case HLIST_NODE:
X  				case VLIST_NODE:
X  				case RULE_NODE:
X- 				case KERN_NODE:
X  					break_width[1] += width(s);
X  					break;
X  
X  				default:
X  					confusion("disc2");
X  					break;
X  				}
X  			}
X  		}
X  		break_width[1] += disc_width;
X  	}
X  }
X  
X  try_break (pi, break_type)
X
X--- 233,286 -----
X  				case HLIST_NODE:
X  				case VLIST_NODE:
X  				case RULE_NODE:
X  					break_width[1] += width(s);
X  					break;
X  
X+ 				case KERN_NODE:
X+ 					if (t == 0 && subtype(s) != ACC_KERN)
X+ 						t = -1;	/* discardable */
X+ 					else
X+ 						break_width[1] += width(s);
X+ 					break;
X+ 					
X  				default:
X  					confusion("disc2");
X  					break;
X  				}
X  			}
X+ 			incr(t);
X  		}
X  		break_width[1] += disc_width;
X+ 		if (t == 0)
X+ 			s = link(v); /* more nodes may be discardable after
X+ 					the break */
X  	}
X+ 	for (; s != NULL; s = link(s)) {
X+ 		if (is_char_node(s))
X+ 			return;
X+ 		switch (type(s)) {
X+ 		      case GLUE_NODE:
X+ 			v = glue_ptr(s);
X+ 			break_width[1] -= width(v);
X+ 			break_width[2 + stretch_order(v)] -= stretch(v);
X+ 			break_width[6] -= shrink(v);
X+ 			break;
X+ 			
X+ 		      case PENALTY_NODE:
X+ 			break;
X+ 			
X+ 		      case MATH_NODE:
X+ 		      case KERN_NODE:
X+ 			if (subtype(s) == ACC_KERN) 
X+ 				return;
X+ 			else break_width[1] -= width(s);
X+ 			break;
X+ 
X+ 		      default:
X+ 			return;
X+ 			break;
X+ 		}
X+ 	}
X  }
X  
X  try_break (pi, break_type)
X***************
X*** 971,980
X  					}
X  					link(q) = r;
X  					disc_break = TRUE;
X! 				}
X! 				if (!is_char_node(q) && 
X! 					(type(q) == MATH_NODE || type(q) == KERN_NODE))
X! 					width(q) = 0;
X  			}
X  		} else {
X  			q = temp_head; 
X
X--- 981,990 -----
X  					}
X  					link(q) = r;
X  					disc_break = TRUE;
X! 				} else
X! 					if (type(q) == MATH_NODE ||
X! 					    type(q) == KERN_NODE)
X! 						width(q) = 0;
X  			}
X  		} else {
X  			q = temp_head; 
Xdiff -c Common.TeX.orig/print.c Common.TeX/print.c
X*** Common.TeX.orig/print.c	Tue Jul 28 17:41:04 1987
X--- Common.TeX/print.c	Sun Nov 29 12:22:22 1987
X***************
X*** 304,310
X  			print_char(*j);
X  			n -= v;
X  		}
X! 		if (n == 0) return;
X  		k = j + 2;
X  		u = v / (*(k - 1) - '0');
X  		if (*(k - 1) == '2')  {
X
X--- 324,330 -----
X  			print_char(*j);
X  			n -= v;
X  		}
X! 		if (n <= 0) return; /* nonpositive input produces no output */
X  		k = j + 2;
X  		u = v / (*(k - 1) - '0');
X  		if (*(k - 1) == '2')  {
Xdiff -c Common.TeX.orig/scan.c Common.TeX/scan.c
X*** Common.TeX.orig/scan.c	Tue Jul 28 17:41:05 1987
X--- Common.TeX/scan.c	Mon Dec  7 12:56:32 1987
X***************
X*** 245,250
X  		case GLUE_VAL:
X  			cur_val = skip(cur_val);
X  			break;
X  		}
X  		cur_val_level = m;
X  		break;
X
X--- 286,295 -----
X  		case GLUE_VAL:
X  			cur_val = skip(cur_val);
X  			break;
X+ 
X+ 		case MU_VAL:
X+ 			cur_val = mu_skip(cur_val);
X+ 			break;
X  		}
X  		cur_val_level = m;
X  		break;
X***************
X*** 363,369
X  	scan_int();
X  	if (cur_val < 0 || cur_val > 255) {
X  		print_err("Bad character code");
X! 		help_char();
X  		int_error(cur_val);
X  		cur_val = 0;
X  	}
X
X--- 408,414 -----
X  	scan_int();
X  	if (cur_val < 0 || cur_val > 255) {
X  		print_err("Bad character code");
X! 		help_char_num();
X  		int_error(cur_val);
X  		cur_val = 0;
X  	}
X***************
X*** 741,748
X  
X  help_mathchar ()
X  {
X! 	help2("A numeric \\mathchar code must be between 0 and 32767.",
X! 	"I changed this one to zero");
X  }
X  
X  help_number ()
X
X--- 841,848 -----
X  
X  help_mathchar ()
X  {
X! 	help2("A numeric math code must be between 0 and 32767.",
X! 	"I changed this one to zero.");
X  }
X  
X  help_number ()
X***************
X*** 753,762
X  
X  help_char ()
X  {
X! 	help2("The numeric code following \\char must be between 0 and 255.",
X  	"I changed this one to zero.");
X  }
X  
X  help_char_const ()
X  {
X  	help2("A one-character control sequence belongs after a ` mark.",
X
X--- 853,868 -----
X  
X  help_char ()
X  {
X! 	help2("The numeric code for a character must be between 0 and 127.",
X  	"I changed this one to zero.");
X  }
X  
X+ help_char_num ()
X+ {
X+ 	help2("A character number must be between 0 and 255.",
X+ 	"I changed this one to zero.");
X+ }
X+ 
X  help_char_const ()
X  {
X  	help2("A one-character control sequence belongs after a ` mark.",
X***************
X*** 772,779
X  help_missing_number ()
X  {
X  	help3("A number should have been here; I inserted `0'.",
X! 	"(If you can't figure out why I needed a number,",
X! 	"look up `weird error' in the TeX manual index.)");
X  }
X  
X  help_filll ()
X
X--- 878,885 -----
X  help_missing_number ()
X  {
X  	help3("A number should have been here; I inserted `0'.",
X! 	"(If you can't figure out why I needed to see a number,",
X! 	"look up `weird error' in the index to The TeXbook.)");
X  }
X  
X  help_filll ()
X***************
X*** 783,792
X  
X  help_mu ()
X  {
X! 	help4("The unit of measurement in \\mskip glue must be mu.",
X  	"To recover gracefully from this error, it's best to",
X! 	"delete the erroneous units; e.g. type `2' to delete",
X! 	"two letters. (See Chapter 27 of the manual.)");
X  }
X  
X  help_mu_error ()
X
X--- 889,898 -----
X  
X  help_mu ()
X  {
X! 	help4("The unit of measurement in math glue must be mu.",
X  	"To recover gracefully from this error, it's best to",
X! 	"delete the erroneous units; e.g., type `2' to delete",
X! 	"two letters. (See Chapter 27 of The TeXbook.)");
X  }
X  
X  help_mu_error ()
X***************
X*** 812,819
X  
X  help_thee ()
X  {
X! 	help2("I'm forgetting what you said",
X! 	"and using zero for this \\the.");
X  }
X  
X  help_left ()
X
X--- 918,924 -----
X  
X  help_thee ()
X  {
X! 	help1("I'm forgetting what you said and using zero instead.");
X  }
X  
X  help_left ()
X***************
X*** 840,844
X  
X  help_reg ()
X  {
X! 	help1("I'm forgetting what you said and not changing anything.");
X  }
X
X--- 945,950 -----
X  
X  help_reg ()
X  {
X! 	help2("A register number must be between 0 and 255.",
X! 	      "I changed this one to zero.");
X  }
Xdiff -c Common.TeX.orig/tex.c Common.TeX/tex.c
X*** Common.TeX.orig/tex.c	Tue Jul 28 17:41:06 1987
X--- Common.TeX/tex.c	Fri Dec  4 15:38:58 1987
X***************
X*** 35,41
X  #include "print.h"
X  #include "page.h"
X  
X! char		banner[] = "This is Common TeX, Version 2.1";
X  int			ready_already;
X  
X  main (argc, argv)
X
X--- 35,41 -----
X  #include "print.h"
X  #include "page.h"
X  
X! char		banner[] = "This is Common TeX, Version 2.1.1";
X  int			ready_already;
X  
X  main (argc, argv)
Xdiff -c Common.TeX.orig/texext.c Common.TeX/texext.c
X*** Common.TeX.orig/texext.c	Tue Jul 28 17:41:06 1987
X--- Common.TeX/texext.c	Mon Dec  7 16:19:42 1987
X***************
X*** 124,130
X  	 
X  	case CLOSE_NODE: 
X  		print_write("closeout", p); 
X- 		print_int(write_stream(p)); 
X  		break; 
X  	
X  	case SPECIAL_NODE: 
X
X--- 124,129 -----
X  	 
X  	case CLOSE_NODE: 
X  		print_write("closeout", p); 
X  		break; 
X  	
X  	case SPECIAL_NODE: 
X***************
X*** 353,358
X  
X  help_unbal_write ()
X  {
X! 	help2("On this page there's a \\write with fewer real {'s than }'s",
X  	"I can't handle that very well; good luck.");
X  }
X
X--- 358,363 -----
X  
X  help_unbal_write ()
X  {
X! 	help2("On this page there's a \\write with fewer real {'s than }'s.",
X  	"I can't handle that very well; good luck.");
X  }
Xdiff -c Common.TeX.orig/tfm.c Common.TeX/tfm.c
X*** Common.TeX.orig/tfm.c	Tue Jul 28 17:41:07 1987
X--- Common.TeX/tfm.c	Fri Dec  4 15:24:42 1987
X***************
X*** 68,74
X  	{print_err("Font "); sprint_cs(u); \
X  	print_char('='); print_file_name(nom, aire, null_str); \
X  	if (s >= 0) {print(" at "); print_scaled(s); print("pt");} \
X! 	else if (s != -1000) {print(" scaled "); print_scaled(-s);}}
X  
X  #define	get_font_byte() \
X  	(font_byte = getc(tfm_file))
X
X--- 68,74 -----
X  	{print_err("Font "); sprint_cs(u); \
X  	print_char('='); print_file_name(nom, aire, null_str); \
X  	if (s >= 0) {print(" at "); print_scaled(s); print("pt");} \
X! 	else if (s != -1000) {print(" scaled "); print_int(-s);}}
X  
X  #define	get_font_byte() \
X  	(font_byte = getc(tfm_file))
X***************
X*** 416,422
X  {
X  	if (tracing_lost_chars > 0) {
X  		begin_diagnostic();
X! 		print("Missing character: There is no ");
X  		print_ASCII(c);
X  		print(" in font ");
X  		print_str(font_name[f]);
X
X--- 447,453 -----
X  {
X  	if (tracing_lost_chars > 0) {
X  		begin_diagnostic();
X! 		print_nl("Missing character: There is no ");
X  		print_ASCII(c);
X  		print(" in font ");
X  		print_str(font_name[f]);
X***************
X*** 479,485
X  help_font_param ()
X  {
X  	help2("To increase the number of font parameters, you must",
X! 	"use \\fontdimen immediately after the font code is defined.");
X  }
X  
X  help_font_cs ()
X
X--- 516,522 -----
X  help_font_param ()
X  {
X  	help2("To increase the number of font parameters, you must",
X! 	"use \\fontdimen immediately after the \\font is loaded.");
X  }
X  
X  help_font_cs ()
Xdiff -c Common.TeX.orig/token.c Common.TeX/token.c
X*** Common.TeX.orig/token.c	Tue Jul 28 17:41:07 1987
X--- Common.TeX/token.c	Wed Dec  2 14:09:58 1987
X***************
X*** 508,515
X  {
X  	help4("I suspect you have forgotten a `}', causing me",
X  	"to read past where you wanted me to stop.",
X! 	"Either type `I}' to try recovering,",
X! 	"or type 'X' and fix your file.");
X  }
X  
X  help_funny ()
X
X--- 535,542 -----
X  {
X  	help4("I suspect you have forgotten a `}', causing me",
X  	"to read past where you wanted me to stop.",
X! 	"I'll try to recover; but if the error is serious,",
X! 	"you'd better type `E' or `X' now and fix your file.");
X  }
X  
X  help_funny ()
Xdiff -c Common.TeX.orig/tokenlists.c Common.TeX/tokenlists.c
X*** Common.TeX.orig/tokenlists.c	Tue Jul 28 17:41:08 1987
X--- Common.TeX/tokenlists.c	Sat Dec  5 15:31:25 1987
X***************
X*** 400,406
X  		else {
X  			m = token(p) / 0400;
X  			c = token(p) % 0400;
X! 			if (m < 0 || c > 127)
X  				print_esc("BAD.");
X  			else {
X  				switch (m)
X
X--- 492,498 -----
X  		else {
X  			m = token(p) / 0400;
X  			c = token(p) % 0400;
X! 			if (token(p) < 0 || c > 127)
X  				print_esc("BAD.");
X  			else {
X  				switch (m)
X***************
X*** 418,429
X  					break;
X  				
X  				case MAC_PARAM:
X! 					print_char(c);
X! 					print_char(c);
X  					break;
X  				
X  				case OUT_PARAM:
X! 					print_char(match_chr);
X  					if (c <= 9)
X  						print_char(c + '0');
X  					else {
X
X--- 510,521 -----
X  					break;
X  				
X  				case MAC_PARAM:
X! 					print_str(c);
X! 					print_str(c);
X  					break;
X  				
X  				case OUT_PARAM:
X! 					print_str(match_chr);
X  					if (c <= 9)
X  						print_char(c + '0');
X  					else {
X***************
X*** 434,440
X  				
X  				case MATCH:
X  					match_chr = c;
X! 					print_char(c);
X  					incr(n);
X  					print_char(n);
X  					if (n > '9')
X
X--- 526,532 -----
X  				
X  				case MATCH:
X  					match_chr = c;
X! 					print_str(c);
X  					incr(n);
X  					print_char(n);
X  					if (n > '9')
Xdiff -c Common.TeX.orig/tokenstack.c Common.TeX/tokenstack.c
X*** Common.TeX.orig/tokenstack.c	Tue Jul 28 17:41:08 1987
X--- Common.TeX/tokenstack.c	Fri Dec  4 16:45:50 1987
X***************
X*** 282,288
X  					for (i = start; i < j; incr(i)) {
X  						if (i == loc)
X  							set_trick_count();
X! 						print_char(buffer[i]);
X  					}
X  				}
X  			} else {
X
X--- 337,343 -----
X  					for (i = start; i < j; incr(i)) {
X  						if (i == loc)
X  							set_trick_count();
X! 						print_str(buffer[i]);
X  					}
X  				}
X  			} else {
X-- 
XDomainised:  mark at comp.vuw.ac.nz	Bang form: ...!uunet!vuwcomp!mark
X
X
SHAR_EOF
chmod 0444 ctexbugs || echo "restore of ctexbugs fails"
set `wc -c ctexbugs`;Sum=$1
if test "$Sum" != "27054"
then echo original size 27054, current size $Sum;fi
echo "x - extracting def.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > def.c &&
X
X/*
X *    Copyright 1986, 1987 Pat Joseph Monardo. All rights reserved.
X *    Copying of this file is granted according to the provisions 
X *    specified in the file COPYING which must accompany this file.
X */
X
X
X/*
X *		def.c
X */
X
X#include "tex.h"
X#include "cmds.h"
X#include "heap.h"
X#include "io.h"
X#include "eq.h"
X#include "hash.h"
X#include "eqstack.h"
X#include "evalstack.h"
X#include "hash.h"
X#include "token.h"
X#include "scan.h"
X#include "tokenstack.h"
X#include "expand.h"
X#include "arith.h"
X#include "str.h"
X#include "box.h"
X#include "boxlists.h"
X#include "tokenlists.h"
X#include "file.h"
X#include "tfm.h"
X#include "dvi.h"
X#include "page.h"
X#include "print.h"
X#include "error.h"
X#include "def.h"
X
Xhword	after_token;
Xbool	long_help_seen;
Xval		mag_set;
X
X#define	glob	(a >= 4)
X
X#define	def(code, type, value) \
X	{if (glob) \
X		geq_define(code, type, value); \
X	else eq_define(code, type, value);}
X
X#define	word_def(code, value) \
X	{if (glob) \
X		geq_word_define(code, value); \
X	else eq_word_define(code, value);}
X
Xget_r_token ()
X{
Xrestart:
X	do get_token();
X	while (cur_tok == SPACE_TOKEN);
X	if (cur_cs == 0 || cur_cs > FROZEN_CONTROL_SEQUENCE) {
X		print_err("Missing control sequence inserted");
X		help_missing_cs();
X		if (cur_cs == 0) back_input();
X		cur_tok = CS_TOKEN_FLAG + FROZEN_PROTECTION;
X		ins_error();
X		goto restart;
X	}
X}
X
Xprefixed_command ()
X{
X	int		a;
X	bool	e;
X	fnt		f;
X	int		j;
X	int		k;
X	val		n;
X	ptr		p;
X	ptr		q;
X
X	a = 0;
X	while (cur_cmd == PREFIX) {
X		if (!odd(a / cur_chr))
X			a += cur_chr;
X		get_nbrx_token();
X		if (cur_cmd <= MAX_NON_PREFIXED_COMMAND) {
X			print_err("You can't use a prefix with `");
X			print_cmd_chr(cur_cmd, cur_chr);
X			print("'");
X			help_prefix();
X			back_error();
X			return;
X		}
X	}
X
X	if (cur_cmd != DEF && a % 4 != 0) {
X		print_err("You can't use `");
X		print_esc("long");
X		print("' or `");
X		print_esc("outer");
X		print("' with `");
X		print_cmd_chr(cur_cmd, cur_chr);
X		print("'");
X		help_pref();
X		error();
X	}
X
X	if (global_defs != 0) {
X		if (global_defs < 0) {
X			if (glob) a -= 4;
X		} else {
X			if (!glob) a += 4;
X		}
X	}
X
X	switch (cur_cmd)
X	{
X	case SET_FONT:
X		def(CUR_FONT_LOC, DATA, cur_chr);
X		break;
X
X	case DEF:
X		if (odd(cur_chr) && !glob && global_defs >= 0)
X			a += 4;
X		e = (cur_chr >= 2);
X		get_r_token();
X		p = cur_cs;
X		scan_toks(TRUE, e);
X		def(p, CALL + (a % 4), def_ref);
X		break;
X
X	case LET:
X		n = cur_chr;
X		get_r_token();
X		p = cur_cs;
X		if (n == NORMAL) {
X			do	get_token();
X			while (cur_cmd == SPACER);
X			if (cur_tok == OTHER_TOKEN + '=') {
X				get_token();
X				if (cur_cmd == SPACER)
X					get_token();
X			}
X		} else {
X			get_token();
X			q = cur_tok;
X			get_token();
X			back_input();
X			cur_tok = q;
X			back_input();
X		}
X		if (cur_cmd >= CALL)
X			add_token_ref(cur_chr);
X		def(p, cur_cmd, cur_chr);
X		break;
X	
X	case SHORTHAND_DEF:
X		n = cur_chr;
X		get_r_token();
X		p = cur_cs; 
X		def(p, RELAX, 256);
X		scan_optional_equals();
X		switch ((hword) n)
X		{
X		case CHAR_DEF_CODE:
X			scan_char_num();
X			def(p, CHAR_GIVEN, (hword) cur_val);
X			break;
X
X		case MATH_CHAR_DEF_CODE:
X			scan_fifteen_bit_int();
X			def(p, MATH_GIVEN, (hword) cur_val);
X			break;
X
X		default:
X			scan_eight_bit_int();
X			switch ((hword) n)
X			{
X			case COUNT_DEF_CODE:
X				def(p, ASSIGN_INT, (hword) (COUNT_BASE + cur_val));
X				break;
X
X			case DIMEN_DEF_CODE:
X				def(p, ASSIGN_DIMEN, (hword) (SCALED_BASE + cur_val));
X				break;
X
X			case SKIP_DEF_CODE:
X				def(p, ASSIGN_GLUE, (hword) (SKIP_BASE + cur_val));
X				break;
X
X			case MU_SKIP_DEF_CODE:
X				def(p, ASSIGN_MU_GLUE, (hword) (MU_SKIP_BASE + cur_val));
X				break;
X
X			case TOKS_DEF_CODE:
X				def(p, ASSIGN_TOKS, (hword) (TOKS_BASE + cur_val));
X				break;
X			}
X			break;
X		}
X		break;
X
X	case READ_TO_CS:
X		scan_int();
X		n = (int) cur_val;
X		if (!scan_keyword("to")) {
X			print_err("Missing `to' inserted");
X			help_read_to();
X			error();
X		}
X		get_r_token();
X		p = cur_cs;
X		read_toks(n, p);
X		def(p, CALL, (hword) cur_val);
X		break;
X	
X	case TOKS_REGISTER:
X	case ASSIGN_TOKS:
X		q = cur_cs;
X		if (cur_cmd == TOKS_REGISTER) {
X			scan_eight_bit_int();
X			p = TOKS_BASE + cur_val;
X		} else p = cur_chr;
X		scan_optional_equals();
X		get_nbrx_token();
X		if (cur_cmd != LEFT_BRACE) {
X			if (cur_cmd == TOKS_REGISTER) {
X				scan_eight_bit_int();
X				cur_cmd = ASSIGN_TOKS;
X				cur_chr = TOKS_BASE + cur_val;
X			}
X			if (cur_cmd == ASSIGN_TOKS) {
X				q = equiv(cur_chr);
X				if (q == NULL) {
X					def(p, UNDEFINED_CS, NULL);
X				} else {	
X					add_token_ref(q);
X					def(p, CALL, q);
X				}
X				break;
X			}
X		}
X		back_input();
X		cur_cs = q;
X		q = scan_toks(FALSE, FALSE);
X		if (token_link(def_ref) == NULL) {
X			def(p, UNDEFINED_CS, NULL);
X			free_token(def_ref);
X		} else {
X			if (p == OUTPUT_ROUTINE_LOC) {
X				token_link(q) = new_token();
X				q = token_link(q);
X				token(q) = RIGHT_BRACE_TOKEN + '}';
X				q = new_token();
X				token(q) = LEFT_BRACE_TOKEN + '{';
X				token_link(q) = token_link(def_ref);
X				token_link(def_ref) = q;
X			}
X			def(p, CALL, def_ref);
X		}
X		break;
X
X	case ASSIGN_INT:
X		p = cur_chr;
X		scan_optional_equals();
X		scan_int();
X		word_def(p, cur_val); 
X		break;
X	
X	case ASSIGN_DIMEN:
X		p = cur_chr;
X		scan_optional_equals();
X		scan_normal_dimen();
X		word_def(p, cur_val); 
X		break;
X	
X	case ASSIGN_GLUE:
X	case ASSIGN_MU_GLUE:
X		p = cur_chr;
X		n = cur_cmd;
X		scan_optional_equals();
X		if (n == ASSIGN_MU_GLUE)
X			scan_glue(MU_VAL);
X		else scan_glue(GLUE_VAL);
X		trap_zero_glue();
X		def(p, GLUE_REF, (ptr) cur_val); 
X		break;
X	
X	case DEF_CODE:
X		if (cur_chr == CAT_CODE_BASE)
X			n = MAX_CHAR_CODE;
X		else if (cur_chr == MATH_CODE_BASE)
X			n = 0100000;
X		else if (cur_chr == SF_CODE_BASE)
X			n = 077777;
X		else if (cur_chr == DEL_CODE_BASE)
X			n = 077777777;
X		else n = 127;
X		p = cur_chr;
X		scan_seven_bit_int();
X		p += cur_val;
X		scan_optional_equals();
X		scan_int(); 
X		if (cur_val < 0 && p < DEL_CODE_BASE || cur_val > n) {
X			print_err("Invalid code (");
X			print_val(cur_val);
X			if (p < DEL_CODE_BASE)
X				print("), should be in the range 0..");
X			else print("), should be at most ");
X			print_val(n);
X			help_code();
X			error();
X			cur_val = 0;
X		}
X		if (p < MATH_CODE_BASE) {
X			def(p, DATA, (hword) cur_val);
X		} else if (p < DEL_CODE_BASE) {
X			def(p, DATA, (hword) hi(cur_val));
X		} else word_def(p, cur_val);
X		break;
X	
X	case DEF_FAMILY:
X		p = cur_chr;
X		scan_four_bit_int();
X		p += cur_val;
X		scan_optional_equals();
X		scan_font_ident();
X		def(p, DATA, (hword) cur_val);
X		break;
X
X	case REGISTER:
X	case ADVANCE:
X	case MULTIPLY:
X	case DIVIDE:
X		do_register_command(a);
X		break;
X	
X	case SET_BOX:
X		scan_eight_bit_int();
X		if (glob)
X			saved(0) = BOX_FLAG + 256 + cur_val;
X		else saved(0) = BOX_FLAG + cur_val;
X		scan_optional_equals();
X		scan_box();
X		break;
X	
X	case SET_AUX:
X		alter_aux();
X		break;
X
X	case SET_PREV_GRAF:
X		alter_prev_graf();
X		break;
X		
X	case SET_PAGE_DIMEN:
X		alter_page_so_far();
X		break;
X
X	case SET_PAGE_INT:
X		alter_integer();
X		break;
X
X	case SET_BOX_DIMEN:
X		alter_box_dimen();
X		break;
X
X	case SET_SHAPE:
X		scan_optional_equals();
X		scan_int();
X		n = cur_val;
X		if (n <= 0)
X			p = NULL;
X		else {
X			p = get_node(2 * n + 1);
X			info(p) = n;
X			for (j = 1; j <= n; incr(j)) {
X				scan_normal_dimen();
X				mem[p + 2 * j - 1].sc = cur_val;
X				scan_normal_dimen();
X				mem[p + 2 * j].sc = cur_val;
X			}
X		}
X		def(PAR_SHAPE_LOC, SHAPE_REF, p);
X		break;
X	
X	case HYPH_DATA:
X#ifdef	INIT
X		if (cur_chr == 1) 
X			new_patterns();
SHAR_EOF
echo "End of part 5"
echo "File def.c is continued in part 6"
echo "6" > s2_seq_.tmp
exit 0



More information about the Comp.unix.xenix mailing list