LaTeX for Xenix
G Geers
glenn at extro.ucc.su.oz.au
Fri Feb 16 10:44:00 AEST 1990
---- Cut Here and unpack ----
#!/bin/sh
# this is part 13 of a multipart archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file str.h continued
#
CurArch=13
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 str.h"
sed 's/^X//' << 'SHAR_EOF' >> str.h
X */
X
X
X/*
X * string.h
X */
X
Xglobal ptr str_start[];
Xglobal str str_ptr;
X
Xglobal ascii str_pool[];
Xglobal ptr pool_ptr;
X
Xglobal str null_str;
X
X#define length(S) (str_start[S + 1] - str_start[S])
X#define cur_length() (pool_ptr - str_start[str_ptr])
X
X#define append_char(C) {str_pool[pool_ptr] = C; incr(pool_ptr);}
X#define flush_char() decr(pool_ptr)
X
X#define str_room(S) \
X {if (pool_ptr + S >= POOL_SIZE) \
X overflow("pool_size", POOL_SIZE);}
X
Xstr make_string();
Xstr make_string_given();
X
X#define flush_string() \
X {decr(str_ptr); pool_ptr = str_start[str_ptr];}
X
Xbool str_eq_buf();
Xbool str_eq_str();
X
Xint init_strings();
SHAR_EOF
echo "File str.h is complete"
chmod 0444 str.h || echo "restore of str.h fails"
set `wc -c str.h`;Sum=$1
if test "$Sum" != "843"
then echo original size 843, current size $Sum;fi
echo "x - extracting tex.1 (Text)"
sed 's/^X//' << 'SHAR_EOF' > tex.1 &&
X.TH TEX 1L 8/20/85
X.SH NAME
Xtex, latex, initex, virtex \- text formatting and typesetting
X.SH SYNOPSIS
X.B tex
X[ first line ]
X.PP
X.B latex
X[ first line ]
X.PP
X.B initex
X[ first line ]
X.PP
X.B virtex
X[ first line ]
X
X.SH DESCRIPTION
XTeX
Xformats the interspersed text and commands contained in the named
Xfiles
Xand outputs a typesetter independent file (called
X.I DVI
Xwhich is short for
X.IR D e V ice
X.IR I ndependent ).
XTeX
Xcapabilities and language are described in
X.I The TeXbook
Xby Donald E. Knuth, published by Addison-Wesley. There is also an older
Xmanual,
X.I TeX and METAFONT,
Xwhich describes the older version of TeX, now called TeX78, but this
Xdescription is now obsolete.
XThe present version of TeX (often refered to internally as TeX82)
Xincorporates literally hundreds of changes from this older version.
X.PP
XThe \fItex\fR command loads the plain format.
XAny arguments given on the command line to the
XTeX
Xprograms are passed to them as the first input line.
XAs described in
X.I The TeXbook,
Xthat line should begin with a file name
Xor a \\controlsequence.
XThe normal usage is to say
X.RB `` tex
X.IR paper ''
Xto start processing
X.I paper.tex.
XThe name ``paper'' will be the ``jobname'', and is used in forming
Xoutput file names.
XIf TeX doesn't get a file name in the first line, the jobname is ``texput''.
XThe default `.tex' extension can be overridden by specifying an extension
Xexplicitly.
X.PP
XIf there is no paper.tex in the current directory, TeX will look
Xlook through a search path of directories to try to find it.
XThe standard library on the default search path
Xhas the basic format package, plain.tex, described
Xin the TeXbook, as well as several others.
XNote that it is hardly ever necessary to \\input plain, since the
X.I tex
Xprogram has preloaded it.
XThis means that all of the control sequences discussed in the TeXbook
Xare known to TeX.
X.PP
XThe output DVI file is written on
X.I name.dvi
Xwhere
X.I name
Xis the jobname.
XA log of error messages goes into
X.I name.log.
X.PP
X.PP
XNote that there have been incompatible changes in the DVI format
Xbetween
XTeX78
Xand
XTeX82,
Xso programs used to print TeX78 output will not work for TeX82.
XA number of output drivers are available. The one to use on this system
Xis
X.I dvialw
Xfollowed by
X.I lw -X .
X.PP
XThere are some environment variables that can be used to set up directory
Xpaths to search when TeX opens a file for input.
XFor example, the
X.I csh
Xcommand
X.br
X.in +2
Xsetenv TEXINPUTS .:/usr/me/myinputs:/usr/tex/inputs
X.in -2
Xor the
X.I sh
Xcommand sequence
X.br
X.in +2
XTEXINPUTS=.:/usr/me/myinputs:/usr/tex/inputs
X.br
Xexport TEXINPUTS
X.in -2
X.br
Xwould cause all invocations of tex and its derivatives to look for
X\\input files first in the current directory, then in a hypothetical
Xuser's ``myinputs'', and finally in the system library.
XNormally, the user will place the command sequence which sets up the
XTEXINPUTS environment variable in the
X.I .cshrc
Xor
X.I .profile
Xfile.
XThe Environment section below lists the relevant environment variables,
Xand their defaults.
X.PP
XA convenient file in the library is null.tex, containing nothing.
XWhen tex can't find a file it thinks you want to input, it keeps
Xasking you for another file name; responding `null' gets you out
Xof the loop if you don't want to input anything. Typing `control-D'
Xalso works. Presently, `control-C' is ignored.
X.PP
XTwo other TeX programs,
X.I initex
Xand
X.IR virtex ,
Xcan be used to create fast-loading customized versions of TeX.
XThe
X.I initex
Xprogram is used to create a
X.I format (.fmt)
Xfile that permits fast loading of fonts and macro packages.
XAfter processing the fonts and definitions desired, a \\dump command
Xwill create the format file.
XThe format file is used by
X.I virtex.
XIt needs to be given a format file name as the first thing it reads.
XA format file name is preceded by an &, which needs to be escaped with \\
Xif given on the command line.
XSo, for instance, one could create a file myfmt.fmt using initex,
Xand then set up a cshell alias with
X.br
X.ti +2
Xalias mytex "virtex \\&myfmt"
X.br
Xto allow the use of ``mytex paper''.
X.SH ENVIRONMENT
X.PP
X.IP TEXINPUTS
XSearch path for \\input and \\openin files. It should be colon-separated,
Xand start with ``.''. The entire path must be no longer than 700
Xcharacters long.
XDefault: .:/usr/tex/inputs
X.IP TEXFONTS
XSearch path for font metric files. The entire path must be no longer than 100
Xcharacters long. The default doesn't include the current area (".") to
Xavoid confusing the programs that convert the output for printing on the
Xvarious output devices (most of which don't know about the path stuff yet).
XDefault: /usr/tex/fonts
X.IP TEXFORMATS
XSearch path for format files. Default: .:/usr/tex/formats
X.IP TEXPOOL
XSearch path for TeX strings. Default: .:/usr/tex/formats
X
X.SH FILES
X
X.TP 2.5i
X/usr/tex
XTeX's source and library area
X.TP
X/usr/tex/formats/tex.pool
XEncoded text of TeX's messages
X.TP
X/usr/tex/fonts
XTeX's fonts and width tables
X.TP
X/usr/tex/fonts/*.*pxl,gf,pk
XBit maps for low resolution devices
X.TP
X/usr/tex/fonts/*.tfm
XWidth information used by TeX (TeX Font Metric files)
X.TP
X/usr/tex/formats/*.fmt
XDumped binary form TeX system macros
X.TP
X/usr/tex/inputs
XDefault TeX and LaTeX inputs
X.br
X.SH "SEE ALSO"
XOn-line manual entries for
XI. dvialw
X.br
XDonald E. Knuth,
X.I The TeXbook
X.br
XLeslie Lamport,
X.I The LaTeX Document Preparation System
X.br
XMichael Spivak,
X.I The Joy of TeX
X.br
X.I TUGBOAT
X(the publication of the TeX Users Group)
X.br
X.I Differences between TeX82 and SAIL TeX
X.SH "TRIVIA"
XTeX, pronounced properly, rhymes with ``blecchhh.'' Note that the proper
Xspelling in typewriter-like output is ``TeX'' and not ``TEX'' or ``tex.''
X.SH "BUGS"
XMaybe there should be character other than & to specify format files,
Xsince if you forget the \\ on the command line, it doesn't do what you want!
XAlso, there is no way to read a TeX input file with no filename extension.
X.SH "AUTHORS"
XTeX was designed by Donald E. Knuth,
Xwho implemented it using his WEB system for Pascal programs.
XIt was ported to Unix at Stanford by Howard Trickey, and
Xat Cornell by Pavel Curtis.
XWe are running a version of TeX82 which was translated into `C' by
XPat Joseph Monardo.
SHAR_EOF
chmod 0444 tex.1 || echo "restore of tex.1 fails"
set `wc -c tex.1`;Sum=$1
if test "$Sum" != "6180"
then echo original size 6180, current size $Sum;fi
echo "x - extracting tex.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > tex.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 * tex.c
X */
X
X#include "tex.h"
X#include "texext.h"
X#include "cmds.h"
X#include "heap.h"
X#include "char.h"
X#include "str.h"
X#include "eq.h"
X#include "hash.h"
X#include "evalstack.h"
X#include "eqstack.h"
X#include "tokenstack.h"
X#include "token.h"
X#include "box.h"
X#include "pack.h"
X#include "cond.h"
X#include "io.h"
X#include "file.h"
X#include "tfm.h"
X#include "hyph.h"
X#include "dvi.h"
X#include "fmt.h"
X#include "error.h"
X#include "print.h"
X#include "page.h"
X
Xchar banner[] = "This is Common TeX, Version 2.1.1";
Xint ready_already;
X
Xmain (argc, argv)
X int argc;
X char *argv[];
X{
X job_name = 0;
X history = FATAL_ERROR_STOP;
X signal(SIGINT, handle_int);
X set_paths();
X adjust_tail = NULL;
X page_tail = page_head;
X mode = VMODE;
X head = tail = contrib_head;
X prev_depth = IGNORE_DEPTH;
X mode_line = 0;
X t_open_out();
X for (first = 0; first < BUF_SIZE; incr(first))
X buffer[first] = 0;
X first = 1;
X state = NEW_LINE;
X start = 1;
X if (ready_already != 314159)
X initialize();
X ready_already = 314159;
X print(banner);
X selector = TERM_ONLY;
X if (format_ident == 0)
X print(" (no format preloaded)");
X else print_str(format_ident);
X print_ln();
X if (!decode_args(argc, argv))
X if (!init_terminal())
X exit(history);
X limit = last;
X first = last + 1;
X if (format_ident == 0 || buffer[loc] == '&') {
X /*if (format_ident != 0)
X initialize();*/
X if (!open_fmt_file())
X exit(history);
X if (!load_fmt_file())
X exit(history);
X w_close(fmt_file);
X while (loc < limit && buffer[loc] == ' ')
X incr(loc);
X }
X if (end_line_char < 0 || end_line_char > 127)
X decr(limit);
X else buffer[limit] = end_line_char;
X fix_date_and_time();
X if (interaction == BATCH_MODE)
X selector = NO_PRINT;
X else selector = TERM_ONLY;
X if (loc < limit && cat_code(buffer[loc]) != ESCAPE)
X start_input();
X history = SPOTLESS;
X main_control();
X final_cleanup();
X close_files_and_terminate(FALSE);
X}
X
X#define USAGE "usage: %s [ -d dir ] [ file ]\n"
X
Xbool
Xdecode_args (argc, argv)
X int argc;
X char* *argv;
X{
X int j;
X char* ap;
X char* pgm;
X char dir[MAX_PATH_CHARS];
X
X ap = pgm = argv[0];
X while (*pgm++ != NUL)
X if (*pgm == '/' || *pgm == '\\')
X ap = pgm, ap++;
X pgm = ap;
X
X decr(argc), incr(argv);
X if (argc) {
X last = first;
X while (argc) {
X if (argv[0][0] == '-') {
X for (ap = *argv + 1; *ap != NUL; incr(ap)) {
X switch (*ap)
X {
X case 'd':
X decr(argc), incr(argv);
X strcpy(dir, *argv);
X strcat(dir, ":");
X strcat(dir, input_path);
X strcpy(input_path, dir);
X break;
X
X default:
X fprintf(stderr, USAGE, pgm);
X exit(history);
X }
X }
X } else {
X j = 0;
X while (j <= FILE_NAME_SIZE && argv[0][j] != NUL) {
X buffer[last] = argv[0][j];
X incr(last), incr(j);
X }
X if (j > 0)
X buffer[last++] = ' ';
X }
X decr(argc), incr(argv);
X }
X if (last > first) {
X loc = first;
X return TRUE;
X }
X }
X return FALSE;
X}
X
Xfix_date_and_time ()
X{
X val clock, begin_time();
X struct tm *tm_ptr, *localtime();
X
X clock = begin_time();
X tm_ptr = localtime(&clock);
X time = 60 * tm_ptr->tm_hour + tm_ptr->tm_min;
X day = tm_ptr->tm_mday;
X month = tm_ptr->tm_mon + 1;
X year = tm_ptr->tm_year + 1900;
X}
X
Xval
Xbegin_time ()
X{
X#undef time
X val time();
X return (time((long *) 0));
X}
X
Xfinal_cleanup ()
X{
X int c;
X
X c = cur_chr;
X if (job_name == 0)
X open_log_file();
X if (cur_level > LEVEL_ONE) {
X print_nl("(");
X print_esc("end occured ");
X print("inside a group at level ");
X print_int(cur_level - LEVEL_ONE);
X print_char(')');
X }
X while (cond_ptr != NULL) {
X print_nl("(");
X print_esc("end occurred ");
X print("when ");
X print_cmd_chr(IF_TEST, cur_if);
X if (if_line != 0) {
X print(" on line ");
X print_val(if_line);
X }
X print(" was incomplete)");
X if_line = if_line_field(cond_ptr);
X cur_if = subtype(cond_ptr);
X cond_ptr = link(cond_ptr);
X }
X if (history != SPOTLESS &&
X (history == WARNING_ISSUED || interaction < ERROR_STOP_MODE) &&
X selector == TERM_AND_LOG) {
X selector = TERM_ONLY;
X print_nl("(see the transcript file for additional information)");
X selector = TERM_AND_LOG;
X }
X if (c == 1)
X#ifdef INIT
X store_fmt_file();
X#else
X print_nl("(\\dump is performed only by INITEX)");
X#endif
X}
X
Xclose_files_and_terminate (edit)
X bool edit;
X{
X int k;
X
X for (k = 0; k < 16; incr(k))
X if (write_open[k])
X a_close(write_file[k]);
X
X#ifdef STAT
X if (tracing_stats > 0) {
X print_ln();
X print(" Here is how much of TeX's memory you used:");
X print_ln();
X print_int(str_ptr);
X print(" strings out of ");
X print_int(MAX_STRINGS);
X print_ln();
X print_int(pool_ptr);
X print(" string characters out of ");
X print_int(POOL_SIZE);
X print_ln();
X print_int(lo_mem_max - MEM_MIN + mem_end - hi_mem_min);
X print(" words of memory out of ");
X print_int(mem_end + 1 - MEM_MIN);
X print_ln();
X print_int(cs_count);
X print(" multiletter control sequences out of ");
X print_int(HASH_SIZE);
X print_ln();
X print_int(fmem_ptr);
X print(" words of font info for ");
X print_int(font_ptr - FONT_BASE);
X print(" font");
X if (font_ptr != FONT_BASE + 1)
X print_char('s');
X print(", out of ");
X print_int(FONT_MEM_SIZE);
X print(" for ");
X print_int(FONT_MAX - FONT_BASE);
X print_ln();
X print_int(hyph_count);
X print(" hyphenation exception");
X if (hyph_count != 1) print_char('s');
X print(" out of ");
X print_int(HYPH_SIZE);
X print_ln();
X print_int(max_in_stack); print("i, ");
X print_int(max_nest_stack); print("n, ");
X print_int(max_param_stack); print("p, ");
X print_int(max_buf_stack + 1); print("b, ");
X print_int(max_save_stack + 6); print("s, ");
X print_ln();
X }
X#endif
X wake_up_terminal();
X if (total_pages == 0)
X print_nl("No pages of output.");
X else {
X dvi_out(POST);
X dvi_four(last_bop);
X last_bop = dvi_offset + dvi_ptr - 5;
X dvi_four(25400000);
X dvi_four(473628672);
X prepare_mag();
X dvi_four(mag);
X dvi_four(max_v);
X dvi_four(max_h);
X dvi_out(max_push / 256);
X dvi_out(max_push % 256);
X dvi_out(total_pages / 256);
X dvi_out(total_pages % 256);
X while (font_ptr > FONT_BASE) {
X if (font_used[font_ptr])
X dvi_font_def(font_ptr);
X decr(font_ptr);
X }
X dvi_out(POST_POST);
X dvi_four(last_bop);
X dvi_out(ID_BYTE);
X for (k = 4 + (DVI_BUF_SIZE - dvi_ptr) % 4; k > 0; decr(k))
X dvi_out(223);
X if (dvi_limit == HALF_BUF)
X write_dvi(HALF_BUF, DVI_BUF_SIZE);
X if (dvi_ptr > 0) write_dvi(0, dvi_ptr);
X print_nl("Output written on ");
X print_str(dvi_name);
X print(" (");
X print_int(total_pages);
X print(" page");
X if (total_pages != 1)
X print_char('s');
X print(", ");
X print_val(dvi_offset + dvi_ptr);
X print(" bytes).");
X b_close(dvi_file);
X }
X if (job_name > 0) {
X wlog_cr();
X a_close(log_file);
X selector -= 2;
X if (selector == TERM_ONLY) {
X print_nl("Transcript written on ");
X print_str(log_name);
X print_char('.');
X }
X }
X print_ln();
X if (edit)
X {}
X exit(history);
X}
X
Xinitialize ()
X{
X init_char();
X init_strings();
X init_file();
X init_mem();
X init_tok_mem();
X init_eq();
X init_cmds();
X init_hyph();
X init_tfm();
X#ifdef INIT
X format_ident = make_string_given(" (INITEX)");
X#endif
X}
X
Xhandle_int ()
X{
X signal(SIGINT, handle_int);
X interrupt = 1;
X}
SHAR_EOF
chmod 0444 tex.c || echo "restore of tex.c fails"
set `wc -c tex.c`;Sum=$1
if test "$Sum" != "7361"
then echo original size 7361, current size $Sum;fi
echo "x - extracting tex.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > tex.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 * tex.h
X */
X
X#include <stdio.h>
X#include <signal.h>
X#include <time.h>
X
X/*
X * constants in the outer block
X */
X
X#define NUL '\0'
X#define EOLN '\n'
X#define FALSE 0
X#define TRUE 1
X#define EMPTY 0
X
X#define BUF_SIZE 5000
X#define DVI_BUF_SIZE 1024
X#define ERROR_LINE 78
X#define FILE_NAME_SIZE 104
X#define FONT_BASE 0
X#define FONT_MAX 100
X#define FONT_MEM_SIZE 25000
X#define HALF_BUF 512
X#define HALF_ERROR_LINE 39
X#define HASH_SIZE 3000
X#define HASH_PRIME 2551
X#define HYPH_SIZE 307
X#define MAX_IN_OPEN 15
X#define MAX_PRINT_LINE 78
X#define MAX_STRINGS 5400
X#define NEST_SIZE 40
X#define PARAM_SIZE 30
X#define POOL_SIZE 25000
X#define SAVE_SIZE 600
X#define STACK_SIZE 200
X#define STRING_VACANCIES 1000
X#define TRIE_OP_HASH_SIZE 512
X#define TRIE_SIZE 8000
X
X#ifdef INIT
X#if !defined(BIGG) && !defined(BIG)
X#define MEM_BOT 0
X#define MEM_TOP 17000
X#define TOK_BOT 0
X#define TOK_TOP 27000
X#define MEM_MIN MEM_BOT
X#define MEM_MAX MEM_TOP
X#define TOK_MIN TOK_BOT
X#define TOK_MAX TOK_TOP
X#define MIN_QUARTERWORD 0
X#define MAX_QUARTERWORD 255
X#define MIN_HALFWORD 0
X#define MAX_HALFWORD 65535
X#endif
X
X#ifdef BIG
X#define MEM_BOT 0
X#define MEM_TOP 27000
X#define TOK_BOT 0
X#define TOK_TOP 37000
X#define MEM_MIN MEM_BOT
X#define MEM_MAX MEM_TOP
X#define TOK_MIN TOK_BOT
X#define TOK_MAX TOK_TOP
X#define MIN_QUARTERWORD 0
X#define MAX_QUARTERWORD 255
X#define MIN_HALFWORD 0
X#define MAX_HALFWORD 655350
X#endif
X
X#ifdef BIGG
X#define MEM_BOT 0
X#define MEM_TOP 37000
X#define TOK_BOT 0
X#define TOK_TOP 47000
X#define MEM_MIN MEM_BOT
X#define MEM_MAX MEM_TOP
X#define TOK_MIN TOK_BOT
X#define TOK_MAX TOK_TOP
X#define MIN_QUARTERWORD 0
X#define MAX_QUARTERWORD 255
X#define MIN_HALFWORD 0
X#define MAX_HALFWORD 6553500
X#endif
X
X#else
X
X#if !defined(BIGG) && !defined(BIG)
X#define MEM_BOT 0
X#define MEM_TOP 17000
X#define TOK_BOT 0
X#define TOK_TOP 27000
X#define MEM_MIN 0
X#define MEM_MAX 32000
X#define TOK_MIN 0
X#define TOK_MAX 35000
X#define MIN_QUARTERWORD 0
X#define MAX_QUARTERWORD 255
X#define MIN_HALFWORD 0
X#define MAX_HALFWORD 65535
X#endif
X
X#ifdef BIG
X#define MEM_BOT 0
X#define MEM_TOP 27000
X#define TOK_BOT 0
X#define TOK_TOP 37000
X#define MEM_MIN 0
X#define MEM_MAX 128000
X#define TOK_MIN 0
X#define TOK_MAX 45000
X#define MIN_QUARTERWORD 0
X#define MAX_QUARTERWORD 255
X#define MIN_HALFWORD 0
X#define MAX_HALFWORD 655350
X#endif
X
X#ifdef BIGG
X#define MEM_BOT 0
X#define MEM_TOP 37000
X#define TOK_BOT 0
X#define TOK_TOP 47000
X#define MEM_MIN 0
X#define MEM_MAX 256000
X#define TOK_MIN 0
X#define TOK_MAX 65000
X#define MIN_QUARTERWORD 0
X#define MAX_QUARTERWORD 255
X#define MIN_HALFWORD 0
X#define MAX_HALFWORD 6553500
X#endif
X
X#endif
X
X/*
X * types in the outer block
X */
X
X#define global extern
X
X#define ascii unsigned char
X#define bool int
X#define byte unsigned char
X#define fnt int
X#define gord unsigned char
X#define gratio float
X#define group int
X#define ptr hword
X#define sc i
X#define scal long
X#define str hword
X#define val long
X
Xtypedef FILE *word_file;
Xtypedef FILE *alpha_file;
Xtypedef FILE *byte_file;
X
X#define qword unsigned char
X
X#if defined(BIG) || defined(BIGG)
X#define hword unsigned long
X#else
X#define hword unsigned short
X#endif
X
Xtypedef union {
X struct {
X hword rh;
X hword lh;
X } hh1;
X struct {
X hword rh;
X qword b0;
X qword b1;
X } hh2;
X} twoh;
X
Xtypedef struct {
X qword b0;
X qword b1;
X qword b2;
X qword b3;
X} fourq;
X
Xtypedef union {
X long i;
X gratio gr;
X twoh hh;
X fourq qqqq;
X} mword;
X
X/*
X * variables in the outer block
X */
X
Xglobal char banner[];
Xglobal int ready_already;
X
X/*
X * functions in the outer block
X */
X
Xint final_cleanup();
Xint close_files_and_terminate();
Xint initialize();
Xbool decode_args();
Xint handle_int();
X
X/*
X * some common programming idioms
X */
X
X#define incr(i) ++(i)
X#define decr(i) --(i)
X#define odd(i) ((i) & 1)
X#define abs(i) ((i) >= 0 ? (i) : -(i))
X#define round(x) (long) ((x) > 0.0 ? ((x) + 0.5) : ((x) - 0.5))
X#define negate(x) (x) = -(x)
X#define loop while (1)
SHAR_EOF
chmod 0444 tex.h || echo "restore of tex.h fails"
set `wc -c tex.h`;Sum=$1
if test "$Sum" != "4374"
then echo original size 4374, current size $Sum;fi
echo "x - extracting texext.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > texext.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 * texext.c
X */
X
X#include "tex.h"
X#include "cmds.h"
X#include "heap.h"
X#include "eq.h"
X#include "hash.h"
X#include "token.h"
X#include "box.h"
X#include "scan.h"
X#include "def.h"
X#include "tokenstack.h"
X#include "tokenlists.h"
X#include "evalstack.h"
X#include "io.h"
X#include "str.h"
X#include "file.h"
X#include "dvi.h"
X#include "print.h"
X#include "error.h"
X#include "texext.h"
X
Xalpha_file write_file[16];
X
Xbool write_open[18];
Xptr write_loc;
X
Xdo_extension ()
X{
X int i;
X int j;
X int k;
X ptr p;
X ptr q;
X ptr r;
X
X switch (cur_chr)
X {
X case OPEN_NODE:
X new_write(OPEN_NODE_SIZE);
X scan_optional_equals();
X scan_file_name();
X open_name(tail) = cur_name;
X open_area(tail) = cur_area;
X open_ext(tail) = cur_ext;
X break;
X
X case WRITE_NODE:
X k = cur_cs;
X new_write(WRITE_NODE_SIZE);
X cur_cs = k;
X scan_toks(FALSE, FALSE);
X write_tokens(tail) = def_ref;
X break;
X
X case CLOSE_NODE:
X new_write(WRITE_NODE_SIZE);
X write_tokens(tail) = NULL;
X break;
X
X case SPECIAL_NODE:
X new_whatsit(SPECIAL_NODE, WRITE_NODE_SIZE);
X cur_cs = k;
X scan_toks(FALSE, TRUE);
X write_tokens(tail) = def_ref;
X break;
X
X case IMMEDIATE_CODE:
X get_x_token();
X if (cur_cmd == EXTENSION && cur_chr <= CLOSE_NODE) {
X p = tail;
X do_extension();
X out_whatsit(tail);
X flush_node_list(tail);
X tail = p;
X link(p) = NULL;
X } else back_input();
X break;
X
X default:
X confusion("ext1");
X break;
X }
X}
X
Xnew_whatsit (s, w)
X int s;
X int w;
X{
X ptr p;
X
X p = get_node(w);
X type(p) = WHATSIT_NODE;
X subtype(p) = s;
X link(tail) = p;
X tail = p;
X}
X
Xshow_whatsit (p)
X ptr p;
X{
X switch (subtype(p))
X {
X case OPEN_NODE:
X print_write("openout", p);
X print_char('=');
X print_file_name(open_name(p), open_area(p), open_ext(p));
X break;
X
X case WRITE_NODE:
X print_write("write", p);
X print_mark(write_tokens(p));
X break;
X
X case CLOSE_NODE:
X print_write("closeout", p);
X break;
X
X case SPECIAL_NODE:
X print_esc("special");
X print_mark(write_tokens(p));
X break;
X
X default:
X print("whatsit?");
X break;
X }
X}
X
Xptr
Xcopy_whatsit (p)
X ptr p;
X{
X ptr q;
X
X switch (subtype(p))
X {
X case OPEN_NODE:
X q = get_node(OPEN_NODE_SIZE);
X mem[q + 2] = mem[p + 2];
X mem[q + 1] = mem[p + 1];
X break;
X
X case WRITE_NODE:
X case SPECIAL_NODE:
X q = get_node(WRITE_NODE_SIZE);
X add_token_ref(write_tokens(p));
X mem[q + 1] = mem[p + 1];
X break;
X
X case CLOSE_NODE:
X q = get_node(WRITE_NODE_SIZE);
X mem[q + 1] = mem[p + 1];
X break;
X
X default:
X confusion("ext2");
X break;
X }
X return q;
X}
X
Xfree_whatsit (p)
X ptr p;
X{
X switch (subtype(p))
X {
X case OPEN_NODE:
X free_node(p, OPEN_NODE_SIZE);
X break;
X
X case WRITE_NODE:
X case SPECIAL_NODE:
X delete_token_ref(write_tokens(p));
X free_node(p, WRITE_NODE_SIZE);
X break;
X
X case CLOSE_NODE:
X free_node(p, WRITE_NODE_SIZE);
X break;
X
X default:
X confusion("ext3");
X break;
X }
X}
X
Xout_whatsit (p)
X ptr p;
X{
X int j;
X
X switch (subtype(p))
X {
X case OPEN_NODE:
X case WRITE_NODE:
X case CLOSE_NODE:
X if (!doing_leaders) {
X j = write_stream(p);
X if (subtype(p) == WRITE_NODE)
X out_write(p);
X else {
X if (write_open[j])
X a_close(write_file[j]);
X if (subtype(p) == CLOSE_NODE)
X write_open[j] = FALSE;
X else {
X cur_name = open_name(p);
X cur_area = open_area(p);
X cur_ext = open_ext(p);
X if (cur_ext == null_str)
X cur_ext = str_tex;
X if (cur_area == null_str)
X cur_area = job_area;
X pack_cur_name();
X if ((write_file[j] = a_open_out()) == NULL) {
X cur_area = null_str;
X pack_cur_name();
X while ((write_file[j] = a_open_out()) == NULL)
X prompt_file_name("output file name", str_tex);
X }
X write_open[j] = TRUE;
X }
X }
X }
X break;
X
X case SPECIAL_NODE:
X out_special(p);
X break;
X
X default:
X confusion("ext4");
X break;
X }
X}
X
Xnew_write (w)
X int w;
X{
X new_whatsit(cur_chr, w);
X if (w != WRITE_NODE_SIZE)
X scan_four_bit_int();
X else {
X scan_int();
X if (cur_val < 0)
X cur_val = 17;
X else if (cur_val > 15)
X cur_val = 16;
X }
X write_stream(tail) = cur_val;
X}
X
Xprint_write (s, p)
X char* s;
X ptr p;
X{
X print_esc(s);
X if (write_stream(p) < 16)
X print_int(write_stream(p));
X else if (write_stream(p) == 16)
X print_char('*');
X else print_char('-');
X}
X
Xout_write (p)
X ptr p;
X{
X int j;
X ptr q;
X ptr r;
X int old_mode;
X int old_setting;
X
X q = new_token();
X token(q) = RIGHT_BRACE_TOKEN + '}';
X r = new_token();
X token_link(q) = r;
X token(r) = END_WRITE_TOKEN;
X ins_list(q);
X begin_token_list(write_tokens(p), WRITE_TEXT);
X q = new_token();
X token(q) = LEFT_BRACE_TOKEN + '{';
X ins_list(q);
X old_mode = mode;
X mode = 0;
X cur_cs = write_loc;
X scan_toks(FALSE, TRUE);
X get_token();
X if (cur_tok != END_WRITE_TOKEN) {
X print_err("Unbalanced write command");
X help_unbal_write();
X error();
X do get_token();
X while (cur_tok != END_WRITE_TOKEN);
X }
X mode = old_mode;
X end_token_list();
X old_setting = selector;
X j = write_stream(p);
X if (write_open[j])
X selector = j;
X else {
X if (j == 17 && selector == TERM_AND_LOG)
X selector = LOG_ONLY;
X print_nl("");
X }
X show_token_list(token_link(def_ref), NULL, 10000000);
X print_ln();
X flush_list(def_ref);
X selector = old_setting;
X}
X
Xout_special (p)
X ptr p;
X{
X int old_setting;
X int k;
X
X synch_h();
X synch_v();
X old_setting = selector;
X selector = NEW_STRING;
X show_token_list(token_link(write_tokens(p)),NULL,(val)POOL_SIZE-pool_ptr);
X selector = old_setting;
X str_room(1);
X if (cur_length() < 256) {
X dvi_out(XXX1);
X dvi_out(cur_length());
X } else {
X dvi_out(XXX4);
X dvi_four(cur_length());
X }
X for (k = str_start[str_ptr]; k < pool_ptr; incr(k))
X dvi_out(str_pool[k]);
X pool_ptr = str_start[str_ptr];
X}
X
X/*
X * Help text
X */
X
Xhelp_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}
SHAR_EOF
chmod 0444 texext.c || echo "restore of texext.c fails"
set `wc -c texext.c`;Sum=$1
if test "$Sum" != "6015"
then echo original size 6015, current size $Sum;fi
echo "x - extracting texext.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > texext.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 * texext.h
X */
X
X
X#define OPEN_NODE 0
X#define open_name(M) link(M + 1)
X#define open_area(M) info(M + 2)
X#define open_ext(M) link(M + 2)
X#define OPEN_NODE_SIZE 3
X
X#define WRITE_NODE 1
X#define write_tokens(M) link(M + 1)
X#define write_stream(M) info(M + 1)
X#define WRITE_NODE_SIZE 2
X
X#define CLOSE_NODE 2
X#define SPECIAL_NODE 3
X
X#define IMMEDIATE_CODE 4
X#define END_WRITE_TOKEN CS_TOKEN_FLAG + END_WRITE
X
Xglobal alpha_file write_file[];
X
Xglobal bool write_open[];
Xglobal ptr write_loc;
X
Xint do_extension();
X
Xint new_whatsit();
Xint show_whatsit();
Xint free_whatsit();
Xptr copy_whatsit();
Xint out_whatsit();
Xint new_write();
Xint out_write();
Xint print_write();
Xint out_special();
SHAR_EOF
chmod 0444 texext.h || echo "restore of texext.h fails"
set `wc -c texext.h`;Sum=$1
if test "$Sum" != "921"
then echo original size 921, current size $Sum;fi
echo "x - extracting tfm.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > tfm.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 * tfm.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 "hash.h"
X#include "box.h"
X#include "scan.h"
X#include "token.h"
X#include "tokenstack.h"
X#include "str.h"
X#include "io.h"
X#include "file.h"
X#include "print.h"
X#include "error.h"
X#include "tfm.h"
X
X/*
X * Read and check the font data;
X * If the TFM file is malformed, goto bad_tfm;
X * If there is no room for this font, say so and goto done;
X * otherwise, incr(font_ptr) and goto done.
X */
X
Xbyte_file tfm_file;
X
Xfourq null_character;
X
Xptr fmem_ptr;
Xmword font_info[FONT_MEM_SIZE];
X
Xfnt font_ptr = FONT_BASE;
Xfourq font_check[FONT_MAX];
Xscal font_size[FONT_MAX];
Xscal font_dsize[FONT_MAX];
Xhword font_params[FONT_MAX];
Xstr font_name[FONT_MAX];
Xstr font_area[FONT_MAX];
Xbyte font_bc[FONT_MAX];
Xbyte font_ec[FONT_MAX];
Xptr font_glue[FONT_MAX];
Xbool font_used[FONT_MAX];
Xint hyphen_char[FONT_MAX];
Xint skew_char[FONT_MAX];
Xint char_base[FONT_MAX];
Xint width_base[FONT_MAX];
Xint height_base[FONT_MAX];
Xint depth_base[FONT_MAX];
Xint italic_base[FONT_MAX];
Xint lig_kern_base[FONT_MAX];
Xint kern_base[FONT_MAX];
Xint exten_base[FONT_MAX];
Xint param_base[FONT_MAX];
X
X#define start_font_error_message() \
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#define read_sixteen(X) \
X {get_font_byte(); X = font_byte; \
X if (X > 127) goto bad_tfm; \
X get_font_byte(); X = (X) * 0400 + font_byte;}
X
X#define store_four_quarters(Q) \
X {a = get_font_byte(); b = get_font_byte(); \
X c = get_font_byte(); d = get_font_byte(); \
X qw.b0 = qi(a); qw.b1 = qi(b); \
X qw.b2 = qi(c); qw.b3 = qi(d); Q = qw;}
X
X#define store_scaled(S) \
X {a = get_font_byte(); b = get_font_byte(); \
X c = get_font_byte(); d = get_font_byte(); \
X sw = ((((d * z) / 0400) + (c * z)) / 0400 + (b * z)) / beta; \
X if (a == 0) S = sw; else if (a == 255) S = sw - alpha; \
X else goto bad_tfm;}
X
X#define check_byte_range(C) {if (C < bc || C > ec) goto bad_tfm;}
X#define ccbwo (k + bc - fmem_ptr)
X#define adjust(I) (I[f] = qo(I[f]))
X
Xfnt
Xread_font_info (u, nom, aire, s)
X fnt u;
X str nom;
X str aire;
X scal s;
X{
X byte a;
X byte b;
X byte c;
X byte d;
X fnt f;
X fnt g;
X int k;
X scal z;
X hword bc;
X hword ec;
X hword lf;
X hword lh;
X hword nd;
X hword ne;
X hword nh;
X hword ni;
X hword nk;
X hword nl;
X hword np;
X hword nw;
X fourq qw;
X scal sw;
X val alpha;
X hword beta;
X bool file_opened;
X byte font_byte;
X fourq dev_null;
X/*
X * Open tfm_file for input
X */
X g = NULL_FONT;
X file_opened = FALSE;
X pack_file_name(nom, aire, str_tfm);
X if ((tfm_file = b_open_in()) == NULL)
X goto bad_tfm;
X file_opened = TRUE;
X/*
X * Read the TFM size fields
X */
X read_sixteen(lf);
X read_sixteen(lh);
X read_sixteen(bc);
X read_sixteen(ec);
X if (bc > ec + 1 || ec > 255) goto bad_tfm;
X read_sixteen(nw);
X read_sixteen(nh);
X read_sixteen(nd);
X read_sixteen(ni);
X read_sixteen(nl);
X read_sixteen(nk);
X read_sixteen(ne);
X read_sixteen(np);
X if (lf != 6 + lh + (ec - bc + 1) + nw + nh + nd + ni + nl + nk + ne + np)
X goto bad_tfm;
X/*
X * Use size fields to allocate font information
X */
X lf = lf - 6 - lh;
X if (np < 7) lf += 7 - np;
X if (font_ptr == FONT_MAX-1 || fmem_ptr + lf >= FONT_MEM_SIZE) {
X start_font_error_message();
X print(" not loaded: No more room");
X help_font();
X error();
X goto done;
X }
X f = font_ptr + 1;
X char_base[f] = fmem_ptr - bc;
X width_base[f] = char_base[f] + ec + 1;
X height_base[f] = width_base[f] + nw;
X depth_base[f] = height_base[f] + nh;
X italic_base[f] = depth_base[f] + nd;
X lig_kern_base[f] = italic_base[f] + ni;
X kern_base[f] = lig_kern_base[f] + nl;
X exten_base[f] = kern_base[f] + nk;
X param_base[f] = exten_base[f] + ne;
X/*
X * Read the TFM header
X */
X if (lh < 2) goto bad_tfm;
X store_four_quarters(font_check[f]);
X read_sixteen(z);
X get_font_byte();
X z = z * 0400 + font_byte;
X get_font_byte();
X z = z * 020 + font_byte / 020;
X if (z < UNITY) goto bad_tfm;
X while (lh > 2) {
X store_four_quarters(dev_null);
X decr(lh);
X }
X font_dsize[f] = z;
X if (s != -1000) {
X if (s >= 0)
X z = s;
X else z = xn_over_d(z, -s, 1000L);
X }
X font_size[f] = z;
X/*
X * Read character data
X */
X for (k = fmem_ptr; k < width_base[f]; incr(k)) {
X store_four_quarters(font_info[k].qqqq);
X if (a >= nw || b / 020 >= nh || b % 020 >= nd || c / 4 > ni)
X goto bad_tfm;
X switch (c % 4)
X {
X case LIG_TAG:
X if (d >= nl) goto bad_tfm;
X break;
X
X case EXT_TAG:
X if (d >= ne) goto bad_tfm;
X break;
X
X case LIST_TAG:
X check_byte_range(d);
X while (d < ccbwo) {
X qw = char_info(f, d);
X if (char_tag(qw) != LIST_TAG)
X goto not_found;
X d = qo(rem_byte(qw));
X }
X if (d == ccbwo) goto bad_tfm;
X break;
X
X not_found:
X break;
X }
X }
X/*
X * Read box dimensions
X */
X alpha = 16 * z; beta = 16;
X while (z >= 040000000) {
X z >>= 1;
X beta >>= 1;
X }
X
X for (k = width_base[f]; k < lig_kern_base[f]; incr(k))
X store_scaled(font_info[k].sc);
X if (font_info[width_base[f]].sc != 0)
X goto bad_tfm;
X if (font_info[height_base[f]].sc != 0)
X goto bad_tfm;
X if (font_info[depth_base[f]].sc != 0)
X goto bad_tfm;
X if (font_info[italic_base[f]].sc != 0)
X goto bad_tfm;
X/*
X * Read ligature/kern programs
X */
X for (k = lig_kern_base[f]; k < kern_base[f]; incr(k)) {
X store_four_quarters(font_info[k].qqqq);
X check_byte_range(b);
X if (c < KERN_FLAG) {
X check_byte_range(d);
X } else if (d >= nk)
X goto bad_tfm;
X }
X if (nl > 0 && a < STOP_FLAG)
X goto bad_tfm;
X
X for (k = kern_base[f]; k < exten_base[f]; incr(k))
X store_scaled(font_info[k].sc);
X/*
X * Read extensible character recipes
X */
X for (k = exten_base[f]; k < param_base[f]; incr(k)) {
X store_four_quarters(font_info[k].qqqq);
X if (a != 0)
X check_byte_range(a);
X if (b != 0)
X check_byte_range(b);
X if (c != 0)
X check_byte_range(c);
X check_byte_range(d);
X }
X/*
X * Read font parameters
X */
X for (k = 1; k <= np; incr(k)) {
X if (k == 1) {
X get_font_byte();
X sw = font_byte;
X if (sw > 127)
X sw -= 256;
X get_font_byte();
X sw = sw * 0400 + font_byte;
X get_font_byte();
X sw = sw * 0400 + font_byte;
X get_font_byte();
X font_info[param_base[f]].sc = sw * 020 + font_byte / 020;
X } else
X store_scaled(font_info[param_base[f] + k - 1].sc);
X }
X if (feof(tfm_file))
X goto bad_tfm;
X
X for (k = np + 1; k <= 7; incr(k))
X font_info[param_base[f] + k - 1].sc = 0;
X/*
X * Make final adjustments and done
X */
X font_params[f] = (np >= 7) ? np : 7;
X hyphen_char[f] = default_hyphen_char;
X skew_char[f] = default_skew_char;
X font_name[f] = nom;
X font_area[f] = aire;
X font_bc[f] = bc;
X font_ec[f] = ec;
X font_glue[f] = NULL;
X adjust(char_base);
X adjust(width_base);
X adjust(lig_kern_base);
X adjust(kern_base);
X adjust(exten_base);
X decr(param_base[f]);
X fmem_ptr += lf;
X font_ptr = f;
X g = f;
X goto done;
X
Xbad_tfm:
X start_font_error_message();
X if (file_opened)
X print(" not loadable: Bad metric (TFM) file");
X else print(" not loadable: Metric (TFM) file not found");
X help_tfm();
X error();
X return NULL_FONT;
X
Xdone:
X b_close(tfm_file);
X return g;
X}
X
Xscan_font_ident ()
X{
X fnt f;
X int m;
X
X get_nbx_token();
X if (cur_cmd == DEF_FONT)
X f = cur_font;
X else if (cur_cmd == SET_FONT)
X f = cur_chr;
X else if (cur_cmd == DEF_FAMILY) {
X m = cur_chr;
X scan_four_bit_int();
X f = equiv(m + cur_val);
X } else {
X print_err("Missing font identifier");
X help_font_cs();
X back_error();
X f = NULL_FONT;
X }
X cur_val = f;
X}
X
Xfind_font_dimen (writing)
X bool writing;
X{
X fnt f;
X int n;
X
X scan_int();
X n = cur_val;
X scan_font_ident();
X f = cur_val;
X if (n <= 0)
X cur_val = fmem_ptr;
X else {
X if (writing &&
X n <= SPACE_SHRINK_CODE &&
X n >= SPACE_CODE &&
X font_glue[f] != NULL) {
X delete_glue_ref(font_glue[f]);
X font_glue[f] = NULL;
X }
X if (n > font_params[f]) {
X if (f < font_ptr)
X cur_val = fmem_ptr;
X else {
X do {
X if (fmem_ptr == FONT_MEM_SIZE)
X overflow("font_memory", FONT_MEM_SIZE);
X font_info[fmem_ptr].sc = 0;
X incr(fmem_ptr);
X incr(font_params[f]);
X } while (n != font_params[f]);
X cur_val = fmem_ptr - 1;
X }
X } else
X cur_val = n + param_base[f];
X }
X if (cur_val == fmem_ptr) {
X print_nl("! Font ");
X print_esc("");
X print_str(font_id_text(f));
X print(" has only ");
X print_int(font_params[f]);
X print(" fontdimen parameters");
X help_font_param();
X error();
X }
X}
X
Xchar_warning (f, c)
X fnt f;
X byte c;
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 print_char('!');
X end_diagnostic(FALSE);
X }
X}
X
Xptr
Xnew_character (f, c)
X fnt f;
X byte c;
X{
X ptr p;
X
X if (font_bc[f] <= c && font_ec[f] >= c) {
X if (char_exists(char_info(f, qi(c)))) {
X p = get_avail();
X font(p) = f;
X character(p) = qi(c);
X return p;
X }
X }
X char_warning(f, c);
X return NULL;
X}
X
Xinit_tfm ()
X{
X fmem_ptr = 7;
X font_params[0] = 7;
X font_bc[0] = 1;
X font_glue[0] = zero_glue;
X hyphen_char[0] = '-';
X skew_char[0] = -1;
X param_base[0] = -1;
X}
X
X/*
X * Help text
X */
X
Xhelp_font ()
X{
X help4("I'm afraid I won't be able to make use of this font,",
X "because my memory for character-size data is too small.",
X "If you're really stuck, ask a wizard to enlarge me.",
X "Or maybe try `I\\font<same font id>=<name of loaded font>'.");
X}
X
Xhelp_tfm ()
X{
X help5("I wasn't able to read the size data for this font,",
X "so I will ignore the font specification.",
X "[Wizards can fix TFM files using TFtoPL/PLtoTF.]",
X "You might try inserting a different font spec;",
X "e.g., type `I\\font<same font id>=<substitute font name>'.");
X}
X
Xhelp_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
Xhelp_font_cs ()
X{
X help2("I was looking for a control sequence whose",
X "current meaning has been defined by \\font.");
X}
SHAR_EOF
chmod 0444 tfm.c || echo "restore of tfm.c fails"
set `wc -c tfm.c`;Sum=$1
if test "$Sum" != "10162"
then echo original size 10162, current size $Sum;fi
echo "x - extracting tfm.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > tfm.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 * tfm.h
X */
X
Xglobal byte_file tfm_file;
X
Xglobal mword font_info[];
Xglobal ptr fmem_ptr;
X
Xglobal fourq null_character;
X
Xglobal fourq font_check[];
Xglobal scal font_size[];
Xglobal scal font_dsize[];
Xglobal hword font_params[];
Xglobal str font_name[];
Xglobal str font_area[];
Xglobal byte font_bc[];
Xglobal byte font_ec[];
Xglobal ptr font_glue[];
Xglobal bool font_used[];
Xglobal int hyphen_char[];
Xglobal int skew_char[];
X
Xglobal int char_base[];
Xglobal int width_base[];
Xglobal int height_base[];
Xglobal int depth_base[];
Xglobal int italic_base[];
Xglobal int lig_kern_base[];
Xglobal int kern_base[];
Xglobal int exten_base[];
Xglobal int param_base[];
X
Xglobal fnt font_ptr;
X
X#define char_exists(CI) \
X ((CI).b0 > MIN_QUARTERWORD)
X
X#define char_info(F, C) \
X font_info[char_base[F] + (C)].qqqq
X
X#define char_width(F, CI) \
X font_info[width_base[F] + CI.b0].sc
X
X#define char_height(F, CB) \
X font_info[height_base[F] + (CB) / 16].sc
X
X#define char_depth(F, CB) \
X font_info[depth_base[F] + (CB) % 16].sc
X
X#define char_italic(F, CI) \
X font_info[italic_base[F] + qo(CI.b2) / 4].sc
X
X#define NO_TAG 0
X#define LIG_TAG 1
X#define LIST_TAG 2
X#define EXT_TAG 3
X
X#define stop_bit(M) M.b0
X#define next_char(M) M.b1
X#define op_bit(M) M.b2
X#define rem_byte(M) M.b3
X#define STOP_FLAG 128
X#define KERN_FLAG 128
X
X#define ext_top(M) M.b0
X#define ext_mid(M) M.b1
X#define ext_bot(M) M.b2
X#define ext_rep(W) W.b3
X
X#define char_tag(CI) \
X qo(CI.b2) % 4
X
X#define height_depth(CI) \
X qo(CI.b1)
X
X#define lig_kern_start(F, CI) \
X lig_kern_base[F] + rem_byte(CI)
X
X#define char_kern(F, CI) \
X font_info[kern_base[F] + rem_byte(CI)].sc
X
X#define SLANT_CODE 1
X#define SPACE_CODE 2
X#define SPACE_STRETCH_CODE 3
X#define SPACE_SHRINK_CODE 4
X#define X_HEIGHT_CODE 5
X#define QUAD_CODE 6
X#define EXTRA_SPACE_CODE 7
X
X#define param(F, CODE) \
X font_info[param_base[F] + CODE].sc
X
X#define slant(F) \
X param(F, SLANT_CODE)
X
X#define space(F) \
X param(F, SPACE_CODE)
X
X#define space_stretch(F) \
X param(F, SPACE_STRETCH_CODE)
X
X#define space_shrink(F) \
X param(F, SPACE_SHRINK_CODE)
X
X#define x_height(F) \
X param(F, X_HEIGHT_CODE)
X
X#define quad(F) \
X param(F, QUAD_CODE)
X
X#define extra_space(F) \
X param(F, EXTRA_SPACE_CODE)
X
Xfnt read_font_info();
Xint find_font_dimen();
Xint scan_font_ident();
Xint char_warning();
Xptr new_character();
SHAR_EOF
chmod 0444 tfm.h || echo "restore of tfm.h fails"
set `wc -c tfm.h`;Sum=$1
if test "$Sum" != "2561"
then echo original size 2561, current size $Sum;fi
echo "x - extracting tfms.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > tfms.c &&
SHAR_EOF
chmod 0444 tfms.c || echo "restore of tfms.c fails"
set `wc -c tfms.c`;Sum=$1
if test "$Sum" != "0"
then echo original size 0, current size $Sum;fi
echo "x - extracting token.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > token.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 * token.c
X */
X
X#include "tex.h"
X#include "cmds.h"
X#include "heap.h"
X#include "eq.h"
X#include "hash.h"
X#include "scan.h"
X#include "io.h"
X#include "char.h"
X#include "box.h"
X#include "cond.h"
X#include "print.h"
X#include "error.h"
X#include "expand.h"
X#include "align.h"
X#include "tokenstack.h"
X#include "token.h"
X
Xhword cur_chr;
Xbyte cur_cmd;
Xptr cur_cs;
Xhword cur_tok;
X
X/*
X * this is the TeX segment
X */
X
Xhword tok[TOK_MAX-TOK_MIN+1];
Xhword tok_link[TOK_MAX-TOK_MIN+1];
Xptr tok_head;
Xptr tok_low;
Xptr tok_end;
Xint tok_used;
X
Xptr par_loc;
Xhword par_token;
X
Xbool force_eof;
X
Xget_token ()
X{
X no_new_control_sequence = FALSE;
X get_next();
X no_new_control_sequence = TRUE;
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#define reduce_expanded_cc() \
X {if (buffer[k] == cur_chr && \
X cat == SUP_MARK && k < limit) { \
X cur_chr = buffer[k + 1]; \
X if (cur_chr < 0100) \
X buffer[k - 1] = cur_chr + 0100; \
X else buffer[k - 1] = cur_chr - 0100; \
X limit -= 2; \
X first -= 2; \
X while (k <= limit) { \
X buffer[k] = buffer[k + 2]; \
X incr(k);} \
X goto start_cs;}}
X
X#define any_state(CAT) \
X case MID_LINE + CAT: \
X case SKIP_BLANKS + CAT: \
X case NEW_LINE + CAT
X
X#define delims(CAT) \
X case MATH_SHIFT + CAT: \
X case TAB_MARK + CAT: \
X case MAC_PARAM + CAT: \
X case SUB_MARK + CAT: \
X case LETTER + CAT: \
X case OTHER_CHAR + CAT
X
X#define mid_line(CAT) \
X case MID_LINE + CAT
X
X#define new_line(CAT) \
X case NEW_LINE + CAT
X
X#define skip_blanks(CAT) \
X case SKIP_BLANKS + CAT
X
Xget_next ()
X{
X int k;
X hword t;
X int cat;
X
Xrestart:
X cur_cs = 0;
X if (state != TOKEN_LIST) {
Xreread:
X if (loc <= limit) {
X cur_chr = buffer[loc];
X incr(loc);
Xreswitch:
X cur_cmd = cat_code(cur_chr);
X switch (state + cur_cmd)
X {
X any_state(IGNORE):
X skip_blanks(SPACER):
X new_line(SPACER):
X goto reread;
X break;
X
X any_state(ESCAPE):
X if (loc > limit)
X cur_cs = NULL_CS;
X else {
X start_cs:
SHAR_EOF
echo "End of part 13"
echo "File token.c is continued in part 14"
echo "14" > s2_seq_.tmp
exit 0
More information about the Comp.unix.xenix
mailing list