summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2011-08-01 10:21:26 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2011-08-01 10:21:26 +0000
commitdced0f61f3eb8e164594fafc628ac7d8f97eacaf (patch)
tree10fa5a3b780fa37c7e9389a6ac51e0b5f8438503 /Build
parent9728af2a7e87fddfa3a77ae6dc24755d3dda3e71 (diff)
seetexk: remove unused files
git-svn-id: svn://tug.org/texlive/trunk@23301 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r--Build/source/texk/seetexk/ChangeLog12
-rw-r--r--Build/source/texk/seetexk/Makefile.am42
-rw-r--r--Build/source/texk/seetexk/Makefile.in38
-rw-r--r--Build/source/texk/seetexk/bcopy.c26
-rw-r--r--Build/source/texk/seetexk/bzero.c17
-rw-r--r--Build/source/texk/seetexk/conv.c52
-rw-r--r--Build/source/texk/seetexk/conv.h89
-rw-r--r--Build/source/texk/seetexk/convstruct.h38
-rw-r--r--Build/source/texk/seetexk/dvi_draw.c390
-rw-r--r--Build/source/texk/seetexk/dvistate.c245
-rw-r--r--Build/source/texk/seetexk/dvistate.h112
-rw-r--r--Build/source/texk/seetexk/dvistuff.c1190
-rw-r--r--Build/source/texk/seetexk/dvistuff.h145
-rw-r--r--Build/source/texk/seetexk/findpost.c88
-rw-r--r--Build/source/texk/seetexk/font.c544
-rw-r--r--Build/source/texk/seetexk/font_subr.c253
-rw-r--r--Build/source/texk/seetexk/getopt.c73
-rw-r--r--Build/source/texk/seetexk/gfclass.c81
-rw-r--r--Build/source/texk/seetexk/gfclass.h58
-rw-r--r--Build/source/texk/seetexk/gfcodes.h44
-rw-r--r--Build/source/texk/seetexk/gffont.c946
-rw-r--r--Build/source/texk/seetexk/magfactor.c40
-rw-r--r--Build/source/texk/seetexk/num.h39
-rw-r--r--Build/source/texk/seetexk/pkfont.c731
-rw-r--r--Build/source/texk/seetexk/postamble.h48
-rw-r--r--Build/source/texk/seetexk/pxlfont.c306
-rw-r--r--Build/source/texk/seetexk/rotate.c156
-rw-r--r--Build/source/texk/seetexk/rstfont.c301
-rw-r--r--Build/source/texk/seetexk/scaletfm.c120
-rw-r--r--Build/source/texk/seetexk/scanpost.c111
-rw-r--r--Build/source/texk/seetexk/sdecode.c689
-rw-r--r--Build/source/texk/seetexk/sdecode.h54
-rw-r--r--Build/source/texk/seetexk/skip.c30
-rw-r--r--Build/source/texk/seetexk/split.c226
-rw-r--r--Build/source/texk/seetexk/strsave.c31
-rw-r--r--Build/source/texk/seetexk/strtol.c56
-rw-r--r--Build/source/texk/seetexk/tfm.c124
-rw-r--r--Build/source/texk/seetexk/tfm.h84
-rw-r--r--Build/source/texk/seetexk/tfmfont.c262
39 files changed, 13 insertions, 7878 deletions
diff --git a/Build/source/texk/seetexk/ChangeLog b/Build/source/texk/seetexk/ChangeLog
index 8c51dac24d1..dfa21b1dea6 100644
--- a/Build/source/texk/seetexk/ChangeLog
+++ b/Build/source/texk/seetexk/ChangeLog
@@ -1,3 +1,15 @@
+2011-08-01 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ Remove unused files (they can still be found under
+ <http://ctan.org/tex-archive/dviware/dvibook/libtex>).
+ * bcopy.c, bzero.c, conv.[ch], convstruct.h, dvi_draw.c,
+ dvistate.[ch], dvistuff.[ch], findpost.c, font.c, font_subr.c,
+ getopt.c, gfclass.[ch], gfcodes.h, gffont.c, magfactor.c, num.h,
+ pkfont.c, postamble.h, pxlfont.c, rotate.c, rstfont.c,
+ scaletfm.c, scanpost.c, sdecode.[ch], skip.c, split.c, strsave.c,
+ strtol.c, tfm.[ch], tfmfont.c: All removed.
+ * Makefile.am [EXTRA_DIST]: Removed.
+
2010-12-08 Peter Breitenlohner <peb@mppmu.mpg.de>
* dviconcat.c, dviselect.c: Fix typo (RBIN_MODE => WBIN_MODE).
diff --git a/Build/source/texk/seetexk/Makefile.am b/Build/source/texk/seetexk/Makefile.am
index 4efd518295b..c824cb8774b 100644
--- a/Build/source/texk/seetexk/Makefile.am
+++ b/Build/source/texk/seetexk/Makefile.am
@@ -1,6 +1,6 @@
## Makefile.am for the TeX Live subdirectory texk/seetexk/
##
-## Copyright (C) 2009 Peter Breitenlohner <tex-live@tug.org>
+## Copyright (C) 2009, 2011 Peter Breitenlohner <tex-live@tug.org>
## You may freely use, modify and/or distribute this file.
##
ACLOCAL_AMFLAGS = -I ../../m4
@@ -46,43 +46,3 @@ dist_man1_MANS = dvibook.man dviconcat.man dviselect.man dvitodvi.man
## Rebuild libkpathsea
@KPATHSEA_RULE@
-## Not used
-##
-EXTRA_DIST = \
- bcopy.c \
- bzero.c \
- conv.c \
- conv.h \
- convstruct.h \
- dvi_draw.c \
- dvistate.c \
- dvistate.h \
- dvistuff.c \
- dvistuff.h \
- findpost.c \
- font.c \
- font_subr.c \
- getopt.c \
- gfclass.c \
- gfclass.h \
- gfcodes.h \
- gffont.c \
- magfactor.c \
- num.h \
- pkfont.c \
- postamble.h \
- pxlfont.c \
- rotate.c \
- rstfont.c \
- scaletfm.c \
- scanpost.c \
- sdecode.c \
- sdecode.h \
- skip.c \
- split.c \
- strsave.c \
- strtol.c \
- tfm.c \
- tfm.h \
- tfmfont.c
-
diff --git a/Build/source/texk/seetexk/Makefile.in b/Build/source/texk/seetexk/Makefile.in
index c42181d1015..1b1cc01cf44 100644
--- a/Build/source/texk/seetexk/Makefile.in
+++ b/Build/source/texk/seetexk/Makefile.in
@@ -300,44 +300,6 @@ noinst_HEADERS = \
dvicodes.h
dist_man1_MANS = dvibook.man dviconcat.man dviselect.man dvitodvi.man
-EXTRA_DIST = \
- bcopy.c \
- bzero.c \
- conv.c \
- conv.h \
- convstruct.h \
- dvi_draw.c \
- dvistate.c \
- dvistate.h \
- dvistuff.c \
- dvistuff.h \
- findpost.c \
- font.c \
- font_subr.c \
- getopt.c \
- gfclass.c \
- gfclass.h \
- gfcodes.h \
- gffont.c \
- magfactor.c \
- num.h \
- pkfont.c \
- postamble.h \
- pxlfont.c \
- rotate.c \
- rstfont.c \
- scaletfm.c \
- scanpost.c \
- sdecode.c \
- sdecode.h \
- skip.c \
- split.c \
- strsave.c \
- strtol.c \
- tfm.c \
- tfm.h \
- tfmfont.c
-
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-am
diff --git a/Build/source/texk/seetexk/bcopy.c b/Build/source/texk/seetexk/bcopy.c
deleted file mode 100644
index e9bb17ea79e..00000000000
--- a/Build/source/texk/seetexk/bcopy.c
+++ /dev/null
@@ -1,26 +0,0 @@
-#ifndef lint
-static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/bcopy.c,v 3.1 89/08/22 21:42:07 chris Exp $";
-#endif
-
-/*
- * Sample bcopy() routine.
- * This should be rewritten to be as fast as possible for your
- * machine.
- */
-void bcopy(from, to, count)
- register char *from, *to;
- register int count;
-{
-
- if (from == to)
- return;
- if (from > to) {
- while (--count >= 0)
- *to++ = *from++;
- } else {
- from += count;
- to += count;
- while (--count >= 0)
- *--to = *--from;
- }
-}
diff --git a/Build/source/texk/seetexk/bzero.c b/Build/source/texk/seetexk/bzero.c
deleted file mode 100644
index cf1dd416452..00000000000
--- a/Build/source/texk/seetexk/bzero.c
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef lint
-static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/bzero.c,v 3.1 89/08/22 21:42:12 chris Exp $";
-#endif
-
-/*
- * Sample bzero() routine.
- * This should be rewritten to be as fast as possible for your
- * machine.
- */
-bzero(addr, count)
- register char *addr;
- register int count;
-{
-
- while (--count >= 0)
- *addr++ = 0;
-}
diff --git a/Build/source/texk/seetexk/conv.c b/Build/source/texk/seetexk/conv.c
deleted file mode 100644
index f2b096e8ddd..00000000000
--- a/Build/source/texk/seetexk/conv.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 1987, 1989 University of Maryland
- * Department of Computer Science. All rights reserved.
- * Permission to copy for any purpose is hereby granted
- * so long as this copyright notice remains intact.
- */
-
-#ifndef lint
-static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/conv.c,v 3.1 89/08/22 21:48:01 chris Exp $";
-#endif
-
-/*
- * Conversions.
- */
-
-#include "types.h"
-#include "conv.h"
-
-double DMagFactor();
-
-Conv Conversion; /* the global conversion */
-
-/*
- * Set a conversion (possibly the global conversion).
- */
-void
-CSetConversion(c, dpi, usermag, num, denom, dvimag)
- register struct conversion *c;
- int dpi, usermag;
- i32 num, denom, dvimag;
-{
- double ddpi = dpi;
-
- c->c_mag = DMagFactor((int) dvimag) * DMagFactor(usermag);
- c->c_dpi = ddpi;
-
- /*
- * The conversion facture is figured as follows: there are exactly
- * num/denom DVI units per decimicron, and 254000 decimicrons per
- * inch, and dpi pixels per inch. Then we have to adjust this by
- * the stated magnification.
- */
- c->c_fromsp = (num / 254000.0) * (ddpi / denom) * c->c_mag;
-
- /*
- * c->c_tosp is 1/c->c_fromsp, but we will invert the expression
- * above in the hopes of some extra accuracy.
- *
- * IS THIS ANY GOOD? I NEED A NUMERICAL ANALYST!
- */
- c->c_tosp = (254000.0 / num) * (denom / ddpi) * (1.0 / c->c_mag);
-}
diff --git a/Build/source/texk/seetexk/conv.h b/Build/source/texk/seetexk/conv.h
deleted file mode 100644
index 3350ff5a909..00000000000
--- a/Build/source/texk/seetexk/conv.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 1987, 1989 University of Maryland
- * Department of Computer Science. All rights reserved.
- * Permission to copy for any purpose is hereby granted
- * so long as this copyright notice remains intact.
- */
-
-/*
- * Conversions. Conversion factors convert between values in scaled
- * points and values in device-dependent units. The results of all
- * conversions are rounded to the nearest integral value, of type (i32).
- */
-
-/*
- * This is now done using `double' values, but may be changed to
- * fixed-point or some other `fast' method, as long as the results
- * are consistent and reasonably accurate. The structure `conversion'
- * holds the conversion-method-dependent quantities; the macros
- * fromSP and toSP apply the conversion to a value. (Note that
- * fromSP and toSP need not be macros, but should be fast.)
- *
- * SetConversion sets the (single, global) conversion factor.
- * If a driver needs special conversions, there is another routine,
- * CSetConversion that sets a specific conversion, and cfromSP and
- * ctoSP to apply these.
- *
- * IS USING DOTS PER INCH SUFFICIENT? (Pixels per point might be better.)
- *
- * Note that it is necessary to set the global conversion factor before
- * using any fonts.
- */
-typedef struct conversion {
- double c_fromsp; /* multiplier to convert from scaled points */
- double c_tosp; /* multiplier to convert to scaled points:
- could divide by c_fromsp, but this should
- be faster and more accurate */
- double c_mag; /* the magnification this conversion
- represents; mainly for GetFont() */
- double c_dpi; /* dpi (should be pixels per point?) */
-} Conv;
-
-extern Conv Conversion; /* the global conversion factor */
-
-/*
- * In order to do this, we need to round properly. The compilers I
- * have tend to generate very poor code for this. The following is
- * intended to help them out. Smarter compilers can do better, but
- * if they are smart enough, they will realise that the variables
- * here are not used anywhere else, and discard them. (For a compiler
- * to do this given separate compliation, `static' is a must.)
- */
-#ifdef lint /* or a smart compiler */
-
-#define ROUND(f) ((i32) ((f) < 0.0 ? (f) - 0.5 : (f) + 0.5))
-#define CEIL(f) ((double) (i32) (f) < (f) ? (i32) (f) + 1 : (i32) (f))
-
-#else /* lint */
-
-static double _half = 0.5;
-static double _d;
-#define ROUND(f) ((i32) (_d = (f), _d < 0.0 ? _d - _half : _d + _half))
-
-#ifdef NEGATIVE_FLOAT_ROUNDS_TO_NEGATIVE_INFINITY
-#define CEIL(f) (-(i32) -(f))
-#else /* we will assume that floating to integer truncates */
-static i32 _i;
-#define CEIL(f) (_i = _d = (f), _i < _d ? _i + 1 : _i)
-#endif /* round towards negative infinity */
-
-#endif /* lint */
-
-#define SetConversion(dpi, usermag, num, denom, dvimag) \
- CSetConversion(&Conversion, dpi, usermag, num, denom, dvimag)
-
-#define cfromSP(c, v) ROUND((c)->c_fromsp * (v))
-#define ctoSP(c, v) ROUND((c)->c_tosp * (v))
-
-#define fromSP(v) cfromSP(&Conversion, v)
-#define toSP(v) ctoSP(&Conversion, v)
-
-/*
- * Conversions for rules are a bit different: we must round up, rather
- * than off. ConvRule applies the global conversion value for a rule
- * value (height or width); CConvRule applies a specific conversion.
- */
-#define CConvRule(c, v) CEIL((c)->c_fromsp * (v))
-#define ConvRule(v) CConvRule(&Conversion, v)
-
-void CSetConversion();
diff --git a/Build/source/texk/seetexk/convstruct.h b/Build/source/texk/seetexk/convstruct.h
deleted file mode 100644
index b0f97088d8b..00000000000
--- a/Build/source/texk/seetexk/convstruct.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright 1989 Chris Torek
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and that
- * both that copyright notice and this permission notice appear in
- * supporting documentation, and that the name of Chris Torek or M.I.T.
- * not be used in advertising or publicity pertaining to distribution of
- * the software without specific, written prior permission. Chris
- * Torek and M.I.T. make no representations about the suitability of
- * this software for any purpose. It is provided "as is" without express
- * or implied warranty.
- *
- * CHRIS TOREK AND M.I.T. DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS. IN NO EVENT SHALL CHRIS TOREK OR M.I.T. BE LIABLE FOR ANY
- * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
- * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
- * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Original Author:
- * Chris Torek
- * Dept. of Computer Science
- * Univ. of Maryland
- * chris@cs.umd.edu
- */
-
-typedef struct conversion {
- double c_fromsp; /* multiplier to convert from scaled points */
- double c_tosp; /* multiplier to convert to scaled points:
- could divide by c_fromsp, but this should
- be faster and more accurate */
- double c_mag; /* the magnification this conversion
- represents; mainly for GetFont() */
- double c_dpi; /* dpi (should be pixels per point?) */
-} Conv;
diff --git a/Build/source/texk/seetexk/dvi_draw.c b/Build/source/texk/seetexk/dvi_draw.c
deleted file mode 100644
index 9f4f793b937..00000000000
--- a/Build/source/texk/seetexk/dvi_draw.c
+++ /dev/null
@@ -1,390 +0,0 @@
-/*
- * Support drawing routines for TeXsun and TeX
- *
- * Copyright, (C) 1987, 1988 Tim Morgan, UC Irvine
- * Copyright 1989 Dirk Grunwald (extensions & fixes)
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and that
- * both that copyright notice and this permission notice appear in
- * supporting documentation, and that the name of Tim Morgan, Dirk
- * Grunwald or M.I.T. not be used in advertising or publicity
- * pertaining to distribution of the software without specific,
- * written prior permission. Tim Morgan, Dirk Grunwald and M.I.T.
- * makes no representations about the suitability of
- * this software for any purpose. It is provided "as is" without express
- * or implied warranty.
- *
- * TIM MORGAN,
- * DIRK GRUNWALD AND M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
- * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS, IN NO EVENT SHALL M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT
- * OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
- * OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author:
- * Tim Morgan
- * Dept. of Computer Science
- * Univ. of Calf. at Irvine
- *
- * Dirk Grunwald
- * Dept. of Computer Science
- *
- *
- * At the time these routines are called, the values of hh and vv should
- * have been updated to the upper left corner of the graph (the position
- * the \special appears at in the dvi file). Then the coordinates in the
- * graphics commands are in terms of a virtual page with axes oriented the
- * same as the Imagen and the SUN normally have:
- *
- * 0,0
- * +-----------> +x
- * |
- * |
- * |
- * \ /
- * +y
- *
- * Angles are measured in the conventional way, from +x towards +y.
- * Unfortunately, that reverses the meaning of "counterclockwise"
- * from what it's normally thought of.
- *
- * A lot of floating point arithmetic has been converted to integer
- * arithmetic for speed. In some places, this is kind-of kludgy, but
- * it's worth it.
- */
-
-static char *rcsid="$Header: /usr/local/src/Uiuctex/libtex/RCS/dvi_draw.c,v 1.3 88/02/19 17:00:34 grunwald Exp Locker: grunwald $" ;
-
-#include <math.h>
-#include <stdio.h>
-#include <ctype.h>
-
-#define MAXPOINTS 300 /* Max points in a path */
-#define TWOPI (3.14159265359*2.0)
-#define MAX_PEN_SIZE 7 /* Max pixels of pen width */
-
-
-static int xx[MAXPOINTS], yy[MAXPOINTS]; /* Path in milli-inches */
-static int path_len = 0; /* # points in current path */
-int pen_size = 1; /* Pixel width of lines drawn */
-#define FALSE 0
-#define TRUE 1
-int whiten = FALSE, shade = FALSE, blacken = FALSE;
-
-extern void dot_at(), line_btw(), do_attribute_path();
-
-#define shrink_factor shrinkFactor[currentShrink]
-
-/* Unfortunately, these values also appear in dvisun.c */
-#define xRESOLUTION (dviDPI/shrink_factor)
-#define yRESOLUTION (dviDPI/shrink_factor)
-
-extern int dviDPI, currentShrink, shrinkFactor[];
-
-
-/*
- * Issue warning/error messages
- */
-void Fatal(msg)
-char *msg;
-{
- fprintf(stderr, "%s\n", msg);
- exit(1);
-}
-
-static void Warning(fmt, msg)
-char *fmt, *msg;
-{
- fprintf(stderr, fmt, msg);
- fputc ('\n', stderr);
-}
-
-
-/*
- * Set the size of the virtual pen used to draw in milli-inches
- */
-/* ARGSUSED */
-void set_pen_size(cp)
-char *cp;
-{
- int ps;
-
- if (sscanf(cp, " %d ", &ps) != 1) {
- Warning("illegal .ps command format: %s", cp);
- return;
- }
- pen_size = (ps*(xRESOLUTION+yRESOLUTION) + 1000) / 2000;
- if (pen_size < 1) pen_size = 1;
- else if (pen_size > MAX_PEN_SIZE) pen_size = MAX_PEN_SIZE;
-}
-
-
-/*
- * Print the line defined by previous path commands
- */
-void flush_path()
-{
- register int i;
- int last_min_x, last_max_x, last_min_y, last_max_y;
-
- last_min_x = 30000; last_min_y = 30000;
- last_max_x = -30000; last_max_y = -30000;
- for (i=1; i<path_len; i++) {
- if (xx[i] > last_max_x) last_max_x = xx[i];
- if (xx[i] < last_min_x) last_min_x = xx[i];
- if (yy[i] > last_max_y) last_max_y = yy[i];
- if (yy[i] < last_min_y) last_min_y = yy[i];
- line_btw(xx[i], yy[i], xx[i+1], yy[i+1]);
- }
- if (xx[path_len] > last_max_x) last_max_x = xx[path_len];
- if (xx[path_len] < last_min_x) last_min_x = xx[path_len];
- if (yy[path_len] > last_max_y) last_max_y = yy[path_len];
- if (yy[path_len] < last_min_y) last_min_y = yy[path_len];
- path_len = 0;
- do_attribute_path(last_min_x, last_max_x, last_min_y, last_max_y);
-}
-
-
-/*
- * Print a dashed line along the previously defined path, with
- * the dashes/inch defined.
- */
-void flush_dashed(cp, dotted)
-char *cp;
-int dotted;
-{
- int i, numdots, x0, y0, x1, y1;
- int cx0, cy0, cx1, cy1;
- float inchesperdash;
- double d, spacesize, a, b, dx, dy, milliperdash;
-
- if (sscanf(cp, " %f ", &inchesperdash) != 1) {
- Warning("illegal format for dotted/dashed line: %s", cp);
- return;
- }
- if (path_len <= 1 || inchesperdash <= 0.0) {
- Warning("illegal conditions for dotted/dashed line%s", "");
- return;
- }
- milliperdash = inchesperdash * 1000.0;
- x0 = xx[1]; y0 = yy[1];
- x1 = xx[2]; y1 = yy[2];
- dx = x1 - x0;
- dy = y1 - y0;
- if (dotted) {
- numdots = sqrt(dx*dx + dy*dy) / milliperdash + 0.5;
- if ( numdots == 0 ) { /* always draw at least one dot */
- numdots = 1;
- }
- for (i=0; i <= numdots; i++) {
- a = (float) i / (float) numdots;
- cx0 = x0 + a*dx + 0.5;
- cy0 = y0 + a*dy + 0.5;
- dot_at(cx0, cy0);
- }
- }
- else {
- d = sqrt(dx*dx + dy*dy);
- if (d <= 2.0*milliperdash)
- line_btw(x0, y0, x1, y1);
- else {
- numdots = d / (2.0*milliperdash) + 1.0;
- spacesize = (d - numdots * milliperdash) / (numdots - 1);
- for (i=0; i<numdots-1; i++) {
- a = i * (milliperdash + spacesize) / d;
- b = a + milliperdash / d;
- cx0 = x0 + a*dx + 0.5;
- cy0 = y0 + a*dy + 0.5;
- cx1 = x0 + b*dx + 0.5;
- cy1 = y0 + b*dy + 0.5;
- line_btw(cx0, cy0, cx1, cy1);
- b += spacesize / d;
- }
- cx0 = x0 + b*dx + 0.5;
- cy0 = y0 + b*dy + 0.5;
- line_btw(cx0, cy0, x1, y1);
- }
- }
- path_len = 0;
-}
-
-
-/*
- * Add a point to the current path
- */
-void add_path(cp)
-char *cp;
-{
- int pathx, pathy;
-
- if (++path_len >= MAXPOINTS) Fatal("Too many points");
- if (sscanf(cp, " %d %d ", &pathx, &pathy) != 2)
- Fatal("Malformed path command");
- xx[path_len] = pathx;
- yy[path_len] = pathy;
-}
-
-
-/*
- * Draw to a floating point position
- */
-static void im_fdraw(x, y)
-double x,y;
-{
- if (++path_len >= MAXPOINTS) Fatal("Too many arc points");
- xx[path_len] = x + 0.5;
- yy[path_len] = y + 0.5;
-}
-
-
-/*
- * Draw an arc
- */
-void arc(cp)
-char *cp;
-{
- int xc, yc, xrad, yrad, n;
- float start_angle, end_angle, angle, theta, r;
- double xradius, yradius, xcenter, ycenter;
-
- if (sscanf(cp, " %d %d %d %d %f %f ", &xc, &yc, &xrad, &yrad, &start_angle,
- &end_angle) != 6) {
- Warning("illegal arc specification: %s", cp);
- return;
- }
- /* We have a specialized fast way to draw closed circles/ellipses */
- if (start_angle <= 0.0 && end_angle >= 6.282) {
- draw_ellipse(xc, yc, xrad, yrad);
- return;
- }
- xcenter = xc;
- ycenter = yc;
- xradius = xrad;
- yradius = yrad;
- r = (xradius + yradius) / 2.0;
- theta = sqrt(1.0 / r);
- n = 0.3 * TWOPI / theta + 0.5;
- if (n < 12) n = 12;
- else if (n > 80) n = 80;
- n /= 2;
- theta = TWOPI / n;
- flush_path();
- im_fdraw( xcenter + xradius*cos(start_angle),
- ycenter + yradius*sin(start_angle) );
- angle = start_angle + theta;
- while (angle < end_angle) {
- im_fdraw(xcenter + xradius*cos(angle),
- ycenter + yradius*sin(angle) );
- angle += theta;
- }
- im_fdraw(xcenter + xradius*cos(end_angle),
- ycenter + yradius*sin(end_angle) );
- flush_path();
-}
-
-
-/*
- * APPROXIMATE integer distance between two points
- */
-#define dist(x0, y0, x1, y1) (abs(x0-x1)+abs(y0-y1))
-
-
-/*
- * Draw a spline along the previously defined path
- */
-void flush_spline()
-{
- int xp, yp, N, lastx=(-1), lasty;
- int t1, t2, t3, steps, j;
- register int i, w;
-
-#ifdef lint
- lasty = -1;
-#endif
- N = path_len + 1;
- xx[0] = xx[1]; yy[0] = yy[1];
- xx[N] = xx[N-1]; yy[N] = yy[N-1];
- for (i=0; i<N-1; i++) { /* interval */
- steps = (dist(xx[i], yy[i], xx[i+1], yy[i+1]) +
- dist(xx[i+1], yy[i+1], xx[i+2], yy[i+2])) / 80;
- for (j=0; j<steps; j++) { /* points within */
- w = (j*1000 + 500) / steps;
- t1 = w * w / 20;
- w -= 500;
- t2 = (750000 - w * w) / 10;
- w -= 500;
- t3 = w * w / 20;
- xp = (t1*xx[i+2] + t2*xx[i+1] + t3*xx[i] + 50000) / 100000;
- yp = (t1*yy[i+2] + t2*yy[i+1] + t3*yy[i] + 50000) / 100000;
- if (lastx > -1) line_btw(lastx, lasty, xp, yp);
- lastx = xp;
- lasty = yp;
- }
- }
- path_len = 0;
-}
-
-
-/*
- * Shade the last box, circle, or ellipse
- */
-void shade_last()
-{
- blacken = whiten = FALSE;
- shade = TRUE;
-}
-
-
-/*
- * Make the last box, circle, or ellipse, white inside (shade with white)
- */
-void whiten_last()
-{
- whiten = TRUE;
- blacken = shade = FALSE;
-}
-
-
-/*
- * Make last box, etc, black inside
- */
-void blacken_last()
-{
- blacken = TRUE;
- whiten = shade = FALSE;
-}
-
-
-/*
- * Draw an ellipse with the indicated center and radices.
- */
-draw_ellipse(xc, yc, xr, yr)
-int xc, yc, xr, yr;
-{
- double angle, theta;
- int n, px0, py0, px1, py1;
-
- angle = (xr + yr) / 2.0;
- theta = sqrt(1.0 / angle);
- n = TWOPI / theta + 0.5;
- if (n < 12) n = 12;
- else if (n > 80) n = 80;
- n /= 2;
- theta = TWOPI / n;
-
- angle = 0.0;
- px0 = xc + xr; /* cos(0) = 1 */
- py0 = yc; /* Sin(0) = 0 */
- while ((angle += theta) <= TWOPI) {
- px1 = xc + xr*cos(angle) + 0.5;
- py1 = yc + yr*sin(angle) + 0.5;
- line_btw(px0, py0, px1, py1);
- px0 = px1;
- py0 = py1;
- }
- line_btw(px0, py0, xc + xr, yc);
-}
diff --git a/Build/source/texk/seetexk/dvistate.c b/Build/source/texk/seetexk/dvistate.c
deleted file mode 100644
index 04d98d9c6b3..00000000000
--- a/Build/source/texk/seetexk/dvistate.c
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * Copyright (c) 1987, 1989 University of Maryland
- * Department of Computer Science. All rights reserved.
- * Permission to copy for any purpose is hereby granted
- * so long as this copyright notice remains intact.
- */
-
-#ifndef lint
-static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/dvistate.c,v 1.1 89/08/22 21:49:03 chris Exp $";
-#endif
-
-/*
- * dvistate - basic DVI machine interpreter
- */
-
-#include <stdio.h>
-#include "types.h"
-#include "conv.h"
-#include "dvicodes.h"
-#include "error.h"
-#include "fio.h"
-#include "font.h"
-#include "gripes.h"
-#include "postamble.h"
-#include "search.h"
-#include "seek.h"
-#include "dvistate.h"
-
-struct dvi_state ds;
-
-/* yech, statics! */
-static struct font *(*s_deffnt)();
-static int s_dpi;
-static int s_errs;
-
-static void pre(), post(), fntdef();
-
-#if !defined( WIN32 ) && !defined( _AMIGA )
-char *malloc();
-#endif
-
-/*
- * Read through the postamble and the preamble and set up the
- * global DVI state. Each font is passed to (*fontfn)().
- * Upon return, the input file (fp) is positioned at the beginning
- * of the first page.
- *
- * dpi is the resolution of the printer in pixels (dots) per inch,
- * and xoffset and yoffset are the values from the -X and -Y flags
- * (default zero). We add 1000 to each offset (since the offsets
- * are in 1/1000ths of an inch), and then multiply by dpi and divide
- * by 1000, to get the actual offset.
- *
- * If a device introduces a constant offset, e.g., of .25 inch
- * horizontally and .31 inch vertically, the caller can compensate
- * by passing (xflag - 2500) and (yflag - 3100).
- */
-void
-DVISetState(fp, fontfn, dpi, xoffset, yoffset)
- FILE *fp;
- struct font *(*fontfn)();
- int dpi, xoffset, yoffset;
-{
-
- /* make sure fseek() will work */
- if ((ds.ds_fp = SeekFile(fp)) == NULL)
- error(1, -1, "unable to copy input to temp file (disk full?)");
-
- /* h and v must be deferred until we have a conversion */
- ds.ds_fresh.hh = ((1000 + (i32)xoffset) * dpi) / 1000;
- ds.ds_fresh.vv = ((1000 + (i32)yoffset) * dpi) / 1000;
-
- ds.ds_fonts = SCreate(sizeof(struct font *));
- if (ds.ds_fonts == NULL)
- error(1, 0, "cannot create font table (out of memory?)");
- s_errs = 0;
- s_dpi = dpi;
- s_deffnt = fontfn;
- ScanPostAmble(ds.ds_fp, post, fntdef);
- if (s_errs)
- GripeMissingFontsPreventOutput(s_errs);
- pre();
-}
-
-/*
- * Read the preamble and apply sanity checks.
- * The presence of a preamble is virtually certain,
- * since we have already found and read a postamble.
- */
-static void
-pre()
-{
- register int n;
- register FILE *fp = ds.ds_fp;
-
- rewind(fp);
- if (GetByte(fp) != Sign8(DVI_PRE))
- GripeMissingOp("PRE");
- if (GetByte(fp) != Sign8(DVI_VERSION))
- GripeMismatchedValue("version number");
- if (GetLong(fp) != ds.ds_num)
- GripeMismatchedValue("numerator");
- if (GetLong(fp) != ds.ds_denom)
- GripeMismatchedValue("denominator");
- if (GetLong(fp) != ds.ds_dvimag)
- GripeMismatchedValue("\\magnification");
- n = UnSign8(GetByte(fp));
- while (--n >= 0)
- (void) GetByte(fp);
-}
-
-/*
- * Store the relevant information from the DVI postamble.
- */
-static void
-post(p)
- register struct PostAmbleInfo *p;
-{
- register int n;
-
- ds.ds_prevpage = p->pai_PrevPagePointer;
- ds.ds_num = p->pai_Numerator;
- ds.ds_denom = p->pai_Denominator;
- ds.ds_dvimag = p->pai_DVIMag;
- ds.ds_maxheight = p->pai_TallestPageHeight;
- ds.ds_maxwidth = p->pai_WidestPageWidth;
- ds.ds_npages = p->pai_NumberOfPages;
-
- /* set the global conversion factor */
- SetConversion(s_dpi,
- ds.ds_usermag, ds.ds_num, ds.ds_denom, ds.ds_dvimag);
-
- ds.ds_fresh.h = toSP(ds.ds_fresh.hh);
- ds.ds_fresh.v = toSP(ds.ds_fresh.vv);
-#ifdef unneeded /* counting on init-to-zero ... */
- ds.ds_fresh.w = 0;
- ds.ds_fresh.x = 0;
- ds.ds_fresh.y = 0;
- ds.ds_fresh.z = 0;
-#endif
- /* make the stack */
- n = p->pai_DVIStackSize * sizeof(DviStack);
- if ((ds.ds_stack = (struct dvi_stack *)malloc((unsigned)n)) == NULL)
- GripeOutOfMemory(n, "DVI stack");
- ds.ds_sp = ds.ds_stack;
-}
-
-/*
- * Handle a font definition from the postamble.
- */
-static void
-fntdef(p)
- register struct PostAmbleFont *p;
-{
- register struct font *f, **fp;
- int def = S_CREATE | S_EXCL;
-
- fp = (struct font **)SSearch(ds.ds_fonts, p->paf_DVIFontIndex, &def);
- if (fp == NULL) {
- if (def & S_COLL)
- GripeFontAlreadyDefined(p->paf_DVIFontIndex);
- else
- error(1, 0, "cannot stash font %ld (out of memory?)",
- (long)p->paf_DVIFontIndex);
- /* NOTREACHED */
- }
-
- /* apply driver function to get font */
- f = (*s_deffnt)(p->paf_name, p->paf_DVIMag, p->paf_DVIDesignSize);
- if (f == NULL) {
- s_errs++;
- return;
- }
- *fp = f;
-
- /* match checksums, unless one is (or both are) zero */
- if (p->paf_DVIChecksum && f->f_checksum &&
- p->paf_DVIChecksum != f->f_checksum)
- GripeDifferentChecksums(f->f_path, p->paf_DVIChecksum,
- f->f_checksum);
-}
-
-/*
- * Given a font index, return the corresponding pointer.
- */
-struct font *
-DVIFindFont(n)
- i32 n;
-{
- int x = S_LOOKUP;
- char *p;
-
- if ((p = SSearch(ds.ds_fonts, n, &x)) == NULL) {
- GripeNoSuchFont(n);
- /* NOTREACHED */
- }
- return (*(struct font **)p);
-}
-
-/*
- * Handle a rule: read width and height, then call the given function.
- * If `advance', move dvi position afterwards.
- */
-void
-DVIRule(fn, advance)
- void (*fn)();
- int advance;
-{
- register i32 h, w, ww;
- register FILE *fp = ds.ds_fp;
-
- fGetLong(fp, h);
- fGetLong(fp, ww);
- h = ConvRule(h);
- w = ConvRule(ww);
- (*fn)(h, w);
- if (advance) {
- dvi_hh += w;
- dvi_h += ww;
- w = fromSP(dvi_h);
- FIXDRIFT(dvi_hh, w);
- }
-}
-
-/*
- * Handle a BOP: read the ten \count values and the previous page pointer,
- * reset DVI position, and call the given function.
- */
-void
-DVIBeginPage(fn)
- void (*fn)();
-{
- register int i;
- i32 count[10];
-
- for (i = 0; i < 10; i++)
- count[i] = GetLong(ds.ds_fp);
- ds.ds_prevpage = GetLong(ds.ds_fp);
-
- /* reset DVI page position and stack pointer, then call driver */
- ds.ds_cur = ds.ds_fresh;
- ds.ds_sp = ds.ds_stack;
-
- (*fn)(count);
-}
diff --git a/Build/source/texk/seetexk/dvistate.h b/Build/source/texk/seetexk/dvistate.h
deleted file mode 100644
index c0b3b7b00c4..00000000000
--- a/Build/source/texk/seetexk/dvistate.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (c) 1989 University of Maryland
- * Department of Computer Science. All rights reserved.
- * Permission to copy for any purpose is hereby granted
- * so long as this copyright notice remains intact.
- */
-
-/* DVI file information (as used by dvi-to-device programs) */
-
-/*
- * Units of distance are stored in scaled points, but we can convert to
- * units of 10^-7 meters by multiplying by the numbers in the preamble.
- * The values hh and vv are kept in device coordinates.
- */
-
-/* the structure of the stack used to hold the values (h,v,hh,vv,w,x,y,z) */
-typedef struct dvi_stack {
- i32 h; /* the saved h */
- i32 v; /* the saved v */
- i32 hh; /* the saved hh */
- i32 vv; /* the saved vv */
- i32 w; /* etc */
- i32 x;
- i32 y;
- i32 z;
-} DviStack;
-
-/*
- * DVI state machine interpreter encapsulation (global state).
- */
-struct dvi_state {
- /*
- * Variables that must be set by user before calling SetDVIState().
- */
- int ds_usermag; /* user-supplied (additional) magnification */
- int ds_maxdrift; /* maximum drift, typically 3 */
-
- /* the rest are set by DVISetState() */
-
- /*
- * Values based on the (postamble of the) DVI file,
- * or used by the interpreter.
- */
- i32 ds_num; /* numerator from DVI file */
- i32 ds_denom; /* denominator from DVI file */
- i32 ds_dvimag; /* magnification from DVI file */
- i32 ds_maxheight; /* height of tallest page */
- i32 ds_maxwidth; /* width of widest page */
- i32 ds_prevpage; /* previous page of DVI file */
- int ds_npages; /* number of DVI pages */
- DviStack *ds_stack; /* base of stack of DVI values */
- DviStack *ds_sp; /* current place in stack */
- DviStack ds_cur; /* current values */
- DviStack ds_fresh; /* fresh values for new pages: not all
- zero unless there are no margins.
- This works because all DVI motion
- is relative. */
- /*
- * Although this is not strictly within the realm of DVI
- * state, we need a place to store the fonts we allocate
- * while reading through the postamble. Each entry in
- * the ds_fonts search table is a pointer to a font,
- * so that *(struct font **)SSearch(...) is the pointer.
- */
- struct search *ds_fonts;/* font table */
-
- /*
- * A few routines want a private copy of the DVI file pointer.
- */
- FILE *ds_fp; /* input DVI file */
-};
-
-extern struct dvi_state ds;
-
-/* shorthand */
-#define dvi_h ds.ds_cur.h
-#define dvi_v ds.ds_cur.v
-#define dvi_hh ds.ds_cur.hh
-#define dvi_vv ds.ds_cur.vv
-#define dvi_w ds.ds_cur.w
-#define dvi_x ds.ds_cur.x
-#define dvi_y ds.ds_cur.y
-#define dvi_z ds.ds_cur.z
-
-/*
- * Set up the state for the interpreter loop.
- */
-void DVISetState();
-
-/*
- * Service routines (called from main loop).
- */
-struct font *DVIFindFont();
-void DVIRule(), DVIBeginPage();
-
-/*
- * Drift fixing. Note that the first argument must be an lvalue.
- * It is the desired position in pixels, and is maintained within
- * ds.ds_maxdrift pixels of the second argument, which is the
- * `absolute' DVI position rounded to the nearest pixel.
- */
-#define FIXDRIFT(xx, x) \
- if ((x) >= (xx)) \
- if ((x) - (xx) <= ds.ds_maxdrift) \
- /* position is in bounds */; \
- else \
- (xx) = (x) - ds.ds_maxdrift; \
- else \
- if ((xx) - (x) <= ds.ds_maxdrift) \
- /* position is in bounds */; \
- else \
- (xx) = (x) + ds.ds_maxdrift
diff --git a/Build/source/texk/seetexk/dvistuff.c b/Build/source/texk/seetexk/dvistuff.c
deleted file mode 100644
index 1831de3df7d..00000000000
--- a/Build/source/texk/seetexk/dvistuff.c
+++ /dev/null
@@ -1,1190 +0,0 @@
-/*
- * Copyright 1989 Dirk Grunwald
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and that
- * both that copyright notice and this permission notice appear in
- * supporting documentation, and that the name of Dirk Grunwald or M.I.T.
- * not be used in advertising or publicity pertaining to distribution of
- * the software without specific, written prior permission. Dirk
- * Grunwald and M.I.T. makes no representations about the suitability of
- * this software for any purpose. It is provided "as is" without express
- * or implied warranty.
- *
- * DIRK GRUNWALD AND M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
- * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS, IN NO EVENT SHALL M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT
- * OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
- * OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author:
- * Dr. Dirk Grunwald
- * Dept. of Computer Science
- * Campus Box 430
- * Univ. of Colorado, Boulder
- * Boulder, CO 80309
- *
- * grunwald@colorado.edu
- *
- */
-
-#include <stdio.h>
-#include <ctype.h>
-
-#include "dvistuff.h" /* includes types & fonts */
-
-static char *rcsid="$Header: /home/reed/grunwald/Iptex/drivers/RCS/dvistuff.c,v 1.17 88/07/07 23:25:32 grunwald Exp Locker: grunwald $" ;
-
-#include "dviclass.h"
-#include "dvicodes.h"
-#include "postamble.h"
-#include "search.h"
-#include "fio.h"
-
-int dviHH = -1; /* current horizontal position, in DEVs */
-int dviVV = -1; /* current vertical position, in DEVs */
-long *dviCount[DVI_COUNT]; /* values of count */
-DviStack dvi_current;
-int dviHHMargin = -1; /* horizontal margin (in DEVs) */
-int dviVVMargin = -1; /* vertical margin (in DEVs) */
-int dviTallestPage = -1;
-int dviWidestPage = -1 ;
-int dviCurrentPage = -1;
-int dviTotalPages = -1;
-int dviDPI = -1;
-int dviMaxDrift = -1;
-int dviUserMag = -1; /* user-specified magnification */
-int dviBlackness = -1;
-int dviFontRotation = -1;
-char *DVIFileName;
-static char *dviTmpFileName = 0;
-static char dviTmpFileNameBuffer[256];
-FILE *dviFile; /* users file */
-char *dviPrintEngine = "canon";
-
-char *ProgName;
-
-/*
- * Similar to dvi_stack, but includes `dviHH and `dviVV, which are usually
- * but not always the same as fromSP(h) and fromSP(v):
- */
-struct localstack {
- int stack_hh;
- int stack_vv;
- struct dvi_stack stack_dvi;
-};
-
-static struct localstack *dvi_stack = 0;/* base of stack */
-static struct localstack *dvi_stackp; /* current place in stack */
-
-/*
- * DVI preamble and postamble information.
- */
-
-static long Magnification;
-static long Numerator; /* numerator from DVI file */
-static long Denominator; /* denominator from DVI file */
-
-/*
- * Font related things.
- * We keep track of the current font, use the fontfiner
- * and record errors in the dvi postable in FontErros.
- * the NoFont is a used when we cant find a font,
- * to avoid errors.
- */
-
-struct fontinfo *dviCurrentFont = 0;
-
-/*
- * imagen1-special uses the NextFamilyNumber. *sigh*
- */
-
-int NextFamilyNumber = 0;
-static int MaxFontFamily = MAX_FONTFAMILY;
-
-static struct search *FontFinder = 0;
-int FontErrors = 0;
-static struct fontinfo NoFont;
-/*
- * We keep a list of pointers to the beginning of pages.
- * Each page is headed by a DVI_BOP + 44 bytes of information.
- */
-
-static long *pageOffset = 0;
-
-#undef FIXDRIFT
-/*
- * Correct devpos (the actual device position) to be within MaxDrift pixels
- * of dvipos (the virtual DVI position).
- */
-#define FIXDRIFT(devpos, dvipos) \
- if (ABS((devpos) - (dvipos)) <= dviMaxDrift) \
- /* void */; \
- else \
- if ((devpos) < (dvipos)) \
- (devpos) = (dvipos) - dviMaxDrift; \
- else \
- (devpos) = (dvipos) + dviMaxDrift
-
-#define ABS(X) ( (X) < 0 ? -(X) : (X) )
-
-
-/*
- * Store the relevant information from the DVI postamble, and set up
- * various internal things.
- */
-static void
-PostAmbleHeader(p)
- register struct PostAmbleInfo *p;
-{
- int i;
- int page;
- int pageSize;
- int stackSize;
- long prevPagePointer;
- long wuzAt;
-
- Numerator = p->pai_Numerator;
- Denominator = p->pai_Denominator;
- Magnification = p->pai_DVIMag;
-
-/*
- * Set the conversion factor. This must be done before using
- * any fonts or the fromSP routine.
- */
-
- SetConversion(dviDPI, dviUserMag, Numerator, Denominator, Magnification);
-
- dviTotalPages = p -> pai_NumberOfPages;
- dviWidestPage = fromSP(p -> pai_WidestPageWidth);
- dviTallestPage = fromSP(p -> pai_TallestPageHeight);
-
-/*
- * Set up the DVI stack
- */
- stackSize = p -> pai_DVIStackSize * sizeof(*dvi_stack);
- if (dvi_stack != 0) {
- free(dvi_stack);
- }
- dvi_stack = (struct localstack *) malloc((unsigned) stackSize);
-
-/*
- * Set of the table of pointers to pages and room for the
- * count variables.
- */
-
- pageSize = dviTotalPages * sizeof(long);
- if (pageOffset != 0) {
- free(pageOffset);
- }
- pageOffset = (long *) malloc(pageSize);
-
- if (pageOffset == NULL) {
- fprintf(stderr,"xdvi: Can not allocate page directory (%d pages)",
- dviTotalPages);
- exit(1);
- }
-
- for (i = 0; i < DVI_COUNT; i++) {
- if (dviCount[i] != 0) {
- free(dviCount[i]);
- }
- dviCount[i] = (long*) malloc(pageSize);
- if (dviCount[i] == NULL) {
- fprintf(stderr,"xdvi: Can not allocate count directory (%d pages)",
- dviTotalPages);
- exit(1);
- }
- }
-
-
-/*
- * Follow back pointers through pages in the DVI file,
- * storing the offsets in the pageOffset table.
- */
-
- prevPagePointer = p->pai_PrevPagePointer;
- wuzAt = (long) ftell(dviFile);
-
- for (page = dviTotalPages - 1; page >= 0 ; page--) {
-
-/*
- * Skip to previous page, but skip over BOP marker.
- */
- pageOffset[page] = prevPagePointer;
- if( fseek(dviFile, prevPagePointer+1, 0) < 0) {
- perror("fseek");
- fprintf(stderr,"[postamble] improper seek looking up pages\n");
- fprintf(stderr,"prevPagePointer = %lx\n",
- prevPagePointer);
- exit(1);
- }
-
-/*
- * Read the other counters at the beginning of the page
- */
-
- for (i = 0; i < DVI_COUNT; i++) {
- long value;
- fGetLong(dviFile, value);
- dviCount[i][page] = value;
- }
- fGetLong(dviFile, prevPagePointer);
- }
- fseek(dviFile, wuzAt, 0);
-}
-
-static void
-PostAmbleFontDef(p)
-register struct PostAmbleFont *p;
-{
- register struct fontinfo *fi;
- register struct font *f;
-
- char *fname;
- int def = S_CREATE | S_EXCL;
-
- fi = (struct fontinfo *) SSearch(FontFinder, p->paf_DVIFontIndex,
- &def);
- if (fi == NULL) {
-/*
- * If the font already exists, lets just check that its really the
- * same thing & return
- */
-
- if ((def & S_FOUND) | (def & S_COLL)) {
-
- def = S_LOOKUP;
- if ((fi = (struct fontinfo *) SSearch(FontFinder,
- p -> paf_DVIFontIndex,
- &def)) == 0){
- GripeNoSuchFont(p -> paf_DVIFontIndex);
- exit(1);
- }
-
- if (fi -> f == NULL) {
- GripeCannotGetFont(p->paf_name, p->paf_DVIMag,
- p->paf_DVIDesignSize,
- dviPrintEngine, fname);
- }
- f = fi -> f;
- if (p->paf_DVIChecksum && f->f_checksum &&
- p->paf_DVIChecksum != f->f_checksum) {
- GripeDifferentChecksums(fname, p->paf_DVIChecksum,
- f->f_checksum);
- exit(1);
- }
- return; /* font already defined */
- }
- else {
- fprintf(stderr, "Can not stash font %ld (out of memory?)\n",
- p -> paf_DVIFontIndex);
- exit(1);
- }
- }
-
- if (NextFamilyNumber == MaxFontFamily) {
- fprintf(stderr,"Out of font family!\n");
- exit(1);
- }
-
- fi->family = NextFamilyNumber;
- NextFamilyNumber++;
-
- f = GetFont(p->paf_name, p->paf_DVIMag, p->paf_DVIDesignSize,
- dviPrintEngine, &fname);
-
-/*
- * Give the application a chance to bang on this if they want to.
- */
-
- f = applicationNewFont(f, fi -> family);
-
- if ((fi->f = f) == NULL) {
- GripeCannotGetFont(p->paf_name, p->paf_DVIMag,
- p->paf_DVIDesignSize, dviPrintEngine, fname);
- FontErrors++;
- return;
- }
-
- /* match checksums, if not zero */
- if (p->paf_DVIChecksum && f->f_checksum &&
- p->paf_DVIChecksum != f->f_checksum)
- GripeDifferentChecksums(fname, p->paf_DVIChecksum,
- f->f_checksum);
-
- fi->pspace = p->paf_DVIMag / 6; /* a three-unit "thin space" */
- fi->nspace = -4 * fi->pspace;
- fi->vspace = 5 * fi->pspace;
-}
-
-static void
-ReadPostAmble()
-{
-
- if (FontFinder == 0) {
- if ((FontFinder = SCreate(sizeof(struct fontinfo))) == 0) {
- fprintf(stderr, "can not create FontFinder (out of memory?)");
- exit(1);
- }
- }
-
- ScanPostAmble(dviFile, PostAmbleHeader, PostAmbleFontDef);
-
- if (FontErrors)
- GripeMissingFontsPreventOutput(FontErrors);
-}
-
-/*
- * Read the preamble and do a few sanity checks
- */
-
-static void
-ReadPreAmble()
-{
- register int n;
-
- rewind(dviFile);
- if (GetByte(dviFile) != Sign8(DVI_PRE))
- GripeMissingOp("PRE");
-
- if (GetByte(dviFile) != Sign8(DVI_VERSION))
- GripeMismatchedValue("version numbers");
-
- if (GetLong(dviFile) != Numerator)
- GripeMismatchedValue("numerator");
-
- if (GetLong(dviFile) != Denominator)
- GripeMismatchedValue("denominator");
-
- if (GetLong(dviFile) != Magnification)
- GripeMismatchedValue("\\magfactor");
-
- n = UnSign8(GetByte(dviFile));
- while (--n >= 0)
- (void) GetByte(dviFile);
-}
-
-int
-dviInit()
-{
- extern char *ProgName;
- FILE *tmpFile;
-#ifndef WIN32
- char *mktemp();
-#endif
-
- dviFini(); /* clean up the old files */
-
- if (DVIFileName == 0) {
- dviFile = stdin;
- DVIFileName = "<stdin>";
- }else if ((dviFile = fopen(DVIFileName, "r")) == NULL) {
- int n = strlen(DVIFileName);
- char *dvi_name;
-
- if (strcmp(DVIFileName + n - sizeof(".dvi") + 1, ".dvi") == 0) {
- perror(DVIFileName);
- return(1);
- }
-
- dvi_name = (char *) malloc((unsigned) n + sizeof(".dvi"));
- sprintf(dvi_name, "%s.dvi", DVIFileName);
-
- if ((dviFile = fopen(dvi_name, "r")) == NULL) {
- perror(dvi_name);
- return(1);
- }
- DVIFileName = dvi_name;
- }
-
-/*
- * node, copy the file to a temporary location. This lets the person
- * peruse the file while theyre re-texing it
- */
- strcpy(dviTmpFileNameBuffer,"/tmp/dvistuff.XXXXXX");
- dviTmpFileName = mktemp(dviTmpFileNameBuffer);
-
- if (!(tmpFile = fopen(dviTmpFileName,"w+"))) {
- perror("fopen");
- fprintf(stderr,"Unable to create temporary file");
- dviTmpFileName = 0;
- } else {
- char buffer[BUFSIZ];
- int b;
-
- rewind(dviFile);
- do {
- b = fread(buffer, 1, BUFSIZ, dviFile);
- fwrite(buffer, 1, b, tmpFile);
- } while (! feof(dviFile));
-
- fclose(dviFile);
- dviFile = tmpFile;
- rewind(dviFile);
- }
-/*
- * Unlink the temporary file. This keeps tmp files from cluddering
- * up /tmp and it does it in a very application-independent way.
- * You can't reopen the tmp file, but we don't really allow that
- * anyway (the tmp file is hidden from the user).
- */
- if (dviTmpFileName != 0 &&
- strncmp(dviTmpFileName,"/tmp/",5) == 0) {
- unlink(dviTmpFileName);
- }
-
- if (dviUserMag == -1) {
- dviUserMag = 1000;
- }
-
- if (dviMaxDrift == -1) {
- dviMaxDrift = DEFAULT_MAX_DRIFT;
- }
-
- if (dviDPI == -1) {
- dviDPI = DEFAULT_DPI;
- }
-
- if (dviBlackness == -1) {
- dviBlackness = DEFAULT_BLACKNESS;
- }
-
- if (dviFontRotation == -1) {
- dviFontRotation = ROT_NORM;
- }
-
- ReadPostAmble();
- ReadPreAmble();
-
- /* Margins -- needs work! */
-
- if (dviHHMargin == -1) {
- dviHHMargin = DEFAULT_HHMARGIN;
- }
-
- if (dviVVMargin == -1) {
- dviVVMargin = DEFAULT_VVMARGIN;
- }
-
- dviCurrentFont = &NoFont; /* fake font, all zeros */
-
- return(0);
-}
-
-void
-dviFini()
-{
- if (dviFile != 0) {
- fclose(dviFile);
- }
-
- if (dviTmpFileName != 0 &&
- strncmp(dviTmpFileName,"/tmp/",5) == 0) {
- unlink(dviTmpFileName);
- }
-}
-
-
-static void
-SelectFont(n)
-i32 n;
-{
- int x = S_LOOKUP;
-
- if ((dviCurrentFont = (struct fontinfo *)SSearch(FontFinder, n, &x)) == 0)
- GripeNoSuchFont(n);
-}
-
-/* Read the postamble. */
-
-static void
-doDviChar(c, advance)
-int c;
-int advance;
-{
- register struct glyph *g;
- register struct font *f;
- int p;
-
- f = dviCurrentFont->f;
-
- if (c < f -> f_lowch || c > f -> f_highch) {
- fprintf(stderr,"Character out of range: %d\n",
- c);
- return;
- }
-
- g = GLYPH(f, c);
- if (!GVALID(g)) {
- fprintf(stderr, "there is no character %d in %s",
- c, f->f_path);
- exit(1);
- } else {
-
- if (HASRASTER(g)) { /* workaround for Imagen bug */
- applicationPutChar(dviHH,dviVV,c);
- }
-
- if (advance) {
- dviHH += g->g_pixwidth;
- dvi_h += g->g_tfmwidth;
- p = fromSP(dvi_h);
- FIXDRIFT(dviHH, p);
- }
- }
-}
-
-/*
- * The next two routines are used to reset all the glyphs.
- * the dviResetFont routine is called for each font in the font table.
- * It de-allocates the rasters & glyphs for the shrunken fonts, leaving
- * the original glyph data untouched.
- */
-
-
-static void
-dviResetFont(fi, key)
-struct fontinfo *fi;
-int key;
-{
- if (fi != 0) {
- applicationResetFont(fi, fi -> family);
- }
-}
-
-void
-dviResetAll()
-{
- SEnumerate(FontFinder, dviResetFont);
-}
-
-/*
- * Process the DVI commands for page #page. If the page number is
- * out of range, it is cropped to the end.
- *
- * Updates dviCurrentPage
- */
-void
-dviPreparePage(page)
-int page;
-{
- register int c;
- register i32 p;
- int advance;
-
- if (page < 0) {
- page = 0;
- }
-
- if (page >= dviTotalPages) {
- page = dviTotalPages - 1;
- }
-
- dviCurrentPage = page;
-
- fseek(dviFile, (long) pageOffset[page], 0);
-
- dviHH = dviHHMargin;
- dviVV = dviVVMargin;
-
- dvi_h = toSP(dviHH);
- dvi_v = toSP(dviVV);
-
- dvi_w = 0;
- dvi_x = 0;
- dvi_y = 0;
- dvi_z = 0;
-
- dvi_stackp = dvi_stack;
-
- for(;;) {
-/*
- * Get the DVI byte, and switch on its parameter length and type.
- * Note that getchar() returns unsigned values.
- */
-
- if (feof(dviFile)) {
- fprintf(stderr,"Unexpected end-of-file\n");
- exit(1);
- }
-
- c = getc(dviFile);
-
- if (DVI_IsChar(c)) {
- advance = 1;
- doDviChar(c, advance);
- } else {
-
- switch (DVI_OpLen(c)) {
-
- case DPL_NONE:
- break;
-
- case DPL_SGN1:
- p = getc(dviFile);
- p = Sign8(p);
- break;
-
- case DPL_SGN2:
- fGetWord(dviFile, p);
- p = Sign16(p);
- break;
-
- case DPL_SGN3:
- fGet3Byte(dviFile, p);
- p = Sign24(p);
- break;
-
- case DPL_SGN4:
- fGetLong(dviFile, p);
- break;
-
- case DPL_UNS1:
- p = UnSign8(getc(dviFile));
- break;
-
- case DPL_UNS2:
- fGetWord(dviFile, p);
- p = UnSign16(p);
- break;
-
- case DPL_UNS3:
- fGet3Byte(dviFile, p);
- p = UnSign24(p);
- break;
-
- default:
- panic("DVI_OpLen(%d) = %d", c, DVI_OpLen(c));
- /* NOTREACHED */
- }
-
- switch (DVI_DT(c)) {
-
- case DT_SET:
- c = p;
- doDviChar(c, 1);
- break;
-
- case DT_PUT:
- c = p;
- doDviChar(c, 0);
- break;
-
- case DT_SETRULE:
- case DT_PUTRULE:
-
- {
- i32 h, w, rw;
-
- fGetLong(dviFile, h);
- fGetLong(dviFile, rw);
-
- h = ConvRule(h);
- w = ConvRule(rw);
-
- applicationSetRule(dviHH, dviVV, h,w);
-
- if (DVI_DT(c) == DT_SETRULE) {
- dviHH += w;
- dvi_h += rw;
- w = fromSP(dvi_h);
- FIXDRIFT(dviHH, w);
- }
- }
- break;
-
- case DT_NOP:
- break;
-
- case DT_BOP:
-/*
- * Each beginning of page has 11 4-byte words telling us things
- * about the page. We ignore them.
- */
- {
- fseek(dviFile, (long) (11 * 4), 1);
- }
-
- break;
-
- case DT_EOP:
- return;
-
- case DT_PUSH:
- dvi_stackp->stack_hh = dviHH;
- dvi_stackp->stack_vv = dviVV;
- dvi_stackp->stack_dvi = dvi_current;
- dvi_stackp++;
- break;
-
- case DT_POP:
- dvi_stackp--;
- dviHH = dvi_stackp->stack_hh;
- dviVV = dvi_stackp->stack_vv;
- dvi_current = dvi_stackp->stack_dvi;
- break;
-
- case DT_W0: /* there should be a way to make these pretty */
- p = dvi_w;
- goto move_right;
-
- case DT_W:
- dvi_w = p;
- goto move_right;
-
- case DT_X0:
- p = dvi_x;
- goto move_right;
-
- case DT_X:
- dvi_x = p;
- goto move_right;
-
- case DT_RIGHT:
- move_right:
- dvi_h += p;
-/*
- * DVItype tells us that we must round motions in this way:
- * `When the horizontal motion is small, like a kern, hh
- * changes by rounding the kern; but when the motion is
- * large, hh changes by rounding the true position so that
- * accumulated rounding errors disappear.
- */
- if (p >= dviCurrentFont->pspace || p <= dviCurrentFont->nspace)
- dviHH = fromSP(dvi_h);
- else {
- dviHH += fromSP(p);
- p = fromSP(dvi_h);
- FIXDRIFT(dviHH, p);
- }
- break;
-
- case DT_Y0:
- p = dvi_y;
- goto move_down;
-
- case DT_Y:
- dvi_y = p;
- goto move_down;
-
- case DT_Z0:
- p = dvi_z;
- goto move_down;
-
- case DT_Z:
- dvi_z = p;
- goto move_down;
-
- case DT_DOWN:
- move_down:
- dvi_v += p;
-/*
- * `Vertical motion is done similarly, but with the threshold
- * between ``small and ``large increased by a factor of
- * 5. The idea is to make fractions like $1\over2$ round
- * consistently, but to absorb accumulated rounding errors in
- * the baseline-skip moves.
- */
- if (ABS(p) >= dviCurrentFont->vspace)
- dviVV = fromSP(dvi_v);
- else {
- dviVV += fromSP(p);
- p = fromSP(dvi_v);
- FIXDRIFT(dviVV, p);
- }
- break;
-
- case DT_FNTNUM:
- SelectFont((i32) (c - DVI_FNTNUM0));
- break;
-
- case DT_FNT:
- SelectFont(p);
- break;
-
- case DT_XXX:
- {
- char specialBuffer [2048];
- register char *cp;
- int sweetp = 0;
-
- if (p > 2047) {
- sweetp = p - 2047;
- p = 2047;
- }
-
- for (cp = specialBuffer ; p > 0; p--) {
- *cp = getc(dviFile);
- cp++;
- }
- *(cp) = 0;
-
- while(sweetp > 0) {
- getc(dviFile);
- }
-
- applicationDoSpecial(specialBuffer);
- }
- break;
-
- case DT_FNTDEF:
- SkipFontDef(dviFile);
- break;
-
- case DT_PRE:
- GripeUnexpectedOp("PRE");
- /* NOTREACHED */
-
- case DT_POST:
- GripeUnexpectedOp("POST");
- /* NOTREACHED */
-
- case DT_POSTPOST:
- GripeUnexpectedOp("POSTPOST");
- /* NOTREACHED */
-
- case DT_UNDEF:
- GripeUndefinedOp(c);
- /* NOTREACHED */
-
- default:
- panic("DVI_DT(%d) = %d", c, DVI_DT(c));
- /* NOTREACHED */
- }
- }
- }
-}
-
-/* Transpose bytes in each pair of bytes (0123 -> 1032) */
-/* Reverse bits in a byte (01234567 -> 76543210) */
-/* needed for sun386i */
-/* Gerhard Fleischanderl & Wolfgang Nejdl */
-
-#ifdef sun386
-static unsigned char pow2[]={1,2,4,8,16,32,64,128};
-
-unsigned char reverseByte(oldByte)
- unsigned char oldByte;
-{
- unsigned short i;
- unsigned char newByte=0;
-
- /* build newByte with bits mirrored */
-
- for(i=0;i<8;i++)
- if (oldByte & pow2[i])
- newByte |= pow2[7-i];
-
- return newByte;
-}
-
-#ifdef UNDEF
-#define transposeBytesMirrorBits(pairPtr) \
-/* B16 *pairPtr; */ \
-/* B16 comprises 2 bytes */ \
-{ \
- unsigned char c0,c1, *bP = (unsigned char *) pairPtr; \
- \
- /* transpose neighbouring bytes and \
- reverse bits in each byte */ \
- \
- c0 = *bP; \
- c1 = *(bP+1); \
- *bP = ReverseByteTable[c1]; \
- *(bP+1) = ReverseByteTable[c0]; \
-}
-
-#else
-#define transposeBytesMirrorBits(ptr) {*ptr = ReverseByteTable[ (*ptr)&0xff ];}
-#endif /* undef */
-
-#endif
-
-
-/*
- * The following routine is used to shrink a glyph by some
- * shrink factor (in the width & height dimension).
- *
- * These shrunken glyphs are more appropriate for previewers.
- *
- * To do this, we simple scan the original raster, counting the
- * number of pixels within a given area. If the number of on pixels is
- * at least twice the total number of pixels, we turn the pixel in
- * the shrunken glyph ON, else OFF.
- *
- * We use a lookup table to hasten the process of counting pixels.
- *
- * The method used should be independent of byte-order (I think).
- *
- * You need to define two types. One should be 32-bits long, and
- * the other 16 bits long.
- */
-
-typedef unsigned char B8;
-typedef unsigned short B16;
-typedef unsigned long B32;
-
-#define LOOKUP_BYTES 256
-#define LOOKUP_BITS 8
-#define LOOKUP_MASK 0xff
-
-static char dviLookUpTable[LOOKUP_BYTES];
-static char tableNotInitialized = 1;
-
-#ifdef sun386
-static unsigned char ReverseByteTable[LOOKUP_BYTES];
-#endif
-
-struct glyph *
-dviShrinkGlyph(gly, shrinkH, shrinkW)
-DviGlyph *gly;
-int shrinkH;
-int shrinkW;
-{
- int shrunkHeight;
- int shrunkWidth;
- int glyphWide;
- int glyphHigh;
- int glyphAdvance;
- int shrunkAdvance;
-
- int bytesWide;
- int shrunkBytesWide;
-
- struct glyph *ngly;
-
- B16 *shrunkRaster;
- int rasterSize;
-
- int x,y;
- B8 *cp;
- B8 *ptr;
-
- B32 shrinkMask;
-
- int sampleSize;
-
- if (gly == 0 || !HASRASTER(gly)) {
- return(0);
- }
-
- if (gly -> g_raster == 0) {
- gly-> g_raster = RASTER(gly, dviCurrentFont -> f, dviFontRotation);
- }
-
-/*
- * Initialize the lookup table of the number of bits in a given byte
- */
-
- if (tableNotInitialized) {
- register int i;
- register int j;
- register int k;
- register int acc;
- for (i = 0; i < LOOKUP_BYTES; i++) {
- j = i;
- acc = 0;
- for (k = 0; j != 0 && k < LOOKUP_BITS ; k++) {
- acc += (j & 1);
- j >>= 1;
- }
- dviLookUpTable[i] = acc;
- }
-
-#ifdef sun386
- for (i = 0; i < LOOKUP_BYTES; i++) {
- ReverseByteTable[i] = reverseByte(i);
- }
-#endif
-
- tableNotInitialized = 0;
- }
-
-/*
- * When shrinking the fonts, we convert them from byte alligned
- * to 16 bit-aligned fonts. I think that this is needed by X,
- * and also SunWindows. This is done rather than changing the
- * library routines because some device drivers, i.e. imagen1,
- * depend on the byte-alligned fonts.
- */
- glyphHigh = gly -> g_height;
- glyphWide = gly -> g_width;
-
- gly -> g_pixwidth = fromSP(gly -> g_tfmwidth);
- glyphAdvance = gly -> g_pixwidth;
-
- shrunkHeight = (glyphHigh + shrinkH - 1) / shrinkH;
- shrunkWidth = (glyphWide + shrinkW - 1) / shrinkW;
- shrunkAdvance = (glyphAdvance + shrinkW - 1) / shrinkW;
-
- bytesWide = (gly -> g_width + 7) >> 3;
-
- shrunkBytesWide = ((shrunkWidth + 15) >> 4) * 2;
-
- rasterSize = (shrunkHeight + 1) * shrunkBytesWide;
- shrunkRaster = (B16 *) malloc(rasterSize);
- bzero(shrunkRaster, rasterSize);
- ptr = (B8 *) shrunkRaster;
-
- if (shrunkRaster == NULL) {
- fprintf(stderr, "Out of memory!\n");
- exit(1);
- }
-
- for (y = 0; y < glyphHigh; y+= shrinkH) {
- cp = (B8 *) ptr;
- shrinkMask = 0x80;
- for (x = 0; x < glyphWide; x += shrinkW) {
- int i;
- int samples;
- B8 *baseP;
- int upper;
- register int thisShrinkW;
-
- baseP = (B8 *) gly -> g_raster + (y * bytesWide);
-
-/*
- * Set the upper limit on the height iteration so we dont count
- * off the end of the raster
- */
-
- upper = y + shrinkH;
- if (upper > glyphHigh) {
- upper = glyphHigh;
- }
-
- if (x + shrinkW > glyphWide) {
- thisShrinkW = glyphWide - x;
- } else {
- thisShrinkW = shrinkW;
- }
-
- samples = 0;
- sampleSize = thisShrinkW * (upper - y);
-
- for (i = y; i < upper; i++) {
- register int acc;
- register B8 *p;
- register B8 *ep;
-/*
- * Determine how many bytes our shrink window crosses (we might
- * overlap on byte-edges)
- */
-
- p = baseP + (x >> 3);
- ep = baseP + ( (x + thisShrinkW - 1) >> 3);
- baseP += bytesWide;
-
-/*
- * stuff everything in the accumulator
- */
-
- acc = 0;
- while (p <= ep) {
- acc = ((acc << 8) & ~0xff) | *p;
- p++;
- }
-
-/*
- * clean off the right hand-side of extra bits, then clean off
- * the left hand side of extra bits, and then count them.
- */
-
- acc = acc >> ( 7 - ((x + thisShrinkW - 1) & 0x7));
- acc &= ~(-1 << thisShrinkW);
- while (acc != 0) {
- samples += dviLookUpTable[ acc & LOOKUP_MASK ];
- acc >>= LOOKUP_BITS;
- }
- }
-/*
- * If at least 1/blackness of the bits are on, treat this entire sample as
- * being on.
- */
-
- if ((samples * dviBlackness) >= sampleSize) {
- *ptr |= shrinkMask;
- } else {
- *ptr &= ~ shrinkMask;
- }
- shrinkMask >>= 1;
- if (shrinkMask == 0) {
- shrinkMask = 0x80;
-#ifdef sun386
- transposeBytesMirrorBits(ptr)
-#endif
- ptr ++;
- }
- }
-#ifdef sun386
- transposeBytesMirrorBits(ptr)
-#endif
- ptr = (B8 *) (cp + shrunkBytesWide);
- }
-
-/*
- * Build a new glyph from the shrunken raster
- */
-
-#ifdef UNDEF
- if ( shrunkBytesWide != 2 )
- {
- printf("Old glyph:\n");
- seeGlyph(gly -> g_raster, glyphHigh, bytesWide);
- printf("%d ", shrunkBytesWide);
- printf("New glyph:\n");
- seeGlyph(shrunkRaster, shrunkHeight, shrunkBytesWide);
- }
-#endif UNDEF
-
- ngly = (struct glyph *) malloc(sizeof(struct glyph));
- bzero(ngly, sizeof(struct glyph));
-
- ngly -> g_raster = (char * ) shrunkRaster;
- ngly -> g_width = shrunkWidth;
- ngly -> g_pixwidth = shrunkAdvance;
- ngly -> g_height = shrunkHeight;
-
- ngly -> g_xorigin = gly -> g_xorigin / shrinkH;
- ngly -> g_yorigin = gly -> g_yorigin / shrinkW;
-
- ngly -> g_flags |= GF_SHRUNK; /* yes, its been shrunk */
-
- return(ngly);
-}
-
-#ifdef UNDEF
-
-seeGlyph(c, h, w)
-char *c;
-int h;
-int w;
-{
- int i,j;
-
- for (i = 0; i < h; i++ ) {
- for (j = 0; j < w; j++) {
- int k;
- register int ch;
- register int m;
- char str[9];
-
- ch = *(c++);
- m = 0x80;
- for (k = 0; k < 8; k++) {
- str[k] = '"' + ( (ch & m) ? 1 : 0 );
- m >>= 1;
- }
- str[8] = 0;
- printf("%s", str);
- }
- printf("\n");
- }
-}
-
-
-#endif UNDEF
diff --git a/Build/source/texk/seetexk/dvistuff.h b/Build/source/texk/seetexk/dvistuff.h
deleted file mode 100644
index 040e02bdac1..00000000000
--- a/Build/source/texk/seetexk/dvistuff.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright 1989 Dirk Grunwald
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and that
- * both that copyright notice and this permission notice appear in
- * supporting documentation, and that the name of Dirk Grunwald or M.I.T.
- * not be used in advertising or publicity pertaining to distribution of
- * the software without specific, written prior permission. Dirk
- * Grunwald and M.I.T. makes no representations about the suitability of
- * this software for any purpose. It is provided "as is" without express
- * or implied warranty.
- *
- * DIRK GRUNWALD AND M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
- * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS, IN NO EVENT SHALL M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT
- * OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
- * OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author:
- * Dr. Dirk Grunwald
- * Dept. of Computer Science
- * Campus Box 430
- * Univ. of Colorado, Boulder
- * Boulder, CO 80309
- *
- * grunwald@colorado.edu
- *
- */
-
-static char *dvistuff_header_rcsid="$Header: /home/reed/grunwald/Iptex/drivers/RCS/dvistuff.h,v 1.11 89/02/15 16:31:56 grunwald Exp $" ;
-
-/*
- * Include the following from the CTex distribution
- */
-
-#include <stdio.h>
-
-#include "types.h"
-#include "font.h"
-#include "conv.h"
-
-/*
- * We use the following flags to keep track of shrunk fonts
- */
-
-#define GF_SHRUNK GF_USR0
-
-#define GLYPH_SHRUNK(g) ((g) -> g_flags & GF_SHRUNK)
-
-#define SHRUNK_GLYPH_BYTES_WIDE(g) ((((g) -> g_width + 15) >> 4) * 2)
-
-typedef struct font DviFont;
-typedef struct glyph DviGlyph;
-
-#define MAX_GLYPH 128
-#define MAX_FONTFAMILY 128
-
-#define DEFAULT_DPI 300
-#define DEFAULT_HHMARGIN DEFAULT_DPI
-#define DEFAULT_VVMARGIN DEFAULT_DPI
-#define DEFAULT_MAX_DRIFT 3
-
-#define DEFAULT_BLACKNESS 3
-
-
-struct fontinfo {
- struct font *f; /* the font */
- i32 pspace; /* boundary between `small & `large spaces
- (for positive horizontal motion) */
- i32 nspace; /* -4 * pspace, for negative motion */
- i32 vspace; /* 5 * pspace, for vertical motion */
- int family; /* Imagen family number (we pick one) */
-};
-
-typedef struct fontinfo DviFontInfo;
-
-/* DVI file info */
-
-/*
- * Units of distance are stored in scaled points, but we can convert to
- * units of 10^-7 meters by multiplying by the numbers in the preamble.
- */
-
-/* the structure of the stack used to hold the values (h,v,w,x,y,z) */
-
-typedef struct dvi_stack {
- i32 h; /* the saved h */
- i32 v; /* the saved v */
- i32 w; /* etc */
- i32 x;
- i32 y;
- i32 z;
-} DviStack;
-
-extern DviStack dvi_current; /* the current values of h, v, etc */
-extern int dvi_f; /* the current font */
-
-#define dvi_h dvi_current.h
-#define dvi_v dvi_current.v
-#define dvi_w dvi_current.w
-#define dvi_x dvi_current.x
-#define dvi_y dvi_current.y
-#define dvi_z dvi_current.z
-
-
-
-extern int dviHH; /* current horizontal position, in DEVs */
-extern int dviVV; /* current vertical position, in DEVs */
-#define DVI_COUNT 10 /* count0 .. count9 */
-extern long *dviCount[DVI_COUNT]; /* values of count */
-
-extern Conv Conversion;
-
-extern int dviHHMargin;
-extern int dviVVMargin;
-extern int dviDPI;
-extern int dviTallestPage;
-extern int dviWidestPage;
-extern int dviTotalPages;
-extern int dviCurrentPage;
-extern int dviMaxDrift;
-extern char *dviPrintEngine;
-extern int dviBlackness;
-extern int dviFontRotation;
-extern int dviUserMag;
-
-extern DviFontInfo *dviCurrentFont;
-extern char *DVIFileName;
-extern FILE *dviFile; /* user's file */
-extern char *ProgName;
-
-extern int dviInit();
-extern void dviFini();
-extern void dviPreparePage( /* int */ );
-extern struct glyph *dviShrinkGlyph();
-
-void applicationPutChar( /* hh, vv, charCode */ );
-DviFont *applicationNewFont( /* font structure */);
-void applicationResetFont(/* font info, key */);
-void applicationSetRule( /* hh, vv, height, width : long*/ );
-void applicationDoSpecial();
diff --git a/Build/source/texk/seetexk/findpost.c b/Build/source/texk/seetexk/findpost.c
deleted file mode 100644
index 2f2f8d99303..00000000000
--- a/Build/source/texk/seetexk/findpost.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 1987, 1989 University of Maryland
- * Department of Computer Science. All rights reserved.
- * Permission to copy for any purpose is hereby granted
- * so long as this copyright notice remains intact.
- */
-
-#ifndef lint
-static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/findpost.c,v 2.3 89/08/22 21:50:11 chris Exp $";
-#endif
-
-/*
- * FindPostAmble - Find the postamble of a DVI file.
- *
- * N.B.: This routine assumes that ftell() returns byte offsets,
- * not magic cookies.
- */
-
-#include <stdio.h>
-#include "types.h"
-#include "dvicodes.h"
-#include "fio.h"
-#include "num.h"
-
-/*
- * The end of the file consists of a four-byte postamble pointer,
- * followed by the DVI_VERSION byte, followed by at least four
- * bytes of DVI_FILLER, and at least enough bytes to make the file
- * size a multiple of four. Normally, this would be between 4 and 7
- * inclusive, but some versions of TeX append huge amounts of padding.
- */
-#define POSTSIZE 512 /* how many bytes to read at a time */
-
-#ifndef WIN32
-long ftell(); /* should be declared in stdio.h */
-#endif
-
-FindPostAmble(f)
- register FILE *f;
-{
- register long offset;
- register char *p;
- register int i;
- register i32 n;
- char postbuf[POSTSIZE];
-
- /*
- * Working backwards from end-of-file, read POSTSIZE bytes.
- * Keep looking until we find something or run out of filler.
- */
- fseek(f, 0L, 2);
- offset = ftell(f);
- do {
- if ((offset -= POSTSIZE) < 0L)
- offset = 0L; /* no negative fseeks please */
- fseek(f, offset, 0);
- if ((i = fread(postbuf, sizeof(char), POSTSIZE, f)) <= 0)
- break;
- for (p = postbuf + i; --i >= 0;)
- if (UnSign8(*--p) != DVI_FILLER)
- goto found_something;
- } while (offset);
- return (-1); /* ran out of filler: not a DVI file */
-
- /*
- * We found something other than a filler byte at *p (which is
- * the same as postbuf[i]). It had better be a version byte.
- * If so, we want to start at the byte four bytes before that,
- * and get one long; that will tell us where the postamble
- * begins.
- */
-found_something:
- if (UnSign8(*p) != DVI_VERSION)
- return (-1); /* not a DVI file */
- if ((i -= 4) >= 0) {
- /* it is in the buffer, so just fish it out */
- p -= 4;
- pGetLong(p, n);
- } else {
- if ((offset += i) < 0L)
- return (-1); /* tsk */
- fseek(f, offset, 0);
- fGetLong(f, n);
- }
- offset = n;
- fseek(f, offset, 0);
- return (0); /* success */
-}
diff --git a/Build/source/texk/seetexk/font.c b/Build/source/texk/seetexk/font.c
deleted file mode 100644
index f00094a963e..00000000000
--- a/Build/source/texk/seetexk/font.c
+++ /dev/null
@@ -1,544 +0,0 @@
-/*
- * Copyright (c) 1987, 1989 University of Maryland
- * Department of Computer Science. All rights reserved.
- * Permission to copy for any purpose is hereby granted
- * so long as this copyright notice remains intact.
- */
-
-#ifndef lint
-static char rcsid[] = "$Header: /homes/grunwald/Src/SeeTeX/libtex/RCS/font.c,v 1.2 1992/07/22 16:26:02 grunwald Exp grunwald $";
-#endif
-
-/*
- * Routines for working with fonts. In particular, the configuration
- * dependent code is here.
- *
- * Specific fonts (GF, PXL, etc.) have functions in separate files.
- */
-
-#include <stdio.h>
-#include <errno.h>
-#include <ctype.h>
-#include "types.h"
-#include "conv.h"
-#include "error.h"
-#include "font.h"
-
-/*
- * Define the default configuration file.
- * Also define the maximum path name length.
- */
-#ifndef FONTDESC
-/* #define FONTDESC "/usr/local/lib/tex/fontdesc" */
- you must define FONTDESC in the Makefile
-#endif
-
-#define PATHLEN 1024
-
-/*
- * A font configuration. The font list is ordered.
- *
- * A specifier is typically a particular print engine, since
- * different engines need slightly different fonts.
- */
-struct fontconf {
- struct fontconf *fc_next;
- struct fontops *fc_ops;
- char *fc_path; /* path, with metacharacters */
- char *fc_spec; /* specifier */
- int fc_slop; /* slop value */
-};
-
-/*
- * EQ is a fast way to check for string equivalence.
- */
-#define EQ(a, b) (*(a) == *(b) && strcmp(a, b) == 0)
-
-/*
- * Private variables and functions.
- */
-static int didinit; /* true => initialised already */
-static char *cfname; /* config file name, for errors */
-static int cfline; /* config file line, likewise */
-static struct fontops *fontops;/* font operations code: list head */
-static struct fontconf *fonts; /* font list */
-static struct fontconf **nextfc;/* used during initialisation */
-static char spec_any[] = "*"; /* the `anything' specifier */
-
-static void readconf(char *name);
-static void badcf(char *why);
-static void setfenv(struct fontconf *pfc, char *env, char *suf);
-static void setfont(struct fontconf *pfc, char *path);
-static struct font *getafont(char *nm, i32 dvimag, i32 dvidsz,
- char *dev, char **fname, int wantrast);
-
-/*
- * Imports.
- */
-extern int errno;
-char *getenv(), *malloc(), *strncpy(), *strsave();
-
-/*
- * You may get warnings from lint about sprintf(), which is of type
- * `char *' in early 4BSD releases. Ignore the warning.
- */
-
-/*
- * Here, alas, we know about all the kinds of fonts.
- * This also means that every DVI interpreter pulls in
- * the full set of font manipulation routines.
- *
- * PERHAPS THIS SHOULD BE CONFIGURABLE.
- */
-#define ADDFONT(x) { \
- extern struct fontops x; \
- x.fo_next = fontops; \
- fontops = &x; \
-}
-
-void
-fontinit(char *file)
-{
-
- if (didinit) {
- /*
- * Could free the old configuration and fire up
- * a new one, but for now . . .
- */
- error(1, 0, "attempt to reinit fonts");
- /* NOTREACHED */
- }
- didinit++;
- ADDFONT(invisops);
- ADDFONT(tfmops);
- ADDFONT(blankops);
- ADDFONT(boxops);
- ADDFONT(pxlops);
- ADDFONT(gfops);
- ADDFONT(pkops);
- nextfc = &fonts;
- if (file == NULL)
- if ((file = getenv(CONFENV)) == NULL)
- file = FONTDESC;
- readconf(file);
-}
-
-/*
- * Find a font's operations, given its name.
- */
-static struct fontops *
-findops(char *name)
-{
- register struct fontops *fo;
-
- for (fo = fontops; fo != NULL; fo = fo->fo_next)
- if (EQ(fo->fo_name, name))
- return (fo);
- return (NULL);
-}
-
-/*
- * Read the named configuration file. The file is split into
- * lines, and lines are split into words; if the first word is
- * "font", this is a fontconf, and we read the remainder of the
- * words and make a fontconf entry.
- */
-static void
-readconf(char *name)
-{
- register FILE *f; /* config file */
- register int c; /* char and word counter */
- int isenv; /* true => doing `fontenv', not `font' */
- char *env; /* value from getenv() */
- struct fontconf proto; /* prototype fontconf */
- char *v[20]; /* word vector */
- char line[BUFSIZ]; /* input line */
-
- if ((f = fopen(name, "r")) == NULL)
- error(1, -1, "cannot read font configuration file \"%s\"",
- name);
- cfname = name;
- cfline = 0;
- while (fgets(line, sizeof (line), f) != NULL) {
- cfline++;
- if ((c = strlen(line)) > 0) {
- if (line[--c] != '\n')
- badcf("line too long");
- line[c] = 0;
- }
- if ((c = split(line, v, sizeof v / sizeof *v)) < 0)
- badcf("too many words");
- /* skip things that are not fonts */
- if (c == 0)
- continue;
- if (EQ(v[0], "font"))
- isenv = 0;
- else if (EQ(v[0], "fontenv"))
- isenv = 1;
- else
- continue;
- switch (c) {
- case 1:
- badcf("missing font typename");
- /* NOTREACHED */
- case 2:
- badcf("missing font spec (engine)");
- /* NOTREACHED */
- case 3:
- badcf("missing slop value");
- /* NOTREACHED */
- case 4:
- badcf(isenv ? "need environment variable" :
- "need pathname");
- /* NOTREACHED */
- case 5:
- if (isenv)
- badcf("need suffix");
- break;
- case 6:
- if (isenv)
- break;
- default:
- error(0, 0,
- "%s, line %d: warning: %d extra word(s) ignored",
- cfname, cfline, c - 5);
- break;
- }
- if ((proto.fc_ops = findops(v[1])) == NULL) {
- error(0, 0,
- "\"%s\", line %d: unknown font type \"%s\" ignored",
- cfname, cfline, v[1]);
- continue;
- }
-
- /*
- * For fontenv, if the environment variable is not actually
- * set in the environment, just skip over this line.
- */
-
- /* Debugging (LOG) */
- printf(" texsunLOG: ");
- printf(v[0]);
- printf(" .");
- printf(v[1]);
- printf(" ");
- if (isenv)
- printf("'");
- printf(v[4]);
- if (isenv)
- printf("'");
- printf(" does:\n");
-
- if (isenv && (env = getenv(v[4])) == NULL)
- continue;
- proto.fc_next = NULL;
- proto.fc_spec = EQ(v[2], spec_any) ? NULL : strsave(v[2]);
- proto.fc_slop = atoi(v[3]);
- if (proto.fc_slop < 0) /* quietly enforce proper slops */
- proto.fc_slop = 0;
- if (isenv) {
- printf(" = ");
- printf(env);
- printf("\n");
- setfenv(&proto, env, v[5]);
- }
- else
- setfont(&proto, strsave(v[4]));
- }
-}
-
-/*
- * Handle fontenv lines by appending as many configuration entries
- * as there are components in the given environment variable.
- */
-static void
-setfenv(struct fontconf *pfc, char *env, char *suf)
-{
- register char *s, *t;
- register int len, suflen = strlen(suf);
- register char *mem, *slash;
- char *munch = strsave(env); /* a copy we can write on */
- struct fontops *fo;
-
- /*
- * Loop over the path. Turn `foo' into `foo/<suf1><suf2>';
- * turn an empty string into just <suf1><suf2>. Put these
- * names in fresh memory and set them up as places to search.
- */
-
- for (s = munch; (t = s) != NULL; s = t) {
- for (;;) {
- if (*t == ':') {
- *t++ = 0;
- len = t - s; /* includes trailing NUL */
- break;
- }
- if (*t++ == 0) {
- len = t - s; /* includes trailing NUL */
- t = NULL;
- break;
- }
- }
- if (len != 0) {
- slash = "/";
- len++;
- } else
- slash = "";
- if ((mem = malloc(len + suflen)) == NULL)
- error(1, -1, "out of memory while saving $%s", env);
- (void) sprintf(mem, "%s%s%s", s, slash, suf);
- setfont(pfc, mem);
- }
- free(munch);
-}
-
-/*
- * Turn a prototype fontconf into a real one.
- */
-static void
-setfont(struct fontconf *pfc, char *path)
-{
- register struct fontconf *fc;
-
- if ((fc = (struct fontconf *)malloc(sizeof(*fc))) == NULL)
- error(1, -1, "out of memory for font configuration (sorry)");
- *fc = *pfc;
- fc->fc_path = path;
- *nextfc = fc;
- nextfc = &fc->fc_next;
-
- printf(" texsunLOG: scanning ");
- printf(path);
- printf("\n");
- /* message for found path (logging) */
-}
-
-/*
- * Complain about a problem in the configuration file.
- */
-static void
-badcf(char *why)
-{
-
- error(1, 0, "\"%s\", line %d: %s", cfname, cfline, why);
- /* NOTREACHED */
-}
-
-/*
- * Copy string s into buffer buf, dropping off any numerical suffix.
- * E.g., cmr7 and cmr10 become cmr. (This is the `%b' operator.)
- */
-static void
-basify(char *s, char *buf, int size)
-{
- register char *p, *endp;
- register int n;
-
- for (p = s; *p; p++)
- if (!isdigit(*p))
- endp = p;
- if ((n = endp + 1 - s) >= size)
- error(1, 0, "font name `%s' too long for %%b (sorry)", s);
- (void) strncpy(buf, s, n);
- buf[n] = 0;
-}
-
-/*
- * Turn a prototype path, name, and magnification into a full
- * path (expand %f, %m, %b).
- */
-static void
-pave(char *result, char *proto, char *name, int mag)
-{
- register int c;
- register char *s, *d, *p;
- char num[30], fontbase[256];
-
- d = result;
- p = proto;
- s = NULL;
- num[0] = 0; /* will need changing for other bases */
- fontbase[0] = 0;
-
- while (p != NULL) {
- /*
- * If sourcing from s, take its next character, and
- * insert it directly. Otherwise take the next path
- * character and interpret it.
- */
- if (s != NULL) {
- if ((c = *s++) == 0) {
- s = NULL;
- continue;
- }
- goto put;
- }
- if ((c = *p++) == 0)
- p = NULL;
- if (c != '%')
- goto put;
-
- switch (c = *p++) {
-
- case 'b':
- if (fontbase[0] == 0)
- basify(name, fontbase, sizeof(fontbase));
- s = fontbase;
- continue;
-
- case 'f':
- case 'n':
- case 's':
- s = name;
- continue;
-
- case 'd':
- case 'm':
- if (num[0] == 0)
- (void) sprintf(num, "%d", mag);
- s = num;
- continue;
-
- case 0:
- c = '%';
- p--;
- /* FALLTHROUGH */
- }
-put:
- if (d - result >= PATHLEN)
- error(1, 0, "font path `%s' too long (sorry)", proto);
- *d++ = c;
- }
-}
-
-/*
- * Given a font name and size, return the first font that fits, along
- * with its name (via fname). If we cannot find such a font, we set
- * *fname to point to a `canonical' example font name, unless there are
- * are no fonts for the device, in which case we set *fname to NULL.
- */
-struct font *
-GetFont(char *nm, i32 dvimag, i32 dvidsz, char *dev, char **fname)
-{
-
- return (getafont(nm, dvimag, dvidsz, dev, fname, 1));
-}
-
-/*
- * Same as GetFont, but caller promises never to ask for rasters.
- */
-struct font *
-GetRasterlessFont(char *nm, i32 dvimag, i32 dvidsz, char *dev, char **fname)
-{
-
- return (getafont(nm, dvimag, dvidsz, dev, fname, 0));
-}
-
-/*
- * NEED TO THINK ABOUT gf NAMING CONVENTIONS HERE: ARE THEY LIKE pxl?
- * WHAT ABOUT OTHERS?
- */
-static struct font *
-getafont(char *nm, i32 dvimag, i32 dvidsz, char *dev, char **fname, int wantrast)
-{
- register int slop, fmag;
- register struct font *f;
- register struct fontconf *fc;
- register struct fontops *fo;
- register char *path;
- int fd, scaled;
- double mag;
- static char firstpath[PATHLEN], laterpath[PATHLEN];
-
- if (!didinit)
- fontinit((char *)NULL);
-
- /*
- * The equation below means, approximately, `the font is
- * magnified by the ratio of the actual size dvimag to the
- * design size dvidsz, and then further scaled by the
- * global magnification.' We multiply this by the printer's
- * resolution in dots per inch, then use the per-font
- * conversion factor to convert a dots-per-inch value to
- * a font name `%m' magnification (extension).
- */
- mag = (double) dvimag / (double) dvidsz;
- scaled = mag * 1000.0 + 0.5;
- mag *= Conversion.c_mag * Conversion.c_dpi;
-
- path = firstpath; /* no canonical font name yet */
- for (fc = fonts; fc != NULL; fc = fc->fc_next) {
- if (dev != NULL && fc->fc_spec != NULL &&
- !EQ(dev, fc->fc_spec))
- continue;
- /*
- * Fake fonts are ignored unless there is already
- * `canonical' real font. The first non-fake font
- * is the `canonical' one.
- */
- fo = fc->fc_ops;
- if (path == firstpath && fo->fo_fakefont)
- continue;
- fmag = mag * fo->fo_dpitomag + 0.5;
- for (slop = 0; slop <= fc->fc_slop; slop++) {
- pave(path, fc->fc_path, nm, fmag + slop);
- if ((fd = open(path, 0)) >= 0)
- goto found;
- path = laterpath; /* tried at least one now */
- if (slop) {
- pave(path, fc->fc_path, nm, fmag - slop);
- if ((fd = open(path, 0)) >= 0)
- goto found;
- }
- }
- }
-
- /* not found */
- if (path == firstpath) {
- *fname = NULL;
- errno = ENXIO;
- } else {
- *fname = firstpath;
- errno = ENOENT;
- }
- return (NULL);
-
-found:
- *fname = path;
-
- /* allocate space for the per-font info, and read it in */
- f = (struct font *)malloc(sizeof *f);
- if (f == NULL) {
- errno = ENOMEM;
- return (NULL);
- }
- f->f_flags = wantrast ? FF_RASTERS : 0;
- f->f_ops = fc->fc_ops;
- f->f_path = strsave(path);
- f->f_font = strsave(nm);
- f->f_dvimag = dvimag;
- f->f_dvidsz = dvidsz;
- f->f_scaled = scaled;
- f->f_pspace = f->f_dvimag / 6; /* a three-unit "thin space" */
- f->f_nspace = -4 * f->f_pspace;
- f->f_vspace = 5 * f->f_pspace;
- errno = 0;
- if ((*f->f_ops->fo_read)(f, fd)) {
- int e = errno; /* paranoid */
-
- free(f->f_path);
- free(f->f_font);
- free((char *)f);
- errno = e;
- return (NULL);
- }
- if (f->f_ops->fo_fakefont) {
- error(0, 0, "Warning: no font for %s", Font_TeXName(f));
- if (firstpath[0])
- error(0, 0, "(wanted, e.g., \"%s\")", firstpath);
- error(0, 0, "I will substitute %s for the missing glyphs",
- f->f_ops->fo_fakefont == 1 ? "boxes" : "white space");
- }
- return (f);
-}
-
diff --git a/Build/source/texk/seetexk/font_subr.c b/Build/source/texk/seetexk/font_subr.c
deleted file mode 100644
index 1d8f698d1d6..00000000000
--- a/Build/source/texk/seetexk/font_subr.c
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * Copyright (c) 1987, 1989 University of Maryland
- * Department of Computer Science. All rights reserved.
- * Permission to copy for any purpose is hereby granted
- * so long as this copyright notice remains intact.
- */
-
-#ifndef lint
-static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/font_subr.c,v 2.8 89/10/30 04:08:52 chris Exp $";
-#endif
-
-/*
- * Subroutines common to all fonts.
- */
-
-#include "types.h"
-#include "error.h"
-#include "font.h"
-
-static struct glyph *freeglyphs;
-
-#if !defined( WIN32 ) && !defined( _AMIGA )
-char *malloc();
-extern errno;
-#endif
-
-/*
- * Set up the font structures to note that a font has glyphs in
- * the half-open interval [low, high).
- *
- * SHOULD I ALLOW ADDITIONS TO THE RANGE VIA SUBSEQUENT CALLS TO
- * FontHasGlyphs?
- */
-FontHasGlyphs(f, low, high)
- register struct font *f;
- register int low, high;
-{
- register struct glyph **gp;
-
- /* record bounds */
- f->f_lowch = low;
- f->f_highch = high;
-
- /*
- * Allocate space for all the glyph pointers, and set
- * them all to NULL.
- */
- if (low >= high) /* no glyphs */
- gp = NULL;
- else {
- gp = (struct glyph **) malloc((unsigned) (high - low) *
- sizeof (*gp));
- if (gp == NULL)
- return (-1);
- }
- f->f_glybase = gp;
- f->f_gly = gp - low;
- while (++low <= high)
- *gp++ = NULL;
- return (0);
-}
-
-/*
- * AllocGlyph allocates a new glyph. ReleaseGlyph puts one onto the free
- * list. We maintain a local list of free glyphs.
- */
-#define ReleaseGlyph(g) \
- ((g)->g_un.g_next = freeglyphs, freeglyphs = (g))
-
-static struct glyph *
-AllocGlyph(n)
- int n;
-{
- register struct glyph *g;
- register int i;
-
- if ((g = freeglyphs) == NULL) {
- g = (struct glyph *) malloc((unsigned) (128 * sizeof (*g)));
- if (g == NULL)
- error(1, errno, "out of glyph memory");
- g += (i = 128);
- while (--i >= 0) {
- g--;
- ReleaseGlyph(g);
- }
- }
- freeglyphs = g->g_un.g_next;
- g->g_flags = 0;
- g->g_raster = NULL;
- g->g_index = n;
- g->g_xescapement = NO_ESCAPEMENT;/* default, if not set by font */
- g->g_yescapement = NO_ESCAPEMENT;
- return (g);
-}
-
-/*
- * Free one glyph.
- */
-void
-FreeGlyph(f, g)
- struct font *f;
- register struct glyph *g;
-{
- int n = g->g_index;
-
-#ifdef notdef
- (*f->f_ops->fo_freegly)(f, n, n);
-#endif
- if (g->g_raster != NULL)
- free(g->g_raster);
- ReleaseGlyph(g);
- f->f_gly[n] = NULL;
-}
-
-/*
- * Free a font.
- */
-void
-FreeFont(f)
- register struct font *f;
-{
- register struct glyph *g;
- register int i;
-
-#ifdef notdef
- (*f->f_ops->fo_freegly)(f, f->f_lowch, f->f_highch);
-#endif
- for (i = f->f_lowch; i < f->f_highch; i++) {
- if ((g = f->f_gly[i]) == NULL)
- continue;
- if (g->g_raster != NULL)
- free(g->g_raster);
- ReleaseGlyph(g);
- }
- if (f->f_glybase != NULL)
- free((char *)f->f_glybase);
- (*f->f_ops->fo_freefont)(f);
- free(f->f_path);
- free(f->f_font);
- free((char *)f);
-}
-
-/*
- * Get glyph `c' in font `f'. We pull in a few adjacent glyphs here
- * under the (perhaps naive) assumption that things will go faster
- * that way.
- *
- * TODO:
- * try different adjacency values
- * make adjacency a font attribute? (or an op)
- */
-#define ADJ 4 /* must be a power of 2 */
-#define GET_ADJ(c, l, h) ((h) = ADJ + ((l) = (c) & ~(ADJ - 1)))
-
-struct glyph *
-GetGlyph(f, c)
- register struct font *f;
- int c;
-{
- register int i, h, l;
-
- GET_ADJ(c, l, h);
- if (l < f->f_lowch)
- l = f->f_lowch;
- if (h > f->f_highch)
- h = f->f_highch;
- if (l >= h)
- return (NULL);
- for (i = l; i < h; i++)
- if (f->f_gly[i] == NULL)
- f->f_gly[i] = AllocGlyph(i);
-
- if ((*f->f_ops->fo_getgly)(f, l, h)) {
- /*
- * I do not know what to do about this just yet, so:
- */
- panic("getgly fails and I am confused ... help!");
- }
-
- /*
- * Apply the appropriate scale factor to the TFM widths.
- * This makes them come out in scaled points, instead of FIXes.
- */
- ScaleGlyphs(f, l, h); /* ??? */
-
- return (f->f_gly[c]);
-}
-
-/*
- * Get the raster for glyph g in font f at rotation r.
- */
-char *
-GetRaster(g, f, r)
- register struct glyph *g;
- register struct font *f;
- int r;
-{
- int l, h;
-
- /* abort if caller did not ask for rasters in advance */
- if ((f->f_flags & FF_RASTERS) == 0)
- panic("GetRaster(%s)", f->f_path);
-
- /*
- * If there is no raster, get one. Blank characters,
- * however, never have rasters.
- */
- if (g->g_raster == NULL) {
- if (!HASRASTER(g))
- return (NULL);
- /*
- * THE FOLLOWING DEPENDS ON THE ADJACENCY MATCHING THAT IN
- * GetGlyph() ABOVE.
- */
- GET_ADJ(g->g_index, l, h);
- if (l < f->f_lowch)
- l = f->f_lowch;
- if (h > f->f_highch)
- h = f->f_highch;
- if ((*f->f_ops->fo_rasterise)(f, l, h))
- error(1, 0, "rasterise fails (out of memory?)");
- }
- if (g->g_rotation != r)
- SetRotation(g, r);
- return (g->g_raster);
-}
-
-void
-FreeRaster(g)
- struct glyph *g;
-{
-
- if (g->g_raster) {
- free((g)->g_raster);
- g->g_raster = NULL;
- }
-}
-
-/*
- * Return a TeX-style font name, including scale factor.
- * SHOULD I BOTHER WITH \magstep STYLE NAMES?
- */
-char *
-Font_TeXName(f)
- register struct font *f;
-{
- static char result[200];
-
- if (f->f_scaled == 1000)
- return (f->f_font);
- (void) sprintf(result, "%s scaled %d", f->f_font, f->f_scaled);
- return (result);
-}
diff --git a/Build/source/texk/seetexk/getopt.c b/Build/source/texk/seetexk/getopt.c
deleted file mode 100644
index 258d91f3d9f..00000000000
--- a/Build/source/texk/seetexk/getopt.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 1987, 1989 University of Maryland
- * Department of Computer Science. All rights reserved.
- * Permission to copy for any purpose is hereby granted
- * so long as this copyright notice remains intact.
- */
-
-/*
- * getopt - get option letter from argv
- * (From Henry Spencer @ U of Toronto Zoology, slightly edited)
- */
-
-#include <stdio.h>
-
-char *optarg; /* Global argument pointer. */
-int optind; /* Global argv index. */
-
-static char *scan; /* Private scan pointer. */
-#if defined( WIN32 ) || defined( _AMIGA )
-#include <string.h>
-#define index strchr
-#else
-extern char *index();
-#endif
-
-int
-getopt(argc, argv, optstring)
- register int argc;
- register char **argv;
- char *optstring;
-{
- register int c;
- register char *place;
-
- optarg = NULL;
- if (scan == NULL || *scan == 0) {
- if (optind == 0)
- optind++;
- if (optind >= argc || argv[optind][0] != '-' ||
- argv[optind][1] == 0)
- return (EOF);
- if (strcmp(argv[optind], "--") == 0) {
- optind++;
- return (EOF);
- }
- scan = argv[optind] + 1;
- optind++;
- }
- c = *scan++;
- place = index(optstring, c);
-
- if (place == NULL || c == ':') {
- fprintf(stderr, "%s: unknown option -%c\n", argv[0], c);
- return ('?');
- }
- place++;
- if (*place == ':') {
- if (*scan != '\0') {
- optarg = scan;
- scan = NULL;
- } else {
- if (optind >= argc) {
- fprintf(stderr,
- "%s: missing argument after -%c\n",
- argv[0], c);
- return ('?');
- }
- optarg = argv[optind];
- optind++;
- }
- }
- return (c);
-}
diff --git a/Build/source/texk/seetexk/gfclass.c b/Build/source/texk/seetexk/gfclass.c
deleted file mode 100644
index 207b58ef7e4..00000000000
--- a/Build/source/texk/seetexk/gfclass.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 1987, 1989 University of Maryland
- * Department of Computer Science. All rights reserved.
- * Permission to copy for any purpose is hereby granted
- * so long as this copyright notice remains intact.
- */
-
-#ifndef lint
-static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/gfclass.c,v 2.3 89/08/22 21:52:30 chris Exp $";
-#endif
-
-/*
- * gfclass - GF code classification tables.
- */
-
-#include "gfclass.h"
-
-/* shorthand---in lowercase for contrast (read on!) */
-#define three(x) x, x, x
-#define four(x) x, x, x, x
-#define five(x) four(x), x
-#define six(x) four(x), x, x
-#define eight(x) four(x), four(x)
-#define sixteen(x) eight(x), eight(x)
-#define thirty_two(x) sixteen(x), sixteen(x)
-#define sixty_four(x) thirty_two(x), thirty_two(x)
-#define one_twenty_eight(x) sixty_four(x), sixty_four(x)
-#define one_sixty_five(x) one_twenty_eight(x), thirty_two(x), five(x)
-
-/*
- * Length of the single (or first) operand, if any.
- */
-char gf_oplen[256] = {
- sixty_four(GPL_NONE), /* GF_PAINT_0 through GF_PAINT_63 */
- GPL_UNS1, /* GF_PAINT1 */
- GPL_UNS2, /* GF_PAINT2 */
- GPL_UNS3, /* GF_PAINT3 */
- GPL_NONE, /* GF_BOC */
- GPL_NONE, /* GF_BOC1 */
- GPL_NONE, /* GF_EOC */
- GPL_NONE, /* GF_SKIP0 */
- GPL_UNS1, /* GF_SKIP1 */
- GPL_UNS2, /* GF_SKIP2 */
- GPL_UNS3, /* GF_SKIP3 */
- one_sixty_five(GPL_NONE),/* GF_NEW_ROW_0 through GF_NEW_ROW_164 */
- GPL_UNS1, /* GF_XXX1 */
- GPL_UNS2, /* GF_XXX2 */
- GPL_UNS3, /* GF_XXX3 */
- GPL_SGN4, /* GF_XXX4 */
- GPL_SGN4, /* GF_YYY */
- GPL_NONE, /* GF_NOP */
- GPL_NONE, /* GF_CHAR_LOC */
- GPL_NONE, /* GF_CHAR_LOC0 */
- GPL_NONE, /* GF_PRE */
- GPL_NONE, /* GF_POST */
- GPL_NONE, /* GF_POSTPOST */
- six(GPL_NONE) /* 250 through 255 */
-};
-
-/*
- * Types of the various opcodes.
- */
-char gf_gt[256] = {
- sixty_four(GT_PAINT0), /* GF_PAINT_0 through GF_PAINT_63 */
- three(GT_PAINT), /* GF_PAINT1 through GF_PAINT3 */
- GT_BOC, /* GF_BOC */
- GT_BOC1, /* GF_BOC1 */
- GT_EOC, /* GF_EOC */
- GT_SKIP0, /* GF_SKIP0 */
- three(GT_SKIP), /* GF_SKIP1 through GF_SKIP3 */
- one_sixty_five(GT_NEW_ROW),/* GF_NEW_ROW_0 throgh GF_NEW_ROW_164 */
- four(GT_XXX), /* GF_XXX1 through GF_XXX4 */
- GT_YYY, /* GF_YYY */
- GT_NOP, /* GF_NOP */
- GT_CHAR_LOC, /* GF_CHAR_LOC */
- GT_CHAR_LOC0, /* GF_CHAR_LOC0 */
- GT_PRE, /* GF_PRE */
- GT_POST, /* GF_POST */
- GT_POSTPOST, /* GF_POSTPOST */
- six(GT_UNDEF) /* 250 through 255 */
-};
diff --git a/Build/source/texk/seetexk/gfclass.h b/Build/source/texk/seetexk/gfclass.h
deleted file mode 100644
index dd43f8254aa..00000000000
--- a/Build/source/texk/seetexk/gfclass.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 1987, 1989 University of Maryland
- * Department of Computer Science. All rights reserved.
- * Permission to copy for any purpose is hereby granted
- * so long as this copyright notice remains intact.
- */
-
-/*
- * GF classification codes
- */
-
-/*
- * Predicate for simple paint commands. This is presumably the most
- * common GF operation; it may be profitable to check for this before
- * switching out on the command type.
- */
-#define GF_IsPaint(c) ((c) < 64)
-
-/*
- * Symbolic names for command `types', as returned by the macro
- * GT_TYPE(int c).
- */
-#define GT_PAINT0 0 /* paint without parameter */
-#define GT_PAINT 1 /* paint with parameter */
-#define GT_BOC 2 /* long BOC */
-#define GT_BOC1 3 /* short BOC */
-#define GT_EOC 4 /* EOC */
-#define GT_SKIP0 5 /* parameterless SKIP */
-#define GT_SKIP 6 /* parmeterised SKIP */
-#define GT_NEW_ROW 7 /* NEW_ROW_n */
-#define GT_XXX 8 /* XXXn */
-#define GT_YYY 9 /* YYY */
-#define GT_NOP 10 /* no op */
-#define GT_CHAR_LOC 11 /* CHAR_LOC */
-#define GT_CHAR_LOC0 12 /* abbreviated CHAR_LOC */
-#define GT_PRE 13
-#define GT_POST 14
-#define GT_POSTPOST 15
-#define GT_UNDEF 16
-
-/*
- * Symbolic names for parameter lengths, obtained via the macro
- * GT_OpLen(int c).
- */
-#define GPL_NONE 0 /* no parameter, or too complex */
-#define GPL_UNS1 1 /* one one-byte parameter in 0..255 */
-#define GPL_UNS2 2 /* one two-byte parameter in 0..65535 */
-#define GPL_UNS3 3 /* one three-byte parameter in 0..16777215 */
-#define GPL_SGN4 4 /* one four-byte signed parameter */
-/*
- * there are no unsigned four byte parameters, and no shorter signed
- * parameters
- */
-
-#define GF_OpLen(code) (gf_oplen[code])
-#define GF_TYPE(code) (gf_gt[code])
-extern char gf_oplen[];
-extern char gf_gt[];
diff --git a/Build/source/texk/seetexk/gfcodes.h b/Build/source/texk/seetexk/gfcodes.h
deleted file mode 100644
index beab1c54ea7..00000000000
--- a/Build/source/texk/seetexk/gfcodes.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 1987, 1989 University of Maryland
- * Department of Computer Science. All rights reserved.
- * Permission to copy for any purpose is hereby granted
- * so long as this copyright notice remains intact.
- */
-
-/*
- * GF (generic font) opcodes.
- */
-
-#define GF_PAINT_0 0 /* paint with `d' = 0 */
- /* ... through PAINT_63, d = 63 */
-#define GF_PAINT1 64 /* paint, with a one-byte parameter */
-#define GF_PAINT2 65 /* paint, with a two-byte parameter */
-#define GF_PAINT3 66 /* paint, with a three-byte parameter */
-#define GF_BOC 67 /* beginning of character */
-#define GF_BOC1 68 /* compressed form of BOC */
-#define GF_EOC 69 /* end of character */
-#define GF_SKIP0 70 /* finish this row, begin next with white */
-#define GF_SKIP1 71 /* finish row, one byte parameter */
-#define GF_SKIP2 72
-#define GF_SKIP3 73
-#define GF_NEW_ROW_0 74 /* begin a new row, ready to blacken */
-#define GF_NEW_ROW_1 75 /* begin a new row, but one col. from left */
- /* through GF_NEW_ROW_164 */
-#define GF_XXX1 239 /* special (interpreter dependent) command */
-#define GF_XXX2 240 /* like XXX1, but two byte length parameter */
-#define GF_XXX3 241
-#define GF_XXX4 242
-#define GF_YYY 243 /* takes four byte parameter, otherwise nop */
- /* (generated by METAFONT for numspecial) */
-#define GF_NOP 244 /* no op */
-#define GF_CHAR_LOC 245 /* character locator */
-#define GF_CHAR_LOC0 246 /* abbreviated form of CHAR_LOC */
-#define GF_PRE 247 /* introduces preamble */
-#define GF_POST 248 /* introduces postamble */
-#define GF_POSTPOST 249 /* marks end of postamble */
-
- /* codes 250 through 255 are undefined */
-
-#define GF_ID 131 /* identifies this revision of GF */
-
-#define GF_FILLER 223 /* filler bytes at end of GF file */
diff --git a/Build/source/texk/seetexk/gffont.c b/Build/source/texk/seetexk/gffont.c
deleted file mode 100644
index 85301b03c53..00000000000
--- a/Build/source/texk/seetexk/gffont.c
+++ /dev/null
@@ -1,946 +0,0 @@
-/*
- * Copyright (c) 1987, 1989 University of Maryland
- * Department of Computer Science. All rights reserved.
- * Permission to copy for any purpose is hereby granted
- * so long as this copyright notice remains intact.
- */
-
-#ifndef lint
-static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/gffont.c,v 2.9 89/09/02 17:16:17 chris Exp $";
-#endif
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "types.h"
-#include "error.h"
-#include "font.h"
-#include "gfcodes.h"
-#include "gfclass.h"
-#include "num.h"
-
-/*
- * GF font operations.
- *
- * GF files may be compact, but this code surely is not!
- *
- * TODO:
- * think about fonts with characters outside [0..255]
- * find some way to free gf body when done
- */
-static int gf_read(), gf_getgly(), gf_rasterise();
-static void gf_freefont();
-
-struct fontops gfops =
- { "gf", 0, 1.0, gf_read, gf_getgly, gf_rasterise, gf_freefont };
-
-/*
- * Local info.
- */
-
-/*
- * A bounding box. The names follow those in the GF documentation.
- */
-struct bounds {
- i32 min_m, max_m; /* min and max `m' (colunm) values */
- i32 min_n, max_n; /* min and max `n' (row) values */
-};
-
-/*
- * char_loc is one `character locator' from a GF file, save for the
- * `character residue', which we need not.
- */
-struct char_loc {
- i32 cl_dx; /* x escapement (scaled pixels) */
- i32 cl_dy; /* y escapement (scaled pixels) */
- i32 cl_w; /* TFM width */
- i32 cl_p; /* pointer to BOC (or specials) */
-};
-
-/*
- * GF details include:
- * -> the main body of the GF file (all bytes save pre- and post-amble);
- * -> global box boundaries;
- * and character locators, addressed by `character residue'. Empty
- * slots are indicated by a -1 `pointer'.
- */
-struct gf_details {
- char *gd_body; /* GF body */
- char *gd_base; /* == gd_body - preamble_size */
- struct bounds gd_gb; /* global boundaries */
- struct char_loc gd_cl[256]; /* character locators */
-};
-
-/*
- * Get the gf_details from font f.
- */
-#define ftogd(f) ((struct gf_details *)(f)->f_details)
-
-#if !defined( WIN32 ) && !defined( _AMIGA )
-extern int errno;
-extern char *malloc();
-#endif
-char *copyit();
-
-/*
- * This code mimicks findpost.c.
- */
-#define POSTSIZE 512
-
-/*
- * Find the GF postamble. Store the offsets of the POST and POSTPOST
- * opcodes through postp and postpostp.
- */
-static int
-findGFpostamble(fd, postp, postpostp)
- int fd;
- long *postp, *postpostp;
-
-{
- register long offset;
- register char *p;
- register int i;
- register i32 n;
- char postbuf[POSTSIZE];
-
- offset = lseek(fd, 0L, 2);
- do {
-
- if ((offset -= POSTSIZE) < 0L)
- offset = 0L;
- (void) lseek(fd, offset, 0);
- i = read(fd, postbuf, POSTSIZE);
- if (i <= 0)
- break;
- for (p = postbuf + i; --i >= 0;)
- if (UnSign8(*--p) != GF_FILLER)
- goto found_something;
- } while (offset);
- return (-1); /* ran out of filler */
-
-found_something:
- if (UnSign8(*p) != GF_ID)
- return (-1); /* not a GF file */
- offset += i; /* this is the offset of *p */
- *postpostp = offset - 5;/* POSTPOST should be here */
- /* we need 4 bytes for the pointer */
- if (i >= 4)
- p -= 4;
- else {
- offset -= 4;
- if (offset < 0L)
- return (-1); /* tsk */
- (void) lseek(fd, offset, 0);
- if (read(fd, p = postbuf, 4) != 4)
- return (-1);
- }
- /*
- * p now points to the postamble pointer. Get it and
- * seek to the postamble, also saving the offset.
- */
- pGetLong(p, n);
- *postp = offset = n;
- (void) lseek(fd, offset, 0);
- return (0); /* made it */
-}
-
-/*
- * Read a GF file.
- */
-static int
-gf_read(f, fd)
- register struct font *f;
- int fd;
-{
- register struct gf_details *gd;
- register char *p;
- register struct char_loc *cl;
- register int i;
- int presize, postsize, bodysize, firstc, lastc;
- char *postamble;
- long postaddr, postpostaddr;
- i32 lasteoc;
- char *problem = NULL;
- struct stat st;
- char b[4];
- int saverr;
-
- gd = NULL; /* prepare for failure */
- postamble = NULL;
-
- /*
- * The file had best be at least 50 bytes long. A
- * `completely empty' GF file might consist of a PRE, a GF_ID,
- * no comment (one zero byte), then: POST, pointer to last
- * EOC, design size, checksum, hppp, vppp, min_m, max_m,
- * min_n, max_n, POSTPOST, pointer to POST, GF_ID, and four
- * FILLERs.
- */
- (void) fstat(fd, &st);
- if (st.st_size < 50) { /* too small to be a GF file */
- problem = "file is too short";
- goto fail;
- }
-
- /*
- * Read the very beginning and pick up the preamble size.
- */
- if (read(fd, b, 4) != 4)
- goto fail;
- if (UnSign8(b[0]) != GF_PRE) {
- problem = "file does not begin with PRE";
- goto fail;
- }
- i = UnSign8(b[1]);
- if (i != GF_ID)
- error(0, 0, "Warning: strange GF id (%d) in \"%s\"", i,
- f->f_path);
- presize = 3 + UnSign8(b[2]);
-
- /*
- * Find the postamble, allocate space, and read it in.
- */
- if (findGFpostamble(fd, &postaddr, &postpostaddr)) {
- problem = "cannot find postamble";
- goto fail;
- }
- postsize = postpostaddr - postaddr + 1;
- if ((p = malloc(postsize)) == NULL)
- goto fail;
- if (read(fd, p, postsize) != postsize)
- goto fail;
- postamble = p;
-
- /*
- * Make sure we found it.
- */
- if (pgetbyte(p) != GF_POST) {
- problem = "no GF_POST at postamble";
- goto fail;
- }
- if (UnSign8(postamble[postsize - 1]) != GF_POSTPOST) {
- problem = "no GF_POSTPOST after postamble";
- goto fail;
- }
-
- /*
- * Looks okay. Allocate detail space and poke through the postamble.
- */
- if ((gd = (struct gf_details *) malloc(sizeof (*gd))) == NULL)
- goto fail;
- gd->gd_body = NULL;
-
- pGetLong(p, lasteoc); /* actually one past last EOC */
- pGetLong(p, f->f_design_size);
- pGetLong(p, f->f_checksum);
- pGetLong(p, f->f_hppp);
- pGetLong(p, f->f_vppp);
-
- pGetLong(p, gd->gd_gb.min_m);
- pGetLong(p, gd->gd_gb.max_m);
- pGetLong(p, gd->gd_gb.min_n);
- pGetLong(p, gd->gd_gb.max_n);
-
- /*
- * Zap all the character locators, then read those that are
- * defined in the postamble. Remember the first and last
- * characters so that we know which glyphs are defined. Lastc
- * is actually the last-plus-one'th character.
- */
- for (cl = gd->gd_cl, i = 256; --i >= 0; cl++)
- cl->cl_p = -1;
- firstc = 256;
- lastc = 0;
- for (;;) {
- i32 dx, dy;
-
- switch (pgetbyte(p)) {
-
- case GF_CHAR_LOC:
- i = pgetbyte(p);
- pGetLong(p, dx);
- pGetLong(p, dy);
- goto merge;
-
- case GF_CHAR_LOC0:
- i = pgetbyte(p);
- dx = ((i32) pgetbyte(p)) << 16;
- dy = 0;
-merge:
- if (i < firstc)
- firstc = i;
- if (i >= lastc)
- lastc = i + 1;
- cl = &gd->gd_cl[i];
- cl->cl_dx = dx;
- cl->cl_dy = dy;
- pGetLong(p, cl->cl_w);
- pGetLong(p, cl->cl_p);
- break;
-
- case GF_POSTPOST:
- goto done;
-
- default:
- error(0, 0, "I do not understand %d here",
- UnSign8(p[-1]));
- problem = "unexpected opcode in postamble";
- goto fail;
- }
- }
-done:
- free(postamble);
- postamble = NULL; /* all done with it */
-
- /*
- * Alas, we need the instructions whether or not we need
- * the rasters, since the raster bounding box information
- * can only be properly determined by converting the rasters.
- * Compute the size of the main body of the GF file, then
- * read it in.
- */
- bodysize = lasteoc - presize;
- if ((gd->gd_body = malloc(bodysize + 1)) == NULL)
- goto fail;
- (void) lseek(fd, (long) presize, 0);
- if (read(fd, gd->gd_body, bodysize) != bodysize)
- goto fail;
- /*
- * The next byte might be a special, so we just
- * arbitrarily stuff in a POST.
- */
- gd->gd_body[bodysize] = GF_POST;
- gd->gd_base = gd->gd_body - presize;
-
- f->f_details = (char *)gd;
- if (FontHasGlyphs(f, firstc, lastc))
- goto fail2;
- (void) close(fd);
- return (0);
-
-fail:
- if (problem == NULL)
- error(0, errno, "trouble reading \"%s\"", f->f_path);
- else {
- error(0, 0, "%s", problem);
- error(0, 0, "(are you sure \"%s\" is a GF file?)", f->f_path);
- }
- errno = 0;
-fail2:
- saverr = errno;
- if (postamble != NULL)
- free(postamble);
- if (gd != NULL) {
- if (gd->gd_body != NULL)
- free(gd->gd_body);
- free((char *) gd);
- }
- (void) close(fd);
- errno = saverr;
- return (-1);
-}
-
-/*
- * Some global variables, used while building rasters. (These are
- * referenced also in copyit(), so must be global. Fortunately, no
- * one yet requires the font routines to be re-entrant.)
- */
-static char *buildraster; /* raster being built */
-static int buildsize; /* size of buildraster (bytes) */
-
-static struct bounds tempb; /* bounds used during buildraster */
-static struct bounds ob; /* observed bounds */
-
-/*
- * Bit tables: `left' and `right' bits. lbits[b] has all the bits
- * that are to the left of bit b set; rbits[b] has all the bits
- * that are to the right of bit b set, as well as bit b itself.
- */
-static char lbits[] = { 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe };
-static char rbits[] = { 0xff, 0x7f, 0x3f, 0x1f, 0x0f, 0x07, 0x03, 0x01 };
-
-/*
- * The magic address `nullraster' is known in getgly() as a valid
- * but empty raster, and changed there to NULL. A NULL return from
- * drawchar indicates failure; we need something to distinguish the
- * empty raster.
- */
-static char nullraster[1];
-
-/*
- * `Inline functions':
- * -> convert a bit number to a byte number (round down);
- * -> convert a number of bits to a number of bytes (round up);
- * and convert a bit to a bit index.
- */
-#define btoby(b) ((b) >> 3)
-#define btonb(b) (((b) + 7) >> 3)
-#define btobi(b) ((b) & 7)
-
-/*
- * Helper function for getgly: build the raster, and compute its
- * minimal bounding box. Called with `p' pointing past the backpointer
- * field of the BOC command (i.e., at min_m or del_m). `abbrev' is true
- * iff this was a BOC1. `globalb' are the global bounds from the GF file,
- * whose name is pointed to by gfname.
- */
-static char *
-drawchar(p, abbrev, globalb, gfname)
- register char *p;
- int abbrev;
- struct bounds globalb;
- char *gfname;
-{
- register i32 m; /* m register (column) */
- register char *colp; /* pointer to byte corresponding to m */
- register int c; /* temporary */
- register i32 i; /* temporary */
- register int black; /* true when paint_switch==black */
- register i32 n; /* n register (row) */
- int stride; /* multiplier to convert linear to 2d array */
- int wrotethisrow; /* true iff we wrote in the current row */
- char *virtrast; /* virtual origin version of buildraster */
- int mustcopy; /* true if we must copy the built raster */
- struct bounds gb; /* bounds from the GF file */
-
- /* get the bounds */
- if (abbrev) {
- c = pgetbyte(p);/* del_m */
- gb.min_m = (gb.max_m = pgetbyte(p)) - c;
- c = pgetbyte(p);/* del_n */
- gb.min_n = (gb.max_n = pgetbyte(p)) - c;
- } else {
- pGetLong(p, gb.min_m);
- pGetLong(p, gb.max_m);
- pGetLong(p, gb.min_n);
- pGetLong(p, gb.max_n);
- }
-
- /*
- * Trim the GF bounds according to the global bounds. We
- * use the trimmed values to allocate the build space.
- */
- tempb = gb;
-#define GB_ADJ(field, cmp) \
- if (tempb.field cmp globalb.field) \
- tempb.field = globalb.field
- GB_ADJ(min_m, <);
- GB_ADJ(max_m, >);
- GB_ADJ(min_n, <);
- GB_ADJ(max_n, >);
-#undef GB_ADJ
-
- /*
- * First check for completely empty characters---that is,
- * those where min > max. The space in cmtex10, for instance,
- * could be a completely empty character, but for some reason
- * METAFONT declares cmtex10 space as [0..0][0..0].
- * Nonetheless, we will not assume that [0..-1][0..0] or
- * the like are impossible.
- */
- if (tempb.min_m > tempb.max_m || tempb.min_n > tempb.max_n)
- return (nullraster);
-
- /*
- * Compute the distance between rows (the number of bytes per
- * column), then make sure there is room in the build space
- * for [min_n..max_n] of these, possibly by allocating a new raster.
- */
- stride = btonb(tempb.max_m - tempb.min_m + 1);
- c = stride * (tempb.max_n - tempb.min_n + 1);
- if (c > buildsize) {
- if (buildraster != NULL)
- free(buildraster);
- if ((buildraster = malloc(c)) == NULL) {
- buildsize = 0;
- return (NULL);
- }
- buildsize = c;
- }
-
- /*
- * If we are using an old raster that is too big, remember to
- * scrunch it down later.
- */
- mustcopy = buildsize > c;
-
- /* clear the raster to white */
- bzero(buildraster, c);
-
- /*
- * Make a virtual origin raster pointer. The virtual origin is
- * where raster[0][0] is, whether or not there is a raster[0][0].
- * Normally, this would be
- * &buildraster[-gb.min_n * stride - btoby(gb.min_m)],
- * but it is complicated by two things. Firstly, we would like
- * n==max_n to be the bottommost point in the raster (low
- * addresses), and n==min_n to be the topmost (high addresses).
- * In other words, we need to reflect the n (Y) values about
- * the X axis: negate them. Secondly, the raster we create
- * must be `flush left'. That is, somewhere along its rows,
- * bit 0x80 must be set at the left edge of one of its columns.
- * We need to subtract away the minimum bit index before
- * calculating bit values. This cannot really be done in
- * advance, since we cannot address bits directly.
- */
- virtrast = &buildraster[gb.max_n * stride];
-
- /*
- * Set up the bounds-trimming variables. We could do this by
- * simply setting the observed min point to a very large number,
- * and the observed max point to a very small number, but this
- * way we need not come up with extreme numbers (which might not
- * be portable).
- *
- * If at least one pixel is blackened, the observed bounds will
- * become the correct bounds in the code below, and we will have
- * min<=max; but if no pixels are blackened, we arrange to have
- * min>max, so we have to check for that again later.
- *
- * This would be `min = max + 1' and `max = min - 1', but for
- * efficiency, the observed m bounds are kept offset by gb.min_m
- * until we finish drawing the character.
- */
- ob.min_m = tempb.max_m + 1 - gb.min_m;
- ob.max_m = tempb.min_m - 1 - gb.min_m;
- ob.min_n = tempb.max_n + 1;
- ob.max_n = tempb.min_n - 1;
- wrotethisrow = 0;
-
-#define FIX_N_BOUNDS() { \
- if (wrotethisrow) { \
- c = -n; /* recall that n is reflected about X axis */ \
- if (c < ob.min_n) \
- ob.min_n = c; \
- if (c > ob.max_n) \
- ob.max_n = c; \
- wrotethisrow = 0; \
- } \
-}
-
- /*
- * Initialise state variables: m = min_m, n = max_n,
- * paint_switch = white.
- */
- m = 0; /* gb.min_m - gb.min_m */
- n = -gb.max_n; /* reflected */
- colp = &virtrast[n * stride];
-if (colp != buildraster)
-panic("gffont drawchar colp != buildraster");
- black = 0;
-
- /*
- * Now interpret the character.
- * `for (;;)' pushes everything off the right edge, alas.
- */
-more:
- c = pgetbyte(p);
- if (GF_IsPaint(c)) /* faster? */
- goto paint;
- switch (GF_OpLen(c)) {
-
- case GPL_NONE:
- break;
-
- case GPL_UNS1:
- i = pgetbyte(p);
- break;
-
- case GPL_UNS2:
- pGetWord(p, i);
- break;
-
- case GPL_UNS3:
- pGet3Byte(p, i);
- break;
-
- case GPL_SGN4:
- pGetLong(p, i);
- break;
-
- default:
- panic("gffont drawchar GF_OpLen(%d) = %d", c, GF_OpLen(c));
- /* NOTREACHED */
- }
-
- switch (GF_TYPE(c)) {
-
- case GT_PAINT0:
-paint:
- i = c - GF_PAINT_0;
- /* FALLTHROUGH */
-
- case GT_PAINT:
- /*
- * Paint `i' bits in the current row at columns [m..m+i).
- */
- if (i && black) {
- /* remember to adjust n bounds later */
- wrotethisrow = 1;
- /* adjust minimum m bound */
- if (m < ob.min_m)
- ob.min_m = m;
-
- /*
- * Finish the partial byte at colp. There are 8-k
- * bits to set to finish it, where k is the bit
- * index value from m. If we need to set fewer
- * than 8-k bits, set them now and skip the rest
- * of this.
- */
- c = 8 - btobi(m);
- if (i < c) { /* cannot finish it off */
- *colp |= UnSign8(lbits[i]) >> btobi(m);
- m += i;
- } else { /* finish it off */
- *colp++ |= rbits[btobi(m)];
- i -= c;
- m += c;
-
- /*
- * Update m to reflect having written the
- * remaining i bits, then write them.
- * First write all the full bytes, then
- * start a partial byte with whatever
- * is left over, if anything.
- */
- m += i;
- i >>= 3;
- while (--i >= 0)
- *colp++ = 0xff;
- *colp |= lbits[btobi(m)];
- }
-
- /* adjust maximum m bound */
- if (m > ob.max_m)
- ob.max_m = m;
- } else {
- /*
- * Add the bit index so that we round up whenever
- * this fills the partial byte at colp.
- */
- colp += (i + btobi(m)) >> 3;
- m += i;
- }
- black = !black;
- break;
-
- case GT_EOC: /* all done */
- FIX_N_BOUNDS();
- goto done;
-
- case GT_SKIP0: /* skip no rows */
- i = 0;
- /* FALLTHROUGH */
-
- case GT_SKIP: /* skip some rows, draw white */
- m = 0;
- black = 0;
- goto skip_or_new_row;
-
- case GT_NEW_ROW: /* next row near left col, draw black */
- m = c - GF_NEW_ROW_0;
- black = 1;
- i = 0; /* n offset is 1: skip no rows */
-skip_or_new_row:
- FIX_N_BOUNDS();
- n += i + 1; /* += because reflected */
- colp = &virtrast[n * stride + btoby(m)];
- break;
-
- case GT_XXX: /* special */
- p += i;
- break;
-
- case GT_YYY: /* numspecial */
- break;
-
- case GT_NOP: /* dull */
- break;
-
- case GT_BOC: /* should not appear */
- case GT_BOC1:
- case GT_CHAR_LOC:
- case GT_CHAR_LOC0:
- case GT_PRE:
- case GT_POST:
- case GT_POSTPOST:
- case GT_UNDEF:
- error(0, 0, "unexpected GF opcode %d", c);
- error(1, 0, "bad GF file \"%s\"", gfname);
- /* NOTREACHED */
-
- default:
- panic("gffont drawchar GF_TYPE(%d) = %d", c, GF_TYPE(c));
- /* NOTREACHED */
- }
- goto more;
-
-done:
- /*
- * The observed bounds `m' values are both off by gb.min_m, so
- * fix them now.
- */
- ob.min_m += gb.min_m;
- ob.max_m += gb.min_m;
-
- /* as noted above, we have to make sure there were some points */
- if (ob.min_m > ob.max_m)
- return (nullraster);
-if (ob.min_n > ob.max_n)
-panic("gffont min>max: n but not m");
-
- /*
- * If we used too much memory for the raster, copy it now.
- */
- if (mustcopy || tempb.min_n != ob.min_n || tempb.max_n != ob.max_n ||
- btonb(ob.max_m - ob.min_m + 1) != stride)
- return (copyit());
-
- /*
- * If the left column bounds match, just move the raster in place.
- */
- if (tempb.min_m == ob.min_m) {
- p = buildraster;
- buildraster = NULL;
- buildsize = 0;
- return (p);
- }
-
- /*
- * The raster must be copied, but only because it is not
- * `left justified'.
- *
- * CONSIDER DEFERRING THIS PHASE UNTIL THE RASTER IS USED
- */
- return (copyit());
-}
-
-/*
- * Copy the built raster to newly allocated space.
- * We may need to shift all the bits left as well.
- */
-char *
-copyit()
-{
- register char *o, *p;
- register int i, oldoff, newoff;
- char *n;
-
- /*
- * Compute the observed minimum stride.
- */
- newoff = btonb(ob.max_m - ob.min_m + 1);
- n = malloc((unsigned)(newoff * (ob.max_n - ob.min_n + 1)));
- if ((p = n) == NULL)
- return (NULL);
-
- /*
- * Compute the old stride.
- */
- oldoff = btonb(tempb.max_m - tempb.min_m + 1);
-if (oldoff < newoff)
-panic("gffont copyit oldoff < newoff");
-
- /*
- * Point at the old raster, then add the offset to the first
- * written row, and then the offset to the first written column.
- */
- o = buildraster;
- o += (ob.max_n - tempb.max_n) * oldoff;
- i = ob.min_m - tempb.min_m;
- o += btoby(i);
-
- /*
- * Now copy each row, doing shifting if required.
- */
- if ((i = btobi(i)) != 0) { /* must shift, alas */
- register int r = 8 - i, j, k;
-
- oldoff -= newoff;
- for (k = ob.max_n; k >= ob.min_n; k--) {
- for (j = newoff; --j > 0;) {
- *p = *o++ << i;
- *p++ |= UnSign8(*o) >> r;
- }
- /* last byte is special: no rightward bits */
- *p++ = *o++ << i;
- o += oldoff;
- }
- } else if (oldoff > newoff) { /* compressing columns */
- for (i = ob.max_n; i >= ob.min_n; i--) {
- bcopy(o, p, newoff);
- o += oldoff;
- p += newoff;
- }
- } else /* just squeezing out extra rows */
- bcopy(o, p, newoff * (ob.max_n - ob.min_n + 1));
-
- /* finally, return the copy */
- return (n);
-}
-
-/*
- * Obtain the specified range of glyphs.
- */
-static int
-gf_getgly(f, l, h)
- register struct font *f;
- int l, h;
-{
- register struct glyph *g;
- register struct char_loc *cl;
- register char *p;
- register i32 c;
- register int i;
- register i32 thisboc;
- int abbrev;
- struct gf_details *gd = ftogd(f);
-
- /*
- * For each glyph, make sure there exists an instance of that
- * character residue. Go find the actual glyph (which may be
- * arbitrarily far down a chain of pointers) and get its info.
- */
- for (cl = &gd->gd_cl[i = l]; i < h; i++, cl++) {
- g = f->f_gly[i];
- thisboc = cl->cl_p;
-
- /*
- * Screw around locating the character for real.
- */
- while (thisboc != -1) {
- p = gd->gd_base + thisboc;
-skip:
- c = pgetbyte(p);
- switch (GF_TYPE(c)) {
-
- case GT_XXX:
- switch (GF_OpLen(c)) {
-
- case GPL_UNS1:
- c = pgetbyte(p);
- break;
-
- case GPL_UNS2:
- pGetWord(p, c);
- break;
-
- case GPL_UNS3:
- pGet3Byte(p, c);
- break;
-
- case GPL_SGN4:
- pGetLong(p, c);
- break;
-
- default:
- panic("gf_getgly GF_OpLen(%d) = %d",
- c, GF_OpLen(c));
- /* NOTREACHED */
- }
- p += c;
- goto skip;
-
- case GT_YYY:
- p += 4;
- goto skip;
-
- case GT_BOC:
- abbrev = 0;
- pGetLong(p, c);
- break;
-
- case GT_BOC1:
- abbrev = 1;
- c = pgetbyte(p);
- break;
-
- default:
- error(0, 0, "GF code %d; I expected BOC", c);
- error(1, 0, "bad GF file \"%s\"", f->f_path);
- /* NOTREACHED */
- }
- /*
- * Found a BOC. If it is the right character,
- * go handle it.
- */
- if (c == i)
- goto handleit;
- if ((c & 255) != i) {
- error(0, 0, "%d != %d mod 256", c, i);
- error(1, 0, "Bad GF file \"%s\"", f->f_path);
- }
- /*
- * Follow the backpointer.
- */
- if (abbrev)
- thisboc = -1;
- else
- pGetLong(p, thisboc);
- }
-
- /*
- * If we get here, the glyph is not valid after all.
- */
- continue;
-
- /*
- * The glyph is okay. Set it up.
- */
-handleit:
- g->g_flags = GF_VALID;
- g->g_xescapement = cl->cl_dx;
- g->g_yescapement = cl->cl_dy;
- g->g_rawtfmwidth = cl->cl_w;
- if (!abbrev)
- p += 4; /* skip backpointer */
- if ((p = drawchar(p, abbrev, gd->gd_gb, f->f_path)) == NULL)
- return (-1); /* ??? */
- if (p == nullraster) {
- /* min > max, hence max-min+1 <= 0; we want 0 */
- g->g_height = 0;
- g->g_width = 0;
- g->g_yorigin = 0;
- g->g_xorigin = 0;
- g->g_raster = NULL;
- } else {
- /* set height &c based on observed bounds */
- g->g_height = ob.max_n - ob.min_n + 1;
- g->g_width = ob.max_m - ob.min_m + 1;
- g->g_yorigin = ob.max_n;
- g->g_xorigin = -ob.min_m;
- g->g_raster = p;
- }
- g->g_rotation = ROT_NORM;
- }
- return (0);
-}
-
-/*
- * Obtain rasters for the specified glyphs. We did this above, while
- * adjusting the bounding boxes, so this routine should never get called.
- */
-static int
-gf_rasterise(f, l, h)
- struct font *f;
- int l, h;
-{
-
- panic("gf_rasterise(%s, %d, %d)", f->f_path, l, h);
-}
-
-/*
- * Discard the font details.
- */
-static void
-gf_freefont(f)
- struct font *f;
-{
- struct gf_details *gd;
-
- if ((gd = ftogd(f)) != NULL) {
- free(gd->gd_body);
- free((char *) gd);
- }
-}
diff --git a/Build/source/texk/seetexk/magfactor.c b/Build/source/texk/seetexk/magfactor.c
deleted file mode 100644
index f0419d4aa81..00000000000
--- a/Build/source/texk/seetexk/magfactor.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 1987, 1989 University of Maryland
- * Department of Computer Science. All rights reserved.
- * Permission to copy for any purpose is hereby granted
- * so long as this copyright notice remains intact.
- */
-
-/*
- * Convert a magnification factor to floating point. This is used in
- * conjunction with the FONT_SLOP stuff to try to get the file names
- * right, and may also be used by DVI reading programs to get slightly
- * more accurate values for (mag/1000.0).
- */
-double
-DMagFactor(mag)
- int mag;
-{
-
- switch (mag) {
-
- case 1095: /* stephalf */
- return (1.095445);
-
- case 1315: /* stepihalf */
- return (1.314534);
-
- case 2074: /* stepiv */
- return (2.0736);
-
- case 2488: /* stepv */
- return (2.48832);
-
- case 2986: /* stepiv */
- return (2.985984);
-
- default: /* remaining mags have been ok */
- return ((double) mag / 1000.);
- }
- /* NOTREACHED */
-}
diff --git a/Build/source/texk/seetexk/num.h b/Build/source/texk/seetexk/num.h
deleted file mode 100644
index 80e03188df8..00000000000
--- a/Build/source/texk/seetexk/num.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 1987, 1989 University of Maryland
- * Department of Computer Science. All rights reserved.
- * Permission to copy for any purpose is hereby granted
- * so long as this copyright notice remains intact.
- */
-
-/*
- * Pointer I/O: numbers.
- *
- * We deal in fixed format numbers and pointers here.
- * For file I/O, see fio.h.
- */
-
-/*
- * Get one unsigned byte. Note that this is a proper expression.
- * The rest have more limited contexts, and are therefore OddLy
- * CapItaliseD.
- */
-#define pgetbyte(p) UnSign8(*(p)++)
-
-/*
- * Get a two-byte unsigned integer, a three-byte unsigned integer,
- * or a four-byte signed integer.
- */
-#define pGetWord(p, r) ((r) = UnSign8(*(p)++) << 8, \
- (r) |= UnSign8(*(p)++))
-#define pGet3Byte(p,r) ((r) = UnSign8(*(p)++) << 16, \
- (r) |= UnSign8(*(p)++) << 8, \
- (r) |= UnSign8(*(p)++))
-#define pGetLong(p, r) ((r) = UnSign8(*(p)++) << 24, \
- (r) |= UnSign8(*(p)++) << 16, \
- (r) |= UnSign8(*(p)++) << 8, \
- (r) |= UnSign8(*(p)++))
-
-/*
- * ADD pputbyte, pPutWord, pPut3Byte, pPutLong HERE IF THEY PROVE
- * USEFUL. (But then must consider changing PutWord &c in fio.h.)
- */
diff --git a/Build/source/texk/seetexk/pkfont.c b/Build/source/texk/seetexk/pkfont.c
deleted file mode 100644
index f5ccdb14159..00000000000
--- a/Build/source/texk/seetexk/pkfont.c
+++ /dev/null
@@ -1,731 +0,0 @@
-/*
- * Copyright (c) 1987, 1989 University of Maryland
- * Department of Computer Science. All rights reserved.
- * Permission to copy for any purpose is hereby granted
- * so long as this copyright notice remains intact.
- */
-
-#ifndef lint
-static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/pkfont.c,v 2.10 89/08/22 21:54:49 chris Exp $";
-#endif
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "types.h"
-#include "error.h"
-#include "font.h"
-#include "num.h"
-
-/*
- * PK font operations.
- *
- * The spelling `nybble' is a concession to the authors of the PK format.
- */
-static int pk_read(), pk_getgly(), pk_rasterise();
-static void pk_freefont();
-
-struct fontops pkops =
- { "pk", 0, 1.0, pk_read, pk_getgly, pk_rasterise, pk_freefont };
-
-/*
- * Local info.
- */
-
-/*
- * Commands.
- */
-#define PK_XXX1 240 /* 1 byte special */
-#define PK_XXX2 241 /* 2 byte special */
-#define PK_XXX3 242 /* 3 byte special */
-#define PK_XXX4 243 /* 4 byte special */
-#define PK_YYY 244 /* METAFONT numspecial */
-#define PK_POST 245 /* marks postamble */
-#define PK_NO_OP 246 /* do nothing */
-#define PK_PRE 247 /* marks preamble */
- /* 248..255 undefined */
-#define PK_IsUndef(c) ((c) > PK_PRE)
-
-#define PK_ID 89 /* marks this brand of PK file */
-
-/*
- * Information about a character packet.
- */
-struct cp {
- char *cp_packet; /* the beginning of the packet */
- int cp_type; /* decoded pre type, see below */
-};
-
-#define CP_SHORT 0 /* short preamble */
-#define CP_EXT_SHORT 1 /* extended short preamble */
-#define CP_LONG 2 /* long preamble */
-
-/*
- * The PK details include:
- * -> a pointer to the next byte to fetch;
- * -> the most recent byte fetched (when we are using nextnyb());
- * -> a flag indicating that we have used nybble 0 (bits 4..7) and
- * should use nybble 1 next;
- * -> the base address of the memory allocated for the PK file;
- * -> the value of dyn_f (during character translation);
- * -> the repeat count (during rasterisation);
- * -> the lowest glyph number that is legal;
- * -> the highest glyph number that is legal;
- * -> glyph instructions for the standard glyphs;
- * -> glyph instructions for more (nonstandard) glyphs;
- * and the number of glyphs left unrasterised.
- */
-struct pk_details {
- char *pk_ptr; /* next byte to fetch */
- int pk_c; /* most recent byte fetched, if nybbling */
- int pk_1nyb; /* true => nybble 1 is next (bits 0..3) */
- char *pk_base; /* base of allocated memory */
- int pk_dyn_f; /* the dyn_f value */
- int pk_repeat; /* the repeat count */
- int pk_minc; /* minimum character value */
- int pk_maxc; /* maximum character value */
-#define MAXSTD 256 /* maximum `standard' character value */
- int pk_gleft; /* number of valid glyphs left uninterpreted */
- struct cp pk_cpack[MAXSTD]; /* for characters in [0..MAXSTD) */
- struct cp *pk_morec; /* for characters in [MAXSTD..maxc] */
-};
-
-/*
- * Fetch the next byte from the PK file.
- */
-#define nextbyte(pk) pgetbyte((pk)->pk_ptr)
-
-/*
- * PK packed number encoding. Nybbles in [1..dyn_f] represent themselves.
- * Values in (dyn_f..13] are two-nybble values, and represent values
- * dyn_f+1 through (13-dyn_f+1)*16+15. Zero marks a long number; 14 and
- * 15 specify repeat counts instead (which are another packed number).
- * Note that we cannot represent the number zero as a packed number.
- */
-#define PK_LONGNUM 0 /* a `long number' */
-#define PK_REPEAT 14 /* set repeat count */
-#define PK_REPEAT1 15 /* set repeat to 1 */
-
-/*
- * Get the next nybble. This is an expression rendition of
- * if (--pk->pk_1nyb < 0) {
- * pk->pk_1nyb = 1;
- * pk->pk_c = nextbyte(pk);
- * return (pk->pk_c >> 4);
- * } else
- * return (pk->pk_c & 0xf);
- */
-#define nextnyb(pk) \
- (--(pk)->pk_1nyb < 0 ? \
- ((pk)->pk_1nyb = 1, ((pk)->pk_c = nextbyte(pk)) >> 4) : \
- (pk)->pk_c & 0xf)
-
-/*
- * Get the pk_details from font f.
- */
-#define ftopk(f) ((struct pk_details *)(f)->f_details)
-
-static int scan_characters();
-
-#if !defined( WIN32 ) && !defined( _AMIGA )
-extern int errno;
-char *malloc();
-#endif
-
-/*
- * PK subroutines.
- */
-
-/*
- * Unpack a packed number.
- */
-static int
-pk_unpack(pk)
- register struct pk_details *pk;
-{
- register int i, j;
-
-top:
- if ((i = nextnyb(pk)) == PK_LONGNUM) {
-#if PK_LONGNUM != 0 /* this may be silly, but . . . */
- i = 0;
-#endif
- /*
- * Expand a long number. There are one fewer leading
- * zeros than there are nonzero digits to obtain, so
- * count up the leading zeros, add one, and get that
- * many digits. (The `digits' are hexadecimal values.)
- */
- do {
- i++;
- } while ((j = nextnyb(pk)) == 0);
- while (--i >= 0) {
- j <<= 4;
- j += nextnyb(pk);
- }
- return (j - 15 + (13 - pk->pk_dyn_f) * 16 + pk->pk_dyn_f);
- }
- if (i <= pk->pk_dyn_f)
- return (i);
- if (i < PK_REPEAT)
- return ((i - pk->pk_dyn_f - 1) * 16 + nextnyb(pk) +
- pk->pk_dyn_f + 1);
-
- /*
- * There is a repeat count, either one or a packed number.
- * Get it first, then start over. (tail recursion)
- */
- if (i == PK_REPEAT)
- pk->pk_repeat = pk_unpack(pk);
- else
- pk->pk_repeat = 1;
- goto top;
-}
-
-/*
- * Skip over special commands (PK_XXX?, PK_YYY).
- */
-static void
-skip_specials(f)
- struct font *f;
-{
- struct pk_details *pk = ftopk(f);
- register char *p = pk->pk_ptr;
- register i32 i;
-
- for (;;) {
- switch (UnSign8(*p++)) {
-
- case PK_XXX1:
- i = UnSign8(*p++);
- p += i;
- break;
-
- case PK_XXX2:
- pGetWord(p, i);
- p += i;
- break;
-
- case PK_XXX3:
- pGet3Byte(p, i);
- p += i;
- break;
-
- case PK_XXX4:
- pGetLong(p, i);
- p += i;
- break;
-
- case PK_YYY:
- p += 4;
- break;
-
- case PK_NO_OP:
- break;
-
- case PK_PRE:
- error(1, 0, "unexpected PK_PRE in \"%s\"", f->f_path);
- break;
-
- default:
- p--;
- if (PK_IsUndef(UnSign8(*p)))
- error(1, 0, "invalid opcode %d in \"%s\"",
- f->f_path);
- pk->pk_ptr = p;
- return;
- }
- }
-}
-
-/*
- * Read a PK file.
- */
-static int
-pk_read(f, fd)
- register struct font *f;
- int fd;
-{
- register struct pk_details *pk;
- register char *p;
- int i, minc;
- struct stat st;
- char *reason;
-
- pk = NULL; /* prepare for failure */
- reason = NULL;
- (void) fstat(fd, &st);
- if (st.st_size < 4) { /* ??? */
- reason = "file is too small";
- goto fail;
- }
- if ((pk = (struct pk_details *)malloc(sizeof (*pk))) == NULL)
- goto fail;
- pk->pk_morec = NULL;
- if ((pk->pk_base = malloc(st.st_size)) == NULL)
- goto fail;
- if (read(fd, pk->pk_base, st.st_size) != st.st_size)
- goto fail;
- pk->pk_ptr = pk->pk_base;
- if (nextbyte(pk) != PK_PRE) {
- reason = "file does not begin with PK_PRE";
- goto fail;
- }
- if (nextbyte(pk) != PK_ID) {
- reason = "bad PK_ID";
- goto fail;
- }
- i = nextbyte(pk);
- p = pk->pk_ptr + i; /* skip comment */
- pGetLong(p, f->f_design_size);
- pGetLong(p, f->f_checksum);
- pGetLong(p, f->f_hppp);
- pGetLong(p, f->f_vppp);
- pk->pk_ptr = p;
-
- f->f_details = (char *)pk;
-
- /* scan the characters, fail if necessary */
- if (scan_characters(f, &reason))
- goto fail;
-
- /* ignore the postamble */
-
- /* COMPRESS pk->pk_base DATA? */
-
- if (FontHasGlyphs(f, pk->pk_minc, pk->pk_maxc + 1))
- goto fail;
- (void) close(fd);
- return (0);
-
-fail:
- if (reason) {
- error(0, 0, "%s", reason);
- error(0, 0, "(are you sure %s is a PK file?)", f->f_path);
- errno = 0;
- }
- if (pk != NULL) {
- if (pk->pk_base != NULL)
- free(pk->pk_base);
- if (pk->pk_morec != NULL)
- free((char *)pk->pk_morec);
- free((char *)pk);
- }
- (void) close(fd);
- return (-1);
-}
-
-/*
- * Scan through the characters in the PK file, and set the offsets
- * and preamble types for each of the character packets.
- */
-static int
-scan_characters(f, reason)
- struct font *f;
- char **reason;
-{
- register struct pk_details *pk = ftopk(f);
- register i32 c, pl;
- register char *p;
- register struct cp *cp;
- int type;
-
-#ifdef lint
- /* reason will be used someday ... I think */
- reason = reason;
-#endif
-
- /* set up the minimisers and the glyph count */
- pk->pk_minc = 1;
- pk->pk_maxc = 0;
- pk->pk_gleft = 0;
-
- /* mark all character packets as untouched */
- for (cp = pk->pk_cpack, c = MAXSTD; --c >= 0; cp++)
- cp->cp_packet = NULL;
-
- /*
- * Loop through the packets until we reach a POST, skipping
- * the glyph instructions themselves after each definition,
- * and specials (if any) before each.
- */
- for (;; pk->pk_ptr = p + pl) {
- skip_specials(f);
- p = pk->pk_ptr;
- if ((c = pgetbyte(p)) == PK_POST)
- break; /* whoops, done after all */
-
- /*
- * Look at the low three bits to decide preamble size.
- * A value of 7 is a `long preamble'; 4, 5, and 6 are
- * `extended short preambles'; and 0, 1, 2, and 3 are
- * `short preambles'.
- *
- * We ignore most of the preamble, reading only the
- * `packet length' and the character code at this time.
- */
- switch (c & 7) {
-
- case 7: /* long */
- type = CP_LONG;
- pGetLong(p, pl);
- pGetLong(p, c);
- break;
-
- case 6:
- case 5:
- case 4: /* extended short */
- type = CP_EXT_SHORT;
- pGetWord(p, pl);
- pl += (c & 3) << 16;
- c = pgetbyte(p);
- break;
-
- default: /* short */
- type = CP_SHORT;
- pl = ((c & 3) << 8) + pgetbyte(p);
- c = pgetbyte(p);
- break;
- }
-
- if (c >= MAXSTD) {
- /*
- * BEGIN XXX - should alloc pk_morec, but is hard
- * and not now useful
- */
- error(0, 0, "ignoring character %d in \"%s\"",
- f->f_path);
- error(0, 0, "because some darn programmer was lazy!");
- continue;
- /* END XXX */
- } else
- cp = &pk->pk_cpack[c];
-
- cp->cp_packet = pk->pk_ptr;
- cp->cp_type = type;
-
- /* adjust range */
- if (c < pk->pk_minc)
- pk->pk_minc = c;
- if (c > pk->pk_maxc)
- pk->pk_maxc = c;
-
- pk->pk_gleft++; /* and count the glyph */
- }
- return (0); /* no problems */
-}
-
-/*
- * Obtain the specified range of glyphs.
- */
-static int
-pk_getgly(f, l, h)
- register struct font *f;
- int l, h;
-{
- register struct pk_details *pk = ftopk(f);
- register char *p;
- register struct glyph *g;
- register int i;
- register struct cp *cp;
-
- if (pk == NULL)
- panic("pk_getgly(%s)", f->f_path);
- for (i = l; i < h; i++) {
- if (i < MAXSTD)
- cp = &pk->pk_cpack[i];
- else {
- if (i > pk->pk_maxc)
- panic("pk_getgly(%s, %d)", f->f_path, i);
- cp = &pk->pk_morec[i - MAXSTD];
- }
- p = cp->cp_packet;
- if (p == NULL) /* glyph is not valid */
- continue;
- g = f->f_gly[i];
- p++; /* skip flag */
- switch (cp->cp_type) {
-
- case CP_LONG:
- p += 8; /* skip packet len, character code */
- pGetLong(p, g->g_rawtfmwidth);
- pGetLong(p, g->g_xescapement);
- pGetLong(p, g->g_yescapement);
- pGetLong(p, g->g_width);
- pGetLong(p, g->g_height);
- pGetLong(p, g->g_xorigin);
- pGetLong(p, g->g_yorigin);
- break;
-
- case CP_EXT_SHORT: {
- i32 dm;
-
- p += 3; /* skip packet len, character code */
- pGet3Byte(p, g->g_rawtfmwidth);
- pGetWord(p, dm);
- g->g_xescapement = dm << 16;
- g->g_yescapement = 0;
- pGetWord(p, g->g_width);
- pGetWord(p, g->g_height);
- pGetWord(p, g->g_xorigin);
- g->g_xorigin = Sign16(g->g_xorigin);
- pGetWord(p, g->g_yorigin);
- g->g_yorigin = Sign16(g->g_yorigin);
- break;
- }
-
- case CP_SHORT:
- p += 2; /* skip packet len, character code */
- pGet3Byte(p, g->g_rawtfmwidth);
- g->g_xescapement = pgetbyte(p) << 16;
- g->g_yescapement = 0;
- g->g_width = pgetbyte(p);
- g->g_height = pgetbyte(p);
- g->g_xorigin = pgetbyte(p);
- g->g_xorigin = Sign8(g->g_xorigin);
- g->g_yorigin = pgetbyte(p);
- g->g_yorigin = Sign8(g->g_yorigin);
- break;
- }
- g->g_flags = GF_VALID;
- g->g_un.g_details = p;
- }
- return (0);
-}
-
-/*
- * Bit masks for pk_rasterise().
- */
-static char bmask[8] = {0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe};
-static char rbits[9] = {0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff};
-
-/*
- * Obtain rasters for the specified glyphs.
- */
-static int
-pk_rasterise(f, l, h)
- struct font *f;
- int l, h;
-{
- struct pk_details *pk0;
- struct glyph *g0;
- char *p0, *rp0;
- int flag, ii;
-
- if ((pk0 = ftopk(f)) == NULL)
- panic("pk_rasterise(%s)", f->f_path);
- for (ii = l; ii < h; ii++) {
- {
- register struct glyph *g;
- register char *p;
- register int i;
-
- g = f->f_gly[i = ii];
- if ((g->g_flags & GF_VALID) == 0)
- continue; /* no glyph */
- if (!HASRASTER(g)) /* empty raster */
- goto done;
-
- /*
- * Allocate a raster.
- */
- rp0 = malloc(((g->g_width + 7) >> 3) * g->g_height);
- if ((g->g_raster = rp0) == NULL)
- return (-1);/* ??? */
- g->g_rotation = ROT_NORM;
-
- /*
- * Pick up the flag byte, then start at the real
- * packet, which we saved in g_details.
- */
- if (i < MAXSTD)
- p = pk0->pk_cpack[i].cp_packet;
- else
- p = pk0->pk_morec[i - MAXSTD].cp_packet;
- flag = UnSign8(*p);
- p0 = g->g_un.g_details;
- g0 = g;
- }
- if ((pk0->pk_dyn_f = flag >> 4) == 14) {
- register char *p = p0, *rp = rp0;
- register int j, ls, rs, i, w;
-
- /*
- * Expand a bit-packed representation.
- * If we get lucky, it is byte packed and
- * we can just copy it over.
- */
- i = g0->g_height;
- j = g0->g_width;
- if ((j & 7) == 0) {
- bcopy(p, rp, i * (j >> 3));
- goto done;
- }
-
- /*
- * No such luck.
- */
- w = j;
- ls = 0;
- while (--i >= 0) {
- rs = 8 - ls;
- /* know j always != 8 */
- for (j = w; j > 8; j -= 8) {
- *rp = *p++ << ls;
- *rp++ |= UnSign8(*p) >> rs;
- }
-
- /*
- * We need j more bits; there are rs
- * bits available at *p. Ask for j,
- * which gets min(j, rs).
- */
- *rp++ = (*p << ls) & bmask[j];
- /* account for j bits */
- ls += j; ls &= 7;
- /* then adjust j based on rs */
- j -= rs;
- /* still need j more bits */
- if (j < 0) /* got them all */
- continue;
- p++;
- if (j == 0) /* there were just enough */
- continue;
- /* take j more bits */
- rp[-1] |= UnSign8(*p & bmask[j]) >> rs;
- }
- } else {
- register struct pk_details *pk = pk0;
- register int on = flag & 8 ? 0xff : 0;
- register char *rowp; /* pointer into this row */
- register int j; /* trimmed run count */
- register int k; /* misc */
- register int b; /* bit index in current col */
- register int i; /* run count */
- register int colsleft; /* columns left this row */
- register int rowsleft; /* rows left */
- static char *row; /* a one-row buffer */
- static int rowsize; /* and its size in bytes */
- int wb; /* row width in bytes */
-
- wb = (g0->g_width + 7) >> 3;
- if (rowsize < wb) { /* get more row space */
- if (row)
- free(row);
- /* keep a slop byte */
- row = malloc((unsigned) (wb + 1));
- if (row == NULL)
- return (-1); /* ??? */
- rowsize = wb;
- }
- bzero(row, wb);
- rowsleft = g0->g_height;
- colsleft = g0->g_width;
- pk->pk_repeat = 0;
- pk->pk_ptr = p0;
- pk->pk_1nyb = 0; /* start on nybble 0 */
- rowp = row;
- b = 0;
- while (rowsleft > 0) { /* do all rows */
- /* EXPAND IN LINE? */
- i = pk_unpack(pk);
- /*
- * Work until the run count is exhausted
- * (or at least pretty tired).
- *
- * (Okay, so the joke is stolen!)
- */
- while ((j = i) > 0) {
- /*
- * If the count is more than the
- * rest of this row, trim it down.
- */
- if (j > colsleft)
- j = colsleft;
- i -= j; /* call them done */
- /*
- * We need k=8-b bits to finish
- * up the current byte. If we
- * can finish it, do so; the proper
- * bits to set are in rbits[k].
- */
- if (j >= (k = 8 - b)) {
- j -= k;
- colsleft -= k;
- *rowp++ |= on & rbits[k];
- b = 0;
- }
- /*
- * Set any full bytes.
- */
- while (j >= 8) {
- *rowp++ = on;
- j -= 8;
- colsleft -= 8;
- }
- /*
- * Finally, begin a new byte, or
- * add to the current byte, with
- * j more bits. We know j <= 8-b.
- * (If j==0, we may be writing on
- * our slop byte, which is why we
- * keep one around....)
- */
-if (j > 8-b) panic("pk_rasterise j>8-b");
- *rowp |= (on & bmask[j]) >> b;
- colsleft -= j;
- b += j; b &= 7;
- if (colsleft == 0) {
- pk->pk_repeat++;
- rowsleft -= pk->pk_repeat;
- while (--pk->pk_repeat >= 0) {
- bcopy(row, rp0, wb);
- rp0 += wb;
- }
-if (rowsleft == 0 && i) panic("pk_rasterise leftover bits");
- pk->pk_repeat = 0;
- rowp = row;
- colsleft = g0->g_width;
- bzero(row, wb);
- b = 0;
- }
- }
- on = 0xff - on;
- }
- }
-
-done:
- /*
- * Successfully converted another glyph.
- */
- pk0->pk_gleft--;
- }
-
-if (pk0->pk_gleft < 0)
-panic("%s: gleft==%d", f->f_path, pk0->pk_gleft);
- if (pk0->pk_gleft == 0) {
- free(pk0->pk_base);
- if (pk0->pk_morec != NULL)
- free((char *) pk0->pk_morec);
- free((char *) pk0);
- f->f_details = NULL;
- }
- return (0);
-}
-
-/*
- * Discard the font details.
- */
-static void
-pk_freefont(f)
- struct font *f;
-{
- register struct pk_details *pk = ftopk(f);
-
- if (pk != NULL) {
- free(pk->pk_base);
- if (pk->pk_morec != NULL)
- free((char *) pk->pk_morec);
- free((char *) pk);
- }
-}
diff --git a/Build/source/texk/seetexk/postamble.h b/Build/source/texk/seetexk/postamble.h
deleted file mode 100644
index 6931b46d409..00000000000
--- a/Build/source/texk/seetexk/postamble.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1987, 1989 University of Maryland
- * Department of Computer Science. All rights reserved.
- * Permission to copy for any purpose is hereby granted
- * so long as this copyright notice remains intact.
- */
-
-/* Definitions for ScanPostAmble */
-
-/*
- * ScanPostAmble reads the postamble of a DVI file from the (stdio)
- * file specified in its first argument. It is handed two pointers to
- * functions. The first (ScanPostAmble's second argument) is called
- * after the header information has been read, and given a pointer to a
- * PostAmbleInfo structure. It is the job of this function to extract the
- * required information from this structure (which is deallocated when
- * ScanPostAmble returns).
- *
- * The second function is called once for each font definition occurring in
- * the postamble, and is given a pointer to a PostAmbleFont structure. This
- * function should do whatever the device needs to read the actual font.
- *
- * If the DVI file appears malformed, ScanPostAmble will print an error
- * message and exit. (Drastic, perhaps, but effective.)
- */
-
-struct PostAmbleInfo {
- i32 pai_PrevPagePointer; /* previous page pointer */
- i32 pai_Numerator; /* numerator from dvi file */
- i32 pai_Denominator; /* denominator from dvi file*/
- i32 pai_DVIMag; /* \magnification */
- i32 pai_TallestPageHeight; /* height of tallest page */
- i32 pai_WidestPageWidth; /* width of widest page */
- int pai_DVIStackSize; /* DVI stack size required */
- int pai_NumberOfPages; /* total number of pages in DVI file */
-};
-
-struct PostAmbleFont {
- char *paf_name; /* name of font (null terminated) */
- int paf_n1; /* length of first part of name */
- int paf_n2; /* length of second part of name */
- i32 paf_DVIFontIndex; /* font index number */
- i32 paf_DVIChecksum; /* checksum from DVI file */
- i32 paf_DVIMag; /* "at size" */
- i32 paf_DVIDesignSize; /* design size of font */
-};
-
-int ScanPostAmble();
diff --git a/Build/source/texk/seetexk/pxlfont.c b/Build/source/texk/seetexk/pxlfont.c
deleted file mode 100644
index 3d3e40cbf8a..00000000000
--- a/Build/source/texk/seetexk/pxlfont.c
+++ /dev/null
@@ -1,306 +0,0 @@
-/*
- * Copyright (c) 1987, 1989 University of Maryland
- * Department of Computer Science. All rights reserved.
- * Permission to copy for any purpose is hereby granted
- * so long as this copyright notice remains intact.
- */
-
-#ifndef lint
-static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/pxlfont.c,v 2.5 89/08/22 21:55:34 chris Exp $";
-#endif
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include "types.h"
-#include "error.h"
-#include "font.h"
-#include "fio.h"
-
-/*
- * PXL font operations.
- */
-static int pxl_read(), pxl_getgly(), pxl_rasterise();
-static void pxl_freefont();
-
-struct fontops pxlops =
- { "pxl", 0, 5.0, pxl_read, pxl_getgly, pxl_rasterise, pxl_freefont };
-
-/*
- * Local info.
- */
-#define PXLID 1001 /* ID denoting PXL files */
-#define TAILSIZE (517 * 4) /* size of pxl tail info */
-
-/*
- * pc describes one PXL character information block.
- */
-struct pc {
- i16 pc_width; /* character width (pixels) */
- i16 pc_height; /* character height (pixels) */
- i16 pc_xoffset; /* X offset of reference point */
- i16 pc_yoffset; /* Y offset of reference point */
- i32 pc_rastoff; /* raster offset */
- i32 pc_TFMwidth; /* TFM width (FIXes) */
-};
-
-/*
- * pxl_details are the PXL-specific font details.
- *
- * We keep track of the number of characters converted to internal
- * glyph form, and when all have been done, we discard the now-
- * useless details.
- */
-struct pxl_details {
- int pd_nconv; /* number of characters converted */
- char *pd_ras; /* raster space, until converted */
- struct pc pd_pc[128]; /* `font directory' */
-};
-
-/*
- * Get the pxl_details from font f.
- */
-#define ftopd(f) ((struct pxl_details *) (f)->f_details)
-
-extern errno;
-#ifndef KPATHSEA
-char *malloc();
-#endif
-
-/*
- * Read a PXL file.
- */
-static int
-pxl_read(f, fd)
- struct font *f;
- int fd;
-{
- register struct pxl_details *pd;
- register FILE *fp;
- register struct pc *pc;
- register int i;
- int saverr;
- i32 pxlid;
- struct stat st;
-
- fp = NULL;
- if ((pd = (struct pxl_details *)malloc(sizeof (*pd))) == 0)
- goto fail;
- pd->pd_ras = 0;
-
- /*
- * There should be 4n bytes, with an absolute minimum of TAILSIZE+4
- * (+4 for the initial PXLID).
- */
- (void) fstat(fd, &st);
- if ((st.st_size & 3) != 0 || st.st_size < (TAILSIZE + 4)) {
- errno = EINVAL;
- goto fail;
- }
-
- /*
- * Set up the raster pointer (if we need rasters).
- */
- if (f->f_flags & FF_RASTERS) {
- i = st.st_size - (TAILSIZE + 4);
- if (i != 0) {
- if ((pd->pd_ras = malloc((unsigned) i)) == 0)
- goto fail;
- (void) lseek(fd, 4L, 0);
- if (read(fd, pd->pd_ras, i) != i)
- goto fail;
- }
- }
-
- /*
- * Read the glyph information.
- */
- errno = 0; /* try to make errno meaningful */
- if ((fp = fdopen(fd, "r")) == NULL) {
- if (errno == 0)
- errno = EMFILE;
- goto fail;
- }
- (void) fseek(fp, (long) -TAILSIZE, 2);
- for (i = 128, pc = pd->pd_pc; --i >= 0; pc++) {
- fGetWord(fp, pc->pc_width);
- fGetWord(fp, pc->pc_height);
- fGetWord(fp, pc->pc_xoffset);
- fGetWord(fp, pc->pc_yoffset);
- fGetLong(fp, pc->pc_rastoff);
- fGetLong(fp, pc->pc_TFMwidth);
- }
- f->f_checksum = GetLong(fp);
- (void) GetLong(fp); /* mag */
- f->f_design_size = GetLong(fp); /* designsize */
- f->f_hppp = 0; /* ??? maybe 200? */
- f->f_vppp = 0;
- (void) GetLong(fp); /* dirpointer */
- pxlid = GetLong(fp);
- if (pxlid != PXLID)
- error(0, 0, "Warning: strange PXL id (%d) in \"%s\"",
- pxlid, f->f_path);
-
- f->f_details = (char *)pd;
- if (FontHasGlyphs(f, 0, 128))
- goto fail;
- (void) fclose(fp);
- pd->pd_nconv = 0;
- return (0);
-
-fail:
- saverr = errno;
- if (pd) {
- if (pd->pd_ras)
- free(pd->pd_ras);
- free((char *)pd);
- }
- if (fp)
- (void) fclose(fp);
- else
- (void) close(fd);
- errno = saverr;
- return (-1);
-}
-
-/*
- * Obtain the specified range of glyphs.
- */
-static int
-pxl_getgly(f, l, h)
- register struct font *f;
- int l;
- register int h;
-{
- register struct glyph *g;
- register struct pc *pc;
- register int i;
- struct pxl_details *pd;
-
- if ((pd = ftopd(f)) == NULL)
- error(1, 0, "pxl_getgly details==0: cannot happen");
- /*
- * By definition, all 128 glyphs are valid. Just copy the
- * PXL information.
- */
- for (pc = &pd->pd_pc[i = l]; i < h; i++, pc++) {
- g = f->f_gly[i];
- g->g_flags = GF_VALID;
- g->g_height = pc->pc_height;
- g->g_width = pc->pc_width;
- g->g_yorigin = pc->pc_yoffset;
- g->g_xorigin = pc->pc_xoffset;
- g->g_rawtfmwidth = pc->pc_TFMwidth;
- }
- return (0);
-}
-
-/*
- * Helper function for rasterise: return a pointer to a converted
- * (malloc()ed and minimised) raster.
- */
-static char *
-makeraster(h, w, rp)
- register int h, w;
- register char *rp;
-{
- register char *cp;
- register int i, o;
- char *rv;
-
- /*
- * The height and width values are in bits. Convert width to
- * bytes, rounding up. The raw raster (at rp) is almost what
- * we want, but not quite: it has `extra' bytes at the end of
- * each row, to pad out to a multiple of four bytes.
- */
- w = (w + 7) >> 3;
- o = (4 - w) & 3; /* offset (number of `extra' bytes) */
- if ((cp = malloc((unsigned) (h * w))) == NULL)
- return (NULL);
- if (o == 0) {
- /*
- * The raster fits exactly; just copy it to the allocated
- * memory space. (We must copy anyway, so that glyphs
- * can be freed, e.g., after rotation.)
- */
- bcopy(rp, cp, h * w);
- return (cp);
- }
- rv = cp;
- while (--h >= 0) {
- /*
- * Copy each row, then skip over the extra stuff.
- */
- for (i = w; --i >= 0;)
- *cp++ = *rp++;
- rp += o;
- }
- return (rv);
-}
-
-/*
- * Obtain rasters for the specified glyphs.
- */
-static int
-pxl_rasterise(f, l, h)
- register struct font *f;
- int l;
- register int h;
-{
- register struct glyph *g;
- register struct pc *pc;
- register int i;
- register struct pxl_details *pd;
-
- if ((pd = ftopd(f)) == NULL)
- error(1, 0, "pxl_rasterise details==0: cannot happen");
- if (pd->pd_ras == NULL)
- error(1, 0, "pxl_rasterise pd_ras==NULL: cannot happen");
- for (pc = &pd->pd_pc[i = l]; i < h; i++, pc++) {
- g = f->f_gly[i];
- if (pc->pc_rastoff == 0) {
- /*
- * g should not claim a raster, since it has none.
- */
- if (HASRASTER(g))
- error(1, 0, "bad PXL glyph %d in \"%s\"",
- g->g_index, f->f_path);
- } else {
- g->g_raster = makeraster(pc->pc_height, pc->pc_width,
- pd->pd_ras + ((pc->pc_rastoff - 1) << 2));
- if (g->g_raster == NULL)
- return (-1); /* ??? */
- g->g_rotation = ROT_NORM;
- }
- }
-
- /*
- * If we have converted all the characters, dump the
- * pre-conversion rasters. In fact, dump everything.
- */
- pd->pd_nconv += h - l;
- if (pd->pd_nconv == 128) {
- free(pd->pd_ras);
- free((char *)pd);
- f->f_details = NULL;
- }
- return (0);
-}
-
-/*
- * Discard the font details.
- */
-static void
-pxl_freefont(f)
- struct font *f;
-{
- struct pxl_details *pd;
-
- if ((pd = ftopd(f)) != NULL) {
- if (pd->pd_ras != NULL)
- free(pd->pd_ras);
- free((char *)pd);
- }
-}
diff --git a/Build/source/texk/seetexk/rotate.c b/Build/source/texk/seetexk/rotate.c
deleted file mode 100644
index 757a479f291..00000000000
--- a/Build/source/texk/seetexk/rotate.c
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Copyright (c) 1987, 1989 University of Maryland
- * Department of Computer Science. All rights reserved.
- * Permission to copy for any purpose is hereby granted
- * so long as this copyright notice remains intact.
- */
-
-#ifndef lint
-static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/rotate.c,v 2.4 89/08/22 21:56:05 chris Exp $";
-#endif
-
-/*
- * Routines to generate rotated bitmaps given unrotated inputs.
- *
- * The rotated bitmap is indistinguishable from the unrotated one (aside
- * from being rotated of course!).
- */
-
-#include "types.h"
-#include "error.h"
-#include "font.h"
-
-static void RotateClockwise();
-
-#if !defined( WIN32 ) && !defined( _AMIGA )
-extern int errno;
-char *malloc();
-#endif
-
-/*
- * Rounding, but by powers of two only.
- */
-#define ROUND(n,r) (((n) + ((r) - 1)) & ~((r) - 1))
-
-/*
- * Set the rotation of glyph g to r.
- */
-void SetRotation(g, r)
- register struct glyph *g;
- int r;
-{
-
- if (r < ROT_NORM || r > ROT_RIGHT)
- error(1, 0, "bad rotation value %d", r);
-
- /*
- * The null glyph is trivial to rotate by any amount.
- *
- * Note that this assumes that any raster has been obtained
- * BEFORE calling SetRotation()!
- */
- if (g->g_raster == NULL) {
- g->g_rotation = r;
- return;
- }
-
- /*
- * This is hardly efficient, but it *is* expedient....
- */
- while (g->g_rotation != r) {
- RotateClockwise(g);
- g->g_rotation = (g->g_rotation - 1) & 3;
- }
-}
-
-/*
- * Rotation by 1/4 turn clockwise (from ROT_NORM to ROT_RIGHT, e.g.).
- */
-static void
-RotateClockwise(glyph)
- struct glyph *glyph;
-{
- register char *nrast; /* new raster */
- register char *orast; /* old raster */
- register int oheight; /* old raster height, new raster width */
- register int owidth; /* old raster width, new raster height */
- unsigned int size; /* size of new raster (in bytes) */
- int nplus; /* offset between rows in nrast */
-
- /*
- * First, get a new raster.
- */
- {
- register struct glyph *g = glyph;
- register int t;
-
- oheight = g->g_height;
- owidth = g->g_width;
-
- /*
- * Offset is (new width) rounded to bytes.
- */
- nplus = ROUND(oheight, 8) >> 3;
-
- /*
- * Size of new raster is (new height) * (new rounded width,
- * in bytes).
- */
- size = nplus * owidth;
- if ((nrast = malloc(size)) == NULL)
- error(1, errno, "out of memory");
- bzero(nrast, size);
-
- /*
- * New y origin is old x origin; new x origin is old height
- * minus old y origin - 1.
- */
- t = g->g_yorigin;
- g->g_yorigin = g->g_xorigin;
- g->g_xorigin = oheight - t - 1;
-
- /* While we are at it, exchange height & width... */
- g->g_height = owidth;
- g->g_width = oheight;
-
- /* and grab a pointer to the old raster. */
- orast = g->g_raster;
- }
-
- /*
- * Now copy bits from the old raster to the new one. The mapping
- * function is
- *
- * for i in [0..height)
- * for j in [0..width)
- * new[j, height-i-1] = old[i, j]
- *
- * Thus i maps to height-i-1 and (since we have to do our own 2
- * dimensional array indexing) j to nplus*j. We call the mapped
- * variables mapi and mapj, and, since we scan sequentially through
- * the old raster, can discard the original i and j.
- */
- {
- register int mapj, c, k, mapi;
-
- mapi = oheight;
- owidth *= nplus;
- while (--mapi >= 0) {
- k = 7;
- for (mapj = 0; mapj < owidth; mapj += nplus) {
- if (++k == 8) /* get another byte */
- c = *orast++, k = 0;
- if (c & 0x80) /* old[i,j] was set */
- nrast[mapj + (mapi >> 3)] |=
- 1 << (7 - (mapi & 7));
- c <<= 1;
- }
- }
- }
-
- /*
- * Finally, free the storage associated with the original raster.
- */
- free(glyph->g_raster);
- glyph->g_raster = nrast;
-}
diff --git a/Build/source/texk/seetexk/rstfont.c b/Build/source/texk/seetexk/rstfont.c
deleted file mode 100644
index 589e9417507..00000000000
--- a/Build/source/texk/seetexk/rstfont.c
+++ /dev/null
@@ -1,301 +0,0 @@
-/*
- * Copyright (c) 1987, 1989 University of Maryland
- * Department of Computer Science. All rights reserved.
- * Permission to copy for any purpose is hereby granted
- * so long as this copyright notice remains intact.
- *
- * The code in this file was partially derived from another version by
- * Tim Morgan at UCI.
- *
- * TODO:
- * test
- */
-
-#ifndef lint
-static char rcsid[] = "$Header$";
-#endif
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include "types.h"
-#include "error.h"
-#include "font.h"
-#include "fio.h"
-
-/*
- * RST (Imagen's font format) font operations.
- */
-static int rst_read(), rst_getgly(), rst_rasterise();
-static void rst_freefont();
-
-#ifdef UCI
-#define D 1.0 /* I think */
-#else
-#define D 150.0
-#endif
-
-struct fontops rstops =
- { "rst", 0, D, rst_read, rst_getgly, rst_rasterise, rst_freefont };
-
-#undef D
-
-/*
- * Local info.
- */
-#define FILEMARK_SIZE 8 /* header `file mark' bytes to skip */
-
-/*
- * rc describes one RST character information block.
- */
-struct rc {
- i16 rc_height; /* character height (pixels) */
- i16 rc_width; /* character width (pixels) */
- i16 rc_yoffset; /* Y offset of reference point */
- i16 rc_xoffset; /* X offset of reference point */
- i32 rc_rastoff; /* raster offset */
- i32 rc_TFMwidth; /* TFM width */
-};
-
-/*
- * rst_details are the RST-specific font details.
- *
- * We keep track of the number of characters converted to internal
- * glyph form, and when all have been done, we discard the now-
- * useless details.
- */
-struct rst_details {
- int rd_unconv; /* number of characters unconverted */
- struct rc *rd_rc; /* `font directory' */
- char *rd_ras; /* raster space, until converted */
- long rd_rastbase; /* adjust rc_rastoff by rastbase */
-};
-
-/*
- * Get the rst_details from font f.
- */
-#define ftord(f) ((struct rst_details *)(f)->f_details)
-
-#if !defined( WIN32 ) && !defined( _AMIGA )
-extern errno;
-char *malloc();
-long ftell();
-#endif
-
-/*
- * Read an RST file.
- */
-static int
-rst_read(f, fd)
- struct font *f;
- int fd;
-{
- register struct rst_details *rd;
- register FILE *fp;
- register struct rc *rc;
- register int i;
- int saverr;
- long presize, diroff;
- i32 firstgly, lastgly;
-
- fp = NULL;
- if ((rd = (struct rst_details *)malloc(sizeof *rd)) == 0)
- goto fail;
- rd->rd_ras = 0;
- rd->rd_rc = 0;
-
- /*
- * Read the header.
- */
- errno = 0; /* try to make errno meaningful */
- if ((fp = fdopen(fd, "r")) == NULL) {
- if (errno == 0)
- errno = EMFILE;
- goto fail;
- }
- (void) fseek(fp, (long)FILEMARK_SIZE, 0);
- fGetWord(fp, presize); /* bytes in preamble (from FILEMARK_SIZE+2) */
- presize += 2 + FILEMARK_SIZE;
- i = getc(fp); /* version */
- if (i != 0) {
- error(0, 0, "Warning: strange RST version (%d) in \"%s\"", i,
- f->f_path);
- errno = EINVAL;
- goto fail;
- }
- fGet3Byte(fp, diroff); /* offset to glyph directory */
- fGetWord(fp, firstgly); /* first glyph */
- fGetWord(fp, lastgly); /* last glyph (inclusive) */
- lastgly++; /* make it exclusive */
-
- (void) GetLong(fp); /* mag */
- fGetLong(fp, f->f_design_size);
- /* interline, interword, rotation, charadv, lineadv */
- (void) fseek(fp, (long)(4 + 4 + 2 + 1 + 1), 1);
- fGetLong(fp, f->f_checksum);
- f->f_hppp = 0; /* ??? */
- f->f_vppp = 0;
-
- /*
- * Read the glyph directory.
- */
- i = lastgly - firstgly;
- rd->rd_rc = (struct rc *)malloc((unsigned) (i * sizeof(*rc)));
- if (rd->rd_rc == 0)
- goto fail;
- (void) fseek(fp, presize, 0);
- for (rc = rd->rd_rc; --i >= 0; rc++) {
- fGetWord(fp, rc->rc_height);
- fGetWord(fp, rc->rc_width);
- fGetWord(fp, rc->rc_yoffset);
- fGetWord(fp, rc->rc_xoffset);
- fGetLong(fp, rc->rc_TFMwidth);
- fGet3Byte(fp, rc->rc_rastoff);
- }
-
- /*
- * Set up the raster pointer (if we need rasters).
- */
- if (f->f_flags & FF_RASTERS) {
- struct stat st;
-
- rd->rd_rastbase = ftell(fp);
- /* back to unbuffered I/O */
- (void) fstat(fd, &st);
- i = st.st_size - presize - 15 * (lastgly - firstgly);
- if (i < 0)
- error(1, 0, "calculated raster size < 0 for \"%s\"",
- f->f_path);
- if (i != 0) {
- if ((rd->rd_ras = malloc((unsigned) i)) == 0)
- goto fail;
- (void) lseek(fd, rd->rd_rastbase, 0);
- if (read(fd, rd->rd_ras, i) != i)
- goto fail;
- }
- }
-
- f->f_details = (char *) rd;
- if (FontHasGlyphs(f, firstgly, lastgly))
- goto fail;
-
- (void) fclose(fp);
- rd->rd_unconv = lastgly - firstgly;
- return (0);
-
-fail:
- saverr = errno;
- if (rd) {
- if (rd->rd_rc)
- free((char *)rd->rd_rc);
- if (rd->rd_ras)
- free(rd->rd_ras);
- free((char *) rd);
- }
- if (fp)
- (void) fclose(fp);
- else
- (void) close(fd);
- errno = saverr;
- return (-1);
-}
-
-/*
- * Obtain the specified range of glyphs.
- */
-static int
-rst_getgly(f, l, h)
- register struct font *f;
- int l;
- register int h;
-{
- register struct glyph *g;
- register struct rc *rc;
- register int i;
- struct rst_details *rd;
-
- if ((rd = ftord(f)) == NULL)
- panic("rst_getgly");
-
- /*
- * By definition, all glyphs are valid. Just copy the
- * RST information.
- */
- for (rc = &rd->rd_rc[(i = l) - f->f_lowch]; i < h; i++, rc++) {
- g = f->f_gly[i];
- g->g_flags = GF_VALID;
- g->g_height = rc->rc_height;
- g->g_width = rc->rc_width;
- g->g_yorigin = rc->rc_yoffset;
- g->g_xorigin = rc->rc_xoffset;
- g->g_rawtfmwidth = rc->rc_TFMwidth;
- }
- return (0);
-}
-
-/*
- * Obtain rasters for the specified glyphs.
- */
-static int
-rst_rasterise(f, l, h)
- register struct font *f;
- int l;
- register int h;
-{
- register struct glyph *g;
- register struct rc *rc;
- register struct rst_details *rd;
- register int i;
- unsigned sz;
-
- if ((rd = ftord(f)) == NULL)
- panic("rst_rasterise details==0");
- if (rd->rd_ras == NULL)
- panic("rst_rasterise rd_ras==NULL");
- for (rc = &rd->rd_rc[(i = l) - f->f_lowch]; i < h; i++, rc++) {
- g = f->f_gly[i];
- if (!HASRASTER(g))
- continue;
- if (rc->rc_rastoff == 0) {
- error(1, 0, "bad RST glyph %d in \"%s\"",
- g->g_index, f->f_path);
- } else {
- sz = ((g->g_width + 7) >> 3) * g->g_height;
- if ((g->g_raster = malloc(sz)) == NULL)
- return (-1); /* ??? */
- g->g_rotation = ROT_NORM;
- bcopy(rd->rd_ras + rc->rc_rastoff - rd->rd_rastbase,
- g->g_raster, sz);
- }
- }
-
- /*
- * If we have converted all the characters, dump the
- * pre-conversion rasters. In fact, dump everything.
- */
- rd->rd_unconv -= h - l;
- if (rd->rd_unconv == 0) {
- free((char *)rd->rd_rc);
- free(rd->rd_ras);
- free((char *)rd);
- f->f_details = NULL;
- }
- return (0);
-}
-
-/*
- * Discard the font details.
- */
-static void
-rst_freefont(f)
- struct font *f;
-{
- struct rst_details *rd;
-
- if ((rd = ftord(f)) != NULL) {
- free((char *)rd->rd_rc);
- free(rd->rd_ras);
- free((char *)rd);
- }
-}
diff --git a/Build/source/texk/seetexk/scaletfm.c b/Build/source/texk/seetexk/scaletfm.c
deleted file mode 100644
index f6444d5d369..00000000000
--- a/Build/source/texk/seetexk/scaletfm.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (c) 1987, 1989 University of Maryland
- * Department of Computer Science. All rights reserved.
- * Permission to copy for any purpose is hereby granted
- * so long as this copyright notice remains intact.
- */
-
-#ifndef lint
-static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/scaletfm.c,v 3.2 89/11/23 16:34:43 chris Exp $";
-#endif
-
-#include "types.h"
-#include "error.h"
-#include "font.h"
-
-/*
- * From DVITYPE.WEB:
- *
- * ``The most important part of in_TFM is the width computation, which
- * involvles multiplying the relative widths in the TFM file by the scaling
- * factor in the DVI file. This fixed-point multiplication must be done with
- * precisely the same accuracy by all DVI-reading programs, in order to
- * validate the assumptions made by DVI-writing programs like \TeX 82.
- *
- * Let us therefore summarize what needs to be done. Each width in a TFM
- * file appears as a four-byte quantity called a fix_word. A fix_word whose
- * respective bytes are (a,b,c,d) represents the number
- *
- * {{ b * 2^{-4} + c * 2^{-12} + d * 2^{-20}, if a = 0;
- * x = {{
- * {{ -16 + b * 2^{-4} + c * 2^{-12} + d * 2^{-20}, if a = 255.
- *
- * (No other choices of a are allowed, since the magnitude of a TFM dimension
- * must be less than 16.) We want to multiply this quantity by the integer
- * z, which is known to be less than 2^{27}. Let \alpha = 16z. If z <
- * 2^{23}, the individual multiplications b * z, c * z, d * z cannot
- * overflow; otherwise we will divide z by 2, 4, 8, or 16, to obtain a
- * multiplier less than 2^{23}, and we can compensate for this later. If z
- * has thereby been replaced by z' = z/2^e, let \beta = 2^{4-e}; we shall
- * compute
- *
- * \lfloor (b + c * 2^{-8} + d * 2^{-16})z' / \beta \rfloor
- *
- * if a = 0, or the same quantity minus \alpha if a = 255. This calculation
- * must be done exactly, for the reasons stated above; the following program
- * does the job in a system-independent way, assuming that arithmetic is
- * exact on numbers less than 2^{31} in magnitude.''
- */
-#define ZLIM ((i32)1 << 23) /* z must be < zlim */
-
-/*
- * Scale the single TFM width t by z.
- */
-i32
-ScaleOneWidth(t, z)
- register i32 t, z;
-{
- register i32 alpha, log2beta;
- register int a0;
-
- /* First compute \alpha, \beta, and z': */
- alpha = 16 * z;
- log2beta = 4;
- while (z >= ZLIM) {
- z >>= 1;
- log2beta--;
- }
-
- /* The four values 'a', 'b', 'c', and 'd' are fields within t: */
-#define a (UnSign8(t >> 24))
-#define b (UnSign8(t >> 16))
-#define c (UnSign8(t >> 8))
-#define d (UnSign8(t))
- if (t) {
- a0 = a;
- t = (((((d * z) >> 8) + c * z) >> 8) + b * z) >> log2beta;
- if (a0) {
- if (a0 != 255)
- error(0, 0, "bad TFM width! [ScaleOneWidth]");
- t -= alpha;
- }
- }
- return (t);
-}
-
-/*
- * Scale a set of glyphs [l..h) in font f according to f->f_dvimag
- * (that is, set g_tfmwidth from g_rawtfmwidth).
- */
-ScaleGlyphs(f, l, h)
- register struct font *f;
- int l, h;
-{
- register int i, a0;
- register i32 t, z, alpha, log2beta;
-
- z = f->f_dvimag;
- alpha = 16 * z;
- log2beta = 4;
- while (z >= ZLIM) {
- z >>= 1;
- log2beta--;
- }
-
- for (i = l; i < h; i++) {
- if ((t = f->f_gly[i]->g_rawtfmwidth) != 0) {
- a0 = a;
- t = (((((d * z) >> 8) + c * z) >> 8) + b * z) >>
- log2beta;
- if (a0) {
- if (a0 != 255)
- error(0, 0,
- "\"%s\", glyph %d: bad TFM width",
- f->f_path, i);
- t -= alpha;
- }
- }
- f->f_gly[i]->g_tfmwidth = t;
- }
-}
diff --git a/Build/source/texk/seetexk/scanpost.c b/Build/source/texk/seetexk/scanpost.c
deleted file mode 100644
index f71b33c9b5c..00000000000
--- a/Build/source/texk/seetexk/scanpost.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (c) 1987, 1989 University of Maryland
- * Department of Computer Science. All rights reserved.
- * Permission to copy for any purpose is hereby granted
- * so long as this copyright notice remains intact.
- */
-
-#ifndef lint
-static char rcsid[] = "$Header: /usr/local/src/SeeTeX/libtex/RCS/scanpost.c,v 1.2 90/07/10 14:33:23 grunwald Exp Locker: grunwald $";
-#endif
-
-/*
- * ScanPostAmble - read a DVI postamble.
- */
-
-#include <stdio.h>
-#include "types.h"
-#include "dvicodes.h"
-#include "fio.h"
-#include "gripes.h"
-#include "postamble.h"
-
-ScanPostAmble(f, headerfunc, fontfunc)
- register FILE *f;
- void (*headerfunc)();
- register void (*fontfunc)();
-{
- register int n;
- register char *s;
- char name[512];
-
- if (FindPostAmble(f)) {
- GripeCannotFindPostamble();
- return(1);
- }
- if (GetByte(f) != Sign8(DVI_POST)) {
- GripeMissingOp("POST");
- return(1);
- }
-
- /* Read the postamble info stuff. */
- {
- struct PostAmbleInfo pai;
- register struct PostAmbleInfo *p = &pai;
-
- p->pai_PrevPagePointer = GetLong(f);
- p->pai_Numerator = GetLong(f);
- p->pai_Denominator = GetLong(f);
- p->pai_DVIMag = GetLong(f);
- p->pai_TallestPageHeight = GetLong(f);
- p->pai_WidestPageWidth = GetLong(f);
- p->pai_DVIStackSize = GetWord(f);
- p->pai_NumberOfPages = GetWord(f);
-
- (*headerfunc)(p);
- }
-
- /* Now read all the font definitions. */
- {
- struct PostAmbleFont paf;
- register struct PostAmbleFont *p = &paf;
- int c;
-
- for (;;) {
- if ((c = getc(f)) == EOF)
- GripeUnexpectedDVIEOF();
- switch (c) {
-
- case DVI_NOP:
- break;
-
- case DVI_FNTDEF1:
- p->paf_DVIFontIndex = UnSign8(getc(f));
- break;
-
- case DVI_FNTDEF2:
- p->paf_DVIFontIndex = UnSign16(GetWord(f));
- break;
-
- case DVI_FNTDEF3:
- p->paf_DVIFontIndex = UnSign24(Get3Byte(f));
- break;
-
- case DVI_FNTDEF4:
- p->paf_DVIFontIndex = GetLong(f);
- break;
-
- case DVI_POSTPOST:
- return(0);
-
- default:
- GripeMissingOp("POSTPOST");
- return(1);
- /*NOTREACHED*/
- }
- p->paf_DVIChecksum = GetLong(f);
- p->paf_DVIMag = GetLong(f);
- p->paf_DVIDesignSize = GetLong(f);
- p->paf_n1 = UnSign8(getc(f));
- p->paf_n2 = UnSign8(getc(f));
- p->paf_name = name; /* never trust people not to
- clobber it */
- n = p->paf_n1 + p->paf_n2;
- s = name;
- while (--n >= 0)
- *s++ = GetByte(f);
- *s = 0;
- (*fontfunc)(p);
- }
- }
-}
diff --git a/Build/source/texk/seetexk/sdecode.c b/Build/source/texk/seetexk/sdecode.c
deleted file mode 100644
index 02fe746da08..00000000000
--- a/Build/source/texk/seetexk/sdecode.c
+++ /dev/null
@@ -1,689 +0,0 @@
-/*
- * Copyright (c) 1989 University of Maryland
- * Department of Computer Science. All rights reserved.
- * Permission to copy for any purpose is hereby granted
- * so long as this copyright notice remains intact.
- */
-
-#ifndef lint
-static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/sdecode.c,v 3.4 89/11/06 15:01:07 chris Exp $";
-#endif
-
-#include <stdio.h>
-#ifdef __STDC__
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-#include "types.h"
-#include "error.h"
-#include "sdecode.h"
-
-static char cclass[256]; /* XXX assumes 8-bit char */
-#define CCL_SPACE 0x01 /* white space */
-#define CCL_SEMI 0x02 /* `semicolon' (statement separator) */
-#define isstopc(c) (cclass[c] != 0) /* both space and semi char */
-static int sdset; /* flag says whether cclass[] set up */
-
-static void args(), badarg();
-static int scan(struct decode_info *di, char **fmt, ...), scan_i(), scan_d();
-
-extern char *strsave();
-
-extern char *DVIFileName;
-
-#ifndef BLOCK_COPY
-/*
- * Copy the text at `src' `downward' in memory for `len' bytes.
- * This is like strcpy or memcpy, but handles one direction of
- * overlap (when dst < src).
- */
-static void
-movedown(src, dst, len)
- register char *src, *dst;
- register int len;
-{
-
- while (--len >= 0)
- *dst++ = *src++;
-}
-#endif
-
-/*
- * We have a number of states to do word interpretation. Outside words,
- * we skip blanks and `semicolons'. The first non-blank, non-`semi' enters
- * WORD state; in WORD state, double quote characters switch to
- * QUOTE state, after which another double quote switches back to
- * WORD state, and blanks and `semi' end WORD state, switching to DONE.
- * While in WORD or QUOTE states, `c produces c for all characters c;
- * to do this, we use two more states.
- */
-#define S_DULL 0 /* not in a word */
-#define S_WORD 1 /* in a word */
-#define S_QUOTE 2 /* inside "" in a word */
-#define S_BKQT1 3 /* not in "", but just read one ` */
-#define S_BKQT2 4 /* in "", but just read one ` */
-#define S_DONE 5 /* found end of word */
-
-/*
- * Structure used to communicate between the various functions.
- */
-struct decode_info {
- /* data used to read from input file */
- int di_nch; /* number of characters remaining in buffer */
- char *di_cp; /* next character to be read from buffer */
- long di_nfilech; /* number of characters remaining in file */
- FILE *di_file; /* the file itself */
-
- /* information used and/or returned by the canon routine */
- int di_lexstate; /* lexical state */
- int di_call; /* set when we reach terminating `semicolon' */
-
- /* information used more globally */
- char *di_word; /* last word from word() */
- char *di_kw; /* the keyword */
- int di_bkw; /* true iff keyword is in static buffer */
-};
-
-/*
- * `Edit' the text in the buffer in-place.
- * Return the count of characters resulting from the edit (e.g.,
- * from `foo`"bar' the count would be 7).
- * Set di_call if we reach state S_DONE by encountering a `semicolon'.
- * The edited text begins wherever di_cp points.
- * We begin the edit in the state given by di_lexstate.
- */
-static int
-canon(di)
- register struct decode_info *di;
-{
- register int state, c, n;
- register char *cp, *outp, *s;
-
- state = di->di_lexstate;
- n = di->di_nch;
- cp = outp = di->di_cp;
- while (--n >= 0) {
- c = *cp++;
- switch (state) {
-
- case S_DULL:
- if (isstopc(c))
- continue;
- state = S_WORD;
- /* FALLTHROUGH */
-
- case S_WORD:
- if (c == '"') {
- state = S_QUOTE;
- continue;
- }
- if (c == '`') {
- state = S_BKQT1;
- continue;
- }
- /* look for `semicolon' (call) characters */
- if (cclass[c] & CCL_SEMI)
- di->di_call = 1;
- if (isstopc(c)) {
- state = S_DONE;
- goto done;
- }
- break;
-
- case S_QUOTE:
- if (c == '`') {
- state = S_BKQT2;
- continue;
- }
- if (c == '"') {
- state = S_WORD;
- continue;
- }
- break;
-
- case S_BKQT1:
- state = S_WORD;
- break;
-
- case S_BKQT2:
- state = S_QUOTE;
- break;
-
- default:
- panic("sdecode canon");
- /* NOTREACHED */
- }
- *outp++ = c;
- }
- n = 0;
-done:
- c = outp - di->di_cp; /* wrote this many chars */
- di->di_lexstate = state;/* save new state */
- di->di_nch = n; /* and new counts and pointers */
- di->di_cp = cp;
- return (c);
-}
-
-#define WDMAX BUFSIZ /* when testing, make this small */
-
-/*
- * Read a word from the input file.
- * Returns NULL (and sets di_call) at end of \special.
- *
- * We gather up to WDMAX + k characters at a time into an input
- * buffer, and lex them using `canon' above. The result is at most
- * as long as the original text. Since a single legal word might
- * be up to WDMAX bytes long, k must be at least 1 (for the trailing
- * NUL). If the input word is longer, we flush the trailing part,
- * using the k `extra' bytes (and again k must be at least 1).
- *
- * If there is a current keyword and it is in the current buffer
- * (di_bkw != 0), and we have to move existing buffer text around
- * or write over it with new file text, we save the keyword and
- * clear di_bkw.
- */
-static char *
-word(di, quietly)
- register struct decode_info *di;
- int quietly;
-{
- register int n;
- register char *p;
- register int len, trunc = 0;
- static char inbuf[WDMAX + 20]; /* k=20 */
-
- len = 0; /* no word bytes yet */
- p = di->di_cp; /* where canon() writes (nil if first time) */
- di->di_lexstate = S_DULL;
- /*
- * Loop invariants:
- * len is in [0..WDMAX)
- * di_lexstate != S_DONE
- */
- do {
- /* if the buffer is empty, refill it */
- if (di->di_nch == 0) {
- /* compute remaining buffer space */
- n = sizeof inbuf - len;
- /* read n bytes or rest of string, whichever smaller */
- if (di->di_nfilech < n && (n = di->di_nfilech) == 0) {
- /* `eof': fake up a call-terminator */
- di->di_call = 1;
- if (di->di_lexstate == S_DULL)
- return (di->di_word = NULL);
- break; /* take partial word */
- }
- /* save keyword if this will clobber it */
- if (di->di_bkw) {
- di->di_kw = strsave(di->di_kw);
- di->di_bkw = 0;
- }
- /* if there is some canon text, move it to front */
- if (len && p > inbuf) {
-#ifdef BLOCK_COPY
- bcopy(p, inbuf, len);
-#else
- movedown(p, inbuf, len);
-#endif
- }
- /* canon text is (or will be) at front now */
- p = inbuf;
- di->di_cp = p + len;
- if (fread(di->di_cp, 1, n, di->di_file) != n) {
- if (ferror(di->di_file))
- error(1, -1, "error reading %s",
- DVIFileName);
- GripeUnexpectedDVIEOF();
- }
- di->di_nfilech -= n;
- di->di_nch = n;
- }
- n = canon(di);
- if ((len += n) > WDMAX) {
- len = WDMAX;
- trunc = 1;
- }
- } while (di->di_lexstate != S_DONE);
- p[len] = 0;
-
- /*
- * If the word was too long (and hence truncated), complain
- * (unless we are quietly skipping over the remains of a
- * broken \special).
- */
- if (trunc && !quietly) {
- /* word was too long; complain */
- error(0, 0,
-#if WDMAX > 20
- "over-long word in \\special: `%.20s...'",
-#else
- "over-long word in \\special: `%s...'",
-#endif
- p);
- error(0, 0, "(truncated to %d characters)", WDMAX);
- }
- return (di->di_word = p);
-}
-
-/*
- * Initialise the character class table.
- */
-void
-SDsetclass(spaces, semis)
- register char *spaces;
- register char *semis;
-{
- register int c;
-
- if (spaces == NULL)
- spaces = "\b\t\n\f\r ";
- if (semis == NULL)
- semis = ";\n";
-
- for (c = 0; c < sizeof cclass / sizeof *cclass; c++)
- cclass[c] = 0;
- while ((c = *spaces++) != 0)
- cclass[c] |= CCL_SPACE;
- while ((c = *semis++) != 0)
- cclass[c] |= CCL_SEMI;
- sdset = 1;
-}
-
-/*
- * Perform a binary search for the given string in the given table.
- */
-static struct sdecode *
-lookup(str, p, max)
- register char *str;
- register struct sdecode *p;
- register int max;
-{
- register struct sdecode *m;
- register int dir;
-
- while (max > 0) {
- /*
- * Look at the median; pick the right hand one if
- * there are two such entries (when `max' is even).
- * Set dir positive if str is `greater than' m->sd_name,
- * negative if it is `less'. If not equal, move
- * left or right accordingly. When max is even and
- * we move right, we have to use (max-1)/2 since we
- * broke the tie towards the right.
- */
- m = p + (max >> 1);
- if ((dir = *str - *m->sd_name) == 0)
- dir = strcmp(str, m->sd_name);
- if (dir == 0) /* found */
- return (m);
- if (dir > 0) { /* str > mid: move right */
- p = m + 1;
- max = (max - 1) >> 1;
- } else /* str < mid: move left */
- max >>= 1;
- }
- return (NULL);
-}
-
-/*
- * Decode a series of \special keywords.
- *
- * The table points to a sorted list of keywords to match.
- * On a match, the appropriate function is called with appropriate
- * arguments.
- *
- * Characters in `semi' (if not NULL) act like `statement separators'.
- * For instance, decoding with semi=>";\n" means that
- *
- * \special{foo 1; bar 2 4^^Jbaz 3}
- *
- * tries to call foo(1), bar(2,4), and baz(3) (in that order).
- */
-void
-SDecode(fp, len, table, tsize)
- FILE *fp;
- register i32 len;
- struct sdecode *table;
- int tsize;
-{
- register char *cp;
- register struct sdecode *tp;
- register int h;
- struct decode_info di;
-
- /* set defaults, if necessary */
- if (!sdset)
- SDsetclass((char *)NULL, (char *)NULL);
-
- di.di_nch = 0;
- di.di_cp = NULL;
- di.di_nfilech = len;
- di.di_file = fp;
- di.di_bkw = 0;
- for (;;) {
- di.di_call = 0;
- if ((cp = word(&di, 0)) == NULL)
- return; /* (all done) */
- tp = lookup(cp, table, tsize);
- if (tp == NULL) {
- error(0, 0,
- "Warning: unrecognised \\special keyword `%s' ignored", cp);
- /* di_call is not set, so fall through */
- } else {
- di.di_kw = cp;
- di.di_bkw = 1;
- args(tp, &di);
- if (!di.di_call)
- error(0, 0,
- "Warning: extra arguments to \\special `%s' ignored", di.di_kw);
- if (!di.di_bkw)
- free(di.di_kw);
- di.di_bkw = 0;
- }
- /* eat extra arguments, or arguments to an unknown function */
- while (!di.di_call)
- (void) word(&di, 1);
- }
-}
-
-/*
- * Gather up the arguments to the given function, then (if all goes well)
- * call that function with those arguments. On return, if di_call is not
- * set, there were extra arguments left over.
- */
-static void
-args(tp, di)
- register struct sdecode *tp;
- register struct decode_info *di;
-{
- char *fmt;
- int n, room, f1;
- i32 *ip, i[4];
- double d[2];
-
- switch (tp->sd_args) {
-
- case sda_none:
- (*tp->sd_fn)(tp->sd_name);
- return;
-
- case sda_s:
- fmt = "s";
- if (scan(di, &fmt))
- break;
- (*tp->sd_fn)(tp->sd_name, di->di_word);
- return;
-
- case sda_d:
- fmt = "d";
- if (scan(di, &fmt, &i[0]))
- break;
- (*tp->sd_fn)(tp->sd_name, i[0]);
- return;
-
- case sda_f:
- fmt = "f";
- if (scan(di, &fmt, &d[0]))
- break;
- (*tp->sd_fn)(tp->sd_name, d[0]);
- return;
-
- case sda_dd:
- fmt = "dd";
- if (scan(di, &fmt, &i[0], &i[1]))
- break;
- (*tp->sd_fn)(tp->sd_name, i[0], i[1]);
- return;
-
- case sda_ff:
- fmt = "ff";
- if (scan(di, &fmt, &d[0], &d[1]))
- break;
- (*tp->sd_fn)(tp->sd_name, d[0], d[1]);
- return;
-
- case sda_ddddff:
- fmt = "ddddff";
- if (scan(di, &fmt, &i[0], &i[1], &i[2], &i[3], &d[0], &d[1]))
- break;
- (*tp->sd_fn)(tp->sd_name, i[0], i[1], i[2], i[3], d[0], d[1]);
- return;
-
- case sda_nd:
- f1 = 'd';
- goto array;
-
- case sda_nx:
- f1 = 'x';
- goto array;
-
- case sda_rest:
- (*tp->sd_fn)(tp->sd_name,
- (i32)di->di_nch, di->di_cp, (i32)di->di_nfilech);
- di->di_call = 1;
- di->di_nch = 0;
- di->di_nfilech = 0;
- return;
-
- default:
- panic("sdecode args(): sd_argtype");
- /* NOTREACHED */
- }
-
- /*
- * If we get here, there is a missing or incorrect argument.
- */
- badarg(*fmt, di);
- return;
-
-array:
- ip = (i32 *)malloc((unsigned)(room = 10) * sizeof(i32));
- if (ip == NULL)
- goto nomem;
- n = 0;
- while (!di->di_call && word(di, 0) != NULL) {
- if (scan_i(di->di_word, f1, &i[0])) {
- badarg(f1, di);
- free((char *)ip);
- return;
- }
- if (n == room) {
- room += 10;
- ip = (i32 *)realloc((char *)ip,
- (unsigned)room * sizeof(i32));
- if (ip == NULL)
- goto nomem;
- }
- ip[n++] = i[0];
- }
- (*tp->sd_fn)(tp->sd_name, n, ip);
- free((char *)ip);
- return;
-nomem:
- /*
- * might as well stop: if malloc() failed, we will probably get
- * nowhere fast anyway.
- */
- error(1, -1,
- "ran out of memory allocating %d bytes for \\special `%s'",
- n * sizeof(i32), di->di_kw);
- /* NOTREACHED */
-
-}
-
-/*
- * Complain about an argument. Scan() has set di_word to NULL if
- * it was missing; otherwise it is incorrect.
- */
-static void
-badarg(c, di)
- int c;
- struct decode_info *di;
-{
- char *s;
-
- switch (c) {
-
- case 'd':
- s = "decimal";
- break;
-
- case 'f':
- s = "floating";
- break;
-
- case 's':
- s = "string"; /* must be `missing', not `bad' */
- break;
-
- case 'x':
- s = "hexadecimal";
- break;
-
- default:
- panic("sdecode badarg(%c)", c);
- /* NOTREACHED */
- }
- if (di->di_word == NULL)
- error(0, 0, "missing %s argument for \\special `%s'",
- s, di->di_kw);
- else {
- error(0, 0, "bad %s argument to \\special `%s': `%s'",
- s, di->di_kw, di->di_word);
- error(0, 0, "(this part of the \\special will be ignored)");
- while (!di->di_call)
- (void) word(di, 1);
- }
-}
-
-#ifdef WIN32
-static int
-scan(struct decode_info *di, char **fmtp, va_list ap)
-{
- register int c;
- char *fmt = *fmtp;
-
- va_start(ap, fmt);
- while ((c = *fmt++) != 0) {
- if (di->di_call || word(di, 0) == NULL) {
- di->di_word = NULL;
- goto out;
- }
- switch (c) {
-
- /* BEWARE, can only handle one string */
- case 's': /* always accepted */
- break;
-
- case 'd':
- case 'x':
- if (scan_i(di->di_word, c, va_arg(ap, i32 *)))
- goto out;
- break;
-
- case 'f':
- if (scan_d(di->di_word, va_arg(ap, double *)))
- goto out;
- break;
-
- default:
- panic("sdecode scan() *fmt=%c", c);
- /* NOTREACHED */
- }
- }
- c = 0;
-out:
- va_end(ap);
- return (c);
-}
-
-#else
-static int
-scan(va_alist)
- va_dcl
-{
- register struct decode_info *di;
- register char *fmt;
- register int c;
- char **fmtp;
- va_list ap;
-
- va_start(ap);
- di = va_arg(ap, struct decode_info *);
- fmtp = va_arg(ap, char **);
- fmt = *fmtp;
- while ((c = *fmt++) != 0) {
- if (di->di_call || word(di, 0) == NULL) {
- di->di_word = NULL;
- goto out;
- }
- switch (c) {
-
- /* BEWARE, can only handle one string */
- case 's': /* always accepted */
- break;
-
- case 'd':
- case 'x':
- if (scan_i(di->di_word, c, va_arg(ap, i32 *)))
- goto out;
- break;
-
- case 'f':
- if (scan_d(di->di_word, va_arg(ap, double *)))
- goto out;
- break;
-
- default:
- panic("sdecode scan() *fmt=%c", c);
- /* NOTREACHED */
- }
- }
- c = 0;
-out:
- va_end(ap);
- *fmtp = fmt - 1;
- return (c);
-}
-#endif
-static int
-scan_i(p, c, result)
- char *p;
- int c;
- i32 *result;
-{
-#ifdef HAVE_STRTOL
- char *end;
- long strtol();
-
- *result = strtol(p, &end, c == 'x' ? 16 : 10);
- return (*end);
-#else
- long l;
- char junk;
-
- if (sscanf(p, c == 'x' ? "%lx%c" : "%ld%c", &l, &junk) != 1)
- return (1);
- *result = l;
- return (0);
-#endif
-}
-
-static int
-scan_d(p, result)
- char *p;
- double *result;
-{
-#ifdef HAVE_STRTOD
- char *end;
- double strtod();
-
- *result = strtod(p, &end);
- return (*end);
-#else
- char junk;
-
- return (sscanf(p, "%lf%c", result, &junk) != 1);
-#endif
-}
diff --git a/Build/source/texk/seetexk/sdecode.h b/Build/source/texk/seetexk/sdecode.h
deleted file mode 100644
index b0ef12ef8e9..00000000000
--- a/Build/source/texk/seetexk/sdecode.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 1989 University of Maryland
- * Department of Computer Science. All rights reserved.
- * Permission to copy for any purpose is hereby granted
- * so long as this copyright notice remains intact.
- */
-
-/*
- * Specials consist of keyword/value groupings, with the simple syntax
- * suggested by the BNF
- *
- * list ::= kv | list ',' kv
- * kv ::= word opt_eq words
- * opt_eq ::= '=' | <empty>
- * words ::= word | words ' ' word
- *
- * `Words' include any character that is not a space, comma, or quote,
- * and can include these by using quoting. Inside and outside quotes,
- * `\"' produces `"'; `\\' produces `\'; and `\,' produces `,'.
- *
- * No single word can exceed WDMAX characters (after quotes are interpreted).
- * WDMAX is defined in sdecode.c, and is typically large (>= 1024).
- *
- * Each special is typed according to its arguments, which are collected
- * and decoded, and passed to the special function as ordinary parameters.
- * All possible argument-types must be known to the special decoder.
- * The function also receives its own name (from the table) as its
- * first argument.
- */
-
-/* value argument types */
-enum sd_args {
- sda_none, /* no arguments, just a flag */
- sda_s, /* one string argument (`foo abc') */
- sda_d, /* one decimal (i32) argument (`foo 2') */
- sda_f, /* one floating (double) argument (`foo 3.14') */
- sda_dd, /* two decimal arguments (`foo 3 4') */
- sda_ff, /* two floating arguments (`foo .3 .4') */
- sda_ddddff, /* four decimal args, then 2 floating args */
- sda_nd, /* array n of decimal arguments */
- sda_nx, /* array n of hex arguments (`x 1a00 d02f ...') */
- sda_rest /* fn(len1, ptr, len2); uses up rest of input */
-};
-
-struct sdecode {
- char *sd_name; /* keyword to match */
- enum sd_args sd_args; /* arguments to collect */
- void (*sd_fn)(); /* actual arguments depend on sd_args */
-};
-
-void SDecode(/* FILE *, i32, struct sdecode *, size_t */);
-void SDsetclass(/* char *spaces, char *semis */);
-
-#define SDsize(tab) ((int)(sizeof(tab) / sizeof(*tab)))
diff --git a/Build/source/texk/seetexk/skip.c b/Build/source/texk/seetexk/skip.c
deleted file mode 100644
index 54366b331ab..00000000000
--- a/Build/source/texk/seetexk/skip.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 1987, 1989 University of Maryland
- * Department of Computer Science. All rights reserved.
- * Permission to copy for any purpose is hereby granted
- * so long as this copyright notice remains intact.
- */
-
-#ifndef lint
-static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/skip.c,v 3.1 89/08/22 21:45:13 chris Exp $";
-#endif
-
-#include <stdio.h>
-#include "types.h"
-#include "fio.h"
-
-/*
- * Skip a font definition. The font number has already been consumed.
- */
-SkipFontDef(fp)
- register FILE *fp;
-{
- register int i;
-
- (void) GetLong(fp); /* checksum */
- (void) GetLong(fp); /* mag */
- (void) GetLong(fp); /* designsize */
- i = UnSign8(GetByte(fp)) + UnSign8(GetByte(fp));
- while (--i >= 0)
- (void) GetByte(fp);
-}
diff --git a/Build/source/texk/seetexk/split.c b/Build/source/texk/seetexk/split.c
deleted file mode 100644
index 21d0d648325..00000000000
--- a/Build/source/texk/seetexk/split.c
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * Copyright (c) 1987, 1989 University of Maryland
- * Department of Computer Science. All rights reserved.
- * Permission to copy for any purpose is hereby granted
- * so long as this copyright notice remains intact.
- */
-
-#ifndef lint
-static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/split.c,v 3.1 89/08/22 21:59:36 chris Exp $";
-#endif
-
-#include <ctype.h>
-
-/*
- * Split a line into an array of words. This is destructive of
- * the original line; the word pointers point to places within
- * that line.
- *
- * The pound-sign character `#', at the beginning of the line or
- * after white space, marks the end of the line.
- *
- * Return the number of words made, or -1 for overflow.
- */
-
-/*
- * The lexical states are much like `sh's, except that we also do
- * C-style backslash-escapes.
- */
-enum lexstate {
- S_BLANK, /* outside a word */
- S_WORD, /* inside a word, no quoting */
- S_SQUOTE, /* inside a single quote */
- S_DQUOTE, /* inside a double quote */
- S_BKSL0, /* last char was \ */
- S_BKSL1, /* last chars were \, [0-7] */
- S_BKSL2 /* last chars were \, [0-7][0-7] */
-};
-
-int
-split(s, w, nw)
- register char *s, **w;
- int nw;
-{
- register int c;
- register char *canon = s;
- register int wleft = nw;
- enum lexstate state, prebkstate;
-
- /*
- * Start out in the `blank' state (outside a word). Handle
- * quotes and things. Backslashes are handled by saving the
- * `pre-backslash' state, doing the backslash, and restoring
- * that state at the end of the backslash sequence.
- */
- state = S_BLANK;
- while ((c = *s++) != 0) {
-reswitch:
- switch (state) {
-
- /*
- * Blanks: spaces stay in blank state; '#' ends the line;
- * anything else starts a word. However, quotes may put
- * us into quote states, rather than word states.
- */
- case S_BLANK:
- if (isspace(c))
- continue;
- if (c == '#')
- goto stopped_by_comment;
- if (--wleft < 0)
- return (-1);
- *w++ = canon;
- state = S_WORD;
- /* FALLTHROUGH */
-
- /*
- * In a word. Spaces take us out (and end the
- * current word). Quotes, however, put us into
- * quote states.
- */
- case S_WORD:
- if (isspace(c)) {
- *canon++ = 0;
- state = S_BLANK;
- break;
- }
- if (c == '\'') {
- state = S_SQUOTE;
- break;
- }
- if (c == '"') {
- state = S_DQUOTE;
- break;
- }
- if (c == '\\') {
- prebkstate = S_WORD;
- state = S_BKSL0;
- break;
- }
- *canon++ = c;
- break;
-
- /*
- * Inside a single quote, the only special character
- * is another single quote. This matches the Bourne
- * shell quoting convention exactly.
- */
- case S_SQUOTE:
- if (c == '\'')
- state = S_WORD;
- else
- *canon++ = c;
- break;
-
- /*
- * Inside a double quote, double quotes get us out,
- * but backslashes must be interpreted.
- */
- case S_DQUOTE:
- if (c == '\\') {
- prebkstate = S_DQUOTE;
- state = S_BKSL0;
- } else if (c == '"')
- state = S_WORD;
- else
- *canon++ = c;
- break;
-
- /*
- * If we are handling a backslash, we will either
- * restore the state, or go to BKSL1 state. In
- * the latter case, do not advance the canonicalisation
- * pointer, since we might have more octal digits
- * to insert.
- */
- case S_BKSL0:
- state = prebkstate; /* probably */
- switch (c) {
-
- case 'b':
- *canon++ = '\b';
- break;
-
- case 'f':
- *canon++ = '\f';
- break;
-
- case 'n':
- *canon++ = '\n';
- break;
-
- case 'r':
- *canon++ = '\r';
- break;
-
- case 't':
- *canon++ = '\t';
- break;
-
- case '0': case '1': case '2': case '3':
- case '4': case '5': case '6': case '7':
- *canon = c - '0';
- state = S_BKSL1;
- break;
-
- default:
- *canon++ = c;
- break;
- }
- break;
-
-
- /*
- * In BKSL1, we have seen backslash and one octal
- * digit. There may be more (in which case just
- * count them on in), or there might be something
- * that requires we restore the state and try again.
- */
- case S_BKSL1:
- switch (c) {
-
- case '0': case '1': case '2': case '3':
- case '4': case '5': case '6': case '7':
- *canon <<= 3;
- *canon |= c - '0';
- state = S_BKSL2;
- break;
-
- default:
- canon++;
- state = prebkstate;
- goto reswitch;
- }
- break;
-
- /*
- * BKSL2 is like BKSL1, except that it cannot
- * help but restore the original state, since
- * there are no four-character octal sequences.
- */
- case S_BKSL2:
- state = prebkstate; /* assuredly */
- switch (c) {
-
- case '0': case '1': case '2': case '3':
- case '4': case '5': case '6': case '7':
- *canon <<= 3;
- *canon++ |= c - '0';
- break;
-
- default:
- canon++;
- goto reswitch;
- }
- break;
- }
- }
-stopped_by_comment:
-#ifdef notdef
- if (state != S_WORD && state != S_BLANK)
- error(0, 0, "warning: unclosed quote");
-#endif
- if (state != S_BLANK)
- *canon = 0;
- return (nw - wleft);
-}
diff --git a/Build/source/texk/seetexk/strsave.c b/Build/source/texk/seetexk/strsave.c
deleted file mode 100644
index a7b53d4af8d..00000000000
--- a/Build/source/texk/seetexk/strsave.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 1987, 1989 University of Maryland
- * Department of Computer Science. All rights reserved.
- * Permission to copy for any purpose is hereby granted
- * so long as this copyright notice remains intact.
- */
-
-/*
- * Save a string in managed memory.
- */
-
-#if !defined( WIN32 ) && !defined( _AMIGA )
-char *malloc(), *realloc();
-extern int errno;
-#endif
-
-#include "types.h" /* for bcopy */
-#include "error.h"
-
-char *
-strsave(s)
- register char *s;
-{
- register int l = strlen(s) + 1;
- register char *p = malloc((unsigned) l);
-
- if (p == 0)
- error(1, errno, "no room for %d bytes of string", l);
- bcopy(s, p, l);
- return (p);
-}
diff --git a/Build/source/texk/seetexk/strtol.c b/Build/source/texk/seetexk/strtol.c
deleted file mode 100644
index 5cb6662fbb6..00000000000
--- a/Build/source/texk/seetexk/strtol.c
+++ /dev/null
@@ -1,56 +0,0 @@
-#include <stdio.h>
-#include <ctype.h>
-
-/*
- * This is for people who don't have strtol defined on their systems.
- * -- Compliments of Daniel.Stodolsky@cs.cmu.edu
- */
-
-long strtol(nptr,base,eptr)
-char *nptr;
-int base;
-char **eptr;
-{
- long l;
-
- if (base==10)
- {
- if (sscanf(nptr,"%ld",&l)!=1)
- {
- *eptr = nptr;
- return 0;
- }
- else
- {
- while(!isdigit(*nptr))
- nptr++;
- while (isdigit(*nptr))
- nptr++;
- *eptr = nptr;
- return l;
- }
- }
- else
- if (base==16)
- {
- if (sscanf(nptr,"%lx",&l)!=1)
- {
- *eptr = nptr;
- return 0;
- }
- else
- {
- while(!isxdigit(*nptr))
- nptr++;
- while (isxdigit(*nptr))
- nptr++;
- *eptr = nptr;
- return l;
- }
- }
- else
- { /* a base we don't understand. Puke */
- *eptr = nptr;
- return 0;
- }
-}
diff --git a/Build/source/texk/seetexk/tfm.c b/Build/source/texk/seetexk/tfm.c
deleted file mode 100644
index 9a9a43aa6ef..00000000000
--- a/Build/source/texk/seetexk/tfm.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright (c) 1987, 1989 University of Maryland
- * Department of Computer Science. All rights reserved.
- * Permission to copy for any purpose is hereby granted
- * so long as this copyright notice remains intact.
- */
-
-#ifndef lint
-static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/tfm.c,v 3.1 89/08/22 22:00:12 chris Exp $";
-#endif
-
-/*
- * TFM file reading routines.
- *
- * TODO:
- * finish
- */
-
-#include <stdio.h>
-#include "types.h"
-#include "fio.h"
-#include "tfm.h"
-
-static int trd_header(), trd_ci(), trd_fix();
-
-#if !defined( WIN32 ) && !defined( _AMIGA )
-char *malloc();
-#endif
-
-#define ALLOC(n, type) ((type *)malloc((unsigned)((n) * sizeof(type))))
-
-int
-readtfmfile(f, t, stopafterwidth)
- register FILE *f;
- register struct tfmdata *t;
- int stopafterwidth; /* ??? */
-{
- i32 nc;
-
- if (trd_header(f, &t->t_hdr))
- return (-1);
- nc = t->t_hdr.th_ec - t->t_hdr.th_bc + 1;
-
- t->t_ci = NULL;
- t->t_width = NULL;
- t->t_height = NULL;
- t->t_depth = NULL;
-
- (void) fseek(f, t->t_hdr.th_lh * 4L, 1); /* XXX */
-
- if ((t->t_ci = ALLOC(nc, struct char_info_word)) == NULL ||
- trd_ci(f, nc, t->t_ci) ||
- (t->t_width = ALLOC(t->t_hdr.th_nw, i32)) == NULL ||
- trd_fix(f, t->t_hdr.th_nw, t->t_width))
- goto bad;
- if (stopafterwidth)
- return (0);
- if ((t->t_height = ALLOC(t->t_hdr.th_nh, i32)) == NULL ||
- trd_fix(f, t->t_hdr.th_nh, t->t_height) ||
- (t->t_depth = ALLOC(t->t_hdr.th_nd, i32)) == NULL ||
- trd_fix(f, t->t_hdr.th_nd, t->t_depth))
- goto bad;
- return (0);
-
-bad:
- if (t->t_ci != NULL)
- free((char *) t->t_ci);
- if (t->t_width != NULL)
- free((char *) t->t_width);
- if (t->t_height != NULL)
- free((char *) t->t_height);
- if (t->t_depth != NULL)
- free((char *) t->t_depth);
- return (-1);
-}
-
-static int
-trd_header(f, th)
- register FILE *f;
- register struct tfmheader *th;
-{
- register i32 *p;
-
- for (p = &th->th_lf; p <= &th->th_np; p++)
- fGetWord(f, *p);
- if (feof(f))
- return (-1);
- return (0);
-}
-
-static int
-trd_ci(f, nc, ci)
- register FILE *f;
- register int nc;
- register struct char_info_word *ci;
-{
-
- while (--nc >= 0) {
- ci->ci_width = fgetbyte(f);
- ci->ci_h_d = fgetbyte(f);
- ci->ci_i_t = fgetbyte(f);
- ci->ci_remainder = fgetbyte(f);
- ci++;
- }
- if (feof(f))
- return (-1);
- return (0);
-}
-
-static int
-trd_fix(f, nf, p)
- register FILE *f;
- register int nf;
- register i32 *p;
-{
-
- while (--nf >= 0) {
- fGetLong(f, *p);
- p++;
- }
- if (feof(f))
- return (-1);
- return (0);
-}
diff --git a/Build/source/texk/seetexk/tfm.h b/Build/source/texk/seetexk/tfm.h
deleted file mode 100644
index 9a50657e873..00000000000
--- a/Build/source/texk/seetexk/tfm.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (c) 1987, 1989 University of Maryland
- * Department of Computer Science. All rights reserved.
- * Permission to copy for any purpose is hereby granted
- * so long as this copyright notice remains intact.
- */
-
-/*
- * TFM file information.
- */
-
-/*
- * TFM files start with a series of unsigned 16 bit integers. We
- * read this into the structure `tfm_header'. These are type i32
- * so that they may be used as integer quantities without concern
- * as to sign extension.
- */
-struct tfmheader {
- i32 th_lf; /* length of the file (16 bit words) */
- i32 th_lh; /* length of the header data (words) */
- i32 th_bc; /* beginning character */
- i32 th_ec; /* ending character (inclusive) */
- i32 th_nw; /* number of words in width table */
- i32 th_nh; /* number of words in height table */
- i32 th_nd; /* number of words in depth table */
- i32 th_ni; /* words in italic correction table */
- i32 th_nl; /* words in ligature/kern table */
- i32 th_nk; /* words in kern table */
- i32 th_ne; /* words in extensible character table */
- i32 th_np; /* number of font parameter words */
-};
-
-/*
- * The remainder of the TFM file comprises the following information,
- * all of which are 32 bit quantities:
- *
- * header: array [0..lh-1] of stuff
- * char_info: array [bc..ec] of char_info_word
- * width: array [0..nw-1] of fix_word
- * height: array [0..nh-1] of fix_word
- * depth: array [0..nd-1] of fix_word
- * italic: array [0..ni-1] of fix_word
- * lig_kern: array [0..nl-1] of lig_kern_command
- * kern: array [0..ne-1] of extensible_recipie
- * param: array [0..np-1] of fix_word
- */
-
-/*
- * A char_info_word is built of four unsigned eight-bit quantities. The first
- * is an index into the width table (this saves 24 bits for every
- * character that has the same width as another character). The
- * second is a composite height and depth index. The third is a
- * composite italic index and tag, and the fourth is a remainder.
- *
- * XXX needs explaining
- */
-struct char_info_word {
- char ci_width; /* width index */
- char ci_h_d; /* height and depth index */
- char ci_i_t; /* italic index and tag */
- char ci_remainder; /* ??? */
-};
-
-/*
- * These macros split up h_and_d and i_and_t values.
- */
-#define T_CI_H(ci) (((ci)->ci_h_d >> 4) & 0xf)
-#define T_CI_D(ci) ((ci)->ci_h_d & 0xf)
-#define T_CI_I(ci) (((ci)->ci_i_t >> 2) & 0x3f)
-#define T_CI_T(ci) ((ci)->ci_i_t & 3)
-
-/*
- * This structure contains everything one might need to know about
- * a TFM file at run-time.
- *
- * XXX incomplete, or wrong, as yet
- */
-struct tfmdata {
- struct tfmheader t_hdr; /* full header */
- struct char_info_word *t_ci; /* char info */
- i32 *t_width; /* widths table */
- i32 *t_height; /* heights */
- i32 *t_depth; /* depths */
-};
diff --git a/Build/source/texk/seetexk/tfmfont.c b/Build/source/texk/seetexk/tfmfont.c
deleted file mode 100644
index e18be7ce1a1..00000000000
--- a/Build/source/texk/seetexk/tfmfont.c
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- * Copyright (c) 1987, 1989 University of Maryland
- * Department of Computer Science. All rights reserved.
- * Permission to copy for any purpose is hereby granted
- * so long as this copyright notice remains intact.
- */
-
-#ifndef lint
-static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/tfmfont.c,v 3.4 89/11/29 02:29:58 chris Exp $";
-#endif
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "types.h"
-#include "conv.h"
-#include "font.h"
-#include "tfm.h"
-
-/*
- * TFM font operations. This defines three fonts:
- *
- * box - prints as little square boxes, outlining what TeX
- * thinks is the character; carries a warning.
- * blank - prints as entirely blank; carries a warning.
- * tfm - prints as entirely blank; can be used for built-in fonts.
- * invis - an alias for tfm.
- *
- * The first two also complain that no font is available in the
- * requested size; these are intended to be used as a last resort
- * so that users can always print DVI files. You should configure
- * in exactly one of box or blank.
- *
- * TODO:
- * base box edge widths on Conversion.c_dpi
- */
-static int box_read(), blank_read(), tfm_read();
-static int tfm_getgly(), tfm_rasterise();
-static void tfm_freefont();
-
- /* magnifications are unused in tfm fonts */
-struct fontops boxops = /* `boxtops'? Is this a cereal driver? */
- { "box", 1, 0.0, box_read, tfm_getgly, tfm_rasterise, tfm_freefont };
-struct fontops blankops =
- { "blank", 2, 0.0, blank_read, tfm_getgly, tfm_rasterise, tfm_freefont };
-struct fontops tfmops =
- { "tfm", 0, 0.0, tfm_read, tfm_getgly, tfm_rasterise, tfm_freefont };
-struct fontops invisops =
- { "invis", 0, 0.0, tfm_read, tfm_getgly, tfm_rasterise, tfm_freefont };
-
-/*
- * Local info.
- */
-struct tfm_details {
- int tfm_edge; /* box edge widths, in pixels */
- struct tfmdata tfm_data; /* the TFM file data */
-};
-
-/*
- * Get the tfm_details from font f.
- */
-#define ftotfm(f) ((struct tfm_details *)(f)->f_details)
-
-static int do_read();
-
-#if !defined( WIN32 ) && !defined( _AMIGA )
-extern int errno;
-char *malloc();
-#endif
-
-/*
- * Read a Box font.
- */
-static int
-box_read(f, fd)
- struct font *f;
- int fd;
-{
-
- return (do_read(f, fd, 0));
-}
-
-/*
- * Read a Blank font.
- */
-static int
-blank_read(f, fd)
- struct font *f;
- int fd;
-{
-
- return (do_read(f, fd, 1));
-}
-
-/*
- * Read a TFM font.
- */
-static int
-tfm_read(f, fd)
- struct font *f;
- int fd;
-{
-
- return (do_read(f, fd, 1));
-}
-
-/*
- * Read a TFM font. It is blank if `blank'.
- */
-static int
-do_read(f, fd, blank)
- register struct font *f;
- int fd, blank;
-{
- register struct tfm_details *tfm;
- FILE *fp;
-
- if ((fp = fdopen(fd, "r")) == NULL) {
- (void) close(fd);
- return (-1);
- }
- if ((tfm = (struct tfm_details *)malloc(sizeof *tfm)) == NULL)
- goto fail;
- if (readtfmfile(fp, &tfm->tfm_data, blank))
- goto fail;
- if (blank)
- tfm->tfm_edge = 0;
- else
- tfm->tfm_edge = 2; /* XXX should be based on dpi */
- if (FontHasGlyphs(f, tfm->tfm_data.t_hdr.th_bc,
- tfm->tfm_data.t_hdr.th_ec + 1))
- goto fail;
- f->f_checksum = 0; /* ??? */
- f->f_design_size = 0; /* ??? */
- f->f_hppp = 0;
- f->f_vppp = 0;
- f->f_details = (char *)tfm;
- (void) fclose(fp);
- return (0);
-
-fail:
- (void) fclose(fp);
- if (tfm != NULL)
- free((char *)tfm);
- return (-1);
-}
-
-/*
- * Obtain the specified range of glyphs.
- */
-static int
-tfm_getgly(f, l, h)
- register struct font *f;
- int l;
- register int h;
-{
- register struct tfm_details *tfm = ftotfm(f);
- register struct glyph *g;
- register int i;
- register struct char_info_word *ci;
-#define t (&tfm->tfm_data)
- extern i32 ScaleOneWidth(i32, i32);
-#define ftop(fix) fromSP(ScaleOneWidth(fix, f->f_dvimag))
-
- for (i = l; i < h; i++) {
- ci = &t->t_ci[i - t->t_hdr.th_bc];
- /* zero widths mark invalid characters */
- if (ci->ci_width == 0)
- continue;
- g = f->f_gly[i];
- g->g_flags = GF_VALID;
- g->g_rawtfmwidth = t->t_width[UnSign8(ci->ci_width)];
- g->g_xorigin = 0;
- if (tfm->tfm_edge != 0) {
- g->g_yorigin = ftop(t->t_height[T_CI_H(ci)]);
- g->g_width = ftop(g->g_rawtfmwidth);
- g->g_height = g->g_yorigin +
- ftop(t->t_depth[T_CI_D(ci)]);
- } else {
- g->g_yorigin = 0;
- g->g_width = 0;
- g->g_height = 0;
- }
- }
- return (0);
-#undef t
-}
-
-/*
- * Obtain rasters for the specified glyphs.
- *
- * IGNORES tfm->tfm_edge: 2 HARDCODED FOR NOW
- */
-static int
-tfm_rasterise(f, l, h)
- struct font *f;
- int l, h;
-{
- register struct glyph *g;
- register char *p;
- register int w, j, i;
- struct tfm_details *tfm = ftotfm(f);
-#define EDGE 2
-
- if (tfm->tfm_edge == 0)
- return (0);
-if (tfm->tfm_edge != 2) panic("tfm_rasterise");
- for (i = l; i < h; i++) {
- g = f->f_gly[i];
- if ((g->g_flags & GF_VALID) == 0 || !HASRASTER(g))
- continue;
- w = (g->g_width + 7) >> 3;
- p = malloc((unsigned) (g->g_height * w));
- if (p == NULL)
- return (-1);
- g->g_raster = p;
- g->g_rotation = ROT_NORM;
- if (g->g_width < 2 * EDGE) {
- w = 2 * EDGE - g->g_width;
- for (j = g->g_height; --j >= 0;)
- *p++ = 0xf0 << w;
- } else {
- bzero(p, g->g_height * w);
- for (j = 0; j < g->g_height;) {
- if (j < EDGE || j >= g->g_height - EDGE) {
- register int k = w;
-
- while (--k > 0)
- *p++ = 0xff;
- *p++ = 0xff << ((8 - g->g_width) & 7);
- j++;
- continue;
- }
- /* the following depends on EDGE==2 */
- *p = 0xc0;
- p += w - ((g->g_width & 7) == 1 ? 2 : 1);
- *p++ |= 0xc0 >> ((g->g_width - EDGE) & 7);
- if ((g->g_width & 7) == 1)
- *p++ = 0x80;
- /* end dependencies */
- if (++j == EDGE && g->g_height >= 2 * EDGE) {
- register int n = g->g_height - EDGE;
-
- p += (n - j) * w;
- j = n;
- }
- }
- }
- }
- return (0);
-}
-
-/*
- * Discard the font details.
- */
-static void
-tfm_freefont(f)
- struct font *f;
-{
-
- free(f->f_details);
-}