diff options
author | Karl Berry <karl@freefriends.org> | 2006-01-17 21:41:51 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-01-17 21:41:51 +0000 |
commit | 487ca4806cc046076293cf6cc5fbba0db282bac7 (patch) | |
tree | 847b412ab5158dd7bdd7ed7e5a4cc3fbca94be32 /Build/source/texk/dvi2tty | |
parent | a3d3111bfe26b8e5f5bc6049dfb2a4ca2edc7881 (diff) |
texk 1
git-svn-id: svn://tug.org/texlive/trunk@1485 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/dvi2tty')
-rw-r--r-- | Build/source/texk/dvi2tty/DVI.format | 70 | ||||
-rw-r--r-- | Build/source/texk/dvi2tty/MANIFEST | 13 | ||||
-rw-r--r-- | Build/source/texk/dvi2tty/Makefile.in | 44 | ||||
-rw-r--r-- | Build/source/texk/dvi2tty/README | 53 | ||||
-rw-r--r-- | Build/source/texk/dvi2tty/README.ORG | 26 | ||||
-rw-r--r-- | Build/source/texk/dvi2tty/commands.h | 67 | ||||
-rwxr-xr-x | Build/source/texk/dvi2tty/configure | 1614 | ||||
-rw-r--r-- | Build/source/texk/dvi2tty/configure.in | 17 | ||||
-rw-r--r-- | Build/source/texk/dvi2tty/depend.mak | 10 | ||||
-rw-r--r-- | Build/source/texk/dvi2tty/disdvi.c | 495 | ||||
-rw-r--r-- | Build/source/texk/dvi2tty/dummy.ps | 0 | ||||
-rw-r--r-- | Build/source/texk/dvi2tty/dvi2tty.1 | 131 | ||||
-rw-r--r-- | Build/source/texk/dvi2tty/dvi2tty.c | 721 | ||||
-rw-r--r-- | Build/source/texk/dvi2tty/dvi2tty.h | 108 | ||||
-rw-r--r-- | Build/source/texk/dvi2tty/dvi2tty.patch | 91 | ||||
-rw-r--r-- | Build/source/texk/dvi2tty/dvistuff.c | 1180 | ||||
-rw-r--r-- | Build/source/texk/dvi2tty/win32.mak | 52 |
17 files changed, 4692 insertions, 0 deletions
diff --git a/Build/source/texk/dvi2tty/DVI.format b/Build/source/texk/dvi2tty/DVI.format new file mode 100644 index 00000000000..a48ad47e4d9 --- /dev/null +++ b/Build/source/texk/dvi2tty/DVI.format @@ -0,0 +1,70 @@ +/* + + +================================================================================ +== DVI file format == +================================================================================ +no_ops >= 0 bytes (NOP, nops before the preamble) +preamble_marker 1 ubyte (PRE) +version_id 1 ubyte (should be version 2) +numerator 4 ubytes (numerater must equal the one in postamble) +denominator 4 ubytes (denominator must equal the one in postamble) +magnification 4 ubytes (magnification must equal the one in postamble) +id_len 1 ubyte (lenght of identification string) +id_string id_len ubytes (identification string) + +no_ops >= 0 bytes (NOP, nops before a page) +begin_of_page 1 ubyte (BOP) +page_nr 4 sbytes (page number) +do_be_do 36 bytes (filler ????) +prev_page_offset 4 sbytes (offset in file where previous page starts, -1 for none) +... PAGE DATA ... +end_of_page 1 ubyte (EOP) + +no_ops ??? >= 0 bytes (NOPS, I think they are allowed here...) +postamble_marker 1 ubyte (POST) +last_page_offset 4 sbytes (offset in file where last page starts) +numerator 4 ubytes (numerater must equal the one in preamble) +denominator 4 ubytes (denominator must equal the one in preamble) +magnification 4 ubytes (magnification must equal the one in preamble) +max_page_height 4 ubytes (maximum page height) +max_page_width 4 ubytes (maximum page width) +max_stack 2 ubytes (maximum stack depth needed) +total_pages 2 ubytes (number of pages in file) +... FONT DEFINITIONS ... + +postamble_offset 4 sbytes (offset in file where postamble starts) +version_id 1 ubyte (should be version 2) +trailer >= 4 ubytes (TRAILER) +<EOF> + + +FONT DEFINITIONS: + do { + switch (c = getc(dvi_fp) { + case FNTDEF1 : + case FNTDEF2 : + case FNTDEF3 : + case FNTDEF4 : define_font(c); + case POSTPOST : break; + default : error; + } + } while (c != POSTPOST); + +===== A font def looks like: + +1,2,3 or 4 ubytes TeXfontnumber for FNTDEF1 .. FNTDEF4 +4 ubytes checksum +4 ubytes scale +4 ubytes design size +1 byte deflen1 +1 byte deflen2 +deflen1 + deflen2 bytes fontname. + +===== A special looks like: + +1,2,3 or 4 ubytes telling length of special command for XXX1 .. XXX4 +all bytes in the special command are used as defined in the dvi driver. + + +*/ diff --git a/Build/source/texk/dvi2tty/MANIFEST b/Build/source/texk/dvi2tty/MANIFEST new file mode 100644 index 00000000000..304aadd3544 --- /dev/null +++ b/Build/source/texk/dvi2tty/MANIFEST @@ -0,0 +1,13 @@ + File Name Archive # Description +----------------------------------------------------------- + README 1 + README.ORG 1 + DVI.format 1 + MANIFEST 1 + Makefile 1 + disdvi.c 1 + dvi2tty.c 1 + dvistuff.c 2 + commands.h 1 + dvi2tty.h 2 + dvi2tty.1 2 diff --git a/Build/source/texk/dvi2tty/Makefile.in b/Build/source/texk/dvi2tty/Makefile.in new file mode 100644 index 00000000000..de4881d60c9 --- /dev/null +++ b/Build/source/texk/dvi2tty/Makefile.in @@ -0,0 +1,44 @@ +# Makefile for dvi2tty --te@informatik.uni-hannover.de. Public domain. +version = 4.0 + +kpse_include ../make/paths.mk +kpse_include ../make/common.mk +kpse_include ../make/programs.mk +prog_cflags = -DUNIX -DKPATHSEA + +programs = disdvi dvi2tty +default all: $(programs) + +dvi2tty: $(kpathsea) dvi2tty.o dvistuff.o + $(kpathsea_link) dvi2tty.o dvistuff.o $(LOADLIBES) +disdvi: $(kpathsea) disdvi.o + $(kpathsea_link) disdvi.o $(LOADLIBES) + +kpse_include ../make/tkpathsea.mk + +install: install-exec install-data +uninstall: uninstall-exec uninstall-data + +install-exec: $(programs) + $(SHELL) $(top_srcdir)/../mkinstalldirs $(bindir) + for p in $(programs); do $(INSTALL_LIBTOOL_PROG) $$p $(bindir); done +uninstall-exec: + for p in $(programs); do rm -f $(bindir)/$$p; done + +install-data: dvi2tty.1 + $(SHELL) $(top_srcdir)/../mkinstalldirs $(man1dir) + $(INSTALL_DATA) $(srcdir)/dvi2tty.1 $(man1dir)/dvi2tty.$(manext) + +uninstall-data: + rm -f $(man1dir)/dvi2tty.$(manext) +pre-dist-$(distname): +post-dist-$(distname): + +kpse_include ../make/dist.mk +kpse_include ../make/config.mk + +info dvi check: + +kpse_include ../make/clean.mk +kpse_include ../make/rdepend.mk +kpse_include depend.mk diff --git a/Build/source/texk/dvi2tty/README b/Build/source/texk/dvi2tty/README new file mode 100644 index 00000000000..9c66e197190 --- /dev/null +++ b/Build/source/texk/dvi2tty/README @@ -0,0 +1,53 @@ + DVI2TTY + + +dvi2tty is intended for previewing dvi-files on text-only +devices (terminals and lineprinters). +The program is basicly an improved C version of the pascal +program written by Svante Lindahl (see README.ORG). +I translated it because I could not find a pascal compiler +on our machine that could compile it. +The program runs under UNIX and MSDOS without problems +It should also run under VMS. +(you may need some site dependend redefinitions, see below). +Undocumented option: the -e option can be used to influence +the width of spaces. With a negative value the number of spaces +between words becomes less, with a positive value it becomes more. +Just play around if you like, -e-11 worked nice with me. + + + DISDVI + +Disdvi is a simple hack that dumps a dvi file in a more readable form. +It is not a spectacular program but use it and improve as you wish. +I'd appreciate any enhancements made, bug reports etc. mailed to me. + + + COMPILING THE PROGRAMS + +Disdvi is rather simple and does not need any modifications. +To compile under VMS, you might need to define an extra macro: +Add a -DVMS on the command line, or add a line +#define VMS +in the dvi2tty.h file. +For dvi2tty you may find the following problems: + + function strchr() can not be found: + Your are probably a BSD UNIX or alike. + Solution: #define strchr index + '/usr/bin/pg' program not found. + Solution: change the DEFPAGER macro in dvi2tty.c + To compile under VMS, you might need to define an extra macro: + Add a -DVMS on the command line, or add a line + #define VMS + +Thats all, good luck. + + +- Marcel +----------------------------------------- +| Marcel J.E. Mol | They hate you if your're clever +| Delft University of Technology | And they despise the fool +| The Netherlands | Till you're so fucking crazy +| UUCP: marcel@duteca.tudelft.nl | You can't follow the rules. +----------------------------------------- - Lennon diff --git a/Build/source/texk/dvi2tty/README.ORG b/Build/source/texk/dvi2tty/README.ORG new file mode 100644 index 00000000000..3eeefc4684c --- /dev/null +++ b/Build/source/texk/dvi2tty/README.ORG @@ -0,0 +1,26 @@ + +dvitty is intended for previewing dvi-files on text-only devices +(terminals and lineprinters). The output is not very pretty many +times, but it still saves quite a lot of work, especially if you +have a little ways to walk to a laserprinter, for example. + +The program was originally written in Hedrick-Pascal, running on +TOPS-20, and was later ported to UNIX (BSD, Berkeley-pascal). + +It is not very smart in all situations, but still serves it pur- +pose fairly well. + +For information on how to use see the man-page. + +Before compiling and installing inspect the "compile-time cust- +omization constants" and change them to suit your site. +These constants configure default pager and a little more. + +Please report complaints, suggestions, bugs and/or fixes to: + +Svante Lindahl, NADA, KTH Numerical Analysis & Computer Science +UUCP: {seismo,mcvax}!enea!ttds!zap Royal Institute of Technology, Sweden +ARPA: enea!ttds!zap@seismo.CSS.GOV EAN: zap@cs.kth.sunet + +The TOPS-20 version of the program can also be obtained from the above +address. diff --git a/Build/source/texk/dvi2tty/commands.h b/Build/source/texk/dvi2tty/commands.h new file mode 100644 index 00000000000..4c9702deae5 --- /dev/null +++ b/Build/source/texk/dvi2tty/commands.h @@ -0,0 +1,67 @@ +/* DVI COMMANDS */ +#define SETC_000 0 /* typeset character 0 and move right */ +#define SETC_127 127 /* typeset character 127 and move right */ +#define SET1 128 /* typeset a character and move right */ +#define SET2 129 /* ??? */ +#define SET3 130 /* ??? */ +#define SET4 131 /* ??? */ +#define SET_RULE 132 /* typeset a rule and move right */ +#define PUT1 133 /* typeset a character */ +#define PUT2 134 /* ??? */ +#define PUT3 135 /* ??? */ +#define PUT4 136 /* ??? */ +#define PUT_RULE 137 /* typeset a rule */ +#define NOP 138 /* no operation */ +#define BOP 139 /* beginning of page */ +#define EOP 140 /* ending of page */ +#define PUSH 141 /* save the current positions */ +#define POP 142 /* restore previous positions */ +#define RIGHT1 143 /* move right */ +#define RIGHT2 144 /* ??? */ +#define RIGHT3 145 /* ??? */ +#define RIGHT4 146 /* ??? */ +#define W0 147 /* move right by |w| */ +#define W1 148 /* move right and set |w| */ +#define W2 149 /* ??? */ +#define W3 150 /* ??? */ +#define W4 151 /* ??? */ +#define X0 152 /* move right by |x| */ +#define X1 153 /* move right and set |x| */ +#define X2 154 /* ??? */ +#define X3 155 /* ??? */ +#define X4 156 /* ??? */ +#define DOWN1 157 /* move down */ +#define DOWN2 158 /* ??? */ +#define DOWN3 159 /* ??? */ +#define DOWN4 160 /* ??? */ +#define Y0 161 /* move down by |y| */ +#define Y1 162 /* move down and set |y| */ +#define Y2 163 /* ??? */ +#define Y3 164 /* ??? */ +#define Y4 165 /* ??? */ +#define Z0 166 /* move down by |z| */ +#define Z1 167 /* move down and set |z| */ +#define Z2 168 /* ??? */ +#define Z3 169 /* ??? */ +#define Z4 170 /* ??? */ +#define FONT_00 171 /* set current font to 0 */ +#define FONT_63 234 /* set current font to 0 */ +#define FNT1 235 /* set current font */ +#define FNT2 236 /* Same as FNT1, except that arg is 2 bytes */ +#define FNT3 237 /* Same as FNT1, except that arg is 3 bytes */ +#define FNT4 238 /* Same as FNT1, except that arg is 4 bytes */ +#define XXX1 239 /* extension to \.DVI primitives */ +#define XXX2 240 /* Like XXX1, but 0<=k<65536 */ +#define XXX3 241 /* Like XXX1, but 0<=k<@t$2^{24}$@> */ +#define XXX4 242 /* potentially long extension to \.DVI + primitives */ +#define FNT_DEF1 243 /* define the meaning of a font number */ +#define FNT_DEF2 244 /* ??? */ +#define FNT_DEF3 245 /* ??? */ +#define FNT_DEF4 246 /* ??? */ +#define PRE 247 /* preamble */ +#define POST 248 /* postamble beginning */ +#define POST_POST 249 /* postamble ending */ +#define TRAILER 223 /* trailer bytes in dvi file */ + + /* undefined_commands 250,251,252,253,254,255 */ diff --git a/Build/source/texk/dvi2tty/configure b/Build/source/texk/dvi2tty/configure new file mode 100755 index 00000000000..e7420f17b21 --- /dev/null +++ b/Build/source/texk/dvi2tty/configure @@ -0,0 +1,1614 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.13 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: +ac_help="$ac_help + --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer" +ac_help="$ac_help + --without-mktexmf-default do not run mktexmf if MF source missing" +ac_help="$ac_help + --without-mktexpk-default do not run mktexpk if PK font missing" +ac_help="$ac_help + --without-mktextfm-default do not run mktextfm if TFM file missing" +ac_help="$ac_help + --without-mkocp-default do not run mkocp if OCP file missing" +ac_help="$ac_help + --without-mkofm-default do not run mkofm if OFM file missing" +ac_help="$ac_help + --with-mktexfmt-default run mktexfmt if format file missing" +ac_help="$ac_help + --with-mktextex-default run mktextex if TeX source missing" + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +ac_config_files= +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.13" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_envvar| sed 's/[_a-zA-Z0-9]//g'`"; then + { echo "configure: error: invalid variable name: $ac_envvar" 1>&2; exit 1; } + fi + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=dvi2tty.c + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +ac_exeext= +ac_objext=o +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + +# AC_CONFIG_HEADER(c-auto.h:c-auto.in) + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:559: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test $ac_x $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:590: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_prog_rejected=no + if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test $ac_x $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test -z "$CC"; then + case "`uname -s`" in + *win32* | *WIN32*) + # Extract the first word of "cl", so it can be a program name with args. +set dummy cl; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:642: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test $ac_x $ac_dir/$ac_word; then + ac_cv_prog_CC="cl" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + ;; + esac + fi + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:675: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext << EOF + +#line 686 "configure" +#include "confdefs.h" + +main(){return(0);} +EOF +if { (eval echo configure:691: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + ac_cv_prog_cc_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no +fi +rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +if test $ac_cv_prog_cc_works = no; then + { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:717: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 +cross_compiling=$ac_cv_prog_cc_cross + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:722: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <<EOF +#ifdef __GNUC__ + yes; +#endif +EOF +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:731: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +else + GCC= +fi + +ac_test_CFLAGS="${CFLAGS+set}" +ac_save_CFLAGS="$CFLAGS" +CFLAGS= +echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:750: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + case $ac_dir in + /*|[A-z]:/*) ac_aux_dir=$ac_dir;; + *) ac_aux_dir=`pwd`/$ac_dir;; + esac + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + case $ac_dir in + /*|[A-z]:/*) ac_aux_dir=$ac_dir;; + *) ac_aux_dir=`pwd`/$ac_dir;; + esac + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:818: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + # Hack for MSDOS and descendants. + if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test $ac_x $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +echo "configure:873: checking whether ${MAKE-make} sets \${MAKE}" >&5 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftestmake <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftestmake +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SET_MAKE= +else + echo "$ac_t""no" 1>&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + +echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 +echo "configure:900: checking whether ln -s works" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + rm -f conftestdata +# MS-DOS is a special case, because it sort of pretends that ln -s +# works for executables. +if test -z "$COMSPEC" && ln -s X conftestdata 2>/dev/null +then + rm -f conftestdata + ac_cv_prog_LN_S="ln -s" +else + ac_cv_prog_LN_S=ln +fi +fi +LN_S="$ac_cv_prog_LN_S" +if test "$ac_cv_prog_LN_S" = "ln -s"; then + echo "$ac_t""yes" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + + +echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 +echo "configure:925: checking whether to enable maintainer-specific portions of Makefiles" >&5 + # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. +if test "${enable_maintainer_mode+set}" = set; then + enableval="$enable_maintainer_mode" + USE_MAINTAINER_MODE=$enableval +else + USE_MAINTAINER_MODE=no +fi + + echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6 + if test "x$USE_MAINTAINER_MODE" = xyes; then + MAINT= + else + MAINT='#M#' + fi + + + +echo $ac_n "checking for loader (symbol LD)""... $ac_c" 1>&6 +echo "configure:944: checking for loader (symbol LD)" >&5 +if eval "test \"`echo '$''{'cf_cv_subst_LD'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + +test -z "$LD" && LD=ld +cf_cv_subst_LD=$LD +fi + +LD=${cf_cv_subst_LD} +echo "$ac_t""$LD" 1>&6 + + +echo $ac_n "checking for archiver (symbol AR)""... $ac_c" 1>&6 +echo "configure:958: checking for archiver (symbol AR)" >&5 +if eval "test \"`echo '$''{'cf_cv_subst_AR'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + +test -z "$AR" && AR=ar +cf_cv_subst_AR=$AR +fi + +AR=${cf_cv_subst_AR} +echo "$ac_t""$AR" 1>&6 + + +echo $ac_n "checking for archiver options (symbol ARFLAGS)""... $ac_c" 1>&6 +echo "configure:972: checking for archiver options (symbol ARFLAGS)" >&5 +if eval "test \"`echo '$''{'cf_cv_subst_ARFLAGS'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + +test -z "$ARFLAGS" && ARFLAGS=rc +cf_cv_subst_ARFLAGS=$ARFLAGS +fi + +ARFLAGS=${cf_cv_subst_ARFLAGS} +echo "$ac_t""$ARFLAGS" 1>&6 + + + +# Check whether --with-mktexmf-default or --without-mktexmf-default was given. +if test "${with_mktexmf_default+set}" = set; then + withval="$with_mktexmf_default" + : +else + with_mktexmf_default=yes +fi + +# Check whether --with-mktexpk-default or --without-mktexpk-default was given. +if test "${with_mktexpk_default+set}" = set; then + withval="$with_mktexpk_default" + : +else + with_mktexpk_default=yes +fi + +# Check whether --with-mktextfm-default or --without-mktextfm-default was given. +if test "${with_mktextfm_default+set}" = set; then + withval="$with_mktextfm_default" + : +else + with_mktextfm_default=yes +fi + +# Check whether --with-mkocp-default or --without-mkocp-default was given. +if test "${with_mkocp_default+set}" = set; then + withval="$with_mkocp_default" + : +else + with_mkocp_default=yes +fi + +# Check whether --with-mkofm-default or --without-mkofm-default was given. +if test "${with_mkofm_default+set}" = set; then + withval="$with_mkofm_default" + : +else + with_mkofm_default=yes +fi + +# Check whether --with-mktexfmt-default or --without-mktexfmt-default was given. +if test "${with_mktexfmt_default+set}" = set; then + withval="$with_mktexfmt_default" + : +fi + +# Check whether --with-mktextex-default or --without-mktextex-default was given. +if test "${with_mktextex_default+set}" = set; then + withval="$with_mktextex_default" + with_mktextex_default=yes +else + with_mktextex_default=no +fi + + +echo $ac_n "checking where the main texmf tree is located""... $ac_c" 1>&6 +echo "configure:1042: checking where the main texmf tree is located" >&5 +texmfmain= +if test -n "$TEXMFMAIN"; then + texmfmain="$TEXMFMAIN" + echo "$ac_t""$texmfmain (from TEXMFMAIN)" 1>&6 + +elif test "x$datadir" != 'x${prefix}/share'; then + # datadir is explicitly defined, assume datadir/texmf. + eval p=\"$datadir\" + # Unconditionally set the directory, but... + texmfmain=`echo "$p/texmf" | sed 's,//*,/,g'` + # ... do complain if it wasn't found. + if test -d "$texmfmain"; then + echo "$ac_t"""$texmfmain"" 1>&6 + else + echo "$ac_t""not found" 1>&6 + echo "configure: warning: No texmf tree found at datadir/texmf ($texmfmain)" 1>&2 + echo "configure: warning: proceeding anyway. + ***************************************************************** + * Warning: The main texmf tree was not found. * + * If you do not have the files, you should be able to find them * + * at the same place you got these sources, or from one of the * + * CTAN hosts. Good luck. * + ***************************************************************** +" 1>&2 + fi + +else + # Second case, datadir is default... + if test "x$prefix" = "xNONE"; then + p="$ac_default_prefix" + else + eval p=\"$prefix\" + fi + for e in share/texmf lib/texmf texmf; do + if test -d "$p/$e"; then + texmfmain='${prefix}'/"$e" + break + fi + done + if test -z "$texmfmain" && test "x$prefix" = "xNONE"; then + # Still no texmfmain found, no prefix set, perhaps kpsewhich is + # installed and can help us out. + texmfmain=`kpsewhich --expand-path='$TEXMFMAIN'` 2>/dev/null + fi + texmfmain=`echo "$texmfmain" | sed 's,//*,/,g'` + if test -n "$texmfmain"; then + echo "$ac_t"""$texmfmain"" 1>&6 + else + eval texmfmain="$datadir/texmf" + echo "$ac_t""not found" 1>&6 + echo "configure: warning: The main texmf tree was not found at $texmfmain. + ***************************************************************** + * Warning: The main texmf tree was not found. * + * Use the --datadir option to specify its parent directory. * + * If you do not have the files, you should be able to them from * + * the same place you got these sources from, or from one of the * + * CTAN hosts. * + ***************************************************************** + Winging it by pretending $texmfmain is correct." 1>&2 + fi +fi + + +ac_config_files="$ac_config_files Makefile" + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +DEFS=-DHAVE_CONFIG_H + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS <<EOF +#! /bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# This directory was configured as follows, +# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.13" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + + +trap 'rm -fr `echo "$ac_config_files " | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS <<EOF + +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; + s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@FFLAGS@%$FFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@CC@%$CC%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@SET_MAKE@%$SET_MAKE%g +s%@LN_S@%$LN_S%g +s%@MAINT@%$MAINT%g +s%@LD@%$LD%g +s%@AR@%$AR%g +s%@ARFLAGS@%$ARFLAGS%g +s%@texmfmain@%$texmfmain%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <<EOF + +CONFIG_FILES=\${CONFIG_FILES-"$ac_config_files"} +EOF +cat >> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*|[A-z]:/*) # Absolute path. + srcdir="$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + "") ;; + [/$]*|[A-z]:/*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + rm -f conftest.in + ac_file_inputs=`echo $ac_file_in|sed -e "s%:% $ac_given_srcdir/%g" -e "s%^%$ac_given_srcdir/%"` + cat $ac_file_inputs > conftest.in + # + # Replace lines of the form ac_include foo with the contents of foo: + # first, from the ac_include lines construct a list of file names. + # From that list, we construct a second list of those files that exist. + # Then we construct lists of sed commands for including those files, + # and a sed command that removes the ac_include lines. We don't attempt + # to read non-existent files because some (buggy) versions of sed choke + # on this. Have to use sed because old (Ultrix, SunOS) awk does not support + # getline or system. (Anyway, configure scripts aren't supposed to use awk.) + # Can't use only one -e and commands {dr foo} because foo has to be last. + # Be careful, because the filename may contain /. Be careful with + # whitespace; we need to use echo. + # + file_substs=`sed -n '/^ac_include/s%ac_include[ ]*\(.*\)%\1%p' conftest.in` + # Create the sed command line ... + if test -n "$file_substs"; then + echo "configure: warning: ac_include is obsolete; instead use kpse_include" 1>&2 + file_subst_cmd="sed -e 's/^ac_include/kpse_include/'" + else + file_subst_cmd='sed' + fi + kpse_substs=`sed -n '/^kpse_include/s%kpse_include[ ]*\(.*\)%\1%p' conftest.in` + for ac_inc in $file_substs $kpse_substs; do + if test -f "$ac_given_srcdir/$ac_inc"; then + ac_mung=`echo $ac_inc | sed 's,/,%,g'` + file_subst_cmd="$file_subst_cmd -e '/^kpse_include $ac_mung$/r $ac_given_srcdir/$ac_inc'" + fi + done + file_subst_cmd="$file_subst_cmd -e '/^kpse_include/d'" + # ... and fix the whitespace and escaped slashes. + file_subst_cmd=`echo "$file_subst_cmd" | sed -e 's,%,\\\/,g' \ +-e 's/kpse_include /kpse_include[ ]*/g'` + # I can't find any way to do variable substitution in the sed commands + # (so the user could have, e.g., $top_srcdir in their ac_include line). + (eval $file_subst_cmd conftest.in) \ + | sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* conftest.in + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='\([ ][ ]*\)[^ ].*$%\1#\2' +ac_dC='\3' +ac_dD='%g' +# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". +ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='\([ ]\)%\1#\2define\3' +ac_uC=' ' +ac_uD='\4%g' +# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_eB='$%\1#\2define\3' +ac_eC=' ' +ac_eD='%g' + +if test "${CONFIG_HEADERS+set}" != set; then +EOF +cat >> $CONFIG_STATUS <<EOF + CONFIG_HEADERS="" +EOF +cat >> $CONFIG_STATUS <<\EOF +fi +for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + echo creating $ac_file + + rm -f conftest.frag conftest.in conftest.out + ac_file_inputs=`echo $ac_file_in|sed -e "s%:% $ac_given_srcdir/%g" -e "s%^%$ac_given_srcdir/%"` + cat $ac_file_inputs > conftest.in + +EOF + +# Transform confdefs.h into a sed script conftest.vals that substitutes +# the proper values into config.h.in to produce config.h. And first: +# Protect against being on the right side of a sed subst in config.status. +# Protect against being in an unquoted here document in config.status. +rm -f conftest.vals +cat > conftest.hdr <<\EOF +s/[\\&%]/\\&/g +s%[\\$`]%\\&%g +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp +s%ac_d%ac_u%gp +s%ac_u%ac_e%gp +EOF +sed -n -f conftest.hdr confdefs.h > conftest.vals +rm -f conftest.hdr + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >> conftest.vals <<\EOF +s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% +EOF + +# Break up conftest.vals because some shells have a limit on +# the size of here documents, and old seds have small limits too. + +rm -f conftest.tail +while : +do + ac_lines=`grep -c . conftest.vals` + # grep -c gives empty output for an empty file on some AIX systems. + if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi + # Write a limited-size here document to conftest.frag. + echo ' cat > conftest.frag <<CEOF' >> $CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS + echo 'CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in +' >> $CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail + rm -f conftest.vals + mv conftest.tail conftest.vals +done +rm -f conftest.vals + +cat >> $CONFIG_STATUS <<\EOF + rm -f conftest.frag conftest.h + echo "/* $ac_file. Generated automatically by configure. */" > conftest.h + cat conftest.in >> conftest.h + rm -f conftest.in + if cmp -s $ac_file conftest.h 2>/dev/null; then + echo "$ac_file is unchanged" + rm -f conftest.h + else + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + fi + rm -f $ac_file + mv conftest.h $ac_file + fi +fi; done + +EOF +cat >> $CONFIG_STATUS <<EOF + + +EOF +cat >> $CONFIG_STATUS <<\EOF + + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + +if test "$no_recursion" != yes; then + + # Remove --cache-file and --srcdir arguments so they do not pile up. + ac_sub_configure_args= + ac_prev= + for ac_arg in $ac_configure_args; do + if test -n "$ac_prev"; then + ac_prev= + continue + fi + case "$ac_arg" in + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + ;; + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + ;; + *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;; + esac + done + + for ac_config_dir in : $subdirs; do + + # Do not complain, so a configure script can configure whichever + # parts of a large source tree are present. + if test ! -d $srcdir/$ac_config_dir; then + continue + fi + + echo configuring in $ac_config_dir + + case "$srcdir" in + .) ;; + *) + if test -d ./$ac_config_dir || mkdir ./$ac_config_dir; then :; + else + { echo "configure: error: can not create `pwd`/$ac_config_dir" 1>&2; exit 1; } + fi + ;; + esac + + ac_popdir=`pwd` + cd $ac_config_dir + + # A "../" for each directory in /$ac_config_dir. + ac_dots=`echo $ac_config_dir|sed -e 's%^\./%%' -e 's%[^/]$%&/%' -e 's%[^/]*/%../%g'` + + case "$srcdir" in + .) # No --srcdir option. We are building in place. + ac_sub_srcdir=$srcdir ;; + /*|[A-z]:/*) # Absolute path. + ac_sub_srcdir=$srcdir/$ac_config_dir ;; + *) # Relative path. + ac_sub_srcdir=$ac_dots$srcdir/$ac_config_dir ;; + esac + + # Check for guested configure; otherwise get Cygnus style configure. + if test -f ./configure; then + ac_sub_configure=./configure + elif test -f $ac_sub_srcdir/configure; then + ac_sub_configure=$ac_sub_srcdir/configure + elif test -f $ac_sub_srcdir/configure.in; then + ac_sub_configure=$ac_configure + else + echo "configure: warning: no configuration information is in $ac_config_dir" 1>&2 + ac_sub_configure= + fi + + # The recursion is here. + if test -n "$ac_sub_configure"; then + + # Make the cache file name correct relative to the subdirectory. + case "$cache_file" in + /*|[A-z]:/*) ac_sub_cache_file=$cache_file ;; + *) # Relative path. + ac_sub_cache_file="$ac_dots$cache_file" ;; + esac + case "$ac_given_INSTALL" in + "") ;; + [/$]*|[A-z]:/*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo "running ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir" + # The eval makes quoting arguments work. + if eval ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir + then : + else + { echo "configure: error: $ac_sub_configure failed for $ac_config_dir" 1>&2; exit 1; } + fi + fi + + cd $ac_popdir + done +fi + + +date >stamp-auto diff --git a/Build/source/texk/dvi2tty/configure.in b/Build/source/texk/dvi2tty/configure.in new file mode 100644 index 00000000000..b2d1f2a34ec --- /dev/null +++ b/Build/source/texk/dvi2tty/configure.in @@ -0,0 +1,17 @@ +dnl Public domain. +dnl Process this file with autoconf to produce a configure script. +AC_INIT(dvi2tty.c) + +# AC_CONFIG_HEADER(c-auto.h:c-auto.in) + +AC_PROG_CC +AC_PROG_INSTALL +AC_PROG_MAKE_SET +AC_PROG_LN_S + +sinclude(../kpathsea/withenable.ac) +KPSE_CONFIG_FILES([Makefile]) +AC_OUTPUT + +dnl update `stamp-auto' since we just remade `c-auto.h' +date >stamp-auto diff --git a/Build/source/texk/dvi2tty/depend.mak b/Build/source/texk/dvi2tty/depend.mak new file mode 100644 index 00000000000..e78918665d7 --- /dev/null +++ b/Build/source/texk/dvi2tty/depend.mak @@ -0,0 +1,10 @@ +$(objdir)/dvistuff.obj: \ + dvi2tty.h \ + commands.h + +$(objdir)/dvi2tty.obj: \ + dvi2tty.h + +$(objdir)/disdvi.obj: \ + commands.h + diff --git a/Build/source/texk/dvi2tty/disdvi.c b/Build/source/texk/dvi2tty/disdvi.c new file mode 100644 index 00000000000..dba9754787a --- /dev/null +++ b/Build/source/texk/dvi2tty/disdvi.c @@ -0,0 +1,495 @@ +/*****************************************************************************/ +/* */ +/* disdvi --- disassembles TeX dvi files. */ +/* */ +/* */ +/* 2.0 23/01/89 M.J.E. Mol (c) 1989 marcel@duteca.tudelft.nl */ +/* 2.1 19/01/90 M.J.E. Mol Maintain a list of fonts and */ +/* show fontnames in font changes. */ +/* Show character code when printing ligatures */ +/* */ +/* */ +/*****************************************************************************/ + + +char *disdvi = "@(#) disdvi.c 2.1 19/01/90 M.J.E. Mol (c) 1989, 1990"; + +#include <stdio.h> +#include <ctype.h> +#include "commands.h" + +#if defined(KPATHSEA) +#define NO_DEBUG +#include <kpathsea/config.h> +#include <kpathsea/c-proto.h> +#include <kpathsea/lib.h> +#else +#if defined(MSDOS) +#include <stdlib.h> +#include <string.h> +#include <fcntl.h> +#endif +#endif + +#define LASTCHAR 127 /* max dvi character, above are commands */ + +#define get1() num(1) +#define get2() num(2) +#define get3() num(3) +#define get4() num(4) +#define sget1() snum(1) +#define sget2() snum(2) +#define sget3() snum(3) +#define sget4() snum(4) + +typedef struct _font { + long num; + struct _font * next; + char * name; +} font; + +font * fonts = NULL; +FILE * dvifp; +char * dvi_name; +long pc = 0; + +#ifdef KPATHSEA +extern int main P2H(int argc,char **argv ); +extern void bop P1H(void); +extern void postamble P1H(void); +extern void preamble P1H(void); +extern void postpostamble P1H(void); +extern void special P1H(int x); +extern void fontdef P1H(int x); +extern char *fontname P1H(long fntnum); +extern void printnonprint P1H(int ch); +extern unsigned long num P1H(int size); +extern long snum P1H(int size); +#else +char * malloc (); + +int main (); +void bop (); +void preamble (); +void postamble (); +void postpostamble (); +void fontdef (); +char * fontname (); +void special (); +void printnonprint (); +unsigned long num (); +long snum (); +#endif + + + +/*---------------------------------------------------------------------------*/ + +int main(argc, argv) +int argc; +char **argv; +{ + register int opcode; /* dvi opcode */ + register int i; + int fontnum; + + if (argc > 2) { + fprintf(stderr, "To many arguments\n"); + fprintf(stderr, "Usage: %s [dvi-file]\n", *argv); + exit(1); + } + + if (argc == 2) { + if ((i = strlen(argv[1])) == 0) { + fprintf(stderr, "Illegal empty filename\n"); + fprintf(stderr, "Usage: %s [dvi-file]\n", *argv); + exit(2); + } + if ((i >= 5) && (argv[1][i-4] == '.') && (argv[1][i-3] == 'd') && + (argv[1][i-2] == 'v') && (argv[1][i-1] == 'i')) + dvi_name = argv[1]; + else { + dvi_name = malloc((i+5) * sizeof(char)); + strcpy(dvi_name, argv[1]); + strcat(dvi_name, ".dvi"); + } + if ((dvifp = fopen(dvi_name, "r")) == NULL) { + perror(dvi_name); + exit(3); + } + } + else + dvifp = stdin; + +#if defined(MSDOS) + setmode(fileno(dvifp), O_BINARY); +#endif + + while ((opcode = (int) get1()) != EOF) { /* process until end of file */ + printf("%06ld: ", pc - 1); + if ((opcode <= LASTCHAR) && isprint(opcode)) { + printf("Char: "); + while ((opcode <= LASTCHAR) && isprint(opcode)) { + putchar(opcode); + opcode = (int) get1(); + } + putchar('\n'); + printf("%06ld: ", pc - 1); + } + + if (opcode <= LASTCHAR) + printnonprint(opcode); /* it must be a non-printable */ + else if ((opcode >= FONT_00) && (opcode <= FONT_63)) + printf("FONT_%02d /* %s */\n", opcode - FONT_00, + fontname(opcode - FONT_00)); + else + switch (opcode) { + case SET1 : + case SET2 : + case SET3 : + case SET4 : printf("SET%d: %ld\n", opcode - SET1 + 1, + num(opcode - SET1 + 1)); + break; + case SET_RULE : printf("SET_RULE: height: %ld\n", sget4()); + printf("%06ld: ", pc); + printf(" length: %ld\n", sget4()); + break; + case PUT1 : + case PUT2 : + case PUT3 : + case PUT4 : printf("PUT%d: %ld\n", opcode - PUT1 + 1, + num(opcode - PUT1 + 1)); + break; + case PUT_RULE : printf("PUT_RULE: height: %ld\n", sget4()); + printf("%06ld: ", pc); + printf(" length: %ld\n", sget4()); + break; + case NOP : printf("NOP\n"); break; + case BOP : bop(); break; + case EOP : printf("EOP\n"); break; + case PUSH : printf("PUSH\n"); break; + case POP : printf("POP\n"); break; + case RIGHT1 : + case RIGHT2 : + case RIGHT3 : + case RIGHT4 : printf("RIGHT%d: %ld\n", opcode - RIGHT1 + 1, + snum(opcode - RIGHT1 + 1)); + break; + case W0 : printf("W0\n"); break; + case W1 : + case W2 : + case W3 : + case W4 : printf("W%d: %ld\n", opcode - W0, + snum(opcode - W0)); + break; + case X0 : printf("X0\n"); break; + case X1 : + case X2 : + case X3 : + case X4 : printf("X%d: %ld\n", opcode - X0, + snum(opcode - X0)); + break; + case DOWN1 : + case DOWN2 : + case DOWN3 : + case DOWN4 : printf("DOWN%d: %ld\n", opcode - DOWN1 + 1, + snum(opcode - DOWN1 + 1)); + break; + case Y0 : printf("Y0\n"); break; + case Y1 : + case Y2 : + case Y3 : + case Y4 : printf("Y%d: %ld\n", opcode - Y0, + snum(opcode - Y0)); + break; + case Z0 : printf("Z0\n"); break; + case Z1 : + case Z2 : + case Z3 : + case Z4 : printf("Z%d: %ld\n", opcode - Z0, + snum(opcode - Z0)); + break; + case FNT1 : + case FNT2 : + case FNT3 : + case FNT4 : fontnum = num(opcode -FNT1 + 1); + printf("FNT%d: %d /* %s */\n", + opcode - FNT1 + 1, fontnum, + fontname(fontnum)); + break; + case XXX1 : + case XXX2 : + case XXX3 : + case XXX4 : special(opcode - XXX1 + 1); break; + case FNT_DEF1 : + case FNT_DEF2 : + case FNT_DEF3 : + case FNT_DEF4 : fontdef(opcode - FNT_DEF1 + 1); break; + case PRE : preamble(); break; + case POST : postamble(); break; + case POST_POST: postpostamble(); break; + } + } + + return 0; +} /* main */ + + +/*----------------------------------------------------------------------------*/ + + +void bop() +{ + int i; + + printf("BOP page number : %ld", sget4()); + for (i=0; i < 9; i++) { + if (i % 3 == 0) + printf("\n%06ld: ", pc); + printf(" %6ld", sget4()); + } + printf("\n%06ld: ", pc); + printf(" prev page offset : %06ld\n", sget4()); + +} /* bop */ + + +/*---------------------------------------------------------------------------*/ + +void postamble() +{ + + printf("POST last page offset : %06ld\n", sget4()); + printf("%06ld: ", pc); + printf(" numerator : %ld\n", get4()); + printf("%06ld: ", pc); + printf(" denominator : %ld\n", get4()); + printf("%06ld: ", pc); + printf(" magnification : %ld\n", get4()); + printf("%06ld: ", pc); + printf(" max page height : %ld\n", get4()); + printf("%06ld: ", pc); + printf(" max page width : %ld\n", get4()); + printf("%06ld: ", pc); + printf(" stack size needed: %d\n", (int) get2()); + printf("%06ld: ", pc); + printf(" number of pages : %d\n", (int) get2()); + +} /* postamble */ + +void preamble() +{ + register int i; + + printf("PRE version : %d\n", (int) get1()); + printf("%06ld: ", pc); + printf(" numerator : %ld\n", get4()); + printf("%06ld: ", pc); + printf(" denominator : %ld\n", get4()); + printf("%06ld: ", pc); + printf(" magnification : %ld\n", get4()); + printf("%06ld: ", pc); + i = (int) get1(); + printf(" job name (%3d) :", i); + while (i-- > 0) + putchar((int) get1()); + putchar('\n'); + +} /* preamble */ + + +void postpostamble() +{ + register int i; + + printf("POSTPOST postamble offset : %06ld\n", get4()); + printf("%06ld: ", pc); + printf(" version : %d\n", (int) get1()); + while ((i = (int) get1()) == TRAILER) { + printf("%06ld: ", pc - 1); + printf("TRAILER\n"); + } + while (i != EOF) { + printf("%06ld: ", pc - 1); + printf("BAD DVI FILE END: 0x%02X\n", i); + i = (int) get1(); + } + +} /* postpostamble */ + + + +void special(x) +register int x; +{ + register long len; + register long i; + + len = num(x); + printf("XXX%d: %ld bytes\n", x, len); + printf("%06ld: ", pc); + for (i = 0; i < len; i++) /* a bit dangerous ... */ + putchar((int) get1()); /* can be non-printables */ + putchar('\n'); + +} /* special */ + + + +void fontdef(x) +register int x; +{ + register int i; + char * name; + font * fnt; + int namelen; + long fntnum; + int new = 0; + + fntnum = num(x); + printf("FNT_DEF%d: %ld\n", x, fntnum); + printf("%06ld: ", pc); /* avoid side-effect on pc in get4() */ + printf(" checksum : %ld\n", get4()); + printf("%06ld: ", pc); + printf(" scale : %ld\n", get4()); + printf("%06ld: ", pc); + printf(" design : %ld\n", get4()); + printf("%06ld: ", pc); + printf(" name : "); + namelen = (int) get1() + (int) get1(); + fnt = fonts; + while (fnt != NULL && fnt->num != fntnum) + fnt = fnt->next; + if (fnt == NULL) { + if ((fnt = (font *) malloc(sizeof(font))) == NULL) { + perror("fontdef"); + exit(1); + } + fnt->num = fntnum; + new = 1; + } + else + free(fnt->name); /* free old name */ + if ((name = (char *) malloc((namelen+1) * sizeof(char))) == NULL) { + perror("fontdef"); + exit(1); + } + + for (i = 0; i < namelen; i++) + name[i] = get1(); + name[namelen] = '\0'; + fnt->name = name; + if (new) { + fnt->next = fonts; + fonts = fnt; + } + + printf("%s\n", name); + +} /* fontdef */ + + + +char * fontname(fntnum) +long fntnum; +{ + font * fnt; + + fnt = fonts; + while (fnt != NULL && fnt->num != fntnum) + fnt = fnt->next; + if (fnt != NULL) + return fnt->name; + else + return "unknown fontname"; + +} /* fontname */ + + + +void printnonprint(ch) +register int ch; +{ + + printf("Char: "); + switch (ch) { + case 11 : printf("ff /* ligature (non-printing) 0x%02X */", + ch); + break; + case 12 : printf("fi /* ligature (non-printing) 0x%02X */", + ch); + break; + case 13 : printf("fl /* ligature (non-printing) 0x%02X */", + ch); + break; + case 14 : printf("ffi /* ligature (non-printing) 0x%02X */", + ch); + break; + case 15 : printf("ffl /* ligature (non-printing) 0x%02X */", + ch); + break; + case 16 : printf("i /* (non-printing) 0x%02X */", ch); + break; + case 17 : printf("j /* (non-printing) 0x%02X */", ch); + break; + case 25 : printf("ss /* german (non-printing) 0x%02X */", ch); + break; + case 26 : printf("ae /* scadinavian (non-printing) 0x%02X */", + ch); + break; + case 27 : printf("oe /* scadinavian (non-printing) 0x%02X */", + ch); + break; + case 28 : printf("o /* scadinavian (non-printing) 0x%02X */", + ch); + break; + case 29 : printf("AE /* scadinavian (non-printing) 0x%02X */", + ch); + break; + case 30 : printf("OE /* scadinavian (non-printing) 0x%02X */", + ch); + break; + case 31 : printf("O /* scadinavian (non-printing) 0x%02X */", + ch); + break; + default : printf("0x%02X", ch); break; + } + putchar('\n'); + +} + + + +unsigned long num(size) +register int size; +{ + register int i; + register long x = 0; + + pc += size; + for (i = 0; i < size; i++) + x = (x << 8) + (unsigned) getc(dvifp); + return x; + +} /* num */ + + + +long snum(size) +register int size; +{ + register int i; + register long x = 0; + + pc += size; + x = getc(dvifp); + if (x & 0x80) + x -= 0x100; + for (i = 1; i < size; i++) + x = (x << 8) + (unsigned) getc(dvifp); + return x; + +} /* snum */ + + + diff --git a/Build/source/texk/dvi2tty/dummy.ps b/Build/source/texk/dvi2tty/dummy.ps new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/Build/source/texk/dvi2tty/dummy.ps diff --git a/Build/source/texk/dvi2tty/dvi2tty.1 b/Build/source/texk/dvi2tty/dvi2tty.1 new file mode 100644 index 00000000000..168a073373d --- /dev/null +++ b/Build/source/texk/dvi2tty/dvi2tty.1 @@ -0,0 +1,131 @@ +.TH DVI2TTY Local "7 June 1986" +.SH NAME +dvi2tty \- preview a dvi\-file on an ordinary ascii terminal +.SH SYNOPSIS +.B dvi2tty +[ options ] dvi\-file +.SH DESCRIPTION +.I dvi2tty +converts a TeX DVI\-file to a format that is apprporiate for terminals +and lineprinters. The program is intended to be used for +preliminary proofreading of TeX-ed documents. +By default the output is directed to the terminal, +possibly through a pager (depending on how the program was installed), +but it can be directed to a file or a pipe. +.PP +The output leaves much to be desired, but is still +usefull if you want to avoid walking to the +laserprinter (or whatever) for each iteration of your +document. +.br +Since +.I dvi2tty +produces output for terminals and lineprinters the +representation of documents is naturally quite primitive. +Fontchanges are totally ignored, which implies that +special symbols, such as mathematical symbols, get mapped into the +characters at the corresponding positions in the "standard" fonts. +.PP +If the width of the output text requires more columns than fits +in one line (c.f. the \-w option) it is broken into several lines by +.I dvi2tty +although they will be printed as one line on regular TeX output +devices (e.g. laserprinters). To show that a broken line is really +just one logical line an asterisk (``*'') in the last position +means that the logical line is continued on the next physical +line output by +.I dvi2tty. +Such a continuation line is started with a a space and an asterisk +in the first two columns. +.PP +Options may be specified in the environment variable DVI2TTY. +Any option on the commandline, conflicting with one in the +environment, will override the one from the environment. +.PP +.B Options: +.PP +.TP +.B \-o file +Write output to file ``file''. +.TP +.B \-p list +Print the pages chosen by list. +Numbers refer to TeX\-page numbers (known as \\count0). +An example of format for list is ``1,3:6,8'' +to choose pages 1, 3 through 6 and 8. +Negative numbers can be used exactly as in TeX, +e g \-1 comes before \-4 as in ``\-p-1:-4,17''. +.TP +.B \-P list +Like \-p except that page numbers refer to +the sequential ordering of the pages in the dvi\-file. +Negative numbers don't make a lot of sense here... +.TP +.B \-w n +Specify terminal width +.I n. +Legal range 16\-132. +Default is 80. If your terminal has the +ability to display in 132 columns it might +be a good idea to use \-w132 and toggle the +terminal into this mode as output will +probably look somewhat better. +.TP +.B \-q +Don't pipe the output through a pager. +This may be the default on some systems +(depending on the whims of the SA installing the program). +.TP +.B \-f +Pipe through a pager, $PAGER if defined, or whatever your SA compiled +in (often ``more''). This may be the default, but it is still okay +to redirect output with ``>'', the pager will not be used if output +is not going to a terminal. +.TP +.B \-F +Specify the pager program to be used. +This overides the $PAGER and the default pager. +.TP +.B \-Fprog +Use ``prog'' as program to pipe output into. Can be used to choose an +alternate pager (e g ``-Fless''). +.TP +.B \-l +Mark pagebreaks with the two-character sequence ``^L''. The default is +to mark them with a formfeed character. +.TP +.B \-u +Don't make any attempts to find special Scandinavian characters. +If such characters are in the text they will map to ``a'' and ``o''. +This is probably the default outside of Scandinavia. (The SA made +the decision when the program was installed.) +.TP +.B \-s +Try to find the special Scandinavian characters that on most (?) +terminals in Scandinavia are mapped to ``{|}[\\]''. +This can be the default, and output from files not containing these +special characters will be identical regardless of this option. +.SH FILES +/usr/ucb/more \ \ \ \ +probably the default pager. +.SH ENVIRONMENT +PAGER \ \ \ \ \ \ \ \ \ \ \ \ +the pager to use. +.br +DVI2TTY \ \ \ \ \ \ \ \ \ \ \ +can be set to hold commandline options. +.SH "SEE ALSO" +TeX, dvi2ps +.SH AUTHOR +Svante Lindahl, Royal Institute of Technology, Stockholm +.br +Improved C version: Marcel Mol +.br +{seismo, mcvax}!enea!ttds!zap +.br +marcel@duteca.UUCP +.SH BUGS +Blanks between words get lost quite easy. This is less +likely if you are using a wider output than the default 80. +.PP +Only one file may be specified on the commandline. diff --git a/Build/source/texk/dvi2tty/dvi2tty.c b/Build/source/texk/dvi2tty/dvi2tty.c new file mode 100644 index 00000000000..78a26ae632e --- /dev/null +++ b/Build/source/texk/dvi2tty/dvi2tty.c @@ -0,0 +1,721 @@ +/****************************************************************************** + * Marcel Mol: 1990-03-27 (UUCP: marcel@duteca.tudelft.nl) + * Fixed bug that causes the program to hang when it finds a + * fontname with an 's' in it not followed by an 'y'. + * Thanks to Paul Orgren (orgren@Stars.Reston.Unisys.COM). + * Marcel Mol: 1990-02-04 (UUCP: marcel@duteca.tudelft.nl) + * First attempt to recognize symbol fonts, so bullets (in + * itemized lists) are translated to a proper character instead + * an awfull ligature. + * Version 4.0. + * Marcel Mol: 1990-02-01 (UUCP: marcel@duteca.tudelft.nl) + * Included port to VMS (off Joseph Vasallo and Seppo Rantala) + * into latest version. Hope things still work, cannot test it ... + * Joseph Vasallo & Seppo Rantala: 1989-09-05 (Internet: rantala@tut.FI) + * Ported to work under VAX/VMS V4.4 & VAXC V2.4 or higher. + * Fixed bugs in using Swedish/Finnish characters. + * Marcel Mol: 1989-02-14 (UUCP: duteca!marcel) + * Fixed check for .dvi extension. + * Allowed more ligatures. + * Fixed side effect bugs (2 gets as function arguments). + * Version 3.2. + * Marcel Mol: 1989-01-19 (UUCP: duteca!marcel) + * Changed in option handling, no change + * in user interface (only the undocumented + * feature -e). + * Version 3.1. + * Marcel Mol: 1989-01-11 (UUCP: duteca!marcel) + * Changed some longs to ints. + * It now also runs on MSDOS Microsoft C 5.1 + * New version: 3.0 + * Marcel Mol: 1989-01-03 (UUCP: duteca!marcel) + * Fixed a bugs concerning pager programs + * and scanning environment variable DVI2TTY. + * Marcel Mol: 1988-10-25 (UUCP: duteca!marcel) + * dvi2tty.c dvi2tty.h dvistuff.c commands.h + * Converted program to C. + * improved spacing between words/characters. + * bogart:/usr/alla/zap/dvitty/dvitty.p 1986-08-15 20:24:31, + * Version to be sent to mod.sources ready. + * New option since last version: + * -Fprog Pipe output to prog. Can be used to get a different + * pager than the default. + * bogart:/usr/alla/zap/dvitty/dvitty.p 1986-01-13 21:49:31, + * Environment variable DVITTY is read and options can be set from it. + * These are the currently implemented options: + * -ofile Write output to file, else write to stdout, + * possibly piped through a pager if stdout is a tty. + * -plist Print pages whos TeX-page-number are in list. + * List is on the form 1,3:6,8 to choose pages + * 1,3-6 and 8. TeX-nrs can be negative: -p-1:-4,4 + * -Plist Print pages whos sequential number are in list. + * -wn Print the lines with width n characters, default is + * 80. Wider lines gives better results. + * -q Don't try to pipe to a pager. + * -f Try to pipe to a pager if output is a tty. + * -Fname Specify a pager program. + * Default of -q and -f is a compile time option, a constant. + * -l Write '^L' instead of formfeed between pages. + * -u Don't try to find Scandinavian characters (they will + * print as a:s and o:s if this option is choosen). + * -s Scandinavian characters printed as }{|][\. + * Default of -s and -u is a compile time option, a constant. + * bogart:/usr/alla/zap/dvitty/dvitty.p 1986-01-10 18:51:03, + * Argument parsing, and random access functions (external, in C) + * and other OS-dependent stuff (in C). Removed private 'pager' & + * tries to pipe through PAGER (environment var) or, if PAGER not + * defined, /usr/ucb/more. Some changes for efficency. + * bogart:/usr/alla/svante/dvitty/dvitty.p 1985-07-15 20:51:00, + * The code for processing dvi-files running on UNIX (UCB-Pascal) + * but no argument parsing. + * VERA::SS:<SVANTE-LINDAHL.WORK>DVITTY.PAS.140, 30-Mar-85 05:43:56, + * Edit: Svante Lindahl + * VERA::SS:<SVANTE-LINDAHL.WORK>DVITTY.PAS.136, 15-Jan-85 13:52:59, + * Edit: Svante Lindahl, final Twenex version !!!?? + * VERA::SS:<SVANTE-LINDAHL.WORK>DVITTY.PAS.121, 14-Jan-85 03:10:22, + * Edit: Svante Lindahl, cleaned up and fixed a lot of little things + * VERA::SS:<SVANTE-LINDAHL.WORK>DVITTY.PAS.25, 15-Dec-84 05:29:56, + * Edit: Svante Lindahl, COMND-interface, including command line scanning + * VERA::SS:<SVANTE-LINDAHL.WORK>DVITTY.PAS.23, 10-Dec-84 21:24:41, + * Edit: Svante Lindahl, added command line scanning with Rscan-JSYS + * VERA::<SVANTE-LINDAHL.DVITTY>DVITTY.PAS.48, 8-Oct-84 13:26:30, + * Edit: Svante Lindahl, fixed switch-parsing, destroyed by earlier patches + * VERA::<SVANTE-LINDAHL.DVITTY>DVITTY.PAS.45, 29-Sep-84 18:29:53, + * Edit: Svante Lindahl + * + * dvitty - get an ascii representation of a dvi-file, suitable for ttys + * + * This program, and any documentation for it, is copyrighted by Svante + * Lindahl. It may be copied for non-commercial use only, provided that + * any and all copyright notices are preserved. + * + * Please report any bugs and/or fixes to: + * + * UUCP: {seismo,mcvax,cernvax,diku,ukc,unido}!enea!ttds!zap + * ARPA: enea!ttds!zap@seismo.CSS.GOV + * or Svante_Lindahl_NADA%QZCOM.MAILNET@MIT-MULTICS.ARPA + * EAN: zap@cs.kth.sunet + */ + + +#include "dvi2tty.h" +#if defined(VMS) +#include unixio +#endif + + /*-----------------------------------------------------------------------*/ + /* The following constants may be toggled before compilation to */ + /* customize the default behaviour of the program for your site. */ + /* Whichever their settings are, the defaults can be overridden at */ + /* runtime. */ + /*-----------------------------------------------------------------------*/ + +#define DEFSCAND FALSE /* default is Scandinavian, toggle this if you */ + /* don't have terminals with Scand. nat. chars */ +#define WANTPAGER TRUE /* default: try to pipe through a pager (like */ + /* more) if stdout is tty and no -o switch */ +#define DEFPAGER "more" /* CHANGE TO YOUR LOCAL PAGER */ + + /*------------------ end of customization constants ---------------------*/ + +#define MAXLEN 100 /* size of char-arrays for strings */ +#if defined(MSDOS) || defined(VMS) +#define OPTSET "wepPousl" /* legal options */ +#define OPTWARG "wepPo" /* options with argument */ +#else +#define OPTSET "wepPousqlfF"/* legal options */ +#define OPTWARG "wepPoF" /* options with argument */ +#endif + +/* + * USAGE CODES + */ + +#define wrnge 1 /* width switch arg out of range */ +#define ign 2 /* ignore cause, print 'Usage:..' */ +#define nan 3 /* not a number where one expected */ +#define gae 4 /* garbage at end */ +#define bdlst 5 /* bad page-numberlist */ +#define onef 6 /* only one dvifile allowed */ +#define bdopt 7 /* bad option */ +#define onepp 8 /* only one page list allowed */ +#define noarg 9 /* argument expected */ + +char *dvi2tty = "@(#) dvi2tty.c 4.1 27/03/90 M.J.E. Mol (c) 1989, 1990"; + +/*---------------------------------------------------------------------------*/ + +printlisttype * currentpage; /* current page to print */ +printlisttype * firstpage; /* first page selected */ +printlisttype * lastpage; /* last page selected */ + +FILE * DVIfile; +FILE * output; +bool outputtofile; /* tells if output goes to file or stdout */ +int ttywidth; /* max nr of chars per printed line */ +int espace; /* to fake calcs with ttywidth */ + +long foo; /* utility variable, "register" */ +#if !defined(MSDOS) && !defined(VMS) +bool pager; /* tells if output is piped to a pager */ +char * path; /* name of the pager to run */ +#endif +char * progname; /* our name */ +int Argc; +char ** Argv; +char DVIfilename[MAXLEN]; +char * OUTfilename; +char optch; /* for option handling */ + +/*---------------------------------------------------------------------------*/ + +#ifdef KPATHSEA +int main P2H(int, char **); +void setoption P1H(char *); +void getargs P1H(void); +void getpages P2H(int, char *); +void plcnxt P1H(int); +void getfname P1H(char *); +int getinteger P3H(int *, int *, char *); +void usage P1H(int); +#else +# if defined(MSDOS) +int main (int, char **); +void setoption (char *); +void getargs (void); +void getpages (int, char *); +void plcnxt (int); +void getfname (char *); +int getinteger(int *, int *, char *); +void usage (int); +# else +char * getenv (); +FILE * popen (); + +int main (); +void setoption (); +void getargs (); +void getpages (); +void plcnxt (); +void getfname (); +int getinteger(); +void usage (); +# endif +#endif + +/****************************************************************************/ +/* */ +/* M A I N */ +/* */ +/****************************************************************************/ + +int main(argc, argv) +int argc; +char ** argv; +{ + + progname = *argv; + Argc = argc; + Argv = argv; + + getargs(); /* read command line arguments */ +#if defined(DOSISH) + if ((DVIfile = fopen(DVIfilename, "rb")) == NULL) +#else +#if defined(VMS) + if ((DVIfile = fopen(DVIfilename, "r","ctx=rec")) == NULL) +#else + if ((DVIfile = fopen(DVIfilename, "r")) == NULL) +#endif +#endif + errorexit(filop); /* can't open dvifile */ + + if (outputtofile) { /* open the outfile, if needed */ + if ((output = fopen(OUTfilename, "w")) == NULL) + errorexit(filcr); +#if !defined(MSDOS) && !defined(VMS) + pager = FALSE; +#endif + } + else { + output = stdout; +#if !defined(MSDOS) && !defined(VMS) + if (isatty(fileno(output)) && pager) { /* try to pipe to a pager */ + if ((output = popen(path, "w")) == NULL) /* get pipe to pager */ + errorexit(pipcr); /* make output to output */ + } + else + pager = FALSE; +#endif + } + + dvimain(); + +#if !defined(MSDOS) && !defined(VMS) + if (pager) + pclose(output); /* close pipe to pager */ +#endif + + return 0; + +} /* main */ + +/*----------------------------------------------------------------------------*/ + +void setoption(optarg) +char *optarg; +{ + int j = 0; + + while (strchr(OPTSET, optch) != NULL) { + switch (optch) { +#if !defined(MSDOS) && !defined(VMS) + case 'q' : pager = FALSE; break; + case 'f' : pager = TRUE; break; +#endif + case 'l' : noffd = TRUE; break; + case 's' : scascii = TRUE; break; + case 'u' : scascii = FALSE; break; + case 'P' : + sequenceon = TRUE; /* fall through */ + case 'p' : + if (pageswitchon) + usage(onepp); + getpages(j, optarg); + break; + case 'w' : + if (getinteger(&ttywidth, &j, optarg)) + usage(nan); + if (optarg[j] != '\0') + usage(gae); + if ((ttywidth < 16) || (ttywidth > 132)) + usage(wrnge); + break; + case 'e' : + if (getinteger(&espace, &j, optarg)) + usage(nan); + if (optarg[j] != '\0') + usage(gae); + break; + case 'o' : + OUTfilename = optarg; + outputtofile = TRUE; + j = strlen(optarg); + break; +#if !defined(MSDOS) && !defined(VMS) + case 'F' : + pager = TRUE; + path = optarg; + j = strlen(optarg); + break; +#endif + default : + usage(bdopt); + } + if ((optch = optarg[j]) == '\0') + break; + j++; + if ((strchr(OPTWARG, optch) != NULL) && (optarg[j]='\0')) { + if (--Argc <= 0) + usage(noarg); + optarg = *++Argv; + j = 0; + } + } +} /* setoption */ + +/*----------------------------------------------------------------------------*/ + +void getargs() +{ + char *str, *envp; + bool DVIfound; /* if a dvi filename found */ + + if (Argc <= 1) + usage(ign); + + pageswitchon = FALSE; /* show all pages */ + sequenceon = FALSE; /* selected pages are TeX-numbered */ + outputtofile = FALSE; /* write to stdout */ +#if !defined(MSDOS) && !defined(VMS) + pager = WANTPAGER; /* want paging, compile time option */ +#endif + noffd = FALSE; /* print formfeed between pages */ + scascii = DEFSCAND; /* scandinavian, compile time option */ + ttywidth = 80; /* default terminal width */ + espace = 0; /* to fake ttywith calcs */ + DVIfound = FALSE; + +#if !defined(MSDOS) && !defined(VMS) + if ((path = getenv("PAGER")) == NULL) /* find default pathname of page */ + path = DEFPAGER; /* program in case paging is wanted */ +#endif + + if ((envp = getenv("DVI2TTY")) != NULL) { + while (*envp == ' ') + envp++; + while (*envp) { /* environment var args */ + if (strchr(OPTSET, optch = *envp++) != NULL) { + /* + * we always pass one option, and arrange for optarg ourselfves, + * so setoption does not mesh up Argv + */ + if (strchr(OPTWARG, optch) != NULL) { + while (*envp == ' ') + envp++; + if (*envp == '\0') + usage(noarg); + str = envp; /* str points to optarg */ + while ((*envp != ' ') && (*envp != '\0')) + envp++; /* set envp just after optarg */ + if (*envp != '\0') + *envp++ = '\0'; /* end optarg string */ + } + else + str = ""; + setoption(str); + } + else + usage(bdopt); + while (*envp == ' ') + envp++; + } + } + + while (--Argc > 0) { /* command line args */ + str = *++Argv; + if (*str != '-') { /* argument is not an option */ + if (DVIfound) /* only one dvi file allowed */ + usage(onef); + getfname(str); + DVIfound = TRUE; + } + else if (strchr(OPTSET, optch = *++str) != NULL) { + str++; /* point to rest of argument if any */ + if ((strchr(OPTWARG, optch) != NULL) && (*str == '\0')) { + if (--Argc <= 0) + usage(noarg); + str = *++Argv; + } + setoption(str); + } + else + usage(bdopt); + } + + if (!DVIfound) + usage(ign); + +} /* getargs */ + +/*---------------------------------------------------------------------------*/ + +void getpages(j, str) +int j; +char *str; +{ + int i, c; + int num; + + pageswitchon = TRUE; + firstpage = (printlisttype *) malloc(sizeof(printlisttype)); + firstpage->all = FALSE; + firstpage->nxt = nil; + firstpage->pag = 0; + lastpage = firstpage; + currentpage = firstpage; + if (getinteger(&num, &j, str)) + usage(nan); + plcnxt((int) num); + while (str[j]) { + c = str[j]; + if (c == ',' || c == ':') { + j++; + if (getinteger(&num, &j, str)) + usage(nan); + } + else + break; + if (c == ',') + plcnxt(num); + else { + if (currentpage->pag < 0) { + if (num > 0) { + currentpage->all = TRUE; + plcnxt(num); + } + else if (num < currentpage->pag) + for (i = currentpage->pag - 1; i >= num; i--) + plcnxt(i); + else + usage(bdlst); + } + else { + if (num < currentpage->pag) + usage(bdlst); + for (i = currentpage->pag + 1; i <= num; i++) + plcnxt(i); + } + } + } + if ((str[j] != ' ') && (str[j] != '\0')) { + usage(gae); + } + currentpage = firstpage; + +} /* getpages */ + + +void plcnxt(pagnr) /* place page-nr next in list */ +int pagnr; +{ + currentpage = lastpage; + currentpage->pag = pagnr; + lastpage = (printlisttype *) malloc(sizeof(printlisttype)); + lastpage->all = FALSE; + lastpage->nxt = nil; + lastpage->pag = 0; + currentpage->nxt = lastpage; + +} /* plcnxt */ + +/*----------------------------------------------------------------------------*/ + +#ifdef KPATHSEA +#ifdef __DJGPP__ +/* `stat' is way too expensive for such a simple job. */ +#define READABLE(fn, st) \ + (access (fn, R_OK) == 0 && access (fn, D_OK) == -1) +#else +#define READABLE(fn, st) \ + (access (fn, R_OK) == 0 && stat (fn, &(st)) == 0 && !S_ISDIR (st.st_mode)) +#endif + +char * readable_file(char *name) +{ + char *ret; + +#ifdef WIN32 + unsigned int fa, err; + + fa = GetFileAttributes(name); + if (fa == 0xFFFFFFFF) { + ret = NULL; + } + else if ((fa & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY) { + ret = NULL; + } + else { + ret = (string) name; + } +#else /* ! WIN32 */ + struct stat st; + + if (READABLE (name, st)) { + ret = (string) name; + + } else { /* Some other error. */ + ret = NULL; + } +#endif + return ret; + +} +#endif + +void getfname(str) +char *str; +{ + int i; + + i = strlen(str); + if (i == 0) + usage(ign); + strcpy(DVIfilename, str); +#ifdef KPATHSEA + if (readable_file(DVIfilename)) + return; + + strcat(DVIfilename, ".dvi"); + +#else + if (!((i >= 5) && (str[i-1] == 'i') && (str[i-2] == 'v') && + (str[i-3] == 'd') && (str[i-4] == '.'))) { + strcat(DVIfilename, ".dvi"); + } +#endif + +} /* getfname */ + +/*----------------------------------------------------------------------------*/ + +int getinteger(dest, j, str) +int *dest; +int *j; +char *str; +{ + int cum; + int sgn; + char ch; + + ch = str[*j]; + if (ch == '-') { + sgn = -1; + ch = str[++(*j)]; + } + else + sgn = 1; + if ((ch >= '0') && (ch <= '9')) { + cum = 0; + while ((ch >= '0') && (ch <= '9')) { + cum = cum*10 + ch - '0'; + ch = str[++(*j)]; + } + *dest = sgn * cum; + return 0; /* return ok */ + } + return 1; /* return error */ + +} /* getinteger */ + +/*----------------------------------------------------------------------------*/ + +void errorexit(errorcode) +int errorcode; +{ + + fprintf(stderr, "%s: ", progname); + switch (errorcode) { + case illop : fprintf(stderr, "Illegal op-code found: %d\n", opcode); + break; + case stkof : fprintf(stderr, "Stack overflow\n"); + break; + case stkuf : fprintf(stderr, "Stack underflow\n"); + break; + case stkrq : fprintf(stderr, "Cannot create dvi stack\n"); + break; + case lnerq : fprintf(stderr, "Cannot allocate memory\n"); + break; + case badid : fprintf(stderr, "Id-byte is not correct: %d\n ", opcode); + break; + case bdsgn : fprintf(stderr, "Bad signature: %d (not 223)\n", + (int) foo); + break; + case fwsgn : fprintf(stderr, "%d signature bytes (min. 4)\n", + (int) foo); + break; + case nopre : fprintf(stderr, "Missing preamble\n"); + break; + case nobop : fprintf(stderr, "Missing beginning-of-page command\n"); + break; + case nopp : fprintf(stderr, "Missing post-post command\n"); + break; + case bdpre : fprintf(stderr, "Preamble occured inside a page\n"); + break; + case bdbop : fprintf(stderr, "BOP-command occured inside a page\n"); + break; + case bdpst : fprintf(stderr, "Postamble occured before end-of-page\n"); + break; + case bdpp : fprintf(stderr, "Postpost occured before post-command\n"); + break; + case nopst : fprintf(stderr, "Missing postamble\n"); + break; + case illch : fprintf(stderr, "Character code out of range, 0..127\n"); + break; + case filop : fprintf(stderr, "Cannot open dvifile\n"); + break; + case filcr : fprintf(stderr, "Cannot create outfile\n"); + break; +#if !defined(MSDOS) && !defined(VMS) + case pipcr : fprintf(stderr, "Cannot create pipe to pager\n"); + break; +#endif + default : fprintf(stderr, "Unkown error code\n"); + break; + }; + if (outputtofile) +#if defined(VMS) + remove(OUTfilename); +#else + unlink(OUTfilename); +#endif + exit(errorcode); + +} /* errorexit */ + +/*----------------------------------------------------------------------------*/ + +void usage(uerr) +int uerr; +{ + + if (uerr != ign) { + fprintf(stderr,"%s: ", progname); + switch (uerr) { + case ign : fprintf(stderr, "%s", Copyright); + break; + case wrnge : fprintf(stderr, "width arg out of range:16-132"); + break; + case nan : fprintf(stderr, "numeric argument expected for option %c", + optch); + break; + case gae : fprintf(stderr, "garbage in argument for option %c", + optch); + break; + case bdlst : fprintf(stderr, "mal-formed list of pagenumbers"); + break; + case onef : fprintf(stderr, "only one infile argument allowed"); + break; + case noarg : fprintf(stderr, "option argument expected for option %c", + optch); + break; + case bdopt : fprintf(stderr, "bad option %c", optch); + break; + case onepp : fprintf(stderr, "only one pagelist allowed"); + break; + default : fprintf(stderr, "unknown usage error"); + break; + } + fprintf(stderr, "\n"); + } + fprintf(stderr, "Usage: %s [ options ] dvifile[.dvi]\n", progname); + fprintf(stderr, "Options are:\n"); + fprintf(stderr, + " -ofile Write output to file, else write to stdout.\n"); + fprintf(stderr, + " -plist Print pages whos TeX-page-number are in list.\n"); + fprintf(stderr, + " -Plist Print pages whos sequential number are in list.\n"); + fprintf(stderr, + " -wn Print the lines with width n characters, default 80.\n"); +#if !defined(MSDOS) && !defined(VMS) + fprintf(stderr, " -f Try to pipe to a pager if output is a tty"); + if (WANTPAGER) + fprintf(stderr, " (default).\n"); + else + fprintf(stderr, ".\n"); + fprintf(stderr, " -q Don't try to pipe to a pager"); + if (WANTPAGER) + fprintf(stderr, ".\n"); + else + fprintf(stderr, " (default).\n"); + fprintf(stderr, " -Fprog Pipe output to pager prog.\n"); +#endif + fprintf(stderr, + " -l Write ''^L'' instead of formfeed between pages.\n"); + fprintf(stderr, + " -u National Swedish/Finnish characters printed as aaoAAO"); + if (DEFSCAND) + fprintf(stderr, ".\n"); + else + fprintf(stderr, " (default).\n"); + fprintf(stderr, + " -s National Swedish/Finnish characters printed as }{|][\\"); + if (DEFSCAND) + fprintf(stderr, " (default).\n"); + else + fprintf(stderr, ".\n"); + exit(uerr); + +} /* usage */ + diff --git a/Build/source/texk/dvi2tty/dvi2tty.h b/Build/source/texk/dvi2tty/dvi2tty.h new file mode 100644 index 00000000000..baa965f4fe9 --- /dev/null +++ b/Build/source/texk/dvi2tty/dvi2tty.h @@ -0,0 +1,108 @@ +#define Copyright "dvi2tty.c Copyright (C) 1984, 1985, 1986 Svante Lindahl.\n\ +Copyright (C) 1988 M.J.E. Mol 1989, 1990" + +#include <stdio.h> +#include <string.h> + +#include <sys/types.h> +#include <sys/stat.h> + +#if defined(MSDOS) +#define DOSISH +#include <stdlib.h> +#include <malloc.h> +#endif + +#if defined(KPATHSEA) +#define NO_DEBUG +#include <kpathsea/config.h> +#include <kpathsea/c-proto.h> +#endif + +#ifndef KPATHSEA +#define TRUE 1 +#define FALSE 0 +#endif +#define nil NULL + +/* + * ERROR CODES , don't start with 0 + */ + +#define illop 1 /* illegal op-code */ +#define stkof 2 /* stack over-flow */ +#define stkuf 3 /* stack under-flow */ +#define stkrq 4 /* stack requirement */ +#define lnerq 5 /* line allocation */ +#define badid 6 /* id is not right */ +#define bdsgn 7 /* signature is wrong */ +#define fwsgn 8 /* too few signatures */ +#define nopre 9 /* no pre-amble where expected */ +#define nobop 10 /* no bop-command where expected */ +#define nopp 11 /* no postpost where expected */ +#define bdpre 12 /* unexpected preamble occured */ +#define bdbop 13 /* unexpected bop-command occured */ +#define bdpst 14 /* unexpected post-command occured */ +#define bdpp 15 /* unexpected postpost */ +#define nopst 16 /* no post-amble where expected */ +#define illch 17 /* character code out of range */ +#define filop 18 /* cannot access file */ +#define filcr 19 /* cannot creat file */ +#if !defined(MSDOS) +#define pipcr 20 /* cannot creat pipe */ +#endif + +/*---------------------------------------------------------------------------*/ + +typedef char bool; + +typedef struct prlistptr { /* list of pages selected for output */ + int pag; /* number of pages */ + bool all; /* pages in interval selected */ + struct prlistptr *prv; /* previous item in list */ + struct prlistptr *nxt; /* next item in list */ +} printlisttype; + +/*---------------------------------------------------------------------------*/ + +extern bool outputtofile; /* output to file or stdout(dvi2tty.c)*/ +extern bool pageswitchon; /* user-set pages to print(dvistuff.c)*/ +extern bool sequenceon; /* not TeX pagenrs (dvistuff.c) */ +extern bool scascii; /* Scand. nat. chars (dvistuff.c) */ +extern bool noffd; /* output ^L or formfeed (dvistuff.c) */ + +extern printlisttype *currentpage; /* current page to print (dvi2tty.c) */ +extern printlisttype *firstpage; /* first page selected (dvi2tty.c) */ +extern printlisttype *lastpage; /* last page selected (dvi2tty.c) */ + +extern int ttywidth; /* screen width (dvi2tty.c) */ +extern int espace; /* extra screen width (dvi2tty.c) */ +extern long foo; /* temporary 'register' (dvi2tty.c) */ +extern int opcode; /* dvi opcode (dvistuff.c) */ + +extern FILE *DVIfile; /* dvi file (dvi2tty.c) */ +extern FILE *output; /* output file (dvi2tty.c) */ + +/*---------------------------------------------------------------------------*/ + +/* dvi2tty.c */ +#if defined(KPATHSEA) +void errorexit P1H(int); +#else +#if defined(MSDOS) +void errorexit(int); +#else +void errorexit(); +#endif +#endif + +/* dvistuff.c */ +#if defined(KPATHSEA) +void dvimain P1H(void); +#else +#if defined(MSDOS) +void dvimain(void); +#else +void dvimain(); +#endif +#endif diff --git a/Build/source/texk/dvi2tty/dvi2tty.patch b/Build/source/texk/dvi2tty/dvi2tty.patch new file mode 100644 index 00000000000..392a419fc0b --- /dev/null +++ b/Build/source/texk/dvi2tty/dvi2tty.patch @@ -0,0 +1,91 @@ +The following are patches against the standard dvi2tty distribution (at +least as of March of 1996, but it doesn't look like it's going to be +changing any time in the near future). The original code doesn't +null-terminate a string at several points, apparently relying on the +assumption that all memory will be zeroed. This is not the case on +several systems, most notably Linux. These patches will also clean up the +Makefile and add a make clean target. + +To apply these patches, use: + + patch < dvi2tty.patch + +If you don't have patch on your system, you can obtain it from +prep.ai.mit.edu (or any mirror) in /pub/gnu; I highly recommend you +install it. Alternately, you can just make the below changes by hand +(there aren't very many). + +Feel free to send me questions, other problems, corrections, and the like, +but please be aware that I am not the official maintainer of this package, +and although I use it I do not know a lot about the internals. I'll try +to help, but don't expect too much. + + Russ Allbery + rra@cs.stanford.edu + +-------------------------------------------------------------------------- + +--- dvi2tty/Makefile.orig Fri Mar 12 01:05:10 1993 ++++ dvi2tty/Makefile Mon May 6 03:03:51 1996 +@@ -6,17 +6,20 @@ + # This Makefile does not work for MSDOS. Make your + # own one, or compile by hand. + # +-CFLAGS = ++CFLAGS = -O2 ++CC = gcc + + all: dvi2tty disdvi + +-dvi2tty:dvi2tty.o dvistuff.o +- cc -o dvi2tty dvi2tty.o dvistuff.o ++dvi2tty: dvi2tty.o dvistuff.o ++ $(CC) $(CFLAGS) -o dvi2tty dvi2tty.o dvistuff.o + +-disdvi:disdvi.c commands.h +- cc -o disdvi disdvi.o ++disdvi: disdvi.c commands.h ++ $(CC) $(CFLAGS) -o disdvi disdvi.c + + dvi2tty.o: dvi2tty.c dvi2tty.h + + dvistuff.o: dvistuff.c dvi2tty.h commands.h + ++clean: ++ rm -f dvi2tty disdvi *.o +--- dvi2tty/dvistuff.c.orig Fri Mar 12 01:05:35 1993 ++++ dvi2tty/dvistuff.c Mon May 6 04:48:49 1996 +@@ -996,13 +996,14 @@ + } + else + free(fnt->name); /* free old name */ +- if ((name = (char *) malloc(namelen * sizeof(char))) == NULL) { ++ if ((name = (char *) malloc((namelen + 1) * sizeof(char))) == NULL) { + perror("fontdef"); + exit(1); + } + + for (i = 0; i < namelen; i++) + name[i] = get1(); ++ name[namelen] = '\0'; + fnt->name = name; + if (new) { + fnt->next = fonts; +--- dvi2tty/disdvi.c.orig Fri Mar 12 01:05:11 1993 ++++ dvi2tty/disdvi.c Mon May 6 04:47:36 1996 +@@ -348,13 +348,14 @@ + } + else + free(fnt->name); /* free old name */ +- if ((name = (char *) malloc(namelen * sizeof(char))) == NULL) { ++ if ((name = (char *) malloc((namelen + 1) * sizeof(char))) == NULL) { + perror("fontdef"); + exit(1); + } + + for (i = 0; i < namelen; i++) + name[i] = get1(); ++ name[namelen] = '\0'; + fnt->name = name; + if (new) { + fnt->next = fonts; diff --git a/Build/source/texk/dvi2tty/dvistuff.c b/Build/source/texk/dvi2tty/dvistuff.c new file mode 100644 index 00000000000..7ee7c37ac8c --- /dev/null +++ b/Build/source/texk/dvi2tty/dvistuff.c @@ -0,0 +1,1180 @@ + +#include "dvi2tty.h" +#include <sys/types.h> +#include <sys/stat.h> +#if defined(VMS) +#include types.h +#include stat +#endif +#if defined(MSDOS) +#include <math.h> +#endif +#include "commands.h" + +#if defined(VMS) +#define mseek vmsseek +#define ROUND(a) (a>=0.0 ? (int) (a + 0.5) : (int) (a - 0.5) ) +#else +#define mseek fseek +#endif + +#define VERSIONID 2 /* dvi version number that pgm handles */ +#define VERTICALEPSILON 450000L /* crlf when increasing v more than this */ + +#define rightmargin 152 /* nr of columns allowed to the right of h=0*/ +#define leftmargin -50 /* give some room for negative h-coordinate */ +#define LINELEN 203 /* rightmargin - leftmargin + 1 */ + +#define MOVE TRUE /* if advancing h when outputing a rule */ +#define STAY FALSE /* if not advancing h when outputing a rule */ + +#define absolute 0 /* for seeking in files */ +#define relative 1 + +#define FORM 12 /* formfeed */ +#define SPACE 32 /* space */ +#define DEL 127 /* delete */ + +#define LASTCHAR 127 /* max dvi character, above are commands */ + +#define IMIN(a, b) (a<b ? a : b) +#define IMAX(a, b) (a>b ? a : b) + +#define get1() num(1) +#define get2() num(2) +#define get3() num(3) +#define get4() num(4) +#define sget1() snum(1) +#define sget2() snum(2) +#define sget3() snum(3) +#define sget4() snum(4) + +char *dvistuff = "@(#) dvistuff.c 4.1 27/03/90 M.J.E. Mol (c) 1989, 1990"; + +/*---------------------------------------------------------------------------*/ + +typedef struct { + long hh; + long vv; + long ww; + long xx; + long yy; + long zz; +} stackitem; + +typedef struct lineptr { /* the lines of text to be output to outfile */ + long vv; /* vertical position of the line */ + int charactercount; /* pos of last char on line */ + struct lineptr *prev; /* preceding line */ + struct lineptr *next; /* succeeding line */ + char text[LINELEN+1]; /* leftmargin...rightmargin */ +} linetype; + +typedef struct _font { + long num; + struct _font * next; + char * name; +} font; + + +/*---------------------------------------------------------------------------*/ + +bool pageswitchon; /* true if user-set pages to print */ +bool sequenceon; /* false if pagesw-nrs refers to TeX-nrs */ +bool scascii; /* if true make Scand. nat. chars right */ +bool noffd; /* if true output ^L instead of formfeed */ + +int opcode; /* dvi-opcodes */ + +long h, v; /* coordinates, horizontal and vertical */ +long w, x, y, z; /* horizontal and vertical amounts */ + +long pagecounter; /* sequence page number counter */ +long backpointer; /* pointer for offset to previous page */ +long pagenr; /* TeX page number */ +int stackmax; /* stacksize required */ + +long maxpagewidth; /* width of widest page in file */ +long charwidth; /* aprox width of character */ + +linetype * currentline; /* pointer to current line on current page */ +linetype * firstline; /* pointer to first line on current page */ +linetype * lastline; /* pointer to last line on current page */ +int firstcolumn; /* 1st column with something to print */ + +stackitem * stack; /* stack for dvi-pushes */ +int sptr; /* stack pointer */ + +font * fonts = NULL; /* List of fontnames defined */ +int symbolfont = FALSE; /* true if font is a symbol font */ + +/*---------------------------------------------------------------------------*/ + +#ifdef KPATHSEA +void postamble P1H(void); +void preamble P1H(void); +void walkpages P1H(void); +void initpage P1H(void); +void dopage P1H(void); +void skippage P1H(void); +void printpage P1H(void); +bool inlist P1H(long); +void rule P3H(bool, long, long); +void ruleaux P3H(long, long, char); +long horizontalmove P1H(long); +int skipnops P1H(void); +linetype * getline P1H(void); +linetype * findline P1H(void); +unsigned long num P1H(int); +long snum P1H(int); +void dochar P1H(char); +void symchar P1H(char); +void normchar P1H(char); +void outchar P1H(unsigned char); +void putcharacter P1H(long); +void setchar P1H(long); +void fontdef P1H(int); +void setfont P1H(long); +#else +# if defined(MSDOS) +void postamble (void); +void preamble (void); +void walkpages (void); +void initpage (void); +void dopage (void); +void skippage (void); +void printpage (void); +bool inlist (long); +void rule (bool, long, long); +void ruleaux (long, long, char); +long horizontalmove (long); +int skipnops (void); +linetype * getline (void); +linetype * findline (void); +unsigned long num (int); +long snum (int); +void dochar (char); +void symchar (char); +void normchar (char); +void outchar (unsigned char); +void putcharacter (long); +void setchar (long); +void fontdef (int); +void setfont (long); +#else +void postamble (); +void preamble (); +void walkpages (); +void initpage (); +void dopage (); +void skippage (); +void printpage (); +bool inlist (); +void rule (); +void ruleaux (); +long horizontalmove (); +int skipnops (); +linetype * getline (); +linetype * findline (); +unsigned long num (); +long snum (); +void dochar (); +void symchar (); +void normchar (); +void outchar (); +void putcharacter (); +void setchar (); +void fontdef (); +void setfont (); +#if defined(VMS) +long vmsseek (); +long vms_ftell (); +long vms_ungetc (); +#endif +#endif +#endif + +/*---------------------------------------------------------------------------*/ +/*---------------------------------------------------------------------------*/ + +/* + * The main function for processing the dvi file. + * Here we assume there are to file pointers: DVIfile and output. + * Also we have a list of pages pointed to by 'currentpage', + * which is only used (in 'inlist()') when a page list is given. + */ + +void dvimain() +{ + + postamble(); /* seek and process the postamble */ + /* note that walkpages *must* immediately follow preamble */ + preamble(); /* process preamble */ + walkpages(); /* time to do the actual work! */ + +} /* dvimain */ + +/*---------------------------------------------------------------------------*/ + +void postamble() /* find and process postamble, use random access */ +{ + register long size; + register int count; + struct stat st; + + fstat (fileno(DVIfile), &st); + size = (long) st.st_size; /* get size of file */ + count = -1; + do { /* back file up past signature bytes (223), to id-byte */ + if (size == 0) + errorexit(nopst); + size--; + mseek(DVIfile, size, absolute); + opcode = (int) get1(); + count++; + } while (opcode == TRAILER); + if (count < 4) { /* must have 4 trailer bytes */ + foo = count; + errorexit(fwsgn); + } + if (opcode != VERSIONID) + errorexit(badid); + mseek(DVIfile, size-4, absolute); /* back up to back-pointer */ + mseek(DVIfile, sget4(), absolute); /* and to start of postamble */ + if (get1() != POST) + errorexit(nopst); + mseek(DVIfile, 20L, relative); /* lastpageoffset, numerator, denominator */ + /* magnification, maxpageheight */ + maxpagewidth = sget4(); + charwidth = maxpagewidth / (ttywidth + espace); + stackmax = (int) get2(); + if ((stack = (stackitem *) malloc(stackmax * sizeof(stackitem))) == NULL) + errorexit(stkrq); + + /* get2() -- totalpages */ + /* fontdefs do fontdefs in flight ... */ + +} /* postamble */ + +/*---------------------------------------------------------------------------*/ + +void preamble() /* process preamble, use random access */ +{ + + mseek(DVIfile, 0L, absolute); /* read the dvifile from the start */ + if ((opcode = skipnops()) != PRE) + errorexit(nopre); + opcode = (int) get1(); /* check id in preamble, ignore rest of it */ + if (opcode != VERSIONID) + errorexit(badid); + mseek(DVIfile, 12L, relative); /* numerator, denominator, magnification */ + mseek(DVIfile, get1(), relative); /* skip job identification */ + +} /* preamble */ + +/*----------------------------------------------------------------------------*/ + +void walkpages() /* process the pages in the DVI-file */ +{ + register bool wantpage; + + pagecounter = 0L; + while ((opcode = skipnops()) != POST) { + if (opcode != BOP) /* should be at start of page now */ + errorexit(nobop); + else { + pagecounter++; + pagenr = sget4(); /* get TeX page number */ + mseek(DVIfile, 36L, relative); /* skip page header */ + backpointer = sget4(); /* get previous page offset */ + if (pageswitchon) + if (sequenceon) + wantpage = inlist(pagecounter); + else + wantpage = inlist(pagenr); + else + wantpage = TRUE; + + if (wantpage) { + initpage(); + dopage(); + printpage(); + } + else { + skippage(); + } + } + } + +} /* walkpages */ + +/*---------------------------------------------------------------------------*/ + +void initpage() +{ + + h = 0L; v = 0L; /* initialize coordinates */ + x = 0L; w = 0L; y = 0L; z = 0L; /* initialize amounts */ + sptr = 0; /* initialize stack */ + currentline = getline(); /* initialize list of lines */ + currentline->vv = 0L; + firstline = currentline; + lastline = currentline; + firstcolumn = rightmargin; + if (pageswitchon) { + if ((sequenceon && (pagecounter != firstpage->pag)) || + (!sequenceon && (pagenr != firstpage->pag))) { + if (noffd) + fprintf(output, "^L\n"); + else + putc(FORM, output); + } + } + else + if (backpointer != -1) { /* not FORM at first page */ + if (noffd) + fprintf(output, "^L\n"); + else + putc(FORM, output); + } + +} /* initpage */ + +/*----------------------------------------------------------------------------*/ + +void dopage() +{ + + while ((opcode = (int) get1()) != EOP) { /* process page until eop */ + if (opcode <= LASTCHAR) + dochar((char) opcode); + else if ((opcode >= FONT_00) && (opcode <= FONT_63)) + setfont(opcode - FONT_00); + else if (opcode > POST_POST) + errorexit(illop); + else + switch (opcode) { + case SET1 : setchar(get1()); break; + case SET2 : setchar(get2()); break; + case SET3 : setchar(get3()); break; + case SET4 : setchar(get4()); break; + case SET_RULE : { long height = sget4(); + rule(MOVE, sget4(), height); break; + } + case PUT1 : putcharacter(get1()); break; + case PUT2 : putcharacter(get2()); break; + case PUT3 : putcharacter(get3()); break; + case PUT4 : putcharacter(get4()); break; + case PUT_RULE : { long height = sget4(); + rule(STAY, sget4(), height); break; + } + case NOP : break; /* no-op */ + case BOP : errorexit(bdbop); break; +/* case EOP : break; strange place to have EOP */ + case PUSH : if (sptr >= stackmax) /* push */ + errorexit(stkof); + stack[sptr].hh = h; + stack[sptr].vv = v; + stack[sptr].ww = w; + stack[sptr].xx = x; + stack[sptr].yy = y; + stack[sptr].zz = z; + sptr++; + break; + case POP : if (sptr == 0) /* pop */ + errorexit(stkuf); + sptr--; + h = stack[sptr].hh; + v = stack[sptr].vv; + w = stack[sptr].ww; + x = stack[sptr].xx; + y = stack[sptr].yy; + z = stack[sptr].zz; + break; + case RIGHT1 : (void) horizontalmove(sget1()); break; + case RIGHT2 : (void) horizontalmove(sget2()); break; + case RIGHT3 : (void) horizontalmove(sget3()); break; + case RIGHT4 : (void) horizontalmove(sget4()); break; + case W0 : h += w; break; + case W1 : w = horizontalmove(sget1()); break; + case W2 : w = horizontalmove(sget2()); break; + case W3 : w = horizontalmove(sget3()); break; + case W4 : w = horizontalmove(sget4()); break; + case X0 : h += x; break; + case X1 : x = horizontalmove(sget1()); break; + case X2 : x = horizontalmove(sget2()); break; + case X3 : x = horizontalmove(sget3()); break; + case X4 : x = horizontalmove(sget4()); break; + case DOWN1 : v += sget1(); break; + case DOWN2 : v += sget2(); break; + case DOWN3 : v += sget3(); break; + case DOWN4 : v += sget4(); break; + case Y0 : v += y; break; + case Y1 : y = sget1(); v += y; break; + case Y2 : y = sget2(); v += y; break; + case Y3 : y = sget3(); v += y; break; + case Y4 : y = sget4(); v += y; break; + case Z0 : v += z; break; + case Z1 : z = sget1(); v += z; break; + case Z2 : z = sget2(); v += z; break; + case Z3 : z = sget3(); v += z; break; + case Z4 : z = sget4(); v += z; break; + case FNT1 : + case FNT2 : + case FNT3 : + case FNT4 : setfont(num(opcode - FNT1 + 1)); + break; + case XXX1 : mseek(DVIfile, get1(), relative); break; + case XXX2 : mseek(DVIfile, get2(), relative); break; + case XXX3 : mseek(DVIfile, get3(), relative); break; + case XXX4 : mseek(DVIfile, get4(), relative); break; + case FNT_DEF1 : + case FNT_DEF2 : + case FNT_DEF3 : + case FNT_DEF4 : fontdef(opcode - FNT_DEF1 + 1); + break; + case PRE : errorexit(bdpre); break; + case POST : errorexit(bdpst); break; + case POST_POST: errorexit(bdpp); break; + } + } + +} /* dopage */ + +/*----------------------------------------------------------------------------*/ + +void skippage() /* skip past one page */ +{ + register int opcode; + + while ((opcode = (int) get1()) != EOP) { + if (opcode > POST_POST) + errorexit(illop); + else + switch (opcode) { + case SET1 : + case PUT1 : + case RIGHT1 : + case W1 : + case X1 : + case DOWN1 : + case Y1 : + case Z1 : /* assume FNT change can also be skipped */ + case FNT1 : mseek(DVIfile, 1L, relative); break; + case SET2 : + case PUT2 : + case RIGHT2 : + case W2 : + case X2 : + case DOWN2 : + case Y2 : + case Z2 : + case FNT2 : mseek(DVIfile, 2L, relative); break; + case SET3 : + case PUT3 : + case RIGHT3 : + case W3 : + case X3 : + case DOWN3 : + case Y3 : + case Z3 : + case FNT3 : mseek(DVIfile, 3L, relative); break; + case SET4 : + case PUT4 : + case RIGHT4 : + case W4 : + case X4 : + case DOWN4 : + case Y4 : + case Z4 : + case FNT4 : mseek(DVIfile, 4L, relative); break; + case SET_RULE : + case PUT_RULE : mseek(DVIfile, 8L, relative); break; + case BOP : errorexit(bdbop); break; + case XXX1 : mseek(DVIfile, get1(), relative); break; + case XXX2 : mseek(DVIfile, get2(), relative); break; + case XXX3 : mseek(DVIfile, get3(), relative); break; + case XXX4 : mseek(DVIfile, get4(), relative); break; + case FNT_DEF1 : + case FNT_DEF2 : + case FNT_DEF3 : + case FNT_DEF4 : fontdef(opcode - FNT_DEF1 + 1); break; + case PRE : errorexit(bdpre); break; + case POST : errorexit(bdpst); break; + case POST_POST: errorexit(bdpp); break; + } + } + +} /* skippage */ + +/*---------------------------------------------------------------------------*/ + +void printpage() /* 'end of page', writes lines of page to output file */ +{ + register int i, j; + register unsigned char ch; + + if (sptr != 0) + fprintf(stderr, "dvi2tty: warning - stack not empty at eop.\n"); + for (currentline = firstline; currentline != nil; + currentline = currentline->next) { + if (currentline != firstline) { + foo = ((currentline->vv - currentline->prev->vv)/VERTICALEPSILON)-1; + if (foo > 3) + foo = 3; /* linespacings not too large */ + for (i = 1; i <= (int) foo; i++) + putc('\n', output); + } + if (currentline->charactercount >= leftmargin) { + foo = ttywidth - 2; + for (i = firstcolumn, j = 1; i <= currentline->charactercount; + i++, j++) { + ch = currentline->text[i - leftmargin]; + if (ch >= SPACE) + putc(ch, output); + if ((j > (int) foo) && (currentline->charactercount > i+1)) { + fprintf(output, "*\n"); /* if line to large */ + fprintf(output, " *"); /* mark output */ + j = 2; + } + } + } + putc('\n', output); + } + + currentline = firstline; + while (currentline->next != nil) { + currentline = currentline->next; + free(currentline->prev); + } + free(currentline); /* free last line */ + currentline = nil; + +} /* printpage */ + +/*----------------------------------------------------------------------------*/ + +bool inlist(pagenr) /* ret true if in list of pages */ +register long pagenr; +{ + + while ((currentpage->pag < 0) && (currentpage->pag != pagenr) && + !currentpage->all && (currentpage->nxt != nil)) + currentpage = currentpage->nxt; + if ((currentpage->all && (pagenr < currentpage->pag)) || + (currentpage->pag == pagenr)) + return TRUE; + else if (pagenr > 0) { + while ((currentpage->pag < pagenr) && (currentpage->nxt != nil)) + currentpage = currentpage->nxt; + if (currentpage->pag == pagenr) + return TRUE; + } + return FALSE; + +} /* inlist */ + +/*----------------------------------------------------------------------------*/ + +void rule(bool moving, long rulewt, long ruleht) +{ /* output a rule (vertical or horizontal), increment h if moving is true */ + + register char ch; /* character to set rule with */ + register long saveh = 0, savev; + /* rule -- starts up the recursive routine */ + if (!moving) + saveh = h; + if ((ruleht <= 0) || (rulewt <= 0)) + h += rulewt; + else { + savev = v; + if ((ruleht / rulewt) > 0) /* value < 1 truncates to 0 */ + ch = '|'; + else if (ruleht > (VERTICALEPSILON / 2)) + ch = '='; + else + ch = '_'; + ruleaux(rulewt, ruleht, ch); + v = savev; + } + if (!moving) + h = saveh; + +} /* rule */ + + + +void ruleaux(long rulewt, long ruleht, char ch) /* recursive that does the job */ +{ + register long wt, lmh, rmh; + + wt = rulewt; + lmh = h; /* save left margin */ + if (h < 0) { /* let rules that start at negative h */ + wt -= h; /* start at coordinate 0, but let it */ + h = 0; /* have the right length */ + } + while (wt > 0) { /* output the part of the rule that */ + rmh = h; /* goes on this line */ + outchar(ch); + wt -= (h-rmh); /* decrease the width left on line */ + } + ruleht -= VERTICALEPSILON; /* decrease the height */ + if (ruleht > VERTICALEPSILON) { /* still more vertical? */ + rmh = h; /* save current h (right margin) */ + h = lmh; /* restore left margin */ + v -= (VERTICALEPSILON + VERTICALEPSILON / 10); + ruleaux(rulewt, ruleht, ch); + h = rmh; /* restore right margin */ + } + +} /* ruleaux */ + +/*----------------------------------------------------------------------------*/ + +long horizontalmove(amount) +register long amount; +{ + +#if defined(MSDOS) + if (labs(amount) > charwidth / 4L) { +#else + if (abs(amount) > charwidth / 4L) { +#endif + foo = 3*charwidth / 4; + if (amount > 0) + amount = ((amount+foo) / charwidth) * charwidth; + else +#if defined(VMS) + amount = (ROUND( (float) (amount-foo) / charwidth) + 1)* charwidth; +#else + amount = ((amount-foo) / charwidth) * charwidth; +#endif + h += amount; + return amount; + } + else + return 0; + +} /* horizontalmove */ + +/*----------------------------------------------------------------------------*/ + +int skipnops() /* skips by no-op commands */ +{ + register int opcode; + + while ((opcode = (int) num(1)) == NOP); + return opcode; + +} /* skipnops */ + +/*----------------------------------------------------------------------------*/ + +linetype *getline() /* returns an initialized line-object */ +{ + register int i; + register linetype *temp; + + if ((temp = (linetype *) malloc(sizeof(linetype))) == NULL) + errorexit(lnerq); + temp->charactercount = leftmargin - 1; + temp->prev = nil; + temp->next = nil; + for (i = 0; i < LINELEN; i++) + temp->text[i] = ' '; + temp->text[i] = '\0'; + return temp; + +} /* getline */ + +/*----------------------------------------------------------------------------*/ + +linetype *findline() /* find best fit line were text should go */ +{ /* and generate new line if needed */ + register linetype *temp; + register long topd, botd; + + if (v <= firstline->vv) { /* above first line */ + if (firstline->vv - v > VERTICALEPSILON) { + temp = getline(); + temp->next = firstline; + firstline->prev = temp; + temp->vv = v; + firstline = temp; + } + return firstline; + } + + if (v >= lastline->vv) { /* below last line */ + if (v - lastline->vv > VERTICALEPSILON) { + temp = getline(); + temp->prev = lastline; + lastline->next = temp; + temp->vv = v; + lastline = temp; + } + return lastline; + } + + temp = lastline; /* in between two lines */ + while ((temp->vv > v) && (temp != firstline)) + temp = temp->prev; + + /* temp->vv < v < temp->next->vv --- temp is above, temp->next is below */ + topd = v - temp->vv; + botd = temp->next->vv - v; + if ((topd < VERTICALEPSILON) || (botd < VERTICALEPSILON)) { + if (topd < botd) /* take best fit */ + return temp; + else + return temp->next; + } + + /* no line fits suitable, generate a new one */ + currentline = getline(); + currentline->next = temp->next; + currentline->prev = temp; + temp->next->prev = currentline; + temp->next = currentline; + currentline->vv = v; + return currentline; + +} /* findline */ + +/*----------------------------------------------------------------------------*/ + +unsigned long num(size) +register int size; +{ + register int i; + register long x = 0; + + for (i = 0; i < size; i++) + x = (x << 8) + (unsigned) getc(DVIfile); + return x; + +} /* num */ + + +long snum(size) +register int size; +{ + register int i; + register long x = 0; + + x = getc(DVIfile); + if (x & 0x80) + x -= 0x100; + for (i = 1; i < size; i++) + x = (x << 8) + (unsigned) getc(DVIfile); + return x; + +} /* snum */ + +/*----------------------------------------------------------------------------*/ + +void dochar(char ch) +{ + + if (symbolfont == TRUE) + symchar(ch); + else + normchar(ch); + + return; + +} /* dochar */ + + + +void symchar(char ch) /* output ch to appropriate line */ +{ + + switch (ch) { /* can do a lot more on MSDOS machines ... */ + case 0: ch = '-'; break; + case 1: ch = '.'; break; + case 2: ch = 'x'; break; + case 3: ch = '*'; break; + case 13: ch = 'O'; break; + case 14: ch = 'O'; break; + case 15: ch = 'o'; break; + case 24: ch = '~'; break; + case 102: ch = '{'; break; + case 103: ch = '}'; break; + case 104: ch = '<'; break; + case 105: ch = '>'; break; + case 106: ch = '|'; break; + case 110: ch = '\\'; break; + } + outchar(ch); + + return; + +} /* symchar */ + + + +void normchar(char ch) +{ + + switch (ch) { + case 11 : outchar('f'); ch = 'f'; break; /* ligature */ + case 12 : outchar('f'); ch = 'i'; break; /* ligature */ + case 13 : outchar('f'); ch = 'l'; break; /* ligature */ + case 14 : outchar('f'); outchar('f'); + ch = 'i'; break; /* ligature */ + case 15 : outchar('f'); outchar('f'); + ch = 'l'; break; /* ligature */ + case 16 : ch = 'i'; break; + case 17 : ch = 'j'; break; + case 25 : if (scascii) /* German sz ligature */ + ch = 0xdf; + else + {outchar('s'); ch = 's';} + break; + case 26 : if (scascii) /* Dane/Norw ae */ + ch = 0xe6; + else + {outchar('a'); ch = 'e';} + break; + case 27 : outchar('o'); ch = 'e'; break; /* Dane/Norw oe */ + case 28 : if (scascii) /* Dane/Norw /o */ + ch = 0xf8; + else + ch = 'o'; + break; + case 29 : if (scascii) /* Dane/Norw AE */ + ch = 0xc6; + else + {outchar('A'); ch = 'E';} + break; + case 30 : outchar('O'); ch = 'E'; break; /* Dane/Norw OE */ + case 31 : if (scascii) + ch = 0xd8; /* Dane/Norw /O */ + else + ch = 'O'; + break; + case 92 : ch = '"'; break; /* \ from `` */ + case 123 : ch = '-'; break; /* { from -- */ + case 124 : ch = '_'; break; /* | from --- */ + case 125 : ch = '"'; break; /* } from \H */ + case 126 : ch = '"'; break; /* ~ from \~ */ + case 127 : ch = '"'; break; /* DEL from \" */ +#if 0 + case 18 : ch = '`'; break /* from \` */ + case 19 : ch = ''''; break /* from \' */ + case 20 : ch = '~'; break /* from \v */ + case 21 : ch = '~'; break /* from \u */ + case 22 : ch = '~'; break /* from \= */ + case 24 : ch = ','; break /* from \c */ + case 94 : ch = '^'; break /* ^ from \^ */ + case 95 : ch = '`'; break /* _ from \. */ +#endif + } + outchar(ch); + + return; + +} /*normchar */ + + + +void outchar(unsigned char ch) /* output ch to appropriate line */ +{ + register int i, j; + +#if defined(MSDOS) + if (labs(v - currentline->vv) > VERTICALEPSILON / 2L) +#else + if (abs(v - currentline->vv) > VERTICALEPSILON / 2L) +#endif + currentline = findline(); + +#if 0 + j = (int) (((double) h / (double) maxpagewidth) * (ttywidth-1)) + 1; +#else + j = (int) (h / charwidth); +#endif + if (j > rightmargin) /* leftmargin <= j <= rightmargin */ + j = rightmargin; + else if (j < leftmargin) + j = leftmargin; + foo = leftmargin - 1; + /* + * This code does not really belong here ... + * + *-------------------------------------------------------------* + * The following is very specialized code, it handles some eu- * + * ropean characters. These are: a, o, u with two dots ("a & * + * "o & "u), and a with a circle (Oa). TeX outputs these by * + * first issuing the dots or circle and then backspace and set * + * the a, o, or u. When dvitty finds an a, o, or u it sear- * + * ches in the near vicinity for the character codes that re- * + * present circle or dots and if one is found the correspon- * + * ding Latin-1 character replaces the special character code. * + *-------------------------------------------------------------*/ + if (scascii) { + if ((ch == 'a') || (ch == 'A') || (ch == 'o') || (ch == 'O') || + (ch == 'u') || (ch == 'U')) { + for (i = IMAX(leftmargin, j-2); + i <= IMIN(rightmargin, j+2); + i++) + if ((currentline->text[i - leftmargin] == 127) || + (currentline->text[i - leftmargin] == 34) || + (currentline->text[i - leftmargin] == 23)) + foo = i; + if (foo >= leftmargin) { + j = (int) foo; + switch (currentline->text[j - leftmargin]) { + case 127 : case 34: + if (ch == 'a') + ch = 0xe4; + else if (ch == 'A') /* dots ... */ + ch = 0xc4; + else if (ch == 'o') + ch = 0xf6; + else if (ch == 'O') + ch = 0xd6; + else if (ch == 'u') + ch = 0xfc; + else if (ch == 'U') + ch = 0xdc; + break; + case 23 : if (ch == 'a') + ch = 0xe5; + else if (ch == 'A') /* circle */ + ch = 0xc5; + break; + } + } + } + } + /*----------------- end of 'Scandinavian code' ----------------*/ + if (foo == leftmargin-1) + while ((currentline->text[j - leftmargin] != SPACE) + && (j < rightmargin)) { + j++; + h += charwidth; + } + if ( ((ch >= SPACE) && (ch != DEL)) || + (scascii && (ch == 23)) ) { + /* (scascii && (ch == DEL)) ) { if VMS ??? */ + if (j < rightmargin) + currentline->text[j - leftmargin] = ch; + else + currentline->text[rightmargin - leftmargin] = '@'; + if (j > currentline->charactercount) + currentline->charactercount = j; + if (j < firstcolumn) + firstcolumn = j; + h += charwidth; + } + +} /* outchar */ + +/*----------------------------------------------------------------------------*/ + +void putcharacter(charnr) /* output character, don't change h */ +register long charnr; +{ + register long saveh; + + saveh = h; + if ((charnr >= 0) && (charnr <= LASTCHAR)) + outchar((char) charnr); + else + setchar(charnr); + h = saveh; + +} /* putcharacter */ + +/*----------------------------------------------------------------------------*/ + +void setchar(charnr) +long charnr; +{ /* should print characters with character code>127 from current font */ + /* note that the parameter is a dummy, since ascii-chars are<=127 */ + + outchar((unsigned char)(charnr)); + +} /* setchar */ + + +/*----------------------------------------------------------------------------*/ + + +void fontdef(x) +register int x; +{ + register int i; + char * name; + font * fnt; + int namelen; + long fntnum; + int new = 0; + + fntnum = num(x); + (void) get4(); /* checksum */ + (void) get4(); /* scale */ + (void) get4(); /* design */ + namelen = (int) get1() + (int) get1(); + fnt = fonts; + while (fnt != NULL && fnt->num != fntnum) /* does fontnum exist */ + fnt = fnt->next; + if (fnt == NULL) { + if ((fnt = (font *) malloc(sizeof(font))) == NULL) { + perror("fontdef"); + exit(1); + } + fnt->num = fntnum; + new = 1; + } + else + free(fnt->name); /* free old name */ + if ((name = (char *) malloc((namelen+1) * sizeof(char))) == NULL) { + perror("fontdef"); + exit(1); + } + + for (i = 0; i < namelen; i++) + name[i] = get1(); + name[namelen] = '\0'; + fnt->name = name; + if (new) { + fnt->next = fonts; + fonts = fnt; + } + + return; + +} /* fontdef */ + + + +void setfont(fntnum) +long fntnum; +{ + font * fnt; + char * s; + + fnt = fonts; + while (fnt != NULL && fnt->num != fntnum) + fnt = fnt->next; + if (fnt == NULL) { + /* error : font not found */ + symbolfont = FALSE; + return; + } + + s = fnt->name; + while ((s = strchr(s, 's')) != NULL) { + if (strncmp("sy", s, 2) == 0) { + symbolfont = TRUE; + return; + } + s++; /* New line to fix bug; font names with 's' would hang */ + } + + symbolfont = FALSE; + return; + +} /* setfont */ + + + +/*----------------------------------------------------------------------------*/ + + +#if defined(VMS) +long vmsseek(fp,n,dir) +FILE *fp; +long n; +long dir; +{ + long k,m,pos,val,oldpos; + struct stat buffer; + + for (;;) { /*loops only once or twice*/ + switch (dir) { + case 0: /*from BOF*/ + oldpos = vms_ftell(fp); + k = n & 511; + m = n >> 9; + if (((*fp)->_cnt) && ((oldpos >> 9) == m)) { + val = 0; /* still in */ + (*fp)->_ptr = ((*fp)->_base) + k; + (*fp)->_cnt = 512 - k; + } + else { + val = fseek(fp, m << 9, 0); + if (val == 0) { + (*fp)->_cnt = 0; + (void) fgetc(fp); + (*fp)->_ptr = ((*fp)->_base) + k; + (*fp)->_cnt = 512 - k; + } + } + return(val); + + case 1: pos = vms_ftell(fp); + if (pos == EOF) + return (EOF); + n += pos; + dir = 0; + break; + + case 2: val = fstat(fileno(fp), &buffer); + if (val == EOF) + return (EOF); + n += buffer.st_size - 1; + + dir = 0; + break; + + default : return (EOF); + } + } + +} /* vmsseek */ + + + +long vms_ftell(fp) +FILE *fp; +{ + char c; + long pos; + long val; + if ((*fp)->_cnt == 0) { + c = fgetc(fp); + val = vms_ungetc(c, fp); + if (val != c) + return (EOF); + } + pos = ftell(fp); + if (pos >= 0) + pos += ((*fp)->_ptr) - ((*fp)->_base); + return (pos); + +} /* vms_ftell */ + + + +long vms_ungetc(c,fp) +char c; +FILE *fp; +{ + if ((c == EOF) && feof(fp)) + return (EOF); + else if ((*fp)->_cnt >= 512) + return (EOF); + else { + (*fp)->_cnt++; + (*fp)->_ptr--; + *((*fp)->_ptr) = c; + return (c); + } + +} /*vms_ungetc */ +#endif diff --git a/Build/source/texk/dvi2tty/win32.mak b/Build/source/texk/dvi2tty/win32.mak new file mode 100644 index 00000000000..766ffca3b2c --- /dev/null +++ b/Build/source/texk/dvi2tty/win32.mak @@ -0,0 +1,52 @@ +################################################################################ +# +# Makefile : Dvi2tty +# Author : Fabrice Popineau <Fabrice.Popineau@supelec.fr> +# Platform : Win32, Microsoft VC++ 6.0, depends upon fpTeX 0.5 sources +# Time-stamp: <02/02/02 00:37:46 popineau> +# +################################################################################ +root_srcdir = ..\.. +!ifdef DEVELOPMENT +INCLUDE=$(INCLUDE);$(root_srcdir)\texk.development +!else +INCLUDE=$(INCLUDE);$(root_srcdir)\texk +!endif +# +# For BSD Unix use the following CFLAGS definition +# CFLAGS = -Dstrchr=index +# +# This Makefile does not work for MSDOS. Make your +# own one, or compile by hand. +# + +USE_KPATHSEA = 1 +USE_GNUW32 = 1 + +!include <msvc/common.mak> + +objects = $(objdir)\dvi2tty.obj $(objdir)\disdvi.obj +programs = $(objdir)\dvi2tty.exe $(objdir)\disdvi.exe +manfiles = dvi2tty.1 + +all: $(objdir) $(programs) + +$(objdir)\dvi2tty.exe: $(objdir)\dvi2tty.obj $(objdir)\dvistuff.obj $(kpathsealib) + $(link) $(**) $(conlibs) + +$(objdir)\disdvi.exe: $(objdir)\disdvi.obj $(kpathsealib) + $(link) $(**) $(conlibs) + +!include <msvc/config.mak> +!include <msvc/install.mak> + +install:: install-exec install-man + +!include <msvc/clean.mak> +!include <msvc/rdepend.mak> +!include "./depend.mak" + +# +# Local Variables: +# mode: makefile +# End: |