LaTeX for Xenix (8 of 14)
G Geers
glenn at extro.ucc.su.oz.au
Fri Feb 16 10:40:07 AEST 1990
---- Cut Here and unpack ----
#!/bin/sh
# this is part 8 of a multipart archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file eval.c continued
#
CurArch=8
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 eval.c"
sed 's/^X//' << 'SHAR_EOF' >> eval.c
X */
X
Xhelp_dollar ()
X{
X help2("I've inserted a begin-math/end-math symbol since I think",
X "you left one out. Proceed with fingers crossed.");
X}
X
Xhelp_illegal_case ()
X{
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}
SHAR_EOF
echo "File eval.c is complete"
chmod 0444 eval.c || echo "restore of eval.c fails"
set `wc -c eval.c`;Sum=$1
if test "$Sum" != "12031"
then echo original size 12031, current size $Sum;fi
echo "x - extracting eval.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > eval.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 * Copying of this file is granted according to the provisions
X * specified in the file COPYING which must accompany this file.
X */
X
X
X/*
X * eval.h
X */
X
Xint main_control();
Xint app_space();
Xint insert_dollar_sign();
Xint you_cant();
Xint report_illegal_case();
Xbool privileged();
Xint missing_font();
Xbool its_all_over();
SHAR_EOF
chmod 0444 eval.h || echo "restore of eval.h fails"
set `wc -c eval.h`;Sum=$1
if test "$Sum" != "539"
then echo original size 539, current size $Sum;fi
echo "x - extracting evalstack.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > evalstack.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 * evalstack.c
X */
X
X#include "tex.h"
X#include "cmds.h"
X#include "heap.h"
X#include "str.h"
X#include "arith.h"
X#include "tokenstack.h"
X#include "eq.h"
X#include "box.h"
X#include "page.h"
X#include "print.h"
X#include "error.h"
X#include "evalstack.h"
X
Xlist cur_list;
Xlist nest[NEST_SIZE];
Xptr nest_ptr;
Xint max_nest_stack;
Xint shown_mode;
X
Xpush_nest ()
X{
X if (nest_ptr > max_nest_stack) {
X max_nest_stack = nest_ptr;
X if (nest_ptr == NEST_SIZE)
X overflow("semantic nest size", NEST_SIZE);
X }
X nest[nest_ptr] = cur_list;
X incr(nest_ptr);
X head = get_avail();
X tail = head;
X prev_graf = 0;
X mode_line = line;
X}
X
Xpop_nest ()
X{
X free_avail(head);
X decr(nest_ptr);
X cur_list = nest[nest_ptr];
X}
X
Xprint_mode (m)
X int m;
X{
X if (m > 0) {
X switch (m / (MAX_COMMAND + 1))
X {
X case 0:
X print("vertical");
X break;
X
X case 1:
X print("horizontal");
X break;
X
X case 2:
X print("display math");
X break;
X }
X } else if (m == 0)
X print("no");
X else {
X switch (-m / (MAX_COMMAND + 1))
X {
X case 0:
X print("internal vertical");
X break;
X
X case 1:
X print("restricted horizontal");
X break;
X
X case 2:
X print("math");
X break;
X }
X }
X print(" mode");
X}
X
Xshow_activities ()
X{
X val a;
X int p;
X int m;
X ptr q;
X ptr r;
X val t;
X
X nest[nest_ptr] = cur_list;
X print_nl("");
X print_ln();
X for (p = nest_ptr; p >= 0; decr(p)) {
X m = nest[p].mode_field;
X a = nest[p].aux_field;
X print_nl("### ");
X print_mode(m);
X print(" entered at line ");
X print_val(abs(nest[p].ml_field));
X if (nest[p].ml_field < 0)
X print(" (\\output routine)");
X if (p == 0) {
X if (page_head != page_tail) {
X print_nl("### current page:");
X if (output_active)
X print(" (held over for next output)");
X show_box(link(page_head));
X if (page_contents > EMPTY) {
X print_nl("total height ");
X print_totals();
X print_nl(" goal height ");
X print_scaled(page_goal);
X r = link(page_ins_head);
X while (r != page_ins_head) {
X print_ln();
X print_esc("insert");
X t = qo(subtype(r));
X print_int((int) t);
X print(" adds ");
X t = x_over_n(height(r), 1000L) * count(t);
X print_scaled((scal) t);
X if (type(r) == SPLIT_UP) {
X q = page_head;
X t = 0;
X do {
X q = link(q);
X if (type(q) == INS_NODE &&
X subtype(q) == subtype(r))
X incr(t);
X } while (q != broken_ins(r));
X print(", #");
X print_int((int) t);
X print(" might split");
X }
X r = link(r);
X }
X }
X }
X if (link(contrib_head) != NULL)
X print_nl("### recent contributions:");
X }
X show_box(link(nest[p].head_field));
X switch (abs(m) / (MAX_COMMAND + 1))
X {
X case 0:
X print_nl("prevdepth ");
X if (a <= IGNORE_DEPTH)
X print("ignored");
X else print_scaled((scal) a);
X if (nest[p].pg_field != 0) {
X print(", prevgraf ");
X print_int(nest[p].pg_field);
X print(" line");
X if (nest[p].pg_field != 1)
X print_char('s');
X }
X break;
X
X case 1:
X print_nl("spacefactor ");
X print_int((int) a);
X break;
X
X case 2:
X if (a != NULL) {
X print("this will be a denominator of:");
X show_box((ptr) a);
X }
X break;
X }
X }
X}
SHAR_EOF
chmod 0444 evalstack.c || echo "restore of evalstack.c fails"
set `wc -c evalstack.c`;Sum=$1
if test "$Sum" != "3367"
then echo original size 3367, current size $Sum;fi
echo "x - extracting evalstack.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > evalstack.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 * evalstack.h
X */
X
X#define VMODE 1
X#define HMODE (VMODE + MAX_COMMAND + 1)
X#define MMODE (HMODE + MAX_COMMAND + 1)
X
Xint push_nest();
Xint pop_nest();
Xint print_mode();
X
X#define IGNORE_DEPTH -65536000
X
Xtypedef struct
X{
X int mode_field;
X ptr head_field;
X ptr tail_field;
X int pg_field;
X val aux_field;
X val ml_field;
X}
X list;
X
Xglobal list cur_list;
Xglobal ptr nest_ptr;
Xglobal list nest[];
Xglobal int max_nest_stack;
X
X#define mode cur_list.mode_field
X#define head cur_list.head_field
X#define tail cur_list.tail_field
X#define prev_graf cur_list.pg_field
X#define aux cur_list.aux_field
X#define prev_depth aux
X#define space_factor aux
X#define incompleat_noad aux
X#define mode_line cur_list.ml_field
X
Xglobal int shown_mode;
X
Xint show_activities();
X
X#define tail_append(N) \
X {link(tail) = N; tail = link(tail);}
SHAR_EOF
chmod 0444 evalstack.h || echo "restore of evalstack.h fails"
set `wc -c evalstack.h`;Sum=$1
if test "$Sum" != "1060"
then echo original size 1060, current size $Sum;fi
echo "x - extracting expand.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > expand.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 * expand.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 "box.h"
X#include "tokenstack.h"
X#include "scan.h"
X#include "token.h"
X#include "tokenlists.h"
X#include "cond.h"
X#include "file.h"
X#include "print.h"
X#include "error.h"
X#include "expand.h"
X
Xint long_state;
Xptr pstack[9];
Xptr cur_mark[5];
X
Xget_x_token ()
X{
Xrestart:
X get_next();
X if (cur_cmd <= MAX_COMMAND)
X goto done;
X if (cur_cmd >= CALL) {
X if (cur_cmd < END_TEMPLATE)
X macro_call();
X else {
X cur_cs = FROZEN_ENDV;
X cur_cmd = ENDV;
X goto done;
X }
X } else expand();
X goto restart;
X
Xdone:
X if (cur_cs == 0)
X cur_tok = cur_cmd * 0400 + cur_chr;
X else cur_tok = CS_TOKEN_FLAG + cur_cs;
X}
X
Xexpand ()
X{
X int j;
X ptr p;
X ptr q;
X ptr r;
X hword t;
X int save_scanner_status;
X val cv_backup = cur_val;
X int radix_backup = radix;
X int cvl_backup = cur_val_level;
X ptr backup_backup = token_link(backup_tokens);
X
X if (cur_cmd < CALL) {
X if (tracing_commands > 1)
X show_cur_cmd_chr();
X switch (cur_cmd)
X {
X case TOP_BOT_MARK:
X if (cur_mark[cur_chr] != NULL)
X begin_token_list(cur_mark[cur_chr], MARK_TEXT);
X break;
X
X case EXPAND_AFTER:
X get_token();
X t = cur_tok;
X get_token();
X if (cur_cmd > MAX_COMMAND)
X expand();
X else back_input();
X cur_tok = t;
X back_input();
X break;
X
X case NO_EXPAND:
X save_scanner_status = scanner_status;
X scanner_status = NORMAL;
X get_token();
X scanner_status = save_scanner_status;
X t = cur_tok;
X back_input();
X if (t >= CS_TOKEN_FLAG) {
X p = new_token();
X token(p) = CS_TOKEN_FLAG + FROZEN_DONT_EXPAND;
X token_link(p) = loc;
X start = p;
X loc = p;
X }
X break;
X
X case CS_NAME:
X p = r = new_token();
X do {
X get_x_token();
X if (cur_cs == 0)
X store_new_token(cur_tok);
X } while (cur_cs == 0);
X if (cur_cmd != END_CS_NAME) {
X print_err("Missing ");
X print_esc("endcsname");
X print(" inserted");
X help_cs();
X back_error();
X }
X j = first;
X p = token_link(r);
X while (p != NULL) {
X if (j >= max_buf_stack) {
X max_buf_stack = j + 1;
X if (max_buf_stack == BUF_SIZE)
X overflow("buffer size", BUF_SIZE);
X }
X buffer[j] = token(p) % 0400;
X incr(j);
X p = token_link(p);
X }
X if (j > first + 1) {
X no_new_control_sequence = FALSE;
X cur_cs = id_lookup(first, j - first);
X no_new_control_sequence = TRUE;
X } else if (j == first)
X cur_cs = NULL_CS;
X else cur_cs = SINGLE_BASE + buffer[first];
X flush_list(r);
X if (eq_type(cur_cs) == UNDEFINED_CS)
X eqtb[cur_cs] = eqtb[FROZEN_RELAX];
X cur_tok = cur_cs + CS_TOKEN_FLAG;
X back_input();
X break;
X
X case CONVERT:
X conv_toks();
X break;
X
X case THE:
X ins_the_toks();
X break;
X
X case IF_TEST:
X conditional();
X break;
X
X case FI_OR_ELSE:
X if (cur_chr > if_limit) {
X if (if_limit == IF_CODE) {
X insert_relax();
X } else {
X print_err("Extra ");
X print_cmd_chr(FI_OR_ELSE, cur_chr);
X help_extra_if();
X error();
X }
X } else {
X while (cur_chr != FI_CODE)
X pass_text();
X pop_cond();
X }
X break;
X
X case INPUT:
X if (cur_chr > 0)
X force_eof = TRUE;
X else if (name_in_progress)
X insert_relax();
X else start_input();
X break;
X
X default:
X print_err("Undefined control sequence");
X help_undefd();
X error();
X break;
X }
X } else if (cur_cmd < END_TEMPLATE)
X macro_call();
X else {
X cur_tok = CS_TOKEN_FLAG + FROZEN_ENDV;
X back_input();
X }
X cur_val = cv_backup;
X cur_val_level = cvl_backup;
X radix = radix_backup;
X token_link(backup_tokens) = backup_backup;
X}
X
Xinsert_relax ()
X{
X cur_tok = CS_TOKEN_FLAG + cur_cs;
X back_input();
X cur_tok = CS_TOKEN_FLAG + FROZEN_RELAX;
X back_input();
X token_type = INSERTED;
X}
X
X#define runaway_arg() \
X {if (long_state == CALL) { \
X runaway(); \
X print_err("Paragraph ended before "); \
X sprint_cs(warning_index); \
X print(" was complete"); \
X help_runaway(); \
X back_error();} \
X pstack[n] = token_link(temp_toks); \
X align_state -= unbalance; \
X for (m = 0; m <= n; incr(m)) \
X flush_list(pstack[m]); \
X goto local_exit;}
X
Xmacro_call ()
X{
X int m;
X int n;
X ptr p;
X ptr q;
X ptr r;
X ptr s;
X ptr t;
X ptr u;
X ptr v;
X ascii match_chr;
X ptr ref_count;
X ptr rbrace_ptr;
X ptr save_warning_index;
X int save_scanner_status;
X int unbalance;
X
X n = 0;
X ref_count = cur_chr;
X r = token_link(ref_count);
X save_scanner_status = scanner_status;
X save_warning_index = warning_index;
X warning_index = cur_cs;
X if (tracing_macros > 0) {
X begin_diagnostic();
X print_ln();
X print_cs(warning_index);
X token_show(ref_count);
X end_diagnostic(FALSE);
X }
X if (token(r) != END_MATCH_TOKEN) {
X scanner_status = MATCHING;
X unbalance = 0;
X long_state = eq_type(cur_cs);
X if (long_state >= OUTER_CALL)
X long_state -= 2;
X do {
X if (token(r) > MATCH_TOKEN + 127 ||
X token(r) < MATCH_TOKEN) {
X s = NULL;
X } else {
X match_chr = token(r) - MATCH_TOKEN;
X s = token_link(r);
X r = s;
X p = temp_toks;
X token_link(p) = NULL;
X m = 0;
X }
X
X contin:
X get_token();
X if (cur_tok == token(r)) {
X r = token_link(r);
X if (token(r) >= MATCH_TOKEN &&
X token(r) <= END_MATCH_TOKEN) {
X if (cur_tok < LEFT_BRACE_LIMIT)
X decr(align_state);
X goto found;
X } else goto contin;
X }
X if (s != r) {
X if (s == NULL) {
X print_err("Use of ");
X sprint_cs(warning_index);
X print(" doesn't match its definition");
X help_match();
X error();
X goto local_exit;
X } else {
X t = s;
X do {
X store_new_token(token(t));
X incr(m);
X u = token_link(t);
X v = s;
X loop {
X if (u == r) {
X if (cur_tok != token(v))
X break;
X else {
X r = token_link(v);
X goto contin;
X }
X }
X if (token(u) != token(v))
X break;
X u = token_link(u);
X v = token_link(v);
X }
X t = token_link(t);
X } while (t != r);
X r = s;
X }
X }
X if (cur_tok == par_token && long_state != LONG_CALL)
X runaway_arg();
X if (cur_tok < RIGHT_BRACE_LIMIT) {
X if (cur_tok < LEFT_BRACE_LIMIT) {
X unbalance = 1;
X loop {
X fast_store_new_token(cur_tok);
X get_token();
X if (cur_tok == par_token &&
X long_state != LONG_CALL) {
X runaway_arg();
X }
X if (cur_tok < RIGHT_BRACE_LIMIT) {
X if (cur_tok < LEFT_BRACE_LIMIT)
X incr(unbalance);
X else {
X decr(unbalance);
X if (unbalance == 0)
X break;
X }
X }
X }
X rbrace_ptr = p;
X store_new_token(cur_tok);
X } else {
X back_input();
X print_err("Argument of ");
X sprint_cs(warning_index);
X print(" has an extra `}'");
X help_match_xtra();
X incr(align_state);
X long_state = CALL;
X cur_tok = par_token;
X ins_error();
X }
X } else {
X if (cur_tok == SPACE_TOKEN &&
X token(r) <= END_MATCH_TOKEN &&
X token(r) >= MATCH_TOKEN)
X goto contin;
X store_new_token(cur_tok);
X }
X incr(m);
X if (token(r) > END_MATCH_TOKEN || token(r) < MATCH_TOKEN)
X goto contin;
X
X found:
X if (s != NULL) {
X if (m == 1 &&
X token(p) < RIGHT_BRACE_LIMIT &&
X p != temp_toks) {
X token_link(rbrace_ptr) = NULL;
X free_token(p);
X p = token_link(temp_toks);
X pstack[n] = token_link(p);
X free_token(p);
X } else pstack[n] = token_link(temp_toks);
X incr(n);
X if (tracing_macros > 0) {
X begin_diagnostic();
X print_nl("");
X print_char(match_chr);
X print_int(n);
X print("<-");
X show_token_list(pstack[n - 1], NULL, 1000L);
X end_diagnostic(FALSE);
X }
X }
X } while (token(r) != END_MATCH_TOKEN);
X }
X while (state == TOKEN_LIST && loc == NULL)
X end_token_list();
X begin_token_list(ref_count, MACRO);
X name = warning_index;
X loc = token_link(r);
X if (n > 0) {
X if (param_ptr + n > max_param_stack) {
X max_param_stack = param_ptr + n;
X if (max_param_stack >= PARAM_SIZE)
X overflow("parameter stack size", PARAM_SIZE);
X }
X for (m = 0; m < n; incr(m))
X param_stack[param_ptr + m] = pstack[m];
X param_ptr += n;
X }
X
Xlocal_exit:
X scanner_status = save_scanner_status;
X warning_index = save_warning_index;
X}
X
Xx_token ()
X{
X while (cur_cmd > MAX_COMMAND) {
X expand();
X get_next();
X }
X if (cur_cs == 0)
X cur_tok = cur_cmd * 0400 + cur_chr;
X else cur_tok = CS_TOKEN_FLAG + cur_cs;
X}
X
X/*
X * Help text
X */
X
Xhelp_runaway ()
X{
X help3("I suspect you've forgotten a `}', causing me to apply this",
X "control sequence to too much text. How can we recover?",
X "My plan is to forget the whole thing and hope for the best.");
X}
X
Xhelp_match ()
X{
X help4("If you say, e.g., `\\def\\a1{...}', then you must always",
X "put `1' after `\\a', since control sequence names are",
X "made up of letters only. The macro here has not been",
X "followed by the required stuff, so I'm ignoring it.");
X}
X
Xhelp_match_xtra ()
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
Xhelp_undefd ()
X{
X help5("The control sequence at the end of the top line",
X "of your error message was never \\def'ed. If you have",
X "misspelled it (e.g., `\\hobx'), type `I' and the correct",
X "spelling (e.g., `I\\hbox'). Otherwise just continue,",
X "and I'll forget about whatever was undefined.");
X}
X
Xhelp_cs ()
X{
X help2("The control sequence marked <to be read again> should",
X "not appear between \\csname and \\endcsname.");
X}
X
Xhelp_extra_if ()
X{
X help1("I'm ignoring this; it doesn't match any \\if.");
X}
SHAR_EOF
chmod 0444 expand.c || echo "restore of expand.c fails"
set `wc -c expand.c`;Sum=$1
if test "$Sum" != "9947"
then echo original size 9947, current size $Sum;fi
echo "x - extracting expand.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > expand.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 * expand.h
X */
X
Xint get_x_token();
Xint expand();
Xint insert_relax();
X
X#define TOP_MARK_CODE 0
X#define FIRST_MARK_CODE 1
X#define BOT_MARK_CODE 2
X#define SPLIT_FIRST_MARK_CODE 3
X#define SPLIT_BOT_MARK_CODE 4
X
X#define top_mark cur_mark[TOP_MARK_CODE]
X#define first_mark cur_mark[FIRST_MARK_CODE]
X#define bot_mark cur_mark[BOT_MARK_CODE]
X#define split_first_mark cur_mark[SPLIT_FIRST_MARK_CODE]
X#define split_bot_mark cur_mark[SPLIT_BOT_MARK_CODE]
X
Xglobal ptr cur_mark[];
X
Xglobal int long_state;
Xglobal ptr pstack[];
X
Xint macro_call();
Xint x_token();
SHAR_EOF
chmod 0444 expand.h || echo "restore of expand.h fails"
set `wc -c expand.h`;Sum=$1
if test "$Sum" != "799"
then echo original size 799, current size $Sum;fi
echo "x - extracting file.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > file.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 * file.c
X */
X
X#include "tex.h"
X#include "cmds.h"
X#include "heap.h"
X#include "char.h"
X#include "eq.h"
X#include "token.h"
X#include "scan.h"
X#include "tokenstack.h"
X#include "str.h"
X#include "fmt.h"
X#include "io.h"
X#include "print.h"
X#include "error.h"
X#include "file.h"
X
Xchar name_of_file[FILE_NAME_SIZE];
Xint name_length;
X
Xint area_delimiter;
Xint ext_delimiter;
X
Xstr cur_area;
Xstr cur_name;
Xstr cur_ext;
X
Xbool name_in_progress = FALSE;
Xstr job_area;
Xstr job_name;
Xstr log_name;
Xstr dvi_name;
X
Xalpha_file read_file[16];
X
Xint read_open[17];
X
Xstr str_dvi;
Xstr str_log;
Xstr str_tex;
Xstr str_tfm;
Xstr str_fmt;
Xstr str_texput;
X
Xbool
Xbegin_name ()
X{
X area_delimiter = 0;
X ext_delimiter = 0;
X}
X
Xbool
Xmore_name (c)
X ascii c;
X{
X if (c == ' ')
X return FALSE;
X else {
X if (c == '/') {
X area_delimiter = pool_ptr;
X ext_delimiter = 0;
X } else if (c == '.' && ext_delimiter == 0)
X ext_delimiter = pool_ptr;
X str_room(1);
X append_char(c);
X return TRUE;
X }
X}
X
Xend_name ()
X{
X if (str_ptr + 3 > MAX_STRINGS)
X overflow("number of strings", MAX_STRINGS);
X if (area_delimiter == 0)
X cur_area = null_str;
X else {
X cur_area = str_ptr;
X incr(str_ptr);
X str_start[str_ptr] = area_delimiter + 1;
X }
X if (ext_delimiter == 0) {
X cur_ext = null_str;
X cur_name = make_string();
X } else {
X cur_name = str_ptr;
X incr(str_ptr);
X str_start[str_ptr] = ext_delimiter;
X cur_ext = make_string();
X }
X}
X
X#define append_to_name(F) \
X {c = F; name_of_file[k] = xchr[c]; incr(k);}
X
Xpack_file_name (n, a, e)
X str n;
X str a;
X str e;
X{
X ascii c;
X int j;
X int k;
X
X if (length(a) + length(n) + length(e) >= FILE_NAME_SIZE)
X overflow("file name size", FILE_NAME_SIZE);
X k = 0;
X for (j = str_start[a]; j < str_start[a+1]; incr(j))
X append_to_name(str_pool[j]);
X for (j = str_start[n]; j < str_start[n+1]; incr(j))
X append_to_name(str_pool[j]);
X for (j = str_start[e]; j < str_start[e+1]; incr(j))
X append_to_name(str_pool[j]);
X name_length = k;
X name_of_file[k] = NUL;
X}
X
Xprint_file_name (n, a, e)
X str n;
X str a;
X str e;
X{
X print_str(a);
X print_str(n);
X print_str(e);
X}
X
Xpack_job_name (s)
X{
X cur_area = job_area;
X cur_name = job_name;
X cur_ext = s;
X pack_cur_name();
X}
X
Xstr
Xmake_name_string ()
X{
X int k;
X
X str_room(name_length);
X for (k = 0; k < name_length; incr(k))
X append_char(xord[name_of_file[k]]);
X return (make_string());
X}
X
Xwrite_name_string ()
X{
X int k;
X
X for (k = 0; k < name_length; incr(k))
X print_char(name_of_file[k]);
X}
X
Xscan_file_name ()
X{
X name_in_progress = TRUE;
X get_nbx_token();
X begin_name();
X loop {
X if (cur_cmd > OTHER_CHAR || cur_chr > 127) {
X back_input();
X break;
X }
X if (!more_name(cur_chr)) break;
X get_x_token();
X }
X end_name();
X name_in_progress = FALSE;
X}
X
Xprompt_file_name (s, e)
X char* s;
X str e;
X{
X int k;
X
X if (s[0] == 'i' && s[1] == 'n')
X print_nl("! I can't find file `");
X else print_nl("! I can't write on file `");
X print_file_name(cur_name, cur_area, cur_ext);
X print("'.");
X if (e == str_tex)
X show_context();
X print_nl("Please type another ");
X print(s);
X if (interaction < SCROLL_MODE)
X fatal_error("*** (job aborted, file error in nonstop mode)");
X clear_terminal();
X prompt_input(": ");
X begin_name();
X k = first;
X while (buffer[k] == ' ' && k < last)
X incr(k);
X loop {
X if (k == last)
X break;
X if (! more_name(buffer[k]))
X break;
X incr(k);
X }
X end_name();
X if (cur_ext == null_str)
X cur_ext = e;
X pack_cur_name();
X}
X
Xstart_input ()
X{
X scan_file_name();
X if (cur_ext == null_str)
X cur_ext = str_tex;
X pack_cur_name();
X loop {
X begin_file_reading();
X if (cur_file = a_open_in())
X break;
X end_file_reading();
X if (cur_ext == str_tex) {
X cur_ext = null_str;
X pack_cur_name();
X begin_file_reading();
X if (cur_file = a_open_in())
X break;
X end_file_reading();
X }
X prompt_file_name("input file name", str_tex);
X }
X name = a_make_name_string(cur_file);
X if (job_name == 0) {
X job_area = cur_area;
X job_name = cur_name;
X open_log_file();
X if (job_area != null_str)
X set_def_area();
X }
X if (term_offset + length(name) > MAX_PRINT_LINE - 2)
X print_ln();
X else if (term_offset > 0 || file_offset > 0)
X print_char(' ');
X print_char('(');
X print_str(name);
X update_terminal();
X state = NEW_LINE;
X input_ln(cur_file, FALSE);
X firm_up_the_line();
X if (end_line_char < 0 || end_line_char > 127)
X decr(limit);
X else buffer[limit] = end_line_char;
X first = limit + 1;
X loc = start;
X line = 1;
X}
X
Xopen_log_file ()
X{
X int k;
X int l;
X char months[37];
X int old_setting;
X
X old_setting = selector;
X if (job_name == 0) {
X job_area = null_str;
X job_name = str_texput;
X }
X pack_job_name(str_log);
X while ((log_file = a_open_out()) == NULL)
X prompt_file_name("transcript file name", str_log);
X log_name = a_make_name_string(log_file);
X selector = LOG_ONLY;
X fputs(banner, log_file);
X if (format_ident == 0)
X print(" (no format preloaded)");
X else print_str(format_ident);
X print_char(' ');
X print_int(day);
X print_char(' ');
X strcpy(months, "JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC");
X for (k = 3 * month - 3; k < 3 * month; incr(k))
X putc(months[k], log_file);
X print_char(' ');
X print_int(year);
X print_char(' ');
X print_two(time / 60);
X print_char(':');
X print_two(time % 60);
X input_stack[input_ptr] = cur_input;
X print_nl("**");
X l = input_stack[0].limit_field;
X if (buffer[l] == end_line_char) decr(l);
X for (k = 1; k <= l; incr(k))
X print_char(buffer[k]);
X print_ln();
X selector = old_setting + 2;
X}
X
Xbool
Xopen_fmt_file ()
X{
X int j;
X
X j = loc;
X if (buffer[loc] == '&') {
X incr(loc);
X j = loc;
X buffer[last] = ' ';
X while (buffer[j] != ' ') incr(j);
X pack_buffered_name(loc, j);
X if (fmt_file = w_open_in()) goto found;
X wake_up_terminal();
X puts("Sorry, I can't find that format, will try PLAIN.");
X update_terminal();
X }
X strcpy(name_of_file, TeX_format_default);
X name_length = 9;
X if ((fmt_file = w_open_in()) == NULL) {
X puts("I can't find the PLAIN format file!");
X return FALSE;
X }
Xfound:
X loc = j;
X return TRUE;
X}
X
Xpack_buffered_name (a, b)
X int a;
X int b;
X{
X ascii c;
X int j;
X int k;
X
X k = 0;
X for (j = a; j < b; incr(j))
X append_to_name(buffer[j]);
X append_to_name(xchr['.']);
X append_to_name(xchr['f']);
X append_to_name(xchr['m']);
X append_to_name(xchr['t']);
X append_to_name(NUL);
X name_length = b - a + 4;
X}
X
X/*
X * fixed arrays are used to hold the paths, to avoid any possible problems
X * involving interaction of malloc and undump
X */
X
Xchar* cur_path;
X
Xchar input_path[MAX_PATH_CHARS] = default_input_path;
Xchar font_path[MAX_PATH_CHARS] = default_font_path;
Xchar format_path[MAX_PATH_CHARS] = default_format_path;
X
Xset_paths ()
X{
X char* env_path;
X char* getenv();
X
X if (env_path = getenv("TEXINPUTS"))
X copy_path(input_path, env_path, MAX_PATH_CHARS);
X if (env_path = getenv("TEXFONTS"))
X copy_path(font_path, env_path, MAX_PATH_CHARS);
X if (env_path = getenv("TEXFORMATS"))
X copy_path(format_path, env_path, MAX_PATH_CHARS);
X}
X
X/*
X * copy_path(s1,s2,n) copies at most n characters (including the null)
X * from string s2 to string s1, giving an error message for paths
X * that are too long.
X */
X
Xcopy_path (s1, s2, n)
X char* s1;
X char* s2;
X int n;
X{
X int i;
X
X i = 0;
X while (s2[i] != NUL) {
X s1[i] = s2[i];
X incr(i);
X if (i == n) {
X fprintf(stderr, "! Environment search path is too big\n");
X s1[i - 1] = '\0';
X return;
X }
X }
X s1[i] = NUL;
X}
X
X#define append_to_def_area(C) \
X {if (i == MAX_PATH_CHARS) \
X overflow("def_area", MAX_PATH_CHARS); \
X def_area[i] = C; \
X incr(i), incr(j);}
X
Xset_def_area()
X{
X char c;
X int i;
X int j;
X char def_area[MAX_PATH_CHARS];
X
X i = 0;
X j = str_start[job_area];
X while (j < str_start[job_area + 1])
X append_to_def_area(str_pool[j]);
X append_to_def_area(':');
X j = 0;
X while ((c = input_path[j]) != NUL)
X append_to_def_area(c);
X append_to_def_area(NUL);
X strcpy(input_path, def_area);
X}
X
X/*
X * test_access(amode, file_path)
X *
X * Test whether or not the file whose name is in the global name_of_file
X * can be opened for reading according to access mode.
X *
X * If the filename given in name_of_file does not begin with '/', we try
X * prepending all the ':'-separated areanames in the appropriate path to the
X * filename until access can be made.
X */
X
Xbool
Xtest_access (amode, file_path)
X int amode;
X int file_path;
X{
X int nl;
X bool ok;
X char original_name[FILE_NAME_SIZE];
X
X strcpy(original_name, name_of_file);
X nl = name_length;
X switch (file_path)
X {
X case NO_FILE_PATH:
X cur_path = NULL;
X break;
X
X case INPUT_FILE_PATH:
X cur_path = input_path;
X break;
X
X case FONT_FILE_PATH:
X cur_path = font_path;
X break;
X
X case FORMAT_FILE_PATH:
X cur_path = format_path;
X break;
X }
X if (name_of_file[0] == '/' ||
X name_of_file[0] == '.' && name_of_file[1] == '/')
X cur_path = NULL;
X do {
X strcpy(name_of_file, original_name);
X name_length = nl;
X get_real_name();
X switch (amode)
X {
X case READ_ACCESS:
X ok = access(name_of_file, amode) == 0 ? TRUE : FALSE;
X break;
X
X case WRITE_ACCESS:
X {FILE *fp = fopen(name_of_file, "w");
X ok = fp != (FILE *) 0;
X if (ok) fclose(fp);}
X break;
X }
X } while (!ok && cur_path != NULL);
X return ok;
X}
X
X#define append_to_real_name(C) \
X {if (i == FILE_NAME_SIZE) \
X overflow("real_name", FILE_NAME_SIZE); \
X real_name[i] = C; \
X incr(i), incr(j);}
X
Xget_real_name ()
X{
X int i;
X int j;
X char real_name[FILE_NAME_SIZE];
X
X i = j = 0;
X if (cur_path) {
X while (cur_path[j] != ':' && cur_path[j] != NUL)
X append_to_real_name(cur_path[j]);
X if (real_name[i - 1] != '/')
X append_to_real_name('/');
X if (cur_path[j] == NUL)
X cur_path = NULL;
X else cur_path += j;
X }
X j = 0;
X while (j < name_length)
X append_to_real_name(name_of_file[j]);
X append_to_real_name(NUL);
X strcpy(name_of_file, real_name);
X name_length = i - 1;
X}
X
Xinit_file ()
X{
X int i;
X
X name_in_progress = FALSE;
X str_tex = make_string_given(".tex");
X str_dvi = make_string_given(".dvi");
X str_log = make_string_given(".log");
X str_tfm = make_string_given(".tfm");
X str_fmt = make_string_given(".fmt");
X str_texput = make_string_given("texput");
X for (i = 0; i <= 16; incr(i))
X read_open[i] = CLOSED;
X}
SHAR_EOF
chmod 0444 file.c || echo "restore of file.c fails"
set `wc -c file.c`;Sum=$1
if test "$Sum" != "10343"
then echo original size 10343, current size $Sum;fi
echo "x - extracting file.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > file.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 * file.h
X */
X
Xglobal char name_of_file[];
Xglobal int name_length;
X
Xglobal str cur_name;
Xglobal str cur_area;
Xglobal str cur_ext;
X
Xglobal int area_delimiter;
Xglobal int ext_delimiter;
X
X#define MAX_PATH_CHARS 1024
X
Xglobal char input_path[];
Xglobal char format_path[];
Xglobal char font_path[];
X
Xint set_paths();
X
X#define default_font_path ".:/usra/tex/fonts"
X#define default_format_path ".:/usra/ctex/formats"
X#define default_input_path ".:/usra/tex/inputs"
X
Xint print_file_name();
Xint pack_file_name();
X
X#define TeX_format_default "plain.fmt"
X
Xbool open_fmt_file();
X
Xstr make_name_string();
Xint write_name_string();
X
X#define a_make_name_string(f) make_name_string()
X#define b_make_name_string(f) make_name_string()
X#define w_make_name_string(f) make_name_string()
X
Xglobal bool name_in_progress;
Xint scan_file_name();
X
X#define pack_cur_name() \
X {pack_file_name(cur_name, cur_area, cur_ext);}
X
Xint pack_job_name();
Xint prompt_job_name();
X
Xglobal str dvi_name;
X
Xglobal str job_name;
Xglobal str job_area;
Xglobal str log_name;
X
Xint open_log_file();
Xint start_input();
X
Xglobal alpha_file read_file[];
Xglobal int read_open[];
X
X#define JUST_OPENED 1
X#define CLOSED 2
X
Xbool test_access();
X
X#define READ_ACCESS 4
X#define WRITE_ACCESS 2
X
X#define NO_FILE_PATH 0
X#define INPUT_FILE_PATH 1
X#define FONT_FILE_PATH 2
X#define FORMAT_FILE_PATH 3
X
Xglobal str str_dvi;
Xglobal str str_tex;
Xglobal str str_log;
Xglobal str str_tfm;
Xglobal str str_fmt;
Xglobal str str_texput;
X
X#ifdef INIT
Xint init_file();
X#endif
SHAR_EOF
chmod 0444 file.h || echo "restore of file.h fails"
set `wc -c file.h`;Sum=$1
if test "$Sum" != "1756"
then echo original size 1756, current size $Sum;fi
echo "x - extracting fmt.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > fmt.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 * fmt.c
X */
X
X#include "tex.h"
X#include "texext.h"
X#include "heap.h"
X#include "token.h"
X#include "eq.h"
X#include "box.h"
X#include "eqstack.h"
X#include "hash.h"
X#include "file.h"
X#include "tfm.h"
X#include "str.h"
X#include "hyph.h"
X#include "token.h"
X#include "io.h"
X#include "print.h"
X#include "error.h"
X#include "fmt.h"
X
Xword_file fmt_file;
X
Xstr format_ident;
X
X#define undump_ascii() (str_pool[k] = getc(fmt_file))
X#define undump_int(M) M = getw(fmt_file)
X#define undump_wd(M) fread(&M, sizeof(M), 1, fmt_file);
X#define undump_hh(M) fread(&M, sizeof(M), 1, fmt_file);
X#define undump_qqqq(M) fread(&M, sizeof(M), 1, fmt_file);
X
X#define undump(MIN, MAX, X) \
X {undump_int(x); \
X if (x < MIN || x > MAX) \
X goto bad_fmt; \
X else X = x;}
X
X#define too_small(S) \
X printf("---! Must increase the %s\n", S)
X
X#define undump_size(MIN, MAX, TABLE, X) \
X {undump_int(x); \
X if (x < MIN) goto bad_fmt; \
X if (x > MAX) too_small(TABLE); \
X else X = x;}
X
Xbool
Xload_fmt_file ()
X{
X int j;
X int k;
X ptr p;
X ptr q;
X int w;
X int x;
X
X undump_int(x);
X if (x != MEM_BOT) goto bad_fmt;
X undump_int(x);
X if (x != MEM_TOP) goto bad_fmt;
X undump_int(x);
X if (x != TOK_BOT) goto bad_fmt;
X undump_int(x);
X if (x != TOK_TOP) goto bad_fmt;
X undump_int(x);
X if (x != EQTB_SIZE) goto bad_fmt;
X undump_int(x);
X if (x != HASH_PRIME) goto bad_fmt;
X undump_int(x);
X if (x != HYPH_SIZE) goto bad_fmt;
X
X undump_int(pool_ptr);
X undump_int(str_ptr);
X undump_int(null_str);
X for (k = 0; k <= str_ptr; incr(k))
X undump(0, pool_ptr, str_start[k]);
X for (k = 0; k < pool_ptr; incr(k))
X undump_ascii();
X
X undump(LO_MEM_STAT_MAX + 1000, HI_MEM_STAT_MIN - 1, lo_mem_max);
X undump(LO_MEM_STAT_MAX + 1, lo_mem_max, rover);
X p = MEM_BOT;
X q = rover;
X x = 0;
X do {
X for (k = p; k <= q + 1; incr(k))
X undump_wd(mem[k]);
X p = q + node_size(q);
X if (p > lo_mem_max || q >= rlink(q) && rlink(q) != rover)
X goto bad_fmt;
X q = rlink(q);
X } while (q != rover);
X for (k = p; k <= lo_mem_max; incr(k))
X undump_wd(mem[k]);
X
X undump(lo_mem_max + 1, HI_MEM_STAT_MIN, hi_mem_min);
X undump(NULL, MEM_TOP, avail);
X mem_end = MEM_TOP;
X for (k = hi_mem_min; k <= mem_end; incr(k))
X undump_wd(mem[k]);
X
X undump(TOK_BOT, tok_high, tok_low);
X undump(NULL, TOK_TOP, tok_head);
X tok_end = TOK_TOP;
X for (k = tok_low; k <= tok_end; incr(k)) {
X undump_wd(tok_link[k]);
X undump_wd(tok[k]);
X }
X
X undump_int(var_used);
X undump_int(dyn_used);
X undump_int(tok_used);
X
X k = ACTIVE_BASE;
X do {
X undump_int(x);
X if (x < 1 || k + x > EQTB_SIZE + 1)
X goto bad_fmt;
X for (j = k; j < k + x; incr(j))
X undump_wd(eqtb[j]);
X k += x;
X undump_int(x);
X if (x < 0 || k + x > EQTB_SIZE + 1)
X goto bad_fmt;
X for (j = k; j < k + x; incr(j))
X eqtb[j] = eqtb[k - 1];
X k += x;
X } while (k <= EQTB_SIZE);
X undump(HASH_BASE, FROZEN_CONTROL_SEQUENCE, par_loc);
X par_token = CS_TOKEN_FLAG + par_loc;
X undump(HASH_BASE, FROZEN_CONTROL_SEQUENCE, write_loc);
X
X undump(HASH_BASE, FROZEN_CONTROL_SEQUENCE, hash_used);
X p = HASH_BASE - 1;
X do {
X undump(p + 1, hash_used, p);
X undump_hh(hash[p]);
X } while (p != hash_used);
X for (p = hash_used + 1; p < UNDEFINED_CONTROL_SEQUENCE; incr(p))
X undump_hh(hash[p]);
X undump_int(cs_count);
X
X undump_size(7, FONT_MEM_SIZE, "font mem size", fmem_ptr);
X for (k = 0; k < fmem_ptr; incr(k))
X undump_wd(font_info[k]);
X undump_size(FONT_BASE, FONT_MAX, "font max", font_ptr);
X for (k = NULL_FONT; k <= font_ptr; incr(k)) {
X undump_qqqq(font_check[k]);
X undump_wd(font_size[k]);
X undump_wd(font_dsize[k]);
X undump(MIN_HALFWORD, MAX_HALFWORD, font_params[k]);
X undump_int(hyphen_char[k]);
X undump_int(skew_char[k]);
X undump(0, str_ptr, font_name[k]);
X undump(0, str_ptr, font_area[k]);
X undump(0, 255, font_bc[k]);
X undump(0, 255, font_ec[k]);
X undump_int(char_base[k]);
X undump_int(width_base[k]);
X undump_int(height_base[k]);
X undump_int(depth_base[k]);
X undump_int(italic_base[k]);
X undump_int(lig_kern_base[k]);
X undump_int(kern_base[k]);
X undump_int(exten_base[k]);
X undump_int(param_base[k]);
X undump(MIN_HALFWORD, hi_mem_min, font_glue[k]);
X }
X
X undump(0, HYPH_SIZE, hyph_count);
X for (k = 1; k <= hyph_count; incr(k)) {
X undump(0, HYPH_SIZE, j);
X undump(0, str_ptr, hyph_word[j]);
X undump(MIN_HALFWORD, MAX_HALFWORD, hyph_list[j]);
X }
X undump_size(0, TRIE_SIZE, "trie size", trie_max);
X for (k = 0; k <= trie_max; incr(k))
X undump_hh(trie[k]);
X undump(MIN_QUARTERWORD, MAX_QUARTERWORD, trie_op_ptr);
X for (k = MIN_QUARTERWORD + 1; k <= trie_op_ptr; incr(k)) {
X undump(0, 63, hyf_distance[k]);
X undump(0, 63, hyf_num[k]);
X undump(MIN_QUARTERWORD, MAX_QUARTERWORD, hyf_next[k]);
X }
X undump(BATCH_MODE, ERROR_STOP_MODE, interaction);
X undump(0, str_ptr, format_ident);
X undump_int(x);
X if (x != 6969 || feof(fmt_file)) goto bad_fmt;
X return TRUE;
X
Xbad_fmt:
X print("(Fatal format file error; I'm stymied)");
X return FALSE;
X}
X
X#ifdef INIT
X
X#define dump_ascii() putc(str_pool[k], fmt_file)
X#define dump_int(W) putw(W, fmt_file)
X#define dump_hh(W) fwrite(&W, sizeof(W), 1, fmt_file);
X#define dump_wd(W) fwrite(&W, sizeof(W), 1, fmt_file);
X#define dump_qqqq(W) fwrite(&W, sizeof(W), 1, fmt_file);
X
Xstore_fmt_file ()
X{
X int j;
X int k;
X int l;
X ptr p;
X ptr q;
X fourq w;
X int x;
X
X if (save_ptr != 0) {
X print_nl("! You can't \\dump inside a group");
X help1("`{...\\dump}' is a no-no.");
X succumb();
X }
X selector = NEW_STRING;
X print(" (preloaded format=");
X print_str(job_name);
X print_char(' ');
X print_val(abs(year) % 100);
X print_char('.');
X print_val(month);
X print_char('.');
X print_val(day);
X print_char(')');
X if (interaction == BATCH_MODE)
X selector = LOG_ONLY;
X else selector = TERM_AND_LOG;
X str_room(1);
X format_ident = make_string();
X pack_job_name(str_fmt);
X while ((fmt_file = w_open_out()) == NULL)
X prompt_file_name("format file name", str_fmt);
X print_nl("Beginning to dump on file ");
X print_str(w_make_name_string(fmt_file));
X flush_string();
X print_nl("");
X print_str(format_ident);
X
X dump_int(MEM_BOT);
X dump_int(MEM_TOP);
X dump_int(TOK_BOT);
X dump_int(TOK_TOP);
X dump_int(EQTB_SIZE);
X dump_int(HASH_PRIME);
X dump_int(HYPH_SIZE);
X
X dump_int(pool_ptr);
X dump_int(str_ptr);
X dump_int(null_str);
X for (k = 0; k <= str_ptr; incr(k))
X dump_int(str_start[k]);
X for (k = 0; k < pool_ptr; incr(k))
X dump_ascii();
X print_ln();
X print_int(str_ptr);
X print(" strings of total length ");
X print_int(pool_ptr);
X
X sort_avail();
X var_used = 0;
X dump_int(lo_mem_max);
X dump_int(rover);
X p = MEM_BOT;
X q = rover;
X x = 0;
X do {
X for (k = p; k <= q + 1; incr(k))
X dump_wd(mem[k]);
X x = x + q + 2 - p;
X var_used = var_used + q - p;
X p = q + node_size(q);
X q = rlink(q);
X } while (q != rover);
X var_used = var_used + lo_mem_max - p;
X dyn_used = mem_end + 1 - hi_mem_min;
X for (k = p; k <= lo_mem_max; incr(k))
X dump_wd(mem[k]);
X x = x + lo_mem_max + 1 - p;
X dump_int(hi_mem_min);
X dump_int(avail);
X for (k = hi_mem_min; k <= mem_end; incr(k))
X dump_wd(mem[k]);
X x = x + mem_end + 1 - hi_mem_min;
X for (p = avail; p != NULL; p = link(p))
X decr(dyn_used);
X tok_used = tok_end + 1 - tok_low;
X dump_int(tok_low);
X dump_int(tok_head);
X for (k = tok_low; k <= tok_end; incr(k)) {
X dump_wd(tok_link[k]);
X dump_wd(tok[k]);
X }
X for (p = tok_head; p != NULL; p = token_link(p))
X decr(tok_used);
X x = x + tok_end + 1 - tok_low;
X dump_int(var_used);
X dump_int(dyn_used);
X dump_int(tok_used);
X print_ln();
X print_int(x);
X print(" memory locations dumped; current usage is ");
X print_int(var_used);
X print_char(',');
X print_int(dyn_used);
X print_char(',');
X print_int(tok_used);
X
X k = ACTIVE_BASE;
X do {
X for (j = k; j < INT_BASE - 1; incr(j))
X if (equiv(j) == equiv(j + 1) &&
X eq_type(j) == eq_type(j + 1) &&
X eq_level(j) == eq_level(j + 1))
X goto found1;
X l = INT_BASE;
X goto done1;
X
X found1:
X incr(j);
X l = j;
X for (; j < INT_BASE - 1; incr(j))
X if (equiv(j) != equiv(j + 1) ||
X eq_type(j) != eq_type(j + 1) ||
X eq_level(j) != eq_level(j + 1))
X goto done1;
X
X done1:
X dump_int(l - k);
X for (; k < l; incr(k))
X dump_wd(eqtb[k]);
X k = j + 1;
X dump_int(k - l);
X } while (k != INT_BASE);
X
X do {
X for (j = k; j < EQTB_SIZE; incr(j))
X if (eqtb[j].i == eqtb[j + 1].i)
X goto found2;
X l = EQTB_SIZE + 1;
X goto done2;
X
X found2:
X incr(j);
X l = j;
X for (; j < EQTB_SIZE; incr(j))
X if (eqtb[j].i != eqtb[j + 1].i)
X goto done2;
X
X done2:
X dump_int(l - k);
X for (; k < l; incr(k))
X dump_wd(eqtb[k]);
X k = j + 1;
X dump_int(k - l);
X } while (k <= EQTB_SIZE);
X dump_int(par_loc);
X dump_int(write_loc);
X
X dump_int(hash_used);
X cs_count = FROZEN_CONTROL_SEQUENCE - 1 - hash_used;
X for (p = HASH_BASE; p <= hash_used; incr(p))
X if (text(p) != 0) {
X dump_int(p);
X dump_hh(hash[p]);
X incr(cs_count);
X }
X for (p = hash_used + 1; p < UNDEFINED_CONTROL_SEQUENCE; incr(p))
X dump_hh(hash[p]);
X dump_int(cs_count);
X print_ln();
X print_int(cs_count);
X print(" multiletter control sequences");
X
X dump_int(fmem_ptr);
X for (k = 0; k < fmem_ptr; incr(k))
X dump_wd(font_info[k]);
X dump_int(font_ptr);
X for (k = NULL_FONT; k <= font_ptr; incr(k)) {
X dump_qqqq(font_check[k]);
X dump_wd(font_size[k]);
X dump_wd(font_dsize[k]);
X dump_int(font_params[k]);
X dump_int(hyphen_char[k]);
X dump_int(skew_char[k]);
X dump_int(font_name[k]);
X dump_int(font_area[k]);
X dump_int(font_bc[k]);
X dump_int(font_ec[k]);
X dump_int(char_base[k]);
X dump_int(width_base[k]);
X dump_int(height_base[k]);
X dump_int(depth_base[k]);
X dump_int(italic_base[k]);
X dump_int(lig_kern_base[k]);
X dump_int(kern_base[k]);
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 print_file_name(font_name[k], font_area[k], null_str);
X if (font_size[k] != font_dsize[k]) {
X print(" at ");
X print_scaled(font_size[k]);
X print("pt");
X }
X }
X print_ln();
X print_int(fmem_ptr - 7);
X print(" words of font info for ");
X print_int(font_ptr - FONT_BASE);
X print(" preloaded font");
X if (font_ptr != FONT_BASE + 1)
X print_char('s');
X dump_int(hyph_count);
X for (k = 0; k <= HYPH_SIZE; incr(k))
X if (hyph_word[k] != 0) {
X dump_int(k);
X dump_int(hyph_word[k]);
X dump_int(hyph_list[k]);
X }
X dump_int(trie_max);
X for (k = 0; k <= trie_max; incr(k))
X dump_hh(trie[k]);
X dump_int(trie_op_ptr);
X for (k = MIN_QUARTERWORD + 1; k <= trie_op_ptr; incr(k)) {
X dump_int(hyf_distance[k]);
X dump_int(hyf_num[k]);
X dump_int(hyf_next[k]);
X }
X print_ln();
X print_int(hyph_count);
X print(" hyphenation exception");
X if (hyph_count != 1)
X print_char('s');
X print_nl("Hyphenation trie of length ");
X print_int(trie_max);
X print(" has ");
X print_int(qo(trie_op_ptr));
X print(" op");
X if (trie_op_ptr != MIN_QUARTERWORD + 1)
X print_char('s');
X
X dump_int(interaction);
X dump_int(format_ident);
X dump_int(6969);
X w_close(fmt_file);
X tracing_stats = 0;
X}
X#endif
SHAR_EOF
chmod 0444 fmt.c || echo "restore of fmt.c fails"
set `wc -c fmt.c`;Sum=$1
if test "$Sum" != "11010"
then echo original size 11010, current size $Sum;fi
echo "x - extracting fmt.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > fmt.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 * fmt.h
X */
X
Xglobal word_file fmt_file;
X
Xglobal str format_ident;
X
Xbool load_fmt_file();
X
X#ifdef INIT
Xint store_fmt_file();
X#endif
SHAR_EOF
chmod 0444 fmt.h || echo "restore of fmt.h fails"
set `wc -c fmt.h`;Sum=$1
if test "$Sum" != "350"
then echo original size 350, current size $Sum;fi
echo "x - extracting hash.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > hash.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 * hash.c
X */
X
X#include "tex.h"
X#include "cmds.h"
X#include "heap.h"
X#include "box.h"
X#include "scan.h"
X#include "eq.h"
X#include "io.h"
X#include "math.h"
X#include "boxlists.h"
X#include "str.h"
X#include "error.h"
X#include "hash.h"
X
Xtwoh hash[UNDEFINED_CONTROL_SEQUENCE+1];
Xptr hash_used = FROZEN_CONTROL_SEQUENCE;
Xbool no_new_control_sequence = TRUE;
Xint cs_count = 0;
X
Xptr
Xid_lookup (j, l)
X int j;
X int l;
X{
X int h;
X int k;
SHAR_EOF
echo "End of part 8"
echo "File hash.c is continued in part 9"
echo "9" > s2_seq_.tmp
exit 0
More information about the Comp.unix.xenix
mailing list